@askrjs/askr 0.2.4 → 0.3.1
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 +30 -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-DLplW9h4.js} +700 -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/testing/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { r as flushRuntimeScheduler } from "../access-
|
|
2
|
-
import {
|
|
3
|
-
import { l as addInvalidationListener, t as createDataRuntime } from "../data-runtime-
|
|
4
|
-
import { a as
|
|
5
|
-
import {
|
|
6
|
-
import { a as cleanupApp,
|
|
1
|
+
import { r as flushRuntimeScheduler } from "../access-CEA2pOry.js";
|
|
2
|
+
import { v as recordReadableRead } from "../notify-DxxuDPeY.js";
|
|
3
|
+
import { l as addInvalidationListener, t as createDataRuntime } from "../data-runtime-CxoY98lX.js";
|
|
4
|
+
import { a as loadingQueryState, i as freshQueryState, o as refreshingQueryState, r as errorQueryState, s as staleQueryState } from "../data-2edW0jhF.js";
|
|
5
|
+
import { a as normalizeAsyncDataError, o as notifySource, t as createReadableSource } from "../shared-kU8yvryp.js";
|
|
6
|
+
import { a as cleanupApp, n as createSPA, r as createIsland } from "../boot-DLplW9h4.js";
|
|
7
|
+
import { r as computeRouteActivityMatches } from "../route-matching-CUzZ31gT.js";
|
|
7
8
|
//#region src/testing/render.ts
|
|
8
9
|
const renderStates = /* @__PURE__ */ new WeakMap();
|
|
9
10
|
const eventConstructorNames = {
|
|
@@ -189,7 +190,7 @@ async function renderRoute(options) {
|
|
|
189
190
|
}
|
|
190
191
|
}
|
|
191
192
|
//#endregion
|
|
192
|
-
//#region src/testing/
|
|
193
|
+
//#region src/testing/interactions.ts
|
|
193
194
|
/** Dispatch the browser click sequence expected by Askr's delegated events. */
|
|
194
195
|
function click(element) {
|
|
195
196
|
if (!element || typeof element.dispatchEvent !== "function") throw new TypeError("@askrjs/askr/testing click requires an Element.");
|
|
@@ -211,6 +212,8 @@ function submit(form) {
|
|
|
211
212
|
if (!form || typeof form.dispatchEvent !== "function") throw new TypeError("@askrjs/askr/testing submit requires a form.");
|
|
212
213
|
return dispatch(form, "submit");
|
|
213
214
|
}
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/testing/registries.ts
|
|
214
217
|
/** Create a keyed query fixture registry for a test render runtime. */
|
|
215
218
|
function createQueryTestRegistry() {
|
|
216
219
|
const runtime = createDataRuntime();
|
|
@@ -249,6 +252,8 @@ function createMutationTestRegistry() {
|
|
|
249
252
|
}
|
|
250
253
|
};
|
|
251
254
|
}
|
|
255
|
+
//#endregion
|
|
256
|
+
//#region src/testing/mutation-fixtures.ts
|
|
252
257
|
var MutableMutationFixture = class {
|
|
253
258
|
constructor(initial = {}) {
|
|
254
259
|
this.source = createReadableSource();
|
|
@@ -376,6 +381,8 @@ const mutationState = Object.assign(createMutationFixture, {
|
|
|
376
381
|
return createMutationFixture({ error });
|
|
377
382
|
}
|
|
378
383
|
});
|
|
384
|
+
//#endregion
|
|
385
|
+
//#region src/testing/query-fixtures.ts
|
|
379
386
|
function normalizeRefresh(options) {
|
|
380
387
|
return async () => {
|
|
381
388
|
await options?.refresh?.();
|
|
@@ -388,15 +395,7 @@ function makeQuery(state, options) {
|
|
|
388
395
|
};
|
|
389
396
|
}
|
|
390
397
|
function createFreshQuery(data, options) {
|
|
391
|
-
return makeQuery(
|
|
392
|
-
data,
|
|
393
|
-
error: null,
|
|
394
|
-
loading: false,
|
|
395
|
-
refreshing: false,
|
|
396
|
-
stale: false,
|
|
397
|
-
consistency: "fresh",
|
|
398
|
-
staleReason: null
|
|
399
|
-
}, options);
|
|
398
|
+
return makeQuery(freshQueryState(data), options);
|
|
400
399
|
}
|
|
401
400
|
/**
|
|
402
401
|
* Build a fresh {@link Query} fixture for tests: call directly with data, or
|
|
@@ -404,59 +403,19 @@ function createFreshQuery(data, options) {
|
|
|
404
403
|
*/
|
|
405
404
|
const mockQuery = Object.assign(createFreshQuery, {
|
|
406
405
|
loading(options) {
|
|
407
|
-
return makeQuery(
|
|
408
|
-
data: null,
|
|
409
|
-
error: null,
|
|
410
|
-
loading: true,
|
|
411
|
-
refreshing: false,
|
|
412
|
-
stale: false,
|
|
413
|
-
consistency: "fresh",
|
|
414
|
-
staleReason: null
|
|
415
|
-
}, options);
|
|
406
|
+
return makeQuery(loadingQueryState(), options);
|
|
416
407
|
},
|
|
417
408
|
error(error, previousData, options) {
|
|
418
|
-
return makeQuery(
|
|
419
|
-
data: previousData ?? null,
|
|
420
|
-
error,
|
|
421
|
-
loading: false,
|
|
422
|
-
refreshing: false,
|
|
423
|
-
stale: true,
|
|
424
|
-
consistency: "stale",
|
|
425
|
-
staleReason: "error"
|
|
426
|
-
}, options);
|
|
409
|
+
return makeQuery(errorQueryState(previousData ?? null, error), options);
|
|
427
410
|
},
|
|
428
411
|
refreshing(data, options) {
|
|
429
|
-
return makeQuery(
|
|
430
|
-
data,
|
|
431
|
-
error: null,
|
|
432
|
-
loading: false,
|
|
433
|
-
refreshing: true,
|
|
434
|
-
stale: true,
|
|
435
|
-
consistency: "refreshing",
|
|
436
|
-
staleReason: null
|
|
437
|
-
}, options);
|
|
412
|
+
return makeQuery(refreshingQueryState(data, "refreshing"), options);
|
|
438
413
|
},
|
|
439
414
|
stale(data, reason = "inconsistent", options) {
|
|
440
|
-
return makeQuery(
|
|
441
|
-
data,
|
|
442
|
-
error: null,
|
|
443
|
-
loading: false,
|
|
444
|
-
refreshing: false,
|
|
445
|
-
stale: true,
|
|
446
|
-
consistency: "stale",
|
|
447
|
-
staleReason: reason
|
|
448
|
-
}, options);
|
|
415
|
+
return makeQuery(staleQueryState(data, reason), options);
|
|
449
416
|
},
|
|
450
417
|
pendingWrite(data, options) {
|
|
451
|
-
return makeQuery(
|
|
452
|
-
data,
|
|
453
|
-
error: null,
|
|
454
|
-
loading: false,
|
|
455
|
-
refreshing: true,
|
|
456
|
-
stale: true,
|
|
457
|
-
consistency: "pending-write",
|
|
458
|
-
staleReason: null
|
|
459
|
-
}, options);
|
|
418
|
+
return makeQuery(refreshingQueryState(data, "pending-write"), options);
|
|
460
419
|
}
|
|
461
420
|
});
|
|
462
421
|
/** Alias table mirroring {@link mockQuery}'s state builders (`fresh`, `loading`, `error`, ...). */
|
|
@@ -468,6 +427,8 @@ const queryState = {
|
|
|
468
427
|
stale: mockQuery.stale,
|
|
469
428
|
pendingWrite: mockQuery.pendingWrite
|
|
470
429
|
};
|
|
430
|
+
//#endregion
|
|
431
|
+
//#region src/testing/invalidation.ts
|
|
471
432
|
/** Start recording {@link invalidate} calls for assertions; call `stop()` when done. */
|
|
472
433
|
function createInvalidationRecorder() {
|
|
473
434
|
const records = [];
|
|
@@ -495,6 +456,8 @@ function createInvalidationRecorder() {
|
|
|
495
456
|
}
|
|
496
457
|
};
|
|
497
458
|
}
|
|
459
|
+
//#endregion
|
|
460
|
+
//#region src/testing/routes.ts
|
|
498
461
|
/** Match `path` against a route registry for tests, without mounting the app. */
|
|
499
462
|
function matchRoute(path, options) {
|
|
500
463
|
if (!options?.registry) throw new TypeError("matchRoute requires options.registry.");
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { a as registerCommitOperation } from "./instance-VAFYVJOa.js";
|
|
2
|
+
import { O as ownCleanup, f as getCurrentComponentInstance, i as claimHookIndex } from "./scope-Cq_iYbTR.js";
|
|
3
|
+
import { n as getComponentLifecycleSlot } from "./capabilities-Bbf0mlp9.js";
|
|
4
|
+
import { t as isRouteActivityActive } from "./route-activity-CNJfpwx-.js";
|
|
5
|
+
//#region src/runtime/lifecycle/policy.ts
|
|
6
|
+
function normalizePredicates(predicates) {
|
|
7
|
+
if (!predicates) return [];
|
|
8
|
+
return typeof predicates === "function" ? [predicates] : predicates;
|
|
9
|
+
}
|
|
10
|
+
function allPredicatesPass(predicates) {
|
|
11
|
+
for (const predicate of predicates) if (!predicate()) return false;
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
/** {@link ActivityPredicate} that is true while the current route matches `pathOrPaths`. */
|
|
15
|
+
function routeActive(pathOrPaths) {
|
|
16
|
+
return () => isRouteActivityActive(pathOrPaths);
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/resources/browser-activity.ts
|
|
20
|
+
/** Activity gates retain their permissive server defaults. */
|
|
21
|
+
function documentVisible() {
|
|
22
|
+
return () => typeof document === "undefined" || document.visibilityState !== "hidden";
|
|
23
|
+
}
|
|
24
|
+
function windowFocused() {
|
|
25
|
+
return () => typeof document === "undefined" || typeof document.hasFocus !== "function" || document.hasFocus();
|
|
26
|
+
}
|
|
27
|
+
/** Browser target factories are deferred and skipped during server execution. */
|
|
28
|
+
function resolveListenerTarget(target) {
|
|
29
|
+
return typeof target === "function" ? typeof window === "undefined" ? null : target() ?? null : target;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/runtime/lifecycle/timer.ts
|
|
33
|
+
function stopTimerSlot(slot) {
|
|
34
|
+
if (slot.id === null) return;
|
|
35
|
+
clearInterval(slot.id);
|
|
36
|
+
slot.id = null;
|
|
37
|
+
}
|
|
38
|
+
function startTimerSlot(slot) {
|
|
39
|
+
slot.id = setInterval(() => {
|
|
40
|
+
if (allPredicatesPass(slot.predicates)) slot.callback();
|
|
41
|
+
}, slot.intervalMs ?? slot.pendingIntervalMs);
|
|
42
|
+
}
|
|
43
|
+
function commitTimerSlot(instance, slot) {
|
|
44
|
+
const intervalChanged = slot.intervalMs !== slot.pendingIntervalMs;
|
|
45
|
+
slot.callback = slot.pendingCallback;
|
|
46
|
+
slot.predicates = slot.pendingPredicates;
|
|
47
|
+
if (slot.id === null || intervalChanged) {
|
|
48
|
+
stopTimerSlot(slot);
|
|
49
|
+
slot.intervalMs = slot.pendingIntervalMs;
|
|
50
|
+
startTimerSlot(slot);
|
|
51
|
+
}
|
|
52
|
+
if (!slot.cleanupRegistered) {
|
|
53
|
+
slot.cleanupRegistered = true;
|
|
54
|
+
ownCleanup(instance.owner, () => {
|
|
55
|
+
stopTimerSlot(slot);
|
|
56
|
+
slot.cleanupRegistered = false;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/** Run `fn` on an owned interval for the current component's lifetime, optionally gated by `options.when`. */
|
|
61
|
+
function timer(intervalMs, fn, options) {
|
|
62
|
+
const instance = getCurrentComponentInstance();
|
|
63
|
+
if (!instance) return;
|
|
64
|
+
const index = claimHookIndex(instance, "timer");
|
|
65
|
+
const predicates = normalizePredicates(options?.when);
|
|
66
|
+
const slot = getComponentLifecycleSlot(instance, index, "timer", () => ({
|
|
67
|
+
kind: "timer",
|
|
68
|
+
id: null,
|
|
69
|
+
intervalMs: null,
|
|
70
|
+
pendingIntervalMs: intervalMs,
|
|
71
|
+
callback: fn,
|
|
72
|
+
predicates,
|
|
73
|
+
pendingCallback: fn,
|
|
74
|
+
pendingPredicates: predicates,
|
|
75
|
+
cleanupRegistered: false
|
|
76
|
+
}));
|
|
77
|
+
slot.pendingIntervalMs = intervalMs;
|
|
78
|
+
slot.pendingCallback = fn;
|
|
79
|
+
slot.pendingPredicates = predicates;
|
|
80
|
+
registerCommitOperation(() => {
|
|
81
|
+
commitTimerSlot(instance, slot);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
85
|
+
export { routeActive as a, windowFocused as i, documentVisible as n, resolveListenerTarget as r, timer as t };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/foundations/utilities/event-types.d.ts
|
|
2
1
|
/** Minimal shape of an event that can be prevented from its default action. */
|
|
3
2
|
interface DefaultPreventable {
|
|
4
3
|
defaultPrevented?: boolean;
|
|
@@ -22,8 +21,6 @@ interface PointerLikeEvent extends DefaultPreventable, PropagationStoppable {
|
|
|
22
21
|
interface FocusLikeEvent extends DefaultPreventable, PropagationStoppable {
|
|
23
22
|
relatedTarget?: unknown;
|
|
24
23
|
}
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region src/foundations/utilities/compose-handlers.d.ts
|
|
27
24
|
/**
|
|
28
25
|
* composeHandlers
|
|
29
26
|
*
|
|
@@ -61,16 +58,19 @@ interface ComposeHandlersOptions {
|
|
|
61
58
|
* Compose two optional event handlers into one, running `first` then
|
|
62
59
|
* `second` unless `first` marked the event as default-prevented.
|
|
63
60
|
*/
|
|
64
|
-
declare function composeHandlers<A extends readonly unknown[]>(
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
declare function composeHandlers<A extends readonly unknown[]>(
|
|
62
|
+
first?: (...args: A) => void,
|
|
63
|
+
second?: (...args: A) => void,
|
|
64
|
+
options?: ComposeHandlersOptions
|
|
65
|
+
): (...args: A) => void;
|
|
67
66
|
/**
|
|
68
67
|
* Merge `base` props over `injected` props: non-handler keys in `base` win,
|
|
69
68
|
* and matching event handlers are composed (`injected` runs first).
|
|
70
69
|
*/
|
|
71
|
-
declare function mergeProps<TBase extends object, TInjected extends object>(
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
declare function mergeProps<TBase extends object, TInjected extends object>(
|
|
71
|
+
base: TBase,
|
|
72
|
+
injected: TInjected
|
|
73
|
+
): TInjected & TBase;
|
|
74
74
|
/**
|
|
75
75
|
* Tiny aria helpers
|
|
76
76
|
*/
|
|
@@ -86,8 +86,6 @@ declare function ariaExpanded(expanded?: boolean): {
|
|
|
86
86
|
declare function ariaSelected(selected?: boolean): {
|
|
87
87
|
'aria-selected'?: 'true' | 'false';
|
|
88
88
|
};
|
|
89
|
-
//#endregion
|
|
90
|
-
//#region src/foundations/utilities/use-id.d.ts
|
|
91
89
|
/** Options for {@link formatId}. */
|
|
92
90
|
interface FormatIdOptions {
|
|
93
91
|
/** Defaults to 'askr' */
|
|
@@ -117,5 +115,18 @@ interface FormatIdOptions {
|
|
|
117
115
|
* This is deterministic and consistent.
|
|
118
116
|
*/
|
|
119
117
|
declare function formatId(options: FormatIdOptions): string;
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
export {
|
|
119
|
+
ariaSelected,
|
|
120
|
+
composeHandlers,
|
|
121
|
+
KeyboardLikeEvent,
|
|
122
|
+
PointerLikeEvent,
|
|
123
|
+
ariaExpanded,
|
|
124
|
+
DefaultPreventable,
|
|
125
|
+
formatId,
|
|
126
|
+
mergeProps,
|
|
127
|
+
PropagationStoppable,
|
|
128
|
+
ariaDisabled,
|
|
129
|
+
ComposeHandlersOptions,
|
|
130
|
+
FormatIdOptions,
|
|
131
|
+
FocusLikeEvent,
|
|
132
|
+
};
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
import { g as getHydrationRenderUrl, m as withHydrationVerificationRender } from "./render-context-B7ohlh6t.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { n as getRouteRenderContext, s as currentAuth } from "./resolution-3DskUkjG.js";
|
|
3
|
+
import { t as SSR_RENDER_DATA_ATTR } from "./ssr-EPjwJH5R.js";
|
|
4
|
+
import { t as renderResolvedForHydrationSync } from "./render-resolved-BC0W7_5b.js";
|
|
4
5
|
//#region src/ssr/verify-hydration.ts
|
|
6
|
+
const SSR_STYLE_REGISTRY_SELECTOR = "style[data-askr-style-registry]";
|
|
5
7
|
function normalizeHydrationHtml(html) {
|
|
6
8
|
const template = document.createElement("template");
|
|
7
9
|
template.innerHTML = html;
|
|
8
|
-
for (const
|
|
10
|
+
for (const carrier of Array.from(template.content.querySelectorAll(`script[${SSR_RENDER_DATA_ATTR}],${SSR_STYLE_REGISTRY_SELECTOR}`))) carrier.remove();
|
|
9
11
|
return template.innerHTML.replace(/<!--[\s\S]*?-->/g, "");
|
|
10
12
|
}
|
|
11
13
|
function verifyHydrationSyncForUrl(opts) {
|
|
12
14
|
const { root, url, registry, resolved, options } = opts;
|
|
13
15
|
const verificationUrl = getHydrationRenderUrl(options?.envelope) ?? new URL(url, "http://localhost").pathname;
|
|
14
|
-
const
|
|
16
|
+
const authContext = getRouteRenderContext(resolved)?.auth ?? currentAuth();
|
|
17
|
+
const expected = withHydrationVerificationRender(() => renderResolvedForHydrationSync({
|
|
15
18
|
url: verificationUrl,
|
|
16
19
|
registry,
|
|
17
20
|
handler: resolved.handler,
|
|
18
21
|
params: resolved.params,
|
|
19
22
|
options
|
|
20
|
-
}));
|
|
23
|
+
}, authContext));
|
|
21
24
|
return normalizeHydrationHtml(root.innerHTML) === normalizeHydrationHtml(expected);
|
|
22
25
|
}
|
|
23
26
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@askrjs/askr",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Lane-scheduled deterministic UI framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"askr",
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
],
|
|
31
31
|
"type": "module",
|
|
32
32
|
"sideEffects": [
|
|
33
|
-
"./dist/index.js"
|
|
33
|
+
"./dist/index.js",
|
|
34
|
+
"./dist/boot/index.js"
|
|
34
35
|
],
|
|
35
36
|
"main": "./dist/index.js",
|
|
36
37
|
"types": "./dist/index.d.ts",
|
|
@@ -139,30 +140,27 @@
|
|
|
139
140
|
"pack:check": "node tests/package-artifacts.js",
|
|
140
141
|
"check": "npm run release:verify && npm run pack:check",
|
|
141
142
|
"test:unit": "vp test run -c vitest.test.unit.config.ts",
|
|
142
|
-
"bench": "npm run bench:tier1 && npm run bench:tier2
|
|
143
|
+
"bench": "npm run bench:tier1 && npm run bench:tier2",
|
|
143
144
|
"bench:tier1": "cross-env NODE_ENV=production vp test bench --run --reporter=default --config vitest.bench.tier1.config.ts",
|
|
144
145
|
"bench:tier2": "cross-env NODE_ENV=production vp test bench --run --reporter=default --config vitest.bench.tier2.config.ts",
|
|
145
|
-
"bench:tier3": "cross-env NODE_ENV=production vp test bench --run --reporter=default --config vitest.bench.tier3.config.ts",
|
|
146
|
-
"bench:tier4": "cross-env NODE_ENV=production vp test bench --run --reporter=default --config vitest.bench.tier4.config.ts",
|
|
147
146
|
"prepack": "npm run build",
|
|
148
147
|
"prepublishOnly": "npm run check"
|
|
149
148
|
},
|
|
150
149
|
"dependencies": {
|
|
151
|
-
"@askrjs/auth": ">=0.
|
|
152
|
-
"@askrjs/schema": ">=0.
|
|
150
|
+
"@askrjs/auth": ">=0.3.0 <0.4.0",
|
|
151
|
+
"@askrjs/schema": ">=0.3.0 <0.4.0"
|
|
153
152
|
},
|
|
154
153
|
"devDependencies": {
|
|
155
|
-
"@types/node": "^26.
|
|
156
|
-
"@typescript/
|
|
157
|
-
"@vitest/browser-playwright": "4.1.
|
|
154
|
+
"@types/node": "^26.4.1",
|
|
155
|
+
"@typescript/typescript6": "^6.0.2",
|
|
156
|
+
"@vitest/browser-playwright": "4.1.11",
|
|
158
157
|
"cross-env": "^10.1.0",
|
|
159
158
|
"jsdom": "^30.0.1",
|
|
160
|
-
"playwright": "^1.
|
|
159
|
+
"playwright": "^1.63.0",
|
|
161
160
|
"publint": "^0.3.24",
|
|
162
161
|
"tsd": "^0.33.0",
|
|
163
|
-
"typescript": "
|
|
164
|
-
"vite": "^
|
|
165
|
-
"vite-plus": "^0.2.8"
|
|
162
|
+
"typescript": "^7.0.2",
|
|
163
|
+
"vite-plus": "^0.3.1"
|
|
166
164
|
},
|
|
167
165
|
"tsd": {
|
|
168
166
|
"compilerOptions": {
|