update API reference docs (#2206)

pull/2346/head
Rich Harris 5 years ago committed by GitHub
parent a824a6dd6f
commit a07eac432a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,9 @@
---
title: Before we begin
---
> Temporary note: This document is a work-in-progress. Please forgive any missing or misleading parts, and don't be shy about asking for help in the [Discord chatroom](https://discord.gg/yy75DKs). The [tutorial](tutorial) is more complete; start there.
This page contains detailed API reference documentation. It's intended to be a resource for people who already have some familiarity with Svelte.
If that's not you (yet), you may prefer to visit the [interactive tutorial](tutorial) or the [examples](examples) before consulting this reference.

@ -0,0 +1,193 @@
---
title: Component format
---
---
Components are the building blocks of Svelte applications. They are written into `.svelte` files, using a superset of HTML.
All three sections — script, styles and markup — are optional.
```html
<script>
// logic goes here
</script>
<style>
/* styles go here */
</style>
<!-- markup (zero or more items) goes here -->
```
### &lt;script&gt;
A `<script>` block contains JavaScript that runs when a component instance is created. Variables declared (or imported) at the top level are 'visible' from the component's markup. There are four additional rules:
#### 1. `export` creates a component prop
---
Svelte uses the `export` keyword to mark a variable declaration as a *property* or *prop*, which means it becomes accessible to consumers of the component:
```html
<script>
// these properties can be set externally
export let foo;
export let bar = 'optional default value';
// Values that are passed in as props
// are immediately available
console.log(foo, bar);
// function declarations cannot be set externally,
// but can be accessed from outside
export function instanceMethod() {
alert(foo);
}
</script>
```
#### 2. Assignments are 'reactive'
---
To change component state and trigger a re-render, just assign to a locally declared variable.
Update expressions (`count += 1`) and property assignments (`obj.x = y`) have the same effect.
```html
<script>
let count = 0;
function handleClick () {
// calling this function will trigger a re-render
// if the markup references `count`
count = count + 1;
}
</script>
```
#### 3. `$:` marks a statement as reactive
---
Any top-level statement (i.e. not inside a block or a function) can be made reactive by prefixing it with the `$:` label. Reactive statements run immediately before the component updates, whenever the values that they depend on have changed.
```html
<script>
export let title;
// this will update `document.title` whenever
// the `title` prop changes
$: document.title = title;
$: {
console.log(`multiple statements can be combined`);
console.log(`the current title is ${title}`);
}
</script>
```
---
If a statement consists entirely of an assignment to an undeclared variable, Svelte will inject a `let` declaration on your behalf.
```html
<script>
export let num;
// we don't need to declare `squared` and `cubed`
// — Svelte does it for us
$: squared = num * num;
$: cubed = squared * num;
</script>
```
#### 4. Prefix stores with `$` to access their values
---
Any time you have a reference to a store, you can access its value inside a component by prefixing it with the `$` character. This causes Svelte to declare the prefixed variable, and set up a store subscription that will be unsubscribed when appropriate.
Note that the store must be declared at the top level of the component — not inside an `if` block or a function, for example.
Local variables (that do not represent store values) must *not* have a `$` prefix.
```html
<script>
import { writable } from 'svelte/store';
const count = writable(0);
console.log($count); // logs 0
count.set(1);
console.log($count); // logs 1
</script>
```
### &lt;script context="module"&gt;
---
A `<script>` tag with a `context="module"` attribute runs once when the module first evaluates, rather than for each component instance. Values declared in this block are accessible from a regular `<script>` (and the component markup) but not vice versa.
You can `export` bindings from this block, and they will become exports of the compiled module.
You cannot `export default`, since the default export is the component itself.
```html
<script context="module">
let totalComponents = 0;
// this allows an importer to do e.g.
// `import Example, { alertTotal } from './Example.svelte'`
export function alertTotal() {
alert(totalComponents);
}
</script>
<script>
totalComponents += 1;
console.log(`total number of times this component has been created: ${totalComponents}`);
</script>
```
### &lt;style&gt;
---
CSS inside a `<style>` block will be scoped to that component.
This works by adding a class to affected elements, which is based on a hash of the component styles (e.g. `svelte-123xyz`).
```html
<style>
p {
/* this will only affect <p> elements in this component */
color: burlywood;
}
</style>
```
---
To apply styles to a selector globally, use the `:global(...)` modifier.
```html
<style>
:global(body) {
/* this will apply to <body> */
margin: 0;
}
div :global(strong) {
/* this will apply to all <strong> elements, in any
component, that are inside <div> elements belonging
to this component */
color: goldenrod;
}
</style>
```

File diff suppressed because it is too large Load Diff

@ -0,0 +1,550 @@
---
title: Run time
---
### svelte
The `svelte` package exposes [lifecycle functions](tutorial/onmount) and the [context API](tutorial/context-api).
* `onMount(callback: () => void)`
* `onMount(callback: () => () => void)`
---
The `onMount` function schedules a callback to run as soon as the component has been mounted to the DOM. It must be called during the component's initialisation (but doesn't need to live *inside* the component; it can be called from an external module).
`onMount` does not run inside a [server-side component](docs#server-side-component-api).
```html
<script>
import { onMount } from 'svelte';
onMount(() => {
console.log('the component has mounted');
});
</script>
```
---
If a function is returned from `onMount`, it will be called when the component is unmounted.
```html
<script>
import { onMount } from 'svelte';
onMount(() => {
const interval = setInterval(() => {
console.log('beep');
}, 1000);
return () => clearInterval(interval);
});
</script>
```
* `beforeUpdate(callback: () => void)`
---
Schedules a callback to run immediately before the component is updated after any state change.
> The first time the callback runs will be before the initial `onMount`
```html
<script>
import { beforeUpdate } from 'svelte';
beforeUpdate(() => {
console.log('the component is about to update');
});
</script>
```
* `afterUpdate(callback: () => void)`
---
Schedules a callback to run immediately after the component has been updated.
```html
<script>
import { afterUpdate } from 'svelte';
afterUpdate(() => {
console.log('the component just updated');
});
</script>
```
* `onDestroy(callback: () => void)`
---
Schedules a callback to run once the component is unmounted.
Out of `onMount`, `beforeUpdate`, `afterUpdate` and `onDestroy`, this is the only one that runs inside a server-side component.
```html
<script>
import { onDestroy } from 'svelte';
onDestroy(() => {
console.log('the component is being destroyed');
});
</script>
```
* `promise: Promise = tick()`
---
Returns a promise that resolves once any pending state changes have been applied, or in the next microtask if there are none.
```html
<script>
import { beforeUpdate, tick } from 'svelte';
beforeUpdate(async () => {
console.log('the component is about to update');
await tick();
console.log('the component just updated');
});
</script>
```
* `setContext(key: any, context: any)`
---
Associates an arbitrary `context` object with the current component and the specified `key`. The context is then available to children of the component (including slotted content) with `getContext`.
Like lifecycle functions, this must be called during component initialisation.
```html
<script>
import { setContext } from 'svelte';
setContext('answer', 42);
</script>
```
* `context: any = getContext(key: any)`
---
Retrieves the context that belongs to the closest parent component with the specified `key`. Must be called during component initialisation.
```html
<script>
import { getContext } from 'svelte';
const answer = getContext('answer');
</script>
```
### svelte/store
The `svelte/store` module exports functions for creating [stores](http://localhost:3000/tutorial/writable-stores).
---
To be considered a store, an object must have a `subscribe` method that returns an `unsubscribe` function.
```js
const unsubscribe = store.subscribe(value => {
console.log(value);
}); // logs `value`
// later...
unsubscribe();
```
---
Stores have special significance inside Svelte components. Their values can be read by prefixing the store's name with the `$` character, which causes Svelte to set up subscriptions and unsubscriptions automatically during the component's lifecycle.
```html
<script>
import { count } from './stores.js';
function handleClick() {
// this is equivalent to count.update(n => n + 1)
$count += 1;
}
</script>
<button on:click={handleClick}>
Clicks: {$count}
</button>
```
* `store = writable(value: any)`
* `store = writable(value: any, () => () => void)`
---
Creates a store with additional `set` and `update` methods.
```js
import { writable } from 'svelte/store';
const count = writable(0);
count.subscribe(value => {
console.log(value);
}); // logs '0'
count.set(1); // logs '1'
count.update(n => n + 1); // logs '2'
```
---
If a function is passed as the second argument, it will be called when the number of subscribers goes from zero to one (but not from one to two, etc). That function can return another function that is called when the number of subscribers goes from one to zero.
```js
import { writable } from 'svelte/store';
const count = writable(0, () => {
console.log('got a subscriber');
return () => console.log('no more subscribers');
});
count.set(1); // does nothing
const unsubscribe = count.subscribe(value => {
console.log(value);
}); // logs 'got a subscriber', then '1'
unsubscribe(); // logs 'no more subscribers'
```
* `store = readable((set: (value: any) => void) => () => void)`
* `store = readable((set: (value: any) => void) => () => void, value: any)`
---
Creates a store whose value cannot be set from 'outside'. Instead, the function passed to `readable`, which is called when the subscriber count goes from zero to one, must call the provided `set` value. It must return a function that is called when the subscriber count goes from one to zero.
If a second argument is provided, it becomes the store's initial value.
```js
import { readable } from 'svelte/store';
const time = readable(set => {
const interval = setInterval(() => {
set(new Date());
}, 1000);
return () => clearInterval(interval);
}, new Date());
```
* `store = derive(a, callback: (a: any) => any)`
* `store = derive(a, callback: (a: any, set: (value: any) => void) => void)`
* `store = derive([a, ...b], callback: ([a: any, ...b: any[]]) => any)`
* `store = derive([a, ...b], callback: ([a: any, ...b: any[]], set: (value: any) => void) => void)`
---
Derives a store from one or more other stores. Whenever those dependencies change, the callback runs.
In the simplest version, `derive` takes a single store, and the callback returns a derived value.
```js
import { derive } from 'svelte/store';
const doubled = derive(a, $a => $a * 2);
```
---
The callback can set a value asynchronously by accepting a second argument, `set`, and calling it when appropriate.
```js
import { derive } from 'svelte/store';
const delayed = derive(a, ($a, set) => {
setTimeout(() => set($a), 1000);
});
```
---
In both cases, an array of arguments can be passed as the first argument instead of a single store.
```js
import { derive } from 'svelte/store';
const summed = derive([a, b], ([$a, $b]) => $a + $b);
const delayed = derive([a, b], ([$a, $b], set) => {
setTimeout(() => set($a + $b), 1000);
});
```
* `value: any = get(store)`
---
Generally, you should read the value of a store by subscribing to it and using the value as it changes over time. Occasionally, you may need to retrieve the value of a store to which you're not subscribed. `get` allows you to do so.
> This works by creating a subscription, reading the value, then unsubscribing. It's therefore not recommended in hot code paths.
```js
import { get } from 'svelte/store';
const value = get(store);
```
### svelte/motion
The `svelte/motion` module exports two functions, `tweened` and `spring`, for creating writable stores whose values change over time after `set` and `update`, rather than immediately.
#### tweened
* `store = tweened(value: any, options)`
Tweened stores update their values over a fixed duration. The following options are available:
* `delay` (`number`, default 0) — milliseconds before starting
* `duration` (`number`, default 400) — milliseconds the tween lasts
* `easing` (`function`, default `t => t`) — an [easing function](docs#svelte-easing)
* `interpolator` (`function`) — see below
`store.set` and `store.update` can accept a second `options` argument that will override the options passed in upon instantiation.
Both functions return a Promise that resolves when the tween completes. If the tween is interrupted, the promise will never resolve.
---
Out of the box, Svelte will interpolate between two numbers, two arrays or two objects (as long as the arrays and objects are the same 'shape', and their 'leaf' properties are also numbers).
```html
<script>
import { tweened } from 'svelte/motion';
import { cubicOut } from 'svelte/easing';
const size = tweened(1, {
duration: 300,
easing: cubicOut
});
function handleClick() {
// this is equivalent to size.update(n => n + 1)
$size += 1;
}
</script>
<button
on:click={handleClick}
style="transform: scale({$size}); transform-origin: 0 0"
>embiggen</button>
```
---
The `interpolator` option allows you to tween between *any* arbitrary values. It must be an `(a, b) => t => value` function, where `a` is the starting value, `b` is the target value, `t` is a number between 0 and 1, and `value` is the result. For example, we can use the [d3-interpolate](https://github.com/d3/d3-interpolate) package to smoothly interpolate between two colours.
```html
<script>
import { interpolateLab } from 'd3-interpolate';
import { tweened } from 'svelte/motion';
const colors = [
'rgb(255, 62, 0)',
'rgb(64, 179, 255)',
'rgb(103, 103, 120)'
];
const color = tweened(colors[0], {
duration: 800,
interpolate: interpolateLab
});
</script>
{#each colors as c}
<button
style="background-color: {c}; color: white; border: none;"
on:click="{e => color.set(c)}"
>{c}</button>
{/each}
<h1 style="color: {$color}">{$color}</h1>
```
#### spring
* `store = spring(value: any, options)`
A `spring` store gradually changes to its target value based on its `stiffness` and `damping` parameters. Whereas `tweened` stores change their values over a fixed duration, `spring` stores change over a duration that is determined by their existing velocity, allowing for more natural-seeming motion in many situations. The following options are available:
* `stiffness` (`number`, default `0.15`) — a value between 0 and 1 where higher means a 'tighter' spring
* `damping` (`number`, default `0.8`) — a value between 0 and 1 where lower means a 'springier' spring
* `precision` (`number`, default `0.001`) — determines the threshold at which the spring is considered to have 'settled', where lower means more precise
---
As with `tweened` stores, `set` and `update` return a Promise that resolves if the spring settles. The `store.stiffness` and `store.damping` properties can be changed while the spring is in motion, and will take immediate effect.
[See a full example here.](tutorial/spring)
```html
<script>
import { spring } from 'svelte/motion';
const coords = spring({ x: 50, y: 50 }, {
stiffness: 0.1,
damping: 0.25
});
</script>
```
### svelte/transition
TODO
* fade, fly, slide, draw
* crossfade...
### svelte/animation
TODO
* TODO this doesn't even exist yet
TODO
### svelte/easing
* TODO could have nice little interactive widgets showing the different functions, maybe
### svelte/register
TODO
### Client-side component API
* `const component = new Component(options)`
---
A client-side component — that is, a component compiled with `generate: 'dom'` (or the `generate` option left unspecified) is a JavaScript class.
```js
import App from './App.svelte';
const app = new App({
target: document.body,
props: {
// assuming App.svelte contains something like
// `export let answer`:
answer: 42
}
});
```
The following initialisation options can be provided:
| option | default | description |
| --- | --- | --- |
| `target` | **none** | An `HTMLElement` to render to. This option is required
| `anchor` | `null` | A child of `target` to render the component immediately before
| `props` | `{}` | An object of proeprties to supply to the component
| `hydrate` | `false` | See below
| `intro` | `false` | If `true`, will play transitions on initial render, rather than waiting for subsequent state changes
Existing children of `target` are left where they are.
---
The `hydrate` option instructs Svelte to upgrade existing DOM (usually from server-side rendering) rather than creating new elements. It will only work if the component was compiled with the `hydratable: true` option.
Whereas children of `target` are normally left alone, `hydrate: true` will cause any children to be removed. For that reason, the `anchor` option cannot be used alongside `hydrate: true`.
The existing DOM doesn't need to match the component — Svelte will 'repair' the DOM as it goes.
```js
import App from './App.svelte';
const app = new App({
target: document.querySelector('#server-rendered-html'),
hydrate: true
});
```
* `component.$set(props)`
---
Programmatically sets props on an instance. `component.$set({ x: 1 })` is equivalent to `x = 1` inside the component's `<script>` block.
Calling this method schedules an update for the next microtask — the DOM is *not* updated synchronously.
```js
app.$set({ answer: 42 });
```
* `component.$on(event, callback)`
---
Causes the `callback` function to be called whenever the component dispatches an `event`.
```js
app.$on('selected', event => {
console.log(event.detail.selection);
});
```
* `component.$destroy()`
Removes a component from the DOM and triggers any `onDestroy` handlers.
* `component.prop`
* `component.prop = value`
---
If a component is compiled with `accessors: true`, each instance will have getters and setters corresponding to each of the component's props. Setting a value will cause a *synchronous* update, rather than the default async update caused by `component.$set(...)`.
By default, `accessors` is `false`, unless you're compiling as a custom element.
```js
console.log(app.count);
app.count += 1;
```
### Custom element API
* TODO
### Server-side component API
* `const result = Component.render(...)`
---
Unlike client-side components, server-side components don't have a lifespan after you render them — their whole job is to create some HTML and CSS. For that reason, the API is somewhat different.
A server-side component exposes a `render` method that can be called with optional props. It returns an object with `head`, `html`, and `css` properties, where `head` contains the contents of any `<svelte:head>` elements encountered.
```js
const App = require('./App.svelte');
const { head, html, css } = App.render({
answer: 42
});
```

@ -0,0 +1,291 @@
---
title: Compile time
---
Typically, you won't interact with the Svelte compiler directly, but will instead integrate it into your build system using a bundler plugin:
* [rollup-plugin-svelte](https://github.com/rollup/rollup-plugin-svelte) for users of [Rollup](https://rollupjs.org)
* [svelte-loader](https://github.com/sveltejs/svelte-loader) for users of [webpack](https://webpack.js.org)
* [parcel-plugin-svelte](https://github.com/DeMoorJasper/parcel-plugin-svelte) for users of [Parcel](https://parceljs.org/)
Nonetheless, it's useful to understand how to use the compiler, since bundler plugins generally expose compiler options to you.
### svelte.compile
```js
result: {
js,
css,
ast,
warnings,
vars,
stats
} = svelte.compile(source: string, options?: {...})
```
---
This is where the magic happens. `svelte.compile` takes your component source code, and turns it into a JavaScript module that exports a class.
```js
const svelte = require('svelte/compiler');
const result = svelte.compile(source, {
// options
});
```
The following options can be passed to the compiler. None are required:
<!-- | option | type | default
| --- | --- | --- |
| `filename` | string | `null`
| `name` | string | `"Component"`
| `format` | `"esm"` or `"cjs"` | `"esm"`
| `generate` | `"dom"` or `"ssr"` | `"dom"`
| `dev` | boolean | `false`
| `immutable` | boolean | `false`
| `hydratable` | boolean | `false`
| `legacy` | boolean | `false`
| `customElement` | boolean | `false`
| `tag` | string | null
| `accessors` | boolean | `false`
| `css` | boolean | `true`
| `preserveComments` | boolean | `false`
| `preserveWhitespace` | boolean | `false`
| `outputFilename` | string | `null`
| `cssOutputFilename` | string | `null`
| `sveltePath` | string | `"svelte"` -->
| option | default | description |
| --- | --- | --- |
| `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.
| `dev` | `false` | If `true`, causes extra code to be added to components that will perform runtime checks and provide debugging information during development.
| `immutable` | `false` | If `true`, tells the compiler that you promise not to mutate any objects. This allows it to be less conservative about checking whether values have changed.
| `hydratable` | `false` | If `true`, enables the `hydrate: true` runtime option, which allows a component to upgrade existing DOM rather than creating new DOM from scratch.
| `legacy` | `false` | If `true`, generates code that will work in IE9 and IE10, which don't support things like `element.dataset`.
| `accessors` | `false` | If `true`, getters and setters will be created for the component's props. If `false`, they will only be created for readonly exported values (i.e. those declared with `const`, `class` and `function`). If compiling with `customElement: true` this option defaults to `true`.
| `customElement` | `false` | If `true`, tells the compiler to generate a custom element constructor instead of a regular Svelte component.
| `tag` | `null` | A `string` that tells Svelte what tag name to register the custom element with. It must be a lowercase alphanumeric string with at least one hyphen, e.g. `"my-element"`.
| `css` | `true` | If `true`, styles will be included in the JavaScript class and injected at runtime. It's recommended that you set this to `false` and use the CSS that is statically generated, as it will result in smaller JavaScript bundles and better performance.
| `preserveComments` | `false` | If `true`, your HTML comments will be preserved during server-side rendering. By default, they are stripped out.
| `preserveWhitespace` | `false` | If `true`, whitespace inside and between elements is kept as you typed it, rather than optimised by Svelte.
| `outputFilename` | `null` | A `string` used for your JavaScript sourcemap.
| `cssOutputFilename` | `null` | A `string` used for your CSS sourcemap.
| `sveltePath` | `"svelte"` | The location of the `svelte` package. Any imports from `svelte` or `svelte/[module]` will be modified accordingly.
---
The returned `result` object contains the code for your component, along with useful bits of metadata.
```js
const {
js,
css,
ast,
warnings,
vars,
stats
} = svelte.compile(source);
```
* `js` and `css` are obejcts with the following properties:
* `code` is a JavaScript string
* `map` is a sourcemap with additional `toString()` and `toUrl()` convenience methods
* `ast` is an abstract syntax tree representing the structure of your component.
* `warnings` is an array of warning objects that were generated during compilation. Each warning has several properties:
* `code` is a string identifying the category of warning
* `message` describes the issue in human-readable terms
* `start` and `end`, if the warning relates to a specific location, are objects with `line`, `column` and `character` properties
* `frame`, if applicable, is a string highlighting the offending code with line numbers
* `vars` is an array of the component's declarations, used by [eslint-plugin-svelte3](https://github.com/sveltejs/eslint-plugin-svelte3) for example. Each variable has several properties:
* `name` is self-explanatory
* `export_name` is the name the value is exported as, if it is exported (will match `name` unless you do `export...as`)
* `injected` is `true` if the declaration is injected by Svelte, rather than in the code you wrote
* `module` is `true` if the value is declared in a `context="module"` script
* `mutated` is `true` if the value's properties are assigned to inside the component
* `reassigned` is `true` if the value is reassigned inside the component
* `referenced` is `true` if the value is used outside the declaration
* `writable` is `true` if the value was declared with `let` or `var` (but not `const`, `class` or `function`)
* `stats` is an object used by the Svelte developer team for diagnosing the compiler. Avoid relying on it to stay the same!
<!--
```js
compiled: {
// `map` is a v3 sourcemap with toString()/toUrl() methods
js: { code: string, map: {...} },
css: { code: string, map: {...} },
ast: {...}, // ESTree-like syntax tree for the component, including HTML, CSS and JS
warnings: Array<{
code: string,
message: string,
filename: string,
pos: number,
start: { line: number, column: number },
end: { line: number, column: number },
frame: string,
toString: () => string
}>,
vars: Array<{
name: string,
export_name: string,
injected: boolean,
module: boolean,
mutated: boolean,
reassigned: boolean,
referenced: boolean,
writable: boolean
}>,
stats: {
timings: { [label]: number }
}
} = svelte.compile(source: string, options?: {...})
```
-->
### svelte.preprocess
```js
result: {
code: string,
dependencies: Array<string>
} = svelte.preprocess(
source: string,
preprocessors: Array<{
markup?: (input: { source: string, filename: string }) => Promise<{
code: string,
dependencies?: Array<string>
}>,
script?: (input: { source: string, attributes: Record<string, string>, filename: string }) => Promise<{
code: string,
dependencies?: Array<string>
}>,
style?: (input: { source: string, attributes: Record<string, string>, filename: string }) => Promise<{
code: string,
dependencies?: Array<string>
}>
}>,
options?: {
filename?: string
}
)
```
---
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 `markup` function receives the entire component source text, along with the component's `filename` if it was specified in the third argument.
> Preprocessor functions may additionally return a `map` object alongside `code` and `dependencies`, where `map` is a sourcemap representing the transformation. In current versions of Svelte it will be ignored, but future versions of Svelte may take account of preprocessor sourcemaps.
```js
const svelte = require('svelte/compiler');
const { code } = svelte.preprocess(source, {
markup: ({ content, filename }) => {
return {
code: content.replace(/foo/g, 'bar')
};
}
}, {
filename: 'App.svelte'
});
```
---
The `script` and `style` functions receive the contents of `<script>` and `<style>` elements respectively. In addition to `filename`, they get an object of the element's attributes.
If a `dependencies` array is returned, it will be included in the result object. This is used by packages like [rollup-plugin-svelte](https://github.com/rollup/rollup-plugin-svelte) to watch additional files for changes, in the case where your `<style>` tag has an `@import` (for example).
```js
const svelte = require('svelte/compiler');
const sass = require('node-sass');
const { code, dependencies } = svelte.preprocess(source, {
style: ({ 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);
}));
return {
code: css.toString(),
dependencies: stats.includedFiles
};
}
}, {
filename: 'App.svelte'
});
```
---
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`.
```js
const svelte = require('svelte/compiler');
const { code } = svelte.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');
}
}
], {
filename: 'App.svelte'
});
```
### svelte.VERSION
---
The current version, as set in package.json.
```js
const svelte = require('svelte/compiler');
console.log(`running svelte version ${svelte.VERSION}`);
```

@ -1,7 +0,0 @@
---
title: Important note
---
### Read the RFCs
Much of the documentation below is out of date! For more accurate and current information on how Svelte 3 works in the meantime, check out the RFCS on [reactive assignments](https://github.com/sveltejs/rfcs/blob/master/text/0001-reactive-assignments.md), [reactive stores](https://github.com/sveltejs/rfcs/blob/master/text/0002-reactive-stores.md) and [reactive declarations](https://github.com/sveltejs/rfcs/blob/master/text/0003-reactive-declarations.md).

@ -1,112 +0,0 @@
---
title: Introduction
---
### What is Svelte?
Svelte is a tool for building fast web applications.
It is similar to JavaScript frameworks such as React and Vue, which share a goal of making it easy to build slick interactive user interfaces.
But there's a crucial difference: Svelte converts your app into ideal JavaScript at *build time*, rather than interpreting your application code at *run time*. This means you don't pay the performance cost of the framework's abstractions, and you don't incur a penalty when your app first loads.
You can build your entire app with Svelte, or you can add it incrementally to an existing codebase. You can also ship components as standalone packages that work anywhere, without the overhead of a dependency on a conventional framework.
[Read the introductory blog post](/blog/frameworks-without-the-framework) to learn more about Svelte's goals and philosophy.
### Understanding components
In Svelte, an application is composed from one or more *components*. A component is a reusable self-contained block of code that encapsulates markup, styles and behaviours that belong together, written into an `.html` file. Here's a simple example:
```html
<!--{ title: 'Hello world!' }-->
<h1>Hello {name}!</h1>
```
```json
/* { hidden: true } */
{
name: 'world'
}
```
> Wherever you see <strong style="font-weight: 700; font-size: 16px; font-family: Inconsolata, monospace; color: rgba(170,30,30, 0.8)">REPL</strong> links, click through for an interactive example
Svelte turns this into a JavaScript module that you can import into your app:
```js
/* { filename: 'main.js' } */
import App from './App.html';
const app = new App({
target: document.querySelector('main'),
props: { name: 'world' },
});
// change the component's "name" prop. We'll learn about props (aka properties) below
app.name = 'everybody';
// detach the component and clean everything up
app.$destroy();
```
Congratulations, you've just learned about half of Svelte's API!
### Getting started
Normally, this is the part where the instructions might tell you to add the framework to your page as a `<script>` tag. But because Svelte runs at build time, it works a little bit differently.
The best way to use Svelte is to integrate it into your build system  there are plugins for Rollup, Webpack and others, with more on the way. See [here](https://github.com/sveltejs/svelte/#svelte) for an up-to-date list.
> You will need to have [Node.js](https://nodejs.org/en/) installed, and have some familiarity with the command line
#### Getting started using the REPL
Going to the [REPL](/repl) and pressing the *download* button on any of the examples will give you a .zip file containing everything you need to run that example locally. Just unzip it, `cd` to the directory, and run `npm install` and `npm run dev`. See [this blog post](/blog/the-easiest-way-to-get-started) for more information.
#### Getting started using degit
[degit](https://github.com/Rich-Harris/degit) is a tool for creating projects from templates stored in git repos. Install it globally...
```bash
npm install -g degit
```
...then you can use it to spin up a new project:
```bash
degit sveltejs/template my-new-project
cd my-new-project
npm install
npm run dev
```
You can use any git repo you like — these are the 'official' templates:
* [sveltejs/template](https://github.com/sveltejs/template) — this is what you get by downloading from the REPL
* [sveltejs/template-webpack](https://github.com/sveltejs/template-webpack) — similar, but uses [webpack](https://webpack.js.org/) instead of [Rollup](https://rollupjs.org/guide/en)
#### Getting started using the CLI
Svelte also provides a Command Line Interface, but it's not recommended for production use. The CLI will compile your components to standalone JavaScript files, but won't automatically recompile them when they change, and won't deduplicate code shared between your components. Use one of the above methods instead.
If you've installed `svelte` globally, you can use `svelte --help` for a complete list of options. Some examples of the more common operations are:
```bash
# Generate a JavaScript module from MyComponent.html
svelte compile MyComponent.html > MyComponent.js
svelte compile -i MyComponent.html -o MyComponent.js
# Generate a UMD module from MyComponent.html, inferring its name from the filename ('MyComponent')
svelte compile -f umd MyComponent.html > MyComponent.js
# Generate a UMD module, specifying the name
svelte compile -f umd -n CustomName MyComponent.html > MyComponent.js
# Compile all .html files in a directory
svelte compile -i src/components -o build/components
```
> You can also use [npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) to use the CLI without installing Svelte globally — just prefix your command with `npx`: `npx svelte compile ...`

@ -1,7 +0,0 @@
<svelte:head>
<title>About</title>
</svelte:head>
<h1>About this site</h1>
<p>This is the 'about' page. There's not much here.</p>

@ -1,6 +1,6 @@
<script context="module">
export async function preload({ params }) {
const post = await this.fetch(`api/blog/${params.slug}`).then(r => r.json());
const post = await this.fetch(`blog/${params.slug}.json`).then(r => r.json());
return { post };
}
</script>

@ -1,6 +1,6 @@
import fs from 'fs';
import path from 'path';
import { extract_frontmatter, langs } from '../../../utils/markdown.js';
import { extract_frontmatter, langs } from '../../utils/markdown.js';
import marked from 'marked';
import PrismJS from 'prismjs';
import 'prismjs/components/prism-bash';

@ -1,6 +1,6 @@
<script context="module">
export async function preload() {
const posts = await this.fetch(`api/blog`).then(r => r.json());
const posts = await this.fetch(`blog.json`).then(r => r.json());
return { posts };
}
</script>

@ -1,4 +1,4 @@
import get_posts from '../api/blog/_posts.js';
import get_posts from '../blog/_posts.js';
const months = ',Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'.split(',');

@ -72,35 +72,55 @@
</script>
<style>
.guide-toc li {
.reference-toc li {
display: block;
line-height: 1.2;
margin: 0 0 4.8rem 0;
}
a {
position: relative;
opacity: 0.7;
transition: opacity 0.2s;
}
.section {
display: block;
padding: 0 0 .8rem 0;
font: 400 var(--h6) var(--font);
text-transform: uppercase;
letter-spacing: 0.12em;
font-weight: 700;
}
.subsection {
display: block;
font-size: 1.6rem;
font-family: var(--font);
padding: 0.3em 0;
padding: 0 0 0.6em 0;
}
.section:hover,
.subsection:hover { color: var(--flash) }
.active { color: var(--prime) }
.subsection:hover {
color: var(--flash);
opacity: 1
}
.active {
opacity: 1;
/* font-weight: 700; */
}
.icon-container {
position: absolute;
top: -.3rem;
right: 3.2rem;
}
</style>
<ul
bind:this={ul}
class="guide-toc"
class="reference-toc"
on:mouseenter="{() => prevent_sidebar_scroll = true}"
on:mouseleave="{() => prevent_sidebar_scroll = false}"
>
@ -110,7 +130,9 @@
{section.metadata.title}
{#if section.slug === active_section}
<Icon name="arrow-right" />
<div class="icon-container">
<Icon name="arrow-right" />
</div>
{/if}
</a>
@ -120,7 +142,9 @@
{subsection.title}
{#if subsection.slug === active_section}
<Icon name="arrow-right" />
<div class="icon-container">
<Icon name="arrow-right" />
</div>
{/if}
</a>
{/each}

@ -35,33 +35,27 @@ const blockTypes = [
'tablecell'
];
// https://github.com/darkskyapp/string-hash/blob/master/index.js
function getHash(str) {
let hash = 5381;
let i = str.length;
while (i--) hash = ((hash << 5) - hash) ^ str.charCodeAt(i);
return (hash >>> 0).toString(36);
}
export const demos = new Map();
export default function() {
return fs
.readdirSync(`content/guide`)
.readdirSync(`content/docs`)
.filter(file => file[0] !== '.' && path.extname(file) === '.md')
.map(file => {
const markdown = fs.readFileSync(`content/guide/${file}`, 'utf-8');
const markdown = fs.readFileSync(`content/docs/${file}`, 'utf-8');
const { content, metadata } = extract_frontmatter(markdown);
const subsections = [];
const groups = [];
let group = null;
let uid = 1;
const renderer = new marked.Renderer();
let block_open = false;
renderer.hr = (...args) => {
block_open = true;
return '<div class="side-by-side"><div class="copy">';
};
renderer.code = (source, lang) => {
source = source.replace(/^ +/gm, match =>
match.split(' ').join('\t')
@ -74,15 +68,6 @@ export default function() {
let prefix = '';
let className = 'code-block';
if (lang === 'html' && !group) {
if (!meta || meta.repl !== false) {
prefix = `<a class='open-in-repl' href='repl?demo=@@${uid}' title='open in REPL'><svg class='icon'><use xlink:href='#maximize-2' /></svg></a>`;
}
group = { id: uid++, blocks: [] };
groups.push(group);
}
if (meta) {
source = lines.slice(1).join('\n');
const filename = meta.filename || (lang === 'html' && 'App.svelte');
@ -92,8 +77,6 @@ export default function() {
}
}
if (group) group.blocks.push({ meta: meta || {}, lang, source });
if (meta && meta.hidden) return '';
const plang = langs[lang];
@ -103,13 +86,20 @@ export default function() {
lang
);
return `<div class='${className}'>${prefix}<pre class='language-${plang}'><code>${highlighted}</code></pre></div>`;
let html = `<div class='${className}'>${prefix}<pre class='language-${plang}'><code>${highlighted}</code></pre></div>`;
if (block_open) {
block_open = false;
return `</div><div class="code">${html}</div></div>`;
}
return html;
};
const seen = new Set();
renderer.heading = (text, level, rawtext) => {
if (level <= 3) {
if (level <= 4) {
const slug = rawtext
.toLowerCase()
.replace(/[^a-zA-Z0-9]+/g, '-')
@ -147,7 +137,6 @@ export default function() {
blockTypes.forEach(type => {
const fn = renderer[type];
renderer[type] = function() {
group = null;
return fn.apply(this, arguments);
};
});
@ -156,37 +145,6 @@ export default function() {
const hashes = {};
groups.forEach(group => {
const main = group.blocks[0];
if (main.meta.repl === false) return;
const hash = getHash(group.blocks.map(block => block.source).join(''));
hashes[group.id] = hash;
const json5 = group.blocks.find(block => block.lang === 'json');
const title = main.meta.title;
if (!title) console.error(`Missing title for demo in ${file}`);
demos.set(
hash,
JSON.stringify({
title: title || 'Example from guide',
components: group.blocks
.filter(block => block.lang === 'html' || block.lang === 'js')
.map(block => {
const [name, type] = (block.meta.filename || '').split('.');
return {
name: name || 'App',
type: type || 'html',
source: block.source,
};
}),
json5: json5 && json5.source,
})
);
});
return {
html: html.replace(/@@(\d+)/g, (m, id) => hashes[id] || m),
metadata,

@ -1,22 +0,0 @@
import { demos } from '../_sections.js';
export function get(req, res) {
const { hash } = req.params;
if (!demos.has(hash)) {
res.writeHead(404, {
'Content-Type': 'application/json'
});
res.end(JSON.stringify({
error: 'not found'
}));
} else {
const json = demos.get(hash);
res.writeHead(200, {
'Content-Type': 'application/json'
});
res.end(json);
}
}

@ -82,7 +82,6 @@
overflow: hidden;
border: 1px solid #eee;
box-shadow: 1px 1px 6px rgba(0,0,0,0.1);
border-radius: var(--border-r);
padding: 1.6rem;
transition: width 0.2s, height 0.2s;
}
@ -107,7 +106,7 @@
bottom: calc(100vh - var(--nav-h) - 10.8rem);
width: 100%;
height: 2em;
background: linear-gradient(to top, rgba(255,255,255,0) 0%, rgba(255,255,255,0.7) 50%, rgba(255,255,255,1) 100%);
background: linear-gradient(to top, rgba(103,103,120,0) 0%, rgba(103,103,120,0.7) 50%, rgba(103,103,120,1) 100%);
pointer-events: none;
z-index: 2;
}
@ -119,7 +118,7 @@
bottom: 1.9em;
width: 100%;
height: 2em;
background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0.7) 50%, rgba(255,255,255,1) 100%);
background: linear-gradient(to bottom, rgba(103,103,120,0) 0%, rgba(103,103,120,0.7) 50%, rgba(103,103,120,1) 100%);
pointer-events: none;
}
@ -135,10 +134,10 @@
.content {
width: 100%;
max-width: calc(var(--main-width) + var(--side-nav));
margin: 0 auto;
/* max-width: calc(var(--main-width) + var(--side-nav)); */
margin: 0;
-moz-tab-size: 2;
padding: var(--top-offset) 0;
padding: var(--top-offset) var(--side-nav);
tab-size: 2;
}
@ -146,14 +145,15 @@
aside {
display: block;
width: var(--sidebar-w);
height: calc(100vh - var(--nav-h));
top: var(--nav-h);
left: var(--side-nav);
height: 100vh;
top: 0;
left: 0;
overflow: hidden;
box-shadow: none;
border: none;
overflow: hidden;
padding: 0;
background-color: var(--second);
color: white;
}
aside.open::before {
@ -171,30 +171,33 @@
}
.sidebar {
padding: var(--top-offset) 3.2rem var(--top-offset) 0;
padding: var(--top-offset) 0;
font-family: var(--font);
overflow-y: auto;
height: 100%;
bottom: auto;
width: calc(var(--sidebar-w) + 5rem);
width: 100%;
}
.content {
max-width: none;
padding-left: 28rem;
/* max-width: none; */
padding-left: calc(var(--sidebar-w) + var(--side-nav));
}
.content :global(.side-by-side) {
display: grid;
grid-template-columns: calc(50% - 0.5em) calc(50% - 0.5em);
grid-gap: 1em;
}
}
@media (min-width: 1200px) { /* can't use vars in @media :( */
aside {
display: block;
left: calc(50vw - (60rem - var(--side-nav)));
}
.content {
width: 80rem;
padding-left: calc(50vw - 32rem);
box-sizing: content-box;
/* box-sizing: content-box; */
/* padding-right: calc(50% - 50rem); */
}
}
@ -205,12 +208,17 @@
border-top: 2px solid var(--second);
color: var(--second);
line-height: 1;
text-transform: uppercase;
}
.content section:first-of-type > h2 {
margin-top: 0;
}
.content :global(h4) {
margin: 2em 0 1em 0;
}
.content :global(.offset-anchor) {
position: relative;
display: block;
@ -234,9 +242,14 @@
@media (min-width: 768px) {
.content :global(h2):hover :global(.anchor),
.content :global(h3):hover :global(.anchor) {
.content :global(h3):hover :global(.anchor),
.content :global(h4):hover :global(.anchor) {
opacity: 1;
}
.content :global(h4):hover :global(.anchor) {
top: 0.4em;
}
}
.content :global(h3),
@ -263,6 +276,10 @@
background: transparent;
}
.content :global(pre) {
margin: 0 0 2em 0;
}
.content :global(.icon) {
width: 20px;
height: 20px;
@ -273,6 +290,18 @@
fill: none;
}
.content :global(table) {
margin: 0 0 2em 0;
}
section > :global(.code-block)> :global(pre) {
background: transparent;
color: white;
padding: 0;
border: none;
box-shadow: none;
}
/* max line-length ~60 chars */
section > :global(p) {
max-width: var(--linemax)
@ -290,11 +319,10 @@
small a { all: unset }
small a:before { all: unset }
section :global(blockquote) {
color: hsl(204, 100%, 50%);
border: 2px solid var(--flash);
padding-left: 8.8rem;
/* padding-left: 8.8rem; */
}
section :global(blockquote) :global(code) {
@ -315,24 +343,24 @@
</style>
<svelte:head>
<title>Learn Svelte</title>
<title>API Docs • Svelte</title>
</svelte:head>
<div bind:this={container} class='content linkify listify'>
{#each sections as section}
<section data-id={section.slug}>
<h2>
<span class="offset-anchor" id={section.slug}></span>
<a href="#{section.slug}" class="anchor" aria-hidden></a>
{section.metadata.title}
<small>
<a href='https://github.com/sveltejs/svelte/edit/master/site/content/guide/{section.file}' title='edit this section'>
<Icon name='edit' /></a>
</small>
</h2>
{@html section.html}
</section>
<section data-id={section.slug}>
<h2>
<span class="offset-anchor" id={section.slug}></span>
<a href="#{section.slug}" class="anchor" aria-hidden></a>
{section.metadata.title}
<small>
<a href='https://github.com/sveltejs/svelte/edit/master/site/content/docs/{section.file}' title='edit this section'>
<Icon name='edit' /></a>
</small>
</h2>
{@html section.html}
</section>
{/each}
</div>

@ -166,7 +166,7 @@ a:focus {
:root {
--nav-h: 6rem;
--top-offset: 6rem;
--sidebar-w: 24rem;
--sidebar-w: 30rem;
--main-width: 80rem;
--code-w: 72em;
--side-nav: 1.6rem;

@ -39,7 +39,7 @@ pre[class*='language-'] {
overflow: auto;
padding: 1.5rem 2rem;
margin: .8rem 0 2.4rem;
max-width: var(--code-w);
/* max-width: var(--code-w); */
border-radius: var(--border-r);
box-shadow: 1px 1px 0.1rem rgba(68, 68, 68, 0.05) inset;
}

@ -33,7 +33,7 @@ input, button, select, textarea {
font-family: inherit;
font-size: inherit;
padding: 0.4em;
margin: 0 0 0.5em 0;
margin: 0 0.5em 0.5em 0;
box-sizing: border-box;
border: 1px solid #ccc;
border-radius: 2px;

@ -91,7 +91,7 @@ export default function compile(source: string, options: CompileOptions = {}) {
const component = new Component(
ast,
source,
options.name || get_name(options.filename) || 'SvelteComponent',
options.name || get_name(options.filename) || 'Component',
options,
stats,
warnings

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
detach,
element,
init,
@ -59,11 +59,11 @@ function instance($$self, $$props, $$invalidate) {
return { bar, foo_function };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["bar"]);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
detach,
element,
init,
@ -53,11 +53,11 @@ function link(node) {
}
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, null, create_fragment, safe_not_equal, []);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
add_render_callback,
init,
listen,
@ -43,11 +43,11 @@ function instance($$self, $$props, $$invalidate) {
return { online, onlinestatuschanged };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, []);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
add_render_callback,
add_resize_listener,
detach,
@ -58,11 +58,11 @@ function instance($$self, $$props, $$invalidate) {
return { w, h, div_resize_handler };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["w", "h"]);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
append,
detach,
element,
@ -61,7 +61,7 @@ function instance($$self, $$props, $$invalidate) {
return { foo };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
if (!document.getElementById("svelte-1a7i8ec-style")) add_css();
@ -69,4 +69,4 @@ class SvelteComponent extends SvelteComponent_1 {
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
init,
mount_component,
noop,
@ -48,11 +48,11 @@ function instance($$self) {
return { Nested };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, []);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
init,
mount_component,
noop,
@ -48,11 +48,11 @@ function instance($$self) {
return { Nested };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, not_equal, []);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
init,
mount_component,
noop,
@ -48,11 +48,11 @@ function instance($$self) {
return { Nested };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, not_equal, []);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
init,
mount_component,
noop,
@ -48,11 +48,11 @@ function instance($$self) {
return { Nested };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, []);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
init,
noop,
safe_not_equal
@ -35,7 +35,7 @@ function instance($$self, $$props, $$invalidate) {
return { x, a, b };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["x", "a", "b"]);
@ -50,4 +50,4 @@ class SvelteComponent extends SvelteComponent_1 {
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
append,
detach,
element,
@ -42,7 +42,7 @@ function create_fragment(ctx) {
};
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
if (!document.getElementById("svelte-1slhpfn-style")) add_css();
@ -50,4 +50,4 @@ class SvelteComponent extends SvelteComponent_1 {
}
}
export default SvelteComponent;
export default Component;

@ -35,7 +35,7 @@ function create_fragment(ctx) {
};
}
class SvelteComponent extends SvelteElement {
class Component extends SvelteElement {
constructor(options) {
super();
@ -55,6 +55,6 @@ class SvelteComponent extends SvelteElement {
}
}
customElements.define("custom-element", SvelteComponent);
customElements.define("custom-element", Component);
export default SvelteComponent;
export default Component;

@ -72,7 +72,7 @@ function instance($$self, $$props, $$invalidate) {
return { name };
}
class SvelteComponent extends SvelteComponentDev {
class Component extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance, create_fragment, safe_not_equal, ["name"]);
@ -80,17 +80,17 @@ class SvelteComponent extends SvelteComponentDev {
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.name === undefined && !('name' in props)) {
console.warn("<SvelteComponent> was created without expected prop 'name'");
console.warn("<Component> was created without expected prop 'name'");
}
}
get name() {
throw new Error("<SvelteComponent>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
throw new Error("<Component>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set name(value) {
throw new Error("<SvelteComponent>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
throw new Error("<Component>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
export default SvelteComponent;
export default Component;

@ -161,7 +161,7 @@ function instance($$self, $$props, $$invalidate) {
return { things, foo, bar, baz };
}
class SvelteComponent extends SvelteComponentDev {
class Component extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance, create_fragment, safe_not_equal, ["things", "foo", "bar", "baz"]);
@ -169,50 +169,50 @@ class SvelteComponent extends SvelteComponentDev {
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.things === undefined && !('things' in props)) {
console.warn("<SvelteComponent> was created without expected prop 'things'");
console.warn("<Component> was created without expected prop 'things'");
}
if (ctx.foo === undefined && !('foo' in props)) {
console.warn("<SvelteComponent> was created without expected prop 'foo'");
console.warn("<Component> was created without expected prop 'foo'");
}
if (ctx.bar === undefined && !('bar' in props)) {
console.warn("<SvelteComponent> was created without expected prop 'bar'");
console.warn("<Component> was created without expected prop 'bar'");
}
if (ctx.baz === undefined && !('baz' in props)) {
console.warn("<SvelteComponent> was created without expected prop 'baz'");
console.warn("<Component> was created without expected prop 'baz'");
}
}
get things() {
throw new Error("<SvelteComponent>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
throw new Error("<Component>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set things(value) {
throw new Error("<SvelteComponent>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
throw new Error("<Component>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get foo() {
throw new Error("<SvelteComponent>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
throw new Error("<Component>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set foo(value) {
throw new Error("<SvelteComponent>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
throw new Error("<Component>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get bar() {
throw new Error("<SvelteComponent>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
throw new Error("<Component>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set bar(value) {
throw new Error("<SvelteComponent>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
throw new Error("<Component>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get baz() {
throw new Error("<SvelteComponent>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
throw new Error("<Component>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set baz(value) {
throw new Error("<SvelteComponent>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
throw new Error("<Component>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
export default SvelteComponent;
export default Component;

@ -159,7 +159,7 @@ function instance($$self, $$props, $$invalidate) {
return { things, foo };
}
class SvelteComponent extends SvelteComponentDev {
class Component extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance, create_fragment, safe_not_equal, ["things", "foo"]);
@ -167,28 +167,28 @@ class SvelteComponent extends SvelteComponentDev {
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.things === undefined && !('things' in props)) {
console.warn("<SvelteComponent> was created without expected prop 'things'");
console.warn("<Component> was created without expected prop 'things'");
}
if (ctx.foo === undefined && !('foo' in props)) {
console.warn("<SvelteComponent> was created without expected prop 'foo'");
console.warn("<Component> was created without expected prop 'foo'");
}
}
get things() {
throw new Error("<SvelteComponent>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
throw new Error("<Component>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set things(value) {
throw new Error("<SvelteComponent>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
throw new Error("<Component>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
get foo() {
throw new Error("<SvelteComponent>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
throw new Error("<Component>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set foo(value) {
throw new Error("<SvelteComponent>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
throw new Error("<Component>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
export default SvelteComponent;
export default Component;

@ -6,7 +6,7 @@ import {
escape
} from "svelte/internal";
const SvelteComponent = create_ssr_component(($$result, $$props, $$bindings, $$slots) => {
const Component = create_ssr_component(($$result, $$props, $$bindings, $$slots) => {
let { things, foo } = $$props;
if ($$props.things === void 0 && $$bindings.things && things !== void 0) $$bindings.things(things);
@ -18,4 +18,4 @@ const SvelteComponent = create_ssr_component(($$result, $$props, $$bindings, $$s
<p>foo: ${escape(foo)}</p>`;
});
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
append,
destroy_each,
detach,
@ -123,11 +123,11 @@ function instance($$self, $$props, $$invalidate) {
return { createElement };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["createElement"]);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
init,
noop,
safe_not_equal
@ -32,11 +32,11 @@ function instance($$self, $$props, $$invalidate) {
return { foo };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["foo"]);
}
}
export default SvelteComponent;
export default Component;

@ -78,7 +78,7 @@ function instance($$self, $$props, $$invalidate) {
return { foo, bar };
}
class SvelteComponent extends SvelteComponentDev {
class Component extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance, create_fragment, safe_not_equal, ["foo"]);
@ -86,17 +86,17 @@ class SvelteComponent extends SvelteComponentDev {
const { ctx } = this.$$;
const props = options.props || {};
if (ctx.foo === undefined && !('foo' in props)) {
console.warn("<SvelteComponent> was created without expected prop 'foo'");
console.warn("<Component> was created without expected prop 'foo'");
}
}
get foo() {
throw new Error("<SvelteComponent>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
throw new Error("<Component>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
set foo(value) {
throw new Error("<SvelteComponent>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
throw new Error("<Component>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
detach,
element,
init,
@ -57,11 +57,11 @@ function instance($$self, $$props, $$invalidate) {
return { bar };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["bar"]);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
detach,
element,
init,
@ -41,11 +41,11 @@ function make_uppercase() {
this.value = this.value.toUpperCase();
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, null, create_fragment, safe_not_equal, []);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
attr,
detach,
element,
@ -58,11 +58,11 @@ function instance($$self, $$props, $$invalidate) {
return { bar };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["bar"]);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
append,
attr,
detach,
@ -56,11 +56,11 @@ function instance($$self, $$props, $$invalidate) {
return { bar };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["bar"]);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
init,
mount_component,
noop,
@ -47,11 +47,11 @@ function func() {
return import('./Foo.svelte');
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, null, create_fragment, safe_not_equal, []);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
append,
destroy_each,
detach,
@ -126,11 +126,11 @@ function instance($$self, $$props, $$invalidate) {
return { a, b, c, d, e };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["a", "b", "c", "d", "e"]);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
append,
destroy_each,
detach,
@ -167,11 +167,11 @@ function instance($$self, $$props, $$invalidate) {
return { comments, elapsed, time, foo };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["comments", "elapsed", "time", "foo"]);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
append,
blank_object,
create_animation,
@ -142,11 +142,11 @@ function instance($$self, $$props, $$invalidate) {
return { things };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["things"]);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
append,
blank_object,
destroy_block,
@ -110,11 +110,11 @@ function instance($$self, $$props, $$invalidate) {
return { things };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["things"]);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
detach,
element,
init,
@ -43,11 +43,11 @@ function touchstart_handler(e) {
return e.preventDefault();
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, null, create_fragment, safe_not_equal, []);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
append,
detach,
element,
@ -68,11 +68,11 @@ function handleClick() {
// ...
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, null, create_fragment, safe_not_equal, []);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
append,
detach,
element,
@ -38,11 +38,11 @@ function create_fragment(ctx) {
};
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, null, create_fragment, safe_not_equal, []);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
append,
detach,
element,
@ -41,11 +41,11 @@ const ANSWER = 42;
function get_answer() { return ANSWER; }
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, null, create_fragment, safe_not_equal, []);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
append,
detach,
element,
@ -41,11 +41,11 @@ let ANSWER = 42;
function get_answer() { return ANSWER; }
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, null, create_fragment, safe_not_equal, []);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
detach,
element,
empty,
@ -110,11 +110,11 @@ function instance($$self, $$props, $$invalidate) {
return { foo };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["foo"]);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
detach,
element,
empty,
@ -84,11 +84,11 @@ function instance($$self, $$props, $$invalidate) {
return { foo };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["foo"]);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
detach,
element,
init,
@ -57,11 +57,11 @@ function instance($$self, $$props, $$invalidate) {
return { color, x, y };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["color", "x", "y"]);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
detach,
element,
init,
@ -50,11 +50,11 @@ function instance($$self, $$props, $$invalidate) {
return { data };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["data"]);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
detach,
element,
init,
@ -50,11 +50,11 @@ function instance($$self, $$props, $$invalidate) {
return { color };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["color"]);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
detach,
element,
init,
@ -63,11 +63,11 @@ function instance($$self, $$props, $$invalidate) {
return { style, key, value };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["style", "key", "value"]);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
attr,
detach,
element,
@ -55,11 +55,11 @@ function instance($$self, $$props, $$invalidate) {
return { files, input_input_handler };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["files"]);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
attr,
detach,
element,
@ -65,11 +65,11 @@ function instance($$self, $$props, $$invalidate) {
return { value, input_change_input_handler };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["value"]);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
attr,
detach,
element,
@ -59,11 +59,11 @@ function instance($$self, $$props, $$invalidate) {
return { foo, input_change_handler };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["foo"]);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
append,
detach,
element,
@ -67,11 +67,11 @@ function instance($$self, $$props, $$invalidate) {
return { x, foo };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, []);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
append,
detach,
element,
@ -68,11 +68,11 @@ function instance($$self, $$props, $$invalidate) {
return { things, foo };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, []);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
append,
detach,
element,
@ -67,11 +67,11 @@ function instance($$self, $$props, $$invalidate) {
return { x, click_handler };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, []);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
append,
detach,
element,
@ -65,11 +65,11 @@ function instance($$self, $$props, $$invalidate) {
return { things, click_handler };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, []);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
detach,
element,
init,
@ -35,11 +35,11 @@ function create_fragment(ctx) {
};
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, null, create_fragment, safe_not_equal, []);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
add_render_callback,
detach,
element,
@ -144,11 +144,11 @@ function instance($$self, $$props, $$invalidate) {
};
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["buffered", "seekable", "played", "currentTime", "duration", "paused", "volume", "playbackRate"]);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
detach,
init,
insert,
@ -61,11 +61,11 @@ function create_fragment(ctx) {
};
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, null, create_fragment, safe_not_equal, []);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
append,
detach,
element,
@ -43,11 +43,11 @@ function create_fragment(ctx) {
let name = 'world';
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, null, create_fragment, safe_not_equal, []);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
init,
noop,
safe_not_equal
@ -39,11 +39,11 @@ function instance($$self, $$props, $$invalidate) {
return { x };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["x"]);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
init,
noop,
safe_not_equal
@ -35,11 +35,11 @@ function instance($$self, $$props, $$invalidate) {
return {};
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, []);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
append,
detach,
element,
@ -76,11 +76,11 @@ function instance($$self, $$props, $$invalidate) {
return { current };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["current"]);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
init,
noop,
safe_not_equal
@ -23,7 +23,7 @@ function foo(bar) {
console.log(bar);
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, null, create_fragment, safe_not_equal, ["foo"]);
@ -34,5 +34,5 @@ class SvelteComponent extends SvelteComponent_1 {
}
}
export default SvelteComponent;
export default Component;
export { SOME_CONSTANT };

@ -14,7 +14,7 @@ function swipe(node, callback) {
// TODO implement
}
const SvelteComponent = create_ssr_component(($$result, $$props, $$bindings, $$slots) => {
const Component = create_ssr_component(($$result, $$props, $$bindings, $$slots) => {
onMount(() => {
console.log('onMount');
});
@ -26,5 +26,5 @@ const SvelteComponent = create_ssr_component(($$result, $$props, $$bindings, $$s
return ``;
});
export default SvelteComponent;
export default Component;
export { preload };

@ -1,10 +1,10 @@
/* generated by Svelte vX.Y.Z */
import { create_ssr_component } from "svelte/internal";
const SvelteComponent = create_ssr_component(($$result, $$props, $$bindings, $$slots) => {
const Component = create_ssr_component(($$result, $$props, $$bindings, $$slots) => {
return `<div>content</div>
<!-- comment -->
<div>more content</div>`;
});
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
append,
detach,
init,
@ -39,11 +39,11 @@ function create_fragment(ctx) {
};
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, null, create_fragment, safe_not_equal, []);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
init,
noop,
safe_not_equal
@ -37,11 +37,11 @@ function instance($$self, $$props, $$invalidate) {
return { custom };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["custom"]);
}
}
export default SvelteComponent;
export default Component;

@ -1,6 +1,6 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
SvelteComponent,
add_render_callback,
create_in_transition,
detach,
@ -147,11 +147,11 @@ function instance($$self, $$props, $$invalidate) {
return { x, y };
}
class SvelteComponent extends SvelteComponent_1 {
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["x", "y"]);
}
}
export default SvelteComponent;
export default Component;

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

Loading…
Cancel
Save