@askrjs/askr 0.2.4 → 0.3.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/CHANGELOG.md +11 -0
- package/dist/access-CEA2pOry.js +1046 -0
- package/dist/actions/index.d.ts +16 -2
- package/dist/actions/index.js +5 -5
- package/dist/{activity-FirwPXA_.js → activity-oy2YFTFF.js} +10 -16
- package/dist/benchmark.js +8 -9
- package/dist/boot/index.d.ts +19 -9
- package/dist/boot/index.js +1 -1
- package/dist/{boot-tWyF6121.js → boot-BMBMWUGI.js} +680 -441
- package/dist/capabilities-Bbf0mlp9.js +42 -0
- package/dist/components/index.d.ts +11 -8
- package/dist/components/index.js +1 -1
- package/dist/{compose-ref-Bfaf4kUC.js → compose-ref-v0qGlHoN.js} +7 -1
- package/dist/control/index.d.ts +20 -2
- package/dist/control/index.js +1 -1
- package/dist/{control-C-wSaq9V.js → control-BR_mrX__.js} +4 -4
- package/dist/core.d.ts +163 -0
- package/dist/csp-nonce-BfFWcd0w.js +173 -0
- package/dist/data/index.d.ts +74 -2
- package/dist/data/index.js +3 -3
- package/dist/{data-ghKopAbp.js → data-2edW0jhF.js} +108 -122
- package/dist/{data-runtime-7t_Y0iv3.js → data-runtime-CxoY98lX.js} +22 -15
- package/dist/{deferred-CxjWCkIn.js → deferred-CbgNhf67.js} +5 -5
- package/dist/dom-renderer.d.ts +77 -0
- package/dist/domains/actions.d.ts +70 -0
- package/dist/domains/component.d.ts +119 -0
- package/dist/domains/context.d.ts +73 -0
- package/dist/domains/control.d.ts +328 -0
- package/dist/domains/data.d.ts +461 -0
- package/dist/domains/diagnostics.d.ts +21 -0
- package/dist/domains/lifecycle.d.ts +112 -0
- package/dist/domains/refs.d.ts +18 -0
- package/dist/domains/renderer.d.ts +127 -0
- package/dist/domains/routing.d.ts +501 -0
- package/dist/domains/scheduler.d.ts +79 -0
- package/dist/domains/server.d.ts +112 -0
- package/dist/domains/state.d.ts +129 -0
- package/dist/domains/telemetry.d.ts +29 -0
- package/dist/eager-control.d.ts +8 -0
- package/dist/{effect-CNwstBBD.js → effect-C3Zsc1k6.js} +14 -41
- package/dist/{types-DWVrKn9N.d.ts → elements.d.ts} +79 -42
- package/dist/{for-internal-DyBHfKJA.js → for-state-BDykeOJL.js} +598 -494
- package/dist/foundations/icon/index.d.ts +67 -16
- package/dist/foundations/icon/index.js +1 -1
- package/dist/foundations/index.d.ts +26 -3
- package/dist/foundations/index.js +1 -1
- package/dist/foundations/interactions/index.d.ts +73 -34
- package/dist/foundations/interactions/index.js +1 -1
- package/dist/foundations/state/index.d.ts +12 -5
- package/dist/foundations/state/index.js +1 -1
- package/dist/foundations/structures/index.d.ts +44 -3
- package/dist/foundations/structures/index.js +1 -1
- package/dist/foundations/utilities/index.d.ts +34 -3
- package/dist/foundations/utilities/index.js +1 -1
- package/dist/fx/index.d.ts +72 -25
- package/dist/fx/index.js +8 -8
- package/dist/index.d.ts +121 -4
- package/dist/index.js +316 -47
- package/dist/{component-internal-C4hKKQBF.js → instance-VAFYVJOa.js} +495 -283
- package/dist/{interactions-D102JxBR.js → interactions-CTeACdT_.js} +1 -1
- package/dist/jsx-dev-runtime.d.ts +51 -11
- package/dist/jsx-globals.d.ts +2 -0
- package/dist/jsx-runtime-CPJXAOBF.js +43 -0
- package/dist/jsx-runtime.d.ts +17 -3
- package/dist/jsx-runtime.js +2 -42
- package/dist/jsx.d.ts +108 -0
- package/dist/{manifest-D6rfj_jC.js → manifest-D1P3UNWV.js} +4 -9
- package/dist/{navigate-ZZu1IV0B.js → navigate-prC5V8XV.js} +125 -472
- package/dist/{navigate-F4sHgWbw.d.ts → navigation.d.ts} +8 -8
- package/dist/{readable-Di1fzSwm.js → notify-DxxuDPeY.js} +96 -34
- package/dist/{query-registry-Bua3cDyb.js → query-registry-LrYpQsDJ.js} +1 -1
- package/dist/{compose-ref-DOJHoW5X.d.ts → refs.d.ts} +11 -7
- package/dist/{ssr-Doog-AfJ.js → render-resolved-BC0W7_5b.js} +165 -558
- package/dist/{renderer-Cl23O0hV.js → renderer-CT0HeY58.js} +6825 -5692
- package/dist/{resolution-ClD-K7Lz.js → resolution-3DskUkjG.js} +189 -180
- package/dist/{resource-operation-Vz1S5h2k.js → resource-18-sFRl9.js} +98 -58
- package/dist/resources/index.d.ts +64 -12
- package/dist/resources/index.js +214 -8
- package/dist/route-activity.d.ts +21 -0
- package/dist/{route-matching-Bo6UqG-5.js → route-matching-CUzZ31gT.js} +68 -82
- package/dist/router/index.d.ts +378 -79
- package/dist/router/index.js +9 -9
- package/dist/router-internal-7nuNEHfG.js +36 -0
- package/dist/scope-Cq_iYbTR.js +403 -0
- package/dist/{selector-CsKuomw0.js → selector-BSPVkjKP.js} +26 -27
- package/dist/{shared-CYBH3F8I.js → shared-kU8yvryp.js} +3 -6
- package/dist/{snapshot-source-BB42xgwb.js → snapshot-source-An4iKajG.js} +1 -1
- package/dist/ssg/index.d.ts +51 -15
- package/dist/ssg/index.js +269 -209
- package/dist/ssr/index.d.ts +121 -68
- package/dist/ssr/index.js +2 -1
- package/dist/ssr-CiNm6Vzl.js +393 -0
- package/dist/{ssr-DSHd_Q9K.js → ssr-EPjwJH5R.js} +5 -1
- package/dist/{state-BGJgYSyQ.js → state-BXJfudq1.js} +10 -15
- package/dist/{structures-DFyK5AdQ.js → structures-CjEzfj4h.js} +37 -57
- package/dist/{index-CTpMmzgN.d.ts → structures.d.ts} +57 -36
- package/dist/testing/index.d.ts +123 -24
- package/dist/testing/index.js +24 -61
- package/dist/timer-C7uqnJVt.js +85 -0
- package/dist/{index-B1gu0_m0.d.ts → utilities.d.ts} +24 -13
- package/dist/{verify-hydration-BZPJ_kYa.js → verify-hydration-ikaxotf7.js} +8 -5
- package/package.json +12 -14
- package/dist/access-BucjYZcX.js +0 -509
- package/dist/activity-DooIuxQO.d.ts +0 -14
- package/dist/benchmark.d.ts +0 -26
- package/dist/cleanup-TXSsApEl.js +0 -535
- package/dist/component-cleanup-jdbgjkT1.js +0 -143
- package/dist/component-scope-4I3yEMkb.js +0 -195
- package/dist/control-Cxag1yqV.d.ts +0 -8
- package/dist/csp-nonce-9NFUb7hJ.js +0 -72
- package/dist/css-BuPaTOfe.js +0 -70
- package/dist/fastlane-BKZduiBQ.js +0 -166
- package/dist/index-Dgjbo2gU.d.ts +0 -1456
- package/dist/jsx-runtime-Cg7GqY1S.d.ts +0 -2
- package/dist/jsx-runtime-gVIaTPw0.d.ts +0 -38
- package/dist/lifecycle-batch-63aXFf2S.js +0 -253
- package/dist/lifecycle-operations-Q0k3EFnG.js +0 -287
package/dist/access-BucjYZcX.js
DELETED
|
@@ -1,509 +0,0 @@
|
|
|
1
|
-
import { a as clearCurrentComponentScope, y as restoreCurrentComponentScope } from "./component-scope-4I3yEMkb.js";
|
|
2
|
-
//#region src/common/env.ts
|
|
3
|
-
function normalizeEnv(source) {
|
|
4
|
-
if (!source) return {};
|
|
5
|
-
const normalized = {};
|
|
6
|
-
for (const [key, value] of Object.entries(source)) if (typeof value === "string") normalized[key] = value;
|
|
7
|
-
else if (typeof value === "boolean" || typeof value === "number") normalized[key] = String(value);
|
|
8
|
-
return normalized;
|
|
9
|
-
}
|
|
10
|
-
function getBuildTimeEnv() {
|
|
11
|
-
const metaEnv = import.meta.env;
|
|
12
|
-
const normalized = normalizeEnv(metaEnv);
|
|
13
|
-
if (normalized.NODE_ENV == null && metaEnv) {
|
|
14
|
-
if (typeof metaEnv.MODE === "string" && metaEnv.MODE.length > 0) normalized.NODE_ENV = metaEnv.MODE;
|
|
15
|
-
else if (metaEnv.PROD === true || metaEnv.PROD === "true") normalized.NODE_ENV = "production";
|
|
16
|
-
else if (metaEnv.DEV === true || metaEnv.DEV === "true") normalized.NODE_ENV = "development";
|
|
17
|
-
}
|
|
18
|
-
return normalized;
|
|
19
|
-
}
|
|
20
|
-
function resolveNodeEnv(processNodeEnv, buildNodeEnv) {
|
|
21
|
-
if (buildNodeEnv === "production") return "production";
|
|
22
|
-
if (processNodeEnv != null) return processNodeEnv;
|
|
23
|
-
if (buildNodeEnv === "development") return "development";
|
|
24
|
-
return buildNodeEnv === "test" ? void 0 : buildNodeEnv;
|
|
25
|
-
}
|
|
26
|
-
function getRuntimeEnv() {
|
|
27
|
-
const processEnv = globalThis.process?.env ?? {};
|
|
28
|
-
const buildTimeEnv = getBuildTimeEnv();
|
|
29
|
-
return {
|
|
30
|
-
...processEnv,
|
|
31
|
-
...buildTimeEnv,
|
|
32
|
-
NODE_ENV: resolveNodeEnv(processEnv.NODE_ENV, buildTimeEnv.NODE_ENV)
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
function isProductionEnvironment() {
|
|
36
|
-
return getRuntimeEnv().NODE_ENV === "production";
|
|
37
|
-
}
|
|
38
|
-
function isDevelopmentEnvironment() {
|
|
39
|
-
return !isProductionEnvironment();
|
|
40
|
-
}
|
|
41
|
-
//#endregion
|
|
42
|
-
//#region src/common/invariant.ts
|
|
43
|
-
/**
|
|
44
|
-
* Invariant assertions shared by production runtime code.
|
|
45
|
-
*/
|
|
46
|
-
function invariant(condition, message, context) {
|
|
47
|
-
if (!condition) {
|
|
48
|
-
const contextStr = context ? "\n" + JSON.stringify(context, null, 2) : "";
|
|
49
|
-
throw new Error(`[Askr Invariant] ${message}${contextStr}`);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function assertSchedulingPrecondition(condition, violationMessage) {
|
|
53
|
-
invariant(condition, `[Scheduler Precondition] ${violationMessage}`);
|
|
54
|
-
}
|
|
55
|
-
//#endregion
|
|
56
|
-
//#region src/common/logger.ts
|
|
57
|
-
/**
|
|
58
|
-
* Shared logger interface for runtime and tooling code.
|
|
59
|
-
*
|
|
60
|
-
* Debug, info, and warn stay silent in production. Errors always log.
|
|
61
|
-
*/
|
|
62
|
-
function callConsole(method, args) {
|
|
63
|
-
const c = typeof console !== "undefined" ? console : void 0;
|
|
64
|
-
if (!c) return;
|
|
65
|
-
const fn = c[method];
|
|
66
|
-
if (typeof fn === "function") try {
|
|
67
|
-
fn.apply(console, args);
|
|
68
|
-
} catch {}
|
|
69
|
-
}
|
|
70
|
-
const logger = {
|
|
71
|
-
debug: (...args) => {
|
|
72
|
-
if (isProductionEnvironment()) return;
|
|
73
|
-
callConsole("debug", args);
|
|
74
|
-
},
|
|
75
|
-
info: (...args) => {
|
|
76
|
-
if (isProductionEnvironment()) return;
|
|
77
|
-
callConsole("info", args);
|
|
78
|
-
},
|
|
79
|
-
warn: (...args) => {
|
|
80
|
-
if (isProductionEnvironment()) return;
|
|
81
|
-
callConsole("warn", args);
|
|
82
|
-
},
|
|
83
|
-
error: (...args) => {
|
|
84
|
-
callConsole("error", args);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
//#endregion
|
|
88
|
-
//#region src/runtime/perf-metrics.ts
|
|
89
|
-
const incrementPerfMetric = () => {};
|
|
90
|
-
const addPerfDuration = () => {};
|
|
91
|
-
//#endregion
|
|
92
|
-
//#region src/runtime/scheduler.ts
|
|
93
|
-
/**
|
|
94
|
-
* Serialized update scheduler — safer design (no inline execution, explicit flush)
|
|
95
|
-
*
|
|
96
|
-
* Key ideas:
|
|
97
|
-
* - Never execute a task inline from `enqueue`.
|
|
98
|
-
* - `flush()` is explicit and non-reentrant.
|
|
99
|
-
* - `runWithSyncProgress()` allows enqueues temporarily but does not run tasks
|
|
100
|
-
* inline; it runs `fn` and then does an explicit `flush()`.
|
|
101
|
-
* - `waitForFlush()` is race-free with a monotonic `flushVersion`.
|
|
102
|
-
*/
|
|
103
|
-
const MAX_FLUSH_DEPTH = 50;
|
|
104
|
-
const SCHEDULER_LANES = [
|
|
105
|
-
"derived",
|
|
106
|
-
"component",
|
|
107
|
-
"reactive",
|
|
108
|
-
"post"
|
|
109
|
-
];
|
|
110
|
-
var Scheduler = class {
|
|
111
|
-
constructor() {
|
|
112
|
-
this.bulkCommitProbe = () => false;
|
|
113
|
-
this.lanes = {
|
|
114
|
-
derived: {
|
|
115
|
-
tasks: [],
|
|
116
|
-
head: 0
|
|
117
|
-
},
|
|
118
|
-
component: {
|
|
119
|
-
tasks: [],
|
|
120
|
-
head: 0
|
|
121
|
-
},
|
|
122
|
-
reactive: {
|
|
123
|
-
tasks: [],
|
|
124
|
-
head: 0
|
|
125
|
-
},
|
|
126
|
-
post: {
|
|
127
|
-
tasks: [],
|
|
128
|
-
head: 0
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
this.running = false;
|
|
132
|
-
this.inHandler = false;
|
|
133
|
-
this.depth = 0;
|
|
134
|
-
this.executionDepth = 0;
|
|
135
|
-
this.flushVersion = 0;
|
|
136
|
-
this.kickScheduled = false;
|
|
137
|
-
this.allowSyncProgress = false;
|
|
138
|
-
this.waiters = [];
|
|
139
|
-
this.taskCount = 0;
|
|
140
|
-
}
|
|
141
|
-
setBulkCommitProbe(probe) {
|
|
142
|
-
this.bulkCommitProbe = probe;
|
|
143
|
-
}
|
|
144
|
-
isBulkCommitActive() {
|
|
145
|
-
try {
|
|
146
|
-
return this.bulkCommitProbe();
|
|
147
|
-
} catch (e) {
|
|
148
|
-
return false;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
hasPendingTasks() {
|
|
152
|
-
for (const lane of SCHEDULER_LANES) {
|
|
153
|
-
const queue = this.lanes[lane];
|
|
154
|
-
if (queue.head < queue.tasks.length) return true;
|
|
155
|
-
}
|
|
156
|
-
return false;
|
|
157
|
-
}
|
|
158
|
-
getPendingTaskCount() {
|
|
159
|
-
let total = 0;
|
|
160
|
-
for (const lane of SCHEDULER_LANES) {
|
|
161
|
-
const queue = this.lanes[lane];
|
|
162
|
-
total += queue.tasks.length - queue.head;
|
|
163
|
-
}
|
|
164
|
-
return total;
|
|
165
|
-
}
|
|
166
|
-
compactLane(queue) {
|
|
167
|
-
if (queue.head >= queue.tasks.length) {
|
|
168
|
-
queue.tasks.length = 0;
|
|
169
|
-
queue.head = 0;
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
if (queue.head <= 0) return;
|
|
173
|
-
const remaining = queue.tasks.length - queue.head;
|
|
174
|
-
for (let i = 0; i < remaining; i++) queue.tasks[i] = queue.tasks[queue.head + i];
|
|
175
|
-
queue.tasks.length = remaining;
|
|
176
|
-
queue.head = 0;
|
|
177
|
-
}
|
|
178
|
-
scheduleFlushKick() {
|
|
179
|
-
if (this.running || this.kickScheduled || this.inHandler || this.allowSyncProgress || this.isBulkCommitActive() || !this.hasPendingTasks()) return;
|
|
180
|
-
this.kickScheduled = true;
|
|
181
|
-
queueMicrotask(() => {
|
|
182
|
-
this.kickScheduled = false;
|
|
183
|
-
if (this.running || this.isBulkCommitActive() || !this.hasPendingTasks()) return;
|
|
184
|
-
try {
|
|
185
|
-
this.flush();
|
|
186
|
-
} catch (err) {
|
|
187
|
-
setTimeout(() => {
|
|
188
|
-
throw err;
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
enqueue(task) {
|
|
194
|
-
this.enqueueInLane("component", task);
|
|
195
|
-
}
|
|
196
|
-
enqueueInLane(lane, task) {
|
|
197
|
-
assertSchedulingPrecondition(typeof task === "function", "enqueue() requires a function");
|
|
198
|
-
if (this.isBulkCommitActive() && !this.allowSyncProgress) {
|
|
199
|
-
if (isDevelopmentEnvironment()) throw new Error("[Scheduler] enqueue() during bulk commit (not allowed)");
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
this.lanes[lane].tasks.push(task);
|
|
203
|
-
this.taskCount++;
|
|
204
|
-
this.scheduleFlushKick();
|
|
205
|
-
}
|
|
206
|
-
flush() {
|
|
207
|
-
invariant(!this.running, "[Scheduler] flush() called while already running");
|
|
208
|
-
if (isDevelopmentEnvironment()) {
|
|
209
|
-
if (this.isBulkCommitActive() && !this.allowSyncProgress) throw new Error("[Scheduler] flush() started during bulk commit (not allowed)");
|
|
210
|
-
}
|
|
211
|
-
this.running = true;
|
|
212
|
-
this.depth = 0;
|
|
213
|
-
const failures = [];
|
|
214
|
-
let executedTaskCount = 0;
|
|
215
|
-
const executionsByTask = isDevelopmentEnvironment() ? /* @__PURE__ */ new Map() : null;
|
|
216
|
-
try {
|
|
217
|
-
while (true) {
|
|
218
|
-
let didRunTask = false;
|
|
219
|
-
for (const lane of SCHEDULER_LANES) {
|
|
220
|
-
const laneQueue = this.lanes[lane];
|
|
221
|
-
let executedInLane = 0;
|
|
222
|
-
while (laneQueue.head < laneQueue.tasks.length) {
|
|
223
|
-
const task = laneQueue.tasks[laneQueue.head++];
|
|
224
|
-
if (executionsByTask) {
|
|
225
|
-
const taskExecutions = (executionsByTask.get(task) ?? 0) + 1;
|
|
226
|
-
executionsByTask.set(task, taskExecutions);
|
|
227
|
-
this.depth = Math.max(this.depth, taskExecutions);
|
|
228
|
-
if (taskExecutions > MAX_FLUSH_DEPTH) throw new Error(`[Scheduler] exceeded MAX_FLUSH_DEPTH (${MAX_FLUSH_DEPTH}). Likely infinite update loop.`);
|
|
229
|
-
}
|
|
230
|
-
try {
|
|
231
|
-
this.executionDepth++;
|
|
232
|
-
task();
|
|
233
|
-
} catch (err) {
|
|
234
|
-
failures.push(err);
|
|
235
|
-
} finally {
|
|
236
|
-
if (this.executionDepth > 0) this.executionDepth--;
|
|
237
|
-
executedTaskCount++;
|
|
238
|
-
executedInLane++;
|
|
239
|
-
didRunTask = true;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
if (executedInLane > 0) this.taskCount = Math.max(0, this.taskCount - executedInLane);
|
|
243
|
-
}
|
|
244
|
-
if (!didRunTask) break;
|
|
245
|
-
}
|
|
246
|
-
} finally {
|
|
247
|
-
this.running = false;
|
|
248
|
-
this.depth = 0;
|
|
249
|
-
this.executionDepth = 0;
|
|
250
|
-
for (const lane of SCHEDULER_LANES) {
|
|
251
|
-
const queue = this.lanes[lane];
|
|
252
|
-
if (queue.head > 0) this.compactLane(queue);
|
|
253
|
-
}
|
|
254
|
-
this.flushVersion++;
|
|
255
|
-
this.resolveWaiters();
|
|
256
|
-
}
|
|
257
|
-
if (failures.length === 1) throw failures[0];
|
|
258
|
-
if (failures.length > 1) throw new AggregateError(failures, "Scheduler task failures");
|
|
259
|
-
}
|
|
260
|
-
runWithSyncProgress(fn) {
|
|
261
|
-
const prev = this.allowSyncProgress;
|
|
262
|
-
this.allowSyncProgress = true;
|
|
263
|
-
const startVersion = this.flushVersion;
|
|
264
|
-
try {
|
|
265
|
-
const res = fn();
|
|
266
|
-
if (!this.running && this.hasPendingTasks()) this.flush();
|
|
267
|
-
if (isDevelopmentEnvironment()) {
|
|
268
|
-
if (!this.running && this.hasPendingTasks()) throw new Error("[Scheduler] tasks remain after runWithSyncProgress flush");
|
|
269
|
-
}
|
|
270
|
-
return res;
|
|
271
|
-
} finally {
|
|
272
|
-
try {
|
|
273
|
-
if (this.flushVersion === startVersion) {
|
|
274
|
-
this.flushVersion++;
|
|
275
|
-
this.resolveWaiters();
|
|
276
|
-
}
|
|
277
|
-
} catch (e) {}
|
|
278
|
-
this.allowSyncProgress = prev;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
waitForFlush(targetVersion, timeoutMs = 2e3) {
|
|
282
|
-
const target = typeof targetVersion === "number" ? targetVersion : this.flushVersion + 1;
|
|
283
|
-
if (this.flushVersion >= target) return Promise.resolve();
|
|
284
|
-
return new Promise((resolve, reject) => {
|
|
285
|
-
const waiter = {
|
|
286
|
-
target,
|
|
287
|
-
resolve,
|
|
288
|
-
reject
|
|
289
|
-
};
|
|
290
|
-
waiter.timer = setTimeout(() => {
|
|
291
|
-
const index = this.waiters.indexOf(waiter);
|
|
292
|
-
if (index >= 0) this.waiters.splice(index, 1);
|
|
293
|
-
if (waiter.timer !== void 0) clearTimeout(waiter.timer);
|
|
294
|
-
const diag = {
|
|
295
|
-
flushVersion: this.flushVersion,
|
|
296
|
-
queueLen: this.getPendingTaskCount(),
|
|
297
|
-
running: this.running,
|
|
298
|
-
inHandler: this.inHandler,
|
|
299
|
-
bulk: this.isBulkCommitActive()
|
|
300
|
-
};
|
|
301
|
-
reject(/* @__PURE__ */ new Error(`waitForFlush timeout ${timeoutMs}ms: ${JSON.stringify(diag)}`));
|
|
302
|
-
}, timeoutMs);
|
|
303
|
-
this.waiters.push(waiter);
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
getState() {
|
|
307
|
-
return {
|
|
308
|
-
queueLength: this.getPendingTaskCount(),
|
|
309
|
-
running: this.running,
|
|
310
|
-
depth: this.depth,
|
|
311
|
-
executionDepth: this.executionDepth,
|
|
312
|
-
taskCount: this.taskCount,
|
|
313
|
-
flushVersion: this.flushVersion,
|
|
314
|
-
laneQueues: {
|
|
315
|
-
derived: this.lanes.derived.tasks.length - this.lanes.derived.head,
|
|
316
|
-
component: this.lanes.component.tasks.length - this.lanes.component.head,
|
|
317
|
-
reactive: this.lanes.reactive.tasks.length - this.lanes.reactive.head,
|
|
318
|
-
post: this.lanes.post.tasks.length - this.lanes.post.head
|
|
319
|
-
},
|
|
320
|
-
inHandler: this.inHandler,
|
|
321
|
-
allowSyncProgress: this.allowSyncProgress
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
getFlushVersion() {
|
|
325
|
-
return this.flushVersion;
|
|
326
|
-
}
|
|
327
|
-
flushIfQueued() {
|
|
328
|
-
if (!this.running && this.hasPendingTasks()) this.flush();
|
|
329
|
-
}
|
|
330
|
-
runInHandlerScope(fn, flushMode = "defer") {
|
|
331
|
-
const prevInHandler = this.inHandler;
|
|
332
|
-
this.inHandler = true;
|
|
333
|
-
try {
|
|
334
|
-
return fn();
|
|
335
|
-
} finally {
|
|
336
|
-
this.inHandler = prevInHandler;
|
|
337
|
-
if (!this.inHandler) {
|
|
338
|
-
if (flushMode === "sync") this.flushIfQueued();
|
|
339
|
-
else this.scheduleFlushKick();
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
setInHandler(v) {
|
|
344
|
-
this.inHandler = v;
|
|
345
|
-
if (!v) this.scheduleFlushKick();
|
|
346
|
-
}
|
|
347
|
-
isInHandler() {
|
|
348
|
-
return this.inHandler;
|
|
349
|
-
}
|
|
350
|
-
isExecuting() {
|
|
351
|
-
return this.running || this.executionDepth > 0;
|
|
352
|
-
}
|
|
353
|
-
clearPendingSyncTasks() {
|
|
354
|
-
const remaining = this.getPendingTaskCount();
|
|
355
|
-
if (remaining <= 0) return 0;
|
|
356
|
-
if (this.running) {
|
|
357
|
-
for (const lane of SCHEDULER_LANES) {
|
|
358
|
-
const queue = this.lanes[lane];
|
|
359
|
-
queue.tasks.length = queue.head;
|
|
360
|
-
}
|
|
361
|
-
this.taskCount = Math.max(0, this.taskCount - remaining);
|
|
362
|
-
queueMicrotask(() => {
|
|
363
|
-
try {
|
|
364
|
-
this.flushVersion++;
|
|
365
|
-
this.resolveWaiters();
|
|
366
|
-
} catch (e) {}
|
|
367
|
-
});
|
|
368
|
-
return remaining;
|
|
369
|
-
}
|
|
370
|
-
for (const lane of SCHEDULER_LANES) {
|
|
371
|
-
const queue = this.lanes[lane];
|
|
372
|
-
queue.tasks.length = 0;
|
|
373
|
-
queue.head = 0;
|
|
374
|
-
}
|
|
375
|
-
this.taskCount = Math.max(0, this.taskCount - remaining);
|
|
376
|
-
this.flushVersion++;
|
|
377
|
-
this.resolveWaiters();
|
|
378
|
-
return remaining;
|
|
379
|
-
}
|
|
380
|
-
resolveWaiters() {
|
|
381
|
-
if (this.waiters.length === 0) return;
|
|
382
|
-
const ready = [];
|
|
383
|
-
const remaining = [];
|
|
384
|
-
for (const w of this.waiters) if (this.flushVersion >= w.target) {
|
|
385
|
-
if (w.timer !== void 0) clearTimeout(w.timer);
|
|
386
|
-
ready.push(w.resolve);
|
|
387
|
-
} else remaining.push(w);
|
|
388
|
-
this.waiters = remaining;
|
|
389
|
-
for (const r of ready) r();
|
|
390
|
-
}
|
|
391
|
-
};
|
|
392
|
-
const globalScheduler = new Scheduler();
|
|
393
|
-
function scheduleEventHandler(handler) {
|
|
394
|
-
return (event) => {
|
|
395
|
-
try {
|
|
396
|
-
globalScheduler.runInHandlerScope(() => {
|
|
397
|
-
handler.call(null, event);
|
|
398
|
-
});
|
|
399
|
-
} catch (error) {
|
|
400
|
-
logger.error("[Askr] Event handler error:", error);
|
|
401
|
-
}
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
//#endregion
|
|
405
|
-
//#region src/runtime/runtime.ts
|
|
406
|
-
function createMissingRendererHost() {
|
|
407
|
-
const missing = (method) => {
|
|
408
|
-
throw new Error(`[Askr] renderer host is not configured; cannot call ${method}().`);
|
|
409
|
-
};
|
|
410
|
-
return {
|
|
411
|
-
evaluate() {
|
|
412
|
-
missing("evaluate");
|
|
413
|
-
},
|
|
414
|
-
cleanupInstancesUnder() {
|
|
415
|
-
missing("cleanupInstancesUnder");
|
|
416
|
-
},
|
|
417
|
-
replaceComponentRange() {
|
|
418
|
-
return missing("replaceComponentRange");
|
|
419
|
-
},
|
|
420
|
-
teardownNodeSubtree() {
|
|
421
|
-
missing("teardownNodeSubtree");
|
|
422
|
-
},
|
|
423
|
-
populateKeyMapForElement() {},
|
|
424
|
-
getKeyMapForElement() {},
|
|
425
|
-
isKeyedReorderFastPathEligible() {
|
|
426
|
-
return {
|
|
427
|
-
useFastPath: false,
|
|
428
|
-
totalKeyed: 0,
|
|
429
|
-
totalChildren: 0,
|
|
430
|
-
currentKeyCount: 0,
|
|
431
|
-
moveCount: 0,
|
|
432
|
-
lisLen: 0,
|
|
433
|
-
hasPropChanges: false,
|
|
434
|
-
isWholeKeyedList: false
|
|
435
|
-
};
|
|
436
|
-
},
|
|
437
|
-
markReactivePropsDirtySource() {}
|
|
438
|
-
};
|
|
439
|
-
}
|
|
440
|
-
/** A scheduler + renderer host pairing; owns scheduling and renderer wiring for an app instance. */
|
|
441
|
-
var AskrRuntime = class {
|
|
442
|
-
constructor(options = {}) {
|
|
443
|
-
this.scheduler = options.scheduler ?? globalScheduler;
|
|
444
|
-
this.rendererHost = options.renderer ?? createMissingRendererHost();
|
|
445
|
-
}
|
|
446
|
-
get renderer() {
|
|
447
|
-
return this.rendererHost;
|
|
448
|
-
}
|
|
449
|
-
configureRenderer(renderer) {
|
|
450
|
-
this.rendererHost = renderer;
|
|
451
|
-
}
|
|
452
|
-
};
|
|
453
|
-
const defaultRuntime = new AskrRuntime({ scheduler: globalScheduler });
|
|
454
|
-
/** Create a new {@link AskrRuntime} instance with its own scheduler/renderer wiring. */
|
|
455
|
-
function createRuntime(options = {}) {
|
|
456
|
-
return new AskrRuntime(options);
|
|
457
|
-
}
|
|
458
|
-
/** Get the process-wide default {@link AskrRuntime}. */
|
|
459
|
-
function getDefaultRuntime() {
|
|
460
|
-
return defaultRuntime;
|
|
461
|
-
}
|
|
462
|
-
function configureRuntimeRenderer(renderer, runtime = defaultRuntime) {
|
|
463
|
-
runtime.configureRenderer(renderer);
|
|
464
|
-
}
|
|
465
|
-
//#endregion
|
|
466
|
-
//#region src/runtime/access.ts
|
|
467
|
-
function getRuntimeScheduler() {
|
|
468
|
-
return getDefaultRuntime().scheduler;
|
|
469
|
-
}
|
|
470
|
-
function getDefaultRuntimeInstance() {
|
|
471
|
-
return getDefaultRuntime();
|
|
472
|
-
}
|
|
473
|
-
function getRuntimeRenderer() {
|
|
474
|
-
return getDefaultRuntime().renderer;
|
|
475
|
-
}
|
|
476
|
-
function enqueueRuntimeTask(task) {
|
|
477
|
-
getRuntimeScheduler().enqueue(task);
|
|
478
|
-
}
|
|
479
|
-
function enqueueRuntimeLane(lane, task) {
|
|
480
|
-
getRuntimeScheduler().enqueueInLane(lane, task);
|
|
481
|
-
}
|
|
482
|
-
function runRuntimeHandlerScope(fn, flushMode = "defer") {
|
|
483
|
-
const savedScope = clearCurrentComponentScope();
|
|
484
|
-
try {
|
|
485
|
-
return getRuntimeScheduler().runInHandlerScope(fn, flushMode);
|
|
486
|
-
} finally {
|
|
487
|
-
restoreCurrentComponentScope(savedScope);
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
function runRuntimeWithSyncProgress(fn) {
|
|
491
|
-
return getRuntimeScheduler().runWithSyncProgress(fn);
|
|
492
|
-
}
|
|
493
|
-
function isRuntimeSchedulerExecuting() {
|
|
494
|
-
return getRuntimeScheduler().isExecuting();
|
|
495
|
-
}
|
|
496
|
-
function getRuntimeFlushVersion() {
|
|
497
|
-
return getRuntimeScheduler().getFlushVersion();
|
|
498
|
-
}
|
|
499
|
-
function flushRuntimeScheduler() {
|
|
500
|
-
getRuntimeScheduler().flush();
|
|
501
|
-
}
|
|
502
|
-
function setRuntimeBulkCommitProbe(probe) {
|
|
503
|
-
getRuntimeScheduler().setBulkCommitProbe(probe);
|
|
504
|
-
}
|
|
505
|
-
function markRuntimeReactivePropsDirtySource(source) {
|
|
506
|
-
getRuntimeRenderer().markReactivePropsDirtySource(source);
|
|
507
|
-
}
|
|
508
|
-
//#endregion
|
|
509
|
-
export { isProductionEnvironment as S, addPerfDuration as _, getRuntimeFlushVersion as a, getRuntimeEnv as b, markRuntimeReactivePropsDirtySource as c, setRuntimeBulkCommitProbe as d, AskrRuntime as f, scheduleEventHandler as g, getDefaultRuntime as h, getDefaultRuntimeInstance as i, runRuntimeHandlerScope as l, createRuntime as m, enqueueRuntimeTask as n, getRuntimeRenderer as o, configureRuntimeRenderer as p, flushRuntimeScheduler as r, isRuntimeSchedulerExecuting as s, enqueueRuntimeLane as t, runRuntimeWithSyncProgress as u, incrementPerfMetric as v, isDevelopmentEnvironment as x, logger as y };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { $t as RouteSnapshot, zt as RouteParams } from "./index-Dgjbo2gU.js";
|
|
2
|
-
//#region src/router/activity.d.ts
|
|
3
|
-
/** Options for {@link onRouteChange}. */
|
|
4
|
-
interface RouteChangeOptions {
|
|
5
|
-
immediate?: boolean;
|
|
6
|
-
}
|
|
7
|
-
/** Optional cleanup returned by an {@link onRouteChange} callback, run before the next change. */
|
|
8
|
-
type RouteChangeCleanup = void | (() => void);
|
|
9
|
-
/** Register a callback to run whenever the active route changes, with optional cleanup. */
|
|
10
|
-
declare function onRouteChange(fn: (current: RouteSnapshot, previous: RouteSnapshot | null) => RouteChangeCleanup, options?: RouteChangeOptions): void;
|
|
11
|
-
/** Read the currently active route's {@link RouteSnapshot}; reactive during component render. */
|
|
12
|
-
declare function currentRoute<TParams extends RouteParams = RouteParams, TState = unknown>(): RouteSnapshot<TParams, TState>;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { onRouteChange as i, RouteChangeOptions as n, currentRoute as r, RouteChangeCleanup as t };
|
package/dist/benchmark.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import "./jsx-runtime-Cg7GqY1S.js";
|
|
2
|
-
//#region src/bench/components/benchmark-row.d.ts
|
|
3
|
-
interface BenchmarkRowData {
|
|
4
|
-
id: number;
|
|
5
|
-
label: string;
|
|
6
|
-
}
|
|
7
|
-
//#endregion
|
|
8
|
-
//#region src/bench/benchmark-entry.d.ts
|
|
9
|
-
type RowData = BenchmarkRowData;
|
|
10
|
-
interface BenchmarkMetadata {
|
|
11
|
-
packageName: string;
|
|
12
|
-
packageVersion: string;
|
|
13
|
-
buildLabel: string;
|
|
14
|
-
}
|
|
15
|
-
declare const benchmarkMetadata: BenchmarkMetadata;
|
|
16
|
-
declare function getBenchmarkMetadata(): BenchmarkMetadata;
|
|
17
|
-
declare function mountBenchmark(root: Element, initialRows?: RowData[]): {
|
|
18
|
-
setRows(rows: RowData[]): void;
|
|
19
|
-
setSelected(id: number | null): void;
|
|
20
|
-
cleanup(): void;
|
|
21
|
-
};
|
|
22
|
-
declare const _default: {
|
|
23
|
-
mountBenchmark: typeof mountBenchmark;
|
|
24
|
-
};
|
|
25
|
-
//#endregion
|
|
26
|
-
export { BenchmarkMetadata, benchmarkMetadata, _default as default, getBenchmarkMetadata, mountBenchmark };
|