From 1a28d58b5d2bda54cae70718f7ac36e45e25b9f7 Mon Sep 17 00:00:00 2001 From: Puru Vijay <47742487+PuruVJ@users.noreply.github.com> Date: Sat, 16 Sep 2023 20:00:16 +0530 Subject: [PATCH] feat: Copy code button (#8995) * Push * Bump site-kit * Add headers to primary snippets * Update deps * Bump deos * redploy * Back to normal * Push * Bump deps * site: fix rendering of promise in deprecation warning (#9191) * copy: true * Bump site-kit * Use cache --- .../02-template-syntax/03-logic-blocks.md | 13 + .../02-template-syntax/04-special-tags.md | 4 + .../05-element-directives.md | 43 +- .../06-component-directives.md | 17 +- .../02-template-syntax/07-special-elements.md | 1 - .../docs/03-runtime/02-svelte-store.md | 22 +- .../docs/03-runtime/04-svelte-transition.md | 18 + .../docs/03-runtime/05-svelte-animate.md | 1 + .../docs/03-runtime/07-svelte-action.md | 3 - .../04-compiler-and-api/01-svelte-compiler.md | 5 +- .../02-client-side-component-api.md | 3 + documentation/docs/05-misc/03-typescript.md | 14 +- pnpm-lock.yaml | 674 ++++++++++-------- sites/svelte.dev/package.json | 28 +- sites/svelte.dev/src/routes/+page.svelte | 2 +- .../src/routes/blog/[slug]/+page.svelte | 3 +- .../src/routes/content.json/content.server.js | 24 +- .../src/routes/docs/[slug]/+page.svelte | 3 +- .../svelte.dev/src/routes/nav.json/+server.js | 23 +- 19 files changed, 537 insertions(+), 364 deletions(-) diff --git a/documentation/docs/02-template-syntax/03-logic-blocks.md b/documentation/docs/02-template-syntax/03-logic-blocks.md index 43e7511bf5..98bfc3ea18 100644 --- a/documentation/docs/02-template-syntax/03-logic-blocks.md +++ b/documentation/docs/02-template-syntax/03-logic-blocks.md @@ -5,14 +5,17 @@ title: Logic blocks ## {#if ...} ```svelte + {#if expression}...{/if} ``` ```svelte + {#if expression}...{:else if expression}...{/if} ``` ```svelte + {#if expression}...{:else}...{/if} ``` @@ -41,22 +44,27 @@ Additional conditions can be added with `{:else if expression}`, optionally endi ## {#each ...} ```svelte + {#each expression as name}...{/each} ``` ```svelte + {#each expression as name, index}...{/each} ``` ```svelte + {#each expression as name (key)}...{/each} ``` ```svelte + {#each expression as name, index (key)}...{/each} ``` ```svelte + {#each expression as name}...{:else}...{/each} ``` @@ -125,18 +133,22 @@ Since Svelte 4 it is possible to iterate over iterables like `Map` or `Set`. Ite ## {#await ...} ```svelte + {#await expression}...{:then name}...{:catch name}...{/await} ``` ```svelte + {#await expression}...{:then name}...{/await} ``` ```svelte + {#await expression then name}...{/await} ``` ```svelte + {#await expression catch name}...{/await} ``` @@ -186,6 +198,7 @@ Similarly, if you only want to show the error state, you can omit the `then` blo ## {#key ...} ```svelte + {#key expression}...{/key} ``` diff --git a/documentation/docs/02-template-syntax/04-special-tags.md b/documentation/docs/02-template-syntax/04-special-tags.md index f70ab4d092..4145d8d6d6 100644 --- a/documentation/docs/02-template-syntax/04-special-tags.md +++ b/documentation/docs/02-template-syntax/04-special-tags.md @@ -5,6 +5,7 @@ title: Special tags ## {@html ...} ```svelte + {@html expression} ``` @@ -24,10 +25,12 @@ The expression should be valid standalone HTML — `{@html "
"}content{@html ## {@debug ...} ```svelte + {@debug} ``` ```svelte + {@debug var1, var2, ..., varN} ``` @@ -65,6 +68,7 @@ The `{@debug}` tag without any arguments will insert a `debugger` statement that ## {@const ...} ```svelte + {@const assignment} ``` diff --git a/documentation/docs/02-template-syntax/05-element-directives.md b/documentation/docs/02-template-syntax/05-element-directives.md index ee24c97e51..f9ff1821c8 100644 --- a/documentation/docs/02-template-syntax/05-element-directives.md +++ b/documentation/docs/02-template-syntax/05-element-directives.md @@ -7,10 +7,12 @@ As well as attributes, elements can have _directives_, which control the element ## on:_eventname_ ```svelte + on:eventname={handler} ``` ```svelte + on:eventname|modifiers={handler} ``` @@ -72,7 +74,6 @@ If the `on:` directive is used without a value, the component will _forward_ the It's possible to have multiple event listeners for the same event: ```svelte - - + - + ``` Listening for component events looks the same as listening for DOM events: @@ -44,6 +40,7 @@ As with DOM events, if the `on:` directive is used without a value, the event wi ## --style-props ```svelte + --style-props="anycssvalue" ``` @@ -78,7 +75,6 @@ For SVG namespace, the example above desugars into using `` instead: Svelte's CSS Variables support allows for easily themeable components: ```svelte -