effect-atom-svelte 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/Form.d.ts +14 -3
- package/dist/Hooks.svelte.d.ts +16 -7
- package/dist/Hooks.svelte.js +101 -31
- package/dist/Inspector.d.ts +1 -1
- package/dist/Inspector.js +1 -1
- package/dist/RegistryContext.d.ts +6 -2
- package/dist/RegistryProvider.svelte +2 -1
- package/dist/ScopedAtom.js +2 -1
- package/dist/SvelteKit.d.ts +88 -0
- package/dist/SvelteKit.js +168 -2
- package/dist/internal/follow.svelte.d.ts +7 -0
- package/dist/internal/follow.svelte.js +15 -0
- package/dist/internal/form/engine.js +140 -45
- package/dist/internal/form/field.js +11 -4
- package/dist/internal/form/types.d.ts +9 -0
- package/dist/internal/hydration.d.ts +2 -1
- package/dist/internal/hydration.js +6 -2
- package/dist/internal/kitVersion.d.ts +5 -0
- package/dist/internal/kitVersion.js +11 -0
- package/dist/internal/nodeInternals.js +2 -2
- package/dist/internal/remoteQueries.d.ts +5 -0
- package/dist/internal/remoteQueries.js +11 -0
- package/package.json +8 -7
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Which SvelteKit versions remoteQueryAtom supports. Internal: not exported from the package.
|
|
2
|
+
import { troubleshooting } from "./troubleshooting.js";
|
|
3
|
+
/**
|
|
4
|
+
* Throws unless `version` is SvelteKit 3. Remote queries keep the state fields and promise that
|
|
5
|
+
* remoteQueryAtom follows from SvelteKit 3.0.0, and SvelteKit 4 may change them.
|
|
6
|
+
*/
|
|
7
|
+
export const assertSupportedKit = (version) => {
|
|
8
|
+
if (!version.startsWith("3.")) {
|
|
9
|
+
throw new Error(`remoteQueryAtom needs SvelteKit 3, with experimental.remoteFunctions turned on, and this app has SvelteKit ${version}. ${troubleshooting("remotequeryatom-needs-sveltekit-3")}`);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// The one place the inspector (../Inspector.ts) relies on how Effect implements AtomRegistry rather
|
|
2
|
-
// than on its public API. Written against effect 4.0.1 (effect/src/reactivity/AtomRegistry.ts);
|
|
3
|
-
// peer range is ~4.
|
|
2
|
+
// than on its public API. Written against effect 4.0.1 and checked against 4.1.7 (effect/src/reactivity/AtomRegistry.ts);
|
|
3
|
+
// the peer range is ~4.1.0 because of code like this.
|
|
4
4
|
//
|
|
5
5
|
// The public `AtomRegistry` announces nodes added and removed (`onNodeAdded`, `onNodeRemoved`), and
|
|
6
6
|
// a `Node` shows its parents, children and listeners. It says nothing when a node's value changes,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Atom } from "effect/reactivity";
|
|
2
|
+
/** Records an atom made by remoteQueryAtom. */
|
|
3
|
+
export declare const markRemoteQueryAtom: (atom: Atom.Atom<unknown>) => void;
|
|
4
|
+
/** Whether remoteQueryAtom made this atom, or it is a copy of one. */
|
|
5
|
+
export declare const isRemoteQueryAtom: (atom: Atom.Atom<unknown>) => boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Which atoms remoteQueryAtom made, so the hooks can warn about reading one in a way that renders
|
|
2
|
+
// Initial on the server. Internal: not exported from the package. Kept apart from SvelteKit.ts so
|
|
3
|
+
// the hooks don't import SvelteKit.
|
|
4
|
+
// An own enumerable property, so the copies Atom.keepAlive, Atom.withLabel and the like make keep it.
|
|
5
|
+
const marker = Symbol.for("effect-atom-svelte/remoteQueryAtom");
|
|
6
|
+
/** Records an atom made by remoteQueryAtom. */
|
|
7
|
+
export const markRemoteQueryAtom = (atom) => {
|
|
8
|
+
Reflect.set(atom, marker, true);
|
|
9
|
+
};
|
|
10
|
+
/** Whether remoteQueryAtom made this atom, or it is a copy of one. */
|
|
11
|
+
export const isRemoteQueryAtom = (atom) => Object.hasOwn(atom, marker);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "effect-atom-svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Community-built Svelte 5 bindings for Effect Atom (not affiliated with the Effect team)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"effect",
|
|
@@ -53,15 +53,16 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@demo/domain": "workspace:*",
|
|
56
|
-
"@sveltejs/
|
|
57
|
-
"@sveltejs/
|
|
56
|
+
"@sveltejs/kit": "^3.4.1",
|
|
57
|
+
"@sveltejs/package": "^3.0.3",
|
|
58
|
+
"@sveltejs/vite-plugin-svelte": "^7.3.2",
|
|
58
59
|
"@types/bun": "^1.4.2",
|
|
59
60
|
"@vitest/browser": "^5.0.5",
|
|
60
61
|
"@vitest/browser-playwright": "^5.0.5",
|
|
61
|
-
"effect": "4.
|
|
62
|
+
"effect": "4.1.7",
|
|
62
63
|
"playwright": "^1.57.0",
|
|
63
|
-
"svelte": "^5.
|
|
64
|
-
"svelte-check": "^4.7.
|
|
64
|
+
"svelte": "^5.59.2",
|
|
65
|
+
"svelte-check": "^4.7.8",
|
|
65
66
|
"typescript": "^6.0.3",
|
|
66
67
|
"vite": "^8.3.4",
|
|
67
68
|
"vitest": "^5.0.5",
|
|
@@ -69,7 +70,7 @@
|
|
|
69
70
|
},
|
|
70
71
|
"peerDependencies": {
|
|
71
72
|
"@sveltejs/kit": "^2.0.0 || ^3.0.0",
|
|
72
|
-
"effect": "~4.
|
|
73
|
+
"effect": "~4.1.0",
|
|
73
74
|
"svelte": "^5.57.2"
|
|
74
75
|
},
|
|
75
76
|
"peerDependenciesMeta": {
|