@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as a,g as t,h as
|
|
1
|
+
import{r as a,g as t,h as i,H as e}from"./p-CEeiinfk.js";import{d as r,e as d}from"./p-JwSoedEO.js";
|
|
2
2
|
/**
|
|
3
3
|
* @license lucide v0.554.0 - ISC
|
|
4
4
|
*
|
|
@@ -10,4 +10,4 @@ import{r as a,g as t,h as e,H as i}from"./p-CEeiinfk.js";import{d as r,e as d}fr
|
|
|
10
10
|
*
|
|
11
11
|
* This source code is licensed under the ISC license.
|
|
12
12
|
* See the LICENSE file in the root directory of this source tree.
|
|
13
|
-
*/function n(a){return String(a).replaceAll("&","&").replaceAll('"',""")}function s(a){const[t,
|
|
13
|
+
*/function n(a){return String(a).replaceAll("&","&").replaceAll('"',""")}function s(a){const[t,i]=a;return`<${t}${function(a){return Object.entries(a).map((([a,t])=>` ${a}="${n(t)}"`)).join("")}(i)}></${t}>`}function c(a,t="looma-icon"){return[`<svg class="${n(t)}" data-looma-icon="${a}" aria-hidden="true" focusable="false"`,' viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"',' stroke-linecap="round" stroke-linejoin="round">',o[a].map(s).join(""),"</svg>"].join("")}const h=class{constructor(t){a(this,t)}get host(){return t(this)}itemId="";label="";depth=1;container=!1;sortable=!1;dragType="item";dropScope="";accepts="";expanded=!1;defaultExpanded=!1;selected=!1;disabled=!1;internalExpanded=!1;syncExpandedFromProp(){this.internalExpanded=this.expanded}componentWillLoad(){this.internalExpanded=this.expanded||this.defaultExpanded}componentDidLoad(){this.host.addEventListener("ui-tree-auto-expand",this.onAutoExpand)}disconnectedCallback(){this.host.removeEventListener("ui-tree-auto-expand",this.onAutoExpand)}setExpanded(a,t){this.container&&!this.disabled&&this.internalExpanded!==a&&(this.internalExpanded=a,r(this.host,"expand",{id:this.itemId,expanded:a,trigger:t}))}onAutoExpand=()=>{this.setExpanded(!0,"pointer")};onDisclosureClick=a=>{a.stopPropagation(),this.setExpanded(!this.internalExpanded,d(a))};onDisclosureKeydown=a=>{"ArrowRight"!==a.key&&"ArrowLeft"!==a.key||(a.preventDefault(),a.stopPropagation(),this.setExpanded("ArrowRight"===a.key,"keyboard"))};onRowClick=a=>{this.container&&!this.disabled&&(a.composedPath().some((a=>a instanceof HTMLElement&&(a.matches('a, button, input, select, textarea, [role="button"], [role="link"]')||"actions"===a.getAttribute("slot"))))||this.setExpanded(!this.internalExpanded,d(a)))};render(){const a=Math.max(1,Math.floor(this.depth)),t=`${this.internalExpanded?"Collapse":"Expand"} ${this.label||"item"}`,r=`Drag ${this.label||"item"} to reorder`;return i(e,{key:"ea8ed538aa3883c87257a25614a066965364693f",role:"treeitem","aria-level":String(a),"aria-expanded":this.container?String(this.internalExpanded):void 0,"aria-selected":String(this.selected),"aria-disabled":this.disabled?"true":void 0,"data-container":this.container?"":void 0,"data-selected":this.selected?"":void 0,"data-disabled":this.disabled?"":void 0,"data-drag-type":this.dragType||"item","data-drop-scope":this.dropScope||void 0,"data-accepts":this.accepts||void 0,tabIndex:this.disabled?-1:0,style:{"--ui-tree-item-depth":String(a-1),"margin-inline-start":a>1?"var(--ui-tree-indent, 16px)":"0px"}},i("div",{key:"740b93aa47e65d8a1cb899d4b9c966d9ad1d456f",class:"row",part:"row",onClick:this.onRowClick},this.sortable&&!this.disabled?i("button",{class:"drag-handle",part:"drag-handle",type:"button",draggable:!0,"aria-label":r,title:r},i("span",{innerHTML:c("grip-vertical")})):null,this.container?i("button",{class:"disclosure",part:"disclosure",type:"button","aria-label":t,"aria-expanded":String(this.internalExpanded),disabled:this.disabled,onClick:this.onDisclosureClick,onKeyDown:this.onDisclosureKeydown},i("span",{class:{"disclosure-icon":!0,"disclosure-icon--expanded":this.internalExpanded},innerHTML:c("chevron-down")})):i("span",{class:"disclosure-spacer","aria-hidden":"true"}),i("span",{key:"37e1b7f1cdddf623734becef465ffde83d8b86f2",class:"leading",part:"leading"},i("slot",{key:"0ab3a60c98628f009918d0d720772154912d2709",name:"leading"})),i("span",{key:"defdd343f25a0f4354110e981f3889e1d09c27ee",class:"label",part:"label"},i("slot",{key:"bde46ccacc1a620348062fc300503c4f1736316b"})),i("span",{key:"caff9ada38c41be90aeb6e331f4c54a51f31d26c",class:"actions",part:"actions"},i("slot",{key:"e11704d6871445c91eaa29c99302d8b751be69d3",name:"actions"})),i("span",{key:"7e40559d6c5ba56710bc705083ad2ede3046e0b1",class:"drop-indicator",part:"drop-indicator","aria-hidden":"true"})),this.container?i("div",{class:"children",part:"children",role:"group",hidden:!this.internalExpanded},i("slot",{name:"children"})):null)}static get watchers(){return{expanded:[{syncExpandedFromProp:0}]}}};h.style=":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}}";export{h as ui_tree_item}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
type ContextMenuTrigger = 'keyboard' | 'pointer' | 'programmatic';
|
|
1
2
|
export declare class UIContextMenu {
|
|
2
3
|
host: HTMLElement;
|
|
3
4
|
/** Controls the menu when the consumer owns open state. */
|
|
@@ -7,17 +8,21 @@ export declare class UIContextMenu {
|
|
|
7
8
|
/** Optional id of the region that should also respond to a context-menu gesture. */
|
|
8
9
|
for?: string;
|
|
9
10
|
internalOpen: boolean;
|
|
11
|
+
focusTrigger: ContextMenuTrigger;
|
|
10
12
|
private overlayId;
|
|
11
13
|
private trigger;
|
|
12
14
|
private contextTarget;
|
|
13
15
|
private pointerX;
|
|
14
16
|
private pointerY;
|
|
17
|
+
private pointPositioned;
|
|
18
|
+
private surface;
|
|
15
19
|
syncFromProp(): void;
|
|
16
20
|
syncTarget(): void;
|
|
17
21
|
syncOverlay(): void;
|
|
18
22
|
componentDidLoad(): void;
|
|
19
23
|
componentDidUpdate(): void;
|
|
20
24
|
disconnectedCallback(): void;
|
|
25
|
+
private setupSurface;
|
|
21
26
|
private resolveTargets;
|
|
22
27
|
private attachTargetListeners;
|
|
23
28
|
private detachTargetListeners;
|
|
@@ -35,3 +40,4 @@ export declare class UIContextMenu {
|
|
|
35
40
|
private onItemClick;
|
|
36
41
|
render(): any;
|
|
37
42
|
}
|
|
43
|
+
export {};
|
|
@@ -1,11 +1,24 @@
|
|
|
1
|
+
import { type AnchoredPlacement } from '../../overlay/positioning';
|
|
1
2
|
export declare class UIMenu {
|
|
2
3
|
host: HTMLElement;
|
|
3
4
|
open: boolean;
|
|
4
5
|
defaultOpen: boolean;
|
|
6
|
+
/** Id of the control that anchors this menu in the top layer. */
|
|
7
|
+
for?: string;
|
|
8
|
+
/** Preferred placement; Looma flips and shifts when space is constrained. */
|
|
9
|
+
placement: AnchoredPlacement;
|
|
5
10
|
internalOpen: boolean;
|
|
11
|
+
private overlayId;
|
|
12
|
+
private anchor;
|
|
13
|
+
private surface;
|
|
6
14
|
syncFromProp(): void;
|
|
15
|
+
resetSurface(): void;
|
|
16
|
+
syncSurface(): void;
|
|
7
17
|
componentDidLoad(): void;
|
|
8
18
|
disconnectedCallback(): void;
|
|
19
|
+
private setupSurface;
|
|
20
|
+
private syncAnchorState;
|
|
21
|
+
private closeMenu;
|
|
9
22
|
private getItems;
|
|
10
23
|
private isItemDisabled;
|
|
11
24
|
private onItemClick;
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
+
import { type AnchoredPlacement } from '../../overlay/positioning';
|
|
1
2
|
export declare class UIPopover {
|
|
2
3
|
host: HTMLElement;
|
|
3
4
|
open: boolean;
|
|
4
5
|
defaultOpen: boolean;
|
|
6
|
+
/** Optional id of the element this popover follows in the top layer. */
|
|
7
|
+
for?: string;
|
|
8
|
+
placement: AnchoredPlacement;
|
|
5
9
|
internalOpen: boolean;
|
|
6
10
|
private overlayId;
|
|
11
|
+
private anchor;
|
|
12
|
+
private surface;
|
|
7
13
|
syncFromProp(): void;
|
|
8
14
|
onOpenChange(): void;
|
|
15
|
+
resetSurface(): void;
|
|
16
|
+
private setupSurface;
|
|
17
|
+
private syncSurface;
|
|
9
18
|
private syncOverlay;
|
|
10
19
|
componentDidLoad(): void;
|
|
11
20
|
disconnectedCallback(): void;
|
|
@@ -1,19 +1,34 @@
|
|
|
1
|
+
import { type AnchoredPlacement } from '../../overlay/positioning';
|
|
1
2
|
export declare class UITooltip {
|
|
2
3
|
host: HTMLElement;
|
|
3
4
|
for: string;
|
|
4
5
|
open: boolean;
|
|
5
6
|
defaultOpen: boolean;
|
|
7
|
+
placement: AnchoredPlacement;
|
|
8
|
+
/** Pointer hover intent delay in milliseconds. Keyboard focus is immediate. */
|
|
9
|
+
showDelay: number;
|
|
10
|
+
/** Pointer leave grace period in milliseconds. */
|
|
11
|
+
hideDelay: number;
|
|
6
12
|
internalOpen: boolean;
|
|
7
13
|
private overlayId;
|
|
8
14
|
private trigger;
|
|
15
|
+
private surface;
|
|
16
|
+
private showTimer;
|
|
17
|
+
private hideTimer;
|
|
9
18
|
syncFromProp(): void;
|
|
19
|
+
resetSurface(): void;
|
|
10
20
|
syncOverlay(): void;
|
|
11
21
|
componentDidLoad(): void;
|
|
12
22
|
componentDidUpdate(): void;
|
|
13
23
|
disconnectedCallback(): void;
|
|
14
|
-
private
|
|
24
|
+
private syncTrigger;
|
|
25
|
+
private setupSurface;
|
|
15
26
|
private attachTriggerListeners;
|
|
16
27
|
private detachTriggerListeners;
|
|
28
|
+
private clearShowTimer;
|
|
29
|
+
private clearHideTimer;
|
|
30
|
+
private clearTimers;
|
|
31
|
+
private setInteractionOpen;
|
|
17
32
|
private onTriggerEnter;
|
|
18
33
|
private onTriggerLeave;
|
|
19
34
|
private onTriggerFocusIn;
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* It contains typing information for all components that exist in this project.
|
|
6
6
|
*/
|
|
7
7
|
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
8
|
+
import { AnchoredPlacement } from "./overlay/positioning";
|
|
9
|
+
export { AnchoredPlacement } from "./overlay/positioning";
|
|
8
10
|
export namespace Components {
|
|
9
11
|
interface UiAffordanceScope {
|
|
10
12
|
/**
|
|
@@ -212,10 +214,19 @@ export namespace Components {
|
|
|
212
214
|
* @default false
|
|
213
215
|
*/
|
|
214
216
|
"defaultOpen": boolean;
|
|
217
|
+
/**
|
|
218
|
+
* Id of the control that anchors this menu in the top layer.
|
|
219
|
+
*/
|
|
220
|
+
"for"?: string;
|
|
215
221
|
/**
|
|
216
222
|
* @default false
|
|
217
223
|
*/
|
|
218
224
|
"open": boolean;
|
|
225
|
+
/**
|
|
226
|
+
* Preferred placement; Looma flips and shifts when space is constrained.
|
|
227
|
+
* @default 'bottom-start'
|
|
228
|
+
*/
|
|
229
|
+
"placement": AnchoredPlacement;
|
|
219
230
|
}
|
|
220
231
|
interface UiMenuItem {
|
|
221
232
|
/**
|
|
@@ -232,10 +243,18 @@ export namespace Components {
|
|
|
232
243
|
* @default false
|
|
233
244
|
*/
|
|
234
245
|
"defaultOpen": boolean;
|
|
246
|
+
/**
|
|
247
|
+
* Optional id of the element this popover follows in the top layer.
|
|
248
|
+
*/
|
|
249
|
+
"for"?: string;
|
|
235
250
|
/**
|
|
236
251
|
* @default false
|
|
237
252
|
*/
|
|
238
253
|
"open": boolean;
|
|
254
|
+
/**
|
|
255
|
+
* @default 'bottom-start'
|
|
256
|
+
*/
|
|
257
|
+
"placement": AnchoredPlacement;
|
|
239
258
|
}
|
|
240
259
|
interface UiRadio {
|
|
241
260
|
/**
|
|
@@ -396,10 +415,24 @@ export namespace Components {
|
|
|
396
415
|
* @default ''
|
|
397
416
|
*/
|
|
398
417
|
"for": string;
|
|
418
|
+
/**
|
|
419
|
+
* Pointer leave grace period in milliseconds.
|
|
420
|
+
* @default 100
|
|
421
|
+
*/
|
|
422
|
+
"hideDelay": number;
|
|
399
423
|
/**
|
|
400
424
|
* @default false
|
|
401
425
|
*/
|
|
402
426
|
"open": boolean;
|
|
427
|
+
/**
|
|
428
|
+
* @default 'top-start'
|
|
429
|
+
*/
|
|
430
|
+
"placement": AnchoredPlacement;
|
|
431
|
+
/**
|
|
432
|
+
* Pointer hover intent delay in milliseconds. Keyboard focus is immediate.
|
|
433
|
+
* @default 500
|
|
434
|
+
*/
|
|
435
|
+
"showDelay": number;
|
|
403
436
|
}
|
|
404
437
|
interface UiTopBar {
|
|
405
438
|
}
|
|
@@ -888,10 +921,19 @@ declare namespace LocalJSX {
|
|
|
888
921
|
* @default false
|
|
889
922
|
*/
|
|
890
923
|
"defaultOpen"?: boolean;
|
|
924
|
+
/**
|
|
925
|
+
* Id of the control that anchors this menu in the top layer.
|
|
926
|
+
*/
|
|
927
|
+
"for"?: string;
|
|
891
928
|
/**
|
|
892
929
|
* @default false
|
|
893
930
|
*/
|
|
894
931
|
"open"?: boolean;
|
|
932
|
+
/**
|
|
933
|
+
* Preferred placement; Looma flips and shifts when space is constrained.
|
|
934
|
+
* @default 'bottom-start'
|
|
935
|
+
*/
|
|
936
|
+
"placement"?: AnchoredPlacement;
|
|
895
937
|
}
|
|
896
938
|
interface UiMenuItem {
|
|
897
939
|
/**
|
|
@@ -908,10 +950,18 @@ declare namespace LocalJSX {
|
|
|
908
950
|
* @default false
|
|
909
951
|
*/
|
|
910
952
|
"defaultOpen"?: boolean;
|
|
953
|
+
/**
|
|
954
|
+
* Optional id of the element this popover follows in the top layer.
|
|
955
|
+
*/
|
|
956
|
+
"for"?: string;
|
|
911
957
|
/**
|
|
912
958
|
* @default false
|
|
913
959
|
*/
|
|
914
960
|
"open"?: boolean;
|
|
961
|
+
/**
|
|
962
|
+
* @default 'bottom-start'
|
|
963
|
+
*/
|
|
964
|
+
"placement"?: AnchoredPlacement;
|
|
915
965
|
}
|
|
916
966
|
interface UiRadio {
|
|
917
967
|
/**
|
|
@@ -1072,10 +1122,24 @@ declare namespace LocalJSX {
|
|
|
1072
1122
|
* @default ''
|
|
1073
1123
|
*/
|
|
1074
1124
|
"for"?: string;
|
|
1125
|
+
/**
|
|
1126
|
+
* Pointer leave grace period in milliseconds.
|
|
1127
|
+
* @default 100
|
|
1128
|
+
*/
|
|
1129
|
+
"hideDelay"?: number;
|
|
1075
1130
|
/**
|
|
1076
1131
|
* @default false
|
|
1077
1132
|
*/
|
|
1078
1133
|
"open"?: boolean;
|
|
1134
|
+
/**
|
|
1135
|
+
* @default 'top-start'
|
|
1136
|
+
*/
|
|
1137
|
+
"placement"?: AnchoredPlacement;
|
|
1138
|
+
/**
|
|
1139
|
+
* Pointer hover intent delay in milliseconds. Keyboard focus is immediate.
|
|
1140
|
+
* @default 500
|
|
1141
|
+
*/
|
|
1142
|
+
"showDelay"?: number;
|
|
1079
1143
|
}
|
|
1080
1144
|
interface UiTopBar {
|
|
1081
1145
|
}
|
|
@@ -1224,6 +1288,8 @@ declare namespace LocalJSX {
|
|
|
1224
1288
|
interface UiMenuAttributes {
|
|
1225
1289
|
"open": boolean;
|
|
1226
1290
|
"defaultOpen": boolean;
|
|
1291
|
+
"for": string;
|
|
1292
|
+
"placement": AnchoredPlacement;
|
|
1227
1293
|
}
|
|
1228
1294
|
interface UiMenuItemAttributes {
|
|
1229
1295
|
"disabled": boolean;
|
|
@@ -1232,6 +1298,8 @@ declare namespace LocalJSX {
|
|
|
1232
1298
|
interface UiPopoverAttributes {
|
|
1233
1299
|
"open": boolean;
|
|
1234
1300
|
"defaultOpen": boolean;
|
|
1301
|
+
"for": string;
|
|
1302
|
+
"placement": AnchoredPlacement;
|
|
1235
1303
|
}
|
|
1236
1304
|
interface UiRadioAttributes {
|
|
1237
1305
|
"checked": boolean;
|
|
@@ -1286,6 +1354,9 @@ declare namespace LocalJSX {
|
|
|
1286
1354
|
"for": string;
|
|
1287
1355
|
"open": boolean;
|
|
1288
1356
|
"defaultOpen": boolean;
|
|
1357
|
+
"placement": AnchoredPlacement;
|
|
1358
|
+
"showDelay": number;
|
|
1359
|
+
"hideDelay": number;
|
|
1289
1360
|
}
|
|
1290
1361
|
interface UiTreeAttributes {
|
|
1291
1362
|
"label": string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reflects real touch use instead of guessing from device capability media
|
|
3
|
+
* queries. Hybrid devices therefore keep compact pointer affordances until the
|
|
4
|
+
* user actually touches the interface.
|
|
5
|
+
*/
|
|
6
|
+
export declare function initializeInputModality(owner?: Document): void;
|
|
@@ -4,6 +4,9 @@ export interface OverlayRecord {
|
|
|
4
4
|
id: string;
|
|
5
5
|
modal: boolean;
|
|
6
6
|
element: HTMLElement;
|
|
7
|
+
/** Controls that are part of the overlay interaction boundary (for example,
|
|
8
|
+
* the button that toggles an anchored menu). */
|
|
9
|
+
relatedElements?: readonly HTMLElement[];
|
|
7
10
|
dismissible?: boolean;
|
|
8
11
|
requestClose: (reason: OverlayCloseReason, trigger: OverlayTrigger) => void;
|
|
9
12
|
}
|
|
@@ -26,7 +26,40 @@ export interface ProximityCoordinator {
|
|
|
26
26
|
/** Removes the scope-level listeners and all reflected interaction state. */
|
|
27
27
|
destroy(): void;
|
|
28
28
|
}
|
|
29
|
+
export type AnchoredPlacement = "bottom-start" | "bottom-end" | "top-start" | "top-end";
|
|
30
|
+
export interface AnchoredSurfaceOptions {
|
|
31
|
+
anchor?: HTMLElement | null;
|
|
32
|
+
placement?: AnchoredPlacement;
|
|
33
|
+
gap?: number;
|
|
34
|
+
viewportGap?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface AnchoredSurface {
|
|
37
|
+
setAnchor(anchor: HTMLElement | null): void;
|
|
38
|
+
show(): void;
|
|
39
|
+
showAtPoint(point: Point): void;
|
|
40
|
+
hide(): void;
|
|
41
|
+
refresh(): void;
|
|
42
|
+
destroy(): void;
|
|
43
|
+
}
|
|
44
|
+
export interface ViewportSurface {
|
|
45
|
+
show(): void;
|
|
46
|
+
hide(): void;
|
|
47
|
+
destroy(): void;
|
|
48
|
+
}
|
|
29
49
|
export declare const DEFAULT_AFFORDANCE_NEAR_RADIUS = 16;
|
|
50
|
+
/**
|
|
51
|
+
* Places unanchored floating UI, such as a toast region, in the browser top
|
|
52
|
+
* layer. Its viewport position remains CSS-owned; the controller only provides
|
|
53
|
+
* the native Popover API boundary and its no-Popover fallback.
|
|
54
|
+
*/
|
|
55
|
+
export declare function createViewportSurface(surface: HTMLElement): ViewportSurface;
|
|
56
|
+
/**
|
|
57
|
+
* One lightweight positioning controller for Looma floating UI. Native
|
|
58
|
+
* Popover provides the top layer and CSS Anchor Positioning follows a named
|
|
59
|
+
* element. Browsers without Anchor Positioning use the same flip/shift
|
|
60
|
+
* geometry through scroll/resize listeners that exist only while open.
|
|
61
|
+
*/
|
|
62
|
+
export declare function createAnchoredSurface(surface: HTMLElement, options?: AnchoredSurfaceOptions): AnchoredSurface;
|
|
30
63
|
export declare function getVisualViewportRect(owner?: Window): ViewportRect;
|
|
31
64
|
export declare function clampRectToViewport(rect: RectLike, viewport?: ViewportRect, gutter?: number): Point;
|
|
32
65
|
export declare function distanceFromPointToRect(point: Point, rect: RectLike): number;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_AFFORDANCE_NEAR_RADIUS,
|
|
3
|
+
createProximityCoordinator
|
|
4
|
+
} from "./chunk-YHXJC5M5.js";
|
|
5
|
+
import {
|
|
6
|
+
Host,
|
|
7
|
+
getElement,
|
|
8
|
+
h,
|
|
9
|
+
registerInstance
|
|
10
|
+
} from "./chunk-DTQVRGVL.js";
|
|
11
|
+
|
|
12
|
+
// dist/esm/ui-affordance-scope.entry.js
|
|
13
|
+
var uiAffordanceScopeCss = () => `:host{display:contents;--ui-affordance-scope-engaged:0}:host([data-ui-interaction='engaged']){--ui-affordance-scope-engaged:1}`;
|
|
14
|
+
var UIAffordanceScope = class {
|
|
15
|
+
constructor(hostRef) {
|
|
16
|
+
registerInstance(this, hostRef);
|
|
17
|
+
}
|
|
18
|
+
get host() {
|
|
19
|
+
return getElement(this);
|
|
20
|
+
}
|
|
21
|
+
/** Distance outside each registered affordance that reveals its near state. */
|
|
22
|
+
nearRadius = DEFAULT_AFFORDANCE_NEAR_RADIUS;
|
|
23
|
+
coordinator = null;
|
|
24
|
+
componentDidLoad() {
|
|
25
|
+
this.connectCoordinator();
|
|
26
|
+
}
|
|
27
|
+
disconnectedCallback() {
|
|
28
|
+
this.coordinator?.destroy();
|
|
29
|
+
this.coordinator = null;
|
|
30
|
+
}
|
|
31
|
+
connectCoordinator() {
|
|
32
|
+
this.coordinator?.destroy();
|
|
33
|
+
this.coordinator = createProximityCoordinator(this.host, {
|
|
34
|
+
nearRadius: this.nearRadius
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
onSlotChange = () => {
|
|
38
|
+
this.coordinator?.refresh();
|
|
39
|
+
};
|
|
40
|
+
render() {
|
|
41
|
+
return h(Host, { key: "184b0a908494d480ed23aa14b75d4f7b94e5275b" }, h("slot", { key: "570e810db588c1514c6fd85985c9bc4532993a2b", onSlotchange: this.onSlotChange }));
|
|
42
|
+
}
|
|
43
|
+
static get watchers() {
|
|
44
|
+
return {
|
|
45
|
+
"nearRadius": [{
|
|
46
|
+
"connectCoordinator": 0
|
|
47
|
+
}]
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
UIAffordanceScope.style = uiAffordanceScopeCss();
|
|
52
|
+
export {
|
|
53
|
+
UIAffordanceScope as ui_affordance_scope
|
|
54
|
+
};
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
getElement,
|
|
4
4
|
h,
|
|
5
5
|
registerInstance
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DTQVRGVL.js";
|
|
7
7
|
|
|
8
8
|
// dist/esm/ui-avatar-group.entry.js
|
|
9
9
|
var uiAvatarGroupCss = () => `:host{display:flex;align-items:center;flex-direction:row-reverse;gap:0}::slotted(*:not([data-ui-avatar-group-overflow])){margin-inline-end:-0.5rem;flex-shrink:0}::slotted(*:last-of-type:not([data-ui-avatar-group-overflow])){margin-inline-end:0}.overflow{margin-inline-end:-0.5rem;display:inline-flex;align-items:center;justify-content:center;inline-size:2.5rem;block-size:2.5rem;border-radius:999px;border:1px solid var(--ui-border-default);background:var(--ui-surface-muted);color:var(--ui-text-secondary);font:inherit;font-size:0.75rem;font-weight:600;flex-shrink:0}`;
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
Host,
|
|
3
3
|
h,
|
|
4
4
|
registerInstance
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-DTQVRGVL.js";
|
|
6
6
|
|
|
7
7
|
// dist/esm/ui-badge.entry.js
|
|
8
8
|
var uiBadgeCss = () => `:host{display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--ui-border-default);border-radius:999px;background:var(--ui-surface-muted);color:var(--ui-text-secondary);font:inherit;font-size:0.75rem;line-height:1;padding:0.25em 0.6em;white-space:nowrap}:host([data-tone='accent']){background:var(--ui-accent-solid);border-color:var(--ui-accent-solid);color:var(--ui-text-on-accent)}:host([data-tone='danger']){background:var(--ui-danger-solid);border-color:var(--ui-danger-solid);color:var(--ui-text-on-accent)}:host([data-tone='success']){background:var(--ui-success-solid);border-color:var(--ui-success-solid);color:var(--ui-text-on-accent)}:host([data-tone='warning']){background:var(--ui-warning-solid);border-color:var(--ui-warning-solid);color:var(--ui-text-primary)}:host([data-tone='info']){background:var(--ui-info-solid);border-color:var(--ui-info-solid);color:var(--ui-text-on-accent)}:host([data-variant='subtle'][data-tone='accent']){background:var(--ui-accent-soft);border-color:var(--ui-accent-soft);color:var(--ui-accent-solid)}:host([data-variant='subtle'][data-tone='danger']){background:var(--ui-danger-soft);border-color:var(--ui-danger-soft);color:var(--ui-danger-solid)}:host([data-variant='subtle'][data-tone='success']){background:var(--ui-success-soft);border-color:var(--ui-success-soft);color:var(--ui-success-solid)}:host([data-variant='subtle'][data-tone='warning']){background:var(--ui-warning-soft);border-color:var(--ui-warning-soft);color:var(--ui-warning-solid)}:host([data-variant='subtle'][data-tone='info']){background:var(--ui-info-soft);border-color:var(--ui-info-soft);color:var(--ui-info-solid)}`;
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
getElement,
|
|
7
7
|
h,
|
|
8
8
|
registerInstance
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DTQVRGVL.js";
|
|
10
10
|
|
|
11
11
|
// dist/esm/ui-button.entry.js
|
|
12
12
|
var uiButtonCss = () => `:host{display:inline-flex;vertical-align:middle;color:var(--ui-text-primary)}:host([variant='outline'])::slotted(button),::slotted(button){appearance:none;border:1px solid var(--ui-border-default);border-radius:var(--ui-button-radius, var(--ui-radius-2));background:var(--ui-surface-default);color:inherit;font:inherit;font-weight:var(--ui-font-medium, 500);line-height:var(--ui-line-height-tight);padding:var(--ui-space-2) var(--ui-space-3);cursor:pointer;transition:background-color var(--ui-motion-fast) var(--ui-motion-ease), border-color var(--ui-motion-fast) var(--ui-motion-ease), color var(--ui-motion-fast) var(--ui-motion-ease), box-shadow var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease);margin:0}:host([data-size='sm'])::slotted(button){padding:var(--ui-space-1) var(--ui-space-2);font-size:0.875rem}:host([data-size='lg'])::slotted(button){padding:var(--ui-space-3) var(--ui-space-4);font-size:1rem}::slotted(button:hover:enabled){background:var(--ui-surface-muted);border-color:var(--ui-border-strong)}::slotted(button:active:enabled){background:var(--ui-surface-subtle)}:host([variant='solid'])::slotted(button){border-color:var(--ui-accent-solid);background:var(--ui-accent-solid);color:var(--ui-text-on-accent);box-shadow:var(--ui-button-solid-shadow, inset 0 1px rgb(255 255 255 / 0.16), var(--ui-shadow-xs))}:host([variant='solid'])::slotted(button:hover:enabled){background:var(--ui-accent-hover);border-color:var(--ui-accent-hover);box-shadow:var(--ui-shadow-sm);transform:translateY(-1px)}:host([variant='solid'])::slotted(button:active:enabled){background:var(--ui-accent-active);border-color:var(--ui-accent-active);box-shadow:none;transform:translateY(0)}:host([variant='destructive'])::slotted(button){border-color:var(--ui-danger-solid);background:var(--ui-danger-solid);color:var(--ui-text-on-accent);box-shadow:var(--ui-button-destructive-shadow, inset 0 1px rgb(255 255 255 / 0.14), var(--ui-shadow-xs))}:host([variant='destructive'])::slotted(button:hover:enabled){background:var(--ui-danger-hover);border-color:var(--ui-danger-hover);box-shadow:var(--ui-shadow-sm);transform:translateY(-1px)}:host([variant='destructive'])::slotted(button:active:enabled){box-shadow:none;transform:translateY(0)}:host([variant='ghost'])::slotted(button){border-color:transparent;background:transparent}:host([variant='ghost'])::slotted(button:hover:enabled){background:var(--ui-surface-muted);border-color:transparent}:host([variant='ghost'])::slotted(button:active:enabled){background:var(--ui-surface-subtle);border-color:transparent}::slotted(button:focus-visible){outline:2px solid var(--ui-focus-ring);outline-offset:2px}::slotted(button:disabled),:host([data-disabled]){opacity:0.6;cursor:not-allowed}`;
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
getElement,
|
|
8
8
|
h,
|
|
9
9
|
registerInstance
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-DTQVRGVL.js";
|
|
11
11
|
|
|
12
12
|
// dist/esm/ui-checkbox.entry.js
|
|
13
13
|
var uiCheckboxCss = () => `:host{display:inline-flex;align-items:center;gap:var(--ui-space-2);color:var(--ui-text-primary)}:host([aria-disabled='true']),:host([data-disabled='true']){opacity:0.6;cursor:not-allowed}::slotted(input[type='checkbox']){accent-color:var(--ui-accent-solid);width:1.125em;height:1.125em;cursor:pointer}::slotted(input[type='checkbox']:focus-visible){outline:2px solid var(--ui-accent-solid);outline-offset:2px}`;
|
|
@@ -2,7 +2,10 @@ import {
|
|
|
2
2
|
closeOverlay,
|
|
3
3
|
openOverlay,
|
|
4
4
|
requestTopOverlayClose
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-SZJQ3NPX.js";
|
|
6
|
+
import {
|
|
7
|
+
createAnchoredSurface
|
|
8
|
+
} from "./chunk-YHXJC5M5.js";
|
|
6
9
|
import {
|
|
7
10
|
dispatchDetail
|
|
8
11
|
} from "./chunk-UL7UIUJZ.js";
|
|
@@ -11,10 +14,10 @@ import {
|
|
|
11
14
|
getElement,
|
|
12
15
|
h,
|
|
13
16
|
registerInstance
|
|
14
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-DTQVRGVL.js";
|
|
15
18
|
|
|
16
19
|
// dist/esm/ui-context-menu.entry.js
|
|
17
|
-
var uiContextMenuCss = () => `:host{display:contents}.menu{position:fixed;z-index:var(--ui-z-overlay, 1000);min-width:12rem}.menu
|
|
20
|
+
var 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}}`;
|
|
18
21
|
var UIContextMenu = class {
|
|
19
22
|
constructor(hostRef) {
|
|
20
23
|
registerInstance(this, hostRef);
|
|
@@ -29,11 +32,14 @@ var UIContextMenu = class {
|
|
|
29
32
|
/** Optional id of the region that should also respond to a context-menu gesture. */
|
|
30
33
|
for;
|
|
31
34
|
internalOpen = false;
|
|
35
|
+
focusTrigger = "programmatic";
|
|
32
36
|
overlayId = `ui-context-menu-${Math.random().toString(36).slice(2, 11)}`;
|
|
33
37
|
trigger = null;
|
|
34
38
|
contextTarget = null;
|
|
35
39
|
pointerX = 0;
|
|
36
40
|
pointerY = 0;
|
|
41
|
+
pointPositioned = false;
|
|
42
|
+
surface = null;
|
|
37
43
|
syncFromProp() {
|
|
38
44
|
this.internalOpen = this.open;
|
|
39
45
|
}
|
|
@@ -44,6 +50,11 @@ var UIContextMenu = class {
|
|
|
44
50
|
syncOverlay() {
|
|
45
51
|
this.syncTriggerState();
|
|
46
52
|
if (this.internalOpen) {
|
|
53
|
+
if (this.pointPositioned) {
|
|
54
|
+
this.surface?.showAtPoint({ x: this.pointerX, y: this.pointerY });
|
|
55
|
+
} else {
|
|
56
|
+
this.surface?.show();
|
|
57
|
+
}
|
|
47
58
|
openOverlay({
|
|
48
59
|
id: this.overlayId,
|
|
49
60
|
modal: false,
|
|
@@ -52,6 +63,7 @@ var UIContextMenu = class {
|
|
|
52
63
|
requestClose: (reason, trigger) => this.closeMenu(reason, trigger)
|
|
53
64
|
});
|
|
54
65
|
} else {
|
|
66
|
+
this.surface?.hide();
|
|
55
67
|
closeOverlay(this.overlayId);
|
|
56
68
|
}
|
|
57
69
|
}
|
|
@@ -60,18 +72,33 @@ var UIContextMenu = class {
|
|
|
60
72
|
this.internalOpen = this.internalOpen || this.defaultOpen;
|
|
61
73
|
this.resolveTargets();
|
|
62
74
|
this.attachTargetListeners();
|
|
75
|
+
this.setupSurface();
|
|
63
76
|
this.syncTriggerState();
|
|
64
77
|
this.syncOverlay();
|
|
65
78
|
}
|
|
66
79
|
componentDidUpdate() {
|
|
67
80
|
this.resolveTargets();
|
|
68
81
|
this.attachTargetListeners();
|
|
82
|
+
if (!this.pointPositioned)
|
|
83
|
+
this.surface?.setAnchor(this.trigger);
|
|
69
84
|
this.syncTriggerState();
|
|
70
85
|
}
|
|
71
86
|
disconnectedCallback() {
|
|
72
87
|
this.detachTargetListeners();
|
|
88
|
+
this.surface?.destroy();
|
|
89
|
+
this.surface = null;
|
|
73
90
|
closeOverlay(this.overlayId);
|
|
74
91
|
}
|
|
92
|
+
setupSurface() {
|
|
93
|
+
const menu = this.host.shadowRoot?.querySelector(".menu");
|
|
94
|
+
if (!menu)
|
|
95
|
+
return;
|
|
96
|
+
this.surface?.destroy();
|
|
97
|
+
this.surface = createAnchoredSurface(menu, {
|
|
98
|
+
anchor: this.trigger,
|
|
99
|
+
placement: "bottom-start"
|
|
100
|
+
});
|
|
101
|
+
}
|
|
75
102
|
resolveTargets() {
|
|
76
103
|
const previousTrigger = this.trigger;
|
|
77
104
|
const previousContextTarget = this.contextTarget;
|
|
@@ -111,6 +138,9 @@ var UIContextMenu = class {
|
|
|
111
138
|
openMenu(x, y, trigger) {
|
|
112
139
|
this.pointerX = x;
|
|
113
140
|
this.pointerY = y;
|
|
141
|
+
this.focusTrigger = trigger;
|
|
142
|
+
this.pointPositioned = true;
|
|
143
|
+
this.surface?.showAtPoint({ x, y });
|
|
114
144
|
this.internalOpen = true;
|
|
115
145
|
dispatchDetail(this.host, "open", {
|
|
116
146
|
open: true,
|
|
@@ -122,8 +152,14 @@ var UIContextMenu = class {
|
|
|
122
152
|
openFromTrigger(trigger) {
|
|
123
153
|
if (!this.trigger)
|
|
124
154
|
return;
|
|
125
|
-
|
|
126
|
-
this.
|
|
155
|
+
this.pointPositioned = false;
|
|
156
|
+
this.internalOpen = true;
|
|
157
|
+
dispatchDetail(this.host, "open", {
|
|
158
|
+
open: true,
|
|
159
|
+
reason: "action",
|
|
160
|
+
trigger
|
|
161
|
+
});
|
|
162
|
+
this.focusFirstItem();
|
|
127
163
|
}
|
|
128
164
|
closeMenu(reason, trigger, returnFocus = true) {
|
|
129
165
|
if (!this.internalOpen)
|
|
@@ -165,6 +201,7 @@ var UIContextMenu = class {
|
|
|
165
201
|
onKeydown = (event) => {
|
|
166
202
|
if (!this.internalOpen)
|
|
167
203
|
return;
|
|
204
|
+
this.focusTrigger = "keyboard";
|
|
168
205
|
if (event.key === "Escape") {
|
|
169
206
|
event.preventDefault();
|
|
170
207
|
requestTopOverlayClose("escape", "keyboard");
|
|
@@ -189,7 +226,7 @@ var UIContextMenu = class {
|
|
|
189
226
|
this.closeMenu("action", "pointer");
|
|
190
227
|
};
|
|
191
228
|
render() {
|
|
192
|
-
return h(Host, { key: "
|
|
229
|
+
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" }))));
|
|
193
230
|
}
|
|
194
231
|
static get watchers() {
|
|
195
232
|
return {
|