@askrjs/askr 0.2.4 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/access-CEA2pOry.js +1046 -0
  3. package/dist/actions/index.d.ts +16 -2
  4. package/dist/actions/index.js +5 -5
  5. package/dist/{activity-FirwPXA_.js → activity-oy2YFTFF.js} +10 -16
  6. package/dist/benchmark.js +8 -9
  7. package/dist/boot/index.d.ts +19 -9
  8. package/dist/boot/index.js +1 -1
  9. package/dist/{boot-tWyF6121.js → boot-BMBMWUGI.js} +680 -441
  10. package/dist/capabilities-Bbf0mlp9.js +42 -0
  11. package/dist/components/index.d.ts +11 -8
  12. package/dist/components/index.js +1 -1
  13. package/dist/{compose-ref-Bfaf4kUC.js → compose-ref-v0qGlHoN.js} +7 -1
  14. package/dist/control/index.d.ts +20 -2
  15. package/dist/control/index.js +1 -1
  16. package/dist/{control-C-wSaq9V.js → control-BR_mrX__.js} +4 -4
  17. package/dist/core.d.ts +163 -0
  18. package/dist/csp-nonce-BfFWcd0w.js +173 -0
  19. package/dist/data/index.d.ts +74 -2
  20. package/dist/data/index.js +3 -3
  21. package/dist/{data-ghKopAbp.js → data-2edW0jhF.js} +108 -122
  22. package/dist/{data-runtime-7t_Y0iv3.js → data-runtime-CxoY98lX.js} +22 -15
  23. package/dist/{deferred-CxjWCkIn.js → deferred-CbgNhf67.js} +5 -5
  24. package/dist/dom-renderer.d.ts +77 -0
  25. package/dist/domains/actions.d.ts +70 -0
  26. package/dist/domains/component.d.ts +119 -0
  27. package/dist/domains/context.d.ts +73 -0
  28. package/dist/domains/control.d.ts +328 -0
  29. package/dist/domains/data.d.ts +461 -0
  30. package/dist/domains/diagnostics.d.ts +21 -0
  31. package/dist/domains/lifecycle.d.ts +112 -0
  32. package/dist/domains/refs.d.ts +18 -0
  33. package/dist/domains/renderer.d.ts +127 -0
  34. package/dist/domains/routing.d.ts +501 -0
  35. package/dist/domains/scheduler.d.ts +79 -0
  36. package/dist/domains/server.d.ts +112 -0
  37. package/dist/domains/state.d.ts +129 -0
  38. package/dist/domains/telemetry.d.ts +29 -0
  39. package/dist/eager-control.d.ts +8 -0
  40. package/dist/{effect-CNwstBBD.js → effect-C3Zsc1k6.js} +14 -41
  41. package/dist/{types-DWVrKn9N.d.ts → elements.d.ts} +79 -42
  42. package/dist/{for-internal-DyBHfKJA.js → for-state-BDykeOJL.js} +598 -494
  43. package/dist/foundations/icon/index.d.ts +67 -16
  44. package/dist/foundations/icon/index.js +1 -1
  45. package/dist/foundations/index.d.ts +26 -3
  46. package/dist/foundations/index.js +1 -1
  47. package/dist/foundations/interactions/index.d.ts +73 -34
  48. package/dist/foundations/interactions/index.js +1 -1
  49. package/dist/foundations/state/index.d.ts +12 -5
  50. package/dist/foundations/state/index.js +1 -1
  51. package/dist/foundations/structures/index.d.ts +44 -3
  52. package/dist/foundations/structures/index.js +1 -1
  53. package/dist/foundations/utilities/index.d.ts +34 -3
  54. package/dist/foundations/utilities/index.js +1 -1
  55. package/dist/fx/index.d.ts +72 -25
  56. package/dist/fx/index.js +8 -8
  57. package/dist/index.d.ts +121 -4
  58. package/dist/index.js +316 -47
  59. package/dist/{component-internal-C4hKKQBF.js → instance-VAFYVJOa.js} +495 -283
  60. package/dist/{interactions-D102JxBR.js → interactions-CTeACdT_.js} +1 -1
  61. package/dist/jsx-dev-runtime.d.ts +51 -11
  62. package/dist/jsx-globals.d.ts +2 -0
  63. package/dist/jsx-runtime-CPJXAOBF.js +43 -0
  64. package/dist/jsx-runtime.d.ts +17 -3
  65. package/dist/jsx-runtime.js +2 -42
  66. package/dist/jsx.d.ts +108 -0
  67. package/dist/{manifest-D6rfj_jC.js → manifest-D1P3UNWV.js} +4 -9
  68. package/dist/{navigate-ZZu1IV0B.js → navigate-prC5V8XV.js} +125 -472
  69. package/dist/{navigate-F4sHgWbw.d.ts → navigation.d.ts} +8 -8
  70. package/dist/{readable-Di1fzSwm.js → notify-DxxuDPeY.js} +96 -34
  71. package/dist/{query-registry-Bua3cDyb.js → query-registry-LrYpQsDJ.js} +1 -1
  72. package/dist/{compose-ref-DOJHoW5X.d.ts → refs.d.ts} +11 -7
  73. package/dist/{ssr-Doog-AfJ.js → render-resolved-BC0W7_5b.js} +165 -558
  74. package/dist/{renderer-Cl23O0hV.js → renderer-CT0HeY58.js} +6825 -5692
  75. package/dist/{resolution-ClD-K7Lz.js → resolution-3DskUkjG.js} +189 -180
  76. package/dist/{resource-operation-Vz1S5h2k.js → resource-18-sFRl9.js} +98 -58
  77. package/dist/resources/index.d.ts +64 -12
  78. package/dist/resources/index.js +214 -8
  79. package/dist/route-activity.d.ts +21 -0
  80. package/dist/{route-matching-Bo6UqG-5.js → route-matching-CUzZ31gT.js} +68 -82
  81. package/dist/router/index.d.ts +378 -79
  82. package/dist/router/index.js +9 -9
  83. package/dist/router-internal-7nuNEHfG.js +36 -0
  84. package/dist/scope-Cq_iYbTR.js +403 -0
  85. package/dist/{selector-CsKuomw0.js → selector-BSPVkjKP.js} +26 -27
  86. package/dist/{shared-CYBH3F8I.js → shared-kU8yvryp.js} +3 -6
  87. package/dist/{snapshot-source-BB42xgwb.js → snapshot-source-An4iKajG.js} +1 -1
  88. package/dist/ssg/index.d.ts +51 -15
  89. package/dist/ssg/index.js +269 -209
  90. package/dist/ssr/index.d.ts +121 -68
  91. package/dist/ssr/index.js +2 -1
  92. package/dist/ssr-CiNm6Vzl.js +393 -0
  93. package/dist/{ssr-DSHd_Q9K.js → ssr-EPjwJH5R.js} +5 -1
  94. package/dist/{state-BGJgYSyQ.js → state-BXJfudq1.js} +10 -15
  95. package/dist/{structures-DFyK5AdQ.js → structures-CjEzfj4h.js} +37 -57
  96. package/dist/{index-CTpMmzgN.d.ts → structures.d.ts} +57 -36
  97. package/dist/testing/index.d.ts +123 -24
  98. package/dist/testing/index.js +24 -61
  99. package/dist/timer-C7uqnJVt.js +85 -0
  100. package/dist/{index-B1gu0_m0.d.ts → utilities.d.ts} +24 -13
  101. package/dist/{verify-hydration-BZPJ_kYa.js → verify-hydration-ikaxotf7.js} +8 -5
  102. package/package.json +12 -14
  103. package/dist/access-BucjYZcX.js +0 -509
  104. package/dist/activity-DooIuxQO.d.ts +0 -14
  105. package/dist/benchmark.d.ts +0 -26
  106. package/dist/cleanup-TXSsApEl.js +0 -535
  107. package/dist/component-cleanup-jdbgjkT1.js +0 -143
  108. package/dist/component-scope-4I3yEMkb.js +0 -195
  109. package/dist/control-Cxag1yqV.d.ts +0 -8
  110. package/dist/csp-nonce-9NFUb7hJ.js +0 -72
  111. package/dist/css-BuPaTOfe.js +0 -70
  112. package/dist/fastlane-BKZduiBQ.js +0 -166
  113. package/dist/index-Dgjbo2gU.d.ts +0 -1456
  114. package/dist/jsx-runtime-Cg7GqY1S.d.ts +0 -2
  115. package/dist/jsx-runtime-gVIaTPw0.d.ts +0 -38
  116. package/dist/lifecycle-batch-63aXFf2S.js +0 -253
  117. package/dist/lifecycle-operations-Q0k3EFnG.js +0 -287
@@ -1,5 +1,4 @@
1
- import "./index-Dgjbo2gU.js";
2
- //#region src/router/navigation-scroll.d.ts
1
+ import './core.js';
3
2
  /** Scroll behavior for programmatic navigations (`navigate()`). */
4
3
  type NavigationScrollBehavior = 'top' | 'preserve';
5
4
  /** Scroll behavior for browser back/forward (popstate) navigations. */
@@ -9,8 +8,6 @@ type ScrollRestorationOptions = {
9
8
  navigation?: NavigationScrollBehavior;
10
9
  history?: HistoryScrollBehavior;
11
10
  };
12
- //#endregion
13
- //#region src/router/navigation-targets.d.ts
14
11
  /** Options for {@link navigate}. */
15
12
  type NavigateOptions = {
16
13
  history?: 'push' | 'replace';
@@ -19,9 +16,12 @@ type NavigateOptions = {
19
16
  /** Entry-local browser history state. It is not serialized into the URL or sent to the server. */
20
17
  state?: unknown;
21
18
  };
22
- //#endregion
23
- //#region src/router/navigate.d.ts
24
19
  /** Navigate the client-side router to `path` using the History API. */
25
20
  declare function navigate(path: string, options?: NavigateOptions): void;
26
- //#endregion
27
- export { ScrollRestorationOptions as a, NavigationScrollBehavior as i, NavigateOptions as n, HistoryScrollBehavior as r, navigate as t };
21
+ export {
22
+ ScrollRestorationOptions,
23
+ NavigationScrollBehavior,
24
+ NavigateOptions,
25
+ HistoryScrollBehavior,
26
+ navigate,
27
+ };
@@ -1,6 +1,6 @@
1
- import { c as markRuntimeReactivePropsDirtySource, n as enqueueRuntimeTask, s as isRuntimeSchedulerExecuting } from "./access-BucjYZcX.js";
2
- import { p as getCurrentInstance } from "./component-scope-4I3yEMkb.js";
3
- //#region src/runtime/readable.ts
1
+ import { _ as defaultRuntimeState, d as markRuntimeReactivePropsDirtySource, n as enqueueRuntimeTask, u as isRuntimeSchedulerExecuting } from "./access-CEA2pOry.js";
2
+ import { f as getCurrentComponentInstance } from "./scope-Cq_iYbTR.js";
3
+ //#region src/runtime/reactivity/readable.ts
4
4
  const DEVELOPMENT_BUILD_ENABLED = false;
5
5
  function markReadableUsage(source) {
6
6
  if (source && typeof source === "function" && ("_hasBeenRead" in source || "_readers" in source)) {
@@ -13,7 +13,7 @@ let currentDerivedSubscriber = null;
13
13
  let suppressComponentReadTrackingDepth = 0;
14
14
  let currentFineGrainedReadCollector = null;
15
15
  function scheduleReadableInstanceUpdate(instance) {
16
- if (instance.hasPendingUpdate) return;
16
+ if (instance.owner.disposed || instance.hasPendingUpdate) return;
17
17
  instance.hasPendingUpdate = true;
18
18
  const task = instance._pendingFlushTask;
19
19
  if (task) {
@@ -49,7 +49,7 @@ function recordReadableRead(source) {
49
49
  currentDerivedSubscriber._pendingDependencySources.add(source);
50
50
  }
51
51
  if (suppressComponentReadTrackingDepth > 0) return;
52
- const inst = getCurrentInstance();
52
+ const inst = getCurrentComponentInstance();
53
53
  if (!inst || inst._currentRenderToken === void 0) return;
54
54
  if (!inst._pendingReadSources) inst._pendingReadSources = /* @__PURE__ */ new Set();
55
55
  inst._pendingReadSources.add(source);
@@ -74,23 +74,14 @@ function withFineGrainedReadTracking(collector, fn) {
74
74
  function shouldCoalesceFineGrainedItemReads() {
75
75
  return (currentFineGrainedReadCollector?._owner)?._coalesceForItemReads === true;
76
76
  }
77
- function finalizeReadableSubscriptions(instance) {
78
- const newSet = instance._pendingReadSources;
79
- const token = instance._currentRenderToken;
80
- const pendingVersions = instance._pendingReadSourceVersions;
81
- finalizeReadableSubscriptionsFromSnapshot(instance, token, newSet, pendingVersions);
82
- instance._pendingReadSources = void 0;
83
- instance._currentRenderToken = void 0;
84
- instance._pendingReadSourceVersions = void 0;
85
- }
86
- function finalizeReadableSubscriptionsFromSnapshot(instance, token, newSet, pendingReadSourceVersions = instance._pendingReadSourceVersions, ownershipGeneration = instance._ownershipGeneration) {
87
- if (token === void 0 || instance._ownershipGeneration !== ownershipGeneration || !instance.mounted && instance.notifyUpdate === null) return;
88
- const oldSet = instance._lastReadSources;
77
+ function finalizeReadableSubscriptionsFromSnapshot(instance, token, newSet, pendingReadSourceVersions = instance._pendingReadSourceVersions, ownershipGeneration = instance.owner.identity) {
78
+ if (instance.owner.disposed || token === void 0 || instance.owner.identity !== ownershipGeneration || !instance.owner.mounted && instance.notifyUpdate === null) return;
79
+ const oldSet = instance.owner.reads;
89
80
  const pendingVersions = pendingReadSourceVersions;
90
81
  let needsFollowUpUpdate = false;
91
82
  if (oldSet) {
92
83
  for (const source of oldSet) if (!newSet?.has(source)) {
93
- if ((source._readers?.get(instance))?.generation === instance._ownershipGeneration) {
84
+ if ((source._readers?.get(instance))?.generation === instance.owner.identity) {
94
85
  if (source._readers?.delete(instance) && DEVELOPMENT_BUILD_ENABLED);
95
86
  }
96
87
  }
@@ -110,24 +101,12 @@ function finalizeReadableSubscriptionsFromSnapshot(instance, token, newSet, pend
110
101
  readers.has(instance);
111
102
  readers.set(instance, {
112
103
  token: instance.lastRenderToken ?? 0,
113
- generation: instance._ownershipGeneration
104
+ generation: instance.owner.identity
114
105
  });
115
106
  }
116
- instance._lastReadSources = newSet?.size ? newSet : void 0;
107
+ instance.owner.reads = newSet?.size ? newSet : void 0;
117
108
  if (needsFollowUpUpdate) scheduleReadableInstanceUpdate(instance);
118
109
  }
119
- function cleanupReadableSubscriptions(instance, generation = instance._ownershipGeneration) {
120
- const sources = instance._lastReadSources;
121
- if (!sources || sources.size === 0) {
122
- instance._pendingReadSources = void 0;
123
- instance._pendingReadSourceVersions = void 0;
124
- return;
125
- }
126
- cleanupReadableSubscriptionSources(instance, sources, generation);
127
- instance._lastReadSources = void 0;
128
- instance._pendingReadSources = void 0;
129
- instance._pendingReadSourceVersions = void 0;
130
- }
131
110
  /** @internal Detach an exact committed read set without mutating another live generation. */
132
111
  function cleanupReadableSubscriptionSources(instance, sources, generation) {
133
112
  if (!sources) return;
@@ -193,7 +172,7 @@ function notifyReadableReaders(source, skipInstance, skipOwnedBy) {
193
172
  }
194
173
  if (isOwned) continue;
195
174
  }
196
- if (instance._ownershipGeneration !== reader.generation || instance.lastRenderToken !== reader.token) continue;
175
+ if (instance.owner.identity !== reader.generation || instance.lastRenderToken !== reader.token) continue;
197
176
  if (instance.hasPendingUpdate) continue;
198
177
  scheduleReadableInstanceUpdate(instance);
199
178
  didScheduleUpdate = true;
@@ -201,4 +180,87 @@ function notifyReadableReaders(source, skipInstance, skipOwnedBy) {
201
180
  return didScheduleUpdate;
202
181
  }
203
182
  //#endregion
204
- export { finalizeReadableSubscriptionsFromSnapshot as a, markReadableUsage as c, shouldCoalesceFineGrainedItemReads as d, syncDerivedDependencySubscriptions as f, finalizeReadableSubscriptions as i, notifyReadableReaders as l, withFineGrainedReadTracking as m, cleanupReadableSubscriptions as n, markReactivePropsDirtySource as o, withDerivedReadTracking as p, clearDerivedDependencySubscriptions as r, markReadableDerivedSubscribersDirty as s, cleanupReadableSubscriptionSources as t, recordReadableRead as u };
183
+ //#region src/runtime/transactions/access.ts
184
+ /**
185
+ * Resolved per call rather than captured at import time.
186
+ *
187
+ * Binding the coordinator once when this module is first evaluated meant these
188
+ * helpers could never follow a runtime whose state was replaced afterwards —
189
+ * the import order of an unrelated module decided which coordinator they used.
190
+ */
191
+ function commitCoordinator() {
192
+ return defaultRuntimeState.commits;
193
+ }
194
+ function beginCommitTransaction() {
195
+ return commitCoordinator().begin();
196
+ }
197
+ function getCurrentCommitTransaction() {
198
+ const transaction = commitCoordinator().current;
199
+ return transaction?.active ? transaction : null;
200
+ }
201
+ function deferCommitNotification(key, notify) {
202
+ return commitCoordinator().deferCompletion(key, notify);
203
+ }
204
+ function commitTransaction(transaction) {
205
+ commitCoordinator().commit(transaction);
206
+ }
207
+ function discardTransaction(transaction) {
208
+ commitCoordinator().discard(transaction);
209
+ }
210
+ function suspendTransaction(transaction) {
211
+ commitCoordinator().suspend(transaction);
212
+ }
213
+ function applyTransaction(transaction, operation) {
214
+ return commitCoordinator().apply(transaction, operation);
215
+ }
216
+ function registerCommitParticipant(participant) {
217
+ return commitCoordinator().register(participant);
218
+ }
219
+ function registerCommitEffect(key, settle, rollback, merge) {
220
+ return registerCommitParticipant({
221
+ key,
222
+ settle,
223
+ rollback,
224
+ merge
225
+ });
226
+ }
227
+ function registerCommitRollback(rollback) {
228
+ return registerCommitParticipant({ rollback });
229
+ }
230
+ function runCommitTransaction(operation) {
231
+ const transaction = beginCommitTransaction();
232
+ try {
233
+ const result = applyTransaction(transaction, operation);
234
+ commitTransaction(transaction);
235
+ return result;
236
+ } catch (error) {
237
+ discardTransaction(transaction);
238
+ throw error;
239
+ } finally {
240
+ suspendTransaction(transaction);
241
+ }
242
+ }
243
+ /** Operation boundaries reuse their enclosing transaction, or own its lifetime. */
244
+ function runCommitOperation(operation) {
245
+ return getCurrentCommitTransaction() ? operation() : runCommitTransaction(operation);
246
+ }
247
+ //#endregion
248
+ //#region src/runtime/reactivity/notify.ts
249
+ /**
250
+ * Publish a change to everything subscribed to `source`.
251
+ *
252
+ * A readable source has four kinds of subscriber — derived values, reactive
253
+ * props (and, through them, fine-grained effects), and component readers — and
254
+ * every one of them has to be told, in this order. That sequence was written
255
+ * out by hand at nine call sites across the reactivity core, portals, control
256
+ * flow, the router and the data layer, and had already drifted into four
257
+ * variants; the only named copy lived in `data/`, which the runtime cannot
258
+ * import. It belongs here, beside the three primitives it drives.
259
+ */
260
+ function notifyReadableSource(source, options) {
261
+ markReadableDerivedSubscribersDirty(source, options?.skipCurrentDerivedSubscriber);
262
+ markReactivePropsDirtySource(source);
263
+ notifyReadableReaders(source, options?.skipInstance, options?.skipOwnedBy);
264
+ }
265
+ //#endregion
266
+ export { withFineGrainedReadTracking as S, markReadableUsage as _, deferCommitNotification as a, syncDerivedDependencySubscriptions as b, registerCommitEffect as c, runCommitOperation as d, runCommitTransaction as f, finalizeReadableSubscriptionsFromSnapshot as g, clearDerivedDependencySubscriptions as h, commitTransaction as i, registerCommitParticipant as l, cleanupReadableSubscriptionSources as m, applyTransaction as n, discardTransaction as o, suspendTransaction as p, beginCommitTransaction as r, getCurrentCommitTransaction as s, notifyReadableSource as t, registerCommitRollback as u, recordReadableRead as v, withDerivedReadTracking as x, shouldCoalesceFineGrainedItemReads as y };
@@ -1,4 +1,4 @@
1
- import { i as getDefaultDataRuntime, t as createDataRuntime } from "./data-runtime-7t_Y0iv3.js";
1
+ import { i as getDefaultDataRuntime, t as createDataRuntime } from "./data-runtime-CxoY98lX.js";
2
2
  //#region src/common/telemetry.ts
3
3
  function withTelemetry(span, fields, work) {
4
4
  return span ? span(fields, work) : work();
@@ -1,4 +1,3 @@
1
- //#region src/foundations/utilities/compose-ref.d.ts
2
1
  /**
3
2
  * Ref composition utilities
4
3
  *
@@ -18,12 +17,17 @@
18
17
  * All refs are called even if one fails.
19
18
  */
20
19
  /** A callback ref, an object ref, or a nullish value (no-op). */
21
- type Ref<T> = ((value: T | null) => void) | {
22
- current: T | null;
23
- } | null | undefined;
20
+ type Ref<T> =
21
+ | ((value: T | null) => void)
22
+ | {
23
+ current: T | null;
24
+ }
25
+ | null
26
+ | undefined;
24
27
  /** Write `value` to a {@link Ref}, ignoring failures on readonly object refs. */
25
28
  declare function setRef<T>(ref: Ref<T>, value: T | null): void;
26
29
  /** Combine multiple refs into one callback ref that writes to all of them. */
27
- declare function composeRefs<T>(...refs: Array<Ref<T>>): (value: T | null) => void;
28
- //#endregion
29
- export { composeRefs as n, setRef as r, Ref as t };
30
+ declare function composeRefs<T>(
31
+ ...refs: Array<Ref<T>>
32
+ ): (value: T | null) => void;
33
+ export { composeRefs, setRef, Ref };