@solidjs/signals 2.0.0-rc.2 → 2.0.0-rc.4
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/dist/dev.js +1454 -118
- package/dist/node.cjs +2709 -1396
- package/dist/prod/affects.js +13 -12
- package/dist/prod/boundaries.js +39 -34
- package/dist/prod/core/action.js +3 -3
- package/dist/prod/core/async.js +48 -46
- package/dist/prod/core/core.js +99 -67
- package/dist/prod/core/effect.js +25 -28
- package/dist/prod/core/external.js +2 -2
- package/dist/prod/core/graph.js +85 -49
- package/dist/prod/core/heap.js +10 -10
- package/dist/prod/core/lanes.js +19 -19
- package/dist/prod/core/optimistic.js +66 -41
- package/dist/prod/core/owner.js +13 -13
- package/dist/prod/core/scheduler.js +131 -85
- package/dist/prod/core/verdict.js +36 -15
- package/dist/prod/index.js +4 -0
- package/dist/prod/map.js +101 -101
- package/dist/prod/signals.js +1 -1
- package/dist/prod/store/index.js +2 -0
- package/dist/prod/store/next/optimistic.js +65 -11
- package/dist/prod/store/next/patch-hooks.js +13 -0
- package/dist/prod/store/next/patch.js +614 -0
- package/dist/prod/store/next/projection.js +107 -45
- package/dist/prod/store/next/reconcile.js +307 -120
- package/dist/prod/store/next/store.js +321 -92
- package/dist/prod/store/next/target.js +13 -4
- package/dist/prod/store/store.js +5 -5
- package/dist/types/core/core.d.ts +15 -1
- package/dist/types/core/dev.d.ts +8 -0
- package/dist/types/core/graph.d.ts +22 -0
- package/dist/types/core/invariants.d.ts +1 -1
- package/dist/types/core/scheduler.d.ts +12 -0
- package/dist/types/store/index.d.ts +2 -0
- package/dist/types/store/next/patch-hooks.d.ts +41 -0
- package/dist/types/store/next/patch.d.ts +91 -0
- package/dist/types/store/next/reconcile.d.ts +14 -0
- package/dist/types/store/next/store.d.ts +30 -2
- package/dist/types/store/next/target.d.ts +58 -8
- package/dist/types-cjs/core/core.d.cts +15 -1
- package/dist/types-cjs/core/dev.d.cts +8 -0
- package/dist/types-cjs/core/graph.d.cts +22 -0
- package/dist/types-cjs/core/invariants.d.cts +1 -1
- package/dist/types-cjs/core/scheduler.d.cts +12 -0
- package/dist/types-cjs/store/index.d.cts +2 -0
- package/dist/types-cjs/store/next/patch-hooks.d.cts +41 -0
- package/dist/types-cjs/store/next/patch.d.cts +91 -0
- package/dist/types-cjs/store/next/reconcile.d.cts +14 -0
- package/dist/types-cjs/store/next/store.d.cts +30 -2
- package/dist/types-cjs/store/next/target.d.cts +58 -8
- package/package.json +14 -14
- package/dist/types/store/optimistic.d.ts +0 -45
- package/dist/types/store/projection.d.ts +0 -70
- package/dist/types/store/reconcile.d.ts +0 -46
- package/dist/types-cjs/store/optimistic.d.cts +0 -45
- package/dist/types-cjs/store/projection.d.cts +0 -70
- package/dist/types-cjs/store/reconcile.d.cts +0 -46
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared body of `reconcile()` and the projection commit. `replace` is the
|
|
3
|
-
* only difference: a projection commit is a value swap, not a merge — its root
|
|
4
|
-
* proxy is a cell handed out by `createProjection` that can never change
|
|
5
|
-
* reference, so a derive returning a different entity is not the slot mistake
|
|
6
|
-
* `reconcile()` throws on. Nothing below the root survives that swap, which is
|
|
7
|
-
* the rule the keyed diff already applies at a nested slot on a key mismatch.
|
|
8
|
-
*
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
export declare function reconcileState(value: any, state: any, key: any, replace: boolean): void;
|
|
12
|
-
/**
|
|
13
|
-
* Returns a draft-mutating function that smart-merges `value` into a store,
|
|
14
|
-
* preserving fine-grained reactivity: only changed leaves trigger updates.
|
|
15
|
-
*
|
|
16
|
-
* With a `key` (default `"id"`), array items whose key matches between old
|
|
17
|
-
* and new states keep their identity (updated in place, moves and removals
|
|
18
|
-
* update the corresponding signals) — the shape for keyed server payloads.
|
|
19
|
-
* Items without the key field fall back to positional matching.
|
|
20
|
-
*
|
|
21
|
-
* With `key: null`, matching is purely positional: index N of the new array
|
|
22
|
-
* merges into index N of the old, and object properties merge recursively —
|
|
23
|
-
* the classic pattern for fixed-shape data that churns in place (dashboards,
|
|
24
|
-
* monitors), where no keyed diff pass is needed or wanted.
|
|
25
|
-
*
|
|
26
|
-
* Merging into a slot that holds a *different* entity throws — the caller
|
|
27
|
-
* picked the slot, so a key mismatch there is a bug.
|
|
28
|
-
*
|
|
29
|
-
* @param value the next state to merge in
|
|
30
|
-
* @param key property name (string) or extractor function for stable
|
|
31
|
-
* identity (default `"id"`); pass `null` for positional merging
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```ts
|
|
35
|
-
* const [todos, setTodos] = createStore<Todo[]>([]);
|
|
36
|
-
*
|
|
37
|
-
* async function refresh() {
|
|
38
|
-
* const fresh = await api.getTodos();
|
|
39
|
-
* setTodos(reconcile(fresh)); // diff-merge by `id`
|
|
40
|
-
* }
|
|
41
|
-
*
|
|
42
|
-
* // fixed-shape polling data — positional merge
|
|
43
|
-
* setStats(reconcile(nextStats, null));
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
export declare function reconcile<T extends U, U>(value: T, key?: string | ((item: NonNullable<any>) => any) | null): (state: U) => void;
|