@solidjs/signals 2.0.0-beta.8 → 2.0.0-beta.9

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.
Files changed (38) hide show
  1. package/dist/dev.js +172 -79
  2. package/dist/node.cjs +1091 -1043
  3. package/dist/prod.js +802 -752
  4. package/dist/types/boundaries.d.ts +35 -0
  5. package/dist/types/core/action.d.ts +34 -0
  6. package/dist/types/core/constants.d.ts +17 -0
  7. package/dist/types/core/core.d.ts +106 -7
  8. package/dist/types/core/dev.d.ts +1 -1
  9. package/dist/types/core/owner.d.ts +54 -3
  10. package/dist/types/core/scheduler.d.ts +18 -2
  11. package/dist/types/core/types.d.ts +2 -5
  12. package/dist/types/index.d.ts +1 -1
  13. package/dist/types/map.d.ts +32 -3
  14. package/dist/types/signals.d.ts +264 -11
  15. package/dist/types/store/optimistic.d.ts +38 -12
  16. package/dist/types/store/projection.d.ts +40 -14
  17. package/dist/types/store/reconcile.d.ts +22 -0
  18. package/dist/types/store/store.d.ts +64 -14
  19. package/dist/types/store/storePath.d.ts +28 -0
  20. package/dist/types/store/utils.d.ts +78 -7
  21. package/dist/types-cjs/boundaries.d.cts +35 -0
  22. package/dist/types-cjs/core/action.d.cts +34 -0
  23. package/dist/types-cjs/core/constants.d.cts +17 -0
  24. package/dist/types-cjs/core/core.d.cts +106 -7
  25. package/dist/types-cjs/core/dev.d.cts +1 -1
  26. package/dist/types-cjs/core/owner.d.cts +54 -3
  27. package/dist/types-cjs/core/scheduler.d.cts +18 -2
  28. package/dist/types-cjs/core/types.d.cts +2 -5
  29. package/dist/types-cjs/index.d.cts +1 -1
  30. package/dist/types-cjs/map.d.cts +32 -3
  31. package/dist/types-cjs/signals.d.cts +264 -11
  32. package/dist/types-cjs/store/optimistic.d.cts +38 -12
  33. package/dist/types-cjs/store/projection.d.cts +40 -14
  34. package/dist/types-cjs/store/reconcile.d.cts +22 -0
  35. package/dist/types-cjs/store/store.d.cts +64 -14
  36. package/dist/types-cjs/store/storePath.d.cts +28 -0
  37. package/dist/types-cjs/store/utils.d.cts +78 -7
  38. package/package.json +4 -3
@@ -1,15 +1,41 @@
1
1
  /**
2
- * Returns a non reactive copy of the store object.
3
- * It will attempt to preserver the original reference unless the value has been modified.
4
- * @param item store proxy object
2
+ * Returns a plain (non-proxy, non-reactive) deep copy of a store value.
3
+ * Reading via `snapshot` does **not** subscribe to changes use this when you
4
+ * need to hand a stable plain object to non-reactive code (logging,
5
+ * serialization, structured-clone, network payloads, etc.).
6
+ *
7
+ * Returns the original object identity for any sub-tree that wasn't modified
8
+ * relative to the proxy's underlying source.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const [state] = createStore({ user: { name: "Ada" }, todos: [] });
13
+ *
14
+ * console.log(JSON.stringify(snapshot(state))); // safe, non-reactive copy
15
+ * ```
5
16
  */
6
17
  export declare function snapshot<T>(item: T): T;
7
18
  export declare function snapshot<T>(item: T, map?: Map<unknown, unknown>, lookup?: WeakMap<any, any>): T;
8
19
  /**
9
- * Returns a non-reactive snapshot of the store while subscribing to all nested changes.
10
- * Subscribes to `$TRACK` at every level so that any deep change triggers recomputation,
11
- * and returns plain (non-proxy) data. Works correctly with `reconcile()`.
12
- * @param store store proxy object
20
+ * Returns a plain (non-proxy) deep copy **and** subscribes the current
21
+ * tracking scope to every nested change in the source store. Any write
22
+ * anywhere in the subtree invalidates the consumer.
23
+ *
24
+ * Use this when you need plain data inside a reactive scope and want to
25
+ * react to deep mutations (e.g. passing a snapshot to `reconcile()` or to a
26
+ * memo that should rerun on any nested change). For most read paths, prefer
27
+ * direct property access — Solid stores already track per-property reads
28
+ * with no `deep()` wrapper needed.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * const [state] = createStore({ a: { b: { c: 1 } } });
33
+ *
34
+ * createEffect(
35
+ * () => deep(state), // reruns on any nested change
36
+ * plain => sendToWorker(plain) // worker gets a non-proxy copy
37
+ * );
38
+ * ```
13
39
  */
14
40
  export declare function deep<T extends object>(store: T): T;
15
41
  type DistributeOverride<T, F> = T extends undefined ? F : T;
@@ -35,9 +61,54 @@ type _Merge<T extends unknown[], Curr = {}> = T extends [
35
61
  ...infer Rest
36
62
  ] ? _Merge<Rest, Override<Curr, Next>> : T extends [...infer Rest, infer Next | (() => infer Next)] ? Override<_Merge<Rest, Curr>, Next> : T extends [] ? Curr : T extends (infer I | (() => infer I))[] ? OverrideSpread<Curr, I> : Curr;
37
63
  export type Merge<T extends unknown[]> = Simplify<_Merge<T>>;
64
+ /**
65
+ * Merges multiple props-like objects into a single proxy that *preserves
66
+ * reactivity*. Reads are forwarded to the right-most source that defines the
67
+ * property, so later sources override earlier ones (like `Object.assign`).
68
+ *
69
+ * Function arguments are treated as memo-backed sources — useful for passing
70
+ * derived defaults whose computation should track reactively.
71
+ *
72
+ * Use this in component bodies to merge defaults / overrides without losing
73
+ * Solid's per-property tracking.
74
+ *
75
+ * @example
76
+ * ```tsx
77
+ * function Button(_props: { label: string; type?: string; disabled?: boolean }) {
78
+ * const props = merge({ type: "button", disabled: false }, _props);
79
+ *
80
+ * return <button type={props.type} disabled={props.disabled}>{props.label}</button>;
81
+ * }
82
+ * ```
83
+ */
38
84
  export declare function merge<T extends unknown[]>(...sources: T): Merge<T>;
39
85
  export type Omit<T, K extends readonly (keyof T)[]> = {
40
86
  [P in keyof T as Exclude<P, K[number]>]: T[P];
41
87
  };
88
+ /**
89
+ * Returns a reactive proxy of `props` with the listed keys hidden. Tracking
90
+ * on the remaining keys is preserved.
91
+ *
92
+ * Use it to forward "rest" props to a child element while pulling out the
93
+ * keys your component handles itself — the equivalent of `splitProps(p, ["a","b"])[1]`.
94
+ *
95
+ * @example
96
+ * ```tsx
97
+ * function Input(props: { label: string; value: string; onInput: (v: string) => void } & JSX.HTMLAttributes<HTMLInputElement>) {
98
+ * const rest = omit(props, "label", "value", "onInput");
99
+ *
100
+ * return (
101
+ * <label>
102
+ * {props.label}
103
+ * <input
104
+ * {...rest}
105
+ * value={props.value}
106
+ * onInput={e => props.onInput(e.currentTarget.value)}
107
+ * />
108
+ * </label>
109
+ * );
110
+ * }
111
+ * ```
112
+ */
42
113
  export declare function omit<T extends Record<any, any>, K extends readonly (keyof T)[]>(props: T, ...keys: K): Omit<T, K>;
43
114
  export {};
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@solidjs/signals",
3
- "version": "2.0.0-beta.8",
4
- "description": "SolidJS' reactive core implementation",
3
+ "version": "2.0.0-beta.9",
4
+ "description": "Solid's reactive primitives: signals, memos, effects, stores, and async-aware computations.",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "https://github.com/solidjs/solid"
10
+ "url": "git+https://github.com/solidjs/solid.git",
11
+ "directory": "packages/solid-signals"
11
12
  },
12
13
  "publishConfig": {
13
14
  "access": "public"