@threadlabs/looma 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-SVINNT3E.js → chunk-OY4D3W4U.js} +29 -29
- package/dist/{chunk-G53JEAQK.js → chunk-SZJQ3NPX.js} +6 -3
- package/dist/chunk-YHXJC5M5.js +341 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/looma.cjs.js +1 -1
- package/dist/cjs/{manager-BOpVXb92.js → manager-C9j3HZay.js} +5 -2
- package/dist/cjs/positioning-i0WrCAdF.js +384 -0
- package/dist/cjs/ui-affordance-scope.cjs.entry.js +3 -113
- package/dist/cjs/ui-context-menu.cjs.entry.js +40 -5
- package/dist/cjs/ui-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ui-menu.cjs.entry.js +83 -2
- package/dist/cjs/ui-popover.cjs.entry.js +43 -3
- package/dist/cjs/ui-toast-region.cjs.entry.js +17 -2
- package/dist/cjs/ui-tooltip.cjs.entry.js +95 -27
- package/dist/cjs/ui-tree-item.cjs.entry.js +1 -1
- package/dist/collection/components/ui-context-menu/ui-context-menu.css +17 -4
- package/dist/collection/components/ui-context-menu/ui-context-menu.js +38 -3
- package/dist/collection/components/ui-menu/ui-menu.css +39 -0
- package/dist/collection/components/ui-menu/ui-menu.js +128 -1
- package/dist/collection/components/ui-popover/ui-popover.css +31 -0
- package/dist/collection/components/ui-popover/ui-popover.js +87 -1
- package/dist/collection/components/ui-toast-region/ui-toast-region.css +6 -0
- package/dist/collection/components/ui-toast-region/ui-toast-region.js +16 -1
- package/dist/collection/components/ui-tooltip/ui-tooltip.css +20 -0
- package/dist/collection/components/ui-tooltip/ui-tooltip.js +160 -25
- package/dist/collection/components/ui-tree-item/ui-tree-item.css +10 -6
- package/dist/collection/input-modality.js +24 -0
- package/dist/collection/overlay/manager.js +5 -2
- package/dist/collection/overlay/positioning.js +246 -0
- package/dist/components/p-CEYIKqYc.js +1 -0
- package/dist/components/p-DOulVJT7.js +1 -0
- package/dist/components/p-PM9a74r7.js +1 -0
- package/dist/components/ui-affordance-scope.js +1 -1
- package/dist/components/ui-context-menu.js +1 -1
- package/dist/components/ui-dialog.js +1 -1
- package/dist/components/ui-menu.js +1 -1
- package/dist/components/ui-popover.js +1 -1
- package/dist/components/ui-toast-region.js +1 -1
- package/dist/components/ui-tooltip.js +1 -1
- package/dist/components/ui-tree-item.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/looma.js +1 -1
- package/dist/esm/{manager-CR7f2MQC.js → manager-PM9a74r7.js} +5 -2
- package/dist/esm/positioning-Bu0dmLBE.js +379 -0
- package/dist/esm/ui-affordance-scope.entry.js +1 -111
- package/dist/esm/ui-context-menu.entry.js +40 -5
- package/dist/esm/ui-dialog.entry.js +1 -1
- package/dist/esm/ui-menu.entry.js +83 -2
- package/dist/esm/ui-popover.entry.js +43 -3
- package/dist/esm/ui-toast-region.entry.js +17 -2
- package/dist/esm/ui-tooltip.entry.js +95 -27
- package/dist/esm/ui-tree-item.entry.js +1 -1
- package/dist/index.cjs +776 -59
- package/dist/index.d.cts +44 -1
- package/dist/index.d.ts +44 -1
- package/dist/index.js +235 -4
- package/dist/looma/looma.esm.js +1 -1
- package/dist/looma/{p-c6721aba.entry.js → p-11083743.entry.js} +1 -1
- package/dist/looma/p-1674cda4.entry.js +1 -0
- package/dist/looma/p-2e6f791e.entry.js +1 -0
- package/dist/looma/p-54c41576.entry.js +1 -0
- package/dist/looma/p-9194a99d.entry.js +1 -0
- package/dist/looma/p-Bu0dmLBE.js +1 -0
- package/dist/looma/p-PM9a74r7.js +1 -0
- package/dist/looma/p-ba01f45d.entry.js +1 -0
- package/dist/looma/p-caa8fc7b.entry.js +1 -0
- package/dist/looma/{p-ef9ca2ed.entry.js → p-d01960c2.entry.js} +2 -2
- package/dist/types/components/ui-context-menu/ui-context-menu.d.ts +3 -0
- package/dist/types/components/ui-menu/ui-menu.d.ts +13 -0
- package/dist/types/components/ui-popover/ui-popover.d.ts +9 -0
- package/dist/types/components/ui-toast-region/ui-toast-region.d.ts +2 -0
- package/dist/types/components/ui-tooltip/ui-tooltip.d.ts +16 -1
- package/dist/types/components.d.ts +71 -0
- package/dist/types/input-modality.d.ts +6 -0
- package/dist/types/overlay/manager.d.ts +3 -0
- package/dist/types/overlay/positioning.d.ts +33 -0
- package/dist/ui-affordance-scope.entry-X7DTKJGL.js +54 -0
- package/dist/{ui-avatar-group.entry-DQDP325O.js → ui-avatar-group.entry-MC34FKAN.js} +1 -1
- package/dist/{ui-avatar.entry-WYIDMOFE.js → ui-avatar.entry-OKRQWTQV.js} +1 -1
- package/dist/{ui-badge.entry-VGHXPEDT.js → ui-badge.entry-RI7JB7KV.js} +1 -1
- package/dist/{ui-button.entry-LKPLOJ22.js → ui-button.entry-PFO5TTPN.js} +1 -1
- package/dist/{ui-checkbox.entry-J74HEA22.js → ui-checkbox.entry-UHFWVISP.js} +1 -1
- package/dist/{ui-context-menu.entry-MQM2FCLI.js → ui-context-menu.entry-AIXB6U5D.js} +40 -6
- package/dist/{ui-dialog.entry-DQMMDO4Z.js → ui-dialog.entry-LPREQH2T.js} +2 -2
- package/dist/{ui-disclosure.entry-ONF7UZDC.js → ui-disclosure.entry-7XCUIYVZ.js} +1 -1
- package/dist/{ui-floating-action-button.entry-FKTGVC5T.js → ui-floating-action-button.entry-5PNIMUAW.js} +1 -1
- package/dist/{ui-form-field.entry-M3ISWQNU.js → ui-form-field.entry-77YW46SM.js} +1 -1
- package/dist/{ui-icon-button.entry-AWFIQUHM.js → ui-icon-button.entry-4AD6ALPQ.js} +1 -1
- package/dist/{ui-input.entry-JZ6RETMT.js → ui-input.entry-E7E6QDTV.js} +1 -1
- package/dist/{ui-menu-item.entry-5MFR5LFL.js → ui-menu-item.entry-H3HFLUB6.js} +1 -1
- package/dist/ui-menu.entry-UAKZU4HG.js +184 -0
- package/dist/{ui-popover.entry-ELCMKO6Y.js → ui-popover.entry-GVQKX26B.js} +46 -4
- package/dist/{ui-radio-group.entry-RJHUPPEM.js → ui-radio-group.entry-MNSR6UEE.js} +1 -1
- package/dist/{ui-radio.entry-3VRDPOY4.js → ui-radio.entry-6D4WTI5E.js} +1 -1
- package/dist/{ui-search-result-row.entry-J34YPAV7.js → ui-search-result-row.entry-J2TILUH2.js} +1 -1
- package/dist/{ui-search-shell.entry-IJ4UUP27.js → ui-search-shell.entry-FSWHEZQF.js} +1 -1
- package/dist/{ui-select.entry-C6YD3HQ5.js → ui-select.entry-JRCYYNNW.js} +1 -1
- package/dist/{ui-switch.entry-UZDF5QTI.js → ui-switch.entry-YZWMNRP2.js} +1 -1
- package/dist/{ui-tabs.entry-YRAKWOMR.js → ui-tabs.entry-F2Y344JY.js} +1 -1
- package/dist/{ui-textarea.entry-JLDKFT3K.js → ui-textarea.entry-3EZCUUAK.js} +1 -1
- package/dist/{ui-toast-region.entry-GC7C7KXF.js → ui-toast-region.entry-BTV4AW3I.js} +20 -3
- package/dist/ui-tooltip.entry-U644CF5U.js +214 -0
- package/dist/{ui-top-bar.entry-5W5UA5KV.js → ui-top-bar.entry-FGGOREQR.js} +1 -1
- package/dist/{ui-tree-item.entry-3LM7IXIK.js → ui-tree-item.entry-XVMHEONY.js} +2 -2
- package/dist/{ui-tree.entry-X4FU42A6.js → ui-tree.entry-4R7DYGAM.js} +1 -1
- package/editor.css +3 -4
- package/package.json +1 -1
- package/tokens.css +14 -2
- package/vue/editor/index.js +62 -51
- package/dist/components/p-CR7f2MQC.js +0 -1
- package/dist/components/p-QiwSQmKJ.js +0 -1
- package/dist/looma/p-2ae73d5b.entry.js +0 -1
- package/dist/looma/p-3ac2e0d4.entry.js +0 -1
- package/dist/looma/p-65c25c94.entry.js +0 -1
- package/dist/looma/p-8c09c724.entry.js +0 -1
- package/dist/looma/p-95cd639d.entry.js +0 -1
- package/dist/looma/p-96f73d07.entry.js +0 -1
- package/dist/looma/p-CR7f2MQC.js +0 -1
- package/dist/ui-affordance-scope.entry-PFP2TDKO.js +0 -145
- package/dist/ui-menu.entry-IOEIDATQ.js +0 -98
- package/dist/ui-tooltip.entry-F26XDTYX.js +0 -145
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Host,
|
|
3
|
-
getElement,
|
|
4
|
-
h,
|
|
5
|
-
registerInstance
|
|
6
|
-
} from "./chunk-SVINNT3E.js";
|
|
7
|
-
|
|
8
|
-
// dist/esm/ui-affordance-scope.entry.js
|
|
9
|
-
var DEFAULT_AFFORDANCE_NEAR_RADIUS = 16;
|
|
10
|
-
function distanceFromPointToRect(point, rect) {
|
|
11
|
-
const dx = Math.max(rect.left - point.x, 0, point.x - rect.right);
|
|
12
|
-
const dy = Math.max(rect.top - point.y, 0, point.y - rect.bottom);
|
|
13
|
-
return Math.hypot(dx, dy);
|
|
14
|
-
}
|
|
15
|
-
function createProximityCoordinator(scope, options = {}) {
|
|
16
|
-
const owner = scope.ownerDocument.defaultView ?? window;
|
|
17
|
-
const pointerTarget = options.pointerTarget ?? scope;
|
|
18
|
-
const anchorSelector = options.anchorSelector ?? "[data-ui-affordance]";
|
|
19
|
-
const configuredRadius = options.nearRadius ?? DEFAULT_AFFORDANCE_NEAR_RADIUS;
|
|
20
|
-
const nearRadius = Number.isFinite(configuredRadius) ? Math.max(0, configuredRadius) : DEFAULT_AFFORDANCE_NEAR_RADIUS;
|
|
21
|
-
const abort = new AbortController();
|
|
22
|
-
let anchors = [];
|
|
23
|
-
let frame = null;
|
|
24
|
-
let point = null;
|
|
25
|
-
let geometryDirty = false;
|
|
26
|
-
const clear = () => {
|
|
27
|
-
for (const { element } of anchors) {
|
|
28
|
-
if (element.hasAttribute("data-ui-proximity")) {
|
|
29
|
-
element.removeAttribute("data-ui-proximity");
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
if (scope.hasAttribute("data-ui-interaction")) {
|
|
33
|
-
scope.removeAttribute("data-ui-interaction");
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
const measure = () => {
|
|
37
|
-
anchors = Array.from(scope.querySelectorAll(anchorSelector)).filter((element) => !element.hasAttribute("disabled") && element.getAttribute("aria-disabled") !== "true").map((element) => ({ element, rect: element.getBoundingClientRect() }));
|
|
38
|
-
geometryDirty = false;
|
|
39
|
-
};
|
|
40
|
-
const update = () => {
|
|
41
|
-
frame = null;
|
|
42
|
-
if (geometryDirty)
|
|
43
|
-
measure();
|
|
44
|
-
if (!point) {
|
|
45
|
-
clear();
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
let engaged = false;
|
|
49
|
-
for (const anchor of anchors) {
|
|
50
|
-
const near = distanceFromPointToRect(point, anchor.rect) <= nearRadius;
|
|
51
|
-
if (near && anchor.element.getAttribute("data-ui-proximity") !== "near") {
|
|
52
|
-
anchor.element.setAttribute("data-ui-proximity", "near");
|
|
53
|
-
} else if (!near && anchor.element.hasAttribute("data-ui-proximity")) {
|
|
54
|
-
anchor.element.removeAttribute("data-ui-proximity");
|
|
55
|
-
}
|
|
56
|
-
engaged ||= near;
|
|
57
|
-
}
|
|
58
|
-
if (engaged && scope.getAttribute("data-ui-interaction") !== "engaged") {
|
|
59
|
-
scope.setAttribute("data-ui-interaction", "engaged");
|
|
60
|
-
} else if (!engaged && scope.hasAttribute("data-ui-interaction")) {
|
|
61
|
-
scope.removeAttribute("data-ui-interaction");
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
const schedule = () => {
|
|
65
|
-
if (frame !== null)
|
|
66
|
-
return;
|
|
67
|
-
frame = owner.requestAnimationFrame(update);
|
|
68
|
-
};
|
|
69
|
-
const onPointerMove = (event) => {
|
|
70
|
-
const pointer = event;
|
|
71
|
-
if (pointer.pointerType === "touch") {
|
|
72
|
-
point = null;
|
|
73
|
-
} else {
|
|
74
|
-
point = { x: pointer.clientX, y: pointer.clientY };
|
|
75
|
-
}
|
|
76
|
-
schedule();
|
|
77
|
-
};
|
|
78
|
-
const invalidate = () => {
|
|
79
|
-
geometryDirty = true;
|
|
80
|
-
schedule();
|
|
81
|
-
};
|
|
82
|
-
pointerTarget.addEventListener("pointermove", onPointerMove, {
|
|
83
|
-
passive: true,
|
|
84
|
-
signal: abort.signal
|
|
85
|
-
});
|
|
86
|
-
owner.addEventListener("resize", invalidate, { passive: true, signal: abort.signal });
|
|
87
|
-
owner.addEventListener("scroll", invalidate, { passive: true, capture: true, signal: abort.signal });
|
|
88
|
-
owner.visualViewport?.addEventListener("resize", invalidate, { passive: true, signal: abort.signal });
|
|
89
|
-
owner.visualViewport?.addEventListener("scroll", invalidate, { passive: true, signal: abort.signal });
|
|
90
|
-
measure();
|
|
91
|
-
return {
|
|
92
|
-
refresh: invalidate,
|
|
93
|
-
destroy() {
|
|
94
|
-
abort.abort();
|
|
95
|
-
if (frame !== null)
|
|
96
|
-
owner.cancelAnimationFrame(frame);
|
|
97
|
-
frame = null;
|
|
98
|
-
point = null;
|
|
99
|
-
clear();
|
|
100
|
-
anchors = [];
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
var uiAffordanceScopeCss = () => `:host{display:contents;--ui-affordance-scope-engaged:0}:host([data-ui-interaction='engaged']){--ui-affordance-scope-engaged:1}`;
|
|
105
|
-
var UIAffordanceScope = class {
|
|
106
|
-
constructor(hostRef) {
|
|
107
|
-
registerInstance(this, hostRef);
|
|
108
|
-
}
|
|
109
|
-
get host() {
|
|
110
|
-
return getElement(this);
|
|
111
|
-
}
|
|
112
|
-
/** Distance outside each registered affordance that reveals its near state. */
|
|
113
|
-
nearRadius = DEFAULT_AFFORDANCE_NEAR_RADIUS;
|
|
114
|
-
coordinator = null;
|
|
115
|
-
componentDidLoad() {
|
|
116
|
-
this.connectCoordinator();
|
|
117
|
-
}
|
|
118
|
-
disconnectedCallback() {
|
|
119
|
-
this.coordinator?.destroy();
|
|
120
|
-
this.coordinator = null;
|
|
121
|
-
}
|
|
122
|
-
connectCoordinator() {
|
|
123
|
-
this.coordinator?.destroy();
|
|
124
|
-
this.coordinator = createProximityCoordinator(this.host, {
|
|
125
|
-
nearRadius: this.nearRadius
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
onSlotChange = () => {
|
|
129
|
-
this.coordinator?.refresh();
|
|
130
|
-
};
|
|
131
|
-
render() {
|
|
132
|
-
return h(Host, { key: "184b0a908494d480ed23aa14b75d4f7b94e5275b" }, h("slot", { key: "570e810db588c1514c6fd85985c9bc4532993a2b", onSlotchange: this.onSlotChange }));
|
|
133
|
-
}
|
|
134
|
-
static get watchers() {
|
|
135
|
-
return {
|
|
136
|
-
"nearRadius": [{
|
|
137
|
-
"connectCoordinator": 0
|
|
138
|
-
}]
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
UIAffordanceScope.style = uiAffordanceScopeCss();
|
|
143
|
-
export {
|
|
144
|
-
UIAffordanceScope as ui_affordance_scope
|
|
145
|
-
};
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
dispatchDetail,
|
|
3
|
-
eventToTrigger
|
|
4
|
-
} from "./chunk-UL7UIUJZ.js";
|
|
5
|
-
import {
|
|
6
|
-
Host,
|
|
7
|
-
getElement,
|
|
8
|
-
h,
|
|
9
|
-
registerInstance
|
|
10
|
-
} from "./chunk-SVINNT3E.js";
|
|
11
|
-
|
|
12
|
-
// dist/esm/ui-menu.entry.js
|
|
13
|
-
var 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)}::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}`;
|
|
14
|
-
var UIMenu = class {
|
|
15
|
-
constructor(hostRef) {
|
|
16
|
-
registerInstance(this, hostRef);
|
|
17
|
-
}
|
|
18
|
-
get host() {
|
|
19
|
-
return getElement(this);
|
|
20
|
-
}
|
|
21
|
-
open = false;
|
|
22
|
-
defaultOpen = false;
|
|
23
|
-
internalOpen = false;
|
|
24
|
-
syncFromProp() {
|
|
25
|
-
this.internalOpen = this.open;
|
|
26
|
-
}
|
|
27
|
-
componentDidLoad() {
|
|
28
|
-
this.syncFromProp();
|
|
29
|
-
this.internalOpen = this.internalOpen || this.defaultOpen;
|
|
30
|
-
this.host.addEventListener("click", this.onItemClick);
|
|
31
|
-
this.host.addEventListener("keydown", this.onKeydown);
|
|
32
|
-
}
|
|
33
|
-
disconnectedCallback() {
|
|
34
|
-
this.host.removeEventListener("click", this.onItemClick);
|
|
35
|
-
this.host.removeEventListener("keydown", this.onKeydown);
|
|
36
|
-
}
|
|
37
|
-
getItems() {
|
|
38
|
-
return Array.from(this.host.querySelectorAll("ui-menu-item"));
|
|
39
|
-
}
|
|
40
|
-
isItemDisabled(item) {
|
|
41
|
-
return item.getAttribute("aria-disabled") === "true" || item.hasAttribute("disabled") || item.getAttribute("disabled") === "true" || item.disabled === true;
|
|
42
|
-
}
|
|
43
|
-
onItemClick = (e) => {
|
|
44
|
-
const item = e.target.closest?.("ui-menu-item");
|
|
45
|
-
if (!item || item.getRootNode() !== this.host.getRootNode())
|
|
46
|
-
return;
|
|
47
|
-
if (this.isItemDisabled(item))
|
|
48
|
-
return;
|
|
49
|
-
const value = item.getAttribute("value") ?? item.getAttribute("data-value") ?? "";
|
|
50
|
-
dispatchDetail(this.host, "select", { value, trigger: eventToTrigger(e) });
|
|
51
|
-
dispatchDetail(this.host, "close", {
|
|
52
|
-
open: false,
|
|
53
|
-
reason: "action",
|
|
54
|
-
trigger: eventToTrigger(e)
|
|
55
|
-
});
|
|
56
|
-
this.internalOpen = false;
|
|
57
|
-
};
|
|
58
|
-
onKeydown = (e) => {
|
|
59
|
-
const items = this.getItems().filter((i) => !this.isItemDisabled(i));
|
|
60
|
-
if (items.length === 0)
|
|
61
|
-
return;
|
|
62
|
-
const target = e.target.closest?.("ui-menu-item");
|
|
63
|
-
const currentIndex = target && target instanceof HTMLElement ? items.indexOf(target) : -1;
|
|
64
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
65
|
-
e.preventDefault();
|
|
66
|
-
if (target && currentIndex >= 0) {
|
|
67
|
-
const value = target.getAttribute("value") ?? target.getAttribute("data-value") ?? "";
|
|
68
|
-
dispatchDetail(this.host, "select", { value, trigger: "keyboard" });
|
|
69
|
-
dispatchDetail(this.host, "close", {
|
|
70
|
-
open: false,
|
|
71
|
-
reason: "action",
|
|
72
|
-
trigger: "keyboard"
|
|
73
|
-
});
|
|
74
|
-
this.internalOpen = false;
|
|
75
|
-
}
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
79
|
-
e.preventDefault();
|
|
80
|
-
const nextIndex = e.key === "ArrowDown" ? currentIndex < 0 ? 0 : Math.min(currentIndex + 1, items.length - 1) : currentIndex <= 0 ? items.length - 1 : currentIndex - 1;
|
|
81
|
-
items[nextIndex].focus();
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
render() {
|
|
85
|
-
return h(Host, { key: "5e463cbbce272c6b6132a839b818deef3e39a532", role: "menu", "aria-orientation": "vertical", "data-open": this.internalOpen ? "" : void 0 }, h("slot", { key: "feea6a21d41a7b27a6270814bcf0b3f3ded394a1" }));
|
|
86
|
-
}
|
|
87
|
-
static get watchers() {
|
|
88
|
-
return {
|
|
89
|
-
"open": [{
|
|
90
|
-
"syncFromProp": 0
|
|
91
|
-
}]
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
UIMenu.style = uiMenuCss();
|
|
96
|
-
export {
|
|
97
|
-
UIMenu as ui_menu
|
|
98
|
-
};
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
closeOverlay,
|
|
3
|
-
openOverlay,
|
|
4
|
-
requestTopOverlayClose
|
|
5
|
-
} from "./chunk-G53JEAQK.js";
|
|
6
|
-
import {
|
|
7
|
-
dispatchDetail
|
|
8
|
-
} from "./chunk-UL7UIUJZ.js";
|
|
9
|
-
import {
|
|
10
|
-
Host,
|
|
11
|
-
getElement,
|
|
12
|
-
h,
|
|
13
|
-
registerInstance
|
|
14
|
-
} from "./chunk-SVINNT3E.js";
|
|
15
|
-
|
|
16
|
-
// dist/esm/ui-tooltip.entry.js
|
|
17
|
-
var uiTooltipCss = () => `:host{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)}:host([hidden]){display:none !important}`;
|
|
18
|
-
var UITooltip = class {
|
|
19
|
-
constructor(hostRef) {
|
|
20
|
-
registerInstance(this, hostRef);
|
|
21
|
-
}
|
|
22
|
-
get host() {
|
|
23
|
-
return getElement(this);
|
|
24
|
-
}
|
|
25
|
-
for = "";
|
|
26
|
-
open = false;
|
|
27
|
-
defaultOpen = false;
|
|
28
|
-
internalOpen = false;
|
|
29
|
-
overlayId = `ui-tooltip-${Math.random().toString(36).slice(2, 11)}`;
|
|
30
|
-
trigger = null;
|
|
31
|
-
syncFromProp() {
|
|
32
|
-
this.internalOpen = this.open;
|
|
33
|
-
}
|
|
34
|
-
syncOverlay() {
|
|
35
|
-
if (this.internalOpen) {
|
|
36
|
-
openOverlay({
|
|
37
|
-
id: this.overlayId,
|
|
38
|
-
modal: false,
|
|
39
|
-
element: this.host,
|
|
40
|
-
dismissible: true,
|
|
41
|
-
requestClose: (reason, trigger) => this.handleRequestClose(reason, trigger)
|
|
42
|
-
});
|
|
43
|
-
} else {
|
|
44
|
-
closeOverlay(this.overlayId);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
componentDidLoad() {
|
|
48
|
-
this.syncFromProp();
|
|
49
|
-
this.internalOpen = this.internalOpen || this.defaultOpen;
|
|
50
|
-
this.resolveTrigger();
|
|
51
|
-
this.attachTriggerListeners();
|
|
52
|
-
this.host.addEventListener("keydown", this.onKeydown);
|
|
53
|
-
this.syncOverlay();
|
|
54
|
-
}
|
|
55
|
-
componentDidUpdate() {
|
|
56
|
-
this.resolveTrigger();
|
|
57
|
-
this.attachTriggerListeners();
|
|
58
|
-
this.syncOverlay();
|
|
59
|
-
}
|
|
60
|
-
disconnectedCallback() {
|
|
61
|
-
this.detachTriggerListeners();
|
|
62
|
-
this.host.removeEventListener("keydown", this.onKeydown);
|
|
63
|
-
closeOverlay(this.overlayId);
|
|
64
|
-
}
|
|
65
|
-
resolveTrigger() {
|
|
66
|
-
if (this.for) {
|
|
67
|
-
this.trigger = document.getElementById(this.for);
|
|
68
|
-
} else {
|
|
69
|
-
this.trigger = this.host.previousElementSibling;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
attachTriggerListeners() {
|
|
73
|
-
this.detachTriggerListeners();
|
|
74
|
-
if (!this.trigger)
|
|
75
|
-
return;
|
|
76
|
-
this.trigger.addEventListener("pointerenter", this.onTriggerEnter);
|
|
77
|
-
this.trigger.addEventListener("pointerleave", this.onTriggerLeave);
|
|
78
|
-
this.trigger.addEventListener("focusin", this.onTriggerFocusIn);
|
|
79
|
-
this.trigger.addEventListener("focusout", this.onTriggerFocusOut);
|
|
80
|
-
}
|
|
81
|
-
detachTriggerListeners() {
|
|
82
|
-
if (!this.trigger)
|
|
83
|
-
return;
|
|
84
|
-
this.trigger.removeEventListener("pointerenter", this.onTriggerEnter);
|
|
85
|
-
this.trigger.removeEventListener("pointerleave", this.onTriggerLeave);
|
|
86
|
-
this.trigger.removeEventListener("focusin", this.onTriggerFocusIn);
|
|
87
|
-
this.trigger.removeEventListener("focusout", this.onTriggerFocusOut);
|
|
88
|
-
}
|
|
89
|
-
onTriggerEnter = () => {
|
|
90
|
-
this.internalOpen = true;
|
|
91
|
-
dispatchDetail(this.host, "open", { open: true, reason: "action", trigger: "pointer" });
|
|
92
|
-
this.syncOverlay();
|
|
93
|
-
};
|
|
94
|
-
onTriggerLeave = () => {
|
|
95
|
-
this.internalOpen = false;
|
|
96
|
-
dispatchDetail(this.host, "close", { open: false, reason: "action", trigger: "pointer" });
|
|
97
|
-
this.syncOverlay();
|
|
98
|
-
};
|
|
99
|
-
onTriggerFocusIn = () => {
|
|
100
|
-
this.internalOpen = true;
|
|
101
|
-
dispatchDetail(this.host, "open", { open: true, reason: "action", trigger: "keyboard" });
|
|
102
|
-
this.syncOverlay();
|
|
103
|
-
};
|
|
104
|
-
onTriggerFocusOut = (e) => {
|
|
105
|
-
const related = e.relatedTarget;
|
|
106
|
-
if (related && this.host.contains(related))
|
|
107
|
-
return;
|
|
108
|
-
this.internalOpen = false;
|
|
109
|
-
dispatchDetail(this.host, "close", { open: false, reason: "action", trigger: "keyboard" });
|
|
110
|
-
this.syncOverlay();
|
|
111
|
-
};
|
|
112
|
-
handleRequestClose(reason, trigger) {
|
|
113
|
-
if (reason === "escape") {
|
|
114
|
-
this.internalOpen = false;
|
|
115
|
-
dispatchDetail(this.host, "close", {
|
|
116
|
-
open: false,
|
|
117
|
-
reason: "escape",
|
|
118
|
-
trigger
|
|
119
|
-
});
|
|
120
|
-
this.trigger?.focus();
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
onKeydown = (e) => {
|
|
124
|
-
if (e.key === "Escape") {
|
|
125
|
-
requestTopOverlayClose("escape", "keyboard");
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
render() {
|
|
129
|
-
return h(Host, { key: "64b5f4e7a56cbf5560edc6d7118022a49d5e2786", role: "tooltip", hidden: !this.internalOpen, "data-open": this.internalOpen ? "" : void 0, onKeyDown: this.onKeydown }, h("slot", { key: "cf6f96689021a42a01b782f0e1d0730b5a9aa1f8" }));
|
|
130
|
-
}
|
|
131
|
-
static get watchers() {
|
|
132
|
-
return {
|
|
133
|
-
"open": [{
|
|
134
|
-
"syncFromProp": 0
|
|
135
|
-
}],
|
|
136
|
-
"internalOpen": [{
|
|
137
|
-
"syncOverlay": 0
|
|
138
|
-
}]
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
UITooltip.style = uiTooltipCss();
|
|
143
|
-
export {
|
|
144
|
-
UITooltip as ui_tooltip
|
|
145
|
-
};
|