pull/8452/head
Puru Vijay 3 years ago
parent 8e22b8382c
commit a842562467

@ -6,6 +6,8 @@ The `svelte/motion` module exports two functions, `tweened` and `spring`, for cr
## `tweened`
> EXPORT_SNIPPET: svelte/motion#tweened
```js
store = tweened(value: any, options)
```
@ -81,6 +83,8 @@ The `interpolate` option allows you to tween between _any_ arbitrary values. It
## `spring`
> EXPORT_SNIPPET: svelte/motion#spring
```js
store = spring(value: any, options)
```

@ -6,6 +6,8 @@ The `svelte/transition` module exports seven functions: `fade`, `blur`, `fly`, `
## `fade`
> EXPORT_SNIPPET: svelte/transition#fade
```svelte
transition:fade={params}
```
@ -40,6 +42,8 @@ You can see the `fade` transition in action in the [transition tutorial](/tutori
## `blur`
> EXPORT_SNIPPET: svelte/transition#blur
```svelte
transition:blur={params}
```
@ -74,6 +78,8 @@ Animates a `blur` filter alongside an element's opacity.
## `fly`
> EXPORT_SNIPPET: svelte/transition#fly
```svelte
transition:fly={params}
```
@ -117,6 +123,8 @@ You can see the `fly` transition in action in the [transition tutorial](/tutoria
## `slide`
> EXPORT_SNIPPET: svelte/transition#slide
```svelte
transition:slide={params}
```
@ -154,6 +162,8 @@ Slides an element in and out.
## `scale`
> EXPORT_SNIPPET: svelte/transition#scale
```svelte
transition:scale={params}
```
@ -191,6 +201,8 @@ Animates the opacity and scale of an element. `in` transitions animate from an e
## `draw`
> EXPORT_SNIPPET: svelte/transition#draw
```svelte
transition:draw={params}
```
@ -236,6 +248,8 @@ The `speed` parameter is a means of setting the duration of the transition relat
## `crossfade`
> EXPORT_SNIPPET: svelte/transition#crossfade
The `crossfade` function creates a pair of [transitions](/docs/element-directives#transition-fn) called `send` and `receive`. When an element is 'sent', it looks for a corresponding element being 'received', and generates a transition that transforms the element to its counterpart's position and fades it out. When an element is 'received', the reverse happens. If there is no counterpart, the `fallback` transition is used.
`crossfade` accepts the following parameters:

@ -6,6 +6,8 @@ The `svelte/animate` module exports one function for use with Svelte [animations
## `flip`
> EXPORT_SNIPPET: svelte/animate#flip
```svelte
animate:flip={params}
```

@ -8,6 +8,8 @@ Nonetheless, it's useful to understand how to use the compiler, since bundler pl
## `svelte.compile`
> EXPORT_SNIPPET: svelte/compiler#compile
```js
result: {
js,
@ -147,6 +149,8 @@ compiled: {
## `svelte.parse`
> EXPORT_SNIPPET: svelte/compiler#parse
```js
ast: object = svelte.parse(
source: string,
@ -167,6 +171,8 @@ const ast = svelte.parse(source, { filename: 'App.svelte' });
## `svelte.preprocess`
> 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.
You can write your own preprocessor using the `svelte.preprocess` API.
@ -305,6 +311,8 @@ const { code } = await svelte.preprocess(
## `svelte.walk`
> EXPORT_SNIPPET: svelte/compiler#walk
```js
walk(ast: Node, {
enter(node: Node, parent: Node, prop: string, index: number)?: void,
@ -334,13 +342,11 @@ svelte.walk(ast, {
## `svelte.VERSION`
> EXPORT_SNIPPET: svelte/compiler#VERSION
The current version, as set in package.json.
```js
import svelte from 'svelte/compiler';
console.log(`running svelte version ${svelte.VERSION}`);
```
## Types
> TYPES: svelte/compiler

@ -0,0 +1,11 @@
---
title: svelte/internal
---
## Exports
> EXPORTS: svelte/internal
## Types
> TYPES: svelte/internal

@ -108,6 +108,36 @@ export function replace_placeholders(content) {
.join('\n\n')}`;
})
.join('\n\n');
})
.replace(/> EXPORTS: (.+)/, (_, name) => {
const module = modules.find((module) => module.name === name);
if (!module) throw new Error(`Could not find module ${name} for EXPORTS: clause`);
if (module.exports.length === 0 && !module.exempt) return '';
let import_block = '';
if (module.exports.length > 0) {
// deduplication is necessary for now, because of `error()` overload
const exports = Array.from(new Set(module.exports.map((x) => x.name)));
let declaration = `import { ${exports.join(', ')} } from '${module.name}';`;
if (declaration.length > 80) {
declaration = `import {\n\t${exports.join(',\n\t')}\n} from '${module.name}';`;
}
import_block = fence(declaration, 'js');
}
return `${import_block}\n\n${module.comment}\n\n${module.exports
.map((type) => {
const markdown =
`<div class="ts-block">${fence(type.snippet)}` +
type.children.map(stringify).join('\n\n') +
`</div>`;
return `### ${type.name}\n\n${type.comment}\n\n${markdown}`;
})
.join('\n\n')}`;
});
}

Loading…
Cancel
Save