@solidjs/signals 2.0.0-rc.7 → 2.0.0-rc.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.
- package/dist/dev-shared.js +6357 -0
- package/dist/dev.attribution.js +2485 -0
- package/dist/dev.js +2851 -7027
- package/dist/observe/affects.js +129 -0
- package/dist/observe/attribution.js +7 -0
- package/dist/observe/boundaries.js +641 -0
- package/dist/observe/core/action.js +177 -0
- package/dist/observe/core/async.js +846 -0
- package/dist/observe/core/attribution-costs.js +66 -0
- package/dist/observe/core/attribution-feedback.js +282 -0
- package/dist/observe/core/attribution-hooks.js +82 -0
- package/dist/observe/core/attribution-queries.js +28 -0
- package/dist/observe/core/attribution.js +2095 -0
- package/dist/observe/core/constants.js +248 -0
- package/dist/{types-cjs/core/context.d.cts → observe/core/context.js} +37 -12
- package/dist/observe/core/core.js +1789 -0
- package/dist/observe/core/dev.js +293 -0
- package/dist/observe/core/effect.js +195 -0
- package/dist/observe/core/error-hooks.js +71 -0
- package/dist/observe/core/error.js +80 -0
- package/dist/observe/core/external.js +98 -0
- package/dist/observe/core/graph.js +155 -0
- package/dist/observe/core/heap.js +147 -0
- package/dist/observe/core/invariants.js +45 -0
- package/dist/observe/core/lanes.js +205 -0
- package/dist/observe/core/optimistic.js +585 -0
- package/dist/observe/core/owner.js +322 -0
- package/dist/observe/core/scheduler.js +1428 -0
- package/dist/observe/core/verdict.js +669 -0
- package/dist/observe/index.js +59 -0
- package/dist/observe/map.js +484 -0
- package/dist/{types-cjs/signals.d.cts → observe/signals.js} +311 -317
- package/dist/observe/store/index.js +40 -0
- package/dist/observe/store/next/optimistic.js +660 -0
- package/dist/observe/store/next/projection.js +255 -0
- package/dist/observe/store/next/reconcile.js +375 -0
- package/dist/observe/store/next/store.js +2327 -0
- package/dist/observe/store/next/target.js +51 -0
- package/dist/observe/store/store.js +325 -0
- package/dist/observe/store/storePath.js +103 -0
- package/dist/observe/store/utils.js +1023 -0
- package/dist/prod/attribution.js +41 -0
- package/dist/prod/boundaries.js +128 -76
- package/dist/prod/core/action.js +65 -37
- package/dist/prod/core/async.js +324 -172
- package/dist/prod/core/constants.js +57 -1
- package/dist/prod/core/context.js +3 -3
- package/dist/prod/core/core.js +1003 -364
- package/dist/prod/core/dev.js +17 -1
- package/dist/prod/core/effect.js +76 -42
- package/dist/prod/core/error-hooks.js +71 -0
- package/dist/prod/core/external.js +4 -4
- package/dist/prod/core/graph.js +37 -37
- package/dist/prod/core/heap.js +61 -56
- package/dist/prod/core/lanes.js +107 -63
- package/dist/prod/core/optimistic.js +374 -93
- package/dist/prod/core/owner.js +62 -46
- package/dist/prod/core/scheduler.js +653 -286
- package/dist/prod/core/verdict.js +245 -127
- package/dist/prod/index.js +15 -5
- package/dist/prod/map.js +292 -141
- package/dist/prod/signals.js +29 -16
- package/dist/prod/store/next/optimistic.js +77 -55
- package/dist/prod/store/next/projection.js +31 -20
- package/dist/prod/store/next/reconcile.js +87 -84
- package/dist/prod/store/next/store.js +718 -401
- package/dist/prod/store/next/target.js +32 -10
- package/dist/prod/store/store.js +12 -14
- package/dist/prod/store/utils.js +950 -130
- package/dist/types/attribution.d.ts +20 -0
- package/dist/types/attribution.prod.d.ts +22 -0
- package/dist/types/boundaries.d.ts +10 -1
- package/dist/types/core/action.d.ts +12 -5
- package/dist/types/core/async.d.ts +1 -1
- package/dist/types/core/attribution-costs.d.ts +35 -0
- package/dist/types/core/attribution-feedback.d.ts +133 -0
- package/dist/types/core/attribution-hooks.d.ts +147 -9
- package/dist/types/core/attribution-queries.d.ts +10 -0
- package/dist/types/core/attribution.d.ts +216 -182
- package/dist/types/core/constants.d.ts +56 -0
- package/dist/types/core/core.d.ts +190 -2
- package/dist/types/core/dev.d.ts +246 -28
- package/dist/types/core/effect.d.ts +8 -1
- package/dist/types/core/error-hooks.d.ts +71 -0
- package/dist/types/core/index.d.ts +4 -1
- package/dist/types/core/invariants.d.ts +4 -0
- package/dist/types/core/lanes.d.ts +39 -5
- package/dist/types/core/scheduler.d.ts +153 -0
- package/dist/types/core/types.d.ts +32 -9
- package/dist/types/index.d.ts +10 -3
- package/dist/types/map.d.ts +2 -0
- package/dist/types/signals.d.ts +8 -0
- package/dist/types/store/index.d.ts +2 -0
- package/dist/types/store/next/optimistic.d.ts +1 -1
- package/dist/types/store/next/store.d.ts +11 -5
- package/dist/types/store/next/target.d.ts +37 -10
- package/dist/types/store/utils.d.ts +178 -0
- package/package.json +21 -17
- package/dist/node.cjs +0 -10541
- package/dist/node.dev.cjs +0 -13724
- package/dist/types-cjs/affects.d.cts +0 -47
- package/dist/types-cjs/boundaries.d.cts +0 -175
- package/dist/types-cjs/core/action.d.cts +0 -64
- package/dist/types-cjs/core/async.d.cts +0 -23
- package/dist/types-cjs/core/attribution-hooks.d.cts +0 -127
- package/dist/types-cjs/core/attribution.d.cts +0 -495
- package/dist/types-cjs/core/constants.d.cts +0 -159
- package/dist/types-cjs/core/core.d.cts +0 -185
- package/dist/types-cjs/core/dev.d.cts +0 -136
- package/dist/types-cjs/core/effect.d.cts +0 -30
- package/dist/types-cjs/core/error.d.cts +0 -56
- package/dist/types-cjs/core/external.d.cts +0 -15
- package/dist/types-cjs/core/graph.d.cts +0 -28
- package/dist/types-cjs/core/heap.d.cts +0 -24
- package/dist/types-cjs/core/index.d.cts +0 -13
- package/dist/types-cjs/core/invariants.d.cts +0 -59
- package/dist/types-cjs/core/lanes.d.cts +0 -54
- package/dist/types-cjs/core/optimistic.d.cts +0 -6
- package/dist/types-cjs/core/owner.d.cts +0 -124
- package/dist/types-cjs/core/scheduler.d.cts +0 -236
- package/dist/types-cjs/core/types.d.cts +0 -204
- package/dist/types-cjs/core/verdict.d.cts +0 -2
- package/dist/types-cjs/index.d.cts +0 -10
- package/dist/types-cjs/map.d.cts +0 -69
- package/dist/types-cjs/package.json +0 -3
- package/dist/types-cjs/store/index.d.cts +0 -18
- package/dist/types-cjs/store/next/optimistic.d.cts +0 -25
- package/dist/types-cjs/store/next/projection.d.cts +0 -8
- package/dist/types-cjs/store/next/reconcile.d.cts +0 -10
- package/dist/types-cjs/store/next/store.d.cts +0 -121
- package/dist/types-cjs/store/next/target.d.cts +0 -166
- package/dist/types-cjs/store/store.d.cts +0 -143
- package/dist/types-cjs/store/storePath.d.cts +0 -58
- package/dist/types-cjs/store/utils.d.cts +0 -74
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import type { Computed, Disposable, Owner, Root } from "./types.cjs";
|
|
2
|
-
export declare function markDisposal(el: Owner): void;
|
|
3
|
-
export declare function dispose(node: Computed<unknown>): void;
|
|
4
|
-
export declare function disposeChildren(node: Owner, self?: boolean, zombie?: boolean): void;
|
|
5
|
-
/**
|
|
6
|
-
* Allocates and returns the next stable child id for `owner`. Used by
|
|
7
|
-
* hydration plumbing and `createUniqueId`. Not part of the user-facing API.
|
|
8
|
-
*
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
export declare function getNextChildId(owner: Owner): string;
|
|
12
|
-
/**
|
|
13
|
-
* The id a freshly-created node inherits: an explicit `options.id` wins;
|
|
14
|
-
* transparent nodes share their parent's id; otherwise the parent's next
|
|
15
|
-
* child id is consumed (or `undefined` outside an id-carrying tree).
|
|
16
|
-
*/
|
|
17
|
-
export declare function inheritId(options: {
|
|
18
|
-
id?: string;
|
|
19
|
-
} | undefined, transparent: boolean, parent: Owner | null | undefined): string | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Returns the *next* child id for `owner` without consuming it. Used by
|
|
22
|
-
* hydration plumbing to peek at the id a future child will receive.
|
|
23
|
-
*
|
|
24
|
-
* @internal
|
|
25
|
-
*/
|
|
26
|
-
export declare function peekNextChildId(owner: Owner): string;
|
|
27
|
-
/**
|
|
28
|
-
* Returns the currently-tracking observer (the computation that subscribes to
|
|
29
|
-
* reactive reads at this point), or `null` if reads here would be untracked.
|
|
30
|
-
* Used by reactive primitives that need to know whether they're inside a
|
|
31
|
-
* tracking scope. App code rarely needs this — see `getOwner()` for the
|
|
32
|
-
* lifecycle owner instead.
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```ts
|
|
36
|
-
* // Library predicate: only register a hot-path subscription when the
|
|
37
|
-
* // caller is inside a tracking scope (memo / effect compute / JSX).
|
|
38
|
-
* function trackIfTracked(source: () => unknown) {
|
|
39
|
-
* if (getObserver()) source();
|
|
40
|
-
* }
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
export declare function getObserver(): Owner | null;
|
|
44
|
-
/**
|
|
45
|
-
* Returns the current reactive **owner** — the lifecycle node that the next
|
|
46
|
-
* `cleanup()` / `onCleanup()` / `createSignal()` etc. will be attached to.
|
|
47
|
-
*
|
|
48
|
-
* Returns `null` if called outside any owner. Capture the owner with
|
|
49
|
-
* `getOwner()` and re-enter it later with `runWithOwner(owner, fn)` to attach
|
|
50
|
-
* disposables created from a callback (event handler, async resolution, etc.)
|
|
51
|
-
* back to a component's lifecycle.
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```ts
|
|
55
|
-
* function defer<T>(fn: () => T) {
|
|
56
|
-
* const owner = getOwner();
|
|
57
|
-
* queueMicrotask(() => runWithOwner(owner, fn));
|
|
58
|
-
* }
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
export declare function getOwner(): Owner | null;
|
|
62
|
-
/**
|
|
63
|
-
* Low-level: registers `fn` as a disposal callback on the current owner.
|
|
64
|
-
* Most code should use `onCleanup()` from `solid-js`, which adds dev-mode
|
|
65
|
-
* checks. `cleanup()` is the unchecked primitive used by internals.
|
|
66
|
-
*/
|
|
67
|
-
export declare function cleanup(fn: Disposable): Disposable;
|
|
68
|
-
/**
|
|
69
|
-
* Returns `true` if the owner has been disposed (or marked zombie pending
|
|
70
|
-
* disposal). Pair with a captured owner to bail out of late callbacks whose
|
|
71
|
-
* surrounding component already unmounted.
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```ts
|
|
75
|
-
* function onSettleSafe(fn: () => void) {
|
|
76
|
-
* const owner = getOwner();
|
|
77
|
-
* queueMicrotask(() => {
|
|
78
|
-
* if (owner && isDisposed(owner)) return; // component unmounted; skip
|
|
79
|
-
* runWithOwner(owner, fn);
|
|
80
|
-
* });
|
|
81
|
-
* }
|
|
82
|
-
* ```
|
|
83
|
-
*/
|
|
84
|
-
export declare function isDisposed(node: Owner): boolean;
|
|
85
|
-
/**
|
|
86
|
-
* Creates a fresh owner attached as a child of the current owner (or as a
|
|
87
|
-
* detached root if there is none). Used by framework internals to group
|
|
88
|
-
* cleanups; app code should use `createRoot()` (host a reactive scope outside
|
|
89
|
-
* a component) or `runWithOwner()` (re-enter a captured owner).
|
|
90
|
-
*
|
|
91
|
-
* @internal
|
|
92
|
-
*/
|
|
93
|
-
export declare function createOwner(options?: {
|
|
94
|
-
id?: string;
|
|
95
|
-
transparent?: boolean;
|
|
96
|
-
}): Root;
|
|
97
|
-
/**
|
|
98
|
-
* Creates a detached reactive root. The callback receives a `dispose()`
|
|
99
|
-
* function which, when called, tears down every signal, memo, effect, and
|
|
100
|
-
* `onCleanup` registered inside the root.
|
|
101
|
-
*
|
|
102
|
-
* Use this to host long-lived reactive scopes outside of a component (custom
|
|
103
|
-
* controllers, app bootstrapping, tests). Inside a component, prefer
|
|
104
|
-
* letting Solid's component lifecycle own things.
|
|
105
|
-
*
|
|
106
|
-
* @example
|
|
107
|
-
* ```ts
|
|
108
|
-
* const dispose = createRoot(dispose => {
|
|
109
|
-
* const [n, setN] = createSignal(0);
|
|
110
|
-
* createEffect(() => n(), value => console.log(value));
|
|
111
|
-
* setInterval(() => setN(x => x + 1), 1000);
|
|
112
|
-
* return dispose;
|
|
113
|
-
* });
|
|
114
|
-
*
|
|
115
|
-
* // Later, to tear everything down:
|
|
116
|
-
* dispose();
|
|
117
|
-
* ```
|
|
118
|
-
*
|
|
119
|
-
* @description https://docs.solidjs.com/reference/reactive-utilities/create-root
|
|
120
|
-
*/
|
|
121
|
-
export declare function createRoot<T>(init: ((dispose: () => void) => T) | (() => T), options?: {
|
|
122
|
-
id?: string;
|
|
123
|
-
transparent?: boolean;
|
|
124
|
-
}): T;
|
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
import { type Heap } from "./heap.cjs";
|
|
2
|
-
import { activeLanes, assignOrMergeLane, findLane, type OptimisticLane } from "./lanes.cjs";
|
|
3
|
-
import type { Computed, Signal } from "./types.cjs";
|
|
4
|
-
export { activeLanes, assignOrMergeLane, findLane };
|
|
5
|
-
export { getOrCreateLane, hasActiveOverride, mergeLanes, resolveLane } from "./lanes.cjs";
|
|
6
|
-
export declare const dirtyQueue: Heap;
|
|
7
|
-
export declare const zombieQueue: Heap;
|
|
8
|
-
export declare let clock: number;
|
|
9
|
-
export declare let activeTransition: Transition | null;
|
|
10
|
-
export declare let projectionWriteActive: boolean;
|
|
11
|
-
export declare let _hitUnhandledAsync: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Consume the unhandled-async hit. Returns whether this is the first report
|
|
14
|
-
* of the current enforcement window — the caller warns only then.
|
|
15
|
-
*/
|
|
16
|
-
export declare function resetUnhandledAsync(): boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Toggles the dev-mode "must be inside a `<Loading>` boundary" enforcement
|
|
19
|
-
* window. Only `render()` calls this — wrapping the initial mount so that a
|
|
20
|
-
* top-level uncaught async read surfaces the diagnostic. Not part of the
|
|
21
|
-
* user-facing API.
|
|
22
|
-
*
|
|
23
|
-
* @internal
|
|
24
|
-
*/
|
|
25
|
-
export declare function enforceLoadingBoundary(enabled: boolean): void;
|
|
26
|
-
export declare function setProjectionWriteActive(value: boolean): void;
|
|
27
|
-
export declare function setTrackedQueueCallback(value: boolean): void;
|
|
28
|
-
export declare function setEffectCallback(value: boolean): void;
|
|
29
|
-
export type QueueCallback = (type: number) => void;
|
|
30
|
-
type QueueStub = {
|
|
31
|
-
_queues: [QueueCallback[], QueueCallback[]];
|
|
32
|
-
_children: QueueStub[];
|
|
33
|
-
};
|
|
34
|
-
type OptimisticNode = Signal<any> | Computed<any>;
|
|
35
|
-
export interface Transition {
|
|
36
|
-
_time: number;
|
|
37
|
-
_asyncReporters: Map<Computed<any>, Set<Computed<any>>>;
|
|
38
|
-
_pendingNodes: Signal<any>[];
|
|
39
|
-
_optimisticNodes: OptimisticNode[];
|
|
40
|
-
_affectsNodes: OptimisticNode[];
|
|
41
|
-
_optimisticStores: Set<any>;
|
|
42
|
-
_actions: Array<Generator<any, any, any> | AsyncGenerator<any, any, any>>;
|
|
43
|
-
_queueStash: QueueStub;
|
|
44
|
-
_done: boolean | Transition;
|
|
45
|
-
_gatedSubs: Set<Computed<any>>;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Flip-entanglement (#3164 follow-up): `until()` is a declaration of
|
|
49
|
-
* relatedness — the predicate names the condition that confirms the awaiting
|
|
50
|
-
* transaction. When the predicate settles truthy, every live foreign
|
|
51
|
-
* transition whose staged write it read IS the confirming event by the
|
|
52
|
-
* user's own definition, so it merges into the awaiting transaction and
|
|
53
|
-
* reveals at the joint settle — the cross-primitive twin of the family fold
|
|
54
|
-
* (a landing on an optimism-carrying family joins the retaining
|
|
55
|
-
* transaction). Non-flipping updates never pass through here: falsy
|
|
56
|
-
* evaluations don't entangle, so unrelated traffic on the watched sources
|
|
57
|
-
* reveals freely on its own schedule.
|
|
58
|
-
*
|
|
59
|
-
* Runs inside the predicate's compute (pure phase) — the confirming
|
|
60
|
-
* transition's stamps are still live and its commit decision hasn't run, so
|
|
61
|
-
* the merge lands before any reveal. Only the tree-shaken graphs that call
|
|
62
|
-
* `until()` retain this.
|
|
63
|
-
*/
|
|
64
|
-
export declare function entangleConfirmingTransitions(obs: Computed<any>, target: Transition): void;
|
|
65
|
-
export declare function schedule(): void;
|
|
66
|
-
/**
|
|
67
|
-
* Permanently halts the reactive system. Called when a user error escapes
|
|
68
|
-
* every boundary — app state is undefined at that point, so scheduling stops
|
|
69
|
-
* entirely rather than limping along with a half-applied update.
|
|
70
|
-
*/
|
|
71
|
-
export declare function haltReactivity(cause?: unknown): void;
|
|
72
|
-
/** @internal Test/dev-reload hook. Revives scheduling after a halt. */
|
|
73
|
-
export declare function resetErrorHalt(): void;
|
|
74
|
-
export interface IQueue {
|
|
75
|
-
enqueue(type: number, fn: QueueCallback): void;
|
|
76
|
-
run(type: number): boolean | void;
|
|
77
|
-
addChild(child: IQueue): void;
|
|
78
|
-
removeChild(child: IQueue): void;
|
|
79
|
-
created: number;
|
|
80
|
-
notify(node: Computed<any>, mask: number, flags: number, error?: any): boolean;
|
|
81
|
-
stashQueues(stub: QueueStub): void;
|
|
82
|
-
restoreQueues(stub: QueueStub): void;
|
|
83
|
-
_parent: IQueue | null;
|
|
84
|
-
}
|
|
85
|
-
export declare class Queue implements IQueue {
|
|
86
|
-
_parent: IQueue | null;
|
|
87
|
-
_queues: [QueueCallback[], QueueCallback[]];
|
|
88
|
-
_children: IQueue[];
|
|
89
|
-
_ranAt: number;
|
|
90
|
-
created: number;
|
|
91
|
-
addChild(child: IQueue): void;
|
|
92
|
-
removeChild(child: IQueue): void;
|
|
93
|
-
notify(node: Computed<any>, mask: number, flags: number, error?: any): boolean;
|
|
94
|
-
run(type: number): void;
|
|
95
|
-
enqueue(type: number, fn: QueueCallback): void;
|
|
96
|
-
stashQueues(stub: QueueStub): void;
|
|
97
|
-
restoreQueues(stub: QueueStub): void;
|
|
98
|
-
}
|
|
99
|
-
export declare class GlobalQueue extends Queue {
|
|
100
|
-
_running: boolean;
|
|
101
|
-
_batch: Transition;
|
|
102
|
-
static _update: (el: Computed<unknown>) => void;
|
|
103
|
-
static _dispose: (el: Computed<unknown>, self: boolean, zombie: boolean) => void;
|
|
104
|
-
static _runEffect: (el: Computed<unknown>) => void;
|
|
105
|
-
static _clearOptimisticStores: ((stores: Set<any>, completing: Transition | null) => void) | null;
|
|
106
|
-
static _releaseAffectsScope: ((node: OptimisticNode) => void) | null;
|
|
107
|
-
static _releaseAffectsMarks: ((nodes: OptimisticNode[]) => void) | null;
|
|
108
|
-
static _markAffects: ((node: OptimisticNode) => void) | null;
|
|
109
|
-
static _releaseAffectsMark: ((node: OptimisticNode) => void) | null;
|
|
110
|
-
static _wireExternalSource: ((self: Computed<any>) => void) | null;
|
|
111
|
-
static _externalUntrack: (<T>(fn: () => T) => T) | null;
|
|
112
|
-
static _syncCompanions: (<T>(el: Signal<T> | Computed<T>, value: T) => void) | null;
|
|
113
|
-
static _updatePendingSignal: ((el: OptimisticNode) => void) | null;
|
|
114
|
-
static _updateChildCompanions: ((el: Computed<any>) => void) | null;
|
|
115
|
-
static _snapCompanions: ((el: OptimisticNode) => void) | null;
|
|
116
|
-
static _latestRead: (<T>(el: Signal<T> | Computed<T>) => T) | null;
|
|
117
|
-
static _pendingCheck: ((el: OptimisticNode, c: Computed<any> | null, owner: OptimisticNode, firewall: Computed<any> | null) => void) | null;
|
|
118
|
-
static _recordFresh: ((el: OptimisticNode, value: any) => void) | null;
|
|
119
|
-
static _applyReask: ((el: Computed<any>, hadReask: boolean) => boolean) | null;
|
|
120
|
-
static _repollVerdicts: ((el: Computed<any>, snap?: boolean) => void) | null;
|
|
121
|
-
static _witnessAffects: ((node: OptimisticNode) => void) | null;
|
|
122
|
-
static _wakeSuppressedProbes: ((transition: Transition) => void) | null;
|
|
123
|
-
static _optimisticWrite: (<T>(el: Signal<T> | Computed<T>, v: T | ((prev: T) => T)) => T) | null;
|
|
124
|
-
static _resolveOptimistic: ((nodes: OptimisticNode[]) => void) | null;
|
|
125
|
-
static _transitionBlocked: ((transition: Transition) => boolean) | null;
|
|
126
|
-
static _cleanupLanes: ((completingTransition: Transition | null) => void) | null;
|
|
127
|
-
static _runLaneEffects: ((type: number) => void) | null;
|
|
128
|
-
/** Patch-channel optimistic drain (next/patch.ts): optimistic emissions
|
|
129
|
-
* apply at lane-effect timing — visible in flight, unlike the regular
|
|
130
|
-
* effect queues an action stashes. Injected; null when unused. */
|
|
131
|
-
static _drainPatchOptimistic: (() => void) | null;
|
|
132
|
-
static _gatedRead: ((el: Signal<any>, owner: OptimisticNode, c: Computed<any>) => boolean) | null;
|
|
133
|
-
static _laneSuspends: ((owner: OptimisticNode) => boolean) | null;
|
|
134
|
-
static _laneReadsCommitted: ((el: OptimisticNode, owner: OptimisticNode, c: Computed<any>) => boolean) | null;
|
|
135
|
-
static _recomputeLane: ((el: Computed<any>, own: boolean) => OptimisticLane | null | false) | null;
|
|
136
|
-
static _laneAsyncPending: ((el: Computed<any>) => void) | null;
|
|
137
|
-
/** Authoritative-view reader wakeup: installed by until() and refresh() before
|
|
138
|
-
* their first read. Call sites are gated by CONFIG_AUTHORITATIVE_OBSERVED, which
|
|
139
|
-
* only such a reader's carve-out read can set, so `!` invocations are safe once
|
|
140
|
-
* the gate holds (#3303). */
|
|
141
|
-
static _notifyAuthoritativeObservers: ((el: Signal<any> | Computed<any>) => void) | null;
|
|
142
|
-
static _laneAsyncSettled: ((el: Computed<any>) => void) | null;
|
|
143
|
-
static _trackOptimisticStore: ((store: any) => void) | null;
|
|
144
|
-
flush(): void;
|
|
145
|
-
notify(node: Computed<any>, mask: number, flags: number, error?: any): boolean;
|
|
146
|
-
initTransition(transition?: Transition | null): void;
|
|
147
|
-
}
|
|
148
|
-
export declare function queuePendingNode(node: Signal<any>): void;
|
|
149
|
-
export declare let reaskArmed: boolean;
|
|
150
|
-
/** §12d: bumped by every recompute and every new subscriber edge. A node's
|
|
151
|
-
* staged-rewrite skip is sound only while NOTHING recomputed or linked since
|
|
152
|
-
* its last notify — a mid-batch pull can clean a marked subscriber, and a
|
|
153
|
-
* skipped re-write would leave it stale. */
|
|
154
|
-
export declare let notifyEpoch: number;
|
|
155
|
-
export declare function bumpNotifyEpoch(): void;
|
|
156
|
-
export declare function armReaskClear(): void;
|
|
157
|
-
export declare function insertSubs(node: Signal<any> | Computed<any>, optimistic?: boolean): void;
|
|
158
|
-
export declare let storeCommitHook: (() => void) | null;
|
|
159
|
-
export declare function setStoreCommitHook(fn: () => void): void;
|
|
160
|
-
/** Patch-channel release hook (next/patch.ts): transition-stamped patch
|
|
161
|
-
* emissions are released when THEIR batch commits. Transitions never
|
|
162
|
-
* abort: failed actions still commit (only optimistic overrides revert),
|
|
163
|
-
* and merged-away transitions hand their stash to the survivor
|
|
164
|
-
* (mergeTransitionState) — every stash drains exactly once. Injected like
|
|
165
|
-
* storeCommitHook to stay tree-shakeable. */
|
|
166
|
-
export declare let patchCommitHook: ((batch: Transition) => void) | null;
|
|
167
|
-
export declare function setPatchCommitHook(fn: (batch: Transition) => void): void;
|
|
168
|
-
export declare function finalizePureQueue(completingTransition?: Transition | null, incomplete?: boolean): void;
|
|
169
|
-
/**
|
|
170
|
-
* Count of live `affects()` registrations across the system (including
|
|
171
|
-
* store-scope inherited marks). Gates the read-path mark check in `read()` so
|
|
172
|
-
* graphs that never use the feature pay one integer compare.
|
|
173
|
-
*/
|
|
174
|
-
export declare let activeAffectsMarks: number;
|
|
175
|
-
/**
|
|
176
|
-
* Counter mutation seam for the mark engine in affects.ts: an imported `let`
|
|
177
|
-
* binding is read-only, and the read-path gate above must stay a plain module
|
|
178
|
-
* variable so `read()` pays one integer compare, not a function call.
|
|
179
|
-
*
|
|
180
|
-
* @internal
|
|
181
|
-
*/
|
|
182
|
-
export declare function shiftAffectsMarks(delta: 1 | -1): void;
|
|
183
|
-
export declare const globalQueue: GlobalQueue;
|
|
184
|
-
/**
|
|
185
|
-
* Synchronously processes the pending reactive queue, or runs `fn` in a synchronous
|
|
186
|
-
* flush scope before draining the queue.
|
|
187
|
-
*
|
|
188
|
-
* Reactive updates are normally batched onto the microtask queue, so multiple
|
|
189
|
-
* writes in a row collapse into a single update pass. Call `flush()` when you
|
|
190
|
-
* need to *observe* the result of those writes synchronously — most commonly
|
|
191
|
-
* in tests, but also at the boundary of imperative integration code. Pass a
|
|
192
|
-
* callback when the writes themselves should bypass microtask scheduling and
|
|
193
|
-
* drain synchronously when the callback returns.
|
|
194
|
-
*
|
|
195
|
-
* @example
|
|
196
|
-
* ```ts
|
|
197
|
-
* const [count, setCount] = createSignal(0);
|
|
198
|
-
* const doubled = createMemo(() => count() * 2);
|
|
199
|
-
*
|
|
200
|
-
* setCount(5);
|
|
201
|
-
* flush();
|
|
202
|
-
* expect(doubled()).toBe(10);
|
|
203
|
-
*
|
|
204
|
-
* flush(() => setCount(6));
|
|
205
|
-
* expect(doubled()).toBe(12);
|
|
206
|
-
*
|
|
207
|
-
* // Nested flushes drain at each level:
|
|
208
|
-
* flush(() => {
|
|
209
|
-
* setCount(7);
|
|
210
|
-
* flush(() => setCount(8)); // inner drain — effects fire here
|
|
211
|
-
* // outer continues with up-to-date state
|
|
212
|
-
* });
|
|
213
|
-
* ```
|
|
214
|
-
*/
|
|
215
|
-
export declare function flush(): void;
|
|
216
|
-
export declare function flush<T>(fn: () => T): T;
|
|
217
|
-
/** A fresh, unentered transaction (#3146): the optimistic store's truth
|
|
218
|
-
* flight DECLARES an owned transaction instead of relying on whatever the
|
|
219
|
-
* ambient adoption machinery stamped on its firewall. Activate it with
|
|
220
|
-
* initTransition; it is a plain batch until then. */
|
|
221
|
-
export declare function createTransition(): Transition;
|
|
222
|
-
export declare function currentTransition(transition: Transition): Transition;
|
|
223
|
-
export declare function setActiveTransition(transition: Transition | null): void;
|
|
224
|
-
export declare function runInTransition<T>(transition: Transition, fn: () => T): T;
|
|
225
|
-
/** Run `fn` with `transition` as BOTH the ambient transaction and the
|
|
226
|
-
* registration batch, restoring both after. runInTransition alone is not
|
|
227
|
-
* enough for code that WRITES on behalf of a transaction from inside someone
|
|
228
|
-
* else's window (optimistic replay re-arming a still-open action's edits
|
|
229
|
-
* during a landing commit, #3123): registrations route through the queue's
|
|
230
|
-
* batch pointer, and a bare activeTransition swap leaves them in the ambient
|
|
231
|
-
* batch — a plain batch "completes" at the next flush and reverts optimistic
|
|
232
|
-
* registrations that were supposed to live with the transaction.
|
|
233
|
-
* initTransition is the wrong tool here: it MERGES the currently ambient
|
|
234
|
-
* transaction into the target, entangling whatever the interrupted window
|
|
235
|
-
* belonged to. */
|
|
236
|
-
export declare function runAsTransitionBatch<T>(transition: Transition, fn: () => T): T;
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import type { NOT_PENDING } from "./constants.cjs";
|
|
2
|
-
import type { OptimisticLane } from "./lanes.cjs";
|
|
3
|
-
import type { IQueue, Transition } from "./scheduler.cjs";
|
|
4
|
-
export interface Disposable {
|
|
5
|
-
(): void;
|
|
6
|
-
}
|
|
7
|
-
export interface Link {
|
|
8
|
-
_dep: Signal<unknown> | Computed<unknown>;
|
|
9
|
-
_sub: Computed<unknown>;
|
|
10
|
-
_nextDep: Link | null;
|
|
11
|
-
_prevSub: Link | null;
|
|
12
|
-
_nextSub: Link | null;
|
|
13
|
-
/**
|
|
14
|
-
* `_sub._depGen` at the time this link was created or last revalidated
|
|
15
|
-
* in-order. A link stamped with the subscriber's current pass generation is
|
|
16
|
-
* inside the validated `[deps.._depsTail]` prefix — an O(1) replacement for
|
|
17
|
-
* scanning the dep list to answer membership (see `link()`).
|
|
18
|
-
*/
|
|
19
|
-
_gen: number;
|
|
20
|
-
_pendingObserver?: boolean;
|
|
21
|
-
}
|
|
22
|
-
export interface NodeOptions<T> {
|
|
23
|
-
id?: string;
|
|
24
|
-
name?: string;
|
|
25
|
-
transparent?: boolean;
|
|
26
|
-
equals?: ((prev: T, next: T) => boolean) | false;
|
|
27
|
-
ownedWrite?: boolean;
|
|
28
|
-
/** Exclude this signal from snapshot capture (internal — not part of public API) */
|
|
29
|
-
_noSnapshot?: boolean;
|
|
30
|
-
/** Extra CONFIG_* bits OR'd into the node's config at creation (internal —
|
|
31
|
-
* not part of public API). Used by resolve()/until() for
|
|
32
|
-
* CONFIG_DIRECT_COMMIT / CONFIG_AUTHORITATIVE_READ, keeping the per-flag
|
|
33
|
-
* option arms out of the core creation path. */
|
|
34
|
-
_extraConfig?: number;
|
|
35
|
-
unobserved?: () => void;
|
|
36
|
-
lazy?: boolean;
|
|
37
|
-
sync?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Commit #0. When present (checked with `in`, so an explicit `undefined`
|
|
40
|
-
* counts), the node is born committed with this value instead of
|
|
41
|
-
* STATUS_UNINITIALIZED: reads serve it everywhere, nothing suspends to
|
|
42
|
-
* Loading boundaries, transitions are never held, and the window is
|
|
43
|
-
* verdict-quiet (`isPending` stays false — commit #0 answers the question
|
|
44
|
-
* by declaration; first-load affordances live in the value itself). After
|
|
45
|
-
* the first real answer lands, normal refetch/pending semantics apply.
|
|
46
|
-
*/
|
|
47
|
-
loadingValue?: T;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Cold node extension (stage-3 §12): optional machinery that most nodes
|
|
51
|
-
* never touch lives one hop away so the CORE node literal stays under V8's
|
|
52
|
-
* in-object property boundary (~39 fields measured: past it, every literal
|
|
53
|
-
* allocation spills to an out-of-object backing store and creation cost
|
|
54
|
-
* roughly quadruples — the create0to1 cliff). Allocated lazily by `ext()`
|
|
55
|
-
* on first installer write; ONE shape shared by signals and computeds so
|
|
56
|
-
* `_x` access stays monomorphic. Presence bits on `_config`
|
|
57
|
-
* (CONFIG_OPTIMISTIC / HAS_COMPANIONS / HAS_LANE / HAS_SNAPSHOT) remain the
|
|
58
|
-
* hot-path gates — a bit says "consult _x", never the reverse.
|
|
59
|
-
*/
|
|
60
|
-
export interface NodeExtension {
|
|
61
|
-
_overrideValue: unknown | typeof NOT_PENDING;
|
|
62
|
-
/**
|
|
63
|
-
* The transaction that owns the active override (stamped at optimistic
|
|
64
|
-
* write, cleared at settle). Ownership must live on the node: a lane's
|
|
65
|
-
* _transition is a scheduling affinity that a shared subscriber can merge
|
|
66
|
-
* across transactions (#2912) — following it would let one action's settle
|
|
67
|
-
* revert another action's live override. Node-level sibling of the store
|
|
68
|
-
* layer's STORE_OPTIMISTIC_OWNERS stamps (#2899). `null` = ambient write.
|
|
69
|
-
*/
|
|
70
|
-
_overrideOwner: Transition | null | undefined;
|
|
71
|
-
_optimisticLane: OptimisticLane | undefined;
|
|
72
|
-
_pendingSignal: Signal<boolean> | undefined;
|
|
73
|
-
_latestValueComputed: Computed<any> | undefined;
|
|
74
|
-
_parentSource: Signal<any> | Computed<any> | undefined;
|
|
75
|
-
/**
|
|
76
|
-
* Live `affects()` marks on this node (refcount). Non-zero is declared
|
|
77
|
-
* motion — see affects(); the count is the mark's only graph state.
|
|
78
|
-
*/
|
|
79
|
-
_affectsCount: number;
|
|
80
|
-
_inFlight: PromiseLike<any> | AsyncIterable<any> | null;
|
|
81
|
-
/** Cancellation for the CURRENT iterator flight (#3122): closes the
|
|
82
|
-
* iterator (`it.return()`), idempotent. Fired at the sites that release
|
|
83
|
-
* `_inFlight` so a superseded stream stops at supersede time — its owner
|
|
84
|
-
* cleanup registration may ride the zombie-disposal channel, which a held
|
|
85
|
-
* transition defers until the SUPERSEDING flight settles. Null for plain
|
|
86
|
-
* promise flights (no cancellation hook exists). */
|
|
87
|
-
_flightTeardown: (() => void) | null;
|
|
88
|
-
_error: unknown;
|
|
89
|
-
_blocked: boolean | undefined;
|
|
90
|
-
_pendingSources: Set<Computed<any>> | undefined;
|
|
91
|
-
_notifyStatus: ((status?: number, error?: any) => void) | undefined;
|
|
92
|
-
/** Question-scoped re-ask classification of the current pending window
|
|
93
|
-
* (see the former Computed._x?._reask doc): set by recompute from
|
|
94
|
-
* REACTIVE_REASK, cleared on landing; meaningless while not pending. */
|
|
95
|
-
_reask: boolean;
|
|
96
|
-
_child: FirewallSignal<any> | null;
|
|
97
|
-
_unobserved: (() => void) | undefined;
|
|
98
|
-
_snapshotValue: any;
|
|
99
|
-
/** Zombie staging (staged disposal): a recompute of an owner that HAS
|
|
100
|
-
* children/disposal parks them here until the flush commits (or a
|
|
101
|
-
* transition reverts). Childless nodes — the common case — never write
|
|
102
|
-
* these. */
|
|
103
|
-
_pendingDisposal: Disposable | Disposable[] | null;
|
|
104
|
-
_pendingFirstChild: Owner | null;
|
|
105
|
-
/** #3038: the firewall children that actually carry isPending()/latest()
|
|
106
|
-
* companions. The post-recompute companion snap iterates THIS set —
|
|
107
|
-
* O(companions asked for) — never the full `_child` chain (one entry per
|
|
108
|
-
* materialized leaf). Populated at companion creation; entries live as
|
|
109
|
-
* long as their companions (which are permanent once created). */
|
|
110
|
-
_companionChildren: Set<FirewallSignal<any>> | undefined;
|
|
111
|
-
}
|
|
112
|
-
export interface RawSignal<T> {
|
|
113
|
-
_subs: Link | null;
|
|
114
|
-
_subsTail: Link | null;
|
|
115
|
-
/**
|
|
116
|
-
* DEV-only live subscriber count. Maintained by `link`/`unlinkSubs` for
|
|
117
|
-
* graph-size diagnostics; undefined in production.
|
|
118
|
-
*/
|
|
119
|
-
_subCount?: number;
|
|
120
|
-
_value: T;
|
|
121
|
-
_name?: string;
|
|
122
|
-
_equals: false | ((a: T, b: T) => boolean);
|
|
123
|
-
_config: number;
|
|
124
|
-
_time: number;
|
|
125
|
-
/** IN CORE, not the extension (stage-3 §12c): consulted on EVERY write
|
|
126
|
-
* (setSignal's transition-init check) and on recompute scheduling — the
|
|
127
|
-
* per-write extension chase measurably taxed propagation chains. */
|
|
128
|
-
_transition: Transition | null;
|
|
129
|
-
/** Notify-epoch stamp of the last subscriber walk (§12d). A re-write to an
|
|
130
|
-
* already-staged node whose stamp still equals the global epoch skips the
|
|
131
|
-
* whole walk — marking is idempotent, and the epoch bumps on every
|
|
132
|
-
* recompute and new subscriber edge (either can invalidate the skip). */
|
|
133
|
-
_notifiedAt: number;
|
|
134
|
-
_pendingValue: T | typeof NOT_PENDING;
|
|
135
|
-
/** Cold extension — see NodeExtension. */
|
|
136
|
-
_x: NodeExtension | null;
|
|
137
|
-
}
|
|
138
|
-
export interface FirewallSignal<T> extends RawSignal<T> {
|
|
139
|
-
_firewall: Computed<any>;
|
|
140
|
-
_nextChild: FirewallSignal<unknown> | null;
|
|
141
|
-
}
|
|
142
|
-
export type Signal<T> = RawSignal<T> | FirewallSignal<T>;
|
|
143
|
-
export interface Owner {
|
|
144
|
-
id?: string;
|
|
145
|
-
_config: number;
|
|
146
|
-
_snapshotScope?: boolean;
|
|
147
|
-
/** Effect-returned cleanup; managed across reruns, invoked at true disposal */
|
|
148
|
-
_cleanup?: () => void;
|
|
149
|
-
_disposal: Disposable | Disposable[] | null;
|
|
150
|
-
_parent: Owner | null;
|
|
151
|
-
_context: Record<symbol | string, unknown>;
|
|
152
|
-
_childCount: number;
|
|
153
|
-
_queue: IQueue;
|
|
154
|
-
_firstChild: Owner | null;
|
|
155
|
-
_nextSibling: Owner | null;
|
|
156
|
-
_prevSibling: Owner | null;
|
|
157
|
-
/** Cold extension — see NodeExtension (owners use the zombie-pair slots). */
|
|
158
|
-
_x: NodeExtension | null;
|
|
159
|
-
}
|
|
160
|
-
export interface Computed<T> extends RawSignal<T>, Owner {
|
|
161
|
-
_deps: Link | null;
|
|
162
|
-
_depsTail: Link | null;
|
|
163
|
-
/**
|
|
164
|
-
* DEV-only live source count. Maintained by `link`/`unlinkSubs` for
|
|
165
|
-
* graph-size diagnostics; undefined in production.
|
|
166
|
-
*/
|
|
167
|
-
_depCount?: number;
|
|
168
|
-
/** Recompute-pass counter; bumped when dep revalidation starts. */
|
|
169
|
-
_depGen: number;
|
|
170
|
-
_flags: number;
|
|
171
|
-
_statusFlags: number;
|
|
172
|
-
_height: number;
|
|
173
|
-
_nextHeap: Computed<any> | undefined;
|
|
174
|
-
_prevHeap: Computed<any>;
|
|
175
|
-
_fn: (prev?: T) => T;
|
|
176
|
-
/**
|
|
177
|
-
* Clock tick at which REACTIVE_MANUAL_WRITE was last applied
|
|
178
|
-
* (`suppressComputedRecompute`). Lets `refresh()` distinguish a same-tick
|
|
179
|
-
* manual write (which wins over the refresh, #2692) from a mask carried
|
|
180
|
-
* across ticks by a transaction (which an explicit refresh lifts, #3026).
|
|
181
|
-
* Only meaningful while REACTIVE_MANUAL_WRITE is set.
|
|
182
|
-
*/
|
|
183
|
-
_manualWriteTime?: number;
|
|
184
|
-
/**
|
|
185
|
-
* True while a `loadingValue` node's first real answer hasn't landed: the
|
|
186
|
-
* node was born committed (commit #0 = the loading value) and `handleAsync`
|
|
187
|
-
* serves that committed value instead of throwing NotReadyError, so first
|
|
188
|
-
* flights never suspend readers, trip boundaries, or hold transitions.
|
|
189
|
-
* The window is verdict-quiet: `isPending` stays false, because commit #0
|
|
190
|
-
* answers the question by declaration (first-load affordances belong to
|
|
191
|
-
* the value channel). Cleared by the first value landing on any path (sync
|
|
192
|
-
* return, sync-resolved promise, first iterator yield, async settle); a
|
|
193
|
-
* real error leaves it set — errors answer reads but don't enter the value
|
|
194
|
-
* lineage, so a retry serves the loading value again. Once cleared, normal
|
|
195
|
-
* pending/refetch semantics apply forever. (Stays in CORE: written
|
|
196
|
-
* unconditionally by recompute and every commit.)
|
|
197
|
-
*/
|
|
198
|
-
_loading: boolean;
|
|
199
|
-
}
|
|
200
|
-
export interface Root extends Owner {
|
|
201
|
-
_root: true;
|
|
202
|
-
_parentComputed: Computed<any> | null;
|
|
203
|
-
dispose(self?: boolean): void;
|
|
204
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { $REFRESH, ContextNotFoundError, NoOwnerError, NotReadyError, TimeoutError, action, createContext, createOwner, createRoot, runWithOwner, flush, getNextChildId, peekNextChildId, getContext, setContext, getOwner, isDisposed, getObserver, isEqual, untrack, isPending, latest, SUPPORTS_PROXY, setSnapshotCapture, markSnapshotScope, releaseSnapshotScope, clearSnapshots, enforceLoadingBoundary, enableExternalSource, resetErrorHalt } from "./core/index.cjs";
|
|
2
|
-
import { type Dev } from "./core/index.cjs";
|
|
3
|
-
export declare const DEV: Dev | undefined;
|
|
4
|
-
export type { Owner, Context, ContextRecord, IQueue, ExternalSourceFactory, ExternalSource, ExternalSourceConfig, Refreshable, Dev, DevHooks, DiagnosticCapture, DiagnosticCode, DiagnosticEvent, DiagnosticKind, Diagnostics, DiagnosticSeverity } from "./core/index.cjs";
|
|
5
|
-
export { createSignal, createMemo, createEffect, createRenderEffect, createTrackedEffect, createReaction, createOptimistic, refresh, resolve, until, onSettled, onCleanup } from "./signals.cjs";
|
|
6
|
-
export type { Truthy, UntilOptions, Accessor, SourceAccessor, Setter, Signal, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, SignalOptions, MemoOptions, NoInfer } from "./signals.cjs";
|
|
7
|
-
export { affects } from "./affects.cjs";
|
|
8
|
-
export { mapArray, repeat, type Maybe } from "./map.cjs";
|
|
9
|
-
export * from "./store/index.cjs";
|
|
10
|
-
export { createLoadingBoundary, createErrorBoundary, createRevealOrder, flatten, type RevealOrder } from "./boundaries.cjs";
|
package/dist/types-cjs/map.d.cts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { type Accessor } from "./signals.cjs";
|
|
2
|
-
export type Maybe<T> = T | void | null | undefined | false;
|
|
3
|
-
/**
|
|
4
|
-
* Reactively maps an array, reusing the previously-mapped value for unchanged
|
|
5
|
-
* items.
|
|
6
|
-
*
|
|
7
|
-
* The callback shape follows the keying mode:
|
|
8
|
-
* - default / `keyed: true` receives `(item, index)` where `item` is the raw
|
|
9
|
-
* row value and `index` is an accessor.
|
|
10
|
-
* - `keyed: false` receives `(item, index)` where `item` is an accessor and
|
|
11
|
-
* `index` is a stable number.
|
|
12
|
-
* - `keyed: item => key` receives accessors for both arguments.
|
|
13
|
-
*
|
|
14
|
-
* This is the underlying helper that powers `<For>`. App code should use
|
|
15
|
-
* `<For>` directly; reach for `mapArray` when implementing custom list
|
|
16
|
-
* components.
|
|
17
|
-
*
|
|
18
|
-
* - `options.keyed` — `true` (default for primitives) compares by identity;
|
|
19
|
-
* `false` falls back to index-only mapping; pass a function `(item) => key`
|
|
20
|
-
* for stable identity by extracted key.
|
|
21
|
-
* - `options.fallback` — accessor returning a value to show when the input is
|
|
22
|
-
* empty.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```ts
|
|
26
|
-
* const view = mapArray(
|
|
27
|
-
* items,
|
|
28
|
-
* (item, index) => `${index()}: ${item.label}`,
|
|
29
|
-
* { fallback: () => "no items" }
|
|
30
|
-
* );
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
* @description https://docs.solidjs.com/reference/reactive-utilities/map-array
|
|
34
|
-
*/
|
|
35
|
-
export declare function mapArray<Item, MappedItem>(list: Accessor<Maybe<readonly Item[]>>, map: (value: Item, index: Accessor<number>) => MappedItem, options?: {
|
|
36
|
-
keyed?: true;
|
|
37
|
-
fallback?: Accessor<any>;
|
|
38
|
-
name?: string;
|
|
39
|
-
}): Accessor<MappedItem[]>;
|
|
40
|
-
export declare function mapArray<Item, MappedItem>(list: Accessor<Maybe<readonly Item[]>>, map: (value: Accessor<Item>, index: number) => MappedItem, options: {
|
|
41
|
-
keyed: false;
|
|
42
|
-
fallback?: Accessor<any>;
|
|
43
|
-
name?: string;
|
|
44
|
-
}): Accessor<MappedItem[]>;
|
|
45
|
-
export declare function mapArray<Item, MappedItem>(list: Accessor<Maybe<readonly Item[]>>, map: (value: Accessor<Item>, index: Accessor<number>) => MappedItem, options: {
|
|
46
|
-
keyed: (item: Item) => any;
|
|
47
|
-
fallback?: Accessor<any>;
|
|
48
|
-
name?: string;
|
|
49
|
-
}): Accessor<MappedItem[]>;
|
|
50
|
-
/**
|
|
51
|
-
* Reactively renders a callback `count` times, reusing previously-rendered
|
|
52
|
-
* entries when only the count changes. Underlying helper for `<Repeat>`.
|
|
53
|
-
*
|
|
54
|
-
* - `options.from` — start index (default `0`); useful for offset/windowed
|
|
55
|
-
* rendering.
|
|
56
|
-
* - `options.fallback` — accessor returning a value to show when count is `0`.
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* ```ts
|
|
60
|
-
* const view = repeat(count, i => `Item ${i}`, { fallback: () => "empty" });
|
|
61
|
-
* ```
|
|
62
|
-
*
|
|
63
|
-
* @description https://docs.solidjs.com/reference/reactive-utilities/repeat
|
|
64
|
-
*/
|
|
65
|
-
export declare function repeat(count: Accessor<number>, map: (index: number) => any, options?: {
|
|
66
|
-
from?: Accessor<number | undefined>;
|
|
67
|
-
fallback?: Accessor<any>;
|
|
68
|
-
name?: string;
|
|
69
|
-
}): Accessor<any[]>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export type { Store, StoreReturn, ProjectionStoreReturn, StoreSetter, StoreNode, StoreOptions, ProjectionOptions, NotWrappable, SolidStore } from "./store.cjs";
|
|
2
|
-
export type { Merge, Omit } from "./utils.cjs";
|
|
3
|
-
export { isWrappable, $TRACK, $PROXY, $TARGET } from "./store.cjs";
|
|
4
|
-
import type { NoFn, ProjectionOptions, Store, StoreOptions, StoreSetter } from "./store.cjs";
|
|
5
|
-
import type { Refreshable } from "../core/index.cjs";
|
|
6
|
-
export { createProjectionNext as createProjection } from "./next/projection.cjs";
|
|
7
|
-
export { storeIsShallow, storeHasFamily, storeHasOptimisticFamily } from "./next/store.cjs";
|
|
8
|
-
export { createOptimisticStoreNext as createOptimisticStore } from "./next/optimistic.cjs";
|
|
9
|
-
/** Public createStore: plain form `(initialValue, options?)` and derived writable
|
|
10
|
-
* form `(fn, seed, options?)`. */
|
|
11
|
-
export declare function createStore<T extends object = {}>(initialValue: NoFn<T> | Store<NoFn<T>>, options?: StoreOptions): [get: Store<T>, set: StoreSetter<T>];
|
|
12
|
-
export declare function createStore<T extends object = {}>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, seed: Partial<T> | Store<NoFn<T>>, options?: ProjectionOptions): [get: Refreshable<Store<T>>, set: StoreSetter<T>];
|
|
13
|
-
export declare function reconcile<T extends U, U>(value: T, key?: string | ((item: NonNullable<any>) => any) | null): (state: U) => T;
|
|
14
|
-
export declare function snapshot<T>(value: T): T;
|
|
15
|
-
export declare function deep<T>(value: T): T;
|
|
16
|
-
export { storePath } from "./storePath.cjs";
|
|
17
|
-
export type { PathSetter, Part, StorePathRange, ArrayFilterFn, CustomPartial } from "./storePath.cjs";
|
|
18
|
-
export { merge, omit } from "./utils.cjs";
|