@threadlabs/looma 0.1.15 → 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/{chunk-IITL6UBR.js → chunk-5KWCMTXB.js} +3 -0
- package/vue/editor/index.js +63 -52
- package/vue/index.js +1 -1
- 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
|
@@ -1,56 +1,85 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
2
|
import { openOverlay, closeOverlay, requestTopOverlayClose } from "../../overlay/manager";
|
|
3
3
|
import { dispatchDetail } from "../../utils/events";
|
|
4
|
+
import { createAnchoredSurface, } from "../../overlay/positioning";
|
|
4
5
|
export class UITooltip {
|
|
5
6
|
host;
|
|
6
7
|
for = '';
|
|
7
8
|
open = false;
|
|
8
9
|
defaultOpen = false;
|
|
10
|
+
placement = 'top-start';
|
|
11
|
+
/** Pointer hover intent delay in milliseconds. Keyboard focus is immediate. */
|
|
12
|
+
showDelay = 500;
|
|
13
|
+
/** Pointer leave grace period in milliseconds. */
|
|
14
|
+
hideDelay = 100;
|
|
9
15
|
internalOpen = false;
|
|
10
16
|
overlayId = `ui-tooltip-${Math.random().toString(36).slice(2, 11)}`;
|
|
11
17
|
trigger = null;
|
|
18
|
+
surface = null;
|
|
19
|
+
showTimer = null;
|
|
20
|
+
hideTimer = null;
|
|
12
21
|
syncFromProp() {
|
|
22
|
+
this.clearTimers();
|
|
13
23
|
this.internalOpen = this.open;
|
|
14
24
|
}
|
|
25
|
+
resetSurface() {
|
|
26
|
+
this.syncTrigger();
|
|
27
|
+
this.setupSurface();
|
|
28
|
+
this.syncOverlay();
|
|
29
|
+
}
|
|
15
30
|
syncOverlay() {
|
|
16
31
|
if (this.internalOpen) {
|
|
32
|
+
this.surface?.show();
|
|
17
33
|
openOverlay({
|
|
18
34
|
id: this.overlayId,
|
|
19
35
|
modal: false,
|
|
20
36
|
element: this.host,
|
|
37
|
+
relatedElements: this.trigger ? [this.trigger] : undefined,
|
|
21
38
|
dismissible: true,
|
|
22
39
|
requestClose: (reason, trigger) => this.handleRequestClose(reason, trigger),
|
|
23
40
|
});
|
|
24
41
|
}
|
|
25
42
|
else {
|
|
43
|
+
this.surface?.hide();
|
|
26
44
|
closeOverlay(this.overlayId);
|
|
27
45
|
}
|
|
28
46
|
}
|
|
29
47
|
componentDidLoad() {
|
|
30
48
|
this.syncFromProp();
|
|
31
49
|
this.internalOpen = this.internalOpen || this.defaultOpen;
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
50
|
+
this.syncTrigger();
|
|
51
|
+
this.setupSurface();
|
|
34
52
|
this.host.addEventListener('keydown', this.onKeydown);
|
|
35
53
|
this.syncOverlay();
|
|
36
54
|
}
|
|
37
55
|
componentDidUpdate() {
|
|
38
|
-
this.
|
|
39
|
-
this.attachTriggerListeners();
|
|
40
|
-
this.syncOverlay();
|
|
56
|
+
this.syncTrigger();
|
|
41
57
|
}
|
|
42
58
|
disconnectedCallback() {
|
|
59
|
+
this.clearTimers();
|
|
43
60
|
this.detachTriggerListeners();
|
|
61
|
+
this.surface?.destroy();
|
|
62
|
+
this.surface = null;
|
|
44
63
|
this.host.removeEventListener('keydown', this.onKeydown);
|
|
45
64
|
closeOverlay(this.overlayId);
|
|
46
65
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
this.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
66
|
+
syncTrigger() {
|
|
67
|
+
const next = this.for
|
|
68
|
+
? this.host.ownerDocument.getElementById(this.for)
|
|
69
|
+
: this.host.previousElementSibling;
|
|
70
|
+
if (next === this.trigger)
|
|
71
|
+
return;
|
|
72
|
+
this.detachTriggerListeners();
|
|
73
|
+
this.trigger = next;
|
|
74
|
+
this.attachTriggerListeners();
|
|
75
|
+
this.surface?.setAnchor(next);
|
|
76
|
+
}
|
|
77
|
+
setupSurface() {
|
|
78
|
+
this.surface?.destroy();
|
|
79
|
+
this.surface = createAnchoredSurface(this.host, {
|
|
80
|
+
anchor: this.trigger,
|
|
81
|
+
placement: this.placement,
|
|
82
|
+
});
|
|
54
83
|
}
|
|
55
84
|
attachTriggerListeners() {
|
|
56
85
|
this.detachTriggerListeners();
|
|
@@ -69,31 +98,64 @@ export class UITooltip {
|
|
|
69
98
|
this.trigger.removeEventListener('focusin', this.onTriggerFocusIn);
|
|
70
99
|
this.trigger.removeEventListener('focusout', this.onTriggerFocusOut);
|
|
71
100
|
}
|
|
101
|
+
clearShowTimer() {
|
|
102
|
+
if (this.showTimer === null)
|
|
103
|
+
return;
|
|
104
|
+
clearTimeout(this.showTimer);
|
|
105
|
+
this.showTimer = null;
|
|
106
|
+
}
|
|
107
|
+
clearHideTimer() {
|
|
108
|
+
if (this.hideTimer === null)
|
|
109
|
+
return;
|
|
110
|
+
clearTimeout(this.hideTimer);
|
|
111
|
+
this.hideTimer = null;
|
|
112
|
+
}
|
|
113
|
+
clearTimers() {
|
|
114
|
+
this.clearShowTimer();
|
|
115
|
+
this.clearHideTimer();
|
|
116
|
+
}
|
|
117
|
+
setInteractionOpen(nextOpen, trigger) {
|
|
118
|
+
if (this.internalOpen === nextOpen)
|
|
119
|
+
return;
|
|
120
|
+
this.internalOpen = nextOpen;
|
|
121
|
+
dispatchDetail(this.host, nextOpen ? 'open' : 'close', {
|
|
122
|
+
open: nextOpen,
|
|
123
|
+
reason: 'action',
|
|
124
|
+
trigger,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
72
127
|
onTriggerEnter = () => {
|
|
73
|
-
this.
|
|
74
|
-
|
|
75
|
-
|
|
128
|
+
this.clearHideTimer();
|
|
129
|
+
if (this.internalOpen || this.showTimer !== null)
|
|
130
|
+
return;
|
|
131
|
+
this.showTimer = setTimeout(() => {
|
|
132
|
+
this.showTimer = null;
|
|
133
|
+
this.setInteractionOpen(true, 'pointer');
|
|
134
|
+
}, Math.max(0, this.showDelay));
|
|
76
135
|
};
|
|
77
136
|
onTriggerLeave = () => {
|
|
78
|
-
this.
|
|
79
|
-
|
|
80
|
-
|
|
137
|
+
this.clearShowTimer();
|
|
138
|
+
if (!this.internalOpen || this.hideTimer !== null)
|
|
139
|
+
return;
|
|
140
|
+
this.hideTimer = setTimeout(() => {
|
|
141
|
+
this.hideTimer = null;
|
|
142
|
+
this.setInteractionOpen(false, 'pointer');
|
|
143
|
+
}, Math.max(0, this.hideDelay));
|
|
81
144
|
};
|
|
82
145
|
onTriggerFocusIn = () => {
|
|
83
|
-
this.
|
|
84
|
-
|
|
85
|
-
this.syncOverlay();
|
|
146
|
+
this.clearTimers();
|
|
147
|
+
this.setInteractionOpen(true, 'keyboard');
|
|
86
148
|
};
|
|
87
149
|
onTriggerFocusOut = (e) => {
|
|
88
150
|
const related = e.relatedTarget;
|
|
89
151
|
if (related && this.host.contains(related))
|
|
90
152
|
return;
|
|
91
|
-
this.
|
|
92
|
-
|
|
93
|
-
this.syncOverlay();
|
|
153
|
+
this.clearTimers();
|
|
154
|
+
this.setInteractionOpen(false, 'keyboard');
|
|
94
155
|
};
|
|
95
156
|
handleRequestClose(reason, trigger) {
|
|
96
157
|
if (reason === 'escape') {
|
|
158
|
+
this.clearTimers();
|
|
97
159
|
this.internalOpen = false;
|
|
98
160
|
dispatchDetail(this.host, 'close', {
|
|
99
161
|
open: false,
|
|
@@ -109,7 +171,7 @@ export class UITooltip {
|
|
|
109
171
|
}
|
|
110
172
|
};
|
|
111
173
|
render() {
|
|
112
|
-
return (h(Host, { key: '
|
|
174
|
+
return (h(Host, { key: '4c3890a7371508ede06a5b370d1cec32db25280f', role: "tooltip", hidden: !this.internalOpen, "data-open": this.internalOpen ? '' : undefined, onKeyDown: this.onKeydown }, h("slot", { key: '2e3bcd0dc69b0c3e3376d73dc4efc82e4f4cfaaa' })));
|
|
113
175
|
}
|
|
114
176
|
static get is() { return "ui-tooltip"; }
|
|
115
177
|
static get encapsulation() { return "shadow"; }
|
|
@@ -184,6 +246,73 @@ export class UITooltip {
|
|
|
184
246
|
"reflect": false,
|
|
185
247
|
"attribute": "default-open",
|
|
186
248
|
"defaultValue": "false"
|
|
249
|
+
},
|
|
250
|
+
"placement": {
|
|
251
|
+
"type": "string",
|
|
252
|
+
"mutable": false,
|
|
253
|
+
"complexType": {
|
|
254
|
+
"original": "AnchoredPlacement",
|
|
255
|
+
"resolved": "\"bottom-end\" | \"bottom-start\" | \"top-end\" | \"top-start\"",
|
|
256
|
+
"references": {
|
|
257
|
+
"AnchoredPlacement": {
|
|
258
|
+
"location": "import",
|
|
259
|
+
"path": "../../overlay/positioning",
|
|
260
|
+
"id": "src/overlay/positioning.ts::AnchoredPlacement",
|
|
261
|
+
"referenceLocation": "AnchoredPlacement"
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
"required": false,
|
|
266
|
+
"optional": false,
|
|
267
|
+
"docs": {
|
|
268
|
+
"tags": [],
|
|
269
|
+
"text": ""
|
|
270
|
+
},
|
|
271
|
+
"getter": false,
|
|
272
|
+
"setter": false,
|
|
273
|
+
"reflect": false,
|
|
274
|
+
"attribute": "placement",
|
|
275
|
+
"defaultValue": "'top-start'"
|
|
276
|
+
},
|
|
277
|
+
"showDelay": {
|
|
278
|
+
"type": "number",
|
|
279
|
+
"mutable": false,
|
|
280
|
+
"complexType": {
|
|
281
|
+
"original": "number",
|
|
282
|
+
"resolved": "number",
|
|
283
|
+
"references": {}
|
|
284
|
+
},
|
|
285
|
+
"required": false,
|
|
286
|
+
"optional": false,
|
|
287
|
+
"docs": {
|
|
288
|
+
"tags": [],
|
|
289
|
+
"text": "Pointer hover intent delay in milliseconds. Keyboard focus is immediate."
|
|
290
|
+
},
|
|
291
|
+
"getter": false,
|
|
292
|
+
"setter": false,
|
|
293
|
+
"reflect": false,
|
|
294
|
+
"attribute": "show-delay",
|
|
295
|
+
"defaultValue": "500"
|
|
296
|
+
},
|
|
297
|
+
"hideDelay": {
|
|
298
|
+
"type": "number",
|
|
299
|
+
"mutable": false,
|
|
300
|
+
"complexType": {
|
|
301
|
+
"original": "number",
|
|
302
|
+
"resolved": "number",
|
|
303
|
+
"references": {}
|
|
304
|
+
},
|
|
305
|
+
"required": false,
|
|
306
|
+
"optional": false,
|
|
307
|
+
"docs": {
|
|
308
|
+
"tags": [],
|
|
309
|
+
"text": "Pointer leave grace period in milliseconds."
|
|
310
|
+
},
|
|
311
|
+
"getter": false,
|
|
312
|
+
"setter": false,
|
|
313
|
+
"reflect": false,
|
|
314
|
+
"attribute": "hide-delay",
|
|
315
|
+
"defaultValue": "100"
|
|
187
316
|
}
|
|
188
317
|
};
|
|
189
318
|
}
|
|
@@ -197,6 +326,12 @@ export class UITooltip {
|
|
|
197
326
|
return [{
|
|
198
327
|
"propName": "open",
|
|
199
328
|
"methodName": "syncFromProp"
|
|
329
|
+
}, {
|
|
330
|
+
"propName": "for",
|
|
331
|
+
"methodName": "resetSurface"
|
|
332
|
+
}, {
|
|
333
|
+
"propName": "placement",
|
|
334
|
+
"methodName": "resetSurface"
|
|
200
335
|
}, {
|
|
201
336
|
"propName": "internalOpen",
|
|
202
337
|
"methodName": "syncOverlay"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
:host {
|
|
2
2
|
--ui-tree-indent: 16px;
|
|
3
|
-
--ui-tree-row-min-height:
|
|
3
|
+
--ui-tree-row-min-height: 32px;
|
|
4
4
|
--ui-tree-drop-color: var(--ui-accent-solid);
|
|
5
5
|
|
|
6
6
|
position: relative;
|
|
@@ -16,13 +16,15 @@
|
|
|
16
16
|
align-items: center;
|
|
17
17
|
min-block-size: var(--ui-tree-row-min-height);
|
|
18
18
|
min-inline-size: 0;
|
|
19
|
+
font-size: var(--ui-tree-font-size, var(--ui-font-size-ui, 0.9375rem));
|
|
19
20
|
border-radius: var(--ui-radius-md);
|
|
20
21
|
color: var(--ui-text-secondary);
|
|
21
22
|
transition:
|
|
22
23
|
background-color var(--ui-motion-fast) var(--ui-motion-ease),
|
|
23
24
|
color var(--ui-motion-fast) var(--ui-motion-ease),
|
|
24
25
|
opacity var(--ui-motion-fast) var(--ui-motion-ease),
|
|
25
|
-
box-shadow var(--ui-motion-fast) var(--ui-motion-ease)
|
|
26
|
+
box-shadow var(--ui-motion-fast) var(--ui-motion-ease),
|
|
27
|
+
min-block-size var(--ui-motion-base) var(--ui-motion-ease);
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
.row:hover,
|
|
@@ -198,10 +200,12 @@
|
|
|
198
200
|
display: none;
|
|
199
201
|
}
|
|
200
202
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
:host-context(html[data-ui-input-modality='touch']) {
|
|
204
|
+
--ui-tree-row-min-height: 44px;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
:host-context(html[data-ui-input-modality='touch']) .drag-handle {
|
|
208
|
+
display: none;
|
|
205
209
|
}
|
|
206
210
|
|
|
207
211
|
@media (prefers-reduced-motion: reduce) {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const initializedDocuments = new WeakSet();
|
|
2
|
+
/**
|
|
3
|
+
* Reflects real touch use instead of guessing from device capability media
|
|
4
|
+
* queries. Hybrid devices therefore keep compact pointer affordances until the
|
|
5
|
+
* user actually touches the interface.
|
|
6
|
+
*/
|
|
7
|
+
export function initializeInputModality(owner = document) {
|
|
8
|
+
if (initializedDocuments.has(owner))
|
|
9
|
+
return;
|
|
10
|
+
initializedDocuments.add(owner);
|
|
11
|
+
const markTouch = () => {
|
|
12
|
+
if (owner.documentElement.getAttribute("data-ui-input-modality") === "touch")
|
|
13
|
+
return;
|
|
14
|
+
owner.documentElement.setAttribute("data-ui-input-modality", "touch");
|
|
15
|
+
owner.dispatchEvent(new CustomEvent("ui-input-modality-change", {
|
|
16
|
+
detail: { modality: "touch" },
|
|
17
|
+
}));
|
|
18
|
+
};
|
|
19
|
+
owner.addEventListener("pointerdown", (event) => {
|
|
20
|
+
if (event.pointerType === "touch")
|
|
21
|
+
markTouch();
|
|
22
|
+
}, { capture: true, passive: true });
|
|
23
|
+
owner.addEventListener("touchstart", markTouch, { capture: true, passive: true });
|
|
24
|
+
}
|
|
@@ -30,8 +30,11 @@ function handleLightDismiss(event) {
|
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
const target = event.target;
|
|
33
|
-
if (target instanceof Node
|
|
34
|
-
|
|
33
|
+
if (target instanceof Node) {
|
|
34
|
+
if (top.element.contains(target))
|
|
35
|
+
return;
|
|
36
|
+
if (top.relatedElements?.some((element) => element.contains(target)))
|
|
37
|
+
return;
|
|
35
38
|
}
|
|
36
39
|
requestTopOverlayClose("light-dismiss", "pointer");
|
|
37
40
|
}
|
|
@@ -1,4 +1,250 @@
|
|
|
1
1
|
export const DEFAULT_AFFORDANCE_NEAR_RADIUS = 16;
|
|
2
|
+
let anchorSequence = 0;
|
|
3
|
+
const anchorBindings = new WeakMap();
|
|
4
|
+
function bindAnchorName(anchor, name) {
|
|
5
|
+
const binding = anchorBindings.get(anchor) ?? {
|
|
6
|
+
original: anchor.style.getPropertyValue("anchor-name"),
|
|
7
|
+
names: new Set(),
|
|
8
|
+
};
|
|
9
|
+
binding.names.add(name);
|
|
10
|
+
anchorBindings.set(anchor, binding);
|
|
11
|
+
const values = [binding.original, ...binding.names].filter(Boolean);
|
|
12
|
+
anchor.style.setProperty("anchor-name", values.join(", "));
|
|
13
|
+
}
|
|
14
|
+
function unbindAnchorName(anchor, name) {
|
|
15
|
+
const binding = anchorBindings.get(anchor);
|
|
16
|
+
if (!binding)
|
|
17
|
+
return;
|
|
18
|
+
binding.names.delete(name);
|
|
19
|
+
if (binding.names.size) {
|
|
20
|
+
const values = [binding.original, ...binding.names].filter(Boolean);
|
|
21
|
+
anchor.style.setProperty("anchor-name", values.join(", "));
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (binding.original)
|
|
25
|
+
anchor.style.setProperty("anchor-name", binding.original);
|
|
26
|
+
else
|
|
27
|
+
anchor.style.removeProperty("anchor-name");
|
|
28
|
+
anchorBindings.delete(anchor);
|
|
29
|
+
}
|
|
30
|
+
function supportsAnchorPositioning(owner) {
|
|
31
|
+
const css = owner.CSS;
|
|
32
|
+
return typeof css?.supports === "function"
|
|
33
|
+
&& css.supports("anchor-name: --ui-anchor-test")
|
|
34
|
+
&& css.supports("position-anchor: --ui-anchor-test")
|
|
35
|
+
&& css.supports("top: anchor(bottom)");
|
|
36
|
+
}
|
|
37
|
+
function topLayerOpen(surface) {
|
|
38
|
+
try {
|
|
39
|
+
return surface.matches(":popover-open");
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return !surface.hidden;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function showInTopLayer(surface) {
|
|
46
|
+
surface.setAttribute("popover", "manual");
|
|
47
|
+
surface.hidden = false;
|
|
48
|
+
if (typeof surface.showPopover === "function" && !topLayerOpen(surface)) {
|
|
49
|
+
try {
|
|
50
|
+
surface.showPopover();
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
// A disconnected or already-transitioning surface still receives the
|
|
54
|
+
// fixed-position fallback below and will be retried on the next sync.
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function hideFromTopLayer(surface) {
|
|
59
|
+
if (typeof surface.hidePopover === "function" && topLayerOpen(surface)) {
|
|
60
|
+
try {
|
|
61
|
+
surface.hidePopover();
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
// The surface may have been disconnected between state and DOM updates.
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
surface.hidden = true;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Places unanchored floating UI, such as a toast region, in the browser top
|
|
71
|
+
* layer. Its viewport position remains CSS-owned; the controller only provides
|
|
72
|
+
* the native Popover API boundary and its no-Popover fallback.
|
|
73
|
+
*/
|
|
74
|
+
export function createViewportSurface(surface) {
|
|
75
|
+
surface.setAttribute("popover", "manual");
|
|
76
|
+
surface.dataset.uiPositioning = "viewport";
|
|
77
|
+
return {
|
|
78
|
+
show() {
|
|
79
|
+
showInTopLayer(surface);
|
|
80
|
+
},
|
|
81
|
+
hide() {
|
|
82
|
+
hideFromTopLayer(surface);
|
|
83
|
+
},
|
|
84
|
+
destroy() {
|
|
85
|
+
hideFromTopLayer(surface);
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function fallbackPosition(surface, anchor, placement, gap, viewportGap) {
|
|
90
|
+
const owner = surface.ownerDocument.defaultView ?? window;
|
|
91
|
+
const viewport = getVisualViewportRect(owner);
|
|
92
|
+
const rect = surface.getBoundingClientRect();
|
|
93
|
+
const preferTop = placement.startsWith("top");
|
|
94
|
+
const preferEnd = placement.endsWith("end");
|
|
95
|
+
const spaceBelow = viewport.bottom - anchor.bottom - viewportGap;
|
|
96
|
+
const spaceAbove = anchor.top - viewport.top - viewportGap;
|
|
97
|
+
const useTop = preferTop
|
|
98
|
+
? !(spaceAbove < rect.height + gap && spaceBelow > spaceAbove)
|
|
99
|
+
: spaceBelow < rect.height + gap && spaceAbove > spaceBelow;
|
|
100
|
+
const unclampedTop = useTop
|
|
101
|
+
? anchor.top - rect.height - gap
|
|
102
|
+
: anchor.bottom + gap;
|
|
103
|
+
const unclampedLeft = preferEnd
|
|
104
|
+
? anchor.right - rect.width
|
|
105
|
+
: anchor.left;
|
|
106
|
+
const shifted = clampRectToViewport({
|
|
107
|
+
left: unclampedLeft,
|
|
108
|
+
top: unclampedTop,
|
|
109
|
+
right: unclampedLeft + rect.width,
|
|
110
|
+
bottom: unclampedTop + rect.height,
|
|
111
|
+
width: rect.width,
|
|
112
|
+
height: rect.height,
|
|
113
|
+
}, viewport, viewportGap);
|
|
114
|
+
surface.style.left = `${Math.round(unclampedLeft + shifted.x)}px`;
|
|
115
|
+
surface.style.top = `${Math.round(unclampedTop + shifted.y)}px`;
|
|
116
|
+
surface.style.right = "auto";
|
|
117
|
+
surface.style.bottom = "auto";
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* One lightweight positioning controller for Looma floating UI. Native
|
|
121
|
+
* Popover provides the top layer and CSS Anchor Positioning follows a named
|
|
122
|
+
* element. Browsers without Anchor Positioning use the same flip/shift
|
|
123
|
+
* geometry through scroll/resize listeners that exist only while open.
|
|
124
|
+
*/
|
|
125
|
+
export function createAnchoredSurface(surface, options = {}) {
|
|
126
|
+
const owner = surface.ownerDocument.defaultView ?? window;
|
|
127
|
+
const placement = options.placement ?? "bottom-start";
|
|
128
|
+
const gap = Math.max(0, options.gap ?? 4);
|
|
129
|
+
const viewportGap = Math.max(0, options.viewportGap ?? 8);
|
|
130
|
+
const nativeAnchor = supportsAnchorPositioning(owner);
|
|
131
|
+
const anchorName = `--ui-anchor-${++anchorSequence}`;
|
|
132
|
+
let anchor = options.anchor ?? null;
|
|
133
|
+
let point = null;
|
|
134
|
+
let open = false;
|
|
135
|
+
let frame = null;
|
|
136
|
+
let listenerAbort = null;
|
|
137
|
+
surface.setAttribute("popover", "manual");
|
|
138
|
+
surface.dataset.uiPositioning = nativeAnchor ? "anchor" : "fallback";
|
|
139
|
+
surface.style.position = "fixed";
|
|
140
|
+
surface.style.margin = "0";
|
|
141
|
+
const bindAnchor = (next) => {
|
|
142
|
+
if (anchor)
|
|
143
|
+
unbindAnchorName(anchor, anchorName);
|
|
144
|
+
anchor = next;
|
|
145
|
+
if (!anchor) {
|
|
146
|
+
surface.style.removeProperty("position-anchor");
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
bindAnchorName(anchor, anchorName);
|
|
150
|
+
surface.style.setProperty("position-anchor", anchorName);
|
|
151
|
+
};
|
|
152
|
+
const positionNative = () => {
|
|
153
|
+
const blockEnd = placement.startsWith("bottom");
|
|
154
|
+
const inlineEnd = placement.endsWith("end");
|
|
155
|
+
surface.style.top = blockEnd ? `calc(anchor(bottom) + ${gap}px)` : "auto";
|
|
156
|
+
surface.style.bottom = blockEnd ? "auto" : `calc(anchor(top) + ${gap}px)`;
|
|
157
|
+
surface.style.left = inlineEnd ? "auto" : "anchor(left)";
|
|
158
|
+
surface.style.right = inlineEnd ? "anchor(right)" : "auto";
|
|
159
|
+
surface.style.setProperty("position-try-fallbacks", "flip-block, flip-inline");
|
|
160
|
+
};
|
|
161
|
+
const position = () => {
|
|
162
|
+
frame = null;
|
|
163
|
+
if (!open)
|
|
164
|
+
return;
|
|
165
|
+
if (point) {
|
|
166
|
+
fallbackPosition(surface, {
|
|
167
|
+
left: point.x,
|
|
168
|
+
right: point.x,
|
|
169
|
+
top: point.y,
|
|
170
|
+
bottom: point.y,
|
|
171
|
+
width: 0,
|
|
172
|
+
height: 0,
|
|
173
|
+
}, "bottom-start", gap, viewportGap);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
if (!anchor)
|
|
177
|
+
return;
|
|
178
|
+
if (nativeAnchor)
|
|
179
|
+
positionNative();
|
|
180
|
+
else
|
|
181
|
+
fallbackPosition(surface, anchor.getBoundingClientRect(), placement, gap, viewportGap);
|
|
182
|
+
};
|
|
183
|
+
const schedule = () => {
|
|
184
|
+
if (!open || frame !== null)
|
|
185
|
+
return;
|
|
186
|
+
frame = owner.requestAnimationFrame(position);
|
|
187
|
+
};
|
|
188
|
+
const syncFallbackListeners = () => {
|
|
189
|
+
const needsListeners = open && (point !== null || !nativeAnchor);
|
|
190
|
+
if (!needsListeners) {
|
|
191
|
+
listenerAbort?.abort();
|
|
192
|
+
listenerAbort = null;
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (listenerAbort)
|
|
196
|
+
return;
|
|
197
|
+
listenerAbort = new AbortController();
|
|
198
|
+
const signal = listenerAbort.signal;
|
|
199
|
+
owner.addEventListener("resize", schedule, { passive: true, signal });
|
|
200
|
+
owner.addEventListener("scroll", schedule, { passive: true, capture: true, signal });
|
|
201
|
+
owner.visualViewport?.addEventListener("resize", schedule, { passive: true, signal });
|
|
202
|
+
owner.visualViewport?.addEventListener("scroll", schedule, { passive: true, signal });
|
|
203
|
+
};
|
|
204
|
+
bindAnchor(anchor);
|
|
205
|
+
return {
|
|
206
|
+
setAnchor(next) {
|
|
207
|
+
point = null;
|
|
208
|
+
bindAnchor(next);
|
|
209
|
+
syncFallbackListeners();
|
|
210
|
+
schedule();
|
|
211
|
+
},
|
|
212
|
+
show() {
|
|
213
|
+
point = null;
|
|
214
|
+
open = true;
|
|
215
|
+
syncFallbackListeners();
|
|
216
|
+
showInTopLayer(surface);
|
|
217
|
+
position();
|
|
218
|
+
},
|
|
219
|
+
showAtPoint(nextPoint) {
|
|
220
|
+
point = nextPoint;
|
|
221
|
+
open = true;
|
|
222
|
+
syncFallbackListeners();
|
|
223
|
+
showInTopLayer(surface);
|
|
224
|
+
position();
|
|
225
|
+
},
|
|
226
|
+
hide() {
|
|
227
|
+
open = false;
|
|
228
|
+
point = null;
|
|
229
|
+
syncFallbackListeners();
|
|
230
|
+
if (frame !== null)
|
|
231
|
+
owner.cancelAnimationFrame(frame);
|
|
232
|
+
frame = null;
|
|
233
|
+
hideFromTopLayer(surface);
|
|
234
|
+
},
|
|
235
|
+
refresh: schedule,
|
|
236
|
+
destroy() {
|
|
237
|
+
open = false;
|
|
238
|
+
listenerAbort?.abort();
|
|
239
|
+
listenerAbort = null;
|
|
240
|
+
if (frame !== null)
|
|
241
|
+
owner.cancelAnimationFrame(frame);
|
|
242
|
+
frame = null;
|
|
243
|
+
hideFromTopLayer(surface);
|
|
244
|
+
bindAnchor(null);
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
}
|
|
2
248
|
export function getVisualViewportRect(owner = window) {
|
|
3
249
|
const viewport = owner.visualViewport;
|
|
4
250
|
const left = viewport?.offsetLeft ?? 0;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as e,H as t,h as i,c as s,t as a}from"./p-CIA4RyEp.js";import{d as r,e as o}from"./p-JwSoedEO.js";import{o as n,c as u,r as c}from"./p-PM9a74r7.js";import{c as l}from"./p-DOulVJT7.js";const d=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow()}get host(){return 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(),n({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(),u(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,u(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,r(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")??"";r(this.host,"select",{value:i,trigger:o(e)}),r(this.host,"close",{open:!1,reason:"action",trigger:o(e)}),this.internalOpen=!1};onKeydown=e=>{if("Escape"===e.key)return e.preventDefault(),void c("escape","keyboard");const i=this.getItems().filter((e=>!this.isItemDisabled(e)));if(0===i.length)return;const s=e.target.closest?.("ui-menu-item"),a=s&&s instanceof t?i.indexOf(s):-1;if("Enter"!==e.key&&" "!==e.key)"ArrowDown"!==e.key&&"ArrowUp"!==e.key||(e.preventDefault(),i["ArrowDown"===e.key?a<0?0:Math.min(a+1,i.length-1):a<=0?i.length-1:a-1].focus());else if(e.preventDefault(),s&&a>=0){const e=s.getAttribute("value")??s.getAttribute("data-value")??"";r(this.host,"select",{value:e,trigger:"keyboard"}),r(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}]}}static get style(){return":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}"}},[769,"ui-menu",{open:[4],defaultOpen:[4,"default-open"],for:[1],placement:[1],internalOpen:[32]},void 0,{open:[{syncFromProp:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}],internalOpen:[{syncSurface:0}]}]);function p(){"undefined"!=typeof customElements&&["ui-menu"].forEach((e=>{"ui-menu"===e&&(customElements.get(a(e))||customElements.define(a(e),d))}))}export{d as U,p as d}
|
|
@@ -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,h as a,r as b,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}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as
|
|
1
|
+
import{p as e,t,H as n,h as o,c as s}from"./p-CIA4RyEp.js";import{D as a,a as c}from"./p-DOulVJT7.js";const i=e(class extends n{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow()}get host(){return this}nearRadius=a;coordinator=null;componentDidLoad(){this.connectCoordinator()}disconnectedCallback(){this.coordinator?.destroy(),this.coordinator=null}connectCoordinator(){this.coordinator?.destroy(),this.coordinator=c(this.host,{nearRadius:this.nearRadius})}onSlotChange=()=>{this.coordinator?.refresh()};render(){return o(s,{key:"184b0a908494d480ed23aa14b75d4f7b94e5275b"},o("slot",{key:"570e810db588c1514c6fd85985c9bc4532993a2b",onSlotchange:this.onSlotChange}))}static get watchers(){return{nearRadius:[{connectCoordinator:0}]}}static get style(){return":host{display:contents;--ui-affordance-scope-engaged:0}:host([data-ui-interaction='engaged']){--ui-affordance-scope-engaged:1}"}},[769,"ui-affordance-scope",{nearRadius:[514,"near-radius"]},void 0,{nearRadius:[{connectCoordinator:0}]}]),r=i,d=function(){"undefined"!=typeof customElements&&["ui-affordance-scope"].forEach((e=>{"ui-affordance-scope"===e&&(customElements.get(t(e))||customElements.define(t(e),i))}))};export{r as UiAffordanceScope,d as defineCustomElement}
|