foldkit-primitives 0.7.0 → 0.8.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.
package/dist/device/index.d.mts
CHANGED
|
@@ -59,7 +59,7 @@ export declare const GeolocationMessage: import("foldkit/message").MessageUnion<
|
|
|
59
59
|
}>;
|
|
60
60
|
export type GeolocationMessage = typeof GeolocationMessage.Type;
|
|
61
61
|
export declare const Geolocation: Bundle.Bundle<"Geolocation", void, {
|
|
62
|
-
readonly status: "unknown" | "
|
|
62
|
+
readonly status: "unknown" | "denied" | "ready";
|
|
63
63
|
readonly coords: {
|
|
64
64
|
readonly latitude: number;
|
|
65
65
|
readonly longitude: number;
|
|
@@ -130,7 +130,7 @@ export declare const mediaDevices: <const Name extends string>(config: {
|
|
|
130
130
|
/** Read lazily so tests can substitute a double, like the SSE bundle. */
|
|
131
131
|
readonly create?: ((navigator: Navigator) => MediaDevicesHandle | null) | undefined;
|
|
132
132
|
}) => Bundle.Bundle<Name, void, {
|
|
133
|
-
readonly status: "unknown" | "
|
|
133
|
+
readonly status: "unknown" | "denied" | "ready";
|
|
134
134
|
readonly devices: readonly {
|
|
135
135
|
readonly deviceId: string;
|
|
136
136
|
readonly groupId: string;
|
|
@@ -288,7 +288,7 @@ export declare const permissions: <const Name extends string>(config: {
|
|
|
288
288
|
readonly names: ReadonlyArray<string>;
|
|
289
289
|
}, {
|
|
290
290
|
readonly states: {
|
|
291
|
-
readonly [x: string]: "
|
|
291
|
+
readonly [x: string]: "granted" | "denied" | "prompt";
|
|
292
292
|
};
|
|
293
293
|
readonly lastError: string | null;
|
|
294
294
|
}, {
|
|
@@ -296,15 +296,15 @@ export declare const permissions: <const Name extends string>(config: {
|
|
|
296
296
|
} | {
|
|
297
297
|
readonly _tag: "Changed";
|
|
298
298
|
readonly name: string;
|
|
299
|
-
readonly state: "
|
|
300
|
-
} | {
|
|
301
|
-
readonly _tag: "Failed";
|
|
302
|
-
readonly message: string;
|
|
299
|
+
readonly state: "granted" | "denied" | "prompt";
|
|
303
300
|
} | {
|
|
304
301
|
readonly _tag: "Snapshot";
|
|
305
302
|
readonly states: {
|
|
306
|
-
readonly [x: string]: "
|
|
303
|
+
readonly [x: string]: "granted" | "denied" | "prompt";
|
|
307
304
|
};
|
|
305
|
+
} | {
|
|
306
|
+
readonly _tag: "Failed";
|
|
307
|
+
readonly message: string;
|
|
308
308
|
}, never, never, ManagedResource.ManagedResourceService<"permissions">, void, Readonly<{
|
|
309
309
|
watch: ManagedResource.Entry<PermissionsModel, PermissionsMessage, Option.Option<ReadonlyArray<string>>, Acquired, WatchService, (acquired: Acquired) => PermissionsMessage>;
|
|
310
310
|
}>, {}>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { A as ScrollLock, C as targetOf, D as MoveStarted, E as MoveEnded, M as tabbableWithin, O as Moved, S as Targets, T as Move, _ as boxOf, a as TextEdited, b as TargetHovered, c as DRAG_THRESHOLD, d as DragFact, f as DragPlace, g as PointerDrag, h as DraggedOver, i as TextCommitted, j as FocusScope, k as HideOutside, l as DragCancelled, m as DragZone, n as EditableText, o as TextFact, p as DragStarted, r as TextCancelled, s as textOf, t as EditAsked, u as DragDropped, v as zoneOf, w as Fact$1, x as TargetPressed, y as TargetFact } from "../editable-text-BbsPOATY.mjs";
|
|
2
2
|
import { a as modalityOfKey, i as Modality, r as InputModalityModel, t as InputModality } from "../input-modality-DGOhAknO.mjs";
|
|
3
|
-
import { Schema } from "effect";
|
|
3
|
+
import { Option, Schema } from "effect";
|
|
4
4
|
import * as Mount from "foldkit/mount";
|
|
5
5
|
import { Bundle, Declared } from "foldkit-bundle";
|
|
6
|
-
import { Behavior, Behaviors, SlotItem } from "foldkit-mixins";
|
|
6
|
+
import { Behavior, Behaviors, NamedBehavior, SlotItem } from "foldkit-mixins";
|
|
7
7
|
import { Attribute, Html, HtmlBuilder, KeyboardModifiers } from "foldkit/html";
|
|
8
8
|
declare namespace dismiss_layer_d_exports {
|
|
9
9
|
export { BehaviorOptions$14 as BehaviorOptions, Dismiss, LAYER_ATTRIBUTE, Layer$1 as Layer, Message$9 as Message, Model$9 as Model, TRIGGER_ATTRIBUTE, behavior$14 as behavior, bundle$9 as bundle, layersOnPath, toDismiss };
|
|
@@ -434,7 +434,7 @@ declare const bundle$5: Bundle.Bundle<"ListNavigation", {
|
|
|
434
434
|
readonly _tag: "Focused";
|
|
435
435
|
readonly id: string;
|
|
436
436
|
}, never, never, never, void, {}, {}>;
|
|
437
|
-
interface BehaviorOptions$8<Input, Slots> {
|
|
437
|
+
interface BehaviorOptions$8<Input, Slots, ParentMessage> {
|
|
438
438
|
readonly container: keyof Slots & string;
|
|
439
439
|
/** The slot rendered once per item; must carry the item's id (see `Behaviors.Collection`). */
|
|
440
440
|
readonly item: keyof Slots & string;
|
|
@@ -442,6 +442,17 @@ interface BehaviorOptions$8<Input, Slots> {
|
|
|
442
442
|
/** The text an item is matched by when typing. */
|
|
443
443
|
readonly text: (input: Input, index: number) => string;
|
|
444
444
|
readonly direction?: (input: Input) => Direction;
|
|
445
|
+
/**
|
|
446
|
+
* Whether a printable key moves the pointer. Off when the container is a
|
|
447
|
+
* text field: letters belong to the field, and arrows still navigate.
|
|
448
|
+
* Defaults to on.
|
|
449
|
+
*/
|
|
450
|
+
readonly typeahead?: boolean;
|
|
451
|
+
/**
|
|
452
|
+
* Enter on the current enabled item. One handler with the arrows: a second
|
|
453
|
+
* key handler on the same slot would be a second owner of `keydown`.
|
|
454
|
+
*/
|
|
455
|
+
readonly commit?: (input: Input, id: string) => ParentMessage;
|
|
445
456
|
}
|
|
446
457
|
/**
|
|
447
458
|
* The key's outcome, before it is turned into an attribute: navigation to an
|
|
@@ -466,7 +477,7 @@ declare const keyOutcome: (items: Behaviors.Collection.Items<unknown>, texts: Re
|
|
|
466
477
|
* `OnFocus` as under `RovingTabindex`. Under `virtual` nothing takes DOM focus
|
|
467
478
|
* and the container carries `aria-activedescendant`.
|
|
468
479
|
*/
|
|
469
|
-
declare const behavior$8: <Field extends string>(declared: Declared<typeof bundle$5, Field>, args: Args$5) => <Slots>(slots: Slots) => <Input extends { readonly [K in Field]: Model$5; }, ParentMessage>(options: BehaviorOptions$8<Input, Slots>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
480
|
+
declare const behavior$8: <Field extends string>(declared: Declared<typeof bundle$5, Field>, args: Args$5) => <Slots>(slots: Slots) => <Input extends { readonly [K in Field]: Model$5; }, ParentMessage>(options: BehaviorOptions$8<Input, Slots, ParentMessage>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
470
481
|
declare namespace long_press_d_exports {
|
|
471
482
|
export { Args$4 as Args, BehaviorOptions$7 as BehaviorOptions, LongPressed, Message$4 as Message, Model$4 as Model, behavior$7 as behavior, bundle$4 as bundle };
|
|
472
483
|
}
|
|
@@ -577,6 +588,50 @@ interface BehaviorOptions$6<Slots, ParentMessage> {
|
|
|
577
588
|
readonly toMessage: (fact: Fact$1) => ParentMessage;
|
|
578
589
|
}
|
|
579
590
|
declare const behavior$6: <Slots>(slots: Slots) => <Input, ParentMessage>(options: BehaviorOptions$6<Slots, ParentMessage>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
591
|
+
declare namespace overlay_d_exports {
|
|
592
|
+
export { DismissPolicy, FocusPolicy, Policy, behaviors, modal, nonModal };
|
|
593
|
+
}
|
|
594
|
+
interface DismissPolicy {
|
|
595
|
+
/** Dismiss on a press outside. Default `true`. */
|
|
596
|
+
readonly outside: boolean;
|
|
597
|
+
/** Dismiss on Escape when topmost. Default `true`. */
|
|
598
|
+
readonly escape: boolean;
|
|
599
|
+
}
|
|
600
|
+
interface FocusPolicy {
|
|
601
|
+
/** Keep Tab, Shift+Tab, and stray focus inside. Default `true`. */
|
|
602
|
+
readonly contain: boolean;
|
|
603
|
+
/** Give focus back to what had it on unmount. Default `true`. */
|
|
604
|
+
readonly restore: boolean;
|
|
605
|
+
/** A selector inside the layer to focus first. */
|
|
606
|
+
readonly initialFocus?: string;
|
|
607
|
+
}
|
|
608
|
+
interface Policy {
|
|
609
|
+
readonly dismiss: DismissPolicy;
|
|
610
|
+
readonly focus: FocusPolicy;
|
|
611
|
+
/** Lock the document's scroll while mounted. */
|
|
612
|
+
readonly scroll: {
|
|
613
|
+
readonly lock: boolean;
|
|
614
|
+
};
|
|
615
|
+
/** Mark everything outside inert while mounted. */
|
|
616
|
+
readonly inert: boolean;
|
|
617
|
+
}
|
|
618
|
+
/** A modal overlay: dismissed by Escape and outside press, focused, locked, inert. */
|
|
619
|
+
declare const modal: Policy;
|
|
620
|
+
/** A modeless overlay: dismissed by Escape and outside press, focus restored, page usable. */
|
|
621
|
+
declare const nonModal: Policy;
|
|
622
|
+
/**
|
|
623
|
+
* The policy as behaviors, to spread into the view's pipe alongside the
|
|
624
|
+
* widget's own. Conditional pieces are included or left out when the list
|
|
625
|
+
* is built — a static policy per composition — so no slot carries a mount
|
|
626
|
+
* its policy never uses.
|
|
627
|
+
*/
|
|
628
|
+
declare const behaviors: <Slots>(slots: Slots) => <Input, ParentMessage, StackField extends string>(options: {
|
|
629
|
+
readonly stack: Declared<typeof bundle$9, StackField>;
|
|
630
|
+
readonly layer: keyof Slots & string;
|
|
631
|
+
readonly trigger?: keyof Slots & string;
|
|
632
|
+
readonly id: (input: Input) => string;
|
|
633
|
+
readonly policy: Policy;
|
|
634
|
+
}) => ReadonlyArray<NamedBehavior<Slots, Input, ParentMessage>>;
|
|
580
635
|
declare namespace press_d_exports {
|
|
581
636
|
export { Args$3 as Args, BehaviorOptions$5 as BehaviorOptions, Fact, Message$3 as Message, Model$3 as Model, PointerType, Pressed, behavior$5 as behavior, bundle$3 as bundle, events };
|
|
582
637
|
}
|
|
@@ -834,6 +889,91 @@ interface BehaviorOptions$2<Slots, ParentMessage> {
|
|
|
834
889
|
readonly toMessage: (fact: DragFact) => ParentMessage;
|
|
835
890
|
}
|
|
836
891
|
declare const behavior$2: <Slots>(slots: Slots) => <Input, ParentMessage>(options: BehaviorOptions$2<Slots, ParentMessage>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
892
|
+
declare namespace placing_d_exports {
|
|
893
|
+
export { AnchorRect, KeepWithin, OriginRect, PanelRect, PlaceAt, PlaceAtPoint, Placed, PlacedAt, Viewport, ViewportPoint, keepWithin, placeAt, placeAtPoint, placeAtTrigger, placeFor, placedAbove, placedSide, placedTop, shiftIntoViewport };
|
|
894
|
+
}
|
|
895
|
+
interface PanelRect {
|
|
896
|
+
readonly top: number;
|
|
897
|
+
readonly right: number;
|
|
898
|
+
readonly bottom: number;
|
|
899
|
+
readonly height: number;
|
|
900
|
+
}
|
|
901
|
+
interface Viewport {
|
|
902
|
+
readonly width: number;
|
|
903
|
+
readonly height: number;
|
|
904
|
+
}
|
|
905
|
+
interface Placed {
|
|
906
|
+
/** Pixels to move left; `0` when the panel fits. */
|
|
907
|
+
readonly dx: number;
|
|
908
|
+
/** Whether the panel stands above its trigger instead of below. */
|
|
909
|
+
readonly flip: boolean;
|
|
910
|
+
}
|
|
911
|
+
/** Where the panel goes so it fits: left by the overflow, above when the
|
|
912
|
+
* bottom clears the window and the room overhead fits the panel. */
|
|
913
|
+
declare const placeFor: (rect: PanelRect, viewport: Viewport, margin?: number) => Placed;
|
|
914
|
+
/** Pixels to move a box up so its bottom sits `margin` inside the viewport.
|
|
915
|
+
* `0` when it already fits, or when its top is already at the margin. */
|
|
916
|
+
declare const shiftIntoViewport: (rect: {
|
|
917
|
+
readonly top: number;
|
|
918
|
+
readonly bottom: number;
|
|
919
|
+
}, viewportHeight: number, margin?: number) => number;
|
|
920
|
+
/** Attribute `keepWithin` sets to `placedAbove` when the panel flips. */
|
|
921
|
+
declare const placedSide = "data-fk-placed";
|
|
922
|
+
/** Value of `placedSide` while the panel stands above its anchor. */
|
|
923
|
+
declare const placedAbove = "above";
|
|
924
|
+
interface AnchorRect {
|
|
925
|
+
readonly left: number;
|
|
926
|
+
readonly top: number;
|
|
927
|
+
readonly bottom: number;
|
|
928
|
+
readonly width: number;
|
|
929
|
+
readonly height: number;
|
|
930
|
+
}
|
|
931
|
+
interface OriginRect {
|
|
932
|
+
readonly left: number;
|
|
933
|
+
readonly top: number;
|
|
934
|
+
}
|
|
935
|
+
interface PlacedAt {
|
|
936
|
+
readonly left: number;
|
|
937
|
+
readonly top: number;
|
|
938
|
+
}
|
|
939
|
+
/** Custom property `PlaceAt` writes. A panel reads it as `top` so a viewport
|
|
940
|
+
* flip, which sets the `top` property, still wins. */
|
|
941
|
+
declare const placedTop = "--fk-placed-top";
|
|
942
|
+
/** Where a popup sits under its trigger's left edge, in the offset parent's
|
|
943
|
+
* coordinates. A zero-size trigger (an inert document) stays at the origin. */
|
|
944
|
+
declare const placeAt: (trigger: AnchorRect, origin: OriginRect, gap?: number) => PlacedAt;
|
|
945
|
+
interface ViewportPoint {
|
|
946
|
+
readonly x: number;
|
|
947
|
+
readonly y: number;
|
|
948
|
+
}
|
|
949
|
+
/** Where a popup's top-left sits on a viewport point, in the offset parent's
|
|
950
|
+
* coordinates. A context menu uses it: the right-click event carries the
|
|
951
|
+
* point, and `OnContextMenu` does not. */
|
|
952
|
+
declare const placeAtPoint: (point: ViewportPoint, origin: OriginRect) => PlacedAt;
|
|
953
|
+
declare const KeepWithin: Mount.MountDefinitionNoArgs<"KeepWithin", never>;
|
|
954
|
+
declare const PlaceAt: Mount.MountDefinitionWithArgs<"PlaceAt", {
|
|
955
|
+
/** Element id of the trigger the popup opens under. */
|
|
956
|
+
triggerId: Schema.String;
|
|
957
|
+
/** Pixels between the trigger's bottom and the popup. */
|
|
958
|
+
gap: Schema.Number;
|
|
959
|
+
}, never>;
|
|
960
|
+
declare const PlaceAtPoint: Mount.MountDefinitionWithArgs<"PlaceAtPoint", {
|
|
961
|
+
/** Viewport x of the popup's top-left. */
|
|
962
|
+
x: Schema.Number;
|
|
963
|
+
/** Viewport y of the popup's top-left. */
|
|
964
|
+
y: Schema.Number;
|
|
965
|
+
}, never>;
|
|
966
|
+
declare const placeAtTrigger: <Slots>(slots: Slots) => <Input, ParentMessage>(options: {
|
|
967
|
+
readonly panel: keyof Slots & string;
|
|
968
|
+
/** The trigger this open belongs to. Read at insert, so key the panel by it. */
|
|
969
|
+
readonly triggerId: (input: Input) => string;
|
|
970
|
+
readonly gap?: number;
|
|
971
|
+
/** A viewport point wins over the trigger. None places under `triggerId`. */
|
|
972
|
+
readonly at?: (input: Input) => Option.Option<ViewportPoint>;
|
|
973
|
+
}) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
974
|
+
declare const keepWithin: <Slots>(slots: Slots) => <Input, ParentMessage>(options: {
|
|
975
|
+
readonly panel: keyof Slots & string;
|
|
976
|
+
}) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
837
977
|
declare namespace tree_navigation_d_exports {
|
|
838
978
|
export { Action, Args$1 as Args, BehaviorOptions$1 as BehaviorOptions, Message$1 as Message, Model$1 as Model, Row, Shown, behavior$1 as behavior, bundle$1 as bundle, isOpen, move, shown, tabStop };
|
|
839
979
|
}
|
|
@@ -1015,5 +1155,5 @@ interface BehaviorOptions<Input, Slots> {
|
|
|
1015
1155
|
*/
|
|
1016
1156
|
declare const behavior: <Field extends string>(declared: Declared<typeof bundle, Field>) => <Slots>(slots: Slots) => <Input extends { readonly [K in Field]: Model; }, ParentMessage>(options: BehaviorOptions<Input, Slots>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
1017
1157
|
//#endregion
|
|
1018
|
-
export { dismiss_layer_d_exports as DismissLayer, editable_text_d_exports as EditableText, focus_scope_d_exports as FocusScope, focus_visible_d_exports as FocusVisible, grid_navigation_d_exports as GridNavigation, layers_d_exports as Layers, list_navigation_d_exports as ListNavigation, live_announce_d_exports as LiveAnnounce, long_press_d_exports as LongPress, move_d_exports as Move, pointer_drag_d_exports as PointerDrag, press_d_exports as Press, roving_tabindex_d_exports as RovingTabindex, selection_d_exports as Selection, targets_d_exports as Targets, tree_navigation_d_exports as TreeNavigation, typeahead_d_exports as Typeahead };
|
|
1158
|
+
export { dismiss_layer_d_exports as DismissLayer, editable_text_d_exports as EditableText, focus_scope_d_exports as FocusScope, focus_visible_d_exports as FocusVisible, grid_navigation_d_exports as GridNavigation, layers_d_exports as Layers, list_navigation_d_exports as ListNavigation, live_announce_d_exports as LiveAnnounce, long_press_d_exports as LongPress, move_d_exports as Move, overlay_d_exports as Overlay, placing_d_exports as Placing, pointer_drag_d_exports as PointerDrag, press_d_exports as Press, roving_tabindex_d_exports as RovingTabindex, selection_d_exports as Selection, targets_d_exports as Targets, tree_navigation_d_exports as TreeNavigation, typeahead_d_exports as Typeahead };
|
|
1019
1159
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/interaction/dismiss-layer.ts","../../src/interaction/editable-text.ts","../../src/interaction/focus-scope.ts","../../src/interaction/focus-visible.ts","../../src/interaction/roving-tabindex.ts","../../src/interaction/grid-navigation.ts","../../src/interaction/layers.ts","../../src/interaction/live-announce.ts","../../src/interaction/list-navigation.ts","../../src/interaction/long-press.ts","../../src/interaction/move.ts","../../src/interaction/press.ts","../../src/interaction/selection.ts","../../src/interaction/targets.ts","../../src/interaction/pointer-drag.ts","../../src/interaction/tree-navigation.ts","../../src/interaction/typeahead.ts"],"mappings":";;;;;;;;;;cAmBa;cACA;;cAKA,SAAK,OAAA;;;;;;;KAON,iBAAe,QAAM;cAEpB,SAAK,OAAA;;;;;;;;;;KAIN,iBAAe,QAAM;cAEpB,qCAAO;;;;;;;;;;;;;;;;;;;;;;KAKR,mBAAiB,UAAQ;cAExB,SAAO,OAAA;;;KACR,iBAAiB,QAAQ;;cAGxB,YACX,QAAQ,cAAc,UACtB,QAAQ,0BACP;cAsBU,UAAM,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;cAqCN,eAAgB,MAAM,cAAc,iBAAe;UA6C/C,mBAAgB,OAAO;;WAE7B,aAAa;;WAEb,gBAAgB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;;cAwCN,MACV,sBAAsB,UAAU,gBAAgB,UAAQ,YACxD,eAAe,cAAc,aAAY,eAAwB;cAKvD;;;;;;cAOA,OAAQ,eAAe,OAAO,SAAO,GAAG,YAAY,mBAAiB;;;;cCjGrE,SAAK,OAAA;;;;;KAKN,iBAAe,QAAM;cAEpB,qCAAO;;;;;;;;;;;;;;;KAQR,mBAAiB,UAAQ;cAExB,QAAI,OAAA;;;;;;;;;KAYL,gBAAc,OAAK;cAElB,UAAM,OAAA;;;;;;;;;;;;;;;;;;;;;;;UA6BF,kBAAgB,OAAO;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/interaction/dismiss-layer.ts","../../src/interaction/editable-text.ts","../../src/interaction/focus-scope.ts","../../src/interaction/focus-visible.ts","../../src/interaction/roving-tabindex.ts","../../src/interaction/grid-navigation.ts","../../src/interaction/layers.ts","../../src/interaction/live-announce.ts","../../src/interaction/list-navigation.ts","../../src/interaction/long-press.ts","../../src/interaction/move.ts","../../src/interaction/overlay.ts","../../src/interaction/press.ts","../../src/interaction/selection.ts","../../src/interaction/targets.ts","../../src/interaction/pointer-drag.ts","../../src/interaction/placing.ts","../../src/interaction/tree-navigation.ts","../../src/interaction/typeahead.ts"],"mappings":";;;;;;;;;;cAmBa;cACA;;cAKA,SAAK,OAAA;;;;;;;KAON,iBAAe,QAAM;cAEpB,SAAK,OAAA;;;;;;;;;;KAIN,iBAAe,QAAM;cAEpB,qCAAO;;;;;;;;;;;;;;;;;;;;;;KAKR,mBAAiB,UAAQ;cAExB,SAAO,OAAA;;;KACR,iBAAiB,QAAQ;;cAGxB,YACX,QAAQ,cAAc,UACtB,QAAQ,0BACP;cAsBU,UAAM,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;cAqCN,eAAgB,MAAM,cAAc,iBAAe;UA6C/C,mBAAgB,OAAO;;WAE7B,aAAa;;WAEb,gBAAgB;WAChB,KAAK,OAAO;;WAEZ;;WAEA;;;;;;;;cASE,cACV,sBAAsB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eW,cAAe,aAAa,WAAW;UAGnC,gBAAgB,OAAO;;WAE7B,YAAY;WACZ,QAAQ,OAAO,UAAU,UAAU,WAAW;;WAE9C,OAAO,OAAO,OAAO;;;WAGrB,UAAU,OAAO;;;;;;;;;cAUf,WACV,sBAAsB,UAAU,gBAAgB,QAAQ,YACxD,OAAO,OAAO,WACd,0BAA0B,KAAK,QAAQ,UAAS,eAC/C,SAAS,gBAAgB,OAAO,WAC/B,SAAS,cAAc,OAAO,OAAO"}
|
|
@@ -867,11 +867,38 @@ const behavior$7 = (declared, args) => (slots) => (options) => {
|
|
|
867
867
|
direction: options.direction?.(input) ?? "ltr",
|
|
868
868
|
page: args.page
|
|
869
869
|
};
|
|
870
|
-
const
|
|
870
|
+
const typeahead = options.typeahead !== false;
|
|
871
|
+
const decide = (key, modifiers) => {
|
|
872
|
+
const current = state.current;
|
|
873
|
+
if (key === "Enter" && options.commit !== void 0 && !modifiers.shiftKey && !modifiers.ctrlKey && !modifiers.altKey && !modifiers.metaKey && current !== null) {
|
|
874
|
+
const currentIndex = items.indexOf(current);
|
|
875
|
+
if (currentIndex !== -1 && !items.isDisabled(currentIndex)) return Option.some({
|
|
876
|
+
_tag: "Commit",
|
|
877
|
+
id: current,
|
|
878
|
+
message: options.commit(input, current)
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
const result = keyOutcome(items, items.ids.map((_, index) => options.text(input, index)), state, key, modifiers, moveOptions);
|
|
882
|
+
if (!typeahead && result !== void 0 && result._tag === "Type") return Option.none();
|
|
883
|
+
if (result === void 0) return Option.none();
|
|
884
|
+
return Option.some({
|
|
885
|
+
_tag: "Key",
|
|
886
|
+
outcome: result
|
|
887
|
+
});
|
|
888
|
+
};
|
|
889
|
+
const messageOf = (decision) => {
|
|
890
|
+
if (decision._tag === "Commit") return decision.message;
|
|
891
|
+
return outcomeMessage(decision.outcome);
|
|
892
|
+
};
|
|
871
893
|
const stop = tabStop$1(items, state.current);
|
|
872
894
|
const stopId = stop === -1 ? void 0 : items.ids[stop];
|
|
873
|
-
if (args.virtual) return [h.OnKeyDownPreventDefault((key, modifiers) => Option.map(
|
|
874
|
-
return [h.OnKeyDownFocus((key, modifiers) => Option.map(
|
|
895
|
+
if (args.virtual) return [h.OnKeyDownPreventDefault((key, modifiers) => Option.map(decide(key, modifiers), messageOf)), ...stopId === void 0 ? [] : [h.AriaActiveDescendant(stopId)]];
|
|
896
|
+
return [h.OnKeyDownFocus((key, modifiers) => Option.map(decide(key, modifiers), (decision) => {
|
|
897
|
+
if (decision._tag === "Commit") return {
|
|
898
|
+
focusSelector: idSelector(decision.id),
|
|
899
|
+
message: decision.message
|
|
900
|
+
};
|
|
901
|
+
const result = decision.outcome;
|
|
875
902
|
const target = result._tag === "Navigate" ? result.id : result.match ?? state.current;
|
|
876
903
|
return {
|
|
877
904
|
focusSelector: target === null ? ":not(*)" : idSelector(target),
|
|
@@ -1252,6 +1279,62 @@ const behavior$4 = (slots) => (options) => Behavior.forSlots(slots)({ [options.h
|
|
|
1252
1279
|
mount: () => Mount.mapMessage(Move(), options.toMessage)
|
|
1253
1280
|
}) }, { name: "Move" });
|
|
1254
1281
|
//#endregion
|
|
1282
|
+
//#region src/interaction/overlay.ts
|
|
1283
|
+
var overlay_exports = /* @__PURE__ */ __exportAll({
|
|
1284
|
+
behaviors: () => behaviors,
|
|
1285
|
+
modal: () => modal,
|
|
1286
|
+
nonModal: () => nonModal
|
|
1287
|
+
});
|
|
1288
|
+
/** A modal overlay: dismissed by Escape and outside press, focused, locked, inert. */
|
|
1289
|
+
const modal = {
|
|
1290
|
+
dismiss: {
|
|
1291
|
+
outside: true,
|
|
1292
|
+
escape: true
|
|
1293
|
+
},
|
|
1294
|
+
focus: {
|
|
1295
|
+
contain: true,
|
|
1296
|
+
restore: true
|
|
1297
|
+
},
|
|
1298
|
+
scroll: { lock: true },
|
|
1299
|
+
inert: true
|
|
1300
|
+
};
|
|
1301
|
+
/** A modeless overlay: dismissed by Escape and outside press, focus restored, page usable. */
|
|
1302
|
+
const nonModal = {
|
|
1303
|
+
dismiss: {
|
|
1304
|
+
outside: true,
|
|
1305
|
+
escape: true
|
|
1306
|
+
},
|
|
1307
|
+
focus: {
|
|
1308
|
+
contain: false,
|
|
1309
|
+
restore: true
|
|
1310
|
+
},
|
|
1311
|
+
scroll: { lock: false },
|
|
1312
|
+
inert: false
|
|
1313
|
+
};
|
|
1314
|
+
/**
|
|
1315
|
+
* The policy as behaviors, to spread into the view's pipe alongside the
|
|
1316
|
+
* widget's own. Conditional pieces are included or left out when the list
|
|
1317
|
+
* is built — a static policy per composition — so no slot carries a mount
|
|
1318
|
+
* its policy never uses.
|
|
1319
|
+
*/
|
|
1320
|
+
const behaviors = (slots) => (options) => [
|
|
1321
|
+
behavior$14(options.stack)(slots)({
|
|
1322
|
+
layer: options.layer,
|
|
1323
|
+
...options.trigger === void 0 ? {} : { trigger: options.trigger },
|
|
1324
|
+
id: options.id,
|
|
1325
|
+
outsidePress: options.policy.dismiss.outside,
|
|
1326
|
+
escape: options.policy.dismiss.escape
|
|
1327
|
+
}),
|
|
1328
|
+
behavior$12(slots)({
|
|
1329
|
+
container: options.layer,
|
|
1330
|
+
contain: options.policy.focus.contain,
|
|
1331
|
+
restore: options.policy.focus.restore,
|
|
1332
|
+
...options.policy.focus.initialFocus === void 0 ? {} : { initialFocus: options.policy.focus.initialFocus }
|
|
1333
|
+
}),
|
|
1334
|
+
...options.policy.scroll.lock ? [scrollLock(slots)({ container: options.layer })] : [],
|
|
1335
|
+
...options.policy.inert ? [hideOutside(slots)({ container: options.layer })] : []
|
|
1336
|
+
];
|
|
1337
|
+
//#endregion
|
|
1255
1338
|
//#region src/interaction/selection.ts
|
|
1256
1339
|
/**
|
|
1257
1340
|
* Selection over a set of items: which ids are selected, and the anchor a
|
|
@@ -1434,6 +1517,254 @@ const behavior$1 = (slots) => (options) => Behavior.forSlots(slots)({ [options.c
|
|
|
1434
1517
|
}), options.toMessage)
|
|
1435
1518
|
}) }, { name: "PointerDrag" });
|
|
1436
1519
|
//#endregion
|
|
1520
|
+
//#region src/interaction/placing.ts
|
|
1521
|
+
/**
|
|
1522
|
+
* Keeps a floating panel inside the viewport: on insert it shifts left past
|
|
1523
|
+
* the right edge and flips above its trigger when the bottom overflows and
|
|
1524
|
+
* the room overhead fits; on release every inline prop goes. `placeFor` is
|
|
1525
|
+
* pure geometry over rects, so the rule is unit-tested and the Mount only
|
|
1526
|
+
* reads and writes. Inert without layout (zero rects never overflow), with
|
|
1527
|
+
* no timers, observers, or reposition loops.
|
|
1528
|
+
*
|
|
1529
|
+
* `placeAt` is the other half, for a popup that must open under the trigger
|
|
1530
|
+
* that opened it. It writes `left` and `--fk-placed-top` once, relative to
|
|
1531
|
+
* the popup's offset parent; the panel's stylesheet reads the variable as
|
|
1532
|
+
* `top`, so `keepWithin` can still replace `top` when it flips. Key the
|
|
1533
|
+
* popup by the trigger: a Mount reads its args at insert and never again.
|
|
1534
|
+
* `placeAtPoint` is the same write for a viewport point, when the open
|
|
1535
|
+
* event carried coordinates the message builder dropped. The two mounts
|
|
1536
|
+
* start together, so the fit may run before that write; the write measures
|
|
1537
|
+
* again. A point that would hang past the bottom shifts up. A trigger still
|
|
1538
|
+
* flips, and the panel is marked `data-fk-placed="above"` so a hover bridge
|
|
1539
|
+
* can follow the side that opened.
|
|
1540
|
+
* Zero-size rects stay at the origin, so an inert document writes nothing
|
|
1541
|
+
* a layout pass would have to undo.
|
|
1542
|
+
*
|
|
1543
|
+
* Three related pieces this is not:
|
|
1544
|
+
*
|
|
1545
|
+
* - `Anchor.behavior` (`foldkit-mixins-ui`) binds a floating element to
|
|
1546
|
+
* another element's id through floating-ui, with portals and continuous
|
|
1547
|
+
* repositioning. It relocates nodes out from under the runtime (portal by
|
|
1548
|
+
* default) and burns under zero geometry; reach for it when the panel must
|
|
1549
|
+
* track a moving anchor, not for a popup placed once.
|
|
1550
|
+
* - `KeepInView` (`foldkit-primitives/dom`) scrolls newly marked content
|
|
1551
|
+
* into view. Same verb, opposite direction: that one moves the page to
|
|
1552
|
+
* the panel, this one moves the panel into the page.
|
|
1553
|
+
* - `Overlay.behaviors` owns dismissal, focus, scroll lock, and inertness,
|
|
1554
|
+
* but no positioning; spread this alongside it for the full overlay.
|
|
1555
|
+
*/
|
|
1556
|
+
var placing_exports = /* @__PURE__ */ __exportAll({
|
|
1557
|
+
KeepWithin: () => KeepWithin,
|
|
1558
|
+
PlaceAt: () => PlaceAt,
|
|
1559
|
+
PlaceAtPoint: () => PlaceAtPoint,
|
|
1560
|
+
keepWithin: () => keepWithin,
|
|
1561
|
+
placeAt: () => placeAt,
|
|
1562
|
+
placeAtPoint: () => placeAtPoint,
|
|
1563
|
+
placeAtTrigger: () => placeAtTrigger,
|
|
1564
|
+
placeFor: () => placeFor,
|
|
1565
|
+
placedAbove: () => placedAbove,
|
|
1566
|
+
placedSide: () => placedSide,
|
|
1567
|
+
placedTop: () => placedTop,
|
|
1568
|
+
shiftIntoViewport: () => shiftIntoViewport
|
|
1569
|
+
});
|
|
1570
|
+
/** Where the panel goes so it fits: left by the overflow, above when the
|
|
1571
|
+
* bottom clears the window and the room overhead fits the panel. */
|
|
1572
|
+
const placeFor = (rect, viewport, margin = 8) => {
|
|
1573
|
+
const over = rect.right - viewport.width + margin;
|
|
1574
|
+
return {
|
|
1575
|
+
dx: over > 0 ? -over : 0,
|
|
1576
|
+
flip: rect.bottom > viewport.height && rect.top - margin >= rect.height
|
|
1577
|
+
};
|
|
1578
|
+
};
|
|
1579
|
+
/** Pixels to move a box up so its bottom sits `margin` inside the viewport.
|
|
1580
|
+
* `0` when it already fits, or when its top is already at the margin. */
|
|
1581
|
+
const shiftIntoViewport = (rect, viewportHeight, margin = 8) => {
|
|
1582
|
+
const overflow = rect.bottom - (viewportHeight - margin);
|
|
1583
|
+
if (overflow <= 0) return 0;
|
|
1584
|
+
const room = rect.top - margin;
|
|
1585
|
+
if (room <= 0) return 0;
|
|
1586
|
+
return Math.min(overflow, room);
|
|
1587
|
+
};
|
|
1588
|
+
/** Attribute `keepWithin` sets to `placedAbove` when the panel flips. */
|
|
1589
|
+
const placedSide = "data-fk-placed";
|
|
1590
|
+
/** Value of `placedSide` while the panel stands above its anchor. */
|
|
1591
|
+
const placedAbove = "above";
|
|
1592
|
+
/** Custom property `PlaceAt` writes. A panel reads it as `top` so a viewport
|
|
1593
|
+
* flip, which sets the `top` property, still wins. */
|
|
1594
|
+
const placedTop = "--fk-placed-top";
|
|
1595
|
+
/** Where a popup sits under its trigger's left edge, in the offset parent's
|
|
1596
|
+
* coordinates. A zero-size trigger (an inert document) stays at the origin. */
|
|
1597
|
+
const placeAt = (trigger, origin, gap = 4) => {
|
|
1598
|
+
if (trigger.width === 0 && trigger.height === 0) return {
|
|
1599
|
+
left: 0,
|
|
1600
|
+
top: 0
|
|
1601
|
+
};
|
|
1602
|
+
return {
|
|
1603
|
+
left: trigger.left - origin.left,
|
|
1604
|
+
top: trigger.bottom - origin.top + gap
|
|
1605
|
+
};
|
|
1606
|
+
};
|
|
1607
|
+
/** Where a popup's top-left sits on a viewport point, in the offset parent's
|
|
1608
|
+
* coordinates. A context menu uses it: the right-click event carries the
|
|
1609
|
+
* point, and `OnContextMenu` does not. */
|
|
1610
|
+
const placeAtPoint = (point, origin) => ({
|
|
1611
|
+
left: point.x - origin.left,
|
|
1612
|
+
top: point.y - origin.top
|
|
1613
|
+
});
|
|
1614
|
+
const clearFit = (element) => {
|
|
1615
|
+
element.style.translate = "";
|
|
1616
|
+
element.style.top = "";
|
|
1617
|
+
element.style.bottom = "";
|
|
1618
|
+
element.removeAttribute(placedSide);
|
|
1619
|
+
};
|
|
1620
|
+
const fitWithin = (element) => {
|
|
1621
|
+
clearFit(element);
|
|
1622
|
+
const rect = element.getBoundingClientRect();
|
|
1623
|
+
const placed = placeFor({
|
|
1624
|
+
top: rect.top,
|
|
1625
|
+
right: rect.right,
|
|
1626
|
+
bottom: rect.bottom,
|
|
1627
|
+
height: rect.height
|
|
1628
|
+
}, {
|
|
1629
|
+
width: document.documentElement.clientWidth,
|
|
1630
|
+
height: window.innerHeight
|
|
1631
|
+
});
|
|
1632
|
+
if (placed.dx !== 0) element.style.translate = `${placed.dx}px 0`;
|
|
1633
|
+
if (placed.flip) {
|
|
1634
|
+
element.style.top = "auto";
|
|
1635
|
+
element.style.bottom = "calc(100% + 4px)";
|
|
1636
|
+
element.setAttribute(placedSide, placedAbove);
|
|
1637
|
+
}
|
|
1638
|
+
};
|
|
1639
|
+
const refits = /* @__PURE__ */ new WeakMap();
|
|
1640
|
+
const onPlaced = (element, refit) => {
|
|
1641
|
+
const waiting = refits.get(element) ?? /* @__PURE__ */ new Set();
|
|
1642
|
+
waiting.add(refit);
|
|
1643
|
+
refits.set(element, waiting);
|
|
1644
|
+
};
|
|
1645
|
+
const offPlaced = (element, refit) => {
|
|
1646
|
+
const waiting = refits.get(element);
|
|
1647
|
+
if (waiting === void 0) return;
|
|
1648
|
+
waiting.delete(refit);
|
|
1649
|
+
if (waiting.size === 0) refits.delete(element);
|
|
1650
|
+
};
|
|
1651
|
+
const notifyPlaced = (element) => {
|
|
1652
|
+
const waiting = refits.get(element);
|
|
1653
|
+
if (waiting === void 0) return;
|
|
1654
|
+
for (const refit of waiting) refit();
|
|
1655
|
+
};
|
|
1656
|
+
const applyPlaced = (element, placed) => {
|
|
1657
|
+
element.style.left = `${placed.left}px`;
|
|
1658
|
+
element.style.setProperty(placedTop, `${placed.top}px`);
|
|
1659
|
+
};
|
|
1660
|
+
const clearPlaced = (element) => {
|
|
1661
|
+
element.style.left = "";
|
|
1662
|
+
element.style.removeProperty(placedTop);
|
|
1663
|
+
};
|
|
1664
|
+
const writePlaced = (element, placed, shift) => {
|
|
1665
|
+
clearFit(element);
|
|
1666
|
+
applyPlaced(element, placed);
|
|
1667
|
+
if (shift) {
|
|
1668
|
+
const rect = element.getBoundingClientRect();
|
|
1669
|
+
const dy = shiftIntoViewport({
|
|
1670
|
+
top: rect.top,
|
|
1671
|
+
bottom: rect.bottom
|
|
1672
|
+
}, window.innerHeight);
|
|
1673
|
+
if (dy !== 0) element.style.setProperty(placedTop, `${placed.top - dy}px`);
|
|
1674
|
+
}
|
|
1675
|
+
notifyPlaced(element);
|
|
1676
|
+
};
|
|
1677
|
+
const KeepWithin = Mount.defineStream("KeepWithin", {
|
|
1678
|
+
messages: [Schema.Never],
|
|
1679
|
+
execute: ({ element }) => Stream.callback(() => {
|
|
1680
|
+
if (!(element instanceof HTMLElement)) return Effect.acquireRelease(Effect.void, () => Effect.void);
|
|
1681
|
+
const node = element;
|
|
1682
|
+
const refit = () => fitWithin(node);
|
|
1683
|
+
return Effect.acquireRelease(Effect.sync(() => {
|
|
1684
|
+
onPlaced(node, refit);
|
|
1685
|
+
refit();
|
|
1686
|
+
}), () => Effect.sync(() => {
|
|
1687
|
+
offPlaced(node, refit);
|
|
1688
|
+
clearFit(node);
|
|
1689
|
+
}));
|
|
1690
|
+
})
|
|
1691
|
+
});
|
|
1692
|
+
const paddingEdge = (node) => {
|
|
1693
|
+
const rect = node.getBoundingClientRect();
|
|
1694
|
+
return {
|
|
1695
|
+
left: rect.left + node.clientLeft,
|
|
1696
|
+
top: rect.top + node.clientTop
|
|
1697
|
+
};
|
|
1698
|
+
};
|
|
1699
|
+
const originOf = (element) => {
|
|
1700
|
+
const originNode = element.offsetParent;
|
|
1701
|
+
return originNode instanceof HTMLElement ? paddingEdge(originNode) : {
|
|
1702
|
+
left: 0,
|
|
1703
|
+
top: 0
|
|
1704
|
+
};
|
|
1705
|
+
};
|
|
1706
|
+
const PlaceAt = Mount.defineStream("PlaceAt", {
|
|
1707
|
+
messages: [Schema.Never],
|
|
1708
|
+
args: {
|
|
1709
|
+
/** Element id of the trigger the popup opens under. */
|
|
1710
|
+
triggerId: Schema.String,
|
|
1711
|
+
/** Pixels between the trigger's bottom and the popup. */
|
|
1712
|
+
gap: Schema.Number
|
|
1713
|
+
},
|
|
1714
|
+
execute: ({ element, triggerId, gap }) => Stream.callback(() => Effect.acquireRelease(Effect.sync(() => {
|
|
1715
|
+
if (!(element instanceof HTMLElement)) return;
|
|
1716
|
+
const trigger = document.getElementById(triggerId);
|
|
1717
|
+
if (!(trigger instanceof HTMLElement)) return;
|
|
1718
|
+
const rect = trigger.getBoundingClientRect();
|
|
1719
|
+
writePlaced(element, placeAt({
|
|
1720
|
+
left: rect.left,
|
|
1721
|
+
top: rect.top,
|
|
1722
|
+
bottom: rect.bottom,
|
|
1723
|
+
width: rect.width,
|
|
1724
|
+
height: rect.height
|
|
1725
|
+
}, originOf(element), gap), false);
|
|
1726
|
+
}), () => Effect.sync(() => {
|
|
1727
|
+
if (!(element instanceof HTMLElement)) return;
|
|
1728
|
+
clearPlaced(element);
|
|
1729
|
+
})))
|
|
1730
|
+
});
|
|
1731
|
+
const PlaceAtPoint = Mount.defineStream("PlaceAtPoint", {
|
|
1732
|
+
messages: [Schema.Never],
|
|
1733
|
+
args: {
|
|
1734
|
+
/** Viewport x of the popup's top-left. */
|
|
1735
|
+
x: Schema.Number,
|
|
1736
|
+
/** Viewport y of the popup's top-left. */
|
|
1737
|
+
y: Schema.Number
|
|
1738
|
+
},
|
|
1739
|
+
execute: ({ element, x, y }) => Stream.callback(() => Effect.acquireRelease(Effect.sync(() => {
|
|
1740
|
+
if (!(element instanceof HTMLElement)) return;
|
|
1741
|
+
writePlaced(element, placeAtPoint({
|
|
1742
|
+
x,
|
|
1743
|
+
y
|
|
1744
|
+
}, originOf(element)), true);
|
|
1745
|
+
}), () => Effect.sync(() => {
|
|
1746
|
+
if (!(element instanceof HTMLElement)) return;
|
|
1747
|
+
clearPlaced(element);
|
|
1748
|
+
})))
|
|
1749
|
+
});
|
|
1750
|
+
const placeAtTrigger = (slots) => (options) => Behavior.forSlots(slots)({ [options.panel]: Behavior.slot({
|
|
1751
|
+
requires: { capability: Capability.Container },
|
|
1752
|
+
mount: (input) => {
|
|
1753
|
+
const at = options.at?.(input) ?? Option.none();
|
|
1754
|
+
return Option.isSome(at) ? PlaceAtPoint({
|
|
1755
|
+
x: at.value.x,
|
|
1756
|
+
y: at.value.y
|
|
1757
|
+
}) : PlaceAt({
|
|
1758
|
+
triggerId: options.triggerId(input),
|
|
1759
|
+
gap: options.gap ?? 4
|
|
1760
|
+
});
|
|
1761
|
+
}
|
|
1762
|
+
}) }, { name: "PlaceAt" });
|
|
1763
|
+
const keepWithin = (slots) => (options) => Behavior.forSlots(slots)({ [options.panel]: Behavior.slot({
|
|
1764
|
+
requires: { capability: Capability.Container },
|
|
1765
|
+
mount: () => KeepWithin()
|
|
1766
|
+
}) }, { name: "KeepWithin" });
|
|
1767
|
+
//#endregion
|
|
1437
1768
|
//#region src/interaction/tree-navigation.ts
|
|
1438
1769
|
/**
|
|
1439
1770
|
* Keyboard navigation of a tree (a file explorer, a page's layers, a nested
|
|
@@ -1643,6 +1974,6 @@ const behavior = (declared, args) => (slots) => (options) => {
|
|
|
1643
1974
|
}, { name: "TreeNavigation" });
|
|
1644
1975
|
};
|
|
1645
1976
|
//#endregion
|
|
1646
|
-
export { dismiss_layer_exports as DismissLayer, editable_text_exports as EditableText, focus_scope_exports as FocusScope, focus_visible_exports as FocusVisible, grid_navigation_exports as GridNavigation, layers_exports as Layers, list_navigation_exports as ListNavigation, live_announce_exports as LiveAnnounce, long_press_exports as LongPress, move_exports as Move, pointer_drag_exports as PointerDrag, press_exports as Press, roving_tabindex_exports as RovingTabindex, selection_exports as Selection, targets_exports as Targets, tree_navigation_exports as TreeNavigation, typeahead_exports as Typeahead };
|
|
1977
|
+
export { dismiss_layer_exports as DismissLayer, editable_text_exports as EditableText, focus_scope_exports as FocusScope, focus_visible_exports as FocusVisible, grid_navigation_exports as GridNavigation, layers_exports as Layers, list_navigation_exports as ListNavigation, live_announce_exports as LiveAnnounce, long_press_exports as LongPress, move_exports as Move, overlay_exports as Overlay, placing_exports as Placing, pointer_drag_exports as PointerDrag, press_exports as Press, roving_tabindex_exports as RovingTabindex, selection_exports as Selection, targets_exports as Targets, tree_navigation_exports as TreeNavigation, typeahead_exports as Typeahead };
|
|
1647
1978
|
|
|
1648
1979
|
//# sourceMappingURL=index.mjs.map
|