0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-24 16:29:46 +01:00

Merge remote-tracking branch 'origin/version-4' into sites

This commit is contained in:
Puru Vijay 2023-05-25 16:30:20 +05:30
commit ad949c5490
132 changed files with 103181 additions and 932 deletions

20
.gitignore vendored
View File

@ -4,17 +4,17 @@
node_modules
*.map
/src/compiler/compile/internal_exports.js
/src/shared/version.js
/compiler.d.ts
/compiler.*js
/index.*js
/ssr.*js
/action
/internal
/store
/easing
/motion
/transition
/animate
/compiler.cjs
/index.d.ts
/action.d.ts
/internal.d.ts
/store.d.ts
/easing.d.ts
/motion.d.ts
/transition.d.ts
/animate.d.ts
/scratch/
/test/*/samples/_
/test/runtime/shards

View File

@ -3,6 +3,7 @@
!/scripts
!/src
src/compiler/compile/internal_exports.js
src/shared/version.js
!/test
!documentation
!sites
@ -12,4 +13,5 @@ src/compiler/compile/internal_exports.js
/test/**/expected*
/test/**/_output
/types
!rollup.config.js
!vitest.config.js

View File

@ -7,6 +7,7 @@
* **breaking** Bundlers must specify the `browser` condition when building a frontend bundle for the browser ([#8516](https://github.com/sveltejs/svelte/pull/8516))
* **breaking** Minimum supported vite-plugin-svelte version is now 2.1.1. SvelteKit users can upgrade to 1.15.9 or newer to ensure a compatible version ([#8516](https://github.com/sveltejs/svelte/pull/8516))
* **breaking** Minimum supported TypeScript version is now TypeScript 5 (it will likely work with lower versions, but we make no guarantees about that) ([#8488](https://github.com/sveltejs/svelte/pull/8488))
* **breaking** Remove `svelte/register` hook, CJS runtime version and CJS compiler output ([#8613](https://github.com/sveltejs/svelte/pull/8613))
* **breaking** Stricter types for `createEventDispatcher` (see PR for migration instructions) ([#7224](https://github.com/sveltejs/svelte/pull/7224))
* **breaking** Stricter types for `Action` and `ActionReturn` (see PR for migration instructions) ([#7224](https://github.com/sveltejs/svelte/pull/7224))
* **breaking** Stricter types for `onMount` - now throws a type error when returning a function asynchronously to catch potential mistakes around callback functions (see PR for migration instructions) ([#8136](https://github.com/sveltejs/svelte/pull/8136))
@ -14,6 +15,8 @@
* **breaking** Deprecate `SvelteComponentTyped`, use `SvelteComponent` instead ([#8512](https://github.com/sveltejs/svelte/pull/8512))
* **breaking** Error on falsy values instead of stores passed to `derived` ([#7947](https://github.com/sveltejs/svelte/pull/7947))
* **breaking** Custom store implementers now need to pass an `update` function additionally to the `set` function ([#6750](https://github.com/sveltejs/svelte/pull/6750))
* **breaking** Change order in which preprocessors are applied ([#8618](https://github.com/sveltejs/svelte/pull/8618))
* Add a way to modify attributes for script/style preprocessors ([#8618](https://github.com/sveltejs/svelte/pull/8618))
* Improve hydration speed by adding `data-svelte-h` attribute to detect unchanged HTML elements ([#7426](https://github.com/sveltejs/svelte/pull/7426))
* Add `a11y no-noninteractive-element-interactions` rule ([#8391](https://github.com/sveltejs/svelte/pull/8391))
* Add `a11y-no-static-element-interactions`rule ([#8251](https://github.com/sveltejs/svelte/pull/8251))

1
action/index.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from '../types/runtime/action/index.js';

2
action/index.js Normal file
View File

@ -0,0 +1,2 @@
'use strict';

1
action/index.mjs Normal file
View File

@ -0,0 +1 @@

5
action/package.json Normal file
View File

@ -0,0 +1,5 @@
{
"main": "./index",
"module": "./index.mjs",
"types": "./index.d.ts"
}

1
animate/index.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from '../types/runtime/animate/index.js';

33
animate/index.js Normal file
View File

@ -0,0 +1,33 @@
'use strict';
var easing = require('../easing/index.js');
var Component = require('../internal/Component-9c4b98a2.js');
/**
* @param {Element} node
* @param {{ from: DOMRect; to: DOMRect }} fromTo
* @param {import('./public.js').FlipParams} params
* @returns {import('./public.js').AnimationConfig}
*/
function flip(node, { from, to }, params = {}) {
const style = getComputedStyle(node);
const transform = style.transform === 'none' ? '' : style.transform;
const [ox, oy] = style.transformOrigin.split(' ').map(parseFloat);
const dx = from.left + (from.width * ox) / to.width - (to.left + ox);
const dy = from.top + (from.height * oy) / to.height - (to.top + oy);
const { delay = 0, duration = (d) => Math.sqrt(d) * 120, easing: easing$1 = easing.cubicOut } = params;
return {
delay,
duration: Component.is_function(duration) ? duration(Math.sqrt(dx * dx + dy * dy)) : duration,
easing: easing$1,
css: (t, u) => {
const x = u * dx;
const y = u * dy;
const sx = t + (u * from.width) / to.width;
const sy = t + (u * from.height) / to.height;
return `transform: ${transform} translate(${x}px, ${y}px) scale(${sx}, ${sy});`;
}
};
}
exports.flip = flip;

31
animate/index.mjs Normal file
View File

@ -0,0 +1,31 @@
import { cubicOut } from '../easing/index.mjs';
import { is_function } from '../internal/Component-cd97939e.mjs';
/**
* @param {Element} node
* @param {{ from: DOMRect; to: DOMRect }} fromTo
* @param {import('./public.js').FlipParams} params
* @returns {import('./public.js').AnimationConfig}
*/
function flip(node, { from, to }, params = {}) {
const style = getComputedStyle(node);
const transform = style.transform === 'none' ? '' : style.transform;
const [ox, oy] = style.transformOrigin.split(' ').map(parseFloat);
const dx = from.left + (from.width * ox) / to.width - (to.left + ox);
const dy = from.top + (from.height * oy) / to.height - (to.top + oy);
const { delay = 0, duration = (d) => Math.sqrt(d) * 120, easing = cubicOut } = params;
return {
delay,
duration: is_function(duration) ? duration(Math.sqrt(dx * dx + dy * dy)) : duration,
easing,
css: (t, u) => {
const x = u * dx;
const y = u * dy;
const sx = t + (u * from.width) / to.width;
const sy = t + (u * from.height) / to.height;
return `transform: ${transform} translate(${x}px, ${y}px) scale(${sx}, ${sy});`;
}
};
}
export { flip };

5
animate/package.json Normal file
View File

@ -0,0 +1,5 @@
{
"main": "./index",
"module": "./index.mjs",
"types": "./index.d.ts"
}

View File

@ -1,4 +0,0 @@
if (!process.env.PUBLISH) {
console.error('npm publish must be run with the PUBLISH environment variable set');
process.exit(1);
}

View File

@ -1,47 +0,0 @@
import { existsSync, fstat, readFileSync, readdirSync, writeFileSync } from 'fs';
import { resolve } from 'path';
import { parse } from 'acorn';
import { walk } from 'estree-walker';
import { inspect } from 'util';
import { p, print } from 'code-red';
const samples = resolve(`vitest/runtime/runtime/samples`);
for (const dir of readdirSync(samples)) {
const cwd = resolve(samples, dir);
const file = resolve(cwd, '_config.js');
if (!existsSync(file)) continue;
const contents = readFileSync(file, 'utf-8');
const ast = parse(contents, {
sourceType: 'module',
ecmaVersion: 'latest',
sourceFile: file,
ranges: true
});
walk(ast, {
enter(node) {
if (
node.type === 'ExportDefaultDeclaration' &&
node.declaration.type === 'ObjectExpression'
) {
this.skip();
const props = node.declaration.properties.find((prop) => prop.key.name === 'props');
if (!props) return;
const { range } = props;
const [start, end] = range;
const code =
contents.slice(0, start) +
print(p`get ${props.key}() { return ${props.value}}`).code +
contents.slice(end);
writeFileSync(file, code);
}
}
});
}

43153
compiler.js Normal file

File diff suppressed because one or more lines are too long

43129
compiler.mjs Normal file

File diff suppressed because one or more lines are too long

View File

@ -35,7 +35,6 @@ The following options can be passed to the compiler. None are required:
| --- | --- | --- |
| `filename` | string | `null`
| `name` | string | `"Component"`
| `format` | `"esm"` or `"cjs"` | `"esm"`
| `generate` | `"dom"` or `"ssr"` or `false` | `"dom"`
| `errorMode` | `"throw"` or `"warn"` | `"throw"`
| `varsReport` | `"strict"` or `"full"` or `false` | `"strict"`
@ -58,7 +57,6 @@ The following options can be passed to the compiler. None are required:
| -------------------- | ------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `filename` | `null` | `string` used for debugging hints and sourcemaps. Your bundler plugin will set it automatically. |
| `name` | `"Component"` | `string` that sets the name of the resulting JavaScript class (though the compiler will rename it if it would otherwise conflict with other variables in scope). It will normally be inferred from `filename`. |
| `format` | `"esm"` | If `"esm"`, creates a JavaScript module (with `import` and `export`). If `"cjs"`, creates a CommonJS module (with `require` and `module.exports`), which is useful in some server-side rendering situations or for testing. |
| `generate` | `"dom"` | If `"dom"`, Svelte emits a JavaScript class for mounting to the DOM. If `"ssr"`, Svelte emits an object with a `render` method suitable for server-side rendering. If `false`, no JavaScript or CSS is returned; just metadata. |
| `errorMode` | `"throw"` | If `"throw"`, Svelte throws when a compilation error occurred. If `"warn"`, Svelte will treat errors as warnings and add them to the warning report. |
| `varsReport` | `"strict"` | If `"strict"`, Svelte returns a variables report with only variables that are not globals nor internals. If `"full"`, Svelte returns a variables report with all detected variables. If `false`, no variables report is returned. |
@ -180,19 +178,21 @@ const ast = parse(source, { filename: 'App.svelte' });
> EXPORT_SNIPPET: svelte/compiler#preprocess
A number of [community-maintained preprocessing plugins](https://sveltesociety.dev/tools#preprocessors) are available to allow you to use Svelte with tools like TypeScript, PostCSS, SCSS, and Less.
A number of [official and community-maintained preprocessing plugins](https://sveltesociety.dev/tools#preprocessors) are available to allow you to use Svelte with tools like TypeScript, PostCSS, SCSS, and Less.
You can write your own preprocessor using the `svelte.preprocess` API.
The `preprocess` function provides convenient hooks for arbitrarily transforming component source code. For example, it can be used to convert a `<style lang="sass">` block into vanilla CSS.
The first argument is the component source code. The second is an array of _preprocessors_ (or a single preprocessor, if you only have one), where a preprocessor is an object with `markup`, `script` and `style` functions, each of which is optional.
Each `markup`, `script` or `style` function must return an object (or a Promise that resolves to an object) with a `code` property, representing the transformed source code, and an optional array of `dependencies`.
The first argument is the component source code. The second is an array of _preprocessors_ (or a single preprocessor, if you only have one), where a preprocessor is an object with a `name` which is required, and `markup`, `script` and `style` functions, each of which is optional.
The `markup` function receives the entire component source text, along with the component's `filename` if it was specified in the third argument.
> Preprocessor functions should additionally return a `map` object alongside `code` and `dependencies`, where `map` is a sourcemap representing the transformation.
The `script` and `style` functions receive the contents of `<script>` and `<style>` elements respectively (`content`) as well as the entire component source text (`markup`). In addition to `filename`, they get an object of the element's attributes.
Each `markup`, `script` or `style` function must return an object (or a Promise that resolves to an object) with a `code` property, representing the transformed source code. Optionally they can return an array of `dependencies` which represents files to watch for changes, and a `map` object which is a sourcemap mapping back the transformation to the original code. `script` and `style` preprocessors can optionally return a record of attributes which represent the updated attributes on the script/style tag.
> Preprocessor functions should return a `map` object whenever possible or else debugging becomes harder as stack traces can't link to the original code correctly.
```js
// @filename: ambient.d.ts
@ -245,24 +245,57 @@ export {};
// @errors: 2322 2345
/// <reference types="@types/node" />
// ---cut---
import { dirname } from 'node:path';
import { preprocess } from 'svelte/compiler';
import MagicString from 'magic-string';
import sass from 'sass';
import { dirname } from 'path';
const { code, dependencies } = await preprocess(
const { code } = await preprocess(
source,
{
style: async ({ content, attributes, filename }) => {
// only process <style lang="sass">
if (attributes.lang !== 'sass' && attributes.lang !== 'scss') return;
name: 'my-fancy-preprocessor',
markup: ({ content, filename }) => {
// Return code as is when no foo string present
const pos = content.indexOf('foo');
if (pos < 0) {
return;
}
const { css, loadedUrls } = await sass.compileStringAsync(content, {
loadPaths: [dirname(filename)]
});
// Replace foo with bar using MagicString which provides
// a source map along with the changed code
const s = new MagicString(content, { filename });
s.overwrite(pos, pos + 3, 'bar', { storeName: true });
return {
code: css,
dependencies: loadedUrls
code: s.toString(),
map: s.generateMap({ hires: true, file: filename })
};
},
style: async ({ content, attributes, filename }) => {
// only process <style lang="sass">
if (attributes.lang !== 'sass') return;
const { css, stats } = await new Promise((resolve, reject) =>
sass.render(
{
file: filename,
data: content,
includePaths: [dirname(filename)]
},
(err, result) => {
if (err) reject(err);
else resolve(result);
}
)
);
// remove lang attribute from style tag
delete attributes.lang;
return {
code: css.toString(),
dependencies: stats.includedFiles,
attributes
};
}
},
@ -272,7 +305,9 @@ const { code, dependencies } = await preprocess(
);
```
Multiple preprocessors can be used together. The output of the first becomes the input to the second. `markup` functions run first, then `script` and `style`.
Multiple preprocessors can be used together. The output of the first becomes the input to the second. Within one preprocessor, `markup` runs first, then `script` and `style`.
> In Svelte 3, all `markup` functions ran first, then all `script` and then all `style` preprocessors. This order was changed in Svelte 4.
```js
// @filename: ambient.d.ts
@ -286,36 +321,34 @@ export {};
// ---cut---
import { preprocess } from 'svelte/compiler';
const { code } = await preprocess(
source,
[
{
markup: () => {
console.log('this runs first');
},
script: () => {
console.log('this runs third');
},
style: () => {
console.log('this runs fifth');
}
},
{
markup: () => {
console.log('this runs second');
},
script: () => {
console.log('this runs fourth');
},
style: () => {
console.log('this runs sixth');
}
}
],
const { code } = await preprocess(source, [
{
filename: 'App.svelte'
name: 'first preprocessor',
markup: () => {
console.log('this runs first');
},
script: () => {
console.log('this runs second');
},
style: () => {
console.log('this runs third');
}
},
{
name: 'second preprocessor',
markup: () => {
console.log('this runs fourth');
},
script: () => {
console.log('this runs fifth');
},
style: () => {
console.log('this runs sixth');
}
}
);
], {
filename: 'App.svelte'
});
```
## `svelte.walk`

View File

@ -2,6 +2,8 @@
title: 'svelte/register'
---
> This API is removed in Svelte 4. `require` hooks are deprecated and current Node versions understand ESM. Use a bundler like Vite or our full-stack framework [SvelteKit](https://kit.svelte.dev) instead to create JavaScript modules from Svelte components.
To render Svelte components in Node.js without bundling, use `require('svelte/register')`. After that, you can use `require` to include any `.svelte` file.
```js

1
easing/index.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from '../types/runtime/easing/index.js';

314
easing/index.js Normal file
View File

@ -0,0 +1,314 @@
'use strict';
var Component = require('../internal/Component-9c4b98a2.js');
/*
Adapted from https://github.com/mattdesl
Distributed under MIT License https://github.com/mattdesl/eases/blob/master/LICENSE.md
*/
/**
* @param {number} t
* @returns {number}
*/
function backInOut(t) {
const s = 1.70158 * 1.525;
if ((t *= 2) < 1) return 0.5 * (t * t * ((s + 1) * t - s));
return 0.5 * ((t -= 2) * t * ((s + 1) * t + s) + 2);
}
/**
* @param {number} t
* @returns {number}
*/
function backIn(t) {
const s = 1.70158;
return t * t * ((s + 1) * t - s);
}
/**
* @param {number} t
* @returns {number}
*/
function backOut(t) {
const s = 1.70158;
return --t * t * ((s + 1) * t + s) + 1;
}
/**
* @param {number} t
* @returns {number}
*/
function bounceOut(t) {
const a = 4.0 / 11.0;
const b = 8.0 / 11.0;
const c = 9.0 / 10.0;
const ca = 4356.0 / 361.0;
const cb = 35442.0 / 1805.0;
const cc = 16061.0 / 1805.0;
const t2 = t * t;
return t < a
? 7.5625 * t2
: t < b
? 9.075 * t2 - 9.9 * t + 3.4
: t < c
? ca * t2 - cb * t + cc
: 10.8 * t * t - 20.52 * t + 10.72;
}
/**
* @param {number} t
* @returns {number}
*/
function bounceInOut(t) {
return t < 0.5 ? 0.5 * (1.0 - bounceOut(1.0 - t * 2.0)) : 0.5 * bounceOut(t * 2.0 - 1.0) + 0.5;
}
/**
* @param {number} t
* @returns {number}
*/
function bounceIn(t) {
return 1.0 - bounceOut(1.0 - t);
}
/**
* @param {number} t
* @returns {number}
*/
function circInOut(t) {
if ((t *= 2) < 1) return -0.5 * (Math.sqrt(1 - t * t) - 1);
return 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1);
}
/**
* @param {number} t
* @returns {number}
*/
function circIn(t) {
return 1.0 - Math.sqrt(1.0 - t * t);
}
/**
* @param {number} t
* @returns {number}
*/
function circOut(t) {
return Math.sqrt(1 - --t * t);
}
/**
* @param {number} t
* @returns {number}
*/
function cubicInOut(t) {
return t < 0.5 ? 4.0 * t * t * t : 0.5 * Math.pow(2.0 * t - 2.0, 3.0) + 1.0;
}
/**
* @param {number} t
* @returns {number}
*/
function cubicIn(t) {
return t * t * t;
}
/**
* @param {number} t
* @returns {number}
*/
function cubicOut(t) {
const f = t - 1.0;
return f * f * f + 1.0;
}
/**
* @param {number} t
* @returns {number}
*/
function elasticInOut(t) {
return t < 0.5
? 0.5 * Math.sin(((+13.0 * Math.PI) / 2) * 2.0 * t) * Math.pow(2.0, 10.0 * (2.0 * t - 1.0))
: 0.5 *
Math.sin(((-13.0 * Math.PI) / 2) * (2.0 * t - 1.0 + 1.0)) *
Math.pow(2.0, -10.0 * (2.0 * t - 1.0)) +
1.0;
}
/**
* @param {number} t
* @returns {number}
*/
function elasticIn(t) {
return Math.sin((13.0 * t * Math.PI) / 2) * Math.pow(2.0, 10.0 * (t - 1.0));
}
/**
* @param {number} t
* @returns {number}
*/
function elasticOut(t) {
return Math.sin((-13.0 * (t + 1.0) * Math.PI) / 2) * Math.pow(2.0, -10.0 * t) + 1.0;
}
/**
* @param {number} t
* @returns {number}
*/
function expoInOut(t) {
return t === 0.0 || t === 1.0
? t
: t < 0.5
? +0.5 * Math.pow(2.0, 20.0 * t - 10.0)
: -0.5 * Math.pow(2.0, 10.0 - t * 20.0) + 1.0;
}
/**
* @param {number} t
* @returns {number}
*/
function expoIn(t) {
return t === 0.0 ? t : Math.pow(2.0, 10.0 * (t - 1.0));
}
/**
* @param {number} t
* @returns {number}
*/
function expoOut(t) {
return t === 1.0 ? t : 1.0 - Math.pow(2.0, -10.0 * t);
}
/**
* @param {number} t
* @returns {number}
*/
function quadInOut(t) {
t /= 0.5;
if (t < 1) return 0.5 * t * t;
t--;
return -0.5 * (t * (t - 2) - 1);
}
/**
* @param {number} t
* @returns {number}
*/
function quadIn(t) {
return t * t;
}
/**
* @param {number} t
* @returns {number}
*/
function quadOut(t) {
return -t * (t - 2.0);
}
/**
* @param {number} t
* @returns {number}
*/
function quartInOut(t) {
return t < 0.5 ? +8.0 * Math.pow(t, 4.0) : -8.0 * Math.pow(t - 1.0, 4.0) + 1.0;
}
/**
* @param {number} t
* @returns {number}
*/
function quartIn(t) {
return Math.pow(t, 4.0);
}
/**
* @param {number} t
* @returns {number}
*/
function quartOut(t) {
return Math.pow(t - 1.0, 3.0) * (1.0 - t) + 1.0;
}
/**
* @param {number} t
* @returns {number}
*/
function quintInOut(t) {
if ((t *= 2) < 1) return 0.5 * t * t * t * t * t;
return 0.5 * ((t -= 2) * t * t * t * t + 2);
}
/**
* @param {number} t
* @returns {number}
*/
function quintIn(t) {
return t * t * t * t * t;
}
/**
* @param {number} t
* @returns {number}
*/
function quintOut(t) {
return --t * t * t * t * t + 1;
}
/**
* @param {number} t
* @returns {number}
*/
function sineInOut(t) {
return -0.5 * (Math.cos(Math.PI * t) - 1);
}
/**
* @param {number} t
* @returns {number}
*/
function sineIn(t) {
const v = Math.cos(t * Math.PI * 0.5);
if (Math.abs(v) < 1e-14) return 1;
else return 1 - v;
}
/**
* @param {number} t
* @returns {number}
*/
function sineOut(t) {
return Math.sin((t * Math.PI) / 2);
}
exports.linear = Component.identity;
exports.backIn = backIn;
exports.backInOut = backInOut;
exports.backOut = backOut;
exports.bounceIn = bounceIn;
exports.bounceInOut = bounceInOut;
exports.bounceOut = bounceOut;
exports.circIn = circIn;
exports.circInOut = circInOut;
exports.circOut = circOut;
exports.cubicIn = cubicIn;
exports.cubicInOut = cubicInOut;
exports.cubicOut = cubicOut;
exports.elasticIn = elasticIn;
exports.elasticInOut = elasticInOut;
exports.elasticOut = elasticOut;
exports.expoIn = expoIn;
exports.expoInOut = expoInOut;
exports.expoOut = expoOut;
exports.quadIn = quadIn;
exports.quadInOut = quadInOut;
exports.quadOut = quadOut;
exports.quartIn = quartIn;
exports.quartInOut = quartInOut;
exports.quartOut = quartOut;
exports.quintIn = quintIn;
exports.quintInOut = quintInOut;
exports.quintOut = quintOut;
exports.sineIn = sineIn;
exports.sineInOut = sineInOut;
exports.sineOut = sineOut;

282
easing/index.mjs Normal file
View File

@ -0,0 +1,282 @@
export { identity as linear } from '../internal/Component-cd97939e.mjs';
/*
Adapted from https://github.com/mattdesl
Distributed under MIT License https://github.com/mattdesl/eases/blob/master/LICENSE.md
*/
/**
* @param {number} t
* @returns {number}
*/
function backInOut(t) {
const s = 1.70158 * 1.525;
if ((t *= 2) < 1) return 0.5 * (t * t * ((s + 1) * t - s));
return 0.5 * ((t -= 2) * t * ((s + 1) * t + s) + 2);
}
/**
* @param {number} t
* @returns {number}
*/
function backIn(t) {
const s = 1.70158;
return t * t * ((s + 1) * t - s);
}
/**
* @param {number} t
* @returns {number}
*/
function backOut(t) {
const s = 1.70158;
return --t * t * ((s + 1) * t + s) + 1;
}
/**
* @param {number} t
* @returns {number}
*/
function bounceOut(t) {
const a = 4.0 / 11.0;
const b = 8.0 / 11.0;
const c = 9.0 / 10.0;
const ca = 4356.0 / 361.0;
const cb = 35442.0 / 1805.0;
const cc = 16061.0 / 1805.0;
const t2 = t * t;
return t < a
? 7.5625 * t2
: t < b
? 9.075 * t2 - 9.9 * t + 3.4
: t < c
? ca * t2 - cb * t + cc
: 10.8 * t * t - 20.52 * t + 10.72;
}
/**
* @param {number} t
* @returns {number}
*/
function bounceInOut(t) {
return t < 0.5 ? 0.5 * (1.0 - bounceOut(1.0 - t * 2.0)) : 0.5 * bounceOut(t * 2.0 - 1.0) + 0.5;
}
/**
* @param {number} t
* @returns {number}
*/
function bounceIn(t) {
return 1.0 - bounceOut(1.0 - t);
}
/**
* @param {number} t
* @returns {number}
*/
function circInOut(t) {
if ((t *= 2) < 1) return -0.5 * (Math.sqrt(1 - t * t) - 1);
return 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1);
}
/**
* @param {number} t
* @returns {number}
*/
function circIn(t) {
return 1.0 - Math.sqrt(1.0 - t * t);
}
/**
* @param {number} t
* @returns {number}
*/
function circOut(t) {
return Math.sqrt(1 - --t * t);
}
/**
* @param {number} t
* @returns {number}
*/
function cubicInOut(t) {
return t < 0.5 ? 4.0 * t * t * t : 0.5 * Math.pow(2.0 * t - 2.0, 3.0) + 1.0;
}
/**
* @param {number} t
* @returns {number}
*/
function cubicIn(t) {
return t * t * t;
}
/**
* @param {number} t
* @returns {number}
*/
function cubicOut(t) {
const f = t - 1.0;
return f * f * f + 1.0;
}
/**
* @param {number} t
* @returns {number}
*/
function elasticInOut(t) {
return t < 0.5
? 0.5 * Math.sin(((+13.0 * Math.PI) / 2) * 2.0 * t) * Math.pow(2.0, 10.0 * (2.0 * t - 1.0))
: 0.5 *
Math.sin(((-13.0 * Math.PI) / 2) * (2.0 * t - 1.0 + 1.0)) *
Math.pow(2.0, -10.0 * (2.0 * t - 1.0)) +
1.0;
}
/**
* @param {number} t
* @returns {number}
*/
function elasticIn(t) {
return Math.sin((13.0 * t * Math.PI) / 2) * Math.pow(2.0, 10.0 * (t - 1.0));
}
/**
* @param {number} t
* @returns {number}
*/
function elasticOut(t) {
return Math.sin((-13.0 * (t + 1.0) * Math.PI) / 2) * Math.pow(2.0, -10.0 * t) + 1.0;
}
/**
* @param {number} t
* @returns {number}
*/
function expoInOut(t) {
return t === 0.0 || t === 1.0
? t
: t < 0.5
? +0.5 * Math.pow(2.0, 20.0 * t - 10.0)
: -0.5 * Math.pow(2.0, 10.0 - t * 20.0) + 1.0;
}
/**
* @param {number} t
* @returns {number}
*/
function expoIn(t) {
return t === 0.0 ? t : Math.pow(2.0, 10.0 * (t - 1.0));
}
/**
* @param {number} t
* @returns {number}
*/
function expoOut(t) {
return t === 1.0 ? t : 1.0 - Math.pow(2.0, -10.0 * t);
}
/**
* @param {number} t
* @returns {number}
*/
function quadInOut(t) {
t /= 0.5;
if (t < 1) return 0.5 * t * t;
t--;
return -0.5 * (t * (t - 2) - 1);
}
/**
* @param {number} t
* @returns {number}
*/
function quadIn(t) {
return t * t;
}
/**
* @param {number} t
* @returns {number}
*/
function quadOut(t) {
return -t * (t - 2.0);
}
/**
* @param {number} t
* @returns {number}
*/
function quartInOut(t) {
return t < 0.5 ? +8.0 * Math.pow(t, 4.0) : -8.0 * Math.pow(t - 1.0, 4.0) + 1.0;
}
/**
* @param {number} t
* @returns {number}
*/
function quartIn(t) {
return Math.pow(t, 4.0);
}
/**
* @param {number} t
* @returns {number}
*/
function quartOut(t) {
return Math.pow(t - 1.0, 3.0) * (1.0 - t) + 1.0;
}
/**
* @param {number} t
* @returns {number}
*/
function quintInOut(t) {
if ((t *= 2) < 1) return 0.5 * t * t * t * t * t;
return 0.5 * ((t -= 2) * t * t * t * t + 2);
}
/**
* @param {number} t
* @returns {number}
*/
function quintIn(t) {
return t * t * t * t * t;
}
/**
* @param {number} t
* @returns {number}
*/
function quintOut(t) {
return --t * t * t * t * t + 1;
}
/**
* @param {number} t
* @returns {number}
*/
function sineInOut(t) {
return -0.5 * (Math.cos(Math.PI * t) - 1);
}
/**
* @param {number} t
* @returns {number}
*/
function sineIn(t) {
const v = Math.cos(t * Math.PI * 0.5);
if (Math.abs(v) < 1e-14) return 1;
else return 1 - v;
}
/**
* @param {number} t
* @returns {number}
*/
function sineOut(t) {
return Math.sin((t * Math.PI) / 2);
}
export { backIn, backInOut, backOut, bounceIn, bounceInOut, bounceOut, circIn, circInOut, circOut, cubicIn, cubicInOut, cubicOut, elasticIn, elasticInOut, elasticOut, expoIn, expoInOut, expoOut, quadIn, quadInOut, quadOut, quartIn, quartInOut, quartOut, quintIn, quintInOut, quintOut, sineIn, sineInOut, sineOut };

5
easing/package.json Normal file
View File

@ -0,0 +1,5 @@
{
"main": "./index",
"module": "./index.mjs",
"types": "./index.d.ts"
}

View File

@ -1,3 +0,0 @@
{
"types": "./index.d.ts"
}

19
index.js Normal file
View File

@ -0,0 +1,19 @@
'use strict';
var Component = require('./internal/Component-9c4b98a2.js');
var dev = require('./internal/dev-1537023e.js');
exports.afterUpdate = Component.afterUpdate;
exports.beforeUpdate = Component.beforeUpdate;
exports.createEventDispatcher = Component.createEventDispatcher;
exports.getAllContexts = Component.getAllContexts;
exports.getContext = Component.getContext;
exports.hasContext = Component.hasContext;
exports.onDestroy = Component.onDestroy;
exports.onMount = Component.onMount;
exports.setContext = Component.setContext;
exports.tick = Component.tick;
exports.SvelteComponent = dev.SvelteComponentDev;
exports.SvelteComponentTyped = dev.SvelteComponentTyped;

2
index.mjs Normal file
View File

@ -0,0 +1,2 @@
export { afterUpdate, beforeUpdate, createEventDispatcher, getAllContexts, getContext, hasContext, onDestroy, onMount, setContext, tick } from './internal/Component-cd97939e.mjs';
export { SvelteComponentDev as SvelteComponent, SvelteComponentTyped } from './internal/dev-89102382.mjs';

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

394
internal/dev-1537023e.js Normal file
View File

@ -0,0 +1,394 @@
'use strict';
var Component = require('./Component-9c4b98a2.js');
/** regex of all html void element names */
const void_element_names =
/^(?:area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/;
/**
* @param {string} name
* @returns {boolean}
*/
function is_void(name) {
return void_element_names.test(name) || name.toLowerCase() === '!doctype';
}
/**
* @template T
* @param {string} type
* @param {T} detail
* @returns {void}
*/
function dispatch_dev(type, detail) {
document.dispatchEvent(
Component.custom_event(type, { version: '4.0.0-next.0', ...detail }, { bubbles: true })
);
}
/**
* @param {Node} target
* @param {Node} node
* @returns {void}
*/
function append_dev(target, node) {
dispatch_dev('SvelteDOMInsert', { target, node });
Component.append(target, node);
}
/**
* @param {Node} target
* @param {Node} node
* @returns {void}
*/
function append_hydration_dev(target, node) {
dispatch_dev('SvelteDOMInsert', { target, node });
Component.append_hydration(target, node);
}
/**
* @param {Node} target
* @param {Node} node
* @param {Node} anchor
* @returns {void}
*/
function insert_dev(target, node, anchor) {
dispatch_dev('SvelteDOMInsert', { target, node, anchor });
Component.insert(target, node, anchor);
}
/** @param {Node} target
* @param {Node} node
* @param {Node} anchor
* @returns {void}
*/
function insert_hydration_dev(target, node, anchor) {
dispatch_dev('SvelteDOMInsert', { target, node, anchor });
Component.insert_hydration(target, node, anchor);
}
/**
* @param {Node} node
* @returns {void}
*/
function detach_dev(node) {
dispatch_dev('SvelteDOMRemove', { node });
Component.detach(node);
}
/**
* @param {Node} before
* @param {Node} after
* @returns {void}
*/
function detach_between_dev(before, after) {
while (before.nextSibling && before.nextSibling !== after) {
detach_dev(before.nextSibling);
}
}
/**
* @param {Node} after
* @returns {void}
*/
function detach_before_dev(after) {
while (after.previousSibling) {
detach_dev(after.previousSibling);
}
}
/**
* @param {Node} before
* @returns {void}
*/
function detach_after_dev(before) {
while (before.nextSibling) {
detach_dev(before.nextSibling);
}
}
/**
* @param {Node} node
* @param {string} event
* @param {EventListenerOrEventListenerObject} handler
* @param {boolean | AddEventListenerOptions | EventListenerOptions} options
* @param {boolean} has_prevent_default
* @param {boolean} has_stop_propagation
* @param {boolean} has_stop_immediate_propagation
* @returns {() => void}
*/
function listen_dev(
node,
event,
handler,
options,
has_prevent_default,
has_stop_propagation,
has_stop_immediate_propagation
) {
const modifiers =
options === true ? ['capture'] : options ? Array.from(Object.keys(options)) : [];
if (has_prevent_default) modifiers.push('preventDefault');
if (has_stop_propagation) modifiers.push('stopPropagation');
if (has_stop_immediate_propagation) modifiers.push('stopImmediatePropagation');
dispatch_dev('SvelteDOMAddEventListener', { node, event, handler, modifiers });
const dispose = Component.listen(node, event, handler, options);
return () => {
dispatch_dev('SvelteDOMRemoveEventListener', { node, event, handler, modifiers });
dispose();
};
}
/**
* @param {Element} node
* @param {string} attribute
* @param {string} value
* @returns {void}
*/
function attr_dev(node, attribute, value) {
Component.attr(node, attribute, value);
if (value == null) dispatch_dev('SvelteDOMRemoveAttribute', { node, attribute });
else dispatch_dev('SvelteDOMSetAttribute', { node, attribute, value });
}
/**
* @param {Element} node
* @param {string} property
* @param {any} value
* @returns {void}
*/
function prop_dev(node, property, value) {
node[property] = value;
dispatch_dev('SvelteDOMSetProperty', { node, property, value });
}
/**
* @param {HTMLElement} node
* @param {string} property
* @param {any} value
* @returns {void}
*/
function dataset_dev(node, property, value) {
node.dataset[property] = value;
dispatch_dev('SvelteDOMSetDataset', { node, property, value });
}
/**
* @param {Text} text
* @param {unknown} data
* @returns {void}
*/
function set_data_dev(text, data) {
data = '' + data;
if (text.data === data) return;
dispatch_dev('SvelteDOMSetData', { node: text, data });
text.data = /** @type {string} */ (data);
}
/**
* @param {Text} text
* @param {unknown} data
* @returns {void}
*/
function set_data_contenteditable_dev(text, data) {
data = '' + data;
if (text.wholeText === data) return;
dispatch_dev('SvelteDOMSetData', { node: text, data });
text.data = /** @type {string} */ (data);
}
/**
* @param {Text} text
* @param {unknown} data
* @param {string} attr_value
* @returns {void}
*/
function set_data_maybe_contenteditable_dev(text, data, attr_value) {
if (~Component.contenteditable_truthy_values.indexOf(attr_value)) {
set_data_contenteditable_dev(text, data);
} else {
set_data_dev(text, data);
}
}
/**
* @returns {void} */
function validate_each_argument(arg) {
if (typeof arg !== 'string' && !(arg && typeof arg === 'object' && 'length' in arg)) {
let msg = '{#each} only iterates over array-like objects.';
if (typeof Symbol === 'function' && arg && Symbol.iterator in arg) {
msg += ' You can use a spread to convert this iterable into an array.';
}
throw new Error(msg);
}
}
/**
* @returns {void} */
function validate_slots(name, slot, keys) {
for (const slot_key of Object.keys(slot)) {
if (!~keys.indexOf(slot_key)) {
console.warn(`<${name}> received an unexpected slot "${slot_key}".`);
}
}
}
/**
* @param {unknown} tag
* @returns {void}
*/
function validate_dynamic_element(tag) {
const is_string = typeof tag === 'string';
if (tag && !is_string) {
throw new Error('<svelte:element> expects "this" attribute to be a string.');
}
}
/**
* @param {undefined | string} tag
* @returns {void}
*/
function validate_void_dynamic_element(tag) {
if (tag && is_void(tag)) {
console.warn(`<svelte:element this="${tag}"> is self-closing and cannot have content.`);
}
}
function construct_svelte_component_dev(component, props) {
const error_message = 'this={...} of <svelte:component> should specify a Svelte component.';
try {
const instance = new component(props);
if (!instance.$$ || !instance.$set || !instance.$on || !instance.$destroy) {
throw new Error(error_message);
}
return instance;
} catch (err) {
const { message } = err;
if (typeof message === 'string' && message.indexOf('is not a constructor') !== -1) {
throw new Error(error_message);
} else {
throw err;
}
}
}
/**
* Base class for Svelte components with some minor dev-enhancements. Used when dev=true.
*
* Can be used to create strongly typed Svelte components.
*
* ### Example:
*
* You have component library on npm called `component-library`, from which
* you export a component called `MyComponent`. For Svelte+TypeScript users,
* you want to provide typings. Therefore you create a `index.d.ts`:
* ```ts
* import { SvelteComponent } from "svelte";
* export class MyComponent extends SvelteComponent<{foo: string}> {}
* ```
* Typing this makes it possible for IDEs like VS Code with the Svelte extension
* to provide intellisense and to use the component like this in a Svelte file
* with TypeScript:
* ```svelte
* <script lang="ts">
* import { MyComponent } from "component-library";
* </script>
* <MyComponent foo={'bar'} />
* ```
* @template {Record<string, any>} [Props=any]
* @template {Record<string, any>} [Events=any]
* @template {Record<string, any>} [Slots=any]
* @extends SvelteComponent<Props, Events>
*/
class SvelteComponentDev extends Component.SvelteComponent {
/**
* For type checking capabilities only.
* Does not exist at runtime.
* ### DO NOT USE!
*
* @type {Props}
*/
/**
* For type checking capabilities only.
* Does not exist at runtime.
* ### DO NOT USE!
*
* @type {Events}
*/
/**
* For type checking capabilities only.
* Does not exist at runtime.
* ### DO NOT USE!
*
* @type {Slots}
*/
/** @param {import('./public.js').ComponentConstructorOptions<Props>} options */
constructor(options) {
if (!options || (!options.target && !options.$$inline)) {
throw new Error("'target' is a required option");
}
super();
}
/** @returns {void} */
$destroy() {
super.$destroy();
this.$destroy = () => {
console.warn('Component was already destroyed'); // eslint-disable-line no-console
};
}
/** @returns {void} */
$capture_state() {}
/** @returns {void} */
$inject_state() {}
}
/**
* @template {Record<string, any>} [Props=any]
* @template {Record<string, any>} [Events=any]
* @template {Record<string, any>} [Slots=any]
* @deprecated Use `SvelteComponent` instead. See PR for more information: https://github.com/sveltejs/svelte/pull/8512
* @extends SvelteComponentDev<Props, Events, Slots>
*/
class SvelteComponentTyped extends SvelteComponentDev {}
/** @returns {() => void} */
function loop_guard(timeout) {
const start = Date.now();
return () => {
if (Date.now() - start > timeout) {
throw new Error('Infinite loop detected');
}
};
}
exports.SvelteComponentDev = SvelteComponentDev;
exports.SvelteComponentTyped = SvelteComponentTyped;
exports.append_dev = append_dev;
exports.append_hydration_dev = append_hydration_dev;
exports.attr_dev = attr_dev;
exports.construct_svelte_component_dev = construct_svelte_component_dev;
exports.dataset_dev = dataset_dev;
exports.detach_after_dev = detach_after_dev;
exports.detach_before_dev = detach_before_dev;
exports.detach_between_dev = detach_between_dev;
exports.detach_dev = detach_dev;
exports.dispatch_dev = dispatch_dev;
exports.insert_dev = insert_dev;
exports.insert_hydration_dev = insert_hydration_dev;
exports.is_void = is_void;
exports.listen_dev = listen_dev;
exports.loop_guard = loop_guard;
exports.prop_dev = prop_dev;
exports.set_data_contenteditable_dev = set_data_contenteditable_dev;
exports.set_data_dev = set_data_dev;
exports.set_data_maybe_contenteditable_dev = set_data_maybe_contenteditable_dev;
exports.validate_dynamic_element = validate_dynamic_element;
exports.validate_each_argument = validate_each_argument;
exports.validate_slots = validate_slots;
exports.validate_void_dynamic_element = validate_void_dynamic_element;

356
internal/dev-7f6e6ca2.mjs Normal file
View File

@ -0,0 +1,356 @@
import { custom_event, append, append_hydration, insert, insert_hydration, detach, listen, attr, contenteditable_truthy_values, SvelteComponent } from './Component-b90cf812.mjs';
/** regex of all html void element names */
const void_element_names =
/^(?:area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/;
function is_void(name) {
return void_element_names.test(name) || name.toLowerCase() === '!doctype';
}
function dispatch_dev(type, detail) {
document.dispatchEvent(
custom_event(type, { version: '4.0.0-next.0', ...detail }, { bubbles: true })
);
}
function append_dev(target, node) {
dispatch_dev('SvelteDOMInsert', { target, node });
append(target, node);
}
function append_hydration_dev(target, node) {
dispatch_dev('SvelteDOMInsert', { target, node });
append_hydration(target, node);
}
function insert_dev(target, node, anchor) {
dispatch_dev('SvelteDOMInsert', { target, node, anchor });
insert(target, node, anchor);
}
function insert_hydration_dev(target, node, anchor) {
dispatch_dev('SvelteDOMInsert', { target, node, anchor });
insert_hydration(target, node, anchor);
}
function detach_dev(node) {
dispatch_dev('SvelteDOMRemove', { node });
detach(node);
}
function detach_between_dev(before, after) {
while (before.nextSibling && before.nextSibling !== after) {
detach_dev(before.nextSibling);
}
}
function detach_before_dev(after) {
while (after.previousSibling) {
detach_dev(after.previousSibling);
}
}
function detach_after_dev(before) {
while (before.nextSibling) {
detach_dev(before.nextSibling);
}
}
function listen_dev(
node,
event,
handler,
options,
has_prevent_default,
has_stop_propagation,
has_stop_immediate_propagation
) {
const modifiers =
options === true ? ['capture'] : options ? Array.from(Object.keys(options)) : [];
if (has_prevent_default) modifiers.push('preventDefault');
if (has_stop_propagation) modifiers.push('stopPropagation');
if (has_stop_immediate_propagation) modifiers.push('stopImmediatePropagation');
dispatch_dev('SvelteDOMAddEventListener', { node, event, handler, modifiers });
const dispose = listen(node, event, handler, options);
return () => {
dispatch_dev('SvelteDOMRemoveEventListener', { node, event, handler, modifiers });
dispose();
};
}
function attr_dev(node, attribute, value) {
attr(node, attribute, value);
if (value == null) dispatch_dev('SvelteDOMRemoveAttribute', { node, attribute });
else dispatch_dev('SvelteDOMSetAttribute', { node, attribute, value });
}
function prop_dev(node, property, value) {
node[property] = value;
dispatch_dev('SvelteDOMSetProperty', { node, property, value });
}
function dataset_dev(node, property, value) {
node.dataset[property] = value;
dispatch_dev('SvelteDOMSetDataset', { node, property, value });
}
function set_data_dev(text, data) {
data = '' + data;
if (text.data === data) return;
dispatch_dev('SvelteDOMSetData', { node: text, data });
text.data = data ;
}
function set_data_contenteditable_dev(text, data) {
data = '' + data;
if (text.wholeText === data) return;
dispatch_dev('SvelteDOMSetData', { node: text, data });
text.data = data ;
}
function set_data_maybe_contenteditable_dev(text, data, attr_value) {
if (~contenteditable_truthy_values.indexOf(attr_value)) {
set_data_contenteditable_dev(text, data);
} else {
set_data_dev(text, data);
}
}
function validate_each_argument(arg) {
if (typeof arg !== 'string' && !(arg && typeof arg === 'object' && 'length' in arg)) {
let msg = '{#each} only iterates over array-like objects.';
if (typeof Symbol === 'function' && arg && Symbol.iterator in arg) {
msg += ' You can use a spread to convert this iterable into an array.';
}
throw new Error(msg);
}
}
function validate_slots(name, slot, keys) {
for (const slot_key of Object.keys(slot)) {
if (!~keys.indexOf(slot_key)) {
console.warn(`<${name}> received an unexpected slot "${slot_key}".`);
}
}
}
function validate_dynamic_element(tag) {
const is_string = typeof tag === 'string';
if (tag && !is_string) {
throw new Error('<svelte:element> expects "this" attribute to be a string.');
}
}
function validate_void_dynamic_element(tag) {
if (tag && is_void(tag)) {
console.warn(`<svelte:element this="${tag}"> is self-closing and cannot have content.`);
}
}
function construct_svelte_component_dev(component, props) {
const error_message = 'this={...} of <svelte:component> should specify a Svelte component.';
try {
const instance = new component(props);
if (!instance.$$ || !instance.$set || !instance.$on || !instance.$destroy) {
throw new Error(error_message);
}
return instance;
} catch (err) {
const { message } = err;
if (typeof message === 'string' && message.indexOf('is not a constructor') !== -1) {
throw new Error(error_message);
} else {
throw err;
}
}
}
/**
* Base class for Svelte components with some minor dev-enhancements. Used when dev=true.
*
* Can be used to create strongly typed Svelte components.
*
* ### Example:
*
* You have component library on npm called `component-library`, from which
* you export a component called `MyComponent`. For Svelte+TypeScript users,
* you want to provide typings. Therefore you create a `index.d.ts`:
* ```ts
* import { SvelteComponent } from "svelte";
* export class MyComponent extends SvelteComponent<{foo: string}> {}
* ```
* Typing this makes it possible for IDEs like VS Code with the Svelte extension
* to provide intellisense and to use the component like this in a Svelte file
* with TypeScript:
* ```svelte
* <script lang="ts">
* import { MyComponent } from "component-library";
* </script>
* <MyComponent foo={'bar'} />
* ```
*/
class SvelteComponentDev
extends SvelteComponent {
/**
* @private
* For type checking capabilities only.
* Does not exist at runtime.
* ### DO NOT USE!
*/
/**
* @private
* For type checking capabilities only.
* Does not exist at runtime.
* ### DO NOT USE!
*/
/**
* @private
* For type checking capabilities only.
* Does not exist at runtime.
* ### DO NOT USE!
*/
constructor(options) {
if (!options || (!options.target && !options.$$inline)) {
throw new Error("'target' is a required option");
}
super();
}
$destroy() {
super.$destroy();
this.$destroy = () => {
console.warn('Component was already destroyed'); // eslint-disable-line no-console
};
}
$capture_state() {}
$inject_state() {}
}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
/**
* @deprecated Use `SvelteComponent` instead. See PR for more information: https://github.com/sveltejs/svelte/pull/8512
*/
class SvelteComponentTyped
extends SvelteComponentDev {}
/**
* Convenience type to get the type of a Svelte component. Useful for example in combination with
* dynamic components using `<svelte:component>`.
*
* Example:
* ```svelte
* <script lang="ts">
* import type { ComponentType, SvelteComponent } from 'svelte';
* import Component1 from './Component1.svelte';
* import Component2 from './Component2.svelte';
*
* const component: ComponentType = someLogic() ? Component1 : Component2;
* const componentOfCertainSubType: ComponentType<SvelteComponent<{ needsThisProp: string }>> = someLogic() ? Component1 : Component2;
* </script>
*
* <svelte:component this={component} />
* <svelte:component this={componentOfCertainSubType} needsThisProp="hello" />
* ```
*/
function loop_guard(timeout) {
const start = Date.now();
return () => {
if (Date.now() - start > timeout) {
throw new Error('Infinite loop detected');
}
};
}
export { SvelteComponentDev, SvelteComponentTyped, append_dev, append_hydration_dev, attr_dev, construct_svelte_component_dev, dataset_dev, detach_after_dev, detach_before_dev, detach_between_dev, detach_dev, dispatch_dev, insert_dev, insert_hydration_dev, is_void, listen_dev, loop_guard, prop_dev, set_data_contenteditable_dev, set_data_dev, set_data_maybe_contenteditable_dev, validate_dynamic_element, validate_each_argument, validate_slots, validate_void_dynamic_element };

368
internal/dev-89102382.mjs Normal file
View File

@ -0,0 +1,368 @@
import { custom_event, append, append_hydration, insert, insert_hydration, detach, listen, attr, contenteditable_truthy_values, SvelteComponent } from './Component-cd97939e.mjs';
/** regex of all html void element names */
const void_element_names =
/^(?:area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/;
/**
* @param {string} name
* @returns {boolean}
*/
function is_void(name) {
return void_element_names.test(name) || name.toLowerCase() === '!doctype';
}
/**
* @template T
* @param {string} type
* @param {T} detail
* @returns {void}
*/
function dispatch_dev(type, detail) {
document.dispatchEvent(
custom_event(type, { version: '4.0.0-next.0', ...detail }, { bubbles: true })
);
}
/**
* @param {Node} target
* @param {Node} node
* @returns {void}
*/
function append_dev(target, node) {
dispatch_dev('SvelteDOMInsert', { target, node });
append(target, node);
}
/**
* @param {Node} target
* @param {Node} node
* @returns {void}
*/
function append_hydration_dev(target, node) {
dispatch_dev('SvelteDOMInsert', { target, node });
append_hydration(target, node);
}
/**
* @param {Node} target
* @param {Node} node
* @param {Node} anchor
* @returns {void}
*/
function insert_dev(target, node, anchor) {
dispatch_dev('SvelteDOMInsert', { target, node, anchor });
insert(target, node, anchor);
}
/** @param {Node} target
* @param {Node} node
* @param {Node} anchor
* @returns {void}
*/
function insert_hydration_dev(target, node, anchor) {
dispatch_dev('SvelteDOMInsert', { target, node, anchor });
insert_hydration(target, node, anchor);
}
/**
* @param {Node} node
* @returns {void}
*/
function detach_dev(node) {
dispatch_dev('SvelteDOMRemove', { node });
detach(node);
}
/**
* @param {Node} before
* @param {Node} after
* @returns {void}
*/
function detach_between_dev(before, after) {
while (before.nextSibling && before.nextSibling !== after) {
detach_dev(before.nextSibling);
}
}
/**
* @param {Node} after
* @returns {void}
*/
function detach_before_dev(after) {
while (after.previousSibling) {
detach_dev(after.previousSibling);
}
}
/**
* @param {Node} before
* @returns {void}
*/
function detach_after_dev(before) {
while (before.nextSibling) {
detach_dev(before.nextSibling);
}
}
/**
* @param {Node} node
* @param {string} event
* @param {EventListenerOrEventListenerObject} handler
* @param {boolean | AddEventListenerOptions | EventListenerOptions} options
* @param {boolean} has_prevent_default
* @param {boolean} has_stop_propagation
* @param {boolean} has_stop_immediate_propagation
* @returns {() => void}
*/
function listen_dev(
node,
event,
handler,
options,
has_prevent_default,
has_stop_propagation,
has_stop_immediate_propagation
) {
const modifiers =
options === true ? ['capture'] : options ? Array.from(Object.keys(options)) : [];
if (has_prevent_default) modifiers.push('preventDefault');
if (has_stop_propagation) modifiers.push('stopPropagation');
if (has_stop_immediate_propagation) modifiers.push('stopImmediatePropagation');
dispatch_dev('SvelteDOMAddEventListener', { node, event, handler, modifiers });
const dispose = listen(node, event, handler, options);
return () => {
dispatch_dev('SvelteDOMRemoveEventListener', { node, event, handler, modifiers });
dispose();
};
}
/**
* @param {Element} node
* @param {string} attribute
* @param {string} value
* @returns {void}
*/
function attr_dev(node, attribute, value) {
attr(node, attribute, value);
if (value == null) dispatch_dev('SvelteDOMRemoveAttribute', { node, attribute });
else dispatch_dev('SvelteDOMSetAttribute', { node, attribute, value });
}
/**
* @param {Element} node
* @param {string} property
* @param {any} value
* @returns {void}
*/
function prop_dev(node, property, value) {
node[property] = value;
dispatch_dev('SvelteDOMSetProperty', { node, property, value });
}
/**
* @param {HTMLElement} node
* @param {string} property
* @param {any} value
* @returns {void}
*/
function dataset_dev(node, property, value) {
node.dataset[property] = value;
dispatch_dev('SvelteDOMSetDataset', { node, property, value });
}
/**
* @param {Text} text
* @param {unknown} data
* @returns {void}
*/
function set_data_dev(text, data) {
data = '' + data;
if (text.data === data) return;
dispatch_dev('SvelteDOMSetData', { node: text, data });
text.data = /** @type {string} */ (data);
}
/**
* @param {Text} text
* @param {unknown} data
* @returns {void}
*/
function set_data_contenteditable_dev(text, data) {
data = '' + data;
if (text.wholeText === data) return;
dispatch_dev('SvelteDOMSetData', { node: text, data });
text.data = /** @type {string} */ (data);
}
/**
* @param {Text} text
* @param {unknown} data
* @param {string} attr_value
* @returns {void}
*/
function set_data_maybe_contenteditable_dev(text, data, attr_value) {
if (~contenteditable_truthy_values.indexOf(attr_value)) {
set_data_contenteditable_dev(text, data);
} else {
set_data_dev(text, data);
}
}
/**
* @returns {void} */
function validate_each_argument(arg) {
if (typeof arg !== 'string' && !(arg && typeof arg === 'object' && 'length' in arg)) {
let msg = '{#each} only iterates over array-like objects.';
if (typeof Symbol === 'function' && arg && Symbol.iterator in arg) {
msg += ' You can use a spread to convert this iterable into an array.';
}
throw new Error(msg);
}
}
/**
* @returns {void} */
function validate_slots(name, slot, keys) {
for (const slot_key of Object.keys(slot)) {
if (!~keys.indexOf(slot_key)) {
console.warn(`<${name}> received an unexpected slot "${slot_key}".`);
}
}
}
/**
* @param {unknown} tag
* @returns {void}
*/
function validate_dynamic_element(tag) {
const is_string = typeof tag === 'string';
if (tag && !is_string) {
throw new Error('<svelte:element> expects "this" attribute to be a string.');
}
}
/**
* @param {undefined | string} tag
* @returns {void}
*/
function validate_void_dynamic_element(tag) {
if (tag && is_void(tag)) {
console.warn(`<svelte:element this="${tag}"> is self-closing and cannot have content.`);
}
}
function construct_svelte_component_dev(component, props) {
const error_message = 'this={...} of <svelte:component> should specify a Svelte component.';
try {
const instance = new component(props);
if (!instance.$$ || !instance.$set || !instance.$on || !instance.$destroy) {
throw new Error(error_message);
}
return instance;
} catch (err) {
const { message } = err;
if (typeof message === 'string' && message.indexOf('is not a constructor') !== -1) {
throw new Error(error_message);
} else {
throw err;
}
}
}
/**
* Base class for Svelte components with some minor dev-enhancements. Used when dev=true.
*
* Can be used to create strongly typed Svelte components.
*
* ### Example:
*
* You have component library on npm called `component-library`, from which
* you export a component called `MyComponent`. For Svelte+TypeScript users,
* you want to provide typings. Therefore you create a `index.d.ts`:
* ```ts
* import { SvelteComponent } from "svelte";
* export class MyComponent extends SvelteComponent<{foo: string}> {}
* ```
* Typing this makes it possible for IDEs like VS Code with the Svelte extension
* to provide intellisense and to use the component like this in a Svelte file
* with TypeScript:
* ```svelte
* <script lang="ts">
* import { MyComponent } from "component-library";
* </script>
* <MyComponent foo={'bar'} />
* ```
* @template {Record<string, any>} [Props=any]
* @template {Record<string, any>} [Events=any]
* @template {Record<string, any>} [Slots=any]
* @extends SvelteComponent<Props, Events>
*/
class SvelteComponentDev extends SvelteComponent {
/**
* For type checking capabilities only.
* Does not exist at runtime.
* ### DO NOT USE!
*
* @type {Props}
*/
/**
* For type checking capabilities only.
* Does not exist at runtime.
* ### DO NOT USE!
*
* @type {Events}
*/
/**
* For type checking capabilities only.
* Does not exist at runtime.
* ### DO NOT USE!
*
* @type {Slots}
*/
/** @param {import('./public.js').ComponentConstructorOptions<Props>} options */
constructor(options) {
if (!options || (!options.target && !options.$$inline)) {
throw new Error("'target' is a required option");
}
super();
}
/** @returns {void} */
$destroy() {
super.$destroy();
this.$destroy = () => {
console.warn('Component was already destroyed'); // eslint-disable-line no-console
};
}
/** @returns {void} */
$capture_state() {}
/** @returns {void} */
$inject_state() {}
}
/**
* @template {Record<string, any>} [Props=any]
* @template {Record<string, any>} [Events=any]
* @template {Record<string, any>} [Slots=any]
* @deprecated Use `SvelteComponent` instead. See PR for more information: https://github.com/sveltejs/svelte/pull/8512
* @extends SvelteComponentDev<Props, Events, Slots>
*/
class SvelteComponentTyped extends SvelteComponentDev {}
/** @returns {() => void} */
function loop_guard(timeout) {
const start = Date.now();
return () => {
if (Date.now() - start > timeout) {
throw new Error('Infinite loop detected');
}
};
}
export { SvelteComponentDev, SvelteComponentTyped, append_dev, append_hydration_dev, attr_dev, construct_svelte_component_dev, dataset_dev, detach_after_dev, detach_before_dev, detach_between_dev, detach_dev, dispatch_dev, insert_dev, insert_hydration_dev, is_void, listen_dev, loop_guard, prop_dev, set_data_contenteditable_dev, set_data_dev, set_data_maybe_contenteditable_dev, validate_dynamic_element, validate_each_argument, validate_slots, validate_void_dynamic_element };

382
internal/dev-c6aa8932.js Normal file
View File

@ -0,0 +1,382 @@
'use strict';
var Component = require('./Component-d02c1ae2.js');
/** regex of all html void element names */
const void_element_names =
/^(?:area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/;
function is_void(name) {
return void_element_names.test(name) || name.toLowerCase() === '!doctype';
}
function dispatch_dev(type, detail) {
document.dispatchEvent(
Component.custom_event(type, { version: '4.0.0-next.0', ...detail }, { bubbles: true })
);
}
function append_dev(target, node) {
dispatch_dev('SvelteDOMInsert', { target, node });
Component.append(target, node);
}
function append_hydration_dev(target, node) {
dispatch_dev('SvelteDOMInsert', { target, node });
Component.append_hydration(target, node);
}
function insert_dev(target, node, anchor) {
dispatch_dev('SvelteDOMInsert', { target, node, anchor });
Component.insert(target, node, anchor);
}
function insert_hydration_dev(target, node, anchor) {
dispatch_dev('SvelteDOMInsert', { target, node, anchor });
Component.insert_hydration(target, node, anchor);
}
function detach_dev(node) {
dispatch_dev('SvelteDOMRemove', { node });
Component.detach(node);
}
function detach_between_dev(before, after) {
while (before.nextSibling && before.nextSibling !== after) {
detach_dev(before.nextSibling);
}
}
function detach_before_dev(after) {
while (after.previousSibling) {
detach_dev(after.previousSibling);
}
}
function detach_after_dev(before) {
while (before.nextSibling) {
detach_dev(before.nextSibling);
}
}
function listen_dev(
node,
event,
handler,
options,
has_prevent_default,
has_stop_propagation,
has_stop_immediate_propagation
) {
const modifiers =
options === true ? ['capture'] : options ? Array.from(Object.keys(options)) : [];
if (has_prevent_default) modifiers.push('preventDefault');
if (has_stop_propagation) modifiers.push('stopPropagation');
if (has_stop_immediate_propagation) modifiers.push('stopImmediatePropagation');
dispatch_dev('SvelteDOMAddEventListener', { node, event, handler, modifiers });
const dispose = Component.listen(node, event, handler, options);
return () => {
dispatch_dev('SvelteDOMRemoveEventListener', { node, event, handler, modifiers });
dispose();
};
}
function attr_dev(node, attribute, value) {
Component.attr(node, attribute, value);
if (value == null) dispatch_dev('SvelteDOMRemoveAttribute', { node, attribute });
else dispatch_dev('SvelteDOMSetAttribute', { node, attribute, value });
}
function prop_dev(node, property, value) {
node[property] = value;
dispatch_dev('SvelteDOMSetProperty', { node, property, value });
}
function dataset_dev(node, property, value) {
node.dataset[property] = value;
dispatch_dev('SvelteDOMSetDataset', { node, property, value });
}
function set_data_dev(text, data) {
data = '' + data;
if (text.data === data) return;
dispatch_dev('SvelteDOMSetData', { node: text, data });
text.data = data ;
}
function set_data_contenteditable_dev(text, data) {
data = '' + data;
if (text.wholeText === data) return;
dispatch_dev('SvelteDOMSetData', { node: text, data });
text.data = data ;
}
function set_data_maybe_contenteditable_dev(text, data, attr_value) {
if (~Component.contenteditable_truthy_values.indexOf(attr_value)) {
set_data_contenteditable_dev(text, data);
} else {
set_data_dev(text, data);
}
}
function validate_each_argument(arg) {
if (typeof arg !== 'string' && !(arg && typeof arg === 'object' && 'length' in arg)) {
let msg = '{#each} only iterates over array-like objects.';
if (typeof Symbol === 'function' && arg && Symbol.iterator in arg) {
msg += ' You can use a spread to convert this iterable into an array.';
}
throw new Error(msg);
}
}
function validate_slots(name, slot, keys) {
for (const slot_key of Object.keys(slot)) {
if (!~keys.indexOf(slot_key)) {
console.warn(`<${name}> received an unexpected slot "${slot_key}".`);
}
}
}
function validate_dynamic_element(tag) {
const is_string = typeof tag === 'string';
if (tag && !is_string) {
throw new Error('<svelte:element> expects "this" attribute to be a string.');
}
}
function validate_void_dynamic_element(tag) {
if (tag && is_void(tag)) {
console.warn(`<svelte:element this="${tag}"> is self-closing and cannot have content.`);
}
}
function construct_svelte_component_dev(component, props) {
const error_message = 'this={...} of <svelte:component> should specify a Svelte component.';
try {
const instance = new component(props);
if (!instance.$$ || !instance.$set || !instance.$on || !instance.$destroy) {
throw new Error(error_message);
}
return instance;
} catch (err) {
const { message } = err;
if (typeof message === 'string' && message.indexOf('is not a constructor') !== -1) {
throw new Error(error_message);
} else {
throw err;
}
}
}
/**
* Base class for Svelte components with some minor dev-enhancements. Used when dev=true.
*
* Can be used to create strongly typed Svelte components.
*
* ### Example:
*
* You have component library on npm called `component-library`, from which
* you export a component called `MyComponent`. For Svelte+TypeScript users,
* you want to provide typings. Therefore you create a `index.d.ts`:
* ```ts
* import { SvelteComponent } from "svelte";
* export class MyComponent extends SvelteComponent<{foo: string}> {}
* ```
* Typing this makes it possible for IDEs like VS Code with the Svelte extension
* to provide intellisense and to use the component like this in a Svelte file
* with TypeScript:
* ```svelte
* <script lang="ts">
* import { MyComponent } from "component-library";
* </script>
* <MyComponent foo={'bar'} />
* ```
*/
class SvelteComponentDev
extends Component.SvelteComponent {
/**
* @private
* For type checking capabilities only.
* Does not exist at runtime.
* ### DO NOT USE!
*/
/**
* @private
* For type checking capabilities only.
* Does not exist at runtime.
* ### DO NOT USE!
*/
/**
* @private
* For type checking capabilities only.
* Does not exist at runtime.
* ### DO NOT USE!
*/
constructor(options) {
if (!options || (!options.target && !options.$$inline)) {
throw new Error("'target' is a required option");
}
super();
}
$destroy() {
super.$destroy();
this.$destroy = () => {
console.warn('Component was already destroyed'); // eslint-disable-line no-console
};
}
$capture_state() {}
$inject_state() {}
}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
/**
* @deprecated Use `SvelteComponent` instead. See PR for more information: https://github.com/sveltejs/svelte/pull/8512
*/
class SvelteComponentTyped
extends SvelteComponentDev {}
/**
* Convenience type to get the type of a Svelte component. Useful for example in combination with
* dynamic components using `<svelte:component>`.
*
* Example:
* ```svelte
* <script lang="ts">
* import type { ComponentType, SvelteComponent } from 'svelte';
* import Component1 from './Component1.svelte';
* import Component2 from './Component2.svelte';
*
* const component: ComponentType = someLogic() ? Component1 : Component2;
* const componentOfCertainSubType: ComponentType<SvelteComponent<{ needsThisProp: string }>> = someLogic() ? Component1 : Component2;
* </script>
*
* <svelte:component this={component} />
* <svelte:component this={componentOfCertainSubType} needsThisProp="hello" />
* ```
*/
function loop_guard(timeout) {
const start = Date.now();
return () => {
if (Date.now() - start > timeout) {
throw new Error('Infinite loop detected');
}
};
}
exports.SvelteComponentDev = SvelteComponentDev;
exports.SvelteComponentTyped = SvelteComponentTyped;
exports.append_dev = append_dev;
exports.append_hydration_dev = append_hydration_dev;
exports.attr_dev = attr_dev;
exports.construct_svelte_component_dev = construct_svelte_component_dev;
exports.dataset_dev = dataset_dev;
exports.detach_after_dev = detach_after_dev;
exports.detach_before_dev = detach_before_dev;
exports.detach_between_dev = detach_between_dev;
exports.detach_dev = detach_dev;
exports.dispatch_dev = dispatch_dev;
exports.insert_dev = insert_dev;
exports.insert_hydration_dev = insert_hydration_dev;
exports.is_void = is_void;
exports.listen_dev = listen_dev;
exports.loop_guard = loop_guard;
exports.prop_dev = prop_dev;
exports.set_data_contenteditable_dev = set_data_contenteditable_dev;
exports.set_data_dev = set_data_dev;
exports.set_data_maybe_contenteditable_dev = set_data_maybe_contenteditable_dev;
exports.validate_dynamic_element = validate_dynamic_element;
exports.validate_each_argument = validate_each_argument;
exports.validate_slots = validate_slots;
exports.validate_void_dynamic_element = validate_void_dynamic_element;

1
internal/index.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from '../types/runtime/internal/index.js';

813
internal/index.js Normal file
View File

@ -0,0 +1,813 @@
'use strict';
var Component = require('./Component-9c4b98a2.js');
var dev = require('./dev-1537023e.js');
/**
* @param {Element & ElementCSSInlineStyle} node
* @param {import('./private.js').PositionRect} from
* @param {import('./private.js').AnimationFn} fn
*/
function create_animation(node, from, fn, params) {
if (!from) return Component.noop;
const to = node.getBoundingClientRect();
if (
from.left === to.left &&
from.right === to.right &&
from.top === to.top &&
from.bottom === to.bottom
)
return Component.noop;
const {
delay = 0,
duration = 300,
easing = Component.identity,
// @ts-ignore todo: should this be separated from destructuring? Or start/end added to public api and documentation?
start: start_time = Component.now() + delay,
// @ts-ignore todo:
end = start_time + duration,
tick = Component.noop,
css
} = fn(node, { from, to }, params);
let running = true;
let started = false;
let name;
/** @returns {void} */
function start() {
if (css) {
name = Component.create_rule(node, 0, 1, duration, delay, easing, css);
}
if (!delay) {
started = true;
}
}
/** @returns {void} */
function stop() {
if (css) Component.delete_rule(node, name);
running = false;
}
Component.loop((now) => {
if (!started && now >= start_time) {
started = true;
}
if (started && now >= end) {
tick(1, 0);
stop();
}
if (!running) {
return false;
}
if (started) {
const p = now - start_time;
const t = 0 + 1 * easing(p / duration);
tick(t, 1 - t);
}
return true;
});
start();
tick(0, 1);
return stop;
}
/**
* @param {Element & ElementCSSInlineStyle} node
* @returns {void}
*/
function fix_position(node) {
const style = getComputedStyle(node);
if (style.position !== 'absolute' && style.position !== 'fixed') {
const { width, height } = style;
const a = node.getBoundingClientRect();
node.style.position = 'absolute';
node.style.width = width;
node.style.height = height;
add_transform(node, a);
}
}
/**
* @param {Element & ElementCSSInlineStyle} node
* @param {import('./private.js').PositionRect} a
* @returns {void}
*/
function add_transform(node, a) {
const b = node.getBoundingClientRect();
if (a.left !== b.left || a.top !== b.top) {
const style = getComputedStyle(node);
const transform = style.transform === 'none' ? '' : style.transform;
node.style.transform = `${transform} translate(${a.left - b.left}px, ${a.top - b.top}px)`;
}
}
/**
* @template T
* @param {Promise<T>} promise
* @param {import('./private.js').PromiseInfo<T>} info
* @returns {boolean}
*/
function handle_promise(promise, info) {
const token = (info.token = {});
/**
* @param {import('./private.js').FragmentFactory} type
* @param {0 | 1 | 2} index
* @param {number} [key]
* @param {any} [value]
* @returns {void}
*/
function update(type, index, key, value) {
if (info.token !== token) return;
info.resolved = value;
let child_ctx = info.ctx;
if (key !== undefined) {
child_ctx = child_ctx.slice();
child_ctx[key] = value;
}
const block = type && (info.current = type)(child_ctx);
let needs_flush = false;
if (info.block) {
if (info.blocks) {
info.blocks.forEach((block, i) => {
if (i !== index && block) {
Component.group_outros();
Component.transition_out(block, 1, 1, () => {
if (info.blocks[i] === block) {
info.blocks[i] = null;
}
});
Component.check_outros();
}
});
} else {
info.block.d(1);
}
block.c();
Component.transition_in(block, 1);
block.m(info.mount(), info.anchor);
needs_flush = true;
}
info.block = block;
if (info.blocks) info.blocks[index] = block;
if (needs_flush) {
Component.flush();
}
}
if (Component.is_promise(promise)) {
const current_component = Component.get_current_component();
promise.then(
(value) => {
Component.set_current_component(current_component);
update(info.then, 1, info.value, value);
Component.set_current_component(null);
},
(error) => {
Component.set_current_component(current_component);
update(info.catch, 2, info.error, error);
Component.set_current_component(null);
if (!info.hasCatch) {
throw error;
}
}
);
// if we previously had a then/catch block, destroy it
if (info.current !== info.pending) {
update(info.pending, 0);
return true;
}
} else {
if (info.current !== info.then) {
update(info.then, 1, info.value, promise);
return true;
}
info.resolved = /** @type {T} */ (promise);
}
}
/** @returns {void} */
function update_await_block_branch(info, ctx, dirty) {
const child_ctx = ctx.slice();
const { resolved } = info;
if (info.current === info.then) {
child_ctx[info.value] = resolved;
}
if (info.current === info.catch) {
child_ctx[info.error] = resolved;
}
info.block.p(child_ctx, dirty);
}
/** @returns {void} */
function destroy_block(block, lookup) {
block.d(1);
lookup.delete(block.key);
}
/** @returns {void} */
function outro_and_destroy_block(block, lookup) {
Component.transition_out(block, 1, 1, () => {
lookup.delete(block.key);
});
}
/** @returns {void} */
function fix_and_destroy_block(block, lookup) {
block.f();
destroy_block(block, lookup);
}
/** @returns {void} */
function fix_and_outro_and_destroy_block(block, lookup) {
block.f();
outro_and_destroy_block(block, lookup);
}
/** @returns {any[]} */
function update_keyed_each(
old_blocks,
dirty,
get_key,
dynamic,
ctx,
list,
lookup,
node,
destroy,
create_each_block,
next,
get_context
) {
let o = old_blocks.length;
let n = list.length;
let i = o;
const old_indexes = {};
while (i--) old_indexes[old_blocks[i].key] = i;
const new_blocks = [];
const new_lookup = new Map();
const deltas = new Map();
const updates = [];
i = n;
while (i--) {
const child_ctx = get_context(ctx, list, i);
const key = get_key(child_ctx);
let block = lookup.get(key);
if (!block) {
block = create_each_block(key, child_ctx);
block.c();
} else if (dynamic) {
// defer updates until all the DOM shuffling is done
updates.push(() => block.p(child_ctx, dirty));
}
new_lookup.set(key, (new_blocks[i] = block));
if (key in old_indexes) deltas.set(key, Math.abs(i - old_indexes[key]));
}
const will_move = new Set();
const did_move = new Set();
/** @returns {void} */
function insert(block) {
Component.transition_in(block, 1);
block.m(node, next);
lookup.set(block.key, block);
next = block.first;
n--;
}
while (o && n) {
const new_block = new_blocks[n - 1];
const old_block = old_blocks[o - 1];
const new_key = new_block.key;
const old_key = old_block.key;
if (new_block === old_block) {
// do nothing
next = new_block.first;
o--;
n--;
} else if (!new_lookup.has(old_key)) {
// remove old block
destroy(old_block, lookup);
o--;
} else if (!lookup.has(new_key) || will_move.has(new_key)) {
insert(new_block);
} else if (did_move.has(old_key)) {
o--;
} else if (deltas.get(new_key) > deltas.get(old_key)) {
did_move.add(new_key);
insert(new_block);
} else {
will_move.add(old_key);
o--;
}
}
while (o--) {
const old_block = old_blocks[o];
if (!new_lookup.has(old_block.key)) destroy(old_block, lookup);
}
while (n) insert(new_blocks[n - 1]);
Component.run_all(updates);
return new_blocks;
}
/** @returns {void} */
function validate_each_keys(ctx, list, get_context, get_key) {
const keys = new Map();
for (let i = 0; i < list.length; i++) {
const key = get_key(get_context(ctx, list, i));
if (keys.has(key)) {
let value = '';
try {
value = `with value '${String(key)}' `;
} catch (e) {
// can't stringify
}
throw new Error(
`Cannot have duplicate keys in a keyed each: Keys at index ${keys.get(
key
)} and ${i} ${value}are duplicates`
);
}
keys.set(key, i);
}
}
/** @returns {{}} */
function get_spread_update(levels, updates) {
const update = {};
const to_null_out = {};
const accounted_for = { $$scope: 1 };
let i = levels.length;
while (i--) {
const o = levels[i];
const n = updates[i];
if (n) {
for (const key in o) {
if (!(key in n)) to_null_out[key] = 1;
}
for (const key in n) {
if (!accounted_for[key]) {
update[key] = n[key];
accounted_for[key] = 1;
}
}
levels[i] = n;
} else {
for (const key in o) {
accounted_for[key] = 1;
}
}
}
for (const key in to_null_out) {
if (!(key in update)) update[key] = undefined;
}
return update;
}
function get_spread_object(spread_props) {
return typeof spread_props === 'object' && spread_props !== null ? spread_props : {};
}
const _boolean_attributes = /** @type {const} */ ([
'allowfullscreen',
'allowpaymentrequest',
'async',
'autofocus',
'autoplay',
'checked',
'controls',
'default',
'defer',
'disabled',
'formnovalidate',
'hidden',
'inert',
'ismap',
'loop',
'multiple',
'muted',
'nomodule',
'novalidate',
'open',
'playsinline',
'readonly',
'required',
'reversed',
'selected'
]);
/**
* List of HTML boolean attributes (e.g. `<input disabled>`).
* Source: https://html.spec.whatwg.org/multipage/indices.html
*
* @type {Set<string>}
*/
const boolean_attributes = new Set([..._boolean_attributes]);
/** @typedef {typeof _boolean_attributes[number]} BooleanAttributes */
const invalid_attribute_name_character =
/[\s'">/=\u{FDD0}-\u{FDEF}\u{FFFE}\u{FFFF}\u{1FFFE}\u{1FFFF}\u{2FFFE}\u{2FFFF}\u{3FFFE}\u{3FFFF}\u{4FFFE}\u{4FFFF}\u{5FFFE}\u{5FFFF}\u{6FFFE}\u{6FFFF}\u{7FFFE}\u{7FFFF}\u{8FFFE}\u{8FFFF}\u{9FFFE}\u{9FFFF}\u{AFFFE}\u{AFFFF}\u{BFFFE}\u{BFFFF}\u{CFFFE}\u{CFFFF}\u{DFFFE}\u{DFFFF}\u{EFFFE}\u{EFFFF}\u{FFFFE}\u{FFFFF}\u{10FFFE}\u{10FFFF}]/u;
// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
// https://infra.spec.whatwg.org/#noncharacter
/** @returns {string} */
function spread(args, attrs_to_add) {
const attributes = Object.assign({}, ...args);
if (attrs_to_add) {
const classes_to_add = attrs_to_add.classes;
const styles_to_add = attrs_to_add.styles;
if (classes_to_add) {
if (attributes.class == null) {
attributes.class = classes_to_add;
} else {
attributes.class += ' ' + classes_to_add;
}
}
if (styles_to_add) {
if (attributes.style == null) {
attributes.style = style_object_to_string(styles_to_add);
} else {
attributes.style = style_object_to_string(
merge_ssr_styles(attributes.style, styles_to_add)
);
}
}
}
let str = '';
Object.keys(attributes).forEach((name) => {
if (invalid_attribute_name_character.test(name)) return;
const value = attributes[name];
if (value === true) str += ' ' + name;
else if (boolean_attributes.has(name.toLowerCase())) {
if (value) str += ' ' + name;
} else if (value != null) {
str += ` ${name}="${value}"`;
}
});
return str;
}
/** @returns {{}} */
function merge_ssr_styles(style_attribute, style_directive) {
const style_object = {};
for (const individual_style of style_attribute.split(';')) {
const colon_index = individual_style.indexOf(':');
const name = individual_style.slice(0, colon_index).trim();
const value = individual_style.slice(colon_index + 1).trim();
if (!name) continue;
style_object[name] = value;
}
for (const name in style_directive) {
const value = style_directive[name];
if (value) {
style_object[name] = value;
} else {
delete style_object[name];
}
}
return style_object;
}
const ATTR_REGEX = /[&"]/g;
const CONTENT_REGEX = /[&<]/g;
/**
* Note: this method is performance sensitive and has been optimized
* https://github.com/sveltejs/svelte/pull/5701
* @param {unknown} value
* @returns {string}
*/
function escape(value, is_attr = false) {
const str = String(value);
const pattern = is_attr ? ATTR_REGEX : CONTENT_REGEX;
pattern.lastIndex = 0;
let escaped = '';
let last = 0;
while (pattern.test(str)) {
const i = pattern.lastIndex - 1;
const ch = str[i];
escaped += str.substring(last, i) + (ch === '&' ? '&amp;' : ch === '"' ? '&quot;' : '&lt;');
last = i + 1;
}
return escaped + str.substring(last);
}
function escape_attribute_value(value) {
// keep booleans, null, and undefined for the sake of `spread`
const should_escape = typeof value === 'string' || (value && typeof value === 'object');
return should_escape ? escape(value, true) : value;
}
/** @returns {{}} */
function escape_object(obj) {
const result = {};
for (const key in obj) {
result[key] = escape_attribute_value(obj[key]);
}
return result;
}
/** @returns {string} */
function each(items, fn) {
let str = '';
for (let i = 0; i < items.length; i += 1) {
str += fn(items[i], i);
}
return str;
}
const missing_component = {
$$render: () => ''
};
function validate_component(component, name) {
if (!component || !component.$$render) {
if (name === 'svelte:component') name += ' this={...}';
throw new Error(
`<${name}> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules. Otherwise you may need to fix a <${name}>.`
);
}
return component;
}
/** @returns {string} */
function debug(file, line, column, values) {
console.log(`{@debug} ${file ? file + ' ' : ''}(${line}:${column})`); // eslint-disable-line no-console
console.log(values); // eslint-disable-line no-console
return '';
}
let on_destroy;
/** @returns {{ render: (props?: {}, { $$slots, context }?: { $$slots?: {}; context?: Map<any, any>; }) => { html: any; css: { code: string; map: any; }; head: string; }; $$render: (result: any, props: any, bindings: any, slots: any, context: any) => any; }} */
function create_ssr_component(fn) {
function $$render(result, props, bindings, slots, context) {
const parent_component = Component.current_component;
const $$ = {
on_destroy,
context: new Map(context || (parent_component ? parent_component.$$.context : [])),
// these will be immediately discarded
on_mount: [],
before_update: [],
after_update: [],
callbacks: Component.blank_object()
};
Component.set_current_component({ $$ });
const html = fn(result, props, bindings, slots);
Component.set_current_component(parent_component);
return html;
}
return {
render: (props = {}, { $$slots = {}, context = new Map() } = {}) => {
on_destroy = [];
const result = { title: '', head: '', css: new Set() };
const html = $$render(result, props, {}, $$slots, context);
Component.run_all(on_destroy);
return {
html,
css: {
code: Array.from(result.css)
.map((css) => css.code)
.join('\n'),
map: null // TODO
},
head: result.title + result.head
};
},
$$render
};
}
/** @returns {string} */
function add_attribute(name, value, boolean) {
if (value == null || (boolean && !value)) return '';
const assignment = boolean && value === true ? '' : `="${escape(value, true)}"`;
return ` ${name}${assignment}`;
}
/** @returns {string} */
function add_classes(classes) {
return classes ? ` class="${classes}"` : '';
}
/** @returns {string} */
function style_object_to_string(style_object) {
return Object.keys(style_object)
.filter((key) => style_object[key])
.map((key) => `${key}: ${escape_attribute_value(style_object[key])};`)
.join(' ');
}
/** @returns {string} */
function add_styles(style_object) {
const styles = style_object_to_string(style_object);
return styles ? ` style="${styles}"` : '';
}
exports.HtmlTag = Component.HtmlTag;
exports.HtmlTagHydration = Component.HtmlTagHydration;
exports.ResizeObserverSingleton = Component.ResizeObserverSingleton;
exports.SvelteComponent = Component.SvelteComponent;
Object.defineProperty(exports, 'SvelteElement', {
enumerable: true,
get: function () { return Component.SvelteElement; }
});
exports.action_destroyer = Component.action_destroyer;
exports.add_flush_callback = Component.add_flush_callback;
exports.add_iframe_resize_listener = Component.add_iframe_resize_listener;
exports.add_location = Component.add_location;
exports.add_render_callback = Component.add_render_callback;
exports.afterUpdate = Component.afterUpdate;
exports.append = Component.append;
exports.append_empty_stylesheet = Component.append_empty_stylesheet;
exports.append_hydration = Component.append_hydration;
exports.append_styles = Component.append_styles;
exports.assign = Component.assign;
exports.attr = Component.attr;
exports.attribute_to_object = Component.attribute_to_object;
exports.beforeUpdate = Component.beforeUpdate;
exports.bind = Component.bind;
exports.binding_callbacks = Component.binding_callbacks;
exports.blank_object = Component.blank_object;
exports.bubble = Component.bubble;
exports.check_outros = Component.check_outros;
exports.children = Component.children;
exports.claim_comment = Component.claim_comment;
exports.claim_component = Component.claim_component;
exports.claim_element = Component.claim_element;
exports.claim_html_tag = Component.claim_html_tag;
exports.claim_space = Component.claim_space;
exports.claim_svg_element = Component.claim_svg_element;
exports.claim_text = Component.claim_text;
exports.clear_loops = Component.clear_loops;
exports.comment = Component.comment;
exports.component_subscribe = Component.component_subscribe;
exports.compute_rest_props = Component.compute_rest_props;
exports.compute_slots = Component.compute_slots;
exports.construct_svelte_component = Component.construct_svelte_component;
exports.contenteditable_truthy_values = Component.contenteditable_truthy_values;
exports.createEventDispatcher = Component.createEventDispatcher;
exports.create_bidirectional_transition = Component.create_bidirectional_transition;
exports.create_component = Component.create_component;
exports.create_custom_element = Component.create_custom_element;
exports.create_in_transition = Component.create_in_transition;
exports.create_out_transition = Component.create_out_transition;
exports.create_slot = Component.create_slot;
Object.defineProperty(exports, 'current_component', {
enumerable: true,
get: function () { return Component.current_component; }
});
exports.custom_event = Component.custom_event;
exports.destroy_component = Component.destroy_component;
exports.destroy_each = Component.destroy_each;
exports.detach = Component.detach;
exports.dirty_components = Component.dirty_components;
exports.element = Component.element;
exports.element_is = Component.element_is;
exports.empty = Component.empty;
exports.end_hydrating = Component.end_hydrating;
exports.exclude_internal_props = Component.exclude_internal_props;
exports.flush = Component.flush;
exports.flush_render_callbacks = Component.flush_render_callbacks;
exports.getAllContexts = Component.getAllContexts;
exports.getContext = Component.getContext;
exports.get_all_dirty_from_scope = Component.get_all_dirty_from_scope;
exports.get_binding_group_value = Component.get_binding_group_value;
exports.get_current_component = Component.get_current_component;
exports.get_custom_elements_slots = Component.get_custom_elements_slots;
exports.get_root_for_style = Component.get_root_for_style;
exports.get_slot_changes = Component.get_slot_changes;
exports.get_store_value = Component.get_store_value;
exports.get_svelte_dataset = Component.get_svelte_dataset;
exports.globals = Component.globals;
exports.group_outros = Component.group_outros;
exports.hasContext = Component.hasContext;
exports.has_prop = Component.has_prop;
exports.head_selector = Component.head_selector;
exports.identity = Component.identity;
exports.init = Component.init;
exports.init_binding_group = Component.init_binding_group;
exports.init_binding_group_dynamic = Component.init_binding_group_dynamic;
exports.insert = Component.insert;
exports.insert_hydration = Component.insert_hydration;
exports.intros = Component.intros;
exports.is_client = Component.is_client;
exports.is_crossorigin = Component.is_crossorigin;
exports.is_empty = Component.is_empty;
exports.is_function = Component.is_function;
exports.is_promise = Component.is_promise;
exports.listen = Component.listen;
exports.loop = Component.loop;
exports.mount_component = Component.mount_component;
exports.noop = Component.noop;
exports.not_equal = Component.not_equal;
Object.defineProperty(exports, 'now', {
enumerable: true,
get: function () { return Component.now; }
});
exports.null_to_empty = Component.null_to_empty;
exports.object_without_properties = Component.object_without_properties;
exports.onDestroy = Component.onDestroy;
exports.onMount = Component.onMount;
exports.once = Component.once;
exports.prevent_default = Component.prevent_default;
exports.query_selector_all = Component.query_selector_all;
Object.defineProperty(exports, 'raf', {
enumerable: true,
get: function () { return Component.raf; }
});
exports.resize_observer_border_box = Component.resize_observer_border_box;
exports.resize_observer_content_box = Component.resize_observer_content_box;
exports.resize_observer_device_pixel_content_box = Component.resize_observer_device_pixel_content_box;
exports.run = Component.run;
exports.run_all = Component.run_all;
exports.safe_not_equal = Component.safe_not_equal;
exports.schedule_update = Component.schedule_update;
exports.select_multiple_value = Component.select_multiple_value;
exports.select_option = Component.select_option;
exports.select_options = Component.select_options;
exports.select_value = Component.select_value;
exports.self = Component.self;
exports.setContext = Component.setContext;
exports.set_attributes = Component.set_attributes;
exports.set_current_component = Component.set_current_component;
exports.set_custom_element_data = Component.set_custom_element_data;
exports.set_custom_element_data_map = Component.set_custom_element_data_map;
exports.set_data = Component.set_data;
exports.set_data_contenteditable = Component.set_data_contenteditable;
exports.set_data_maybe_contenteditable = Component.set_data_maybe_contenteditable;
exports.set_dynamic_element_data = Component.set_dynamic_element_data;
exports.set_input_type = Component.set_input_type;
exports.set_input_value = Component.set_input_value;
exports.set_now = Component.set_now;
exports.set_raf = Component.set_raf;
exports.set_store_value = Component.set_store_value;
exports.set_style = Component.set_style;
exports.set_svg_attributes = Component.set_svg_attributes;
exports.space = Component.space;
exports.split_css_unit = Component.split_css_unit;
exports.src_url_equal = Component.src_url_equal;
exports.start_hydrating = Component.start_hydrating;
exports.stop_immediate_propagation = Component.stop_immediate_propagation;
exports.stop_propagation = Component.stop_propagation;
exports.subscribe = Component.subscribe;
exports.svg_element = Component.svg_element;
exports.text = Component.text;
exports.tick = Component.tick;
exports.time_ranges_to_array = Component.time_ranges_to_array;
exports.to_number = Component.to_number;
exports.toggle_class = Component.toggle_class;
exports.transition_in = Component.transition_in;
exports.transition_out = Component.transition_out;
exports.trusted = Component.trusted;
exports.update_slot = Component.update_slot;
exports.update_slot_base = Component.update_slot_base;
exports.validate_store = Component.validate_store;
exports.xlink_attr = Component.xlink_attr;
exports.SvelteComponentDev = dev.SvelteComponentDev;
exports.SvelteComponentTyped = dev.SvelteComponentTyped;
exports.append_dev = dev.append_dev;
exports.append_hydration_dev = dev.append_hydration_dev;
exports.attr_dev = dev.attr_dev;
exports.construct_svelte_component_dev = dev.construct_svelte_component_dev;
exports.dataset_dev = dev.dataset_dev;
exports.detach_after_dev = dev.detach_after_dev;
exports.detach_before_dev = dev.detach_before_dev;
exports.detach_between_dev = dev.detach_between_dev;
exports.detach_dev = dev.detach_dev;
exports.dispatch_dev = dev.dispatch_dev;
exports.insert_dev = dev.insert_dev;
exports.insert_hydration_dev = dev.insert_hydration_dev;
exports.is_void = dev.is_void;
exports.listen_dev = dev.listen_dev;
exports.loop_guard = dev.loop_guard;
exports.prop_dev = dev.prop_dev;
exports.set_data_contenteditable_dev = dev.set_data_contenteditable_dev;
exports.set_data_dev = dev.set_data_dev;
exports.set_data_maybe_contenteditable_dev = dev.set_data_maybe_contenteditable_dev;
exports.validate_dynamic_element = dev.validate_dynamic_element;
exports.validate_each_argument = dev.validate_each_argument;
exports.validate_slots = dev.validate_slots;
exports.validate_void_dynamic_element = dev.validate_void_dynamic_element;
exports.add_attribute = add_attribute;
exports.add_classes = add_classes;
exports.add_styles = add_styles;
exports.add_transform = add_transform;
exports.create_animation = create_animation;
exports.create_ssr_component = create_ssr_component;
exports.debug = debug;
exports.destroy_block = destroy_block;
exports.each = each;
exports.escape = escape;
exports.escape_attribute_value = escape_attribute_value;
exports.escape_object = escape_object;
exports.fix_and_destroy_block = fix_and_destroy_block;
exports.fix_and_outro_and_destroy_block = fix_and_outro_and_destroy_block;
exports.fix_position = fix_position;
exports.get_spread_object = get_spread_object;
exports.get_spread_update = get_spread_update;
exports.handle_promise = handle_promise;
exports.invalid_attribute_name_character = invalid_attribute_name_character;
exports.merge_ssr_styles = merge_ssr_styles;
exports.missing_component = missing_component;
exports.outro_and_destroy_block = outro_and_destroy_block;
exports.spread = spread;
exports.update_await_block_branch = update_await_block_branch;
exports.update_keyed_each = update_keyed_each;
exports.validate_component = validate_component;
exports.validate_each_keys = validate_each_keys;

601
internal/index.mjs Normal file
View File

@ -0,0 +1,601 @@
import { noop, identity, now, loop, create_rule, delete_rule, is_promise, get_current_component, set_current_component, group_outros, transition_out, check_outros, transition_in, flush, run_all, blank_object, current_component } from './Component-cd97939e.mjs';
export { HtmlTag, HtmlTagHydration, ResizeObserverSingleton, SvelteComponent, SvelteElement, action_destroyer, add_flush_callback, add_iframe_resize_listener, add_location, add_render_callback, afterUpdate, append, append_empty_stylesheet, append_hydration, append_styles, assign, attr, attribute_to_object, beforeUpdate, bind, binding_callbacks, bubble, children, claim_comment, claim_component, claim_element, claim_html_tag, claim_space, claim_svg_element, claim_text, clear_loops, comment, component_subscribe, compute_rest_props, compute_slots, construct_svelte_component, contenteditable_truthy_values, createEventDispatcher, create_bidirectional_transition, create_component, create_custom_element, create_in_transition, create_out_transition, create_slot, custom_event, destroy_component, destroy_each, detach, dirty_components, element, element_is, empty, end_hydrating, exclude_internal_props, flush_render_callbacks, getAllContexts, getContext, get_all_dirty_from_scope, get_binding_group_value, get_custom_elements_slots, get_root_for_style, get_slot_changes, get_store_value, get_svelte_dataset, globals, hasContext, has_prop, head_selector, init, init_binding_group, init_binding_group_dynamic, insert, insert_hydration, intros, is_client, is_crossorigin, is_empty, is_function, listen, mount_component, not_equal, null_to_empty, object_without_properties, onDestroy, onMount, once, prevent_default, query_selector_all, raf, resize_observer_border_box, resize_observer_content_box, resize_observer_device_pixel_content_box, run, safe_not_equal, schedule_update, select_multiple_value, select_option, select_options, select_value, self, setContext, set_attributes, set_custom_element_data, set_custom_element_data_map, set_data, set_data_contenteditable, set_data_maybe_contenteditable, set_dynamic_element_data, set_input_type, set_input_value, set_now, set_raf, set_store_value, set_style, set_svg_attributes, space, split_css_unit, src_url_equal, start_hydrating, stop_immediate_propagation, stop_propagation, subscribe, svg_element, text, tick, time_ranges_to_array, to_number, toggle_class, trusted, update_slot, update_slot_base, validate_store, xlink_attr } from './Component-cd97939e.mjs';
export { SvelteComponentDev, SvelteComponentTyped, append_dev, append_hydration_dev, attr_dev, construct_svelte_component_dev, dataset_dev, detach_after_dev, detach_before_dev, detach_between_dev, detach_dev, dispatch_dev, insert_dev, insert_hydration_dev, is_void, listen_dev, loop_guard, prop_dev, set_data_contenteditable_dev, set_data_dev, set_data_maybe_contenteditable_dev, validate_dynamic_element, validate_each_argument, validate_slots, validate_void_dynamic_element } from './dev-89102382.mjs';
/**
* @param {Element & ElementCSSInlineStyle} node
* @param {import('./private.js').PositionRect} from
* @param {import('./private.js').AnimationFn} fn
*/
function create_animation(node, from, fn, params) {
if (!from) return noop;
const to = node.getBoundingClientRect();
if (
from.left === to.left &&
from.right === to.right &&
from.top === to.top &&
from.bottom === to.bottom
)
return noop;
const {
delay = 0,
duration = 300,
easing = identity,
// @ts-ignore todo: should this be separated from destructuring? Or start/end added to public api and documentation?
start: start_time = now() + delay,
// @ts-ignore todo:
end = start_time + duration,
tick = noop,
css
} = fn(node, { from, to }, params);
let running = true;
let started = false;
let name;
/** @returns {void} */
function start() {
if (css) {
name = create_rule(node, 0, 1, duration, delay, easing, css);
}
if (!delay) {
started = true;
}
}
/** @returns {void} */
function stop() {
if (css) delete_rule(node, name);
running = false;
}
loop((now) => {
if (!started && now >= start_time) {
started = true;
}
if (started && now >= end) {
tick(1, 0);
stop();
}
if (!running) {
return false;
}
if (started) {
const p = now - start_time;
const t = 0 + 1 * easing(p / duration);
tick(t, 1 - t);
}
return true;
});
start();
tick(0, 1);
return stop;
}
/**
* @param {Element & ElementCSSInlineStyle} node
* @returns {void}
*/
function fix_position(node) {
const style = getComputedStyle(node);
if (style.position !== 'absolute' && style.position !== 'fixed') {
const { width, height } = style;
const a = node.getBoundingClientRect();
node.style.position = 'absolute';
node.style.width = width;
node.style.height = height;
add_transform(node, a);
}
}
/**
* @param {Element & ElementCSSInlineStyle} node
* @param {import('./private.js').PositionRect} a
* @returns {void}
*/
function add_transform(node, a) {
const b = node.getBoundingClientRect();
if (a.left !== b.left || a.top !== b.top) {
const style = getComputedStyle(node);
const transform = style.transform === 'none' ? '' : style.transform;
node.style.transform = `${transform} translate(${a.left - b.left}px, ${a.top - b.top}px)`;
}
}
/**
* @template T
* @param {Promise<T>} promise
* @param {import('./private.js').PromiseInfo<T>} info
* @returns {boolean}
*/
function handle_promise(promise, info) {
const token = (info.token = {});
/**
* @param {import('./private.js').FragmentFactory} type
* @param {0 | 1 | 2} index
* @param {number} [key]
* @param {any} [value]
* @returns {void}
*/
function update(type, index, key, value) {
if (info.token !== token) return;
info.resolved = value;
let child_ctx = info.ctx;
if (key !== undefined) {
child_ctx = child_ctx.slice();
child_ctx[key] = value;
}
const block = type && (info.current = type)(child_ctx);
let needs_flush = false;
if (info.block) {
if (info.blocks) {
info.blocks.forEach((block, i) => {
if (i !== index && block) {
group_outros();
transition_out(block, 1, 1, () => {
if (info.blocks[i] === block) {
info.blocks[i] = null;
}
});
check_outros();
}
});
} else {
info.block.d(1);
}
block.c();
transition_in(block, 1);
block.m(info.mount(), info.anchor);
needs_flush = true;
}
info.block = block;
if (info.blocks) info.blocks[index] = block;
if (needs_flush) {
flush();
}
}
if (is_promise(promise)) {
const current_component = get_current_component();
promise.then(
(value) => {
set_current_component(current_component);
update(info.then, 1, info.value, value);
set_current_component(null);
},
(error) => {
set_current_component(current_component);
update(info.catch, 2, info.error, error);
set_current_component(null);
if (!info.hasCatch) {
throw error;
}
}
);
// if we previously had a then/catch block, destroy it
if (info.current !== info.pending) {
update(info.pending, 0);
return true;
}
} else {
if (info.current !== info.then) {
update(info.then, 1, info.value, promise);
return true;
}
info.resolved = /** @type {T} */ (promise);
}
}
/** @returns {void} */
function update_await_block_branch(info, ctx, dirty) {
const child_ctx = ctx.slice();
const { resolved } = info;
if (info.current === info.then) {
child_ctx[info.value] = resolved;
}
if (info.current === info.catch) {
child_ctx[info.error] = resolved;
}
info.block.p(child_ctx, dirty);
}
/** @returns {void} */
function destroy_block(block, lookup) {
block.d(1);
lookup.delete(block.key);
}
/** @returns {void} */
function outro_and_destroy_block(block, lookup) {
transition_out(block, 1, 1, () => {
lookup.delete(block.key);
});
}
/** @returns {void} */
function fix_and_destroy_block(block, lookup) {
block.f();
destroy_block(block, lookup);
}
/** @returns {void} */
function fix_and_outro_and_destroy_block(block, lookup) {
block.f();
outro_and_destroy_block(block, lookup);
}
/** @returns {any[]} */
function update_keyed_each(
old_blocks,
dirty,
get_key,
dynamic,
ctx,
list,
lookup,
node,
destroy,
create_each_block,
next,
get_context
) {
let o = old_blocks.length;
let n = list.length;
let i = o;
const old_indexes = {};
while (i--) old_indexes[old_blocks[i].key] = i;
const new_blocks = [];
const new_lookup = new Map();
const deltas = new Map();
const updates = [];
i = n;
while (i--) {
const child_ctx = get_context(ctx, list, i);
const key = get_key(child_ctx);
let block = lookup.get(key);
if (!block) {
block = create_each_block(key, child_ctx);
block.c();
} else if (dynamic) {
// defer updates until all the DOM shuffling is done
updates.push(() => block.p(child_ctx, dirty));
}
new_lookup.set(key, (new_blocks[i] = block));
if (key in old_indexes) deltas.set(key, Math.abs(i - old_indexes[key]));
}
const will_move = new Set();
const did_move = new Set();
/** @returns {void} */
function insert(block) {
transition_in(block, 1);
block.m(node, next);
lookup.set(block.key, block);
next = block.first;
n--;
}
while (o && n) {
const new_block = new_blocks[n - 1];
const old_block = old_blocks[o - 1];
const new_key = new_block.key;
const old_key = old_block.key;
if (new_block === old_block) {
// do nothing
next = new_block.first;
o--;
n--;
} else if (!new_lookup.has(old_key)) {
// remove old block
destroy(old_block, lookup);
o--;
} else if (!lookup.has(new_key) || will_move.has(new_key)) {
insert(new_block);
} else if (did_move.has(old_key)) {
o--;
} else if (deltas.get(new_key) > deltas.get(old_key)) {
did_move.add(new_key);
insert(new_block);
} else {
will_move.add(old_key);
o--;
}
}
while (o--) {
const old_block = old_blocks[o];
if (!new_lookup.has(old_block.key)) destroy(old_block, lookup);
}
while (n) insert(new_blocks[n - 1]);
run_all(updates);
return new_blocks;
}
/** @returns {void} */
function validate_each_keys(ctx, list, get_context, get_key) {
const keys = new Map();
for (let i = 0; i < list.length; i++) {
const key = get_key(get_context(ctx, list, i));
if (keys.has(key)) {
let value = '';
try {
value = `with value '${String(key)}' `;
} catch (e) {
// can't stringify
}
throw new Error(
`Cannot have duplicate keys in a keyed each: Keys at index ${keys.get(
key
)} and ${i} ${value}are duplicates`
);
}
keys.set(key, i);
}
}
/** @returns {{}} */
function get_spread_update(levels, updates) {
const update = {};
const to_null_out = {};
const accounted_for = { $$scope: 1 };
let i = levels.length;
while (i--) {
const o = levels[i];
const n = updates[i];
if (n) {
for (const key in o) {
if (!(key in n)) to_null_out[key] = 1;
}
for (const key in n) {
if (!accounted_for[key]) {
update[key] = n[key];
accounted_for[key] = 1;
}
}
levels[i] = n;
} else {
for (const key in o) {
accounted_for[key] = 1;
}
}
}
for (const key in to_null_out) {
if (!(key in update)) update[key] = undefined;
}
return update;
}
function get_spread_object(spread_props) {
return typeof spread_props === 'object' && spread_props !== null ? spread_props : {};
}
const _boolean_attributes = /** @type {const} */ ([
'allowfullscreen',
'allowpaymentrequest',
'async',
'autofocus',
'autoplay',
'checked',
'controls',
'default',
'defer',
'disabled',
'formnovalidate',
'hidden',
'inert',
'ismap',
'loop',
'multiple',
'muted',
'nomodule',
'novalidate',
'open',
'playsinline',
'readonly',
'required',
'reversed',
'selected'
]);
/**
* List of HTML boolean attributes (e.g. `<input disabled>`).
* Source: https://html.spec.whatwg.org/multipage/indices.html
*
* @type {Set<string>}
*/
const boolean_attributes = new Set([..._boolean_attributes]);
/** @typedef {typeof _boolean_attributes[number]} BooleanAttributes */
const invalid_attribute_name_character =
/[\s'">/=\u{FDD0}-\u{FDEF}\u{FFFE}\u{FFFF}\u{1FFFE}\u{1FFFF}\u{2FFFE}\u{2FFFF}\u{3FFFE}\u{3FFFF}\u{4FFFE}\u{4FFFF}\u{5FFFE}\u{5FFFF}\u{6FFFE}\u{6FFFF}\u{7FFFE}\u{7FFFF}\u{8FFFE}\u{8FFFF}\u{9FFFE}\u{9FFFF}\u{AFFFE}\u{AFFFF}\u{BFFFE}\u{BFFFF}\u{CFFFE}\u{CFFFF}\u{DFFFE}\u{DFFFF}\u{EFFFE}\u{EFFFF}\u{FFFFE}\u{FFFFF}\u{10FFFE}\u{10FFFF}]/u;
// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
// https://infra.spec.whatwg.org/#noncharacter
/** @returns {string} */
function spread(args, attrs_to_add) {
const attributes = Object.assign({}, ...args);
if (attrs_to_add) {
const classes_to_add = attrs_to_add.classes;
const styles_to_add = attrs_to_add.styles;
if (classes_to_add) {
if (attributes.class == null) {
attributes.class = classes_to_add;
} else {
attributes.class += ' ' + classes_to_add;
}
}
if (styles_to_add) {
if (attributes.style == null) {
attributes.style = style_object_to_string(styles_to_add);
} else {
attributes.style = style_object_to_string(
merge_ssr_styles(attributes.style, styles_to_add)
);
}
}
}
let str = '';
Object.keys(attributes).forEach((name) => {
if (invalid_attribute_name_character.test(name)) return;
const value = attributes[name];
if (value === true) str += ' ' + name;
else if (boolean_attributes.has(name.toLowerCase())) {
if (value) str += ' ' + name;
} else if (value != null) {
str += ` ${name}="${value}"`;
}
});
return str;
}
/** @returns {{}} */
function merge_ssr_styles(style_attribute, style_directive) {
const style_object = {};
for (const individual_style of style_attribute.split(';')) {
const colon_index = individual_style.indexOf(':');
const name = individual_style.slice(0, colon_index).trim();
const value = individual_style.slice(colon_index + 1).trim();
if (!name) continue;
style_object[name] = value;
}
for (const name in style_directive) {
const value = style_directive[name];
if (value) {
style_object[name] = value;
} else {
delete style_object[name];
}
}
return style_object;
}
const ATTR_REGEX = /[&"]/g;
const CONTENT_REGEX = /[&<]/g;
/**
* Note: this method is performance sensitive and has been optimized
* https://github.com/sveltejs/svelte/pull/5701
* @param {unknown} value
* @returns {string}
*/
function escape(value, is_attr = false) {
const str = String(value);
const pattern = is_attr ? ATTR_REGEX : CONTENT_REGEX;
pattern.lastIndex = 0;
let escaped = '';
let last = 0;
while (pattern.test(str)) {
const i = pattern.lastIndex - 1;
const ch = str[i];
escaped += str.substring(last, i) + (ch === '&' ? '&amp;' : ch === '"' ? '&quot;' : '&lt;');
last = i + 1;
}
return escaped + str.substring(last);
}
function escape_attribute_value(value) {
// keep booleans, null, and undefined for the sake of `spread`
const should_escape = typeof value === 'string' || (value && typeof value === 'object');
return should_escape ? escape(value, true) : value;
}
/** @returns {{}} */
function escape_object(obj) {
const result = {};
for (const key in obj) {
result[key] = escape_attribute_value(obj[key]);
}
return result;
}
/** @returns {string} */
function each(items, fn) {
let str = '';
for (let i = 0; i < items.length; i += 1) {
str += fn(items[i], i);
}
return str;
}
const missing_component = {
$$render: () => ''
};
function validate_component(component, name) {
if (!component || !component.$$render) {
if (name === 'svelte:component') name += ' this={...}';
throw new Error(
`<${name}> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules. Otherwise you may need to fix a <${name}>.`
);
}
return component;
}
/** @returns {string} */
function debug(file, line, column, values) {
console.log(`{@debug} ${file ? file + ' ' : ''}(${line}:${column})`); // eslint-disable-line no-console
console.log(values); // eslint-disable-line no-console
return '';
}
let on_destroy;
/** @returns {{ render: (props?: {}, { $$slots, context }?: { $$slots?: {}; context?: Map<any, any>; }) => { html: any; css: { code: string; map: any; }; head: string; }; $$render: (result: any, props: any, bindings: any, slots: any, context: any) => any; }} */
function create_ssr_component(fn) {
function $$render(result, props, bindings, slots, context) {
const parent_component = current_component;
const $$ = {
on_destroy,
context: new Map(context || (parent_component ? parent_component.$$.context : [])),
// these will be immediately discarded
on_mount: [],
before_update: [],
after_update: [],
callbacks: blank_object()
};
set_current_component({ $$ });
const html = fn(result, props, bindings, slots);
set_current_component(parent_component);
return html;
}
return {
render: (props = {}, { $$slots = {}, context = new Map() } = {}) => {
on_destroy = [];
const result = { title: '', head: '', css: new Set() };
const html = $$render(result, props, {}, $$slots, context);
run_all(on_destroy);
return {
html,
css: {
code: Array.from(result.css)
.map((css) => css.code)
.join('\n'),
map: null // TODO
},
head: result.title + result.head
};
},
$$render
};
}
/** @returns {string} */
function add_attribute(name, value, boolean) {
if (value == null || (boolean && !value)) return '';
const assignment = boolean && value === true ? '' : `="${escape(value, true)}"`;
return ` ${name}${assignment}`;
}
/** @returns {string} */
function add_classes(classes) {
return classes ? ` class="${classes}"` : '';
}
/** @returns {string} */
function style_object_to_string(style_object) {
return Object.keys(style_object)
.filter((key) => style_object[key])
.map((key) => `${key}: ${escape_attribute_value(style_object[key])};`)
.join(' ');
}
/** @returns {string} */
function add_styles(style_object) {
const styles = style_object_to_string(style_object);
return styles ? ` style="${styles}"` : '';
}
export { add_attribute, add_classes, add_styles, add_transform, blank_object, check_outros, create_animation, create_ssr_component, current_component, debug, destroy_block, each, escape, escape_attribute_value, escape_object, fix_and_destroy_block, fix_and_outro_and_destroy_block, fix_position, flush, get_current_component, get_spread_object, get_spread_update, group_outros, handle_promise, identity, invalid_attribute_name_character, is_promise, loop, merge_ssr_styles, missing_component, noop, now, outro_and_destroy_block, run_all, set_current_component, spread, transition_in, transition_out, update_await_block_branch, update_keyed_each, validate_component, validate_each_keys };

5
internal/package.json Normal file
View File

@ -0,0 +1,5 @@
{
"main": "./index",
"module": "./index.mjs",
"types": "./index.d.ts"
}

1
motion/index.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from '../types/runtime/motion/index.js';

252
motion/index.js Normal file
View File

@ -0,0 +1,252 @@
'use strict';
var store = require('../store/index.js');
var Component = require('../internal/Component-9c4b98a2.js');
/**
* @param {any} obj
* @returns {boolean}
*/
function is_date(obj) {
return Object.prototype.toString.call(obj) === '[object Date]';
}
/**
* @template T
* @param {import('./private.js').TickContext<T>} ctx
* @param {T} last_value
* @param {T} current_value
* @param {T} target_value
* @returns {T}
*/
function tick_spring(ctx, last_value, current_value, target_value) {
if (typeof current_value === 'number' || is_date(current_value)) {
// @ts-ignore
const delta = target_value - current_value;
// @ts-ignore
const velocity = (current_value - last_value) / (ctx.dt || 1 / 60); // guard div by 0
const spring = ctx.opts.stiffness * delta;
const damper = ctx.opts.damping * velocity;
const acceleration = (spring - damper) * ctx.inv_mass;
const d = (velocity + acceleration) * ctx.dt;
if (Math.abs(d) < ctx.opts.precision && Math.abs(delta) < ctx.opts.precision) {
return target_value; // settled
} else {
ctx.settled = false; // signal loop to keep ticking
// @ts-ignore
return is_date(current_value) ? new Date(current_value.getTime() + d) : current_value + d;
}
} else if (Array.isArray(current_value)) {
// @ts-ignore
return current_value.map((_, i) =>
tick_spring(ctx, last_value[i], current_value[i], target_value[i])
);
} else if (typeof current_value === 'object') {
const next_value = {};
for (const k in current_value) {
// @ts-ignore
next_value[k] = tick_spring(ctx, last_value[k], current_value[k], target_value[k]);
}
// @ts-ignore
return next_value;
} else {
throw new Error(`Cannot spring ${typeof current_value} values`);
}
}
/**
* @template T
* @param {T} [value]
* @param {import('./private.js').SpringOpts} [opts]
* @returns {import('./public.js').Spring<T>}
*/
function spring(value, opts = {}) {
const store$1 = store.writable(value);
const { stiffness = 0.15, damping = 0.8, precision = 0.01 } = opts;
/** @type {number} */
let last_time;
/** @type {import('../internal/private.js').Task} */
let task;
/** @type {object} */
let current_token;
/** @type {T} */
let last_value = value;
/** @type {T} */
let target_value = value;
let inv_mass = 1;
let inv_mass_recovery_rate = 0;
let cancel_task = false;
/**
* @param {T} new_value
* @param {import('./private.js').SpringUpdateOpts} opts
* @returns {Promise<void>}
*/
function set(new_value, opts = {}) {
target_value = new_value;
const token = (current_token = {});
if (value == null || opts.hard || (spring.stiffness >= 1 && spring.damping >= 1)) {
cancel_task = true; // cancel any running animation
last_time = Component.now();
last_value = new_value;
store$1.set((value = target_value));
return Promise.resolve();
} else if (opts.soft) {
const rate = opts.soft === true ? 0.5 : +opts.soft;
inv_mass_recovery_rate = 1 / (rate * 60);
inv_mass = 0; // infinite mass, unaffected by spring forces
}
if (!task) {
last_time = Component.now();
cancel_task = false;
task = Component.loop((now) => {
if (cancel_task) {
cancel_task = false;
task = null;
return false;
}
inv_mass = Math.min(inv_mass + inv_mass_recovery_rate, 1);
const ctx = {
inv_mass,
opts: spring,
settled: true,
dt: ((now - last_time) * 60) / 1000
};
const next_value = tick_spring(ctx, last_value, value, target_value);
last_time = now;
last_value = value;
store$1.set((value = next_value));
if (ctx.settled) {
task = null;
}
return !ctx.settled;
});
}
return new Promise((fulfil) => {
task.promise.then(() => {
if (token === current_token) fulfil();
});
});
}
/** @type {import('./public.js').Spring<T>} */
const spring = {
set,
update: (fn, opts) => set(fn(target_value, value), opts),
subscribe: store$1.subscribe,
stiffness,
damping,
precision
};
return spring;
}
/** @returns {(t: any) => any} */
function get_interpolator(a, b) {
if (a === b || a !== a) return () => a;
const type = typeof a;
if (type !== typeof b || Array.isArray(a) !== Array.isArray(b)) {
throw new Error('Cannot interpolate values of different type');
}
if (Array.isArray(a)) {
const arr = b.map((bi, i) => {
return get_interpolator(a[i], bi);
});
return (t) => arr.map((fn) => fn(t));
}
if (type === 'object') {
if (!a || !b) throw new Error('Object cannot be null');
if (is_date(a) && is_date(b)) {
a = a.getTime();
b = b.getTime();
const delta = b - a;
return (t) => new Date(a + t * delta);
}
const keys = Object.keys(b);
const interpolators = {};
keys.forEach((key) => {
interpolators[key] = get_interpolator(a[key], b[key]);
});
return (t) => {
const result = {};
keys.forEach((key) => {
result[key] = interpolators[key](t);
});
return result;
};
}
if (type === 'number') {
const delta = b - a;
return (t) => a + t * delta;
}
throw new Error(`Cannot interpolate ${type} values`);
}
/**
* @template T
* @param {T} [value]
* @param {import('./private.js').TweenedOptions<T>} [defaults]
* @returns {import('./public.js').Tweened<T>}
*/
function tweened(value, defaults = {}) {
const store$1 = store.writable(value);
/** @type {import('../internal/private.js').Task} */
let task;
let target_value = value;
/**
* @param {T} new_value
* @param {import('./private.js').TweenedOptions<T>} opts
*/
function set(new_value, opts) {
if (value == null) {
store$1.set((value = new_value));
return Promise.resolve();
}
target_value = new_value;
let previous_task = task;
let started = false;
let {
delay = 0,
duration = 400,
easing = Component.identity,
interpolate = get_interpolator
} = Component.assign(Component.assign({}, defaults), opts);
if (duration === 0) {
if (previous_task) {
previous_task.abort();
previous_task = null;
}
store$1.set((value = target_value));
return Promise.resolve();
}
const start = Component.now() + delay;
let fn;
task = Component.loop((now) => {
if (now < start) return true;
if (!started) {
fn = interpolate(value, new_value);
if (typeof duration === 'function') duration = duration(value, new_value);
started = true;
}
if (previous_task) {
previous_task.abort();
previous_task = null;
}
const elapsed = now - start;
if (elapsed > /** @type {number} */ (duration)) {
store$1.set((value = new_value));
return false;
}
// @ts-ignore
store$1.set((value = fn(easing(elapsed / duration))));
return true;
});
return task.promise;
}
return {
set,
update: (fn, opts) => set(fn(target_value, value), opts),
subscribe: store$1.subscribe
};
}
exports.spring = spring;
exports.tweened = tweened;

249
motion/index.mjs Normal file
View File

@ -0,0 +1,249 @@
import { writable } from '../store/index.mjs';
import { now, loop, assign, identity } from '../internal/Component-cd97939e.mjs';
/**
* @param {any} obj
* @returns {boolean}
*/
function is_date(obj) {
return Object.prototype.toString.call(obj) === '[object Date]';
}
/**
* @template T
* @param {import('./private.js').TickContext<T>} ctx
* @param {T} last_value
* @param {T} current_value
* @param {T} target_value
* @returns {T}
*/
function tick_spring(ctx, last_value, current_value, target_value) {
if (typeof current_value === 'number' || is_date(current_value)) {
// @ts-ignore
const delta = target_value - current_value;
// @ts-ignore
const velocity = (current_value - last_value) / (ctx.dt || 1 / 60); // guard div by 0
const spring = ctx.opts.stiffness * delta;
const damper = ctx.opts.damping * velocity;
const acceleration = (spring - damper) * ctx.inv_mass;
const d = (velocity + acceleration) * ctx.dt;
if (Math.abs(d) < ctx.opts.precision && Math.abs(delta) < ctx.opts.precision) {
return target_value; // settled
} else {
ctx.settled = false; // signal loop to keep ticking
// @ts-ignore
return is_date(current_value) ? new Date(current_value.getTime() + d) : current_value + d;
}
} else if (Array.isArray(current_value)) {
// @ts-ignore
return current_value.map((_, i) =>
tick_spring(ctx, last_value[i], current_value[i], target_value[i])
);
} else if (typeof current_value === 'object') {
const next_value = {};
for (const k in current_value) {
// @ts-ignore
next_value[k] = tick_spring(ctx, last_value[k], current_value[k], target_value[k]);
}
// @ts-ignore
return next_value;
} else {
throw new Error(`Cannot spring ${typeof current_value} values`);
}
}
/**
* @template T
* @param {T} [value]
* @param {import('./private.js').SpringOpts} [opts]
* @returns {import('./public.js').Spring<T>}
*/
function spring(value, opts = {}) {
const store = writable(value);
const { stiffness = 0.15, damping = 0.8, precision = 0.01 } = opts;
/** @type {number} */
let last_time;
/** @type {import('../internal/private.js').Task} */
let task;
/** @type {object} */
let current_token;
/** @type {T} */
let last_value = value;
/** @type {T} */
let target_value = value;
let inv_mass = 1;
let inv_mass_recovery_rate = 0;
let cancel_task = false;
/**
* @param {T} new_value
* @param {import('./private.js').SpringUpdateOpts} opts
* @returns {Promise<void>}
*/
function set(new_value, opts = {}) {
target_value = new_value;
const token = (current_token = {});
if (value == null || opts.hard || (spring.stiffness >= 1 && spring.damping >= 1)) {
cancel_task = true; // cancel any running animation
last_time = now();
last_value = new_value;
store.set((value = target_value));
return Promise.resolve();
} else if (opts.soft) {
const rate = opts.soft === true ? 0.5 : +opts.soft;
inv_mass_recovery_rate = 1 / (rate * 60);
inv_mass = 0; // infinite mass, unaffected by spring forces
}
if (!task) {
last_time = now();
cancel_task = false;
task = loop((now) => {
if (cancel_task) {
cancel_task = false;
task = null;
return false;
}
inv_mass = Math.min(inv_mass + inv_mass_recovery_rate, 1);
const ctx = {
inv_mass,
opts: spring,
settled: true,
dt: ((now - last_time) * 60) / 1000
};
const next_value = tick_spring(ctx, last_value, value, target_value);
last_time = now;
last_value = value;
store.set((value = next_value));
if (ctx.settled) {
task = null;
}
return !ctx.settled;
});
}
return new Promise((fulfil) => {
task.promise.then(() => {
if (token === current_token) fulfil();
});
});
}
/** @type {import('./public.js').Spring<T>} */
const spring = {
set,
update: (fn, opts) => set(fn(target_value, value), opts),
subscribe: store.subscribe,
stiffness,
damping,
precision
};
return spring;
}
/** @returns {(t: any) => any} */
function get_interpolator(a, b) {
if (a === b || a !== a) return () => a;
const type = typeof a;
if (type !== typeof b || Array.isArray(a) !== Array.isArray(b)) {
throw new Error('Cannot interpolate values of different type');
}
if (Array.isArray(a)) {
const arr = b.map((bi, i) => {
return get_interpolator(a[i], bi);
});
return (t) => arr.map((fn) => fn(t));
}
if (type === 'object') {
if (!a || !b) throw new Error('Object cannot be null');
if (is_date(a) && is_date(b)) {
a = a.getTime();
b = b.getTime();
const delta = b - a;
return (t) => new Date(a + t * delta);
}
const keys = Object.keys(b);
const interpolators = {};
keys.forEach((key) => {
interpolators[key] = get_interpolator(a[key], b[key]);
});
return (t) => {
const result = {};
keys.forEach((key) => {
result[key] = interpolators[key](t);
});
return result;
};
}
if (type === 'number') {
const delta = b - a;
return (t) => a + t * delta;
}
throw new Error(`Cannot interpolate ${type} values`);
}
/**
* @template T
* @param {T} [value]
* @param {import('./private.js').TweenedOptions<T>} [defaults]
* @returns {import('./public.js').Tweened<T>}
*/
function tweened(value, defaults = {}) {
const store = writable(value);
/** @type {import('../internal/private.js').Task} */
let task;
let target_value = value;
/**
* @param {T} new_value
* @param {import('./private.js').TweenedOptions<T>} opts
*/
function set(new_value, opts) {
if (value == null) {
store.set((value = new_value));
return Promise.resolve();
}
target_value = new_value;
let previous_task = task;
let started = false;
let {
delay = 0,
duration = 400,
easing = identity,
interpolate = get_interpolator
} = assign(assign({}, defaults), opts);
if (duration === 0) {
if (previous_task) {
previous_task.abort();
previous_task = null;
}
store.set((value = target_value));
return Promise.resolve();
}
const start = now() + delay;
let fn;
task = loop((now) => {
if (now < start) return true;
if (!started) {
fn = interpolate(value, new_value);
if (typeof duration === 'function') duration = duration(value, new_value);
started = true;
}
if (previous_task) {
previous_task.abort();
previous_task = null;
}
const elapsed = now - start;
if (elapsed > /** @type {number} */ (duration)) {
store.set((value = new_value));
return false;
}
// @ts-ignore
store.set((value = fn(easing(elapsed / duration))));
return true;
});
return task.promise;
}
return {
set,
update: (fn, opts) => set(fn(target_value, value), opts),
subscribe: store.subscribe
};
}
export { spring, tweened };

5
motion/package.json Normal file
View File

@ -0,0 +1,5 @@
{
"main": "./index",
"module": "./index.mjs",
"types": "./index.d.ts"
}

View File

@ -3,22 +3,22 @@
"version": "4.0.0-next.0",
"description": "Cybernetically enhanced web apps",
"type": "module",
"module": "index.mjs",
"main": "index",
"module": "src/runtime/index.js",
"main": "src/runtime/index.js",
"files": [
"src",
"types",
"compiler.*",
"register.js",
"index.*",
"ssr.*",
"internal",
"store",
"animate",
"transition",
"easing",
"motion",
"action",
"elements",
"index.d.ts",
"internal.d.ts",
"store.d.ts",
"animate.d.ts",
"transition.d.ts",
"easing.d.ts",
"motion.d.ts",
"action.d.ts",
"elements.d.ts",
"README.md"
],
"exports": {
@ -26,55 +26,44 @@
".": {
"types": "./types/runtime/index.d.ts",
"browser": {
"import": "./index.mjs",
"require": "./index.js"
"import": "./src/runtime/index.js"
},
"import": "./ssr.mjs",
"require": "./ssr.js"
"import": "./src/runtime/ssr.js"
},
"./compiler": {
"types": "./types/compiler/index.d.ts",
"import": "./compiler.mjs",
"require": "./compiler.js"
"import": "./src/compiler/index.js",
"require": "./compiler.cjs"
},
"./action": {
"types": "./types/runtime/action/index.d.ts"
},
"./animate": {
"types": "./types/runtime/animate/index.d.ts",
"import": "./animate/index.mjs",
"require": "./animate/index.js"
"import": "./src/runtime/animate/index.js"
},
"./easing": {
"types": "./types/runtime/easing/index.d.ts",
"import": "./easing/index.mjs",
"require": "./easing/index.js"
"import": "./src/runtime/easing/index.js"
},
"./internal": {
"types": "./types/runtime/internal/index.d.ts",
"import": "./internal/index.mjs",
"require": "./internal/index.js"
"import": "./src/runtime/internal/index.js"
},
"./motion": {
"types": "./types/runtime/motion/index.d.ts",
"import": "./motion/index.mjs",
"require": "./motion/index.js"
},
"./register": {
"require": "./register.js"
"import": "./src/runtime/motion/index.js"
},
"./store": {
"types": "./types/runtime/store/index.d.ts",
"import": "./store/index.mjs",
"require": "./store/index.js"
"import": "./src/runtime/store/index.js"
},
"./transition": {
"types": "./types/runtime/transition/index.d.ts",
"import": "./transition/index.mjs",
"require": "./transition/index.js"
"import": "./src/runtime/transition/index.js"
},
"./elements": {
"types": "./elements/index.d.ts"
"types": "./elements.d.ts"
}
},
"engines": {
@ -88,9 +77,9 @@
"build": "rollup -c && npm run tsd",
"prepare": "npm run build",
"dev": "rollup -cw",
"posttest": "agadoo internal/index.mjs",
"prepublishOnly": "node check_publish_env.js && npm run lint && npm run build && npm test",
"tsd": "node ./generate-types.mjs",
"posttest": "agadoo src/internal/index.js",
"prepublishOnly": "npm run lint && npm run build && npm test",
"tsd": "node ./generate-types.js",
"lint": "eslint \"{src,test}/**/*.{ts,js}\" --cache"
},
"repository": {
@ -109,51 +98,45 @@
"url": "https://github.com/sveltejs/svelte/issues"
},
"homepage": "https://svelte.dev",
"devDependencies": {
"dependencies": {
"@ampproject/remapping": "^2.2.1",
"@jridgewell/sourcemap-codec": "^1.4.15",
"acorn": "^8.8.2",
"aria-query": "^5.1.3",
"axobject-query": "^3.1.1",
"code-red": "^1.0.0",
"css-tree": "^2.3.1",
"estree-walker": "^3.0.3",
"is-reference": "^3.0.1",
"locate-character": "^2.0.5",
"magic-string": "^0.30.0",
"periscopic": "^3.1.0"
},
"devDependencies": {
"@playwright/test": "^1.33.0",
"@rollup/plugin-commonjs": "^24.1.0",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.2",
"@rollup/plugin-replace": "^5.0.2",
"@rollup/plugin-sucrase": "^5.0.1",
"@rollup/plugin-typescript": "^11.1.0",
"@rollup/plugin-virtual": "^3.0.1",
"@sveltejs/eslint-config": "^6.0.1",
"@types/aria-query": "^5.0.1",
"@types/estree": "^1.0.0",
"@types/mocha": "^10.0.1",
"@types/node": "^14.14.31",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"acorn": "^8.8.2",
"agadoo": "^3.0.0",
"aria-query": "^5.1.3",
"axobject-query": "^3.1.1",
"code-red": "^1.0.0",
"css-tree": "^2.3.1",
"esbuild": "^0.17.19",
"eslint": "^8.40.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-svelte": "^2.28.0",
"eslint-plugin-unicorn": "^47.0.0",
"estree-walker": "^3.0.3",
"happy-dom": "^9.18.3",
"is-reference": "^3.0.1",
"jsdom": "^21.1.1",
"kleur": "^4.1.5",
"locate-character": "^2.0.5",
"magic-string": "^0.30.0",
"periscopic": "^3.1.0",
"prettier": "^2.8.8",
"prettier-plugin-svelte": "^2.10.0",
"rollup": "^3.20.2",
"rollup-plugin-dts": "^5.3.0",
"source-map": "^0.7.4",
"source-map-support": "^0.5.21",
"tiny-glob": "^0.2.9",
"tslib": "^2.5.0",
"typescript": "^5.0.4",
"util": "^0.12.5",
"vitest": "^0.31.1"

View File

@ -3,13 +3,44 @@ lockfileVersion: '6.0'
importers:
.:
devDependencies:
dependencies:
'@ampproject/remapping':
specifier: ^2.2.1
version: 2.2.1
'@jridgewell/sourcemap-codec':
specifier: ^1.4.15
version: 1.4.15
acorn:
specifier: ^8.8.2
version: 8.8.2
aria-query:
specifier: ^5.1.3
version: 5.1.3
axobject-query:
specifier: ^3.1.1
version: 3.1.1
code-red:
specifier: ^1.0.0
version: 1.0.0
css-tree:
specifier: ^2.3.1
version: 2.3.1
estree-walker:
specifier: ^3.0.3
version: 3.0.3
is-reference:
specifier: ^3.0.1
version: 3.0.1
locate-character:
specifier: ^2.0.5
version: 2.0.5
magic-string:
specifier: ^0.30.0
version: 0.30.0
periscopic:
specifier: ^3.1.0
version: 3.1.0
devDependencies:
'@playwright/test':
specifier: ^1.33.0
version: 1.33.0
@ -25,15 +56,6 @@ importers:
'@rollup/plugin-replace':
specifier: ^5.0.2
version: 5.0.2(rollup@3.20.2)
'@rollup/plugin-sucrase':
specifier: ^5.0.1
version: 5.0.1(rollup@3.20.2)
'@rollup/plugin-typescript':
specifier: ^11.1.0
version: 11.1.0(rollup@3.20.2)(tslib@2.5.0)(typescript@5.0.4)
'@rollup/plugin-virtual':
specifier: ^3.0.1
version: 3.0.1(rollup@3.20.2)
'@sveltejs/eslint-config':
specifier: ^6.0.1
version: 6.0.1(@typescript-eslint/eslint-plugin@5.58.0)(@typescript-eslint/parser@5.58.0)(eslint-config-prettier@8.8.0)(eslint-plugin-import@2.27.5)(eslint-plugin-node@11.1.0)(eslint-plugin-svelte@2.28.0)(eslint-plugin-unicorn@47.0.0)(eslint@8.40.0)(typescript@5.0.4)
@ -43,42 +65,21 @@ importers:
'@types/estree':
specifier: ^1.0.0
version: 1.0.0
'@types/mocha':
specifier: ^10.0.1
version: 10.0.1
'@types/node':
specifier: ^14.14.31
version: 14.14.31
'@typescript-eslint/eslint-plugin':
specifier: ^5.58.0
version: 5.58.0(@typescript-eslint/parser@5.58.0)(eslint@8.40.0)(typescript@5.0.4)
acorn:
specifier: ^8.8.2
version: 8.8.2
agadoo:
specifier: ^3.0.0
version: 3.0.0
aria-query:
specifier: ^5.1.3
version: 5.1.3
axobject-query:
specifier: ^3.1.1
version: 3.1.1
code-red:
specifier: ^1.0.0
version: 1.0.0
css-tree:
specifier: ^2.3.1
version: 2.3.1
esbuild:
specifier: ^0.17.19
version: 0.17.19
eslint:
specifier: ^8.40.0
version: 8.40.0
eslint-config-prettier:
specifier: ^8.8.0
version: 8.8.0(eslint@8.40.0)
eslint-plugin-import:
specifier: ^2.27.5
version: 2.27.5(@typescript-eslint/parser@5.58.0)(eslint@8.40.0)
@ -88,30 +89,15 @@ importers:
eslint-plugin-unicorn:
specifier: ^47.0.0
version: 47.0.0(eslint@8.40.0)
estree-walker:
specifier: ^3.0.3
version: 3.0.3
happy-dom:
specifier: ^9.18.3
version: 9.18.3
is-reference:
specifier: ^3.0.1
version: 3.0.1
jsdom:
specifier: ^21.1.1
version: 21.1.1
kleur:
specifier: ^4.1.5
version: 4.1.5
locate-character:
specifier: ^2.0.5
version: 2.0.5
magic-string:
specifier: ^0.30.0
version: 0.30.0
periscopic:
specifier: ^3.1.0
version: 3.1.0
prettier:
specifier: ^2.8.8
version: 2.8.8
@ -121,21 +107,12 @@ importers:
rollup:
specifier: ^3.20.2
version: 3.20.2
rollup-plugin-dts:
specifier: ^5.3.0
version: 5.3.0(rollup@3.20.2)(typescript@5.0.4)
source-map:
specifier: ^0.7.4
version: 0.7.4
source-map-support:
specifier: ^0.5.21
version: 0.5.21
tiny-glob:
specifier: ^0.2.9
version: 0.2.9
tslib:
specifier: ^2.5.0
version: 2.5.0
typescript:
specifier: ^5.0.4
version: 5.0.4
@ -266,7 +243,7 @@ packages:
dependencies:
'@jridgewell/gen-mapping': 0.3.3
'@jridgewell/trace-mapping': 0.3.18
dev: true
dev: false
/@babel/code-frame@7.21.4:
resolution: {integrity: sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==}
@ -995,21 +972,19 @@ packages:
'@jridgewell/set-array': 1.1.2
'@jridgewell/sourcemap-codec': 1.4.15
'@jridgewell/trace-mapping': 0.3.18
dev: true
dev: false
/@jridgewell/resolve-uri@3.1.0:
resolution: {integrity: sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==}
engines: {node: '>=6.0.0'}
dev: true
/@jridgewell/set-array@1.1.2:
resolution: {integrity: sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==}
engines: {node: '>=6.0.0'}
dev: true
dev: false
/@jridgewell/sourcemap-codec@1.4.14:
resolution: {integrity: sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==}
dev: true
/@jridgewell/sourcemap-codec@1.4.15:
resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==}
@ -1019,7 +994,6 @@ packages:
dependencies:
'@jridgewell/resolve-uri': 3.1.0
'@jridgewell/sourcemap-codec': 1.4.14
dev: true
/@lezer/common@1.0.2:
resolution: {integrity: sha512-SVgiGtMnMnW3ActR8SXgsDhw7a0w0ChHSYAyAUxxrOiJ1OqYWEKk/xJd84tTSPo1mo6DXLObAJALNnd0Hrv7Ng==}
@ -1137,7 +1111,7 @@ packages:
engines: {node: '>=14'}
hasBin: true
dependencies:
'@types/node': 14.14.31
'@types/node': 20.2.3
playwright-core: 1.33.0
optionalDependencies:
fsevents: 2.3.2
@ -1375,40 +1349,6 @@ packages:
rollup: 3.20.2
dev: true
/@rollup/plugin-sucrase@5.0.1(rollup@3.20.2):
resolution: {integrity: sha512-3mYe28rR/sUTkV8v10yPCP55TQ/oJkvcxKZBj6NGx9ZfCn9BdBtBL1v1S0TQrcOV4WD3FTHJaI7TbbukALx9wA==}
engines: {node: '>=14.0.0'}
peerDependencies:
rollup: ^2.53.1||^3.0.0
peerDependenciesMeta:
rollup:
optional: true
dependencies:
'@rollup/pluginutils': 5.0.2(rollup@3.20.2)
rollup: 3.20.2
sucrase: 3.32.0
dev: true
/@rollup/plugin-typescript@11.1.0(rollup@3.20.2)(tslib@2.5.0)(typescript@5.0.4):
resolution: {integrity: sha512-86flrfE+bSHB69znnTV6kVjkncs2LBMhcTCyxWgRxLyfXfQrxg4UwlAqENnjrrxnSNS/XKCDJCl8EkdFJVHOxw==}
engines: {node: '>=14.0.0'}
peerDependencies:
rollup: ^2.14.0||^3.0.0
tslib: '*'
typescript: '>=3.7.0'
peerDependenciesMeta:
rollup:
optional: true
tslib:
optional: true
dependencies:
'@rollup/pluginutils': 5.0.2(rollup@3.20.2)
resolve: 1.22.2
rollup: 3.20.2
tslib: 2.5.0
typescript: 5.0.4
dev: true
/@rollup/plugin-virtual@3.0.1(rollup@3.20.2):
resolution: {integrity: sha512-fK8O0IL5+q+GrsMLuACVNk2x21g3yaw+sG2qn16SnUd3IlBsQyvWxLMGHmCmXRMecPjGRSZ/1LmZB4rjQm68og==}
engines: {node: '>=14.0.0'}
@ -1438,7 +1378,7 @@ packages:
rollup:
optional: true
dependencies:
'@types/estree': 1.0.0
'@types/estree': 1.0.1
estree-walker: 2.0.2
picomatch: 2.3.1
rollup: 3.20.2
@ -1722,10 +1662,6 @@ packages:
resolution: {integrity: sha512-zK4gSFMjgslsv5Lyvr3O1yCjgmnE4pr8jbG8qVn4QglMwtpvPCf4YT2Wma7Nk95OxUUJI8Z+kzdXohbM7mVpGw==}
dev: true
/@types/mocha@10.0.1:
resolution: {integrity: sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==}
dev: true
/@types/node@14.14.31:
resolution: {integrity: sha512-vFHy/ezP5qI0rFgJ7aQnjDXwAMrG0KqqIH7tQG5PPv3BWBayOPIQNBjVc/P6hhdZfMx51REc6tfDNXHUio893g==}
dev: true
@ -2071,10 +2007,6 @@ packages:
resolution: {integrity: sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg==}
dev: true
/any-promise@1.3.0:
resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==}
dev: true
/anymatch@3.1.3:
resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==}
engines: {node: '>= 8'}
@ -2102,7 +2034,7 @@ packages:
resolution: {integrity: sha512-R5iJ5lkuHybztUfuOAznmboyjWq8O6sqNqtK7CLOqdydi54VNbORp49mb14KbWgG1QD3JFO9hJdZ+y4KutfdOQ==}
dependencies:
deep-equal: 2.2.0
dev: true
dev: false
/array-buffer-byte-length@1.0.0:
resolution: {integrity: sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==}
@ -2162,13 +2094,12 @@ packages:
/available-typed-arrays@1.0.5:
resolution: {integrity: sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==}
engines: {node: '>= 0.4'}
dev: true
/axobject-query@3.1.1:
resolution: {integrity: sha512-goKlv8DZrK9hUh975fnHzhNIO4jUnFCfv/dszV5VwUGDFjI6vQ2VwoyjYjYNEbBE8AH87TduWP5uyDR1D+Iteg==}
dependencies:
deep-equal: 2.2.0
dev: true
dev: false
/balanced-match@1.0.2:
resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
@ -2237,10 +2168,6 @@ packages:
engines: {node: '>=0.4.0'}
dev: true
/buffer-from@1.1.2:
resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==}
dev: true
/buffer@5.7.1:
resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==}
dependencies:
@ -2277,7 +2204,6 @@ packages:
dependencies:
function-bind: 1.1.1
get-intrinsic: 1.2.0
dev: true
/callsites@3.1.0:
resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==}
@ -2369,7 +2295,7 @@ packages:
acorn: 8.8.2
estree-walker: 3.0.3
periscopic: 3.1.0
dev: true
dev: false
/codemirror@6.0.1(@lezer/common@1.0.2):
resolution: {integrity: sha512-J8j+nZ+CdWmIeFIGXEFbFPtpiYacFMDR8GlHK3IyHQJMCaVRfGx9NT+Hxivv1ckLWPvNdZqndbr/7lVhrf/Svg==}
@ -2433,11 +2359,6 @@ packages:
delayed-stream: 1.0.0
dev: true
/commander@4.1.1:
resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==}
engines: {node: '>= 6'}
dev: true
/commondir@1.0.1:
resolution: {integrity: sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==}
dev: true
@ -2516,7 +2437,7 @@ packages:
dependencies:
mdn-data: 2.0.30
source-map-js: 1.0.2
dev: true
dev: false
/css.escape@1.5.1:
resolution: {integrity: sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==}
@ -2632,7 +2553,7 @@ packages:
which-boxed-primitive: 1.0.2
which-collection: 1.0.1
which-typed-array: 1.1.9
dev: true
dev: false
/deep-extend@0.6.0:
resolution: {integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==}
@ -2653,7 +2574,6 @@ packages:
dependencies:
has-property-descriptors: 1.0.0
object-keys: 1.1.1
dev: true
/degit@2.8.4:
resolution: {integrity: sha512-vqYuzmSA5I50J882jd+AbAhQtgK6bdKUJIex1JNfEUPENCgYsxugzKVZlFyMwV4i06MmnV47/Iqi5Io86zf3Ng==}
@ -2801,7 +2721,7 @@ packages:
is-string: 1.0.7
isarray: 2.0.5
stop-iteration-iterator: 1.0.0
dev: true
dev: false
/es-set-tostringtag@2.0.1:
resolution: {integrity: sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==}
@ -3203,6 +3123,7 @@ packages:
resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==}
dependencies:
'@types/estree': 1.0.0
dev: false
/esutils@2.0.3:
resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==}
@ -3341,7 +3262,6 @@ packages:
resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==}
dependencies:
is-callable: 1.2.7
dev: true
/form-data@4.0.0:
resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==}
@ -3383,7 +3303,6 @@ packages:
/function-bind@1.1.1:
resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==}
dev: true
/function.prototype.name@1.1.5:
resolution: {integrity: sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==}
@ -3397,7 +3316,6 @@ packages:
/functions-have-names@1.2.3:
resolution: {integrity: sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==}
dev: true
/gauge@3.0.2:
resolution: {integrity: sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==}
@ -3424,7 +3342,6 @@ packages:
function-bind: 1.1.1
has: 1.0.3
has-symbols: 1.0.3
dev: true
/get-symbol-description@1.0.0:
resolution: {integrity: sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==}
@ -3458,17 +3375,6 @@ packages:
is-glob: 4.0.3
dev: true
/glob@7.1.6:
resolution: {integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==}
dependencies:
fs.realpath: 1.0.0
inflight: 1.0.6
inherits: 2.0.4
minimatch: 3.1.2
once: 1.4.0
path-is-absolute: 1.0.1
dev: true
/glob@7.2.3:
resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==}
dependencies:
@ -3534,7 +3440,6 @@ packages:
resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==}
dependencies:
get-intrinsic: 1.2.0
dev: true
/graceful-fs@4.2.11:
resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==}
@ -3557,7 +3462,6 @@ packages:
/has-bigints@1.0.2:
resolution: {integrity: sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==}
dev: true
/has-flag@3.0.0:
resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==}
@ -3573,7 +3477,6 @@ packages:
resolution: {integrity: sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==}
dependencies:
get-intrinsic: 1.2.0
dev: true
/has-proto@1.0.1:
resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==}
@ -3583,14 +3486,12 @@ packages:
/has-symbols@1.0.3:
resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==}
engines: {node: '>= 0.4'}
dev: true
/has-tostringtag@1.0.0:
resolution: {integrity: sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==}
engines: {node: '>= 0.4'}
dependencies:
has-symbols: 1.0.3
dev: true
/has-unicode@2.0.1:
resolution: {integrity: sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==}
@ -3601,7 +3502,6 @@ packages:
engines: {node: '>= 0.4.0'}
dependencies:
function-bind: 1.1.1
dev: true
/hex-rgb@4.3.0:
resolution: {integrity: sha512-Ox1pJVrDCyGHMG9CFg1tmrRUMRPRsAWYc/PinY0XzJU4K7y7vjNoLKIQ7BR5UJMCxNN8EM1MNDmHWA/B3aZUuw==}
@ -3712,7 +3612,6 @@ packages:
get-intrinsic: 1.2.0
has: 1.0.3
side-channel: 1.0.4
dev: true
/interpret@1.4.0:
resolution: {integrity: sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==}
@ -3725,7 +3624,6 @@ packages:
dependencies:
call-bind: 1.0.2
has-tostringtag: 1.0.0
dev: true
/is-array-buffer@3.0.2:
resolution: {integrity: sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==}
@ -3733,7 +3631,6 @@ packages:
call-bind: 1.0.2
get-intrinsic: 1.2.0
is-typed-array: 1.1.10
dev: true
/is-arrayish@0.2.1:
resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==}
@ -3747,7 +3644,6 @@ packages:
resolution: {integrity: sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==}
dependencies:
has-bigints: 1.0.2
dev: true
/is-binary-path@2.1.0:
resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==}
@ -3761,7 +3657,6 @@ packages:
dependencies:
call-bind: 1.0.2
has-tostringtag: 1.0.0
dev: true
/is-builtin-module@3.2.1:
resolution: {integrity: sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==}
@ -3773,7 +3668,6 @@ packages:
/is-callable@1.2.7:
resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==}
engines: {node: '>= 0.4'}
dev: true
/is-core-module@2.12.0:
resolution: {integrity: sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ==}
@ -3786,7 +3680,6 @@ packages:
engines: {node: '>= 0.4'}
dependencies:
has-tostringtag: 1.0.0
dev: true
/is-extglob@2.1.1:
resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==}
@ -3816,7 +3709,7 @@ packages:
/is-map@2.0.2:
resolution: {integrity: sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==}
dev: true
dev: false
/is-module@1.0.0:
resolution: {integrity: sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==}
@ -3832,7 +3725,6 @@ packages:
engines: {node: '>= 0.4'}
dependencies:
has-tostringtag: 1.0.0
dev: true
/is-number@7.0.0:
resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==}
@ -3857,7 +3749,7 @@ packages:
resolution: {integrity: sha512-baJJdQLiYaJdvFbJqXrcGv3WU3QCzBlUcI5QhbesIm6/xPsvmO+2CDoi/GMOFBQEQm+PXkwOPrp9KK5ozZsp2w==}
dependencies:
'@types/estree': 1.0.0
dev: true
dev: false
/is-regex@1.1.4:
resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==}
@ -3865,31 +3757,27 @@ packages:
dependencies:
call-bind: 1.0.2
has-tostringtag: 1.0.0
dev: true
/is-set@2.0.2:
resolution: {integrity: sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==}
dev: true
dev: false
/is-shared-array-buffer@1.0.2:
resolution: {integrity: sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==}
dependencies:
call-bind: 1.0.2
dev: true
/is-string@1.0.7:
resolution: {integrity: sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==}
engines: {node: '>= 0.4'}
dependencies:
has-tostringtag: 1.0.0
dev: true
/is-symbol@1.0.4:
resolution: {integrity: sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==}
engines: {node: '>= 0.4'}
dependencies:
has-symbols: 1.0.3
dev: true
/is-typed-array@1.1.10:
resolution: {integrity: sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==}
@ -3900,7 +3788,6 @@ packages:
for-each: 0.3.3
gopd: 1.0.1
has-tostringtag: 1.0.0
dev: true
/is-typedarray@1.0.0:
resolution: {integrity: sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==}
@ -3908,7 +3795,7 @@ packages:
/is-weakmap@2.0.1:
resolution: {integrity: sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==}
dev: true
dev: false
/is-weakref@1.0.2:
resolution: {integrity: sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==}
@ -3921,11 +3808,11 @@ packages:
dependencies:
call-bind: 1.0.2
get-intrinsic: 1.2.0
dev: true
dev: false
/isarray@2.0.5:
resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==}
dev: true
dev: false
/isexe@2.0.0:
resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
@ -4110,7 +3997,7 @@ packages:
/locate-character@2.0.5:
resolution: {integrity: sha512-n2GmejDXtOPBAZdIiEFy5dJ5N38xBCXLNOtw2WpB9kGh6pnrEuKlwYI+Tkpofc4wDtVXHtoAOJaMRlYG/oYaxg==}
dev: true
dev: false
/locate-path@5.0.0:
resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==}
@ -4186,7 +4073,7 @@ packages:
/mdn-data@2.0.30:
resolution: {integrity: sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==}
dev: true
dev: false
/merge2@1.4.1:
resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==}
@ -4335,14 +4222,6 @@ packages:
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
dev: true
/mz@2.7.0:
resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==}
dependencies:
any-promise: 1.3.0
object-assign: 4.1.1
thenify-all: 1.6.0
dev: true
/nanoid@3.3.6:
resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
@ -4462,7 +4341,6 @@ packages:
/object-inspect@1.12.3:
resolution: {integrity: sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==}
dev: true
/object-is@1.1.5:
resolution: {integrity: sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==}
@ -4470,12 +4348,11 @@ packages:
dependencies:
call-bind: 1.0.2
define-properties: 1.2.0
dev: true
dev: false
/object-keys@1.1.1:
resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==}
engines: {node: '>= 0.4'}
dev: true
/object.assign@4.1.4:
resolution: {integrity: sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==}
@ -4485,7 +4362,6 @@ packages:
define-properties: 1.2.0
has-symbols: 1.0.3
object-keys: 1.1.1
dev: true
/object.values@1.1.6:
resolution: {integrity: sha512-FVVTkD1vENCsAcwNs9k6jea2uHC/X0+JcjG8YA60FN5CMaJmG95wT9jek/xX9nornqGRrBkKtzuAu2wuHpKqvw==}
@ -4674,7 +4550,7 @@ packages:
'@types/estree': 1.0.0
estree-walker: 3.0.3
is-reference: 3.0.1
dev: true
dev: false
/phin@2.9.3:
resolution: {integrity: sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==}
@ -4687,11 +4563,6 @@ packages:
resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==}
engines: {node: '>=8.6'}
/pirates@4.0.5:
resolution: {integrity: sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==}
engines: {node: '>= 6'}
dev: true
/pixelmatch@4.0.2:
resolution: {integrity: sha512-J8B6xqiO37sU/gkcMglv6h5Jbd9xNER7aHzpfRdNmV4IbQBzBpe4l9XmbG+xPF/znacgu2jfEw+wHffaq/YkXA==}
hasBin: true
@ -4937,7 +4808,6 @@ packages:
call-bind: 1.0.2
define-properties: 1.2.0
functions-have-names: 1.2.3
dev: true
/regexpp@3.2.0:
resolution: {integrity: sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==}
@ -4998,20 +4868,6 @@ packages:
glob: 7.2.3
dev: true
/rollup-plugin-dts@5.3.0(rollup@3.20.2)(typescript@5.0.4):
resolution: {integrity: sha512-8FXp0ZkyZj1iU5klkIJYLjIq/YZSwBoERu33QBDxm/1yw5UU4txrEtcmMkrq+ZiKu3Q4qvPCNqc3ovX6rjqzbQ==}
engines: {node: '>=v14'}
peerDependencies:
rollup: ^3.0.0
typescript: ^4.1 || ^5.0
dependencies:
magic-string: 0.30.0
rollup: 3.20.2
typescript: 5.0.4
optionalDependencies:
'@babel/code-frame': 7.21.4
dev: true
/rollup-plugin-dts@5.3.0(rollup@3.23.0)(typescript@5.0.4):
resolution: {integrity: sha512-8FXp0ZkyZj1iU5klkIJYLjIq/YZSwBoERu33QBDxm/1yw5UU4txrEtcmMkrq+ZiKu3Q4qvPCNqc3ovX6rjqzbQ==}
engines: {node: '>=v14'}
@ -5236,7 +5092,6 @@ packages:
call-bind: 1.0.2
get-intrinsic: 1.2.0
object-inspect: 1.12.3
dev: true
/siginfo@2.0.0:
resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==}
@ -5291,17 +5146,12 @@ packages:
resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==}
engines: {node: '>=0.10.0'}
/source-map-support@0.5.21:
resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==}
dependencies:
buffer-from: 1.1.2
source-map: 0.6.1
dev: true
/source-map@0.6.1:
resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==}
engines: {node: '>=0.10.0'}
requiresBuild: true
dev: true
optional: true
/source-map@0.7.4:
resolution: {integrity: sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==}
@ -5343,7 +5193,7 @@ packages:
engines: {node: '>= 0.4'}
dependencies:
internal-slot: 1.0.5
dev: true
dev: false
/streamsearch@1.1.0:
resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==}
@ -5440,20 +5290,6 @@ packages:
resolution: {integrity: sha512-78Jv8kYJdjbvRwwijtCevYADfsI0lGzYJe4mMFdceO8l75DFFDoqBhR1jVDicDRRaX4//g1u9wKeo+ztc2h1Rw==}
dev: false
/sucrase@3.32.0:
resolution: {integrity: sha512-ydQOU34rpSyj2TGyz4D2p8rbktIOZ8QY9s+DGLvFU1i5pWJE8vkpruCjGCMHsdXwnD7JDcS+noSwM/a7zyNFDQ==}
engines: {node: '>=8'}
hasBin: true
dependencies:
'@jridgewell/gen-mapping': 0.3.3
commander: 4.1.1
glob: 7.1.6
lines-and-columns: 1.2.4
mz: 2.7.0
pirates: 4.0.5
ts-interface-checker: 0.1.13
dev: true
/supports-color@5.5.0:
resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==}
engines: {node: '>=4'}
@ -5629,19 +5465,6 @@ packages:
resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==}
dev: true
/thenify-all@1.6.0:
resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==}
engines: {node: '>=0.8'}
dependencies:
thenify: 3.3.1
dev: true
/thenify@3.3.1:
resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==}
dependencies:
any-promise: 1.3.0
dev: true
/time-zone@1.0.0:
resolution: {integrity: sha512-TIsDdtKo6+XrPtiTm1ssmMngN1sAhyKnTO2kunQWqNPWIVvCm15Wmw4SWInwTVgJ5u/Tr04+8Ei9TNcw4x4ONA==}
engines: {node: '>=4'}
@ -5717,10 +5540,6 @@ packages:
punycode: 2.3.0
dev: true
/ts-interface-checker@0.1.13:
resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==}
dev: true
/ts-morph@18.0.0:
resolution: {integrity: sha512-Kg5u0mk19PIIe4islUI/HWRvm9bC1lHejK4S0oh1zaZ77TMZAEmQC0sHQYiu2RgCQFZKXz1fMVi/7nOOeirznA==}
dependencies:
@ -5741,10 +5560,6 @@ packages:
resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==}
dev: true
/tslib@2.5.0:
resolution: {integrity: sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==}
dev: true
/tsutils@3.21.0(typescript@5.0.4):
resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==}
engines: {node: '>= 6'}
@ -6140,7 +5955,6 @@ packages:
is-number-object: 1.0.7
is-string: 1.0.7
is-symbol: 1.0.4
dev: true
/which-collection@1.0.1:
resolution: {integrity: sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==}
@ -6149,7 +5963,7 @@ packages:
is-set: 2.0.2
is-weakmap: 2.0.1
is-weakset: 2.0.2
dev: true
dev: false
/which-typed-array@1.1.9:
resolution: {integrity: sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==}
@ -6161,7 +5975,6 @@ packages:
gopd: 1.0.1
has-tostringtag: 1.0.0
is-typed-array: 1.1.10
dev: true
/which@2.0.2:
resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}

View File

@ -1,56 +0,0 @@
const fs = require('fs');
const path = require('path');
const { compile } = require('./compiler.js');
const extensions = ['.svelte', '.html'];
let compileOptions = {};
function capitalise(name) {
return name[0].toUpperCase() + name.slice(1);
}
function register(options = {}) {
if (options.extensions) {
extensions.forEach(deregisterExtension);
options.extensions.forEach(registerExtension);
}
compileOptions = Object.assign({}, options);
delete compileOptions.extensions;
}
function deregisterExtension(extension) {
delete require.extensions[extension];
}
function registerExtension(extension) {
require.extensions[extension] = function(module, filename) {
const name = path.parse(filename).name
.replace(/^\d/, '_$&')
.replace(/[^a-zA-Z0-9_$]/g, '');
const options = Object.assign({}, compileOptions, {
filename,
name: capitalise(name),
generate: 'ssr',
format: 'cjs'
});
const { js, warnings } = compile(fs.readFileSync(filename, 'utf-8'), options);
if (options.dev) {
warnings.forEach(warning => {
console.warn(`\nSvelte Warning in ${warning.filename}:`);
console.warn(warning.message);
console.warn(warning.frame);
})
}
return module._compile(js.code, filename);
};
}
registerExtension('.svelte');
registerExtension('.html');
module.exports = register;

82
rollup.config.js Normal file
View File

@ -0,0 +1,82 @@
import fs from 'node:fs';
import { createRequire } from 'node:module';
import replace from '@rollup/plugin-replace';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
const require = createRequire(import.meta.url);
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
// Create auto-generated .js files
fs.writeFileSync(
'./src/shared/version.js',
`/** @type {string} */\nexport const VERSION = '${pkg.version}';`
);
const internal = await import('./src/runtime/internal/index.js');
fs.writeFileSync(
'src/compiler/compile/internal_exports.js',
`// This file is automatically generated\n` +
`export default new Set(${JSON.stringify(Object.keys(internal))});`
);
// Generate d.ts files for runtime entrypoints so that TS can find it also without `"moduleResolution": "bundler"`
fs.readdirSync('src/runtime', { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.forEach((dirent) =>
fs.writeFileSync(
`${dirent.name}.d.ts`,
`export * from './types/runtime/${dirent.name}/index.js';`
)
);
fs.writeFileSync('./index.d.ts', `export * from './types/runtime/index.js';`);
fs.writeFileSync(
'./compiler.d.ts',
`export { compile, parse, preprocess, walk, VERSION } from './types/compiler/index.js';`
);
/**
* @type {import("rollup").RollupOptions[]}
*/
export default [
// Generate UMD build of the compiler so that Eslint/Prettier (which need CJS) and REPL (which needs UMD because browser) can use it
{
input: 'src/compiler/index.js',
plugins: [
replace({
preventAssignment: true,
values: {
'process.env.NODE_DEBUG': false // appears inside the util package
}
}),
{
resolveId(id) {
// util is a built-in module in Node.js, but we want a self-contained compiler bundle
// that also works in the browser, so we load its polyfill instead
if (id === 'util') {
return require.resolve('./node_modules/util'); // just 'utils' would resolve this to the built-in module
}
// Must import from the `css-tree` browser bundled distribution due to `createRequire` usage if importing from css-tree directly
if (id === 'css-tree') {
return require.resolve('./node_modules/css-tree/dist/csstree.esm.js');
}
}
},
resolve(),
commonjs({
include: ['node_modules/**']
}),
json()
],
output: {
file: 'compiler.cjs',
format: 'umd',
name: 'svelte',
sourcemap: false
},
external: []
}
];

View File

@ -1,150 +0,0 @@
import fs from 'node:fs';
import { createRequire } from 'node:module';
import replace from '@rollup/plugin-replace';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import sucrase from '@rollup/plugin-sucrase';
import typescript from '@rollup/plugin-typescript';
const require = createRequire(import.meta.url);
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
const is_publish = !!process.env.PUBLISH;
const ts_plugin = is_publish
? typescript({
typescript: require('typescript'),
paths: {
'svelte/*': ['./src/runtime/*']
}
})
: sucrase({
transforms: ['typescript']
});
fs.writeFileSync(
`./compiler.d.ts`,
`export { compile, parse, preprocess, walk, VERSION } from './types/compiler/index.js';`
);
const runtime_entrypoints = Object.fromEntries(
fs
.readdirSync('src/runtime', { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.map((dirent) => [dirent.name, `src/runtime/${dirent.name}/index.js`])
);
/**
* @type {import("rollup").RollupOptions[]}
*/
export default [
{
input: {
...runtime_entrypoints,
index: 'src/runtime/index.js',
ssr: 'src/runtime/ssr.js'
},
output: ['es', 'cjs'].map(
/** @returns {import('rollup').OutputOptions} */
(format) => {
const ext = format === 'es' ? 'mjs' : 'js';
return {
entryFileNames: (entry) => {
if (entry.isEntry) {
if (entry.name === 'index') return `index.${ext}`;
else if (entry.name === 'ssr') return `ssr.${ext}`;
return `${entry.name}/index.${ext}`;
}
},
chunkFileNames: `internal/[name]-[hash].${ext}`,
format,
minifyInternalExports: false,
dir: '.',
};
}
),
plugins: [
replace({
preventAssignment: true,
values: {
__VERSION__: pkg.version,
},
}),
ts_plugin,
{
writeBundle(options, bundle) {
if (options.format !== 'es') return;
for (const entry of Object.values(bundle)) {
const dir = entry.name;
if (!entry.isEntry || !runtime_entrypoints[dir]) continue;
if (dir === 'internal') {
const mod = bundle[`internal/index.mjs`];
if (mod) {
fs.writeFileSync(
'src/compiler/compile/internal_exports.js',
`// This file is automatically generated\n` +
`export default new Set(${JSON.stringify(mod.exports)});`
);
}
}
fs.writeFileSync(
`${dir}/index.d.ts`,
`export * from '../types/runtime/${dir}/index.js';`
);
}
}
}
]
},
/* compiler.js */
{
input: 'src/compiler/index.js',
plugins: [
replace({
preventAssignment: true,
values: {
__VERSION__: pkg.version,
'process.env.NODE_DEBUG': false // appears inside the util package
},
}),
{
resolveId(id) {
// util is a built-in module in Node.js, but we want a self-contained compiler bundle
// that also works in the browser, so we load its polyfill instead
if (id === 'util') {
return require.resolve('./node_modules/util'); // just 'utils' would resolve this to the built-in module
}
},
},
resolve(),
commonjs({
include: ['node_modules/**']
}),
json(),
ts_plugin
],
output: [
{
file: 'compiler.js',
format: is_publish ? 'umd' : 'cjs',
name: 'svelte',
sourcemap: true,
},
{
file: 'compiler.mjs',
format: 'esm',
name: 'svelte',
sourcemap: true,
}
],
external: is_publish
? []
: (id) =>
id === 'acorn' || id === 'magic-string' || id.startsWith('css-tree')
}
];

View File

@ -1,7 +1,7 @@
/** ----------------------------------------------------------------------
This script gets a list of global objects/functions of browser.
This process is simple for now, so it is handled without AST parser.
Please run `node scripts/globals-extractor.mjs` at the project root.
Please run `node scripts/globals-extractor.js` at the project root.
see: https://github.com/microsoft/TypeScript/tree/main/lib
---------------------------------------------------------------------- */
@ -68,7 +68,7 @@ const build_output = (functions) => {
const sorted = Array.from(new Set(functions.sort()));
return `\
/** ----------------------------------------------------------------------
This file is automatically generated by \`scripts/globals-extractor.mjs\`.
This file is automatically generated by \`scripts/globals-extractor.js\`.
Generated At: ${new Date().toISOString()}
---------------------------------------------------------------------- */

View File

@ -28,6 +28,7 @@ import {
extract_svelte_ignore_from_comments
} from '../utils/extract_svelte_ignore.js';
import check_enable_sourcemap from './utils/check_enable_sourcemap.js';
import { VERSION } from '../../shared/version.js';
const regex_leading_directory_separator = /^[/\\]/;
const regex_starts_with_term_export = /^Export/;
@ -319,8 +320,7 @@ export default class Component {
let css = null;
if (result) {
const { compile_options, name } = this;
const { format = 'esm' } = compile_options;
const banner = `${this.file ? `${this.file} ` : ''}generated by Svelte v${'__VERSION__'}`;
const banner = `${this.file ? `${this.file} ` : ''}generated by Svelte v${VERSION}`;
/** @type {any} */
const program = { type: 'Program', body: result.js };
@ -387,7 +387,6 @@ export default class Component {
);
create_module(
program,
format,
name,
banner,
compile_options.sveltePath,

View File

@ -1,10 +1,7 @@
import list from '../utils/list.js';
import { b, x } from 'code-red';
const wrappers = { esm, cjs };
import { b } from 'code-red';
/**
* @param {any} program
* @param {import('../interfaces.js').ModuleFormat} format
* @param {import('estree').Identifier} name
* @param {string} banner
* @param {any} sveltePath
@ -16,7 +13,6 @@ const wrappers = { esm, cjs };
*/
export default function create_module(
program,
format,
name,
banner,
sveltePath = 'svelte',
@ -39,11 +35,7 @@ export default function create_module(
* @param {any} b
*/ (a, b) => (a.name < b.name ? -1 : 1)
);
const formatter = wrappers[format];
if (!formatter) {
throw new Error(`options.format is invalid (must be ${list(Object.keys(wrappers))})`);
}
return formatter(
return esm(
program,
name,
banner,
@ -174,124 +166,7 @@ function esm(
}
/**
* @param {any} program
* @param {import('estree').Identifier} name
* @param {string} banner
* @param {string} sveltePath
* @param {string} internal_path
* @param {Array<{ name: string; alias: import('estree').Identifier }>} helpers
* @param {Array<{ name: string; alias: import('estree').Identifier }>} globals
* @param {import('estree').ImportDeclaration[]} imports
* @param {Export[]} module_exports
* @param {import('estree').ExportNamedDeclaration[]} exports_from
*/
function cjs(
program,
name,
banner,
sveltePath,
internal_path,
helpers,
globals,
imports,
module_exports,
exports_from
) {
const internal_requires = {
type: 'VariableDeclaration',
kind: 'const',
declarations: [
{
type: 'VariableDeclarator',
id: {
type: 'ObjectPattern',
properties: helpers.map(
/** @param {any} h */ (h) => ({
type: 'Property',
method: false,
shorthand: false,
computed: false,
key: { type: 'Identifier', name: h.name },
value: h.alias,
kind: 'init'
})
)
},
init: x`require("${internal_path}")`
}
]
};
const internal_globals = get_internal_globals(globals, helpers);
const user_requires = imports.map(
/** @param {any} node */ (node) => {
const init = x`require("${edit_source(node.source.value, sveltePath)}")`;
if (node.specifiers.length === 0) {
return b`${init};`;
}
return {
type: 'VariableDeclaration',
kind: 'const',
declarations: [
{
type: 'VariableDeclarator',
id:
node.specifiers[0].type === 'ImportNamespaceSpecifier'
? { type: 'Identifier', name: node.specifiers[0].local.name }
: {
type: 'ObjectPattern',
properties: node.specifiers.map(
/** @param {any} s */ (s) => ({
type: 'Property',
method: false,
shorthand: false,
computed: false,
key:
s.type === 'ImportSpecifier'
? s.imported
: { type: 'Identifier', name: 'default' },
value: s.local,
kind: 'init'
})
)
},
init
}
]
};
}
);
const exports = module_exports.map(
/** @param {any} x */
(x) =>
b`exports.${{ type: 'Identifier', name: x.as }} = ${{ type: 'Identifier', name: x.name }};`
);
const user_exports_from = exports_from.map(
/** @param {any} node */ (node) => {
const init = x`require("${edit_source(node.source.value, sveltePath)}")`;
return node.specifiers.map(
/** @param {any} specifier */ (specifier) => {
return b`exports.${specifier.exported} = ${init}.${specifier.local};`;
}
);
}
);
program.body = b`
/* ${banner} */
"use strict";
${internal_requires}
${internal_globals}
${user_requires}
${user_exports_from}
${program.body}
exports.default = ${name};
${exports}
`;
}
/** @typedef {Object} Export
* @typedef {Object} Export
* @property {string} name
* @property {string} as
*/

View File

@ -2,6 +2,4 @@ export { default as compile } from './compile/index.js';
export { default as parse } from './parse/index.js';
export { default as preprocess } from './preprocess/index.js';
export { walk } from 'estree-walker';
/** @type {string} */
export const VERSION = '__VERSION__';
export { VERSION } from '../shared/version.js';

View File

@ -159,8 +159,6 @@ export interface Warning {
toString: () => string;
}
export type ModuleFormat = 'esm' | 'cjs';
export type EnableSourcemap = boolean | { js: boolean; css: boolean };
export type CssHashGetter = (args: {
@ -171,7 +169,6 @@ export type CssHashGetter = (args: {
}) => string;
export interface CompileOptions {
format?: ModuleFormat;
name?: string;
filename?: string;
generate?: 'dom' | 'ssr' | false;

View File

@ -1,7 +1,4 @@
// @ts-nocheck
// Note: Must import from the `css-tree` browser bundled distribution due to `createRequire` usage if importing from
// `css-tree` Node module directly. This allows the production build of Svelte to work correctly.
// import { fork } from '../../../../../node_modules/css-tree/dist/csstree.esm.js';
import { fork } from 'css-tree';
import * as node from './node/index.js';

View File

@ -7,7 +7,6 @@ import {
} from '../utils/mapped_code.js';
import { decode_map } from './decode_sourcemap.js';
import { replace_in_code, slice_source } from './replace_in_code.js';
import { regex_whitespaces } from '../utils/patterns.js';
const regex_filepath_separator = /[/\\]/;
@ -132,11 +131,18 @@ function processed_content_to_code(processed, location, file_basename) {
* representing the tag content replaced with `processed`.
* @param {import('./public.js').Processed} processed
* @param {'style' | 'script'} tag_name
* @param {string} attributes
* @param {string} original_attributes
* @param {string} generated_attributes
* @param {import('./private.js').Source} source
* @returns {MappedCode}
*/
function processed_tag_to_code(processed, tag_name, attributes, source) {
function processed_tag_to_code(
processed,
tag_name,
original_attributes,
generated_attributes,
source
) {
const { file_basename, get_location } = source;
/**
@ -145,34 +151,105 @@ function processed_tag_to_code(processed, tag_name, attributes, source) {
*/
const build_mapped_code = (code, offset) =>
MappedCode.from_source(slice_source(code, offset, source));
const tag_open = `<${tag_name}${attributes || ''}>`;
// To map the open/close tag and content starts positions correctly, we need to
// differentiate between the original attributes and the generated attributes:
// `source` contains the original attributes and its get_location maps accordingly.
const original_tag_open = `<${tag_name}${original_attributes}>`;
const tag_open = `<${tag_name}${generated_attributes}>`;
/** @type {MappedCode} */
let tag_open_code;
if (original_tag_open.length !== tag_open.length) {
// Generate a source map for the open tag
/** @type {import('@ampproject/remapping').DecodedSourceMap['mappings']} */
const mappings = [
[
// start of tag
[0, 0, 0, 0],
// end of tag start
[`<${tag_name}`.length, 0, 0, `<${tag_name}`.length]
]
];
const line = tag_open.split('\n').length - 1;
const column = tag_open.length - (line === 0 ? 0 : tag_open.lastIndexOf('\n')) - 1;
while (mappings.length <= line) {
// end of tag start again, if this is a multi line mapping
mappings.push([[0, 0, 0, `<${tag_name}`.length]]);
}
// end of tag
mappings[line].push([
column,
0,
original_tag_open.split('\n').length - 1,
original_tag_open.length - original_tag_open.lastIndexOf('\n') - 1
]);
/** @type {import('@ampproject/remapping').DecodedSourceMap} */
const map = {
version: 3,
names: [],
sources: [file_basename],
mappings
};
sourcemap_add_offset(map, get_location(0), 0);
tag_open_code = MappedCode.from_processed(tag_open, map);
} else {
tag_open_code = build_mapped_code(tag_open, 0);
}
const tag_close = `</${tag_name}>`;
const tag_open_code = build_mapped_code(tag_open, 0);
const tag_close_code = build_mapped_code(tag_close, tag_open.length + source.source.length);
const tag_close_code = build_mapped_code(
tag_close,
original_tag_open.length + source.source.length
);
parse_attached_sourcemap(processed, tag_name);
const content_code = processed_content_to_code(
processed,
get_location(tag_open.length),
get_location(original_tag_open.length),
file_basename
);
return tag_open_code.concat(content_code).concat(tag_close_code);
}
const regex_quoted_value = /^['"](.*)['"]$/;
const attribute_pattern = /([\w-$]+\b)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g;
/**
* @param {string} str
*/
function parse_tag_attributes(str) {
// note: won't work with attribute values containing spaces.
return str
.split(regex_whitespaces)
.filter(Boolean)
.reduce((attrs, attr) => {
const i = attr.indexOf('=');
const [key, value] = i > 0 ? [attr.slice(0, i), attr.slice(i + 1)] : [attr];
const [, unquoted] = (value && value.match(regex_quoted_value)) || [];
return { ...attrs, [key]: unquoted ?? value ?? true };
}, {});
/** @type {Record<string, string | boolean>} */
const attrs = {};
/** @type {RegExpMatchArray} */
let match;
while ((match = attribute_pattern.exec(str)) !== null) {
const name = match[1];
const value = match[2] || match[3] || match[4];
attrs[name] = !value || value;
}
return attrs;
}
/**
* @param {Record<string, string | boolean> | undefined} attributes
*/
function stringify_tag_attributes(attributes) {
if (!attributes) return;
let value = Object.entries(attributes)
.map(([key, value]) => (value === true ? key : `${key}="${value}"`))
.join(' ');
if (value) {
value = ' ' + value;
}
return value;
}
const regex_style_tags = /<!--[^]*?-->|<style(\s[^]*?)?(?:>([^]*?)<\/style>|\/>)/gi;
@ -216,6 +293,7 @@ async function process_tag(tag_name, preprocessor, source) {
processed,
tag_name,
attributes,
stringify_tag_attributes(processed.attributes) ?? attributes,
slice_source(content, tag_offset, source)
);
}
@ -264,20 +342,21 @@ export default async function preprocess(source, preprocessor, options) {
? preprocessor
: [preprocessor]
: [];
const markup = preprocessors.map((p) => p.markup).filter(Boolean);
const script = preprocessors.map((p) => p.script).filter(Boolean);
const style = preprocessors.map((p) => p.style).filter(Boolean);
const result = new PreprocessResult(source, filename);
// TODO keep track: what preprocessor generated what sourcemap?
// to make debugging easier = detect low-resolution sourcemaps in fn combine_mappings
for (const process of markup) {
result.update_source(await process_markup(process, result));
}
for (const process of script) {
result.update_source(await process_tag('script', process, result));
}
for (const preprocess of style) {
result.update_source(await process_tag('style', preprocess, result));
for (const preprocessor of preprocessors) {
if (preprocessor.markup) {
result.update_source(await process_markup(preprocessor.markup, result));
}
if (preprocessor.script) {
result.update_source(await process_tag('script', preprocessor.script, result));
}
if (preprocessor.style) {
result.update_source(await process_tag('style', preprocessor.style, result));
}
}
return result.to_processed();
}

View File

@ -1,34 +1,76 @@
/**
* The result of a preprocessor run. If the preprocessor does not return a result, it is assumed that the code is unchanged.
*/
export interface Processed {
/**
* The new code
*/
code: string;
/**
* A source map mapping back to the original code
*/
map?: string | object; // we are opaque with the type here to avoid dependency on the remapping module for our public types.
/**
* A list of additional files to watch for changes
*/
dependencies?: string[];
/**
* Only for script/style preprocessors: The updated attributes to set on the tag. If undefined, attributes stay unchanged.
*/
attributes?: Record<string, string | boolean>;
toString?: () => string;
}
/**
* A markup preprocessor that takes a string of code and returns a processed version.
*/
export type MarkupPreprocessor = (options: {
/**
* The whole Svelte file content
*/
content: string;
/**
* The filename of the Svelte file
*/
filename?: string;
}) => Processed | void | Promise<Processed | void>;
/**
* A script/style preprocessor that takes a string of code and returns a processed version.
*/
export type Preprocessor = (options: {
/**
* The script/style tag content
*/
content: string;
/**
* The attributes on the script/style tag
*/
attributes: Record<string, string | boolean>;
/**
* The whole Svelte file content
*/
markup: string;
/**
* The filename of the Svelte file
*/
filename?: string;
}) => Processed | void | Promise<Processed | void>;
/**
* A preprocessor group is a set of preprocessors that are applied to a Svelte file.
*/
export interface PreprocessorGroup {
/** Name of the preprocessor. Will be a required option in the next major version */
name?: string;
markup?: MarkupPreprocessor;
style?: Preprocessor;
script?: Preprocessor;
}
/**
* Utility type to extract the type of a preprocessor from a preprocessor group
*/
export interface SveltePreprocessor<
PreprocessorType extends keyof PreprocessorGroup,
Options = any

View File

@ -1,2 +1,2 @@
export type { CompileOptions, ModuleFormat, EnableSourcemap, CssHashGetter } from './interfaces';
export type { CompileOptions, EnableSourcemap, CssHashGetter } from './interfaces';
export type * from './preprocess/public.js';

View File

@ -1,6 +1,6 @@
/** ----------------------------------------------------------------------
This file is automatically generated by `scripts/globals-extractor.mjs`.
Generated At: 2023-05-11T15:31:28.406Z
This file is automatically generated by `scripts/globals-extractor.js`.
Generated At: 2023-05-24T13:16:20.777Z
---------------------------------------------------------------------- */
export default new Set([

View File

@ -10,6 +10,7 @@ import {
} from './dom.js';
import { SvelteComponent } from './Component.js';
import { is_void } from '../../shared/utils/names.js';
import { VERSION } from '../../shared/version.js';
import { contenteditable_truthy_values } from './utils.js';
/**
@ -19,9 +20,7 @@ import { contenteditable_truthy_values } from './utils.js';
* @returns {void}
*/
export function dispatch_dev(type, detail) {
document.dispatchEvent(
custom_event(type, { version: '__VERSION__', ...detail }, { bubbles: true })
);
document.dispatchEvent(custom_event(type, { version: VERSION, ...detail }, { bubbles: true }));
}
/**

View File

@ -1,9 +1,9 @@
import { identity as linear, is_function, noop, run_all } from './utils.js';
import { now } from './environment';
import { loop } from './loop';
import { create_rule, delete_rule } from './style_manager';
import { custom_event } from './dom';
import { add_render_callback } from './scheduler';
import { now } from './environment.js';
import { loop } from './loop.js';
import { create_rule, delete_rule } from './style_manager.js';
import { custom_event } from './dom.js';
import { add_render_callback } from './scheduler.js';
/**
* @type {Promise<void> | null}

26
ssr.js Normal file
View File

@ -0,0 +1,26 @@
'use strict';
var Component = require('./internal/Component-9c4b98a2.js');
var dev = require('./internal/dev-1537023e.js');
/** @returns {void} */
function onMount() {}
/** @returns {void} */
function beforeUpdate() {}
/** @returns {void} */
function afterUpdate() {}
exports.createEventDispatcher = Component.createEventDispatcher;
exports.getAllContexts = Component.getAllContexts;
exports.getContext = Component.getContext;
exports.hasContext = Component.hasContext;
exports.onDestroy = Component.onDestroy;
exports.setContext = Component.setContext;
exports.tick = Component.tick;
exports.SvelteComponent = dev.SvelteComponentDev;
exports.SvelteComponentTyped = dev.SvelteComponentTyped;
exports.afterUpdate = afterUpdate;
exports.beforeUpdate = beforeUpdate;
exports.onMount = onMount;

13
ssr.mjs Normal file
View File

@ -0,0 +1,13 @@
export { createEventDispatcher, getAllContexts, getContext, hasContext, onDestroy, setContext, tick } from './internal/Component-cd97939e.mjs';
export { SvelteComponentDev as SvelteComponent, SvelteComponentTyped } from './internal/dev-89102382.mjs';
/** @returns {void} */
function onMount() {}
/** @returns {void} */
function beforeUpdate() {}
/** @returns {void} */
function afterUpdate() {}
export { afterUpdate, beforeUpdate, onMount };

1
store/index.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from '../types/runtime/store/index.js';

189
store/index.js Normal file
View File

@ -0,0 +1,189 @@
'use strict';
var Component = require('../internal/Component-9c4b98a2.js');
const subscriber_queue = [];
/**
* Creates a `Readable` store that allows reading by subscription.
* @template T
* @param {T} value initial value
* @param {import('./public.js').StartStopNotifier<T>} start
* @returns {import('./public.js').Readable<T>}
*/
function readable(value, start) {
return {
subscribe: writable(value, start).subscribe
};
}
/**
* Create a `Writable` store that allows both updating and reading by subscription.
* @template T
* @param {T} value initial value
* @param {import('./public.js').StartStopNotifier<T>} start
* @returns {import('./public.js').Writable<T>}
*/
function writable(value, start = Component.noop) {
/** @type {import('./public.js').Unsubscriber} */
let stop;
/** @type {Set<import('./private.js').SubscribeInvalidateTuple<T>>} */
const subscribers = new Set();
/** @param {T} new_value
* @returns {void}
*/
function set(new_value) {
if (Component.safe_not_equal(value, new_value)) {
value = new_value;
if (stop) {
// store is ready
const run_queue = !subscriber_queue.length;
for (const subscriber of subscribers) {
subscriber[1]();
subscriber_queue.push(subscriber, value);
}
if (run_queue) {
for (let i = 0; i < subscriber_queue.length; i += 2) {
subscriber_queue[i][0](subscriber_queue[i + 1]);
}
subscriber_queue.length = 0;
}
}
}
}
/**
* @param {import('./public.js').Updater<T>} fn
* @returns {void}
*/
function update(fn) {
set(fn(value));
}
/**
* @param {import('./public.js').Subscriber<T>} run
* @param {import('./private.js').Invalidator<T>} invalidate
* @returns {import('./public.js').Unsubscriber}
*/
function subscribe(run, invalidate = Component.noop) {
/** @type {import('./private.js').SubscribeInvalidateTuple<T>} */
const subscriber = [run, invalidate];
subscribers.add(subscriber);
if (subscribers.size === 1) {
stop = start(set, update) || Component.noop;
}
run(value);
return () => {
subscribers.delete(subscriber);
if (subscribers.size === 0 && stop) {
stop();
stop = null;
}
};
}
return { set, update, subscribe };
}
/**
* Derived value store by synchronizing one or more readable stores and
* applying an aggregation function over its input values.
*
* @template {import('./private.js').Stores} S
* @template T
* @overload
* @param {S} stores - input stores
* @param {(values: import('./public.js').StoresValues<S>, set: import('./public.js').Subscriber<T>, update: (fn: import('./public.js').Updater<T>) => void) => import('./public.js').Unsubscriber | void} fn - function callback that aggregates the values
* @param {T} [initial_value] - initial value
* @returns {import('./public.js').Readable<T>}
*/
/**
* Derived value store by synchronizing one or more readable stores and
* applying an aggregation function over its input values.
*
* @template {import('./private.js').Stores} S
* @template T
* @overload
* @param {S} stores - input stores
* @param {(values: import('./public.js').StoresValues<S>) => T} fn - function callback that aggregates the values
* @param {T} [initial_value] - initial value
* @returns {import('./public.js').Readable<T>}
*/
/**
* @template {import('./private.js').Stores} S
* @template T
* @param {S} stores
* @param {Function} fn
* @param {T} [initial_value]
* @returns {import('./public.js').Readable<T>}
*/
function derived(stores, fn, initial_value) {
const single = !Array.isArray(stores);
/** @type {Array<import('./public.js').Readable<any>>} */
const stores_array = single ? [stores] : stores;
if (!stores_array.every(Boolean)) {
throw new Error('derived() expects stores as input, got a falsy value');
}
const auto = fn.length < 2;
return readable(initial_value, (set, update) => {
let started = false;
const values = [];
let pending = 0;
let cleanup = Component.noop;
const sync = () => {
if (pending) {
return;
}
cleanup();
const result = fn(single ? values[0] : values, set, update);
if (auto) {
set(result);
} else {
cleanup = Component.is_function(result) ? result : Component.noop;
}
};
const unsubscribers = stores_array.map((store, i) =>
Component.subscribe(
store,
(value) => {
values[i] = value;
pending &= ~(1 << i);
if (started) {
sync();
}
},
() => {
pending |= 1 << i;
}
)
);
started = true;
sync();
return function stop() {
Component.run_all(unsubscribers);
cleanup();
// We need to set this to false because callbacks can still happen despite having unsubscribed:
// Callbacks might already be placed in the queue which doesn't know it should no longer
// invoke this derived store.
started = false;
};
});
}
/**
* Takes a store and returns a new one derived from the old one that is readable.
*
* @template T
* @param {import('./public.js').Readable<T>} store - store to make readonly
* @returns {import('./public.js').Readable<T>}
*/
function readonly(store) {
return {
subscribe: store.subscribe.bind(store)
};
}
exports.get = Component.get_store_value;
exports.derived = derived;
exports.readable = readable;
exports.readonly = readonly;
exports.writable = writable;

184
store/index.mjs Normal file
View File

@ -0,0 +1,184 @@
import { noop, subscribe, run_all, safe_not_equal, is_function } from '../internal/Component-cd97939e.mjs';
export { get_store_value as get } from '../internal/Component-cd97939e.mjs';
const subscriber_queue = [];
/**
* Creates a `Readable` store that allows reading by subscription.
* @template T
* @param {T} value initial value
* @param {import('./public.js').StartStopNotifier<T>} start
* @returns {import('./public.js').Readable<T>}
*/
function readable(value, start) {
return {
subscribe: writable(value, start).subscribe
};
}
/**
* Create a `Writable` store that allows both updating and reading by subscription.
* @template T
* @param {T} value initial value
* @param {import('./public.js').StartStopNotifier<T>} start
* @returns {import('./public.js').Writable<T>}
*/
function writable(value, start = noop) {
/** @type {import('./public.js').Unsubscriber} */
let stop;
/** @type {Set<import('./private.js').SubscribeInvalidateTuple<T>>} */
const subscribers = new Set();
/** @param {T} new_value
* @returns {void}
*/
function set(new_value) {
if (safe_not_equal(value, new_value)) {
value = new_value;
if (stop) {
// store is ready
const run_queue = !subscriber_queue.length;
for (const subscriber of subscribers) {
subscriber[1]();
subscriber_queue.push(subscriber, value);
}
if (run_queue) {
for (let i = 0; i < subscriber_queue.length; i += 2) {
subscriber_queue[i][0](subscriber_queue[i + 1]);
}
subscriber_queue.length = 0;
}
}
}
}
/**
* @param {import('./public.js').Updater<T>} fn
* @returns {void}
*/
function update(fn) {
set(fn(value));
}
/**
* @param {import('./public.js').Subscriber<T>} run
* @param {import('./private.js').Invalidator<T>} invalidate
* @returns {import('./public.js').Unsubscriber}
*/
function subscribe(run, invalidate = noop) {
/** @type {import('./private.js').SubscribeInvalidateTuple<T>} */
const subscriber = [run, invalidate];
subscribers.add(subscriber);
if (subscribers.size === 1) {
stop = start(set, update) || noop;
}
run(value);
return () => {
subscribers.delete(subscriber);
if (subscribers.size === 0 && stop) {
stop();
stop = null;
}
};
}
return { set, update, subscribe };
}
/**
* Derived value store by synchronizing one or more readable stores and
* applying an aggregation function over its input values.
*
* @template {import('./private.js').Stores} S
* @template T
* @overload
* @param {S} stores - input stores
* @param {(values: import('./public.js').StoresValues<S>, set: import('./public.js').Subscriber<T>, update: (fn: import('./public.js').Updater<T>) => void) => import('./public.js').Unsubscriber | void} fn - function callback that aggregates the values
* @param {T} [initial_value] - initial value
* @returns {import('./public.js').Readable<T>}
*/
/**
* Derived value store by synchronizing one or more readable stores and
* applying an aggregation function over its input values.
*
* @template {import('./private.js').Stores} S
* @template T
* @overload
* @param {S} stores - input stores
* @param {(values: import('./public.js').StoresValues<S>) => T} fn - function callback that aggregates the values
* @param {T} [initial_value] - initial value
* @returns {import('./public.js').Readable<T>}
*/
/**
* @template {import('./private.js').Stores} S
* @template T
* @param {S} stores
* @param {Function} fn
* @param {T} [initial_value]
* @returns {import('./public.js').Readable<T>}
*/
function derived(stores, fn, initial_value) {
const single = !Array.isArray(stores);
/** @type {Array<import('./public.js').Readable<any>>} */
const stores_array = single ? [stores] : stores;
if (!stores_array.every(Boolean)) {
throw new Error('derived() expects stores as input, got a falsy value');
}
const auto = fn.length < 2;
return readable(initial_value, (set, update) => {
let started = false;
const values = [];
let pending = 0;
let cleanup = noop;
const sync = () => {
if (pending) {
return;
}
cleanup();
const result = fn(single ? values[0] : values, set, update);
if (auto) {
set(result);
} else {
cleanup = is_function(result) ? result : noop;
}
};
const unsubscribers = stores_array.map((store, i) =>
subscribe(
store,
(value) => {
values[i] = value;
pending &= ~(1 << i);
if (started) {
sync();
}
},
() => {
pending |= 1 << i;
}
)
);
started = true;
sync();
return function stop() {
run_all(unsubscribers);
cleanup();
// We need to set this to false because callbacks can still happen despite having unsubscribed:
// Callbacks might already be placed in the queue which doesn't know it should no longer
// invoke this derived store.
started = false;
};
});
}
/**
* Takes a store and returns a new one derived from the old one that is readable.
*
* @template T
* @param {import('./public.js').Readable<T>} store - store to make readonly
* @returns {import('./public.js').Readable<T>}
*/
function readonly(store) {
return {
subscribe: store.subscribe.bind(store)
};
}
export { derived, readable, readonly, writable };

5
store/package.json Normal file
View File

@ -0,0 +1,5 @@
{
"main": "./index",
"module": "./index.mjs",
"types": "./index.d.ts"
}

View File

@ -0,0 +1,47 @@
import * as fs from 'node:fs';
import * as path from 'node:path';
import { assert, describe, expect, it } from 'vitest';
import { compile } from 'svelte/compiler';
const configs = import.meta.glob('./samples/*/_config.js', { import: 'default', eager: true });
describe('compiler-errors', () => {
function run_test(dir) {
if (dir[0] === '.') return;
const config = configs[`./samples/${dir}/_config.js`];
assert.ok(config, `Missing config for ${dir}`);
const solo = config.solo || /\.solo/.test(dir);
const it_fn = config.skip ? it.skip : solo ? it.only : it;
it_fn(dir, () => {
const cwd = path.resolve(`${__dirname}/samples/${dir}`);
const compileOptions = Object.assign({}, config.compileOptions || {}, {
immutable: config.immutable,
accessors: 'accessors' in config ? config.accessors : true,
generate: 'dom'
});
try {
compile(fs.readFileSync(`${cwd}/main.svelte`, 'utf-8'), compileOptions);
} catch (error) {
if (typeof config.error === 'function') {
config.error(assert, error);
} else {
expect(error.message).toMatch(config.error);
}
return;
}
assert.fail('Expected an error');
});
}
const samples = fs.readdirSync(`${__dirname}/samples`);
samples.forEach((sample) => run_test(sample));
});

View File

@ -1,5 +1,5 @@
<script>
import Nested from './Nested.svelte';
import Nested from './irrelevant';
</script>
<Nested>

View File

@ -1,5 +1,5 @@
<script>
import Nested from './Nested.svelte';
import Nested from './irrelevant';
</script>
<Nested>

View File

@ -1,5 +1,5 @@
<script>
import Nested from './Nested.svelte';
import Nested from './irrelevant';
</script>
<Nested>

View File

@ -1,5 +1,5 @@
<script>
import Nested from './Nested.svelte';
import Nested from './irrelevant';
</script>
<Nested>

View File

@ -1,5 +1,4 @@
export default {
error: [
error:
"Element with a slot='...' attribute must be a child of a component or a descendant of a custom element"
]
};

View File

@ -1,5 +1,5 @@
<script>
import Nested from "./Nested.svelte";
import Nested from './irrelevant';
</script>
<Nested>

View File

@ -1,5 +1,4 @@
export default {
error: [
error:
"Element with a slot='...' attribute must be a child of a component or a descendant of a custom element"
]
};

View File

@ -1,5 +1,5 @@
<script>
import Nested from "./Nested.svelte";
import Nested from './irrelevant';
</script>
<Nested>

View File

@ -1,5 +1,4 @@
export default {
error: [
error:
"Element with a slot='...' attribute must be a child of a component or a descendant of a custom element"
]
};

View File

@ -1,5 +1,5 @@
<script>
import Nested from "./Nested.svelte";
import Nested from './irrelevant';
</script>
<Nested>

View File

@ -1,5 +1,5 @@
<script context="module">
import foo from './foo.js';
const foo = {};
const answer = $foo;
</script>

View File

@ -34,15 +34,9 @@ describe('css', () => {
const expected_warnings = (config.warnings || []).map(normalize_warning);
const dom = svelte.compile(
input,
Object.assign({}, config.compileOptions || {}, { format: 'cjs' })
);
const dom = svelte.compile(input, Object.assign({}, config.compileOptions || {}));
const ssr = svelte.compile(
input,
Object.assign({}, config.compileOptions || {}, { format: 'cjs', generate: 'ssr' })
);
const ssr = svelte.compile(input, Object.assign({}, config.compileOptions || {}));
assert.equal(dom.css.code, ssr.css.code);
@ -75,7 +69,7 @@ describe('css', () => {
// we do this here, rather than in the expected.html !== null
// block, to verify that valid code was generated
const load = create_loader({ ...(config.compileOptions || {}), format: 'cjs' }, cwd);
const load = create_loader({ ...(config.compileOptions || {}) }, cwd);
try {
ClientComponent = (await load('input.svelte')).default;
} catch (err) {
@ -83,10 +77,7 @@ describe('css', () => {
throw err;
}
const load_ssr = create_loader(
{ ...(config.compileOptions || {}), generate: 'ssr', format: 'cjs' },
cwd
);
const load_ssr = create_loader({ ...(config.compileOptions || {}), generate: 'ssr' }, cwd);
try {
ServerComponent = (await load_ssr('input.svelte')).default;
} catch (err) {

View File

@ -103,6 +103,8 @@ export function show_output(cwd, options = {}) {
const svelte_path = fileURLToPath(new URL('..', import.meta.url)).replace(/\\/g, '/');
const AsyncFunction = /** @type {typeof Function} */ (async function () {}.constructor);
export function create_loader(compileOptions, cwd) {
const cache = new Map();
@ -110,46 +112,100 @@ export function create_loader(compileOptions, cwd) {
if (cache.has(file)) return cache.get(file);
if (file.endsWith('.svelte')) {
const options = {
...compileOptions,
filename: file
};
const compiled = compile(
// Windows/Linux newline conversion
fs.readFileSync(file, 'utf-8').replace(/\r\n/g, '\n'),
{
...compileOptions,
filename: file
}
options
);
const imports = new Map();
const __import = (id) => {
let resolved = id;
for (const match of compiled.js.code.matchAll(/require\("(.+?)"\)/g)) {
const source = match[1];
let resolved = source;
if (source.startsWith('.')) {
resolved = path.resolve(path.dirname(file), source);
if (id.startsWith('.')) {
resolved = path.resolve(path.dirname(file), id);
}
if (source === 'svelte') {
if (id === 'svelte') {
resolved = `${svelte_path}src/runtime/index.js`;
}
if (source.startsWith('svelte/')) {
resolved = `${svelte_path}src/runtime/${source.slice(7)}/index.js`;
if (id.startsWith('svelte/')) {
resolved = `${svelte_path}src/runtime/${id.slice(7)}/index.js`;
}
imports.set(source, await load(resolved));
return load(resolved);
};
const exports = [];
// We can't use Node's or Vitest's loaders cause we compile with different options.
// We need to rewrite the imports into function calls that we can intercept to transform
// any imported Svelte components as well. A few edge cases aren't handled but also
// currently unused in the tests, for example `export * from`and live bindings.
let transformed = compiled.js.code
.replace(
/^import \* as (\w+) from ['"]([^'"]+)['"];?/gm,
'const $1 = await __import("$2");'
)
.replace(
/^import (\w+) from ['"]([^'"]+)['"];?/gm,
'const {default: $1} = await __import("$2");'
)
.replace(
/^import (\w+, )?{([^}]+)} from ['"](.+)['"];?/gm,
(_, default_, names, source) => {
const d = default_ ? `default: ${default_}` : '';
return `const { ${d} ${names.replaceAll(
' as ',
': '
)} } = await __import("${source}");`;
}
)
.replace(/^export default /gm, '__exports.default = ')
.replace(
/^export (const|let|var|class|function|async\s+function) (\w+)/gm,
(_, type, name) => {
exports.push(name);
return `${type} ${name}`;
}
)
.replace(/^export \{([^}]+)\}(?: from ['"]([^'"]+)['"];?)?/gm, (_, names, source) => {
const entries = names.split(',').map((name) => {
const match = name.trim().match(/^(\w+)( as (\w+))?$/);
const i = match[1];
const o = match[3] || i;
return [o, i];
});
return source
? `{ const __mod = await __import("${source}"); ${entries
.map(([o, i]) => `__exports.${o} = __mod.${i};`)
.join('\n')}}`
: `{ ${entries.map(([o, i]) => `__exports.${o} = ${i};`).join('\n')} }`;
});
exports.forEach((name) => {
transformed += `\n__exports.${name} = ${name};`;
});
const __exports = {
[Symbol.toStringTag]: 'Module'
};
try {
const fn = new AsyncFunction('__import', '__exports', transformed);
await fn(__import, __exports);
} catch (err) {
console.error({ transformed }); // eslint-disable-line no-console
throw err;
}
function require(id) {
return imports.get(id);
}
const fn = new Function('require', 'exports', 'module', compiled.js.code);
const module = { exports: {} };
fn(require, module.exports, module);
cache.set(file, module.exports);
return module.exports;
cache.set(file, __exports);
return __exports;
} else {
return import(file);
}

View File

@ -21,7 +21,6 @@ describe('hydration', async () => {
const compileOptions = Object.assign({}, config.compileOptions, {
accessors: 'accessors' in config ? config.accessors : true,
format: 'cjs',
hydratable: true
});

View File

@ -37,7 +37,10 @@ describe('js-output', () => {
actual = svelte
.compile(input, options)
.js.code.replace(/generated by Svelte v__VERSION__/, 'generated by Svelte vX.Y.Z');
.js.code.replace(
/generated by Svelte v\d+\.\d+\.\d+(-\w+\.\d+)?/,
'generated by Svelte vX.Y.Z'
);
} catch (err) {
console.log(err.frame);
throw err;

View File

@ -1,6 +0,0 @@
export default {
options: {
accessors: true,
format: 'cjs'
}
};

View File

@ -1,36 +0,0 @@
/* generated by Svelte vX.Y.Z */
"use strict";
const { SvelteComponent, init, safe_not_equal } = require("svelte/internal");
const { f: f_1, g: g_1 } = require("./d");
const { h: h_1 } = require("./e");
const { i: j } = require("./f");
exports.e = require("./c").d;
exports.c = require("./b").c;
exports.a = require("./a").a;
exports.b = require("./a").b;
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, null, null, safe_not_equal, {});
}
get f() {
return f_1;
}
get g() {
return g_1;
}
get h() {
return h_1;
}
get j() {
return j;
}
}
exports.default = Component;

Some files were not shown because too many files have changed in this diff Show More