Zum Inhalt springen

Svelte Release Notes

Einträge
181
Quellen
2
Zuletzt aktualisiert

Folge Svelte, um die Release Notes in deinen Feed zu holen.

Svelte

Svelte: Neuerungen im Mai 2021

Der Svelte-Compiler unterstützt :global() in zusammengesetzten Selektoren und CSS-Custom-Properties; SvelteKit bietet SPA-Erstellung, deaktivierbares SSR und bessere Fehlermeldungen.

Last week, Svelte Summit blew us away with a mountain of content! Check out the full recording or an audio-only (p)review on Svelte Radio. Now let’s get into this month’s news...

New features in the Svelte Compiler

  • :global() is now supported as part of compound CSS selectors (3.38.0, Example)
  • CSS custom properties can now be passed to components for use cases such as theming (3.38.0, Docs coming soon)

New in SvelteKit

  • kit.svelte.dev has a fresh new look and the SvelteKit Demo Site got a fresh set of paint. Check it out by running npm init svelte@next
  • You can now use @sveltejs/adapter-static to create a single-page app or SPA by specifying a fallback page (PR, Docs)
  • Disable Server-side Rendering (SSR) app-wide or on a page-by-page basis (PR)
  • Error messages thrown during pre-rendering are now much more informative and readable (PR, Docs) …

Originalquelle(öffnet in neuem Tab)Problem melden

Svelte

Svelte: Neuerungen im April 2021

SvelteKit ist jetzt in der öffentlichen Beta; Svelte 3.35.0 führt Slotted Components ein und die Language Tools unterstützen verknüpftes Bearbeiten von HTML.

Two projects that have been months (even years) in the making have made their way out into the world. SvelteKit is now in public beta and slotted components are now available in Svelte!

What’s up with SvelteKit?

SvelteKit - Svelte’s versatile framework for building SSR, serverless applications, or SPAs - is now officially in public beta. Expect bugs! Lots more detail in the latest blog post. Want to know when 1.0 is close? Check out the milestone on github.

Want to learn more about how to get started, what’s different compared to Sapper, new features and migration paths? Check out this week’s episode of Svelte Radio for a deep dive with Antony, Kev and Swyx.

New in Svelte & Language Tools

  • Slotted components, including <svelte:fragment slot="..."> lets component consumers target specific slots with rich content (Svelte 3.35.0, Language Tools 104.5.0)
  • Linked editing now works for HTML in Svelte files (Language Tools, 104.6.0) …

Originalquelle(öffnet in neuem Tab)Problem melden

Svelte

SvelteKit in öffentlicher Beta

Previously: What's the deal with SvelteKit?

It’s time. After five months and hundreds of commits, you’re finally invited to try out the SvelteKit beta. It’s not finished — there are a few known bugs and several missing features — but we’re really happy with how it’s shaping up and can’t wait for you to try it.

Starting a new project is easy:

# create the project
mkdir my-app
cd my-app
npm init svelte@next

# install dependencies
npm install

# start dev server and open a browser tab
npm run dev -- --open

You’ll find documentation at svelte.dev/docs/kit. If you have a Sapper app that you’d like to migrate to SvelteKit, you’ll find instructions on GitHub.

The source code is available at github.com/sveltejs/kit. Issues and pull requests are disabled while we finish getting our house in order, but we’ll be making it fully open in the near future.

Wait, what is SvelteKit?

Think of it as Next for Svelte. It’s a framework for building apps with Svelte, complete with server-side rendering, routing, code-splitting for JS and CSS, adapters for different serverless platforms and so on.

If you’re familiar with Sapper, SvelteKit is Sapper’s successor. …

Originalquelle(öffnet in neuem Tab)Problem melden

Svelte

Svelte: Neuerungen im März 2021

Svelte 3.31.2 bis 3.33.0 verbessern die SSR-Store-Behandlung, erlauben mehrere Aktionsinstanzen pro Element, führen den foreign-Namespace ein und unterstützen Inline-Sourcemaps.

Lots to cover this month with releases from across the Svelte ecosystem. Most importantly, Svelte Summit Spring 2021 has an Open Call for Speakers. The deadline is March 14 so if you have an idea for a talk, submit it now!

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 and Server-side component API )
  • Multiple instances of the same action are now allowed on an element (3.32.0, example)
  • 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)
  • Support for inline comment sourcemaps in code from preprocessors (3.32.0)
  • Destructured defaults are now allowed to refer to other variables (3.33.0, example) …

Originalquelle(öffnet in neuem Tab)Problem melden

Svelte

Svelte: Neuerungen im Februar 2021

Der Compiler erkennt Aria-Rollen aus dem WAI-ARIA Graphics Module und warnt bei React-Attributen; die Language Tools verbessern Umbenennungen und semantische Hervorhebung.

With the shortest month of the year coming up, Svelte maintainers and community members alike have been busy this last month – from big changes in svelte-loader, prettier-plugin-svelte, rollup-plugin-svelte, and language-tools to steady progress in Sapper and svelte-preprocess. Meanwhile, lots of folks have been busy integrating Svelte with other popular frameworks.

New compiler features

  • Aria roles from the WAI-ARIA Graphics Module are now recognized as valid aria roles in Svelte components (3.31.1)
  • Compiler warnings for the common React attributes, className and htmlFor, now make it easier to port React components to Svelte (3.31.1)

Have a suggestion for a compiler feature or want to help implement new features/bug fixes? Check out the “triage: good first issue” tag for Svelte

New bits in language-tools

  • User disabled auto import suggestions no longer show in VS Code (103.0.0)
  • Renaming a variable is now safer with smart additions of a prefix/suffix to renamed variables (104.0.0)
  • Semantic (token) highlighting for TypeScript users lets theme makers apply semantic styling in their themes, if they support it (104.0.0) …

Originalquelle(öffnet in neuem Tab)Problem melden

Svelte

Svelte: Neuerungen im Januar 2021

Die Klasse SvelteComponent wurde zu SvelteComponentTyped umbenannt; Sapper 0.29.0 bringt neue TypeScript-Definitionen und Router-Verbesserungen.

Happy new year from Svelte! In the last month we made progress on Sapper’s upcoming release, fine-tuned our SvelteComponent typings, and have seen some amazing apps, sites, and libraries coming out in the showcase.

What’s changed in Svelte?

A new minor release replaces the SvelteComponent class with a SvelteComponentTyped class. This renaming should help with backwards compatibility. We’ve updated last month’s blog post to avoid any confusion with the name change.

If you’re using SvelteComponent or the new SvelteComponentTyped in your project or library, let us know what you’re using it for and we’ll add it to the showcase!

What’s going on in Sapper?

More quality of life features are landing in the upcoming release every day. 0.29.0 will include new TypeScript definitions, fixes to scroll tracking and prefetching behavior, and improvements to the runtime router to support encoded query parameters.

If you’re upgrading from 0.28.x, check out the migration guide for steps on updating to Sapper 0.29.

Is SvelteKit ready yet?

To avoid too much churn during development, SvelteKit is still being worked on in a private repo. There will be an announcement on the Discord, blog and Twitter when it’s ready for a larger group of users and contributors. …

Originalquelle(öffnet in neuem Tab)Problem melden

Svelte

Svelte: Neuerungen im Dezember 2020

Svelte 3.29.5 bis 3.31.0 unterstützen $$props in Web Components, Spread-Props in Slots, die Funktion hasContext und die Klasse SvelteComponentTyped; Transitionen in {:else}-Blöcken funktionieren nun.

It’s the last “What’s new in Svelte” of the year and there’s lots to celebrate! This month’s coverage includes updates from rollup-plugin-svelte, Sapper and SvelteKit and a bunch of showcases from the Svelte community!

New features & impactful bug fixes

  1. $$props, $$restProps, and $$slots are all now supported in custom web components (3.29.5, Example) and slot components now support spread props: <slot {...foo} /> (3.30.0)
  2. A new hasContext lifecycle function makes it easy to check whether a key has been set in the context of a parent component (3.30.0 & 3.30.1, Docs)
  3. There is now a new SvelteComponentTyped class which makes it easier to add strongly typed components that extend base Svelte components. Component library and framework authors rejoice! An example: export class YourComponent extends SvelteComponentTyped<{aProp: boolean}, {click: MouseEvent}, {default: {aSlot: string}}> {} (3.31.0, RFC)
  4. Transitions within {:else} blocks should now complete successfully (3.29.5, Example) …

Originalquelle(öffnet in neuem Tab)Problem melden

Svelte

SvelteKit als Nachfolger von Sapper

Sapper wird nicht Version 1.0 erreichen, stattdessen wird der Nachfolger SvelteKit als Neuschreibung mit neuem Namen eingeführt.

If you didn't attend Svelte Summit, you can catch up on the Svelte Society YouTube page

If you attended Svelte Summit last month you may have seen my talk, Futuristic Web Development, in which I finally tackled one of the most frequently asked questions about Svelte: when will Sapper reach version 1.0?

The answer: never.

This was slightly tongue-in-cheek — as the talk explains, it’s really more of a rewrite of Sapper coupled with a rebrand — but it raised a lot of new questions from the community, and it’s time we offered a bit more clarity on what you can expect from Sapper’s successor, SvelteKit.

'Futuristic Web Development' from Svelte Summit

What’s Sapper?

Sapper is an app framework (or ‘metaframework’) built on top of Svelte (which is a component framework). Its job is to make it easy to build Svelte apps with all the modern best practices like server-side rendering (SSR) and code-splitting, and to provide a project structure that makes development productive and fun. It uses filesystem-based routing (as popularised by Next and adopted by many other frameworks, albeit with some enhancements) — your project’s file structure mirrors the structure of the app itself. …

Originalquelle(öffnet in neuem Tab)Problem melden

Svelte

Neuerungen in Svelte und Sapper

Svelte 3.29.3 bietet Verbesserungen bei destructuring Promises und Slot-Forwarding, Sapper 0.28.10 neue Typen für preload und diverse Fehlerbehebungen.

Welcome back to the “What’s new in Svelte” series! This month, we’re covering new features & bug fixes, last month’s Svelte Summit and some stand-out sites and libraries...

New features & impactful bug fixes

  1. Destructuring Promises now works as expected by using the {#await} syntax (3.29.3, Example)
  2. Slot forwarding (released in 3.29.0) should no longer hang during compilation (3.29.3, Example)
  3. Better typings for the get function in svelte/store and on lifecycle hooks (3.29.1)

What’s going on in Sapper?

Sapper got some new types in its preload function, which will make typing easier if you are using TypeScript. See the Sapper docs on how to use them. There also were fixes to preload links in exported sites. Route layouts got a few fixes too - including ensuring CSS is applied to nested route layouts. You can also better organize your files now that extensions with multiple dots are supported. (0.28.10)

For all the features and bugfixes see the CHANGELOGs for Svelte and Sapper. …

Originalquelle(öffnet in neuem Tab)Problem melden

Svelte

Svelte Oktober-Update mit neuen Features

Svelte 3.26.0 bis 3.29.0 führt unter anderem use:obj.method, numerische Trennzeichen, import.meta in Templates, CSS-Kombinatoren und den {#key}-Block ein.

Welcome to the first edition of our “What’s new in Svelte” series! We’ll try to make this a monthly blog post in which you’ll find out about new features, bug fixes, and a showcase of Svelte projects from around the community.

New features

  1. use:obj.method allows functions defined within objects to be used within actions (Example, 3.26.0, warning removed in 3.27.0)
  2. _ is now supported as a “numerical separator”, similar to a . or , (Example, 3.26.0)
  3. import.meta now works in template expressions (Example, 3.26.0)
  4. CSS Selectors with ~ and + combinators are now supported (Example, 3.27.0, with a compiler fix in 3.29.0)
  5. The {#key} block is now available to key arbitrary content on an expression. Whenever the expression changes, the contents inside the {#key} block will be destroyed and recreated. For an in-depth explanation and to find out how it’s implemented, check out the new blog post of Svelte Team member Tan Li Hau. (More info, 3.29.0) …

Originalquelle(öffnet in neuem Tab)Problem melden

Svelte

Offizielle TypeScript-Unterstützung für Svelte

Svelte unterstützt nun offiziell TypeScript, neue Projekte lassen sich per CLI erstellen und VS Code-Nutzer erhalten eine offizielle Erweiterung.

It’s been by far the most requested feature for a while, and it’s finally here: Svelte officially supports TypeScript.

We think it’ll give you a much nicer development experience — one that also scales beautifully to larger Svelte code bases — regardless of whether you use TypeScript or JavaScript.

Screenshot of TypeScript in Svelte

Image of TypeScript + Svelte in VS Code (theme is Kary Pro.)

Try it now

You can start a new Svelte TypeScript project using Svelte’s official scaffolding CLI by running npm create svelte@latest and following the prompts. This sets up a new SvelteKit project for you.

Alternatively you can run npm create vite@latest myapp -- --template svelte-ts to scaffold a Vite project using Svelte and TypeScript.

If you’re a VS Code user, make sure you’re using the (new) official extension, which replaces the popular extension by James Birtles. Later in this blog post, we’ll detail the individual steps involved in using TypeScript in an existing Svelte project.

What does it mean to support TypeScript in Svelte? …

Originalquelle(öffnet in neuem Tab)Problem melden

Svelte

Stabile Veröffentlichung von Svelte 3

Svelte 3 ist stabil und wandelt Komponenten zur Build-Zeit in effizienten imperativen Code um, um die DOM-Updates zu optimieren.

After several months of being just days away, we are over the moon to announce the stable release of Svelte 3. This is a huge release representing hundreds of hours of work by many people in the Svelte community, including invaluable feedback from beta testers who have helped shape the design every step of the way.

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 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 — 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. …

Originalquelle(öffnet in neuem Tab)Problem melden

Svelte

Weniger Code schreiben mit Svelte

Svelte reduziert die Menge an Code, die Entwickler schreiben müssen, was zu weniger Bugs und kürzerer Entwicklungszeit führt.

All code is buggy. It stands to reason, therefore, that the more code you have to write the buggier your apps will be.

Writing more code also takes more time, leaving less time for other things like optimisation, nice-to-have features, or being outdoors instead of hunched over a laptop.

In fact it’s widely acknowledged that project development time and bug count grow quadratically, not linearly, with the size of a codebase. That tracks with our intuitions: a ten-line pull request will get a level of scrutiny rarely applied to a 100-line one. And once a given module becomes too big to fit on a single screen, the cognitive effort required to understand it increases significantly. We compensate by refactoring and adding comments — activities that almost always result in more code. It’s a vicious cycle.

Yet while we obsess — rightly! — over performance numbers, bundle size and anything else we can measure, we rarely pay attention to the amount of code we’re writing.

Readability is important

I’m certainly not claiming that we should use clever tricks to scrunch our code into the most compact form possible at the expense of readability. Nor am I claiming that reducing lines of code is necessarily a worthwhile goal, since it encourages turning readable code like this...

Originalquelle(öffnet in neuem Tab)Problem melden

Svelte

Leitfaden für neue Svelte-Entwickler

Ein Leitfaden hilft neuen Entwicklern ohne viel JavaScript-Build-Tooling-Erfahrung, mit Svelte-Apps zu beginnen.

This short guide is designed to help you — someone who has looked at the tutorial and wants to start creating Svelte apps, but doesn’t have a ton of experience using JavaScript build tooling — get up and running.

If there are things that don’t make sense, or that we’re glossing over, feel free to raise an issue or suggest edits to this page that will help us help more people.

If you get stuck at any point following this guide, the best place to ask for help is in the chatroom.

First things first

You’ll be using the command line, also known as the terminal. On Windows, you can access it by running Command Prompt from the Start menu; on a Mac, hit Cmd and Space together to bring up Spotlight, then start typing Terminal.app. On most Linux systems, Ctrl-Alt-T brings up the command line.

The command line is a way to interact with your computer (or another computer! but that’s a topic for another time) with more power and control than the GUI (graphical user interface) that most people use day-to-day. …

Originalquelle(öffnet in neuem Tab)Problem melden

Svelte

Svelte im The-Changelog-Podcast

Rich Harris war im Podcast The Changelog zu Gast und sprach über Svelte 3 sowie die Entwicklung des Frameworks.

Earlier this month, I had the privilege of appearing on The Changelog, a podcast about software development. We had a fun (for me) and wide-ranging conversation:

  • life as a coder inside a newsroom
  • the big compilers-as-frameworks trend
  • scalability
  • the Great Divide

...and, most importantly, Svelte 3.

Unless you hang out in our Discord server or follow @sveltejs on BlueSky, you might not know that Svelte 3 is just around the corner, and it’s going to be a huge release. We’ve rethought the developer experience from the ground up, and while it will be a nuisance if you need to upgrade a Svelte 2 app (more on that soon) we think you’re going to love it.

On the podcast Adam, Jerod and I talk about some of the changes and why we’re making them. You can listen here or on the podcast page.

The Changelog 332: A UI framework without the framework – Listen on Changelog.com

Originalquelle(öffnet in neuem Tab)Problem melden

Svelte

Virtuelles DOM ist reiner Overhead

Der Blogbeitrag analysiert, warum das virtuelle DOM nicht schneller als das echte DOM ist und wie Svelte darauf verzichtet.

If you’ve used JavaScript frameworks in the last few years, you’ve probably heard the phrase ‘the virtual DOM is fast’, often said to mean that it’s faster than the real DOM. It’s a surprisingly resilient meme — for example people have asked how Svelte can be fast when it doesn’t use a virtual DOM.

It’s time to take a closer look.

What is the virtual DOM?

In many frameworks, you build an app by creating render() functions, like this simple React component:

function HelloMessagefunction HelloMessage(props: any): div(props(parameter) props: any) {
	return <divtype div = /*unresolved*/ any classNameany="greeting">Helloany {props(parameter) props: any.nameany}</div>;
}

You can do the same thing without JSX...

function HelloMessagefunction HelloMessage(props: any): any(props(parameter) props: any) {
	return Reactany.createElementany('div', { className(property) className: string: 'greeting' }, 'Hello ', props(parameter) props: any.nameany);
}

...but the result is the same — an object representing how the page should now look. That object is the virtual DOM. Every time your app’s state updates (for example when the name prop changes), you create a new one. The framework’s job is to reconcile the new one against the old one, to figure out what changes are necessary and apply them to the real DOM.

How did the meme start? …

Originalquelle(öffnet in neuem Tab)Problem melden

Svelte

CSS-in-JS mit Svelte nutzen

Der Artikel erklärt, wie man CSS-in-JS-Bibliotheken wie Emotion zusammen mit Sveltes eingebauter CSS-Behandlung verwenden kann.

CSS is a core part of any web app. By extension, a UI framework that doesn’t have a built-in way to add styles to your components is unfinished.

That’s why Svelte allows you to add CSS in a component’s <style> tag. Co-locating your CSS with your markup means we can solve the biggest problems developers face when writing CSS without introducing new ones, all while providing a rather nice development experience.

But Svelte’s style handling does have some limitations. It’s too difficult to share styles between components, or apply app-level optimisations. These are areas we plan to address in future versions, but in the meantime if you need those things you can use any framework-agnostic CSS-in-JS library.

For example

Here, we’re using Emotion to generate scoped class names that can be used across multiple components:

It’s important to note that most CSS-in-JS libraries have a runtime library, and many don’t support statically extracting styles out into a separate .css file at build time (which is essential for the best performance). You should therefore only use CSS-in-JS if it’s necessary for your application!

Note that you can mix-and-match — you can still use Svelte’s built-in CSS handling alongside a CSS-in-JS library.

Originalquelle(öffnet in neuem Tab)Problem melden

Svelte

Svelte v2 ist veröffentlicht

Svelte Version 2 ist erschienen und bringt neue Templatesyntax sowie weitere Änderungen; ein Upgrade-Tool hilft bei der Migration.

Our motto is 'move slowly and break things'. No, wait, that came out wrong...

Almost a year after we first started talking about version 2 on the Svelte issue tracker, it’s finally time to make some breaking changes. This blog post will explain what changed, why it changed, and what you need to do to bring your apps up to date.

tl;dr

Each of these items is described in more depth below. If you get stuck, ask for help in our friendly Discord chatroom.

  • Install Svelte v2 from npm
  • Upgrade your templates with svelte-upgrade
  • Remove calls to component.observe, or add the observe method from svelte-extras
  • Rewrite calls to component.get('foo') as component.get().foo
  • Return destroy from your custom event handlers, rather than teardown
  • Make sure you’re not passing numeric string props to components

New template syntax

The most visible change: we’ve made some improvements to the template syntax. …

Originalquelle(öffnet in neuem Tab)Problem melden

Svelte

Sapper: Zum idealen Web-App-Framework

Der Artikel stellt Sapper vor, ein Framework für ideale Web-Apps mit Server-Side Rendering, Code-Splitting und Offline-Unterstützung.

Quickstart for the impatient: the Sapper docs, and the starter template

If you had to list the characteristics of the perfect Node.js web application framework, you’d probably come up with something like this:

  1. It should do server-side rendering, for fast initial loads and no caveats around SEO
  2. As a corollary, your app’s codebase should be universal — write once for server and client
  3. The client-side app should hydrate the server-rendered HTML, attaching event listeners (and so on) to existing elements rather than re-rendering them
  4. Navigating to subsequent pages should be instantaneous
  5. Offline, and other Progressive Web App characteristics, must be supported out of the box
  6. Only the JavaScript and CSS required for the first page should load initially. That means the framework should do automatic code-splitting at the route level, and support dynamic import(...) for more granular manual control
  7. No compromise on performance
  8. First-rate developer experience, with hot module reloading and all the trimmings
  9. The resulting codebase should be easy to grok and maintain
  10. It should be possible to understand and customise every aspect of the system — no webpack configs locked up in the framework, and as little hidden ‘plumbing’ as possible
  11. Learning the entire framework in under an hour should be easy, and not just for experienced developers …

Originalquelle(öffnet in neuem Tab)Problem melden

Svelte

Die Kunst, einfach CSS zu schreiben

Der Artikel argumentiert, dass die größten Probleme mit CSS auch ohne CSS-in-JS gelöst werden können und dass das Schreiben von CSS mit Single File Components und echtem CSS angenehm sein kann.

It’s fashionable to dislike CSS. There are lots of reasons why that’s the case, but it boils down to this: CSS is unpredictable. If you’ve never had the experience of tweaking a style rule and accidentally breaking some layout that you thought was completely unrelated — usually when you’re trying to ship — then you’re either new at this or you’re a much better programmer than the rest of us.

So the JavaScript community rolled up its sleeves and got to work. Over the last couple of years, there’s been a Cambrian explosion of libraries aimed at making CSS behave, collectively referred to as CSS-in-JS.

What you might not realise is that the biggest problems with CSS can be solved without CSS-in-JS. Without those problems, writing CSS isn’t just tolerable — it’s enjoyable. And you don’t have to find solutions to the additional problems that CSS-in-JS introduces.

This article isn’t in any way intended as criticism of the hard work the CSS-in-JS community has done. It’s one of the most active corners of the JS ecosystem, and new ideas are springing up every week. Instead, my purpose is to illustrate why an alternative approach — based on Single File Components with real CSS — is so damn delightful.

The biggest problem with CSS …

Originalquelle(öffnet in neuem Tab)Problem melden