@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.
- package/dist/dev.js +700 -385
- package/dist/node.cjs +1865 -1592
- package/dist/prod.js +1496 -1232
- package/dist/types/boundaries.d.ts +3 -3
- package/dist/types/core/async.d.ts +1 -0
- package/dist/types/core/core.d.ts +25 -1
- package/dist/types/core/dev.d.ts +10 -2
- package/dist/types/core/effect.d.ts +1 -3
- package/dist/types/core/graph.d.ts +1 -1
- package/dist/types/core/index.d.ts +2 -2
- package/dist/types/core/invariants.d.ts +49 -0
- package/dist/types/core/scheduler.d.ts +8 -0
- package/dist/types/core/types.d.ts +19 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/signals.d.ts +39 -2
- package/dist/types/store/projection.d.ts +2 -2
- package/dist/types/store/store.d.ts +28 -1
- package/dist/types-cjs/boundaries.d.cts +3 -3
- package/dist/types-cjs/core/async.d.cts +1 -0
- package/dist/types-cjs/core/core.d.cts +25 -1
- package/dist/types-cjs/core/dev.d.cts +10 -2
- package/dist/types-cjs/core/effect.d.cts +1 -3
- package/dist/types-cjs/core/graph.d.cts +1 -1
- package/dist/types-cjs/core/index.d.cts +2 -2
- package/dist/types-cjs/core/invariants.d.cts +49 -0
- package/dist/types-cjs/core/scheduler.d.cts +8 -0
- package/dist/types-cjs/core/types.d.cts +19 -0
- package/dist/types-cjs/index.d.cts +1 -1
- package/dist/types-cjs/signals.d.cts +39 -2
- package/dist/types-cjs/store/projection.d.cts +2 -2
- package/dist/types-cjs/store/store.d.cts +28 -1
- package/package.json +1 -1
- package/dist/types/src/boundaries.d.ts +0 -173
- package/dist/types/src/core/action.d.ts +0 -35
- package/dist/types/src/core/async.d.ts +0 -6
- package/dist/types/src/core/constants.d.ts +0 -51
- package/dist/types/src/core/context.d.ts +0 -36
- package/dist/types/src/core/core.d.ts +0 -174
- package/dist/types/src/core/dev.d.ts +0 -49
- package/dist/types/src/core/effect.d.ts +0 -32
- package/dist/types/src/core/error.d.ts +0 -38
- package/dist/types/src/core/external.d.ts +0 -45
- package/dist/types/src/core/graph.d.ts +0 -5
- package/dist/types/src/core/heap.d.ts +0 -14
- package/dist/types/src/core/index.d.ts +0 -12
- package/dist/types/src/core/lanes.d.ts +0 -54
- package/dist/types/src/core/owner.d.ts +0 -116
- package/dist/types/src/core/scheduler.d.ts +0 -122
- package/dist/types/src/core/types.d.ts +0 -85
- package/dist/types/src/index.d.ts +0 -9
- package/dist/types/src/map.d.ts +0 -53
- package/dist/types/src/signals.d.ts +0 -512
- package/dist/types/src/store/index.d.ts +0 -9
- package/dist/types/src/store/optimistic.d.ts +0 -45
- package/dist/types/src/store/projection.d.ts +0 -66
- package/dist/types/src/store/reconcile.d.ts +0 -23
- package/dist/types/src/store/store.d.ts +0 -125
- package/dist/types/src/store/storePath.d.ts +0 -58
- package/dist/types/src/store/utils.d.ts +0 -114
- package/dist/types-cjs/src/boundaries.d.cts +0 -173
- package/dist/types-cjs/src/core/action.d.cts +0 -35
- package/dist/types-cjs/src/core/async.d.cts +0 -6
- package/dist/types-cjs/src/core/constants.d.cts +0 -51
- package/dist/types-cjs/src/core/context.d.cts +0 -36
- package/dist/types-cjs/src/core/core.d.cts +0 -174
- package/dist/types-cjs/src/core/dev.d.cts +0 -49
- package/dist/types-cjs/src/core/effect.d.cts +0 -32
- package/dist/types-cjs/src/core/error.d.cts +0 -38
- package/dist/types-cjs/src/core/external.d.cts +0 -45
- package/dist/types-cjs/src/core/graph.d.cts +0 -5
- package/dist/types-cjs/src/core/heap.d.cts +0 -14
- package/dist/types-cjs/src/core/index.d.cts +0 -12
- package/dist/types-cjs/src/core/lanes.d.cts +0 -54
- package/dist/types-cjs/src/core/owner.d.cts +0 -116
- package/dist/types-cjs/src/core/scheduler.d.cts +0 -122
- package/dist/types-cjs/src/core/types.d.cts +0 -85
- package/dist/types-cjs/src/index.d.cts +0 -9
- package/dist/types-cjs/src/map.d.cts +0 -53
- package/dist/types-cjs/src/signals.d.cts +0 -512
- package/dist/types-cjs/src/store/index.d.cts +0 -9
- package/dist/types-cjs/src/store/optimistic.d.cts +0 -45
- package/dist/types-cjs/src/store/projection.d.cts +0 -66
- package/dist/types-cjs/src/store/reconcile.d.cts +0 -23
- package/dist/types-cjs/src/store/store.d.cts +0 -125
- package/dist/types-cjs/src/store/storePath.d.cts +0 -58
- package/dist/types-cjs/src/store/utils.d.cts +0 -114
|
@@ -10,6 +10,14 @@ export interface Link {
|
|
|
10
10
|
_nextDep: Link | null;
|
|
11
11
|
_prevSub: Link | null;
|
|
12
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;
|
|
13
21
|
}
|
|
14
22
|
export interface NodeOptions<T> {
|
|
15
23
|
id?: string;
|
|
@@ -50,6 +58,8 @@ export interface Owner {
|
|
|
50
58
|
id?: string;
|
|
51
59
|
_config: number;
|
|
52
60
|
_snapshotScope?: boolean;
|
|
61
|
+
/** Effect-returned cleanup; managed across reruns, invoked at true disposal */
|
|
62
|
+
_cleanup?: () => void;
|
|
53
63
|
_disposal: Disposable | Disposable[] | null;
|
|
54
64
|
_parent: Owner | null;
|
|
55
65
|
_context: Record<symbol | string, unknown>;
|
|
@@ -64,6 +74,8 @@ export interface Owner {
|
|
|
64
74
|
export interface Computed<T> extends RawSignal<T>, Owner {
|
|
65
75
|
_deps: Link | null;
|
|
66
76
|
_depsTail: Link | null;
|
|
77
|
+
/** Recompute-pass counter; bumped when dep revalidation starts. */
|
|
78
|
+
_depGen: number;
|
|
67
79
|
_flags: number;
|
|
68
80
|
_blocked?: boolean;
|
|
69
81
|
_pendingSource?: Computed<any>;
|
|
@@ -77,6 +89,13 @@ export interface Computed<T> extends RawSignal<T>, Owner {
|
|
|
77
89
|
_inFlight: PromiseLike<T> | AsyncIterable<T> | null;
|
|
78
90
|
_child: FirewallSignal<any> | null;
|
|
79
91
|
_notifyStatus?: (status?: number, error?: any) => void;
|
|
92
|
+
/**
|
|
93
|
+
* Store-wide optimistic mask (count of this firewall's store targets with
|
|
94
|
+
* live optimistic writes). Non-zero decrees the whole store settled for
|
|
95
|
+
* `isPending` — the store is the primitive the mask covers (A20 re-rule
|
|
96
|
+
* 2026-07-07c).
|
|
97
|
+
*/
|
|
98
|
+
_optimisticMask?: number;
|
|
80
99
|
}
|
|
81
100
|
export interface Root extends Owner {
|
|
82
101
|
_root: true;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { $REFRESH, ContextNotFoundError, NoOwnerError, NotReadyError, action, createContext, createOwner, createRoot, runWithOwner, flush, getNextChildId, peekNextChildId, getContext, setContext, getOwner, isDisposed, getObserver, isEqual, untrack, isPending, latest, refresh, SUPPORTS_PROXY, setSnapshotCapture, markSnapshotScope, releaseSnapshotScope, clearSnapshots, enforceLoadingBoundary, enableExternalSource } from "./core/index.cjs";
|
|
1
|
+
export { $REFRESH, ContextNotFoundError, NoOwnerError, NotReadyError, action, createContext, createOwner, createRoot, runWithOwner, flush, getNextChildId, peekNextChildId, getContext, setContext, getOwner, isDisposed, getObserver, isEqual, untrack, isPending, latest, refresh, SUPPORTS_PROXY, setSnapshotCapture, markSnapshotScope, releaseSnapshotScope, clearSnapshots, enforceLoadingBoundary, enableExternalSource, resetErrorHalt } from "./core/index.cjs";
|
|
2
2
|
import { type Dev } from "./core/index.cjs";
|
|
3
3
|
export declare const DEV: Dev | undefined;
|
|
4
4
|
export type { Owner, Context, ContextRecord, IQueue, ExternalSourceFactory, ExternalSource, ExternalSourceConfig, Refreshable, Dev, DevHooks, DiagnosticCapture, DiagnosticCode, DiagnosticEvent, DiagnosticKind, Diagnostics, DiagnosticSeverity } from "./core/index.cjs";
|
|
@@ -69,6 +69,17 @@ export type ComputeFunction<Prev, Next extends Prev = Prev> = (v: Prev) => Promi
|
|
|
69
69
|
export type EffectFunction<Prev, Next extends Prev = Prev> = (v: Next, p?: Prev) => (() => void) | void;
|
|
70
70
|
export type EffectBundle<Prev, Next extends Prev = Prev> = {
|
|
71
71
|
effect: EffectFunction<Prev, Next>;
|
|
72
|
+
/**
|
|
73
|
+
* Intercepts compute-phase errors (thrown by the compute function or arriving
|
|
74
|
+
* from upstream sources). Effect-phase throws are NOT routed here — they are
|
|
75
|
+
* your own imperative code and escalate to the nearest error boundary.
|
|
76
|
+
*
|
|
77
|
+
* This is the error arm of the effect phase: it runs on the same queue and
|
|
78
|
+
* in the same imperative, writable scope as `effect` (signal writes are
|
|
79
|
+
* legal), receives the error the user code threw, and observes settled
|
|
80
|
+
* outcomes — an error that recovers before the effect phase runs the
|
|
81
|
+
* `effect` arm instead, and a held transition defers it like `effect`.
|
|
82
|
+
*/
|
|
72
83
|
error: (err: unknown, cleanup: () => void) => void;
|
|
73
84
|
};
|
|
74
85
|
/** Options shared by every effect primitive. */
|
|
@@ -245,7 +256,24 @@ export declare function createMemo<T>(compute: ComputeFunction<undefined | NoInf
|
|
|
245
256
|
* `createTrackedEffect` (with the tradeoffs noted there).
|
|
246
257
|
*
|
|
247
258
|
* Pass an `EffectBundle` (`{ effect, error }`) instead of a plain function to
|
|
248
|
-
* intercept errors thrown
|
|
259
|
+
* intercept **compute-phase** errors — errors thrown by `compute` or arriving
|
|
260
|
+
* from upstream reactive sources (including async rejections), which your own
|
|
261
|
+
* code has no frame to `try/catch`. The `error` handler is the error arm of
|
|
262
|
+
* the effect phase: it runs on the same schedule and in the same imperative,
|
|
263
|
+
* writable scope as `effect` (setting error state via signals is fine), and
|
|
264
|
+
* only for *settled* errors — a transient error that recovers before the
|
|
265
|
+
* effect phase runs `effect` with the recovered value instead, and a held
|
|
266
|
+
* transition defers it exactly as it defers `effect`. Without an `error`
|
|
267
|
+
* handler a compute-phase error is logged and the effect simply skips that
|
|
268
|
+
* run — a non-render effect's reactivity failing does not crash the app.
|
|
269
|
+
* Rethrowing from `error` escalates it to the nearest error boundary
|
|
270
|
+
* (halting the system if none exists).
|
|
271
|
+
*
|
|
272
|
+
* The **effect phase is different**: it is your own imperative code, so handle
|
|
273
|
+
* failures with `try/catch` where they occur. An uncaught effect-phase throw
|
|
274
|
+
* is treated as an unhandled application error — caught by the nearest
|
|
275
|
+
* `createErrorBoundary`/`<Errored>`, and permanently halting the reactive
|
|
276
|
+
* system if there is none. It is *not* routed to the bundle's `error` handler.
|
|
249
277
|
*
|
|
250
278
|
* ```typescript
|
|
251
279
|
* createEffect<T>(compute, effectFn | { effect, error }, options?: EffectOptions);
|
|
@@ -383,7 +411,9 @@ export declare function createReaction(effectFn: EffectFunction<undefined> | Eff
|
|
|
383
411
|
* Awaits a reactive expression and returns its first fully-settled value as a
|
|
384
412
|
* `Promise`. Pending async reads (`createMemo` returning a promise, etc.) are
|
|
385
413
|
* waited on; once the expression returns synchronously without `NotReadyError`
|
|
386
|
-
* the promise resolves with that value.
|
|
414
|
+
* the promise resolves with that value. If the expression settles with an
|
|
415
|
+
* error instead — including an async source that rejects — the promise
|
|
416
|
+
* rejects with it.
|
|
387
417
|
*
|
|
388
418
|
* Must be called *outside* a tracking scope — it doesn't subscribe, it just
|
|
389
419
|
* resolves the current value once.
|
|
@@ -459,6 +489,13 @@ export declare function createOptimistic<T>(fn: ComputeFunction<T>, options?: Si
|
|
|
459
489
|
* `onCleanup` is **not** allowed inside the callback — return a cleanup
|
|
460
490
|
* function instead. The returned cleanup runs on owner disposal.
|
|
461
491
|
*
|
|
492
|
+
* A cleanup return is only honored when `onSettled` is called from an **owned**
|
|
493
|
+
* scope (e.g. a component body). When it fires out of band from an *unowned*
|
|
494
|
+
* scope — an event handler, a tracked effect, or another `onSettled` — there is
|
|
495
|
+
* no owner lifecycle to bind a cleanup to; returning one is a dev-mode error
|
|
496
|
+
* (and is dropped in production). Use the post-settle/event-handler forms below
|
|
497
|
+
* for one-shot work, and keep setup-with-teardown in an owned scope.
|
|
498
|
+
*
|
|
462
499
|
* @example
|
|
463
500
|
* ```tsx
|
|
464
501
|
* // Component-level setup + teardown — replaces onMount + onCleanup.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Computed, type Refreshable } from "../core/index.cjs";
|
|
2
|
-
import { type ProjectionOptions, type Store } from "./store.cjs";
|
|
2
|
+
import { type NoFn, type ProjectionOptions, type Store } from "./store.cjs";
|
|
3
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
4
|
store: Refreshable<Store<T>>;
|
|
5
5
|
node: Computed<void | T>;
|
|
@@ -47,7 +47,7 @@ export declare function createProjectionInternal<T extends object = {}>(fn: (dra
|
|
|
47
47
|
*
|
|
48
48
|
* @see {@link https://github.com/solidjs/x-reactivity#createprojection}
|
|
49
49
|
*/
|
|
50
|
-
export declare function createProjection<T extends object = {}>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, seed: Partial<T
|
|
50
|
+
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>>;
|
|
51
51
|
/**
|
|
52
52
|
* Shared projection computed body used by both `createProjection` and the derived
|
|
53
53
|
* form of `createOptimisticStore`. Encapsulates the write-trap draft, `storeSetter`
|
|
@@ -41,7 +41,7 @@ type DataNodes = Record<PropertyKey, DataNode>;
|
|
|
41
41
|
* @internal
|
|
42
42
|
*/
|
|
43
43
|
export declare const $TRACK: unique symbol, $TARGET: unique symbol, $PROXY: unique symbol, $DELETED: unique symbol;
|
|
44
|
-
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";
|
|
44
|
+
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", STORE_MASKED = "m";
|
|
45
45
|
export type StoreNode = {
|
|
46
46
|
[$PROXY]: any;
|
|
47
47
|
[STORE_VALUE]: Record<PropertyKey, any>;
|
|
@@ -54,6 +54,8 @@ export type StoreNode = {
|
|
|
54
54
|
[STORE_LOOKUP]?: WeakMap<any, any>;
|
|
55
55
|
[STORE_FIREWALL]?: Computed<any>;
|
|
56
56
|
[STORE_OPTIMISTIC]?: boolean;
|
|
57
|
+
/** This target currently contributes to its firewall's store-wide mask. */
|
|
58
|
+
[STORE_MASKED]?: boolean;
|
|
57
59
|
[STORE_SNAPSHOT_PROPS]?: Record<PropertyKey, any>;
|
|
58
60
|
};
|
|
59
61
|
export declare namespace SolidStore {
|
|
@@ -63,13 +65,38 @@ export declare namespace SolidStore {
|
|
|
63
65
|
export type NotWrappable = string | number | bigint | symbol | boolean | Function | null | undefined | SolidStore.Unwrappable[keyof SolidStore.Unwrappable];
|
|
64
66
|
export declare function createStoreProxy<T extends object>(value: T, traps?: ProxyHandler<StoreNode>, extend?: (target: StoreNode) => void): any;
|
|
65
67
|
export declare const storeLookup: WeakMap<WeakKey, any>;
|
|
68
|
+
export declare const symbolKeyedRecords: WeakSet<object>;
|
|
66
69
|
export declare function wrap<T extends Record<PropertyKey, any>>(value: T, target?: StoreNode): T;
|
|
67
70
|
export declare function isWrappable<T>(obj: T | NotWrappable): obj is T;
|
|
68
71
|
export declare function setWriteOverride(value: boolean): void;
|
|
72
|
+
export declare function ownEnumerableKeys(o: object): (string | symbol)[];
|
|
73
|
+
/**
|
|
74
|
+
* Single chokepoint for the store's layered value resolution: returns the
|
|
75
|
+
* override layer (optimistic first, then regular) that shadows `property`, or
|
|
76
|
+
* `undefined` when the base `STORE_VALUE` is authoritative. Every trap must
|
|
77
|
+
* resolve through this — hand-inlining the layer order is how the optimistic
|
|
78
|
+
* layer gets missed (#2850).
|
|
79
|
+
*/
|
|
80
|
+
export declare function getOverlayLayer(target: StoreNode, property: PropertyKey): Record<PropertyKey, any> | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* The value a store leaf's backing signal currently shows to readers: active
|
|
83
|
+
* override, else held pending value, else committed value.
|
|
84
|
+
*/
|
|
85
|
+
export declare function visibleNodeValue(node: DataNode): any;
|
|
69
86
|
export declare function trackSelf(target: StoreNode, symbol?: symbol): void;
|
|
70
87
|
export declare function notifySelf(target: StoreNode): void;
|
|
71
88
|
export declare function getKeys(source: Record<PropertyKey, any>, override: Record<PropertyKey, any> | undefined, enumerable?: boolean): PropertyKey[];
|
|
72
89
|
export declare function getPropertyDescriptor(source: Record<PropertyKey, any>, override: Record<PropertyKey, any> | undefined, property: PropertyKey): PropertyDescriptor | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Store-wide mask bookkeeping (A20 re-rule 2026-07-07c): the store is the
|
|
92
|
+
* primitive, so an optimistic write decrees the WHOLE store settled for
|
|
93
|
+
* `isPending` — firewall, written leaves, untouched siblings, structural
|
|
94
|
+
* reads — for the lifetime of the override/transition. The firewall carries a
|
|
95
|
+
* count of masked targets (nested objects mask independently); companions of
|
|
96
|
+
* the firewall and its probed leaves are poked on 0↔1 transitions so an
|
|
97
|
+
* already-materialized verdict flips without waiting for another write.
|
|
98
|
+
*/
|
|
99
|
+
export declare function maskStoreTarget(target: StoreNode, on: boolean): void;
|
|
73
100
|
export declare const storeTraps: ProxyHandler<StoreNode>;
|
|
74
101
|
export declare function storeSetter<T extends object>(store: Store<T>, fn: (draft: T) => T | void): void;
|
|
75
102
|
/**
|
package/package.json
CHANGED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { Queue, type Computed, type Effect } from "./core/index.js";
|
|
2
|
-
import type { Signal } from "./core/index.js";
|
|
3
|
-
export interface BoundaryComputed<T> extends Computed<T> {
|
|
4
|
-
_propagationMask: number;
|
|
5
|
-
}
|
|
6
|
-
type RevealSlot = CollectionQueue | RevealController;
|
|
7
|
-
type BoolAccessor = () => boolean;
|
|
8
|
-
export type RevealOrder = "sequential" | "together" | "natural";
|
|
9
|
-
type OrderAccessor = () => RevealOrder;
|
|
10
|
-
export declare class RevealController {
|
|
11
|
-
_orderAccessor: OrderAccessor;
|
|
12
|
-
_collapsedAccessor: BoolAccessor;
|
|
13
|
-
_slots: RevealSlot[];
|
|
14
|
-
_parentController?: RevealController;
|
|
15
|
-
_disabled: Signal<boolean>;
|
|
16
|
-
_collapsed: Signal<boolean>;
|
|
17
|
-
_ready: boolean;
|
|
18
|
-
_minimallyReady: boolean;
|
|
19
|
-
_evaluating: boolean;
|
|
20
|
-
constructor(order: OrderAccessor, collapsed: BoolAccessor);
|
|
21
|
-
_forEachOwnedSlot(fn: (slot: RevealSlot) => boolean | void): boolean;
|
|
22
|
-
isReady(): boolean;
|
|
23
|
-
/**
|
|
24
|
-
* "Minimally ready" = this group has something visible to show under its own policy.
|
|
25
|
-
* Used by an enclosing `together` group to decide when it can release.
|
|
26
|
-
* - `together`: fully ready (atomic).
|
|
27
|
-
* - `sequential`: the first owned slot is minimally ready (frontier can advance).
|
|
28
|
-
* - `natural`: any owned slot is minimally ready.
|
|
29
|
-
*/
|
|
30
|
-
isMinimallyReady(): boolean;
|
|
31
|
-
register(slot: RevealSlot): void;
|
|
32
|
-
unregister(slot: RevealSlot): void;
|
|
33
|
-
evaluate(disabledOverride?: boolean, collapsedOverride?: boolean): void;
|
|
34
|
-
}
|
|
35
|
-
export declare class CollectionQueue extends Queue {
|
|
36
|
-
_collectionType: number;
|
|
37
|
-
_sources: Set<Computed<any>>;
|
|
38
|
-
_tree?: BoundaryComputed<any>;
|
|
39
|
-
_pending: boolean;
|
|
40
|
-
_disabled: Signal<boolean>;
|
|
41
|
-
_collapsed: Signal<boolean>;
|
|
42
|
-
_revealController?: RevealController;
|
|
43
|
-
_initialized: boolean;
|
|
44
|
-
_onFn: (() => any) | undefined;
|
|
45
|
-
_prevOn: any;
|
|
46
|
-
constructor(type: number);
|
|
47
|
-
run(type: number): void;
|
|
48
|
-
notify(node: Effect<any>, type: number, flags: number, error?: any): boolean;
|
|
49
|
-
checkSources(): void;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Lower-level primitive that backs the `<Loading>` flow control. Catches
|
|
53
|
-
* pending async reads inside `fn` and renders `fallback` until they settle.
|
|
54
|
-
*
|
|
55
|
-
* App code should use `<Loading fallback={...}>` instead — reach for this only
|
|
56
|
-
* when authoring custom boundary components.
|
|
57
|
-
*
|
|
58
|
-
* @param fn the tracked subtree
|
|
59
|
-
* @param fallback the fallback shown while async reads in `fn` are unresolved
|
|
60
|
-
* @param options `on` — accessor whose value scopes the boundary; when set,
|
|
61
|
-
* transitions caused by writes to other reactive sources are *not* caught
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```tsx
|
|
65
|
-
* // Custom boundary component built on top of the primitive.
|
|
66
|
-
* function MyLoading(props: { fallback: JSX.Element; children: JSX.Element }) {
|
|
67
|
-
* return createLoadingBoundary(
|
|
68
|
-
* () => props.children,
|
|
69
|
-
* () => props.fallback
|
|
70
|
-
* ) as unknown as JSX.Element;
|
|
71
|
-
* }
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
export declare function createLoadingBoundary(fn: () => any, fallback: () => any, options?: {
|
|
75
|
-
on?: () => any;
|
|
76
|
-
}): import("./signals.js").SourceAccessor<unknown>;
|
|
77
|
-
/**
|
|
78
|
-
* Lower-level primitive that backs the `<Errored>` flow control. Catches
|
|
79
|
-
* thrown errors inside `fn` and invokes `fallback(error, reset)` instead.
|
|
80
|
-
* `reset()` recomputes the failing sources so the boundary can attempt to
|
|
81
|
-
* recover.
|
|
82
|
-
*
|
|
83
|
-
* App code should use `<Errored fallback={...}>` instead — reach for this only
|
|
84
|
-
* when authoring custom boundary components.
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* ```tsx
|
|
88
|
-
* // Custom boundary that wraps the primitive and adds telemetry.
|
|
89
|
-
* function TracedErrored(props: { fallback: (e: unknown) => JSX.Element; children: JSX.Element }) {
|
|
90
|
-
* return createErrorBoundary(
|
|
91
|
-
* () => props.children,
|
|
92
|
-
* (err, reset) => {
|
|
93
|
-
* reportError(err);
|
|
94
|
-
* return props.fallback(err);
|
|
95
|
-
* }
|
|
96
|
-
* ) as unknown as JSX.Element;
|
|
97
|
-
* }
|
|
98
|
-
* ```
|
|
99
|
-
*/
|
|
100
|
-
export declare function createErrorBoundary<U>(fn: () => any, fallback: (error: unknown, reset: () => void) => U): import("./signals.js").SourceAccessor<unknown>;
|
|
101
|
-
/**
|
|
102
|
-
* Coordinate the reveal timing of sibling loading boundaries.
|
|
103
|
-
*
|
|
104
|
-
* Accepts reactive accessors:
|
|
105
|
-
* - `order`: `"sequential"` (default) | `"together"` | `"natural"`.
|
|
106
|
-
* - `"sequential"` — classic frontier reveal: siblings reveal in registration order
|
|
107
|
-
* as each resolves; later siblings stay hidden until earlier ones complete.
|
|
108
|
-
* - `"together"` — every direct slot stays on its fallback until the whole group
|
|
109
|
-
* is "minimally ready" (each direct slot has produced its own first visible
|
|
110
|
-
* content under its own order), then the whole group releases at once.
|
|
111
|
-
* - `"natural"` — children reveal independently (as each resolves). At the top
|
|
112
|
-
* level this is a no-op compared to not using `createRevealOrder`; the mode
|
|
113
|
-
* exists for nesting, where the group registers as a single composite slot to
|
|
114
|
-
* any enclosing `createRevealOrder`.
|
|
115
|
-
* - `collapsed`: only meaningful when `order === "sequential"`. When set, tail siblings
|
|
116
|
-
* past the frontier suppress their own fallback output. Ignored under `"together"`
|
|
117
|
-
* and `"natural"` — those orders have no frontier.
|
|
118
|
-
*
|
|
119
|
-
* Nested `createRevealOrder` groups compose: the inner controller registers as a
|
|
120
|
-
* single slot in the outer controller and is held on its fallbacks until the outer
|
|
121
|
-
* releases that slot. Once released, the inner controller runs its own order locally
|
|
122
|
-
* over anything still pending. There is no opt-out from an outer hold.
|
|
123
|
-
*
|
|
124
|
-
* "Minimally ready" is what an order considers its first visible content:
|
|
125
|
-
* - `sequential` — frontier-0 is minimally ready (leaf: on resolve; nested: via its
|
|
126
|
-
* own minimal signal).
|
|
127
|
-
* - `together` — every direct slot is minimally ready.
|
|
128
|
-
* - `natural` — any direct slot has visible content (leaves on resolve; nested
|
|
129
|
-
* composites when fully ready, since natural treats composites as atomic).
|
|
130
|
-
*
|
|
131
|
-
* @example
|
|
132
|
-
* ```ts
|
|
133
|
-
* // Primitive form of `<Reveal>` — coordinate sibling loading boundaries
|
|
134
|
-
* // programmatically. App code uses the JSX `<Reveal>` component instead.
|
|
135
|
-
* // Both options are accessors so they can react to state changes.
|
|
136
|
-
* createRevealOrder(
|
|
137
|
-
* () => renderSiblings(),
|
|
138
|
-
* { order: () => mode(), collapsed: () => true }
|
|
139
|
-
* );
|
|
140
|
-
* ```
|
|
141
|
-
*/
|
|
142
|
-
export declare function createRevealOrder<T>(fn: () => T, options?: {
|
|
143
|
-
order?: OrderAccessor;
|
|
144
|
-
collapsed?: BoolAccessor;
|
|
145
|
-
}): T;
|
|
146
|
-
/**
|
|
147
|
-
* Resolves a children value to its renderable form: unwraps zero-arg functions
|
|
148
|
-
* (accessors), recursively flattens arrays, and optionally skips
|
|
149
|
-
* non-rendering values (`null`, `undefined`, `true`, `false`, `""`).
|
|
150
|
-
*
|
|
151
|
-
* Used internally by flow components and by the renderer to walk a children
|
|
152
|
-
* tree. App code rarely needs this directly — see `children()` in `solid-js`
|
|
153
|
-
* for the user-facing helper that memoizes the result.
|
|
154
|
-
*
|
|
155
|
-
* @param children value or array of values to flatten
|
|
156
|
-
* @param options
|
|
157
|
-
* - `skipNonRendered` — drop values that won't render
|
|
158
|
-
* - `doNotUnwrap` — leave function children as-is (caller will resolve)
|
|
159
|
-
*
|
|
160
|
-
* @example
|
|
161
|
-
* ```ts
|
|
162
|
-
* // Custom renderer walking a children tree manually. Most authors should
|
|
163
|
-
* // use `children()` from solid-js, which memoizes the resolved value.
|
|
164
|
-
* function renderChildren(value: unknown): unknown {
|
|
165
|
-
* return flatten(value, { skipNonRendered: true });
|
|
166
|
-
* }
|
|
167
|
-
* ```
|
|
168
|
-
*/
|
|
169
|
-
export declare function flatten(children: any, options?: {
|
|
170
|
-
skipNonRendered?: boolean;
|
|
171
|
-
doNotUnwrap?: boolean;
|
|
172
|
-
}): any;
|
|
173
|
-
export {};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wraps a generator function so each invocation runs as a single transaction
|
|
3
|
-
* (a "transition") that batches every signal/store write between yields. The
|
|
4
|
-
* surrounding UI sees one atomic update per yielded step; nothing is committed
|
|
5
|
-
* until the action either completes or the next `yield` resolves.
|
|
6
|
-
*
|
|
7
|
-
* Yield promises (or any awaitable) inside the generator — the action waits
|
|
8
|
-
* for each before continuing, but the writes you made beforehand are already
|
|
9
|
-
* visible (or held by `<Loading>` if optimistic). Yield bare values for
|
|
10
|
-
* synchronous batched steps.
|
|
11
|
-
*
|
|
12
|
-
* Each call returns a `Promise` that resolves with the generator's return
|
|
13
|
-
* value, or rejects if it throws. Pair with `createOptimistic` /
|
|
14
|
-
* `createOptimisticStore` to apply tentative writes that auto-revert if the
|
|
15
|
-
* action fails.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```ts
|
|
19
|
-
* const [todos, setTodos] = createOptimisticStore<Todo[]>([]);
|
|
20
|
-
*
|
|
21
|
-
* const addTodo = action(function* (text: string) {
|
|
22
|
-
* const tempId = crypto.randomUUID();
|
|
23
|
-
* setTodos(t => { t.push({ id: tempId, text, pending: true }); }); // optimistic
|
|
24
|
-
* const saved = yield api.createTodo(text); // network round-trip
|
|
25
|
-
* setTodos(t => {
|
|
26
|
-
* const i = t.findIndex(x => x.id === tempId);
|
|
27
|
-
* if (i >= 0) t[i] = saved;
|
|
28
|
-
* });
|
|
29
|
-
* return saved;
|
|
30
|
-
* });
|
|
31
|
-
*
|
|
32
|
-
* await addTodo("buy milk");
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
export declare function action<Args extends any[], Y, R>(genFn: (...args: Args) => Generator<Y, R, any> | AsyncGenerator<Y, R, any>): (...args: Args) => Promise<R>;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type OptimisticLane } from "./lanes.js";
|
|
2
|
-
import type { Computed } from "./types.js";
|
|
3
|
-
export declare function settlePendingSource(el: Computed<any>): void;
|
|
4
|
-
export declare function handleAsync<T>(el: Computed<T>, result: T | PromiseLike<T> | AsyncIterable<T>, setter?: (value: T) => void): T;
|
|
5
|
-
export declare function clearStatus(el: Computed<any>, clearUninitialized?: boolean): void;
|
|
6
|
-
export declare function notifyStatus(el: Computed<any>, status: number, error: any, blockStatus?: boolean, lane?: OptimisticLane): void;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
export declare const REACTIVE_NONE = 0;
|
|
2
|
-
export declare const REACTIVE_CHECK: number;
|
|
3
|
-
export declare const REACTIVE_DIRTY: number;
|
|
4
|
-
export declare const REACTIVE_RECOMPUTING_DEPS: number;
|
|
5
|
-
export declare const REACTIVE_IN_HEAP: number;
|
|
6
|
-
export declare const REACTIVE_IN_HEAP_HEIGHT: number;
|
|
7
|
-
export declare const REACTIVE_ZOMBIE: number;
|
|
8
|
-
export declare const REACTIVE_DISPOSED: number;
|
|
9
|
-
export declare const REACTIVE_OPTIMISTIC_DIRTY: number;
|
|
10
|
-
export declare const REACTIVE_SNAPSHOT_STALE: number;
|
|
11
|
-
export declare const REACTIVE_LAZY: number;
|
|
12
|
-
export declare const REACTIVE_MANUAL_WRITE: number;
|
|
13
|
-
export declare const CONFIG_OWNED_WRITE: number;
|
|
14
|
-
export declare const CONFIG_NO_SNAPSHOT: number;
|
|
15
|
-
export declare const CONFIG_TRANSPARENT: number;
|
|
16
|
-
export declare const CONFIG_IN_SNAPSHOT_SCOPE: number;
|
|
17
|
-
export declare const CONFIG_CHILDREN_FORBIDDEN: number;
|
|
18
|
-
export declare const CONFIG_AUTO_DISPOSE: number;
|
|
19
|
-
export declare const CONFIG_SYNC: number;
|
|
20
|
-
export declare const STATUS_NONE = 0;
|
|
21
|
-
export declare const STATUS_PENDING: number;
|
|
22
|
-
export declare const STATUS_ERROR: number;
|
|
23
|
-
export declare const STATUS_UNINITIALIZED: number;
|
|
24
|
-
export declare const EFFECT_PURE = 0;
|
|
25
|
-
export declare const EFFECT_RENDER = 1;
|
|
26
|
-
export declare const EFFECT_USER = 2;
|
|
27
|
-
export declare const EFFECT_TRACKED = 3;
|
|
28
|
-
export declare const NOT_PENDING: {};
|
|
29
|
-
export declare const NO_SNAPSHOT: {};
|
|
30
|
-
export declare const STORE_SNAPSHOT_PROPS = "sp";
|
|
31
|
-
export declare const SUPPORTS_PROXY: boolean;
|
|
32
|
-
export declare const defaultContext: {};
|
|
33
|
-
/**
|
|
34
|
-
* Brand symbol used by `Refreshable<T>` values (projection stores, async
|
|
35
|
-
* memos) to expose their underlying computation to `refresh()`. Not part of
|
|
36
|
-
* the user-facing API.
|
|
37
|
-
*
|
|
38
|
-
* @internal
|
|
39
|
-
*/
|
|
40
|
-
export declare const $REFRESH: unique symbol;
|
|
41
|
-
/**
|
|
42
|
-
* Brand applied to values that participate in the `refresh()` re-run protocol.
|
|
43
|
-
* Accessors receive this handle internally; projected stores expose it through
|
|
44
|
-
* their public return type so user-defined hooks that wrap `createOptimisticStore`
|
|
45
|
-
* / `createProjection` / projection-form `createStore` can have their return
|
|
46
|
-
* types inferred without leaking the internal `$REFRESH` symbol into public type
|
|
47
|
-
* signatures (TS4058).
|
|
48
|
-
*/
|
|
49
|
-
export type Refreshable<T> = T & {
|
|
50
|
-
readonly [$REFRESH]: any;
|
|
51
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { Owner } from "./types.js";
|
|
2
|
-
export interface Context<T> {
|
|
3
|
-
readonly id: symbol;
|
|
4
|
-
readonly defaultValue: T | undefined;
|
|
5
|
-
}
|
|
6
|
-
export type ContextRecord = Record<string | symbol, unknown>;
|
|
7
|
-
/**
|
|
8
|
-
* Context provides a form of dependency injection. It is used to save from needing to pass
|
|
9
|
-
* data as props through intermediate components. This function creates a new context object
|
|
10
|
-
* that can be used with `getContext` and `setContext`.
|
|
11
|
-
*
|
|
12
|
-
* A default value can be provided here which will be used when a specific value is not provided
|
|
13
|
-
* via a `setContext` call.
|
|
14
|
-
*/
|
|
15
|
-
export declare function createContext<T>(defaultValue?: T, description?: string): Context<T>;
|
|
16
|
-
/**
|
|
17
|
-
* Low-level owner-targeted context read. The user-facing read API is
|
|
18
|
-
* `useContext` (in `solid-js`), which wraps this primitive. Exposed here for
|
|
19
|
-
* cross-package wiring (e.g. hydration-aware context plumbing).
|
|
20
|
-
*
|
|
21
|
-
* @throws `NoOwnerError` if there's no owner at the time of call.
|
|
22
|
-
* @throws `ContextNotFoundError` if a context value has not been set yet.
|
|
23
|
-
*
|
|
24
|
-
* @internal
|
|
25
|
-
*/
|
|
26
|
-
export declare function getContext<T>(context: Context<T>, owner?: Owner | null): T;
|
|
27
|
-
/**
|
|
28
|
-
* Low-level owner-targeted context write. The user-facing API is
|
|
29
|
-
* `createContext` (in `solid-js`); its provider component wraps this
|
|
30
|
-
* primitive. Exposed here for cross-package wiring.
|
|
31
|
-
*
|
|
32
|
-
* @throws `NoOwnerError` if there's no owner at the time of call.
|
|
33
|
-
*
|
|
34
|
-
* @internal
|
|
35
|
-
*/
|
|
36
|
-
export declare function setContext<T>(context: Context<T>, value?: T, owner?: Owner | null): void;
|