@solidjs/signals 2.0.0-rc.1 → 2.0.0-rc.10

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 (150) hide show
  1. package/dist/dev-shared.js +7138 -0
  2. package/dist/dev.attribution.js +3307 -0
  3. package/dist/dev.js +5691 -4491
  4. package/dist/observe/affects.js +129 -0
  5. package/dist/observe/attribution.js +7 -0
  6. package/dist/observe/boundaries.js +793 -0
  7. package/dist/observe/core/action.js +177 -0
  8. package/dist/observe/core/async.js +849 -0
  9. package/dist/observe/core/attribution-costs.js +66 -0
  10. package/dist/observe/core/attribution-feedback.js +280 -0
  11. package/dist/observe/core/attribution-hooks.js +83 -0
  12. package/dist/observe/core/attribution-queries.js +43 -0
  13. package/dist/observe/core/attribution.js +2904 -0
  14. package/dist/observe/core/constants.js +283 -0
  15. package/dist/{types-cjs/core/context.d.cts → observe/core/context.js} +37 -12
  16. package/dist/observe/core/core.js +1999 -0
  17. package/dist/observe/core/dev.js +343 -0
  18. package/dist/observe/core/effect.js +200 -0
  19. package/dist/observe/core/error-hooks.js +71 -0
  20. package/dist/observe/core/error.js +80 -0
  21. package/dist/observe/core/external.js +98 -0
  22. package/dist/observe/core/graph.js +155 -0
  23. package/dist/observe/core/heap.js +147 -0
  24. package/dist/observe/core/invariants.js +45 -0
  25. package/dist/observe/core/lanes.js +205 -0
  26. package/dist/observe/core/optimistic.js +627 -0
  27. package/dist/observe/core/owner.js +353 -0
  28. package/dist/observe/core/scheduler.js +1547 -0
  29. package/dist/observe/core/verdict.js +674 -0
  30. package/dist/observe/index.js +59 -0
  31. package/dist/observe/map.js +484 -0
  32. package/dist/observe/signals.js +731 -0
  33. package/dist/observe/store/index.js +44 -0
  34. package/dist/observe/store/next/optimistic.js +717 -0
  35. package/dist/observe/store/next/projection.js +266 -0
  36. package/dist/observe/store/next/reconcile.js +375 -0
  37. package/dist/observe/store/next/store.js +2480 -0
  38. package/dist/observe/store/next/target.js +51 -0
  39. package/dist/observe/store/store.js +331 -0
  40. package/dist/observe/store/storePath.js +103 -0
  41. package/dist/observe/store/utils.js +1070 -0
  42. package/dist/prod/affects.js +10 -9
  43. package/dist/prod/attribution.js +45 -0
  44. package/dist/prod/boundaries.js +388 -178
  45. package/dist/prod/core/action.js +65 -37
  46. package/dist/prod/core/async.js +378 -163
  47. package/dist/prod/core/attribution-hooks.js +3 -0
  48. package/dist/prod/core/constants.js +186 -1
  49. package/dist/prod/core/context.js +10 -16
  50. package/dist/prod/core/core.js +1546 -416
  51. package/dist/prod/core/dev.js +18 -1
  52. package/dist/prod/core/effect.js +119 -79
  53. package/dist/prod/core/error-hooks.js +71 -0
  54. package/dist/prod/core/error.js +13 -1
  55. package/dist/prod/core/external.js +4 -4
  56. package/dist/prod/core/graph.js +105 -54
  57. package/dist/prod/core/heap.js +72 -65
  58. package/dist/prod/core/invariants.js +3 -2
  59. package/dist/prod/core/lanes.js +117 -52
  60. package/dist/prod/core/optimistic.js +458 -104
  61. package/dist/prod/core/owner.js +131 -84
  62. package/dist/prod/core/scheduler.js +998 -241
  63. package/dist/prod/core/verdict.js +417 -112
  64. package/dist/prod/index.js +20 -8
  65. package/dist/prod/map.js +312 -151
  66. package/dist/prod/signals.js +363 -32
  67. package/dist/prod/store/index.js +2 -0
  68. package/dist/prod/store/next/optimistic.js +530 -197
  69. package/dist/prod/store/next/projection.js +142 -57
  70. package/dist/prod/store/next/reconcile.js +149 -103
  71. package/dist/prod/store/next/store.js +1470 -346
  72. package/dist/prod/store/next/target.js +40 -9
  73. package/dist/prod/store/store.js +23 -19
  74. package/dist/prod/store/utils.js +997 -130
  75. package/dist/types/attribution.d.ts +19 -0
  76. package/dist/types/attribution.prod.d.ts +22 -0
  77. package/dist/types/boundaries.d.ts +78 -5
  78. package/dist/types/core/action.d.ts +12 -5
  79. package/dist/types/core/async.d.ts +3 -1
  80. package/dist/types/core/attribution-costs.d.ts +35 -0
  81. package/dist/types/core/attribution-feedback.d.ts +133 -0
  82. package/dist/types/core/attribution-hooks.d.ts +304 -0
  83. package/dist/types/core/attribution-queries.d.ts +24 -0
  84. package/dist/types/core/attribution.d.ts +892 -0
  85. package/dist/types/core/constants.d.ts +179 -0
  86. package/dist/types/core/core.d.ts +299 -25
  87. package/dist/types/core/dev.d.ts +421 -8
  88. package/dist/types/core/effect.d.ts +8 -1
  89. package/dist/types/core/error-hooks.d.ts +71 -0
  90. package/dist/types/core/error.d.ts +9 -0
  91. package/dist/types/core/graph.d.ts +23 -0
  92. package/dist/types/core/heap.d.ts +5 -3
  93. package/dist/types/core/index.d.ts +6 -3
  94. package/dist/types/core/invariants.d.ts +5 -1
  95. package/dist/types/core/lanes.d.ts +51 -19
  96. package/dist/types/core/owner.d.ts +15 -3
  97. package/dist/types/core/scheduler.d.ts +248 -1
  98. package/dist/types/core/types.d.ts +124 -41
  99. package/dist/types/index.d.ts +18 -5
  100. package/dist/types/map.d.ts +2 -0
  101. package/dist/types/signals.d.ts +145 -13
  102. package/dist/types/store/index.d.ts +7 -6
  103. package/dist/types/store/next/optimistic.d.ts +18 -13
  104. package/dist/types/store/next/projection.d.ts +5 -2
  105. package/dist/types/store/next/reconcile.d.ts +7 -0
  106. package/dist/types/store/next/store.d.ts +83 -11
  107. package/dist/types/store/next/target.d.ts +108 -11
  108. package/dist/types/store/store.d.ts +20 -11
  109. package/dist/types/store/utils.d.ts +188 -0
  110. package/package.json +31 -26
  111. package/dist/node.cjs +0 -8137
  112. package/dist/types/store/optimistic.d.ts +0 -45
  113. package/dist/types/store/projection.d.ts +0 -70
  114. package/dist/types/store/reconcile.d.ts +0 -46
  115. package/dist/types-cjs/affects.d.cts +0 -47
  116. package/dist/types-cjs/boundaries.d.cts +0 -175
  117. package/dist/types-cjs/core/action.d.cts +0 -64
  118. package/dist/types-cjs/core/async.d.cts +0 -21
  119. package/dist/types-cjs/core/constants.d.cts +0 -71
  120. package/dist/types-cjs/core/core.d.cts +0 -156
  121. package/dist/types-cjs/core/dev.d.cts +0 -64
  122. package/dist/types-cjs/core/effect.d.cts +0 -30
  123. package/dist/types-cjs/core/error.d.cts +0 -47
  124. package/dist/types-cjs/core/external.d.cts +0 -15
  125. package/dist/types-cjs/core/graph.d.cts +0 -5
  126. package/dist/types-cjs/core/heap.d.cts +0 -22
  127. package/dist/types-cjs/core/index.d.cts +0 -13
  128. package/dist/types-cjs/core/invariants.d.cts +0 -59
  129. package/dist/types-cjs/core/lanes.d.cts +0 -56
  130. package/dist/types-cjs/core/optimistic.d.cts +0 -6
  131. package/dist/types-cjs/core/owner.d.cts +0 -124
  132. package/dist/types-cjs/core/scheduler.d.cts +0 -172
  133. package/dist/types-cjs/core/types.d.cts +0 -148
  134. package/dist/types-cjs/core/verdict.d.cts +0 -2
  135. package/dist/types-cjs/index.d.cts +0 -10
  136. package/dist/types-cjs/map.d.cts +0 -69
  137. package/dist/types-cjs/package.json +0 -3
  138. package/dist/types-cjs/signals.d.cts +0 -624
  139. package/dist/types-cjs/store/index.d.cts +0 -19
  140. package/dist/types-cjs/store/next/optimistic.d.cts +0 -20
  141. package/dist/types-cjs/store/next/projection.d.cts +0 -24
  142. package/dist/types-cjs/store/next/reconcile.d.cts +0 -3
  143. package/dist/types-cjs/store/next/store.d.cts +0 -71
  144. package/dist/types-cjs/store/next/target.d.cts +0 -99
  145. package/dist/types-cjs/store/optimistic.d.cts +0 -45
  146. package/dist/types-cjs/store/projection.d.cts +0 -70
  147. package/dist/types-cjs/store/reconcile.d.cts +0 -46
  148. package/dist/types-cjs/store/store.d.cts +0 -138
  149. package/dist/types-cjs/store/storePath.d.cts +0 -58
  150. package/dist/types-cjs/store/utils.d.cts +0 -74
@@ -1,24 +0,0 @@
1
- /**
2
- * Store rewrite — projections (§7/§7b): a projection is a computed store.
3
- * The derive runs inside a computed whose recompute merges its output into
4
- * the projection's backing through the adoption channel (replace-mode root:
5
- * entity changes merge in place, the root proxy is stable for life). Children
6
- * wrap into the projection's own FAMILY (writes land here, never in a source
7
- * family), and every family node carries the projection computed as its
8
- * firewall — reads link the derive's status and lifecycle natively. The §6c
9
- * status gate in the traps makes an uninitialized async derive's seed
10
- * unobservable through every read surface.
11
- *
12
- * Mirrors the legacy runProjectionComputed shape (shadow runs for open
13
- * loading windows, handleAsync landings, commit-through-setter) on next
14
- * primitives; the generic draft write-traps are reused from the legacy
15
- * module unchanged.
16
- */
17
- import { type Computed, type Refreshable } from "../../core/index.cjs";
18
- import { type NoFn, type ProjectionOptions, type Store } from "../store.cjs";
19
- export declare function createProjectionNext<T extends object = {}>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, seed: Partial<T> | Store<NoFn<T>>, options?: ProjectionOptions): Refreshable<Store<T>>;
20
- /** Derived writable store (legacy parity): a projection whose public setter
21
- * masks the recompute for the tick (core R31 — the manual write wins over a
22
- * same-flush dependency change). */
23
- export declare function createStoreDerivedNext<T extends object = {}>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, seed: Partial<T> | Store<NoFn<T>>, options?: ProjectionOptions): [Refreshable<Store<T>>, (f: (draft: T) => T | void) => void];
24
- export declare function runProjectionComputedNext<T extends object>(wrappedStore: Store<T>, fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, key: string | ((item: NonNullable<any>) => any) | null, wrapCommit?: (write: () => void) => void, onDraftWrite?: () => void): Computed<void | T>;
@@ -1,3 +0,0 @@
1
- type KeyFn = (item: any) => any;
2
- export declare function reconcileNextState(value: any, state: any, key: string | KeyFn | null | undefined, replace?: boolean): void;
3
- export {};
@@ -1,71 +0,0 @@
1
- import type { Signal } from "../../core/types.cjs";
2
- import { type StoreNextFamily, type StoreNextTarget } from "./target.cjs";
3
- export declare function wrapNext<T extends Record<PropertyKey, any>>(value: T, parent?: StoreNextTarget | null, parentKey?: PropertyKey | null, fam?: StoreNextFamily | null): T;
4
- /** Unwrap our own proxies to their current backing; leave everything else. */
5
- export declare function unwrapValue(v: any): any;
6
- export declare function getNode(target: StoreNextTarget, key: PropertyKey, current: any): Signal<any>;
7
- export declare function getHasNode(target: StoreNextTarget, key: PropertyKey, present: boolean): Signal<boolean>;
8
- export declare function getKeySetNode(target: StoreNextTarget): Signal<number>;
9
- /** Deep-witness bump: any value/shape change on a record with a live deep()
10
- * subscriber notifies it. One null check when unused. */
11
- export declare function bumpDeep(t: StoreNextTarget): void;
12
- /**
13
- * Adoption (2026-08-16c): the incoming object becomes the committed backing
14
- * IMMEDIATELY — reconcile is eagerly visible to every reader (shipped
15
- * contract; only its notifications batch), unlike setter writes which stay
16
- * pending until flush. Ownership resets (incoming is unowned/user data). Any
17
- * staged draft clone folds into the diff and is discarded — next is the
18
- * authoritative base (R21/R32).
19
- */
20
- export declare function adoptPB(target: StoreNextTarget, incoming: Record<PropertyKey, any>, eager?: boolean): void;
21
- /** Same logical slot: both values resolve to one (re-pointed) child target —
22
- * adoption preserved identity, so the slot did not change (R9). */
23
- export declare function targetsEqual(ov: any, nv: any): boolean;
24
- /**
25
- * The fold diff walks SUBSCRIPTION KEYS ONLY (legacy parity: `for key in
26
- * nodes`): nodes exist exactly where something tracked, so unobserved data
27
- * costs nothing here regardless of object size. Accessor safety rides the
28
- * sticky `t.a` flag — a node's key was necessarily read, so the get trap has
29
- * already seen whether it is an accessor.
30
- */
31
- /** One node's fold notification (shared by notifyFold's walk and the fused
32
- * adoption walk): accessor-aware compare + equality/identity-gated setSignal. */
33
- export declare function notifyKeyDiff(node: Signal<any>, key: PropertyKey, old: Record<PropertyKey, any>, neu: Record<PropertyKey, any>, probe?: boolean): void;
34
- /** Accessor-flag probe for the fused walk's early-continue (accessor keys
35
- * can never identity-skip: their VALUE is the descriptor's product). */
36
- export declare function hasAccessorFlag(node: Signal<any>): boolean;
37
- /** Fused-walk per-key notification with values already in hand: the caller
38
- * fetched both sides and handled the identity skip; this applies the
39
- * accessor branch (cached flag only — reconcile channel) or the plain
40
- * equality/identity-gated write. */
41
- export declare function notifyKeyValue(node: Signal<any>, key: PropertyKey, ov: any, nv: any, old: Record<PropertyKey, any>, neu: Record<PropertyKey, any>): void;
42
- /** Presence + membership halves of a fold notification (shared tail). */
43
- export declare function notifyFoldTail(t: StoreNextTarget, old: Record<PropertyKey, any>, neu: Record<PropertyKey, any>): void;
44
- export declare function notifyFold(t: StoreNextTarget, old: Record<PropertyKey, any>, neu: Record<PropertyKey, any>): void;
45
- /** Authoritative-write wrapper exported for the optimistic module: sets the
46
- * scheduler's projectionWriteActive through THIS module's binding (proven to
47
- * share the instance core reads — cross-module live-binding writes from other
48
- * store modules were observed not to propagate under the test transform). */
49
- export declare function runAuthoritative<T>(fn: () => T): T;
50
- /** Active optimistic override on an armed node (armed slot idles at
51
- * NOT_PENDING; undefined = unarmed plain node). */
52
- export declare function hasActiveOverride(node: Signal<any>): boolean;
53
- export type SetStoreNextFunction<T> = (fn: (draft: T) => T | void) => void;
54
- /** Low-level setter primitive: opens write mode on a next proxy, runs `fn`,
55
- * emits write-time notifications at outermost exit, applies returned
56
- * replacements as adoptions. `guard=false` skips the owned-scope dev guard —
57
- * projection recomputes legitimately write from inside their computed. */
58
- export declare function storeSetterNext<T>(proxy: T, fn: (draft: T) => T | void, guard?: boolean): void;
59
- export declare function createStoreNext<T extends Record<PropertyKey, any>>(init: T, shallow?: boolean): [T, SetStoreNextFunction<T>];
60
- /** Tracking deep snapshot (`deep()` for next targets): subscribes to the
61
- * key-set and every property node at every reachable level, then returns the
62
- * plain view. Shared references and cycles handled via the visited set. */
63
- export declare function deepNext<T>(value: T): T;
64
- /**
65
- * Snapshot with per-object registration resolution (RUL-12 DAG ruling): every
66
- * reachable wrappable resolves through its target's CURRENT backing, so
67
- * privatized subtrees are seen through any parent path. Identity-preserving:
68
- * a subtree with no substitutions below returns its own object (zero copy for
69
- * settled, never-diverged graphs).
70
- */
71
- export declare function snapshotNext<T>(value: T): T;
@@ -1,99 +0,0 @@
1
- /**
2
- * Store rewrite — target & ownership (INTERNALS-STORE-STATE.md §1, §5b).
3
- *
4
- * The proxy wraps this internal target, never the raw (proxy-target
5
- * indirection, decision 2026-08-16d). `b` is the single committed home; `pb`
6
- * is the per-target pending backing (RUL-1's pending home): the CoW clone
7
- * created at first draft write, mutated natively by the draft, folded into
8
- * `b` at flush commit. Adoption (setter replacement / reconcile) parks an
9
- * UNOWNED incoming object in `pb` — fold swaps it in and ownership resets.
10
- *
11
- * Creation budget (§5b): one minimal target + one proxy + one storeLookup
12
- * entry per read-through object; zero layer slots; nodes, has-nodes, and the
13
- * key-set node are lazy, materialized only by subscription.
14
- */
15
- import type { Computed, Signal } from "../../core/types.cjs";
16
- /** Projection family (§7b): children wrap into the family's own map (writes
17
- * land in the projection, never the source family), and every node created
18
- * under the family carries the projection computed as its firewall. */
19
- export interface StoreNextFamily {
20
- /** Optimistic family: nodes are born armed (`_overrideValue` slot) so every
21
- * write rides the core optimistic engine — lanes, per-transaction ownership,
22
- * reverts all core-native (§3, RUL-3). */
23
- opt?: boolean;
24
- /** Root proxy (registered with the scheduler's optimistic-store set for the
25
- * transitionBlocked store-half, #2951). */
26
- px?: any;
27
- /** Targets currently carrying active node overrides (landing-consumption
28
- * walk, RUL-2: visible landed truth replaces optimism). */
29
- overlaid?: Set<any>;
30
- map: WeakMap<object, StoreNextTarget>;
31
- /** The projection computed — assigned after creation (accessor pattern). */
32
- node: Computed<any> | null;
33
- shallow?: boolean;
34
- }
35
- export interface StoreNextTarget {
36
- /** Committed backing: source object (shared) or owned clone. */
37
- v: Record<PropertyKey, any>;
38
- /** Pending backing for the current flush (null when settled). */
39
- pb: Record<PropertyKey, any> | null;
40
- /** cached: committed backing is another store's proxy (§7b chained). */
41
- ch: boolean;
42
- /** live value-node count (deleted-key sweep fast-out in the fused walk). */
43
- nc: number;
44
- /** Lazy per-property subscription nodes (real core signals). */
45
- n: Record<PropertyKey, Signal<any>> | null;
46
- /** Lazy per-key presence nodes (`in` tracks presence, not value — R13). */
47
- h: Record<PropertyKey, Signal<boolean>> | null;
48
- /** Lazy key-set node: membership/iteration/$TRACK subscriptions (§6). */
49
- k: Signal<number> | null;
50
- /** Lazy deep-witness node: `deep()` subscribes ONE node per record instead
51
- * of one per path; write paths bump it only when it exists. Separate from
52
- * `k` so $TRACK/mapArray never rerun on leaf value changes (R9). */
53
- dk: Signal<number> | null;
54
- /** Parent target (path copying walks this at commit). */
55
- u: StoreNextTarget | null;
56
- /** Property key of this target in the parent's backing. */
57
- pk: PropertyKey | null;
58
- /** The proxy for this target (stable outward identity). */
59
- px: any;
60
- /** Sticky descendants flag (§6d). */
61
- d: boolean;
62
- /** Sticky accessors-seen flag: an own accessor property was observed on
63
- * this target (first-read scan, defineProperty, or clone scan). Gates the
64
- * fold diff's descriptor-safe path and the get trap's descriptor path. */
65
- a: boolean;
66
- /** Accessor scan performed (scan-once on first trap read; adopted data is
67
- * not rescanned — legacy-parity behavior). */
68
- sc: boolean;
69
- /** Backing was swapped by adoption this batch (fold diff-notifies it). */
70
- adopted: boolean;
71
- /** Projection family, null for plain stores (§7b). */
72
- fam: StoreNextFamily | null;
73
- /** Shallow store root (values served raw). */
74
- s: boolean;
75
- }
76
- /**
77
- * Ownership (first cut, decision 2026-08-16d): one WeakSet of store-owned
78
- * backings serving both the production identity-skip guard and the __TEST__
79
- * no-mutation oracle.
80
- */
81
- export declare const ownedRaw: WeakSet<object>;
82
- /** raw → target. The only raw-keyed lookup; boundary mechanism (O8). */
83
- export declare const storeNextLookup: WeakMap<object, StoreNextTarget>;
84
- /** __TEST__ oracle: every object ingested from a user (never mutate). */
85
- export declare const ingestedRaw: WeakSet<object> | null;
86
- export declare function devAssertNeverUserMutation(target: object): void;
87
- /** Injection table for optimistic-only store machinery (next/optimistic.ts).
88
- * Every call site is gated on `fam?.opt`, and optimistic families can only
89
- * be created by createOptimisticStore — whose install populates this — so
90
- * the non-null assertions at the sites hold by construction. Keeping the
91
- * implementations out of next/store.ts lets plain-store bundles tree-shake
92
- * the optimistic channel entirely. */
93
- export interface OptStoreHooks {
94
- notifyOptimisticWrites(t: any, pb: Record<PropertyKey, any>): void;
95
- optimisticView(t: any, src: Record<PropertyKey, any>): Record<PropertyKey, any>;
96
- applyTentative(t: any, incoming: any, keyFn: ((item: any) => any) | null): void;
97
- }
98
- export declare let optHooks: OptStoreHooks | null;
99
- export declare function setOptHooks(h: OptStoreHooks): void;
@@ -1,45 +0,0 @@
1
- import { type Refreshable } from "../core/index.cjs";
2
- import { type NoFn, type ProjectionOptions, type Store, type StoreSetter } from "./store.cjs";
3
- /**
4
- * The store equivalent of `createOptimistic`. Writes inside an `action`
5
- * transition are tentative — they show up immediately but auto-revert (or
6
- * reconcile to the action's resolved value) once the transition finishes.
7
- *
8
- * Use this for optimistic UI on collection-shaped data. For single-value
9
- * optimistic state, prefer `createOptimistic`.
10
- *
11
- * - Plain form: `createOptimisticStore(initialValue)`.
12
- * - Derived form: `createOptimisticStore(fn, seed, options?)` — a projection
13
- * store whose authoritative value is recomputed by `fn` and whose
14
- * optimistic overlay reverts after each transition.
15
- *
16
- * `options.key` defaults to `"id"`; specify it only when your data uses a
17
- * different identity field (e.g. `{ key: "uuid" }` or `{ key: t => t.slug }`),
18
- * or `null` to merge positionally. Restating the default just adds noise.
19
- *
20
- * @example
21
- * ```ts
22
- * const [todos, setTodos] = createOptimisticStore<Todo[]>([]);
23
- *
24
- * // Mutation: optimistic add, then in-place reconcile to the saved row.
25
- * const addTodo = action(function* (text: string) {
26
- * const tempId = crypto.randomUUID();
27
- * setTodos(t => { t.push({ id: tempId, text, pending: true }); });
28
- * const saved = yield api.createTodo(text);
29
- * setTodos(t => {
30
- * const i = t.findIndex(x => x.id === tempId);
31
- * if (i >= 0) t[i] = saved;
32
- * });
33
- * });
34
- *
35
- * // Return form: filter is the natural shape for removal.
36
- * const removeTodo = action(function* (id: string) {
37
- * setTodos(t => t.filter(x => x.id !== id));
38
- * yield api.removeTodo(id);
39
- * });
40
- * ```
41
- *
42
- * @returns `[store: Store<T>, setStore: StoreSetter<T>]`
43
- */
44
- export declare function createOptimisticStore<T extends object = {}>(store: NoFn<T> | Store<NoFn<T>>, options?: ProjectionOptions): [get: Store<T>, set: StoreSetter<T>];
45
- export declare function createOptimisticStore<T extends object = {}>(fn: (store: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, store: Partial<T> | Store<NoFn<T>>, options?: ProjectionOptions): [get: Refreshable<Store<T>>, set: StoreSetter<T>];
@@ -1,70 +0,0 @@
1
- import { type Computed, type Refreshable } from "../core/index.cjs";
2
- import { type NoFn, type ProjectionOptions, type Store } from "./store.cjs";
3
- export declare function createProjectionInternal<T extends object = {}>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, seed: Partial<T>, options?: ProjectionOptions): {
4
- store: Refreshable<Store<T>>;
5
- node: Computed<void | T>;
6
- };
7
- /**
8
- * Creates a derived (projected) store. Like `createMemo` but for stores: the
9
- * derive function receives a mutable draft and either mutates it in place
10
- * (canonical) or returns a new value. Either way the result is reconciled
11
- * against the previous draft by `options.key` (default `"id"`), so surviving
12
- * items keep their proxy identity — only added/removed items are
13
- * created/disposed.
14
- *
15
- * If the derive returns a different entity than the one currently held (the
16
- * `/users/1` → `/users/2` shape), the store swaps to it rather than merging,
17
- * and nothing below it is treated as surviving.
18
- *
19
- * Returns the projected store directly (no setter — reads only).
20
- *
21
- * Use this when you want the structural-sharing / per-property tracking
22
- * behaviour of a store on top of a derived computation. For simple read-only
23
- * derivations, `createMemo` is lighter.
24
- *
25
- * @param fn receives the current draft; mutate it in place or return new
26
- * data. Return is convenient for filter/derive shapes where mutation is
27
- * awkward.
28
- * @param seed the backing store value to wrap and reconcile into
29
- * @param options `ProjectionOptions` — `name`, `key`. `key` defaults to
30
- * `"id"`; specify it only when your data uses a different identity field
31
- * (e.g. `{ key: "uuid" }` or `{ key: u => u.slug }`), or `null` to merge
32
- * positionally with no keyed pass.
33
- *
34
- * @example
35
- * ```ts
36
- * // Mutation form — update individual fields on the draft.
37
- * const summary = createProjection<{ total: number; active: number }>(
38
- * draft => {
39
- * draft.total = users().length;
40
- * draft.active = users().filter(u => u.active).length;
41
- * },
42
- * { total: 0, active: 0 }
43
- * );
44
- *
45
- * // Return form — produce a derived collection. Reconciled by `id` so each
46
- * // surviving user keeps the same store identity across recomputes.
47
- * const activeUsers = createProjection<User[]>(
48
- * () => allUsers().filter(u => u.active),
49
- * []
50
- * );
51
- * ```
52
- *
53
- * @see {@link https://github.com/solidjs/x-reactivity#createprojection}
54
- */
55
- export declare function createProjection<T extends object = {}>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, seed: Partial<T> | Store<NoFn<T>>, options?: ProjectionOptions): Refreshable<Store<T>>;
56
- /**
57
- * Shared projection computed body used by both `createProjection` and the derived
58
- * form of `createOptimisticStore`. Encapsulates the write-trap draft, `storeSetter`
59
- * wrapping, the `handleAsync` subscription with a setter callback, and the commit
60
- * path (which must always go through `storeSetter` so the `writeOnly` guard is
61
- * engaged during `reconcile`'s property reads).
62
- *
63
- * `wrapCommit` is invoked for every commit (sync return and each async yield) and
64
- * lets callers layer extra context around the write — e.g. the optimistic store
65
- * re-enters `setProjectionWriteActive` so reconciles target `STORE_OVERRIDE`
66
- * instead of `STORE_OPTIMISTIC_OVERRIDE` even when an async yield fires outside
67
- * the outer `setProjectionWriteActive` scope.
68
- */
69
- export declare function runProjectionComputed<T extends object>(wrappedStore: Store<T>, fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, key: string | ((item: NonNullable<any>) => any) | null, wrapCommit?: (write: () => void) => void, onDraftWrite?: () => void): Computed<void | T>;
70
- export declare function createWriteTraps(isActive?: () => boolean, onDraftWrite?: () => void): ProxyHandler<any>;
@@ -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;
@@ -1,138 +0,0 @@
1
- import { type Signal } from "../core/index.cjs";
2
- import type { Refreshable } from "../core/index.cjs";
3
- /** A read-only view of a store's value as seen by consumers. Mutate it via the paired `StoreSetter`. */
4
- export type Store<T> = Readonly<T>;
5
- /**
6
- * A store setter. The callback receives a writable **draft** of the store.
7
- *
8
- * - **Mutate in place (canonical):** `s.foo = 1`, `s.list.push(x)`,
9
- * `s.list.splice(i, 1)`. This is the default form for most updates.
10
- * - **Return a new value:** for shapes where mutation is awkward, most
11
- * commonly removing items (`s => s.list.filter(...)`). Arrays are replaced
12
- * by index (length adjusted); objects are shallow-diffed at the top level
13
- * (keys present in the returned value are written, missing keys deleted).
14
- *
15
- * The setter does **not** perform keyed reconciliation. If you need surviving
16
- * items to keep their store identity across full-array replacement, use the
17
- * projection form — `createStore(fn, seed, { key })` or `createProjection` —
18
- * whose derive function reconciles its return by `options.key`.
19
- */
20
- export type StoreSetter<T> = (fn: (state: T) => T | void) => void;
21
- /** Tuple returned by the plain `createStore(initialValue)` form. */
22
- export type StoreReturn<T> = [get: Store<T>, set: StoreSetter<T>];
23
- /** Tuple returned by the derived `createStore(fn, seed, options?)` form. */
24
- export type ProjectionStoreReturn<T> = [get: Refreshable<Store<T>>, set: StoreSetter<T>];
25
- /** Base options for store primitives. */
26
- export interface StoreOptions {
27
- /** Debug name (dev mode only) */
28
- name?: string;
29
- }
30
- /** Options for derived/projected stores created with `createStore(fn)`, `createProjection`, or `createOptimisticStore(fn)`. */
31
- export interface ProjectionOptions extends StoreOptions {
32
- /** Key property name or function for reconciliation identity; `null` merges positionally */
33
- key?: string | ((item: NonNullable<any>) => any) | null;
34
- /** Single-layer store: root keys reactive, values raw records replaced by reference */
35
- shallow?: boolean;
36
- /**
37
- * Treat the seed as commit #0: the store is born committed with the seed's
38
- * contents, shown until the derive's first real answer lands. While that
39
- * first answer is in flight, reads serve the seed everywhere — nothing
40
- * suspends to a `<Loading>` boundary, no transition is held, and
41
- * `isPending` stays false (the seed answers by declaration; first-load
42
- * affordances belong to the data, e.g. a `skeleton: true` field in the
43
- * seed). Once the first answer lands (reconciled into the seed), refetches
44
- * use normal pending semantics with `isPending` true.
45
- *
46
- * The store equivalent of `MemoOptions.loadingValue`; the seed already
47
- * carries the placeholder shape, so this is just the opt-in.
48
- */
49
- seedLoadingValue?: boolean;
50
- }
51
- export type NoFn<T> = T extends Function ? never : T;
52
- type DataNode = Signal<any>;
53
- type DataNodes = Record<PropertyKey, DataNode>;
54
- /**
55
- * Brand symbols used internally by the store proxy / projection plumbing.
56
- * Cross-package wiring; not part of the user-facing API.
57
- *
58
- * @internal
59
- */
60
- export declare const $TRACK: unique symbol, $TARGET: unique symbol, $PROXY: unique symbol, $DELETED: unique symbol, $AFFECTS: unique symbol;
61
- export declare const STORE_VALUE = "v", STORE_NODE = "n", STORE_HAS = "h", STORE_PARENT = "u", STORE_DESC = "d", STORE_SHALLOW = "s";
62
- /** Structural view of a store target as shared machinery sees it (the real
63
- * shape is `StoreNextTarget` in ./next/target.ts). */
64
- export type StoreNode = {
65
- [$PROXY]: any;
66
- [STORE_VALUE]: Record<PropertyKey, any>;
67
- [STORE_NODE]?: DataNodes;
68
- [STORE_HAS]?: DataNodes;
69
- [STORE_PARENT]?: StoreNode;
70
- [STORE_SHALLOW]?: boolean;
71
- [STORE_DESC]?: boolean;
72
- };
73
- export declare namespace SolidStore {
74
- interface Unwrappable {
75
- }
76
- }
77
- export type NotWrappable = string | number | bigint | symbol | boolean | Function | null | undefined | SolidStore.Unwrappable[keyof SolidStore.Unwrappable];
78
- /**
79
- * Marks a value as raw: no store will ever wrap it — every store presents it
80
- * as-is, tracked by reference at whatever slot holds it and updated by
81
- * replacement. Useful for class instances and external objects (editors,
82
- * scene graphs, Maps) and for record-shaped data updated wholesale. Sticky
83
- * for the value's lifetime.
84
- */
85
- export declare let rawValuesUsed: boolean;
86
- export declare function isRawValue(value: any): boolean;
87
- export declare function markRaw<T>(value: T): T;
88
- export declare function markRawOne(v: any): void;
89
- export declare function markRawIngest(container: any): void;
90
- export declare function isWrappable<T>(obj: T | NotWrappable): obj is T;
91
- export declare function setWriteOverride(value: boolean): void;
92
- export declare function getWriteOverride(): boolean;
93
- export declare function ownEnumerableKeys(o: object): (string | symbol)[];
94
- /**
95
- * Scope inheritance for late-created nodes: every live mark whose identity
96
- * scope contains the owning record's raw — and, for keyed marks, whose key
97
- * is this property — gets counted on the new node. Inherited marks live
98
- * exactly as long as the scope's carrier — the release hook below drops
99
- * them with the entry.
100
- */
101
- export declare function inheritAffectsMarks(node: DataNode, raw: object, property: PropertyKey): void;
102
- /** Next-store node factory for affects carriers/slots: injected by the
103
- * rewrite module (next targets alias the legacy field names, so everything
104
- * here EXCEPT node creation works on them structurally). */
105
- export declare let nextAffectsNodeResolver: ((target: any, key: PropertyKey) => DataNode) | null;
106
- export declare function setNextAffectsNodeResolver(fn: (target: any, key: PropertyKey) => DataNode): void;
107
- /** Next-store optimistic view for the declaration walk (optimistic rows
108
- * pushed before the declaration are in motion too — legacy reads its write
109
- * overlays; next composes armed-node overrides). */
110
- export declare let nextOptimisticViewResolver: ((target: any, raw: any) => any) | null;
111
- export declare function setNextOptimisticViewResolver(fn: (target: any, raw: any) => any): void;
112
- /** @internal birth inheritance for nodes created inside a live mark window —
113
- * exported for the rewrite's node factories. */
114
- export declare function affectsScopesLive(): boolean;
115
- /**
116
- * Witness live mark coverage of a record into the active isPending() probe.
117
- * Tracked reads don't need this — they go through real signal nodes, which
118
- * carry marks directly (declaration walk or birth inheritance). This covers
119
- * UNTRACKED probes reading through records whose nodes never materialized
120
- * (no observer ever subscribed, so no node exists to carry the mark).
121
- * Callers guard on `pendingCheckActive`, so plain reads never pay for this.
122
- *
123
- * @internal
124
- */
125
- export declare function witnessAffectsMark(target: StoreNode, property?: PropertyKey): void;
126
- /**
127
- * Resolves the store nodes an `affects()` declaration marks: with a `key`,
128
- * the named slot's leaf node (upserted so the mark has an addressable
129
- * carrier); without, the record's $AFFECTS carrier plus every LIVE node in
130
- * its subtree (the edges existing readers subscribed through), with the
131
- * subtree's identities snapshotted into the mark's scope so nodes created
132
- * during the window — and untracked probes over captured proxies — resolve
133
- * against it (#2882).
134
- *
135
- * @internal
136
- */
137
- export declare function getStoreAffectsNodes(target: StoreNode, key?: PropertyKey): DataNode[];
138
- export {};
@@ -1,58 +0,0 @@
1
- import { type NotWrappable } from "./store.cjs";
2
- type W<T> = Exclude<T, NotWrappable>;
3
- type KeyOf<T> = number extends keyof T ? 0 extends 1 & T ? keyof T : [T] extends [never] ? never : [T] extends [readonly unknown[]] ? number : keyof T : keyof T;
4
- export type CustomPartial<T> = T extends readonly unknown[] ? "0" extends keyof T ? {
5
- [K in Extract<keyof T, `${number}`>]?: T[K];
6
- } : {
7
- [x: number]: T[number];
8
- } : Partial<T>;
9
- export type StorePathRange = {
10
- from?: number;
11
- to?: number;
12
- by?: number;
13
- };
14
- export type ArrayFilterFn<T> = (item: T, index: number) => boolean;
15
- export type PathSetter<T> = T | CustomPartial<T> | ((prev: T) => T | CustomPartial<T>) | typeof DELETE;
16
- export type Part<T, K extends KeyOf<T> = KeyOf<T>> = K | ([K] extends [never] ? never : readonly K[]) | ([T] extends [readonly unknown[]] ? ArrayFilterFn<T[number]> | StorePathRange : never);
17
- declare const DELETE: unique symbol;
18
- export interface storePath {
19
- DELETE: typeof DELETE;
20
- <T, K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>, K5 extends KeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>, K6 extends KeyOf<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>>, K7 extends KeyOf<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>, k6: Part<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>, K6>, k7: Part<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, K7>, setter: PathSetter<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>): (state: T) => void;
21
- <T, K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>, K5 extends KeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>, K6 extends KeyOf<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>, k6: Part<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>, K6>, setter: PathSetter<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>): (state: T) => void;
22
- <T, K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>, K5 extends KeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>, setter: PathSetter<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>): (state: T) => void;
23
- <T, K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, setter: PathSetter<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>): (state: T) => void;
24
- <T, K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, setter: PathSetter<W<W<W<T>[K1]>[K2]>[K3]>): (state: T) => void;
25
- <T, K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, setter: PathSetter<W<W<T>[K1]>[K2]>): (state: T) => void;
26
- <T, K1 extends KeyOf<W<T>>>(k1: Part<W<T>, K1>, setter: PathSetter<W<T>[K1]>): (state: T) => void;
27
- <T>(setter: PathSetter<T>): (state: T) => void;
28
- }
29
- /**
30
- * Path-based setter helper for `createStore`. Call `storePath(...path, value)`
31
- * to produce a draft-mutating function suitable for passing to `setStore`.
32
- *
33
- * The canonical setter form in Solid 2.0 is the draft-mutating callback
34
- * (`setStore(s => { s.user.name = "Ada"; })`). `storePath` is a backwards-
35
- * compatibility helper for users porting from Solid 1.x's
36
- * `setStore("user", "name", "Ada")` style — it's optional and you can mix the
37
- * two styles freely.
38
- *
39
- * Path parts can be:
40
- * - a single key — `"user"`, `0`
41
- * - an array of keys — `[0, 1, 2]`
42
- * - a range over an array — `{ from?, to?, by? }`
43
- * - a filter `(item, index) => boolean` for arrays
44
- *
45
- * The final argument is the new value or an updater `(prev) => next`. Use
46
- * `storePath.DELETE` to remove a property.
47
- *
48
- * @example
49
- * ```ts
50
- * const [state, setState] = createStore({ user: { name: "Ada" }, todos: [] });
51
- *
52
- * setState(storePath("user", "name", "Grace"));
53
- * setState(storePath("todos", t => !t.done, "done", true)); // mark all undone as done
54
- * setState(storePath("user", "nickname", storePath.DELETE));
55
- * ```
56
- */
57
- export declare const storePath: storePath;
58
- export {};
@@ -1,74 +0,0 @@
1
- type DistributeOverride<T, F> = T extends undefined ? F : T;
2
- type Override<T, U> = T extends any ? U extends any ? {
3
- [K in keyof T]: K extends keyof U ? DistributeOverride<U[K], T[K]> : T[K];
4
- } & {
5
- [K in keyof U]: K extends keyof T ? DistributeOverride<U[K], T[K]> : U[K];
6
- } : T & U : T & U;
7
- type OverrideSpread<T, U> = T extends any ? {
8
- [K in keyof ({
9
- [K in keyof T]: any;
10
- } & {
11
- [K in keyof U]?: any;
12
- } & {
13
- [K in U extends any ? keyof U : keyof U]?: any;
14
- })]: K extends keyof T ? Exclude<U extends any ? U[K & keyof U] : never, undefined> | T[K] : U extends any ? U[K & keyof U] : never;
15
- } : T & U;
16
- type Simplify<T> = T extends any ? {
17
- [K in keyof T]: T[K];
18
- } : T;
19
- type _Merge<T extends unknown[], Curr = {}> = T extends [
20
- infer Next | (() => infer Next),
21
- ...infer Rest
22
- ] ? _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;
23
- export type Merge<T extends unknown[]> = Simplify<_Merge<T>>;
24
- /**
25
- * Merges multiple props-like objects into a single proxy that *preserves
26
- * reactivity*. Reads are forwarded to the right-most source that defines the
27
- * property, so later sources override earlier ones (like `Object.assign`).
28
- *
29
- * Function arguments are treated as memo-backed sources — useful for passing
30
- * derived defaults whose computation should track reactively.
31
- *
32
- * Use this in component bodies to merge defaults / overrides without losing
33
- * Solid's per-property tracking.
34
- *
35
- * @example
36
- * ```tsx
37
- * function Button(_props: { label: string; type?: string; disabled?: boolean }) {
38
- * const props = merge({ type: "button", disabled: false }, _props);
39
- *
40
- * return <button type={props.type} disabled={props.disabled}>{props.label}</button>;
41
- * }
42
- * ```
43
- */
44
- export declare function merge<T extends unknown[]>(...sources: T): Merge<T>;
45
- export type Omit<T, K extends readonly (keyof T)[]> = {
46
- [P in keyof T as Exclude<P, K[number]>]: T[P];
47
- };
48
- /**
49
- * Returns a reactive proxy of `props` with the listed keys hidden. Tracking
50
- * on the remaining keys is preserved.
51
- *
52
- * Use it to forward "rest" props to a child element while pulling out the
53
- * keys your component handles itself — the equivalent of `splitProps(p, ["a","b"])[1]`.
54
- *
55
- * @example
56
- * ```tsx
57
- * function Input(props: { label: string; value: string; onInput: (v: string) => void } & JSX.HTMLAttributes<HTMLInputElement>) {
58
- * const rest = omit(props, "label", "value", "onInput");
59
- *
60
- * return (
61
- * <label>
62
- * {props.label}
63
- * <input
64
- * {...rest}
65
- * value={props.value}
66
- * onInput={e => props.onInput(e.currentTarget.value)}
67
- * />
68
- * </label>
69
- * );
70
- * }
71
- * ```
72
- */
73
- export declare function omit<T extends Record<any, any>, K extends readonly (keyof T)[]>(props: T, ...keys: K): Omit<T, K>;
74
- export {};