@askrjs/askr 0.0.92 → 0.0.94

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.
Files changed (88) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/dist/{access-DSkccuEI.js → access-d_DCdwqn.js} +3 -0
  3. package/dist/actions/index.d.ts +1 -1
  4. package/dist/actions/index.js +3 -2
  5. package/dist/{activity-DodHdC0L.js → activity-BshyLB3_.js} +4 -2
  6. package/dist/{activity-DxUcygE5.d.ts → activity-CJIQyo5X.d.ts} +5 -1
  7. package/dist/benchmark.d.ts +1 -1
  8. package/dist/benchmark.js +8 -8
  9. package/dist/boot/index.d.ts +12 -3
  10. package/dist/boot/index.js +1 -1
  11. package/dist/{boot-D71bjP4r.js → boot-BsMB_ySP.js} +21 -15
  12. package/dist/{cleanup-DAAhJjx5.js → cleanup-DefafSjG.js} +4 -4
  13. package/dist/{component-cleanup-CJCfu5ed.js → component-cleanup-hrqSikl2.js} +2 -2
  14. package/dist/{component-internal-DlAkCgBE.js → component-internal-DOVVMjG7.js} +7 -5
  15. package/dist/components/index.d.ts +7 -2
  16. package/dist/components/index.js +1 -1
  17. package/dist/{compose-ref-Cc_YkUpM.js → compose-ref-1Fhs7mbF.js} +13 -0
  18. package/dist/{compose-ref-Cizq72-x.d.ts → compose-ref-DOJHoW5X.d.ts} +3 -0
  19. package/dist/control/index.d.ts +1 -1
  20. package/dist/control/index.js +1 -1
  21. package/dist/{control-CdzY49Q2.d.ts → control-DdFw-Caz.d.ts} +1 -1
  22. package/dist/{control-Dv540XtV.js → control-DqOzkgc7.js} +9 -5
  23. package/dist/{csp-nonce-ByMbWv8s.js → csp-nonce-BBxq1zq4.js} +8 -1
  24. package/dist/data/index.d.ts +1 -1
  25. package/dist/data/index.js +3 -3
  26. package/dist/{data-DcikEH9N.js → data-DYqokZzc.js} +15 -4
  27. package/dist/{data-runtime-oIdQWnPW.js → data-runtime-JxoRgrrt.js} +2 -0
  28. package/dist/{deferred-B6CafO5u.js → deferred-BS0Xpstg.js} +8 -3
  29. package/dist/{effect-BdZcHblj.js → effect-BdvdgMvV.js} +2 -2
  30. package/dist/{fastlane-B2s24fWt.js → fastlane-DGo7SxBQ.js} +3 -3
  31. package/dist/{for-internal-T1C7jd7x.js → for-internal-jrliHZmF.js} +5 -5
  32. package/dist/foundations/icon/index.d.ts +14 -2
  33. package/dist/foundations/icon/index.js +8 -0
  34. package/dist/foundations/index.d.ts +2 -2
  35. package/dist/foundations/index.js +1 -1
  36. package/dist/foundations/interactions/index.d.ts +18 -2
  37. package/dist/foundations/interactions/index.js +1 -1
  38. package/dist/foundations/state/index.d.ts +8 -1
  39. package/dist/foundations/state/index.js +7 -1
  40. package/dist/foundations/structures/index.d.ts +2 -2
  41. package/dist/foundations/structures/index.js +1 -1
  42. package/dist/foundations/utilities/index.d.ts +2 -2
  43. package/dist/foundations/utilities/index.js +1 -1
  44. package/dist/fx/index.d.ts +10 -1
  45. package/dist/fx/index.js +7 -1
  46. package/dist/{index-oswRaMn6.d.ts → index-C29SEGIv.d.ts} +30 -2
  47. package/dist/{index-BnU0NPwM.d.ts → index-CzH-0LcA.d.ts} +18 -0
  48. package/dist/{index-DA3g8lm8.d.ts → index-KQ7Vl4-8.d.ts} +414 -5
  49. package/dist/index.d.ts +3 -4
  50. package/dist/index.js +13 -12
  51. package/dist/{interactions-CWkNEq_C.js → interactions-B4XaFxt1.js} +6 -1
  52. package/dist/{jsx-C3IECePB.js → jsx-DRS-qjiN.js} +2 -0
  53. package/dist/jsx-dev-runtime.d.ts +2 -2
  54. package/dist/jsx-dev-runtime.js +1 -1
  55. package/dist/jsx-runtime-BTzDdBJ_.d.ts +2 -0
  56. package/dist/{jsx-runtime-Cfb2umb4.d.ts → jsx-runtime-Cdd6Gkb0.d.ts} +4 -2
  57. package/dist/jsx-runtime.d.ts +2 -2
  58. package/dist/jsx-runtime.js +1 -1
  59. package/dist/{lifecycle-batch-Cyfd07rf.js → lifecycle-batch-BH0fax4F.js} +2 -2
  60. package/dist/{lifecycle-operations-CQ8fsc94.js → lifecycle-operations-Qxq6ABrC.js} +6 -1
  61. package/dist/{manifest-Dv0bO6kg.js → manifest-D6rfj_jC.js} +4 -0
  62. package/dist/{navigate-CZHPEUC4.d.ts → navigate-BL_FIIJ6.d.ts} +6 -1
  63. package/dist/{navigate-BbWj-QU-.js → navigate-CECCMPAr.js} +13 -10
  64. package/dist/{query-registry-qm13pEdK.js → query-registry-CimB1YeW.js} +11 -1
  65. package/dist/{readable-B99wh5Z_.js → readable-BsdGWsDE.js} +1 -1
  66. package/dist/{renderer-C6jz9nIN.js → renderer-CLvq458M.js} +10 -10
  67. package/dist/{resolution-B21kmOkp.js → resolution-D8PgnTzh.js} +11 -5
  68. package/dist/{resource-operation-CaAttQqz.js → resource-operation-CLQXCn1p.js} +4 -4
  69. package/dist/resources/index.d.ts +15 -2
  70. package/dist/resources/index.js +6 -5
  71. package/dist/router/index.d.ts +46 -4
  72. package/dist/router/index.js +15 -8
  73. package/dist/{selector-BLWwI55m.js → selector-CyK-sDwB.js} +4 -3
  74. package/dist/ssg/index.d.ts +5 -1
  75. package/dist/ssg/index.js +5 -5
  76. package/dist/ssr/index.d.ts +16 -3
  77. package/dist/ssr/index.js +1 -1
  78. package/dist/{ssr-CaZfvQWn.js → ssr-8_vHDWqV.js} +18 -10
  79. package/dist/{state-XPZYUzHL.js → state-DmkGM_LN.js} +3 -3
  80. package/dist/{structures-DKjkAmM5.js → structures-umvVUD-M.js} +19 -5
  81. package/dist/testing/index.d.ts +31 -2
  82. package/dist/testing/index.js +23 -5
  83. package/dist/{types-BA9FJtfR.d.ts → types-DkVJhVs9.d.ts} +4 -0
  84. package/dist/{verify-hydration-CcF-HJil.js → verify-hydration-jf8X2V3x.js} +1 -1
  85. package/package.json +1 -1
  86. package/dist/index-2bk8nldG.d.ts +0 -241
  87. package/dist/jsx-runtime-C_0v1pMN.d.ts +0 -2
  88. package/dist/scheduler-CmLO4Dfm.d.ts +0 -65
@@ -1,6 +1,6 @@
1
- import { pt as RouteRegistry, q as RouteAuthOptions, tt as RouteMatch, wt as ComponentFunction } from "../index-DA3g8lm8.js";
2
- import { A as QueryStaleReason, S as Mutation, v as DataRuntime, w as Query } from "../index-2bk8nldG.js";
1
+ import { At as RouteRegistry, Gt as Query, Ut as Mutation, Zt as QueryStaleReason, nn as ComponentFunction, ut as RouteAuthOptions, vt as RouteMatch, zt as DataRuntime } from "../index-KQ7Vl4-8.js";
3
2
  //#region src/testing/render.d.ts
3
+ /** Options for {@link render} and {@link mount}. */
4
4
  interface RenderOptions {
5
5
  /**
6
6
  * Existing element to own for the duration of the render. When omitted, the
@@ -10,6 +10,7 @@ interface RenderOptions {
10
10
  /** Surface lifecycle cleanup errors during unmount. */
11
11
  cleanupStrict?: boolean;
12
12
  }
13
+ /** Options for {@link renderRoute}. */
13
14
  interface RouteRenderOptions extends RenderOptions {
14
15
  registry: RouteRegistry;
15
16
  /** Initial path, query, and hash for the routed render. */
@@ -18,6 +19,7 @@ interface RouteRenderOptions extends RenderOptions {
18
19
  dataRuntime?: DataRuntime;
19
20
  }
20
21
  type DispatchEventInit = EventInit | UIEventInit | FocusEventInit | MouseEventInit | WheelEventInit | KeyboardEventInit | InputEventInit | CompositionEventInit | PointerEventInit | TouchEventInit | DragEventInit;
22
+ /** Handle to a mounted test render, returned by {@link render}/{@link mount}/{@link renderRoute}. */
21
23
  interface RenderResult {
22
24
  readonly container: HTMLElement;
23
25
  readonly root: HTMLElement;
@@ -26,11 +28,17 @@ interface RenderResult {
26
28
  unmount(): void;
27
29
  cleanup(): void;
28
30
  }
31
+ /** Synchronously flush the runtime's scheduled work (renders, effects). */
29
32
  declare function flush(): void;
33
+ /** Dispatch an event (constructed from a type string, or given directly) on `target`. */
30
34
  declare function dispatch(target: EventTarget, event: Event | string, init?: DispatchEventInit): boolean;
35
+ /** Tear down a test render, given either its {@link RenderResult} or container element. */
31
36
  declare function cleanup(target: RenderResult | HTMLElement): void;
37
+ /** Mount `component` as an island into a test container and flush pending work. */
32
38
  declare function render(component: ComponentFunction, options?: RenderOptions): RenderResult;
39
+ /** Alias for {@link render}. */
33
40
  declare function mount(component: ComponentFunction, options?: RenderOptions): RenderResult;
41
+ /** Mount a routed app (via {@link createSPA}) into a test container for the given route registry. */
34
42
  declare function renderRoute(options: RouteRenderOptions): Promise<RenderResult>;
35
43
  //#endregion
36
44
  //#region src/testing/index.d.ts
@@ -40,6 +48,7 @@ declare function click(element: Element): boolean;
40
48
  declare function type(element: HTMLInputElement | HTMLTextAreaElement, text: string): void;
41
49
  /** Dispatch a cancelable bubbling submit event on a form. */
42
50
  declare function submit(form: HTMLFormElement): boolean;
51
+ /** Keyed query fixture registry returned by {@link createQueryTestRegistry}. */
43
52
  interface QueryTestRegistry {
44
53
  readonly runtime: DataRuntime;
45
54
  set<T extends {}>(key: string, query: Query<T>): void;
@@ -48,6 +57,7 @@ interface QueryTestRegistry {
48
57
  }
49
58
  /** Create a keyed query fixture registry for a test render runtime. */
50
59
  declare function createQueryTestRegistry(): QueryTestRegistry;
60
+ /** Keyed mutation fixture registry returned by {@link createMutationTestRegistry}. */
51
61
  interface MutationTestRegistry {
52
62
  readonly runtime: DataRuntime;
53
63
  set<TInput, TResult>(key: string, mutation: Mutation<TInput, TResult>): void;
@@ -56,11 +66,13 @@ interface MutationTestRegistry {
56
66
  }
57
67
  /** Create a keyed mutation fixture registry for a test render runtime. */
58
68
  declare function createMutationTestRegistry(): MutationTestRegistry;
69
+ /** Initial state for {@link mutationState}; exactly one of `pending`/`error`/`result` may be set. */
59
70
  type MutationFixtureInitial<TResult> = {
60
71
  pending?: boolean;
61
72
  error?: {} | null;
62
73
  result?: TResult;
63
74
  };
75
+ /** A {@link Mutation} whose state is driven manually via `setPending`/`succeed`/`fail`. */
64
76
  type MutationFixture<TInput, TResult> = Mutation<TInput, TResult> & {
65
77
  /** Inputs received by the fixture's execute method. */
66
78
  readonly inputs: readonly TInput[];
@@ -72,20 +84,28 @@ type MutationFixture<TInput, TResult> = Mutation<TInput, TResult> & {
72
84
  fail(error: {}): void;
73
85
  };
74
86
  declare function createMutationFixture<TInput = unknown, TResult = unknown>(initial?: MutationFixtureInitial<TResult>): MutationFixture<TInput, TResult>;
87
+ /**
88
+ * Build a {@link MutationFixture} for tests: call directly with initial
89
+ * state, or use `.idle()`/`.pending()`/`.success(result)`/`.error(error)`.
90
+ */
75
91
  declare const mutationState: typeof createMutationFixture & {
76
92
  idle<TInput = unknown, TResult = unknown>(): MutationFixture<TInput, TResult>;
77
93
  pending<TInput = unknown, TResult = unknown>(): MutationFixture<TInput, TResult>;
78
94
  success<TInput = unknown, TResult = unknown>(result: TResult): MutationFixture<TInput, TResult>;
79
95
  error<TInput = unknown, TResult = unknown>(error: {}): MutationFixture<TInput, TResult>;
80
96
  };
97
+ /** Refresh callback for a {@link mockQuery} fixture, invoked by the query's `refresh()`. */
81
98
  type MockRefresh = () => void | Promise<void>;
99
+ /** Options for {@link mockQuery} fixtures. */
82
100
  interface MockQueryOptions {
83
101
  refresh?: MockRefresh;
84
102
  }
103
+ /** A single recorded call to {@link invalidate}, captured by {@link createInvalidationRecorder}. */
85
104
  interface InvalidationRecord {
86
105
  prefix: string;
87
106
  markPendingWrite: boolean;
88
107
  }
108
+ /** Recorder returned by {@link createInvalidationRecorder}. */
89
109
  interface InvalidationRecorder {
90
110
  readonly calls: readonly InvalidationRecord[];
91
111
  readonly prefixes: readonly string[];
@@ -95,6 +115,7 @@ interface InvalidationRecorder {
95
115
  interface MatchRouteOptions {
96
116
  registry: RouteRegistry;
97
117
  }
118
+ /** A splat-route/static-route path collision reported by {@link getRouteWarnings}. */
98
119
  interface RoutePatternWarning {
99
120
  kind: 'route-collision';
100
121
  path: string;
@@ -105,6 +126,10 @@ interface RoutePatternWarning {
105
126
  }
106
127
  type StaleValueReason = Exclude<QueryStaleReason, 'error'>;
107
128
  declare function createFreshQuery<T extends {}>(data: T, options?: MockQueryOptions): Query<T>;
129
+ /**
130
+ * Build a fresh {@link Query} fixture for tests: call directly with data, or
131
+ * use `.loading()`/`.error()`/`.refreshing()`/`.stale()`/`.pendingWrite()`.
132
+ */
108
133
  declare const mockQuery: typeof createFreshQuery & {
109
134
  loading<T extends {} = {}>(options?: MockQueryOptions): Query<T>;
110
135
  error<T extends {} = {}>(error: {}, previousData?: T, options?: MockQueryOptions): Query<T>;
@@ -112,6 +137,7 @@ declare const mockQuery: typeof createFreshQuery & {
112
137
  stale<T extends {}>(data: T, reason?: StaleValueReason, options?: MockQueryOptions): Query<T>;
113
138
  pendingWrite<T extends {}>(data: T, options?: MockQueryOptions): Query<T>;
114
139
  };
140
+ /** Alias table mirroring {@link mockQuery}'s state builders (`fresh`, `loading`, `error`, ...). */
115
141
  declare const queryState: {
116
142
  fresh: typeof createFreshQuery;
117
143
  loading: <T extends {} = {}>(options?: MockQueryOptions) => Query<T>;
@@ -120,8 +146,11 @@ declare const queryState: {
120
146
  stale: <T extends {}>(data: T, reason?: StaleValueReason, options?: MockQueryOptions) => Query<T>;
121
147
  pendingWrite: <T extends {}>(data: T, options?: MockQueryOptions) => Query<T>;
122
148
  };
149
+ /** Start recording {@link invalidate} calls for assertions; call `stop()` when done. */
123
150
  declare function createInvalidationRecorder(): InvalidationRecorder;
151
+ /** Match `path` against a route registry for tests, without mounting the app. */
124
152
  declare function matchRoute(path: string, options: MatchRouteOptions): RouteMatch | null;
153
+ /** Find named-splat routes whose reserved segments collide with sibling static routes. */
125
154
  declare function getRouteWarnings(options: MatchRouteOptions): RoutePatternWarning[];
126
155
  //#endregion
127
156
  export { InvalidationRecord, InvalidationRecorder, MockQueryOptions, MockRefresh, MutationFixture, MutationFixtureInitial, MutationTestRegistry, QueryTestRegistry, type RenderOptions, type RenderResult, RoutePatternWarning, type RouteRenderOptions, cleanup, click, createInvalidationRecorder, createMutationTestRegistry, createQueryTestRegistry, dispatch, flush, getRouteWarnings, matchRoute, mockQuery, mount, mutationState, queryState, render, renderRoute, submit, type };
@@ -1,9 +1,9 @@
1
- import { r as flushRuntimeScheduler } from "../access-DSkccuEI.js";
2
- import { u as recordReadableRead } from "../readable-B99wh5Z_.js";
3
- import { l as addInvalidationListener, t as createDataRuntime } from "../data-runtime-oIdQWnPW.js";
4
- import { a as notifySource, i as normalizeAsyncDataError, r as createReadableSource } from "../data-DcikEH9N.js";
1
+ import { r as flushRuntimeScheduler } from "../access-d_DCdwqn.js";
2
+ import { u as recordReadableRead } from "../readable-BsdGWsDE.js";
3
+ import { l as addInvalidationListener, t as createDataRuntime } from "../data-runtime-JxoRgrrt.js";
4
+ import { a as notifySource, i as normalizeAsyncDataError, r as createReadableSource } from "../data-DYqokZzc.js";
5
5
  import { r as computeRouteActivityMatches } from "../route-matching-Bo6UqG-5.js";
6
- import { a as cleanupApp, r as createSPA, t as createIsland } from "../boot-D71bjP4r.js";
6
+ import { a as cleanupApp, r as createSPA, t as createIsland } from "../boot-BsMB_ySP.js";
7
7
  //#region src/testing/render.ts
8
8
  const renderStates = /* @__PURE__ */ new WeakMap();
9
9
  const eventConstructorNames = {
@@ -96,9 +96,11 @@ function isEventForTarget(target, value) {
96
96
  if (value instanceof getBaseEventConstructor(target)) return true;
97
97
  return typeof Event !== "undefined" && value instanceof Event;
98
98
  }
99
+ /** Synchronously flush the runtime's scheduled work (renders, effects). */
99
100
  function flush() {
100
101
  flushRuntimeScheduler();
101
102
  }
103
+ /** Dispatch an event (constructed from a type string, or given directly) on `target`. */
102
104
  function dispatch(target, event, init = {}) {
103
105
  if (!target || typeof target.dispatchEvent !== "function") throw new TypeError("@askrjs/askr/testing dispatch requires an EventTarget.");
104
106
  if (typeof event !== "string" && !isEventForTarget(target, event)) throw new TypeError("@askrjs/askr/testing dispatch requires an Event instance or event type string.");
@@ -125,6 +127,7 @@ function cleanupContainer(container) {
125
127
  function isRenderResult(target) {
126
128
  return "container" in target && "cleanup" in target;
127
129
  }
130
+ /** Tear down a test render, given either its {@link RenderResult} or container element. */
128
131
  function cleanup(target) {
129
132
  cleanupContainer(isRenderResult(target) ? target.container : target);
130
133
  }
@@ -138,6 +141,7 @@ function createRenderResult(container) {
138
141
  cleanup: () => cleanupContainer(container)
139
142
  };
140
143
  }
144
+ /** Mount `component` as an island into a test container and flush pending work. */
141
145
  function render(component, options) {
142
146
  if (typeof component !== "function") throw new TypeError("@askrjs/askr/testing render requires a component function.");
143
147
  const { container } = prepareContainer(options);
@@ -154,9 +158,11 @@ function render(component, options) {
154
158
  throw error;
155
159
  }
156
160
  }
161
+ /** Alias for {@link render}. */
157
162
  function mount(component, options) {
158
163
  return render(component, options);
159
164
  }
165
+ /** Mount a routed app (via {@link createSPA}) into a test container for the given route registry. */
160
166
  async function renderRoute(options) {
161
167
  if (!options?.registry) throw new TypeError("@askrjs/askr/testing renderRoute requires a route registry.");
162
168
  const currentWindow = requireWindow();
@@ -351,6 +357,10 @@ var MutableMutationFixture = class {
351
357
  function createMutationFixture(initial = {}) {
352
358
  return new MutableMutationFixture(initial);
353
359
  }
360
+ /**
361
+ * Build a {@link MutationFixture} for tests: call directly with initial
362
+ * state, or use `.idle()`/`.pending()`/`.success(result)`/`.error(error)`.
363
+ */
354
364
  const mutationState = Object.assign(createMutationFixture, {
355
365
  idle() {
356
366
  return createMutationFixture();
@@ -387,6 +397,10 @@ function createFreshQuery(data, options) {
387
397
  staleReason: null
388
398
  }, options);
389
399
  }
400
+ /**
401
+ * Build a fresh {@link Query} fixture for tests: call directly with data, or
402
+ * use `.loading()`/`.error()`/`.refreshing()`/`.stale()`/`.pendingWrite()`.
403
+ */
390
404
  const mockQuery = Object.assign(createFreshQuery, {
391
405
  loading(options) {
392
406
  return makeQuery({
@@ -444,6 +458,7 @@ const mockQuery = Object.assign(createFreshQuery, {
444
458
  }, options);
445
459
  }
446
460
  });
461
+ /** Alias table mirroring {@link mockQuery}'s state builders (`fresh`, `loading`, `error`, ...). */
447
462
  const queryState = {
448
463
  fresh: createFreshQuery,
449
464
  loading: mockQuery.loading,
@@ -452,6 +467,7 @@ const queryState = {
452
467
  stale: mockQuery.stale,
453
468
  pendingWrite: mockQuery.pendingWrite
454
469
  };
470
+ /** Start recording {@link invalidate} calls for assertions; call `stop()` when done. */
455
471
  function createInvalidationRecorder() {
456
472
  const records = [];
457
473
  let active = true;
@@ -478,6 +494,7 @@ function createInvalidationRecorder() {
478
494
  }
479
495
  };
480
496
  }
497
+ /** Match `path` against a route registry for tests, without mounting the app. */
481
498
  function matchRoute(path, options) {
482
499
  if (!options?.registry) throw new TypeError("matchRoute requires options.registry.");
483
500
  return computeRouteActivityMatches(path, { registry: options.registry })[0] ?? null;
@@ -499,6 +516,7 @@ function routePrefixMatches(splatPrefix, routeSegments) {
499
516
  }
500
517
  return true;
501
518
  }
519
+ /** Find named-splat routes whose reserved segments collide with sibling static routes. */
502
520
  function getRouteWarnings(options) {
503
521
  const records = getRoutePatternRecords(options);
504
522
  const warnings = [];
@@ -326,11 +326,15 @@ interface KnownIntrinsicElementProps {
326
326
  }
327
327
  //#endregion
328
328
  //#region src/common/jsx.d.ts
329
+ /** The element type marker for JSX fragments (`<>...</>`), groups children without a wrapper element. */
329
330
  declare const Fragment: unique symbol;
331
+ /** A component function accepting `TProps`, usable as a JSX element's `type`. */
330
332
  type JSXComponent<TProps extends object = Props> = {
331
333
  bivarianceHack(props: TProps): unknown;
332
334
  }['bivarianceHack'];
335
+ /** Valid `type` values for a JSX element: a tag name, a component, or a symbol (e.g. `Fragment`). */
333
336
  type JSXElementType = string | JSXComponent | symbol;
337
+ /** The vnode shape produced by JSX/`jsx()` calls. */
334
338
  interface JSXElement {
335
339
  /** Internal element marker */
336
340
  $$typeof: symbol;
@@ -1,6 +1,6 @@
1
1
  import { g as getHydrationRenderUrl, m as withHydrationVerificationRender } from "./render-context-B7ohlh6t.js";
2
2
  import { t as SSR_RENDER_DATA_ATTR } from "./ssr-DSHd_Q9K.js";
3
- import { a as renderResolvedToStringSync } from "./ssr-CaZfvQWn.js";
3
+ import { a as renderResolvedToStringSync } from "./ssr-8_vHDWqV.js";
4
4
  //#region src/ssr/verify-hydration.ts
5
5
  function normalizeHydrationHtml(html) {
6
6
  const template = document.createElement("template");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askrjs/askr",
3
- "version": "0.0.92",
3
+ "version": "0.0.94",
4
4
  "description": "Actor-backed deterministic UI framework",
5
5
  "keywords": [
6
6
  "askr",
@@ -1,241 +0,0 @@
1
- //#region src/data/types.d.ts
2
- type QueryConsistency = 'fresh' | 'stale' | 'refreshing' | 'pending-write';
3
- type QueryStaleReason = 'aborted' | 'error' | 'inconsistent';
4
- interface DataRuntime {
5
- readonly queryCache: Map<string, unknown>;
6
- readonly queryData: Map<string, unknown>;
7
- /** Test-only query overrides keyed by the canonical query key. */
8
- readonly queryTestOverrides: Map<string, unknown>;
9
- /** Test-only mutation overrides keyed by the canonical mutation key. */
10
- readonly mutationTestOverrides: Map<string, unknown>;
11
- }
12
- interface DataRuntimeOptions {
13
- queryCache?: Map<string, unknown>;
14
- queryData?: Map<string, unknown>;
15
- queryTestOverrides?: Map<string, unknown>;
16
- mutationTestOverrides?: Map<string, unknown>;
17
- }
18
- interface QueryDefinition<TInput, TResult extends {}> {
19
- readonly key: (input: TInput) => string;
20
- readonly fetch: (context: TInput & {
21
- signal: AbortSignal;
22
- }) => Promise<TResult>;
23
- readonly isConsistent?: (data: TResult) => boolean;
24
- readonly reconcile?: (data: TResult, context: {
25
- key: string;
26
- }) => Promise<boolean> | boolean;
27
- }
28
- interface QueryPrefetchContext {
29
- readonly runtime: DataRuntime;
30
- readonly request?: Request;
31
- readonly signal: AbortSignal;
32
- readonly mode: 'ssr' | 'spa';
33
- prefetch<TInput, TResult extends {}>(query: QueryDefinition<TInput, TResult>, input: TInput): Promise<boolean>;
34
- }
35
- type ServerQueryHandler<TInput, TResult extends {}> = (context: {
36
- input: TInput;
37
- request?: Request;
38
- signal: AbortSignal;
39
- }) => Promise<TResult> | TResult;
40
- interface InvalidateOptions {
41
- markPendingWrite?: boolean;
42
- runtime?: DataRuntime;
43
- }
44
- interface InvalidateOnIntervalOptions extends InvalidateOptions {
45
- intervalMs: number;
46
- activeOn?: string | readonly string[];
47
- visibleOnly?: boolean;
48
- focusedOnly?: boolean;
49
- }
50
- type QueryKeyPart = string | number | boolean | null | undefined | readonly QueryKeyPart[] | {
51
- readonly [key: string]: QueryKeyPart;
52
- };
53
- interface QueryScope {
54
- key(...parts: QueryKeyPart[]): string;
55
- prefix(...parts: QueryKeyPart[]): string;
56
- invalidate(parts: readonly QueryKeyPart[], options?: InvalidateOptions): void;
57
- }
58
- type QueryControls = {
59
- refresh(): Promise<void>;
60
- };
61
- type QueryLoading = {
62
- data: null;
63
- error: null;
64
- loading: true;
65
- refreshing: false;
66
- stale: false;
67
- consistency: 'fresh';
68
- staleReason: null;
69
- };
70
- type QueryFresh<T> = {
71
- data: T;
72
- error: null;
73
- loading: false;
74
- refreshing: false;
75
- stale: false;
76
- consistency: 'fresh';
77
- staleReason: null;
78
- };
79
- type QueryRefreshing<T> = {
80
- data: T;
81
- error: null;
82
- loading: false;
83
- refreshing: true;
84
- stale: true;
85
- consistency: 'refreshing';
86
- staleReason: null;
87
- };
88
- type QueryPendingWrite<T> = {
89
- data: T;
90
- error: null;
91
- loading: false;
92
- refreshing: true;
93
- stale: true;
94
- consistency: 'pending-write';
95
- staleReason: null;
96
- };
97
- type QueryStaleValue<T> = {
98
- data: T;
99
- error: null;
100
- loading: false;
101
- refreshing: false;
102
- stale: true;
103
- consistency: 'stale';
104
- staleReason: 'aborted' | 'inconsistent';
105
- };
106
- type QueryStaleErrorWithValue<T> = {
107
- data: T;
108
- error: {};
109
- loading: false;
110
- refreshing: false;
111
- stale: true;
112
- consistency: 'stale';
113
- staleReason: 'error';
114
- };
115
- type QueryStaleError = {
116
- data: null;
117
- error: {};
118
- loading: false;
119
- refreshing: false;
120
- stale: true;
121
- consistency: 'stale';
122
- staleReason: 'error';
123
- };
124
- type Query<T extends {}> = QueryControls & (QueryLoading | QueryFresh<T> | QueryRefreshing<T> | QueryPendingWrite<T> | QueryStaleValue<T> | QueryStaleErrorWithValue<T> | QueryStaleError);
125
- type MutationControls<TInput, TResult> = {
126
- execute(input: TInput): Promise<TResult>;
127
- abort(): void;
128
- reset(): void;
129
- };
130
- type MutationIdle = {
131
- status: 'idle';
132
- pending: false;
133
- error: null;
134
- result: null;
135
- };
136
- type MutationPending = {
137
- status: 'pending';
138
- pending: true;
139
- error: null;
140
- result: null;
141
- };
142
- type MutationSuccess<TResult> = {
143
- status: 'success';
144
- pending: false;
145
- error: null;
146
- result: TResult;
147
- };
148
- type MutationError = {
149
- status: 'error';
150
- pending: false;
151
- error: {};
152
- result: null;
153
- };
154
- type Mutation<TInput, TResult> = MutationControls<TInput, TResult> & (MutationIdle | MutationPending | MutationSuccess<TResult> | MutationError);
155
- type QueryOptions<T> = {
156
- key: string;
157
- fetch: (ctx: {
158
- signal: AbortSignal;
159
- }) => Promise<T>;
160
- isConsistent?: (data: T) => boolean;
161
- reconcile?: (data: T, ctx: {
162
- key: string;
163
- }) => Promise<boolean> | boolean;
164
- runtime?: DataRuntime;
165
- initialData?: T;
166
- skipInitialFetch?: boolean;
167
- };
168
- type MutationOptions<TInput, TResult> = {
169
- /** Stable identity used by runtime-scoped mutation test overrides. */
170
- key?: string;
171
- action: (input: TInput, ctx: {
172
- signal: AbortSignal;
173
- }) => Promise<TResult>;
174
- affects?: (input: TInput, result: TResult) => string[];
175
- afterSuccess?: 'invalidate';
176
- runtime?: DataRuntime;
177
- };
178
- //#endregion
179
- //#region src/common/telemetry.d.ts
180
- interface TelemetryFields {
181
- requestId?: string;
182
- traceId?: string;
183
- route?: string;
184
- action?: string;
185
- operation?: string;
186
- status?: number;
187
- durationMs?: number;
188
- }
189
- type TelemetrySpan = <T>(fields: TelemetryFields, work: () => T) => T;
190
- /**
191
- * Structural subset implemented by `createTelemetry()` from `@askrjs/otel`.
192
- * Core does not install an OpenTelemetry SDK, backend, or exporter.
193
- */
194
- interface CoreTelemetry {
195
- routeMatch?: TelemetrySpan;
196
- loader?: TelemetrySpan;
197
- queryPrefetch?: TelemetrySpan;
198
- ssrRender?: TelemetrySpan;
199
- }
200
- //#endregion
201
- //#region src/data/mutation-cell.d.ts
202
- declare function createMutation<TInput, TResult>(options: MutationOptions<TInput, TResult>): Mutation<TInput, TResult>;
203
- //#endregion
204
- //#region src/data/query-cell.d.ts
205
- declare function createQuery<T extends {}>(options: QueryOptions<T>): Query<T>;
206
- declare function createQuery<TInput, TResult extends {}>(definition: QueryDefinition<TInput, TResult>, input: TInput, options?: Omit<QueryOptions<TResult>, 'key' | 'fetch'>): Query<TResult>;
207
- //#endregion
208
- //#region src/data/data-runtime.d.ts
209
- declare function createDataRuntime(options?: DataRuntimeOptions): DataRuntime;
210
- declare function getDefaultDataRuntime(): DataRuntime;
211
- //#endregion
212
- //#region src/data/invalidation.d.ts
213
- declare function invalidate(prefix: string, options?: InvalidateOptions): void;
214
- declare function queryScope(namespace: string): QueryScope;
215
- declare function invalidateOnInterval(prefix: string, options: InvalidateOnIntervalOptions): void;
216
- //#endregion
217
- //#region src/data/query-registry.d.ts
218
- interface ServerQueryRegistry {
219
- readonly entries: readonly ServerQueryEntry<unknown, {}>[];
220
- get<TInput, TResult extends {}>(query: QueryDefinition<TInput, TResult>): ServerQueryHandler<TInput, TResult> | undefined;
221
- }
222
- interface ServerQueryEntry<TInput, TResult extends {}> {
223
- readonly query: QueryDefinition<TInput, TResult>;
224
- readonly handler: ServerQueryHandler<TInput, TResult>;
225
- }
226
- declare function serveQuery<TInput, TResult extends {}>(query: QueryDefinition<TInput, TResult>, handler: ServerQueryHandler<TInput, TResult>): ServerQueryEntry<TInput, TResult>;
227
- declare function defineServerQueries(...entries: readonly ServerQueryEntry<any, any>[]): ServerQueryRegistry;
228
- declare function defineQuery<TInput, TResult extends {}>(definition: QueryDefinition<TInput, TResult>): QueryDefinition<TInput, TResult>;
229
- declare function createQueryPrefetchContext(options?: {
230
- runtime?: DataRuntime;
231
- registry?: ServerQueryRegistry;
232
- request?: Request;
233
- signal?: AbortSignal;
234
- mode?: 'ssr' | 'spa';
235
- telemetry?: CoreTelemetry;
236
- }): QueryPrefetchContext;
237
- declare function prefetchQuery<TInput, TResult extends {}>(context: QueryPrefetchContext, query: QueryDefinition<TInput, TResult>, input: TInput): Promise<boolean>;
238
- declare function dehydrateDataRuntime(runtime: DataRuntime): Record<string, unknown>;
239
- declare function hydrateDataRuntime(runtime: DataRuntime, data: unknown): void;
240
- //#endregion
241
- export { QueryStaleReason as A, MutationOptions as C, QueryKeyPart as D, QueryDefinition as E, QueryPrefetchContext as O, Mutation as S, QueryConsistency as T, CoreTelemetry as _, defineServerQueries as a, InvalidateOnIntervalOptions as b, prefetchQuery as c, invalidateOnInterval as d, queryScope as f, createMutation as g, createQuery as h, defineQuery as i, ServerQueryHandler as j, QueryScope as k, serveQuery as l, getDefaultDataRuntime as m, ServerQueryRegistry as n, dehydrateDataRuntime as o, createDataRuntime as p, createQueryPrefetchContext as r, hydrateDataRuntime as s, ServerQueryEntry as t, invalidate as u, DataRuntime as v, Query as w, InvalidateOptions as x, DataRuntimeOptions as y };
@@ -1,2 +0,0 @@
1
- import "./types-BA9FJtfR.js";
2
- import "./jsx-runtime-Cfb2umb4.js";
@@ -1,65 +0,0 @@
1
- //#region src/runtime/scheduler.d.ts
2
- /**
3
- * Serialized update scheduler — safer design (no inline execution, explicit flush)
4
- *
5
- * Key ideas:
6
- * - Never execute a task inline from `enqueue`.
7
- * - `flush()` is explicit and non-reentrant.
8
- * - `runWithSyncProgress()` allows enqueues temporarily but does not run tasks
9
- * inline; it runs `fn` and then does an explicit `flush()`.
10
- * - `waitForFlush()` is race-free with a monotonic `flushVersion`.
11
- */
12
- type Task = () => void;
13
- type SchedulerLane = 'derived' | 'component' | 'reactive' | 'post';
14
- type SchedulerBulkCommitProbe = () => boolean;
15
- declare class Scheduler {
16
- private bulkCommitProbe;
17
- private lanes;
18
- private running;
19
- private inHandler;
20
- private depth;
21
- private executionDepth;
22
- private flushVersion;
23
- private kickScheduled;
24
- private allowSyncProgress;
25
- private waiters;
26
- private taskCount;
27
- setBulkCommitProbe(probe: SchedulerBulkCommitProbe): void;
28
- private isBulkCommitActive;
29
- private hasPendingTasks;
30
- private getPendingTaskCount;
31
- private compactLane;
32
- private scheduleFlushKick;
33
- enqueue(task: Task): void;
34
- enqueueInLane(lane: SchedulerLane, task: Task): void;
35
- flush(): void;
36
- runWithSyncProgress<T>(fn: () => T): T;
37
- waitForFlush(targetVersion?: number, timeoutMs?: number): Promise<void>;
38
- getState(): {
39
- queueLength: number;
40
- running: boolean;
41
- depth: number;
42
- executionDepth: number;
43
- taskCount: number;
44
- flushVersion: number;
45
- laneQueues: {
46
- derived: number;
47
- component: number;
48
- reactive: number;
49
- post: number;
50
- };
51
- inHandler: boolean;
52
- allowSyncProgress: boolean;
53
- };
54
- getFlushVersion(): number;
55
- flushIfQueued(): void;
56
- runInHandlerScope<T>(fn: () => T, flushMode?: 'defer' | 'sync'): T;
57
- setInHandler(v: boolean): void;
58
- isInHandler(): boolean;
59
- isExecuting(): boolean;
60
- clearPendingSyncTasks(): number;
61
- private resolveWaiters;
62
- }
63
- declare function scheduleEventHandler(handler: EventListener): EventListener;
64
- //#endregion
65
- export { scheduleEventHandler as n, Scheduler as t };