sibujs 4.14.0 → 4.15.0
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/browser.cjs +297 -45
- package/dist/browser.js +6 -7
- package/dist/build.cjs +2189 -573
- package/dist/build.js +16 -15
- package/dist/cdn.dev.global.js +13 -12
- package/dist/cdn.full.dev.global.js +14 -13
- package/dist/cdn.full.global.js +12 -12
- package/dist/cdn.global.js +12 -12
- package/dist/{chunk-RVR5NPFL.js → chunk-2VKTFA7C.js} +1 -1
- package/dist/{chunk-7ILEHTVX.js → chunk-4AEFGRYW.js} +1 -1
- package/dist/{chunk-4TQDTWWN.js → chunk-6IV5ZRG6.js} +5 -7
- package/dist/{chunk-GVAMIU6K.js → chunk-75EAQH3U.js} +2 -2
- package/dist/{chunk-TLS4NVIB.js → chunk-7JO7DPSS.js} +4 -4
- package/dist/{chunk-SVULV7O4.js → chunk-AQH7WDSE.js} +6 -8
- package/dist/{chunk-S37PZD6I.js → chunk-BF3WBJJQ.js} +60 -10
- package/dist/{chunk-LJMX4SQ7.js → chunk-BG4BP44S.js} +3 -3
- package/dist/{chunk-N7A6FKWW.js → chunk-D44TAGCT.js} +2 -2
- package/dist/{chunk-CCKUNHVU.js → chunk-DAEXQJQA.js} +1 -1
- package/dist/chunk-DNCQDFJJ.js +22 -0
- package/dist/{chunk-BKZ5N6NK.js → chunk-DNCT2UXB.js} +4 -4
- package/dist/{chunk-BOYKGGVD.js → chunk-DRWOD7RZ.js} +4 -4
- package/dist/chunk-DS5V2PRE.js +64 -0
- package/dist/{chunk-VM2U5LEL.js → chunk-EHSJESRN.js} +595 -123
- package/dist/{chunk-MIRKTVH4.js → chunk-GFM5WWPU.js} +252 -5
- package/dist/{chunk-52XFPGSN.js → chunk-HTPOIAAL.js} +1 -1
- package/dist/{chunk-3HEX6QJQ.js → chunk-I2R5QALY.js} +2 -4
- package/dist/{chunk-4FJSAUKB.js → chunk-IUBV5WO5.js} +1 -1
- package/dist/{chunk-A454RAEK.js → chunk-KIDETDMU.js} +5 -7
- package/dist/{chunk-JTFQ7IL4.js → chunk-KPAXG5IR.js} +7 -9
- package/dist/{chunk-AE32RGWX.js → chunk-LGUXYHTZ.js} +3 -3
- package/dist/{chunk-Y4LUM2XS.js → chunk-LQWLPQOK.js} +6 -8
- package/dist/{chunk-CNPT6NKV.js → chunk-MINLMJUY.js} +48 -9
- package/dist/{chunk-BNXRWZZV.js → chunk-OURTGOJT.js} +8 -10
- package/dist/{chunk-F67F77IA.js → chunk-TQ24Y3IV.js} +2 -2
- package/dist/{chunk-2TTRW2TE.js → chunk-UM3M5PXS.js} +8 -8
- package/dist/{chunk-CJ7KS3DF.js → chunk-VSTX3XSX.js} +205 -15
- package/dist/{chunk-HQIAL7F2.js → chunk-XPDZ2LDR.js} +2 -2
- package/dist/{chunk-UUIKJJIK.js → chunk-Y7JM7GY2.js} +5 -7
- package/dist/{chunk-QS6GMWDD.js → chunk-YAFITBOK.js} +1269 -162
- package/dist/data.cjs +285 -33
- package/dist/data.js +6 -7
- package/dist/devtools.cjs +289 -39
- package/dist/devtools.js +5 -6
- package/dist/{dispose-EIHHHDC7.js → dispose-3WDBYJMH.js} +3 -1
- package/dist/ecosystem.cjs +345 -61
- package/dist/ecosystem.d.cts +1 -1
- package/dist/ecosystem.d.ts +1 -1
- package/dist/ecosystem.js +10 -10
- package/dist/extras.cjs +568 -248
- package/dist/extras.d.cts +1 -1
- package/dist/extras.d.ts +1 -1
- package/dist/extras.js +27 -27
- package/dist/index.cjs +2134 -515
- package/dist/index.d.cts +628 -211
- package/dist/index.d.ts +628 -211
- package/dist/index.js +22 -15
- package/dist/motion.cjs +286 -30
- package/dist/motion.js +4 -4
- package/dist/patterns.cjs +301 -43
- package/dist/patterns.js +6 -6
- package/dist/performance.cjs +286 -36
- package/dist/performance.js +9 -9
- package/dist/plugins.cjs +1237 -291
- package/dist/plugins.d.cts +3 -1
- package/dist/plugins.d.ts +3 -1
- package/dist/plugins.js +20 -19
- package/dist/{renderRoute-fxgsm2Ir.d.ts → renderRoute-B84MONaO.d.cts} +2 -2
- package/dist/{renderRoute-DP20XwMS.d.cts → renderRoute-_yxPuEQY.d.ts} +2 -2
- package/dist/{routeHead-CE9SV-cH.d.cts → routeHead-DLxlq15W.d.cts} +94 -0
- package/dist/{routeHead-DzVxPviY.d.ts → routeHead-w8nANZ3M.d.ts} +94 -0
- package/dist/{ssr-NECEU4X4.js → ssr-EF3IUHTE.js} +6 -6
- package/dist/ssr-dom.cjs +64 -9
- package/dist/ssr-dom.d.cts +2 -0
- package/dist/ssr-dom.d.ts +2 -0
- package/dist/ssr-dom.js +2 -1
- package/dist/ssr.cjs +850 -170
- package/dist/ssr.d.cts +5 -3
- package/dist/ssr.d.ts +5 -3
- package/dist/ssr.js +16 -15
- package/dist/{tagFactory-DkytnJws.d.cts → tagFactory-BfEh69VF.d.cts} +7 -0
- package/dist/{tagFactory-Bnd_Nph9.d.ts → tagFactory-pSYiLYyh.d.ts} +7 -0
- package/dist/testing.cjs +817 -132
- package/dist/testing.d.cts +4 -2
- package/dist/testing.d.ts +4 -2
- package/dist/testing.js +18 -17
- package/dist/track-core-0edROAF5.d.ts +187 -0
- package/dist/track-core-DN5fYLWi.d.cts +187 -0
- package/dist/ui.cjs +293 -43
- package/dist/ui.js +10 -12
- package/dist/widgets.cjs +285 -27
- package/dist/widgets.js +7 -7
- package/package.json +1 -1
- package/dist/chunk-7ZHH77QA.js +0 -9
package/dist/testing.d.cts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { w as AdoptMismatch, y as AdoptResult, R as RenderResult } from './ssr-JpGpHnpC.cjs';
|
|
2
|
-
import { R as RenderRouteOptions, a as RouteRenderResult } from './renderRoute-
|
|
3
|
-
import { a as RouteDef } from './routeHead-
|
|
2
|
+
import { R as RenderRouteOptions, a as RouteRenderResult } from './renderRoute-B84MONaO.cjs';
|
|
3
|
+
import { a as RouteDef } from './routeHead-DLxlq15W.cjs';
|
|
4
4
|
import './types-CJFViL6Q.cjs';
|
|
5
|
+
import './track-core-DN5fYLWi.cjs';
|
|
6
|
+
import './signal-BnWpq6WB.cjs';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* Listener tracking for accessibility checks.
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { w as AdoptMismatch, y as AdoptResult, R as RenderResult } from './ssr-JpGpHnpC.js';
|
|
2
|
-
import { R as RenderRouteOptions, a as RouteRenderResult } from './renderRoute-
|
|
3
|
-
import { a as RouteDef } from './routeHead-
|
|
2
|
+
import { R as RenderRouteOptions, a as RouteRenderResult } from './renderRoute-_yxPuEQY.js';
|
|
3
|
+
import { a as RouteDef } from './routeHead-w8nANZ3M.js';
|
|
4
4
|
import './types-CJFViL6Q.js';
|
|
5
|
+
import './track-core-0edROAF5.js';
|
|
6
|
+
import './signal-BnWpq6WB.js';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* Listener tracking for accessibility checks.
|
package/dist/testing.js
CHANGED
|
@@ -1,36 +1,38 @@
|
|
|
1
1
|
import {
|
|
2
2
|
renderRoute
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-75EAQH3U.js";
|
|
4
|
+
import "./chunk-EHSJESRN.js";
|
|
5
|
+
import "./chunk-HTPOIAAL.js";
|
|
6
|
+
import "./chunk-DS5V2PRE.js";
|
|
6
7
|
import {
|
|
7
8
|
hydrate,
|
|
8
9
|
renderToStringAsync
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-DRWOD7RZ.js";
|
|
11
|
+
import "./chunk-MINLMJUY.js";
|
|
12
|
+
import "./chunk-BG4BP44S.js";
|
|
12
13
|
import {
|
|
13
14
|
__resetTransfer
|
|
14
15
|
} from "./chunk-3HZOSMPX.js";
|
|
15
16
|
import "./chunk-62BDYGAG.js";
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-HQIAL7F2.js";
|
|
18
|
-
import "./chunk-RVWJGWCL.js";
|
|
17
|
+
import "./chunk-VSTX3XSX.js";
|
|
19
18
|
import {
|
|
20
|
-
|
|
21
|
-
} from "./chunk-
|
|
19
|
+
styleKeyToProperty
|
|
20
|
+
} from "./chunk-DNCQDFJJ.js";
|
|
21
|
+
import "./chunk-XPDZ2LDR.js";
|
|
22
|
+
import "./chunk-RVWJGWCL.js";
|
|
22
23
|
import {
|
|
23
24
|
effect
|
|
24
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-LGUXYHTZ.js";
|
|
25
26
|
import "./chunk-B3HOT4TK.js";
|
|
26
27
|
import "./chunk-UYTYNCMZ.js";
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-IUBV5WO5.js";
|
|
29
|
+
import "./chunk-GFM5WWPU.js";
|
|
29
30
|
import {
|
|
30
31
|
dispose,
|
|
32
|
+
globalSingleton,
|
|
31
33
|
replaceChildrenSafely,
|
|
32
34
|
reportError
|
|
33
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-BF3WBJJQ.js";
|
|
34
36
|
import "./chunk-NT3ZYB5S.js";
|
|
35
37
|
import "./chunk-R5U7XKVJ.js";
|
|
36
38
|
|
|
@@ -1204,8 +1206,7 @@ function createJestAdapter() {
|
|
|
1204
1206
|
toHaveStyle(element, style) {
|
|
1205
1207
|
const mismatches = [];
|
|
1206
1208
|
for (const [prop, expected] of Object.entries(style)) {
|
|
1207
|
-
const
|
|
1208
|
-
const actual = element.style.getPropertyValue(kebabProp);
|
|
1209
|
+
const actual = element.style.getPropertyValue(styleKeyToProperty(prop));
|
|
1209
1210
|
if (actual !== expected) {
|
|
1210
1211
|
mismatches.push(`${prop}: expected "${expected}" but got "${actual}"`);
|
|
1211
1212
|
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { R as ReactiveSignal } from './signal-BnWpq6WB.js';
|
|
2
|
+
|
|
3
|
+
type Subscriber = () => void;
|
|
4
|
+
/**
|
|
5
|
+
* Stop recording dependency edges until the matching {@link resumeTracking}.
|
|
6
|
+
* Nestable — the depth is counted, so an inner pair does not resume early.
|
|
7
|
+
*
|
|
8
|
+
* Prefer {@link untracked}, which pairs the two calls for you even when the
|
|
9
|
+
* body throws. Reach for the raw pair only when the suspended region cannot be
|
|
10
|
+
* expressed as a single function.
|
|
11
|
+
*
|
|
12
|
+
* @returns Nothing.
|
|
13
|
+
*/
|
|
14
|
+
declare function suspendTracking(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Undo one {@link suspendTracking}. Dependency recording resumes only when the
|
|
17
|
+
* outermost pair closes.
|
|
18
|
+
*
|
|
19
|
+
* @returns Nothing.
|
|
20
|
+
*/
|
|
21
|
+
declare function resumeTracking(): void;
|
|
22
|
+
/** Read the "tracking suspended" flag (used by derived's lazy path). */
|
|
23
|
+
declare function isTrackingSuspended(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Run `fn` without recording anything it reads as a dependency.
|
|
26
|
+
*
|
|
27
|
+
* The suspension is released even if `fn` throws, which is the reason to prefer
|
|
28
|
+
* this over a manual suspend/resume pair.
|
|
29
|
+
*
|
|
30
|
+
* @param fn Function to run outside dependency tracking.
|
|
31
|
+
* @returns Whatever `fn` returns.
|
|
32
|
+
*/
|
|
33
|
+
declare function untracked<T>(fn: () => T): T;
|
|
34
|
+
/** The owner scope in effect right now (`null` when there is none). @internal */
|
|
35
|
+
declare function getOwnerScope(): unknown;
|
|
36
|
+
/**
|
|
37
|
+
* Run `fn` with `scope` as the current owner scope, restoring the previous
|
|
38
|
+
* scope afterwards (even if `fn` throws). @internal
|
|
39
|
+
*/
|
|
40
|
+
declare function runWithOwnerScope<T>(scope: unknown, fn: () => T): T;
|
|
41
|
+
/**
|
|
42
|
+
* Capture the current owner scope into `fn`, for work that runs later (a
|
|
43
|
+
* deferred first render, a lifecycle callback). Returns `fn` itself when there
|
|
44
|
+
* is no scope to carry. @internal
|
|
45
|
+
*/
|
|
46
|
+
declare function bindOwnerScope<A extends unknown[], R>(fn: (...args: A) => R): (...args: A) => R;
|
|
47
|
+
/** Lifecycle of a captured owner: 0 active, 1 paused, 2 ended. @internal */
|
|
48
|
+
type OwnerState = 0 | 1 | 2;
|
|
49
|
+
/**
|
|
50
|
+
* A check on the structural owner that was current when it was captured.
|
|
51
|
+
* `()` is true while that owner (or one above it) is paused or ended — the
|
|
52
|
+
* work it guards must not run. @internal
|
|
53
|
+
*/
|
|
54
|
+
interface HeldCheck {
|
|
55
|
+
(): boolean;
|
|
56
|
+
/** The owner's state now. */
|
|
57
|
+
state(): OwnerState;
|
|
58
|
+
/**
|
|
59
|
+
* Call `onActive` once the owner is active again, or `onEnd` once it has
|
|
60
|
+
* ended — whichever comes first, exactly once — without polling: both are
|
|
61
|
+
* driven by `thaw` and disposal. Returns a function that drops the wait.
|
|
62
|
+
*/
|
|
63
|
+
wait(onActive: () => void, onEnd: () => void): () => void;
|
|
64
|
+
/**
|
|
65
|
+
* Call `onEnd` once the owner has ended (whatever its state now), exactly
|
|
66
|
+
* once. Returns a function that drops the watch. Unlike `wait`, it is called
|
|
67
|
+
* SYNCHRONOUSLY, inside the disposal that ended the owner: by the time any
|
|
68
|
+
* other subscriber can run, what it tears down is gone.
|
|
69
|
+
*/
|
|
70
|
+
onEnd(onEnd: () => void): () => void;
|
|
71
|
+
/**
|
|
72
|
+
* Run `fn` with the captured owner as the structural owner, so what it
|
|
73
|
+
* creates (an effect, a binding) is owned by it: skipped while it is
|
|
74
|
+
* paused, re-run when it resumes.
|
|
75
|
+
*/
|
|
76
|
+
run<T>(fn: () => T): T;
|
|
77
|
+
/**
|
|
78
|
+
* Call `listener` with the owner's new state whenever it switches between
|
|
79
|
+
* active and paused, a microtask after the switch (a pause and resume in
|
|
80
|
+
* the same task are coalesced: nothing is delivered). Never called once it
|
|
81
|
+
* ended; the listener is dropped then. Returns a function that drops it.
|
|
82
|
+
*/
|
|
83
|
+
onChange(listener: (state: OwnerState) => void): () => void;
|
|
84
|
+
/** Whether the captured owner is `owner`, or lies below it. */
|
|
85
|
+
within(owner: StructuralBinding): boolean;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Capture the structural owner in effect now (see {@link HeldCheck}). Deferred
|
|
89
|
+
* work scheduled on a subtree's behalf — a first render queued in a microtask,
|
|
90
|
+
* an async continuation — which the drain's frozen check never sees, consults
|
|
91
|
+
* it before it reads state or builds DOM, and can wait for the owner to
|
|
92
|
+
* resume. @internal
|
|
93
|
+
*/
|
|
94
|
+
declare function captureFrozen(): HeldCheck;
|
|
95
|
+
/**
|
|
96
|
+
* Hold a detached DOM subtree: bindings whose node lies inside it are skipped
|
|
97
|
+
* (and re-run once released), as for a paused owner. Returns the release.
|
|
98
|
+
* @internal
|
|
99
|
+
*/
|
|
100
|
+
declare function holdSubtree(root: {
|
|
101
|
+
contains(node: unknown): boolean;
|
|
102
|
+
}): () => void;
|
|
103
|
+
declare function retrack(effectFn: () => void, subscriber: Subscriber): void;
|
|
104
|
+
declare function track(effectFn: () => void, subscriber?: Subscriber): () => void;
|
|
105
|
+
declare function reactiveBinding(commit: () => void, ownerNode?: unknown, structural?: boolean): () => void;
|
|
106
|
+
/**
|
|
107
|
+
* Handle returned by {@link structuralBinding}.
|
|
108
|
+
* @internal
|
|
109
|
+
*/
|
|
110
|
+
interface StructuralBinding {
|
|
111
|
+
/** Dispose the binding. Idempotent. */
|
|
112
|
+
stop: () => void;
|
|
113
|
+
/**
|
|
114
|
+
* Run `fn` with this binding as the structural owner, for a render that
|
|
115
|
+
* happens outside the binding's own run (a directive's deferred first
|
|
116
|
+
* render), so what it builds is owned exactly as a later rebuild would be.
|
|
117
|
+
*/
|
|
118
|
+
run: <T>(fn: () => T) => T;
|
|
119
|
+
/**
|
|
120
|
+
* Stop every subscriber created under this binding (through `run`, or while
|
|
121
|
+
* it ran) from running again, without disposing anything. Their DOM stays
|
|
122
|
+
* as it is and their disposers stay registered, so a subtree can keep
|
|
123
|
+
* showing its last state, and keep its lifecycle alive, until it is removed.
|
|
124
|
+
* Disposing the binding lifts the freeze. Absent on a structural binding
|
|
125
|
+
* provided by an older copy of the runtime.
|
|
126
|
+
*/
|
|
127
|
+
freeze?: () => void;
|
|
128
|
+
/**
|
|
129
|
+
* Resume a frozen binding (its branch was taken back before it finished
|
|
130
|
+
* leaving): the subscribers it skipped re-run, and deferred work waiting on
|
|
131
|
+
* it continues. Unlike `stop`, the subtree stays alive. Absent on an older
|
|
132
|
+
* runtime copy.
|
|
133
|
+
*/
|
|
134
|
+
thaw?: () => void;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* A {@link reactiveBinding} whose run may REPLACE the subtree it renders —
|
|
138
|
+
* the binding behind `when`, `match`, `each` and `KeepAlive`. Subscribers
|
|
139
|
+
* created while it runs are owned by it, and the drain runs it before any of
|
|
140
|
+
* them when both are pending (see "Structural ownership").
|
|
141
|
+
* @internal
|
|
142
|
+
*/
|
|
143
|
+
declare function structuralBinding(commit: () => void, ownerNode?: unknown): StructuralBinding;
|
|
144
|
+
declare function recordDependency(signal: ReactiveSignal): void;
|
|
145
|
+
declare function cleanup(subscriber: Subscriber): void;
|
|
146
|
+
/**
|
|
147
|
+
* Cap how many times one subscriber may re-run within a single drain before it
|
|
148
|
+
* is quarantined as a runaway cycle. A safety valve, not a tuning knob.
|
|
149
|
+
*
|
|
150
|
+
* @param n New limit; ignored unless finite and positive.
|
|
151
|
+
* @returns The previous limit, so a caller can restore it.
|
|
152
|
+
*/
|
|
153
|
+
declare function setMaxSubscriberRepeats(n: number): number;
|
|
154
|
+
/**
|
|
155
|
+
* Cap how many passes one notification drain may make before giving up on a
|
|
156
|
+
* self-refeeding update cycle.
|
|
157
|
+
*
|
|
158
|
+
* @param n New limit; ignored unless finite and positive.
|
|
159
|
+
* @returns The previous limit, so a caller can restore it.
|
|
160
|
+
*/
|
|
161
|
+
declare function setMaxDrainIterations(n: number): number;
|
|
162
|
+
/**
|
|
163
|
+
* Flush queued signal notifications, running every dirty subscriber.
|
|
164
|
+
*
|
|
165
|
+
* Re-entrant calls are ignored: a write performed from inside a subscriber adds
|
|
166
|
+
* to the queue the current drain is already working through, rather than
|
|
167
|
+
* starting a nested one.
|
|
168
|
+
*
|
|
169
|
+
* @returns Nothing.
|
|
170
|
+
*/
|
|
171
|
+
declare function drainNotificationQueue(): void;
|
|
172
|
+
declare function queueSignalNotification(signal: ReactiveSignal): void;
|
|
173
|
+
/**
|
|
174
|
+
* Mark every subscriber of `signal` dirty and queue them for the next drain.
|
|
175
|
+
*
|
|
176
|
+
* @param signal The signal that changed.
|
|
177
|
+
* @returns Nothing.
|
|
178
|
+
*/
|
|
179
|
+
declare function notifySubscribers(signal: ReactiveSignal): void;
|
|
180
|
+
/** O(1) subscriber count for devtools / introspection. */
|
|
181
|
+
declare function getSubscriberCount(signal: ReactiveSignal): number;
|
|
182
|
+
/** Return the signals a subscriber currently depends on, in record order. */
|
|
183
|
+
declare function getSubscriberDeps(subscriber: Subscriber): ReactiveSignal[];
|
|
184
|
+
/** Iterate subscribers of a signal (devtools graph walk). */
|
|
185
|
+
declare function forEachSubscriber(signal: ReactiveSignal, visit: (sub: Subscriber) => void): void;
|
|
186
|
+
|
|
187
|
+
export { type HeldCheck as H, type StructuralBinding as S, retrack as a, reactiveBinding as b, recordDependency as c, cleanup as d, setMaxSubscriberRepeats as e, setMaxDrainIterations as f, drainNotificationQueue as g, getSubscriberCount as h, isTrackingSuspended as i, getSubscriberDeps as j, forEachSubscriber as k, getOwnerScope as l, runWithOwnerScope as m, notifySubscribers as n, bindOwnerScope as o, structuralBinding as p, queueSignalNotification as q, resumeTracking as r, suspendTracking as s, track as t, untracked as u, captureFrozen as v, holdSubtree as w };
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { R as ReactiveSignal } from './signal-BnWpq6WB.cjs';
|
|
2
|
+
|
|
3
|
+
type Subscriber = () => void;
|
|
4
|
+
/**
|
|
5
|
+
* Stop recording dependency edges until the matching {@link resumeTracking}.
|
|
6
|
+
* Nestable — the depth is counted, so an inner pair does not resume early.
|
|
7
|
+
*
|
|
8
|
+
* Prefer {@link untracked}, which pairs the two calls for you even when the
|
|
9
|
+
* body throws. Reach for the raw pair only when the suspended region cannot be
|
|
10
|
+
* expressed as a single function.
|
|
11
|
+
*
|
|
12
|
+
* @returns Nothing.
|
|
13
|
+
*/
|
|
14
|
+
declare function suspendTracking(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Undo one {@link suspendTracking}. Dependency recording resumes only when the
|
|
17
|
+
* outermost pair closes.
|
|
18
|
+
*
|
|
19
|
+
* @returns Nothing.
|
|
20
|
+
*/
|
|
21
|
+
declare function resumeTracking(): void;
|
|
22
|
+
/** Read the "tracking suspended" flag (used by derived's lazy path). */
|
|
23
|
+
declare function isTrackingSuspended(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Run `fn` without recording anything it reads as a dependency.
|
|
26
|
+
*
|
|
27
|
+
* The suspension is released even if `fn` throws, which is the reason to prefer
|
|
28
|
+
* this over a manual suspend/resume pair.
|
|
29
|
+
*
|
|
30
|
+
* @param fn Function to run outside dependency tracking.
|
|
31
|
+
* @returns Whatever `fn` returns.
|
|
32
|
+
*/
|
|
33
|
+
declare function untracked<T>(fn: () => T): T;
|
|
34
|
+
/** The owner scope in effect right now (`null` when there is none). @internal */
|
|
35
|
+
declare function getOwnerScope(): unknown;
|
|
36
|
+
/**
|
|
37
|
+
* Run `fn` with `scope` as the current owner scope, restoring the previous
|
|
38
|
+
* scope afterwards (even if `fn` throws). @internal
|
|
39
|
+
*/
|
|
40
|
+
declare function runWithOwnerScope<T>(scope: unknown, fn: () => T): T;
|
|
41
|
+
/**
|
|
42
|
+
* Capture the current owner scope into `fn`, for work that runs later (a
|
|
43
|
+
* deferred first render, a lifecycle callback). Returns `fn` itself when there
|
|
44
|
+
* is no scope to carry. @internal
|
|
45
|
+
*/
|
|
46
|
+
declare function bindOwnerScope<A extends unknown[], R>(fn: (...args: A) => R): (...args: A) => R;
|
|
47
|
+
/** Lifecycle of a captured owner: 0 active, 1 paused, 2 ended. @internal */
|
|
48
|
+
type OwnerState = 0 | 1 | 2;
|
|
49
|
+
/**
|
|
50
|
+
* A check on the structural owner that was current when it was captured.
|
|
51
|
+
* `()` is true while that owner (or one above it) is paused or ended — the
|
|
52
|
+
* work it guards must not run. @internal
|
|
53
|
+
*/
|
|
54
|
+
interface HeldCheck {
|
|
55
|
+
(): boolean;
|
|
56
|
+
/** The owner's state now. */
|
|
57
|
+
state(): OwnerState;
|
|
58
|
+
/**
|
|
59
|
+
* Call `onActive` once the owner is active again, or `onEnd` once it has
|
|
60
|
+
* ended — whichever comes first, exactly once — without polling: both are
|
|
61
|
+
* driven by `thaw` and disposal. Returns a function that drops the wait.
|
|
62
|
+
*/
|
|
63
|
+
wait(onActive: () => void, onEnd: () => void): () => void;
|
|
64
|
+
/**
|
|
65
|
+
* Call `onEnd` once the owner has ended (whatever its state now), exactly
|
|
66
|
+
* once. Returns a function that drops the watch. Unlike `wait`, it is called
|
|
67
|
+
* SYNCHRONOUSLY, inside the disposal that ended the owner: by the time any
|
|
68
|
+
* other subscriber can run, what it tears down is gone.
|
|
69
|
+
*/
|
|
70
|
+
onEnd(onEnd: () => void): () => void;
|
|
71
|
+
/**
|
|
72
|
+
* Run `fn` with the captured owner as the structural owner, so what it
|
|
73
|
+
* creates (an effect, a binding) is owned by it: skipped while it is
|
|
74
|
+
* paused, re-run when it resumes.
|
|
75
|
+
*/
|
|
76
|
+
run<T>(fn: () => T): T;
|
|
77
|
+
/**
|
|
78
|
+
* Call `listener` with the owner's new state whenever it switches between
|
|
79
|
+
* active and paused, a microtask after the switch (a pause and resume in
|
|
80
|
+
* the same task are coalesced: nothing is delivered). Never called once it
|
|
81
|
+
* ended; the listener is dropped then. Returns a function that drops it.
|
|
82
|
+
*/
|
|
83
|
+
onChange(listener: (state: OwnerState) => void): () => void;
|
|
84
|
+
/** Whether the captured owner is `owner`, or lies below it. */
|
|
85
|
+
within(owner: StructuralBinding): boolean;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Capture the structural owner in effect now (see {@link HeldCheck}). Deferred
|
|
89
|
+
* work scheduled on a subtree's behalf — a first render queued in a microtask,
|
|
90
|
+
* an async continuation — which the drain's frozen check never sees, consults
|
|
91
|
+
* it before it reads state or builds DOM, and can wait for the owner to
|
|
92
|
+
* resume. @internal
|
|
93
|
+
*/
|
|
94
|
+
declare function captureFrozen(): HeldCheck;
|
|
95
|
+
/**
|
|
96
|
+
* Hold a detached DOM subtree: bindings whose node lies inside it are skipped
|
|
97
|
+
* (and re-run once released), as for a paused owner. Returns the release.
|
|
98
|
+
* @internal
|
|
99
|
+
*/
|
|
100
|
+
declare function holdSubtree(root: {
|
|
101
|
+
contains(node: unknown): boolean;
|
|
102
|
+
}): () => void;
|
|
103
|
+
declare function retrack(effectFn: () => void, subscriber: Subscriber): void;
|
|
104
|
+
declare function track(effectFn: () => void, subscriber?: Subscriber): () => void;
|
|
105
|
+
declare function reactiveBinding(commit: () => void, ownerNode?: unknown, structural?: boolean): () => void;
|
|
106
|
+
/**
|
|
107
|
+
* Handle returned by {@link structuralBinding}.
|
|
108
|
+
* @internal
|
|
109
|
+
*/
|
|
110
|
+
interface StructuralBinding {
|
|
111
|
+
/** Dispose the binding. Idempotent. */
|
|
112
|
+
stop: () => void;
|
|
113
|
+
/**
|
|
114
|
+
* Run `fn` with this binding as the structural owner, for a render that
|
|
115
|
+
* happens outside the binding's own run (a directive's deferred first
|
|
116
|
+
* render), so what it builds is owned exactly as a later rebuild would be.
|
|
117
|
+
*/
|
|
118
|
+
run: <T>(fn: () => T) => T;
|
|
119
|
+
/**
|
|
120
|
+
* Stop every subscriber created under this binding (through `run`, or while
|
|
121
|
+
* it ran) from running again, without disposing anything. Their DOM stays
|
|
122
|
+
* as it is and their disposers stay registered, so a subtree can keep
|
|
123
|
+
* showing its last state, and keep its lifecycle alive, until it is removed.
|
|
124
|
+
* Disposing the binding lifts the freeze. Absent on a structural binding
|
|
125
|
+
* provided by an older copy of the runtime.
|
|
126
|
+
*/
|
|
127
|
+
freeze?: () => void;
|
|
128
|
+
/**
|
|
129
|
+
* Resume a frozen binding (its branch was taken back before it finished
|
|
130
|
+
* leaving): the subscribers it skipped re-run, and deferred work waiting on
|
|
131
|
+
* it continues. Unlike `stop`, the subtree stays alive. Absent on an older
|
|
132
|
+
* runtime copy.
|
|
133
|
+
*/
|
|
134
|
+
thaw?: () => void;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* A {@link reactiveBinding} whose run may REPLACE the subtree it renders —
|
|
138
|
+
* the binding behind `when`, `match`, `each` and `KeepAlive`. Subscribers
|
|
139
|
+
* created while it runs are owned by it, and the drain runs it before any of
|
|
140
|
+
* them when both are pending (see "Structural ownership").
|
|
141
|
+
* @internal
|
|
142
|
+
*/
|
|
143
|
+
declare function structuralBinding(commit: () => void, ownerNode?: unknown): StructuralBinding;
|
|
144
|
+
declare function recordDependency(signal: ReactiveSignal): void;
|
|
145
|
+
declare function cleanup(subscriber: Subscriber): void;
|
|
146
|
+
/**
|
|
147
|
+
* Cap how many times one subscriber may re-run within a single drain before it
|
|
148
|
+
* is quarantined as a runaway cycle. A safety valve, not a tuning knob.
|
|
149
|
+
*
|
|
150
|
+
* @param n New limit; ignored unless finite and positive.
|
|
151
|
+
* @returns The previous limit, so a caller can restore it.
|
|
152
|
+
*/
|
|
153
|
+
declare function setMaxSubscriberRepeats(n: number): number;
|
|
154
|
+
/**
|
|
155
|
+
* Cap how many passes one notification drain may make before giving up on a
|
|
156
|
+
* self-refeeding update cycle.
|
|
157
|
+
*
|
|
158
|
+
* @param n New limit; ignored unless finite and positive.
|
|
159
|
+
* @returns The previous limit, so a caller can restore it.
|
|
160
|
+
*/
|
|
161
|
+
declare function setMaxDrainIterations(n: number): number;
|
|
162
|
+
/**
|
|
163
|
+
* Flush queued signal notifications, running every dirty subscriber.
|
|
164
|
+
*
|
|
165
|
+
* Re-entrant calls are ignored: a write performed from inside a subscriber adds
|
|
166
|
+
* to the queue the current drain is already working through, rather than
|
|
167
|
+
* starting a nested one.
|
|
168
|
+
*
|
|
169
|
+
* @returns Nothing.
|
|
170
|
+
*/
|
|
171
|
+
declare function drainNotificationQueue(): void;
|
|
172
|
+
declare function queueSignalNotification(signal: ReactiveSignal): void;
|
|
173
|
+
/**
|
|
174
|
+
* Mark every subscriber of `signal` dirty and queue them for the next drain.
|
|
175
|
+
*
|
|
176
|
+
* @param signal The signal that changed.
|
|
177
|
+
* @returns Nothing.
|
|
178
|
+
*/
|
|
179
|
+
declare function notifySubscribers(signal: ReactiveSignal): void;
|
|
180
|
+
/** O(1) subscriber count for devtools / introspection. */
|
|
181
|
+
declare function getSubscriberCount(signal: ReactiveSignal): number;
|
|
182
|
+
/** Return the signals a subscriber currently depends on, in record order. */
|
|
183
|
+
declare function getSubscriberDeps(subscriber: Subscriber): ReactiveSignal[];
|
|
184
|
+
/** Iterate subscribers of a signal (devtools graph walk). */
|
|
185
|
+
declare function forEachSubscriber(signal: ReactiveSignal, visit: (sub: Subscriber) => void): void;
|
|
186
|
+
|
|
187
|
+
export { type HeldCheck as H, type StructuralBinding as S, retrack as a, reactiveBinding as b, recordDependency as c, cleanup as d, setMaxSubscriberRepeats as e, setMaxDrainIterations as f, drainNotificationQueue as g, getSubscriberCount as h, isTrackingSuspended as i, getSubscriberDeps as j, forEachSubscriber as k, getOwnerScope as l, runWithOwnerScope as m, notifySubscribers as n, bindOwnerScope as o, structuralBinding as p, queueSignalNotification as q, resumeTracking as r, suspendTracking as s, track as t, untracked as u, captureFrozen as v, holdSubtree as w };
|