@askrjs/askr 0.0.91 → 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.
- package/CHANGELOG.md +3 -0
- package/dist/{access-Dpfoi4cA.js → access-d_DCdwqn.js} +8 -2
- package/dist/actions/index.d.ts +1 -1
- package/dist/actions/index.js +4 -3
- package/dist/{activity-dKH6nlpj.js → activity-BshyLB3_.js} +9 -5
- package/dist/{activity-CF2_JvJs.d.ts → activity-CJIQyo5X.d.ts} +5 -1
- package/dist/benchmark.d.ts +1 -1
- package/dist/benchmark.js +8 -8
- package/dist/boot/index.d.ts +12 -4
- package/dist/boot/index.js +1 -1
- package/dist/{boot-D3zVVWuN.js → boot-BsMB_ySP.js} +34 -22
- package/dist/{cleanup-c837KVij.js → cleanup-DefafSjG.js} +8 -5
- package/dist/{component-cleanup-BUfUleGZ.js → component-cleanup-hrqSikl2.js} +3 -3
- package/dist/{component-internal-C4uwwUaK.js → component-internal-DOVVMjG7.js} +8 -6
- package/dist/{component-scope-DzJEbYGE.js → component-scope-4I3yEMkb.js} +13 -1
- package/dist/components/index.d.ts +7 -2
- package/dist/components/index.js +2 -2
- package/dist/{compose-ref-Cc_YkUpM.js → compose-ref-1Fhs7mbF.js} +13 -0
- package/dist/{compose-ref-Cizq72-x.d.ts → compose-ref-DOJHoW5X.d.ts} +3 -0
- package/dist/control/index.d.ts +1 -1
- package/dist/control/index.js +1 -1
- package/dist/{control-CsGs2bLS.d.ts → control-DdFw-Caz.d.ts} +1 -1
- package/dist/{control-CON10J1p.js → control-DqOzkgc7.js} +9 -5
- package/dist/{csp-nonce-DH0TrDij.js → csp-nonce-BBxq1zq4.js} +8 -1
- package/dist/data/index.d.ts +1 -2
- package/dist/data/index.js +3 -3
- package/dist/{data-Bh_3OETq.js → data-DYqokZzc.js} +23 -12
- package/dist/{data-runtime-wbooGyu7.js → data-runtime-JxoRgrrt.js} +3 -1
- package/dist/{deferred-D6nZaIPs.js → deferred-BS0Xpstg.js} +10 -5
- package/dist/{effect-lnxQIpJG.js → effect-BdvdgMvV.js} +73 -14
- package/dist/{fastlane-CrfB3QG0.js → fastlane-DGo7SxBQ.js} +23 -4
- package/dist/{for-internal-Bsm0B8GZ.js → for-internal-jrliHZmF.js} +6 -6
- package/dist/foundations/icon/index.d.ts +14 -3
- package/dist/foundations/icon/index.js +8 -0
- package/dist/foundations/index.d.ts +2 -2
- package/dist/foundations/index.js +1 -1
- package/dist/foundations/interactions/index.d.ts +18 -2
- package/dist/foundations/interactions/index.js +1 -1
- package/dist/foundations/state/index.d.ts +8 -1
- package/dist/foundations/state/index.js +7 -1
- package/dist/foundations/structures/index.d.ts +2 -2
- package/dist/foundations/structures/index.js +1 -1
- package/dist/foundations/utilities/index.d.ts +2 -2
- package/dist/foundations/utilities/index.js +1 -1
- package/dist/fx/index.d.ts +10 -1
- package/dist/fx/index.js +8 -2
- package/dist/{index-Cf2ANwPL.d.ts → index-C29SEGIv.d.ts} +30 -3
- package/dist/{index-BnU0NPwM.d.ts → index-CzH-0LcA.d.ts} +18 -0
- package/dist/index-KQ7Vl4-8.d.ts +1364 -0
- package/dist/index.d.ts +3 -7
- package/dist/index.js +34 -18
- package/dist/{interactions-CWkNEq_C.js → interactions-B4XaFxt1.js} +6 -1
- package/dist/{jsx-C3IECePB.js → jsx-DRS-qjiN.js} +2 -0
- package/dist/jsx-dev-runtime.d.ts +2 -3
- package/dist/jsx-dev-runtime.js +1 -1
- package/dist/jsx-runtime-BTzDdBJ_.d.ts +2 -0
- package/dist/{jsx-runtime-LHh5tcTe.d.ts → jsx-runtime-Cdd6Gkb0.d.ts} +4 -3
- package/dist/jsx-runtime.d.ts +2 -2
- package/dist/jsx-runtime.js +1 -1
- package/dist/{lifecycle-batch-Dfpid9-A.js → lifecycle-batch-BH0fax4F.js} +2 -2
- package/dist/{lifecycle-operations-CMK1AN2C.js → lifecycle-operations-Qxq6ABrC.js} +7 -2
- package/dist/{manifest-fBb2ynKL.js → manifest-D6rfj_jC.js} +5 -1
- package/dist/{navigate-BO7M2iUG.d.ts → navigate-BL_FIIJ6.d.ts} +6 -1
- package/dist/{navigate-CnQMXze1.js → navigate-CECCMPAr.js} +16 -11
- package/dist/{query-registry-B4LpVtlT.js → query-registry-CimB1YeW.js} +11 -1
- package/dist/{readable-B5NtV7V0.js → readable-BsdGWsDE.js} +9 -6
- package/dist/{renderer-y2DL627q.js → renderer-CLvq458M.js} +235 -189
- package/dist/{resolution-C9A31xQi.js → resolution-D8PgnTzh.js} +12 -6
- package/dist/{resource-operation-whZDJAYv.js → resource-operation-CLQXCn1p.js} +5 -5
- package/dist/resources/index.d.ts +15 -2
- package/dist/resources/index.js +7 -6
- package/dist/{route-matching-xlgdQXg_.js → route-matching-Bo6UqG-5.js} +13 -4
- package/dist/router/index.d.ts +46 -6
- package/dist/router/index.js +16 -9
- package/dist/{selector-BLNkRZ2i.js → selector-CyK-sDwB.js} +24 -6
- package/dist/ssg/index.d.ts +5 -2
- package/dist/ssg/index.js +6 -6
- package/dist/ssr/index.d.ts +16 -5
- package/dist/ssr/index.js +1 -1
- package/dist/{ssr-DNJUPmMq.js → ssr-8_vHDWqV.js} +20 -12
- package/dist/{state-DCjONcHK.js → state-DmkGM_LN.js} +5 -5
- package/dist/{structures-m-cphWI-.js → structures-umvVUD-M.js} +20 -6
- package/dist/testing/index.d.ts +31 -3
- package/dist/testing/index.js +24 -6
- package/dist/{jsx-BYXe_Nnk.d.ts → types-DkVJhVs9.d.ts} +20 -0
- package/dist/{verify-hydration-D8938Fw2.js → verify-hydration-jf8X2V3x.js} +1 -1
- package/package.json +1 -1
- package/dist/control-D-FIa-n-.d.ts +0 -451
- package/dist/index-BU17hud9.d.ts +0 -52
- package/dist/index-CPlPDbEY.d.ts +0 -64
- package/dist/index-Izwp_ESC.d.ts +0 -458
- package/dist/jsx-runtime-BqhMEuT4.d.ts +0 -2
- package/dist/scheduler-CmLO4Dfm.d.ts +0 -65
- package/dist/types-CsPtBGWb.d.ts +0 -16
- package/dist/types-iAmDSV6o.d.ts +0 -179
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as Ref } from "../../compose-ref-
|
|
2
|
-
import { d as KeyboardLikeEvent, f as PointerLikeEvent, l as DefaultPreventable, p as PropagationStoppable } from "../../index-
|
|
1
|
+
import { t as Ref } from "../../compose-ref-DOJHoW5X.js";
|
|
2
|
+
import { d as KeyboardLikeEvent, f as PointerLikeEvent, l as DefaultPreventable, p as PropagationStoppable } from "../../index-CzH-0LcA.js";
|
|
3
3
|
//#region src/foundations/interactions/pressable.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* pressable
|
|
@@ -33,6 +33,7 @@ import { d as KeyboardLikeEvent, f as PointerLikeEvent, l as DefaultPreventable,
|
|
|
33
33
|
* - Held Enter/Space will fire onPress repeatedly (matches native button)
|
|
34
34
|
* - No debouncing or repeat prevention (platform parity)
|
|
35
35
|
*/
|
|
36
|
+
/** Options for {@link pressable}. */
|
|
36
37
|
interface PressableOptions {
|
|
37
38
|
disabled?: boolean;
|
|
38
39
|
onPress?: (e: PressEvent) => void;
|
|
@@ -42,6 +43,7 @@ interface PressableOptions {
|
|
|
42
43
|
isNativeButton?: boolean;
|
|
43
44
|
}
|
|
44
45
|
type PressEvent = DefaultPreventable & PropagationStoppable;
|
|
46
|
+
/** Element props returned by {@link pressable}. */
|
|
45
47
|
interface PressableResult {
|
|
46
48
|
onClick: (e: PressEvent) => void;
|
|
47
49
|
disabled?: true;
|
|
@@ -51,6 +53,7 @@ interface PressableResult {
|
|
|
51
53
|
onKeyUp?: (e: KeyboardLikeEvent) => void;
|
|
52
54
|
'aria-disabled'?: 'true';
|
|
53
55
|
}
|
|
56
|
+
/** Produce click/keyboard props implementing 'press' semantics for an element. */
|
|
54
57
|
declare function pressable({ disabled, onPress, isNativeButton }: PressableOptions): PressableResult;
|
|
55
58
|
//#endregion
|
|
56
59
|
//#region src/foundations/interactions/dismissable.d.ts
|
|
@@ -97,6 +100,7 @@ declare function pressable({ disabled, onPress, isNativeButton }: PressableOptio
|
|
|
97
100
|
* ❌ Can't create custom escape handler - this is the only one
|
|
98
101
|
* ❌ Can't bypass via direct event listeners - mergeProps composes correctly
|
|
99
102
|
*/
|
|
103
|
+
/** Options for {@link dismissable}. */
|
|
100
104
|
interface DismissableOptions {
|
|
101
105
|
/**
|
|
102
106
|
* Reference to the protected element for outside click detection. Attach the
|
|
@@ -112,6 +116,7 @@ interface DismissableOptions {
|
|
|
112
116
|
*/
|
|
113
117
|
onDismiss?: (trigger: 'escape' | 'outside') => void;
|
|
114
118
|
}
|
|
119
|
+
/** Produce keydown/outside-click props that invoke `onDismiss` on Escape or an outside click. */
|
|
115
120
|
declare function dismissable({ node, disabled, onDismiss }: DismissableOptions): {
|
|
116
121
|
onKeyDown: (e: KeyboardLikeEvent) => void;
|
|
117
122
|
onPointerDownCapture: (e: PointerLikeEvent) => void;
|
|
@@ -124,14 +129,17 @@ declare function dismissable({ node, disabled, onDismiss }: DismissableOptions):
|
|
|
124
129
|
* Normalize focus-related props for hosts.
|
|
125
130
|
* - No DOM manipulation here; returns props that the runtime may attach.
|
|
126
131
|
*/
|
|
132
|
+
/** Options for {@link focusable}. */
|
|
127
133
|
interface FocusableOptions {
|
|
128
134
|
disabled?: boolean;
|
|
129
135
|
tabIndex?: number | undefined;
|
|
130
136
|
}
|
|
137
|
+
/** Element props returned by {@link focusable}. */
|
|
131
138
|
interface FocusableResult {
|
|
132
139
|
tabIndex?: number;
|
|
133
140
|
'aria-disabled'?: 'true';
|
|
134
141
|
}
|
|
142
|
+
/** Normalize `tabIndex`/`aria-disabled` props for a focusable host. */
|
|
135
143
|
declare function focusable({ disabled, tabIndex }: FocusableOptions): FocusableResult;
|
|
136
144
|
//#endregion
|
|
137
145
|
//#region src/foundations/interactions/hoverable.d.ts
|
|
@@ -140,20 +148,25 @@ declare function focusable({ disabled, tabIndex }: FocusableOptions): FocusableR
|
|
|
140
148
|
*
|
|
141
149
|
* Produces props for pointer enter/leave handling. Pure and deterministic.
|
|
142
150
|
*/
|
|
151
|
+
/** Options for {@link hoverable}. */
|
|
143
152
|
interface HoverableOptions {
|
|
144
153
|
disabled?: boolean;
|
|
145
154
|
onEnter?: (e: HoverEvent) => void;
|
|
146
155
|
onLeave?: (e: HoverEvent) => void;
|
|
147
156
|
}
|
|
148
157
|
type HoverEvent = DefaultPreventable & PropagationStoppable;
|
|
158
|
+
/** Element props returned by {@link hoverable}. */
|
|
149
159
|
interface HoverableResult {
|
|
150
160
|
onPointerEnter?: (e: HoverEvent) => void;
|
|
151
161
|
onPointerLeave?: (e: HoverEvent) => void;
|
|
152
162
|
}
|
|
163
|
+
/** Produce pointer enter/leave props that call `onEnter`/`onLeave` unless disabled. */
|
|
153
164
|
declare function hoverable({ disabled, onEnter, onLeave }: HoverableOptions): HoverableResult;
|
|
154
165
|
//#endregion
|
|
155
166
|
//#region src/foundations/interactions/roving-focus.d.ts
|
|
167
|
+
/** Arrow-key axis for {@link rovingFocus}. */
|
|
156
168
|
type Orientation = 'horizontal' | 'vertical' | 'both';
|
|
169
|
+
/** Options for {@link rovingFocus}. */
|
|
157
170
|
interface RovingFocusOptions {
|
|
158
171
|
/**
|
|
159
172
|
* Current focused index
|
|
@@ -183,6 +196,7 @@ interface RovingFocusOptions {
|
|
|
183
196
|
*/
|
|
184
197
|
isDisabled?: (index: number) => boolean;
|
|
185
198
|
}
|
|
199
|
+
/** Container and per-item props returned by {@link rovingFocus}. */
|
|
186
200
|
interface RovingFocusResult {
|
|
187
201
|
/**
|
|
188
202
|
* Props for the container element (composes via mergeProps)
|
|
@@ -198,6 +212,7 @@ interface RovingFocusResult {
|
|
|
198
212
|
'data-roving-index': number;
|
|
199
213
|
};
|
|
200
214
|
}
|
|
215
|
+
/** Implement arrow-key roving tabindex navigation over a set of items. */
|
|
201
216
|
declare function rovingFocus(options: RovingFocusOptions): RovingFocusResult;
|
|
202
217
|
/**
|
|
203
218
|
* USAGE EXAMPLE:
|
|
@@ -227,6 +242,7 @@ declare function rovingFocus(options: RovingFocusOptions): RovingFocusResult;
|
|
|
227
242
|
*/
|
|
228
243
|
//#endregion
|
|
229
244
|
//#region src/foundations/interactions/interaction-policy.d.ts
|
|
245
|
+
/** Input to {@link applyInteractionPolicy}. */
|
|
230
246
|
interface InteractionPolicyInput {
|
|
231
247
|
/** Whether the host element is a native interactive element (button, a, etc) */
|
|
232
248
|
isNative: boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as focusable, i as hoverable, n as mergeInteractionProps, o as dismissable, r as rovingFocus, s as pressable, t as applyInteractionPolicy } from "../../interactions-
|
|
1
|
+
import { a as focusable, i as hoverable, n as mergeInteractionProps, o as dismissable, r as rovingFocus, s as pressable, t as applyInteractionPolicy } from "../../interactions-B4XaFxt1.js";
|
|
2
2
|
export { applyInteractionPolicy, dismissable, focusable, hoverable, mergeInteractionProps, pressable, rovingFocus };
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { dn as State } from "../../index-KQ7Vl4-8.js";
|
|
2
2
|
//#region src/foundations/state/controllable.d.ts
|
|
3
|
+
/** Whether `value` represents controlled mode (not `undefined`). */
|
|
3
4
|
declare function isControlled<T>(value: T | undefined): value is T;
|
|
5
|
+
/** Resolve the effective value and controlled-ness for a controllable prop. */
|
|
4
6
|
declare function resolveControllable<T>(value: T | undefined, defaultValue: T): {
|
|
5
7
|
value: T;
|
|
6
8
|
isControlled: boolean;
|
|
7
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Build a `set` function that calls `onChange` in controlled mode, or
|
|
12
|
+
* updates internal state and then calls `onChange` in uncontrolled mode.
|
|
13
|
+
*/
|
|
8
14
|
declare function makeControllable<T>(options: {
|
|
9
15
|
value: T | undefined;
|
|
10
16
|
defaultValue: T;
|
|
@@ -14,6 +20,7 @@ declare function makeControllable<T>(options: {
|
|
|
14
20
|
set: (next: T) => void;
|
|
15
21
|
isControlled: boolean;
|
|
16
22
|
};
|
|
23
|
+
/** A {@link State} accessor that also reports whether it is controlled. */
|
|
17
24
|
type ControllableState<T> = State<T> & {
|
|
18
25
|
isControlled: boolean;
|
|
19
26
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as state } from "../../state-
|
|
1
|
+
import { t as state } from "../../state-DmkGM_LN.js";
|
|
2
2
|
//#region src/foundations/state/controllable.ts
|
|
3
3
|
/**
|
|
4
4
|
* controllable
|
|
@@ -23,9 +23,11 @@ import { t as state } from "../../state-DCjONcHK.js";
|
|
|
23
23
|
* controllableState uses Object.is() to prevent unnecessary onChange calls.
|
|
24
24
|
* This is intentional — strict equality, no deep comparison.
|
|
25
25
|
*/
|
|
26
|
+
/** Whether `value` represents controlled mode (not `undefined`). */
|
|
26
27
|
function isControlled(value) {
|
|
27
28
|
return value !== void 0;
|
|
28
29
|
}
|
|
30
|
+
/** Resolve the effective value and controlled-ness for a controllable prop. */
|
|
29
31
|
function resolveControllable(value, defaultValue) {
|
|
30
32
|
const controlled = isControlled(value);
|
|
31
33
|
return {
|
|
@@ -33,6 +35,10 @@ function resolveControllable(value, defaultValue) {
|
|
|
33
35
|
isControlled: controlled
|
|
34
36
|
};
|
|
35
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Build a `set` function that calls `onChange` in controlled mode, or
|
|
40
|
+
* updates internal state and then calls `onChange` in uncontrolled mode.
|
|
41
|
+
*/
|
|
36
42
|
function makeControllable(options) {
|
|
37
43
|
const { value, defaultValue, onChange, setInternal } = options;
|
|
38
44
|
const { isControlled } = resolveControllable(value, defaultValue);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { r as JSXElement } from "../../
|
|
2
|
-
import { _ as isElement, a as Collection, c as DefaultPortal, d as definePortal, f as Presence, g as cloneElement, h as SlotProps, i as createLayer, l as Portal, m as Slot, n as LayerManager, o as CollectionItem, p as PresenceProps, r as LayerOptions, s as createCollection, t as Layer, u as PortalProps, v as LayoutComponent, y as layout } from "../../index-
|
|
1
|
+
import { r as JSXElement } from "../../types-DkVJhVs9.js";
|
|
2
|
+
import { _ as isElement, a as Collection, c as DefaultPortal, d as definePortal, f as Presence, g as cloneElement, h as SlotProps, i as createLayer, l as Portal, m as Slot, n as LayerManager, o as CollectionItem, p as PresenceProps, r as LayerOptions, s as createCollection, t as Layer, u as PortalProps, v as LayoutComponent, y as layout } from "../../index-C29SEGIv.js";
|
|
3
3
|
export { type Collection, type CollectionItem, DefaultPortal, type JSXElement, type Layer, type LayerManager, type LayerOptions, type LayoutComponent, Portal, type PortalProps, Presence, type PresenceProps, Slot, type SlotProps, cloneElement, createCollection, createLayer, definePortal, isElement, layout };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as definePortal, c as layout, i as Portal, l as cloneElement, n as createCollection, o as Presence, r as DefaultPortal, s as Slot, t as createLayer, u as isElement } from "../../structures-
|
|
1
|
+
import { a as definePortal, c as layout, i as Portal, l as cloneElement, n as createCollection, o as Presence, r as DefaultPortal, s as Slot, t as createLayer, u as isElement } from "../../structures-umvVUD-M.js";
|
|
2
2
|
export { DefaultPortal, Portal, Presence, Slot, cloneElement, createCollection, createLayer, definePortal, isElement, layout };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as composeRefs, r as setRef, t as Ref } from "../../compose-ref-
|
|
2
|
-
import { a as ariaSelected, c as composeHandlers, d as KeyboardLikeEvent, f as PointerLikeEvent, i as ariaExpanded, l as DefaultPreventable, n as formatId, o as mergeProps, p as PropagationStoppable, r as ariaDisabled, s as ComposeHandlersOptions, t as FormatIdOptions, u as FocusLikeEvent } from "../../index-
|
|
1
|
+
import { n as composeRefs, r as setRef, t as Ref } from "../../compose-ref-DOJHoW5X.js";
|
|
2
|
+
import { a as ariaSelected, c as composeHandlers, d as KeyboardLikeEvent, f as PointerLikeEvent, i as ariaExpanded, l as DefaultPreventable, n as formatId, o as mergeProps, p as PropagationStoppable, r as ariaDisabled, s as ComposeHandlersOptions, t as FormatIdOptions, u as FocusLikeEvent } from "../../index-CzH-0LcA.js";
|
|
3
3
|
export { type ComposeHandlersOptions, type DefaultPreventable, type FocusLikeEvent, type FormatIdOptions, type KeyboardLikeEvent, type PointerLikeEvent, type PropagationStoppable, type Ref, ariaDisabled, ariaExpanded, ariaSelected, composeHandlers, composeRefs, formatId, mergeProps, setRef };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as ariaSelected, i as ariaExpanded, n as setRef, o as mergeProps, r as ariaDisabled, s as composeHandlers, t as composeRefs } from "../../compose-ref-
|
|
1
|
+
import { a as ariaSelected, i as ariaExpanded, n as setRef, o as mergeProps, r as ariaDisabled, s as composeHandlers, t as composeRefs } from "../../compose-ref-1Fhs7mbF.js";
|
|
2
2
|
import { t as formatId } from "../../utilities-C_CGX4Dz.js";
|
|
3
3
|
export { ariaDisabled, ariaExpanded, ariaSelected, composeHandlers, composeRefs, formatId, mergeProps, setRef };
|
package/dist/fx/index.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { X as scheduleEventHandler } from "../index-KQ7Vl4-8.js";
|
|
2
2
|
//#region src/fx/timing.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Timing utilities — pure helpers for common async patterns
|
|
5
5
|
* No framework coupling. No lifecycle awareness.
|
|
6
6
|
*/
|
|
7
|
+
/** Options for {@link debounce}. */
|
|
7
8
|
interface DebounceOptions {
|
|
8
9
|
leading?: boolean;
|
|
9
10
|
trailing?: boolean;
|
|
10
11
|
}
|
|
12
|
+
/** Options for {@link throttle}. */
|
|
11
13
|
interface ThrottleOptions {
|
|
12
14
|
leading?: boolean;
|
|
13
15
|
trailing?: boolean;
|
|
14
16
|
}
|
|
17
|
+
/** Options for {@link retry}. */
|
|
15
18
|
interface RetryOptions {
|
|
16
19
|
maxAttempts?: number;
|
|
17
20
|
delayMs?: number;
|
|
@@ -158,6 +161,7 @@ declare function retry<T>(fn: () => Promise<T>, options?: RetryOptions): Promise
|
|
|
158
161
|
//#endregion
|
|
159
162
|
//#region src/fx/fx.d.ts
|
|
160
163
|
type CancelFn = () => void;
|
|
164
|
+
/** Wrap an event handler so rapid events are coalesced and delayed by `ms`. */
|
|
161
165
|
declare function debounceEvent(ms: number, handler: EventListener, options?: {
|
|
162
166
|
leading?: boolean;
|
|
163
167
|
trailing?: boolean;
|
|
@@ -165,16 +169,20 @@ declare function debounceEvent(ms: number, handler: EventListener, options?: {
|
|
|
165
169
|
cancel(): void;
|
|
166
170
|
flush(): void;
|
|
167
171
|
};
|
|
172
|
+
/** Wrap an event handler so it runs at most once per `ms` interval. */
|
|
168
173
|
declare function throttleEvent(ms: number, handler: EventListener, options?: {
|
|
169
174
|
leading?: boolean;
|
|
170
175
|
trailing?: boolean;
|
|
171
176
|
}): EventListener & {
|
|
172
177
|
cancel(): void;
|
|
173
178
|
};
|
|
179
|
+
/** Wrap an event handler so it runs at most once per animation frame, using the latest event. */
|
|
174
180
|
declare function rafEvent(handler: EventListener): EventListener & {
|
|
175
181
|
cancel(): void;
|
|
176
182
|
};
|
|
183
|
+
/** Schedule `fn` after `ms`, auto-cancelling on component cleanup; returns a cancel function. */
|
|
177
184
|
declare function scheduleTimeout(ms: number, fn: () => void): CancelFn;
|
|
185
|
+
/** Schedule `fn` during browser idle time, auto-cancelling on component cleanup. */
|
|
178
186
|
declare function scheduleIdle(fn: () => void, options?: {
|
|
179
187
|
timeout?: number;
|
|
180
188
|
}): CancelFn;
|
|
@@ -183,6 +191,7 @@ interface RetryOptions$1 {
|
|
|
183
191
|
delayMs?: number;
|
|
184
192
|
backoff?: (attemptIndex: number) => number;
|
|
185
193
|
}
|
|
194
|
+
/** Run `fn`, retrying with backoff on failure, auto-cancelling on component cleanup. */
|
|
186
195
|
declare function scheduleRetry<T>(fn: () => Promise<T>, options?: RetryOptions$1): {
|
|
187
196
|
cancel(): void;
|
|
188
197
|
};
|
package/dist/fx/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { f as getCurrentComponentInstance } from "../component-scope-
|
|
1
|
+
import { g as scheduleEventHandler, n as enqueueRuntimeTask, y as logger } from "../access-d_DCdwqn.js";
|
|
2
|
+
import { f as getCurrentComponentInstance } from "../component-scope-4I3yEMkb.js";
|
|
3
3
|
//#region src/fx/timing.ts
|
|
4
4
|
/**
|
|
5
5
|
* Debounce — delay execution, coalesce rapid calls
|
|
@@ -263,6 +263,7 @@ function enqueueUserCallback(fn) {
|
|
|
263
263
|
}
|
|
264
264
|
});
|
|
265
265
|
}
|
|
266
|
+
/** Wrap an event handler so rapid events are coalesced and delayed by `ms`. */
|
|
266
267
|
function debounceEvent(ms, handler, options) {
|
|
267
268
|
const { leading = false, trailing = true } = options || {};
|
|
268
269
|
const inst = getCurrentComponentInstance();
|
|
@@ -309,6 +310,7 @@ function debounceEvent(ms, handler, options) {
|
|
|
309
310
|
});
|
|
310
311
|
return debounced;
|
|
311
312
|
}
|
|
313
|
+
/** Wrap an event handler so it runs at most once per `ms` interval. */
|
|
312
314
|
function throttleEvent(ms, handler, options) {
|
|
313
315
|
const { leading = true, trailing = true } = options || {};
|
|
314
316
|
const inst = getCurrentComponentInstance();
|
|
@@ -347,6 +349,7 @@ function throttleEvent(ms, handler, options) {
|
|
|
347
349
|
if (inst) (inst.cleanupFns ??= []).push(() => throttled.cancel());
|
|
348
350
|
return throttled;
|
|
349
351
|
}
|
|
352
|
+
/** Wrap an event handler so it runs at most once per animation frame, using the latest event. */
|
|
350
353
|
function rafEvent(handler) {
|
|
351
354
|
const inst = getCurrentComponentInstance();
|
|
352
355
|
if (inst && inst.ssr) return noopEventListener;
|
|
@@ -378,6 +381,7 @@ function rafEvent(handler) {
|
|
|
378
381
|
if (inst) (inst.cleanupFns ??= []).push(() => fn.cancel());
|
|
379
382
|
return fn;
|
|
380
383
|
}
|
|
384
|
+
/** Schedule `fn` after `ms`, auto-cancelling on component cleanup; returns a cancel function. */
|
|
381
385
|
function scheduleTimeout(ms, fn) {
|
|
382
386
|
throwIfDuringRender();
|
|
383
387
|
const inst = getCurrentComponentInstance();
|
|
@@ -395,6 +399,7 @@ function scheduleTimeout(ms, fn) {
|
|
|
395
399
|
if (inst) (inst.cleanupFns ??= []).push(cancel);
|
|
396
400
|
return cancel;
|
|
397
401
|
}
|
|
402
|
+
/** Schedule `fn` during browser idle time, auto-cancelling on component cleanup. */
|
|
398
403
|
function scheduleIdle(fn, options) {
|
|
399
404
|
throwIfDuringRender();
|
|
400
405
|
const inst = getCurrentComponentInstance();
|
|
@@ -421,6 +426,7 @@ function scheduleIdle(fn, options) {
|
|
|
421
426
|
if (inst) (inst.cleanupFns ??= []).push(cancel);
|
|
422
427
|
return cancel;
|
|
423
428
|
}
|
|
429
|
+
/** Run `fn`, retrying with backoff on failure, auto-cancelling on component cleanup. */
|
|
424
430
|
function scheduleRetry(fn, options) {
|
|
425
431
|
throwIfDuringRender();
|
|
426
432
|
const inst = getCurrentComponentInstance();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as JSXElement } from "./
|
|
3
|
-
import "./types-CsPtBGWb.js";
|
|
1
|
+
import { rn as RenderableChild } from "./index-KQ7Vl4-8.js";
|
|
2
|
+
import { r as JSXElement } from "./types-DkVJhVs9.js";
|
|
4
3
|
//#region src/foundations/structures/layout.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Layout helper.
|
|
@@ -25,16 +24,24 @@ import "./types-CsPtBGWb.js";
|
|
|
25
24
|
* Props are spread into the layout component. This is intentional
|
|
26
25
|
* and deterministic — no merging or composition.
|
|
27
26
|
*/
|
|
27
|
+
/** A component that receives its route children via `props.children`. */
|
|
28
28
|
type LayoutComponent<P = object> = (props: P & {
|
|
29
29
|
children?: RenderableChild;
|
|
30
30
|
}) => unknown;
|
|
31
|
+
/**
|
|
32
|
+
* Wrap a {@link LayoutComponent} so it can be invoked as `(children, props)`,
|
|
33
|
+
* matching route layout conventions.
|
|
34
|
+
*/
|
|
31
35
|
declare function layout<P = object>(Layout: LayoutComponent<P>): (children?: RenderableChild, props?: P) => unknown;
|
|
32
36
|
//#endregion
|
|
33
37
|
//#region src/jsx/utils.d.ts
|
|
38
|
+
/** Check whether `value` is a JSX element vnode. */
|
|
34
39
|
declare function isElement(value: unknown): value is JSXElement;
|
|
40
|
+
/** Clone a JSX element, shallow-merging `props` over its existing props. */
|
|
35
41
|
declare function cloneElement(element: JSXElement, props: Record<string, unknown>): JSXElement;
|
|
36
42
|
//#endregion
|
|
37
43
|
//#region src/foundations/structures/slot.d.ts
|
|
44
|
+
/** Props for {@link Slot}: `asChild` selects prop-merging vs. fragment mode. */
|
|
38
45
|
type SlotProps = {
|
|
39
46
|
asChild: true;
|
|
40
47
|
children: JSXElement;
|
|
@@ -66,7 +73,9 @@ type SlotProps = {
|
|
|
66
73
|
declare function Slot(props: SlotProps): JSXElement | null;
|
|
67
74
|
//#endregion
|
|
68
75
|
//#region src/foundations/structures/presence.d.ts
|
|
76
|
+
/** Props for {@link Presence}. */
|
|
69
77
|
interface PresenceProps {
|
|
78
|
+
/** Whether the children should be mounted, or a function returning it. */
|
|
70
79
|
present: boolean | (() => boolean);
|
|
71
80
|
children?: RenderableChild;
|
|
72
81
|
}
|
|
@@ -96,17 +105,28 @@ interface PresenceProps {
|
|
|
96
105
|
declare function Presence({ present, children }: PresenceProps): JSXElement | null;
|
|
97
106
|
//#endregion
|
|
98
107
|
//#region src/runtime/portal.d.ts
|
|
108
|
+
/**
|
|
109
|
+
* A named portal channel created by {@link definePortal}: call it as a
|
|
110
|
+
* component to render the host, and call `.render(props)` to write content.
|
|
111
|
+
*/
|
|
99
112
|
interface Portal<T extends RenderableChild = RenderableChild> {
|
|
100
113
|
(): T | JSXElement | null | undefined;
|
|
101
114
|
render(props: {
|
|
102
115
|
children?: T;
|
|
103
116
|
}): unknown;
|
|
104
117
|
}
|
|
118
|
+
/** Props for the {@link Portal} component. */
|
|
105
119
|
interface PortalProps {
|
|
106
120
|
children?: RenderableChild;
|
|
107
121
|
}
|
|
122
|
+
/** Create a new named {@link Portal} channel with its own host and content. */
|
|
108
123
|
declare function definePortal<T extends RenderableChild = RenderableChild>(): Portal<T>;
|
|
124
|
+
/**
|
|
125
|
+
* The implicit portal channel that {@link Portal} writes to and that any
|
|
126
|
+
* host rendered without an explicit portal falls back to.
|
|
127
|
+
*/
|
|
109
128
|
declare const DefaultPortal: Portal<RenderableChild>;
|
|
129
|
+
/** Write children to the {@link DefaultPortal} host wherever it is rendered. */
|
|
110
130
|
declare function Portal(props: PortalProps): JSXElement | null;
|
|
111
131
|
//#endregion
|
|
112
132
|
//#region src/foundations/structures/collection.d.ts
|
|
@@ -134,10 +154,12 @@ declare function Portal(props: PortalProps): JSXElement | null;
|
|
|
134
154
|
* const allItems = collection.items();
|
|
135
155
|
* unregister();
|
|
136
156
|
*/
|
|
157
|
+
/** A registered node paired with its metadata inside a {@link Collection}. */
|
|
137
158
|
type CollectionItem<TNode, TMetadata = unknown> = {
|
|
138
159
|
node: TNode;
|
|
139
160
|
metadata: TMetadata;
|
|
140
161
|
};
|
|
162
|
+
/** Ordered descendant registry returned by {@link createCollection}. */
|
|
141
163
|
interface Collection<TNode, TMetadata = unknown> {
|
|
142
164
|
/**
|
|
143
165
|
* Register a node with optional metadata.
|
|
@@ -157,6 +179,7 @@ interface Collection<TNode, TMetadata = unknown> {
|
|
|
157
179
|
*/
|
|
158
180
|
size(): number;
|
|
159
181
|
}
|
|
182
|
+
/** Create an empty, insertion-ordered {@link Collection} registry. */
|
|
160
183
|
declare function createCollection<TNode, TMetadata = unknown>(): Collection<TNode, TMetadata>;
|
|
161
184
|
/**
|
|
162
185
|
* USAGE EXAMPLE:
|
|
@@ -208,6 +231,7 @@ declare function createCollection<TNode, TMetadata = unknown>(): Collection<TNod
|
|
|
208
231
|
* layer.isTop(); // true if this is the topmost layer
|
|
209
232
|
* layer.unregister();
|
|
210
233
|
*/
|
|
234
|
+
/** Options for registering a layer with {@link LayerManager.register}. */
|
|
211
235
|
interface LayerOptions {
|
|
212
236
|
/**
|
|
213
237
|
* Called when Escape is pressed and this is the top layer
|
|
@@ -222,6 +246,7 @@ interface LayerOptions {
|
|
|
222
246
|
*/
|
|
223
247
|
node?: Node | null;
|
|
224
248
|
}
|
|
249
|
+
/** A registered layer entry returned by {@link LayerManager.register}. */
|
|
225
250
|
interface Layer {
|
|
226
251
|
/**
|
|
227
252
|
* Unique layer ID
|
|
@@ -236,6 +261,7 @@ interface Layer {
|
|
|
236
261
|
*/
|
|
237
262
|
unregister(): void;
|
|
238
263
|
}
|
|
264
|
+
/** Stacking coordinator returned by {@link createLayer}. */
|
|
239
265
|
interface LayerManager {
|
|
240
266
|
/**
|
|
241
267
|
* Register a new layer
|
|
@@ -254,6 +280,7 @@ interface LayerManager {
|
|
|
254
280
|
*/
|
|
255
281
|
handleOutsidePointer(e: PointerEvent): void;
|
|
256
282
|
}
|
|
283
|
+
/** Create a new, empty {@link LayerManager} for coordinating overlay stacking. */
|
|
257
284
|
declare function createLayer(): LayerManager;
|
|
258
285
|
/**
|
|
259
286
|
* USAGE EXAMPLE:
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
//#region src/foundations/utilities/event-types.d.ts
|
|
2
|
+
/** Minimal shape of an event that can be prevented from its default action. */
|
|
2
3
|
interface DefaultPreventable {
|
|
3
4
|
defaultPrevented?: boolean;
|
|
4
5
|
preventDefault?: () => void;
|
|
5
6
|
}
|
|
7
|
+
/** Minimal shape of an event whose propagation can be stopped. */
|
|
6
8
|
interface PropagationStoppable {
|
|
7
9
|
stopPropagation?: () => void;
|
|
8
10
|
}
|
|
11
|
+
/** Structural subset of a keyboard event, for handlers that accept native or synthetic events. */
|
|
9
12
|
interface KeyboardLikeEvent extends DefaultPreventable, PropagationStoppable {
|
|
10
13
|
key: string;
|
|
11
14
|
}
|
|
15
|
+
/** Structural subset of a pointer event, for handlers that accept native or synthetic events. */
|
|
12
16
|
interface PointerLikeEvent extends DefaultPreventable, PropagationStoppable {
|
|
13
17
|
target?: unknown;
|
|
14
18
|
}
|
|
19
|
+
/** Structural subset of a focus event, for handlers that accept native or synthetic events. */
|
|
15
20
|
interface FocusLikeEvent extends DefaultPreventable, PropagationStoppable {
|
|
16
21
|
relatedTarget?: unknown;
|
|
17
22
|
}
|
|
@@ -42,6 +47,7 @@ interface FocusLikeEvent extends DefaultPreventable, PropagationStoppable {
|
|
|
42
47
|
* 4. Type Safety
|
|
43
48
|
* Args are readonly to prevent mutation. Return type matches input.
|
|
44
49
|
*/
|
|
50
|
+
/** Options for {@link composeHandlers}. */
|
|
45
51
|
interface ComposeHandlersOptions {
|
|
46
52
|
/**
|
|
47
53
|
* When true (default), do not run the second handler if the first prevented default.
|
|
@@ -49,26 +55,38 @@ interface ComposeHandlersOptions {
|
|
|
49
55
|
*/
|
|
50
56
|
checkDefaultPrevented?: boolean;
|
|
51
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Compose two optional event handlers into one, running `first` then
|
|
60
|
+
* `second` unless `first` marked the event as default-prevented.
|
|
61
|
+
*/
|
|
52
62
|
declare function composeHandlers<A extends readonly unknown[]>(first?: (...args: A) => void, second?: (...args: A) => void, options?: ComposeHandlersOptions): (...args: A) => void;
|
|
53
63
|
//#endregion
|
|
54
64
|
//#region src/foundations/utilities/merge-props.d.ts
|
|
65
|
+
/**
|
|
66
|
+
* Merge `base` props over `injected` props: non-handler keys in `base` win,
|
|
67
|
+
* and matching event handlers are composed (`injected` runs first).
|
|
68
|
+
*/
|
|
55
69
|
declare function mergeProps<TBase extends object, TInjected extends object>(base: TBase, injected: TInjected): TInjected & TBase;
|
|
56
70
|
//#endregion
|
|
57
71
|
//#region src/foundations/utilities/aria.d.ts
|
|
58
72
|
/**
|
|
59
73
|
* Tiny aria helpers
|
|
60
74
|
*/
|
|
75
|
+
/** Build an `aria-disabled` prop object; omitted entirely when `disabled` is falsy. */
|
|
61
76
|
declare function ariaDisabled(disabled?: boolean): {
|
|
62
77
|
'aria-disabled'?: 'true';
|
|
63
78
|
};
|
|
79
|
+
/** Build an `aria-expanded` prop object; omitted when `expanded` is `undefined`. */
|
|
64
80
|
declare function ariaExpanded(expanded?: boolean): {
|
|
65
81
|
'aria-expanded'?: 'true' | 'false';
|
|
66
82
|
};
|
|
83
|
+
/** Build an `aria-selected` prop object; omitted when `selected` is `undefined`. */
|
|
67
84
|
declare function ariaSelected(selected?: boolean): {
|
|
68
85
|
'aria-selected'?: 'true' | 'false';
|
|
69
86
|
};
|
|
70
87
|
//#endregion
|
|
71
88
|
//#region src/foundations/utilities/use-id.d.ts
|
|
89
|
+
/** Options for {@link formatId}. */
|
|
72
90
|
interface FormatIdOptions {
|
|
73
91
|
/** Defaults to 'askr' */
|
|
74
92
|
prefix?: string;
|