@threadlabs/looma 0.1.16 → 0.1.18
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/README.md +2 -1
- package/dist/{chunk-SVINNT3E.js → chunk-DTQVRGVL.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 +43 -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 +21 -4
- package/dist/collection/components/ui-context-menu/ui-context-menu.js +43 -4
- 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 +43 -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 +779 -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-063f5a89.entry.js +1 -0
- 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-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 +6 -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-2W7ZKAGK.js +54 -0
- package/dist/{ui-avatar-group.entry-DQDP325O.js → ui-avatar-group.entry-SE5JG2FT.js} +1 -1
- package/dist/{ui-avatar.entry-WYIDMOFE.js → ui-avatar.entry-46JDI25A.js} +1 -1
- package/dist/{ui-badge.entry-VGHXPEDT.js → ui-badge.entry-U7G3MEC5.js} +1 -1
- package/dist/{ui-button.entry-LKPLOJ22.js → ui-button.entry-DELD6KMH.js} +1 -1
- package/dist/{ui-checkbox.entry-J74HEA22.js → ui-checkbox.entry-ZUG2P642.js} +1 -1
- package/dist/{ui-context-menu.entry-MQM2FCLI.js → ui-context-menu.entry-L4HTK3PV.js} +43 -6
- package/dist/{ui-dialog.entry-DQMMDO4Z.js → ui-dialog.entry-TQPYD2YI.js} +2 -2
- package/dist/{ui-disclosure.entry-ONF7UZDC.js → ui-disclosure.entry-23TII4YU.js} +1 -1
- package/dist/{ui-floating-action-button.entry-FKTGVC5T.js → ui-floating-action-button.entry-FOQYAFJI.js} +1 -1
- package/dist/{ui-form-field.entry-M3ISWQNU.js → ui-form-field.entry-SCPG4STY.js} +1 -1
- package/dist/{ui-icon-button.entry-AWFIQUHM.js → ui-icon-button.entry-U45ZVAC3.js} +1 -1
- package/dist/{ui-input.entry-JZ6RETMT.js → ui-input.entry-3AIA3G4C.js} +1 -1
- package/dist/{ui-menu-item.entry-5MFR5LFL.js → ui-menu-item.entry-3QO5TG2J.js} +1 -1
- package/dist/ui-menu.entry-JACWGDDG.js +184 -0
- package/dist/{ui-popover.entry-ELCMKO6Y.js → ui-popover.entry-2XP4H3S2.js} +46 -4
- package/dist/{ui-radio-group.entry-RJHUPPEM.js → ui-radio-group.entry-73IKFMDK.js} +1 -1
- package/dist/{ui-radio.entry-3VRDPOY4.js → ui-radio.entry-INJVXUKE.js} +1 -1
- package/dist/{ui-search-result-row.entry-J34YPAV7.js → ui-search-result-row.entry-4J732TDC.js} +1 -1
- package/dist/{ui-search-shell.entry-IJ4UUP27.js → ui-search-shell.entry-3C2WRVE2.js} +1 -1
- package/dist/{ui-select.entry-C6YD3HQ5.js → ui-select.entry-3ZLDGAKX.js} +1 -1
- package/dist/{ui-switch.entry-UZDF5QTI.js → ui-switch.entry-5MJRLR2P.js} +1 -1
- package/dist/{ui-tabs.entry-YRAKWOMR.js → ui-tabs.entry-F5H7OPBO.js} +1 -1
- package/dist/{ui-textarea.entry-JLDKFT3K.js → ui-textarea.entry-BNJ375JB.js} +1 -1
- package/dist/{ui-toast-region.entry-GC7C7KXF.js → ui-toast-region.entry-ZUIPJ2JH.js} +20 -3
- package/dist/ui-tooltip.entry-DZ4RMF35.js +214 -0
- package/dist/{ui-top-bar.entry-5W5UA5KV.js → ui-top-bar.entry-VKRXIUU6.js} +1 -1
- package/dist/{ui-tree-item.entry-3LM7IXIK.js → ui-tree-item.entry-NFUQ45OL.js} +2 -2
- package/dist/{ui-tree.entry-X4FU42A6.js → ui-tree.entry-H4CWDYI6.js} +1 -1
- package/editor/{chunk-RTHHTPWK.js → chunk-3QMBK3XZ.js} +245 -41
- package/editor/{chunk-OHD4OS32.js → chunk-OXFYYLUC.js} +632 -236
- package/editor/{chunk-CX4QDKSV.js → chunk-ZOUKEZ77.js} +21 -1
- package/editor/extensions/index.d.ts +49 -1
- package/editor/extensions/index.js +15 -3
- package/editor/index.d.ts +3 -2
- package/editor/index.js +16 -4
- package/editor/ui.d.ts +9 -1
- package/editor/ui.js +2 -2
- package/editor.css +173 -4
- package/package.json +1 -1
- package/styles.css +1 -7
- package/tokens.css +14 -2
- package/vue/editor/index.d.ts +103 -4
- package/vue/editor/index.js +199 -114
- 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.cjs
CHANGED
|
@@ -24,11 +24,243 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
24
24
|
};
|
|
25
25
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
26
|
|
|
27
|
-
// dist/esm/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
// dist/esm/positioning-Bu0dmLBE.js
|
|
28
|
+
function bindAnchorName(anchor, name) {
|
|
29
|
+
const binding = anchorBindings.get(anchor) ?? {
|
|
30
|
+
original: anchor.style.getPropertyValue("anchor-name"),
|
|
31
|
+
names: /* @__PURE__ */ new Set()
|
|
32
|
+
};
|
|
33
|
+
binding.names.add(name);
|
|
34
|
+
anchorBindings.set(anchor, binding);
|
|
35
|
+
const values = [binding.original, ...binding.names].filter(Boolean);
|
|
36
|
+
anchor.style.setProperty("anchor-name", values.join(", "));
|
|
37
|
+
}
|
|
38
|
+
function unbindAnchorName(anchor, name) {
|
|
39
|
+
const binding = anchorBindings.get(anchor);
|
|
40
|
+
if (!binding)
|
|
41
|
+
return;
|
|
42
|
+
binding.names.delete(name);
|
|
43
|
+
if (binding.names.size) {
|
|
44
|
+
const values = [binding.original, ...binding.names].filter(Boolean);
|
|
45
|
+
anchor.style.setProperty("anchor-name", values.join(", "));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (binding.original)
|
|
49
|
+
anchor.style.setProperty("anchor-name", binding.original);
|
|
50
|
+
else
|
|
51
|
+
anchor.style.removeProperty("anchor-name");
|
|
52
|
+
anchorBindings.delete(anchor);
|
|
53
|
+
}
|
|
54
|
+
function supportsAnchorPositioning(owner) {
|
|
55
|
+
const css = owner.CSS;
|
|
56
|
+
return typeof css?.supports === "function" && css.supports("anchor-name: --ui-anchor-test") && css.supports("position-anchor: --ui-anchor-test") && css.supports("top: anchor(bottom)");
|
|
57
|
+
}
|
|
58
|
+
function topLayerOpen(surface) {
|
|
59
|
+
try {
|
|
60
|
+
return surface.matches(":popover-open");
|
|
61
|
+
} catch {
|
|
62
|
+
return !surface.hidden;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function showInTopLayer(surface) {
|
|
66
|
+
surface.setAttribute("popover", "manual");
|
|
67
|
+
surface.hidden = false;
|
|
68
|
+
if (typeof surface.showPopover === "function" && !topLayerOpen(surface)) {
|
|
69
|
+
try {
|
|
70
|
+
surface.showPopover();
|
|
71
|
+
} catch {
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function hideFromTopLayer(surface) {
|
|
76
|
+
if (typeof surface.hidePopover === "function" && topLayerOpen(surface)) {
|
|
77
|
+
try {
|
|
78
|
+
surface.hidePopover();
|
|
79
|
+
} catch {
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
surface.hidden = true;
|
|
83
|
+
}
|
|
84
|
+
function createViewportSurface(surface) {
|
|
85
|
+
surface.setAttribute("popover", "manual");
|
|
86
|
+
surface.dataset.uiPositioning = "viewport";
|
|
87
|
+
return {
|
|
88
|
+
show() {
|
|
89
|
+
showInTopLayer(surface);
|
|
90
|
+
},
|
|
91
|
+
hide() {
|
|
92
|
+
hideFromTopLayer(surface);
|
|
93
|
+
},
|
|
94
|
+
destroy() {
|
|
95
|
+
hideFromTopLayer(surface);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function fallbackPosition(surface, anchor, placement, gap, viewportGap) {
|
|
100
|
+
const owner = surface.ownerDocument.defaultView ?? window;
|
|
101
|
+
const viewport = getVisualViewportRect(owner);
|
|
102
|
+
const rect = surface.getBoundingClientRect();
|
|
103
|
+
const preferTop = placement.startsWith("top");
|
|
104
|
+
const preferEnd = placement.endsWith("end");
|
|
105
|
+
const spaceBelow = viewport.bottom - anchor.bottom - viewportGap;
|
|
106
|
+
const spaceAbove = anchor.top - viewport.top - viewportGap;
|
|
107
|
+
const useTop = preferTop ? !(spaceAbove < rect.height + gap && spaceBelow > spaceAbove) : spaceBelow < rect.height + gap && spaceAbove > spaceBelow;
|
|
108
|
+
const unclampedTop = useTop ? anchor.top - rect.height - gap : anchor.bottom + gap;
|
|
109
|
+
const unclampedLeft = preferEnd ? anchor.right - rect.width : anchor.left;
|
|
110
|
+
const shifted = clampRectToViewport({
|
|
111
|
+
left: unclampedLeft,
|
|
112
|
+
top: unclampedTop,
|
|
113
|
+
width: rect.width,
|
|
114
|
+
height: rect.height
|
|
115
|
+
}, viewport, viewportGap);
|
|
116
|
+
surface.style.left = `${Math.round(unclampedLeft + shifted.x)}px`;
|
|
117
|
+
surface.style.top = `${Math.round(unclampedTop + shifted.y)}px`;
|
|
118
|
+
surface.style.right = "auto";
|
|
119
|
+
surface.style.bottom = "auto";
|
|
120
|
+
}
|
|
121
|
+
function createAnchoredSurface(surface, options = {}) {
|
|
122
|
+
const owner = surface.ownerDocument.defaultView ?? window;
|
|
123
|
+
const placement = options.placement ?? "bottom-start";
|
|
124
|
+
const gap = Math.max(0, options.gap ?? 4);
|
|
125
|
+
const viewportGap = Math.max(0, options.viewportGap ?? 8);
|
|
126
|
+
const nativeAnchor = supportsAnchorPositioning(owner);
|
|
127
|
+
const anchorName = `--ui-anchor-${++anchorSequence}`;
|
|
128
|
+
let anchor = options.anchor ?? null;
|
|
129
|
+
let point = null;
|
|
130
|
+
let open = false;
|
|
131
|
+
let frame = null;
|
|
132
|
+
let listenerAbort = null;
|
|
133
|
+
surface.setAttribute("popover", "manual");
|
|
134
|
+
surface.dataset.uiPositioning = nativeAnchor ? "anchor" : "fallback";
|
|
135
|
+
surface.style.position = "fixed";
|
|
136
|
+
surface.style.margin = "0";
|
|
137
|
+
const bindAnchor = (next) => {
|
|
138
|
+
if (anchor)
|
|
139
|
+
unbindAnchorName(anchor, anchorName);
|
|
140
|
+
anchor = next;
|
|
141
|
+
if (!anchor) {
|
|
142
|
+
surface.style.removeProperty("position-anchor");
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
bindAnchorName(anchor, anchorName);
|
|
146
|
+
surface.style.setProperty("position-anchor", anchorName);
|
|
147
|
+
};
|
|
148
|
+
const positionNative = () => {
|
|
149
|
+
const blockEnd = placement.startsWith("bottom");
|
|
150
|
+
const inlineEnd = placement.endsWith("end");
|
|
151
|
+
surface.style.top = blockEnd ? `calc(anchor(bottom) + ${gap}px)` : "auto";
|
|
152
|
+
surface.style.bottom = blockEnd ? "auto" : `calc(anchor(top) + ${gap}px)`;
|
|
153
|
+
surface.style.left = inlineEnd ? "auto" : "anchor(left)";
|
|
154
|
+
surface.style.right = inlineEnd ? "anchor(right)" : "auto";
|
|
155
|
+
surface.style.setProperty("position-try-fallbacks", "flip-block, flip-inline");
|
|
156
|
+
};
|
|
157
|
+
const position = () => {
|
|
158
|
+
frame = null;
|
|
159
|
+
if (!open)
|
|
160
|
+
return;
|
|
161
|
+
if (point) {
|
|
162
|
+
fallbackPosition(surface, {
|
|
163
|
+
left: point.x,
|
|
164
|
+
right: point.x,
|
|
165
|
+
top: point.y,
|
|
166
|
+
bottom: point.y
|
|
167
|
+
}, "bottom-start", gap, viewportGap);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (!anchor)
|
|
171
|
+
return;
|
|
172
|
+
if (nativeAnchor)
|
|
173
|
+
positionNative();
|
|
174
|
+
else
|
|
175
|
+
fallbackPosition(surface, anchor.getBoundingClientRect(), placement, gap, viewportGap);
|
|
176
|
+
};
|
|
177
|
+
const schedule = () => {
|
|
178
|
+
if (!open || frame !== null)
|
|
179
|
+
return;
|
|
180
|
+
frame = owner.requestAnimationFrame(position);
|
|
181
|
+
};
|
|
182
|
+
const syncFallbackListeners = () => {
|
|
183
|
+
const needsListeners = open && (point !== null || !nativeAnchor);
|
|
184
|
+
if (!needsListeners) {
|
|
185
|
+
listenerAbort?.abort();
|
|
186
|
+
listenerAbort = null;
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
if (listenerAbort)
|
|
190
|
+
return;
|
|
191
|
+
listenerAbort = new AbortController();
|
|
192
|
+
const signal = listenerAbort.signal;
|
|
193
|
+
owner.addEventListener("resize", schedule, { passive: true, signal });
|
|
194
|
+
owner.addEventListener("scroll", schedule, { passive: true, capture: true, signal });
|
|
195
|
+
owner.visualViewport?.addEventListener("resize", schedule, { passive: true, signal });
|
|
196
|
+
owner.visualViewport?.addEventListener("scroll", schedule, { passive: true, signal });
|
|
197
|
+
};
|
|
198
|
+
bindAnchor(anchor);
|
|
199
|
+
return {
|
|
200
|
+
setAnchor(next) {
|
|
201
|
+
point = null;
|
|
202
|
+
bindAnchor(next);
|
|
203
|
+
syncFallbackListeners();
|
|
204
|
+
schedule();
|
|
205
|
+
},
|
|
206
|
+
show() {
|
|
207
|
+
point = null;
|
|
208
|
+
open = true;
|
|
209
|
+
syncFallbackListeners();
|
|
210
|
+
showInTopLayer(surface);
|
|
211
|
+
position();
|
|
212
|
+
},
|
|
213
|
+
showAtPoint(nextPoint) {
|
|
214
|
+
point = nextPoint;
|
|
215
|
+
open = true;
|
|
216
|
+
syncFallbackListeners();
|
|
217
|
+
showInTopLayer(surface);
|
|
218
|
+
position();
|
|
219
|
+
},
|
|
220
|
+
hide() {
|
|
221
|
+
open = false;
|
|
222
|
+
point = null;
|
|
223
|
+
syncFallbackListeners();
|
|
224
|
+
if (frame !== null)
|
|
225
|
+
owner.cancelAnimationFrame(frame);
|
|
226
|
+
frame = null;
|
|
227
|
+
hideFromTopLayer(surface);
|
|
228
|
+
},
|
|
229
|
+
refresh: schedule,
|
|
230
|
+
destroy() {
|
|
231
|
+
open = false;
|
|
232
|
+
listenerAbort?.abort();
|
|
233
|
+
listenerAbort = null;
|
|
234
|
+
if (frame !== null)
|
|
235
|
+
owner.cancelAnimationFrame(frame);
|
|
236
|
+
frame = null;
|
|
237
|
+
hideFromTopLayer(surface);
|
|
238
|
+
bindAnchor(null);
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
function getVisualViewportRect(owner = window) {
|
|
243
|
+
const viewport = owner.visualViewport;
|
|
244
|
+
const left = viewport?.offsetLeft ?? 0;
|
|
245
|
+
const top = viewport?.offsetTop ?? 0;
|
|
246
|
+
const width = viewport?.width ?? owner.innerWidth;
|
|
247
|
+
const height = viewport?.height ?? owner.innerHeight;
|
|
248
|
+
return {
|
|
249
|
+
left,
|
|
250
|
+
top,
|
|
251
|
+
right: left + width,
|
|
252
|
+
bottom: top + height,
|
|
253
|
+
width,
|
|
254
|
+
height
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
function clampRectToViewport(rect, viewport = getVisualViewportRect(), gutter = 0) {
|
|
258
|
+
const availableWidth = Math.max(0, viewport.width - gutter * 2);
|
|
259
|
+
const availableHeight = Math.max(0, viewport.height - gutter * 2);
|
|
260
|
+
const targetLeft = rect.width > availableWidth ? viewport.left + gutter : Math.min(Math.max(rect.left, viewport.left + gutter), viewport.right - gutter - rect.width);
|
|
261
|
+
const targetTop = rect.height > availableHeight ? viewport.top + gutter : Math.min(Math.max(rect.top, viewport.top + gutter), viewport.bottom - gutter - rect.height);
|
|
262
|
+
return { x: targetLeft - rect.left, y: targetTop - rect.top };
|
|
263
|
+
}
|
|
32
264
|
function distanceFromPointToRect(point, rect) {
|
|
33
265
|
const dx = Math.max(rect.left - point.x, 0, point.x - rect.right);
|
|
34
266
|
const dy = Math.max(rect.top - point.y, 0, point.y - rect.bottom);
|
|
@@ -123,11 +355,25 @@ function createProximityCoordinator(scope, options = {}) {
|
|
|
123
355
|
}
|
|
124
356
|
};
|
|
125
357
|
}
|
|
126
|
-
var DEFAULT_AFFORDANCE_NEAR_RADIUS,
|
|
358
|
+
var DEFAULT_AFFORDANCE_NEAR_RADIUS, anchorSequence, anchorBindings;
|
|
359
|
+
var init_positioning_Bu0dmLBE = __esm({
|
|
360
|
+
"dist/esm/positioning-Bu0dmLBE.js"() {
|
|
361
|
+
DEFAULT_AFFORDANCE_NEAR_RADIUS = 16;
|
|
362
|
+
anchorSequence = 0;
|
|
363
|
+
anchorBindings = /* @__PURE__ */ new WeakMap();
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
// dist/esm/ui-affordance-scope.entry.js
|
|
368
|
+
var ui_affordance_scope_entry_exports = {};
|
|
369
|
+
__export(ui_affordance_scope_entry_exports, {
|
|
370
|
+
ui_affordance_scope: () => UIAffordanceScope
|
|
371
|
+
});
|
|
372
|
+
var uiAffordanceScopeCss, UIAffordanceScope;
|
|
127
373
|
var init_ui_affordance_scope_entry = __esm({
|
|
128
374
|
"dist/esm/ui-affordance-scope.entry.js"() {
|
|
129
375
|
init_index_CEeiinfk();
|
|
130
|
-
|
|
376
|
+
init_positioning_Bu0dmLBE();
|
|
131
377
|
uiAffordanceScopeCss = () => `:host{display:contents;--ui-affordance-scope-engaged:0}:host([data-ui-interaction='engaged']){--ui-affordance-scope-engaged:1}`;
|
|
132
378
|
UIAffordanceScope = class {
|
|
133
379
|
constructor(hostRef) {
|
|
@@ -496,7 +742,7 @@ var init_ui_checkbox_entry = __esm({
|
|
|
496
742
|
}
|
|
497
743
|
});
|
|
498
744
|
|
|
499
|
-
// dist/esm/manager-
|
|
745
|
+
// dist/esm/manager-PM9a74r7.js
|
|
500
746
|
function syncScrollLock() {
|
|
501
747
|
if (typeof document === "undefined") {
|
|
502
748
|
return;
|
|
@@ -525,8 +771,11 @@ function handleLightDismiss(event) {
|
|
|
525
771
|
return;
|
|
526
772
|
}
|
|
527
773
|
const target = event.target;
|
|
528
|
-
if (target instanceof Node
|
|
529
|
-
|
|
774
|
+
if (target instanceof Node) {
|
|
775
|
+
if (top.element.contains(target))
|
|
776
|
+
return;
|
|
777
|
+
if (top.relatedElements?.some((element) => element.contains(target)))
|
|
778
|
+
return;
|
|
530
779
|
}
|
|
531
780
|
requestTopOverlayClose("light-dismiss", "pointer");
|
|
532
781
|
}
|
|
@@ -581,8 +830,8 @@ function requestTopOverlayClose(reason, trigger) {
|
|
|
581
830
|
return true;
|
|
582
831
|
}
|
|
583
832
|
var stack, scrollLockAttribute, modalCount, listenersAttached;
|
|
584
|
-
var
|
|
585
|
-
"dist/esm/manager-
|
|
833
|
+
var init_manager_PM9a74r7 = __esm({
|
|
834
|
+
"dist/esm/manager-PM9a74r7.js"() {
|
|
586
835
|
stack = [];
|
|
587
836
|
scrollLockAttribute = "data-ui-scroll-lock";
|
|
588
837
|
modalCount = 0;
|
|
@@ -599,9 +848,10 @@ var uiContextMenuCss, UIContextMenu;
|
|
|
599
848
|
var init_ui_context_menu_entry = __esm({
|
|
600
849
|
"dist/esm/ui-context-menu.entry.js"() {
|
|
601
850
|
init_index_CEeiinfk();
|
|
602
|
-
|
|
851
|
+
init_manager_PM9a74r7();
|
|
603
852
|
init_events_JwSoedEO();
|
|
604
|
-
|
|
853
|
+
init_positioning_Bu0dmLBE();
|
|
854
|
+
uiContextMenuCss = () => `:host{display:contents}:host([data-focus-trigger='pointer']) ::slotted(ui-menu-item:focus){outline:none}.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}}`;
|
|
605
855
|
UIContextMenu = class {
|
|
606
856
|
constructor(hostRef) {
|
|
607
857
|
registerInstance(this, hostRef);
|
|
@@ -616,11 +866,14 @@ var init_ui_context_menu_entry = __esm({
|
|
|
616
866
|
/** Optional id of the region that should also respond to a context-menu gesture. */
|
|
617
867
|
for;
|
|
618
868
|
internalOpen = false;
|
|
869
|
+
focusTrigger = "programmatic";
|
|
619
870
|
overlayId = `ui-context-menu-${Math.random().toString(36).slice(2, 11)}`;
|
|
620
871
|
trigger = null;
|
|
621
872
|
contextTarget = null;
|
|
622
873
|
pointerX = 0;
|
|
623
874
|
pointerY = 0;
|
|
875
|
+
pointPositioned = false;
|
|
876
|
+
surface = null;
|
|
624
877
|
syncFromProp() {
|
|
625
878
|
this.internalOpen = this.open;
|
|
626
879
|
}
|
|
@@ -631,6 +884,11 @@ var init_ui_context_menu_entry = __esm({
|
|
|
631
884
|
syncOverlay() {
|
|
632
885
|
this.syncTriggerState();
|
|
633
886
|
if (this.internalOpen) {
|
|
887
|
+
if (this.pointPositioned) {
|
|
888
|
+
this.surface?.showAtPoint({ x: this.pointerX, y: this.pointerY });
|
|
889
|
+
} else {
|
|
890
|
+
this.surface?.show();
|
|
891
|
+
}
|
|
634
892
|
openOverlay({
|
|
635
893
|
id: this.overlayId,
|
|
636
894
|
modal: false,
|
|
@@ -639,6 +897,7 @@ var init_ui_context_menu_entry = __esm({
|
|
|
639
897
|
requestClose: (reason, trigger) => this.closeMenu(reason, trigger)
|
|
640
898
|
});
|
|
641
899
|
} else {
|
|
900
|
+
this.surface?.hide();
|
|
642
901
|
closeOverlay(this.overlayId);
|
|
643
902
|
}
|
|
644
903
|
}
|
|
@@ -647,18 +906,33 @@ var init_ui_context_menu_entry = __esm({
|
|
|
647
906
|
this.internalOpen = this.internalOpen || this.defaultOpen;
|
|
648
907
|
this.resolveTargets();
|
|
649
908
|
this.attachTargetListeners();
|
|
909
|
+
this.setupSurface();
|
|
650
910
|
this.syncTriggerState();
|
|
651
911
|
this.syncOverlay();
|
|
652
912
|
}
|
|
653
913
|
componentDidUpdate() {
|
|
654
914
|
this.resolveTargets();
|
|
655
915
|
this.attachTargetListeners();
|
|
916
|
+
if (!this.pointPositioned)
|
|
917
|
+
this.surface?.setAnchor(this.trigger);
|
|
656
918
|
this.syncTriggerState();
|
|
657
919
|
}
|
|
658
920
|
disconnectedCallback() {
|
|
659
921
|
this.detachTargetListeners();
|
|
922
|
+
this.surface?.destroy();
|
|
923
|
+
this.surface = null;
|
|
660
924
|
closeOverlay(this.overlayId);
|
|
661
925
|
}
|
|
926
|
+
setupSurface() {
|
|
927
|
+
const menu = this.host.shadowRoot?.querySelector(".menu");
|
|
928
|
+
if (!menu)
|
|
929
|
+
return;
|
|
930
|
+
this.surface?.destroy();
|
|
931
|
+
this.surface = createAnchoredSurface(menu, {
|
|
932
|
+
anchor: this.trigger,
|
|
933
|
+
placement: "bottom-start"
|
|
934
|
+
});
|
|
935
|
+
}
|
|
662
936
|
resolveTargets() {
|
|
663
937
|
const previousTrigger = this.trigger;
|
|
664
938
|
const previousContextTarget = this.contextTarget;
|
|
@@ -698,6 +972,9 @@ var init_ui_context_menu_entry = __esm({
|
|
|
698
972
|
openMenu(x, y, trigger) {
|
|
699
973
|
this.pointerX = x;
|
|
700
974
|
this.pointerY = y;
|
|
975
|
+
this.focusTrigger = trigger;
|
|
976
|
+
this.pointPositioned = true;
|
|
977
|
+
this.surface?.showAtPoint({ x, y });
|
|
701
978
|
this.internalOpen = true;
|
|
702
979
|
dispatchDetail(this.host, "open", {
|
|
703
980
|
open: true,
|
|
@@ -709,8 +986,14 @@ var init_ui_context_menu_entry = __esm({
|
|
|
709
986
|
openFromTrigger(trigger) {
|
|
710
987
|
if (!this.trigger)
|
|
711
988
|
return;
|
|
712
|
-
|
|
713
|
-
this.
|
|
989
|
+
this.pointPositioned = false;
|
|
990
|
+
this.internalOpen = true;
|
|
991
|
+
dispatchDetail(this.host, "open", {
|
|
992
|
+
open: true,
|
|
993
|
+
reason: "action",
|
|
994
|
+
trigger
|
|
995
|
+
});
|
|
996
|
+
this.focusFirstItem();
|
|
714
997
|
}
|
|
715
998
|
closeMenu(reason, trigger, returnFocus = true) {
|
|
716
999
|
if (!this.internalOpen)
|
|
@@ -752,6 +1035,7 @@ var init_ui_context_menu_entry = __esm({
|
|
|
752
1035
|
onKeydown = (event) => {
|
|
753
1036
|
if (!this.internalOpen)
|
|
754
1037
|
return;
|
|
1038
|
+
this.focusTrigger = "keyboard";
|
|
755
1039
|
if (event.key === "Escape") {
|
|
756
1040
|
event.preventDefault();
|
|
757
1041
|
requestTopOverlayClose("escape", "keyboard");
|
|
@@ -776,7 +1060,7 @@ var init_ui_context_menu_entry = __esm({
|
|
|
776
1060
|
this.closeMenu("action", "pointer");
|
|
777
1061
|
};
|
|
778
1062
|
render() {
|
|
779
|
-
return h(Host, { key: "
|
|
1063
|
+
return h(Host, { key: "4db0d5b55ead41925aa682b1e383b5735b49bf56", "data-open": this.internalOpen ? "" : void 0, "data-focus-trigger": this.internalOpen ? this.focusTrigger : void 0, onKeyDown: this.onKeydown, onClick: this.onItemClick }, h("slot", { key: "462925d53db169c13e485789ae91e28b0abd3e40", name: "trigger" }), h("div", { key: "cac8f3b11c4872d38e976f210ce9a43fd854b335", class: "menu", "data-open": this.internalOpen ? "" : void 0 }, h("ui-menu", { key: "ba50f74e11466da2240f7568479d5d10a614b394", open: this.internalOpen }, h("slot", { key: "1fcb45bf124e2377ac6c7fc236d2babf0d9e3bae" }))));
|
|
780
1064
|
}
|
|
781
1065
|
static get watchers() {
|
|
782
1066
|
return {
|
|
@@ -805,7 +1089,7 @@ var uiDialogCss, UIDialog;
|
|
|
805
1089
|
var init_ui_dialog_entry = __esm({
|
|
806
1090
|
"dist/esm/ui-dialog.entry.js"() {
|
|
807
1091
|
init_index_CEeiinfk();
|
|
808
|
-
|
|
1092
|
+
init_manager_PM9a74r7();
|
|
809
1093
|
init_events_JwSoedEO();
|
|
810
1094
|
uiDialogCss = () => `: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}}`;
|
|
811
1095
|
UIDialog = class {
|
|
@@ -1289,7 +1573,9 @@ var init_ui_menu_entry = __esm({
|
|
|
1289
1573
|
"dist/esm/ui-menu.entry.js"() {
|
|
1290
1574
|
init_index_CEeiinfk();
|
|
1291
1575
|
init_events_JwSoedEO();
|
|
1292
|
-
|
|
1576
|
+
init_manager_PM9a74r7();
|
|
1577
|
+
init_positioning_Bu0dmLBE();
|
|
1578
|
+
uiMenuCss = () => `: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}`;
|
|
1293
1579
|
UIMenu = class {
|
|
1294
1580
|
constructor(hostRef) {
|
|
1295
1581
|
registerInstance(this, hostRef);
|
|
@@ -1299,19 +1585,83 @@ var init_ui_menu_entry = __esm({
|
|
|
1299
1585
|
}
|
|
1300
1586
|
open = false;
|
|
1301
1587
|
defaultOpen = false;
|
|
1588
|
+
/** Id of the control that anchors this menu in the top layer. */
|
|
1589
|
+
for;
|
|
1590
|
+
/** Preferred placement; Looma flips and shifts when space is constrained. */
|
|
1591
|
+
placement = "bottom-start";
|
|
1302
1592
|
internalOpen = false;
|
|
1593
|
+
overlayId = `ui-menu-${Math.random().toString(36).slice(2, 11)}`;
|
|
1594
|
+
anchor = null;
|
|
1595
|
+
surface = null;
|
|
1303
1596
|
syncFromProp() {
|
|
1304
1597
|
this.internalOpen = this.open;
|
|
1305
1598
|
}
|
|
1599
|
+
resetSurface() {
|
|
1600
|
+
this.setupSurface();
|
|
1601
|
+
this.syncSurface();
|
|
1602
|
+
}
|
|
1603
|
+
syncSurface() {
|
|
1604
|
+
this.syncAnchorState();
|
|
1605
|
+
if (!this.surface)
|
|
1606
|
+
return;
|
|
1607
|
+
if (this.internalOpen) {
|
|
1608
|
+
this.surface.show();
|
|
1609
|
+
openOverlay({
|
|
1610
|
+
id: this.overlayId,
|
|
1611
|
+
modal: false,
|
|
1612
|
+
element: this.host,
|
|
1613
|
+
relatedElements: this.anchor ? [this.anchor] : void 0,
|
|
1614
|
+
dismissible: true,
|
|
1615
|
+
requestClose: (reason, trigger) => this.closeMenu(reason, trigger)
|
|
1616
|
+
});
|
|
1617
|
+
} else {
|
|
1618
|
+
this.surface.hide();
|
|
1619
|
+
closeOverlay(this.overlayId);
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1306
1622
|
componentDidLoad() {
|
|
1307
1623
|
this.syncFromProp();
|
|
1308
1624
|
this.internalOpen = this.internalOpen || this.defaultOpen;
|
|
1309
1625
|
this.host.addEventListener("click", this.onItemClick);
|
|
1310
1626
|
this.host.addEventListener("keydown", this.onKeydown);
|
|
1627
|
+
this.setupSurface();
|
|
1628
|
+
this.syncSurface();
|
|
1311
1629
|
}
|
|
1312
1630
|
disconnectedCallback() {
|
|
1313
1631
|
this.host.removeEventListener("click", this.onItemClick);
|
|
1314
1632
|
this.host.removeEventListener("keydown", this.onKeydown);
|
|
1633
|
+
this.surface?.destroy();
|
|
1634
|
+
this.surface = null;
|
|
1635
|
+
closeOverlay(this.overlayId);
|
|
1636
|
+
}
|
|
1637
|
+
setupSurface() {
|
|
1638
|
+
this.surface?.destroy();
|
|
1639
|
+
this.surface = null;
|
|
1640
|
+
this.anchor = this.for ? this.host.ownerDocument.getElementById(this.for) : null;
|
|
1641
|
+
if (!this.anchor)
|
|
1642
|
+
return;
|
|
1643
|
+
this.surface = createAnchoredSurface(this.host, {
|
|
1644
|
+
anchor: this.anchor,
|
|
1645
|
+
placement: this.placement
|
|
1646
|
+
});
|
|
1647
|
+
}
|
|
1648
|
+
syncAnchorState() {
|
|
1649
|
+
if (!this.anchor)
|
|
1650
|
+
return;
|
|
1651
|
+
this.anchor.setAttribute("aria-haspopup", "menu");
|
|
1652
|
+
this.anchor.setAttribute("aria-expanded", this.internalOpen ? "true" : "false");
|
|
1653
|
+
}
|
|
1654
|
+
closeMenu(reason, trigger) {
|
|
1655
|
+
if (!this.internalOpen)
|
|
1656
|
+
return;
|
|
1657
|
+
this.internalOpen = false;
|
|
1658
|
+
dispatchDetail(this.host, "close", {
|
|
1659
|
+
open: false,
|
|
1660
|
+
reason,
|
|
1661
|
+
trigger
|
|
1662
|
+
});
|
|
1663
|
+
if (reason === "escape")
|
|
1664
|
+
this.anchor?.focus();
|
|
1315
1665
|
}
|
|
1316
1666
|
getItems() {
|
|
1317
1667
|
return Array.from(this.host.querySelectorAll("ui-menu-item"));
|
|
@@ -1335,6 +1685,11 @@ var init_ui_menu_entry = __esm({
|
|
|
1335
1685
|
this.internalOpen = false;
|
|
1336
1686
|
};
|
|
1337
1687
|
onKeydown = (e) => {
|
|
1688
|
+
if (e.key === "Escape") {
|
|
1689
|
+
e.preventDefault();
|
|
1690
|
+
requestTopOverlayClose("escape", "keyboard");
|
|
1691
|
+
return;
|
|
1692
|
+
}
|
|
1338
1693
|
const items = this.getItems().filter((i) => !this.isItemDisabled(i));
|
|
1339
1694
|
if (items.length === 0)
|
|
1340
1695
|
return;
|
|
@@ -1361,12 +1716,21 @@ var init_ui_menu_entry = __esm({
|
|
|
1361
1716
|
}
|
|
1362
1717
|
};
|
|
1363
1718
|
render() {
|
|
1364
|
-
return h(Host, { key: "
|
|
1719
|
+
return h(Host, { key: "06ad0750df843cb874bd4f257d8567157c855493", role: "menu", "aria-orientation": "vertical", "data-open": this.internalOpen ? "" : void 0 }, h("slot", { key: "50118ac749a2747ca06f4d483499c4cd20125a89" }));
|
|
1365
1720
|
}
|
|
1366
1721
|
static get watchers() {
|
|
1367
1722
|
return {
|
|
1368
1723
|
"open": [{
|
|
1369
1724
|
"syncFromProp": 0
|
|
1725
|
+
}],
|
|
1726
|
+
"for": [{
|
|
1727
|
+
"resetSurface": 0
|
|
1728
|
+
}],
|
|
1729
|
+
"placement": [{
|
|
1730
|
+
"resetSurface": 0
|
|
1731
|
+
}],
|
|
1732
|
+
"internalOpen": [{
|
|
1733
|
+
"syncSurface": 0
|
|
1370
1734
|
}]
|
|
1371
1735
|
};
|
|
1372
1736
|
}
|
|
@@ -1384,9 +1748,10 @@ var uiPopoverCss, UIPopover;
|
|
|
1384
1748
|
var init_ui_popover_entry = __esm({
|
|
1385
1749
|
"dist/esm/ui-popover.entry.js"() {
|
|
1386
1750
|
init_index_CEeiinfk();
|
|
1387
|
-
|
|
1751
|
+
init_manager_PM9a74r7();
|
|
1388
1752
|
init_events_JwSoedEO();
|
|
1389
|
-
|
|
1753
|
+
init_positioning_Bu0dmLBE();
|
|
1754
|
+
uiPopoverCss = () => `: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}}`;
|
|
1390
1755
|
UIPopover = class {
|
|
1391
1756
|
constructor(hostRef) {
|
|
1392
1757
|
registerInstance(this, hostRef);
|
|
@@ -1396,8 +1761,13 @@ var init_ui_popover_entry = __esm({
|
|
|
1396
1761
|
}
|
|
1397
1762
|
open = false;
|
|
1398
1763
|
defaultOpen = false;
|
|
1764
|
+
/** Optional id of the element this popover follows in the top layer. */
|
|
1765
|
+
for;
|
|
1766
|
+
placement = "bottom-start";
|
|
1399
1767
|
internalOpen = false;
|
|
1400
1768
|
overlayId = `ui-popover-${Math.random().toString(36).slice(2, 11)}`;
|
|
1769
|
+
anchor = null;
|
|
1770
|
+
surface = null;
|
|
1401
1771
|
syncFromProp() {
|
|
1402
1772
|
this.internalOpen = this.open;
|
|
1403
1773
|
}
|
|
@@ -1417,12 +1787,37 @@ var init_ui_popover_entry = __esm({
|
|
|
1417
1787
|
});
|
|
1418
1788
|
}
|
|
1419
1789
|
}
|
|
1790
|
+
resetSurface() {
|
|
1791
|
+
this.setupSurface();
|
|
1792
|
+
this.syncSurface();
|
|
1793
|
+
}
|
|
1794
|
+
setupSurface() {
|
|
1795
|
+
this.surface?.destroy();
|
|
1796
|
+
this.surface = null;
|
|
1797
|
+
this.anchor = this.for ? this.host.ownerDocument.getElementById(this.for) : null;
|
|
1798
|
+
if (!this.anchor)
|
|
1799
|
+
return;
|
|
1800
|
+
this.surface = createAnchoredSurface(this.host, {
|
|
1801
|
+
anchor: this.anchor,
|
|
1802
|
+
placement: this.placement
|
|
1803
|
+
});
|
|
1804
|
+
}
|
|
1805
|
+
syncSurface() {
|
|
1806
|
+
if (!this.surface)
|
|
1807
|
+
return;
|
|
1808
|
+
if (this.internalOpen)
|
|
1809
|
+
this.surface.show();
|
|
1810
|
+
else
|
|
1811
|
+
this.surface.hide();
|
|
1812
|
+
}
|
|
1420
1813
|
syncOverlay() {
|
|
1814
|
+
this.syncSurface();
|
|
1421
1815
|
if (this.internalOpen) {
|
|
1422
1816
|
openOverlay({
|
|
1423
1817
|
id: this.overlayId,
|
|
1424
1818
|
modal: false,
|
|
1425
1819
|
element: this.host,
|
|
1820
|
+
relatedElements: this.anchor ? [this.anchor] : void 0,
|
|
1426
1821
|
dismissible: true,
|
|
1427
1822
|
requestClose: (reason, trigger) => this.handleRequestClose(reason, trigger)
|
|
1428
1823
|
});
|
|
@@ -1434,10 +1829,13 @@ var init_ui_popover_entry = __esm({
|
|
|
1434
1829
|
this.syncFromProp();
|
|
1435
1830
|
this.internalOpen = this.internalOpen || this.defaultOpen;
|
|
1436
1831
|
this.host.addEventListener("keydown", this.onKeydown);
|
|
1832
|
+
this.setupSurface();
|
|
1437
1833
|
this.syncOverlay();
|
|
1438
1834
|
}
|
|
1439
1835
|
disconnectedCallback() {
|
|
1440
1836
|
this.host.removeEventListener("keydown", this.onKeydown);
|
|
1837
|
+
this.surface?.destroy();
|
|
1838
|
+
this.surface = null;
|
|
1441
1839
|
closeOverlay(this.overlayId);
|
|
1442
1840
|
}
|
|
1443
1841
|
componentDidUpdate() {
|
|
@@ -1457,7 +1855,7 @@ var init_ui_popover_entry = __esm({
|
|
|
1457
1855
|
}
|
|
1458
1856
|
};
|
|
1459
1857
|
render() {
|
|
1460
|
-
return h(Host, { key: "
|
|
1858
|
+
return h(Host, { key: "8e45be54147ff8f76a0d5e7fd875c3f4cf5ac40a", "data-open": this.internalOpen ? "" : void 0, onKeyDown: this.onKeydown }, h("slot", { key: "3141729cd32c8dcdaec1fbd763eb034242563c8f" }));
|
|
1461
1859
|
}
|
|
1462
1860
|
static get watchers() {
|
|
1463
1861
|
return {
|
|
@@ -1466,6 +1864,12 @@ var init_ui_popover_entry = __esm({
|
|
|
1466
1864
|
}],
|
|
1467
1865
|
"internalOpen": [{
|
|
1468
1866
|
"onOpenChange": 0
|
|
1867
|
+
}],
|
|
1868
|
+
"for": [{
|
|
1869
|
+
"resetSurface": 0
|
|
1870
|
+
}],
|
|
1871
|
+
"placement": [{
|
|
1872
|
+
"resetSurface": 0
|
|
1469
1873
|
}]
|
|
1470
1874
|
};
|
|
1471
1875
|
}
|
|
@@ -2234,7 +2638,8 @@ var init_ui_toast_region_entry = __esm({
|
|
|
2234
2638
|
"dist/esm/ui-toast-region.entry.js"() {
|
|
2235
2639
|
init_index_CEeiinfk();
|
|
2236
2640
|
init_events_JwSoedEO();
|
|
2237
|
-
|
|
2641
|
+
init_positioning_Bu0dmLBE();
|
|
2642
|
+
uiToastRegionCss = () => `: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}`;
|
|
2238
2643
|
UIToastRegion = class {
|
|
2239
2644
|
constructor(hostRef) {
|
|
2240
2645
|
registerInstance(this, hostRef);
|
|
@@ -2244,15 +2649,26 @@ var init_ui_toast_region_entry = __esm({
|
|
|
2244
2649
|
}
|
|
2245
2650
|
open = true;
|
|
2246
2651
|
internalOpen = true;
|
|
2652
|
+
surface = null;
|
|
2247
2653
|
syncFromProp() {
|
|
2248
2654
|
this.internalOpen = this.open;
|
|
2249
2655
|
}
|
|
2656
|
+
syncSurface() {
|
|
2657
|
+
if (this.internalOpen)
|
|
2658
|
+
this.surface?.show();
|
|
2659
|
+
else
|
|
2660
|
+
this.surface?.hide();
|
|
2661
|
+
}
|
|
2250
2662
|
componentDidLoad() {
|
|
2663
|
+
this.surface = createViewportSurface(this.host);
|
|
2251
2664
|
this.syncFromProp();
|
|
2665
|
+
this.syncSurface();
|
|
2252
2666
|
this.host.addEventListener("click", this.onClick);
|
|
2253
2667
|
}
|
|
2254
2668
|
disconnectedCallback() {
|
|
2255
2669
|
this.host.removeEventListener("click", this.onClick);
|
|
2670
|
+
this.surface?.destroy();
|
|
2671
|
+
this.surface = null;
|
|
2256
2672
|
}
|
|
2257
2673
|
getToasts() {
|
|
2258
2674
|
return Array.from(this.host.querySelectorAll("[data-ui-toast]"));
|
|
@@ -2286,12 +2702,15 @@ var init_ui_toast_region_entry = __esm({
|
|
|
2286
2702
|
}
|
|
2287
2703
|
};
|
|
2288
2704
|
render() {
|
|
2289
|
-
return h(Host, { key: "
|
|
2705
|
+
return h(Host, { key: "693e24016ec0881a4d619a489f1b655feee41784", role: "region", "aria-label": "Notifications", "data-open": this.internalOpen ? "" : void 0 }, h("slot", { key: "e666b2a73a5d7eb8dd607df3d1c5135b78cf3775" }));
|
|
2290
2706
|
}
|
|
2291
2707
|
static get watchers() {
|
|
2292
2708
|
return {
|
|
2293
2709
|
"open": [{
|
|
2294
2710
|
"syncFromProp": 0
|
|
2711
|
+
}],
|
|
2712
|
+
"internalOpen": [{
|
|
2713
|
+
"syncSurface": 0
|
|
2295
2714
|
}]
|
|
2296
2715
|
};
|
|
2297
2716
|
}
|
|
@@ -2309,9 +2728,10 @@ var uiTooltipCss, UITooltip;
|
|
|
2309
2728
|
var init_ui_tooltip_entry = __esm({
|
|
2310
2729
|
"dist/esm/ui-tooltip.entry.js"() {
|
|
2311
2730
|
init_index_CEeiinfk();
|
|
2312
|
-
|
|
2731
|
+
init_manager_PM9a74r7();
|
|
2313
2732
|
init_events_JwSoedEO();
|
|
2314
|
-
|
|
2733
|
+
init_positioning_Bu0dmLBE();
|
|
2734
|
+
uiTooltipCss = () => `: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}}`;
|
|
2315
2735
|
UITooltip = class {
|
|
2316
2736
|
constructor(hostRef) {
|
|
2317
2737
|
registerInstance(this, hostRef);
|
|
@@ -2322,49 +2742,76 @@ var init_ui_tooltip_entry = __esm({
|
|
|
2322
2742
|
for = "";
|
|
2323
2743
|
open = false;
|
|
2324
2744
|
defaultOpen = false;
|
|
2745
|
+
placement = "top-start";
|
|
2746
|
+
/** Pointer hover intent delay in milliseconds. Keyboard focus is immediate. */
|
|
2747
|
+
showDelay = 500;
|
|
2748
|
+
/** Pointer leave grace period in milliseconds. */
|
|
2749
|
+
hideDelay = 100;
|
|
2325
2750
|
internalOpen = false;
|
|
2326
2751
|
overlayId = `ui-tooltip-${Math.random().toString(36).slice(2, 11)}`;
|
|
2327
2752
|
trigger = null;
|
|
2753
|
+
surface = null;
|
|
2754
|
+
showTimer = null;
|
|
2755
|
+
hideTimer = null;
|
|
2328
2756
|
syncFromProp() {
|
|
2757
|
+
this.clearTimers();
|
|
2329
2758
|
this.internalOpen = this.open;
|
|
2330
2759
|
}
|
|
2760
|
+
resetSurface() {
|
|
2761
|
+
this.syncTrigger();
|
|
2762
|
+
this.setupSurface();
|
|
2763
|
+
this.syncOverlay();
|
|
2764
|
+
}
|
|
2331
2765
|
syncOverlay() {
|
|
2332
2766
|
if (this.internalOpen) {
|
|
2767
|
+
this.surface?.show();
|
|
2333
2768
|
openOverlay({
|
|
2334
2769
|
id: this.overlayId,
|
|
2335
2770
|
modal: false,
|
|
2336
2771
|
element: this.host,
|
|
2772
|
+
relatedElements: this.trigger ? [this.trigger] : void 0,
|
|
2337
2773
|
dismissible: true,
|
|
2338
2774
|
requestClose: (reason, trigger) => this.handleRequestClose(reason, trigger)
|
|
2339
2775
|
});
|
|
2340
2776
|
} else {
|
|
2777
|
+
this.surface?.hide();
|
|
2341
2778
|
closeOverlay(this.overlayId);
|
|
2342
2779
|
}
|
|
2343
2780
|
}
|
|
2344
2781
|
componentDidLoad() {
|
|
2345
2782
|
this.syncFromProp();
|
|
2346
2783
|
this.internalOpen = this.internalOpen || this.defaultOpen;
|
|
2347
|
-
this.
|
|
2348
|
-
this.
|
|
2784
|
+
this.syncTrigger();
|
|
2785
|
+
this.setupSurface();
|
|
2349
2786
|
this.host.addEventListener("keydown", this.onKeydown);
|
|
2350
2787
|
this.syncOverlay();
|
|
2351
2788
|
}
|
|
2352
2789
|
componentDidUpdate() {
|
|
2353
|
-
this.
|
|
2354
|
-
this.attachTriggerListeners();
|
|
2355
|
-
this.syncOverlay();
|
|
2790
|
+
this.syncTrigger();
|
|
2356
2791
|
}
|
|
2357
2792
|
disconnectedCallback() {
|
|
2793
|
+
this.clearTimers();
|
|
2358
2794
|
this.detachTriggerListeners();
|
|
2795
|
+
this.surface?.destroy();
|
|
2796
|
+
this.surface = null;
|
|
2359
2797
|
this.host.removeEventListener("keydown", this.onKeydown);
|
|
2360
2798
|
closeOverlay(this.overlayId);
|
|
2361
2799
|
}
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2800
|
+
syncTrigger() {
|
|
2801
|
+
const next = this.for ? this.host.ownerDocument.getElementById(this.for) : this.host.previousElementSibling;
|
|
2802
|
+
if (next === this.trigger)
|
|
2803
|
+
return;
|
|
2804
|
+
this.detachTriggerListeners();
|
|
2805
|
+
this.trigger = next;
|
|
2806
|
+
this.attachTriggerListeners();
|
|
2807
|
+
this.surface?.setAnchor(next);
|
|
2808
|
+
}
|
|
2809
|
+
setupSurface() {
|
|
2810
|
+
this.surface?.destroy();
|
|
2811
|
+
this.surface = createAnchoredSurface(this.host, {
|
|
2812
|
+
anchor: this.trigger,
|
|
2813
|
+
placement: this.placement
|
|
2814
|
+
});
|
|
2368
2815
|
}
|
|
2369
2816
|
attachTriggerListeners() {
|
|
2370
2817
|
this.detachTriggerListeners();
|
|
@@ -2383,31 +2830,64 @@ var init_ui_tooltip_entry = __esm({
|
|
|
2383
2830
|
this.trigger.removeEventListener("focusin", this.onTriggerFocusIn);
|
|
2384
2831
|
this.trigger.removeEventListener("focusout", this.onTriggerFocusOut);
|
|
2385
2832
|
}
|
|
2833
|
+
clearShowTimer() {
|
|
2834
|
+
if (this.showTimer === null)
|
|
2835
|
+
return;
|
|
2836
|
+
clearTimeout(this.showTimer);
|
|
2837
|
+
this.showTimer = null;
|
|
2838
|
+
}
|
|
2839
|
+
clearHideTimer() {
|
|
2840
|
+
if (this.hideTimer === null)
|
|
2841
|
+
return;
|
|
2842
|
+
clearTimeout(this.hideTimer);
|
|
2843
|
+
this.hideTimer = null;
|
|
2844
|
+
}
|
|
2845
|
+
clearTimers() {
|
|
2846
|
+
this.clearShowTimer();
|
|
2847
|
+
this.clearHideTimer();
|
|
2848
|
+
}
|
|
2849
|
+
setInteractionOpen(nextOpen, trigger) {
|
|
2850
|
+
if (this.internalOpen === nextOpen)
|
|
2851
|
+
return;
|
|
2852
|
+
this.internalOpen = nextOpen;
|
|
2853
|
+
dispatchDetail(this.host, nextOpen ? "open" : "close", {
|
|
2854
|
+
open: nextOpen,
|
|
2855
|
+
reason: "action",
|
|
2856
|
+
trigger
|
|
2857
|
+
});
|
|
2858
|
+
}
|
|
2386
2859
|
onTriggerEnter = () => {
|
|
2387
|
-
this.
|
|
2388
|
-
|
|
2389
|
-
|
|
2860
|
+
this.clearHideTimer();
|
|
2861
|
+
if (this.internalOpen || this.showTimer !== null)
|
|
2862
|
+
return;
|
|
2863
|
+
this.showTimer = setTimeout(() => {
|
|
2864
|
+
this.showTimer = null;
|
|
2865
|
+
this.setInteractionOpen(true, "pointer");
|
|
2866
|
+
}, Math.max(0, this.showDelay));
|
|
2390
2867
|
};
|
|
2391
2868
|
onTriggerLeave = () => {
|
|
2392
|
-
this.
|
|
2393
|
-
|
|
2394
|
-
|
|
2869
|
+
this.clearShowTimer();
|
|
2870
|
+
if (!this.internalOpen || this.hideTimer !== null)
|
|
2871
|
+
return;
|
|
2872
|
+
this.hideTimer = setTimeout(() => {
|
|
2873
|
+
this.hideTimer = null;
|
|
2874
|
+
this.setInteractionOpen(false, "pointer");
|
|
2875
|
+
}, Math.max(0, this.hideDelay));
|
|
2395
2876
|
};
|
|
2396
2877
|
onTriggerFocusIn = () => {
|
|
2397
|
-
this.
|
|
2398
|
-
|
|
2399
|
-
this.syncOverlay();
|
|
2878
|
+
this.clearTimers();
|
|
2879
|
+
this.setInteractionOpen(true, "keyboard");
|
|
2400
2880
|
};
|
|
2401
2881
|
onTriggerFocusOut = (e) => {
|
|
2402
2882
|
const related = e.relatedTarget;
|
|
2403
2883
|
if (related && this.host.contains(related))
|
|
2404
2884
|
return;
|
|
2405
|
-
this.
|
|
2406
|
-
|
|
2407
|
-
this.syncOverlay();
|
|
2885
|
+
this.clearTimers();
|
|
2886
|
+
this.setInteractionOpen(false, "keyboard");
|
|
2408
2887
|
};
|
|
2409
2888
|
handleRequestClose(reason, trigger) {
|
|
2410
2889
|
if (reason === "escape") {
|
|
2890
|
+
this.clearTimers();
|
|
2411
2891
|
this.internalOpen = false;
|
|
2412
2892
|
dispatchDetail(this.host, "close", {
|
|
2413
2893
|
open: false,
|
|
@@ -2423,13 +2903,19 @@ var init_ui_tooltip_entry = __esm({
|
|
|
2423
2903
|
}
|
|
2424
2904
|
};
|
|
2425
2905
|
render() {
|
|
2426
|
-
return h(Host, { key: "
|
|
2906
|
+
return h(Host, { key: "4c3890a7371508ede06a5b370d1cec32db25280f", role: "tooltip", hidden: !this.internalOpen, "data-open": this.internalOpen ? "" : void 0, onKeyDown: this.onKeydown }, h("slot", { key: "2e3bcd0dc69b0c3e3376d73dc4efc82e4f4cfaaa" }));
|
|
2427
2907
|
}
|
|
2428
2908
|
static get watchers() {
|
|
2429
2909
|
return {
|
|
2430
2910
|
"open": [{
|
|
2431
2911
|
"syncFromProp": 0
|
|
2432
2912
|
}],
|
|
2913
|
+
"for": [{
|
|
2914
|
+
"resetSurface": 0
|
|
2915
|
+
}],
|
|
2916
|
+
"placement": [{
|
|
2917
|
+
"resetSurface": 0
|
|
2918
|
+
}],
|
|
2433
2919
|
"internalOpen": [{
|
|
2434
2920
|
"syncOverlay": 0
|
|
2435
2921
|
}]
|
|
@@ -2775,7 +3261,7 @@ var init_ui_tree_item_entry = __esm({
|
|
|
2775
3261
|
underline: Underline,
|
|
2776
3262
|
undo: Undo2
|
|
2777
3263
|
};
|
|
2778
|
-
uiTreeItemCss = () => `:host{--ui-tree-indent:16px;--ui-tree-row-min-height:
|
|
3264
|
+
uiTreeItemCss = () => `:host{--ui-tree-indent:16px;--ui-tree-row-min-height:32px;--ui-tree-drop-color:var(--ui-accent-solid);position:relative;display:block;min-inline-size:0;margin-inline-start:calc(var(--ui-tree-item-depth, 0) * var(--ui-tree-indent))}.row{position:relative;display:grid;grid-template-columns:20px auto minmax(0, 1fr) auto;align-items:center;min-block-size:var(--ui-tree-row-min-height);min-inline-size:0;font-size:var(--ui-tree-font-size, var(--ui-font-size-ui, 0.9375rem));border-radius:var(--ui-radius-md);color:var(--ui-text-secondary);transition:background-color var(--ui-motion-fast) var(--ui-motion-ease), color var(--ui-motion-fast) var(--ui-motion-ease), opacity var(--ui-motion-fast) var(--ui-motion-ease), box-shadow var(--ui-motion-fast) var(--ui-motion-ease), min-block-size var(--ui-motion-base) var(--ui-motion-ease)}.row:hover,:host([data-selected]) .row,.row:focus-within{color:var(--ui-text-primary);background:var(--ui-surface-muted)}:host([data-disabled]) .row{opacity:0.55}:host([data-dragging]) .row{opacity:0.42}:host(:focus){outline:none}:host(:focus-visible) .row{box-shadow:0 0 0 2px var(--ui-focus-ring)}:host([data-drop-position='inside']) .row{background:var(--ui-accent-subtle);box-shadow:inset 0 0 0 1px var(--ui-tree-drop-color)}.disclosure,.disclosure-spacer{grid-column:1;grid-row:1;inline-size:20px;block-size:28px}.disclosure{display:grid;place-items:center;padding:0;color:var(--ui-text-muted);background:transparent;border:0;border-radius:var(--ui-radius-sm);cursor:pointer}.disclosure:hover{color:var(--ui-text-primary);background:var(--ui-surface-elevated)}.disclosure-icon{display:block;inline-size:14px;block-size:14px;transform:rotate(-90deg);transition:transform var(--ui-motion-fast) var(--ui-motion-ease)}.disclosure-icon--expanded{transform:rotate(0deg)}.disclosure-icon :is(svg),.drag-handle :is(svg){display:block;inline-size:100%;block-size:100%}.leading{display:none}.leading:has(*){display:inline-grid;place-items:center;grid-column:2;grid-row:1;inline-size:16px;block-size:16px;margin-inline-start:var(--ui-space-1)}.label{grid-column:3;grid-row:1;min-inline-size:0;padding:var(--ui-space-1) var(--ui-space-2)}.actions{grid-column:4;grid-row:1;display:inline-flex;align-items:center;min-inline-size:0}.drag-handle{position:absolute;z-index:2;inset-block-start:50%;inset-inline-start:-22px;inline-size:20px;block-size:32px;display:grid;place-items:center;padding:7px 3px;color:var(--ui-text-muted);background:var(--ui-surface-elevated);border:1px solid transparent;border-radius:var(--ui-radius-sm);cursor:grab;opacity:0;pointer-events:none;transform:translateY(-50%);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease)}.row:hover .drag-handle,.drag-handle:focus-visible,:host([data-dragging]) .drag-handle{opacity:1;pointer-events:auto}.drag-handle:active{cursor:grabbing}.drop-indicator{position:absolute;z-index:3;inset-inline:1px;display:none;block-size:2px;border-radius:999px;background:var(--ui-tree-drop-color);pointer-events:none}.drop-indicator::before,.drop-indicator::after{content:'';position:absolute;inset-block-start:50%;inline-size:7px;block-size:7px;border:2px solid var(--ui-tree-drop-color);border-radius:999px;background:var(--ui-surface-elevated);transform:translateY(-50%)}.drop-indicator::before{inset-inline-start:-1px}.drop-indicator::after{inset-inline-end:-1px}:host([data-drop-position='before']) .drop-indicator{display:block;inset-block-start:-1px}:host([data-drop-position='after']) .drop-indicator{display:block;inset-block-end:-1px}.children[hidden]{display:none}:host-context(html[data-ui-input-modality='touch']){--ui-tree-row-min-height:44px}:host-context(html[data-ui-input-modality='touch']) .drag-handle{display:none}@media (prefers-reduced-motion: reduce){.row,.disclosure-icon,.drag-handle{transition:none}}`;
|
|
2779
3265
|
UITreeItem = class {
|
|
2780
3266
|
constructor(hostRef) {
|
|
2781
3267
|
registerInstance(this, hostRef);
|
|
@@ -4695,14 +5181,17 @@ var index_exports = {};
|
|
|
4695
5181
|
__export(index_exports, {
|
|
4696
5182
|
DEFAULT_AFFORDANCE_NEAR_RADIUS: () => DEFAULT_AFFORDANCE_NEAR_RADIUS2,
|
|
4697
5183
|
LOOMA_ICONS: () => LOOMA_ICONS2,
|
|
4698
|
-
clampRectToViewport: () =>
|
|
5184
|
+
clampRectToViewport: () => clampRectToViewport2,
|
|
4699
5185
|
classifyDropPosition: () => classifyDropPosition2,
|
|
4700
5186
|
closeOverlay: () => closeOverlay2,
|
|
5187
|
+
createAnchoredSurface: () => createAnchoredSurface2,
|
|
4701
5188
|
createHoverIntent: () => createHoverIntent2,
|
|
4702
5189
|
createProximityCoordinator: () => createProximityCoordinator2,
|
|
5190
|
+
createViewportSurface: () => createViewportSurface2,
|
|
4703
5191
|
distanceFromPointToRect: () => distanceFromPointToRect2,
|
|
4704
5192
|
getTopOverlay: () => getTopOverlay2,
|
|
4705
|
-
getVisualViewportRect: () =>
|
|
5193
|
+
getVisualViewportRect: () => getVisualViewportRect2,
|
|
5194
|
+
initializeInputModality: () => initializeInputModality,
|
|
4706
5195
|
isTopOverlay: () => isTopOverlay,
|
|
4707
5196
|
loomaIconMarkup: () => loomaIconMarkup2,
|
|
4708
5197
|
openOverlay: () => openOverlay2,
|
|
@@ -4723,7 +5212,7 @@ var globalScripts = () => {
|
|
|
4723
5212
|
var defineCustomElements = async (win2, options) => {
|
|
4724
5213
|
if (typeof window === "undefined") return void 0;
|
|
4725
5214
|
await globalScripts();
|
|
4726
|
-
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);
|
|
5215
|
+
return bootstrapLazy([["ui-context-menu", [[769, "ui-context-menu", { "open": [4], "defaultOpen": [4, "default-open"], "for": [1], "internalOpen": [32], "focusTrigger": [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);
|
|
4727
5216
|
};
|
|
4728
5217
|
|
|
4729
5218
|
// loader/index.js
|
|
@@ -4739,6 +5228,24 @@ var defineCustomElements = async (win2, options) => {
|
|
|
4739
5228
|
}
|
|
4740
5229
|
})();
|
|
4741
5230
|
|
|
5231
|
+
// src/input-modality.ts
|
|
5232
|
+
var initializedDocuments = /* @__PURE__ */ new WeakSet();
|
|
5233
|
+
function initializeInputModality(owner = document) {
|
|
5234
|
+
if (initializedDocuments.has(owner)) return;
|
|
5235
|
+
initializedDocuments.add(owner);
|
|
5236
|
+
const markTouch = () => {
|
|
5237
|
+
if (owner.documentElement.getAttribute("data-ui-input-modality") === "touch") return;
|
|
5238
|
+
owner.documentElement.setAttribute("data-ui-input-modality", "touch");
|
|
5239
|
+
owner.dispatchEvent(new CustomEvent("ui-input-modality-change", {
|
|
5240
|
+
detail: { modality: "touch" }
|
|
5241
|
+
}));
|
|
5242
|
+
};
|
|
5243
|
+
owner.addEventListener("pointerdown", (event) => {
|
|
5244
|
+
if (event.pointerType === "touch") markTouch();
|
|
5245
|
+
}, { capture: true, passive: true });
|
|
5246
|
+
owner.addEventListener("touchstart", markTouch, { capture: true, passive: true });
|
|
5247
|
+
}
|
|
5248
|
+
|
|
4742
5249
|
// src/overlay/manager.ts
|
|
4743
5250
|
var stack2 = [];
|
|
4744
5251
|
var scrollLockAttribute2 = "data-ui-scroll-lock";
|
|
@@ -4772,8 +5279,9 @@ function handleLightDismiss2(event) {
|
|
|
4772
5279
|
return;
|
|
4773
5280
|
}
|
|
4774
5281
|
const target = event.target;
|
|
4775
|
-
if (target instanceof Node
|
|
4776
|
-
return;
|
|
5282
|
+
if (target instanceof Node) {
|
|
5283
|
+
if (top.element.contains(target)) return;
|
|
5284
|
+
if (top.relatedElements?.some((element) => element.contains(target))) return;
|
|
4777
5285
|
}
|
|
4778
5286
|
requestTopOverlayClose2("light-dismiss", "pointer");
|
|
4779
5287
|
}
|
|
@@ -4833,7 +5341,215 @@ function requestTopOverlayClose2(reason, trigger) {
|
|
|
4833
5341
|
|
|
4834
5342
|
// src/overlay/positioning.ts
|
|
4835
5343
|
var DEFAULT_AFFORDANCE_NEAR_RADIUS2 = 16;
|
|
4836
|
-
|
|
5344
|
+
var anchorSequence2 = 0;
|
|
5345
|
+
var anchorBindings2 = /* @__PURE__ */ new WeakMap();
|
|
5346
|
+
function bindAnchorName2(anchor, name) {
|
|
5347
|
+
const binding = anchorBindings2.get(anchor) ?? {
|
|
5348
|
+
original: anchor.style.getPropertyValue("anchor-name"),
|
|
5349
|
+
names: /* @__PURE__ */ new Set()
|
|
5350
|
+
};
|
|
5351
|
+
binding.names.add(name);
|
|
5352
|
+
anchorBindings2.set(anchor, binding);
|
|
5353
|
+
const values = [binding.original, ...binding.names].filter(Boolean);
|
|
5354
|
+
anchor.style.setProperty("anchor-name", values.join(", "));
|
|
5355
|
+
}
|
|
5356
|
+
function unbindAnchorName2(anchor, name) {
|
|
5357
|
+
const binding = anchorBindings2.get(anchor);
|
|
5358
|
+
if (!binding) return;
|
|
5359
|
+
binding.names.delete(name);
|
|
5360
|
+
if (binding.names.size) {
|
|
5361
|
+
const values = [binding.original, ...binding.names].filter(Boolean);
|
|
5362
|
+
anchor.style.setProperty("anchor-name", values.join(", "));
|
|
5363
|
+
return;
|
|
5364
|
+
}
|
|
5365
|
+
if (binding.original) anchor.style.setProperty("anchor-name", binding.original);
|
|
5366
|
+
else anchor.style.removeProperty("anchor-name");
|
|
5367
|
+
anchorBindings2.delete(anchor);
|
|
5368
|
+
}
|
|
5369
|
+
function supportsAnchorPositioning2(owner) {
|
|
5370
|
+
const css = owner.CSS;
|
|
5371
|
+
return typeof css?.supports === "function" && css.supports("anchor-name: --ui-anchor-test") && css.supports("position-anchor: --ui-anchor-test") && css.supports("top: anchor(bottom)");
|
|
5372
|
+
}
|
|
5373
|
+
function topLayerOpen2(surface) {
|
|
5374
|
+
try {
|
|
5375
|
+
return surface.matches(":popover-open");
|
|
5376
|
+
} catch {
|
|
5377
|
+
return !surface.hidden;
|
|
5378
|
+
}
|
|
5379
|
+
}
|
|
5380
|
+
function showInTopLayer2(surface) {
|
|
5381
|
+
surface.setAttribute("popover", "manual");
|
|
5382
|
+
surface.hidden = false;
|
|
5383
|
+
if (typeof surface.showPopover === "function" && !topLayerOpen2(surface)) {
|
|
5384
|
+
try {
|
|
5385
|
+
surface.showPopover();
|
|
5386
|
+
} catch {
|
|
5387
|
+
}
|
|
5388
|
+
}
|
|
5389
|
+
}
|
|
5390
|
+
function hideFromTopLayer2(surface) {
|
|
5391
|
+
if (typeof surface.hidePopover === "function" && topLayerOpen2(surface)) {
|
|
5392
|
+
try {
|
|
5393
|
+
surface.hidePopover();
|
|
5394
|
+
} catch {
|
|
5395
|
+
}
|
|
5396
|
+
}
|
|
5397
|
+
surface.hidden = true;
|
|
5398
|
+
}
|
|
5399
|
+
function createViewportSurface2(surface) {
|
|
5400
|
+
surface.setAttribute("popover", "manual");
|
|
5401
|
+
surface.dataset.uiPositioning = "viewport";
|
|
5402
|
+
return {
|
|
5403
|
+
show() {
|
|
5404
|
+
showInTopLayer2(surface);
|
|
5405
|
+
},
|
|
5406
|
+
hide() {
|
|
5407
|
+
hideFromTopLayer2(surface);
|
|
5408
|
+
},
|
|
5409
|
+
destroy() {
|
|
5410
|
+
hideFromTopLayer2(surface);
|
|
5411
|
+
}
|
|
5412
|
+
};
|
|
5413
|
+
}
|
|
5414
|
+
function fallbackPosition2(surface, anchor, placement, gap, viewportGap) {
|
|
5415
|
+
const owner = surface.ownerDocument.defaultView ?? window;
|
|
5416
|
+
const viewport = getVisualViewportRect2(owner);
|
|
5417
|
+
const rect = surface.getBoundingClientRect();
|
|
5418
|
+
const preferTop = placement.startsWith("top");
|
|
5419
|
+
const preferEnd = placement.endsWith("end");
|
|
5420
|
+
const spaceBelow = viewport.bottom - anchor.bottom - viewportGap;
|
|
5421
|
+
const spaceAbove = anchor.top - viewport.top - viewportGap;
|
|
5422
|
+
const useTop = preferTop ? !(spaceAbove < rect.height + gap && spaceBelow > spaceAbove) : spaceBelow < rect.height + gap && spaceAbove > spaceBelow;
|
|
5423
|
+
const unclampedTop = useTop ? anchor.top - rect.height - gap : anchor.bottom + gap;
|
|
5424
|
+
const unclampedLeft = preferEnd ? anchor.right - rect.width : anchor.left;
|
|
5425
|
+
const shifted = clampRectToViewport2({
|
|
5426
|
+
left: unclampedLeft,
|
|
5427
|
+
top: unclampedTop,
|
|
5428
|
+
right: unclampedLeft + rect.width,
|
|
5429
|
+
bottom: unclampedTop + rect.height,
|
|
5430
|
+
width: rect.width,
|
|
5431
|
+
height: rect.height
|
|
5432
|
+
}, viewport, viewportGap);
|
|
5433
|
+
surface.style.left = `${Math.round(unclampedLeft + shifted.x)}px`;
|
|
5434
|
+
surface.style.top = `${Math.round(unclampedTop + shifted.y)}px`;
|
|
5435
|
+
surface.style.right = "auto";
|
|
5436
|
+
surface.style.bottom = "auto";
|
|
5437
|
+
}
|
|
5438
|
+
function createAnchoredSurface2(surface, options = {}) {
|
|
5439
|
+
const owner = surface.ownerDocument.defaultView ?? window;
|
|
5440
|
+
const placement = options.placement ?? "bottom-start";
|
|
5441
|
+
const gap = Math.max(0, options.gap ?? 4);
|
|
5442
|
+
const viewportGap = Math.max(0, options.viewportGap ?? 8);
|
|
5443
|
+
const nativeAnchor = supportsAnchorPositioning2(owner);
|
|
5444
|
+
const anchorName = `--ui-anchor-${++anchorSequence2}`;
|
|
5445
|
+
let anchor = options.anchor ?? null;
|
|
5446
|
+
let point = null;
|
|
5447
|
+
let open = false;
|
|
5448
|
+
let frame = null;
|
|
5449
|
+
let listenerAbort = null;
|
|
5450
|
+
surface.setAttribute("popover", "manual");
|
|
5451
|
+
surface.dataset.uiPositioning = nativeAnchor ? "anchor" : "fallback";
|
|
5452
|
+
surface.style.position = "fixed";
|
|
5453
|
+
surface.style.margin = "0";
|
|
5454
|
+
const bindAnchor = (next) => {
|
|
5455
|
+
if (anchor) unbindAnchorName2(anchor, anchorName);
|
|
5456
|
+
anchor = next;
|
|
5457
|
+
if (!anchor) {
|
|
5458
|
+
surface.style.removeProperty("position-anchor");
|
|
5459
|
+
return;
|
|
5460
|
+
}
|
|
5461
|
+
bindAnchorName2(anchor, anchorName);
|
|
5462
|
+
surface.style.setProperty("position-anchor", anchorName);
|
|
5463
|
+
};
|
|
5464
|
+
const positionNative = () => {
|
|
5465
|
+
const blockEnd = placement.startsWith("bottom");
|
|
5466
|
+
const inlineEnd = placement.endsWith("end");
|
|
5467
|
+
surface.style.top = blockEnd ? `calc(anchor(bottom) + ${gap}px)` : "auto";
|
|
5468
|
+
surface.style.bottom = blockEnd ? "auto" : `calc(anchor(top) + ${gap}px)`;
|
|
5469
|
+
surface.style.left = inlineEnd ? "auto" : "anchor(left)";
|
|
5470
|
+
surface.style.right = inlineEnd ? "anchor(right)" : "auto";
|
|
5471
|
+
surface.style.setProperty("position-try-fallbacks", "flip-block, flip-inline");
|
|
5472
|
+
};
|
|
5473
|
+
const position = () => {
|
|
5474
|
+
frame = null;
|
|
5475
|
+
if (!open) return;
|
|
5476
|
+
if (point) {
|
|
5477
|
+
fallbackPosition2(surface, {
|
|
5478
|
+
left: point.x,
|
|
5479
|
+
right: point.x,
|
|
5480
|
+
top: point.y,
|
|
5481
|
+
bottom: point.y,
|
|
5482
|
+
width: 0,
|
|
5483
|
+
height: 0
|
|
5484
|
+
}, "bottom-start", gap, viewportGap);
|
|
5485
|
+
return;
|
|
5486
|
+
}
|
|
5487
|
+
if (!anchor) return;
|
|
5488
|
+
if (nativeAnchor) positionNative();
|
|
5489
|
+
else fallbackPosition2(surface, anchor.getBoundingClientRect(), placement, gap, viewportGap);
|
|
5490
|
+
};
|
|
5491
|
+
const schedule = () => {
|
|
5492
|
+
if (!open || frame !== null) return;
|
|
5493
|
+
frame = owner.requestAnimationFrame(position);
|
|
5494
|
+
};
|
|
5495
|
+
const syncFallbackListeners = () => {
|
|
5496
|
+
const needsListeners = open && (point !== null || !nativeAnchor);
|
|
5497
|
+
if (!needsListeners) {
|
|
5498
|
+
listenerAbort?.abort();
|
|
5499
|
+
listenerAbort = null;
|
|
5500
|
+
return;
|
|
5501
|
+
}
|
|
5502
|
+
if (listenerAbort) return;
|
|
5503
|
+
listenerAbort = new AbortController();
|
|
5504
|
+
const signal = listenerAbort.signal;
|
|
5505
|
+
owner.addEventListener("resize", schedule, { passive: true, signal });
|
|
5506
|
+
owner.addEventListener("scroll", schedule, { passive: true, capture: true, signal });
|
|
5507
|
+
owner.visualViewport?.addEventListener("resize", schedule, { passive: true, signal });
|
|
5508
|
+
owner.visualViewport?.addEventListener("scroll", schedule, { passive: true, signal });
|
|
5509
|
+
};
|
|
5510
|
+
bindAnchor(anchor);
|
|
5511
|
+
return {
|
|
5512
|
+
setAnchor(next) {
|
|
5513
|
+
point = null;
|
|
5514
|
+
bindAnchor(next);
|
|
5515
|
+
syncFallbackListeners();
|
|
5516
|
+
schedule();
|
|
5517
|
+
},
|
|
5518
|
+
show() {
|
|
5519
|
+
point = null;
|
|
5520
|
+
open = true;
|
|
5521
|
+
syncFallbackListeners();
|
|
5522
|
+
showInTopLayer2(surface);
|
|
5523
|
+
position();
|
|
5524
|
+
},
|
|
5525
|
+
showAtPoint(nextPoint) {
|
|
5526
|
+
point = nextPoint;
|
|
5527
|
+
open = true;
|
|
5528
|
+
syncFallbackListeners();
|
|
5529
|
+
showInTopLayer2(surface);
|
|
5530
|
+
position();
|
|
5531
|
+
},
|
|
5532
|
+
hide() {
|
|
5533
|
+
open = false;
|
|
5534
|
+
point = null;
|
|
5535
|
+
syncFallbackListeners();
|
|
5536
|
+
if (frame !== null) owner.cancelAnimationFrame(frame);
|
|
5537
|
+
frame = null;
|
|
5538
|
+
hideFromTopLayer2(surface);
|
|
5539
|
+
},
|
|
5540
|
+
refresh: schedule,
|
|
5541
|
+
destroy() {
|
|
5542
|
+
open = false;
|
|
5543
|
+
listenerAbort?.abort();
|
|
5544
|
+
listenerAbort = null;
|
|
5545
|
+
if (frame !== null) owner.cancelAnimationFrame(frame);
|
|
5546
|
+
frame = null;
|
|
5547
|
+
hideFromTopLayer2(surface);
|
|
5548
|
+
bindAnchor(null);
|
|
5549
|
+
}
|
|
5550
|
+
};
|
|
5551
|
+
}
|
|
5552
|
+
function getVisualViewportRect2(owner = window) {
|
|
4837
5553
|
const viewport = owner.visualViewport;
|
|
4838
5554
|
const left = viewport?.offsetLeft ?? 0;
|
|
4839
5555
|
const top = viewport?.offsetTop ?? 0;
|
|
@@ -4848,7 +5564,7 @@ function getVisualViewportRect(owner = window) {
|
|
|
4848
5564
|
height
|
|
4849
5565
|
};
|
|
4850
5566
|
}
|
|
4851
|
-
function
|
|
5567
|
+
function clampRectToViewport2(rect, viewport = getVisualViewportRect2(), gutter = 0) {
|
|
4852
5568
|
const availableWidth = Math.max(0, viewport.width - gutter * 2);
|
|
4853
5569
|
const availableHeight = Math.max(0, viewport.height - gutter * 2);
|
|
4854
5570
|
const targetLeft = rect.width > availableWidth ? viewport.left + gutter : Math.min(
|
|
@@ -5056,6 +5772,7 @@ function createHoverIntent2(delay, onIntent) {
|
|
|
5056
5772
|
}
|
|
5057
5773
|
|
|
5058
5774
|
// index.ts
|
|
5775
|
+
if (typeof document !== "undefined") initializeInputModality(document);
|
|
5059
5776
|
defineCustomElements();
|
|
5060
5777
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5061
5778
|
0 && (module.exports = {
|
|
@@ -5064,11 +5781,14 @@ defineCustomElements();
|
|
|
5064
5781
|
clampRectToViewport,
|
|
5065
5782
|
classifyDropPosition,
|
|
5066
5783
|
closeOverlay,
|
|
5784
|
+
createAnchoredSurface,
|
|
5067
5785
|
createHoverIntent,
|
|
5068
5786
|
createProximityCoordinator,
|
|
5787
|
+
createViewportSurface,
|
|
5069
5788
|
distanceFromPointToRect,
|
|
5070
5789
|
getTopOverlay,
|
|
5071
5790
|
getVisualViewportRect,
|
|
5791
|
+
initializeInputModality,
|
|
5072
5792
|
isTopOverlay,
|
|
5073
5793
|
loomaIconMarkup,
|
|
5074
5794
|
openOverlay,
|