0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-25 09:09:35 +01:00
Commit Graph

30 Commits

Author SHA1 Message Date
Dominic Gannaway
75cd1e825c
feat: add $state.frozen rune (#9851)
* feat: add $state.raw rune

fix typo

fix typo

* add more tests, fix example

* add other test

* change to $state.readonly

* fix readme

* fix validation

* fix more

* improve types

* improve REPL

* switch to $state.frozen

* update docs

* update docs

* update docs

* Update .changeset/dry-clocks-grow.md

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

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

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

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

* docs

* Update sites/svelte-5-preview/src/routes/docs/content/01-api/02-runes.md

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

---------

Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
2023-12-27 10:32:59 +00:00
Ben McCann
646c0c432b
docs: update FAQ regarding Svelte 5 release date (#9882) 2023-12-10 18:50:22 -05:00
Rob B
3a9b1436e8
docs: fix typos (#9849)
* Update 02-runes.md

Typo fix `whech` -> `which`

* Update 02-runes.md

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
2023-12-07 20:20:44 +01:00
Simon H
df5105ef2e
breaking: change $inspect API (#9838)
* breaking: change `$inspect` API

`$inspect` now takes 1-n arguments, and inspections modification happens through `.with(..)`
closes #9737

* lint
2023-12-07 10:54:46 -05:00
Rich Harris
fc8349817f
docs: replace event handlers with event props on preview site (#9793)
also add event and snippets section to old vs new

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
2023-12-06 10:53:59 +01:00
dependabot[bot]
9babce9105
chore(deps-dev): bump vite from 4.5.0 to 4.5.1 (#9800)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.5.0 to 4.5.1.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v4.5.1/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v4.5.1/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-05 21:01:24 -05:00
Dominic Gannaway
c7e626ebbb
feat: add unstate utility function (#9776)
* feat: add unstate utility function

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

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

* update docs

* add class support

* oops

* lint

* fix docs

* remove symbol and class support

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
2023-12-05 14:40:52 -05:00
Rich Harris
75fc09a79e
Proxied state (#9739)
* magic objects

* read length eagerly — triggers reconciliation

* nested magic

* tests

* more tests

* fix array memory leak

* skipped, partially passing array test

* Fix each

revert bad changes

* more 1337

* eliminate closures

* maybe this is unnecessary?

* only create sources for own properties

* more

* rename stuff

* shuffle things around

* emit $.proxy

* remove proxy helper from public API

* only create sources for writable properties

* update test

* get tests passing

* fix

* remove state-not-mutated warning, which is no longer valid

* track reassignments separately from mutations

* update test - effects no longer fire on mutations unnecessarily

* move util into utils file

* move each logic into its own module; breathe sigh of relief

* tweaks

* more tweaks

* improve runtime

* fix mistake

* ensure we proxy when assigning to state

* fix test

* handle frozen

* create sources when reading proxy properties inside deriveds

* only mutate in legacy mode

* add immutable to transform state

* remove unused second argument to derived

* remove unused second argument to source, and runtime immutable option to createRoot (not sure what that was doing there?)

* oops, backwards

* dedicated binding.kind for legacy reactive imports

* avoid using prop_source in more cases. bit hacky, could be tidier, but it works

* distinguish between source and mutable_source

* remove immutable option from mount

* remove unused apparatus around immutable option

* deprecate immutable

* fix

* tweak

* better default value handling

* remove unnecessary exports

* whitespace is free

* remove obsolete symbol from proxy

* cleanup ts

* improve runtime perf by removing version reads in has()

* add missing proxy call

* tune perf of has() more

* ensure we only create sources in effect_active()

* fix proxy of computed fields

* simplify and fix issue with indexed each blocks

* fix compiler errors around exported state

* only create source for state that is reassigned

* temporary fix, we should come up with something better than this

* readonly props

* fix test

* add test for bind:

* make readonly dev-only

* docs

* forbid setPrototypeOf

* lol whoops

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
Co-authored-by: Dominic Gannaway <dg@domgan.com>
2023-12-04 14:35:46 -05:00
Simon H
402a322317
chore: more validation errors (#9723)
* invalid directive on component

* duplicate animation

* invalid animation

* no const assignment

* expected token

* invalid-attribute-name

* fixes

* invalid event modifier

* component name

* slot validation

* fix test

* const validation + fix double declaration bug

* omg this validation is skipped in svelte 4, remove it entirely then

* gah

* unskip

* contenteditable

* invalid css selector

* css global selector + css parser fixes

* export default

* dynamic element

* each block

* html tag

* logic block

* reactive declaration

* duplicate script

* namespace

* module context

* slot

* svelte fragment

* textarea

* title

* transition

* window bindings

* changeset

* svelte head, let directive, tweaks
2023-12-04 05:35:56 -05:00
Rich Harris
bde42d5676
$inspect rune (#9705)
* feat: add $log rune

* fix issues

* fix issues

* tune

* avoid static state reference validation

* work around unfortunate browser behavior

* call it ExpectedError

* cleanup

* Fix docs

* tweaks

* tweaks

* lint

* repl, dev: true

* repl dev mode

* Update sites/svelte-5-preview/src/lib/Repl.svelte

* squelch static-state-reference warning

* simplify

* remove redundant code

* Update packages/svelte/src/main/ambient.d.ts

Co-authored-by: Rich Harris <richard.a.harris@gmail.com>

* Update packages/svelte/src/main/ambient.d.ts

Co-authored-by: Rich Harris <richard.a.harris@gmail.com>

* Update packages/svelte/src/main/ambient.d.ts

Co-authored-by: Rich Harris <richard.a.harris@gmail.com>

* only pause/trace on change

* Update packages/svelte/src/main/ambient.d.ts

* Update .changeset/chatty-hotels-grin.md

* Update sites/svelte-5-preview/src/routes/docs/content/01-api/02-runes.md

Co-authored-by: Rich Harris <richard.a.harris@gmail.com>

* $log.break and $log.trace no-op during SSR

* Update sites/svelte-5-preview/src/routes/docs/content/01-api/02-runes.md

Co-authored-by: Rich Harris <richard.a.harris@gmail.com>

* update test

* improve break experience

* fix ts

* remove unnecessary if (DEV) checks - log runes are removed in prod

* ensure hoisting doesnt mess up source maps

* check visited for cyclical values

* rename $log to $inspect, remove children

* custom inspect function

* implement custom inspect functions

* changeset

* update docs

* only fire on change

* lint

* make inspect take a single argument

* ugh eslint

* document console.trace trick

* demos

* fix site

---------

Co-authored-by: Dominic Gannaway <dg@domgan.com>
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
Co-authored-by: Dominic Gannaway <trueadm@users.noreply.github.com>
2023-11-29 14:31:38 -05:00
Simon H
75295ac79f
docs: enhance breaking change section (#9674)
* docs: enhance breaking change section

- mention createRoot first, explain difference to mount
- mentiond bind:this change
- sub headings
- adjust createRoot type that missed the events property

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

Co-authored-by: Conduitry <git@chor.date>

* clarify

---------

Co-authored-by: Conduitry <git@chor.date>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
2023-11-28 17:31:22 -05:00
Dominic Gannaway
81d3e47d1c
feat: add $effect.root rune (#9638)
* feat: effect-root-rune

feat: add $effect.root rune

update doc

update doc

fix validation

* cleanup logic

* Update sites/svelte-5-preview/src/routes/docs/content/01-api/02-runes.md

* address feedback

---------

Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
2023-11-27 13:34:22 -05:00
Rich Harris
405e9da4ff
chore: bump esrap (#9649)
* bump esrap

* changeset

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2023-11-25 17:29:18 -05:00
Yuichiro Yamashita
7825570b07
fix typos (#9622) 2023-11-23 15:49:02 +00:00
Rich Harris
f40efb2027
$effect.active docs (#9598)
* docs: $effect.active

* link

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2023-11-22 20:00:24 +00:00
Rich Harris
fe9c0bc19d
chore: bump esrap (#9590) 2023-11-22 09:54:34 -08:00
Rich Harris
95c6b65f6f
docs: document class state fields (#9563)
Co-authored-by: Rich Harris <rich.harris@vercel.com>
2023-11-20 23:17:53 +01:00
Erick Vargas
687b8f58e3
docs: fix typo in Svelte 5 preview docs (#9507)
intead -> instead
2023-11-17 12:14:53 +01:00
Yuichiro Yamashita
f18adc8b43
docs: Update Breaking changes section (#9444)
* 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>
2023-11-14 18:22:04 -05:00
Rich Harris
6bba70a2a5
Docs (#9449)
* 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>
2023-11-14 18:09:32 -05:00
Yuichiro Yamashita
a6fdc47a0b
chore: show ast on playground (#9440)
The modern one
2023-11-14 13:31:25 +01:00
Rich Harris
a990e5716a
fix tsconfig.json (#9427)
* fix tsconfig.json

* prettier

* another apparently-necessary fix

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2023-11-13 14:18:04 -05:00
Dominic Gannaway
5768df1300
chore: remove selector api (#9426)
* chore: remove selector api
2023-11-13 18:47:32 +00:00
gtmnayan
2ae953934d
enable dev mode for preview repl (#9393)
* enable dev mode for preview repl

* format

* also add dev mode toggle for compiler options

* whoops
2023-11-13 10:16:53 -05:00
Rich Harris
304a29e1cc
fix runes mode indicator (#9388)
* fix runes mode indicator

* tidy up

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2023-11-11 09:18:14 -05:00
Rich Harris
7bcd33dbe1
Fix diagnostics (#9385)
* simplify a whole bunch of stuff

* delete more unused stuff

* fix diagnostics

* prettier

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2023-11-10 17:50:57 -05:00
Simon Holthausen
51394a4834 docs: note more breaking changes 2023-11-10 18:01:41 +01:00
Rich Harris
14d7424d75
fix symlink (hopefully) (#9383)
Co-authored-by: Rich Harris <rich.harris@vercel.com>
2023-11-10 17:47:48 +01:00
Simon H
c6c934afb2
chore: cleanup (#9381)
* lets see if this works

* fix versions

* sigh

* debugging ci is sooo fun

* oh wow

* fix stuff, changelog, add back readme

* appease prettier

* format stuff
2023-11-10 16:46:40 +01:00
Simon Holthausen
fe8a9ce31d breaking: init Svelte 5
Co-authored-by: Rich Harris <rich.harris@vercel.com>
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
Co-authored-by: Dominic Gannaway <dg@domgan.com>
2023-11-10 15:48:23 +01:00