mirror of https://github.com/sveltejs/svelte
parent
863eff9516
commit
147bf4dc2d
@ -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](https://discord.gg/yy75DKs) 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,49 @@
|
|||||||
|
---
|
||||||
|
title: Outline
|
||||||
|
---
|
||||||
|
|
||||||
|
(This isn't the actual documentation, this is just me getting my thoughts straight so that we can create the documentation.)
|
||||||
|
|
||||||
|
I think it makes sense to split the docs into compile time (`svelte.preprocess` and `svelte.compile`), then run time (component API, `svelte`, `svelte/store`, `svelte/motion`, etc). I'm not sure where template syntax, style scoping (and `:global(...)`), `context="module"` etc goes.
|
||||||
|
|
||||||
|
### Compile time
|
||||||
|
|
||||||
|
* `const preprocessed = await svelte.preprocess(source, options);`
|
||||||
|
* `const result = svelte.compile(source, options);`
|
||||||
|
|
||||||
|
|
||||||
|
### Run time
|
||||||
|
|
||||||
|
#### Client-side component API
|
||||||
|
|
||||||
|
* `const component = new Component(options);`
|
||||||
|
* `component.$set(...);`
|
||||||
|
* `component.$on(event, callback);`
|
||||||
|
* `component.$destroy();`
|
||||||
|
* `component.x` if `accessors: true`
|
||||||
|
|
||||||
|
|
||||||
|
#### Server-side component API
|
||||||
|
|
||||||
|
* `const result = Component.render(...)`
|
||||||
|
|
||||||
|
|
||||||
|
#### svelte
|
||||||
|
|
||||||
|
* lifecycle methods, tick, context
|
||||||
|
* SSR behaviour
|
||||||
|
|
||||||
|
|
||||||
|
#### svelte/store
|
||||||
|
|
||||||
|
* writable, readable, derive, get
|
||||||
|
|
||||||
|
#### svelte/motion
|
||||||
|
|
||||||
|
* spring, tweened
|
||||||
|
|
||||||
|
#### svelte/transition
|
||||||
|
|
||||||
|
#### svelte/animation (TODO make this)
|
||||||
|
|
||||||
|
#### svelte/easing
|
@ -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,6 +1,6 @@
|
|||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
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 marked from 'marked';
|
||||||
import PrismJS from 'prismjs';
|
import PrismJS from 'prismjs';
|
||||||
import 'prismjs/components/prism-bash';
|
import 'prismjs/components/prism-bash';
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in new issue