@askrjs/askr 0.2.3 → 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-ZxJXI9hF.js → activity-oy2YFTFF.js} +22 -16
- package/dist/benchmark.js +8 -9
- package/dist/boot/index.d.ts +21 -9
- package/dist/boot/index.js +1 -1
- package/dist/{boot-D4GaLA0d.js → boot-BMBMWUGI.js} +680 -440
- 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-57x3wa4J.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-B7XCDeC8.js → data-2edW0jhF.js} +133 -138
- package/dist/{data-runtime-7t_Y0iv3.js → data-runtime-CxoY98lX.js} +22 -15
- package/dist/{deferred-BELyvMsC.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-4LwBwV58.js → effect-C3Zsc1k6.js} +14 -41
- package/dist/{types-DkVJhVs9.d.ts → elements.d.ts} +84 -42
- package/dist/{for-internal-DeoSg_AV.js → for-state-BDykeOJL.js} +623 -511
- 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-Dl02WQKS.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-C46GtScG.js → navigate-prC5V8XV.js} +204 -476
- package/dist/{navigate-wel1e6cU.d.ts → navigation.d.ts} +10 -8
- package/dist/{readable-CEcteIDE.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-BaC5qHEw.js → render-resolved-BC0W7_5b.js} +165 -558
- package/dist/{renderer-BhXofszH.js → renderer-CT0HeY58.js} +6866 -5715
- package/dist/{resolution-t8J0yNaU.js → resolution-3DskUkjG.js} +189 -180
- package/dist/{resource-operation-B8q-QRUx.js → resource-18-sFRl9.js} +98 -58
- package/dist/resources/index.d.ts +64 -46
- package/dist/resources/index.js +215 -9
- 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-C7rIpOnN.js → selector-BSPVkjKP.js} +41 -41
- package/dist/{shared-CGrx2AOL.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-BzhOW2TX.js → state-BXJfudq1.js} +10 -15
- package/dist/{structures-BwfeO4Iz.js → structures-CjEzfj4h.js} +37 -57
- package/dist/{index-r5THqzPN.d.ts → structures.d.ts} +57 -36
- package/dist/testing/index.d.ts +125 -24
- package/dist/testing/index.js +26 -62
- package/dist/timer-C7uqnJVt.js +85 -0
- package/dist/{index-B1gu0_m0.d.ts → utilities.d.ts} +24 -13
- package/dist/{verify-hydration-_Q6avFp0.js → verify-hydration-ikaxotf7.js} +8 -5
- package/package.json +13 -15
- package/dist/access-Rr7CMa06.js +0 -507
- package/dist/activity-CAJ5eho-.d.ts +0 -14
- package/dist/benchmark.d.ts +0 -26
- package/dist/cleanup-DsrbV-rr.js +0 -535
- package/dist/component-cleanup-DjpwO9WX.js +0 -143
- package/dist/component-scope-4I3yEMkb.js +0 -195
- package/dist/control-DdFw-Caz.d.ts +0 -8
- package/dist/csp-nonce-C9OuML0U.js +0 -72
- package/dist/css-BuPaTOfe.js +0 -70
- package/dist/fastlane-Buz1Rvlr.js +0 -166
- package/dist/index-DSqXWc77.d.ts +0 -1402
- package/dist/jsx-runtime-BTzDdBJ_.d.ts +0 -2
- package/dist/jsx-runtime-Cdd6Gkb0.d.ts +0 -38
- package/dist/lifecycle-batch-Be-CLDjV.js +0 -253
- package/dist/lifecycle-operations-C5m03NQc.js +0 -195
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-BMBMWUGI.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 = {
|
|
@@ -149,7 +150,8 @@ function render(component, options) {
|
|
|
149
150
|
createIsland({
|
|
150
151
|
root: container,
|
|
151
152
|
component,
|
|
152
|
-
cleanupStrict: options?.cleanupStrict
|
|
153
|
+
cleanupStrict: options?.cleanupStrict,
|
|
154
|
+
dataRuntime: options?.dataRuntime
|
|
153
155
|
});
|
|
154
156
|
flush();
|
|
155
157
|
return createRenderResult(container);
|
|
@@ -188,7 +190,7 @@ async function renderRoute(options) {
|
|
|
188
190
|
}
|
|
189
191
|
}
|
|
190
192
|
//#endregion
|
|
191
|
-
//#region src/testing/
|
|
193
|
+
//#region src/testing/interactions.ts
|
|
192
194
|
/** Dispatch the browser click sequence expected by Askr's delegated events. */
|
|
193
195
|
function click(element) {
|
|
194
196
|
if (!element || typeof element.dispatchEvent !== "function") throw new TypeError("@askrjs/askr/testing click requires an Element.");
|
|
@@ -210,6 +212,8 @@ function submit(form) {
|
|
|
210
212
|
if (!form || typeof form.dispatchEvent !== "function") throw new TypeError("@askrjs/askr/testing submit requires a form.");
|
|
211
213
|
return dispatch(form, "submit");
|
|
212
214
|
}
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/testing/registries.ts
|
|
213
217
|
/** Create a keyed query fixture registry for a test render runtime. */
|
|
214
218
|
function createQueryTestRegistry() {
|
|
215
219
|
const runtime = createDataRuntime();
|
|
@@ -248,6 +252,8 @@ function createMutationTestRegistry() {
|
|
|
248
252
|
}
|
|
249
253
|
};
|
|
250
254
|
}
|
|
255
|
+
//#endregion
|
|
256
|
+
//#region src/testing/mutation-fixtures.ts
|
|
251
257
|
var MutableMutationFixture = class {
|
|
252
258
|
constructor(initial = {}) {
|
|
253
259
|
this.source = createReadableSource();
|
|
@@ -375,6 +381,8 @@ const mutationState = Object.assign(createMutationFixture, {
|
|
|
375
381
|
return createMutationFixture({ error });
|
|
376
382
|
}
|
|
377
383
|
});
|
|
384
|
+
//#endregion
|
|
385
|
+
//#region src/testing/query-fixtures.ts
|
|
378
386
|
function normalizeRefresh(options) {
|
|
379
387
|
return async () => {
|
|
380
388
|
await options?.refresh?.();
|
|
@@ -387,15 +395,7 @@ function makeQuery(state, options) {
|
|
|
387
395
|
};
|
|
388
396
|
}
|
|
389
397
|
function createFreshQuery(data, options) {
|
|
390
|
-
return makeQuery(
|
|
391
|
-
data,
|
|
392
|
-
error: null,
|
|
393
|
-
loading: false,
|
|
394
|
-
refreshing: false,
|
|
395
|
-
stale: false,
|
|
396
|
-
consistency: "fresh",
|
|
397
|
-
staleReason: null
|
|
398
|
-
}, options);
|
|
398
|
+
return makeQuery(freshQueryState(data), options);
|
|
399
399
|
}
|
|
400
400
|
/**
|
|
401
401
|
* Build a fresh {@link Query} fixture for tests: call directly with data, or
|
|
@@ -403,59 +403,19 @@ function createFreshQuery(data, options) {
|
|
|
403
403
|
*/
|
|
404
404
|
const mockQuery = Object.assign(createFreshQuery, {
|
|
405
405
|
loading(options) {
|
|
406
|
-
return makeQuery(
|
|
407
|
-
data: null,
|
|
408
|
-
error: null,
|
|
409
|
-
loading: true,
|
|
410
|
-
refreshing: false,
|
|
411
|
-
stale: false,
|
|
412
|
-
consistency: "fresh",
|
|
413
|
-
staleReason: null
|
|
414
|
-
}, options);
|
|
406
|
+
return makeQuery(loadingQueryState(), options);
|
|
415
407
|
},
|
|
416
408
|
error(error, previousData, options) {
|
|
417
|
-
return makeQuery(
|
|
418
|
-
data: previousData ?? null,
|
|
419
|
-
error,
|
|
420
|
-
loading: false,
|
|
421
|
-
refreshing: false,
|
|
422
|
-
stale: true,
|
|
423
|
-
consistency: "stale",
|
|
424
|
-
staleReason: "error"
|
|
425
|
-
}, options);
|
|
409
|
+
return makeQuery(errorQueryState(previousData ?? null, error), options);
|
|
426
410
|
},
|
|
427
411
|
refreshing(data, options) {
|
|
428
|
-
return makeQuery(
|
|
429
|
-
data,
|
|
430
|
-
error: null,
|
|
431
|
-
loading: false,
|
|
432
|
-
refreshing: true,
|
|
433
|
-
stale: true,
|
|
434
|
-
consistency: "refreshing",
|
|
435
|
-
staleReason: null
|
|
436
|
-
}, options);
|
|
412
|
+
return makeQuery(refreshingQueryState(data, "refreshing"), options);
|
|
437
413
|
},
|
|
438
414
|
stale(data, reason = "inconsistent", options) {
|
|
439
|
-
return makeQuery(
|
|
440
|
-
data,
|
|
441
|
-
error: null,
|
|
442
|
-
loading: false,
|
|
443
|
-
refreshing: false,
|
|
444
|
-
stale: true,
|
|
445
|
-
consistency: "stale",
|
|
446
|
-
staleReason: reason
|
|
447
|
-
}, options);
|
|
415
|
+
return makeQuery(staleQueryState(data, reason), options);
|
|
448
416
|
},
|
|
449
417
|
pendingWrite(data, options) {
|
|
450
|
-
return makeQuery(
|
|
451
|
-
data,
|
|
452
|
-
error: null,
|
|
453
|
-
loading: false,
|
|
454
|
-
refreshing: true,
|
|
455
|
-
stale: true,
|
|
456
|
-
consistency: "pending-write",
|
|
457
|
-
staleReason: null
|
|
458
|
-
}, options);
|
|
418
|
+
return makeQuery(refreshingQueryState(data, "pending-write"), options);
|
|
459
419
|
}
|
|
460
420
|
});
|
|
461
421
|
/** Alias table mirroring {@link mockQuery}'s state builders (`fresh`, `loading`, `error`, ...). */
|
|
@@ -467,6 +427,8 @@ const queryState = {
|
|
|
467
427
|
stale: mockQuery.stale,
|
|
468
428
|
pendingWrite: mockQuery.pendingWrite
|
|
469
429
|
};
|
|
430
|
+
//#endregion
|
|
431
|
+
//#region src/testing/invalidation.ts
|
|
470
432
|
/** Start recording {@link invalidate} calls for assertions; call `stop()` when done. */
|
|
471
433
|
function createInvalidationRecorder() {
|
|
472
434
|
const records = [];
|
|
@@ -494,6 +456,8 @@ function createInvalidationRecorder() {
|
|
|
494
456
|
}
|
|
495
457
|
};
|
|
496
458
|
}
|
|
459
|
+
//#endregion
|
|
460
|
+
//#region src/testing/routes.ts
|
|
497
461
|
/** Match `path` against a route registry for tests, without mounting the app. */
|
|
498
462
|
function matchRoute(path, options) {
|
|
499
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.0",
|
|
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.
|
|
161
|
-
"publint": "^0.3.
|
|
159
|
+
"playwright": "^1.63.0",
|
|
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": {
|