@threadlabs/looma 0.1.16 → 0.1.17
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/{chunk-SVINNT3E.js → chunk-OY4D3W4U.js} +29 -29
- package/dist/{chunk-G53JEAQK.js → chunk-SZJQ3NPX.js} +6 -3
- package/dist/chunk-YHXJC5M5.js +341 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/looma.cjs.js +1 -1
- package/dist/cjs/{manager-BOpVXb92.js → manager-C9j3HZay.js} +5 -2
- package/dist/cjs/positioning-i0WrCAdF.js +384 -0
- package/dist/cjs/ui-affordance-scope.cjs.entry.js +3 -113
- package/dist/cjs/ui-context-menu.cjs.entry.js +40 -5
- package/dist/cjs/ui-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ui-menu.cjs.entry.js +83 -2
- package/dist/cjs/ui-popover.cjs.entry.js +43 -3
- package/dist/cjs/ui-toast-region.cjs.entry.js +17 -2
- package/dist/cjs/ui-tooltip.cjs.entry.js +95 -27
- package/dist/cjs/ui-tree-item.cjs.entry.js +1 -1
- package/dist/collection/components/ui-context-menu/ui-context-menu.css +17 -4
- package/dist/collection/components/ui-context-menu/ui-context-menu.js +38 -3
- package/dist/collection/components/ui-menu/ui-menu.css +39 -0
- package/dist/collection/components/ui-menu/ui-menu.js +128 -1
- package/dist/collection/components/ui-popover/ui-popover.css +31 -0
- package/dist/collection/components/ui-popover/ui-popover.js +87 -1
- package/dist/collection/components/ui-toast-region/ui-toast-region.css +6 -0
- package/dist/collection/components/ui-toast-region/ui-toast-region.js +16 -1
- package/dist/collection/components/ui-tooltip/ui-tooltip.css +20 -0
- package/dist/collection/components/ui-tooltip/ui-tooltip.js +160 -25
- package/dist/collection/components/ui-tree-item/ui-tree-item.css +10 -6
- package/dist/collection/input-modality.js +24 -0
- package/dist/collection/overlay/manager.js +5 -2
- package/dist/collection/overlay/positioning.js +246 -0
- package/dist/components/p-CEYIKqYc.js +1 -0
- package/dist/components/p-DOulVJT7.js +1 -0
- package/dist/components/p-PM9a74r7.js +1 -0
- package/dist/components/ui-affordance-scope.js +1 -1
- package/dist/components/ui-context-menu.js +1 -1
- package/dist/components/ui-dialog.js +1 -1
- package/dist/components/ui-menu.js +1 -1
- package/dist/components/ui-popover.js +1 -1
- package/dist/components/ui-toast-region.js +1 -1
- package/dist/components/ui-tooltip.js +1 -1
- package/dist/components/ui-tree-item.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/looma.js +1 -1
- package/dist/esm/{manager-CR7f2MQC.js → manager-PM9a74r7.js} +5 -2
- package/dist/esm/positioning-Bu0dmLBE.js +379 -0
- package/dist/esm/ui-affordance-scope.entry.js +1 -111
- package/dist/esm/ui-context-menu.entry.js +40 -5
- package/dist/esm/ui-dialog.entry.js +1 -1
- package/dist/esm/ui-menu.entry.js +83 -2
- package/dist/esm/ui-popover.entry.js +43 -3
- package/dist/esm/ui-toast-region.entry.js +17 -2
- package/dist/esm/ui-tooltip.entry.js +95 -27
- package/dist/esm/ui-tree-item.entry.js +1 -1
- package/dist/index.cjs +776 -59
- package/dist/index.d.cts +44 -1
- package/dist/index.d.ts +44 -1
- package/dist/index.js +235 -4
- package/dist/looma/looma.esm.js +1 -1
- package/dist/looma/{p-c6721aba.entry.js → p-11083743.entry.js} +1 -1
- package/dist/looma/p-1674cda4.entry.js +1 -0
- package/dist/looma/p-2e6f791e.entry.js +1 -0
- package/dist/looma/p-54c41576.entry.js +1 -0
- package/dist/looma/p-9194a99d.entry.js +1 -0
- package/dist/looma/p-Bu0dmLBE.js +1 -0
- package/dist/looma/p-PM9a74r7.js +1 -0
- package/dist/looma/p-ba01f45d.entry.js +1 -0
- package/dist/looma/p-caa8fc7b.entry.js +1 -0
- package/dist/looma/{p-ef9ca2ed.entry.js → p-d01960c2.entry.js} +2 -2
- package/dist/types/components/ui-context-menu/ui-context-menu.d.ts +3 -0
- package/dist/types/components/ui-menu/ui-menu.d.ts +13 -0
- package/dist/types/components/ui-popover/ui-popover.d.ts +9 -0
- package/dist/types/components/ui-toast-region/ui-toast-region.d.ts +2 -0
- package/dist/types/components/ui-tooltip/ui-tooltip.d.ts +16 -1
- package/dist/types/components.d.ts +71 -0
- package/dist/types/input-modality.d.ts +6 -0
- package/dist/types/overlay/manager.d.ts +3 -0
- package/dist/types/overlay/positioning.d.ts +33 -0
- package/dist/ui-affordance-scope.entry-X7DTKJGL.js +54 -0
- package/dist/{ui-avatar-group.entry-DQDP325O.js → ui-avatar-group.entry-MC34FKAN.js} +1 -1
- package/dist/{ui-avatar.entry-WYIDMOFE.js → ui-avatar.entry-OKRQWTQV.js} +1 -1
- package/dist/{ui-badge.entry-VGHXPEDT.js → ui-badge.entry-RI7JB7KV.js} +1 -1
- package/dist/{ui-button.entry-LKPLOJ22.js → ui-button.entry-PFO5TTPN.js} +1 -1
- package/dist/{ui-checkbox.entry-J74HEA22.js → ui-checkbox.entry-UHFWVISP.js} +1 -1
- package/dist/{ui-context-menu.entry-MQM2FCLI.js → ui-context-menu.entry-AIXB6U5D.js} +40 -6
- package/dist/{ui-dialog.entry-DQMMDO4Z.js → ui-dialog.entry-LPREQH2T.js} +2 -2
- package/dist/{ui-disclosure.entry-ONF7UZDC.js → ui-disclosure.entry-7XCUIYVZ.js} +1 -1
- package/dist/{ui-floating-action-button.entry-FKTGVC5T.js → ui-floating-action-button.entry-5PNIMUAW.js} +1 -1
- package/dist/{ui-form-field.entry-M3ISWQNU.js → ui-form-field.entry-77YW46SM.js} +1 -1
- package/dist/{ui-icon-button.entry-AWFIQUHM.js → ui-icon-button.entry-4AD6ALPQ.js} +1 -1
- package/dist/{ui-input.entry-JZ6RETMT.js → ui-input.entry-E7E6QDTV.js} +1 -1
- package/dist/{ui-menu-item.entry-5MFR5LFL.js → ui-menu-item.entry-H3HFLUB6.js} +1 -1
- package/dist/ui-menu.entry-UAKZU4HG.js +184 -0
- package/dist/{ui-popover.entry-ELCMKO6Y.js → ui-popover.entry-GVQKX26B.js} +46 -4
- package/dist/{ui-radio-group.entry-RJHUPPEM.js → ui-radio-group.entry-MNSR6UEE.js} +1 -1
- package/dist/{ui-radio.entry-3VRDPOY4.js → ui-radio.entry-6D4WTI5E.js} +1 -1
- package/dist/{ui-search-result-row.entry-J34YPAV7.js → ui-search-result-row.entry-J2TILUH2.js} +1 -1
- package/dist/{ui-search-shell.entry-IJ4UUP27.js → ui-search-shell.entry-FSWHEZQF.js} +1 -1
- package/dist/{ui-select.entry-C6YD3HQ5.js → ui-select.entry-JRCYYNNW.js} +1 -1
- package/dist/{ui-switch.entry-UZDF5QTI.js → ui-switch.entry-YZWMNRP2.js} +1 -1
- package/dist/{ui-tabs.entry-YRAKWOMR.js → ui-tabs.entry-F2Y344JY.js} +1 -1
- package/dist/{ui-textarea.entry-JLDKFT3K.js → ui-textarea.entry-3EZCUUAK.js} +1 -1
- package/dist/{ui-toast-region.entry-GC7C7KXF.js → ui-toast-region.entry-BTV4AW3I.js} +20 -3
- package/dist/ui-tooltip.entry-U644CF5U.js +214 -0
- package/dist/{ui-top-bar.entry-5W5UA5KV.js → ui-top-bar.entry-FGGOREQR.js} +1 -1
- package/dist/{ui-tree-item.entry-3LM7IXIK.js → ui-tree-item.entry-XVMHEONY.js} +2 -2
- package/dist/{ui-tree.entry-X4FU42A6.js → ui-tree.entry-4R7DYGAM.js} +1 -1
- package/editor.css +3 -4
- package/package.json +1 -1
- package/tokens.css +14 -2
- package/vue/editor/index.js +62 -51
- package/dist/components/p-CR7f2MQC.js +0 -1
- package/dist/components/p-QiwSQmKJ.js +0 -1
- package/dist/looma/p-2ae73d5b.entry.js +0 -1
- package/dist/looma/p-3ac2e0d4.entry.js +0 -1
- package/dist/looma/p-65c25c94.entry.js +0 -1
- package/dist/looma/p-8c09c724.entry.js +0 -1
- package/dist/looma/p-95cd639d.entry.js +0 -1
- package/dist/looma/p-96f73d07.entry.js +0 -1
- package/dist/looma/p-CR7f2MQC.js +0 -1
- package/dist/ui-affordance-scope.entry-PFP2TDKO.js +0 -145
- package/dist/ui-menu.entry-IOEIDATQ.js +0 -98
- package/dist/ui-tooltip.entry-F26XDTYX.js +0 -145
package/dist/index.d.cts
CHANGED
|
@@ -6,6 +6,9 @@ interface OverlayRecord {
|
|
|
6
6
|
id: string;
|
|
7
7
|
modal: boolean;
|
|
8
8
|
element: HTMLElement;
|
|
9
|
+
/** Controls that are part of the overlay interaction boundary (for example,
|
|
10
|
+
* the button that toggles an anchored menu). */
|
|
11
|
+
relatedElements?: readonly HTMLElement[];
|
|
9
12
|
dismissible?: boolean;
|
|
10
13
|
requestClose: (reason: OverlayCloseReason, trigger: OverlayTrigger) => void;
|
|
11
14
|
}
|
|
@@ -43,7 +46,40 @@ interface ProximityCoordinator {
|
|
|
43
46
|
/** Removes the scope-level listeners and all reflected interaction state. */
|
|
44
47
|
destroy(): void;
|
|
45
48
|
}
|
|
49
|
+
type AnchoredPlacement = "bottom-start" | "bottom-end" | "top-start" | "top-end";
|
|
50
|
+
interface AnchoredSurfaceOptions {
|
|
51
|
+
anchor?: HTMLElement | null;
|
|
52
|
+
placement?: AnchoredPlacement;
|
|
53
|
+
gap?: number;
|
|
54
|
+
viewportGap?: number;
|
|
55
|
+
}
|
|
56
|
+
interface AnchoredSurface {
|
|
57
|
+
setAnchor(anchor: HTMLElement | null): void;
|
|
58
|
+
show(): void;
|
|
59
|
+
showAtPoint(point: Point): void;
|
|
60
|
+
hide(): void;
|
|
61
|
+
refresh(): void;
|
|
62
|
+
destroy(): void;
|
|
63
|
+
}
|
|
64
|
+
interface ViewportSurface {
|
|
65
|
+
show(): void;
|
|
66
|
+
hide(): void;
|
|
67
|
+
destroy(): void;
|
|
68
|
+
}
|
|
46
69
|
declare const DEFAULT_AFFORDANCE_NEAR_RADIUS = 16;
|
|
70
|
+
/**
|
|
71
|
+
* Places unanchored floating UI, such as a toast region, in the browser top
|
|
72
|
+
* layer. Its viewport position remains CSS-owned; the controller only provides
|
|
73
|
+
* the native Popover API boundary and its no-Popover fallback.
|
|
74
|
+
*/
|
|
75
|
+
declare function createViewportSurface(surface: HTMLElement): ViewportSurface;
|
|
76
|
+
/**
|
|
77
|
+
* One lightweight positioning controller for Looma floating UI. Native
|
|
78
|
+
* Popover provides the top layer and CSS Anchor Positioning follows a named
|
|
79
|
+
* element. Browsers without Anchor Positioning use the same flip/shift
|
|
80
|
+
* geometry through scroll/resize listeners that exist only while open.
|
|
81
|
+
*/
|
|
82
|
+
declare function createAnchoredSurface(surface: HTMLElement, options?: AnchoredSurfaceOptions): AnchoredSurface;
|
|
47
83
|
declare function getVisualViewportRect(owner?: Window): ViewportRect;
|
|
48
84
|
declare function clampRectToViewport(rect: RectLike, viewport?: ViewportRect, gutter?: number): Point;
|
|
49
85
|
declare function distanceFromPointToRect(point: Point, rect: RectLike): number;
|
|
@@ -57,6 +93,13 @@ declare function distanceFromPointToRect(point: Point, rect: RectLike): number;
|
|
|
57
93
|
*/
|
|
58
94
|
declare function createProximityCoordinator(scope: HTMLElement, options?: ProximityCoordinatorOptions): ProximityCoordinator;
|
|
59
95
|
|
|
96
|
+
/**
|
|
97
|
+
* Reflects real touch use instead of guessing from device capability media
|
|
98
|
+
* queries. Hybrid devices therefore keep compact pointer affordances until the
|
|
99
|
+
* user actually touches the interface.
|
|
100
|
+
*/
|
|
101
|
+
declare function initializeInputModality(owner?: Document): void;
|
|
102
|
+
|
|
60
103
|
/** The opinionated Lucide set used by Looma's shipped interaction surfaces. */
|
|
61
104
|
declare const LOOMA_ICONS: {
|
|
62
105
|
'align-center': IconNode;
|
|
@@ -121,4 +164,4 @@ declare function setElementDragImage(dataTransfer: DataTransfer | null, element:
|
|
|
121
164
|
/** A keyed, replaceable hover timer suitable for expansion and disclosure intent. */
|
|
122
165
|
declare function createHoverIntent(delay: number, onIntent: (key: string) => void): HoverIntentController;
|
|
123
166
|
|
|
124
|
-
export { DEFAULT_AFFORDANCE_NEAR_RADIUS, type DropPosition, type HoverIntentController, LOOMA_ICONS, type LoomaIconName, type LoomaIconNode, type OverlayCloseReason, type OverlayRecord, type OverlayTrigger, type Point, type ProximityCoordinator, type ProximityCoordinatorOptions, type RectLike, type ViewportRect, clampRectToViewport, classifyDropPosition, closeOverlay, createHoverIntent, createProximityCoordinator, distanceFromPointToRect, getTopOverlay, getVisualViewportRect, isTopOverlay, loomaIconMarkup, openOverlay, requestTopOverlayClose, setElementDragImage };
|
|
167
|
+
export { type AnchoredPlacement, type AnchoredSurface, type AnchoredSurfaceOptions, DEFAULT_AFFORDANCE_NEAR_RADIUS, type DropPosition, type HoverIntentController, LOOMA_ICONS, type LoomaIconName, type LoomaIconNode, type OverlayCloseReason, type OverlayRecord, type OverlayTrigger, type Point, type ProximityCoordinator, type ProximityCoordinatorOptions, type RectLike, type ViewportRect, type ViewportSurface, clampRectToViewport, classifyDropPosition, closeOverlay, createAnchoredSurface, createHoverIntent, createProximityCoordinator, createViewportSurface, distanceFromPointToRect, getTopOverlay, getVisualViewportRect, initializeInputModality, isTopOverlay, loomaIconMarkup, openOverlay, requestTopOverlayClose, setElementDragImage };
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,9 @@ interface OverlayRecord {
|
|
|
6
6
|
id: string;
|
|
7
7
|
modal: boolean;
|
|
8
8
|
element: HTMLElement;
|
|
9
|
+
/** Controls that are part of the overlay interaction boundary (for example,
|
|
10
|
+
* the button that toggles an anchored menu). */
|
|
11
|
+
relatedElements?: readonly HTMLElement[];
|
|
9
12
|
dismissible?: boolean;
|
|
10
13
|
requestClose: (reason: OverlayCloseReason, trigger: OverlayTrigger) => void;
|
|
11
14
|
}
|
|
@@ -43,7 +46,40 @@ interface ProximityCoordinator {
|
|
|
43
46
|
/** Removes the scope-level listeners and all reflected interaction state. */
|
|
44
47
|
destroy(): void;
|
|
45
48
|
}
|
|
49
|
+
type AnchoredPlacement = "bottom-start" | "bottom-end" | "top-start" | "top-end";
|
|
50
|
+
interface AnchoredSurfaceOptions {
|
|
51
|
+
anchor?: HTMLElement | null;
|
|
52
|
+
placement?: AnchoredPlacement;
|
|
53
|
+
gap?: number;
|
|
54
|
+
viewportGap?: number;
|
|
55
|
+
}
|
|
56
|
+
interface AnchoredSurface {
|
|
57
|
+
setAnchor(anchor: HTMLElement | null): void;
|
|
58
|
+
show(): void;
|
|
59
|
+
showAtPoint(point: Point): void;
|
|
60
|
+
hide(): void;
|
|
61
|
+
refresh(): void;
|
|
62
|
+
destroy(): void;
|
|
63
|
+
}
|
|
64
|
+
interface ViewportSurface {
|
|
65
|
+
show(): void;
|
|
66
|
+
hide(): void;
|
|
67
|
+
destroy(): void;
|
|
68
|
+
}
|
|
46
69
|
declare const DEFAULT_AFFORDANCE_NEAR_RADIUS = 16;
|
|
70
|
+
/**
|
|
71
|
+
* Places unanchored floating UI, such as a toast region, in the browser top
|
|
72
|
+
* layer. Its viewport position remains CSS-owned; the controller only provides
|
|
73
|
+
* the native Popover API boundary and its no-Popover fallback.
|
|
74
|
+
*/
|
|
75
|
+
declare function createViewportSurface(surface: HTMLElement): ViewportSurface;
|
|
76
|
+
/**
|
|
77
|
+
* One lightweight positioning controller for Looma floating UI. Native
|
|
78
|
+
* Popover provides the top layer and CSS Anchor Positioning follows a named
|
|
79
|
+
* element. Browsers without Anchor Positioning use the same flip/shift
|
|
80
|
+
* geometry through scroll/resize listeners that exist only while open.
|
|
81
|
+
*/
|
|
82
|
+
declare function createAnchoredSurface(surface: HTMLElement, options?: AnchoredSurfaceOptions): AnchoredSurface;
|
|
47
83
|
declare function getVisualViewportRect(owner?: Window): ViewportRect;
|
|
48
84
|
declare function clampRectToViewport(rect: RectLike, viewport?: ViewportRect, gutter?: number): Point;
|
|
49
85
|
declare function distanceFromPointToRect(point: Point, rect: RectLike): number;
|
|
@@ -57,6 +93,13 @@ declare function distanceFromPointToRect(point: Point, rect: RectLike): number;
|
|
|
57
93
|
*/
|
|
58
94
|
declare function createProximityCoordinator(scope: HTMLElement, options?: ProximityCoordinatorOptions): ProximityCoordinator;
|
|
59
95
|
|
|
96
|
+
/**
|
|
97
|
+
* Reflects real touch use instead of guessing from device capability media
|
|
98
|
+
* queries. Hybrid devices therefore keep compact pointer affordances until the
|
|
99
|
+
* user actually touches the interface.
|
|
100
|
+
*/
|
|
101
|
+
declare function initializeInputModality(owner?: Document): void;
|
|
102
|
+
|
|
60
103
|
/** The opinionated Lucide set used by Looma's shipped interaction surfaces. */
|
|
61
104
|
declare const LOOMA_ICONS: {
|
|
62
105
|
'align-center': IconNode;
|
|
@@ -121,4 +164,4 @@ declare function setElementDragImage(dataTransfer: DataTransfer | null, element:
|
|
|
121
164
|
/** A keyed, replaceable hover timer suitable for expansion and disclosure intent. */
|
|
122
165
|
declare function createHoverIntent(delay: number, onIntent: (key: string) => void): HoverIntentController;
|
|
123
166
|
|
|
124
|
-
export { DEFAULT_AFFORDANCE_NEAR_RADIUS, type DropPosition, type HoverIntentController, LOOMA_ICONS, type LoomaIconName, type LoomaIconNode, type OverlayCloseReason, type OverlayRecord, type OverlayTrigger, type Point, type ProximityCoordinator, type ProximityCoordinatorOptions, type RectLike, type ViewportRect, clampRectToViewport, classifyDropPosition, closeOverlay, createHoverIntent, createProximityCoordinator, distanceFromPointToRect, getTopOverlay, getVisualViewportRect, isTopOverlay, loomaIconMarkup, openOverlay, requestTopOverlayClose, setElementDragImage };
|
|
167
|
+
export { type AnchoredPlacement, type AnchoredSurface, type AnchoredSurfaceOptions, DEFAULT_AFFORDANCE_NEAR_RADIUS, type DropPosition, type HoverIntentController, LOOMA_ICONS, type LoomaIconName, type LoomaIconNode, type OverlayCloseReason, type OverlayRecord, type OverlayTrigger, type Point, type ProximityCoordinator, type ProximityCoordinatorOptions, type RectLike, type ViewportRect, type ViewportSurface, clampRectToViewport, classifyDropPosition, closeOverlay, createAnchoredSurface, createHoverIntent, createProximityCoordinator, createViewportSurface, distanceFromPointToRect, getTopOverlay, getVisualViewportRect, initializeInputModality, isTopOverlay, loomaIconMarkup, openOverlay, requestTopOverlayClose, setElementDragImage };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
bootstrapLazy
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OY4D3W4U.js";
|
|
4
4
|
|
|
5
5
|
// dist/esm/app-globals-DQuL1Twl.js
|
|
6
6
|
var globalScripts = () => {
|
|
@@ -10,7 +10,7 @@ var globalScripts = () => {
|
|
|
10
10
|
var defineCustomElements = async (win, options) => {
|
|
11
11
|
if (typeof window === "undefined") return void 0;
|
|
12
12
|
await globalScripts();
|
|
13
|
-
return bootstrapLazy([["ui-context-menu", [[769, "ui-context-menu", { "open": [4], "defaultOpen": [4, "default-open"], "for": [1], "internalOpen": [32] }, null, { "open": [{ "syncFromProp": 0 }], "for": [{ "syncTarget": 0 }], "internalOpen": [{ "syncOverlay": 0 }] }]]], ["ui-affordance-scope", [[769, "ui-affordance-scope", { "nearRadius": [514, "near-radius"] }, null, { "nearRadius": [{ "connectCoordinator": 0 }] }]]], ["ui-avatar", [[513, "ui-avatar", { "src": [1], "alt": [1], "name": [1], "fallback": [1], "hasImage": [32] }, null, { "src": [{ "watchSrc": 0 }] }]]], ["ui-avatar-group", [[769, "ui-avatar-group", { "max": [2], "label": [1], "overflowCount": [32] }, null, { "max": [{ "syncOverflow": 0 }] }]]], ["ui-badge", [[769, "ui-badge", { "variant": [1], "tone": [1] }]]], ["ui-button", [[769, "ui-button", { "variant": [1], "size": [1], "disabled": [4] }, null, { "variant": [{ "syncToButton": 0 }], "size": [{ "syncToButton": 0 }], "disabled": [{ "syncToButton": 0 }] }]]], ["ui-checkbox", [[769, "ui-checkbox", { "checked": [4], "defaultChecked": [4, "default-checked"], "disabled": [4], "indeterminate": [4], "required": [4], "value": [1], "internalChecked": [32] }, null, { "checked": [{ "syncFromProp": 0 }], "internalChecked": [{ "syncToInput": 0 }], "indeterminate": [{ "syncToInput": 0 }], "disabled": [{ "syncToInput": 0 }], "required": [{ "syncToInput": 0 }] }]]], ["ui-dialog", [[769, "ui-dialog", { "open": [4], "defaultOpen": [4, "default-open"], "modal": [4], "dismissible": [4], "label": [1], "internalOpen": [32] }, null, { "open": [{ "syncFromProp": 0 }], "internalOpen": [{ "syncOpen": 0 }] }]]], ["ui-disclosure", [[769, "ui-disclosure", { "open": [4], "defaultOpen": [4, "default-open"], "disabled": [4], "internalOpen": [32], "contentId": [32] }, null, { "open": [{ "syncFromProp": 0 }], "internalOpen": [{ "syncState": 0 }] }]]], ["ui-floating-action-button", [[769, "ui-floating-action-button", { "disabled": [516], "mobileOnly": [516, "mobile-only"], "label": [1] }]]], ["ui-form-field", [[769, "ui-form-field", { "invalid": [4], "disabled": [4], "required": [4] }]]], ["ui-icon-button", [[769, "ui-icon-button", { "disabled": [516], "label": [1], "size": [513], "variant": [513], "anticipatory": [516] }]]], ["ui-input", [[769, "ui-input", { "value": [1], "defaultValue": [1, "default-value"], "disabled": [4], "invalid": [4], "readOnly": [4, "readonly"], "internalValue": [32] }, null, { "value": [{ "syncFromProp": 0 }], "internalValue": [{ "syncToInput": 0 }], "defaultValue": [{ "syncToInput": 0 }], "disabled": [{ "syncToInput": 0 }], "invalid": [{ "syncToInput": 0 }], "readOnly": [{ "syncToInput": 0 }] }]]], ["ui-menu-item", [[769, "ui-menu-item", { "disabled": [516], "value": [1] }]]], ["ui-popover", [[769, "ui-popover", { "open": [4], "defaultOpen": [4, "default-open"], "internalOpen": [32] }, null, { "open": [{ "syncFromProp": 0 }], "internalOpen": [{ "onOpenChange": 0 }] }]]], ["ui-radio", [[769, "ui-radio", { "checked": [4], "defaultChecked": [4, "default-checked"], "disabled": [4], "name": [1], "required": [4], "value": [1] }, null, { "checked": [{ "syncToInput": 0 }], "disabled": [{ "syncToInput": 0 }], "name": [{ "syncToInput": 0 }], "required": [{ "syncToInput": 0 }], "value": [{ "syncToInput": 0 }] }]]], ["ui-radio-group", [[769, "ui-radio-group", { "value": [1], "name": [1], "orientation": [1], "disabled": [4], "required": [4], "internalValue": [32] }, null, { "value": [{ "syncFromProp": 0 }], "internalValue": [{ "syncToRadios": 0 }], "name": [{ "syncToRadios": 0 }], "orientation": [{ "syncToRadios": 0 }], "disabled": [{ "syncToRadios": 0 }] }]]], ["ui-search-result-row", [[769, "ui-search-result-row", { "disabled": [516], "selected": [516], "hasLeading": [32], "hasMeta": [32], "hasExcerpt": [32], "hasTrailing": [32] }]]], ["ui-search-shell", [[769, "ui-search-shell", { "hasStatus": [32], "hasFooter": [32] }]]], ["ui-select", [[769, "ui-select", { "value": [1], "defaultValue": [1, "default-value"], "disabled": [4], "invalid": [4], "required": [4], "internalValue": [32] }, null, { "value": [{ "syncFromProp": 0 }], "internalValue": [{ "syncToSelect": 0 }], "defaultValue": [{ "syncToSelect": 0 }], "disabled": [{ "syncToSelect": 0 }], "invalid": [{ "syncToSelect": 0 }], "required": [{ "syncToSelect": 0 }] }]]], ["ui-switch", [[769, "ui-switch", { "checked": [4], "defaultChecked": [4, "default-checked"], "disabled": [4], "required": [4], "value": [1], "internalChecked": [32] }, null, { "checked": [{ "syncFromProp": 0 }] }]]], ["ui-tabs", [[769, "ui-tabs", { "value": [1], "defaultValue": [1, "default-value"], "orientation": [1], "internalValue": [32] }, null, { "value": [{ "syncFromProp": 0 }], "internalValue": [{ "syncState": 0 }], "orientation": [{ "syncState": 0 }] }]]], ["ui-textarea", [[769, "ui-textarea", { "value": [1], "defaultValue": [1, "default-value"], "disabled": [4], "invalid": [4], "readOnly": [4, "readonly"], "rows": [2], "internalValue": [32] }, null, { "value": [{ "syncFromProp": 0 }], "internalValue": [{ "syncToTextarea": 0 }], "defaultValue": [{ "syncToTextarea": 0 }], "disabled": [{ "syncToTextarea": 0 }], "invalid": [{ "syncToTextarea": 0 }], "readOnly": [{ "syncToTextarea": 0 }], "rows": [{ "syncToTextarea": 0 }] }]]], ["ui-toast-region", [[769, "ui-toast-region", { "open": [4], "internalOpen": [32] }, null, { "open": [{ "syncFromProp": 0 }] }]]], ["ui-tooltip", [[769, "ui-tooltip", { "for": [1], "open": [4], "defaultOpen": [4, "default-open"], "internalOpen": [32] }, null, { "open": [{ "syncFromProp": 0 }], "internalOpen": [{ "syncOverlay": 0 }] }]]], ["ui-top-bar", [[769, "ui-top-bar", { "hasLeading": [32], "hasSearch": [32], "hasActions": [32] }]]], ["ui-tree", [[769, "ui-tree", { "label": [1], "hoverExpandDelay": [2, "hover-expand-delay"] }]]], ["ui-tree-item", [[769, "ui-tree-item", { "itemId": [1, "item-id"], "label": [1], "depth": [2], "container": [4], "sortable": [4], "dragType": [1, "drag-type"], "dropScope": [1, "drop-scope"], "accepts": [1], "expanded": [4], "defaultExpanded": [4, "default-expanded"], "selected": [4], "disabled": [4], "internalExpanded": [32] }, null, { "expanded": [{ "syncExpandedFromProp": 0 }] }]]], ["ui-menu", [[769, "ui-menu", { "open": [4], "defaultOpen": [4, "default-open"], "internalOpen": [32] }, null, { "open": [{ "syncFromProp": 0 }] }]]]], options);
|
|
13
|
+
return bootstrapLazy([["ui-context-menu", [[769, "ui-context-menu", { "open": [4], "defaultOpen": [4, "default-open"], "for": [1], "internalOpen": [32] }, null, { "open": [{ "syncFromProp": 0 }], "for": [{ "syncTarget": 0 }], "internalOpen": [{ "syncOverlay": 0 }] }]]], ["ui-affordance-scope", [[769, "ui-affordance-scope", { "nearRadius": [514, "near-radius"] }, null, { "nearRadius": [{ "connectCoordinator": 0 }] }]]], ["ui-avatar", [[513, "ui-avatar", { "src": [1], "alt": [1], "name": [1], "fallback": [1], "hasImage": [32] }, null, { "src": [{ "watchSrc": 0 }] }]]], ["ui-avatar-group", [[769, "ui-avatar-group", { "max": [2], "label": [1], "overflowCount": [32] }, null, { "max": [{ "syncOverflow": 0 }] }]]], ["ui-badge", [[769, "ui-badge", { "variant": [1], "tone": [1] }]]], ["ui-button", [[769, "ui-button", { "variant": [1], "size": [1], "disabled": [4] }, null, { "variant": [{ "syncToButton": 0 }], "size": [{ "syncToButton": 0 }], "disabled": [{ "syncToButton": 0 }] }]]], ["ui-checkbox", [[769, "ui-checkbox", { "checked": [4], "defaultChecked": [4, "default-checked"], "disabled": [4], "indeterminate": [4], "required": [4], "value": [1], "internalChecked": [32] }, null, { "checked": [{ "syncFromProp": 0 }], "internalChecked": [{ "syncToInput": 0 }], "indeterminate": [{ "syncToInput": 0 }], "disabled": [{ "syncToInput": 0 }], "required": [{ "syncToInput": 0 }] }]]], ["ui-dialog", [[769, "ui-dialog", { "open": [4], "defaultOpen": [4, "default-open"], "modal": [4], "dismissible": [4], "label": [1], "internalOpen": [32] }, null, { "open": [{ "syncFromProp": 0 }], "internalOpen": [{ "syncOpen": 0 }] }]]], ["ui-disclosure", [[769, "ui-disclosure", { "open": [4], "defaultOpen": [4, "default-open"], "disabled": [4], "internalOpen": [32], "contentId": [32] }, null, { "open": [{ "syncFromProp": 0 }], "internalOpen": [{ "syncState": 0 }] }]]], ["ui-floating-action-button", [[769, "ui-floating-action-button", { "disabled": [516], "mobileOnly": [516, "mobile-only"], "label": [1] }]]], ["ui-form-field", [[769, "ui-form-field", { "invalid": [4], "disabled": [4], "required": [4] }]]], ["ui-icon-button", [[769, "ui-icon-button", { "disabled": [516], "label": [1], "size": [513], "variant": [513], "anticipatory": [516] }]]], ["ui-input", [[769, "ui-input", { "value": [1], "defaultValue": [1, "default-value"], "disabled": [4], "invalid": [4], "readOnly": [4, "readonly"], "internalValue": [32] }, null, { "value": [{ "syncFromProp": 0 }], "internalValue": [{ "syncToInput": 0 }], "defaultValue": [{ "syncToInput": 0 }], "disabled": [{ "syncToInput": 0 }], "invalid": [{ "syncToInput": 0 }], "readOnly": [{ "syncToInput": 0 }] }]]], ["ui-menu-item", [[769, "ui-menu-item", { "disabled": [516], "value": [1] }]]], ["ui-popover", [[769, "ui-popover", { "open": [4], "defaultOpen": [4, "default-open"], "for": [1], "placement": [1], "internalOpen": [32] }, null, { "open": [{ "syncFromProp": 0 }], "internalOpen": [{ "onOpenChange": 0 }], "for": [{ "resetSurface": 0 }], "placement": [{ "resetSurface": 0 }] }]]], ["ui-radio", [[769, "ui-radio", { "checked": [4], "defaultChecked": [4, "default-checked"], "disabled": [4], "name": [1], "required": [4], "value": [1] }, null, { "checked": [{ "syncToInput": 0 }], "disabled": [{ "syncToInput": 0 }], "name": [{ "syncToInput": 0 }], "required": [{ "syncToInput": 0 }], "value": [{ "syncToInput": 0 }] }]]], ["ui-radio-group", [[769, "ui-radio-group", { "value": [1], "name": [1], "orientation": [1], "disabled": [4], "required": [4], "internalValue": [32] }, null, { "value": [{ "syncFromProp": 0 }], "internalValue": [{ "syncToRadios": 0 }], "name": [{ "syncToRadios": 0 }], "orientation": [{ "syncToRadios": 0 }], "disabled": [{ "syncToRadios": 0 }] }]]], ["ui-search-result-row", [[769, "ui-search-result-row", { "disabled": [516], "selected": [516], "hasLeading": [32], "hasMeta": [32], "hasExcerpt": [32], "hasTrailing": [32] }]]], ["ui-search-shell", [[769, "ui-search-shell", { "hasStatus": [32], "hasFooter": [32] }]]], ["ui-select", [[769, "ui-select", { "value": [1], "defaultValue": [1, "default-value"], "disabled": [4], "invalid": [4], "required": [4], "internalValue": [32] }, null, { "value": [{ "syncFromProp": 0 }], "internalValue": [{ "syncToSelect": 0 }], "defaultValue": [{ "syncToSelect": 0 }], "disabled": [{ "syncToSelect": 0 }], "invalid": [{ "syncToSelect": 0 }], "required": [{ "syncToSelect": 0 }] }]]], ["ui-switch", [[769, "ui-switch", { "checked": [4], "defaultChecked": [4, "default-checked"], "disabled": [4], "required": [4], "value": [1], "internalChecked": [32] }, null, { "checked": [{ "syncFromProp": 0 }] }]]], ["ui-tabs", [[769, "ui-tabs", { "value": [1], "defaultValue": [1, "default-value"], "orientation": [1], "internalValue": [32] }, null, { "value": [{ "syncFromProp": 0 }], "internalValue": [{ "syncState": 0 }], "orientation": [{ "syncState": 0 }] }]]], ["ui-textarea", [[769, "ui-textarea", { "value": [1], "defaultValue": [1, "default-value"], "disabled": [4], "invalid": [4], "readOnly": [4, "readonly"], "rows": [2], "internalValue": [32] }, null, { "value": [{ "syncFromProp": 0 }], "internalValue": [{ "syncToTextarea": 0 }], "defaultValue": [{ "syncToTextarea": 0 }], "disabled": [{ "syncToTextarea": 0 }], "invalid": [{ "syncToTextarea": 0 }], "readOnly": [{ "syncToTextarea": 0 }], "rows": [{ "syncToTextarea": 0 }] }]]], ["ui-toast-region", [[769, "ui-toast-region", { "open": [4], "internalOpen": [32] }, null, { "open": [{ "syncFromProp": 0 }], "internalOpen": [{ "syncSurface": 0 }] }]]], ["ui-tooltip", [[769, "ui-tooltip", { "for": [1], "open": [4], "defaultOpen": [4, "default-open"], "placement": [1], "showDelay": [2, "show-delay"], "hideDelay": [2, "hide-delay"], "internalOpen": [32] }, null, { "open": [{ "syncFromProp": 0 }], "for": [{ "resetSurface": 0 }], "placement": [{ "resetSurface": 0 }], "internalOpen": [{ "syncOverlay": 0 }] }]]], ["ui-top-bar", [[769, "ui-top-bar", { "hasLeading": [32], "hasSearch": [32], "hasActions": [32] }]]], ["ui-tree", [[769, "ui-tree", { "label": [1], "hoverExpandDelay": [2, "hover-expand-delay"] }]]], ["ui-tree-item", [[769, "ui-tree-item", { "itemId": [1, "item-id"], "label": [1], "depth": [2], "container": [4], "sortable": [4], "dragType": [1, "drag-type"], "dropScope": [1, "drop-scope"], "accepts": [1], "expanded": [4], "defaultExpanded": [4, "default-expanded"], "selected": [4], "disabled": [4], "internalExpanded": [32] }, null, { "expanded": [{ "syncExpandedFromProp": 0 }] }]]], ["ui-menu", [[769, "ui-menu", { "open": [4], "defaultOpen": [4, "default-open"], "for": [1], "placement": [1], "internalOpen": [32] }, null, { "open": [{ "syncFromProp": 0 }], "for": [{ "resetSurface": 0 }], "placement": [{ "resetSurface": 0 }], "internalOpen": [{ "syncSurface": 0 }] }]]]], options);
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
// loader/index.js
|
|
@@ -26,6 +26,24 @@ var defineCustomElements = async (win, options) => {
|
|
|
26
26
|
}
|
|
27
27
|
})();
|
|
28
28
|
|
|
29
|
+
// src/input-modality.ts
|
|
30
|
+
var initializedDocuments = /* @__PURE__ */ new WeakSet();
|
|
31
|
+
function initializeInputModality(owner = document) {
|
|
32
|
+
if (initializedDocuments.has(owner)) return;
|
|
33
|
+
initializedDocuments.add(owner);
|
|
34
|
+
const markTouch = () => {
|
|
35
|
+
if (owner.documentElement.getAttribute("data-ui-input-modality") === "touch") return;
|
|
36
|
+
owner.documentElement.setAttribute("data-ui-input-modality", "touch");
|
|
37
|
+
owner.dispatchEvent(new CustomEvent("ui-input-modality-change", {
|
|
38
|
+
detail: { modality: "touch" }
|
|
39
|
+
}));
|
|
40
|
+
};
|
|
41
|
+
owner.addEventListener("pointerdown", (event) => {
|
|
42
|
+
if (event.pointerType === "touch") markTouch();
|
|
43
|
+
}, { capture: true, passive: true });
|
|
44
|
+
owner.addEventListener("touchstart", markTouch, { capture: true, passive: true });
|
|
45
|
+
}
|
|
46
|
+
|
|
29
47
|
// src/overlay/manager.ts
|
|
30
48
|
var stack = [];
|
|
31
49
|
var scrollLockAttribute = "data-ui-scroll-lock";
|
|
@@ -59,8 +77,9 @@ function handleLightDismiss(event) {
|
|
|
59
77
|
return;
|
|
60
78
|
}
|
|
61
79
|
const target = event.target;
|
|
62
|
-
if (target instanceof Node
|
|
63
|
-
return;
|
|
80
|
+
if (target instanceof Node) {
|
|
81
|
+
if (top.element.contains(target)) return;
|
|
82
|
+
if (top.relatedElements?.some((element) => element.contains(target))) return;
|
|
64
83
|
}
|
|
65
84
|
requestTopOverlayClose("light-dismiss", "pointer");
|
|
66
85
|
}
|
|
@@ -120,6 +139,214 @@ function requestTopOverlayClose(reason, trigger) {
|
|
|
120
139
|
|
|
121
140
|
// src/overlay/positioning.ts
|
|
122
141
|
var DEFAULT_AFFORDANCE_NEAR_RADIUS = 16;
|
|
142
|
+
var anchorSequence = 0;
|
|
143
|
+
var anchorBindings = /* @__PURE__ */ new WeakMap();
|
|
144
|
+
function bindAnchorName(anchor, name) {
|
|
145
|
+
const binding = anchorBindings.get(anchor) ?? {
|
|
146
|
+
original: anchor.style.getPropertyValue("anchor-name"),
|
|
147
|
+
names: /* @__PURE__ */ new Set()
|
|
148
|
+
};
|
|
149
|
+
binding.names.add(name);
|
|
150
|
+
anchorBindings.set(anchor, binding);
|
|
151
|
+
const values = [binding.original, ...binding.names].filter(Boolean);
|
|
152
|
+
anchor.style.setProperty("anchor-name", values.join(", "));
|
|
153
|
+
}
|
|
154
|
+
function unbindAnchorName(anchor, name) {
|
|
155
|
+
const binding = anchorBindings.get(anchor);
|
|
156
|
+
if (!binding) return;
|
|
157
|
+
binding.names.delete(name);
|
|
158
|
+
if (binding.names.size) {
|
|
159
|
+
const values = [binding.original, ...binding.names].filter(Boolean);
|
|
160
|
+
anchor.style.setProperty("anchor-name", values.join(", "));
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (binding.original) anchor.style.setProperty("anchor-name", binding.original);
|
|
164
|
+
else anchor.style.removeProperty("anchor-name");
|
|
165
|
+
anchorBindings.delete(anchor);
|
|
166
|
+
}
|
|
167
|
+
function supportsAnchorPositioning(owner) {
|
|
168
|
+
const css = owner.CSS;
|
|
169
|
+
return typeof css?.supports === "function" && css.supports("anchor-name: --ui-anchor-test") && css.supports("position-anchor: --ui-anchor-test") && css.supports("top: anchor(bottom)");
|
|
170
|
+
}
|
|
171
|
+
function topLayerOpen(surface) {
|
|
172
|
+
try {
|
|
173
|
+
return surface.matches(":popover-open");
|
|
174
|
+
} catch {
|
|
175
|
+
return !surface.hidden;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function showInTopLayer(surface) {
|
|
179
|
+
surface.setAttribute("popover", "manual");
|
|
180
|
+
surface.hidden = false;
|
|
181
|
+
if (typeof surface.showPopover === "function" && !topLayerOpen(surface)) {
|
|
182
|
+
try {
|
|
183
|
+
surface.showPopover();
|
|
184
|
+
} catch {
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
function hideFromTopLayer(surface) {
|
|
189
|
+
if (typeof surface.hidePopover === "function" && topLayerOpen(surface)) {
|
|
190
|
+
try {
|
|
191
|
+
surface.hidePopover();
|
|
192
|
+
} catch {
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
surface.hidden = true;
|
|
196
|
+
}
|
|
197
|
+
function createViewportSurface(surface) {
|
|
198
|
+
surface.setAttribute("popover", "manual");
|
|
199
|
+
surface.dataset.uiPositioning = "viewport";
|
|
200
|
+
return {
|
|
201
|
+
show() {
|
|
202
|
+
showInTopLayer(surface);
|
|
203
|
+
},
|
|
204
|
+
hide() {
|
|
205
|
+
hideFromTopLayer(surface);
|
|
206
|
+
},
|
|
207
|
+
destroy() {
|
|
208
|
+
hideFromTopLayer(surface);
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function fallbackPosition(surface, anchor, placement, gap, viewportGap) {
|
|
213
|
+
const owner = surface.ownerDocument.defaultView ?? window;
|
|
214
|
+
const viewport = getVisualViewportRect(owner);
|
|
215
|
+
const rect = surface.getBoundingClientRect();
|
|
216
|
+
const preferTop = placement.startsWith("top");
|
|
217
|
+
const preferEnd = placement.endsWith("end");
|
|
218
|
+
const spaceBelow = viewport.bottom - anchor.bottom - viewportGap;
|
|
219
|
+
const spaceAbove = anchor.top - viewport.top - viewportGap;
|
|
220
|
+
const useTop = preferTop ? !(spaceAbove < rect.height + gap && spaceBelow > spaceAbove) : spaceBelow < rect.height + gap && spaceAbove > spaceBelow;
|
|
221
|
+
const unclampedTop = useTop ? anchor.top - rect.height - gap : anchor.bottom + gap;
|
|
222
|
+
const unclampedLeft = preferEnd ? anchor.right - rect.width : anchor.left;
|
|
223
|
+
const shifted = clampRectToViewport({
|
|
224
|
+
left: unclampedLeft,
|
|
225
|
+
top: unclampedTop,
|
|
226
|
+
right: unclampedLeft + rect.width,
|
|
227
|
+
bottom: unclampedTop + rect.height,
|
|
228
|
+
width: rect.width,
|
|
229
|
+
height: rect.height
|
|
230
|
+
}, viewport, viewportGap);
|
|
231
|
+
surface.style.left = `${Math.round(unclampedLeft + shifted.x)}px`;
|
|
232
|
+
surface.style.top = `${Math.round(unclampedTop + shifted.y)}px`;
|
|
233
|
+
surface.style.right = "auto";
|
|
234
|
+
surface.style.bottom = "auto";
|
|
235
|
+
}
|
|
236
|
+
function createAnchoredSurface(surface, options = {}) {
|
|
237
|
+
const owner = surface.ownerDocument.defaultView ?? window;
|
|
238
|
+
const placement = options.placement ?? "bottom-start";
|
|
239
|
+
const gap = Math.max(0, options.gap ?? 4);
|
|
240
|
+
const viewportGap = Math.max(0, options.viewportGap ?? 8);
|
|
241
|
+
const nativeAnchor = supportsAnchorPositioning(owner);
|
|
242
|
+
const anchorName = `--ui-anchor-${++anchorSequence}`;
|
|
243
|
+
let anchor = options.anchor ?? null;
|
|
244
|
+
let point = null;
|
|
245
|
+
let open = false;
|
|
246
|
+
let frame = null;
|
|
247
|
+
let listenerAbort = null;
|
|
248
|
+
surface.setAttribute("popover", "manual");
|
|
249
|
+
surface.dataset.uiPositioning = nativeAnchor ? "anchor" : "fallback";
|
|
250
|
+
surface.style.position = "fixed";
|
|
251
|
+
surface.style.margin = "0";
|
|
252
|
+
const bindAnchor = (next) => {
|
|
253
|
+
if (anchor) unbindAnchorName(anchor, anchorName);
|
|
254
|
+
anchor = next;
|
|
255
|
+
if (!anchor) {
|
|
256
|
+
surface.style.removeProperty("position-anchor");
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
bindAnchorName(anchor, anchorName);
|
|
260
|
+
surface.style.setProperty("position-anchor", anchorName);
|
|
261
|
+
};
|
|
262
|
+
const positionNative = () => {
|
|
263
|
+
const blockEnd = placement.startsWith("bottom");
|
|
264
|
+
const inlineEnd = placement.endsWith("end");
|
|
265
|
+
surface.style.top = blockEnd ? `calc(anchor(bottom) + ${gap}px)` : "auto";
|
|
266
|
+
surface.style.bottom = blockEnd ? "auto" : `calc(anchor(top) + ${gap}px)`;
|
|
267
|
+
surface.style.left = inlineEnd ? "auto" : "anchor(left)";
|
|
268
|
+
surface.style.right = inlineEnd ? "anchor(right)" : "auto";
|
|
269
|
+
surface.style.setProperty("position-try-fallbacks", "flip-block, flip-inline");
|
|
270
|
+
};
|
|
271
|
+
const position = () => {
|
|
272
|
+
frame = null;
|
|
273
|
+
if (!open) return;
|
|
274
|
+
if (point) {
|
|
275
|
+
fallbackPosition(surface, {
|
|
276
|
+
left: point.x,
|
|
277
|
+
right: point.x,
|
|
278
|
+
top: point.y,
|
|
279
|
+
bottom: point.y,
|
|
280
|
+
width: 0,
|
|
281
|
+
height: 0
|
|
282
|
+
}, "bottom-start", gap, viewportGap);
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
if (!anchor) return;
|
|
286
|
+
if (nativeAnchor) positionNative();
|
|
287
|
+
else fallbackPosition(surface, anchor.getBoundingClientRect(), placement, gap, viewportGap);
|
|
288
|
+
};
|
|
289
|
+
const schedule = () => {
|
|
290
|
+
if (!open || frame !== null) return;
|
|
291
|
+
frame = owner.requestAnimationFrame(position);
|
|
292
|
+
};
|
|
293
|
+
const syncFallbackListeners = () => {
|
|
294
|
+
const needsListeners = open && (point !== null || !nativeAnchor);
|
|
295
|
+
if (!needsListeners) {
|
|
296
|
+
listenerAbort?.abort();
|
|
297
|
+
listenerAbort = null;
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
if (listenerAbort) return;
|
|
301
|
+
listenerAbort = new AbortController();
|
|
302
|
+
const signal = listenerAbort.signal;
|
|
303
|
+
owner.addEventListener("resize", schedule, { passive: true, signal });
|
|
304
|
+
owner.addEventListener("scroll", schedule, { passive: true, capture: true, signal });
|
|
305
|
+
owner.visualViewport?.addEventListener("resize", schedule, { passive: true, signal });
|
|
306
|
+
owner.visualViewport?.addEventListener("scroll", schedule, { passive: true, signal });
|
|
307
|
+
};
|
|
308
|
+
bindAnchor(anchor);
|
|
309
|
+
return {
|
|
310
|
+
setAnchor(next) {
|
|
311
|
+
point = null;
|
|
312
|
+
bindAnchor(next);
|
|
313
|
+
syncFallbackListeners();
|
|
314
|
+
schedule();
|
|
315
|
+
},
|
|
316
|
+
show() {
|
|
317
|
+
point = null;
|
|
318
|
+
open = true;
|
|
319
|
+
syncFallbackListeners();
|
|
320
|
+
showInTopLayer(surface);
|
|
321
|
+
position();
|
|
322
|
+
},
|
|
323
|
+
showAtPoint(nextPoint) {
|
|
324
|
+
point = nextPoint;
|
|
325
|
+
open = true;
|
|
326
|
+
syncFallbackListeners();
|
|
327
|
+
showInTopLayer(surface);
|
|
328
|
+
position();
|
|
329
|
+
},
|
|
330
|
+
hide() {
|
|
331
|
+
open = false;
|
|
332
|
+
point = null;
|
|
333
|
+
syncFallbackListeners();
|
|
334
|
+
if (frame !== null) owner.cancelAnimationFrame(frame);
|
|
335
|
+
frame = null;
|
|
336
|
+
hideFromTopLayer(surface);
|
|
337
|
+
},
|
|
338
|
+
refresh: schedule,
|
|
339
|
+
destroy() {
|
|
340
|
+
open = false;
|
|
341
|
+
listenerAbort?.abort();
|
|
342
|
+
listenerAbort = null;
|
|
343
|
+
if (frame !== null) owner.cancelAnimationFrame(frame);
|
|
344
|
+
frame = null;
|
|
345
|
+
hideFromTopLayer(surface);
|
|
346
|
+
bindAnchor(null);
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
}
|
|
123
350
|
function getVisualViewportRect(owner = window) {
|
|
124
351
|
const viewport = owner.visualViewport;
|
|
125
352
|
const left = viewport?.offsetLeft ?? 0;
|
|
@@ -384,6 +611,7 @@ function createHoverIntent(delay, onIntent) {
|
|
|
384
611
|
}
|
|
385
612
|
|
|
386
613
|
// index.ts
|
|
614
|
+
if (typeof document !== "undefined") initializeInputModality(document);
|
|
387
615
|
defineCustomElements();
|
|
388
616
|
export {
|
|
389
617
|
DEFAULT_AFFORDANCE_NEAR_RADIUS,
|
|
@@ -391,11 +619,14 @@ export {
|
|
|
391
619
|
clampRectToViewport,
|
|
392
620
|
classifyDropPosition,
|
|
393
621
|
closeOverlay,
|
|
622
|
+
createAnchoredSurface,
|
|
394
623
|
createHoverIntent,
|
|
395
624
|
createProximityCoordinator,
|
|
625
|
+
createViewportSurface,
|
|
396
626
|
distanceFromPointToRect,
|
|
397
627
|
getTopOverlay,
|
|
398
628
|
getVisualViewportRect,
|
|
629
|
+
initializeInputModality,
|
|
399
630
|
isTopOverlay,
|
|
400
631
|
loomaIconMarkup,
|
|
401
632
|
openOverlay,
|
package/dist/looma/looma.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as a}from"./p-CEeiinfk.js";export{s as setNonce}from"./p-CEeiinfk.js";import{g as n}from"./p-DQuL1Twl.js";(()=>{const a=import.meta.url,n={};return""!==a&&(n.resourcesUrl=new URL(".",a).href),e(n)})().then((async e=>(await n(),a([["p-
|
|
1
|
+
import{p as e,b as a}from"./p-CEeiinfk.js";export{s as setNonce}from"./p-CEeiinfk.js";import{g as n}from"./p-DQuL1Twl.js";(()=>{const a=import.meta.url,n={};return""!==a&&(n.resourcesUrl=new URL(".",a).href),e(n)})().then((async e=>(await n(),a([["p-ba01f45d",[[769,"ui-context-menu",{open:[4],defaultOpen:[4,"default-open"],for:[1],internalOpen:[32]},null,{open:[{syncFromProp:0}],for:[{syncTarget:0}],internalOpen:[{syncOverlay:0}]}]]],["p-2e6f791e",[[769,"ui-affordance-scope",{nearRadius:[514,"near-radius"]},null,{nearRadius:[{connectCoordinator:0}]}]]],["p-1681b218",[[513,"ui-avatar",{src:[1],alt:[1],name:[1],fallback:[1],hasImage:[32]},null,{src:[{watchSrc:0}]}]]],["p-5ba9d496",[[769,"ui-avatar-group",{max:[2],label:[1],overflowCount:[32]},null,{max:[{syncOverflow:0}]}]]],["p-0584a051",[[769,"ui-badge",{variant:[1],tone:[1]}]]],["p-34417499",[[769,"ui-button",{variant:[1],size:[1],disabled:[4]},null,{variant:[{syncToButton:0}],size:[{syncToButton:0}],disabled:[{syncToButton:0}]}]]],["p-0f45c5f0",[[769,"ui-checkbox",{checked:[4],defaultChecked:[4,"default-checked"],disabled:[4],indeterminate:[4],required:[4],value:[1],internalChecked:[32]},null,{checked:[{syncFromProp:0}],internalChecked:[{syncToInput:0}],indeterminate:[{syncToInput:0}],disabled:[{syncToInput:0}],required:[{syncToInput:0}]}]]],["p-11083743",[[769,"ui-dialog",{open:[4],defaultOpen:[4,"default-open"],modal:[4],dismissible:[4],label:[1],internalOpen:[32]},null,{open:[{syncFromProp:0}],internalOpen:[{syncOpen:0}]}]]],["p-a9f46811",[[769,"ui-disclosure",{open:[4],defaultOpen:[4,"default-open"],disabled:[4],internalOpen:[32],contentId:[32]},null,{open:[{syncFromProp:0}],internalOpen:[{syncState:0}]}]]],["p-051f578c",[[769,"ui-floating-action-button",{disabled:[516],mobileOnly:[516,"mobile-only"],label:[1]}]]],["p-5d4713a6",[[769,"ui-form-field",{invalid:[4],disabled:[4],required:[4]}]]],["p-0198bb21",[[769,"ui-icon-button",{disabled:[516],label:[1],size:[513],variant:[513],anticipatory:[516]}]]],["p-624ba086",[[769,"ui-input",{value:[1],defaultValue:[1,"default-value"],disabled:[4],invalid:[4],readOnly:[4,"readonly"],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncToInput:0}],defaultValue:[{syncToInput:0}],disabled:[{syncToInput:0}],invalid:[{syncToInput:0}],readOnly:[{syncToInput:0}]}]]],["p-ed5abf6d",[[769,"ui-menu-item",{disabled:[516],value:[1]}]]],["p-caa8fc7b",[[769,"ui-popover",{open:[4],defaultOpen:[4,"default-open"],for:[1],placement:[1],internalOpen:[32]},null,{open:[{syncFromProp:0}],internalOpen:[{onOpenChange:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}]}]]],["p-8d5adb17",[[769,"ui-radio",{checked:[4],defaultChecked:[4,"default-checked"],disabled:[4],name:[1],required:[4],value:[1]},null,{checked:[{syncToInput:0}],disabled:[{syncToInput:0}],name:[{syncToInput:0}],required:[{syncToInput:0}],value:[{syncToInput:0}]}]]],["p-7e94d90d",[[769,"ui-radio-group",{value:[1],name:[1],orientation:[1],disabled:[4],required:[4],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncToRadios:0}],name:[{syncToRadios:0}],orientation:[{syncToRadios:0}],disabled:[{syncToRadios:0}]}]]],["p-2ed7e241",[[769,"ui-search-result-row",{disabled:[516],selected:[516],hasLeading:[32],hasMeta:[32],hasExcerpt:[32],hasTrailing:[32]}]]],["p-d273b857",[[769,"ui-search-shell",{hasStatus:[32],hasFooter:[32]}]]],["p-a5127c7d",[[769,"ui-select",{value:[1],defaultValue:[1,"default-value"],disabled:[4],invalid:[4],required:[4],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncToSelect:0}],defaultValue:[{syncToSelect:0}],disabled:[{syncToSelect:0}],invalid:[{syncToSelect:0}],required:[{syncToSelect:0}]}]]],["p-b7aa4488",[[769,"ui-switch",{checked:[4],defaultChecked:[4,"default-checked"],disabled:[4],required:[4],value:[1],internalChecked:[32]},null,{checked:[{syncFromProp:0}]}]]],["p-078f9fb8",[[769,"ui-tabs",{value:[1],defaultValue:[1,"default-value"],orientation:[1],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncState:0}],orientation:[{syncState:0}]}]]],["p-4b422d40",[[769,"ui-textarea",{value:[1],defaultValue:[1,"default-value"],disabled:[4],invalid:[4],readOnly:[4,"readonly"],rows:[2],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncToTextarea:0}],defaultValue:[{syncToTextarea:0}],disabled:[{syncToTextarea:0}],invalid:[{syncToTextarea:0}],readOnly:[{syncToTextarea:0}],rows:[{syncToTextarea:0}]}]]],["p-54c41576",[[769,"ui-toast-region",{open:[4],internalOpen:[32]},null,{open:[{syncFromProp:0}],internalOpen:[{syncSurface:0}]}]]],["p-9194a99d",[[769,"ui-tooltip",{for:[1],open:[4],defaultOpen:[4,"default-open"],placement:[1],showDelay:[2,"show-delay"],hideDelay:[2,"hide-delay"],internalOpen:[32]},null,{open:[{syncFromProp:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}],internalOpen:[{syncOverlay:0}]}]]],["p-a33522a2",[[769,"ui-top-bar",{hasLeading:[32],hasSearch:[32],hasActions:[32]}]]],["p-95368dee",[[769,"ui-tree",{label:[1],hoverExpandDelay:[2,"hover-expand-delay"]}]]],["p-d01960c2",[[769,"ui-tree-item",{itemId:[1,"item-id"],label:[1],depth:[2],container:[4],sortable:[4],dragType:[1,"drag-type"],dropScope:[1,"drop-scope"],accepts:[1],expanded:[4],defaultExpanded:[4,"default-expanded"],selected:[4],disabled:[4],internalExpanded:[32]},null,{expanded:[{syncExpandedFromProp:0}]}]]],["p-1674cda4",[[769,"ui-menu",{open:[4],defaultOpen:[4,"default-open"],for:[1],placement:[1],internalOpen:[32]},null,{open:[{syncFromProp:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}],internalOpen:[{syncSurface:0}]}]]]],e))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,g as a,h as o,H as e}from"./p-CEeiinfk.js";import{o as r,c as t,r as s}from"./p-
|
|
1
|
+
import{r as i,g as a,h as o,H as e}from"./p-CEeiinfk.js";import{o as r,c as t,r as s}from"./p-PM9a74r7.js";import{d as n}from"./p-JwSoedEO.js";const d=class{constructor(a){i(this,a)}get host(){return a(this)}open=!1;defaultOpen=!1;modal=!0;dismissible=!0;label;internalOpen=!1;overlayId=`ui-dialog-${Math.random().toString(36).slice(2,11)}`;dialogRef;syncFromProp(){this.internalOpen=this.open}syncOpen(){this.dialogRef&&(this.internalOpen?(this.dialogRef.showModal(),r({id:this.overlayId,modal:this.modal,element:this.host,dismissible:this.dismissible,requestClose:(i,a)=>this.handleRequestClose(i,a)})):(this.dialogRef.close(),t(this.overlayId)))}componentDidLoad(){this.syncFromProp(),this.internalOpen=this.internalOpen||this.defaultOpen,this.dialogRef?.addEventListener("close",this.onDialogClose),this.syncOpen()}disconnectedCallback(){this.dialogRef?.removeEventListener("close",this.onDialogClose),t(this.overlayId)}componentDidUpdate(){this.syncOpen()}handleRequestClose(i,a){this.internalOpen=!1,n(this.host,"close",{open:!1,reason:i,trigger:a})}onDialogClose=()=>{this.internalOpen&&(this.internalOpen=!1,t(this.overlayId),n(this.host,"close",{open:!1,reason:"programmatic",trigger:"programmatic"}))};onKeydown=i=>{"Escape"===i.key&&s("escape","keyboard")};render(){return o(e,{key:"c10f9063a1c2677caff3b8d1f26b37bf25978a77","data-open":this.internalOpen?"":void 0,onKeyDown:this.onKeydown},o("dialog",{key:"a7111bd363cab94f394cca526bf34ea8081e5228",ref:i=>this.dialogRef=i,open:this.internalOpen,"aria-label":this.label},o("slot",{key:"b0a9699fe0be09e331cfea81b6bbeaec11d48956"})))}static get watchers(){return{open:[{syncFromProp:0}],internalOpen:[{syncOpen:0}]}}};d.style=":host{display:block}:host:not([data-open]){display:none}:host dialog{--ui-dialog-duration:var(--ui-motion-base);--ui-dialog-viewport-gap:var(--ui-space-4, 1rem);position:fixed;inset:0;inline-size:min( calc(100% - (var(--ui-dialog-viewport-gap) * 2)), var(--ui-dialog-max-width, 440px) );max-inline-size:none;max-block-size:calc(100dvh - (var(--ui-dialog-viewport-gap) * 2));margin:auto;padding:var(--ui-space-4);overflow:auto;background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-dialog);box-shadow:var(--ui-shadow-dialog);visibility:hidden;pointer-events:none;opacity:0;transform:scale(0.96);transition:opacity var(--ui-dialog-duration) var(--ui-motion-ease), transform var(--ui-dialog-duration) var(--ui-motion-ease), visibility var(--ui-dialog-duration), display var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete, overlay var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete}:host dialog[open]{visibility:visible;pointer-events:auto;opacity:1;transform:scale(1);animation:ui-dialog-enter var(--ui-dialog-duration) var(--ui-motion-ease)}@keyframes ui-dialog-enter{from{opacity:0;transform:scale(0.96)}}:host dialog::backdrop{background-color:transparent;transition:background-color var(--ui-dialog-duration) var(--ui-motion-ease), display var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete, overlay var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete}:host dialog[open]::backdrop{background-color:var(--ui-overlay-backdrop);animation:ui-dialog-backdrop-enter var(--ui-dialog-duration) var(--ui-motion-ease)}@keyframes ui-dialog-backdrop-enter{from{background-color:transparent}}";export{d as ui_dialog}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,g as t,h as i,H as s}from"./p-CEeiinfk.js";import{d as a,e as r}from"./p-JwSoedEO.js";import{o,c as n,r as u}from"./p-PM9a74r7.js";import{a as l}from"./p-Bu0dmLBE.js";const c=class{constructor(t){e(this,t)}get host(){return t(this)}open=!1;defaultOpen=!1;for;placement="bottom-start";internalOpen=!1;overlayId=`ui-menu-${Math.random().toString(36).slice(2,11)}`;anchor=null;surface=null;syncFromProp(){this.internalOpen=this.open}resetSurface(){this.setupSurface(),this.syncSurface()}syncSurface(){this.syncAnchorState(),this.surface&&(this.internalOpen?(this.surface.show(),o({id:this.overlayId,modal:!1,element:this.host,relatedElements:this.anchor?[this.anchor]:void 0,dismissible:!0,requestClose:(e,t)=>this.closeMenu(e,t)})):(this.surface.hide(),n(this.overlayId)))}componentDidLoad(){this.syncFromProp(),this.internalOpen=this.internalOpen||this.defaultOpen,this.host.addEventListener("click",this.onItemClick),this.host.addEventListener("keydown",this.onKeydown),this.setupSurface(),this.syncSurface()}disconnectedCallback(){this.host.removeEventListener("click",this.onItemClick),this.host.removeEventListener("keydown",this.onKeydown),this.surface?.destroy(),this.surface=null,n(this.overlayId)}setupSurface(){this.surface?.destroy(),this.surface=null,this.anchor=this.for?this.host.ownerDocument.getElementById(this.for):null,this.anchor&&(this.surface=l(this.host,{anchor:this.anchor,placement:this.placement}))}syncAnchorState(){this.anchor&&(this.anchor.setAttribute("aria-haspopup","menu"),this.anchor.setAttribute("aria-expanded",this.internalOpen?"true":"false"))}closeMenu(e,t){this.internalOpen&&(this.internalOpen=!1,a(this.host,"close",{open:!1,reason:e,trigger:t}),"escape"===e&&this.anchor?.focus())}getItems(){return Array.from(this.host.querySelectorAll("ui-menu-item"))}isItemDisabled(e){return"true"===e.getAttribute("aria-disabled")||e.hasAttribute("disabled")||"true"===e.getAttribute("disabled")||!0===e.disabled}onItemClick=e=>{const t=e.target.closest?.("ui-menu-item");if(!t||t.getRootNode()!==this.host.getRootNode())return;if(this.isItemDisabled(t))return;const i=t.getAttribute("value")??t.getAttribute("data-value")??"";a(this.host,"select",{value:i,trigger:r(e)}),a(this.host,"close",{open:!1,reason:"action",trigger:r(e)}),this.internalOpen=!1};onKeydown=e=>{if("Escape"===e.key)return e.preventDefault(),void u("escape","keyboard");const t=this.getItems().filter((e=>!this.isItemDisabled(e)));if(0===t.length)return;const i=e.target.closest?.("ui-menu-item"),s=i&&i instanceof HTMLElement?t.indexOf(i):-1;if("Enter"!==e.key&&" "!==e.key)"ArrowDown"!==e.key&&"ArrowUp"!==e.key||(e.preventDefault(),t["ArrowDown"===e.key?s<0?0:Math.min(s+1,t.length-1):s<=0?t.length-1:s-1].focus());else if(e.preventDefault(),i&&s>=0){const e=i.getAttribute("value")??i.getAttribute("data-value")??"";a(this.host,"select",{value:e,trigger:"keyboard"}),a(this.host,"close",{open:!1,reason:"action",trigger:"keyboard"}),this.internalOpen=!1}};render(){return i(s,{key:"06ad0750df843cb874bd4f257d8567157c855493",role:"menu","aria-orientation":"vertical","data-open":this.internalOpen?"":void 0},i("slot",{key:"50118ac749a2747ca06f4d483499c4cd20125a89"}))}static get watchers(){return{open:[{syncFromProp:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}],internalOpen:[{syncSurface:0}]}}};c.style=":host{--ui-menu-viewport-gap:var(--ui-space-2, 0.5rem);display:flex;flex-direction:column;inline-size:max-content;min-inline-size:min(12rem, calc(100vw - (var(--ui-menu-viewport-gap) * 2)));max-inline-size:calc(100vw - (var(--ui-menu-viewport-gap) * 2));padding:var(--ui-space-1);background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3);box-shadow:var(--ui-shadow-lg)}:host(:not([data-open])){display:none}:host([popover]){position:fixed;inset:auto;margin:0;overflow:auto;max-block-size:calc(100dvh - (var(--ui-menu-viewport-gap) * 2));opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}:host([popover]:popover-open){opacity:1;transform:translateY(0) scale(1)}@starting-style{:host([popover]:popover-open){opacity:0;transform:translateY(-4px) scale(0.99)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host([popover]){transition:none}}::slotted(ui-menu-item){display:block;width:100%;padding:var(--ui-space-2) var(--ui-space-3);text-align:left;background:none;border:none;border-radius:var(--ui-radius-2);color:var(--ui-text-primary);font-size:var(--ui-font-size-md);font-weight:var(--ui-font-medium, 500);cursor:pointer;transition:background-color var(--ui-motion-fast) var(--ui-motion-ease), color var(--ui-motion-fast) var(--ui-motion-ease)}::slotted(ui-menu-item:hover:not([aria-disabled='true']):not([disabled])){background:var(--ui-surface-subtle)}::slotted(ui-menu-item[aria-disabled='true']),::slotted(ui-menu-item[disabled]){opacity:0.6;cursor:not-allowed}";export{c as ui_menu}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,g as a,h as e,H as o}from"./p-CEeiinfk.js";import{D as s,c as n}from"./p-Bu0dmLBE.js";const i=class{constructor(a){t(this,a)}get host(){return a(this)}nearRadius=s;coordinator=null;componentDidLoad(){this.connectCoordinator()}disconnectedCallback(){this.coordinator?.destroy(),this.coordinator=null}connectCoordinator(){this.coordinator?.destroy(),this.coordinator=n(this.host,{nearRadius:this.nearRadius})}onSlotChange=()=>{this.coordinator?.refresh()};render(){return e(o,{key:"184b0a908494d480ed23aa14b75d4f7b94e5275b"},e("slot",{key:"570e810db588c1514c6fd85985c9bc4532993a2b",onSlotchange:this.onSlotChange}))}static get watchers(){return{nearRadius:[{connectCoordinator:0}]}}};i.style=":host{display:contents;--ui-affordance-scope-engaged:0}:host([data-ui-interaction='engaged']){--ui-affordance-scope-engaged:1}";export{i as ui_affordance_scope}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,g as a,h as i,H as s}from"./p-CEeiinfk.js";import{d as e,e as r}from"./p-JwSoedEO.js";import{b as o}from"./p-Bu0dmLBE.js";const n=class{constructor(a){t(this,a)}get host(){return a(this)}open=!0;internalOpen=!0;surface=null;syncFromProp(){this.internalOpen=this.open}syncSurface(){this.internalOpen?this.surface?.show():this.surface?.hide()}componentDidLoad(){this.surface=o(this.host),this.syncFromProp(),this.syncSurface(),this.host.addEventListener("click",this.onClick)}disconnectedCallback(){this.host.removeEventListener("click",this.onClick),this.surface?.destroy(),this.surface=null}getToasts(){return Array.from(this.host.querySelectorAll("[data-ui-toast]"))}updateOpenState(){const t=this.getToasts();this.internalOpen=t.length>0}onClick=t=>{const a=t.target.closest?.("[data-ui-toast-dismiss]");if(!a)return;const i=a.closest?.("[data-ui-toast]");if(!i)return;const s=i.id??"";i.setAttribute("aria-hidden","true"),i.remove(),e(this.host,"dismiss",{id:s,reason:"action",trigger:r(t)}),this.updateOpenState(),0===this.getToasts().length&&e(this.host,"close",{open:!1,reason:"action",trigger:r(t)})};render(){return i(s,{key:"693e24016ec0881a4d619a489f1b655feee41784",role:"region","aria-label":"Notifications","data-open":this.internalOpen?"":void 0},i("slot",{key:"e666b2a73a5d7eb8dd607df3d1c5135b78cf3775"}))}static get watchers(){return{open:[{syncFromProp:0}],internalOpen:[{syncSurface:0}]}}};n.style=":host{position:fixed;top:calc(var(--ui-space-4) + env(safe-area-inset-top));left:50%;transform:translateX(-50%);z-index:9999;display:grid;gap:var(--ui-space-2);inline-size:min(24rem, calc(100vw - (var(--ui-space-4) * 2)));max-inline-size:100%;pointer-events:none}:host([popover]){right:auto;bottom:auto;margin:0}:host>*{pointer-events:auto}::slotted([data-ui-toast]){display:grid;grid-template-columns:1fr auto;gap:var(--ui-space-2);align-items:start;border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3);padding:var(--ui-space-3) var(--ui-space-4);background:var(--ui-surface-elevated);color:var(--ui-text-primary);box-shadow:var(--ui-shadow-lg);animation:ui-toast-enter 0.25s var(--ui-motion-ease) forwards}@keyframes ui-toast-enter{from{opacity:0;transform:translateY(-0.5rem)}to{opacity:1;transform:translateY(0)}}::slotted([data-ui-toast][aria-hidden='true']){display:none}::slotted([data-ui-toast-dismiss]){border:0;background:transparent;color:var(--ui-text-secondary);cursor:pointer;font:inherit}";export{n as ui_toast_region}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,g as i,h as s,H as e}from"./p-CEeiinfk.js";import{o,c as r,r as a}from"./p-PM9a74r7.js";import{d as h}from"./p-JwSoedEO.js";import{a as n}from"./p-Bu0dmLBE.js";const l=class{constructor(i){t(this,i)}get host(){return i(this)}for="";open=!1;defaultOpen=!1;placement="top-start";showDelay=500;hideDelay=100;internalOpen=!1;overlayId=`ui-tooltip-${Math.random().toString(36).slice(2,11)}`;trigger=null;surface=null;showTimer=null;hideTimer=null;syncFromProp(){this.clearTimers(),this.internalOpen=this.open}resetSurface(){this.syncTrigger(),this.setupSurface(),this.syncOverlay()}syncOverlay(){this.internalOpen?(this.surface?.show(),o({id:this.overlayId,modal:!1,element:this.host,relatedElements:this.trigger?[this.trigger]:void 0,dismissible:!0,requestClose:(t,i)=>this.handleRequestClose(t,i)})):(this.surface?.hide(),r(this.overlayId))}componentDidLoad(){this.syncFromProp(),this.internalOpen=this.internalOpen||this.defaultOpen,this.syncTrigger(),this.setupSurface(),this.host.addEventListener("keydown",this.onKeydown),this.syncOverlay()}componentDidUpdate(){this.syncTrigger()}disconnectedCallback(){this.clearTimers(),this.detachTriggerListeners(),this.surface?.destroy(),this.surface=null,this.host.removeEventListener("keydown",this.onKeydown),r(this.overlayId)}syncTrigger(){const t=this.for?this.host.ownerDocument.getElementById(this.for):this.host.previousElementSibling;t!==this.trigger&&(this.detachTriggerListeners(),this.trigger=t,this.attachTriggerListeners(),this.surface?.setAnchor(t))}setupSurface(){this.surface?.destroy(),this.surface=n(this.host,{anchor:this.trigger,placement:this.placement})}attachTriggerListeners(){this.detachTriggerListeners(),this.trigger&&(this.trigger.addEventListener("pointerenter",this.onTriggerEnter),this.trigger.addEventListener("pointerleave",this.onTriggerLeave),this.trigger.addEventListener("focusin",this.onTriggerFocusIn),this.trigger.addEventListener("focusout",this.onTriggerFocusOut))}detachTriggerListeners(){this.trigger&&(this.trigger.removeEventListener("pointerenter",this.onTriggerEnter),this.trigger.removeEventListener("pointerleave",this.onTriggerLeave),this.trigger.removeEventListener("focusin",this.onTriggerFocusIn),this.trigger.removeEventListener("focusout",this.onTriggerFocusOut))}clearShowTimer(){null!==this.showTimer&&(clearTimeout(this.showTimer),this.showTimer=null)}clearHideTimer(){null!==this.hideTimer&&(clearTimeout(this.hideTimer),this.hideTimer=null)}clearTimers(){this.clearShowTimer(),this.clearHideTimer()}setInteractionOpen(t,i){this.internalOpen!==t&&(this.internalOpen=t,h(this.host,t?"open":"close",{open:t,reason:"action",trigger:i}))}onTriggerEnter=()=>{this.clearHideTimer(),this.internalOpen||null!==this.showTimer||(this.showTimer=setTimeout((()=>{this.showTimer=null,this.setInteractionOpen(!0,"pointer")}),Math.max(0,this.showDelay)))};onTriggerLeave=()=>{this.clearShowTimer(),this.internalOpen&&null===this.hideTimer&&(this.hideTimer=setTimeout((()=>{this.hideTimer=null,this.setInteractionOpen(!1,"pointer")}),Math.max(0,this.hideDelay)))};onTriggerFocusIn=()=>{this.clearTimers(),this.setInteractionOpen(!0,"keyboard")};onTriggerFocusOut=t=>{const i=t.relatedTarget;i&&this.host.contains(i)||(this.clearTimers(),this.setInteractionOpen(!1,"keyboard"))};handleRequestClose(t,i){"escape"===t&&(this.clearTimers(),this.internalOpen=!1,h(this.host,"close",{open:!1,reason:"escape",trigger:i}),this.trigger?.focus())}onKeydown=t=>{"Escape"===t.key&&a("escape","keyboard")};render(){return s(e,{key:"4c3890a7371508ede06a5b370d1cec32db25280f",role:"tooltip",hidden:!this.internalOpen,"data-open":this.internalOpen?"":void 0,onKeyDown:this.onKeydown},s("slot",{key:"2e3bcd0dc69b0c3e3376d73dc4efc82e4f4cfaaa"}))}static get watchers(){return{open:[{syncFromProp:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}],internalOpen:[{syncOverlay:0}]}}};l.style=":host{position:fixed;inset:auto;margin:0;display:inline-block;border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-2);background:var(--ui-surface-elevated);color:var(--ui-text-primary);padding:var(--ui-space-2) var(--ui-space-3);font-size:var(--ui-font-size-sm);box-shadow:var(--ui-shadow-md);opacity:0;transform:translateY(4px);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}:host(:popover-open){opacity:1;transform:translateY(0)}@starting-style{:host(:popover-open){opacity:0;transform:translateY(4px)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host{transition:none}}";export{l as ui_tooltip}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t=16;let n=0;const o=new WeakMap;function a(t){try{return t.matches(":popover-open")}catch{return!t.hidden}}function i(t){if(t.setAttribute("popover","manual"),t.hidden=!1,"function"==typeof t.showPopover&&!a(t))try{t.showPopover()}catch{}}function e(t){if("function"==typeof t.hidePopover&&a(t))try{t.hidePopover()}catch{}t.hidden=!0}function r(t){return t.setAttribute("popover","manual"),t.dataset.uiPositioning="viewport",{show(){i(t)},hide(){e(t)},destroy(){e(t)}}}function l(t,n,o,a,i){const e=u(t.ownerDocument.defaultView??window),r=t.getBoundingClientRect(),l=o.startsWith("top"),c=o.endsWith("end"),s=e.bottom-n.bottom-i,h=n.top-e.top-i,p=(l?!(h<r.height+a&&s>h):s<r.height+a&&h>s)?n.top-r.height-a:n.bottom+a,f=c?n.right-r.width:n.left,d=function(t,n=u(),o=0){const a=Math.max(0,n.width-2*o),i=Math.max(0,n.height-2*o),e=t.width>a?n.left+o:Math.min(Math.max(t.left,n.left+o),n.right-o-t.width),r=t.height>i?n.top+o:Math.min(Math.max(t.top,n.top+o),n.bottom-o-t.height);return{x:e-t.left,y:r-t.top}}({left:f,top:p,width:r.width,height:r.height},e,i);t.style.left=`${Math.round(f+d.x)}px`,t.style.top=`${Math.round(p+d.y)}px`,t.style.right="auto",t.style.bottom="auto"}function c(t,a={}){const r=t.ownerDocument.defaultView??window,c=a.placement??"bottom-start",u=Math.max(0,a.gap??4),s=Math.max(0,a.viewportGap??8),h=function(t){const n=t.CSS;return"function"==typeof n?.supports&&n.supports("anchor-name: --ui-anchor-test")&&n.supports("position-anchor: --ui-anchor-test")&&n.supports("top: anchor(bottom)")}(r),p="--ui-anchor-"+ ++n;let f=a.anchor??null,d=null,m=!1,g=null,y=null;t.setAttribute("popover","manual"),t.dataset.uiPositioning=h?"anchor":"fallback",t.style.position="fixed",t.style.margin="0";const w=n=>{f&&function(t,n){const a=o.get(t);if(a)if(a.names.delete(n),a.names.size){const n=[a.original,...a.names].filter(Boolean);t.style.setProperty("anchor-name",n.join(", "))}else a.original?t.style.setProperty("anchor-name",a.original):t.style.removeProperty("anchor-name"),o.delete(t)}(f,p),f=n,f?(function(t,n){const a=o.get(t)??{original:t.style.getPropertyValue("anchor-name"),names:new Set};a.names.add(n),o.set(t,a);const i=[a.original,...a.names].filter(Boolean);t.style.setProperty("anchor-name",i.join(", "))}(f,p),t.style.setProperty("position-anchor",p)):t.style.removeProperty("position-anchor")},v=()=>{g=null,m&&(d?l(t,{left:d.x,right:d.x,top:d.y,bottom:d.y},"bottom-start",u,s):f&&(h?(()=>{const n=c.startsWith("bottom"),o=c.endsWith("end");t.style.top=n?`calc(anchor(bottom) + ${u}px)`:"auto",t.style.bottom=n?"auto":`calc(anchor(top) + ${u}px)`,t.style.left=o?"auto":"anchor(left)",t.style.right=o?"anchor(right)":"auto",t.style.setProperty("position-try-fallbacks","flip-block, flip-inline")})():l(t,f.getBoundingClientRect(),c,u,s)))},b=()=>{m&&null===g&&(g=r.requestAnimationFrame(v))},M=()=>{if(!m||null===d&&h)return y?.abort(),void(y=null);if(y)return;y=new AbortController;const t=y.signal;r.addEventListener("resize",b,{passive:!0,signal:t}),r.addEventListener("scroll",b,{passive:!0,capture:!0,signal:t}),r.visualViewport?.addEventListener("resize",b,{passive:!0,signal:t}),r.visualViewport?.addEventListener("scroll",b,{passive:!0,signal:t})};return w(f),{setAnchor(t){d=null,w(t),M(),b()},show(){d=null,m=!0,M(),i(t),v()},showAtPoint(n){d=n,m=!0,M(),i(t),v()},hide(){m=!1,d=null,M(),null!==g&&r.cancelAnimationFrame(g),g=null,e(t)},refresh:b,destroy(){m=!1,y?.abort(),y=null,null!==g&&r.cancelAnimationFrame(g),g=null,e(t),w(null)}}}function u(t=window){const n=t.visualViewport,o=n?.offsetLeft??0,a=n?.offsetTop??0,i=n?.width??t.innerWidth,e=n?.height??t.innerHeight;return{left:o,top:a,right:o+i,bottom:a+e,width:i,height:e}}function s(t,n){const o=Math.max(n.left-t.x,0,t.x-n.right),a=Math.max(n.top-t.y,0,t.y-n.bottom);return Math.hypot(o,a)}function h(t,n={}){const o=t.ownerDocument.defaultView??window,a=n.pointerTarget??t,i=n.anchorSelector??"[data-ui-affordance]",e=n.nearRadius??16,r=Number.isFinite(e)?Math.max(0,e):16,l=new AbortController;let c=[],u=null,h=null,p=!1;const f=()=>{for(const{element:t}of c)t.hasAttribute("data-ui-proximity")&&t.removeAttribute("data-ui-proximity");t.hasAttribute("data-ui-interaction")&&t.removeAttribute("data-ui-interaction")},d=()=>{c=Array.from(t.querySelectorAll(i)).filter((t=>!t.hasAttribute("disabled")&&"true"!==t.getAttribute("aria-disabled"))).map((t=>({element:t,rect:t.getBoundingClientRect()}))),p=!1},m=()=>{if(u=null,p&&d(),!h)return void f();let n=!1;for(const t of c){const o=s(h,t.rect)<=r;o&&"near"!==t.element.getAttribute("data-ui-proximity")?t.element.setAttribute("data-ui-proximity","near"):!o&&t.element.hasAttribute("data-ui-proximity")&&t.element.removeAttribute("data-ui-proximity"),n||=o}n&&"engaged"!==t.getAttribute("data-ui-interaction")?t.setAttribute("data-ui-interaction","engaged"):!n&&t.hasAttribute("data-ui-interaction")&&t.removeAttribute("data-ui-interaction")},g=()=>{null===u&&(u=o.requestAnimationFrame(m))},y=()=>{p=!0,g()};return a.addEventListener("pointermove",(t=>{h="touch"===t.pointerType?null:{x:t.clientX,y:t.clientY},g()}),{passive:!0,signal:l.signal}),o.addEventListener("resize",y,{passive:!0,signal:l.signal}),o.addEventListener("scroll",y,{passive:!0,capture:!0,signal:l.signal}),o.visualViewport?.addEventListener("resize",y,{passive:!0,signal:l.signal}),o.visualViewport?.addEventListener("scroll",y,{passive:!0,signal:l.signal}),d(),{refresh:y,destroy(){l.abort(),null!==u&&o.cancelAnimationFrame(u),u=null,h=null,f(),c=[]}}}export{t as D,c as a,r as b,h as c}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const n=[],t="data-ui-scroll-lock";let e=0,o=!1;function c(){if("undefined"==typeof document)return;const n=document.documentElement;if(e>0)return n.setAttribute(t,"true"),void(n.style.overflow="hidden");n.removeAttribute(t),n.style.removeProperty("overflow")}function i(n){return n.dismissible??!0}function u(n){"Escape"===n.key&&a("escape","keyboard")}function r(n){const t=s();if(!t||!i(t))return;const e=n.target;if(e instanceof Node){if(t.element.contains(e))return;if(t.relatedElements?.some((n=>n.contains(e))))return}a("light-dismiss","pointer")}function d(t){f(t.id),n.push(t),t.modal&&(e+=1,c()),o||"undefined"==typeof document||(document.addEventListener("keydown",u),document.addEventListener("pointerdown",r,{capture:!0}),o=!0)}function f(t){const i=n.findIndex((n=>n.id===t));if(i>=0){const[t]=n.splice(i,1);t?.modal&&(e=Math.max(0,e-1),c())}!o||n.length>0||"undefined"==typeof document||(document.removeEventListener("keydown",u),document.removeEventListener("pointerdown",r,{capture:!0}),o=!1)}function s(){return n.at(-1)}function a(n,t){const e=s();return!!e&&!!(i(e)||"escape"!==n&&"light-dismiss"!==n)&&(e.requestClose(n,t),!0)}export{f as c,d as o,a as r}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,g as i,h as e,H as s}from"./p-CEeiinfk.js";import{o as n,c as a,r as o}from"./p-PM9a74r7.js";import{d as r}from"./p-JwSoedEO.js";import{a as h}from"./p-Bu0dmLBE.js";const c=class{constructor(i){t(this,i)}get host(){return i(this)}open=!1;defaultOpen=!1;for;internalOpen=!1;overlayId=`ui-context-menu-${Math.random().toString(36).slice(2,11)}`;trigger=null;contextTarget=null;pointerX=0;pointerY=0;pointPositioned=!1;surface=null;syncFromProp(){this.internalOpen=this.open}syncTarget(){this.resolveTargets(),this.attachTargetListeners()}syncOverlay(){this.syncTriggerState(),this.internalOpen?(this.pointPositioned?this.surface?.showAtPoint({x:this.pointerX,y:this.pointerY}):this.surface?.show(),n({id:this.overlayId,modal:!1,element:this.host,dismissible:!0,requestClose:(t,i)=>this.closeMenu(t,i)})):(this.surface?.hide(),a(this.overlayId))}componentDidLoad(){this.syncFromProp(),this.internalOpen=this.internalOpen||this.defaultOpen,this.resolveTargets(),this.attachTargetListeners(),this.setupSurface(),this.syncTriggerState(),this.syncOverlay()}componentDidUpdate(){this.resolveTargets(),this.attachTargetListeners(),this.pointPositioned||this.surface?.setAnchor(this.trigger),this.syncTriggerState()}disconnectedCallback(){this.detachTargetListeners(),this.surface?.destroy(),this.surface=null,a(this.overlayId)}setupSurface(){const t=this.host.shadowRoot?.querySelector(".menu");t&&(this.surface?.destroy(),this.surface=h(t,{anchor:this.trigger,placement:"bottom-start"}))}resolveTargets(){const t=this.trigger,i=this.contextTarget,e=this.host.querySelector('[slot="trigger"]'),s=this.for?document.getElementById(this.for):null;this.trigger=e,this.contextTarget=s??e??this.host.parentElement,t===this.trigger&&i===this.contextTarget||(t?.removeEventListener("click",this.onTriggerClick),t?.removeEventListener("keydown",this.onTriggerKeydown),i?.removeEventListener("contextmenu",this.onContextMenu))}attachTargetListeners(){this.detachTargetListeners(),this.trigger?.addEventListener("click",this.onTriggerClick),this.trigger?.addEventListener("keydown",this.onTriggerKeydown),this.contextTarget?.addEventListener("contextmenu",this.onContextMenu)}detachTargetListeners(){this.trigger?.removeEventListener("click",this.onTriggerClick),this.trigger?.removeEventListener("keydown",this.onTriggerKeydown),this.contextTarget?.removeEventListener("contextmenu",this.onContextMenu)}syncTriggerState(){this.trigger&&(this.trigger.setAttribute("aria-haspopup","menu"),this.trigger.setAttribute("aria-expanded",this.internalOpen?"true":"false"))}getItems(){return Array.from(this.host.querySelectorAll("ui-menu-item")).filter((t=>!this.isItemDisabled(t)))}focusFirstItem(){requestAnimationFrame((()=>this.getItems()[0]?.focus()))}openMenu(t,i,e){this.pointerX=t,this.pointerY=i,this.pointPositioned=!0,this.surface?.showAtPoint({x:t,y:i}),this.internalOpen=!0,r(this.host,"open",{open:!0,reason:"action",trigger:e}),this.focusFirstItem()}openFromTrigger(t){this.trigger&&(this.pointPositioned=!1,this.internalOpen=!0,r(this.host,"open",{open:!0,reason:"action",trigger:t}),this.focusFirstItem())}closeMenu(t,i,e=!0){this.internalOpen&&(this.internalOpen=!1,r(this.host,"close",{open:!1,reason:t,trigger:i}),e&&this.trigger?.focus())}onTriggerClick=t=>{this.internalOpen?this.closeMenu("action",0===t.detail?"keyboard":"pointer"):this.openFromTrigger(0===t.detail?"keyboard":"pointer")};onTriggerKeydown=t=>{"Enter"!==t.key&&" "!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),this.internalOpen?this.focusFirstItem():this.openFromTrigger("keyboard"))};onContextMenu=t=>{t.preventDefault(),this.openMenu(t.clientX,t.clientY,"pointer")};isItemDisabled(t){return"true"===t.getAttribute("aria-disabled")||t.hasAttribute("disabled")||"true"===t.getAttribute("disabled")||!0===t.disabled}onKeydown=t=>{if(this.internalOpen){if("Escape"===t.key)return t.preventDefault(),void o("escape","keyboard");if("Enter"===t.key||" "===t.key){const i=t.target.closest?.("ui-menu-item");if(!i||this.isItemDisabled(i))return;t.preventDefault();const e=i.getAttribute("value")??i.getAttribute("data-value")??"";r(this.host,"select",{value:e,trigger:"keyboard"}),this.closeMenu("action","keyboard")}}};onItemClick=t=>{const i=t.target.closest?.("ui-menu-item");if(!i||this.isItemDisabled(i))return;const e=i.getAttribute("value")??i.getAttribute("data-value")??"";r(this.host,"select",{value:e,trigger:"pointer"}),this.closeMenu("action","pointer")};render(){return e(s,{key:"aee76fad23434fb3cdaf885c698f62237c2a9468","data-open":this.internalOpen?"":void 0,onKeyDown:this.onKeydown,onClick:this.onItemClick},e("slot",{key:"da047f870b7a93f1acbba5fa1628b5cb66139d99",name:"trigger"}),e("div",{key:"388a473ac7fb626a20d0feda14f0d8dd16f6ab94",class:"menu","data-open":this.internalOpen?"":void 0},e("ui-menu",{key:"67ca5c05ff40d2dd1d5f17a8634636503f98c02d",open:this.internalOpen},e("slot",{key:"b7c7dfac4342afa1df67459e94de7ac7dca4a251"}))))}static get watchers(){return{open:[{syncFromProp:0}],for:[{syncTarget:0}],internalOpen:[{syncOverlay:0}]}}};c.style=":host{display:contents}.menu{position:fixed;inset:auto;margin:0;z-index:var(--ui-z-overlay, 1000);min-width:12rem;opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}.menu:popover-open{opacity:1;transform:translateY(0) scale(1)}@starting-style{.menu:popover-open{opacity:0;transform:translateY(-4px) scale(0.99)}}.menu[hidden]{display:none !important}@media (prefers-reduced-motion: reduce){.menu{transition:none}}";export{c as ui_context_menu}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,g as e,h as o,H as s}from"./p-CEeiinfk.js";import{o as i,c as a,r}from"./p-PM9a74r7.js";import{d as n}from"./p-JwSoedEO.js";import{a as p}from"./p-Bu0dmLBE.js";const h=class{constructor(e){t(this,e)}get host(){return e(this)}open=!1;defaultOpen=!1;for;placement="bottom-start";internalOpen=!1;overlayId=`ui-popover-${Math.random().toString(36).slice(2,11)}`;anchor=null;surface=null;syncFromProp(){this.internalOpen=this.open}onOpenChange(){this.syncOverlay(),this.internalOpen?n(this.host,"open",{open:!0,reason:"programmatic",trigger:"programmatic"}):n(this.host,"close",{open:!1,reason:"programmatic",trigger:"programmatic"})}resetSurface(){this.setupSurface(),this.syncSurface()}setupSurface(){this.surface?.destroy(),this.surface=null,this.anchor=this.for?this.host.ownerDocument.getElementById(this.for):null,this.anchor&&(this.surface=p(this.host,{anchor:this.anchor,placement:this.placement}))}syncSurface(){this.surface&&(this.internalOpen?this.surface.show():this.surface.hide())}syncOverlay(){this.syncSurface(),this.internalOpen?i({id:this.overlayId,modal:!1,element:this.host,relatedElements:this.anchor?[this.anchor]:void 0,dismissible:!0,requestClose:(t,e)=>this.handleRequestClose(t,e)}):a(this.overlayId)}componentDidLoad(){this.syncFromProp(),this.internalOpen=this.internalOpen||this.defaultOpen,this.host.addEventListener("keydown",this.onKeydown),this.setupSurface(),this.syncOverlay()}disconnectedCallback(){this.host.removeEventListener("keydown",this.onKeydown),this.surface?.destroy(),this.surface=null,a(this.overlayId)}componentDidUpdate(){this.syncOverlay()}handleRequestClose(t,e){this.internalOpen=!1,n(this.host,"close",{open:!1,reason:t,trigger:e})}onKeydown=t=>{"Escape"===t.key&&r("escape","keyboard")};render(){return o(s,{key:"8e45be54147ff8f76a0d5e7fd875c3f4cf5ac40a","data-open":this.internalOpen?"":void 0,onKeyDown:this.onKeydown},o("slot",{key:"3141729cd32c8dcdaec1fbd763eb034242563c8f"}))}static get watchers(){return{open:[{syncFromProp:0}],internalOpen:[{onOpenChange:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}]}}};h.style=":host{--ui-popover-viewport-gap:var(--ui-space-2, 0.5rem);padding:var(--ui-space-3);background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3);box-shadow:var(--ui-shadow-lg);max-inline-size:min( 20rem, calc(100vw - (var(--ui-popover-viewport-gap) * 2)) );max-block-size:calc(100dvh - (var(--ui-popover-viewport-gap) * 2));overflow:auto}:host(:not([data-open])){display:none}:host([popover]){position:fixed;inset:auto;margin:0;opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}:host([popover]:popover-open){opacity:1;transform:translateY(0) scale(1)}@starting-style{:host([popover]:popover-open){opacity:0;transform:translateY(-4px) scale(0.99)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host([popover]){transition:none}}";export{h as ui_popover}
|