From 35376f248753d86ea6b38a0676cdb43d803b9efd Mon Sep 17 00:00:00 2001 From: Conduitry Date: Tue, 21 Dec 2021 03:48:19 -0500 Subject: [PATCH 01/66] [docs] fix path to /tutorial/image.gif (#7033) --- .../examples/00-introduction/01-dynamic-attributes/App.svelte | 4 ++-- .../01-introduction/03-dynamic-attributes/app-a/App.svelte | 4 ++-- .../01-introduction/03-dynamic-attributes/app-b/App.svelte | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/site/content/examples/00-introduction/01-dynamic-attributes/App.svelte b/site/content/examples/00-introduction/01-dynamic-attributes/App.svelte index 6a76b43dde..6a1ac86e69 100644 --- a/site/content/examples/00-introduction/01-dynamic-attributes/App.svelte +++ b/site/content/examples/00-introduction/01-dynamic-attributes/App.svelte @@ -1,7 +1,7 @@ -{name} dancing \ No newline at end of file +{name} dancing diff --git a/site/content/tutorial/01-introduction/03-dynamic-attributes/app-a/App.svelte b/site/content/tutorial/01-introduction/03-dynamic-attributes/app-a/App.svelte index f4ac7557da..03850a3670 100644 --- a/site/content/tutorial/01-introduction/03-dynamic-attributes/app-a/App.svelte +++ b/site/content/tutorial/01-introduction/03-dynamic-attributes/app-a/App.svelte @@ -1,5 +1,5 @@ - \ No newline at end of file + diff --git a/site/content/tutorial/01-introduction/03-dynamic-attributes/app-b/App.svelte b/site/content/tutorial/01-introduction/03-dynamic-attributes/app-b/App.svelte index e61b4d48e0..f2f9101d51 100644 --- a/site/content/tutorial/01-introduction/03-dynamic-attributes/app-b/App.svelte +++ b/site/content/tutorial/01-introduction/03-dynamic-attributes/app-b/App.svelte @@ -1,5 +1,5 @@ From 04890c73d24428a373e85f52694029b539908ba9 Mon Sep 17 00:00:00 2001 From: Ignatius Bagus Date: Wed, 22 Dec 2021 00:46:39 +0700 Subject: [PATCH 02/66] [docs] absolute and future proof links (#7038) --- ...17-08-07-the-easiest-way-to-get-started.md | 2 +- .../blog/2019-04-20-write-less-code.md | 4 +- ...19-04-22-svelte-3-rethinking-reactivity.md | 8 +-- site/content/docs/00-introduction.md | 6 +- site/content/docs/01-component-format.md | 14 ++--- site/content/docs/02-template-syntax.md | 18 +++--- site/content/docs/03-run-time.md | 58 +++++++++---------- .../03-logic/05-await-blocks/App.svelte | 4 +- .../02-named-slots/ContactCard.svelte | 6 +- .../00-svelte-self/File.svelte | 4 +- .../00-svelte-self/Folder.svelte | 4 +- .../04-svelte-body/App.svelte | 4 +- .../05-svelte-head/App.svelte | 4 +- site/content/faq/100-im-new-to-svelte.md | 4 +- .../01-introduction/01-basics/text.md | 2 +- .../01-introduction/07-making-an-app/text.md | 6 +- .../04-logic/06-await-blocks/app-a/App.svelte | 2 +- .../04-logic/06-await-blocks/app-b/App.svelte | 2 +- .../05-events/05-event-forwarding/text.md | 2 +- .../07-multiple-select-bindings/text.md | 2 +- .../tutorial/06-bindings/12-bind-this/text.md | 2 +- .../tutorial/07-lifecycle/01-onmount/text.md | 2 +- .../08-stores/02-auto-subscriptions/text.md | 2 +- .../08-stores/04-derived-stores/text.md | 2 +- .../04-custom-css-transitions/text.md | 2 +- .../tutorial/11-animations/01-animate/text.md | 2 +- .../03-named-slots/app-a/ContactCard.svelte | 6 +- .../03-named-slots/app-b/ContactCard.svelte | 6 +- .../15-context/01-context-api/text.md | 2 +- .../01-svelte-self/app-a/File.svelte | 4 +- .../01-svelte-self/app-a/Folder.svelte | 4 +- .../01-svelte-self/app-b/File.svelte | 4 +- .../01-svelte-self/app-b/Folder.svelte | 4 +- .../03-svelte-window/text.md | 2 +- .../05-svelte-body/app-a/App.svelte | 2 +- .../05-svelte-body/app-b/App.svelte | 2 +- .../06-svelte-head/app-b/App.svelte | 4 +- .../06-svelte-head/text.md | 2 +- .../07-svelte-options/text.md | 2 +- .../19-next-steps/01-congratulations/text.md | 6 +- 40 files changed, 109 insertions(+), 109 deletions(-) diff --git a/site/content/blog/2017-08-07-the-easiest-way-to-get-started.md b/site/content/blog/2017-08-07-the-easiest-way-to-get-started.md index 3a25f15b12..497433a8e7 100644 --- a/site/content/blog/2017-08-07-the-easiest-way-to-get-started.md +++ b/site/content/blog/2017-08-07-the-easiest-way-to-get-started.md @@ -12,7 +12,7 @@ Because of that, getting started with it can be a little bit confusing at first. ## 1. Use the REPL -The [Svelte REPL](repl) is the easiest way to begin. You can choose from a list of examples to get you started, and tweak them until they do what you want. +The [Svelte REPL](/repl) is the easiest way to begin. You can choose from a list of examples to get you started, and tweak them until they do what you want.

You'll need to have Node.js installed, and know how to use the terminal

diff --git a/site/content/blog/2019-04-20-write-less-code.md b/site/content/blog/2019-04-20-write-less-code.md index d56c5312e8..97e020af90 100644 --- a/site/content/blog/2019-04-20-write-less-code.md +++ b/site/content/blog/2019-04-20-write-less-code.md @@ -159,6 +159,6 @@ In Vue, meanwhile, we have a default export with a `data` function that returns ## Death to boilerplate -These are just some of the ways that Svelte helps you build user interfaces with a minimum of fuss. There are plenty of others — for example, [reactive declarations](tutorial/reactive-declarations) essentially do the work of React's `useMemo`, `useCallback` and `useEffect` without the boilerplate (or indeed the garbage collection overhead of creating inline functions and arrays on each state change). +These are just some of the ways that Svelte helps you build user interfaces with a minimum of fuss. There are plenty of others — for example, [reactive declarations](/tutorial/reactive-declarations) essentially do the work of React's `useMemo`, `useCallback` and `useEffect` without the boilerplate (or indeed the garbage collection overhead of creating inline functions and arrays on each state change). -How? By choosing a different set of constraints. Because [Svelte is a compiler](blog/frameworks-without-the-framework), we're not bound to the peculiarities of JavaScript: we can *design* a component authoring experience, rather than having to fit it around the semantics of the language. Paradoxically, this results in *more* idiomatic code — for example using variables naturally rather than via proxies or hooks — while delivering significantly more performant apps. +How? By choosing a different set of constraints. Because [Svelte is a compiler](/blog/frameworks-without-the-framework), we're not bound to the peculiarities of JavaScript: we can *design* a component authoring experience, rather than having to fit it around the semantics of the language. Paradoxically, this results in *more* idiomatic code — for example using variables naturally rather than via proxies or hooks — while delivering significantly more performant apps. diff --git a/site/content/blog/2019-04-22-svelte-3-rethinking-reactivity.md b/site/content/blog/2019-04-22-svelte-3-rethinking-reactivity.md index 89d71caf32..c372d2a85b 100644 --- a/site/content/blog/2019-04-22-svelte-3-rethinking-reactivity.md +++ b/site/content/blog/2019-04-22-svelte-3-rethinking-reactivity.md @@ -12,13 +12,13 @@ We think you're going to love it. ## What is Svelte? -Svelte is a component framework — like React or Vue — but with an important difference. Traditional frameworks allow you to write *declarative* state-driven code, but there's a penalty: the browser must do extra work to convert those declarative structures into DOM operations, using techniques like [virtual DOM diffing](blog/virtual-dom-is-pure-overhead) that eat into your frame budget and tax the garbage collector. +Svelte is a component framework — like React or Vue — but with an important difference. Traditional frameworks allow you to write *declarative* state-driven code, but there's a penalty: the browser must do extra work to convert those declarative structures into DOM operations, using techniques like [virtual DOM diffing](/blog/virtual-dom-is-pure-overhead) that eat into your frame budget and tax the garbage collector. Instead, Svelte runs at *build time*, converting your components into highly efficient *imperative* code that surgically updates the DOM. As a result, you're able to write ambitious applications with excellent performance characteristics. -The first version of Svelte was all about [testing a hypothesis](blog/frameworks-without-the-framework) — that a purpose-built compiler could generate rock-solid code that delivered a great user experience. The second was a small upgrade that tidied things up a bit. +The first version of Svelte was all about [testing a hypothesis](/blog/frameworks-without-the-framework) — that a purpose-built compiler could generate rock-solid code that delivered a great user experience. The second was a small upgrade that tidied things up a bit. -Version 3 is a significant overhaul. Our focus for the last five or six months has been on delivering an outstanding *developer* experience. It's now possible to write components with [significantly less boilerplate](blog/write-less-code) than you'll find elsewhere. Try the brand new [tutorial](tutorial) and see what we mean — if you're familiar with other frameworks we think you'll be pleasantly surprised. +Version 3 is a significant overhaul. Our focus for the last five or six months has been on delivering an outstanding *developer* experience. It's now possible to write components with [significantly less boilerplate](/blog/write-less-code) than you'll find elsewhere. Try the brand new [tutorial](/tutorial) and see what we mean — if you're familiar with other frameworks we think you'll be pleasantly surprised. To make that possible we first needed to rethink the concept at the heart of modern UI frameworks: reactivity. @@ -94,4 +94,4 @@ We don't take this lightly: hopefully once you've experienced Svelte 3 you'll un As grueling as this release has been, we're nowhere near finished. We have a ton of ideas for generating smarter, more compact code, and a long feature wish-list. [Sapper](https://sapper.svelte.dev), our Next.js-style app framework, is still in the middle of being updated to use Svelte 3. The [Svelte Native](https://svelte-native.technology/) community project, which allows you to write Android and iOS apps in Svelte, is making solid progress but deserves more complete support from core. We don't yet have the bounty of editor extensions, syntax highlighters, component kits, devtools and so on that other frameworks have, and we should fix that. We *really* want to add first-class TypeScript support. -But in the meantime we think Svelte 3 is the best way to build web apps yet. Take an hour to go through the [tutorial](tutorial) and we hope to convince you of the same. Either way, we'd love to see you in our [Discord chatroom](chat) and on [GitHub](https://github.com/sveltejs/svelte) — everyone is welcome, especially you. \ No newline at end of file +But in the meantime we think Svelte 3 is the best way to build web apps yet. Take an hour to go through the [tutorial](/tutorial) and we hope to convince you of the same. Either way, we'd love to see you in our [Discord chatroom](/chat) and on [GitHub](https://github.com/sveltejs/svelte) — everyone is welcome, especially you. diff --git a/site/content/docs/00-introduction.md b/site/content/docs/00-introduction.md index 2ca82a8698..2fece5534f 100644 --- a/site/content/docs/00-introduction.md +++ b/site/content/docs/00-introduction.md @@ -4,8 +4,8 @@ title: Before we begin This page contains detailed API reference documentation. It's intended to be a resource for people who already have some familiarity with Svelte. -If that's not you (yet), you may prefer to visit the [interactive tutorial](tutorial) or the [examples](examples) before consulting this reference. +If that's not you (yet), you may prefer to visit the [interactive tutorial](/tutorial) or the [examples](/examples) before consulting this reference. -Don't be shy about asking for help in the [Discord chatroom](chat). +Don't be shy about asking for help in the [Discord chatroom](/chat). -Using an older version of Svelte? Have a look at the [v2 docs](https://v2.svelte.dev). \ No newline at end of file +Using an older version of Svelte? Have a look at the [v2 docs](https://v2.svelte.dev). diff --git a/site/content/docs/01-component-format.md b/site/content/docs/01-component-format.md index cc2673d941..d1751320c0 100644 --- a/site/content/docs/01-component-format.md +++ b/site/content/docs/01-component-format.md @@ -28,7 +28,7 @@ A ` -{name} +{name} \ No newline at end of file + diff --git a/site/content/examples/17-special-elements/00-svelte-self/Folder.svelte b/site/content/examples/17-special-elements/00-svelte-self/Folder.svelte index c65e177983..7e9f667dd2 100644 --- a/site/content/examples/17-special-elements/00-svelte-self/Folder.svelte +++ b/site/content/examples/17-special-elements/00-svelte-self/Folder.svelte @@ -30,14 +30,14 @@ \ No newline at end of file + diff --git a/site/content/examples/17-special-elements/05-svelte-head/App.svelte b/site/content/examples/17-special-elements/05-svelte-head/App.svelte index 38089c9fdd..8323b56ad0 100644 --- a/site/content/examples/17-special-elements/05-svelte-head/App.svelte +++ b/site/content/examples/17-special-elements/05-svelte-head/App.svelte @@ -1,5 +1,5 @@ - + -

Hello world!

\ No newline at end of file +

Hello world!

diff --git a/site/content/faq/100-im-new-to-svelte.md b/site/content/faq/100-im-new-to-svelte.md index 0f1df9cff5..cfe5eb8ec0 100644 --- a/site/content/faq/100-im-new-to-svelte.md +++ b/site/content/faq/100-im-new-to-svelte.md @@ -2,6 +2,6 @@ question: I'm new to Svelte. Where should I start? --- -We think the best way to get started is playing through the interactive [Tutorial](tutorial). Each step there is mainly focused on one specific aspect and is easy to follow. You'll be editing and running real Svelte components right in your browser. +We think the best way to get started is playing through the interactive [Tutorial](/tutorial). Each step there is mainly focused on one specific aspect and is easy to follow. You'll be editing and running real Svelte components right in your browser. -Five to ten minutes should be enough to get you up and running. An hour and a half should get you through the entire tutorial. \ No newline at end of file +Five to ten minutes should be enough to get you up and running. An hour and a half should get you through the entire tutorial. diff --git a/site/content/tutorial/01-introduction/01-basics/text.md b/site/content/tutorial/01-introduction/01-basics/text.md index c0fa2f48a3..08ba922b42 100644 --- a/site/content/tutorial/01-introduction/01-basics/text.md +++ b/site/content/tutorial/01-introduction/01-basics/text.md @@ -4,7 +4,7 @@ title: Basics Welcome to the Svelte tutorial. This will teach you everything you need to know to build fast, small web applications easily. -You can also consult the [API docs](docs) and the [examples](examples), or — if you're impatient to start hacking on your machine locally — the [60-second quickstart](blog/the-easiest-way-to-get-started). +You can also consult the [API docs](/docs) and the [examples](/examples), or — if you're impatient to start hacking on your machine locally — the [60-second quickstart](/blog/the-easiest-way-to-get-started). ## What is Svelte? diff --git a/site/content/tutorial/01-introduction/07-making-an-app/text.md b/site/content/tutorial/01-introduction/07-making-an-app/text.md index ea387120e4..3e1589cd87 100644 --- a/site/content/tutorial/01-introduction/07-making-an-app/text.md +++ b/site/content/tutorial/01-introduction/07-making-an-app/text.md @@ -12,9 +12,9 @@ First, you'll need to integrate Svelte with a build tool. There are officially m ...and a variety of [community-maintained ones](https://sveltesociety.dev/tools). -Don't worry if you're relatively new to web development and haven't used these tools before. We've prepared a simple step-by-step guide, [Svelte for new developers](blog/svelte-for-new-developers), which walks you through the process. +Don't worry if you're relatively new to web development and haven't used these tools before. We've prepared a simple step-by-step guide, [Svelte for new developers](/blog/svelte-for-new-developers), which walks you through the process. -You'll also want to configure your text editor. There are [plugins](https://sveltesociety.dev/tools#editor-support) for many popular editors as well as an official [VS Code extension](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode). If your editor does not have a Svelte plugin then you can follow [this guide](blog/setting-up-your-editor) to configure your text editor to treat `.svelte` files the same as `.html` for the sake of syntax highlighting. +You'll also want to configure your text editor. There are [plugins](https://sveltesociety.dev/tools#editor-support) for many popular editors as well as an official [VS Code extension](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode). If your editor does not have a Svelte plugin then you can follow [this guide](/blog/setting-up-your-editor) to configure your text editor to treat `.svelte` files the same as `.html` for the sake of syntax highlighting. Then, once you've got your project set up, using Svelte components is easy. The compiler turns each component into a regular JavaScript class — just import it and instantiate with `new`: @@ -30,4 +30,4 @@ const app = new App({ }); ``` -You can then interact with `app` using the [component API](docs#run-time-client-side-component-api) if you need to. +You can then interact with `app` using the [component API](/docs#run-time-client-side-component-api) if you need to. diff --git a/site/content/tutorial/04-logic/06-await-blocks/app-a/App.svelte b/site/content/tutorial/04-logic/06-await-blocks/app-a/App.svelte index ae2acecf8b..c473065f63 100644 --- a/site/content/tutorial/04-logic/06-await-blocks/app-a/App.svelte +++ b/site/content/tutorial/04-logic/06-await-blocks/app-a/App.svelte @@ -1,6 +1,6 @@ -{name} +{name} \ No newline at end of file + diff --git a/site/content/tutorial/16-special-elements/01-svelte-self/app-a/Folder.svelte b/site/content/tutorial/16-special-elements/01-svelte-self/app-a/Folder.svelte index 1108b3575c..e93ffdc548 100644 --- a/site/content/tutorial/16-special-elements/01-svelte-self/app-a/Folder.svelte +++ b/site/content/tutorial/16-special-elements/01-svelte-self/app-a/Folder.svelte @@ -29,14 +29,14 @@ \ No newline at end of file + diff --git a/site/content/tutorial/16-special-elements/01-svelte-self/app-b/Folder.svelte b/site/content/tutorial/16-special-elements/01-svelte-self/app-b/Folder.svelte index 11049c2e52..d3fc3a431f 100644 --- a/site/content/tutorial/16-special-elements/01-svelte-self/app-b/Folder.svelte +++ b/site/content/tutorial/16-special-elements/01-svelte-self/app-b/Folder.svelte @@ -29,14 +29,14 @@ \ No newline at end of file + diff --git a/site/content/tutorial/06-bindings/12-bind-this/app-a/App.svelte b/site/content/tutorial/06-bindings/12-bind-this/app-a/App.svelte index cf08455942..9c30979ace 100644 --- a/site/content/tutorial/06-bindings/12-bind-this/app-a/App.svelte +++ b/site/content/tutorial/06-bindings/12-bind-this/app-a/App.svelte @@ -46,7 +46,7 @@ width: 100%; height: 100%; background-color: #666; - -webkit-mask: url(svelte-logo-mask.svg) 50% 50% no-repeat; - mask: url(svelte-logo-mask.svg) 50% 50% no-repeat; + -webkit-mask: url(/svelte-logo-mask.svg) 50% 50% no-repeat; + mask: url(/svelte-logo-mask.svg) 50% 50% no-repeat; } diff --git a/site/content/tutorial/06-bindings/12-bind-this/app-b/App.svelte b/site/content/tutorial/06-bindings/12-bind-this/app-b/App.svelte index 0e53c533ac..5714f3149a 100644 --- a/site/content/tutorial/06-bindings/12-bind-this/app-b/App.svelte +++ b/site/content/tutorial/06-bindings/12-bind-this/app-b/App.svelte @@ -47,7 +47,7 @@ width: 100%; height: 100%; background-color: #666; - -webkit-mask: url(svelte-logo-mask.svg) 50% 50% no-repeat; - mask: url(svelte-logo-mask.svg) 50% 50% no-repeat; + -webkit-mask: url(/svelte-logo-mask.svg) 50% 50% no-repeat; + mask: url(/svelte-logo-mask.svg) 50% 50% no-repeat; } From c183bae3d107cdc0a646ecae493d2ba044b009fb Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Fri, 24 Dec 2021 22:47:32 +0100 Subject: [PATCH 04/66] [chore] adjust stale bot actions per run Only one action per hour to not flood the issue tracker with too many stale messages at once --- .github/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/stale.yml b/.github/stale.yml index 3bc3fa6b99..c95bc4cf22 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -28,7 +28,7 @@ staleLabel: stale-bot # Your comment here. # Limit the number of actions per hour, from 1-30. Default is 30 -limitPerRun: 30 +limitPerRun: 1 # Optionally, specify configuration settings that are specific to just 'issues' or 'pulls': pulls: From f73dc07980f027d4ce2486f386b1f1dcd51e5be8 Mon Sep 17 00:00:00 2001 From: Ignatius Bagus Date: Sat, 25 Dec 2021 09:31:09 +0700 Subject: [PATCH 05/66] [docs] absolute sibling links (#7051) --- .../content/blog/2017-08-07-the-easiest-way-to-get-started.md | 2 +- .../2017-12-31-sapper-towards-the-ideal-web-app-framework.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/site/content/blog/2017-08-07-the-easiest-way-to-get-started.md b/site/content/blog/2017-08-07-the-easiest-way-to-get-started.md index 497433a8e7..72d9d8895b 100644 --- a/site/content/blog/2017-08-07-the-easiest-way-to-get-started.md +++ b/site/content/blog/2017-08-07-the-easiest-way-to-get-started.md @@ -52,7 +52,7 @@ npm run dev This will create a new project in the `my-svelte-project` directory, install its dependencies, and start a server on http://localhost:5000. -You can find more information about using TypeScript [here](blog/svelte-and-typescript). +You can find more information about using TypeScript [here](/blog/svelte-and-typescript). Once you've tinkered a bit and understood how everything fits together, you can fork [sveltejs/template](https://github.com/sveltejs/template) and start doing this instead: diff --git a/site/content/blog/2017-12-31-sapper-towards-the-ideal-web-app-framework.md b/site/content/blog/2017-12-31-sapper-towards-the-ideal-web-app-framework.md index a79042c63f..42ed7012b9 100644 --- a/site/content/blog/2017-12-31-sapper-towards-the-ideal-web-app-framework.md +++ b/site/content/blog/2017-12-31-sapper-towards-the-ideal-web-app-framework.md @@ -38,7 +38,7 @@ We can do better! ## The compiler-as-framework paradigm shift -[Svelte introduced a radical idea](blog/frameworks-without-the-framework): what if your UI framework wasn't a framework at all, but a compiler that turned your components into standalone JavaScript modules? Instead of using a library like React or Vue, which knows nothing about your app and must therefore be a one-size-fits-all solution, we can ship highly-optimised vanilla JavaScript. Just the code your app needs, and without the memory and performance overhead of solutions based on a virtual DOM. +[Svelte introduced a radical idea](/blog/frameworks-without-the-framework): what if your UI framework wasn't a framework at all, but a compiler that turned your components into standalone JavaScript modules? Instead of using a library like React or Vue, which knows nothing about your app and must therefore be a one-size-fits-all solution, we can ship highly-optimised vanilla JavaScript. Just the code your app needs, and without the memory and performance overhead of solutions based on a virtual DOM. The JavaScript world is [moving towards this model](https://tomdale.net/2017/09/compilers-are-the-new-frameworks/). [Stencil](https://stenciljs.com), a Svelte-inspired framework from the Ionic team, compiles to web components. [Glimmer](https://glimmerjs.com) *doesn't* compile to standalone JavaScript (the pros and cons of which deserve a separate blog post), but the team is doing some fascinating research around compiling templates to bytecode. (React is [getting in on the action](https://twitter.com/trueadm/status/944908776896978946), though their current research focuses on optimising your JSX app code, which is arguably more similar to the ahead-of-time optimisations that Angular, Ractive and Vue have been doing for a few years.) @@ -66,7 +66,7 @@ But size is only part of the story. Svelte apps are also extremely performant an The biggest drawback for many developers evaluating Sapper would be 'but I like React, and I already know how to use it', which is fair. -If you're in that camp, I'd invite you to at least try alternative frameworks. You might be pleasantly surprised! The [Sapper RealWorld](https://github.com/sveltejs/realworld) implementation totals 1,201 lines of source code, compared to 2,377 for the reference implementation, because you're able to express concepts very concisely using Svelte's template syntax (which [takes all of five minutes to master](https://v2.svelte.dev/guide#template-syntax)). You get [scoped CSS](blog/the-zen-of-just-writing-css), with unused style removal and minification built-in, and you can use preprocessors like LESS if you want. You no longer need to use Babel. SSR is ridiculously fast, because it's just string concatenation. And we recently introduced [svelte/store](https://v2.svelte.dev/guide#state-management), a tiny global store that synchronises state across your component hierarchy with zero boilerplate. The worst that can happen is that you'll end up feeling vindicated! +If you're in that camp, I'd invite you to at least try alternative frameworks. You might be pleasantly surprised! The [Sapper RealWorld](https://github.com/sveltejs/realworld) implementation totals 1,201 lines of source code, compared to 2,377 for the reference implementation, because you're able to express concepts very concisely using Svelte's template syntax (which [takes all of five minutes to master](https://v2.svelte.dev/guide#template-syntax)). You get [scoped CSS](/blog/the-zen-of-just-writing-css), with unused style removal and minification built-in, and you can use preprocessors like LESS if you want. You no longer need to use Babel. SSR is ridiculously fast, because it's just string concatenation. And we recently introduced [svelte/store](https://v2.svelte.dev/guide#state-management), a tiny global store that synchronises state across your component hierarchy with zero boilerplate. The worst that can happen is that you'll end up feeling vindicated! But there are trade-offs nonetheless. Some people have a pathological aversion to any form of 'template language', and maybe that applies to you. JSX proponents will clobber you with the 'it's just JavaScript' mantra, and therein lies React's greatest strength, which is that it is infinitely flexible. That flexibility comes with its own set of trade-offs, but we're not here to discuss those. From 84669b5a6c085a2528725684995581721a0d2687 Mon Sep 17 00:00:00 2001 From: Tyler Smith Date: Sun, 26 Dec 2021 20:23:12 -0800 Subject: [PATCH 06/66] [docs] Updated link to the ease visualizer in the docs (#7054) --- site/content/blog/2021-03-01-whats-new-in-svelte-march-2021.md | 2 +- site/content/docs/03-run-time.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/site/content/blog/2021-03-01-whats-new-in-svelte-march-2021.md b/site/content/blog/2021-03-01-whats-new-in-svelte-march-2021.md index d009d37391..45a03444c7 100644 --- a/site/content/blog/2021-03-01-whats-new-in-svelte-march-2021.md +++ b/site/content/blog/2021-03-01-whats-new-in-svelte-march-2021.md @@ -10,7 +10,7 @@ Lots to cover this month with releases from across the Svelte ecosystem. Most im Let's dive into the news 🐬 ## What's new in `sveltejs/svelte` -* SSR store handling has been reworked to subscribe and unsubscribe as in DOM mode. SSR stores should work much more consistently now (**3.31.2**, see [custom stores](https://svelte.dev/examples#custom-stores) and [Server-side component API ](https://svelte.dev/docs#run-time-server-side-component-api)) +* SSR store handling has been reworked to subscribe and unsubscribe as in DOM mode. SSR stores should work much more consistently now (**3.31.2**, see [custom stores](https://svelte.dev/examples/custom-stores) and [Server-side component API ](https://svelte.dev/docs#run-time-server-side-component-api)) * Multiple instances of the same action are now allowed on an element (**3.32.0**, [example](https://svelte.dev/repl/01a14375951749dab9579cb6860eccde?version=3.32.0)) * The new `foreign` namespace should make it easier for alternative compile targets (like Svelte Native and SvelteGUI) by disabling certain HTML5-specific behaviour and checks (**3.32.0**, [more info](https://github.com/sveltejs/svelte/pull/5652)) * Support for inline comment sourcemaps in code from preprocessors (**3.32.0**) diff --git a/site/content/docs/03-run-time.md b/site/content/docs/03-run-time.md index 8c5e15fc9a..c4a8b76e65 100644 --- a/site/content/docs/03-run-time.md +++ b/site/content/docs/03-run-time.md @@ -879,7 +879,7 @@ You can see a full example on the [animations tutorial](/tutorial/animate) Easing functions specify the rate of change over time and are useful when working with Svelte's built-in transitions and animations as well as the tweened and spring utilities. `svelte/easing` contains 31 named exports, a `linear` ease and 3 variants of 10 different easing functions: `in`, `out` and `inOut`. -You can explore the various eases using the [ease visualiser](/examples#easing) in the [examples section](/examples). +You can explore the various eases using the [ease visualiser](/examples/easing) in the [examples section](/examples). | ease | in | out | inOut | From 6f2ebaa76dca1e146389f2d682a54cadfa06e21d Mon Sep 17 00:00:00 2001 From: Enrico Spinielli Date: Mon, 27 Dec 2021 19:40:47 +0100 Subject: [PATCH 07/66] [docs] use proper symbol for Celsius and Fahrenheit (#7061) --- .../examples/20-7guis/02-7guis-temperature/App.svelte | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/site/content/examples/20-7guis/02-7guis-temperature/App.svelte b/site/content/examples/20-7guis/02-7guis-temperature/App.svelte index fce279ed76..a98a5fd06c 100644 --- a/site/content/examples/20-7guis/02-7guis-temperature/App.svelte +++ b/site/content/examples/20-7guis/02-7guis-temperature/App.svelte @@ -14,11 +14,11 @@ - °c = - °f + °C = + °F \ No newline at end of file + From 72d40e99b0337ff2ec0369b4c75a30acb3aa1e95 Mon Sep 17 00:00:00 2001 From: Maxi Ferreira Date: Mon, 27 Dec 2021 22:03:36 -0800 Subject: [PATCH 08/66] [docs] fix typo in Context API tutorial (#7063) --- site/content/tutorial/15-context/01-context-api/text.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/content/tutorial/15-context/01-context-api/text.md b/site/content/tutorial/15-context/01-context-api/text.md index 53695b7d69..efb6157652 100644 --- a/site/content/tutorial/15-context/01-context-api/text.md +++ b/site/content/tutorial/15-context/01-context-api/text.md @@ -11,7 +11,7 @@ There are two halves to the context API — `setContext` and `getContext`. If a Let's set the context first. In `Map.svelte`, import `setContext` from `svelte` and `key` from `mapbox.js` and call `setContext`: ```js -import { onMount, setContext } from 'svelte'; +import { onDestroy, setContext } from 'svelte'; import { mapbox, key } from './mapbox.js'; setContext(key, { From 99a04c464d07cd87e2ebd878a1ef629bc27b2a4c Mon Sep 17 00:00:00 2001 From: Ignatius Bagus Date: Tue, 28 Dec 2021 13:17:44 +0700 Subject: [PATCH 09/66] [docs] mention tweened duration as function Resolves #3353 --- site/content/docs/03-run-time.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/content/docs/03-run-time.md b/site/content/docs/03-run-time.md index c4a8b76e65..54228f5c2a 100644 --- a/site/content/docs/03-run-time.md +++ b/site/content/docs/03-run-time.md @@ -445,7 +445,7 @@ store = tweened(value: any, options) Tweened stores update their values over a fixed duration. The following options are available: * `delay` (`number`, default 0) — milliseconds before starting -* `duration` (`number`, default 400) — milliseconds the tween lasts +* `duration` (`number` | `function`, default 400) — milliseconds the tween lasts * `easing` (`function`, default `t => t`) — an [easing function](/docs#run-time-svelte-easing) * `interpolate` (`function`) — see below From a4963d7c0e7c23a682b22b194966fd05bc9d52c3 Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Thu, 30 Dec 2021 16:10:46 +0100 Subject: [PATCH 10/66] [chore] delete stale bot yaml config The stale bot was removed so there's no use for having the config anymore --- .github/stale.yml | 52 ----------------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 .github/stale.yml diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index c95bc4cf22..0000000000 --- a/.github/stale.yml +++ /dev/null @@ -1,52 +0,0 @@ -# Configuration for probot-stale - https://github.com/probot/stale - -# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled) -onlyLabels: [] - -# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable -exemptLabels: - - popular - - pinned - - security - - bug - - "[Status] Maybe Later" - -# Set to true to ignore issues in a project (defaults to false) -exemptProjects: false - -# Set to true to ignore issues in a milestone (defaults to false) -exemptMilestones: false - -# Set to true to ignore issues with an assignee (defaults to false) -exemptAssignees: false - -# Label to use when marking as stale -staleLabel: stale-bot - -# Comment to post when removing the stale label. -# unmarkComment: > -# Your comment here. - -# Limit the number of actions per hour, from 1-30. Default is 30 -limitPerRun: 1 - -# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls': -pulls: - daysUntilStale: 210 - daysUntilClose: 25 - markComment: > - This pull request has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. - closeComment: > - This pull request has been closed as it was previously marked as stale and saw no subsequent activity. - -issues: - daysUntilStale: 180 - daysUntilClose: 14 - markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. - closeComment: > - This issue has been closed as it was previously marked as stale and saw no subsequent activity. From ca2aedfb6c2d5f8eab07cac9ab31f14f043e209e Mon Sep 17 00:00:00 2001 From: Daniel Sandoval Date: Sat, 1 Jan 2022 04:47:02 -1000 Subject: [PATCH 11/66] [docs] "What's new in Svelte" January newsletter (#7074) --- ...-01-01-whats-new-in-svelte-january-2022.md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 site/content/blog/2022-01-01-whats-new-in-svelte-january-2022.md diff --git a/site/content/blog/2022-01-01-whats-new-in-svelte-january-2022.md b/site/content/blog/2022-01-01-whats-new-in-svelte-january-2022.md new file mode 100644 index 0000000000..bf7bc3df57 --- /dev/null +++ b/site/content/blog/2022-01-01-whats-new-in-svelte-january-2022.md @@ -0,0 +1,77 @@ +--- +title: "What's new in Svelte: January 2022" +description: "Faster builds with SvelteKit and a much anticipated REPL feature" +author: Daniel Sandoval +authorURL: https://desandoval.net +--- + +Happy new year, Svelte Community! Lots to share this month across Svelte, SvelteKit, Language Tools and the Showcase. Thanks to everyone who made 2021 a great year to use Svelte. Looking forward to the next one 🚀 + +## What's new in SvelteKit +- `@sveltejs/adapter-static` for SvelteKit now has a `precompress` option to make brotli compression of assets and pages easier to do out of the box ([#3079](https://github.com/sveltejs/kit/pull/3079)) +- Concurrency mode in SvelteKit will now prerender pages in parallel ([#3120](https://github.com/sveltejs/kit/pull/3120)). It is enabled by default in `1.0.0-next.205` and later +- CSS is now automatically included before JS for improved page performance ([d13efe](https://github.com/sveltejs/kit/commit/d138efe21692f5925f1e89afc0a33f42d6a1a711)) +- A new config option adds the ability to disable service worker registration to do your own custom registration ([#2988](https://github.com/sveltejs/kit/pull/2988)) +- SSR route-splitting is here - breaking monolithic builds into smaller pieces for improved startup and routing performance ([#2931](https://github.com/sveltejs/kit/pull/2931)) +- `request.origin/path/query` is now `request.url` - simplifying the config and page `load` functions ([#3126](https://github.com/sveltejs/kit/pull/3126)) +- After the [update to Vite 2.7](https://github.com/sveltejs/kit/pull/3018), SvelteKit users are [reporting significant performance improvements](https://www.reddit.com/r/sveltejs/comments/rljhfc/sveltekit_massive_compiler_improvement_by/) and loading third-parties libraries in SSR has also been greatly improved +- SvelteKit server will now automatically restart when the config files is changed ([vite-plugin-svelte#237](https://github.com/sveltejs/vite-plugin-svelte/pull/237)) + + +## Other new bits from `svelte/*` +- [Svelte 3.44.3](https://github.com/sveltejs/svelte/blob/master/CHANGELOG.md#3443) is out with a few bug fixes in the binding and loop code +- Svelte Language Tools has introduced support for the then/catch shorthands from Svelte 3.41 and TypeScript's "go to" functionality ([105.8.0 and later](https://github.com/sveltejs/language-tools/releases/tag/extensions-105.8.0)) +- The Svelte REPL got a nice upgrade as well - letting you delete saved REPLs. Try it out by logging in at [svelte.dev/apps](https://svelte.dev/apps) + + +--- + +## Community Showcase + +**Apps & Sites** +- [Discover Twitter Spaces](https://github.com/navneetsharmaui/discover-twitter-spaces) is a tool that helps you find the Twitter Spaces +- [Modern Fluid Typography Editor](https://github.com/codeAdrian/modern-fluid-typography-editor) helps create beautiful fluid typography using CSS clamp +- [Unnwhiteboard](https://github.com/AviKKi/unnwhiteboard) is a job board for companies (or teams) that don't do "whiteboard" interviews +- [Secret Santa](https://gitlab.com/arturoguzman/secret-santa-sveltekit) is a gift giving coordination app developed with easiness in mind +- [LogSnag](https://logsnag.com/) notifies you of your projects' events and provides you with a timeline to keep track of anything important that happens +- [Version 0.2 of Tangent](http://tangentnotes.com/Download), a Svelte-based note writing app, is now in beta +- [Intl Explorer](https://github.com/jesperorb/intl-explorer) is a tool for viewing output for all possible formatters for Intl + +A lot of work this month has gone into migrating the Svelte main website and Svelte REPL to live in the https://github.com/sveltejs/sites repository - including a brand new homepage for [svelte.dev](https://svelte.dev/). Thanks to all the contributors who made this possible! + +If you're looking for a fun SvelteKit project to work on, [you can contribute to the Svelte Society site rewrite](https://github.com/svelte-society/sveltesociety-2021/issues) 💅 + + +**Learning and Listening** + +_To Read_ +- [Mutating Query Params in SvelteKit Without Page Reloads or Navigations](https://dev.to/mohamadharith/mutating-query-params-in-sveltekit-without-page-reloads-or-navigations-2i2b) by Mohamad Harith +- [Svelte for Reactaholics : A guide for React developers](https://www.100ms.live/blog/svelte-guide-for-react-developers) by Puru Vijay +- [Svelte's lifecycle methods can be used anywhere](https://geoffrich.net/posts/svelte-lifecycle-examples/) and [The many meanings of $ in Svelte](https://geoffrich.net/posts/svelte-$-meanings/) by Geoff Rich +- [Vercel and Svelte: A Perfect Match for Web Developers](https://thenewstack.io/vercel-and-svelte-a-perfect-match-for-web-developers/) by Darryl K. Taft +- [User-defined TailwindCSS Color Scheme with Svelte Stores](https://blog.dayslice.io/user-defined-tailwindcss-color-scheme-with-svelte-stores-ad80ca2cf038) by jeremy zaborowski +- [Ionic 6 + Svelte 🚀](https://medium.com/@raymondboswel/ionic-6-svelte-ae904caa82df) by Raymond Boswel +- [What happened in #Svelte language tools this year](https://twitter.com/dummdidumm_/status/1474158105395179525?t=ytj2K2Q52iD5-lNyLnQaAQ&s=19) by Simon H + +_To Watch_ +- [The Future of Svelte (Interview with Rich Harris)](https://www.youtube.com/watch?v=uQntFkK8Z54) by Lee Robinson, Director of Developer Relations at Vercel +- [Svelte is becoming the go-to framework](https://www.youtube.com/watch?v=fo6BKY2xR2w&t=1834s) for Obsidian plugin developers +- [Sveltekit WordPress Headless Blog](https://www.youtube.com/watch?v=c0UDVgjPxFw) by WebJeda +- [Getting started with SvelteKit](https://www.youtube.com/watch?v=i2suPKMPUFA) by Lihau Tan +- [Deploy a full-stack SvelteKit app on Cloudflare Pages](https://www.youtube.com/watch?v=Wc1_U6Dy5Tw) by 1nf + +_To Listen To_ +- [Syntax podcast: How To Do Things In Svelte](https://podcasts.apple.com/ca/podcast/how-to-do-things-in-svelte/id1253186678?i=1000544796072) +- [JS Party #205: So much Sveltey goodness (w/ Rich Harris)](https://changelog.com/jsparty/205) + +**Libraries, Tools & Components** +- [svelte-headlessui](https://github.com/rgossiaux/svelte-headlessui) is an unofficial, complete Svelte port of the Headless UI component library +- [svelte-forms v2](https://chainlist.github.io/svelte-forms/) has been released - the author is [looking for feedback](https://www.reddit.com/r/sveltejs/comments/r6354j/svelteforms_v2_has_been_released/) +- [Percival](https://github.com/ekzhang/percival) is a declarative data query and visualization language +- [Svelte FlatList](https://github.com/snuffyDev/svelte-flatlist) is a mobile-friendly, simple, and customizable draggable menu +- [svelte-keyed](https://github.com/bryanmylee/svelte-keyed) is a writable derived store for objects and arrays +- [Svemix](https://github.com/svemix/svemix) is Remix for Svelte - providing server scripts inside your Svelte components/routes, which will be transformed into endpoints + +Want to add something to the showcase? Need help bringing your next idea to life in Svelte? Join us on [Reddit](https://www.reddit.com/r/sveltejs/) or [Discord](https://discord.com/invite/yy75DKs). + +See ya next month! From 9221f216c6af7531c6f32671cd84d4f7eebb0003 Mon Sep 17 00:00:00 2001 From: Gabriel Francisco Date: Sun, 2 Jan 2022 17:47:24 -0300 Subject: [PATCH 12/66] Update license year (#7091) --- LICENSE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.md b/LICENSE.md index cbf510847f..cd8f94f4ca 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -Copyright (c) 2016-21 [these people](https://github.com/sveltejs/svelte/graphs/contributors) +Copyright (c) 2016-22 [these people](https://github.com/sveltejs/svelte/graphs/contributors) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: From 84a4ef07c97cd70f92ec58fbb310719db0f48f42 Mon Sep 17 00:00:00 2001 From: James Bradbury Date: Mon, 3 Jan 2022 10:33:08 +0000 Subject: [PATCH 13/66] [feat] add a11y-no-redundant-roles check (#7067) Part of #820 Closes #5361 Co-authored-by: mhatvan --- src/compiler/compile/compiler_warnings.ts | 4 + src/compiler/compile/nodes/Element.ts | 73 ++ .../a11y-no-redundant-roles/input.svelte | 44 ++ .../a11y-no-redundant-roles/warnings.json | 632 ++++++++++++++++++ 4 files changed, 753 insertions(+) create mode 100644 test/validator/samples/a11y-no-redundant-roles/input.svelte create mode 100644 test/validator/samples/a11y-no-redundant-roles/warnings.json diff --git a/src/compiler/compile/compiler_warnings.ts b/src/compiler/compile/compiler_warnings.ts index bfcd779fc7..86ec98cb8b 100644 --- a/src/compiler/compile/compiler_warnings.ts +++ b/src/compiler/compile/compiler_warnings.ts @@ -76,6 +76,10 @@ export default { code: 'a11y-unknown-role', message: `A11y: Unknown role '${role}'` + (suggestion ? ` (did you mean '${suggestion}'?)` : '') }), + a11y_no_redundant_roles: (role: string | boolean) => ({ + code: 'a11y-no-redundant-roles', + message: `A11y: Redundant role '${role}'` + }), a11y_accesskey: { code: 'a11y-accesskey', message: 'A11y: Avoid using accesskey' diff --git a/src/compiler/compile/nodes/Element.ts b/src/compiler/compile/nodes/Element.ts index 837a0296d0..bf81599bf6 100644 --- a/src/compiler/compile/nodes/Element.ts +++ b/src/compiler/compile/nodes/Element.ts @@ -70,6 +70,46 @@ const a11y_labelable = new Set([ 'textarea' ]); +const a11y_nested_implicit_semantics = new Map([ + ['header', 'banner'], + ['footer', 'contentinfo'] +]); + +const a11y_implicit_semantics = new Map([ + ['a', 'link'], + ['aside', 'complementary'], + ['body', 'document'], + ['datalist', 'listbox'], + ['dd', 'definition'], + ['dfn', 'term'], + ['details', 'group'], + ['dt', 'term'], + ['fieldset', 'group'], + ['form', 'form'], + ['h1', 'heading'], + ['h2', 'heading'], + ['h3', 'heading'], + ['h4', 'heading'], + ['h5', 'heading'], + ['h6', 'heading'], + ['hr', 'separator'], + ['li', 'listitem'], + ['menu', 'list'], + ['nav', 'navigation'], + ['ol', 'list'], + ['optgroup', 'group'], + ['output', 'status'], + ['progress', 'progressbar'], + ['section', 'region'], + ['summary', 'button'], + ['tbody', 'rowgroup'], + ['textarea', 'textbox'], + ['tfoot', 'rowgroup'], + ['thead', 'rowgroup'], + ['tr', 'row'], + ['ul', 'list'] +]); + const invisible_elements = new Set(['meta', 'html', 'script', 'style']); const valid_modifiers = new Set([ @@ -98,6 +138,23 @@ const react_attributes = new Map([ const attributes_to_compact_whitespace = ['class', 'style']; +function is_parent(parent: INode, elements: string[]) { + let check = false; + + while (parent) { + const parent_name = (parent as Element).name; + if (elements.includes(parent_name)) { + check = true; + break; + } + if (parent.type === 'Element') { + break; + } + parent = parent.parent; + } + return check; +} + function get_namespace(parent: Element, element: Element, explicit_namespace: string) { const parent_element = parent.find_nearest(/^Element/); @@ -351,6 +408,22 @@ export default class Element extends Node { const match = fuzzymatch(value, aria_roles); component.warn(attribute, compiler_warnings.a11y_unknown_role(value, match)); } + + // no-redundant-roles + const has_redundant_role = value === a11y_implicit_semantics.get(this.name); + + if (this.name === value || has_redundant_role) { + component.warn(attribute, compiler_warnings.a11y_no_redundant_roles(value)); + } + + // Footers and headers are special cases, and should not have redundant roles unless they are the children of sections or articles. + const is_parent_section_or_article = is_parent(this.parent, ['section', 'article']); + if (!is_parent_section_or_article) { + const has_nested_redundant_role = value === a11y_nested_implicit_semantics.get(this.name); + if (has_nested_redundant_role) { + component.warn(attribute, compiler_warnings.a11y_no_redundant_roles(value)); + } + } } // no-access-key diff --git a/test/validator/samples/a11y-no-redundant-roles/input.svelte b/test/validator/samples/a11y-no-redundant-roles/input.svelte new file mode 100644 index 0000000000..05525effb6 --- /dev/null +++ b/test/validator/samples/a11y-no-redundant-roles/input.svelte @@ -0,0 +1,44 @@ +a link +
+
+ +