@askrjs/askr 0.0.9 → 0.0.10

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 (49) hide show
  1. package/dist/chunk-37RC6ZT3.js +1 -0
  2. package/dist/chunk-4RTKQ7SC.js +1 -0
  3. package/dist/chunk-534P7OMI.js +2 -0
  4. package/dist/chunk-62D2TNHX.js +1 -0
  5. package/dist/chunk-CI6AOGB5.js +1 -0
  6. package/dist/chunk-D2JSJKCW.js +1 -0
  7. package/dist/chunk-DPHQ4JD6.js +1 -0
  8. package/dist/chunk-FFSNBDHN.js +1 -0
  9. package/dist/chunk-JJDSOK6C.js +1 -0
  10. package/dist/chunk-LOSY3JCR.js +1 -0
  11. package/dist/chunk-OQMK7H2R.js +1 -0
  12. package/dist/chunk-Q7GRUZHR.js +1 -0
  13. package/dist/chunk-XKFPM4SY.js +2 -0
  14. package/dist/chunk-Y3Q3LOFT.js +1 -0
  15. package/dist/chunk-YRY4OLQF.js +1 -0
  16. package/dist/{component-DHAn9JxU.d.ts → component-mtwBWhUr.d.ts} +1 -1
  17. package/dist/for/index.d.ts +61 -0
  18. package/dist/for/index.js +1 -0
  19. package/dist/foundations/core.d.ts +449 -0
  20. package/dist/foundations/core.js +1 -0
  21. package/dist/foundations/index.d.ts +4 -722
  22. package/dist/foundations/index.js +1 -1274
  23. package/dist/foundations/structures.d.ts +223 -0
  24. package/dist/foundations/structures.js +1 -0
  25. package/dist/fx/index.js +1 -636
  26. package/dist/index.d.ts +2 -2
  27. package/dist/index.js +1 -3955
  28. package/dist/jsx-dev-runtime.js +1 -17
  29. package/dist/jsx-runtime.js +1 -23
  30. package/dist/logger-MPMIVXAP.js +1 -0
  31. package/dist/main-EPE35NMW.js +65 -0
  32. package/dist/navigate-6CC6IXXF.js +1 -0
  33. package/dist/resources/index.d.ts +1 -1
  34. package/dist/resources/index.js +1 -792
  35. package/dist/route-4QZ3RYN5.js +1 -0
  36. package/dist/router/index.d.ts +5 -0
  37. package/dist/router/index.js +1 -3194
  38. package/dist/ssr/index.js +1 -3935
  39. package/dist/vite/index.js +1 -2306
  40. package/package.json +19 -5
  41. package/dist/foundations/index.js.map +0 -1
  42. package/dist/fx/index.js.map +0 -1
  43. package/dist/index.js.map +0 -1
  44. package/dist/jsx-dev-runtime.js.map +0 -1
  45. package/dist/jsx-runtime.js.map +0 -1
  46. package/dist/resources/index.js.map +0 -1
  47. package/dist/router/index.js.map +0 -1
  48. package/dist/ssr/index.js.map +0 -1
  49. package/dist/vite/index.js.map +0 -1
@@ -0,0 +1,223 @@
1
+ export { L as LayoutComponent, l as layout } from '../layout-BINPv-nz.js';
2
+ import '../types-DxdosFWx.js';
3
+ import { J as JSXElement } from '../jsx-CSWf4VFg.js';
4
+
5
+ type SlotProps = {
6
+ asChild: true;
7
+ children: JSXElement;
8
+ [key: string]: unknown;
9
+ } | {
10
+ asChild?: false;
11
+ children?: unknown;
12
+ };
13
+ /**
14
+ * Slot
15
+ *
16
+ * Structural primitive for prop forwarding patterns.
17
+ *
18
+ * POLICY DECISIONS (LOCKED):
19
+ *
20
+ * 1. asChild Pattern
21
+ * When asChild=true, merges props into the single child element.
22
+ * Child must be a valid JSXElement; non-element children return null.
23
+ * **Slot props override child props** (injection pattern).
24
+ *
25
+ * 2. Fallback Behavior
26
+ * When asChild=false, returns a Fragment (structural no-op).
27
+ * No DOM element is introduced.
28
+ *
29
+ * 3. Type Safety
30
+ * asChild=true requires exactly one JSXElement child (enforced by type).
31
+ * Runtime validates with isElement() check.
32
+ */
33
+ declare function Slot(props: SlotProps): JSXElement | null;
34
+
35
+ interface PresenceProps {
36
+ present: boolean | (() => boolean);
37
+ children?: unknown;
38
+ }
39
+ /**
40
+ * Presence
41
+ *
42
+ * Structural policy primitive for conditional mount/unmount.
43
+ * - No timers
44
+ * - No animation coupling
45
+ * - No DOM side-effects
46
+ *
47
+ * POLICY DECISIONS (LOCKED):
48
+ *
49
+ * 1. Present as Function
50
+ * Accepts boolean OR function to support lazy evaluation patterns.
51
+ * Function is called once per render. Use boolean form for static values.
52
+ *
53
+ * 2. Children Type
54
+ * `children` is intentionally `unknown` to remain runtime-agnostic.
55
+ * The runtime owns child normalization and validation.
56
+ *
57
+ * 3. Immediate Mount/Unmount
58
+ * No exit animations or transitions. When `present` becomes false,
59
+ * children are removed immediately. Animation must be layered above
60
+ * this primitive.
61
+ */
62
+ declare function Presence({ present, children, }: PresenceProps): JSXElement | null;
63
+
64
+ /**
65
+ * Portal / Host primitive.
66
+ *
67
+ * Foundations remain runtime-agnostic: a portal is an explicit read/write slot.
68
+ * Scheduling and attachment are owned by the runtime when `createPortalSlot`
69
+ * exists; otherwise this falls back to a local slot (deterministic, but does
70
+ * not schedule updates).
71
+ *
72
+ * POLICY DECISIONS (LOCKED):
73
+ *
74
+ * 1. Local Mutable State
75
+ * Foundations may use local mutable state ONLY to model deterministic slots,
76
+ * never to coordinate timing, effects, or ordering. The fallback mode uses
77
+ * closure-local `mounted` and `value` variables which are non-escaping and
78
+ * deterministic.
79
+ *
80
+ * 2. Return Type Philosophy
81
+ * Portal call signatures return `unknown` (intentionally opaque). The runtime
82
+ * owns the concrete type. This prevents foundations from assuming JSX.Element
83
+ * or DOM node types, maintaining runtime-agnostic portability.
84
+ */
85
+ interface Portal<T = unknown> {
86
+ /** Mount point — rendered exactly once */
87
+ (): unknown;
88
+ /** Render content into the portal */
89
+ render(props: {
90
+ children?: T;
91
+ }): unknown;
92
+ }
93
+ declare function definePortal<T = unknown>(): Portal<T>;
94
+ declare const DefaultPortal: Portal<unknown>;
95
+
96
+ /**
97
+ * createCollection
98
+ *
99
+ * Ordered descendant registry for coordinating items without DOM queries.
100
+ *
101
+ * INVARIANTS:
102
+ * 1. Registration order determines item order (no DOM queries)
103
+ * 2. Stable ordering across renders (insertion order preserved)
104
+ * 3. Each item may have metadata (type-safe, user-defined)
105
+ * 4. No implicit global state (explicit collection instances)
106
+ * 5. No automatic cleanup (caller controls lifecycle)
107
+ *
108
+ * DESIGN:
109
+ * - Returns a registry API ({ register, items, clear })
110
+ * - Items are stored in insertion order
111
+ * - Registration returns an unregister function
112
+ * - No side effects on registration (pure data structure)
113
+ *
114
+ * USAGE:
115
+ * const collection = createCollection<HTMLElement, { disabled: boolean }>();
116
+ * const unregister = collection.register(element, { disabled: false });
117
+ * const allItems = collection.items();
118
+ * unregister();
119
+ */
120
+ type CollectionItem<TNode, TMetadata = unknown> = {
121
+ node: TNode;
122
+ metadata: TMetadata;
123
+ };
124
+ interface Collection<TNode, TMetadata = unknown> {
125
+ /**
126
+ * Register a node with optional metadata.
127
+ * Returns an unregister function.
128
+ */
129
+ register(node: TNode, metadata: TMetadata): () => void;
130
+ /**
131
+ * Get all registered items in insertion order.
132
+ */
133
+ items(): ReadonlyArray<CollectionItem<TNode, TMetadata>>;
134
+ /**
135
+ * Clear all registered items.
136
+ */
137
+ clear(): void;
138
+ /**
139
+ * Get the count of registered items.
140
+ */
141
+ size(): number;
142
+ }
143
+ declare function createCollection<TNode, TMetadata = unknown>(): Collection<TNode, TMetadata>;
144
+
145
+ /**
146
+ * createLayer
147
+ *
148
+ * Manages stacking order and coordination for overlays (modals, popovers, etc).
149
+ *
150
+ * INVARIANTS:
151
+ * 1. Layers are ordered by registration time (FIFO)
152
+ * 2. Only the top layer handles Escape key
153
+ * 3. Only the top layer handles outside pointer events
154
+ * 4. Nested layers are supported
155
+ * 5. Does not implement portals (orthogonal concern)
156
+ * 6. No automatic DOM insertion (caller controls mounting)
157
+ *
158
+ * DESIGN:
159
+ * - Returns a layer manager with register/unregister API
160
+ * - Each layer has a unique ID and can query if it's the top layer
161
+ * - Escape and outside pointer coordination via callbacks
162
+ * - No z-index management (CSS concern)
163
+ *
164
+ * USAGE:
165
+ * const manager = createLayer();
166
+ *
167
+ * const layer = manager.register({
168
+ * onEscape: () => { ... },
169
+ * onOutsidePointer: () => { ... }
170
+ * });
171
+ *
172
+ * layer.isTop(); // true if this is the topmost layer
173
+ * layer.unregister();
174
+ */
175
+ interface LayerOptions {
176
+ /**
177
+ * Called when Escape is pressed and this is the top layer
178
+ */
179
+ onEscape?: () => void;
180
+ /**
181
+ * Called when pointer event occurs outside and this is the top layer
182
+ */
183
+ onOutsidePointer?: (e: PointerEvent) => void;
184
+ /**
185
+ * Optional node reference for outside pointer detection
186
+ */
187
+ node?: Node | null;
188
+ }
189
+ interface Layer {
190
+ /**
191
+ * Unique layer ID
192
+ */
193
+ id: number;
194
+ /**
195
+ * Check if this layer is the topmost
196
+ */
197
+ isTop(): boolean;
198
+ /**
199
+ * Remove this layer from the stack
200
+ */
201
+ unregister(): void;
202
+ }
203
+ interface LayerManager {
204
+ /**
205
+ * Register a new layer
206
+ */
207
+ register(options: LayerOptions): Layer;
208
+ /**
209
+ * Get all active layers in order
210
+ */
211
+ layers(): ReadonlyArray<Layer>;
212
+ /**
213
+ * Manually trigger escape handling on the top layer
214
+ */
215
+ handleEscape(): void;
216
+ /**
217
+ * Manually trigger outside pointer handling on the top layer
218
+ */
219
+ handleOutsidePointer(e: PointerEvent): void;
220
+ }
221
+ declare function createLayer(): LayerManager;
222
+
223
+ export { type Collection, type CollectionItem, DefaultPortal, JSXElement, type Layer, type LayerManager, type LayerOptions, type Portal, Presence, type PresenceProps, Slot, type SlotProps, createCollection, createLayer, definePortal };
@@ -0,0 +1 @@
1
+ export{b as Presence,a as Slot,c as createCollection,d as createLayer}from'../chunk-CI6AOGB5.js';export{d as DefaultPortal,c as definePortal}from'../chunk-4RTKQ7SC.js';export{a as layout}from'../chunk-FFSNBDHN.js';import'../chunk-37RC6ZT3.js';import'../chunk-62D2TNHX.js';