@askrjs/askr 0.0.21 → 0.0.24

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 (294) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +160 -46
  3. package/dist/_virtual/___vite-browser-external.js +1 -0
  4. package/dist/_virtual/__vite-browser-external.js +1 -0
  5. package/dist/_virtual/_commonjsHelpers.js +1 -0
  6. package/dist/_virtual/main.js +1 -0
  7. package/dist/_virtual/preload-helper.js +1 -0
  8. package/dist/{benchmark.d.ts → bench/benchmark-entry.d.ts} +3 -3
  9. package/dist/bench/benchmark-entry.d.ts.map +1 -0
  10. package/dist/benchmark.js +1 -1
  11. package/dist/boot/index.d.ts +70 -0
  12. package/dist/boot/index.d.ts.map +1 -0
  13. package/dist/boot/index.js +2 -0
  14. package/dist/common/component.d.ts +16 -0
  15. package/dist/common/component.d.ts.map +1 -0
  16. package/dist/common/errors.d.ts +53 -0
  17. package/dist/common/errors.d.ts.map +1 -0
  18. package/dist/common/index.d.ts +14 -0
  19. package/dist/common/index.d.ts.map +1 -0
  20. package/dist/common/jsx.d.ts +17 -0
  21. package/dist/common/jsx.d.ts.map +1 -0
  22. package/dist/common/jsx.js +1 -0
  23. package/dist/{jsx-CPjsGyEg.d.ts → common/props.d.ts} +6 -18
  24. package/dist/common/props.d.ts.map +1 -0
  25. package/dist/{router-DaGtH1Sq.d.ts → common/router.d.ts} +10 -7
  26. package/dist/common/router.d.ts.map +1 -0
  27. package/dist/common/ssr-errors.d.ts +8 -0
  28. package/dist/common/ssr-errors.d.ts.map +1 -0
  29. package/dist/common/ssr-errors.js +1 -0
  30. package/dist/common/ssr.d.ts +17 -0
  31. package/dist/common/ssr.d.ts.map +1 -0
  32. package/dist/common/vnode.d.ts +17 -0
  33. package/dist/common/vnode.d.ts.map +1 -0
  34. package/dist/common/vnode.js +1 -0
  35. package/dist/components/link.d.ts +56 -0
  36. package/dist/components/link.d.ts.map +1 -0
  37. package/dist/components/link.js +1 -0
  38. package/dist/dev/invariant.d.ts +83 -0
  39. package/dist/dev/invariant.d.ts.map +1 -0
  40. package/dist/dev/invariant.js +2 -0
  41. package/dist/dev/logger.d.ts +13 -0
  42. package/dist/dev/logger.d.ts.map +1 -0
  43. package/dist/dev/logger.js +1 -0
  44. package/dist/dev/vite-plugin-askr.d.ts +18 -0
  45. package/dist/dev/vite-plugin-askr.d.ts.map +1 -0
  46. package/dist/dev/warnings.d.ts +5 -0
  47. package/dist/dev/warnings.d.ts.map +1 -0
  48. package/dist/for/for.d.ts +16 -0
  49. package/dist/for/for.d.ts.map +1 -0
  50. package/dist/for/for.js +1 -0
  51. package/dist/for/index.d.ts +2 -63
  52. package/dist/for/index.d.ts.map +1 -0
  53. package/dist/for/index.js +1 -1
  54. package/dist/foundations/core.d.ts +23 -0
  55. package/dist/foundations/core.d.ts.map +1 -0
  56. package/dist/foundations/core.js +1 -0
  57. package/dist/foundations/index.d.ts +3 -669
  58. package/dist/foundations/index.d.ts.map +1 -0
  59. package/dist/foundations/index.js +1 -1
  60. package/dist/foundations/interactions/dismissable.d.ts +58 -0
  61. package/dist/foundations/interactions/dismissable.d.ts.map +1 -0
  62. package/dist/foundations/interactions/dismissable.js +1 -0
  63. package/dist/foundations/interactions/focusable.d.ts +16 -0
  64. package/dist/foundations/interactions/focusable.d.ts.map +1 -0
  65. package/dist/foundations/interactions/focusable.js +1 -0
  66. package/dist/foundations/interactions/hoverable.d.ts +19 -0
  67. package/dist/foundations/interactions/hoverable.d.ts.map +1 -0
  68. package/dist/foundations/interactions/hoverable.js +1 -0
  69. package/dist/foundations/interactions/index.d.ts +5 -0
  70. package/dist/foundations/interactions/index.d.ts.map +1 -0
  71. package/dist/foundations/interactions/interaction-policy.d.ts +96 -0
  72. package/dist/foundations/interactions/interaction-policy.d.ts.map +1 -0
  73. package/dist/foundations/interactions/interaction-policy.js +1 -0
  74. package/dist/foundations/interactions/pressable.d.ts +54 -0
  75. package/dist/foundations/interactions/pressable.d.ts.map +1 -0
  76. package/dist/foundations/interactions/pressable.js +1 -0
  77. package/dist/foundations/interactions/roving-focus.d.ts +117 -0
  78. package/dist/foundations/interactions/roving-focus.d.ts.map +1 -0
  79. package/dist/foundations/interactions/roving-focus.js +1 -0
  80. package/dist/foundations/state/controllable.d.ts +53 -0
  81. package/dist/foundations/state/controllable.d.ts.map +1 -0
  82. package/dist/foundations/state/controllable.js +1 -0
  83. package/dist/foundations/state/index.d.ts +2 -0
  84. package/dist/foundations/state/index.d.ts.map +1 -0
  85. package/dist/foundations/structures/collection.d.ts +67 -0
  86. package/dist/foundations/structures/collection.d.ts.map +1 -0
  87. package/dist/foundations/structures/collection.js +1 -0
  88. package/dist/foundations/structures/index.d.ts +5 -0
  89. package/dist/foundations/structures/index.d.ts.map +1 -0
  90. package/dist/foundations/structures/layer.d.ts +102 -0
  91. package/dist/foundations/structures/layer.d.ts.map +1 -0
  92. package/dist/foundations/structures/layer.js +1 -0
  93. package/dist/{layout-BINPv-nz.d.ts → foundations/structures/layout.d.ts} +3 -4
  94. package/dist/foundations/structures/layout.d.ts.map +1 -0
  95. package/dist/foundations/structures/layout.js +1 -0
  96. package/dist/foundations/structures/portal.d.ts +33 -0
  97. package/dist/foundations/structures/portal.d.ts.map +1 -0
  98. package/dist/foundations/structures/portal.js +1 -0
  99. package/dist/foundations/structures/presence.d.ts +30 -0
  100. package/dist/foundations/structures/presence.d.ts.map +1 -0
  101. package/dist/foundations/structures/presence.js +1 -0
  102. package/dist/foundations/structures/slot.d.ts +31 -0
  103. package/dist/foundations/structures/slot.d.ts.map +1 -0
  104. package/dist/foundations/structures/slot.js +1 -0
  105. package/dist/foundations/structures.d.ts +14 -0
  106. package/dist/foundations/structures.d.ts.map +1 -0
  107. package/dist/foundations/structures.js +1 -0
  108. package/dist/foundations/utilities/aria.d.ts +13 -0
  109. package/dist/foundations/utilities/aria.d.ts.map +1 -0
  110. package/dist/foundations/utilities/aria.js +1 -0
  111. package/dist/foundations/utilities/compose-handlers.d.ts +34 -0
  112. package/dist/foundations/utilities/compose-handlers.d.ts.map +1 -0
  113. package/dist/foundations/utilities/compose-handlers.js +1 -0
  114. package/dist/foundations/utilities/compose-ref.d.ts +24 -0
  115. package/dist/foundations/utilities/compose-ref.d.ts.map +1 -0
  116. package/dist/foundations/utilities/compose-ref.js +1 -0
  117. package/dist/foundations/utilities/event-types.d.ts +17 -0
  118. package/dist/foundations/utilities/event-types.d.ts.map +1 -0
  119. package/dist/foundations/utilities/index.d.ts +7 -0
  120. package/dist/foundations/utilities/index.d.ts.map +1 -0
  121. package/dist/foundations/utilities/merge-props.d.ts +2 -0
  122. package/dist/foundations/utilities/merge-props.d.ts.map +1 -0
  123. package/dist/foundations/utilities/merge-props.js +1 -0
  124. package/dist/foundations/utilities/use-id.d.ts +29 -0
  125. package/dist/foundations/utilities/use-id.d.ts.map +1 -0
  126. package/dist/foundations/utilities/use-id.js +1 -0
  127. package/dist/fx/fx.d.ts +30 -0
  128. package/dist/fx/fx.d.ts.map +1 -0
  129. package/dist/fx/fx.js +1 -0
  130. package/dist/fx/index.d.ts +5 -184
  131. package/dist/fx/index.d.ts.map +1 -0
  132. package/dist/fx/index.js +1 -1
  133. package/dist/fx/noop.d.ts +12 -0
  134. package/dist/fx/noop.d.ts.map +1 -0
  135. package/dist/fx/noop.js +1 -0
  136. package/dist/fx/timing.d.ts +155 -0
  137. package/dist/fx/timing.d.ts.map +1 -0
  138. package/dist/fx/timing.js +1 -0
  139. package/dist/index.d.ts +18 -37
  140. package/dist/index.d.ts.map +1 -0
  141. package/dist/index.js +1 -1
  142. package/dist/jsx/index.d.ts +4 -0
  143. package/dist/jsx/index.d.ts.map +1 -0
  144. package/dist/jsx/index.js +1 -0
  145. package/dist/jsx/jsx-dev-runtime.d.ts +4 -0
  146. package/dist/jsx/jsx-dev-runtime.d.ts.map +1 -0
  147. package/dist/jsx/jsx-runtime.d.ts +10 -0
  148. package/dist/jsx/jsx-runtime.d.ts.map +1 -0
  149. package/dist/{types-BTT0Fc9S.d.ts → jsx/types.d.ts} +6 -3
  150. package/dist/jsx/types.d.ts.map +1 -0
  151. package/dist/jsx/types.js +1 -0
  152. package/dist/jsx/utils.d.ts +4 -0
  153. package/dist/jsx/utils.d.ts.map +1 -0
  154. package/dist/jsx/utils.js +1 -0
  155. package/dist/jsx-dev-runtime.js +1 -1
  156. package/dist/jsx-runtime.js +1 -1
  157. package/dist/node_modules/esbuild/lib/main.js +65 -0
  158. package/dist/renderer/cleanup.d.ts +25 -0
  159. package/dist/renderer/cleanup.d.ts.map +1 -0
  160. package/dist/renderer/cleanup.js +1 -0
  161. package/dist/renderer/dom.d.ts +44 -0
  162. package/dist/renderer/dom.d.ts.map +1 -0
  163. package/dist/renderer/dom.js +1 -0
  164. package/dist/renderer/evaluate.d.ts +4 -0
  165. package/dist/renderer/evaluate.d.ts.map +1 -0
  166. package/dist/renderer/evaluate.js +1 -0
  167. package/dist/renderer/fastpath.d.ts +7 -0
  168. package/dist/renderer/fastpath.d.ts.map +1 -0
  169. package/dist/renderer/fastpath.js +1 -0
  170. package/dist/renderer/index.d.ts +6 -0
  171. package/dist/renderer/index.d.ts.map +1 -0
  172. package/dist/renderer/index.js +1 -0
  173. package/dist/renderer/keyed.d.ts +23 -0
  174. package/dist/renderer/keyed.d.ts.map +1 -0
  175. package/dist/renderer/keyed.js +1 -0
  176. package/dist/renderer/reconcile.d.ts +88 -0
  177. package/dist/renderer/reconcile.d.ts.map +1 -0
  178. package/dist/renderer/reconcile.js +1 -0
  179. package/dist/renderer/types.d.ts +3 -0
  180. package/dist/renderer/types.d.ts.map +1 -0
  181. package/dist/renderer/types.js +1 -0
  182. package/dist/renderer/utils.d.ts +63 -0
  183. package/dist/renderer/utils.d.ts.map +1 -0
  184. package/dist/renderer/utils.js +1 -0
  185. package/dist/resources/index.d.ts +7 -22
  186. package/dist/resources/index.d.ts.map +1 -0
  187. package/dist/resources/index.js +1 -1
  188. package/dist/router/index.d.ts +8 -87
  189. package/dist/router/index.d.ts.map +1 -0
  190. package/dist/router/index.js +1 -1
  191. package/dist/router/match.d.ts +22 -0
  192. package/dist/router/match.d.ts.map +1 -0
  193. package/dist/router/match.js +1 -0
  194. package/dist/router/navigate.d.ts +20 -0
  195. package/dist/router/navigate.d.ts.map +1 -0
  196. package/dist/router/navigate.js +1 -0
  197. package/dist/router/route.d.ts +52 -0
  198. package/dist/router/route.d.ts.map +1 -0
  199. package/dist/router/route.js +1 -0
  200. package/dist/runtime/component.d.ts +123 -0
  201. package/dist/runtime/component.d.ts.map +1 -0
  202. package/dist/runtime/component.js +1 -0
  203. package/dist/runtime/context.d.ts +80 -0
  204. package/dist/runtime/context.d.ts.map +1 -0
  205. package/dist/runtime/context.js +1 -0
  206. package/dist/runtime/derive.d.ts +7 -0
  207. package/dist/runtime/derive.d.ts.map +1 -0
  208. package/dist/runtime/derive.js +1 -0
  209. package/dist/runtime/dev-namespace.d.ts +31 -0
  210. package/dist/runtime/dev-namespace.d.ts.map +1 -0
  211. package/dist/runtime/dev-namespace.js +1 -0
  212. package/dist/runtime/events.d.ts +52 -0
  213. package/dist/runtime/events.d.ts.map +1 -0
  214. package/dist/runtime/events.js +1 -0
  215. package/dist/runtime/execution-model.d.ts +4 -0
  216. package/dist/runtime/execution-model.d.ts.map +1 -0
  217. package/dist/runtime/execution-model.js +1 -0
  218. package/dist/runtime/fastlane.d.ts +27 -0
  219. package/dist/runtime/fastlane.d.ts.map +1 -0
  220. package/dist/runtime/fastlane.js +1 -0
  221. package/dist/runtime/for.d.ts +52 -0
  222. package/dist/runtime/for.d.ts.map +1 -0
  223. package/dist/runtime/for.js +1 -0
  224. package/dist/runtime/hydration.d.ts +25 -0
  225. package/dist/runtime/hydration.d.ts.map +1 -0
  226. package/dist/runtime/operations.d.ts +39 -0
  227. package/dist/runtime/operations.d.ts.map +1 -0
  228. package/dist/runtime/operations.js +1 -0
  229. package/dist/runtime/resource-cell.d.ts +35 -0
  230. package/dist/runtime/resource-cell.d.ts.map +1 -0
  231. package/dist/runtime/resource-cell.js +1 -0
  232. package/dist/runtime/scheduler.d.ts +48 -0
  233. package/dist/runtime/scheduler.d.ts.map +1 -0
  234. package/dist/runtime/scheduler.js +1 -0
  235. package/dist/runtime/snapshot.d.ts +25 -0
  236. package/dist/runtime/snapshot.d.ts.map +1 -0
  237. package/dist/runtime/ssr-bridge.d.ts +10 -0
  238. package/dist/runtime/ssr-bridge.d.ts.map +1 -0
  239. package/dist/runtime/ssr-bridge.js +1 -0
  240. package/dist/runtime/state.d.ts +56 -0
  241. package/dist/runtime/state.d.ts.map +1 -0
  242. package/dist/runtime/state.js +1 -0
  243. package/dist/ssr/attrs.d.ts +26 -0
  244. package/dist/ssr/attrs.d.ts.map +1 -0
  245. package/dist/ssr/attrs.js +1 -0
  246. package/dist/ssr/context.d.ts +47 -0
  247. package/dist/ssr/context.d.ts.map +1 -0
  248. package/dist/ssr/context.js +1 -0
  249. package/dist/ssr/create-ssr.d.ts +19 -0
  250. package/dist/ssr/create-ssr.d.ts.map +1 -0
  251. package/dist/ssr/errors.d.ts +6 -0
  252. package/dist/ssr/errors.d.ts.map +1 -0
  253. package/dist/ssr/errors.js +1 -0
  254. package/dist/ssr/escape.d.ts +38 -0
  255. package/dist/ssr/escape.d.ts.map +1 -0
  256. package/dist/ssr/escape.js +1 -0
  257. package/dist/ssr/index.d.ts +18 -94
  258. package/dist/ssr/index.d.ts.map +1 -0
  259. package/dist/ssr/index.js +1 -1
  260. package/dist/ssr/render-keys.d.ts +39 -0
  261. package/dist/ssr/render-keys.d.ts.map +1 -0
  262. package/dist/ssr/render-keys.js +1 -0
  263. package/dist/ssr/sink.d.ts +23 -0
  264. package/dist/ssr/sink.d.ts.map +1 -0
  265. package/dist/ssr/sink.js +1 -0
  266. package/dist/ssr/stream-render.d.ts +7 -0
  267. package/dist/ssr/stream-render.d.ts.map +1 -0
  268. package/dist/ssr/stream-render.js +1 -0
  269. package/dist/ssr/types.d.ts +21 -0
  270. package/dist/ssr/types.d.ts.map +1 -0
  271. package/dist/vite/index.js +3 -1
  272. package/package.json +11 -10
  273. package/dist/chunk-37RC6ZT3.js +0 -1
  274. package/dist/chunk-3L6PFAJ3.js +0 -1
  275. package/dist/chunk-47D5SNYH.js +0 -1
  276. package/dist/chunk-4RTKQ7SC.js +0 -1
  277. package/dist/chunk-5PLQPS3O.js +0 -1
  278. package/dist/chunk-62D2TNHX.js +0 -1
  279. package/dist/chunk-BP2CKUO6.js +0 -1
  280. package/dist/chunk-D2JSJKCW.js +0 -1
  281. package/dist/chunk-EQ5S5GU4.js +0 -1
  282. package/dist/chunk-HGMOQ3I7.js +0 -1
  283. package/dist/chunk-HZKAD5DE.js +0 -1
  284. package/dist/chunk-ILZCMHZM.js +0 -2
  285. package/dist/chunk-NL44ANML.js +0 -2
  286. package/dist/chunk-YRY4OLQF.js +0 -1
  287. package/dist/component-AJMg1Gmv.d.ts +0 -177
  288. package/dist/jsx-dev-runtime.d.ts +0 -7
  289. package/dist/jsx-runtime.d.ts +0 -14
  290. package/dist/logger-NGZDJLVS.js +0 -1
  291. package/dist/main-EPE35NMW.js +0 -65
  292. package/dist/navigate-4VAVLF3A.js +0 -1
  293. package/dist/route-IVG3V65Y.js +0 -1
  294. package/dist/vite/index.d.ts +0 -17
@@ -0,0 +1,102 @@
1
+ /**
2
+ * createLayer
3
+ *
4
+ * Manages stacking order and coordination for overlays (modals, popovers, etc).
5
+ *
6
+ * INVARIANTS:
7
+ * 1. Layers are ordered by registration time (FIFO)
8
+ * 2. Only the top layer handles Escape key
9
+ * 3. Only the top layer handles outside pointer events
10
+ * 4. Nested layers are supported
11
+ * 5. Does not implement portals (orthogonal concern)
12
+ * 6. No automatic DOM insertion (caller controls mounting)
13
+ *
14
+ * DESIGN:
15
+ * - Returns a layer manager with register/unregister API
16
+ * - Each layer has a unique ID and can query if it's the top layer
17
+ * - Escape and outside pointer coordination via callbacks
18
+ * - No z-index management (CSS concern)
19
+ *
20
+ * USAGE:
21
+ * const manager = createLayer();
22
+ *
23
+ * const layer = manager.register({
24
+ * onEscape: () => { ... },
25
+ * onOutsidePointer: () => { ... }
26
+ * });
27
+ *
28
+ * layer.isTop(); // true if this is the topmost layer
29
+ * layer.unregister();
30
+ */
31
+ export interface LayerOptions {
32
+ /**
33
+ * Called when Escape is pressed and this is the top layer
34
+ */
35
+ onEscape?: () => void;
36
+ /**
37
+ * Called when pointer event occurs outside and this is the top layer
38
+ */
39
+ onOutsidePointer?: (e: PointerEvent) => void;
40
+ /**
41
+ * Optional node reference for outside pointer detection
42
+ */
43
+ node?: Node | null;
44
+ }
45
+ export interface Layer {
46
+ /**
47
+ * Unique layer ID
48
+ */
49
+ id: number;
50
+ /**
51
+ * Check if this layer is the topmost
52
+ */
53
+ isTop(): boolean;
54
+ /**
55
+ * Remove this layer from the stack
56
+ */
57
+ unregister(): void;
58
+ }
59
+ export interface LayerManager {
60
+ /**
61
+ * Register a new layer
62
+ */
63
+ register(options: LayerOptions): Layer;
64
+ /**
65
+ * Get all active layers in order
66
+ */
67
+ layers(): ReadonlyArray<Layer>;
68
+ /**
69
+ * Manually trigger escape handling on the top layer
70
+ */
71
+ handleEscape(): void;
72
+ /**
73
+ * Manually trigger outside pointer handling on the top layer
74
+ */
75
+ handleOutsidePointer(e: PointerEvent): void;
76
+ }
77
+ export declare function createLayer(): LayerManager;
78
+ /**
79
+ * USAGE EXAMPLE:
80
+ *
81
+ * const layerManager = createLayer();
82
+ *
83
+ * function Modal({ onClose }) {
84
+ * const modalRef = ref<HTMLDivElement>();
85
+ *
86
+ * const layer = layerManager.register({
87
+ * node: modalRef.current,
88
+ * onEscape: onClose,
89
+ * onOutsidePointer: onClose,
90
+ * });
91
+ *
92
+ * onUnmount(() => layer.unregister());
93
+ *
94
+ * return (
95
+ * <div ref={modalRef}>
96
+ * <h1>Modal</h1>
97
+ * {layer.isTop() && <p>I am on top!</p>}
98
+ * </div>
99
+ * );
100
+ * }
101
+ */
102
+ //# sourceMappingURL=layer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layer.d.ts","sourceRoot":"","sources":["../../../src/foundations/structures/layer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IAEtB;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;IAE7C;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,KAAK;IACpB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC;IAEjB;;OAEG;IACH,UAAU,IAAI,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,KAAK,CAAC;IAEvC;;OAEG;IACH,MAAM,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC;IAE/B;;OAEG;IACH,YAAY,IAAI,IAAI,CAAC;IAErB;;OAEG;IACH,oBAAoB,CAAC,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;CAC7C;AAED,wBAAgB,WAAW,IAAI,YAAY,CAyE1C;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG"}
@@ -0,0 +1 @@
1
+ function l(){const n=[];let s=1;function d(t){const i=s++,e={id:i,options:t};n.push(e);function f(){return n[n.length-1]?.id===i}function p(){const o=n.findIndex(a=>a.id===i);o!==-1&&n.splice(o,1)}return{id:i,isTop:f,unregister:p}}function r(){return n.map(t=>({id:t.id,isTop:()=>n[n.length-1]?.id===t.id,unregister:()=>{const i=n.findIndex(e=>e.id===t.id);i!==-1&&n.splice(i,1)}}))}function c(){const t=n[n.length-1];t&&t.options.onEscape?.()}function u(t){const i=n[n.length-1];if(!i)return;const e=i.options.node;e&&t.target instanceof Node&&e.contains(t.target)||i.options.onOutsidePointer?.(t)}return{register:d,layers:r,handleEscape:c,handleOutsidePointer:u}}export{l as createLayer};
@@ -21,9 +21,8 @@
21
21
  * Props are spread into the layout component. This is intentional
22
22
  * and deterministic — no merging or composition.
23
23
  */
24
- type LayoutComponent<P = object> = (props: P & {
24
+ export type LayoutComponent<P = object> = (props: P & {
25
25
  children?: unknown;
26
26
  }) => unknown;
27
- declare function layout<P = object>(Layout: LayoutComponent<P>): (children?: unknown, props?: P) => unknown;
28
-
29
- export { type LayoutComponent as L, layout as l };
27
+ export declare function layout<P = object>(Layout: LayoutComponent<P>): (children?: unknown, props?: P) => unknown;
28
+ //# sourceMappingURL=layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/foundations/structures/layout.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,MAAM,eAAe,CAAC,CAAC,GAAG,MAAM,IAAI,CACxC,KAAK,EAAE,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,KAC9B,OAAO,CAAC;AAEb,wBAAgB,MAAM,CAAC,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,IACnD,WAAW,OAAO,EAAE,QAAQ,CAAC,aAItC"}
@@ -0,0 +1 @@
1
+ function o(r){return(t,e)=>{const n={...e,children:t};return r(n)}}export{o as layout};
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Portal / Host primitive.
3
+ *
4
+ * Foundations remain runtime-agnostic: a portal is an explicit read/write slot.
5
+ * Scheduling and attachment are owned by the runtime when `createPortalSlot`
6
+ * exists; otherwise this falls back to a local slot (deterministic, but does
7
+ * not schedule updates).
8
+ *
9
+ * POLICY DECISIONS (LOCKED):
10
+ *
11
+ * 1. Local Mutable State
12
+ * Foundations may use local mutable state ONLY to model deterministic slots,
13
+ * never to coordinate timing, effects, or ordering. The fallback mode uses
14
+ * closure-local `mounted` and `value` variables which are non-escaping and
15
+ * deterministic.
16
+ *
17
+ * 2. Return Type Philosophy
18
+ * Portal call signatures return `unknown` (intentionally opaque). The runtime
19
+ * owns the concrete type. This prevents foundations from assuming JSX.Element
20
+ * or DOM node types, maintaining runtime-agnostic portability.
21
+ */
22
+ export interface Portal<T = unknown> {
23
+ /** Mount point — rendered exactly once */
24
+ (): unknown;
25
+ /** Render content into the portal */
26
+ render(props: {
27
+ children?: T;
28
+ }): unknown;
29
+ }
30
+ export declare function definePortal<T = unknown>(): Portal<T>;
31
+ export declare function _resetDefaultPortal(): void;
32
+ export declare const DefaultPortal: Portal<unknown>;
33
+ //# sourceMappingURL=portal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../../src/foundations/structures/portal.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,WAAW,MAAM,CAAC,CAAC,GAAG,OAAO;IACjC,0CAA0C;IAC1C,IAAI,OAAO,CAAC;IAEZ,qCAAqC;IACrC,MAAM,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,EAAE,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC;CAC1C;AAED,wBAAgB,YAAY,CAAC,CAAC,GAAG,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,CA6CrD;AAaD,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AAOD,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,OAAO,CAUtC,CAAC"}
@@ -0,0 +1 @@
1
+ function f(){if(typeof createPortalSlot=="function"){let o=function(){return n.read()};const n=createPortalSlot();return o.render=function(a){return n.write(a.children),null},o}let r=!1,t;function e(){return r=!0,t}return e.render=function(n){return r&&(t=n.children),null},e}let l;function i(){l=void 0}function u(){return l||(l=f()),l}const d=(()=>{function r(){const t=u()();return t===void 0?null:t}return r.render=function(e){return u().render(e),null},r})();export{d as DefaultPortal,i as _resetDefaultPortal,f as definePortal};
@@ -0,0 +1,30 @@
1
+ import type { JSXElement } from '../../jsx';
2
+ export interface PresenceProps {
3
+ present: boolean | (() => boolean);
4
+ children?: unknown;
5
+ }
6
+ /**
7
+ * Presence
8
+ *
9
+ * Structural policy primitive for conditional mount/unmount.
10
+ * - No timers
11
+ * - No animation coupling
12
+ * - No DOM side-effects
13
+ *
14
+ * POLICY DECISIONS (LOCKED):
15
+ *
16
+ * 1. Present as Function
17
+ * Accepts boolean OR function to support lazy evaluation patterns.
18
+ * Function is called once per render. Use boolean form for static values.
19
+ *
20
+ * 2. Children Type
21
+ * `children` is intentionally `unknown` to remain runtime-agnostic.
22
+ * The runtime owns child normalization and validation.
23
+ *
24
+ * 3. Immediate Mount/Unmount
25
+ * No exit animations or transitions. When `present` becomes false,
26
+ * children are removed immediately. Animation must be layered above
27
+ * this primitive.
28
+ */
29
+ export declare function Presence({ present, children, }: PresenceProps): JSXElement | null;
30
+ //# sourceMappingURL=presence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presence.d.ts","sourceRoot":"","sources":["../../../src/foundations/structures/presence.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,QAAQ,CAAC,EACvB,OAAO,EACP,QAAQ,GACT,EAAE,aAAa,GAAG,UAAU,GAAG,IAAI,CAYnC"}
@@ -0,0 +1 @@
1
+ import"../../jsx/index.js";import{Fragment as t,ELEMENT_TYPE as o}from"../../common/jsx.js";function m({present:e,children:n}){return(typeof e=="function"?e():!!e)?{$$typeof:o,type:t,props:{children:n},key:null}:null}export{m as Presence};
@@ -0,0 +1,31 @@
1
+ import type { JSXElement } from '../../jsx';
2
+ export type SlotProps = {
3
+ asChild: true;
4
+ children: JSXElement;
5
+ [key: string]: unknown;
6
+ } | {
7
+ asChild?: false;
8
+ children?: unknown;
9
+ };
10
+ /**
11
+ * Slot
12
+ *
13
+ * Structural primitive for prop forwarding patterns.
14
+ *
15
+ * POLICY DECISIONS (LOCKED):
16
+ *
17
+ * 1. asChild Pattern
18
+ * When asChild=true, merges props into the single child element.
19
+ * Child must be a valid JSXElement; non-element children return null.
20
+ * **Slot props override child props** (injection pattern).
21
+ *
22
+ * 2. Fallback Behavior
23
+ * When asChild=false, returns a Fragment (structural no-op).
24
+ * No DOM element is introduced.
25
+ *
26
+ * 3. Type Safety
27
+ * asChild=true requires exactly one JSXElement child (enforced by type).
28
+ * Runtime validates with isElement() check.
29
+ */
30
+ export declare function Slot(props: SlotProps): JSXElement | null;
31
+ //# sourceMappingURL=slot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../../src/foundations/structures/slot.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,MAAM,MAAM,SAAS,GACjB;IACE,OAAO,EAAE,IAAI,CAAC;IACd,QAAQ,EAAE,UAAU,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,GACD;IACE,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEN;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,UAAU,GAAG,IAAI,CAmBxD"}
@@ -0,0 +1 @@
1
+ import"../../jsx/index.js";import{isElement as l,cloneElement as r}from"../../jsx/utils.js";import{Fragment as i,ELEMENT_TYPE as o}from"../../common/jsx.js";function s(e){if(e.asChild){const{children:t,asChild:c,...n}=e;return l(t)?r(t,n):null}return{$$typeof:o,type:i,props:{children:e.children},key:null}}export{s as Slot};
@@ -0,0 +1,14 @@
1
+ export { layout } from './structures/layout';
2
+ export type { LayoutComponent } from './structures/layout';
3
+ export { Slot } from './structures/slot';
4
+ export type { SlotProps } from './structures/slot';
5
+ export type { JSXElement } from '../jsx';
6
+ export { Presence } from './structures/presence';
7
+ export type { PresenceProps } from './structures/presence';
8
+ export { definePortal, DefaultPortal } from './structures/portal';
9
+ export type { Portal } from './structures/portal';
10
+ export { createCollection } from './structures/collection';
11
+ export type { Collection, CollectionItem } from './structures/collection';
12
+ export { createLayer } from './structures/layer';
13
+ export type { Layer, LayerManager, LayerOptions } from './structures/layer';
14
+ //# sourceMappingURL=structures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structures.d.ts","sourceRoot":"","sources":["../../src/foundations/structures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,YAAY,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAClE,YAAY,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1 @@
1
+ import{layout as r}from"./structures/layout.js";import{Slot as f}from"./structures/slot.js";import{Presence as l}from"./structures/presence.js";import{DefaultPortal as p,definePortal as x}from"./structures/portal.js";import{createCollection as n}from"./structures/collection.js";import{createLayer as i}from"./structures/layer.js";export{p as DefaultPortal,l as Presence,f as Slot,n as createCollection,i as createLayer,x as definePortal,r as layout};
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Tiny aria helpers
3
+ */
4
+ export declare function ariaDisabled(disabled?: boolean): {
5
+ 'aria-disabled'?: 'true';
6
+ };
7
+ export declare function ariaExpanded(expanded?: boolean): {
8
+ 'aria-expanded'?: 'true' | 'false';
9
+ };
10
+ export declare function ariaSelected(selected?: boolean): {
11
+ 'aria-selected'?: 'true' | 'false';
12
+ };
13
+ //# sourceMappingURL=aria.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aria.d.ts","sourceRoot":"","sources":["../../../src/foundations/utilities/aria.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,wBAAgB,YAAY,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG;IAAE,eAAe,CAAC,EAAE,MAAM,CAAA;CAAE,CAE7E;AAED,wBAAgB,YAAY,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG;IAChD,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACpC,CAIA;AAED,wBAAgB,YAAY,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG;IAChD,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACpC,CAIA"}
@@ -0,0 +1 @@
1
+ function a(r){return r?{"aria-disabled":"true"}:{}}function i(r){return r===void 0?{}:{"aria-expanded":String(r)}}function n(r){return r===void 0?{}:{"aria-selected":String(r)}}export{a as ariaDisabled,i as ariaExpanded,n as ariaSelected};
@@ -0,0 +1,34 @@
1
+ /**
2
+ * composeHandlers
3
+ *
4
+ * Compose two event handlers into one. The first handler runs, and unless it
5
+ * calls `event.preventDefault()` (or sets `defaultPrevented`), the second
6
+ * handler runs. This prevents accidental clobbering of child handlers when
7
+ * injecting props.
8
+ *
9
+ * POLICY DECISIONS (LOCKED):
10
+ *
11
+ * 1. Execution Order
12
+ * First handler runs before second (injected before base).
13
+ * This allows injected handlers to prevent default behavior.
14
+ *
15
+ * 2. Default Prevention Check
16
+ * By default, checks `defaultPrevented` on first argument.
17
+ * Can be disabled via options.checkDefaultPrevented = false.
18
+ *
19
+ * 3. Undefined Handler Support
20
+ * Undefined handlers are skipped (no-op). This simplifies usage
21
+ * where handlers are optional.
22
+ *
23
+ * 4. Type Safety
24
+ * Args are readonly to prevent mutation. Return type matches input.
25
+ */
26
+ export interface ComposeHandlersOptions {
27
+ /**
28
+ * When true (default), do not run the second handler if the first prevented default.
29
+ * When false, always run both handlers.
30
+ */
31
+ checkDefaultPrevented?: boolean;
32
+ }
33
+ export declare function composeHandlers<A extends readonly unknown[]>(first?: (...args: A) => void, second?: (...args: A) => void, options?: ComposeHandlersOptions): (...args: A) => void;
34
+ //# sourceMappingURL=compose-handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose-handlers.d.ts","sourceRoot":"","sources":["../../../src/foundations/utilities/compose-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAaD,wBAAgB,eAAe,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,EAC1D,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,EAC5B,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,EAC7B,OAAO,CAAC,EAAE,sBAAsB,GAC/B,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,CAsBtB"}
@@ -0,0 +1 @@
1
+ function f(e){return typeof e=="object"&&e!==null&&"defaultPrevented"in e&&e.defaultPrevented===!0}function i(e,t,r){if(!e&&!t)return o;if(!e)return t;if(!t)return e;const u=r?.checkDefaultPrevented!==!1;return function(...n){e(...n),!(u&&f(n[0]))&&t(...n)}}function o(){}export{i as composeHandlers};
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Ref composition utilities
3
+ *
4
+ * POLICY DECISIONS (LOCKED):
5
+ *
6
+ * 1. Ref Types Supported
7
+ * - Callback refs: (value: T | null) => void
8
+ * - Object refs: { current: T | null }
9
+ * - null/undefined (no-op)
10
+ *
11
+ * 2. Write Failure Handling
12
+ * setRef catches write failures (readonly refs) and ignores them.
13
+ * This is intentional — refs may be readonly in some contexts.
14
+ *
15
+ * 3. Composition Order
16
+ * composeRefs applies refs in array order (left to right).
17
+ * All refs are called even if one fails.
18
+ */
19
+ export type Ref<T> = ((value: T | null) => void) | {
20
+ current: T | null;
21
+ } | null | undefined;
22
+ export declare function setRef<T>(ref: Ref<T>, value: T | null): void;
23
+ export declare function composeRefs<T>(...refs: Array<Ref<T>>): (value: T | null) => void;
24
+ //# sourceMappingURL=compose-ref.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose-ref.d.ts","sourceRoot":"","sources":["../../../src/foundations/utilities/compose-ref.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,MAAM,GAAG,CAAC,CAAC,IACb,CAAC,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC,GAC3B;IAAE,OAAO,EAAE,CAAC,GAAG,IAAI,CAAA;CAAE,GACrB,IAAI,GACJ,SAAS,CAAC;AAEd,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,CAU5D;AAED,wBAAgB,WAAW,CAAC,CAAC,EAC3B,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GACrB,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,KAAK,IAAI,CAI3B"}
@@ -0,0 +1 @@
1
+ function e(t,n){if(t){if(typeof t=="function"){t(n);return}Object.isExtensible(t)&&(t.current=n)}}function f(...t){return n=>{for(const o of t)e(o,n)}}export{f as composeRefs,e as setRef};
@@ -0,0 +1,17 @@
1
+ export interface DefaultPreventable {
2
+ defaultPrevented?: boolean;
3
+ preventDefault?: () => void;
4
+ }
5
+ export interface PropagationStoppable {
6
+ stopPropagation?: () => void;
7
+ }
8
+ export interface KeyboardLikeEvent extends DefaultPreventable, PropagationStoppable {
9
+ key: string;
10
+ }
11
+ export interface PointerLikeEvent extends DefaultPreventable, PropagationStoppable {
12
+ target?: unknown;
13
+ }
14
+ export interface FocusLikeEvent extends DefaultPreventable, PropagationStoppable {
15
+ relatedTarget?: unknown;
16
+ }
17
+ //# sourceMappingURL=event-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-types.d.ts","sourceRoot":"","sources":["../../../src/foundations/utilities/event-types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,oBAAoB;IACnC,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,iBACf,SAAQ,kBAAkB,EAAE,oBAAoB;IAChD,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,gBACf,SAAQ,kBAAkB,EAAE,oBAAoB;IAChD,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,cACf,SAAQ,kBAAkB,EAAE,oBAAoB;IAChD,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB"}
@@ -0,0 +1,7 @@
1
+ export * from './compose-handlers';
2
+ export * from './merge-props';
3
+ export * from './aria';
4
+ export * from './compose-ref';
5
+ export * from './use-id';
6
+ export * from './event-types';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/foundations/utilities/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function mergeProps<TBase extends object, TInjected extends object>(base: TBase, injected: TInjected): TInjected & TBase;
2
+ //# sourceMappingURL=merge-props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge-props.d.ts","sourceRoot":"","sources":["../../../src/foundations/utilities/merge-props.ts"],"names":[],"mappings":"AAiCA,wBAAgB,UAAU,CAAC,KAAK,SAAS,MAAM,EAAE,SAAS,SAAS,MAAM,EACvE,IAAI,EAAE,KAAK,EACX,QAAQ,EAAE,SAAS,GAClB,SAAS,GAAG,KAAK,CA+BnB"}
@@ -0,0 +1 @@
1
+ import{composeHandlers as f}from"./compose-handlers.js";function u(n){return n.startsWith("on")}function a(n,o){const s=Object.keys(n);if(s.length===0)return o;const e={...o};for(const t of s){const r=n[t],c=o[t];if(u(t)&&typeof r=="function"&&typeof c=="function"){e[t]=f(c,r);continue}e[t]=r}return e}export{a as mergeProps};
@@ -0,0 +1,29 @@
1
+ export interface FormatIdOptions {
2
+ /** Defaults to 'askr' */
3
+ prefix?: string;
4
+ /** Stable, caller-provided identity */
5
+ id: string | number;
6
+ }
7
+ /**
8
+ * formatId
9
+ *
10
+ * Formats a stable ID from a caller-provided identity.
11
+ * - Pure and deterministic (no time/randomness/global counters)
12
+ * - SSR-safe
13
+ *
14
+ * POLICY DECISIONS (LOCKED):
15
+ *
16
+ * 1. No Auto-Generation
17
+ * Caller must provide the `id`. No random/sequential generation.
18
+ * This ensures determinism and SSR safety.
19
+ *
20
+ * 2. Format Convention
21
+ * IDs are formatted as `{prefix}-{id}`.
22
+ * Default prefix is "askr".
23
+ *
24
+ * 3. Type Coercion
25
+ * Numbers are coerced to strings via String().
26
+ * This is deterministic and consistent.
27
+ */
28
+ export declare function formatId(options: FormatIdOptions): string;
29
+ //# sourceMappingURL=use-id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-id.d.ts","sourceRoot":"","sources":["../../../src/foundations/utilities/use-id.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,yBAAyB;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAGzD"}
@@ -0,0 +1 @@
1
+ function f(r){return`${r.prefix??"askr"}-${String(r.id)}`}export{f as formatId};
@@ -0,0 +1,30 @@
1
+ export type CancelFn = () => void;
2
+ export declare function debounceEvent(ms: number, handler: EventListener, options?: {
3
+ leading?: boolean;
4
+ trailing?: boolean;
5
+ }): EventListener & {
6
+ cancel(): void;
7
+ flush(): void;
8
+ };
9
+ export declare function throttleEvent(ms: number, handler: EventListener, options?: {
10
+ leading?: boolean;
11
+ trailing?: boolean;
12
+ }): EventListener & {
13
+ cancel(): void;
14
+ };
15
+ export declare function rafEvent(handler: EventListener): EventListener & {
16
+ cancel(): void;
17
+ };
18
+ export declare function scheduleTimeout(ms: number, fn: () => void): CancelFn;
19
+ export declare function scheduleIdle(fn: () => void, options?: {
20
+ timeout?: number;
21
+ }): CancelFn;
22
+ export interface RetryOptions {
23
+ maxAttempts?: number;
24
+ delayMs?: number;
25
+ backoff?: (attemptIndex: number) => number;
26
+ }
27
+ export declare function scheduleRetry<T>(fn: () => Promise<T>, options?: RetryOptions): {
28
+ cancel(): void;
29
+ };
30
+ //# sourceMappingURL=fx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fx.d.ts","sourceRoot":"","sources":["../../src/fx/fx.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC;AAwClC,wBAAgB,aAAa,CAC3B,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,aAAa,EACtB,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAClD,aAAa,GAAG;IAAE,MAAM,IAAI,IAAI,CAAC;IAAC,KAAK,IAAI,IAAI,CAAA;CAAE,CAoEnD;AAED,wBAAgB,aAAa,CAC3B,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,aAAa,EACtB,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAClD,aAAa,GAAG;IAAE,MAAM,IAAI,IAAI,CAAA;CAAE,CAwDpC;AAED,wBAAgB,QAAQ,CACtB,OAAO,EAAE,aAAa,GACrB,aAAa,GAAG;IAAE,MAAM,IAAI,IAAI,CAAA;CAAE,CAmDpC;AAID,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,GAAG,QAAQ,CAqBpE;AAED,wBAAgB,YAAY,CAC1B,EAAE,EAAE,MAAM,IAAI,EACd,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7B,QAAQ,CAwCV;AAED,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;CAC5C;AAED,wBAAgB,aAAa,CAAC,CAAC,EAC7B,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,OAAO,CAAC,EAAE,YAAY,GACrB;IAAE,MAAM,IAAI,IAAI,CAAA;CAAE,CAiDpB"}
package/dist/fx/fx.js ADDED
@@ -0,0 +1 @@
1
+ import{globalScheduler as h}from"../runtime/scheduler.js";import{getCurrentComponentInstance as d}from"../runtime/component.js";import{logger as T}from"../dev/logger.js";import{noopEventListenerWithFlush as g,noopEventListener as F}from"./noop.js";function p(){if(d()!==null)throw new Error("[Askr] calling FX handler during render is not allowed. Move calls to event handlers or effects.")}function m(c){h.enqueue(()=>{try{c()}catch(u){T.error("[Askr] FX handler error:",u)}})}function A(c,u,e){const{leading:n=!1,trailing:o=!0}=e||{},r=d();if(r&&r.ssr)return g;let l=null,t=null,s=0;const i=function(f){p();const a=Date.now();t=f,l!==null&&(clearTimeout(l),l=null),n&&a-s>=c&&(m(()=>u.call(null,f)),s=a),o&&(l=setTimeout(()=>{t&&m(()=>u.call(null,t)),l=null,s=Date.now()},c))};return i.cancel=()=>{l!==null&&(clearTimeout(l),l=null),t=null},i.flush=()=>{if(l!==null){clearTimeout(l);const f=t;t=null,l=null,f&&m(()=>u.call(null,f))}},r&&r.cleanupFns.push(()=>{i.cancel()}),i}function C(c,u,e){const{leading:n=!0,trailing:o=!0}=e||{},r=d();if(r&&r.ssr)return F;let l=0,t=null,s=null;const i=function(f){p();const a=Date.now();if(s=f,n&&a-l>=c?(m(()=>u.call(null,f)),l=a,t!==null&&(clearTimeout(t),t=null)):!n&&l===0&&(l=a),o&&t===null){const w=c-(a-l);t=setTimeout(()=>{s&&m(()=>u.call(null,s)),l=Date.now(),t=null},Math.max(0,w))}};return i.cancel=()=>{t!==null&&(clearTimeout(t),t=null),s=null},r&&r.cleanupFns.push(()=>i.cancel()),i}function k(c){const u=d();if(u&&u.ssr)return F;let e=null,n=null;const o=()=>{e=(typeof requestAnimationFrame<"u"?requestAnimationFrame:t=>setTimeout(()=>t(Date.now()),16))(()=>{if(e=null,n){const t=n;n=null,m(()=>c.call(null,t))}})},r=function(l){p(),n=l,e===null&&o()};return r.cancel=()=>{e!==null&&(typeof cancelAnimationFrame<"u"&&typeof e=="number"?cancelAnimationFrame(e):clearTimeout(e),e=null),n=null},u&&u.cleanupFns.push(()=>r.cancel()),r}function E(c,u){p();const e=d();if(e&&e.ssr)return()=>{};let n=setTimeout(()=>{n=null,m(u)},c);const o=()=>{n!==null&&(clearTimeout(n),n=null)};return e&&e.cleanupFns.push(o),o}function q(c,u){p();const e=d();if(e&&e.ssr)return()=>{};let n=null,o=!1;typeof requestIdleCallback<"u"?(o=!0,n=requestIdleCallback(()=>{n=null,m(c)},u)):n=setTimeout(()=>{n=null,m(c)},0);const r=()=>{n!==null&&(o&&typeof cancelIdleCallback<"u"&&typeof n=="number"?cancelIdleCallback(n):clearTimeout(n),n=null)};return e&&e.cleanupFns.push(r),r}function D(c,u){p();const e=d();if(e&&e.ssr)return{cancel:()=>{}};const{maxAttempts:n=3,delayMs:o=100,backoff:r=i=>o*Math.pow(2,i)}=u||{};let l=!1;const t=i=>{l||h.enqueue(()=>{if(l)return;c().then(()=>{},()=>{if(!l&&i+1<n){const a=r(i);setTimeout(()=>{t(i+1)},a)}}).catch(a=>{T.error("[Askr] scheduleRetry error:",a)})})};t(0);const s=()=>{l=!0};return e&&e.cleanupFns.push(s),{cancel:s}}export{A as debounceEvent,k as rafEvent,q as scheduleIdle,D as scheduleRetry,E as scheduleTimeout,C as throttleEvent};