diff --git a/site/content/examples/00-introduction/00-hello-world/App.svelte b/site/content/examples/00-introduction/00-hello-world/App.svelte new file mode 100644 index 000000000000..22b3c84db099 --- /dev/null +++ b/site/content/examples/00-introduction/00-hello-world/App.svelte @@ -0,0 +1,5 @@ + + +

Hello {name}!

\ No newline at end of file diff --git a/site/content/examples/00-introduction/00-hello-world/meta.json b/site/content/examples/00-introduction/00-hello-world/meta.json new file mode 100644 index 000000000000..2f47184710c7 --- /dev/null +++ b/site/content/examples/00-introduction/00-hello-world/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Adding data" +} \ No newline at end of file diff --git a/site/content/examples/00-introduction/01-dynamic-attributes/App.svelte b/site/content/examples/00-introduction/01-dynamic-attributes/App.svelte new file mode 100644 index 000000000000..6a76b43dde14 --- /dev/null +++ b/site/content/examples/00-introduction/01-dynamic-attributes/App.svelte @@ -0,0 +1,7 @@ + + + +{name} dancing \ No newline at end of file diff --git a/site/content/examples/00-introduction/01-dynamic-attributes/meta.json b/site/content/examples/00-introduction/01-dynamic-attributes/meta.json new file mode 100644 index 000000000000..89614e0aa6a6 --- /dev/null +++ b/site/content/examples/00-introduction/01-dynamic-attributes/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Dynamic attributes" +} \ No newline at end of file diff --git a/site/content/examples/00-introduction/02-styling/App.svelte b/site/content/examples/00-introduction/02-styling/App.svelte new file mode 100644 index 000000000000..cacaf8ccba86 --- /dev/null +++ b/site/content/examples/00-introduction/02-styling/App.svelte @@ -0,0 +1,9 @@ + + +

Styled!

\ No newline at end of file diff --git a/site/content/examples/00-introduction/02-styling/meta.json b/site/content/examples/00-introduction/02-styling/meta.json new file mode 100644 index 000000000000..dcdf2bff0198 --- /dev/null +++ b/site/content/examples/00-introduction/02-styling/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Styling" +} \ No newline at end of file diff --git a/site/content/examples/00-introduction/03-nested-components/App.svelte b/site/content/examples/00-introduction/03-nested-components/App.svelte new file mode 100644 index 000000000000..e0a2e5fe176b --- /dev/null +++ b/site/content/examples/00-introduction/03-nested-components/App.svelte @@ -0,0 +1,14 @@ + + + + +

These styles...

+ \ No newline at end of file diff --git a/site/content/examples/00-introduction/03-nested-components/Nested.svelte b/site/content/examples/00-introduction/03-nested-components/Nested.svelte new file mode 100644 index 000000000000..17685233a5e9 --- /dev/null +++ b/site/content/examples/00-introduction/03-nested-components/Nested.svelte @@ -0,0 +1 @@ +

...don't affect this element

\ No newline at end of file diff --git a/site/content/examples/00-introduction/03-nested-components/meta.json b/site/content/examples/00-introduction/03-nested-components/meta.json new file mode 100644 index 000000000000..5848360a403c --- /dev/null +++ b/site/content/examples/00-introduction/03-nested-components/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Nested components" +} \ No newline at end of file diff --git a/site/content/examples/00-introduction/04-html-tags/App.svelte b/site/content/examples/00-introduction/04-html-tags/App.svelte new file mode 100644 index 000000000000..4029f076e227 --- /dev/null +++ b/site/content/examples/00-introduction/04-html-tags/App.svelte @@ -0,0 +1,5 @@ + + +

{@html string}

\ No newline at end of file diff --git a/site/content/examples/00-introduction/04-html-tags/meta.json b/site/content/examples/00-introduction/04-html-tags/meta.json new file mode 100644 index 000000000000..01af59ac8434 --- /dev/null +++ b/site/content/examples/00-introduction/04-html-tags/meta.json @@ -0,0 +1,3 @@ +{ + "title": "HTML tags" +} \ No newline at end of file diff --git a/site/content/examples/00-introduction/meta.json b/site/content/examples/00-introduction/meta.json new file mode 100644 index 000000000000..5c8f7bc10b6b --- /dev/null +++ b/site/content/examples/00-introduction/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Introduction" +} \ No newline at end of file diff --git a/site/content/examples/01-reactivity/00-reactive-assignments/App.svelte b/site/content/examples/01-reactivity/00-reactive-assignments/App.svelte new file mode 100644 index 000000000000..bc50d74cfc75 --- /dev/null +++ b/site/content/examples/01-reactivity/00-reactive-assignments/App.svelte @@ -0,0 +1,11 @@ + + + \ No newline at end of file diff --git a/site/content/examples/01-reactivity/00-reactive-assignments/meta.json b/site/content/examples/01-reactivity/00-reactive-assignments/meta.json new file mode 100644 index 000000000000..feb3e8f33801 --- /dev/null +++ b/site/content/examples/01-reactivity/00-reactive-assignments/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Reactive assignments" +} \ No newline at end of file diff --git a/site/content/examples/01-reactivity/01-reactive-declarations/App.svelte b/site/content/examples/01-reactivity/01-reactive-declarations/App.svelte new file mode 100644 index 000000000000..f7aca3bd80b4 --- /dev/null +++ b/site/content/examples/01-reactivity/01-reactive-declarations/App.svelte @@ -0,0 +1,18 @@ + + + + +

{count} * 2 = {doubled}

+

{doubled} * 2 = {quadrupled}

\ No newline at end of file diff --git a/site/content/examples/01-reactivity/01-reactive-declarations/meta.json b/site/content/examples/01-reactivity/01-reactive-declarations/meta.json new file mode 100644 index 000000000000..d824d8366965 --- /dev/null +++ b/site/content/examples/01-reactivity/01-reactive-declarations/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Reactive declarations" +} \ No newline at end of file diff --git a/site/content/examples/01-reactivity/02-reactive-statements/App.svelte b/site/content/examples/01-reactivity/02-reactive-statements/App.svelte new file mode 100644 index 000000000000..f757be6f5107 --- /dev/null +++ b/site/content/examples/01-reactivity/02-reactive-statements/App.svelte @@ -0,0 +1,16 @@ + + + \ No newline at end of file diff --git a/site/content/examples/01-reactivity/02-reactive-statements/meta.json b/site/content/examples/01-reactivity/02-reactive-statements/meta.json new file mode 100644 index 000000000000..1ef62c88304a --- /dev/null +++ b/site/content/examples/01-reactivity/02-reactive-statements/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Reactive statements" +} \ No newline at end of file diff --git a/site/content/examples/01-reactivity/meta.json b/site/content/examples/01-reactivity/meta.json new file mode 100644 index 000000000000..c908815e040a --- /dev/null +++ b/site/content/examples/01-reactivity/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Reactivity" +} \ No newline at end of file diff --git a/site/content/examples/02-props/00-declaring-props/App.svelte b/site/content/examples/02-props/00-declaring-props/App.svelte new file mode 100644 index 000000000000..79d7e6b78956 --- /dev/null +++ b/site/content/examples/02-props/00-declaring-props/App.svelte @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/site/content/examples/02-props/00-declaring-props/Nested.svelte b/site/content/examples/02-props/00-declaring-props/Nested.svelte new file mode 100644 index 000000000000..ecd3cb625410 --- /dev/null +++ b/site/content/examples/02-props/00-declaring-props/Nested.svelte @@ -0,0 +1,5 @@ + + +

The answer is {answer}

\ No newline at end of file diff --git a/site/content/examples/02-props/00-declaring-props/meta.json b/site/content/examples/02-props/00-declaring-props/meta.json new file mode 100644 index 000000000000..485c2708bd31 --- /dev/null +++ b/site/content/examples/02-props/00-declaring-props/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Declaring props" +} \ No newline at end of file diff --git a/site/content/examples/nested-components/App.svelte b/site/content/examples/02-props/01-default-values/App.svelte similarity index 65% rename from site/content/examples/nested-components/App.svelte rename to site/content/examples/02-props/01-default-values/App.svelte index 83cc0c6eb566..f9d63b30d654 100644 --- a/site/content/examples/nested-components/App.svelte +++ b/site/content/examples/02-props/01-default-values/App.svelte @@ -2,5 +2,5 @@ import Nested from './Nested.svelte'; -

This is a top-level element.

+ \ No newline at end of file diff --git a/site/content/examples/02-props/01-default-values/Nested.svelte b/site/content/examples/02-props/01-default-values/Nested.svelte new file mode 100644 index 000000000000..35ee5c9f88c0 --- /dev/null +++ b/site/content/examples/02-props/01-default-values/Nested.svelte @@ -0,0 +1,5 @@ + + +

The answer is {answer}

\ No newline at end of file diff --git a/site/content/examples/02-props/01-default-values/meta.json b/site/content/examples/02-props/01-default-values/meta.json new file mode 100644 index 000000000000..f690d64349b3 --- /dev/null +++ b/site/content/examples/02-props/01-default-values/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Default values" +} \ No newline at end of file diff --git a/site/content/examples/02-props/02-spread-props/App.svelte b/site/content/examples/02-props/02-spread-props/App.svelte new file mode 100644 index 000000000000..f40d3b89c885 --- /dev/null +++ b/site/content/examples/02-props/02-spread-props/App.svelte @@ -0,0 +1,12 @@ + + + \ No newline at end of file diff --git a/site/content/examples/02-props/02-spread-props/Info.svelte b/site/content/examples/02-props/02-spread-props/Info.svelte new file mode 100644 index 000000000000..74123982441f --- /dev/null +++ b/site/content/examples/02-props/02-spread-props/Info.svelte @@ -0,0 +1,12 @@ + + +

+ The {name} package is {speed} fast. + Download version {version} from npm + and learn more here +

\ No newline at end of file diff --git a/site/content/examples/02-props/02-spread-props/meta.json b/site/content/examples/02-props/02-spread-props/meta.json new file mode 100644 index 000000000000..3f4b5128bf89 --- /dev/null +++ b/site/content/examples/02-props/02-spread-props/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Spread props" +} \ No newline at end of file diff --git a/site/content/examples/02-props/meta.json b/site/content/examples/02-props/meta.json new file mode 100644 index 000000000000..7b9e0a27831f --- /dev/null +++ b/site/content/examples/02-props/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Props" +} \ No newline at end of file diff --git a/site/content/examples/03-logic/00-if-blocks/App.svelte b/site/content/examples/03-logic/00-if-blocks/App.svelte new file mode 100644 index 000000000000..01b8867adeba --- /dev/null +++ b/site/content/examples/03-logic/00-if-blocks/App.svelte @@ -0,0 +1,19 @@ + + +{#if user.loggedIn} + +{/if} + +{#if !user.loggedIn} + +{/if} \ No newline at end of file diff --git a/site/content/examples/03-logic/00-if-blocks/meta.json b/site/content/examples/03-logic/00-if-blocks/meta.json new file mode 100644 index 000000000000..21598b878efc --- /dev/null +++ b/site/content/examples/03-logic/00-if-blocks/meta.json @@ -0,0 +1,3 @@ +{ + "title": "If blocks" +} \ No newline at end of file diff --git a/site/content/examples/03-logic/01-else-blocks/App.svelte b/site/content/examples/03-logic/01-else-blocks/App.svelte new file mode 100644 index 000000000000..c82565c2f7ce --- /dev/null +++ b/site/content/examples/03-logic/01-else-blocks/App.svelte @@ -0,0 +1,17 @@ + + +{#if user.loggedIn} + +{:else} + +{/if} \ No newline at end of file diff --git a/site/content/examples/03-logic/01-else-blocks/meta.json b/site/content/examples/03-logic/01-else-blocks/meta.json new file mode 100644 index 000000000000..5703b7ea92ce --- /dev/null +++ b/site/content/examples/03-logic/01-else-blocks/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Else blocks" +} \ No newline at end of file diff --git a/site/content/examples/03-logic/02-else-if-blocks/App.svelte b/site/content/examples/03-logic/02-else-if-blocks/App.svelte new file mode 100644 index 000000000000..9102618ff49f --- /dev/null +++ b/site/content/examples/03-logic/02-else-if-blocks/App.svelte @@ -0,0 +1,11 @@ + + +{#if x > 10} +

{x} is greater than 10

+{:else if 5 > x} +

{x} is less than 5

+{:else} +

{x} is between 5 and 10

+{/if} \ No newline at end of file diff --git a/site/content/examples/03-logic/02-else-if-blocks/meta.json b/site/content/examples/03-logic/02-else-if-blocks/meta.json new file mode 100644 index 000000000000..c778d9f48b0c --- /dev/null +++ b/site/content/examples/03-logic/02-else-if-blocks/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Else-if blocks" +} \ No newline at end of file diff --git a/site/content/examples/03-logic/03-each-blocks/App.svelte b/site/content/examples/03-logic/03-each-blocks/App.svelte new file mode 100644 index 000000000000..6ea5097be202 --- /dev/null +++ b/site/content/examples/03-logic/03-each-blocks/App.svelte @@ -0,0 +1,17 @@ + + +

The Famous Cats of YouTube

+ + \ No newline at end of file diff --git a/site/content/examples/03-logic/03-each-blocks/meta.json b/site/content/examples/03-logic/03-each-blocks/meta.json new file mode 100644 index 000000000000..d829b3cc53a6 --- /dev/null +++ b/site/content/examples/03-logic/03-each-blocks/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Each blocks" +} \ No newline at end of file diff --git a/site/content/examples/03-logic/04-keyed-each-blocks/App.svelte b/site/content/examples/03-logic/04-keyed-each-blocks/App.svelte new file mode 100644 index 000000000000..73a2dcc609f4 --- /dev/null +++ b/site/content/examples/03-logic/04-keyed-each-blocks/App.svelte @@ -0,0 +1,23 @@ + + + + +{#each things as thing (thing.id)} + +{/each} \ No newline at end of file diff --git a/site/content/examples/03-logic/04-keyed-each-blocks/Thing.svelte b/site/content/examples/03-logic/04-keyed-each-blocks/Thing.svelte new file mode 100644 index 000000000000..4e86d3210908 --- /dev/null +++ b/site/content/examples/03-logic/04-keyed-each-blocks/Thing.svelte @@ -0,0 +1,9 @@ + + +

{valueAtStart} / {value}

\ No newline at end of file diff --git a/site/content/examples/03-logic/04-keyed-each-blocks/meta.json b/site/content/examples/03-logic/04-keyed-each-blocks/meta.json new file mode 100644 index 000000000000..faee8bff8d20 --- /dev/null +++ b/site/content/examples/03-logic/04-keyed-each-blocks/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Keyed each blocks" +} \ No newline at end of file diff --git a/site/content/examples/03-logic/05-await-blocks/App.svelte b/site/content/examples/03-logic/05-await-blocks/App.svelte new file mode 100644 index 000000000000..8c8036c0f1f4 --- /dev/null +++ b/site/content/examples/03-logic/05-await-blocks/App.svelte @@ -0,0 +1,30 @@ + + + + +{#await promise} +

...waiting

+{:then number} +

The number is {number}

+{:catch error} +

{error.message}

+{/await} \ No newline at end of file diff --git a/site/content/examples/03-logic/05-await-blocks/meta.json b/site/content/examples/03-logic/05-await-blocks/meta.json new file mode 100644 index 000000000000..c7a809f5edd1 --- /dev/null +++ b/site/content/examples/03-logic/05-await-blocks/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Await blocks" +} \ No newline at end of file diff --git a/site/content/examples/03-logic/meta.json b/site/content/examples/03-logic/meta.json new file mode 100644 index 000000000000..3ecf1ccee24c --- /dev/null +++ b/site/content/examples/03-logic/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Logic" +} \ No newline at end of file diff --git a/site/content/examples/04-events/00-dom-events/App.svelte b/site/content/examples/04-events/00-dom-events/App.svelte new file mode 100644 index 000000000000..f26112f06cec --- /dev/null +++ b/site/content/examples/04-events/00-dom-events/App.svelte @@ -0,0 +1,16 @@ + + + + +
+ The mouse position is {m.x} x {m.y} +
\ No newline at end of file diff --git a/site/content/examples/04-events/00-dom-events/meta.json b/site/content/examples/04-events/00-dom-events/meta.json new file mode 100644 index 000000000000..5b3e37e41f50 --- /dev/null +++ b/site/content/examples/04-events/00-dom-events/meta.json @@ -0,0 +1,3 @@ +{ + "title": "DOM events" +} \ No newline at end of file diff --git a/site/content/examples/04-events/01-inline-handlers/App.svelte b/site/content/examples/04-events/01-inline-handlers/App.svelte new file mode 100644 index 000000000000..f0fd6ff17ab3 --- /dev/null +++ b/site/content/examples/04-events/01-inline-handlers/App.svelte @@ -0,0 +1,11 @@ + + + + +
+ The mouse position is {m.x} x {m.y} +
\ No newline at end of file diff --git a/site/content/examples/04-events/01-inline-handlers/meta.json b/site/content/examples/04-events/01-inline-handlers/meta.json new file mode 100644 index 000000000000..575b9ab2b6e0 --- /dev/null +++ b/site/content/examples/04-events/01-inline-handlers/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Inline handlers" +} \ No newline at end of file diff --git a/site/content/examples/04-events/02-event-modifiers/App.svelte b/site/content/examples/04-events/02-event-modifiers/App.svelte new file mode 100644 index 000000000000..94df49cb2d6f --- /dev/null +++ b/site/content/examples/04-events/02-event-modifiers/App.svelte @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/site/content/examples/04-events/02-event-modifiers/meta.json b/site/content/examples/04-events/02-event-modifiers/meta.json new file mode 100644 index 000000000000..322bb5ba5e28 --- /dev/null +++ b/site/content/examples/04-events/02-event-modifiers/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Event modifiers" +} \ No newline at end of file diff --git a/site/content/examples/04-events/03-component-events/App.svelte b/site/content/examples/04-events/03-component-events/App.svelte new file mode 100644 index 000000000000..a8d14a368a0f --- /dev/null +++ b/site/content/examples/04-events/03-component-events/App.svelte @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/site/content/examples/04-events/03-component-events/Inner.svelte b/site/content/examples/04-events/03-component-events/Inner.svelte new file mode 100644 index 000000000000..6ac8301f2495 --- /dev/null +++ b/site/content/examples/04-events/03-component-events/Inner.svelte @@ -0,0 +1,15 @@ + + + \ No newline at end of file diff --git a/site/content/examples/04-events/03-component-events/meta.json b/site/content/examples/04-events/03-component-events/meta.json new file mode 100644 index 000000000000..2a777d4d003c --- /dev/null +++ b/site/content/examples/04-events/03-component-events/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Component events" +} \ No newline at end of file diff --git a/site/content/examples/04-events/04-event-forwarding/App.svelte b/site/content/examples/04-events/04-event-forwarding/App.svelte new file mode 100644 index 000000000000..973df50f0a2e --- /dev/null +++ b/site/content/examples/04-events/04-event-forwarding/App.svelte @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/site/content/examples/04-events/04-event-forwarding/Inner.svelte b/site/content/examples/04-events/04-event-forwarding/Inner.svelte new file mode 100644 index 000000000000..6ac8301f2495 --- /dev/null +++ b/site/content/examples/04-events/04-event-forwarding/Inner.svelte @@ -0,0 +1,15 @@ + + + \ No newline at end of file diff --git a/site/content/examples/04-events/04-event-forwarding/Outer.svelte b/site/content/examples/04-events/04-event-forwarding/Outer.svelte new file mode 100644 index 000000000000..10c28f298a3a --- /dev/null +++ b/site/content/examples/04-events/04-event-forwarding/Outer.svelte @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/site/content/examples/04-events/04-event-forwarding/meta.json b/site/content/examples/04-events/04-event-forwarding/meta.json new file mode 100644 index 000000000000..3a8aa674b705 --- /dev/null +++ b/site/content/examples/04-events/04-event-forwarding/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Event forwarding" +} \ No newline at end of file diff --git a/site/content/examples/04-events/05-dom-event-forwarding/App.svelte b/site/content/examples/04-events/05-dom-event-forwarding/App.svelte new file mode 100644 index 000000000000..1429cae207d8 --- /dev/null +++ b/site/content/examples/04-events/05-dom-event-forwarding/App.svelte @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/site/content/examples/04-events/05-dom-event-forwarding/FancyButton.svelte b/site/content/examples/04-events/05-dom-event-forwarding/FancyButton.svelte new file mode 100644 index 000000000000..75630ea99c08 --- /dev/null +++ b/site/content/examples/04-events/05-dom-event-forwarding/FancyButton.svelte @@ -0,0 +1,15 @@ + + + \ No newline at end of file diff --git a/site/content/examples/04-events/05-dom-event-forwarding/meta.json b/site/content/examples/04-events/05-dom-event-forwarding/meta.json new file mode 100644 index 000000000000..9aa593808f04 --- /dev/null +++ b/site/content/examples/04-events/05-dom-event-forwarding/meta.json @@ -0,0 +1,3 @@ +{ + "title": "DOM event forwarding" +} \ No newline at end of file diff --git a/site/content/examples/04-events/meta.json b/site/content/examples/04-events/meta.json new file mode 100644 index 000000000000..c5f088e20879 --- /dev/null +++ b/site/content/examples/04-events/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Events" +} \ No newline at end of file diff --git a/site/content/examples/binding-input-text/App.svelte b/site/content/examples/05-bindings/00-text-inputs/App.svelte similarity index 71% rename from site/content/examples/binding-input-text/App.svelte rename to site/content/examples/05-bindings/00-text-inputs/App.svelte index 5d81d1e564b6..5eab79764a6f 100644 --- a/site/content/examples/binding-input-text/App.svelte +++ b/site/content/examples/05-bindings/00-text-inputs/App.svelte @@ -1,2 +1,6 @@ + +

Hello {name || 'stranger'}!

\ No newline at end of file diff --git a/site/content/examples/05-bindings/00-text-inputs/meta.json b/site/content/examples/05-bindings/00-text-inputs/meta.json new file mode 100644 index 000000000000..45577af5be65 --- /dev/null +++ b/site/content/examples/05-bindings/00-text-inputs/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Text inputs" +} \ No newline at end of file diff --git a/site/content/examples/05-bindings/01-numeric-inputs/App.svelte b/site/content/examples/05-bindings/01-numeric-inputs/App.svelte new file mode 100644 index 000000000000..798d57e02192 --- /dev/null +++ b/site/content/examples/05-bindings/01-numeric-inputs/App.svelte @@ -0,0 +1,16 @@ + + + + + + +

{a} + {b} = {a + b}

\ No newline at end of file diff --git a/site/content/examples/05-bindings/01-numeric-inputs/meta.json b/site/content/examples/05-bindings/01-numeric-inputs/meta.json new file mode 100644 index 000000000000..72f8579704f0 --- /dev/null +++ b/site/content/examples/05-bindings/01-numeric-inputs/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Numeric inputs" +} \ No newline at end of file diff --git a/site/content/examples/05-bindings/02-checkbox-inputs/App.svelte b/site/content/examples/05-bindings/02-checkbox-inputs/App.svelte new file mode 100644 index 000000000000..b82d31e78317 --- /dev/null +++ b/site/content/examples/05-bindings/02-checkbox-inputs/App.svelte @@ -0,0 +1,18 @@ + + + + +{#if yes} +

Thank you. We will bombard your inbox and sell your personal details.

+{:else} +

You must opt in to continue. If you're not paying, you're the product.

+{/if} + + \ No newline at end of file diff --git a/site/content/examples/05-bindings/02-checkbox-inputs/meta.json b/site/content/examples/05-bindings/02-checkbox-inputs/meta.json new file mode 100644 index 000000000000..723312a3d955 --- /dev/null +++ b/site/content/examples/05-bindings/02-checkbox-inputs/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Checkbox inputs" +} \ No newline at end of file diff --git a/site/content/examples/05-bindings/03-group-inputs/App.svelte b/site/content/examples/05-bindings/03-group-inputs/App.svelte new file mode 100644 index 000000000000..a46c61c7e786 --- /dev/null +++ b/site/content/examples/05-bindings/03-group-inputs/App.svelte @@ -0,0 +1,52 @@ + + +

Size

+ + + + + + + +

Flavours

+ +{#each menu as flavour} + +{/each} + +{#if flavours.length === 0} +

Please select at least one flavour

+{:else if flavours.length > scoops} +

Can't order more flavours than scoops!

+{:else} +

+ You ordered {scoops} {scoops === 1 ? 'scoop' : 'scoops'} + of {join(flavours)} +

+{/if} diff --git a/site/content/examples/05-bindings/03-group-inputs/meta.json b/site/content/examples/05-bindings/03-group-inputs/meta.json new file mode 100644 index 000000000000..2203d6e6fa6a --- /dev/null +++ b/site/content/examples/05-bindings/03-group-inputs/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Group inputs" +} \ No newline at end of file diff --git a/site/content/examples/05-bindings/04-textarea-inputs/App.svelte b/site/content/examples/05-bindings/04-textarea-inputs/App.svelte new file mode 100644 index 000000000000..be338bf47fc1 --- /dev/null +++ b/site/content/examples/05-bindings/04-textarea-inputs/App.svelte @@ -0,0 +1,12 @@ + + + + + + +{@html marked(value)} \ No newline at end of file diff --git a/site/content/examples/05-bindings/04-textarea-inputs/meta.json b/site/content/examples/05-bindings/04-textarea-inputs/meta.json new file mode 100644 index 000000000000..01adf6b5cf3d --- /dev/null +++ b/site/content/examples/05-bindings/04-textarea-inputs/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Textarea inputs" +} \ No newline at end of file diff --git a/site/content/examples/05-bindings/05-select-bindings/App.svelte b/site/content/examples/05-bindings/05-select-bindings/App.svelte new file mode 100644 index 000000000000..3f1e7fa7e1a8 --- /dev/null +++ b/site/content/examples/05-bindings/05-select-bindings/App.svelte @@ -0,0 +1,39 @@ + + + + +

Insecurity questions

+ +
+ + + + + +
+ +

selected question {selected ? selected.id : '[waiting...]'}

\ No newline at end of file diff --git a/site/content/examples/05-bindings/05-select-bindings/meta.json b/site/content/examples/05-bindings/05-select-bindings/meta.json new file mode 100644 index 000000000000..fe170eb0fcb2 --- /dev/null +++ b/site/content/examples/05-bindings/05-select-bindings/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Select bindings" +} \ No newline at end of file diff --git a/site/content/examples/05-bindings/06-multiple-select-bindings/App.svelte b/site/content/examples/05-bindings/06-multiple-select-bindings/App.svelte new file mode 100644 index 000000000000..d808850158ea --- /dev/null +++ b/site/content/examples/05-bindings/06-multiple-select-bindings/App.svelte @@ -0,0 +1,53 @@ + + +

Size

+ + + + + + + +

Flavours

+ + + +{#if flavours.length === 0} +

Please select at least one flavour

+{:else if flavours.length > scoops} +

Can't order more flavours than scoops!

+{:else} +

+ You ordered {scoops} {scoops === 1 ? 'scoop' : 'scoops'} + of {join(flavours)} +

+{/if} diff --git a/site/content/examples/05-bindings/06-multiple-select-bindings/meta.json b/site/content/examples/05-bindings/06-multiple-select-bindings/meta.json new file mode 100644 index 000000000000..abf763540798 --- /dev/null +++ b/site/content/examples/05-bindings/06-multiple-select-bindings/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Select multiple" +} \ No newline at end of file diff --git a/site/content/examples/05-bindings/07-each-block-bindings/App.svelte b/site/content/examples/05-bindings/07-each-block-bindings/App.svelte new file mode 100644 index 000000000000..92bdc7754f38 --- /dev/null +++ b/site/content/examples/05-bindings/07-each-block-bindings/App.svelte @@ -0,0 +1,39 @@ + + +

Todos

+ +{#each todos as todo} +
+ + + +
+{/each} + + + + diff --git a/site/content/examples/05-bindings/07-each-block-bindings/meta.json b/site/content/examples/05-bindings/07-each-block-bindings/meta.json new file mode 100644 index 000000000000..2d27051b49fa --- /dev/null +++ b/site/content/examples/05-bindings/07-each-block-bindings/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Each block bindings" +} \ No newline at end of file diff --git a/site/content/examples/05-bindings/08-media-elements/App.svelte b/site/content/examples/05-bindings/08-media-elements/App.svelte new file mode 100644 index 000000000000..2cf819fca0ea --- /dev/null +++ b/site/content/examples/05-bindings/08-media-elements/App.svelte @@ -0,0 +1,130 @@ + + + + +

Caminandes: Llamigos

+

From Blender Open Projects. CC-BY

+ +
+ + +
+ + +
+ {format(time)} + click anywhere to {paused ? 'play' : 'pause'} / drag to seek + {format(duration)} +
+
+
\ No newline at end of file diff --git a/site/content/examples/05-bindings/08-media-elements/meta.json b/site/content/examples/05-bindings/08-media-elements/meta.json new file mode 100644 index 000000000000..4e40a6acee3a --- /dev/null +++ b/site/content/examples/05-bindings/08-media-elements/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Media elements" +} \ No newline at end of file diff --git a/site/content/examples/05-bindings/09-dimensions/App.svelte b/site/content/examples/05-bindings/09-dimensions/App.svelte new file mode 100644 index 000000000000..ca992599c1d1 --- /dev/null +++ b/site/content/examples/05-bindings/09-dimensions/App.svelte @@ -0,0 +1,20 @@ + + + + + + + +

size: {w}px x {h}px

+ +
+ {text} +
\ No newline at end of file diff --git a/site/content/examples/05-bindings/09-dimensions/meta.json b/site/content/examples/05-bindings/09-dimensions/meta.json new file mode 100644 index 000000000000..9f8b6602c7b3 --- /dev/null +++ b/site/content/examples/05-bindings/09-dimensions/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Dimensions" +} \ No newline at end of file diff --git a/site/content/examples/05-bindings/10-bind-this/App.svelte b/site/content/examples/05-bindings/10-bind-this/App.svelte new file mode 100644 index 000000000000..eacd203629aa --- /dev/null +++ b/site/content/examples/05-bindings/10-bind-this/App.svelte @@ -0,0 +1,59 @@ + + + + + \ No newline at end of file diff --git a/site/content/examples/05-bindings/10-bind-this/meta.json b/site/content/examples/05-bindings/10-bind-this/meta.json new file mode 100644 index 000000000000..da5ce399ab39 --- /dev/null +++ b/site/content/examples/05-bindings/10-bind-this/meta.json @@ -0,0 +1,3 @@ +{ + "title": "bind:this={canvas}" +} \ No newline at end of file diff --git a/site/content/examples/05-bindings/11-component-bindings/App.svelte b/site/content/examples/05-bindings/11-component-bindings/App.svelte new file mode 100644 index 000000000000..67fec4a5ada9 --- /dev/null +++ b/site/content/examples/05-bindings/11-component-bindings/App.svelte @@ -0,0 +1,14 @@ + + +

{view}

+ + \ No newline at end of file diff --git a/site/content/examples/05-bindings/11-component-bindings/Keypad.svelte b/site/content/examples/05-bindings/11-component-bindings/Keypad.svelte new file mode 100644 index 000000000000..c457a15cb50e --- /dev/null +++ b/site/content/examples/05-bindings/11-component-bindings/Keypad.svelte @@ -0,0 +1,40 @@ + + + + +
+ + + + + + + + + + + + + +
\ No newline at end of file diff --git a/site/content/examples/05-bindings/11-component-bindings/meta.json b/site/content/examples/05-bindings/11-component-bindings/meta.json new file mode 100644 index 000000000000..4c921d0e8a77 --- /dev/null +++ b/site/content/examples/05-bindings/11-component-bindings/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Component bindings" +} \ No newline at end of file diff --git a/site/content/examples/05-bindings/meta.json b/site/content/examples/05-bindings/meta.json new file mode 100644 index 000000000000..8bb0142eccc9 --- /dev/null +++ b/site/content/examples/05-bindings/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Bindings" +} \ No newline at end of file diff --git a/site/content/examples/06-lifecycle/00-onmount/App.svelte b/site/content/examples/06-lifecycle/00-onmount/App.svelte new file mode 100644 index 000000000000..1b83727627bd --- /dev/null +++ b/site/content/examples/06-lifecycle/00-onmount/App.svelte @@ -0,0 +1,38 @@ + + + + +

Photo album

+ +
+ {#each photos as photo} +
+ {photo.title} +
{photo.title}
+
+ {:else} + +

loading...

+ {/each} +
\ No newline at end of file diff --git a/site/content/examples/06-lifecycle/00-onmount/meta.json b/site/content/examples/06-lifecycle/00-onmount/meta.json new file mode 100644 index 000000000000..3b2799c5bce3 --- /dev/null +++ b/site/content/examples/06-lifecycle/00-onmount/meta.json @@ -0,0 +1,3 @@ +{ + "title": "onMount" +} \ No newline at end of file diff --git a/site/content/examples/06-lifecycle/01-ondestroy/App.svelte b/site/content/examples/06-lifecycle/01-ondestroy/App.svelte new file mode 100644 index 000000000000..93a721ef4430 --- /dev/null +++ b/site/content/examples/06-lifecycle/01-ondestroy/App.svelte @@ -0,0 +1,11 @@ + + +

+ The page has been open for + {seconds} {seconds === 1 ? 'second' : 'seconds'} +

\ No newline at end of file diff --git a/site/content/examples/06-lifecycle/01-ondestroy/meta.json b/site/content/examples/06-lifecycle/01-ondestroy/meta.json new file mode 100644 index 000000000000..d87febd1a587 --- /dev/null +++ b/site/content/examples/06-lifecycle/01-ondestroy/meta.json @@ -0,0 +1,3 @@ +{ + "title": "onDestroy" +} \ No newline at end of file diff --git a/site/content/examples/06-lifecycle/01-ondestroy/utils.js b/site/content/examples/06-lifecycle/01-ondestroy/utils.js new file mode 100644 index 000000000000..0f75f29e2a51 --- /dev/null +++ b/site/content/examples/06-lifecycle/01-ondestroy/utils.js @@ -0,0 +1,9 @@ +import { onDestroy } from 'svelte'; + +export function onInterval(callback, milliseconds) { + const interval = setInterval(callback, milliseconds); + + onDestroy(() => { + clearInterval(interval); + }); +} \ No newline at end of file diff --git a/site/content/examples/06-lifecycle/02-update/App.svelte b/site/content/examples/06-lifecycle/02-update/App.svelte new file mode 100644 index 000000000000..373b6dcb6a8b --- /dev/null +++ b/site/content/examples/06-lifecycle/02-update/App.svelte @@ -0,0 +1,106 @@ + + + + +
+

Eliza

+ +
+ {#each comments as comment} +
+ {comment.text} +
+ {/each} +
+ + +
\ No newline at end of file diff --git a/site/content/examples/06-lifecycle/02-update/meta.json b/site/content/examples/06-lifecycle/02-update/meta.json new file mode 100644 index 000000000000..c92a6db8dcb4 --- /dev/null +++ b/site/content/examples/06-lifecycle/02-update/meta.json @@ -0,0 +1,3 @@ +{ + "title": "beforeUpdate and afterUpdate" +} \ No newline at end of file diff --git a/site/content/examples/06-lifecycle/03-tick/App.svelte b/site/content/examples/06-lifecycle/03-tick/App.svelte new file mode 100644 index 000000000000..c9cb6de42089 --- /dev/null +++ b/site/content/examples/06-lifecycle/03-tick/App.svelte @@ -0,0 +1,37 @@ + + + + + \ No newline at end of file diff --git a/site/content/examples/06-lifecycle/03-tick/meta.json b/site/content/examples/06-lifecycle/03-tick/meta.json new file mode 100644 index 000000000000..0a406e13aa35 --- /dev/null +++ b/site/content/examples/06-lifecycle/03-tick/meta.json @@ -0,0 +1,3 @@ +{ + "title": "tick" +} \ No newline at end of file diff --git a/site/content/examples/06-lifecycle/meta.json b/site/content/examples/06-lifecycle/meta.json new file mode 100644 index 000000000000..2f833e2a4aba --- /dev/null +++ b/site/content/examples/06-lifecycle/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Lifecycle" +} \ No newline at end of file diff --git a/site/content/examples/07-stores/00-writable-stores/App.svelte b/site/content/examples/07-stores/00-writable-stores/App.svelte new file mode 100644 index 000000000000..ee542f789d19 --- /dev/null +++ b/site/content/examples/07-stores/00-writable-stores/App.svelte @@ -0,0 +1,18 @@ + + +

The count is {count_value}

+ + + + \ No newline at end of file diff --git a/site/content/examples/07-stores/00-writable-stores/Decrementer.svelte b/site/content/examples/07-stores/00-writable-stores/Decrementer.svelte new file mode 100644 index 000000000000..043b795047b1 --- /dev/null +++ b/site/content/examples/07-stores/00-writable-stores/Decrementer.svelte @@ -0,0 +1,11 @@ + + + \ No newline at end of file diff --git a/site/content/examples/homepage-demo-reactivity/App.svelte b/site/content/examples/07-stores/00-writable-stores/Incrementer.svelte similarity index 55% rename from site/content/examples/homepage-demo-reactivity/App.svelte rename to site/content/examples/07-stores/00-writable-stores/Incrementer.svelte index 9d1b2757c082..2b5763012b46 100644 --- a/site/content/examples/homepage-demo-reactivity/App.svelte +++ b/site/content/examples/07-stores/00-writable-stores/Incrementer.svelte @@ -1,11 +1,11 @@ \ No newline at end of file diff --git a/site/content/examples/07-stores/00-writable-stores/Resetter.svelte b/site/content/examples/07-stores/00-writable-stores/Resetter.svelte new file mode 100644 index 000000000000..4183421e517b --- /dev/null +++ b/site/content/examples/07-stores/00-writable-stores/Resetter.svelte @@ -0,0 +1,11 @@ + + + \ No newline at end of file diff --git a/site/content/examples/07-stores/00-writable-stores/meta.json b/site/content/examples/07-stores/00-writable-stores/meta.json new file mode 100644 index 000000000000..e0b2a6809d5c --- /dev/null +++ b/site/content/examples/07-stores/00-writable-stores/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Writable stores" +} \ No newline at end of file diff --git a/site/content/examples/07-stores/00-writable-stores/stores.js b/site/content/examples/07-stores/00-writable-stores/stores.js new file mode 100644 index 000000000000..143e0c99f085 --- /dev/null +++ b/site/content/examples/07-stores/00-writable-stores/stores.js @@ -0,0 +1,3 @@ +import { writable } from 'svelte/store'; + +export const count = writable(0); \ No newline at end of file diff --git a/site/content/examples/07-stores/01-auto-subscriptions/App.svelte b/site/content/examples/07-stores/01-auto-subscriptions/App.svelte new file mode 100644 index 000000000000..10ebfb65bbde --- /dev/null +++ b/site/content/examples/07-stores/01-auto-subscriptions/App.svelte @@ -0,0 +1,12 @@ + + +

The count is {$count}

+ + + + \ No newline at end of file diff --git a/site/content/examples/07-stores/01-auto-subscriptions/Decrementer.svelte b/site/content/examples/07-stores/01-auto-subscriptions/Decrementer.svelte new file mode 100644 index 000000000000..043b795047b1 --- /dev/null +++ b/site/content/examples/07-stores/01-auto-subscriptions/Decrementer.svelte @@ -0,0 +1,11 @@ + + + \ No newline at end of file diff --git a/site/content/examples/07-stores/01-auto-subscriptions/Incrementer.svelte b/site/content/examples/07-stores/01-auto-subscriptions/Incrementer.svelte new file mode 100644 index 000000000000..2b5763012b46 --- /dev/null +++ b/site/content/examples/07-stores/01-auto-subscriptions/Incrementer.svelte @@ -0,0 +1,11 @@ + + + \ No newline at end of file diff --git a/site/content/examples/07-stores/01-auto-subscriptions/Resetter.svelte b/site/content/examples/07-stores/01-auto-subscriptions/Resetter.svelte new file mode 100644 index 000000000000..4183421e517b --- /dev/null +++ b/site/content/examples/07-stores/01-auto-subscriptions/Resetter.svelte @@ -0,0 +1,11 @@ + + + \ No newline at end of file diff --git a/site/content/examples/07-stores/01-auto-subscriptions/meta.json b/site/content/examples/07-stores/01-auto-subscriptions/meta.json new file mode 100644 index 000000000000..a7e4c5fefc21 --- /dev/null +++ b/site/content/examples/07-stores/01-auto-subscriptions/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Auto-subscriptions" +} \ No newline at end of file diff --git a/site/content/examples/07-stores/01-auto-subscriptions/stores.js b/site/content/examples/07-stores/01-auto-subscriptions/stores.js new file mode 100644 index 000000000000..143e0c99f085 --- /dev/null +++ b/site/content/examples/07-stores/01-auto-subscriptions/stores.js @@ -0,0 +1,3 @@ +import { writable } from 'svelte/store'; + +export const count = writable(0); \ No newline at end of file diff --git a/site/content/examples/07-stores/02-readable-stores/App.svelte b/site/content/examples/07-stores/02-readable-stores/App.svelte new file mode 100644 index 000000000000..3ff0b0362f01 --- /dev/null +++ b/site/content/examples/07-stores/02-readable-stores/App.svelte @@ -0,0 +1,12 @@ + + +

The time is {formatter.format($time)}

\ No newline at end of file diff --git a/site/content/examples/07-stores/02-readable-stores/meta.json b/site/content/examples/07-stores/02-readable-stores/meta.json new file mode 100644 index 000000000000..3f420cafd804 --- /dev/null +++ b/site/content/examples/07-stores/02-readable-stores/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Readable stores" +} \ No newline at end of file diff --git a/site/content/examples/07-stores/02-readable-stores/stores.js b/site/content/examples/07-stores/02-readable-stores/stores.js new file mode 100644 index 000000000000..015de5ad4532 --- /dev/null +++ b/site/content/examples/07-stores/02-readable-stores/stores.js @@ -0,0 +1,11 @@ +import { readable } from 'svelte/store'; + +export const time = readable(function start(set) { + const interval = setInterval(() => { + set(new Date()); + }, 1000); + + return function stop() { + clearInterval(interval); + }; +}, new Date()); \ No newline at end of file diff --git a/site/content/examples/07-stores/03-derived-stores/App.svelte b/site/content/examples/07-stores/03-derived-stores/App.svelte new file mode 100644 index 000000000000..8182ecd671d4 --- /dev/null +++ b/site/content/examples/07-stores/03-derived-stores/App.svelte @@ -0,0 +1,17 @@ + + +

The time is {formatter.format($time)}

+ +

+ This page has been open for + {$elapsed} {$elapsed === 1 ? 'second' : 'seconds'} +

\ No newline at end of file diff --git a/site/content/examples/07-stores/03-derived-stores/meta.json b/site/content/examples/07-stores/03-derived-stores/meta.json new file mode 100644 index 000000000000..23105b0bfa4d --- /dev/null +++ b/site/content/examples/07-stores/03-derived-stores/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Derived stores" +} \ No newline at end of file diff --git a/site/content/examples/07-stores/03-derived-stores/stores.js b/site/content/examples/07-stores/03-derived-stores/stores.js new file mode 100644 index 000000000000..2f3af1247a1c --- /dev/null +++ b/site/content/examples/07-stores/03-derived-stores/stores.js @@ -0,0 +1,18 @@ +import { readable, derive } from 'svelte/store'; + +export const time = readable(function start(set) { + const interval = setInterval(() => { + set(new Date()); + }, 1000); + + return function stop() { + clearInterval(interval); + }; +}, new Date()); + +const start = new Date(); + +export const elapsed = derive( + time, + $time => Math.round(($time - start) / 1000) +); \ No newline at end of file diff --git a/site/content/examples/07-stores/04-custom-stores/App.svelte b/site/content/examples/07-stores/04-custom-stores/App.svelte new file mode 100644 index 000000000000..a320cc052ffd --- /dev/null +++ b/site/content/examples/07-stores/04-custom-stores/App.svelte @@ -0,0 +1,9 @@ + + +

The count is {$count}

+ + + + \ No newline at end of file diff --git a/site/content/examples/07-stores/04-custom-stores/meta.json b/site/content/examples/07-stores/04-custom-stores/meta.json new file mode 100644 index 000000000000..7394c55f2832 --- /dev/null +++ b/site/content/examples/07-stores/04-custom-stores/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Custom stores" +} \ No newline at end of file diff --git a/site/content/examples/07-stores/04-custom-stores/stores.js b/site/content/examples/07-stores/04-custom-stores/stores.js new file mode 100644 index 000000000000..5a26025b0312 --- /dev/null +++ b/site/content/examples/07-stores/04-custom-stores/stores.js @@ -0,0 +1,14 @@ +import { writable } from 'svelte/store'; + +function createCount() { + const { subscribe, set, update } = writable(0); + + return { + subscribe, + increment: () => update(n => n + 1), + decrement: () => update(n => n - 1), + reset: () => set(0) + }; +} + +export const count = createCount(); \ No newline at end of file diff --git a/site/content/examples/07-stores/meta.json b/site/content/examples/07-stores/meta.json new file mode 100644 index 000000000000..ad974de0d918 --- /dev/null +++ b/site/content/examples/07-stores/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Stores" +} \ No newline at end of file diff --git a/site/content/examples/08-motion/00-tweened/App.svelte b/site/content/examples/08-motion/00-tweened/App.svelte new file mode 100644 index 000000000000..83f3b50a0474 --- /dev/null +++ b/site/content/examples/08-motion/00-tweened/App.svelte @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/site/content/examples/08-motion/00-tweened/meta.json b/site/content/examples/08-motion/00-tweened/meta.json new file mode 100644 index 000000000000..39d3af7f38d9 --- /dev/null +++ b/site/content/examples/08-motion/00-tweened/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Tweened" +} \ No newline at end of file diff --git a/site/content/examples/motion-spring/App.svelte b/site/content/examples/08-motion/01-spring/App.svelte similarity index 53% rename from site/content/examples/motion-spring/App.svelte rename to site/content/examples/08-motion/01-spring/App.svelte index ae90d7cc8dd6..2cb0fd1eb78f 100644 --- a/site/content/examples/motion-spring/App.svelte +++ b/site/content/examples/08-motion/01-spring/App.svelte @@ -1,43 +1,20 @@ - - - - - + -
+
- \ No newline at end of file + + + \ No newline at end of file diff --git a/site/content/examples/08-motion/01-spring/meta.json b/site/content/examples/08-motion/01-spring/meta.json new file mode 100644 index 000000000000..f871fea53e34 --- /dev/null +++ b/site/content/examples/08-motion/01-spring/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Spring" +} \ No newline at end of file diff --git a/site/content/examples/08-motion/meta.json b/site/content/examples/08-motion/meta.json new file mode 100644 index 000000000000..e6fa83cd7f5e --- /dev/null +++ b/site/content/examples/08-motion/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Motion" +} \ No newline at end of file diff --git a/site/content/examples/09-transitions/00-transition/App.svelte b/site/content/examples/09-transitions/00-transition/App.svelte new file mode 100644 index 000000000000..b7909fb86e8e --- /dev/null +++ b/site/content/examples/09-transitions/00-transition/App.svelte @@ -0,0 +1,15 @@ + + + + +{#if visible} +

+ Fades in and out +

+{/if} \ No newline at end of file diff --git a/site/content/examples/09-transitions/00-transition/meta.json b/site/content/examples/09-transitions/00-transition/meta.json new file mode 100644 index 000000000000..e07975554f59 --- /dev/null +++ b/site/content/examples/09-transitions/00-transition/meta.json @@ -0,0 +1,3 @@ +{ + "title": "The transition directive" +} \ No newline at end of file diff --git a/site/content/examples/09-transitions/01-adding-parameters-to-transitions/App.svelte b/site/content/examples/09-transitions/01-adding-parameters-to-transitions/App.svelte new file mode 100644 index 000000000000..01047f5e37ca --- /dev/null +++ b/site/content/examples/09-transitions/01-adding-parameters-to-transitions/App.svelte @@ -0,0 +1,15 @@ + + + + +{#if visible} +

+ Flies in and out +

+{/if} \ No newline at end of file diff --git a/site/content/examples/09-transitions/01-adding-parameters-to-transitions/meta.json b/site/content/examples/09-transitions/01-adding-parameters-to-transitions/meta.json new file mode 100644 index 000000000000..517bc54c3cac --- /dev/null +++ b/site/content/examples/09-transitions/01-adding-parameters-to-transitions/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Adding parameters" +} \ No newline at end of file diff --git a/site/content/examples/09-transitions/02-in-and-out/App.svelte b/site/content/examples/09-transitions/02-in-and-out/App.svelte new file mode 100644 index 000000000000..36d36664e6fc --- /dev/null +++ b/site/content/examples/09-transitions/02-in-and-out/App.svelte @@ -0,0 +1,15 @@ + + + + +{#if visible} +

+ Flies in, fades out +

+{/if} \ No newline at end of file diff --git a/site/content/examples/09-transitions/02-in-and-out/meta.json b/site/content/examples/09-transitions/02-in-and-out/meta.json new file mode 100644 index 000000000000..627f409fa478 --- /dev/null +++ b/site/content/examples/09-transitions/02-in-and-out/meta.json @@ -0,0 +1,3 @@ +{ + "title": "In and out" +} \ No newline at end of file diff --git a/site/content/examples/transitions-custom/App.svelte b/site/content/examples/09-transitions/03-custom-css-transitions/App.svelte similarity index 62% rename from site/content/examples/transitions-custom/App.svelte rename to site/content/examples/09-transitions/03-custom-css-transitions/App.svelte index bee159e4c576..6e8dfcaf081e 100644 --- a/site/content/examples/transitions-custom/App.svelte +++ b/site/content/examples/09-transitions/03-custom-css-transitions/App.svelte @@ -1,14 +1,14 @@ - visible - -{#if visible} -
- wheeee!!!!! -
-{/if} - + + + +{#if visible} +
+ transitions! +
+{/if} \ No newline at end of file diff --git a/site/content/examples/09-transitions/03-custom-css-transitions/meta.json b/site/content/examples/09-transitions/03-custom-css-transitions/meta.json new file mode 100644 index 000000000000..8b70464ca8a5 --- /dev/null +++ b/site/content/examples/09-transitions/03-custom-css-transitions/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Custom CSS transitions" +} \ No newline at end of file diff --git a/site/content/examples/09-transitions/04-custom-js-transitions/App.svelte b/site/content/examples/09-transitions/04-custom-js-transitions/App.svelte new file mode 100644 index 000000000000..3b3fb94d1c89 --- /dev/null +++ b/site/content/examples/09-transitions/04-custom-js-transitions/App.svelte @@ -0,0 +1,36 @@ + + + + +{#if visible} +

+ The quick brown fox jumps over the lazy dog +

+{/if} \ No newline at end of file diff --git a/site/content/examples/09-transitions/04-custom-js-transitions/meta.json b/site/content/examples/09-transitions/04-custom-js-transitions/meta.json new file mode 100644 index 000000000000..1ec11d90f974 --- /dev/null +++ b/site/content/examples/09-transitions/04-custom-js-transitions/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Custom JS transitions" +} \ No newline at end of file diff --git a/site/content/examples/09-transitions/05-transition-events/App.svelte b/site/content/examples/09-transitions/05-transition-events/App.svelte new file mode 100644 index 000000000000..da79897365eb --- /dev/null +++ b/site/content/examples/09-transitions/05-transition-events/App.svelte @@ -0,0 +1,25 @@ + + +

status: {status}

+ + + +{#if visible} +

+ Flies in and out +

+{/if} \ No newline at end of file diff --git a/site/content/examples/09-transitions/05-transition-events/meta.json b/site/content/examples/09-transitions/05-transition-events/meta.json new file mode 100644 index 000000000000..b46e28feed27 --- /dev/null +++ b/site/content/examples/09-transitions/05-transition-events/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Transition events" +} \ No newline at end of file diff --git a/site/content/examples/09-transitions/06-deferred-transitions/App.svelte b/site/content/examples/09-transitions/06-deferred-transitions/App.svelte new file mode 100644 index 000000000000..c46096c20467 --- /dev/null +++ b/site/content/examples/09-transitions/06-deferred-transitions/App.svelte @@ -0,0 +1,146 @@ + + + + +
+ + +
+

todo

+ {#each todos.filter(t => !t.done) as todo (todo.id)} + + {/each} +
+ +
+

done

+ {#each todos.filter(t => t.done) as todo (todo.id)} + + {/each} +
+
\ No newline at end of file diff --git a/site/content/examples/09-transitions/06-deferred-transitions/crossfade.js b/site/content/examples/09-transitions/06-deferred-transitions/crossfade.js new file mode 100644 index 000000000000..e11e18b60eb8 --- /dev/null +++ b/site/content/examples/09-transitions/06-deferred-transitions/crossfade.js @@ -0,0 +1,65 @@ +import { quintOut } from 'svelte/easing'; + +export default function crossfade({ send, receive, fallback }) { + let requested = new Map(); + let provided = new Map(); + + function crossfade(from, node) { + const to = node.getBoundingClientRect(); + const dx = from.left - to.left; + const dy = from.top - to.top; + + const style = getComputedStyle(node); + const transform = style.transform === 'none' ? '' : style.transform; + + return { + duration: 400, + easing: quintOut, + css: (t, u) => ` + opacity: ${t}; + transform: ${transform} translate(${u * dx}px,${u * dy}px); + ` + }; + } + + return { + send(node, params) { + provided.set(params.key, { + rect: node.getBoundingClientRect() + }); + + return () => { + if (requested.has(params.key)) { + const { rect } = requested.get(params.key); + requested.delete(params.key); + + return crossfade(rect, node); + } + + // if the node is disappearing altogether + // (i.e. wasn't claimed by the other list) + // then we need to supply an outro + provided.delete(params.key); + return fallback(node, params); + }; + }, + + receive(node, params) { + requested.set(params.key, { + rect: node.getBoundingClientRect() + }); + + return () => { + if (provided.has(params.key)) { + const { rect } = provided.get(params.key); + provided.delete(params.key); + + return crossfade(rect, node); + } + + requested.delete(params.key); + return fallback(node, params); + }; + } + }; +} \ No newline at end of file diff --git a/site/content/examples/09-transitions/06-deferred-transitions/meta.json b/site/content/examples/09-transitions/06-deferred-transitions/meta.json new file mode 100644 index 000000000000..b9fc7da8984d --- /dev/null +++ b/site/content/examples/09-transitions/06-deferred-transitions/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Deferred transitions" +} \ No newline at end of file diff --git a/site/content/examples/09-transitions/meta.json b/site/content/examples/09-transitions/meta.json new file mode 100644 index 000000000000..cb9291d73f28 --- /dev/null +++ b/site/content/examples/09-transitions/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Transitions" +} \ No newline at end of file diff --git a/site/content/examples/10-animations/00-animate/App.svelte b/site/content/examples/10-animations/00-animate/App.svelte new file mode 100644 index 000000000000..c46096c20467 --- /dev/null +++ b/site/content/examples/10-animations/00-animate/App.svelte @@ -0,0 +1,146 @@ + + + + +
+ + +
+

todo

+ {#each todos.filter(t => !t.done) as todo (todo.id)} + + {/each} +
+ +
+

done

+ {#each todos.filter(t => t.done) as todo (todo.id)} + + {/each} +
+
\ No newline at end of file diff --git a/site/content/examples/10-animations/00-animate/crossfade.js b/site/content/examples/10-animations/00-animate/crossfade.js new file mode 100644 index 000000000000..e11e18b60eb8 --- /dev/null +++ b/site/content/examples/10-animations/00-animate/crossfade.js @@ -0,0 +1,65 @@ +import { quintOut } from 'svelte/easing'; + +export default function crossfade({ send, receive, fallback }) { + let requested = new Map(); + let provided = new Map(); + + function crossfade(from, node) { + const to = node.getBoundingClientRect(); + const dx = from.left - to.left; + const dy = from.top - to.top; + + const style = getComputedStyle(node); + const transform = style.transform === 'none' ? '' : style.transform; + + return { + duration: 400, + easing: quintOut, + css: (t, u) => ` + opacity: ${t}; + transform: ${transform} translate(${u * dx}px,${u * dy}px); + ` + }; + } + + return { + send(node, params) { + provided.set(params.key, { + rect: node.getBoundingClientRect() + }); + + return () => { + if (requested.has(params.key)) { + const { rect } = requested.get(params.key); + requested.delete(params.key); + + return crossfade(rect, node); + } + + // if the node is disappearing altogether + // (i.e. wasn't claimed by the other list) + // then we need to supply an outro + provided.delete(params.key); + return fallback(node, params); + }; + }, + + receive(node, params) { + requested.set(params.key, { + rect: node.getBoundingClientRect() + }); + + return () => { + if (provided.has(params.key)) { + const { rect } = provided.get(params.key); + provided.delete(params.key); + + return crossfade(rect, node); + } + + requested.delete(params.key); + return fallback(node, params); + }; + } + }; +} \ No newline at end of file diff --git a/site/content/examples/10-animations/00-animate/meta.json b/site/content/examples/10-animations/00-animate/meta.json new file mode 100644 index 000000000000..dd7e34544306 --- /dev/null +++ b/site/content/examples/10-animations/00-animate/meta.json @@ -0,0 +1,3 @@ +{ + "title": "The animate directive" +} \ No newline at end of file diff --git a/site/content/examples/10-animations/meta.json b/site/content/examples/10-animations/meta.json new file mode 100644 index 000000000000..c71301495eef --- /dev/null +++ b/site/content/examples/10-animations/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Animations" +} \ No newline at end of file diff --git a/site/content/examples/svg-clock/App.svelte b/site/content/examples/11-svg/01-clock/App.svelte similarity index 98% rename from site/content/examples/svg-clock/App.svelte rename to site/content/examples/11-svg/01-clock/App.svelte index b83da1c203e6..49d3a7f8093b 100644 --- a/site/content/examples/svg-clock/App.svelte +++ b/site/content/examples/11-svg/01-clock/App.svelte @@ -20,6 +20,44 @@ }); + + @@ -63,35 +101,4 @@ - - - \ No newline at end of file + \ No newline at end of file diff --git a/site/content/examples/11-svg/01-clock/meta.json b/site/content/examples/11-svg/01-clock/meta.json new file mode 100644 index 000000000000..ec7137feb682 --- /dev/null +++ b/site/content/examples/11-svg/01-clock/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Clock" +} \ No newline at end of file diff --git a/site/content/examples/bar-chart/App.svelte b/site/content/examples/11-svg/02-bar-chart/App.svelte similarity index 89% rename from site/content/examples/bar-chart/App.svelte rename to site/content/examples/11-svg/02-bar-chart/App.svelte index a4b01f97ddb8..e0f27586c3dc 100644 --- a/site/content/examples/bar-chart/App.svelte +++ b/site/content/examples/11-svg/02-bar-chart/App.svelte @@ -1,7 +1,14 @@ -
-

Anscombe's quartet

- - - - - -
- \ No newline at end of file + + +
+

Anscombe's quartet

+ + + + + +
\ No newline at end of file diff --git a/site/content/examples/scatterplot/Scatterplot.svelte b/site/content/examples/11-svg/04-scatterplot/Scatterplot.svelte similarity index 100% rename from site/content/examples/scatterplot/Scatterplot.svelte rename to site/content/examples/11-svg/04-scatterplot/Scatterplot.svelte diff --git a/site/content/examples/11-svg/04-scatterplot/data.js b/site/content/examples/11-svg/04-scatterplot/data.js new file mode 100644 index 000000000000..0faeb976d90e --- /dev/null +++ b/site/content/examples/11-svg/04-scatterplot/data.js @@ -0,0 +1,54 @@ +export default { + a: [ + { x: 10, y: 8.04 }, + { x: 8, y: 6.95 }, + { x: 13, y: 7.58 }, + { x: 9, y: 8.81 }, + { x: 11, y: 8.33 }, + { x: 14, y: 9.96 }, + { x: 6, y: 7.24 }, + { x: 4, y: 4.26 }, + { x: 12, y: 10.84 }, + { x: 7, y: 4.82 }, + { x: 5, y: 5.68 } + ], + b: [ + { x: 10, y: 9.14 }, + { x: 8, y: 8.14 }, + { x: 13, y: 8.74 }, + { x: 9, y: 8.77 }, + { x: 11, y: 9.26 }, + { x: 14, y: 8.1 }, + { x: 6, y: 6.13 }, + { x: 4, y: 3.1 }, + { x: 12, y: 9.13 }, + { x: 7, y: 7.26 }, + { x: 5, y: 4.74 } + ], + c: [ + { x: 10, y: 7.46 }, + { x: 8, y: 6.77 }, + { x: 13, y: 12.74 }, + { x: 9, y: 7.11 }, + { x: 11, y: 7.81 }, + { x: 14, y: 8.84 }, + { x: 6, y: 6.08 }, + { x: 4, y: 5.39 }, + { x: 12, y: 8.15 }, + { x: 7, y: 6.42 }, + { x: 5, y: 5.73 } + ], + d: [ + { x: 8, y: 6.58 }, + { x: 8, y: 5.76 }, + { x: 8, y: 7.71 }, + { x: 8, y: 8.84 }, + { x: 8, y: 8.47 }, + { x: 8, y: 7.04 }, + { x: 8, y: 5.25 }, + { x: 19, y: 12.5 }, + { x: 8, y: 5.56 }, + { x: 8, y: 7.91 }, + { x: 8, y: 6.89 } + ] +}; \ No newline at end of file diff --git a/site/content/examples/11-svg/04-scatterplot/meta.json b/site/content/examples/11-svg/04-scatterplot/meta.json new file mode 100644 index 000000000000..52a4c119bcec --- /dev/null +++ b/site/content/examples/11-svg/04-scatterplot/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Scatterplot" +} \ No newline at end of file diff --git a/site/content/examples/homepage-demo-transitions/App.svelte b/site/content/examples/11-svg/05-svg-transitions/App.svelte similarity index 100% rename from site/content/examples/homepage-demo-transitions/App.svelte rename to site/content/examples/11-svg/05-svg-transitions/App.svelte diff --git a/site/content/examples/homepage-demo-transitions/custom-transitions.js b/site/content/examples/11-svg/05-svg-transitions/custom-transitions.js similarity index 100% rename from site/content/examples/homepage-demo-transitions/custom-transitions.js rename to site/content/examples/11-svg/05-svg-transitions/custom-transitions.js diff --git a/site/content/examples/11-svg/05-svg-transitions/meta.json b/site/content/examples/11-svg/05-svg-transitions/meta.json new file mode 100644 index 000000000000..aa14d1a3d475 --- /dev/null +++ b/site/content/examples/11-svg/05-svg-transitions/meta.json @@ -0,0 +1,3 @@ +{ + "title": "SVG transitions" +} \ No newline at end of file diff --git a/site/content/examples/homepage-demo-transitions/shape.js b/site/content/examples/11-svg/05-svg-transitions/shape.js similarity index 86% rename from site/content/examples/homepage-demo-transitions/shape.js rename to site/content/examples/11-svg/05-svg-transitions/shape.js index 032a58bf24f4..9ed2128ebe8a 100644 --- a/site/content/examples/homepage-demo-transitions/shape.js +++ b/site/content/examples/11-svg/05-svg-transitions/shape.js @@ -1,5 +1,2 @@ export const inner = `M45.41,108.86A21.81,21.81,0,0,1,22,100.18,20.2,20.2,0,0,1,18.53,84.9a19,19,0,0,1,.65-2.57l.52-1.58,1.41,1a35.32,35.32,0,0,0,10.75,5.37l1,.31-.1,1a6.2,6.2,0,0,0,1.11,4.08A6.57,6.57,0,0,0,41,95.19a6,6,0,0,0,1.68-.74L70.11,76.94a5.76,5.76,0,0,0,2.59-3.83,6.09,6.09,0,0,0-1-4.6,6.58,6.58,0,0,0-7.06-2.62,6.21,6.21,0,0,0-1.69.74L52.43,73.31a19.88,19.88,0,0,1-5.58,2.45,21.82,21.82,0,0,1-23.43-8.68A20.2,20.2,0,0,1,20,51.8a19,19,0,0,1,8.56-12.7L56,21.59a19.88,19.88,0,0,1,5.58-2.45A21.81,21.81,0,0,1,85,27.82,20.2,20.2,0,0,1,88.47,43.1a19,19,0,0,1-.65,2.57l-.52,1.58-1.41-1a35.32,35.32,0,0,0-10.75-5.37l-1-.31.1-1a6.2,6.2,0,0,0-1.11-4.08,6.57,6.57,0,0,0-7.06-2.62,6,6,0,0,0-1.68.74L36.89,51.06a5.71,5.71,0,0,0-2.58,3.83,6,6,0,0,0,1,4.6,6.58,6.58,0,0,0,7.06,2.62,6.21,6.21,0,0,0,1.69-.74l10.48-6.68a19.88,19.88,0,0,1,5.58-2.45,21.82,21.82,0,0,1,23.43,8.68A20.2,20.2,0,0,1,87,76.2a19,19,0,0,1-8.56,12.7L51,106.41a19.88,19.88,0,0,1-5.58,2.45`; - -export const outer = ` - M65,34 L37,52 A1 1 0 0 0 44 60 L70.5,44.5 A1 1 0 0 0 65,34Z - M64,67 L36,85 A1 1 0 0 0 42 94 L68,77.5 A1 1 0 0 0 64,67Z`; \ No newline at end of file +export const outer = `M65,34 L37,52 A1 1 0 0 0 44 60 L70.5,44.5 A1 1 0 0 0 65,34Z M64,67 L36,85 A1 1 0 0 0 42 94 L68,77.5 A1 1 0 0 0 64,67Z`; \ No newline at end of file diff --git a/site/content/examples/11-svg/meta.json b/site/content/examples/11-svg/meta.json new file mode 100644 index 000000000000..a26780dfc815 --- /dev/null +++ b/site/content/examples/11-svg/meta.json @@ -0,0 +1,3 @@ +{ + "title": "SVG" +} \ No newline at end of file diff --git a/site/content/examples/12-actions/00-actions/App.svelte b/site/content/examples/12-actions/00-actions/App.svelte new file mode 100644 index 000000000000..1324277bac6a --- /dev/null +++ b/site/content/examples/12-actions/00-actions/App.svelte @@ -0,0 +1,49 @@ + + + + +
\ No newline at end of file diff --git a/site/content/examples/12-actions/00-actions/meta.json b/site/content/examples/12-actions/00-actions/meta.json new file mode 100644 index 000000000000..463fc963af69 --- /dev/null +++ b/site/content/examples/12-actions/00-actions/meta.json @@ -0,0 +1,3 @@ +{ + "title": "The use directive" +} \ No newline at end of file diff --git a/site/content/examples/12-actions/00-actions/pannable.js b/site/content/examples/12-actions/00-actions/pannable.js new file mode 100644 index 000000000000..f7d15328be51 --- /dev/null +++ b/site/content/examples/12-actions/00-actions/pannable.js @@ -0,0 +1,47 @@ +export function pannable(node) { + let x; + let y; + + function handleMousedown(event) { + x = event.clientX; + y = event.clientY; + + node.dispatchEvent(new CustomEvent('panstart', { + detail: { x, y } + })); + + window.addEventListener('mousemove', handleMousemove); + window.addEventListener('mouseup', handleMouseup); + } + + function handleMousemove(event) { + const dx = event.clientX - x; + const dy = event.clientY - y; + x = event.clientX; + y = event.clientY; + + node.dispatchEvent(new CustomEvent('panmove', { + detail: { x, y, dx, dy } + })); + } + + function handleMouseup(event) { + x = event.clientX; + y = event.clientY; + + node.dispatchEvent(new CustomEvent('panend', { + detail: { x, y } + })); + + window.removeEventListener('mousemove', handleMousemove); + window.removeEventListener('mouseup', handleMouseup); + } + + node.addEventListener('mousedown', handleMousedown); + + return { + destroy() { + node.removeEventListener('mousedown', handleMousedown); + } + }; +} \ No newline at end of file diff --git a/site/content/examples/12-actions/01-adding-parameters-to-actions/App.svelte b/site/content/examples/12-actions/01-adding-parameters-to-actions/App.svelte new file mode 100644 index 000000000000..0bd9d56113fc --- /dev/null +++ b/site/content/examples/12-actions/01-adding-parameters-to-actions/App.svelte @@ -0,0 +1,70 @@ + + + \ No newline at end of file diff --git a/site/content/examples/12-actions/01-adding-parameters-to-actions/meta.json b/site/content/examples/12-actions/01-adding-parameters-to-actions/meta.json new file mode 100644 index 000000000000..517bc54c3cac --- /dev/null +++ b/site/content/examples/12-actions/01-adding-parameters-to-actions/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Adding parameters" +} \ No newline at end of file diff --git a/site/content/examples/12-actions/meta.json b/site/content/examples/12-actions/meta.json new file mode 100644 index 000000000000..a15461028365 --- /dev/null +++ b/site/content/examples/12-actions/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Actions" +} \ No newline at end of file diff --git a/site/content/examples/13-classes/00-classes/App.svelte b/site/content/examples/13-classes/00-classes/App.svelte new file mode 100644 index 000000000000..4da386991d5d --- /dev/null +++ b/site/content/examples/13-classes/00-classes/App.svelte @@ -0,0 +1,29 @@ + + + + + + + + + \ No newline at end of file diff --git a/site/content/examples/13-classes/00-classes/meta.json b/site/content/examples/13-classes/00-classes/meta.json new file mode 100644 index 000000000000..7641cc6a5a87 --- /dev/null +++ b/site/content/examples/13-classes/00-classes/meta.json @@ -0,0 +1,3 @@ +{ + "title": "The class directive" +} \ No newline at end of file diff --git a/site/content/examples/13-classes/01-class-shorthand/App.svelte b/site/content/examples/13-classes/01-class-shorthand/App.svelte new file mode 100644 index 000000000000..0f4e0d9f2438 --- /dev/null +++ b/site/content/examples/13-classes/01-class-shorthand/App.svelte @@ -0,0 +1,18 @@ + + + + + + +
+ some {big ? 'big' : 'small'} text +
\ No newline at end of file diff --git a/site/content/examples/13-classes/01-class-shorthand/meta.json b/site/content/examples/13-classes/01-class-shorthand/meta.json new file mode 100644 index 000000000000..72c51bd387ce --- /dev/null +++ b/site/content/examples/13-classes/01-class-shorthand/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Shorthand class directive" +} \ No newline at end of file diff --git a/site/content/examples/13-classes/meta.json b/site/content/examples/13-classes/meta.json new file mode 100644 index 000000000000..9c2b8a41f67b --- /dev/null +++ b/site/content/examples/13-classes/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Classes" +} \ No newline at end of file diff --git a/site/content/examples/14-composition/00-slots/App.svelte b/site/content/examples/14-composition/00-slots/App.svelte new file mode 100644 index 000000000000..cd0ebde93546 --- /dev/null +++ b/site/content/examples/14-composition/00-slots/App.svelte @@ -0,0 +1,8 @@ + + + +

Hello!

+

This is a box. It can contain anything.

+
\ No newline at end of file diff --git a/site/content/examples/14-composition/00-slots/Box.svelte b/site/content/examples/14-composition/00-slots/Box.svelte new file mode 100644 index 000000000000..7ed13f386fe9 --- /dev/null +++ b/site/content/examples/14-composition/00-slots/Box.svelte @@ -0,0 +1,14 @@ + + +
+ +
\ No newline at end of file diff --git a/site/content/examples/14-composition/00-slots/meta.json b/site/content/examples/14-composition/00-slots/meta.json new file mode 100644 index 000000000000..bd30c8935ac3 --- /dev/null +++ b/site/content/examples/14-composition/00-slots/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Slots" +} \ No newline at end of file diff --git a/site/content/examples/14-composition/01-slot-fallbacks/App.svelte b/site/content/examples/14-composition/01-slot-fallbacks/App.svelte new file mode 100644 index 000000000000..e30be6d1fc2e --- /dev/null +++ b/site/content/examples/14-composition/01-slot-fallbacks/App.svelte @@ -0,0 +1,10 @@ + + + +

Hello!

+

This is a box. It can contain anything.

+
+ + \ No newline at end of file diff --git a/site/content/examples/14-composition/01-slot-fallbacks/Box.svelte b/site/content/examples/14-composition/01-slot-fallbacks/Box.svelte new file mode 100644 index 000000000000..66c580632cc2 --- /dev/null +++ b/site/content/examples/14-composition/01-slot-fallbacks/Box.svelte @@ -0,0 +1,16 @@ + + +
+ + no content was provided + +
\ No newline at end of file diff --git a/site/content/examples/14-composition/01-slot-fallbacks/meta.json b/site/content/examples/14-composition/01-slot-fallbacks/meta.json new file mode 100644 index 000000000000..26e7fcfb9253 --- /dev/null +++ b/site/content/examples/14-composition/01-slot-fallbacks/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Slot fallbacks" +} \ No newline at end of file diff --git a/site/content/examples/14-composition/02-named-slots/App.svelte b/site/content/examples/14-composition/02-named-slots/App.svelte new file mode 100644 index 000000000000..80478093590a --- /dev/null +++ b/site/content/examples/14-composition/02-named-slots/App.svelte @@ -0,0 +1,14 @@ + + + + + P. Sherman + + + + 42 Wallaby Way
+ Sydney +
+
\ No newline at end of file diff --git a/site/content/examples/14-composition/02-named-slots/ContactCard.svelte b/site/content/examples/14-composition/02-named-slots/ContactCard.svelte new file mode 100644 index 000000000000..1acf2909430f --- /dev/null +++ b/site/content/examples/14-composition/02-named-slots/ContactCard.svelte @@ -0,0 +1,47 @@ + + +
+

+ + Unknown name + +

+ +
+ + Unknown address + +
+ + +
\ No newline at end of file diff --git a/site/content/examples/14-composition/02-named-slots/meta.json b/site/content/examples/14-composition/02-named-slots/meta.json new file mode 100644 index 000000000000..60b82e991c11 --- /dev/null +++ b/site/content/examples/14-composition/02-named-slots/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Named slots" +} \ No newline at end of file diff --git a/site/content/examples/14-composition/03-slot-props/App.svelte b/site/content/examples/14-composition/03-slot-props/App.svelte new file mode 100644 index 000000000000..36772a507749 --- /dev/null +++ b/site/content/examples/14-composition/03-slot-props/App.svelte @@ -0,0 +1,46 @@ + + + + + +
+ {#if active} +

I am being hovered upon.

+ {:else} +

Hover over me!

+ {/if} +
+
+ + +
+ {#if active} +

I am being hovered upon.

+ {:else} +

Hover over me!

+ {/if} +
+
+ + +
+ {#if active} +

I am being hovered upon.

+ {:else} +

Hover over me!

+ {/if} +
+
\ No newline at end of file diff --git a/site/content/examples/14-composition/03-slot-props/Hoverable.svelte b/site/content/examples/14-composition/03-slot-props/Hoverable.svelte new file mode 100644 index 000000000000..69f2fc8ef6d9 --- /dev/null +++ b/site/content/examples/14-composition/03-slot-props/Hoverable.svelte @@ -0,0 +1,15 @@ + + +
+ +
\ No newline at end of file diff --git a/site/content/examples/14-composition/03-slot-props/meta.json b/site/content/examples/14-composition/03-slot-props/meta.json new file mode 100644 index 000000000000..74e2ff197c45 --- /dev/null +++ b/site/content/examples/14-composition/03-slot-props/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Slot props" +} \ No newline at end of file diff --git a/site/content/examples/modal-with-slot/App.svelte b/site/content/examples/14-composition/04-modal/App.svelte similarity index 97% rename from site/content/examples/modal-with-slot/App.svelte rename to site/content/examples/14-composition/04-modal/App.svelte index 665a89554e8e..ac9d441f52b9 100644 --- a/site/content/examples/modal-with-slot/App.svelte +++ b/site/content/examples/14-composition/04-modal/App.svelte @@ -1,7 +1,7 @@ {#if showModal} diff --git a/site/content/examples/modal-with-slot/Modal.svelte b/site/content/examples/14-composition/04-modal/Modal.svelte similarity index 100% rename from site/content/examples/modal-with-slot/Modal.svelte rename to site/content/examples/14-composition/04-modal/Modal.svelte index 87f1b022990c..5ffa5989a41d 100644 --- a/site/content/examples/modal-with-slot/Modal.svelte +++ b/site/content/examples/14-composition/04-modal/Modal.svelte @@ -4,17 +4,6 @@ const dispatch = createEventDispatcher(); - - - - + + + + diff --git a/site/content/examples/14-composition/04-modal/meta.json b/site/content/examples/14-composition/04-modal/meta.json new file mode 100644 index 000000000000..c39791fcf601 --- /dev/null +++ b/site/content/examples/14-composition/04-modal/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Modal" +} \ No newline at end of file diff --git a/site/content/examples/14-composition/meta.json b/site/content/examples/14-composition/meta.json new file mode 100644 index 000000000000..54cf2db82dfa --- /dev/null +++ b/site/content/examples/14-composition/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Component composition" +} \ No newline at end of file diff --git a/site/content/examples/15-context/00-context-api/App.svelte b/site/content/examples/15-context/00-context-api/App.svelte new file mode 100644 index 000000000000..ea1ba4c7ae7c --- /dev/null +++ b/site/content/examples/15-context/00-context-api/App.svelte @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/site/content/examples/15-context/00-context-api/Map.svelte b/site/content/examples/15-context/00-context-api/Map.svelte new file mode 100644 index 000000000000..0282cbc31166 --- /dev/null +++ b/site/content/examples/15-context/00-context-api/Map.svelte @@ -0,0 +1,50 @@ + + + + +
+ {#if map} + + {/if} +
\ No newline at end of file diff --git a/site/content/examples/15-context/00-context-api/MapMarker.svelte b/site/content/examples/15-context/00-context-api/MapMarker.svelte new file mode 100644 index 000000000000..c9366525077f --- /dev/null +++ b/site/content/examples/15-context/00-context-api/MapMarker.svelte @@ -0,0 +1,19 @@ + \ No newline at end of file diff --git a/site/content/examples/15-context/00-context-api/mapbox.js b/site/content/examples/15-context/00-context-api/mapbox.js new file mode 100644 index 000000000000..55b4200038a4 --- /dev/null +++ b/site/content/examples/15-context/00-context-api/mapbox.js @@ -0,0 +1,8 @@ +import mapbox from 'mapbox-gl'; + +// https://docs.mapbox.com/help/glossary/access-token/ +mapbox.accessToken = MAPBOX_ACCESS_TOKEN; + +const key = {}; + +export { mapbox, key }; \ No newline at end of file diff --git a/site/content/examples/15-context/00-context-api/meta.json b/site/content/examples/15-context/00-context-api/meta.json new file mode 100644 index 000000000000..2601c87cae0e --- /dev/null +++ b/site/content/examples/15-context/00-context-api/meta.json @@ -0,0 +1,3 @@ +{ + "title": "setContext and getContext" +} \ No newline at end of file diff --git a/site/content/examples/15-context/meta.json b/site/content/examples/15-context/meta.json new file mode 100644 index 000000000000..d3bd862676a2 --- /dev/null +++ b/site/content/examples/15-context/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Context API" +} \ No newline at end of file diff --git a/site/content/examples/16-special-elements/00-svelte-self/App.svelte b/site/content/examples/16-special-elements/00-svelte-self/App.svelte new file mode 100644 index 000000000000..ff02fa6a42f9 --- /dev/null +++ b/site/content/examples/16-special-elements/00-svelte-self/App.svelte @@ -0,0 +1,41 @@ + + + \ No newline at end of file diff --git a/site/content/examples/16-special-elements/00-svelte-self/File.svelte b/site/content/examples/16-special-elements/00-svelte-self/File.svelte new file mode 100644 index 000000000000..e34686101a82 --- /dev/null +++ b/site/content/examples/16-special-elements/00-svelte-self/File.svelte @@ -0,0 +1,14 @@ + + + + +{name} \ No newline at end of file diff --git a/site/content/examples/16-special-elements/00-svelte-self/Folder.svelte b/site/content/examples/16-special-elements/00-svelte-self/Folder.svelte new file mode 100644 index 000000000000..c25bb2a93dfe --- /dev/null +++ b/site/content/examples/16-special-elements/00-svelte-self/Folder.svelte @@ -0,0 +1,52 @@ + + + + +{name} + +{#if expanded} +
    + {#each files as file} +
  • + {#if file.type === 'folder'} + + {:else} + + {/if} +
  • + {/each} +
+{/if} \ No newline at end of file diff --git a/site/content/examples/16-special-elements/00-svelte-self/meta.json b/site/content/examples/16-special-elements/00-svelte-self/meta.json new file mode 100644 index 000000000000..14485d7cee00 --- /dev/null +++ b/site/content/examples/16-special-elements/00-svelte-self/meta.json @@ -0,0 +1,3 @@ +{ + "title": "" +} \ No newline at end of file diff --git a/site/content/examples/16-special-elements/01-svelte-component/App.svelte b/site/content/examples/16-special-elements/01-svelte-component/App.svelte new file mode 100644 index 000000000000..a510fa8ad8b5 --- /dev/null +++ b/site/content/examples/16-special-elements/01-svelte-component/App.svelte @@ -0,0 +1,21 @@ + + + + + \ No newline at end of file diff --git a/site/content/examples/16-special-elements/01-svelte-component/BlueThing.svelte b/site/content/examples/16-special-elements/01-svelte-component/BlueThing.svelte new file mode 100644 index 000000000000..f9130d9d653f --- /dev/null +++ b/site/content/examples/16-special-elements/01-svelte-component/BlueThing.svelte @@ -0,0 +1,5 @@ + + +blue thing \ No newline at end of file diff --git a/site/content/examples/16-special-elements/01-svelte-component/GreenThing.svelte b/site/content/examples/16-special-elements/01-svelte-component/GreenThing.svelte new file mode 100644 index 000000000000..9cbee235d368 --- /dev/null +++ b/site/content/examples/16-special-elements/01-svelte-component/GreenThing.svelte @@ -0,0 +1,5 @@ + + +green thing \ No newline at end of file diff --git a/site/content/examples/16-special-elements/01-svelte-component/RedThing.svelte b/site/content/examples/16-special-elements/01-svelte-component/RedThing.svelte new file mode 100644 index 000000000000..42f5e4c6724d --- /dev/null +++ b/site/content/examples/16-special-elements/01-svelte-component/RedThing.svelte @@ -0,0 +1,5 @@ + + +red thing \ No newline at end of file diff --git a/site/content/examples/16-special-elements/01-svelte-component/meta.json b/site/content/examples/16-special-elements/01-svelte-component/meta.json new file mode 100644 index 000000000000..bb3675d5e5f3 --- /dev/null +++ b/site/content/examples/16-special-elements/01-svelte-component/meta.json @@ -0,0 +1,3 @@ +{ + "title": "" +} \ No newline at end of file diff --git a/site/content/examples/16-special-elements/02-svelte-window/App.svelte b/site/content/examples/16-special-elements/02-svelte-window/App.svelte new file mode 100644 index 000000000000..845d666dffe0 --- /dev/null +++ b/site/content/examples/16-special-elements/02-svelte-window/App.svelte @@ -0,0 +1,42 @@ + + + + + + +
+ {#if key} + {key === ' ' ? 'Space' : key} +

{keyCode}

+ {:else} +

Focus this window and press any key

+ {/if} +
\ No newline at end of file diff --git a/site/content/examples/16-special-elements/02-svelte-window/meta.json b/site/content/examples/16-special-elements/02-svelte-window/meta.json new file mode 100644 index 000000000000..18357e9ef94c --- /dev/null +++ b/site/content/examples/16-special-elements/02-svelte-window/meta.json @@ -0,0 +1,3 @@ +{ + "title": "" +} \ No newline at end of file diff --git a/site/content/examples/16-special-elements/03-svelte-window-bindings/App.svelte b/site/content/examples/16-special-elements/03-svelte-window-bindings/App.svelte new file mode 100644 index 000000000000..3dbfd43f218e --- /dev/null +++ b/site/content/examples/16-special-elements/03-svelte-window-bindings/App.svelte @@ -0,0 +1,88 @@ + + + + + + {#each [0, 1, 2, 3, 4, 5, 6, 7, 8] as layer} + parallax layer {layer} + {/each} + + +
+ + scroll down + + +
+ You have scrolled {y} pixels +
+
+ + diff --git a/site/content/examples/16-special-elements/03-svelte-window-bindings/meta.json b/site/content/examples/16-special-elements/03-svelte-window-bindings/meta.json new file mode 100644 index 000000000000..9903a804bbf9 --- /dev/null +++ b/site/content/examples/16-special-elements/03-svelte-window-bindings/meta.json @@ -0,0 +1,3 @@ +{ + "title": " bindings" +} \ No newline at end of file diff --git a/site/content/examples/16-special-elements/04-svelte-body/App.svelte b/site/content/examples/16-special-elements/04-svelte-body/App.svelte new file mode 100644 index 000000000000..ac946962ebe7 --- /dev/null +++ b/site/content/examples/16-special-elements/04-svelte-body/App.svelte @@ -0,0 +1,37 @@ + + + + + + + +Kitten wants to know what's going on \ No newline at end of file diff --git a/site/content/examples/16-special-elements/04-svelte-body/meta.json b/site/content/examples/16-special-elements/04-svelte-body/meta.json new file mode 100644 index 000000000000..a140d2c16854 --- /dev/null +++ b/site/content/examples/16-special-elements/04-svelte-body/meta.json @@ -0,0 +1,3 @@ +{ + "title": "" +} \ No newline at end of file diff --git a/site/content/examples/16-special-elements/05-svelte-head/App.svelte b/site/content/examples/16-special-elements/05-svelte-head/App.svelte new file mode 100644 index 000000000000..38089c9fdd30 --- /dev/null +++ b/site/content/examples/16-special-elements/05-svelte-head/App.svelte @@ -0,0 +1,5 @@ + + + + +

Hello world!

\ No newline at end of file diff --git a/site/content/examples/16-special-elements/05-svelte-head/meta.json b/site/content/examples/16-special-elements/05-svelte-head/meta.json new file mode 100644 index 000000000000..d35a752d152d --- /dev/null +++ b/site/content/examples/16-special-elements/05-svelte-head/meta.json @@ -0,0 +1,3 @@ +{ + "title": "" +} \ No newline at end of file diff --git a/site/content/examples/16-special-elements/06-svelte-options/App.svelte b/site/content/examples/16-special-elements/06-svelte-options/App.svelte new file mode 100644 index 000000000000..e0051449eee1 --- /dev/null +++ b/site/content/examples/16-special-elements/06-svelte-options/App.svelte @@ -0,0 +1,14 @@ + + + + + + + \ No newline at end of file diff --git a/site/content/examples/16-special-elements/06-svelte-options/Square.svelte b/site/content/examples/16-special-elements/06-svelte-options/Square.svelte new file mode 100644 index 000000000000..38f26d1dbacb --- /dev/null +++ b/site/content/examples/16-special-elements/06-svelte-options/Square.svelte @@ -0,0 +1,15 @@ + + + + + diff --git a/site/content/examples/16-special-elements/06-svelte-options/meta.json b/site/content/examples/16-special-elements/06-svelte-options/meta.json new file mode 100644 index 000000000000..242c00685069 --- /dev/null +++ b/site/content/examples/16-special-elements/06-svelte-options/meta.json @@ -0,0 +1,3 @@ +{ + "title": "" +} \ No newline at end of file diff --git a/site/content/examples/16-special-elements/meta.json b/site/content/examples/16-special-elements/meta.json new file mode 100644 index 000000000000..2718c14b5984 --- /dev/null +++ b/site/content/examples/16-special-elements/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Special elements" +} \ No newline at end of file diff --git a/site/content/examples/17-module-context/00-sharing-code/App.svelte b/site/content/examples/17-module-context/00-sharing-code/App.svelte new file mode 100644 index 000000000000..3c0133350a4f --- /dev/null +++ b/site/content/examples/17-module-context/00-sharing-code/App.svelte @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + diff --git a/site/content/examples/17-module-context/00-sharing-code/AudioPlayer.svelte b/site/content/examples/17-module-context/00-sharing-code/AudioPlayer.svelte new file mode 100644 index 000000000000..27dbe1993ba2 --- /dev/null +++ b/site/content/examples/17-module-context/00-sharing-code/AudioPlayer.svelte @@ -0,0 +1,46 @@ + + + + + + +
+

{title}

+

{composer} / performed by {performer}

+ + +
\ No newline at end of file diff --git a/site/content/examples/17-module-context/00-sharing-code/meta.json b/site/content/examples/17-module-context/00-sharing-code/meta.json new file mode 100644 index 000000000000..15c3725377e0 --- /dev/null +++ b/site/content/examples/17-module-context/00-sharing-code/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Sharing code" +} \ No newline at end of file diff --git a/site/content/examples/17-module-context/01-module-exports/App.svelte b/site/content/examples/17-module-context/01-module-exports/App.svelte new file mode 100644 index 000000000000..cd5ab44b211f --- /dev/null +++ b/site/content/examples/17-module-context/01-module-exports/App.svelte @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + diff --git a/site/content/examples/17-module-context/01-module-exports/AudioPlayer.svelte b/site/content/examples/17-module-context/01-module-exports/AudioPlayer.svelte new file mode 100644 index 000000000000..4e3d191dbf69 --- /dev/null +++ b/site/content/examples/17-module-context/01-module-exports/AudioPlayer.svelte @@ -0,0 +1,52 @@ + + + + + + +
+

{title}

+

{composer} / performed by {performer}

+ + +
\ No newline at end of file diff --git a/site/content/examples/17-module-context/01-module-exports/meta.json b/site/content/examples/17-module-context/01-module-exports/meta.json new file mode 100644 index 000000000000..82be49d1c75f --- /dev/null +++ b/site/content/examples/17-module-context/01-module-exports/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Exports" +} \ No newline at end of file diff --git a/site/content/examples/17-module-context/meta.json b/site/content/examples/17-module-context/meta.json new file mode 100644 index 000000000000..1a8720e2ce51 --- /dev/null +++ b/site/content/examples/17-module-context/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Module context" +} \ No newline at end of file diff --git a/site/content/examples/18-debugging/00-debug/App.svelte b/site/content/examples/18-debugging/00-debug/App.svelte new file mode 100644 index 000000000000..1b91ac740b72 --- /dev/null +++ b/site/content/examples/18-debugging/00-debug/App.svelte @@ -0,0 +1,13 @@ + + + + + +{@debug user} + +

Hello {user.firstname}!

\ No newline at end of file diff --git a/site/content/examples/18-debugging/00-debug/meta.json b/site/content/examples/18-debugging/00-debug/meta.json new file mode 100644 index 000000000000..44ad7690243c --- /dev/null +++ b/site/content/examples/18-debugging/00-debug/meta.json @@ -0,0 +1,3 @@ +{ + "title": "The @debug tag" +} \ No newline at end of file diff --git a/site/content/examples/18-debugging/meta.json b/site/content/examples/18-debugging/meta.json new file mode 100644 index 000000000000..5eeed281d38b --- /dev/null +++ b/site/content/examples/18-debugging/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Debugging" +} \ No newline at end of file diff --git a/site/content/examples/7guis-counter/App.svelte b/site/content/examples/19-7guis/01-7guis-counter/App.svelte similarity index 80% rename from site/content/examples/7guis-counter/App.svelte rename to site/content/examples/19-7guis/01-7guis-counter/App.svelte index 385a3c97499c..11c5993901da 100644 --- a/site/content/examples/7guis-counter/App.svelte +++ b/site/content/examples/19-7guis/01-7guis-counter/App.svelte @@ -1,3 +1,7 @@ + + \ No newline at end of file diff --git a/site/content/examples/19-7guis/01-7guis-counter/meta.json b/site/content/examples/19-7guis/01-7guis-counter/meta.json new file mode 100644 index 000000000000..a3c3ba33c2b4 --- /dev/null +++ b/site/content/examples/19-7guis/01-7guis-counter/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Counter" +} \ No newline at end of file diff --git a/site/content/examples/7guis-temperature/App.svelte b/site/content/examples/19-7guis/02-7guis-temperature/App.svelte similarity index 100% rename from site/content/examples/7guis-temperature/App.svelte rename to site/content/examples/19-7guis/02-7guis-temperature/App.svelte diff --git a/site/content/examples/19-7guis/02-7guis-temperature/meta.json b/site/content/examples/19-7guis/02-7guis-temperature/meta.json new file mode 100644 index 000000000000..3a578f388717 --- /dev/null +++ b/site/content/examples/19-7guis/02-7guis-temperature/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Temperature Converter" +} \ No newline at end of file diff --git a/site/content/examples/7guis-flight-booker/App.svelte b/site/content/examples/19-7guis/03-7guis-flight-booker/App.svelte similarity index 100% rename from site/content/examples/7guis-flight-booker/App.svelte rename to site/content/examples/19-7guis/03-7guis-flight-booker/App.svelte diff --git a/site/content/examples/19-7guis/03-7guis-flight-booker/meta.json b/site/content/examples/19-7guis/03-7guis-flight-booker/meta.json new file mode 100644 index 000000000000..8f546a740cfa --- /dev/null +++ b/site/content/examples/19-7guis/03-7guis-flight-booker/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Flight booker" +} \ No newline at end of file diff --git a/site/content/examples/7guis-timer/App.svelte b/site/content/examples/19-7guis/04-7guis-timer/App.svelte similarity index 100% rename from site/content/examples/7guis-timer/App.svelte rename to site/content/examples/19-7guis/04-7guis-timer/App.svelte diff --git a/site/content/examples/19-7guis/04-7guis-timer/meta.json b/site/content/examples/19-7guis/04-7guis-timer/meta.json new file mode 100644 index 000000000000..516b8bc3c265 --- /dev/null +++ b/site/content/examples/19-7guis/04-7guis-timer/meta.json @@ -0,0 +1,3 @@ +{ + "title": "Timer" +} \ No newline at end of file diff --git a/site/content/examples/7guis-crud/App.svelte b/site/content/examples/19-7guis/05-7guis-crud/App.svelte similarity index 91% rename from site/content/examples/7guis-crud/App.svelte rename to site/content/examples/19-7guis/05-7guis-crud/App.svelte index 388a2f4ea3a7..ed53430eff40 100644 --- a/site/content/examples/7guis-crud/App.svelte +++ b/site/content/examples/19-7guis/05-7guis-crud/App.svelte @@ -1,7 +1,20 @@ - - - -{#if promise} - {#await promise} -

wait for it...

- {:then answer} -

the answer is {answer}!

- {:catch error} -

well that's odd

- {/await} -{/if} diff --git a/site/content/examples/await-block/data.json5 b/site/content/examples/await-block/data.json5 deleted file mode 100644 index 9e26dfeeb6e6..000000000000 --- a/site/content/examples/await-block/data.json5 +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/site/content/examples/bar-chart/data.json5 b/site/content/examples/bar-chart/data.json5 deleted file mode 100644 index 389c90a7d170..000000000000 --- a/site/content/examples/bar-chart/data.json5 +++ /dev/null @@ -1,28 +0,0 @@ -{ - "points": [ - { - "year": 1990, - "birthrate": 16.7 - }, - { - "year": 1995, - "birthrate": 14.6 - }, - { - "year": 2000, - "birthrate": 14.4 - }, - { - "year": 2005, - "birthrate": 14 - }, - { - "year": 2010, - "birthrate": 13 - }, - { - "year": 2015, - "birthrate": 12.4 - } - ] -} \ No newline at end of file diff --git a/site/content/examples/binding-input-checkbox-group/App.svelte b/site/content/examples/binding-input-checkbox-group/App.svelte deleted file mode 100644 index 617e71e17d96..000000000000 --- a/site/content/examples/binding-input-checkbox-group/App.svelte +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - -

{selected.join(', ') || 'nothing'} selected

\ 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 deleted file mode 100644 index 2285e3abfa82..000000000000 --- a/site/content/examples/binding-input-checkbox-group/data.json5 +++ /dev/null @@ -1,3 +0,0 @@ -{ - "selected": ["blue"] -} \ No newline at end of file diff --git a/site/content/examples/binding-input-checkbox/App.svelte b/site/content/examples/binding-input-checkbox/App.svelte deleted file mode 100644 index b8facdd53b58..000000000000 --- a/site/content/examples/binding-input-checkbox/App.svelte +++ /dev/null @@ -1,17 +0,0 @@ -{#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 deleted file mode 100644 index 4afee559a5d0..000000000000 --- a/site/content/examples/binding-input-checkbox/data.json5 +++ /dev/null @@ -1,16 +0,0 @@ -{ - "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.svelte b/site/content/examples/binding-input-numeric/App.svelte deleted file mode 100644 index 566c16006c78..000000000000 --- a/site/content/examples/binding-input-numeric/App.svelte +++ /dev/null @@ -1,12 +0,0 @@ - - - - -

{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 deleted file mode 100644 index 1aa99a76cda8..000000000000 --- a/site/content/examples/binding-input-numeric/data.json5 +++ /dev/null @@ -1,4 +0,0 @@ -{ - "a": 5, - "b": 5 -} \ No newline at end of file diff --git a/site/content/examples/binding-input-radio/App.svelte b/site/content/examples/binding-input-radio/App.svelte deleted file mode 100644 index f83813754ff1..000000000000 --- a/site/content/examples/binding-input-radio/App.svelte +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - -

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 deleted file mode 100644 index 961184190e4d..000000000000 --- a/site/content/examples/binding-input-radio/data.json5 +++ /dev/null @@ -1,3 +0,0 @@ -{ - "selected": "blue" -} \ 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 deleted file mode 100644 index 393554903d00..000000000000 --- a/site/content/examples/binding-input-text/data.json5 +++ /dev/null @@ -1,3 +0,0 @@ -{ - "name": "" -} \ No newline at end of file diff --git a/site/content/examples/binding-media-elements/App.svelte b/site/content/examples/binding-media-elements/App.svelte deleted file mode 100644 index fdfb4573d49a..000000000000 --- a/site/content/examples/binding-media-elements/App.svelte +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - -

THX Deep Note

-
- play/pause button - {format(t)} - {format(d)} -
- -
-

THX Deep Note

-
- play/pause button - {format(t)} - {format(d)} -
-
- - diff --git a/site/content/examples/binding-media-elements/data.json5 b/site/content/examples/binding-media-elements/data.json5 deleted file mode 100644 index 9e26dfeeb6e6..000000000000 --- a/site/content/examples/binding-media-elements/data.json5 +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/site/content/examples/binding-textarea/App.svelte b/site/content/examples/binding-textarea/App.svelte deleted file mode 100644 index 4fd46f262566..000000000000 --- a/site/content/examples/binding-textarea/App.svelte +++ /dev/null @@ -1,15 +0,0 @@ - - - -
{@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 deleted file mode 100644 index 12268060fbd0..000000000000 --- a/site/content/examples/binding-textarea/data.json5 +++ /dev/null @@ -1,3 +0,0 @@ -{ - "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.svelte b/site/content/examples/each-blocks/App.svelte deleted file mode 100644 index b8ba07a5e92a..000000000000 --- a/site/content/examples/each-blocks/App.svelte +++ /dev/null @@ -1,7 +0,0 @@ -

Cats of YouTube

- - \ No newline at end of file diff --git a/site/content/examples/each-blocks/data.json5 b/site/content/examples/each-blocks/data.json5 deleted file mode 100644 index 41eff03354e4..000000000000 --- a/site/content/examples/each-blocks/data.json5 +++ /dev/null @@ -1,16 +0,0 @@ -{ - "cats": [ - { - "name": "Keyboard Cat", - "video": "https://www.youtube.com/watch?v=J---aiyznGQ" - }, - { - "name": "Maru", - "video": "https://www.youtube.com/watch?v=z_AbfPXTKms" - }, - { - "name": "Henri The Existential Cat", - "video": "https://www.youtube.com/watch?v=OUtn3pvWmpg" - } - ] -} \ No newline at end of file diff --git a/site/content/examples/hacker-news/data.json5 b/site/content/examples/hacker-news/data.json5 deleted file mode 100644 index 9e26dfeeb6e6..000000000000 --- a/site/content/examples/hacker-news/data.json5 +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/site/content/examples/hello-world/App.svelte b/site/content/examples/hello-world/App.svelte deleted file mode 100644 index 70a9a95503ed..000000000000 --- a/site/content/examples/hello-world/App.svelte +++ /dev/null @@ -1,14 +0,0 @@ -

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 deleted file mode 100644 index 3949aecc6a89..000000000000 --- a/site/content/examples/hello-world/data.json5 +++ /dev/null @@ -1,3 +0,0 @@ -{ - "name": "world" -} \ No newline at end of file diff --git a/site/content/examples/homepage-demo-hello-world/App.svelte b/site/content/examples/homepage-demo-hello-world/App.svelte deleted file mode 100644 index 543c6059c427..000000000000 --- a/site/content/examples/homepage-demo-hello-world/App.svelte +++ /dev/null @@ -1 +0,0 @@ -

Hello {name}!

\ No newline at end of file diff --git a/site/content/examples/homepage-demo-hello-world/data.json5 b/site/content/examples/homepage-demo-hello-world/data.json5 deleted file mode 100644 index 3949aecc6a89..000000000000 --- a/site/content/examples/homepage-demo-hello-world/data.json5 +++ /dev/null @@ -1,3 +0,0 @@ -{ - "name": "world" -} \ No newline at end of file diff --git a/site/content/examples/homepage-demo-reactivity/data.json5 b/site/content/examples/homepage-demo-reactivity/data.json5 deleted file mode 100644 index 9e26dfeeb6e6..000000000000 --- a/site/content/examples/homepage-demo-reactivity/data.json5 +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/site/content/examples/homepage-demo-scoped-styles/App.svelte b/site/content/examples/homepage-demo-scoped-styles/App.svelte deleted file mode 100644 index b1fe0495a93d..000000000000 --- a/site/content/examples/homepage-demo-scoped-styles/App.svelte +++ /dev/null @@ -1,12 +0,0 @@ - - - - -

this <p> is bold but not red

- \ No newline at end of file diff --git a/site/content/examples/homepage-demo-scoped-styles/Foo.svelte b/site/content/examples/homepage-demo-scoped-styles/Foo.svelte deleted file mode 100644 index eb1dd82f7fb4..000000000000 --- a/site/content/examples/homepage-demo-scoped-styles/Foo.svelte +++ /dev/null @@ -1,7 +0,0 @@ - - -

this <p> is red but not bold

\ No newline at end of file diff --git a/site/content/examples/homepage-demo-scoped-styles/data.json5 b/site/content/examples/homepage-demo-scoped-styles/data.json5 deleted file mode 100644 index 9e26dfeeb6e6..000000000000 --- a/site/content/examples/homepage-demo-scoped-styles/data.json5 +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/site/content/examples/homepage-demo-transitions/data.json5 b/site/content/examples/homepage-demo-transitions/data.json5 deleted file mode 100644 index 9e26dfeeb6e6..000000000000 --- a/site/content/examples/homepage-demo-transitions/data.json5 +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/site/content/examples/if-blocks/App.svelte b/site/content/examples/if-blocks/App.svelte deleted file mode 100644 index 57de21915969..000000000000 --- a/site/content/examples/if-blocks/App.svelte +++ /dev/null @@ -1,5 +0,0 @@ -{#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 deleted file mode 100644 index c803db47493a..000000000000 --- a/site/content/examples/if-blocks/data.json5 +++ /dev/null @@ -1,3 +0,0 @@ -{ - "foo": true -} \ No newline at end of file diff --git a/site/content/examples/immutable/data.json5 b/site/content/examples/immutable/data.json5 deleted file mode 100644 index a0ed59d82bf7..000000000000 --- a/site/content/examples/immutable/data.json5 +++ /dev/null @@ -1,7 +0,0 @@ -{ - 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/line-chart/data.json5 b/site/content/examples/line-chart/data.json5 deleted file mode 100644 index 88e7f02f3512..000000000000 --- a/site/content/examples/line-chart/data.json5 +++ /dev/null @@ -1,156 +0,0 @@ -{ - "points": [ - { - "x": 1979, - "y": 7.19 - }, - { - "x": 1980, - "y": 7.83 - }, - { - "x": 1981, - "y": 7.24 - }, - { - "x": 1982, - "y": 7.44 - }, - { - "x": 1983, - "y": 7.51 - }, - { - "x": 1984, - "y": 7.1 - }, - { - "x": 1985, - "y": 6.91 - }, - { - "x": 1986, - "y": 7.53 - }, - { - "x": 1987, - "y": 7.47 - }, - { - "x": 1988, - "y": 7.48 - }, - { - "x": 1989, - "y": 7.03 - }, - { - "x": 1990, - "y": 6.23 - }, - { - "x": 1991, - "y": 6.54 - }, - { - "x": 1992, - "y": 7.54 - }, - { - "x": 1993, - "y": 6.5 - }, - { - "x": 1994, - "y": 7.18 - }, - { - "x": 1995, - "y": 6.12 - }, - { - "x": 1996, - "y": 7.87 - }, - { - "x": 1997, - "y": 6.73 - }, - { - "x": 1998, - "y": 6.55 - }, - { - "x": 1999, - "y": 6.23 - }, - { - "x": 2000, - "y": 6.31 - }, - { - "x": 2001, - "y": 6.74 - }, - { - "x": 2002, - "y": 5.95 - }, - { - "x": 2003, - "y": 6.13 - }, - { - "x": 2004, - "y": 6.04 - }, - { - "x": 2005, - "y": 5.56 - }, - { - "x": 2006, - "y": 5.91 - }, - { - "x": 2007, - "y": 4.29 - }, - { - "x": 2008, - "y": 4.72 - }, - { - "x": 2009, - "y": 5.38 - }, - { - "x": 2010, - "y": 4.92 - }, - { - "x": 2011, - "y": 4.61 - }, - { - "x": 2012, - "y": 3.62 - }, - { - "x": 2013, - "y": 5.35 - }, - { - "x": 2014, - "y": 5.28 - }, - { - "x": 2015, - "y": 4.63 - }, - { - "x": 2016, - "y": 4.72 - } - ] -} \ No newline at end of file diff --git a/site/content/examples/manifest.json b/site/content/examples/manifest.json deleted file mode 100644 index cc7b2f887bf4..000000000000 --- a/site/content/examples/manifest.json +++ /dev/null @@ -1,184 +0,0 @@ -[ - { - "name": "Basics", - "examples": [ - { - "slug": "hello-world", - "title": "Hello World!" - }, - { - "slug": "if-blocks", - "title": "If blocks" - }, - { - "slug": "each-blocks", - "title": "Each blocks" - }, - { - "slug": "scoped-styles", - "title": "Scoped styles" - } - ] - }, - { - "name": "Two-way bindings", - "examples": [ - { - "slug": "binding-input-text", - "title": "Text input" - }, - { - "slug": "binding-input-numeric", - "title": "Numeric input" - }, - { - "slug": "binding-textarea", - "title": "Textarea" - }, - { - "slug": "binding-input-checkbox", - "title": "Checkbox input" - }, - { - "slug": "binding-input-checkbox-group", - "title": "Checkbox input (grouped)" - }, - { - "slug": "binding-input-radio", - "title": "Radio input" - }, - { - "slug": "binding-media-elements", - "title": "Media elements" - } - ] - }, - { - "name": "Nested components", - "examples": [ - { - "slug": "nested-components", - "title": "Nested components" - }, - { - "slug": "modal-with-slot", - "title": "Modal with " - }, - { - "slug": "self-references", - "title": "Self-references" - } - ] - }, - { - "name": "SVG and dataviz", - "examples": [ - { - "slug": "svg-clock", - "title": "SVG Clock" - }, - { - "slug": "line-chart", - "title": "Line/area chart" - }, - { - "slug": "bar-chart", - "title": "Bar chart" - }, - { - "slug": "scatterplot", - "title": "Scatterplot" - } - ] - }, - { - "name": "Transitions", - "examples": [ - { - "slug": "transitions-fade", - "title": "Simple fade" - }, - { - "slug": "transitions-fly", - "title": "Parameterised" - }, - { - "slug": "transitions-in-out", - "title": "In and out" - }, - { - "slug": "transitions-custom", - "title": "Custom CSS" - } - ] - }, - { - "name": "Motion", - "examples": [ - { - "slug": "motion-spring", - "title": "Spring physics" - } - ] - }, - { - "name": "Async data", - "examples": [ - { - "slug": "await-block", - "title": "Await block" - } - ] - }, - { - "name": "7guis", - "examples": [ - { - "slug": "7guis-counter", - "title": "Counter" - }, - { - "slug": "7guis-temperature", - "title": "Temperature converter" - }, - { - "slug": "7guis-flight-booker", - "title": "Flight booker" - }, - { - "slug": "7guis-timer", - "title": "Timer" - }, - { - "slug": "7guis-crud", - "title": "CRUD" - }, - { - "slug": "7guis-circles", - "title": "Circles" - } - ] - }, - { - "name": "<:Window>", - "examples": [ - { - "slug": "parallax", - "title": "Parallax" - } - ] - }, - { - "name": "Miscellaneous", - "examples": [ - { - "slug": "hacker-news", - "title": "Hacker News" - }, - { - "slug": "immutable", - "title": "Immutable data" - } - ] - } -] diff --git a/site/content/examples/modal-with-slot/data.json5 b/site/content/examples/modal-with-slot/data.json5 deleted file mode 100644 index 18cc32884c26..000000000000 --- a/site/content/examples/modal-with-slot/data.json5 +++ /dev/null @@ -1,3 +0,0 @@ -{ - "showModal": true -} \ No newline at end of file diff --git a/site/content/examples/nested-components/Nested.svelte b/site/content/examples/nested-components/Nested.svelte deleted file mode 100644 index 74ee56a5ed5a..000000000000 --- a/site/content/examples/nested-components/Nested.svelte +++ /dev/null @@ -1 +0,0 @@ -

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 deleted file mode 100644 index 9e26dfeeb6e6..000000000000 --- a/site/content/examples/nested-components/data.json5 +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/site/content/examples/parallax/App.svelte b/site/content/examples/parallax/App.svelte deleted file mode 100644 index 38ffd716b5ad..000000000000 --- a/site/content/examples/parallax/App.svelte +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - -
- - - - - -
- -
- (scroll down) - parallax has never been this easy -
- - diff --git a/site/content/examples/parallax/data.json5 b/site/content/examples/parallax/data.json5 deleted file mode 100644 index 9e26dfeeb6e6..000000000000 --- a/site/content/examples/parallax/data.json5 +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/site/content/examples/scatterplot/data.json5 b/site/content/examples/scatterplot/data.json5 deleted file mode 100644 index 8d879e1edd6c..000000000000 --- a/site/content/examples/scatterplot/data.json5 +++ /dev/null @@ -1,186 +0,0 @@ -{ - "a": [ - { - "x": 10, - "y": 8.04 - }, - { - "x": 8, - "y": 6.95 - }, - { - "x": 13, - "y": 7.58 - }, - { - "x": 9, - "y": 8.81 - }, - { - "x": 11, - "y": 8.33 - }, - { - "x": 14, - "y": 9.96 - }, - { - "x": 6, - "y": 7.24 - }, - { - "x": 4, - "y": 4.26 - }, - { - "x": 12, - "y": 10.84 - }, - { - "x": 7, - "y": 4.82 - }, - { - "x": 5, - "y": 5.68 - } - ], - "b": [ - { - "x": 10, - "y": 9.14 - }, - { - "x": 8, - "y": 8.14 - }, - { - "x": 13, - "y": 8.74 - }, - { - "x": 9, - "y": 8.77 - }, - { - "x": 11, - "y": 9.26 - }, - { - "x": 14, - "y": 8.1 - }, - { - "x": 6, - "y": 6.13 - }, - { - "x": 4, - "y": 3.1 - }, - { - "x": 12, - "y": 9.13 - }, - { - "x": 7, - "y": 7.26 - }, - { - "x": 5, - "y": 4.74 - } - ], - "c": [ - { - "x": 10, - "y": 7.46 - }, - { - "x": 8, - "y": 6.77 - }, - { - "x": 13, - "y": 12.74 - }, - { - "x": 9, - "y": 7.11 - }, - { - "x": 11, - "y": 7.81 - }, - { - "x": 14, - "y": 8.84 - }, - { - "x": 6, - "y": 6.08 - }, - { - "x": 4, - "y": 5.39 - }, - { - "x": 12, - "y": 8.15 - }, - { - "x": 7, - "y": 6.42 - }, - { - "x": 5, - "y": 5.73 - } - ], - "d": [ - { - "x": 8, - "y": 6.58 - }, - { - "x": 8, - "y": 5.76 - }, - { - "x": 8, - "y": 7.71 - }, - { - "x": 8, - "y": 8.84 - }, - { - "x": 8, - "y": 8.47 - }, - { - "x": 8, - "y": 7.04 - }, - { - "x": 8, - "y": 5.25 - }, - { - "x": 19, - "y": 12.5 - }, - { - "x": 8, - "y": 5.56 - }, - { - "x": 8, - "y": 7.91 - }, - { - "x": 8, - "y": 6.89 - } - ] -} \ No newline at end of file diff --git a/site/content/examples/scoped-styles/App.svelte b/site/content/examples/scoped-styles/App.svelte deleted file mode 100644 index c4d73176f0e0..000000000000 --- a/site/content/examples/scoped-styles/App.svelte +++ /dev/null @@ -1,11 +0,0 @@ -
- Big red Comic Sans -
- - \ No newline at end of file diff --git a/site/content/examples/scoped-styles/data.json5 b/site/content/examples/scoped-styles/data.json5 deleted file mode 100644 index 9e26dfeeb6e6..000000000000 --- a/site/content/examples/scoped-styles/data.json5 +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/site/content/examples/self-references/App.svelte b/site/content/examples/self-references/App.svelte deleted file mode 100644 index bd4475e206f7..000000000000 --- a/site/content/examples/self-references/App.svelte +++ /dev/null @@ -1,9 +0,0 @@ -
    -
  • {node.name} - {#if node.children} - {#each node.children as child} - - {/each} - {/if} -
  • -
\ No newline at end of file diff --git a/site/content/examples/self-references/data.json5 b/site/content/examples/self-references/data.json5 deleted file mode 100644 index de0cfbd19492..000000000000 --- a/site/content/examples/self-references/data.json5 +++ /dev/null @@ -1,32 +0,0 @@ -{ - "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/data.json5 b/site/content/examples/svg-clock/data.json5 deleted file mode 100644 index 9e26dfeeb6e6..000000000000 --- a/site/content/examples/svg-clock/data.json5 +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/site/content/examples/transitions-custom/data.json5 b/site/content/examples/transitions-custom/data.json5 deleted file mode 100644 index 9e26dfeeb6e6..000000000000 --- a/site/content/examples/transitions-custom/data.json5 +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/site/content/examples/transitions-fade/App.svelte b/site/content/examples/transitions-fade/App.svelte deleted file mode 100644 index 528d495361de..000000000000 --- a/site/content/examples/transitions-fade/App.svelte +++ /dev/null @@ -1,11 +0,0 @@ - - - visible - -{#if visible} -

fades in and out

-{/if} diff --git a/site/content/examples/transitions-fade/data.json5 b/site/content/examples/transitions-fade/data.json5 deleted file mode 100644 index 9e26dfeeb6e6..000000000000 --- a/site/content/examples/transitions-fade/data.json5 +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/site/content/examples/transitions-fly/App.svelte b/site/content/examples/transitions-fly/App.svelte deleted file mode 100644 index 43e4a1dd2d26..000000000000 --- a/site/content/examples/transitions-fly/App.svelte +++ /dev/null @@ -1,11 +0,0 @@ - - - visible - -{#if visible} -

flies 200 pixels up, slowly

-{/if} diff --git a/site/content/examples/transitions-fly/data.json5 b/site/content/examples/transitions-fly/data.json5 deleted file mode 100644 index 9e26dfeeb6e6..000000000000 --- a/site/content/examples/transitions-fly/data.json5 +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/site/content/examples/transitions-in-out/App.svelte b/site/content/examples/transitions-in-out/App.svelte deleted file mode 100644 index 7b995bc04d3a..000000000000 --- a/site/content/examples/transitions-in-out/App.svelte +++ /dev/null @@ -1,11 +0,0 @@ - - - visible - -{#if visible} -

flies up, fades out

-{/if} diff --git a/site/content/examples/transitions-in-out/data.json5 b/site/content/examples/transitions-in-out/data.json5 deleted file mode 100644 index 9e26dfeeb6e6..000000000000 --- a/site/content/examples/transitions-in-out/data.json5 +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/site/content/tutorial/06-bindings/01-text-inputs/app-a/App.svelte b/site/content/tutorial/06-bindings/01-text-inputs/app-a/App.svelte index d3cf1a44ed15..f1c03071ed65 100644 --- a/site/content/tutorial/06-bindings/01-text-inputs/app-a/App.svelte +++ b/site/content/tutorial/06-bindings/01-text-inputs/app-a/App.svelte @@ -2,8 +2,6 @@ let name = 'world'; - +

Hello {name}!

\ No newline at end of file diff --git a/site/content/tutorial/06-bindings/01-text-inputs/app-b/App.svelte b/site/content/tutorial/06-bindings/01-text-inputs/app-b/App.svelte index 662785bfcef8..89dd54a709ed 100644 --- a/site/content/tutorial/06-bindings/01-text-inputs/app-b/App.svelte +++ b/site/content/tutorial/06-bindings/01-text-inputs/app-b/App.svelte @@ -2,8 +2,6 @@ let name = 'world'; - +

Hello {name}!

\ No newline at end of file diff --git a/site/content/tutorial/16-special-elements/04-svelte-window-bindings/app-a/App.svelte b/site/content/tutorial/16-special-elements/04-svelte-window-bindings/app-a/App.svelte index 480ba4419e2b..fc6725e89470 100644 --- a/site/content/tutorial/16-special-elements/04-svelte-window-bindings/app-a/App.svelte +++ b/site/content/tutorial/16-special-elements/04-svelte-window-bindings/app-a/App.svelte @@ -80,5 +80,9 @@ padding: 50vh 0 0 0; } - :global(body) { margin: 0; padding: 0; } + :global(body) { + margin: 0; + padding: 0; + background-color: rgb(253, 174, 51); + } diff --git a/site/content/tutorial/16-special-elements/04-svelte-window-bindings/app-b/App.svelte b/site/content/tutorial/16-special-elements/04-svelte-window-bindings/app-b/App.svelte index a4b6f927b797..3dbfd43f218e 100644 --- a/site/content/tutorial/16-special-elements/04-svelte-window-bindings/app-b/App.svelte +++ b/site/content/tutorial/16-special-elements/04-svelte-window-bindings/app-b/App.svelte @@ -80,5 +80,9 @@ padding: 50vh 0 0 0; } - :global(body) { margin: 0; padding: 0; } + :global(body) { + margin: 0; + padding: 0; + background-color: rgb(253, 174, 51); + } diff --git a/site/package-lock.json b/site/package-lock.json index 149733cc0c52..bfcf6d367a8a 100644 --- a/site/package-lock.json +++ b/site/package-lock.json @@ -702,6 +702,16 @@ "regexpu-core": "^4.1.3" } }, + "@babel/polyfill": { + "version": "7.2.5", + "resolved": "https://registry.npmjs.org/@babel/polyfill/-/polyfill-7.2.5.tgz", + "integrity": "sha512-8Y/t3MWThtMLYr0YNC/Q76tqN1w30+b0uQMeFUYauG2UGTR19zyUtFrAzT23zNtBxPp+LbE5E/nwV/q/r3y6ug==", + "dev": true, + "requires": { + "core-js": "^2.5.7", + "regenerator-runtime": "^0.12.0" + } + }, "@babel/preset-env": { "version": "7.3.1", "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.3.1.tgz", @@ -818,6 +828,312 @@ "to-fast-properties": "^2.0.0" } }, + "@jimp/bmp": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.6.0.tgz", + "integrity": "sha512-zZOcVT1zK/1QL5a7qirkzPPgDKB1ianER7pBdpR2J71vx/g8MnrPbL3h/jEVPxjdci2Hph/VWhc/oLBtTbqO8w==", + "dev": true, + "requires": { + "@jimp/utils": "^0.6.0", + "bmp-js": "^0.1.0", + "core-js": "^2.5.7" + } + }, + "@jimp/core": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/core/-/core-0.6.0.tgz", + "integrity": "sha512-ngAkyCLtX7buc2QyFy0ql/j4R2wGYQVsVhW2G3Y0GVAAklRIFIUYpyNKrqs228xA8f2O6XStbDStFlYkt7uNeg==", + "dev": true, + "requires": { + "@jimp/utils": "^0.6.0", + "any-base": "^1.1.0", + "buffer": "^5.2.0", + "core-js": "^2.5.7", + "exif-parser": "^0.1.12", + "file-type": "^9.0.0", + "load-bmfont": "^1.3.1", + "mkdirp": "0.5.1", + "phin": "^2.9.1", + "pixelmatch": "^4.0.2", + "tinycolor2": "^1.4.1" + } + }, + "@jimp/custom": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.6.0.tgz", + "integrity": "sha512-+YZIWhf03Rfbi+VPbHomKInu3tcntF/aij/JrIJd1QZq13f8m3mRNxakXupiL18KH0C8BPNDk8RiwFX+HaOw3A==", + "dev": true, + "requires": { + "@jimp/core": "^0.6.0", + "core-js": "^2.5.7" + } + }, + "@jimp/gif": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/gif/-/gif-0.6.0.tgz", + "integrity": "sha512-aWQ02P0ymTN1eh0BVsY+84wMdb/QeiVpCNQZl9y50cRnpuMM8TTmF/ZdCEBDiTRFcwXzHsqBXcLwEcYp3X2lTw==", + "dev": true, + "requires": { + "@jimp/utils": "^0.6.0", + "core-js": "^2.5.7", + "omggif": "^1.0.9" + } + }, + "@jimp/jpeg": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.6.0.tgz", + "integrity": "sha512-quYb+lM4h57jQvr2q9dEIkc0laTljws4dunIdFhJRfa5UlNL5mHInk8h5MxyALo0mZdT07TAcxiDHw5QXZ28JQ==", + "dev": true, + "requires": { + "@jimp/utils": "^0.6.0", + "core-js": "^2.5.7", + "jpeg-js": "^0.3.4" + } + }, + "@jimp/plugin-blit": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.6.0.tgz", + "integrity": "sha512-LjiCa+8OT2fgmvBpZt0ogurg/eu5kB8ZFWDRwHPcf8i+058sZC20dar/qrjVd5Knssq4ynjb5oAHsGuJq16Rqw==", + "dev": true, + "requires": { + "@jimp/utils": "^0.6.0", + "core-js": "^2.5.7" + } + }, + "@jimp/plugin-blur": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.6.0.tgz", + "integrity": "sha512-/vjGcEiHda6OLTCYqXPFkfSTbL+RatZoGcp1vewcWqChUccn9QVINTlxB7nEI/3Nb/i7KdhOPNEQh1k6q6QXsw==", + "dev": true, + "requires": { + "@jimp/utils": "^0.6.0", + "core-js": "^2.5.7" + } + }, + "@jimp/plugin-color": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.6.0.tgz", + "integrity": "sha512-mvDeAwN8ZpDkOaABMJ0w9zUzo9OOtu1qvvPkSirXDTMiXt1nsbfz8BoeoD7nU2MFhQj5MiGjH65UDnsH5ZzYuw==", + "dev": true, + "requires": { + "@jimp/utils": "^0.6.0", + "core-js": "^2.5.7", + "tinycolor2": "^1.4.1" + } + }, + "@jimp/plugin-contain": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.6.0.tgz", + "integrity": "sha512-gPHnoQkDztMbvnTVo01BaMoM/hhDJdeJ7FRToD4p4Qvdor4V0I6NXtjOeUPXfD94miTgh/UTyJDqeG4GZzi4sA==", + "dev": true, + "requires": { + "@jimp/utils": "^0.6.0", + "core-js": "^2.5.7" + } + }, + "@jimp/plugin-cover": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.6.0.tgz", + "integrity": "sha512-iv9lA2v3qv+x3eaTThtyzFg+hO8/pSnM8NBymC5OlpSJnR54aWi7BVFXLJAF27T4EZyXko432PVul2IdY3BEPw==", + "dev": true, + "requires": { + "@jimp/utils": "^0.6.0", + "core-js": "^2.5.7" + } + }, + "@jimp/plugin-crop": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.6.0.tgz", + "integrity": "sha512-YftdmFZ2YnZDYyBulkStCt2MZbKKfbjytkE+6i3Djk2b/Rfryg5xjgzVnAumCRQJhVPukexrnc2V7KKbEgx7mQ==", + "dev": true, + "requires": { + "@jimp/utils": "^0.6.0", + "core-js": "^2.5.7" + } + }, + "@jimp/plugin-displace": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.6.0.tgz", + "integrity": "sha512-kkva5Fy3r7J7QmiqYQ5c9NeUKKkN7+KSfCGsZ6tkRHK4REMIXhQO/OnJN8XG6RReV29O6QykdyeTXDiHUDiROw==", + "dev": true, + "requires": { + "@jimp/utils": "^0.6.0", + "core-js": "^2.5.7" + } + }, + "@jimp/plugin-dither": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.6.0.tgz", + "integrity": "sha512-ILSG7bl3SOqmcIa9C4nBvs0h0E0ObnMbeKWUZiNuz6i0OAlbxryiIfU4j0UVQD5XqT9ksC5mviVNrvOMw4SZLw==", + "dev": true, + "requires": { + "@jimp/utils": "^0.6.0", + "core-js": "^2.5.7" + } + }, + "@jimp/plugin-flip": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.6.0.tgz", + "integrity": "sha512-MXGGwABjERvfqVadEzJuVAmbsEQfjxXD0O/mMBegU1Qh7/JmnKAVplQCnojsMPxUdao/FKZjQqOnB/j4LLJtOQ==", + "dev": true, + "requires": { + "@jimp/utils": "^0.6.0", + "core-js": "^2.5.7" + } + }, + "@jimp/plugin-gaussian": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.6.0.tgz", + "integrity": "sha512-RUsBCyj6Ukxgn/TU8v6c6WRbSFqKM0iknLVqDkKIuiOyJB7ougv66fqomh/i/h3ihIkEnf50BuO0c3ovrczfvw==", + "dev": true, + "requires": { + "@jimp/utils": "^0.6.0", + "core-js": "^2.5.7" + } + }, + "@jimp/plugin-invert": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.6.0.tgz", + "integrity": "sha512-zTCqK8el6eqcNKAxw0y57gHBFgxygI5iM8dQDPyqsvVWO71i8XII7ubnJhEvPPN7vhIKlOSnS9XXglezvJoX4Q==", + "dev": true, + "requires": { + "@jimp/utils": "^0.6.0", + "core-js": "^2.5.7" + } + }, + "@jimp/plugin-mask": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.6.0.tgz", + "integrity": "sha512-zkZVqAA7lxWhkn5EbPjBQ6tPluYIGfLMSX4kD1gksj+MVJJnVAd459AVuEXCvkUvv4wG5AlH8m6ve5NZj9vvxw==", + "dev": true, + "requires": { + "@jimp/utils": "^0.6.0", + "core-js": "^2.5.7" + } + }, + "@jimp/plugin-normalize": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.6.0.tgz", + "integrity": "sha512-7bNGT+S0rw9gvmxpkNsA19JSqBZYFrAn9QhEmoN4HIimdKtJaoLJh/GnxrPuOBLuv1IPJntoTOOWvOmfrQ6/ww==", + "dev": true, + "requires": { + "@jimp/utils": "^0.6.0", + "core-js": "^2.5.7" + } + }, + "@jimp/plugin-print": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.6.0.tgz", + "integrity": "sha512-kXNHYo7bGQiMZkUqhCvm6OomjJtZnLGs7cgXp9qsCfPcDBLLW+X3oxnoLaePQMlpQt6hX/lzFnNaWKv/KB1jlA==", + "dev": true, + "requires": { + "@jimp/utils": "^0.6.0", + "core-js": "^2.5.7", + "load-bmfont": "^1.4.0" + } + }, + "@jimp/plugin-resize": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.6.0.tgz", + "integrity": "sha512-m0AA/mPkJG++RuftBFDUMRenqgIN/uSh88Kqs33VURYaabApni4ML3QslE1TCJtl2Lnu1eosxYlbzODjHx49eg==", + "dev": true, + "requires": { + "@jimp/utils": "^0.6.0", + "core-js": "^2.5.7" + } + }, + "@jimp/plugin-rotate": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.6.0.tgz", + "integrity": "sha512-1QGlIisyxs2HNLuynq/ETc4h7E6At3yR+IYAhG9U4KONG4RqlIy0giyDhnfEZaiqOE+O7f+0Z7zN6GoSHmQjzg==", + "dev": true, + "requires": { + "@jimp/utils": "^0.6.0", + "core-js": "^2.5.7" + } + }, + "@jimp/plugin-scale": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.6.0.tgz", + "integrity": "sha512-le/ttYwYioNPRoMlMaoJMCTv+m8d1v0peo/3J8E6Rf9ok7Bw3agkvjL9ILnsmr8jXj1YLrBSPKRs5nJ6ziM/qA==", + "dev": true, + "requires": { + "@jimp/utils": "^0.6.0", + "core-js": "^2.5.7" + } + }, + "@jimp/plugins": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.6.0.tgz", + "integrity": "sha512-9+znfBJM1B31kvw+IcQFnAuDntQhwca/SONFnKOSZ8BNiQdiuTNbXHFxOo3tvdv1ngtB+LkkiTgK+QoF358b8g==", + "dev": true, + "requires": { + "@jimp/plugin-blit": "^0.6.0", + "@jimp/plugin-blur": "^0.6.0", + "@jimp/plugin-color": "^0.6.0", + "@jimp/plugin-contain": "^0.6.0", + "@jimp/plugin-cover": "^0.6.0", + "@jimp/plugin-crop": "^0.6.0", + "@jimp/plugin-displace": "^0.6.0", + "@jimp/plugin-dither": "^0.6.0", + "@jimp/plugin-flip": "^0.6.0", + "@jimp/plugin-gaussian": "^0.6.0", + "@jimp/plugin-invert": "^0.6.0", + "@jimp/plugin-mask": "^0.6.0", + "@jimp/plugin-normalize": "^0.6.0", + "@jimp/plugin-print": "^0.6.0", + "@jimp/plugin-resize": "^0.6.0", + "@jimp/plugin-rotate": "^0.6.0", + "@jimp/plugin-scale": "^0.6.0", + "core-js": "^2.5.7", + "timm": "^1.6.1" + } + }, + "@jimp/png": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/png/-/png-0.6.0.tgz", + "integrity": "sha512-DBtMyQyrJxuKI7/1dVqLek+rCMM8U6BSOTHgo05wU7lhJKTB6fn2tbYfsnHQKzd9ld1M2qKuC+O1GTVdB2yl6w==", + "dev": true, + "requires": { + "@jimp/utils": "^0.6.0", + "core-js": "^2.5.7", + "pngjs": "^3.3.3" + } + }, + "@jimp/tiff": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.6.0.tgz", + "integrity": "sha512-PV95CquEsolFziq0zZrAEJIzZSKwMK89TvkOXTPDi/xesgdXGC2rtG1IZFpC9L4UX5hi/M5GaeJa49xULX6Nqw==", + "dev": true, + "requires": { + "core-js": "^2.5.7", + "utif": "^2.0.1" + } + }, + "@jimp/types": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/types/-/types-0.6.0.tgz", + "integrity": "sha512-j4tm82huEWpLrwave/2NYnMTY6us/6K9Js6Vd/CHoM/ki8M71tMXEVzc8tly92wtnEzQ9+FEk0Ue6pYo68m/5A==", + "dev": true, + "requires": { + "@jimp/bmp": "^0.6.0", + "@jimp/gif": "^0.6.0", + "@jimp/jpeg": "^0.6.0", + "@jimp/png": "^0.6.0", + "@jimp/tiff": "^0.6.0", + "core-js": "^2.5.7", + "timm": "^1.6.1" + } + }, + "@jimp/utils": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-0.6.0.tgz", + "integrity": "sha512-z5iYEfqc45vlYweROneNkjv32en6jS7lPL/eMLIvaEcQAHaoza20Dw8fUoJ0Ht9S92kR74xeTunAZq+gK2w67Q==", + "dev": true, + "requires": { + "core-js": "^2.5.7" + } + }, "@polka/url": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/@polka/url/-/url-0.5.0.tgz", @@ -865,6 +1181,12 @@ "color-convert": "^1.9.0" } }, + "any-base": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz", + "integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg==", + "dev": true + }, "anymatch": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", @@ -1016,12 +1338,24 @@ } } }, + "base64-js": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", + "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==", + "dev": true + }, "binary-extensions": { "version": "1.13.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.0.tgz", "integrity": "sha512-EgmjVLMn22z7eGGv3kcnHwSnJXmFHjISTY9E/S5lIcTD3Oxw05QTcBLNkJFzcb3cNueUdF/IN4U+d78V0zO8Hw==", "dev": true }, + "bmp-js": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.1.0.tgz", + "integrity": "sha1-4Fpj95amwf8l9Hcex62twUjAcjM=", + "dev": true + }, "body-parser": { "version": "1.18.3", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", @@ -1088,6 +1422,22 @@ "node-releases": "^1.1.3" } }, + "buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz", + "integrity": "sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg==", + "dev": true, + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" + } + }, + "buffer-equal": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.1.tgz", + "integrity": "sha1-kbx0sR6kBbyRa8aqkI+q+ltKrEs=", + "dev": true + }, "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", @@ -1370,6 +1720,12 @@ "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", "dev": true }, + "core-js": { + "version": "2.6.5", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.5.tgz", + "integrity": "sha512-klh/kDpwX8hryYL14M9w/xei6vrv6sE8gTHDG7/T/+SEovB/G4ejwcfE/CBzO6Edsu+OETZMZ3wcX/EjUkrl5A==", + "dev": true + }, "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -1503,6 +1859,12 @@ "resolved": "https://registry.npmjs.org/do-not-zip/-/do-not-zip-1.0.0.tgz", "integrity": "sha512-Pgd81ET43bhAGaN2Hq1zluSX1FmD7kl7KcV9ER/lawiLsRUB9pRA5y8r6us29Xk6BrINZETO8TjhYwtwafWUww==" }, + "dom-walk": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", + "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=", + "dev": true + }, "dotenv": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-6.2.0.tgz", @@ -1579,7 +1941,7 @@ "dev": true }, "eslint-plugin-svelte3": { - "version": "git+https://github.com/sveltejs/eslint-plugin-svelte3.git#651d7e3695b1731251ab3a501d1067b561ede09f", + "version": "git+https://github.com/sveltejs/eslint-plugin-svelte3.git#5fc4861d4b191649b0badf4f9a4c2470f08b237e", "from": "git+https://github.com/sveltejs/eslint-plugin-svelte3.git#semver:*", "dev": true }, @@ -1615,6 +1977,12 @@ "strip-eof": "^1.0.0" } }, + "exif-parser": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/exif-parser/-/exif-parser-0.1.12.tgz", + "integrity": "sha1-WKnS1ywCwfbwKg70qRZicrd2CSI=", + "dev": true + }, "expand-brackets": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", @@ -1840,6 +2208,12 @@ } } }, + "file-type": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-9.0.0.tgz", + "integrity": "sha512-Qe/5NJrgIOlwijpq3B7BEpzPFcgzggOTagZmkXQY4LA6bsXKTUstK7Wp12lEJ/mLKTpvIZxmIuRcLYWT6ov9lw==", + "dev": true + }, "filename-regex": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", @@ -1892,6 +2266,15 @@ "locate-path": "^3.0.0" } }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "requires": { + "is-callable": "^1.1.3" + } + }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -2576,6 +2959,16 @@ } } }, + "global": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", + "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", + "dev": true, + "requires": { + "min-document": "^2.19.0", + "process": "~0.5.1" + } + }, "globals": { "version": "11.10.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.10.0.tgz", @@ -2722,6 +3115,12 @@ "safer-buffer": ">= 2.1.2 < 3" } }, + "ieee754": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.12.tgz", + "integrity": "sha512-GguP+DRY+pJ3soyIiGPTvdiVXjZ+DbXOxGpXn3eMvNW4x4irjqXm4wHKscC+TfxSJ0yw/S1F24tqdMNsMZTiLA==", + "dev": true + }, "imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", @@ -2891,6 +3290,12 @@ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, + "is-function": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz", + "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=", + "dev": true + }, "is-glob": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz", @@ -3016,6 +3421,25 @@ } } }, + "jimp": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/jimp/-/jimp-0.6.0.tgz", + "integrity": "sha512-RYpN+AAlTEMf8Bnkhq2eeTNyr70rDK/2UUfUqzBJmwmZwdR6fxRJvgbCGWT1BDVRxaAqo+4CWm8ePBxOIsr4jg==", + "dev": true, + "requires": { + "@babel/polyfill": "^7.0.0", + "@jimp/custom": "^0.6.0", + "@jimp/plugins": "^0.6.0", + "@jimp/types": "^0.6.0", + "core-js": "^2.5.7" + } + }, + "jpeg-js": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.3.4.tgz", + "integrity": "sha512-6IzjQxvnlT8UlklNmDXIJMWxijULjqGrzgqc0OG7YadZdvm7KPQ1j0ehmQQHckgEWOfgpptzcnWgESovxudpTA==", + "dev": true + }, "js-levenshtein": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz", @@ -3078,6 +3502,22 @@ "invert-kv": "^2.0.0" } }, + "load-bmfont": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/load-bmfont/-/load-bmfont-1.4.0.tgz", + "integrity": "sha512-kT63aTAlNhZARowaNYcY29Fn/QYkc52M3l6V1ifRcPewg2lvUZDAj7R6dXjOL9D0sict76op3T5+odumDSF81g==", + "dev": true, + "requires": { + "buffer-equal": "0.0.1", + "mime": "^1.3.4", + "parse-bmfont-ascii": "^1.0.3", + "parse-bmfont-binary": "^1.0.5", + "parse-bmfont-xml": "^1.1.4", + "phin": "^2.9.1", + "xhr": "^2.0.1", + "xtend": "^4.0.0" + } + }, "load-json-file": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", @@ -3251,6 +3691,15 @@ "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", "dev": true }, + "min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", + "dev": true, + "requires": { + "dom-walk": "^0.1.0" + } + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -3524,6 +3973,12 @@ "isobject": "^3.0.1" } }, + "omggif": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/omggif/-/omggif-1.0.9.tgz", + "integrity": "sha1-3LcCTazVDFK00wPwSALJHAV8dl8=", + "dev": true + }, "on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", @@ -3598,6 +4053,12 @@ "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==", "dev": true }, + "pako": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.10.tgz", + "integrity": "sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw==", + "dev": true + }, "param-case": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/param-case/-/param-case-2.1.1.tgz", @@ -3607,6 +4068,28 @@ "no-case": "^2.2.0" } }, + "parse-bmfont-ascii": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/parse-bmfont-ascii/-/parse-bmfont-ascii-1.0.6.tgz", + "integrity": "sha1-Eaw8P/WPfCAgqyJ2kHkQjU36AoU=", + "dev": true + }, + "parse-bmfont-binary": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/parse-bmfont-binary/-/parse-bmfont-binary-1.0.6.tgz", + "integrity": "sha1-0Di0dtPp3Z2x4RoLDlOiJ5K2kAY=", + "dev": true + }, + "parse-bmfont-xml": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.4.tgz", + "integrity": "sha512-bjnliEOmGv3y1aMEfREMBJ9tfL3WR0i0CKPj61DnSLaoxWR3nLrsQrEbCId/8rF4NyRF0cCqisSVXyQYWM+mCQ==", + "dev": true, + "requires": { + "xml-parse-from-string": "^1.0.0", + "xml2js": "^0.4.5" + } + }, "parse-glob": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", @@ -3636,6 +4119,16 @@ } } }, + "parse-headers": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.2.tgz", + "integrity": "sha512-/LypJhzFmyBIDYP9aDVgeyEb5sQfbfY5mnDq4hVhlQ69js87wXfmEI5V3xI6vvXasqebp0oCytYFLxsBVfCzSg==", + "dev": true, + "requires": { + "for-each": "^0.3.3", + "string.prototype.trim": "^1.1.2" + } + }, "parse-json": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", @@ -3737,6 +4230,12 @@ "resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz", "integrity": "sha1-HUCLP9t2kjuVQ9lvtMnf1TXZy10=" }, + "phin": { + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/phin/-/phin-2.9.3.tgz", + "integrity": "sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==", + "dev": true + }, "pidtree": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.3.0.tgz", @@ -3749,6 +4248,21 @@ "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", "dev": true }, + "pixelmatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/pixelmatch/-/pixelmatch-4.0.2.tgz", + "integrity": "sha1-j0fc7FARtHe2fbA8JDvB8wheiFQ=", + "dev": true, + "requires": { + "pngjs": "^3.0.0" + } + }, + "pngjs": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", + "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==", + "dev": true + }, "posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", @@ -3775,6 +4289,12 @@ "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", "dev": true }, + "process": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", + "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=", + "dev": true + }, "process-nextick-args": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", @@ -4303,6 +4823,12 @@ "string-hash": "^1.1.3" } }, + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "dev": true + }, "select": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz", @@ -4719,6 +5245,17 @@ "function-bind": "^1.0.2" } }, + "string.prototype.trim": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz", + "integrity": "sha1-0E3iyJ4Tf019IG8Ia17S+ua+jOo=", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.0", + "function-bind": "^1.0.2" + } + }, "string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -4759,9 +5296,9 @@ } }, "svelte": { - "version": "3.0.0-beta.10", - "resolved": "https://registry.npmjs.org/svelte/-/svelte-3.0.0-beta.10.tgz", - "integrity": "sha512-PDA034OwoMwna9+L99QVN/g9fodfxne3+wWaKph4WmcDDn0cAYRzTgu1h8WfAKK7tyt1iTcOBxKP9y+jonJ0/g==", + "version": "3.0.0-beta.14", + "resolved": "https://registry.npmjs.org/svelte/-/svelte-3.0.0-beta.14.tgz", + "integrity": "sha512-naFCFs5JRYe5PGz3+Vg0LiFMqkQUc4bdiH4e7sd6jyDyia0fWd4CJrLxWiC5kHv5Qo5Iv+y26hBHnDoIGAw3zw==", "dev": true }, "tar": { @@ -4798,6 +5335,12 @@ } } }, + "timm": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/timm/-/timm-1.6.1.tgz", + "integrity": "sha512-hqDTYi/bWuDxL2i6T3v6nrvkAQ/1Bc060GSkVEQZp02zTSTB4CHSKsOkliequCftQaNRcjRqUZmpGWs5FfhrNg==", + "dev": true + }, "tiny-emitter": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz", @@ -4813,6 +5356,12 @@ "globrex": "^0.1.1" } }, + "tinycolor2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.1.tgz", + "integrity": "sha1-9PrTM0R7wLB9TcjpIJ2POaisd+g=", + "dev": true + }, "to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -5044,6 +5593,15 @@ "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", "dev": true }, + "utif": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/utif/-/utif-2.0.1.tgz", + "integrity": "sha512-Z/S1fNKCicQTf375lIP9G8Sa1H/phcysstNrrSdZKj1f9g58J4NMgb5IgiEZN9/nLMPDwF0W7hdOe9Qq2IYoLg==", + "dev": true, + "requires": { + "pako": "^1.0.5" + } + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -5147,6 +5705,46 @@ "slide": "^1.1.5" } }, + "xhr": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", + "integrity": "sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ==", + "dev": true, + "requires": { + "global": "~4.3.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "xml-parse-from-string": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xml-parse-from-string/-/xml-parse-from-string-1.0.1.tgz", + "integrity": "sha1-qQKekp09vN7RafPG4oI42VpdWig=", + "dev": true + }, + "xml2js": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", + "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "dev": true, + "requires": { + "sax": ">=0.6.0", + "xmlbuilder": "~9.0.1" + } + }, + "xmlbuilder": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=", + "dev": true + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "dev": true + }, "y18n": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", diff --git a/site/package.json b/site/package.json index 605682db32ba..de3edb8f6437 100644 --- a/site/package.json +++ b/site/package.json @@ -42,6 +42,7 @@ "chokidar": "^2.1.2", "degit": "^2.1.3", "eslint-plugin-svelte3": "git+https://github.com/sveltejs/eslint-plugin-svelte3.git#semver:*", + "jimp": "^0.6.0", "now": "^14.0.0", "npm-run-all": "^4.1.5", "rollup": "^1.2.2", @@ -53,6 +54,6 @@ "rollup-plugin-svelte": "^5.0.3", "rollup-plugin-terser": "^4.0.4", "sapper": "^0.26.0-alpha.10", - "svelte": "^3.0.0-beta.10" + "svelte": "^3.0.0-beta.14" } } diff --git a/site/scripts/get-example-thumbnails/index.js b/site/scripts/get-example-thumbnails/index.js new file mode 100644 index 000000000000..0b2f425cf1b2 --- /dev/null +++ b/site/scripts/get-example-thumbnails/index.js @@ -0,0 +1,64 @@ +const fs = require('fs'); +const puppeteer = require('puppeteer'); +const Jimp = require('jimp'); +const c = require('kleur'); + +const slugs = []; + +fs.readdirSync(`content/examples`).forEach(group_dir => { + fs.readdirSync(`content/examples/${group_dir}`).filter(file => file !== 'meta.json').map(example_dir => { + const slug = example_dir.replace(/^\d+-/, ''); + slugs.push(slug); + }); +}); + +async function main() { + const browser = await puppeteer.launch({ + defaultViewport: { + width: 1280, + height: 960, + deviceScaleFactor: 2 + } + }); + + const page = await browser.newPage(); + + for (const slug of slugs) { + try { + const output_file = `static/examples/thumbnails/${slug}.png`; + if (fs.existsSync(output_file)) { + console.log(c.gray(`skipping ${slug}`)); + continue; + } + + console.log(slug); + await page.goto(`http://localhost:3000/repl?example=${slug}`); + + await page.waitForSelector('iframe.inited[title=Result]'); + await page.waitFor(1500); + const iframe = await page.$('iframe.inited[title=Result]'); + const buffer = await iframe.screenshot(); + + const image = await Jimp.read(buffer); + image.crop(3, 3, image.bitmap.width - 6, image.bitmap.height - 6); + image.autocrop(); + + if (image.bitmap.width > 300 || image.bitmap.width > 200) { + const scale = Math.min( + 300 / image.bitmap.width, + 200 / image.bitmap.height + ); + + image.scale(scale); + } + + await image.write(output_file); + } catch (err) { + console.log(c.bold().red(`failed to screenshot ${slug}`)); + } + } + + await browser.close(); +} + +main(); \ No newline at end of file diff --git a/site/scripts/get-examples-from-tutorials/index.js b/site/scripts/get-examples-from-tutorials/index.js new file mode 100644 index 000000000000..f828a089beb0 --- /dev/null +++ b/site/scripts/get-examples-from-tutorials/index.js @@ -0,0 +1,74 @@ +const sander = require('sander'); + +process.chdir(`${__dirname}/../..`); + +function extract_frontmatter(markdown) { + const match = /---\r?\n([\s\S]+?)\r?\n---/.exec(markdown); + const frontMatter = match[1]; + const content = markdown.slice(match[0].length); + + const metadata = {}; + frontMatter.split('\n').forEach(pair => { + const colonIndex = pair.indexOf(':'); + metadata[pair.slice(0, colonIndex).trim()] = pair + .slice(colonIndex + 1) + .trim(); + }); + + return { metadata, content }; +} + +const tutorial_sections = sander.readdirSync(`content/tutorial`).map(section_dir => { + const section_slug = section_dir.replace(/^\d+-/, ''); + + const meta = JSON.parse(sander.readFileSync(`content/tutorial/${section_dir}/meta.json`, { encoding: 'utf-8' })); + + const chapters = sander.readdirSync(`content/tutorial/${section_dir}`).map(chapter_dir => { + const app_dir = `content/tutorial/${section_dir}/${chapter_dir}/app-b`; + if (!sander.existsSync(app_dir)) return; + + const markdown = sander.readFileSync(`content/tutorial/${section_dir}/${chapter_dir}/text.md`, { encoding: 'utf-8' }); + const { metadata } = extract_frontmatter(markdown); + + const chapter_slug = chapter_dir.replace(/^\d+-/, ''); + + return { + slug: chapter_slug, + title: metadata.title, + files: sander.readdirSync(app_dir).map(name => { + return { + name, + source: sander.readFileSync(`${app_dir}/${name}`, { encoding: 'utf-8' }) + }; + }) + }; + }).filter(Boolean); + + return { + slug: section_slug, + title: meta.title, + chapters + }; +}).filter(section => section.chapters.length > 0); + +const pad = i => i < 10 ? `0${i}` : i; + +tutorial_sections.forEach((section, i) => { + const section_dir = `${pad(i)}-${section.slug}`; + + sander.writeFileSync(`content/examples/${section_dir}/meta.json`, JSON.stringify({ + title: section.title + }, null, '\t')); + + section.chapters.forEach((chapter, i) => { + const chapter_dir = `${pad(i)}-${chapter.slug}`; + + sander.writeFileSync(`content/examples/${section_dir}/${chapter_dir}/meta.json`, JSON.stringify({ + title: chapter.title + }, null, '\t')); + + chapter.files.forEach(file => { + sander.writeFileSync(`content/examples/${section_dir}/${chapter_dir}/${file.name}`, file.source); + }); + }); +}); \ No newline at end of file diff --git a/site/src/components/Repl/Output/PropEditor.svelte b/site/src/components/Repl/Output/PropEditor.svelte deleted file mode 100644 index 4ea6ce5e7fa6..000000000000 --- a/site/src/components/Repl/Output/PropEditor.svelte +++ /dev/null @@ -1,71 +0,0 @@ - - - - -
- -
\ No newline at end of file diff --git a/site/src/components/Repl/Output/ReplProxy.js b/site/src/components/Repl/Output/ReplProxy.js index 44b77b84dd44..7ae56e35b713 100644 --- a/site/src/components/Repl/Output/ReplProxy.js +++ b/site/src/components/Repl/Output/ReplProxy.js @@ -57,11 +57,6 @@ export default class ReplProxy { this.handleCommandMessage(event.data); } - if (action === 'prop_update') { - const { prop, value } = args; - this.handlers.onPropUpdate(prop, value) - } - if (action === 'fetch_progress') { this.handlers.onFetchProgress(args.remaining) } @@ -71,14 +66,6 @@ export default class ReplProxy { return this.iframeCommand('eval', { script }); } - setProp(prop, value) { - return this.iframeCommand('set_prop', {prop, value}) - } - - bindProps(props) { - return this.iframeCommand('bind_props', { props }) - } - handleLinks() { return this.iframeCommand('catch_clicks', {}); } diff --git a/site/src/components/Repl/Output/Viewer.svelte b/site/src/components/Repl/Output/Viewer.svelte index eec904526ff5..f5fcb0295e69 100644 --- a/site/src/components/Repl/Output/Viewer.svelte +++ b/site/src/components/Repl/Output/Viewer.svelte @@ -6,9 +6,8 @@ import { decode } from 'sourcemap-codec'; const dispatch = createEventDispatcher(); - const { bundle, values, navigate } = getContext('REPL'); + const { bundle, navigate } = getContext('REPL'); - export let props; export let error; // TODO should this be exposed as a prop? export function setProp(prop, value) { @@ -23,16 +22,10 @@ let proxy = null; let ready = false; + let inited = false; onMount(() => { proxy = new ReplProxy(iframe, { - onPropUpdate: (prop, value) => { - dispatch('binding', { prop, value }); - values.update(values => Object.assign({}, values, { - [prop]: value - })); - }, - onFetchProgress: progress => { pending_imports = progress; } @@ -84,13 +77,10 @@ window._svelteTransitionManager = null; window.component = new SvelteComponent({ - target: document.body, - props: ${JSON.stringify($values)} + target: document.body }); `); - await proxy.bindProps(props); - error = null; } catch (e) { const loc = getLocationFromStack(e.stack, $bundle.dom.map); @@ -101,6 +91,8 @@ error = e; } + + inited = true; } $: if (ready) apply_bundle($bundle); @@ -136,7 +128,7 @@
- @@ -245,7 +245,7 @@ npm run dev & open http://localhost:5000 @@ -257,7 +257,7 @@ npm run dev & open http://localhost:5000 @@ -269,7 +269,7 @@ npm run dev & open http://localhost:5000 diff --git a/site/src/routes/repl/_components/AppControls/index.svelte b/site/src/routes/repl/_components/AppControls/index.svelte index 9f1b6a47a757..f02cdc8fd266 100644 --- a/site/src/routes/repl/_components/AppControls/index.svelte +++ b/site/src/routes/repl/_components/AppControls/index.svelte @@ -1,5 +1,4 @@