@solidjs/signals 2.0.0-rc.13 → 2.0.0-rc.15
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 +2059 -3768
- package/dist/dev.attribution.js +237 -101
- package/dist/dev.js +7466 -8497
- package/dist/observe/affects.js +128 -104
- package/dist/observe/boundaries.js +492 -665
- package/dist/observe/core/action.js +63 -66
- package/dist/observe/core/async.js +243 -379
- package/dist/observe/core/attribution-queries.js +1 -1
- package/dist/observe/core/attribution.js +394 -253
- package/dist/observe/core/constants.js +120 -187
- package/dist/observe/core/context.js +3 -3
- package/dist/observe/core/core.js +874 -1440
- package/dist/observe/core/dev.js +3 -3
- package/dist/observe/core/effect.js +73 -84
- package/dist/observe/core/external.js +5 -5
- package/dist/observe/core/graph.js +62 -71
- package/dist/observe/core/heap.js +75 -98
- package/dist/observe/core/invariants.js +1 -34
- package/dist/observe/core/lanes.js +750 -181
- package/dist/observe/core/owner.js +80 -101
- package/dist/observe/core/scheduler.js +719 -1356
- package/dist/observe/core/verdict.js +314 -621
- package/dist/observe/flatten.js +79 -0
- package/dist/observe/index.js +15 -13
- package/dist/observe/map.js +232 -235
- package/dist/observe/reveal.js +212 -0
- package/dist/observe/signals.js +144 -216
- package/dist/observe/store/affects.js +142 -0
- package/dist/observe/store/hooks.js +13 -0
- package/dist/observe/store/index.js +27 -24
- package/dist/observe/store/optimistic.js +571 -0
- package/dist/observe/store/projection.js +308 -0
- package/dist/observe/store/reconcile.js +259 -0
- package/dist/observe/store/store.js +1988 -277
- package/dist/observe/store/storePath.js +1 -1
- package/dist/{prod/store/next → observe/store}/target.js +17 -18
- package/dist/observe/store/types.js +73 -0
- package/dist/observe/store/utils.js +1 -13
- package/dist/prod/affects.js +130 -106
- package/dist/prod/boundaries.js +476 -654
- package/dist/prod/core/action.js +71 -74
- package/dist/prod/core/async.js +306 -444
- package/dist/prod/core/constants.js +117 -186
- package/dist/prod/core/context.js +3 -3
- package/dist/prod/core/core.js +888 -1462
- package/dist/prod/core/effect.js +88 -99
- package/dist/prod/core/external.js +5 -5
- package/dist/prod/core/graph.js +62 -71
- package/dist/prod/core/heap.js +75 -98
- package/dist/prod/core/invariants.js +1 -32
- package/dist/prod/core/lanes.js +712 -181
- package/dist/prod/core/owner.js +75 -96
- package/dist/prod/core/scheduler.js +686 -1335
- package/dist/prod/core/verdict.js +309 -621
- package/dist/prod/flatten.js +77 -0
- package/dist/prod/index.js +15 -13
- package/dist/prod/map.js +142 -145
- package/dist/prod/reveal.js +212 -0
- package/dist/prod/signals.js +155 -227
- package/dist/prod/store/affects.js +142 -0
- package/dist/prod/store/hooks.js +13 -0
- package/dist/prod/store/index.js +26 -19
- package/dist/prod/store/optimistic.js +566 -0
- package/dist/prod/store/projection.js +301 -0
- package/dist/prod/store/reconcile.js +259 -0
- package/dist/prod/store/store.js +1883 -272
- package/dist/prod/store/storePath.js +1 -1
- package/dist/{observe/store/next → prod/store}/target.js +13 -17
- package/dist/prod/store/types.js +73 -0
- package/dist/prod/store/utils.js +1 -11
- package/dist/types/affects.d.ts +11 -30
- package/dist/types/boundaries.d.ts +66 -176
- package/dist/types/carved.d.ts +1 -0
- package/dist/types/core/action.d.ts +5 -6
- package/dist/types/core/async.d.ts +10 -5
- package/dist/types/core/attribution-hooks.d.ts +20 -1
- package/dist/types/core/attribution.d.ts +26 -11
- package/dist/types/core/constants.d.ts +130 -180
- package/dist/types/core/core.d.ts +134 -264
- package/dist/types/core/dev.d.ts +2 -2
- package/dist/types/core/effect.d.ts +0 -7
- package/dist/types/core/graph.d.ts +7 -1
- package/dist/types/core/heap.d.ts +5 -7
- package/dist/types/core/index.d.ts +5 -5
- package/dist/types/core/invariants.d.ts +0 -29
- package/dist/types/core/lanes.d.ts +74 -86
- package/dist/types/core/owner.d.ts +3 -3
- package/dist/types/core/scheduler.d.ts +255 -331
- package/dist/types/core/types.d.ts +45 -85
- package/dist/types/core/verdict.d.ts +3 -0
- package/dist/types/flatten.d.ts +8 -0
- package/dist/types/index.d.ts +6 -4
- package/dist/types/reveal.d.ts +19 -0
- package/dist/types/signals.d.ts +35 -91
- package/dist/types/store/affects.d.ts +12 -0
- package/dist/types/store/hooks.d.ts +48 -0
- package/dist/types/store/index.d.ts +34 -15
- package/dist/types/store/optimistic.d.ts +23 -0
- package/dist/types/store/projection.d.ts +18 -0
- package/dist/types/store/reconcile.d.ts +3 -0
- package/dist/types/store/store.d.ts +132 -145
- package/dist/types/store/storePath.d.ts +1 -1
- package/dist/types/store/target.d.ts +151 -0
- package/dist/types/store/types.d.ts +84 -0
- package/package.json +1 -1
- package/dist/observe/core/optimistic.js +0 -669
- package/dist/observe/store/next/optimistic.js +0 -717
- package/dist/observe/store/next/projection.js +0 -266
- package/dist/observe/store/next/reconcile.js +0 -375
- package/dist/observe/store/next/store.js +0 -2608
- package/dist/prod/core/optimistic.js +0 -658
- package/dist/prod/store/next/optimistic.js +0 -710
- package/dist/prod/store/next/projection.js +0 -257
- package/dist/prod/store/next/reconcile.js +0 -373
- package/dist/prod/store/next/store.js +0 -2484
- package/dist/types/core/optimistic.d.ts +0 -6
- package/dist/types/store/next/optimistic.d.ts +0 -25
- package/dist/types/store/next/projection.d.ts +0 -27
- package/dist/types/store/next/reconcile.d.ts +0 -10
- package/dist/types/store/next/store.d.ts +0 -145
- package/dist/types/store/next/target.d.ts +0 -196
|
@@ -14,33 +14,29 @@
|
|
|
14
14
|
*/
|
|
15
15
|
const $OWNER = Symbol(0);
|
|
16
16
|
|
|
17
|
-
/** raw → target for
|
|
18
|
-
*
|
|
17
|
+
/** raw → target for plain (family-less) stores. Family stores use their own
|
|
18
|
+
* map so one raw can wrap once per family (§7b). */ const storeLookup = new WeakMap;
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
function setLookup(e, o) {
|
|
21
|
+
(o.fam?.map ?? storeLookup).set(e, o);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function isOwned(e) {
|
|
21
25
|
return e[$OWNER] !== undefined;
|
|
22
26
|
}
|
|
23
27
|
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
26
|
-
* else (user objects, adoptees, another family's backings the family
|
|
27
|
-
* re-registered for its own wrapper) resolves through the family's map. */ function lookupTarget(e, o) {
|
|
28
|
+
/** The target wrapping `raw` in `fam` (or the plain lookup). An owned raw
|
|
29
|
+
* answers from its stamp; a user raw from the map. */ function lookupTarget(e, o) {
|
|
28
30
|
const t = e[$OWNER];
|
|
29
|
-
return t !== undefined && t.fam === o ? t : (o?.map ??
|
|
31
|
+
return t !== undefined && t.fam === o ? t : (o?.map ?? storeLookup).get(e);
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
function devAssertNeverUserMutation(e) {
|
|
33
35
|
return;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
function setOptHooks(e) {
|
|
39
|
-
optHooks = e;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** Sticky descendants flag walk (§6d): reconcile's keyed pruning descends
|
|
43
|
-
* only where subscriptions exist at/below. Nodes AND patches count. */ function markDescendants(e) {
|
|
38
|
+
/** Sticky descendants flag up the parent chain (§6d): adoption descends
|
|
39
|
+
* into a changed child pair only where a target with nodes exists below. */ function markDescendants(e) {
|
|
44
40
|
let o = e;
|
|
45
41
|
while (o && !o.d) {
|
|
46
42
|
o.d = true;
|
|
@@ -48,4 +44,4 @@ function setOptHooks(e) {
|
|
|
48
44
|
}
|
|
49
45
|
}
|
|
50
46
|
|
|
51
|
-
export { $OWNER, devAssertNeverUserMutation, isOwned, lookupTarget, markDescendants,
|
|
47
|
+
export { $OWNER, devAssertNeverUserMutation, isOwned, lookupTarget, markDescendants, setLookup, storeLookup };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/** Brand keys the proxy answers directly (never user data). */
|
|
2
|
+
const $TRACK = Symbol(0), $TARGET = Symbol(0), $PROXY = Symbol(0), $RECORD = Symbol(0);
|
|
3
|
+
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
// raw marking (R42 / RUL-12: a value is never both wrapped and raw)
|
|
6
|
+
const rawValues = new WeakSet;
|
|
7
|
+
|
|
8
|
+
let rawValuesUsed = false;
|
|
9
|
+
|
|
10
|
+
function isRawValue(e) {
|
|
11
|
+
return rawValuesUsed && rawValues.has(e);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Mark a value so no store ever wraps it (sticky; it reads as a leaf). */ function markRaw(e) {
|
|
15
|
+
if (isWrappable(e)) {
|
|
16
|
+
rawValuesUsed = true;
|
|
17
|
+
rawValues.add(e);
|
|
18
|
+
}
|
|
19
|
+
return e;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** A shallow store's ingested record: raw by contract (values served
|
|
23
|
+
* verbatim, slots replaced by reference). */ function markRawOne(e) {
|
|
24
|
+
if (isWrappable(e)) {
|
|
25
|
+
if (e[$TARGET] !== undefined) return;
|
|
26
|
+
rawValuesUsed = true;
|
|
27
|
+
rawValues.add(e);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function markRawIngest(e) {
|
|
32
|
+
if (Array.isArray(e)) {
|
|
33
|
+
for (let r = 0, a = e.length; r < a; r++) markRawOne(e[r]);
|
|
34
|
+
} else {
|
|
35
|
+
for (const r in e) markRawOne(e[r]);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
// wrappability
|
|
41
|
+
const OBJECT_PROTO = Object.prototype;
|
|
42
|
+
|
|
43
|
+
const wrappableProtos = new WeakMap;
|
|
44
|
+
|
|
45
|
+
function isWrappable(e) {
|
|
46
|
+
if (e == null || typeof e !== "object" || Object.isFrozen(e)) return false;
|
|
47
|
+
const r = Object.getPrototypeOf(e);
|
|
48
|
+
if (r === OBJECT_PROTO || r === null) return true;
|
|
49
|
+
if (Array.isArray(e)) return true;
|
|
50
|
+
let a = wrappableProtos.get(r);
|
|
51
|
+
if (a === undefined) {
|
|
52
|
+
a = Object.prototype.toString.call(e) === "[object Object]" && (typeof Node === "undefined" || !(e instanceof Node));
|
|
53
|
+
wrappableProtos.set(r, a);
|
|
54
|
+
}
|
|
55
|
+
return a;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function ownEnumerableKeys(e) {
|
|
59
|
+
return Reflect.ownKeys(e).filter(r => Object.prototype.propertyIsEnumerable.call(e, r));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
// write override: a projection's draft ops carry it (the derive is the
|
|
64
|
+
// author — its writes must land outside the sync setter scope too, in a
|
|
65
|
+
// continuation after an `await`/`yield`). Projections return in S3; the
|
|
66
|
+
// traps already honour it.
|
|
67
|
+
let writeOverride = false;
|
|
68
|
+
|
|
69
|
+
function setWriteOverride(e) {
|
|
70
|
+
writeOverride = e;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { $PROXY, $RECORD, $TARGET, $TRACK, isRawValue, isWrappable, markRaw, markRawIngest, markRawOne, ownEnumerableKeys, rawValuesUsed, setWriteOverride, writeOverride };
|
package/dist/prod/store/utils.js
CHANGED
|
@@ -1,18 +1,8 @@
|
|
|
1
|
-
import "../core/core.js";
|
|
2
|
-
|
|
3
1
|
import { SUPPORTS_PROXY } from "../core/constants.js";
|
|
4
2
|
|
|
5
|
-
import "../core/scheduler.js";
|
|
6
|
-
|
|
7
|
-
import "../core/invariants.js";
|
|
8
|
-
|
|
9
|
-
import "../core/verdict.js";
|
|
10
|
-
|
|
11
|
-
import "../core/effect.js";
|
|
12
|
-
|
|
13
3
|
import { createMemo } from "../signals.js";
|
|
14
4
|
|
|
15
|
-
import { $PROXY, $RECORD, $TARGET, ownEnumerableKeys } from "./
|
|
5
|
+
import { $PROXY, $RECORD, $TARGET, ownEnumerableKeys } from "./types.js";
|
|
16
6
|
|
|
17
7
|
function trueFn() {
|
|
18
8
|
return true;
|
package/dist/types/affects.d.ts
CHANGED
|
@@ -1,28 +1,15 @@
|
|
|
1
1
|
import type { Accessor } from "./signals.js";
|
|
2
|
-
import { type Store } from "./store/
|
|
2
|
+
import { type Store } from "./store/types.js";
|
|
3
3
|
/**
|
|
4
|
-
* Declares that in-flight work will change the targeted data: the
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* data the graph can't see changing yet; nothing can turn pending OFF while
|
|
14
|
-
* a real change is in flight — a quiet `refresh()` re-ask under a mark still
|
|
15
|
-
* reads pending (declaring the reload is what makes it a real question).
|
|
16
|
-
*
|
|
17
|
-
* Targets:
|
|
18
|
-
* - `affects(store)` — a store proxy (any record, root or nested): every
|
|
19
|
-
* record reachable from it at declaration time reads pending, including
|
|
20
|
-
* through captured child proxies (e.g. `<For>` rows). Siblings are
|
|
21
|
-
* untouched; records added after the declaration are not covered.
|
|
22
|
-
* - `affects(record, key)` — exactly the named slot of the record. One key
|
|
23
|
-
* per call (keys do NOT form a path — target the owning record directly).
|
|
24
|
-
* - `affects(accessor)` — a source accessor (signal or memo): the source
|
|
25
|
-
* reads pending.
|
|
4
|
+
* Declares that in-flight work will change the targeted data: the source —
|
|
5
|
+
* and everything derived from it — reads as pending (`isPending` → `true`)
|
|
6
|
+
* from the declaration until the surrounding transaction settles. A mark is
|
|
7
|
+
* a promise of change, not an absence of value: the marked values stay
|
|
8
|
+
* readable, no reader suspends on one, and it holds nothing — the
|
|
9
|
+
* transaction's completion never waits on a mark. Pendingness is additive:
|
|
10
|
+
* a mark can turn pending on for data the graph cannot see changing yet
|
|
11
|
+
* (a declared reload's `refresh()` is a quiet re-ask on its own); nothing
|
|
12
|
+
* turns it off while the mark is live.
|
|
26
13
|
*
|
|
27
14
|
* Typically called at the top of an `action` alongside optimistic writes —
|
|
28
15
|
* both are up-front declarations about the same mutation. Outside any
|
|
@@ -30,14 +17,8 @@ import { type Store } from "./store/store.js";
|
|
|
30
17
|
*
|
|
31
18
|
* @example
|
|
32
19
|
* ```ts
|
|
33
|
-
* const send = action(function* (text: string) {
|
|
34
|
-
* setState(s => { s.messages.push({ text, status: "sending" }); });
|
|
35
|
-
* affects(state.messages.at(-1)!, "status"); // this slot pends until settle
|
|
36
|
-
* yield api.send(text);
|
|
37
|
-
* });
|
|
38
|
-
*
|
|
39
20
|
* const reload = action(function* () {
|
|
40
|
-
* affects(thing); //
|
|
21
|
+
* affects(thing); // `thing` and its derivations pend…
|
|
41
22
|
* refresh(thing); // …over this otherwise-quiet re-ask
|
|
42
23
|
* yield api.done();
|
|
43
24
|
* });
|
|
@@ -1,109 +1,72 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
3
|
-
import type { Signal } from "./core/index.js";
|
|
1
|
+
import { type Transaction } from "./core/scheduler.js";
|
|
2
|
+
import type { Computed, Owner, Signal } from "./core/types.js";
|
|
4
3
|
import { type Accessor } from "./signals.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
_collapsed: Signal<boolean>;
|
|
19
|
-
_ready: boolean;
|
|
20
|
-
_minimallyReady: boolean;
|
|
21
|
-
_evaluating: boolean;
|
|
22
|
-
constructor(order: OrderAccessor, collapsed: BoolAccessor);
|
|
23
|
-
_forEachOwnedSlot(fn: (slot: RevealSlot) => boolean | void): boolean;
|
|
24
|
-
_isReady(): boolean;
|
|
25
|
-
/**
|
|
26
|
-
* "Minimally ready" = this group has something visible to show under its own policy.
|
|
27
|
-
* Used by an enclosing `together` group to decide when it can release.
|
|
28
|
-
* - `together`: every direct slot is minimally ready.
|
|
29
|
-
* - `sequential`: the first owned slot is minimally ready (frontier can advance).
|
|
30
|
-
* - `natural`: any owned slot is minimally ready.
|
|
31
|
-
*/
|
|
32
|
-
_isMinimallyReady(): boolean;
|
|
33
|
-
_register(slot: RevealSlot): void;
|
|
34
|
-
_unregister(slot: RevealSlot): void;
|
|
35
|
-
_evaluate(disabledOverride?: boolean, collapsedOverride?: boolean): void;
|
|
36
|
-
}
|
|
37
|
-
export declare class CollectionQueue extends Queue {
|
|
38
|
-
_collectionType: number;
|
|
39
|
-
_sources: Set<Computed<any>>;
|
|
40
|
-
_tree?: BoundaryComputed<any>;
|
|
41
|
-
/** The output pass — fallback or content (createCollectionBoundary). */
|
|
42
|
-
_output?: Computed<any>;
|
|
43
|
-
_pending: boolean;
|
|
44
|
-
_disabled: Signal<boolean>;
|
|
45
|
-
_error?: Signal<unknown>;
|
|
46
|
-
_collapsed: Signal<boolean>;
|
|
47
|
-
_revealController?: RevealController;
|
|
4
|
+
interface Boundary {
|
|
5
|
+
/** STATUS_PENDING (loading) or STATUS_ERROR. */
|
|
6
|
+
_type: number;
|
|
7
|
+
_parent: Boundary | null;
|
|
8
|
+
_owner: Owner;
|
|
9
|
+
_tree: Computed<any>;
|
|
10
|
+
/** Null during the output's first pass (its post-check decides then). */
|
|
11
|
+
_output: Computed<any> | null;
|
|
12
|
+
/** Frame readers under it carrying its status: caught, or (loading,
|
|
13
|
+
* showing content) forwarded — the `on` re-arm collects those. */
|
|
14
|
+
_readers: Set<Computed<any>>;
|
|
15
|
+
/** Loading: has shown content. Fresh again after an `on` re-arm found
|
|
16
|
+
* something pending. */
|
|
48
17
|
_initialized: boolean;
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
/** The lane the
|
|
52
|
-
*
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
*
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
*
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
*
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
_settled(source: Computed<any>): boolean;
|
|
92
|
-
/** The pre-verdict sweep (scheduler run(), #3540): a collecting boundary
|
|
93
|
-
* whose OUTPUT is pending — its fallback read something not ready — is
|
|
94
|
-
* judged here, under the transaction. That output is what an initialized
|
|
95
|
-
* parent holds the frame on, and it derives from `_disabled`, not the
|
|
96
|
-
* tree: the tree settling never re-runs it, only a sweep does, and the
|
|
97
|
-
* commit sweep runs after the verdict the output's own read keeps parking
|
|
98
|
-
* — the content waited for the fallback's flight. Judged ready here, the
|
|
99
|
-
* boundary stages `_disabled` false with the frame and the output re-runs
|
|
100
|
-
* in this heap: it reads the tree and drops the fallback's read (recompute
|
|
101
|
-
* settles a pass's outgoing pending sources), so the verdict sees the
|
|
102
|
-
* release. A boundary showing a ready fallback parks nothing and keeps the
|
|
103
|
-
* commit sweep's reveal. */
|
|
104
|
-
_judgeHeld(): void;
|
|
105
|
-
_checkSources(): void;
|
|
18
|
+
/** Loading: `on` changed this flush — collecting until the seam. */
|
|
19
|
+
_armed: boolean;
|
|
20
|
+
/** The lane the arming pass was work of (a display-ahead read in `on`:
|
|
21
|
+
* `latest`, `isPending`): the swap it causes is that lane's — shown now,
|
|
22
|
+
* beside the held frame — not the frame's. `_lane` is set when the arm
|
|
23
|
+
* flips the boundary and consumed by the swap pass. */
|
|
24
|
+
_armLane: Transaction | null;
|
|
25
|
+
_lane: Transaction | null;
|
|
26
|
+
/** DEV: the arm was display-ahead (a lane) — the fallback shows now,
|
|
27
|
+
* whatever holds the frame; no LOADING_ON_OUTSIDE_HOLD report. */
|
|
28
|
+
_ahead?: boolean;
|
|
29
|
+
/** The output's last pass chose the fallback: readers under it are off
|
|
30
|
+
* screen (`hidden`). */
|
|
31
|
+
_fallback: boolean;
|
|
32
|
+
/** User effects whose run came due behind the fallback: re-queued at the
|
|
33
|
+
* reveal (`heldRun`). */
|
|
34
|
+
_runs: Set<Computed<any>> | null;
|
|
35
|
+
/** Reveal order (reveal.ts): the controller that owns this slot until it
|
|
36
|
+
* has shown content, and the state it forces — the fallback (`_gated`),
|
|
37
|
+
* or nothing at all (`_collapsed`). */
|
|
38
|
+
_reveal: object | null;
|
|
39
|
+
_gated: boolean;
|
|
40
|
+
_collapsed: boolean;
|
|
41
|
+
_error: Signal<unknown> | null;
|
|
42
|
+
_show: (b: Boundary) => unknown;
|
|
43
|
+
/** The fallback's own computed, in its own scope like `Show`'s function
|
|
44
|
+
* child: instantiated once per show and kept across the output's
|
|
45
|
+
* re-derives while it shows (#3991). */
|
|
46
|
+
_fb: Computed<unknown> | null;
|
|
47
|
+
}
|
|
48
|
+
/** Context key: the reveal controller a Loading boundary created here is a
|
|
49
|
+
* slot of (reveal.ts); a boundary clears it for its content — only direct
|
|
50
|
+
* children are slots. */
|
|
51
|
+
export declare const REVEAL: unique symbol;
|
|
52
|
+
/** Reveal order (reveal.ts), installed when something imports
|
|
53
|
+
* `createRevealOrder`: a Loading boundary registers as a slot of the
|
|
54
|
+
* controller in its context, tells it when its readiness changed, and
|
|
55
|
+
* leaves it when it has shown content. */
|
|
56
|
+
export interface RevealHooks {
|
|
57
|
+
_register(controller: object, b: Boundary): void;
|
|
58
|
+
_unregister(controller: object, b: Boundary): void;
|
|
59
|
+
_changed(controller: object): void;
|
|
106
60
|
}
|
|
61
|
+
export declare let revealHooks: RevealHooks | null;
|
|
62
|
+
export declare function setRevealHooks(h: RevealHooks): void;
|
|
63
|
+
export type { Boundary };
|
|
64
|
+
export declare function redraw(b: Boundary): void;
|
|
65
|
+
export declare function prune(b: Boundary, pass: boolean): number;
|
|
66
|
+
/** Reveal order: a slot is ready when its content can show — it has shown
|
|
67
|
+
* content, or nothing under it is unready (the tree neither pending nor
|
|
68
|
+
* born held, no reader waited on). */
|
|
69
|
+
export declare function ready(b: Boundary): boolean;
|
|
107
70
|
/**
|
|
108
71
|
* Lower-level primitive that backs the `<Loading>` flow control. Catches
|
|
109
72
|
* pending async reads inside `fn` and renders `fallback` until they settle.
|
|
@@ -173,76 +136,3 @@ export declare function createLoadingBoundary<T, U>(fn: () => T, fallback: () =>
|
|
|
173
136
|
* ```
|
|
174
137
|
*/
|
|
175
138
|
export declare function createErrorBoundary<T, U>(fn: () => T, fallback: (error: Accessor<unknown>, reset: () => void) => U): Accessor<T | U>;
|
|
176
|
-
/**
|
|
177
|
-
* Coordinate the reveal timing of sibling loading boundaries.
|
|
178
|
-
*
|
|
179
|
-
* Accepts reactive accessors:
|
|
180
|
-
* - `order`: `"sequential"` (default) | `"together"` | `"natural"`.
|
|
181
|
-
* - `"sequential"` — classic frontier reveal: siblings reveal in registration order
|
|
182
|
-
* as each resolves; later siblings stay hidden until earlier ones complete.
|
|
183
|
-
* - `"together"` — every direct slot stays on its fallback until the whole group
|
|
184
|
-
* is "minimally ready" (each direct slot has produced its own first visible
|
|
185
|
-
* content under its own order), then the whole group releases at once.
|
|
186
|
-
* - `"natural"` — children reveal independently (as each resolves). At the top
|
|
187
|
-
* level this is a no-op compared to not using `createRevealOrder`; the mode
|
|
188
|
-
* exists for nesting, where the group registers as a single composite slot to
|
|
189
|
-
* any enclosing `createRevealOrder`.
|
|
190
|
-
* - `collapsed`: only meaningful when `order === "sequential"`. When set, tail siblings
|
|
191
|
-
* past the frontier suppress their own fallback output. Ignored under `"together"`
|
|
192
|
-
* and `"natural"` — those orders have no frontier.
|
|
193
|
-
*
|
|
194
|
-
* Nested `createRevealOrder` groups compose: the inner controller registers as a
|
|
195
|
-
* single slot in the outer controller and is held on its fallbacks until the outer
|
|
196
|
-
* releases that slot. Once released, the inner controller runs its own order locally
|
|
197
|
-
* over anything still pending. There is no opt-out from an outer hold.
|
|
198
|
-
*
|
|
199
|
-
* "Minimally ready" is what an order considers its first visible content:
|
|
200
|
-
* - `sequential` — frontier-0 is minimally ready (leaf: on resolve; nested: via its
|
|
201
|
-
* own minimal signal).
|
|
202
|
-
* - `together` — every direct slot is minimally ready.
|
|
203
|
-
* - `natural` — any direct slot has visible content (leaves on resolve; nested
|
|
204
|
-
* composites via their own minimal signal).
|
|
205
|
-
*
|
|
206
|
-
* @example
|
|
207
|
-
* ```ts
|
|
208
|
-
* // Primitive form of `<Reveal>` — coordinate sibling loading boundaries
|
|
209
|
-
* // programmatically. App code uses the JSX `<Reveal>` component instead.
|
|
210
|
-
* // Both options are accessors so they can react to state changes.
|
|
211
|
-
* createRevealOrder(
|
|
212
|
-
* () => renderSiblings(),
|
|
213
|
-
* { order: () => mode(), collapsed: () => true }
|
|
214
|
-
* );
|
|
215
|
-
* ```
|
|
216
|
-
*/
|
|
217
|
-
export declare function createRevealOrder<T>(fn: () => T, options?: {
|
|
218
|
-
order?: OrderAccessor;
|
|
219
|
-
collapsed?: BoolAccessor;
|
|
220
|
-
}): T;
|
|
221
|
-
/**
|
|
222
|
-
* Resolves a children value to its renderable form: unwraps zero-arg functions
|
|
223
|
-
* (accessors), recursively flattens arrays, and optionally skips
|
|
224
|
-
* non-rendering values (`null`, `undefined`, `true`, `false`, `""`).
|
|
225
|
-
*
|
|
226
|
-
* Used internally by flow components and by the renderer to walk a children
|
|
227
|
-
* tree. App code rarely needs this directly — see `children()` in `solid-js`
|
|
228
|
-
* for the user-facing helper that memoizes the result.
|
|
229
|
-
*
|
|
230
|
-
* @param children value or array of values to flatten
|
|
231
|
-
* @param options
|
|
232
|
-
* - `skipNonRendered` — drop values that won't render
|
|
233
|
-
* - `doNotUnwrap` — leave function children as-is (caller will resolve)
|
|
234
|
-
*
|
|
235
|
-
* @example
|
|
236
|
-
* ```ts
|
|
237
|
-
* // Custom renderer walking a children tree manually. Most authors should
|
|
238
|
-
* // use `children()` from solid-js, which memoizes the resolved value.
|
|
239
|
-
* function renderChildren(value: unknown): unknown {
|
|
240
|
-
* return flatten(value, { skipNonRendered: true });
|
|
241
|
-
* }
|
|
242
|
-
* ```
|
|
243
|
-
*/
|
|
244
|
-
export declare function flatten(children: any, options?: {
|
|
245
|
-
skipNonRendered?: boolean;
|
|
246
|
-
doNotUnwrap?: boolean;
|
|
247
|
-
}): any;
|
|
248
|
-
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* submission tracking layered on top. The shared name is deliberate.
|
|
17
17
|
*
|
|
18
18
|
* Wraps a generator function so each invocation runs as a single transaction
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* that holds every signal/store write between yields. The surrounding UI sees
|
|
20
|
+
* one atomic update when the action completes; nothing is committed until
|
|
21
|
+
* every action in the transaction has returned.
|
|
22
22
|
*
|
|
23
23
|
* `yield` is the transaction-safe suspension point: the action waits for a
|
|
24
24
|
* yielded promise and re-enters the transaction before running the code after
|
|
@@ -28,8 +28,7 @@
|
|
|
28
28
|
* commit immediately, and anything that creates a reader there — `until()`,
|
|
29
29
|
* `latest()`, a memo or effect, a mount — is created mainline, where a read of
|
|
30
30
|
* this action's held state makes it born held (A29): staged with the
|
|
31
|
-
* transaction and replayed at its commit.
|
|
32
|
-
* settle its own promise holds open (#3482). `await` is still the ergonomic
|
|
31
|
+
* transaction and replayed at its commit. `await` is still the ergonomic
|
|
33
32
|
* choice for typed results; just put a bare `yield` before any write or
|
|
34
33
|
* reader creation that follows it — including the expression of the next
|
|
35
34
|
* `yield`, which is evaluated before the step re-enters:
|
|
@@ -42,7 +41,7 @@
|
|
|
42
41
|
* ```
|
|
43
42
|
*
|
|
44
43
|
* (For the same reason, don't call `flush()` inside an action body — it
|
|
45
|
-
*
|
|
44
|
+
* cannot reveal the held writes and is refused.)
|
|
46
45
|
*
|
|
47
46
|
* Each call returns a `Promise` that resolves with the generator's return
|
|
48
47
|
* value, or rejects if it throws. Pair with `createOptimistic` /
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { NotReadyError } from "./error.js";
|
|
2
|
-
import { type OptimisticLane } from "./lanes.js";
|
|
3
2
|
import type { Computed, Link } from "./types.js";
|
|
4
3
|
export declare function addPendingSource(el: Computed<any>, source: Computed<any>): boolean;
|
|
5
4
|
/**
|
|
6
5
|
* A loading-window node hit an unready source (sync throw in recompute, or a
|
|
7
6
|
* NotReadyError-rejected flight): register for the source's settle — the
|
|
8
7
|
* settlePendingSource walk runs off `_pendingSources` + `_blocked` alone —
|
|
9
|
-
* with NO read-visible pending status
|
|
10
|
-
*
|
|
8
|
+
* with NO read-visible pending status and no downstream propagation. Commit
|
|
9
|
+
* #0 keeps serving.
|
|
11
10
|
*/
|
|
12
11
|
export declare function parkLoadingWindow(el: Computed<any>, e: NotReadyError): void;
|
|
13
12
|
export declare function setPendingError(el: Computed<any>, source?: Computed<any>, error?: any): void;
|
|
@@ -18,6 +17,12 @@ export declare function settlePendingSource(el: Computed<any>, source?: Computed
|
|
|
18
17
|
export declare function isThenable<T>(value: T | PromiseLike<T>): value is PromiseLike<T>;
|
|
19
18
|
/** Fire and clear a node's iterator-flight cancellation hook (#3122). */
|
|
20
19
|
export declare function releaseFlightTeardown(el: Computed<any>): void;
|
|
21
|
-
export declare function handleAsync<T>(el: Computed<T>, result: T | PromiseLike<T> | AsyncIterable<T>, setter?: (value: T) => void): T;
|
|
20
|
+
export declare function handleAsync<T>(el: Computed<T>, result: T | PromiseLike<T> | AsyncIterable<T>, setter?: (value: T) => void, onError?: (error: unknown, pending: boolean) => void): T;
|
|
22
21
|
export declare function clearStatus(el: Computed<any>, clearUninitialized?: boolean): void;
|
|
23
|
-
export declare function notifyStatus(el: Computed<any>, status: number, error: any, blockStatus?: boolean
|
|
22
|
+
export declare function notifyStatus(el: Computed<any>, status: number, error: any, blockStatus?: boolean): void;
|
|
23
|
+
/** The dependents' half of `notifyStatus`: `el`'s status reaches each
|
|
24
|
+
* subscriber as a propagated mark (or a re-derive). On its own for a store
|
|
25
|
+
* family's leaves, which are not the derive's dependents — the family
|
|
26
|
+
* propagates the derive's status from each leaf to the leaf's readers
|
|
27
|
+
* (store/projection.ts `wakeFamily`), exactly as a memo's would reach its. */
|
|
28
|
+
export declare function propagateStatus(el: Computed<any>, status: number, error: any, downstreamBlockStatus?: boolean): void;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { ChangeOrigin } from "./attribution.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Transaction } from "./scheduler.js";
|
|
3
3
|
import type { Computed, Owner, Signal } from "./types.js";
|
|
4
|
+
/** The hold the engine records against (L2: scheduler.ts `Transaction`).
|
|
5
|
+
* Outward-facing language says *holds*; the engine's hook names keep their
|
|
6
|
+
* historical `transition` wording. */
|
|
7
|
+
export type Transition = Transaction;
|
|
4
8
|
/**
|
|
5
9
|
* Observe-tier hook points for the reactive core.
|
|
6
10
|
*
|
|
@@ -214,6 +218,21 @@ export interface InteractionRef {
|
|
|
214
218
|
target?: string;
|
|
215
219
|
/** Dispatch time on the `performance.now()` clock; defaults to now. */
|
|
216
220
|
at?: number;
|
|
221
|
+
/**
|
|
222
|
+
* The dispatch this frame handles — the DOM `Event` itself. Frames with the
|
|
223
|
+
* same `event` are one interaction: the first opens the record (its `type`,
|
|
224
|
+
* `target` and `at` describe it) and every later one re-enters it, so each
|
|
225
|
+
* listener of one dispatch adds its work to one record. Such a record stays
|
|
226
|
+
* open for joining until the next task — every listener of a dispatch runs
|
|
227
|
+
* within its task — and is recorded no earlier; a frame for the event after
|
|
228
|
+
* that opens a new interaction. Without `event` the record is the frame's
|
|
229
|
+
* alone and can settle as it closes.
|
|
230
|
+
*
|
|
231
|
+
* A join key only, compared by identity and held weakly: it is never
|
|
232
|
+
* recorded — no `InteractionEvent`, origin or other record carries it — and
|
|
233
|
+
* the engine keeps no strong reference to it.
|
|
234
|
+
*/
|
|
235
|
+
event?: object;
|
|
217
236
|
}
|
|
218
237
|
/**
|
|
219
238
|
* A navigation, as a router describes it to `withOrigin` around the location
|