Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Update 06-component-directives.md on:event clarification #10087

Closed
wants to merge 264 commits into from

Conversation

cloudymeatball
Copy link

@cloudymeatball cloudymeatball commented Jan 4, 2024

Please close / discard this in favour of #10088

Svelte 5 rewrite

Please note that the Svelte codebase is currently being rewritten for Svelte 5. Changes should target Svelte 5, which lives on the default branch (main).

If your PR concerns Svelte 4 (including updates to svelte.dev.docs), please ensure the base branch is svelte-4 and not main.

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests and linting

  • Run the tests with pnpm test and lint the project with pnpm lint

gtm-nayan and others added 30 commits November 13, 2023 10:16
* enable dev mode for preview repl

* format

* also add dev mode toggle for compiler options

* whoops
…veltejs#9413)

I came to the conclusion that when we're making up arbitrary types, we might as well keep the old class. That way:
- one less thing to worry about (language tools and other tooling basically can continue to spit out SvelteComponent )
- we can more clearly mark $set , the constructor etc as being deprecated and no longer functioning unless you use that legacy compatibility mode
- much more ergonomic to type for the user:
  - const someInstance: SvelteComponent<..> instead of const someInstance: ReturnType<typeof Component<..>>
  - If you're using generics, you can do export class MyComponent<T> extends SvelteComponent<{ prop: T }> {} instead of having to type out the whole function in a way that I'm not even sure how to do with generics
* chore: add missing svelte/transition functions

* lint
* fix: correctly handle index within each block updates

* changeset
* Split $.each into $.each_keyed/$.each_indexed

* Add changeset

* Update .changeset/quiet-camels-mate.md

* Fix typo

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* Fix runtime effect issues

* Prettier

* Add changeset

* Fix operations

* Update .changeset/khaki-mails-draw.md

* more tweaks

* more tweaks

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* chore: remove selector api
* fix tsconfig.json

* prettier

* another apparently-necessary fix

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
* skip svelte.dev deploy. this may or may not work

* try this

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
* Version Packages (next)

* Update packages/svelte/CHANGELOG.md

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
no two-way binding because setting it involves a `DataTransfer` workaround, so it's not really officially supported that way - if you need that, you shouldn't use that binding probably. This matches the behavior in Svelte 4.

Co-authored-by: Rich Harris <rich.harris@vercel.com>
* chore: use internal get_descriptors helper

* tweak changeset

* fix bad merge

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
…#9443)

Fixes sveltejs#9403. We weren't taking into account the containment of call expressions logic before.
Fixes sveltejs#9408. Ensures that if we have a key that matches the index, that we fallback to using an indexed each block.
- add event delegation to spread_attributes
- add event attributes to spread
- don't delegate when bindings/actions on the same element in order to preserve backwards compatibility of ordering
- don't hoist identifiers when one of them is used in an event that is not delegateable

---------

Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
* fix: allow svelte:self in snippets

* Create funny-wombats-argue.md
* rename file

* add snippet docs

* add note on deprecation

* they're not attributes

* event docs

* prettier

* remove unnecessary div

* Apply suggestions from code review

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>

* make example less confusing

* note breaking props.children change

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* update docs

* Update sites/svelte-5-preview/src/routes/docs/content/03-appendix/02-breaking-changes.md

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>

* Update sites/svelte-5-preview/src/routes/docs/content/03-appendix/02-breaking-changes.md

* Update sites/svelte-5-preview/src/routes/docs/content/03-appendix/02-breaking-changes.md

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: Rich Harris <hello@rich-harris.dev>
…ejs#9456)

* only escape attribute values for elements, not components - closes sveltejs#9454

* changeset

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
…#9457)

Co-authored-by: Rich Harris <rich.harris@vercel.com>
* fix: address bug in before/after update

fix: address bug in before/after update

* Add changeset

* use every instead of filter - more explicit and enables early-exit from the loop

* Update logic and comment

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
* chore: make DOM operations lazyily init

* cleanup types

* cleanup types

* cleanup types

* Update packages/svelte/src/internal/client/operations.js

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>

* single line annotations

* remove unnecessary coercion

* group statements by type

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* move snapshot test to a runtime test

* handle dynamic cases

* huh

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
sockmaster27 and others added 25 commits December 27, 2023 16:31
* test: add tests of transitions in new runtime

* fix: move evaluation of props

* format

* add changeset
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* sveltejs#9985, but simpler

* oops

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
* Version Packages (next)

* Apply suggestions from code review

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
"Declare" should be "Declared" (past tense)
…#9979)

* chore: skip emitting $.proxy() calls for more expressions

* Update pretty-ties-help.md

---------

Co-authored-by: Dominic Gannaway <trueadm@users.noreply.github.com>
closes sveltejs#10036, this also moves the HTMLDetailsElement toggle event to its interface as it was conflicting with HTMLElement popover toggle event.

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
To ensure that changes to code/types doesn't result in unwanted changes in type generation, or that bumps to dts-buddy don't cause unwanted regressions, we're checking in the generated types. Types should be committed as-is (don't format it with prettier!). CI is enhanced to check that git sees no changed files after generating the types, which would mean types have changed.
* fix: ensure if block is executed in correct order

* alternative approach

* improve algo

* optimize

* lint
closes sveltejs#9969

this also fixes the following along the way:
the + in nth-of-type(+xn-b) would be parsed as a combinator.

invalid cases like these are not allowed anymore:

b(+/-)b
-ax
-ax-b
-b
closes sveltejs#9398 (the other things in that issue are already addressed)
closes sveltejs#10019
When doing `$inspect({ x, y })`, both `x` and `y` are now unstated if they are signals, compared to before where `unstate` was only called on the top level object, leaving the proxies in place which results in a worse debugging experience.
Also improved typings which makes it easier to find related code paths.
* fix: bail-out event handler referencing each index

* lint

* ts

* types
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- the objects could contain getters with reactive values, so we play it safe and assume they're always reactive - fixes sveltejs#10065
- isolate spreads with call expression similar to how we do it with other effects -fixes sveltejs#10013
* fix: improve text node output

* revert
later examples changed to handle the `hello` and `click` events dispatched/forwarded by earlier examples

added note about only events forwarded by direct children can be listened to
Copy link

changeset-bot bot commented Jan 4, 2024

🦋 Changeset detected

Latest commit: 03f17d3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Jan 4, 2024

@cloudymeatball is attempting to deploy a commit to the Svelte Team on Vercel.

A member of the Team first needs to authorize it.

@cloudymeatball cloudymeatball marked this pull request as draft January 4, 2024 22:10
@Conduitry Conduitry closed this Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet