diff --git a/.eslintrc.json b/.eslintrc.json
index 340b9a0e12..c5da7150a7 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -1,46 +1,45 @@
{
- "root": true,
- "rules": {
- "indent": [ 2, "tab", { "SwitchCase": 1 } ],
- "semi": [ 2, "always" ],
- "keyword-spacing": [ 2, { "before": true, "after": true } ],
- "space-before-blocks": [ 2, "always" ],
- "no-mixed-spaces-and-tabs": [ 2, "smart-tabs" ],
- "no-cond-assign": 0,
- "no-unused-vars": 2,
- "object-shorthand": [ 2, "always" ],
- "no-const-assign": 2,
- "no-class-assign": 2,
- "no-this-before-super": 2,
- "no-var": 2,
- "no-unreachable": 2,
- "valid-typeof": 2,
- "quote-props": [ 2, "as-needed" ],
- "one-var": [ 2, "never" ],
- "prefer-arrow-callback": 2,
- "prefer-const": [ 2, { "destructuring": "all" } ],
- "arrow-spacing": 2,
- "no-inner-declarations": 0
- },
- "env": {
- "es6": true,
- "browser": true,
- "node": true,
- "mocha": true
- },
- "extends": [
- "eslint:recommended",
- "plugin:import/errors",
- "plugin:import/warnings"
- ],
- "plugins": [
- "html"
- ],
- "parserOptions": {
- "ecmaVersion": 6,
- "sourceType": "module"
- },
- "settings": {
- "import/core-modules": [ "svelte" ]
- }
+ "root": true,
+ "rules": {
+ "indent": [2, "tab", { "SwitchCase": 1 }],
+ "semi": [2, "always"],
+ "keyword-spacing": [2, { "before": true, "after": true }],
+ "space-before-blocks": [2, "always"],
+ "no-mixed-spaces-and-tabs": [2, "smart-tabs"],
+ "no-cond-assign": 0,
+ "no-unused-vars": 2,
+ "object-shorthand": [2, "always"],
+ "no-const-assign": 2,
+ "no-class-assign": 2,
+ "no-this-before-super": 2,
+ "no-var": 2,
+ "no-unreachable": 2,
+ "valid-typeof": 2,
+ "quote-props": [2, "as-needed"],
+ "one-var": [2, "never"],
+ "prefer-arrow-callback": 2,
+ "prefer-const": [2, { "destructuring": "all" }],
+ "arrow-spacing": 2,
+ "no-inner-declarations": 0
+ },
+ "env": {
+ "es6": true,
+ "browser": true,
+ "node": true,
+ "mocha": true
+ },
+ "extends": [
+ "eslint:recommended",
+ "plugin:import/errors",
+ "plugin:import/warnings"
+ ],
+ "plugins": ["svelte3"],
+ "parserOptions": {
+ "ecmaVersion": 6,
+ "sourceType": "module"
+ },
+ "settings": {
+ "import/core-modules": ["svelte"],
+ "svelte3/extensions": ["html"]
+ }
}
diff --git a/.gitignore b/.gitignore
index dbed468f15..1499a0e697 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,4 +17,8 @@ node_modules
/test/sourcemaps/samples/*/output.css.map
/yarn-error.log
_actual*.*
-_*/
+
+/site/cypress/screenshots/
+/site/__sapper__/
+/site/.env
+/site/.sessions
\ No newline at end of file
diff --git a/package.json b/package.json
index 9cac947be5..0f43ed0019 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "svelte",
- "version": "3.0.0-alpha6",
+ "version": "3.0.0-alpha8",
"description": "The magical disappearing UI framework",
"module": "index.mjs",
"main": "index.js",
diff --git a/site/.eslintrc.json b/site/.eslintrc.json
new file mode 100644
index 0000000000..cb0d06a2ec
--- /dev/null
+++ b/site/.eslintrc.json
@@ -0,0 +1,45 @@
+{
+ "root": true,
+ "rules": {
+ "indent": [2, "tab", { "SwitchCase": 1 }],
+ "semi": [2, "always"],
+ "keyword-spacing": [2, { "before": true, "after": true }],
+ "space-before-blocks": [2, "always"],
+ "no-mixed-spaces-and-tabs": [2, "smart-tabs"],
+ "no-cond-assign": 0,
+ "no-unused-vars": 2,
+ "object-shorthand": [2, "always"],
+ "no-const-assign": 2,
+ "no-class-assign": 2,
+ "no-this-before-super": 2,
+ "no-var": 2,
+ "no-unreachable": 2,
+ "valid-typeof": 2,
+ "quote-props": [2, "as-needed"],
+ "one-var": [2, "never"],
+ "prefer-arrow-callback": 2,
+ "prefer-const": [2, { "destructuring": "all" }],
+ "arrow-spacing": 2,
+ "no-inner-declarations": 0
+ },
+ "env": {
+ "es6": true,
+ "browser": true,
+ "node": true,
+ "mocha": true
+ },
+ "extends": [
+ "eslint:recommended",
+ "plugin:import/errors",
+ "plugin:import/warnings"
+ ],
+ "plugins": ["svelte3"],
+ "parserOptions": {
+ "ecmaVersion": 6,
+ "sourceType": "module"
+ },
+ "settings": {
+ "import/core-modules": ["svelte"],
+ "svelte3/extensions": [".html"]
+ }
+}
diff --git a/site/.travis.yml b/site/.travis.yml
new file mode 100644
index 0000000000..8ad1fc38c8
--- /dev/null
+++ b/site/.travis.yml
@@ -0,0 +1,11 @@
+sudo: false
+language: node_js
+node_js:
+ - "stable"
+env:
+ global:
+ - BUILD_TIMEOUT=10000
+install:
+ - npm install
+ - npm install cypress
+
diff --git a/site/README.md b/site/README.md
new file mode 100644
index 0000000000..eb3c7013ce
--- /dev/null
+++ b/site/README.md
@@ -0,0 +1,75 @@
+# sapper-template-rollup
+
+A version of the default [Sapper](https://github.com/sveltejs/sapper) template that uses Rollup instead of webpack. To clone it and get started:
+
+```bash
+npx degit sveltejs/sapper-template#rollup my-app
+cd my-app
+npm install # or yarn!
+npm run dev
+```
+
+Open up [localhost:3000](http://localhost:3000) and start clicking around.
+
+Consult [sapper.svelte.technology](https://sapper.svelte.technology) for help getting started.
+
+*[Click here for the webpack version of this template](https://github.com/sveltejs/sapper-template)*
+
+## Structure
+
+Sapper expects to find three directories in the root of your project — `app`, `assets` and `routes`.
+
+
+### app
+
+The [app](app) directory contains the entry points for your app — `client.js`, `server.js` and (optionally) a `service-worker.js` — along with a `template.html` file.
+
+
+### assets
+
+The [assets](assets) directory contains any static assets that should be available. These are served using [sirv](https://github.com/lukeed/sirv).
+
+In your [service-worker.js](app/service-worker.js) file, you can import these as `assets` from the generated manifest...
+
+```js
+import { assets } from './manifest/service-worker.js';
+```
+
+...so that you can cache them (though you can choose not to, for example if you don't want to cache very large files).
+
+
+### routes
+
+This is the heart of your Sapper app. There are two kinds of routes — *pages*, and *server routes*.
+
+**Pages** are Svelte components written in `.html` files. When a user first visits the application, they will be served a server-rendered version of the route in question, plus some JavaScript that 'hydrates' the page and initialises a client-side router. From that point forward, navigating to other pages is handled entirely on the client for a fast, app-like feel. (Sapper will preload and cache the code for these subsequent pages, so that navigation is instantaneous.)
+
+**Server routes** are modules written in `.js` files, that export functions corresponding to HTTP methods. Each function receives Express `request` and `response` objects as arguments, plus a `next` function. This is useful for creating a JSON API, for example.
+
+There are three simple rules for naming the files that define your routes:
+
+* A file called `routes/about.html` corresponds to the `/about` route. A file called `routes/blog/[slug].html` corresponds to the `/blog/:slug` route, in which case `params.slug` is available to the route
+* The file `routes/index.html` (or `routes/index.js`) corresponds to the root of your app. `routes/about/index.html` is treated the same as `routes/about.html`.
+* Files and directories with a leading underscore do *not* create routes. This allows you to colocate helper modules and components with the routes that depend on them — for example you could have a file called `routes/_helpers/datetime.js` and it would *not* create a `/_helpers/datetime` route
+
+
+## Rollup config
+
+Sapper uses Rollup to provide code-splitting and dynamic imports, as well as compiling your Svelte components. As long as you don't do anything daft, you can edit the configuration files to add whatever plugins you'd like.
+
+
+## Production mode and deployment
+
+To start a production version of your app, run `npm run build && npm start`.
+
+You can deploy your application to any environment that supports Node 8 or above. As an example, to deploy to [Now](https://zeit.co/now), run these commands:
+
+```bash
+npm install -g now
+now
+```
+
+
+## Bugs and feedback
+
+Sapper is in early development, and may have the odd rough edge here and there. Please be vocal over on the [Sapper issue tracker](https://github.com/sveltejs/sapper/issues).
diff --git a/site/appveyor.yml b/site/appveyor.yml
new file mode 100644
index 0000000000..e75da3bfae
--- /dev/null
+++ b/site/appveyor.yml
@@ -0,0 +1,18 @@
+version: "{build}"
+
+shallow_clone: true
+
+init:
+ - git config --global core.autocrlf false
+
+build: off
+
+environment:
+ matrix:
+ # node.js
+ - nodejs_version: stable
+
+install:
+ - ps: Install-Product node $env:nodejs_version
+ - npm install cypress
+ - npm install
diff --git a/site/content/blog/2016-11-26-frameworks-without-the-framework.md b/site/content/blog/2016-11-26-frameworks-without-the-framework.md
new file mode 100644
index 0000000000..9c663a01ba
--- /dev/null
+++ b/site/content/blog/2016-11-26-frameworks-without-the-framework.md
@@ -0,0 +1,56 @@
+---
+title: Frameworks without the framework: why didn't we think of this sooner?
+description: You can't write serious applications in vanilla JavaScript without hitting a complexity wall. But a compiler can do it for you.
+pubdate: 2016-11-26
+author: Rich Harris
+authorURL: https://twitter.com/Rich_Harris
+---
+
+> Wait, this new framework has a *runtime*? Ugh. Thanks, I'll pass.
+> **– front end developers in 2018**
+
+We're shipping too much code to our users. Like a lot of front end developers, I've been in denial about that fact, thinking that it was fine to serve 100kb of JavaScript on page load – just use [one less .jpg!](https://twitter.com/miketaylr/status/227056824275333120) – and that what *really* mattered was performance once your app was already interactive.
+
+But I was wrong. 100kb of .js isn't equivalent to 100kb of .jpg. It's not just the network time that'll kill your app's startup performance, but the time spent parsing and evaluating your script, during which time the browser becomes completely unresponsive. On mobile, those milliseconds rack up very quickly.
+
+If you're not convinced that this is a problem, follow [Alex Russell](https://twitter.com/slightlylate) on Twitter. Alex [hasn't been making many friends in the framework community lately](https://twitter.com/slightlylate/status/728355959022587905), but he's not wrong. But the proposed alternative to using frameworks like Angular, React and Ember – [Polymer](https://www.polymer-project.org/1.0/) – hasn't yet gained traction in the front end world, and it's certainly not for a lack of marketing.
+
+Perhaps we need to rethink the whole thing.
+
+
+## What problem do frameworks *really* solve?
+
+The common view is that frameworks make it easier to manage the complexity of your code: the framework abstracts away all the fussy implementation details with techniques like virtual DOM diffing. But that's not really true. At best, frameworks *move the complexity around*, away from code that you had to write and into code you didn't.
+
+Instead, the reason that ideas like React are so wildly and deservedly successful is that they make it easier to manage the complexity of your *concepts*. Frameworks are primarily a tool for structuring your thoughts, not your code.
+
+Given that, what if the framework *didn't actually run in the browser*? What if, instead, it converted your application into pure vanilla JavaScript, just like Babel converts ES2016+ to ES5? You'd pay no upfront cost of shipping a hefty runtime, and your app would get seriously fast, because there'd be no layers of abstraction between your app and the browser.
+
+
+## Introducing Svelte
+
+Svelte is a new framework that does exactly that. You write your components using HTML, CSS and JavaScript (plus a few extra bits you can [learn in under 5 minutes](/guide)), and during your build process Svelte compiles them into tiny standalone JavaScript modules. By statically analysing the component template, we can make sure that the browser does as little work as possible.
+
+The [Svelte implementation of TodoMVC](http://svelte-todomvc.surge.sh/) weighs 3.6kb zipped. For comparison, React plus ReactDOM *without any app code* weighs about 45kb zipped. It takes about 10x as long for the browser just to evaluate React as it does for Svelte to be up and running with an interactive TodoMVC.
+
+And once your app *is* up and running, according to [js-framework-benchmark](https://github.com/krausest/js-framework-benchmark) **Svelte is fast as heck**. It's faster than React. It's faster than Vue. It's faster than Angular, or Ember, or Ractive, or Preact, or Riot, or Mithril. It's competitive with Inferno, which is probably the fastest UI framework in the world, for now, because [Dominic Gannaway](https://twitter.com/trueadm) is a wizard. (Svelte is slower at removing elements. We're [working on it](https://github.com/sveltejs/svelte/issues/26).)
+
+It's basically as fast as vanilla JS, which makes sense because it *is* vanilla JS – just vanilla JS that you didn't have to write.
+
+
+## But that's not the important thing
+
+Well, it *is* important – performance matters a great deal. What's really exciting about this approach, though, is that we can finally solve some of the thorniest problems in web development.
+
+Consider interoperability. Want to `npm install cool-calendar-widget` and use it in your app? Previously, you could only do that if you were already using (a correct version of) the framework that the widget was designed for – if `cool-calendar-widget` was built in React and you're using Angular then, well, hard cheese. But if the widget author used Svelte, apps that use it can be built using whatever technology you like. (On the TODO list: a way to convert Svelte components into web components.)
+
+Or [code splitting](https://twitter.com/samccone/status/797528710085652480). It's a great idea (only load the code the user needs for the initial view, then get the rest later), but there's a problem – even if you only initially serve one React component instead of 100, *you still have to serve React itself*. With Svelte, code splitting can be much more effective, because the framework is embedded in the component, and the component is tiny.
+
+Finally, something I've wrestled with a great deal as an open source maintainer: your users always want *their* features prioritised, and underestimate the cost of those features to people who don't need them. A framework author must always balance the long-term health of the project with the desire to meet their users' needs. That's incredibly difficult, because it's hard to anticipate – much less articulate – the consequences of incremental bloat, and it takes serious soft skills to tell people (who may have been enthusiastically evangelising your tool up to that point) that their feature isn't important enough. But with an approach like Svelte's, many features can be added with absolutely no cost to people who don't use them, because the code that implements those features just doesn't get generated by the compiler if it's unnecessary.
+
+
+## We're just getting started
+
+Svelte is very new. There's a lot of work still left to do – creating build tool integrations, adding a server-side renderer, hot reloading, transitions, more documentation and examples, starter kits, and so on.
+
+But you can already build rich components with it, which is why we've gone straight to a stable 1.0.0 release. [Read the guide](/guide), [try it out in the REPL](/repl), and head over to [GitHub](https://github.com/sveltejs/svelte) to help kickstart the next era of front end development.
diff --git a/site/content/blog/2017-08-07-the-easiest-way-to-get-started.md b/site/content/blog/2017-08-07-the-easiest-way-to-get-started.md
new file mode 100644
index 0000000000..08f5b1bf02
--- /dev/null
+++ b/site/content/blog/2017-08-07-the-easiest-way-to-get-started.md
@@ -0,0 +1,66 @@
+---
+title: The easiest way to get started with Svelte
+description: This'll only take a minute.
+pubdate: 2017-08-07
+author: Rich Harris
+authorURL: https://twitter.com/Rich_Harris
+---
+
+Svelte is a [new kind of framework](/blog/frameworks-without-the-framework). Rather than putting a `
+
+
+
+
+
+
+
+
+
+
+{#if adjusting}
+
+
adjust diameter of circle at {selected.cx}, {selected.cy}
+
+
+{/if}
\ No newline at end of file
diff --git a/site/content/examples/7guis-circles/data.json5 b/site/content/examples/7guis-circles/data.json5
new file mode 100644
index 0000000000..9e26dfeeb6
--- /dev/null
+++ b/site/content/examples/7guis-circles/data.json5
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/site/content/examples/7guis-counter/App.html b/site/content/examples/7guis-counter/App.html
new file mode 100644
index 0000000000..385a3c9749
--- /dev/null
+++ b/site/content/examples/7guis-counter/App.html
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/site/content/examples/7guis-counter/data.json5 b/site/content/examples/7guis-counter/data.json5
new file mode 100644
index 0000000000..f30dc46c11
--- /dev/null
+++ b/site/content/examples/7guis-counter/data.json5
@@ -0,0 +1,3 @@
+{
+ "count": 0
+}
\ No newline at end of file
diff --git a/site/content/examples/7guis-crud/App.html b/site/content/examples/7guis-crud/App.html
new file mode 100644
index 0000000000..82ce893aac
--- /dev/null
+++ b/site/content/examples/7guis-crud/App.html
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/site/content/examples/7guis-crud/data.json5 b/site/content/examples/7guis-crud/data.json5
new file mode 100644
index 0000000000..c3e6dc3e67
--- /dev/null
+++ b/site/content/examples/7guis-crud/data.json5
@@ -0,0 +1,16 @@
+{
+ "people": [
+ {
+ "first": "Hans",
+ "last": "Emil"
+ },
+ {
+ "first": "Max",
+ "last": "Mustermann"
+ },
+ {
+ "first": "Roman",
+ "last": "Tisch"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/site/content/examples/7guis-flight-booker/App.html b/site/content/examples/7guis-flight-booker/App.html
new file mode 100644
index 0000000000..1cb45371e1
--- /dev/null
+++ b/site/content/examples/7guis-flight-booker/App.html
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/site/content/examples/7guis-flight-booker/data.json5 b/site/content/examples/7guis-flight-booker/data.json5
new file mode 100644
index 0000000000..9e26dfeeb6
--- /dev/null
+++ b/site/content/examples/7guis-flight-booker/data.json5
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/site/content/examples/7guis-temperature/App.html b/site/content/examples/7guis-temperature/App.html
new file mode 100644
index 0000000000..216c3461eb
--- /dev/null
+++ b/site/content/examples/7guis-temperature/App.html
@@ -0,0 +1,24 @@
+
+ °c =
+ °f
+
+
+
+
diff --git a/site/content/examples/7guis-temperature/data.json5 b/site/content/examples/7guis-temperature/data.json5
new file mode 100644
index 0000000000..21950c8dfb
--- /dev/null
+++ b/site/content/examples/7guis-temperature/data.json5
@@ -0,0 +1,3 @@
+{
+ "celsius": 0
+}
\ No newline at end of file
diff --git a/site/content/examples/7guis-timer/App.html b/site/content/examples/7guis-timer/App.html
new file mode 100644
index 0000000000..47afd6c48b
--- /dev/null
+++ b/site/content/examples/7guis-timer/App.html
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
{(elapsed / 1000).toFixed(1)}s
+
+
+
+
\ No newline at end of file
diff --git a/site/content/examples/7guis-timer/data.json5 b/site/content/examples/7guis-timer/data.json5
new file mode 100644
index 0000000000..9e26dfeeb6
--- /dev/null
+++ b/site/content/examples/7guis-timer/data.json5
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/site/content/examples/await-block/App.html b/site/content/examples/await-block/App.html
new file mode 100644
index 0000000000..dd3ef25bfc
--- /dev/null
+++ b/site/content/examples/await-block/App.html
@@ -0,0 +1,24 @@
+
+
+
+
+{#if promise}
+ {#await promise}
+
wait for it...
+ {:then answer}
+
the answer is {answer}!
+ {:catch error}
+
well that's odd
+ {/await}
+{/if}
\ No newline at end of file
diff --git a/site/content/examples/await-block/data.json5 b/site/content/examples/await-block/data.json5
new file mode 100644
index 0000000000..9e26dfeeb6
--- /dev/null
+++ b/site/content/examples/await-block/data.json5
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/site/content/examples/bar-chart/App.html b/site/content/examples/bar-chart/App.html
new file mode 100644
index 0000000000..0098454e91
--- /dev/null
+++ b/site/content/examples/bar-chart/App.html
@@ -0,0 +1,112 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/site/content/examples/binding-input-checkbox-group/data.json5 b/site/content/examples/binding-input-checkbox-group/data.json5
new file mode 100644
index 0000000000..2285e3abfa
--- /dev/null
+++ b/site/content/examples/binding-input-checkbox-group/data.json5
@@ -0,0 +1,3 @@
+{
+ "selected": ["blue"]
+}
\ No newline at end of file
diff --git a/site/content/examples/binding-input-checkbox/App.html b/site/content/examples/binding-input-checkbox/App.html
new file mode 100644
index 0000000000..b8facdd53b
--- /dev/null
+++ b/site/content/examples/binding-input-checkbox/App.html
@@ -0,0 +1,17 @@
+{#each todos as todo}
+
+
+
+
+{/each}
+
+
\ No newline at end of file
diff --git a/site/content/examples/binding-input-checkbox/data.json5 b/site/content/examples/binding-input-checkbox/data.json5
new file mode 100644
index 0000000000..4afee559a5
--- /dev/null
+++ b/site/content/examples/binding-input-checkbox/data.json5
@@ -0,0 +1,16 @@
+{
+ "todos": [
+ {
+ "description": "Buy some milk",
+ "done": true
+ },
+ {
+ "description": "Do the laundry",
+ "done": true
+ },
+ {
+ "description": "Find life's true purpose",
+ "done": false
+ }
+ ]
+}
\ No newline at end of file
diff --git a/site/content/examples/binding-input-numeric/App.html b/site/content/examples/binding-input-numeric/App.html
new file mode 100644
index 0000000000..566c16006c
--- /dev/null
+++ b/site/content/examples/binding-input-numeric/App.html
@@ -0,0 +1,12 @@
+
+
+
+
+
{a} * {b} = {a * b}
+
+
\ No newline at end of file
diff --git a/site/content/examples/binding-input-numeric/data.json5 b/site/content/examples/binding-input-numeric/data.json5
new file mode 100644
index 0000000000..1aa99a76cd
--- /dev/null
+++ b/site/content/examples/binding-input-numeric/data.json5
@@ -0,0 +1,4 @@
+{
+ "a": 5,
+ "b": 5
+}
\ No newline at end of file
diff --git a/site/content/examples/binding-input-radio/App.html b/site/content/examples/binding-input-radio/App.html
new file mode 100644
index 0000000000..f83813754f
--- /dev/null
+++ b/site/content/examples/binding-input-radio/App.html
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
selected {selected}
\ No newline at end of file
diff --git a/site/content/examples/binding-input-radio/data.json5 b/site/content/examples/binding-input-radio/data.json5
new file mode 100644
index 0000000000..961184190e
--- /dev/null
+++ b/site/content/examples/binding-input-radio/data.json5
@@ -0,0 +1,3 @@
+{
+ "selected": "blue"
+}
\ No newline at end of file
diff --git a/site/content/examples/binding-input-text/App.html b/site/content/examples/binding-input-text/App.html
new file mode 100644
index 0000000000..5d81d1e564
--- /dev/null
+++ b/site/content/examples/binding-input-text/App.html
@@ -0,0 +1,2 @@
+
+
Hello {name || 'stranger'}!
\ No newline at end of file
diff --git a/site/content/examples/binding-input-text/data.json5 b/site/content/examples/binding-input-text/data.json5
new file mode 100644
index 0000000000..393554903d
--- /dev/null
+++ b/site/content/examples/binding-input-text/data.json5
@@ -0,0 +1,3 @@
+{
+ "name": ""
+}
\ No newline at end of file
diff --git a/site/content/examples/binding-media-elements/App.html b/site/content/examples/binding-media-elements/App.html
new file mode 100644
index 0000000000..a8fcb64f64
--- /dev/null
+++ b/site/content/examples/binding-media-elements/App.html
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
THX Deep Note
+
+
+ {format(t)}
+ {format(d)}
+
+
+
+
THX Deep Note
+
+
+ {format(t)}
+ {format(d)}
+
+
+
+
diff --git a/site/content/examples/binding-media-elements/data.json5 b/site/content/examples/binding-media-elements/data.json5
new file mode 100644
index 0000000000..9e26dfeeb6
--- /dev/null
+++ b/site/content/examples/binding-media-elements/data.json5
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/site/content/examples/binding-textarea/App.html b/site/content/examples/binding-textarea/App.html
new file mode 100644
index 0000000000..4fd46f2625
--- /dev/null
+++ b/site/content/examples/binding-textarea/App.html
@@ -0,0 +1,15 @@
+
+
+
+
{@html marked(markdown)}
+
+
\ No newline at end of file
diff --git a/site/content/examples/binding-textarea/data.json5 b/site/content/examples/binding-textarea/data.json5
new file mode 100644
index 0000000000..12268060fb
--- /dev/null
+++ b/site/content/examples/binding-textarea/data.json5
@@ -0,0 +1,3 @@
+{
+ "markdown": "# Markdown editor\n\nTODOs:\n\n* make a Svelte app\n* think of a third item for this list"
+}
\ No newline at end of file
diff --git a/site/content/examples/each-blocks/App.html b/site/content/examples/each-blocks/App.html
new file mode 100644
index 0000000000..b8ba07a5e9
--- /dev/null
+++ b/site/content/examples/each-blocks/App.html
@@ -0,0 +1,7 @@
+
+
\ No newline at end of file
diff --git a/site/content/examples/hacker-news/data.json5 b/site/content/examples/hacker-news/data.json5
new file mode 100644
index 0000000000..9e26dfeeb6
--- /dev/null
+++ b/site/content/examples/hacker-news/data.json5
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/site/content/examples/hello-world/App.html b/site/content/examples/hello-world/App.html
new file mode 100644
index 0000000000..f6882abc09
--- /dev/null
+++ b/site/content/examples/hello-world/App.html
@@ -0,0 +1,14 @@
+
Hello {name}!
+
+
\ No newline at end of file
diff --git a/site/content/examples/hello-world/data.json5 b/site/content/examples/hello-world/data.json5
new file mode 100644
index 0000000000..3949aecc6a
--- /dev/null
+++ b/site/content/examples/hello-world/data.json5
@@ -0,0 +1,3 @@
+{
+ "name": "world"
+}
\ No newline at end of file
diff --git a/site/content/examples/if-blocks/App.html b/site/content/examples/if-blocks/App.html
new file mode 100644
index 0000000000..57de219159
--- /dev/null
+++ b/site/content/examples/if-blocks/App.html
@@ -0,0 +1,5 @@
+{#if foo}
+
foo!
+{:else}
+
not foo!
+{/if}
\ No newline at end of file
diff --git a/site/content/examples/if-blocks/data.json5 b/site/content/examples/if-blocks/data.json5
new file mode 100644
index 0000000000..c803db4749
--- /dev/null
+++ b/site/content/examples/if-blocks/data.json5
@@ -0,0 +1,3 @@
+{
+ "foo": true
+}
\ No newline at end of file
diff --git a/site/content/examples/immutable/App.html b/site/content/examples/immutable/App.html
new file mode 100644
index 0000000000..db7795f43f
--- /dev/null
+++ b/site/content/examples/immutable/App.html
@@ -0,0 +1,40 @@
+
+
+
+
+
Immutable
+{#each todos as todo}
+
+{/each}
+
+
Mutable
+{#each todos as todo}
+
+{/each}
diff --git a/site/content/examples/immutable/ImmutableTodo.html b/site/content/examples/immutable/ImmutableTodo.html
new file mode 100644
index 0000000000..bc2403f048
--- /dev/null
+++ b/site/content/examples/immutable/ImmutableTodo.html
@@ -0,0 +1,15 @@
+
+
+
+
+
+{todo.text}
diff --git a/site/content/examples/immutable/MutableTodo.html b/site/content/examples/immutable/MutableTodo.html
new file mode 100644
index 0000000000..948aaea805
--- /dev/null
+++ b/site/content/examples/immutable/MutableTodo.html
@@ -0,0 +1,13 @@
+
+
+
+{todo.text}
diff --git a/site/content/examples/immutable/data.json5 b/site/content/examples/immutable/data.json5
new file mode 100644
index 0000000000..a0ed59d82b
--- /dev/null
+++ b/site/content/examples/immutable/data.json5
@@ -0,0 +1,7 @@
+{
+ todos: [
+ { id: 1, done: true, text: "wash the car" },
+ { id: 2, done: false, text: "take the dog for a walk" },
+ { id: 3, done: false, text: "mow the lawn" }
+ ]
+}
diff --git a/site/content/examples/immutable/flash.js b/site/content/examples/immutable/flash.js
new file mode 100644
index 0000000000..d8c251f32a
--- /dev/null
+++ b/site/content/examples/immutable/flash.js
@@ -0,0 +1,13 @@
+import { afterUpdate } from 'svelte';
+
+export default function flash(fn) {
+ afterUpdate(() => {
+ const span = fn();
+
+ span.style.color = 'red';
+
+ setTimeout(() => {
+ span.style.color = 'black';
+ }, 400);
+ });
+}
\ No newline at end of file
diff --git a/site/content/examples/line-chart/App.html b/site/content/examples/line-chart/App.html
new file mode 100644
index 0000000000..41881f8a8f
--- /dev/null
+++ b/site/content/examples/line-chart/App.html
@@ -0,0 +1,129 @@
+
+
+
+
+
containing provisions as to the mode of procedure or the manner of taking effect —used of a contract or legacy
+
of or relating to a musical mode
+
of or relating to structure as opposed to substance
+
of, relating to, or constituting a grammatical form or category characteristically indicating predication
+
of or relating to a statistical mode
+
+
+ merriam-webster.com
+
+{:else}
+
+{/if}
\ No newline at end of file
diff --git a/site/content/examples/modal-with-slot/Modal.html b/site/content/examples/modal-with-slot/Modal.html
new file mode 100644
index 0000000000..87f1b02299
--- /dev/null
+++ b/site/content/examples/modal-with-slot/Modal.html
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/site/content/examples/modal-with-slot/data.json5 b/site/content/examples/modal-with-slot/data.json5
new file mode 100644
index 0000000000..18cc32884c
--- /dev/null
+++ b/site/content/examples/modal-with-slot/data.json5
@@ -0,0 +1,3 @@
+{
+ "showModal": true
+}
\ No newline at end of file
diff --git a/site/content/examples/nested-components/App.html b/site/content/examples/nested-components/App.html
new file mode 100644
index 0000000000..a00cb18a41
--- /dev/null
+++ b/site/content/examples/nested-components/App.html
@@ -0,0 +1,6 @@
+
+
+
This is a top-level element.
+
\ No newline at end of file
diff --git a/site/content/examples/nested-components/Nested.html b/site/content/examples/nested-components/Nested.html
new file mode 100644
index 0000000000..74ee56a5ed
--- /dev/null
+++ b/site/content/examples/nested-components/Nested.html
@@ -0,0 +1 @@
+
And this is a nested component.
\ No newline at end of file
diff --git a/site/content/examples/nested-components/data.json5 b/site/content/examples/nested-components/data.json5
new file mode 100644
index 0000000000..9e26dfeeb6
--- /dev/null
+++ b/site/content/examples/nested-components/data.json5
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/site/content/examples/parallax/App.html b/site/content/examples/parallax/App.html
new file mode 100644
index 0000000000..c7781e7a3f
--- /dev/null
+++ b/site/content/examples/parallax/App.html
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (scroll down)
+ parallax has never been this easy
+
+
+
\ No newline at end of file
diff --git a/site/content/examples/parallax/data.json5 b/site/content/examples/parallax/data.json5
new file mode 100644
index 0000000000..9e26dfeeb6
--- /dev/null
+++ b/site/content/examples/parallax/data.json5
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/site/content/examples/scatterplot/App.html b/site/content/examples/scatterplot/App.html
new file mode 100644
index 0000000000..e45d6f8f7f
--- /dev/null
+++ b/site/content/examples/scatterplot/App.html
@@ -0,0 +1,28 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/site/content/examples/scoped-styles/data.json5 b/site/content/examples/scoped-styles/data.json5
new file mode 100644
index 0000000000..9e26dfeeb6
--- /dev/null
+++ b/site/content/examples/scoped-styles/data.json5
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/site/content/examples/self-references/App.html b/site/content/examples/self-references/App.html
new file mode 100644
index 0000000000..bd4475e206
--- /dev/null
+++ b/site/content/examples/self-references/App.html
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/site/content/examples/self-references/data.json5 b/site/content/examples/self-references/data.json5
new file mode 100644
index 0000000000..de0cfbd194
--- /dev/null
+++ b/site/content/examples/self-references/data.json5
@@ -0,0 +1,32 @@
+{
+ "node": {
+ "name": "Fruit",
+ "children": [
+ {
+ "name": "Red",
+ "children": [
+ {
+ "name": "Cherry"
+ },
+ {
+ "name": "Strawberry"
+ }
+ ]
+ },
+ {
+ "name": "Green",
+ "children": [
+ {
+ "name": "Apple"
+ },
+ {
+ "name": "Pear"
+ },
+ {
+ "name": "Lime"
+ }
+ ]
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/site/content/examples/svg-clock/App.html b/site/content/examples/svg-clock/App.html
new file mode 100644
index 0000000000..3e406b5d65
--- /dev/null
+++ b/site/content/examples/svg-clock/App.html
@@ -0,0 +1,100 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/site/content/examples/svg-clock/data.json5 b/site/content/examples/svg-clock/data.json5
new file mode 100644
index 0000000000..9e26dfeeb6
--- /dev/null
+++ b/site/content/examples/svg-clock/data.json5
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/site/content/examples/transitions-custom/App.html b/site/content/examples/transitions-custom/App.html
new file mode 100644
index 0000000000..66d6918895
--- /dev/null
+++ b/site/content/examples/transitions-custom/App.html
@@ -0,0 +1,46 @@
+
+
+ visible
+
+{#if visible}
+
+ wheeee!!!!!
+
+{/if}
+
+
diff --git a/site/content/examples/transitions-custom/data.json5 b/site/content/examples/transitions-custom/data.json5
new file mode 100644
index 0000000000..9e26dfeeb6
--- /dev/null
+++ b/site/content/examples/transitions-custom/data.json5
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/site/content/examples/transitions-fade/App.html b/site/content/examples/transitions-fade/App.html
new file mode 100644
index 0000000000..ef424447de
--- /dev/null
+++ b/site/content/examples/transitions-fade/App.html
@@ -0,0 +1,11 @@
+
+
+ visible
+
+{#if visible}
+
fades in and out
+{/if}
\ No newline at end of file
diff --git a/site/content/examples/transitions-fade/data.json5 b/site/content/examples/transitions-fade/data.json5
new file mode 100644
index 0000000000..9e26dfeeb6
--- /dev/null
+++ b/site/content/examples/transitions-fade/data.json5
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/site/content/examples/transitions-fly/App.html b/site/content/examples/transitions-fly/App.html
new file mode 100644
index 0000000000..2568480bbf
--- /dev/null
+++ b/site/content/examples/transitions-fly/App.html
@@ -0,0 +1,11 @@
+
+
+ visible
+
+{#if visible}
+
flies 200 pixels up, slowly
+{/if}
\ No newline at end of file
diff --git a/site/content/examples/transitions-fly/data.json5 b/site/content/examples/transitions-fly/data.json5
new file mode 100644
index 0000000000..9e26dfeeb6
--- /dev/null
+++ b/site/content/examples/transitions-fly/data.json5
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/site/content/examples/transitions-in-out/App.html b/site/content/examples/transitions-in-out/App.html
new file mode 100644
index 0000000000..940377ea3d
--- /dev/null
+++ b/site/content/examples/transitions-in-out/App.html
@@ -0,0 +1,11 @@
+
+
+ visible
+
+{#if visible}
+
flies up, fades out
+{/if}
\ No newline at end of file
diff --git a/site/content/examples/transitions-in-out/data.json5 b/site/content/examples/transitions-in-out/data.json5
new file mode 100644
index 0000000000..9e26dfeeb6
--- /dev/null
+++ b/site/content/examples/transitions-in-out/data.json5
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/site/content/guide/00-introduction.md b/site/content/guide/00-introduction.md
new file mode 100644
index 0000000000..f193f32217
--- /dev/null
+++ b/site/content/guide/00-introduction.md
@@ -0,0 +1,112 @@
+---
+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 Svelte 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
+
+
Hello {name}!
+```
+
+```json
+/* { hidden: true } */
+{
+ name: 'world'
+}
+```
+
+> Wherever you see REPL 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 `
+
+{#await promise}
+
wait for it...
+{:then answer}
+
the answer is {answer}!
+{:catch error}
+
well that's odd
+{/await}
+```
+
+If the expression in `{#await expression}` *isn't* a promise, Svelte skips ahead to the `then` section.
+
+
+### Directives
+
+Directives allow you to add special instructions for adding [event handlers](guide#event-handlers), [bindings](guide#bindings), [transitions](guide#transitions) and so on. We'll cover each of those in later stages of this guide – for now, all you need to know is that directives can be identified by the `:` character:
+
+```html
+
+
Count: {count}
+
+```
+
+```json
+/* { hidden: true } */
+{
+ count: 0
+}
+```
+
+> Technically, the `:` character is used to denote namespaced attributes in HTML. These will *not* be treated as directives, if encountered.
+
+
+### Debug tags
+
+To inspect data as it changes and flows through your app, use a `{@debug ...}` tag:
+
+```html
+
+
+
+{@debug name}
+
Hello {name}!
+```
+
+```json
+/* { hidden: true } */
+{
+ name: 'world'
+}
+```
+
+This will log the value of `name` whenever it changes. If your devtools are open, changing `name` will pause execution and open the debugger.
+
+You can debug multiple values simultaneously (`{@debug foo, bar, baz}`), or use `{@debug}` to pause execution whenever the surrounding markup is updated.
+
+> Debug tags only have an effect when compiling with the `dev: true` compiler option.
diff --git a/site/content/guide/03-scoped-styles.md b/site/content/guide/03-scoped-styles.md
new file mode 100644
index 0000000000..9a96da84db
--- /dev/null
+++ b/site/content/guide/03-scoped-styles.md
@@ -0,0 +1,118 @@
+---
+title: Scoped styles
+---
+
+One of Svelte's key tenets is that components should be self-contained and reusable in different contexts. Because of that, it has a mechanism for *scoping* your CSS, so that you don't accidentally clobber other selectors on the page.
+
+### Adding styles
+
+Your component template can have a `
+
+
+ Big red Comic Sans
+
+```
+
+
+### How it works
+
+Open the example above in the REPL and inspect the element to see what has happened – Svelte has added a `svelte-[uniqueid]` class to the element, and transformed the CSS selector accordingly. Since no other element on the page can share that selector, anything else on the page with `class="foo"` will be unaffected by our styles.
+
+This is vastly simpler than achieving the same effect via [Shadow DOM](http://caniuse.com/#search=shadow%20dom) and works everywhere without polyfills.
+
+> Svelte will add a `
+
+
+
+
+```
+
+> Scoped styles are *not* dynamic – they are shared between all instances of a component. In other words you can't use `{tags}` inside your CSS.
+
+
+### Unused style removal
+
+Svelte will identify and remove styles that are not being used in your app. It will also emit a warning so that you can remove them from the source.
+
+For rules *not* to be removed, they must apply to the component's markup. As far as Svelte is concerned `.bold` is unused in the following code and should be removed:
+
+```html
+
+
+
this text is not bold
+
+
+
+
+
+```
+
+Instead of manually manipulating the DOM, you should always use the `class` attribute (or the [class directive](https://svelte.technology/guide#classes)):
+
+```html
+
+
+
this text is bold
+
+```
+
+If that's impossible for some reason, you can use `:global(...)`:
+
+```html
+
+
+```
+
+The same applies to the contents of `{@html ...}` tags.
\ No newline at end of file
diff --git a/site/content/guide/04-behaviour.md b/site/content/guide/04-behaviour.md
new file mode 100644
index 0000000000..008a6e4556
--- /dev/null
+++ b/site/content/guide/04-behaviour.md
@@ -0,0 +1,121 @@
+---
+title: Behaviours
+---
+
+As well as scoped styles and a template, components can encapsulate *behaviours*. For that, we add a `
+
+
+
+
+```
+
+
+### Internal state
+
+Often, it makes sense for a component to have internal state that isn't visible to the outside world.
+
+```html
+
+
+
+
Count: {count}
+
+```
+
+
+### External properties
+
+On the other hand, for the component to form part of a system, it needs to expose certain values so that they can be set from outside. These are called *props*, and we use the `export` keyword to differentiate them from internal state:
+
+```html
+
+
+
+
Count: {count}
+
+```
+
+> Effectively, we're exporting a *contract* with the outside world. The `export` keyword normally means something different in JavaScript, so you might be surprised to see it used like this. Just roll with it for now!
+
+The `= 0` sets a default value for `count`, if none is provided.
+
+```js
+const counter = new Counter({
+ target: document.body,
+ props: {
+ count: 99
+ }
+});
+
+counter.count; // 99
+counter.count += 1; // 100
+```
+
+Props declared with `const` or `function` are *read-only* — they cannot be set from outside. This allows you to, for example, attach custom methods to your component:
+
+```js
+component.doSomethingFun();
+```
+
+
+### Lifecycle hooks
+
+There are four 'hooks' provided by Svelte for adding control logic — `onMount`, `beforeUpdate`, `afterUpdate` and `onDestroy`. Import them directly from `svelte`:
+
+```html
+
+
+
+
+
+> Lifecycle hooks do *not* run in server-side rendering (SSR) mode, with the exception of `onDestroy`. More on SSR later.
diff --git a/site/content/guide/05-nested-components.md b/site/content/guide/05-nested-components.md
new file mode 100644
index 0000000000..be114b49eb
--- /dev/null
+++ b/site/content/guide/05-nested-components.md
@@ -0,0 +1,147 @@
+---
+title: Nested components
+---
+
+As well as containing elements (and `if` blocks and `each` blocks), Svelte components can contain *other* Svelte components.
+
+```html
+
+
+
+
+
+
+```
+
+```html
+
+
I am a nested component. The answer is {answer}
+```
+
+That's similar to doing this...
+
+```js
+import Widget from './Widget.html';
+
+const widget = new Widget({
+ target: document.querySelector('.widget-container'),
+ props: {
+ answer: 42
+ }
+});
+```
+
+...except that Svelte takes care of destroying the child component when the parent is destroyed, and keeps props in sync if they change.
+
+> Component names must be capitalised, following the widely-used JavaScript convention of capitalising constructor names. It's also an easy way to distinguish components from elements in your template.
+
+
+### Props
+
+Props, short for 'properties', are the means by which you pass data down from a parent to a child component — in other words, they're just like attributes on an element. As with element attributes, prop values can contain any valid JavaScript expression.
+
+Often, the name of the property will be the same as the value, in which case we can use a shorthand:
+
+```html
+
+
+
+
+```
+
+> Note that props are *one-way* — to get data from a child component into a parent component, use [bindings](guide#bindings).
+
+
+### Composing with ``
+
+A component can contain a `` element, which allows the parent component to inject content:
+
+```html
+
+
+
+
+
Hello!
+
This is a box. It can contain anything.
+
+```
+
+```html
+
+
+
+
+
+
+```
+
+The `` element can contain 'fallback content', which will be used if no children are provided for the component:
+
+```html
+
+
+
+
+```
+
+```html
+
+
+
+
+
+
the box is empty!
+
+
+```
+
+You can also have *named* slots. Any elements with a corresponding `slot` attribute will fill these slots:
+
+```html
+
+
+
+
+ P. Sherman
+ 42 Wallaby Way, Sydney
+
+```
+
+```html
+
+
+
+
+
+ Unknown address
+
+ Unknown email
+
+```
\ No newline at end of file
diff --git a/site/content/guide/06-special-components.md b/site/content/guide/06-special-components.md
new file mode 100644
index 0000000000..47c31c3733
--- /dev/null
+++ b/site/content/guide/06-special-components.md
@@ -0,0 +1,137 @@
+---
+title: Special elements
+---
+
+Svelte includes a handful of built-in elements with special behaviour.
+
+
+### ``
+
+Sometimes, a component needs to embed itself recursively — for example if you have a tree-like data structure. In Svelte, that's accomplished with the `` tag:
+
+```html
+
+{#if countdown > 0}
+
{countdown}
+
+{:else}
+
liftoff!
+{/if}
+```
+
+```json
+/* { hidden: true } */
+{
+ countdown: 5
+}
+```
+
+
+### ``
+
+If you don't know what kind of component to render until the app runs — in other words, it's driven by state (aka a dynamic component) — you can use ``:
+
+```html
+
+
+
+ foo
+
+```
+
+```html
+
+
Red {name}
+```
+
+```html
+
+
Blue {name}
+```
+
+The expression inside the `this="{...}"` can be any valid JavaScript expression.
+
+
+### ``
+
+The `` tag gives you a convenient way to declaratively add event listeners to `window`. Event listeners are automatically removed when the component is destroyed.
+
+```html
+
+
+
+
+
+{#if key}
+
{key === ' ' ? 'Space' : key} (code {keyCode})
+{:else}
+
click in this window and press any key
+{/if}
+```
+
+You can also bind to certain values — so far `innerWidth`, `outerWidth`, `innerHeight`, `outerHeight`, `scrollX`, `scrollY` and `online`:
+
+```html
+
+
+
+
+
+
+
user has scrolled {y} pixels
+```
+
+
+### ``
+
+TODO REPLACE THIS WITH svelte:body
+
+The `` tag, just like ``, gives you a convenient way to declaratively add event listeners to the `document` object. This is useful for listening to events that don't fire on `window`, such as `mouseenter` and `mouseleave`.
+
+
+### ``
+
+If you're building an application with Svelte — particularly if you're using [Sapper](https://sapper.svelte.technology) — then it's likely you'll need to add some content to the `` of your page, such as adding a `` element.
+
+You can do that with the `` tag:
+
+```html
+
+
+ {post.title} • My blog
+
+```
+
+When [server rendering](guide#server-side-rendering), the `` contents can be extracted separately to the rest of the markup.
diff --git a/site/content/guide/07-events.md b/site/content/guide/07-events.md
new file mode 100644
index 0000000000..6cf6b98a23
--- /dev/null
+++ b/site/content/guide/07-events.md
@@ -0,0 +1,180 @@
+---
+title: Events
+---
+
+In most applications, you'll need to respond to the user's actions. In Svelte, this is done with the `on:[event]` directive.
+
+### Element events
+
+When used on an element, `on:click={handler}` is equivalent to calling `element.addEventListener('click', handler)`. When the element is removed, Svelte calls `removeEventListener` automatically.
+
+```html
+
+
Count: {count}
+
+```
+
+```json
+/* { hidden: true } */
+{
+ count: 0
+}
+```
+
+For more complicated behaviours, you'll probably want to declare an event handler in your `
+
+
+```
+
+...it gets annoying if you want to combine that with some other behaviour:
+
+```html
+
+
+
+
...
+```
+
+For that reason, Svelte lets you use *event modifiers*:
+
+- [`preventDefault`](https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
+- [`stopPropagation`](https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation)
+- [`passive`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters) — improves scrolling performance on touch/wheel events (Svelte will add it automatically where it's safe to do so)
+- [`once`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters) — removes the listener after the first invocation
+- [`capture`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameter)
+
+> `passive` and `once` are not implemented in `legacy` mode
+
+The example above can be achieved with modifiers — no need for a separate event handler:
+
+```html
+
+
foo = !foo}">...
+```
+
+
+### Component events
+
+Events are an excellent way for [nested components](guide#nested-components) to communicate with their parents. Let's revisit our earlier example, but turn it into a `` component:
+
+```html
+
+
Select a category:
+
+{#each categories as category}
+
+{/each}
+
+
+```
+
+When the user clicks a button, the component will fire a `select` event, where the `event` object has a `category` property. Any component that nests `` can listen for events like so:
+
+```html
+
+
+
+
+```
+
+```html
+
+
Select a category:
+
+{#each categories as category}
+
+{/each}
+
+
+```
+
+Just as `this` in an element's event handler refers to the element itself, in a component event handler `this` refers to the component firing the event.
+
+There is also a shorthand for listening for and re-firing an event unchanged.
+
+```html
+
+
+
+
+```
+
+Since component events do not propagate as DOM events do, this can be used to pass events through intermediate components. This shorthand technique also applies to element events (`on:click` is equivalent to `on:click="fire('click', event)"`).
diff --git a/site/content/guide/08-bindings.md b/site/content/guide/08-bindings.md
new file mode 100644
index 0000000000..b899ea2376
--- /dev/null
+++ b/site/content/guide/08-bindings.md
@@ -0,0 +1,161 @@
+---
+title: Bindings
+---
+
+
+### Bindings
+
+As we've seen, data can be passed down to elements and components with attributes and [props](guide#props). Occasionally, you need to get data back *up*; for that we use bindings.
+
+
+#### Component bindings
+
+Component bindings keep values in sync between a parent and a child:
+
+```html
+
+
+```
+
+Whenever `childValue` changes in the child component, `parentValue` will be updated in the parent component and vice versa.
+
+If the names are the same, you can shorten the declaration:
+
+```html
+
+
+```
+
+> Use component bindings judiciously. They can save you a lot of boilerplate, but will make it harder to reason about data flow within your application if you overuse them.
+
+
+#### Element bindings
+
+Element bindings make it easy to respond to user interactions:
+
+```html
+
+
Hello {name}!
+
+```
+
+```json
+/* { hidden: true } */
+{
+ name: 'world'
+}
+```
+
+Some bindings are *one-way*, meaning that the values are read-only. Most are *two-way* — changing the data programmatically will update the DOM. The following bindings are available:
+
+| Name | Applies to | Kind |
+|-----------------------------------------------------------------|----------------------------------------------|----------------------|
+| `value` | `` `