@askrjs/askr 0.3.0 → 0.4.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 +874 -0
- package/README.md +61 -29
- package/capabilities.json +19 -9
- package/dist/actions/index.js +56 -12
- package/dist/benchmark.js +10 -15
- package/dist/boot/index.d.ts +3 -2
- package/dist/boot/index.js +1 -1
- package/dist/boot-DaoTYoCw.js +3989 -0
- package/dist/browser-activity-CB8e-V4f.js +220 -0
- package/dist/components/index.d.ts +8 -1
- package/dist/components/index.js +1 -43
- package/dist/{aria-hKjThHcp.js → compose-ref-DWzdbxsD.js} +41 -4
- package/dist/control/index.d.ts +2 -0
- package/dist/control/index.js +1 -1
- package/dist/control-nfpT2fbK.js +209 -0
- package/dist/core.d.ts +5 -9
- package/dist/csp-nonce-DwGw1A6Q.js +35 -0
- package/dist/data/index.js +3 -3
- package/dist/{data-2edW0jhF.js → data-BCwClJiF.js} +283 -94
- package/dist/data-runtime-C1bFAlba.js +242 -0
- package/dist/{deferred-CbgNhf67.js → deferred-bEEHHvic.js} +42 -20
- package/dist/domains/actions.d.ts +8 -3
- package/dist/domains/component.d.ts +1 -107
- package/dist/domains/context.d.ts +0 -15
- package/dist/domains/control.d.ts +36 -249
- package/dist/domains/data.d.ts +31 -13
- package/dist/domains/diagnostics.d.ts +1 -2
- package/dist/domains/lifecycle.d.ts +2 -5
- package/dist/domains/refs.d.ts +0 -2
- package/dist/domains/routing.d.ts +43 -8
- package/dist/domains/scheduler.d.ts +1 -76
- package/dist/domains/server.d.ts +5 -2
- package/dist/domains/state.d.ts +2 -5
- package/dist/domains/telemetry.d.ts +0 -2
- package/dist/elements.d.ts +214 -51
- package/dist/error-boundary-Bpwofwps.js +293 -0
- package/dist/foundations/icon/index.d.ts +0 -58
- package/dist/foundations/icon/index.js +2 -2
- package/dist/foundations/index.js +2 -1
- package/dist/foundations/interactions/index.js +1 -1
- package/dist/foundations/state/index.d.ts +3 -3
- package/dist/foundations/state/index.js +5 -3
- package/dist/foundations/structures/index.js +2 -1
- package/dist/foundations/utilities/index.d.ts +2 -0
- package/dist/foundations/utilities/index.js +1 -2
- package/dist/fx/index.d.ts +31 -58
- package/dist/fx/index.js +313 -195
- package/dist/hooks-BimKStr4.js +202 -0
- package/dist/index.d.ts +11 -74
- package/dist/index.js +8 -447
- package/dist/instance-BAnfmXOR.js +988 -0
- package/dist/{interactions-CTeACdT_.js → interactions-D2BoREb-.js} +3 -2
- package/dist/jsx-dev-runtime.d.ts +41 -18
- package/dist/jsx-dev-runtime.js +1 -6
- package/dist/{jsx-runtime-CPJXAOBF.js → jsx-runtime-C4idqHY0.js} +18 -7
- package/dist/jsx-runtime.js +1 -1
- package/dist/jsx.d.ts +61 -37
- package/dist/{manifest-D1P3UNWV.js → manifest-CW9gyNBY.js} +3 -3
- package/dist/{navigate-prC5V8XV.js → navigate-CP_0Zy5U.js} +454 -87
- package/dist/navigation.d.ts +12 -3
- package/dist/peer-types.d.ts +8 -0
- package/dist/portal-DuOKfnLa.js +349 -0
- package/dist/promise-Dz8iIHAm.js +16 -0
- package/dist/query-registry-WMCN0BJL.js +320 -0
- package/dist/readable-DFWOsTac.js +21 -0
- package/dist/{render-context-B7ohlh6t.js → render-context-DGHnEveC.js} +27 -11
- package/dist/render-sync-IC5lMFpq.js +1240 -0
- package/dist/resolution-Cx82-xjW.js +1244 -0
- package/dist/resource-CLjB7RBQ.js +377 -0
- package/dist/resources/index.d.ts +21 -11
- package/dist/resources/index.js +45 -244
- package/dist/router/index.d.ts +14 -5
- package/dist/router/index.js +22 -53
- package/dist/scope-CwpVSHVf.js +55 -0
- package/dist/{shared-kU8yvryp.js → shared-O2ZnmYAf.js} +1 -7
- package/dist/{snapshot-source-An4iKajG.js → snapshot-Cjx4N988.js} +6 -1
- package/dist/ssg/index.d.ts +1 -2
- package/dist/ssg/index.js +5 -13
- package/dist/ssr/index.d.ts +26 -28
- package/dist/ssr/index.js +4 -4
- package/dist/{ssr-CiNm6Vzl.js → ssr-BJ8ug7zH.js} +133 -122
- package/dist/ssr-DoV-vJ-5.js +229 -0
- package/dist/state-DWO1KzkX.js +232 -0
- package/dist/structures-D4dDMqHX.js +231 -0
- package/dist/testing/index.d.ts +8 -4
- package/dist/testing/index.js +29 -34
- package/dist/url-CnbfpX0K.js +185 -0
- package/dist/utilities.d.ts +48 -2
- package/dist/verify-hydration-DpVaDnqz.js +152 -0
- package/package.json +19 -9
- package/dist/access-CEA2pOry.js +0 -1046
- package/dist/activity-oy2YFTFF.js +0 -201
- package/dist/boot-BMBMWUGI.js +0 -1084
- package/dist/capabilities-Bbf0mlp9.js +0 -42
- package/dist/compose-ref-v0qGlHoN.js +0 -26
- package/dist/control-BR_mrX__.js +0 -173
- package/dist/control-C-ApnFs1.js +0 -20
- package/dist/csp-nonce-BfFWcd0w.js +0 -173
- package/dist/data-runtime-CxoY98lX.js +0 -149
- package/dist/default-portal-runtime-DvMvWJVp.js +0 -20
- package/dist/dom-renderer.d.ts +0 -77
- package/dist/domains/renderer.d.ts +0 -127
- package/dist/eager-control.d.ts +0 -8
- package/dist/effect-C3Zsc1k6.js +0 -292
- package/dist/for-state-BDykeOJL.js +0 -1753
- package/dist/instance-VAFYVJOa.js +0 -1027
- package/dist/notify-DxxuDPeY.js +0 -266
- package/dist/portal-w3oQ6oQU.js +0 -29
- package/dist/query-registry-LrYpQsDJ.js +0 -83
- package/dist/render-resolved-BC0W7_5b.js +0 -1123
- package/dist/renderer-CT0HeY58.js +0 -8623
- package/dist/resolution-3DskUkjG.js +0 -577
- package/dist/resource-18-sFRl9.js +0 -344
- package/dist/route-matching-CUzZ31gT.js +0 -551
- package/dist/router-internal-7nuNEHfG.js +0 -36
- package/dist/scope-Cq_iYbTR.js +0 -403
- package/dist/selector-BSPVkjKP.js +0 -311
- package/dist/ssr-EPjwJH5R.js +0 -29
- package/dist/state-BXJfudq1.js +0 -91
- package/dist/structures-CjEzfj4h.js +0 -654
- package/dist/timer-C7uqnJVt.js +0 -85
- package/dist/verify-hydration-ikaxotf7.js +0 -27
- package/dist/vnode-D24p6IW2.js +0 -7
package/dist/index.js
CHANGED
|
@@ -1,454 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { C as teardownScopeHost, D as captureOwnerRange, E as recordInlineComponentHost, O as releaseOwnerRange, S as resolveScopeBoundary, T as isComponentHostDetached, _ as captureChildScopeHost, b as prepareScopeRemoval, m as applyComponentResult, p as classifyUpdate, r as ensureNativeDOMHost, t as createRendererCapabilities, v as clearChildScopeHost, w as detachPortalHostOutput, x as recordRemovedScopeBoundary, y as hasUnmountedComponentHost } from "./renderer-CT0HeY58.js";
|
|
4
|
-
import { O as ownCleanup, T as getOwnedChildScopes, f as getCurrentComponentInstance, h as getSignal, i as claimHookIndex, j as setOwnedChildScopes, x as componentRecordPrototype, y as OwnershipRecord } from "./scope-Cq_iYbTR.js";
|
|
5
|
-
import { b as syncDerivedDependencySubscriptions, h as clearDerivedDependencySubscriptions, t as notifyReadableSource, v as recordReadableRead, x as withDerivedReadTracking } from "./notify-DxxuDPeY.js";
|
|
1
|
+
import { P as configureRenderDiagnostics } from "./instance-BAnfmXOR.js";
|
|
2
|
+
import { a as state, i as selector, n as getSignal, t as derive } from "./state-DWO1KzkX.js";
|
|
6
3
|
import { n as Fragment } from "./jsx-DRS-qjiN.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { t as
|
|
10
|
-
import {
|
|
11
|
-
import { n as
|
|
12
|
-
import { i as For, n as Match, r as Show, t as Case } from "./control-BR_mrX__.js";
|
|
13
|
-
import { r as jsxs, t as jsx } from "./jsx-runtime-CPJXAOBF.js";
|
|
14
|
-
import { n as createQuery, t as createQueryCollection } from "./data-2edW0jhF.js";
|
|
15
|
-
import { a as hydrateDataRuntime, i as dehydrateDataRuntime, n as defineQuery, o as prefetchQuery, r as defineServerQueries, s as serveQuery } from "./query-registry-LrYpQsDJ.js";
|
|
16
|
-
//#region src/runtime/reactivity/derive.ts
|
|
17
|
-
const deriveCells = /* @__PURE__ */ new WeakMap();
|
|
18
|
-
const dirtyDerivedCells = /* @__PURE__ */ new Set();
|
|
19
|
-
const derivedWork = new ScheduledWork(flushDirtyDerivedCells);
|
|
20
|
-
function getDeriveStore(instance) {
|
|
21
|
-
const generation = instance.owner.identity;
|
|
22
|
-
let store = deriveCells.get(generation);
|
|
23
|
-
if (!store) {
|
|
24
|
-
store = /* @__PURE__ */ new Map();
|
|
25
|
-
deriveCells.set(generation, store);
|
|
26
|
-
}
|
|
27
|
-
return store;
|
|
28
|
-
}
|
|
29
|
-
function markDerivedCellDirty(cell) {
|
|
30
|
-
cell._dirty = true;
|
|
31
|
-
if (!cell._pending) {
|
|
32
|
-
cell._pending = true;
|
|
33
|
-
dirtyDerivedCells.add(cell);
|
|
34
|
-
}
|
|
35
|
-
requestRuntimeWork("derived", derivedWork);
|
|
36
|
-
}
|
|
37
|
-
function flushDirtyDerivedCells() {
|
|
38
|
-
if (dirtyDerivedCells.size === 0) return;
|
|
39
|
-
const pending = dirtyDerivedCells.values();
|
|
40
|
-
let failures = null;
|
|
41
|
-
let next = pending.next();
|
|
42
|
-
while (!next.done) {
|
|
43
|
-
const cell = next.value;
|
|
44
|
-
dirtyDerivedCells.delete(cell);
|
|
45
|
-
cell._pending = false;
|
|
46
|
-
if (!cell._dirty) {
|
|
47
|
-
next = pending.next();
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
try {
|
|
51
|
-
recomputeDerivedCell(cell, true);
|
|
52
|
-
} catch (error) {
|
|
53
|
-
(failures ??= []).push(error);
|
|
54
|
-
}
|
|
55
|
-
next = pending.next();
|
|
56
|
-
}
|
|
57
|
-
if (failures?.length === 1) throw failures[0];
|
|
58
|
-
if (failures && failures.length > 1) throw new AggregateError(failures, "derive() recompute failures");
|
|
59
|
-
}
|
|
60
|
-
function recomputeDerivedCell(cell, notifyDownstream) {
|
|
61
|
-
if (cell._evaluating) throw new Error("derive() cannot read itself recursively");
|
|
62
|
-
if (!cell._dirty && cell._hasValue) return cell._value;
|
|
63
|
-
cell._evaluating = true;
|
|
64
|
-
cell._dirty = false;
|
|
65
|
-
cell._pendingDependencySources = /* @__PURE__ */ new Set();
|
|
66
|
-
const prevSources = cell._sources;
|
|
67
|
-
let nextValue;
|
|
68
|
-
try {
|
|
69
|
-
nextValue = withDerivedReadTracking(cell, cell._compute);
|
|
70
|
-
} catch (error) {
|
|
71
|
-
cell._dirty = true;
|
|
72
|
-
cell._pendingDependencySources = void 0;
|
|
73
|
-
throw error;
|
|
74
|
-
} finally {
|
|
75
|
-
cell._evaluating = false;
|
|
76
|
-
}
|
|
77
|
-
const nextSources = cell._pendingDependencySources ?? /* @__PURE__ */ new Set();
|
|
78
|
-
cell._pendingDependencySources = void 0;
|
|
79
|
-
syncDerivedDependencySubscriptions(cell, prevSources, nextSources);
|
|
80
|
-
cell._sources = nextSources;
|
|
81
|
-
const valueChanged = !cell._hasValue || !Object.is(cell._value, nextValue);
|
|
82
|
-
cell._hasValue = true;
|
|
83
|
-
cell._value = nextValue;
|
|
84
|
-
cell._lastRecomputeFlushVersion = getRuntimeFlushVersion();
|
|
85
|
-
if (valueChanged && notifyDownstream) notifyReadableSource(cell, { skipCurrentDerivedSubscriber: true });
|
|
86
|
-
return cell._value;
|
|
87
|
-
}
|
|
88
|
-
function createDerivedCell(instance, generation, store, hookIndex, compute) {
|
|
89
|
-
const cell = function derivedGetter() {
|
|
90
|
-
const derivedCell = cell;
|
|
91
|
-
if (!derivedCell._active) {
|
|
92
|
-
if (!derivedCell._hasValue) throw new Error("[Askr] derive() was disposed before producing a value.");
|
|
93
|
-
return derivedCell._value;
|
|
94
|
-
}
|
|
95
|
-
recordReadableRead(derivedCell);
|
|
96
|
-
return recomputeDerivedCell(derivedCell, derivedCell._pending);
|
|
97
|
-
};
|
|
98
|
-
cell._owner = instance;
|
|
99
|
-
cell._hookIndex = hookIndex;
|
|
100
|
-
cell._compute = compute;
|
|
101
|
-
cell._value = void 0;
|
|
102
|
-
cell._hasValue = false;
|
|
103
|
-
cell._dirty = true;
|
|
104
|
-
cell._pending = false;
|
|
105
|
-
cell._evaluating = false;
|
|
106
|
-
cell._active = true;
|
|
107
|
-
cell._lastRecomputeFlushVersion = -1;
|
|
108
|
-
cell._sources = /* @__PURE__ */ new Set();
|
|
109
|
-
cell._markDirty = () => {
|
|
110
|
-
markDerivedCellDirty(cell);
|
|
111
|
-
};
|
|
112
|
-
cell._cleanup = () => {
|
|
113
|
-
if (!cell._active) return;
|
|
114
|
-
cell._active = false;
|
|
115
|
-
cell._pending = false;
|
|
116
|
-
cell._dirty = false;
|
|
117
|
-
cell._pendingDependencySources = void 0;
|
|
118
|
-
dirtyDerivedCells.delete(cell);
|
|
119
|
-
clearDerivedDependencySubscriptions(cell, cell._sources);
|
|
120
|
-
cell._derivedSubscribers?.clear();
|
|
121
|
-
cell._readers?.size;
|
|
122
|
-
cell._readers?.clear();
|
|
123
|
-
};
|
|
124
|
-
ownCleanup(instance.owner, () => {
|
|
125
|
-
try {
|
|
126
|
-
cell._cleanup();
|
|
127
|
-
} finally {
|
|
128
|
-
store.delete(hookIndex);
|
|
129
|
-
if (store.size === 0 && deriveCells.get(generation) === store) deriveCells.delete(generation);
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
return cell;
|
|
133
|
-
}
|
|
134
|
-
function getOrCreateDerivedCell(instance, hookIndex, compute) {
|
|
135
|
-
const store = getDeriveStore(instance);
|
|
136
|
-
const existing = store.get(hookIndex);
|
|
137
|
-
if (existing) {
|
|
138
|
-
existing._compute = compute;
|
|
139
|
-
if (existing._lastRecomputeFlushVersion !== getRuntimeFlushVersion()) existing._dirty = true;
|
|
140
|
-
return existing;
|
|
141
|
-
}
|
|
142
|
-
const created = createDerivedCell(instance, instance.owner.identity, store, hookIndex, compute);
|
|
143
|
-
store.set(hookIndex, created);
|
|
144
|
-
return created;
|
|
145
|
-
}
|
|
146
|
-
function createMappedSelector(source, map) {
|
|
147
|
-
return () => {
|
|
148
|
-
let value;
|
|
149
|
-
if (typeof source === "function") value = source();
|
|
150
|
-
else if (isSnapshotSource(source)) {
|
|
151
|
-
const snapshot = source;
|
|
152
|
-
if (snapshot.pending) return null;
|
|
153
|
-
value = snapshot.value;
|
|
154
|
-
} else value = source;
|
|
155
|
-
if (value == null) return null;
|
|
156
|
-
return map(value);
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
function derive(source, map) {
|
|
160
|
-
const instance = getCurrentComponentInstance();
|
|
161
|
-
if (!instance) throw new Error("derive() can only be called during component render execution. Move derive() calls to the top level of your component function.");
|
|
162
|
-
const cell = getOrCreateDerivedCell(instance, claimHookIndex(instance, "derive"), map === void 0 ? () => source() : createMappedSelector(source, map));
|
|
163
|
-
recomputeDerivedCell(cell, false);
|
|
164
|
-
return cell;
|
|
165
|
-
}
|
|
166
|
-
//#endregion
|
|
167
|
-
//#region src/runtime/public-ownership.ts
|
|
168
|
-
const fields = {
|
|
169
|
-
mounted: "mounted",
|
|
170
|
-
abortController: "controller",
|
|
171
|
-
cleanupFns: "cleanups",
|
|
172
|
-
_lastReadSources: "reads",
|
|
173
|
-
_ownershipGeneration: "identity"
|
|
174
|
-
};
|
|
175
|
-
const descriptors = {};
|
|
176
|
-
for (const [field, member] of Object.entries(fields)) descriptors[field] = {
|
|
177
|
-
enumerable: true,
|
|
178
|
-
configurable: true,
|
|
179
|
-
get() {
|
|
180
|
-
return this.owner[member];
|
|
181
|
-
},
|
|
182
|
-
set(value) {
|
|
183
|
-
this.owner[member] = value;
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
descriptors._ownedChildScopes = {
|
|
187
|
-
enumerable: true,
|
|
188
|
-
configurable: true,
|
|
189
|
-
get() {
|
|
190
|
-
return getOwnedChildScopes(this.owner);
|
|
191
|
-
},
|
|
192
|
-
set(scopes) {
|
|
193
|
-
setOwnedChildScopes(this.owner, scopes);
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
let ownershipViewsInstalled = false;
|
|
197
|
-
/**
|
|
198
|
-
* Publish the legacy ownership property views onto the execution record.
|
|
199
|
-
*
|
|
200
|
-
* Called at module scope from the published entry barrels: an entry barrel
|
|
201
|
-
* exists to compose the surface a consumer imports, so wiring there is the
|
|
202
|
-
* composition root rather than accidental import-order coupling. It latches so
|
|
203
|
-
* that importing several entries, or adapting a renderer host afterwards,
|
|
204
|
-
* redefines nothing.
|
|
205
|
-
*/
|
|
206
|
-
function installOwnershipViews() {
|
|
207
|
-
if (ownershipViewsInstalled) return;
|
|
208
|
-
ownershipViewsInstalled = true;
|
|
209
|
-
Object.defineProperties(componentRecordPrototype, descriptors);
|
|
210
|
-
}
|
|
211
|
-
const exposed = /* @__PURE__ */ new WeakSet();
|
|
212
|
-
/** Preserve the object identity used by host callbacks and readable maps.
|
|
213
|
-
* Legacy properties are views of the same record, never copied lifetime state. */
|
|
214
|
-
function componentView(instance) {
|
|
215
|
-
if (!exposed.has(instance)) {
|
|
216
|
-
Object.defineProperties(instance, descriptors);
|
|
217
|
-
exposed.add(instance);
|
|
218
|
-
}
|
|
219
|
-
return instance;
|
|
220
|
-
}
|
|
221
|
-
/** Adopt a consumer-created extension record in place, preserving identity. */
|
|
222
|
-
function executionRecord(instance) {
|
|
223
|
-
const record = instance;
|
|
224
|
-
if (!record.owner) {
|
|
225
|
-
const owner = new OwnershipRecord();
|
|
226
|
-
owner.mounted = instance.mounted;
|
|
227
|
-
owner.controller = instance.abortController;
|
|
228
|
-
owner.cleanups = instance.cleanupFns;
|
|
229
|
-
setOwnedChildScopes(owner, instance._ownedChildScopes);
|
|
230
|
-
owner.reads = instance._lastReadSources;
|
|
231
|
-
owner.identity = instance._ownershipGeneration;
|
|
232
|
-
record.owner = owner;
|
|
233
|
-
bindComponentOwnership(record);
|
|
234
|
-
componentView(record);
|
|
235
|
-
}
|
|
236
|
-
return record;
|
|
237
|
-
}
|
|
238
|
-
//#endregion
|
|
239
|
-
//#region src/renderer/host-adapter.ts
|
|
240
|
-
const nativeHosts = /* @__PURE__ */ new WeakMap();
|
|
241
|
-
/** Only extension hosts pay for callback translation. Keep their receiver and
|
|
242
|
-
* look up methods at invocation time so later host mutation stays observable. */
|
|
243
|
-
function adaptRendererHost(host) {
|
|
244
|
-
installOwnershipViews();
|
|
245
|
-
const native = nativeHosts.get(host);
|
|
246
|
-
if (native) return native;
|
|
247
|
-
return {
|
|
248
|
-
captureComponentHost: captureOwnerRange,
|
|
249
|
-
releaseComponentHost: releaseOwnerRange,
|
|
250
|
-
detachPortalHostOutput,
|
|
251
|
-
isComponentHostDetached,
|
|
252
|
-
clearChildScopeHost,
|
|
253
|
-
captureChildScopeHost,
|
|
254
|
-
resolveScopeBoundary,
|
|
255
|
-
prepareScopeRemoval,
|
|
256
|
-
recordRemovedScopeBoundary,
|
|
257
|
-
teardownScopeHost,
|
|
258
|
-
hasUnmountedComponentHost,
|
|
259
|
-
recordInlineComponentHost,
|
|
260
|
-
applyComponentResult,
|
|
261
|
-
classifyComponentUpdate: classifyUpdate,
|
|
262
|
-
evaluate: (...args) => {
|
|
263
|
-
if (args[3]) componentView(args[3]);
|
|
264
|
-
return host.evaluate(...args);
|
|
265
|
-
},
|
|
266
|
-
cleanupInstancesUnder: (...args) => host.cleanupInstancesUnder(...args),
|
|
267
|
-
replaceComponentRange: (...args) => {
|
|
268
|
-
componentView(args[0]);
|
|
269
|
-
return host.replaceComponentRange(...args);
|
|
270
|
-
},
|
|
271
|
-
get resolveChildScopeRange() {
|
|
272
|
-
return host.resolveChildScopeRange ? (...args) => {
|
|
273
|
-
componentView(args[0].componentInstance);
|
|
274
|
-
return host.resolveChildScopeRange(...args);
|
|
275
|
-
} : void 0;
|
|
276
|
-
},
|
|
277
|
-
teardownNodeSubtree: (...args) => host.teardownNodeSubtree(...args),
|
|
278
|
-
populateKeyMapForElement: (...args) => host.populateKeyMapForElement(...args),
|
|
279
|
-
getKeyMapForElement: (...args) => host.getKeyMapForElement(...args),
|
|
280
|
-
isKeyedReorderFastPathEligible: (...args) => host.isKeyedReorderFastPathEligible(...args),
|
|
281
|
-
markReactivePropsDirtySource: (...args) => host.markReactivePropsDirtySource(...args)
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
/** Keep the native host's identity and writable properties. Only inbound
|
|
285
|
-
* extension records require adoption; ordinary owners are already authoritative. */
|
|
286
|
-
function rendererHostView(capabilities) {
|
|
287
|
-
installOwnershipViews();
|
|
288
|
-
const host = capabilities;
|
|
289
|
-
if (nativeHosts.has(host)) return host;
|
|
290
|
-
const evaluate = capabilities.evaluate;
|
|
291
|
-
capabilities.evaluate = function(...args) {
|
|
292
|
-
if (args[3] && !args[3].owner) executionRecord(args[3]);
|
|
293
|
-
return evaluate.apply(this, args);
|
|
294
|
-
};
|
|
295
|
-
const replace = capabilities.replaceComponentRange;
|
|
296
|
-
capabilities.replaceComponentRange = function(...args) {
|
|
297
|
-
if (!args[0].owner) executionRecord(args[0]);
|
|
298
|
-
return replace.apply(this, args);
|
|
299
|
-
};
|
|
300
|
-
const resolve = capabilities.resolveChildScopeRange;
|
|
301
|
-
if (resolve) capabilities.resolveChildScopeRange = function(...args) {
|
|
302
|
-
if (!args[0].componentInstance.owner) executionRecord(args[0].componentInstance);
|
|
303
|
-
return resolve.apply(this, args);
|
|
304
|
-
};
|
|
305
|
-
nativeHosts.set(host, capabilities);
|
|
306
|
-
return host;
|
|
307
|
-
}
|
|
308
|
-
//#endregion
|
|
309
|
-
//#region src/runtime/public-runtime.ts
|
|
310
|
-
const defaultRuntimeOptions = {};
|
|
311
|
-
/** Construction-only scheduler and renderer wiring. Mounting uses the default runtime. */
|
|
312
|
-
var AskrRuntime = class {
|
|
313
|
-
#rendererCapabilities;
|
|
314
|
-
#state;
|
|
315
|
-
constructor(options = {}) {
|
|
316
|
-
this.#state = options === defaultRuntimeOptions ? defaultRuntimeState : createRuntimeState(options.scheduler);
|
|
317
|
-
this.scheduler = this.#state.scheduler;
|
|
318
|
-
this.rendererHost = options.renderer ?? rendererHostView(this.#state.renderer);
|
|
319
|
-
this.#state.renderer = adaptRendererHost(this.rendererHost);
|
|
320
|
-
this.#rendererCapabilities = this.#state.renderer;
|
|
321
|
-
}
|
|
322
|
-
get renderer() {
|
|
323
|
-
if (this.#rendererCapabilities !== this.#state.renderer) {
|
|
324
|
-
this.#rendererCapabilities = this.#state.renderer;
|
|
325
|
-
this.rendererHost = rendererHostView(this.#rendererCapabilities);
|
|
326
|
-
}
|
|
327
|
-
return this.rendererHost;
|
|
328
|
-
}
|
|
329
|
-
configureRenderer(renderer) {
|
|
330
|
-
this.#state.renderer = adaptRendererHost(renderer);
|
|
331
|
-
this.#rendererCapabilities = this.#state.renderer;
|
|
332
|
-
this.rendererHost = renderer;
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
/** Create construction-only runtime wiring. Omitted schedulers share the default scheduler; mounting uses the default runtime. */
|
|
336
|
-
function createRuntime(options = {}) {
|
|
337
|
-
return new AskrRuntime(options);
|
|
338
|
-
}
|
|
339
|
-
const defaultRuntime = /* @__PURE__ */ new AskrRuntime(defaultRuntimeOptions);
|
|
340
|
-
/** Get the process-wide default {@link AskrRuntime}. */
|
|
341
|
-
function getDefaultRuntime() {
|
|
342
|
-
return defaultRuntime;
|
|
343
|
-
}
|
|
344
|
-
//#endregion
|
|
345
|
-
//#region src/renderer/public-dom-host.ts
|
|
346
|
-
function handles() {
|
|
347
|
-
const outward = /* @__PURE__ */ new WeakMap();
|
|
348
|
-
const inward = /* @__PURE__ */ new WeakMap();
|
|
349
|
-
return {
|
|
350
|
-
wrap(record) {
|
|
351
|
-
let handle = outward.get(record);
|
|
352
|
-
if (!handle) {
|
|
353
|
-
handle = Object.freeze({});
|
|
354
|
-
outward.set(record, handle);
|
|
355
|
-
inward.set(handle, record);
|
|
356
|
-
}
|
|
357
|
-
return handle;
|
|
358
|
-
},
|
|
359
|
-
unwrap(handle) {
|
|
360
|
-
const record = inward.get(handle);
|
|
361
|
-
if (!record) throw new TypeError("[Askr] Invalid DOM renderer handle.");
|
|
362
|
-
return record;
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
/** Construct a complete DOM adapter without installing it. Handles belong only
|
|
367
|
-
* to this factory; native delegates validate them before accessing the DOM. */
|
|
368
|
-
function createDOMRendererHost(configure) {
|
|
369
|
-
ensureNativeDOMHost();
|
|
370
|
-
const renderer = rendererHostView(createRendererCapabilities());
|
|
371
|
-
const owners = handles();
|
|
372
|
-
const scopes = handles();
|
|
373
|
-
const sources = handles();
|
|
374
|
-
const native = {
|
|
375
|
-
evaluation: {
|
|
376
|
-
evaluate(node, target, context, owner) {
|
|
377
|
-
renderer.evaluate(node, target, context, owner === void 0 ? void 0 : owners.unwrap(owner));
|
|
378
|
-
},
|
|
379
|
-
replaceComponentRange(owner, result, host) {
|
|
380
|
-
return renderer.replaceComponentRange(owners.unwrap(owner), result, host);
|
|
381
|
-
}
|
|
382
|
-
},
|
|
383
|
-
cleanup: {
|
|
384
|
-
cleanupInstancesUnder(node) {
|
|
385
|
-
renderer.cleanupInstancesUnder(node);
|
|
386
|
-
},
|
|
387
|
-
teardownNodeSubtree(node) {
|
|
388
|
-
renderer.teardownNodeSubtree(node);
|
|
389
|
-
}
|
|
390
|
-
},
|
|
391
|
-
scopes: { resolveChildScopeRange(scope) {
|
|
392
|
-
const range = renderer.resolveChildScopeRange(scopes.unwrap(scope));
|
|
393
|
-
return range ? Object.freeze({
|
|
394
|
-
start: range.start,
|
|
395
|
-
end: range.end,
|
|
396
|
-
single: range.single
|
|
397
|
-
}) : null;
|
|
398
|
-
} },
|
|
399
|
-
keys: {
|
|
400
|
-
populateKeyMapForElement(parent) {
|
|
401
|
-
renderer.populateKeyMapForElement(parent);
|
|
402
|
-
},
|
|
403
|
-
getKeyMapForElement(parent) {
|
|
404
|
-
return renderer.getKeyMapForElement(parent);
|
|
405
|
-
},
|
|
406
|
-
isKeyedReorderFastPathEligible(parent, children, oldKeyMap) {
|
|
407
|
-
return renderer.isKeyedReorderFastPathEligible(parent, children, oldKeyMap);
|
|
408
|
-
}
|
|
409
|
-
},
|
|
410
|
-
reactivity: { markReactivePropsDirtySource(source) {
|
|
411
|
-
renderer.markReactivePropsDirtySource(sources.unwrap(source));
|
|
412
|
-
} }
|
|
413
|
-
};
|
|
414
|
-
const required = Object.fromEntries(Object.entries(native).map(([role, methods]) => [role, Object.keys(methods)]));
|
|
415
|
-
const host = configure(native);
|
|
416
|
-
for (const role of Object.keys(required)) for (const method of required[role]) if (typeof (host?.[role])?.[method] !== "function") throw new TypeError(`[Askr] DOM renderer requires ${role}.${method}.`);
|
|
417
|
-
return {
|
|
418
|
-
evaluate(node, target, context, owner) {
|
|
419
|
-
host.evaluation.evaluate(node, target, context, owner === void 0 ? void 0 : owners.wrap(owner));
|
|
420
|
-
},
|
|
421
|
-
replaceComponentRange(owner, result, target) {
|
|
422
|
-
return host.evaluation.replaceComponentRange(owners.wrap(owner), result, target);
|
|
423
|
-
},
|
|
424
|
-
cleanupInstancesUnder(node) {
|
|
425
|
-
host.cleanup.cleanupInstancesUnder(node);
|
|
426
|
-
},
|
|
427
|
-
teardownNodeSubtree(node) {
|
|
428
|
-
host.cleanup.teardownNodeSubtree(node);
|
|
429
|
-
},
|
|
430
|
-
resolveChildScopeRange(scope) {
|
|
431
|
-
return host.scopes.resolveChildScopeRange(scopes.wrap(scope));
|
|
432
|
-
},
|
|
433
|
-
populateKeyMapForElement(parent) {
|
|
434
|
-
host.keys.populateKeyMapForElement(parent);
|
|
435
|
-
},
|
|
436
|
-
getKeyMapForElement(parent) {
|
|
437
|
-
return host.keys.getKeyMapForElement(parent);
|
|
438
|
-
},
|
|
439
|
-
isKeyedReorderFastPathEligible(parent, children, oldKeyMap) {
|
|
440
|
-
return host.keys.isKeyedReorderFastPathEligible(parent, children, oldKeyMap);
|
|
441
|
-
},
|
|
442
|
-
markReactivePropsDirtySource(source) {
|
|
443
|
-
host.reactivity.markReactivePropsDirtySource(sources.wrap(source));
|
|
444
|
-
}
|
|
445
|
-
};
|
|
446
|
-
}
|
|
447
|
-
//#endregion
|
|
4
|
+
import { _ as RenderDepthError } from "./hooks-BimKStr4.js";
|
|
5
|
+
import { r as readScope, t as defineScope } from "./scope-CwpVSHVf.js";
|
|
6
|
+
import { n as cspNonce, t as CspNonceScope } from "./csp-nonce-DwGw1A6Q.js";
|
|
7
|
+
import { l as registerSSRStyle } from "./render-context-DGHnEveC.js";
|
|
8
|
+
import { i as jsxs, n as jsx, t as createElement } from "./jsx-runtime-C4idqHY0.js";
|
|
448
9
|
//#region src/ref.ts
|
|
449
10
|
/** Create a new, empty {@link Ref} holder. */
|
|
450
11
|
function createRef() {
|
|
451
12
|
return { current: null };
|
|
452
13
|
}
|
|
453
14
|
//#endregion
|
|
454
|
-
export {
|
|
15
|
+
export { CspNonceScope, Fragment, RenderDepthError, configureRenderDiagnostics, createElement, createRef, cspNonce, defineScope, derive, getSignal, jsx, jsxs, readScope, registerSSRStyle, selector, state };
|