@solidjs/signals 2.0.0-beta.15 → 2.0.0-beta.16

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 (86) hide show
  1. package/dist/dev.js +700 -385
  2. package/dist/node.cjs +1865 -1592
  3. package/dist/prod.js +1496 -1232
  4. package/dist/types/boundaries.d.ts +3 -3
  5. package/dist/types/core/async.d.ts +1 -0
  6. package/dist/types/core/core.d.ts +25 -1
  7. package/dist/types/core/dev.d.ts +10 -2
  8. package/dist/types/core/effect.d.ts +1 -3
  9. package/dist/types/core/graph.d.ts +1 -1
  10. package/dist/types/core/index.d.ts +2 -2
  11. package/dist/types/core/invariants.d.ts +49 -0
  12. package/dist/types/core/scheduler.d.ts +8 -0
  13. package/dist/types/core/types.d.ts +19 -0
  14. package/dist/types/index.d.ts +1 -1
  15. package/dist/types/signals.d.ts +39 -2
  16. package/dist/types/store/projection.d.ts +2 -2
  17. package/dist/types/store/store.d.ts +28 -1
  18. package/dist/types-cjs/boundaries.d.cts +3 -3
  19. package/dist/types-cjs/core/async.d.cts +1 -0
  20. package/dist/types-cjs/core/core.d.cts +25 -1
  21. package/dist/types-cjs/core/dev.d.cts +10 -2
  22. package/dist/types-cjs/core/effect.d.cts +1 -3
  23. package/dist/types-cjs/core/graph.d.cts +1 -1
  24. package/dist/types-cjs/core/index.d.cts +2 -2
  25. package/dist/types-cjs/core/invariants.d.cts +49 -0
  26. package/dist/types-cjs/core/scheduler.d.cts +8 -0
  27. package/dist/types-cjs/core/types.d.cts +19 -0
  28. package/dist/types-cjs/index.d.cts +1 -1
  29. package/dist/types-cjs/signals.d.cts +39 -2
  30. package/dist/types-cjs/store/projection.d.cts +2 -2
  31. package/dist/types-cjs/store/store.d.cts +28 -1
  32. package/package.json +1 -1
  33. package/dist/types/src/boundaries.d.ts +0 -173
  34. package/dist/types/src/core/action.d.ts +0 -35
  35. package/dist/types/src/core/async.d.ts +0 -6
  36. package/dist/types/src/core/constants.d.ts +0 -51
  37. package/dist/types/src/core/context.d.ts +0 -36
  38. package/dist/types/src/core/core.d.ts +0 -174
  39. package/dist/types/src/core/dev.d.ts +0 -49
  40. package/dist/types/src/core/effect.d.ts +0 -32
  41. package/dist/types/src/core/error.d.ts +0 -38
  42. package/dist/types/src/core/external.d.ts +0 -45
  43. package/dist/types/src/core/graph.d.ts +0 -5
  44. package/dist/types/src/core/heap.d.ts +0 -14
  45. package/dist/types/src/core/index.d.ts +0 -12
  46. package/dist/types/src/core/lanes.d.ts +0 -54
  47. package/dist/types/src/core/owner.d.ts +0 -116
  48. package/dist/types/src/core/scheduler.d.ts +0 -122
  49. package/dist/types/src/core/types.d.ts +0 -85
  50. package/dist/types/src/index.d.ts +0 -9
  51. package/dist/types/src/map.d.ts +0 -53
  52. package/dist/types/src/signals.d.ts +0 -512
  53. package/dist/types/src/store/index.d.ts +0 -9
  54. package/dist/types/src/store/optimistic.d.ts +0 -45
  55. package/dist/types/src/store/projection.d.ts +0 -66
  56. package/dist/types/src/store/reconcile.d.ts +0 -23
  57. package/dist/types/src/store/store.d.ts +0 -125
  58. package/dist/types/src/store/storePath.d.ts +0 -58
  59. package/dist/types/src/store/utils.d.ts +0 -114
  60. package/dist/types-cjs/src/boundaries.d.cts +0 -173
  61. package/dist/types-cjs/src/core/action.d.cts +0 -35
  62. package/dist/types-cjs/src/core/async.d.cts +0 -6
  63. package/dist/types-cjs/src/core/constants.d.cts +0 -51
  64. package/dist/types-cjs/src/core/context.d.cts +0 -36
  65. package/dist/types-cjs/src/core/core.d.cts +0 -174
  66. package/dist/types-cjs/src/core/dev.d.cts +0 -49
  67. package/dist/types-cjs/src/core/effect.d.cts +0 -32
  68. package/dist/types-cjs/src/core/error.d.cts +0 -38
  69. package/dist/types-cjs/src/core/external.d.cts +0 -45
  70. package/dist/types-cjs/src/core/graph.d.cts +0 -5
  71. package/dist/types-cjs/src/core/heap.d.cts +0 -14
  72. package/dist/types-cjs/src/core/index.d.cts +0 -12
  73. package/dist/types-cjs/src/core/lanes.d.cts +0 -54
  74. package/dist/types-cjs/src/core/owner.d.cts +0 -116
  75. package/dist/types-cjs/src/core/scheduler.d.cts +0 -122
  76. package/dist/types-cjs/src/core/types.d.cts +0 -85
  77. package/dist/types-cjs/src/index.d.cts +0 -9
  78. package/dist/types-cjs/src/map.d.cts +0 -53
  79. package/dist/types-cjs/src/signals.d.cts +0 -512
  80. package/dist/types-cjs/src/store/index.d.cts +0 -9
  81. package/dist/types-cjs/src/store/optimistic.d.cts +0 -45
  82. package/dist/types-cjs/src/store/projection.d.cts +0 -66
  83. package/dist/types-cjs/src/store/reconcile.d.cts +0 -23
  84. package/dist/types-cjs/src/store/store.d.cts +0 -125
  85. package/dist/types-cjs/src/store/storePath.d.cts +0 -58
  86. package/dist/types-cjs/src/store/utils.d.cts +0 -114
@@ -1,125 +0,0 @@
1
- import { STORE_SNAPSHOT_PROPS, type Computed, type Refreshable, type Signal } from "../core/index.cjs";
2
- /** A read-only view of a store's value as seen by consumers. Mutate it via the paired `StoreSetter`. */
3
- export type Store<T> = Readonly<T>;
4
- /**
5
- * A store setter. The callback receives a writable **draft** of the store.
6
- *
7
- * - **Mutate in place (canonical):** `s.foo = 1`, `s.list.push(x)`,
8
- * `s.list.splice(i, 1)`. This is the default form for most updates.
9
- * - **Return a new value:** for shapes where mutation is awkward, most
10
- * commonly removing items (`s => s.list.filter(...)`). Arrays are replaced
11
- * by index (length adjusted); objects are shallow-diffed at the top level
12
- * (keys present in the returned value are written, missing keys deleted).
13
- *
14
- * The setter does **not** perform keyed reconciliation. If you need surviving
15
- * items to keep their store identity across full-array replacement, use the
16
- * projection form — `createStore(fn, seed, { key })` or `createProjection` —
17
- * whose derive function reconciles its return by `options.key`.
18
- */
19
- export type StoreSetter<T> = (fn: (state: T) => T | void) => void;
20
- /** Base options for store primitives. */
21
- export interface StoreOptions {
22
- /** Debug name (dev mode only) */
23
- name?: string;
24
- }
25
- /** Options for derived/projected stores created with `createStore(fn)`, `createProjection`, or `createOptimisticStore(fn)`. */
26
- export interface ProjectionOptions extends StoreOptions {
27
- /** Key property name or function for reconciliation identity */
28
- key?: string | ((item: NonNullable<any>) => any);
29
- }
30
- export type NoFn<T> = T extends Function ? never : T;
31
- type DataNode = Signal<any>;
32
- type DataNodes = Record<PropertyKey, DataNode>;
33
- /**
34
- * Brand symbols used internally by the store proxy / projection plumbing.
35
- * Cross-package wiring; not part of the user-facing API.
36
- *
37
- * @internal
38
- */
39
- export declare const $TRACK: unique symbol, $TARGET: unique symbol, $PROXY: unique symbol, $DELETED: unique symbol;
40
- export declare const STORE_VALUE = "v", STORE_OVERRIDE = "o", STORE_OPTIMISTIC_OVERRIDE = "x", STORE_NODE = "n", STORE_HAS = "h", STORE_CUSTOM_PROTO = "c", STORE_WRAP = "w", STORE_LOOKUP = "l", STORE_FIREWALL = "f", STORE_OPTIMISTIC = "p";
41
- export type StoreNode = {
42
- [$PROXY]: any;
43
- [STORE_VALUE]: Record<PropertyKey, any>;
44
- [STORE_OVERRIDE]?: Record<PropertyKey, any>;
45
- [STORE_OPTIMISTIC_OVERRIDE]?: Record<PropertyKey, any>;
46
- [STORE_NODE]?: DataNodes;
47
- [STORE_HAS]?: DataNodes;
48
- [STORE_CUSTOM_PROTO]?: boolean;
49
- [STORE_WRAP]?: (value: any, target?: StoreNode) => any;
50
- [STORE_LOOKUP]?: WeakMap<any, any>;
51
- [STORE_FIREWALL]?: Computed<any>;
52
- [STORE_OPTIMISTIC]?: boolean;
53
- [STORE_SNAPSHOT_PROPS]?: Record<PropertyKey, any>;
54
- };
55
- export declare namespace SolidStore {
56
- interface Unwrappable {
57
- }
58
- }
59
- export type NotWrappable = string | number | bigint | symbol | boolean | Function | null | undefined | SolidStore.Unwrappable[keyof SolidStore.Unwrappable];
60
- export declare function createStoreProxy<T extends object>(value: T, traps?: ProxyHandler<StoreNode>, extend?: (target: StoreNode) => void): any;
61
- export declare const storeLookup: WeakMap<WeakKey, any>;
62
- export declare function wrap<T extends Record<PropertyKey, any>>(value: T, target?: StoreNode): T;
63
- export declare function isWrappable<T>(obj: T | NotWrappable): obj is T;
64
- export declare function setWriteOverride(value: boolean): void;
65
- export declare function trackSelf(target: StoreNode, symbol?: symbol): void;
66
- export declare function getKeys(source: Record<PropertyKey, any>, override: Record<PropertyKey, any> | undefined, enumerable?: boolean): PropertyKey[];
67
- export declare function getPropertyDescriptor(source: Record<PropertyKey, any>, override: Record<PropertyKey, any> | undefined, property: PropertyKey): PropertyDescriptor | undefined;
68
- export declare const storeTraps: ProxyHandler<StoreNode>;
69
- export declare function storeSetter<T extends object>(store: Store<T>, fn: (draft: T) => T | void): void;
70
- /**
71
- * Creates a deeply-reactive store backed by a Proxy. Reads track each property
72
- * accessed; only the parts that change trigger updates.
73
- *
74
- * Store properties hold **plain values**, not accessors. The proxy already
75
- * tracks reads per-property — wrapping a value in `() => state.foo` produces
76
- * a getter that *won't* track when called, which looks like a reactivity bug
77
- * but is just a category error. If you have a signal-shaped piece of state,
78
- * make it a property of the store (`{ foo: 1 }`) rather than nesting an
79
- * accessor inside (`{ foo: () => signal() }`).
80
- *
81
- * The setter takes a **draft-mutating** function — mutate the draft in place
82
- * (canonical). The callback may also return a new value: arrays are replaced
83
- * by index (length adjusted), objects are shallow-diffed at the top level
84
- * (keys present in the returned value are written, missing keys deleted). Use
85
- * the return form for shapes where mutation is awkward — most commonly
86
- * removing items via `filter`. The setter does **not** do keyed reconciliation;
87
- * for that, use the derived/projection form (or `createProjection`).
88
- *
89
- * - Plain form: `createStore(initialValue)` — wraps a value in a reactive
90
- * proxy.
91
- * - Derived form: `createStore(fn, seed, options?)` — a *projection store*
92
- * whose contents are computed by `fn(draft)`. `fn` may be sync, async, or
93
- * an `AsyncIterable`; the projection's result reconciles against the
94
- * existing store by `options.key` (default `"id"`) for stable identity.
95
- *
96
- * @example
97
- * ```ts
98
- * const [state, setState] = createStore({
99
- * user: { name: "Ada", age: 36 },
100
- * todos: [] as { id: string; text: string; done: boolean }[]
101
- * });
102
- *
103
- * // Canonical: mutate the draft in place.
104
- * setState(s => { s.user.age = 37; });
105
- * setState(s => { s.todos.push({ id: "1", text: "x", done: false }); });
106
- *
107
- * // Return form: reach for it when mutation is awkward.
108
- * setState(s => s.todos.filter(t => !t.done)); // remove items
109
- * setState(s => ({ ...s, user: { name: "Grace", age: 85 } })); // shallow replace
110
- * ```
111
- *
112
- * @example
113
- * ```ts
114
- * // Derived store — auto-fetches & reconciles by `id`.
115
- * const [users] = createStore(
116
- * async () => fetch("/users").then(r => r.json()),
117
- * [] as User[]
118
- * );
119
- * ```
120
- *
121
- * @returns `[store: Store<T>, setStore: StoreSetter<T>]`
122
- */
123
- export declare function createStore<T extends object = {}>(store: NoFn<T> | Store<NoFn<T>>): [get: Store<T>, set: StoreSetter<T>];
124
- export declare function createStore<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>];
125
- 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,114 +0,0 @@
1
- /**
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
- * ```
16
- */
17
- export declare function snapshot<T>(item: T): T;
18
- export declare function snapshot<T>(item: T, map?: Map<unknown, unknown>, lookup?: WeakMap<any, any>): T;
19
- /**
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
- * ```
39
- */
40
- export declare function deep<T extends object>(store: T): T;
41
- type DistributeOverride<T, F> = T extends undefined ? F : T;
42
- type Override<T, U> = T extends any ? U extends any ? {
43
- [K in keyof T]: K extends keyof U ? DistributeOverride<U[K], T[K]> : T[K];
44
- } & {
45
- [K in keyof U]: K extends keyof T ? DistributeOverride<U[K], T[K]> : U[K];
46
- } : T & U : T & U;
47
- type OverrideSpread<T, U> = T extends any ? {
48
- [K in keyof ({
49
- [K in keyof T]: any;
50
- } & {
51
- [K in keyof U]?: any;
52
- } & {
53
- [K in U extends any ? keyof U : keyof U]?: any;
54
- })]: K extends keyof T ? Exclude<U extends any ? U[K & keyof U] : never, undefined> | T[K] : U extends any ? U[K & keyof U] : never;
55
- } : T & U;
56
- type Simplify<T> = T extends any ? {
57
- [K in keyof T]: T[K];
58
- } : T;
59
- type _Merge<T extends unknown[], Curr = {}> = T extends [
60
- infer Next | (() => infer Next),
61
- ...infer Rest
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;
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
- */
84
- export declare function merge<T extends unknown[]>(...sources: T): Merge<T>;
85
- export type Omit<T, K extends readonly (keyof T)[]> = {
86
- [P in keyof T as Exclude<P, K[number]>]: T[P];
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
- */
113
- export declare function omit<T extends Record<any, any>, K extends readonly (keyof T)[]>(props: T, ...keys: K): Omit<T, K>;
114
- export {};