@editora/ui-core 0.1.13 → 0.1.14
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 +96 -6
- package/dist/color-picker.cjs.js +1 -1
- package/dist/color-picker.esm.js +2 -1
- package/dist/components/date-time-utils.d.ts.map +1 -1
- package/dist/components/ui-context-menu.d.ts +6 -0
- package/dist/components/ui-context-menu.d.ts.map +1 -1
- package/dist/components/ui-floating-toolbar.d.ts +3 -0
- package/dist/components/ui-floating-toolbar.d.ts.map +1 -1
- package/dist/components/ui-gantt.d.ts +30 -1
- package/dist/components/ui-gantt.d.ts.map +1 -1
- package/dist/components/ui-hover-card.d.ts +3 -0
- package/dist/components/ui-hover-card.d.ts.map +1 -1
- package/dist/components/ui-positioner.d.ts.map +1 -1
- package/dist/context-menu.cjs.js +12 -12
- package/dist/context-menu.esm.js +159 -132
- package/dist/date-field.cjs.js +1 -1
- package/dist/date-field.esm.js +2 -1
- package/dist/date-picker.cjs.js +1 -1
- package/dist/date-picker.esm.js +2 -1
- package/dist/date-range-picker.cjs.js +1 -1
- package/dist/date-range-picker.esm.js +2 -1
- package/dist/date-range-time-picker.cjs.js +2 -2
- package/dist/date-range-time-picker.esm.js +2 -1
- package/dist/date-time-picker.cjs.js +2 -2
- package/dist/date-time-picker.esm.js +2 -1
- package/dist/date-time-utils-66480de4.js +1 -0
- package/dist/date-time-utils-a2c7af25.mjs +307 -0
- package/dist/floating-toolbar.cjs.js +4 -4
- package/dist/floating-toolbar.esm.js +52 -25
- package/dist/gantt.cjs.js +656 -74
- package/dist/gantt.esm.js +1050 -100
- package/dist/hover-card.cjs.js +4 -4
- package/dist/hover-card.esm.js +61 -38
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +158 -146
- package/dist/menu.cjs.js +1 -1
- package/dist/menu.esm.js +2 -2
- package/dist/menubar.cjs.js +1 -1
- package/dist/menubar.esm.js +2 -2
- package/dist/popover.cjs.js +1 -1
- package/dist/popover.esm.js +2 -2
- package/dist/portal-c69756c0.js +1 -0
- package/dist/portal-fe73e5cc.mjs +123 -0
- package/dist/portal.d.ts +29 -3
- package/dist/portal.d.ts.map +1 -1
- package/dist/positioner-33529bb8.js +1 -0
- package/dist/positioner-e9770c66.mjs +582 -0
- package/dist/positioner.cjs.js +2 -2
- package/dist/positioner.esm.js +36 -26
- package/dist/primitives/positioner.d.ts +199 -1
- package/dist/primitives/positioner.d.ts.map +1 -1
- package/dist/{runtime-864efe2f.mjs → runtime-161f68a2.mjs} +24 -23
- package/dist/runtime-3f13807b.js +1 -0
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.esm.js +39 -24
- package/dist/split-button.cjs.js +1 -1
- package/dist/split-button.esm.js +2 -2
- package/dist/time-field.cjs.js +1 -1
- package/dist/time-field.esm.js +14 -13
- package/dist/time-picker.cjs.js +1 -1
- package/dist/time-picker.esm.js +2 -1
- package/dist/tooltip.cjs.js +1 -1
- package/dist/tooltip.esm.js +2 -1
- package/package.json +2 -2
- package/dist/date-time-utils-378ecc21.js +0 -1
- package/dist/date-time-utils-a8b17ea7.mjs +0 -299
- package/dist/portal-9060f7a6.mjs +0 -114
- package/dist/portal-d9bae456.js +0 -1
- package/dist/positioner-16f3cca1.mjs +0 -132
- package/dist/positioner-43b1c75a.js +0 -1
- package/dist/runtime-668914fe.js +0 -1
package/README.md
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
# @editora/ui-core
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
> **Live Website:** https://editora-ecosystem.netlify.app/
|
|
5
|
-
> **Storybook:** https://editora-ecosystem-storybook.netlify.app/
|
|
3
|
+

|
|
6
4
|
|
|
5
|
+
## Demos
|
|
6
|
+
|
|
7
|
+
- **CodeSandbox:** https://qjr47y-5173.csb.app/button
|
|
8
|
+
- **UI Component Catalog:** https://editora-ecosystem.netlify.app/
|
|
9
|
+
- **Web Demo:** https://editora-free.netlify.app/
|
|
10
|
+
- **Storybook:** https://editora-ecosystem-storybook.netlify.app/
|
|
7
11
|
|
|
8
12
|
Production-oriented Web Components for Editora UI.
|
|
9
13
|
|
|
@@ -78,6 +82,7 @@ More guidance lives in [`docs/FRAMEWORK_DIRECT_USAGE.md`](https://github.com/aja
|
|
|
78
82
|
- `ElementBase`
|
|
79
83
|
- `applyTheme`, `defaultTokens`
|
|
80
84
|
- `showPortalFor`, `autoUpdatePosition`, portal helpers
|
|
85
|
+
- `createPositioner`, `computePositionState`, `autoUpdatePositioner`, middleware helpers, virtual anchors
|
|
81
86
|
- focus/overlay managers
|
|
82
87
|
- `showToast`
|
|
83
88
|
|
|
@@ -89,7 +94,7 @@ More guidance lives in [`docs/FRAMEWORK_DIRECT_USAGE.md`](https://github.com/aja
|
|
|
89
94
|
|
|
90
95
|
### Primitives and forms
|
|
91
96
|
- `ui-button`, `ui-split-button`, `ui-input`, `ui-textarea`, `ui-label`, `ui-description`, `ui-field-error`, `ui-control-group`, `ui-fieldset`, `ui-field`, `ui-form`, `ui-pin-input`, `ui-otp-input`, `ui-inline-edit`
|
|
92
|
-
- `ui-checkbox`, `ui-radio
|
|
97
|
+
- `ui-checkbox`, `ui-radio-group`, `ui-switch`, `ui-slider`, `ui-select`, `ui-combobox`
|
|
93
98
|
- `ui-date-picker`, `ui-date-range-picker`, `ui-time-picker`, `ui-date-time-picker`, `ui-date-range-time-picker`
|
|
94
99
|
- `ui-color-picker`
|
|
95
100
|
|
|
@@ -169,7 +174,56 @@ More guidance lives in [`docs/FRAMEWORK_DIRECT_USAGE.md`](https://github.com/aja
|
|
|
169
174
|
<ui-pagination id="usersPager"></ui-pagination>
|
|
170
175
|
```
|
|
171
176
|
|
|
172
|
-
### 4.
|
|
177
|
+
### 4. Gantt planning timeline
|
|
178
|
+
|
|
179
|
+
`ui-gantt` is a framework-agnostic planning workspace for schedules, release plans, and project roadmaps. It includes task, summary, and milestone rows; dependency links; drag/resize editing; baselines; critical tasks; split segments; keyboard navigation; and automatic row virtualization for large schedules.
|
|
180
|
+
|
|
181
|
+
```html
|
|
182
|
+
<ui-gantt id="releasePlan" zoom="week" sort="start" bar-variant="soft"></ui-gantt>
|
|
183
|
+
|
|
184
|
+
<script type="module">
|
|
185
|
+
import '@editora/ui-core';
|
|
186
|
+
|
|
187
|
+
const gantt = document.getElementById('releasePlan');
|
|
188
|
+
|
|
189
|
+
gantt.setAttribute('tasks', JSON.stringify([
|
|
190
|
+
{
|
|
191
|
+
id: 'api',
|
|
192
|
+
label: 'API contracts',
|
|
193
|
+
start: '2026-02-10',
|
|
194
|
+
end: '2026-02-24',
|
|
195
|
+
progress: 62,
|
|
196
|
+
baselineStart: '2026-02-07',
|
|
197
|
+
baselineEnd: '2026-02-21',
|
|
198
|
+
critical: true
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
id: 'qa',
|
|
202
|
+
label: 'QA sign-off',
|
|
203
|
+
start: '2026-02-27',
|
|
204
|
+
type: 'milestone',
|
|
205
|
+
tone: 'success'
|
|
206
|
+
}
|
|
207
|
+
]));
|
|
208
|
+
|
|
209
|
+
gantt.setAttribute('links', JSON.stringify([
|
|
210
|
+
{ id: 'api-qa', source: 'api', target: 'qa', type: 'e2s' }
|
|
211
|
+
]));
|
|
212
|
+
|
|
213
|
+
gantt.addEventListener('taskchange', (event) => console.log('task changed', event.detail));
|
|
214
|
+
gantt.addEventListener('taskdelete', (event) => console.log('delete task', event.detail.id));
|
|
215
|
+
gantt.addEventListener('linkselect', (event) => console.log('dependency selected', event.detail));
|
|
216
|
+
</script>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Useful attributes:
|
|
220
|
+
|
|
221
|
+
- `zoom`: `day`, `week`, `month`, `quarter`, or `year`
|
|
222
|
+
- `sort`: `none`, `start`, `end`, `label`, or `progress`
|
|
223
|
+
- `bar-variant`: `solid`, `soft`, `striped`, `outline`, or `glass`
|
|
224
|
+
- `readonly`, `show-toolbar`, `show-today`, `filter`, `virtualized="false"`
|
|
225
|
+
|
|
226
|
+
### 5. Promise dialog manager
|
|
173
227
|
|
|
174
228
|
```ts
|
|
175
229
|
import '@editora/ui-core';
|
|
@@ -190,7 +244,7 @@ if (result.action === 'submit') {
|
|
|
190
244
|
}
|
|
191
245
|
```
|
|
192
246
|
|
|
193
|
-
###
|
|
247
|
+
### 6. Promise alert dialog manager
|
|
194
248
|
|
|
195
249
|
```ts
|
|
196
250
|
import '@editora/ui-core';
|
|
@@ -229,10 +283,46 @@ applyTheme({
|
|
|
229
283
|
});
|
|
230
284
|
```
|
|
231
285
|
|
|
286
|
+
## Floating Positioning
|
|
287
|
+
|
|
288
|
+
`@editora/ui-core` includes the shared floating engine used by menus, context menus, hover cards, floating toolbars, and picker overlays.
|
|
289
|
+
|
|
290
|
+
Use `@editora/ui-core/runtime` for framework-agnostic floating behavior:
|
|
291
|
+
|
|
292
|
+
```ts
|
|
293
|
+
import { createPositioner } from '@editora/ui-core/runtime';
|
|
294
|
+
|
|
295
|
+
const handle = createPositioner({
|
|
296
|
+
anchor: trigger,
|
|
297
|
+
floating: panel,
|
|
298
|
+
placement: 'bottom-start',
|
|
299
|
+
strategy: 'fixed',
|
|
300
|
+
offset: 8,
|
|
301
|
+
flip: true,
|
|
302
|
+
shift: true,
|
|
303
|
+
fitViewport: true
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
// later
|
|
307
|
+
handle.destroy();
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
You can also use:
|
|
311
|
+
|
|
312
|
+
- `computePositionState()` for one-shot coordinate calculation
|
|
313
|
+
- `autoUpdatePositioner()` for observer-driven updates
|
|
314
|
+
- `createVirtualPoint()`, `createVirtualRect()`, `createVirtualRange()` for virtual anchors
|
|
315
|
+
- `detectPositionerOverflow()` for diagnostics and custom middleware
|
|
316
|
+
|
|
317
|
+
Full guide:
|
|
318
|
+
|
|
319
|
+
- `docs/FLOATING_USAGE.md`
|
|
320
|
+
|
|
232
321
|
## Docs
|
|
233
322
|
|
|
234
323
|
- `docs/FRAMEWORK_DIRECT_USAGE.md` for Vue, Svelte, and Angular direct-use guidance
|
|
235
324
|
- `docs/ATTRIBUTE_RENDER_MATRIX.md` for component render strategy coverage
|
|
325
|
+
- `docs/FLOATING_USAGE.md` for first-party floating primitives and Floating UI-style usage
|
|
236
326
|
- `docs/PRIMITIVE_GAP_MATRIX.md` for the missing primitive roadmap
|
|
237
327
|
- `docs/PRIMITIVE_IMPLEMENTATION_PLAN.md` for proposed APIs and rollout order
|
|
238
328
|
|
package/dist/color-picker.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const W=require("./ElementBase-1b301e7f.js"),m=require("./date-time-utils-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const W=require("./ElementBase-1b301e7f.js"),m=require("./date-time-utils-66480de4.js");require("./calendar-a8735e40.js");require("./scroll-lock-d7b0df21.js");require("./positioner-33529bb8.js");function g(s,t,e){return Math.max(t,Math.min(e,s))}function y(s,t=3){const e=10**t;return Math.round(s*e)/e}function C(s){return g(Math.round(s),0,255)}function O(s){const t=s.trim();if(!t)return null;if(t.endsWith("%")){const r=Number(t.slice(0,-1));return Number.isFinite(r)?g(r/100,0,1):null}const e=Number(t);return Number.isFinite(e)?g(e,0,1):null}function B(s){const t=s.trim();if(!t)return null;if(t.endsWith("%")){const r=Number(t.slice(0,-1));return Number.isFinite(r)?C(g(r,0,100)/100*255):null}const e=Number(t);return Number.isFinite(e)?C(e):null}function H(s){const t=s.trim();if(!t.endsWith("%"))return null;const e=Number(t.slice(0,-1));return Number.isFinite(e)?g(e,0,100):null}function K(s){const t=s.trim().toLowerCase();if(!t)return null;if(t.endsWith("deg")){const r=Number(t.slice(0,-3));return Number.isFinite(r)?k(r):null}if(t.endsWith("turn")){const r=Number(t.slice(0,-4));return Number.isFinite(r)?k(r*360):null}if(t.endsWith("rad")){const r=Number(t.slice(0,-3));return Number.isFinite(r)?k(r*180/Math.PI):null}const e=Number(t);return Number.isFinite(e)?k(e):null}function k(s){const t=s%360;return t<0?t+360:t}function F(s){const t=s.trim();if(!t)return null;if(t.includes("/")){const[r,i]=t.split("/");if(i==null)return null;const a=r.includes(",")?r.split(","):r.trim().split(/\s+/);return a.length<3?null:{channels:a.map(n=>n.trim()).filter(Boolean),alpha:i.trim()}}if(t.includes(",")){const r=t.split(",").map(i=>i.trim()).filter(Boolean);return r.length<3?null:{channels:r.slice(0,3),alpha:r[3]??null}}const e=t.split(/\s+/).map(r=>r.trim()).filter(Boolean);return e.length<3?null:{channels:e.slice(0,3),alpha:e[3]??null}}function G(s){const t=s.trim().replace(/^#/,"");if(![3,4,6,8].includes(t.length)||!/^[0-9a-f]+$/i.test(t))return null;if(t.length===3||t.length===4){const n=parseInt(t[0]+t[0],16),o=parseInt(t[1]+t[1],16),l=parseInt(t[2]+t[2],16),u=t.length===4?parseInt(t[3]+t[3],16)/255:1;return h({r:n,g:o,b:l,a:u})}const e=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16),a=t.length===8?parseInt(t.slice(6,8),16)/255:1;return h({r:e,g:r,b:i,a})}function X(s){const t=/^rgba?\((.+)\)$/i.exec(s.trim());if(!t)return null;const e=F(t[1]);if(!e||e.channels.length<3)return null;const r=B(e.channels[0]),i=B(e.channels[1]),a=B(e.channels[2]);if(r==null||i==null||a==null)return null;const n=e.alpha!=null?O(e.alpha):1;return n==null?null:h({r,g:i,b:a,a:n})}function Y(s){const t=/^hsla?\((.+)\)$/i.exec(s.trim());if(!t)return null;const e=F(t[1]);if(!e||e.channels.length<3)return null;const r=K(e.channels[0]),i=H(e.channels[1]),a=H(e.channels[2]);if(r==null||i==null||a==null)return null;const n=e.alpha!=null?O(e.alpha):1;return n==null?null:U({h:r,s:i,l:a,a:n})}function h(s){return{r:C(s.r),g:C(s.g),b:C(s.b),a:y(g(s.a,0,1),4)}}function f(s){const t=(s||"").trim();return t?t.startsWith("#")?G(t):/^rgba?\(/i.test(t)?X(t):/^hsla?\(/i.test(t)?Y(t):null:null}function j(s,t=!1){const e=h(s),r=a=>a.toString(16).padStart(2,"0"),i=`#${r(e.r)}${r(e.g)}${r(e.b)}`;return t?`${i}${r(Math.round(e.a*255))}`:i}function J(s,t=!0){const e=h(s);return!t||e.a>=1?`rgb(${e.r} ${e.g} ${e.b})`:`rgb(${e.r} ${e.g} ${e.b} / ${y(e.a,3)})`}function Q(s,t=!0){const e=Math.round(k(s.h)),r=Math.round(g(s.s,0,100)),i=Math.round(g(s.l,0,100)),a=y(g(s.a,0,1),3);return!t||a>=1?`hsl(${e} ${r}% ${i}%)`:`hsl(${e} ${r}% ${i}% / ${a})`}function T(s){const t=h(s),e=t.r/255,r=t.g/255,i=t.b/255,a=Math.max(e,r,i),n=Math.min(e,r,i),o=a-n;let l=0;o!==0&&(a===e?l=(r-i)/o%6:a===r?l=(i-e)/o+2:l=(e-r)/o+4,l*=60,l<0&&(l+=360));const u=a===0?0:o/a*100,b=a*100;return{h:y(l,3),s:y(u,3),v:y(b,3),a:t.a}}function Z(s){const t=k(s.h),e=g(s.s,0,100)/100,r=g(s.v,0,100)/100,i=r*e,a=i*(1-Math.abs(t/60%2-1)),n=r-i;let o=0,l=0,u=0;return t<60?(o=i,l=a):t<120?(o=a,l=i):t<180?(l=i,u=a):t<240?(l=a,u=i):t<300?(o=a,u=i):(o=i,u=a),h({r:(o+n)*255,g:(l+n)*255,b:(u+n)*255,a:s.a})}function L(s){const t=h(s),e=t.r/255,r=t.g/255,i=t.b/255,a=Math.max(e,r,i),n=Math.min(e,r,i),o=a-n,l=(a+n)/2;let u=0,b=0;return o!==0&&(b=o/(1-Math.abs(2*l-1)),a===e?u=(r-i)/o%6:a===r?u=(i-e)/o+2:u=(e-r)/o+4,u*=60,u<0&&(u+=360)),{h:y(u,3),s:y(b*100,3),l:y(l*100,3),a:t.a}}function U(s){const t=k(s.h),e=g(s.s,0,100)/100,r=g(s.l,0,100)/100,i=(1-Math.abs(2*r-1))*e,a=i*(1-Math.abs(t/60%2-1)),n=r-i/2;let o=0,l=0,u=0;return t<60?(o=i,l=a):t<120?(o=a,l=i):t<180?(l=i,u=a):t<240?(l=a,u=i):t<300?(o=a,u=i):(o=i,u=a),h({r:(o+n)*255,g:(l+n)*255,b:(u+n)*255,a:s.a})}function w(s,t){return j(s,t).toUpperCase()}function A(s,t){return J(s,t)}function tt(s,t){return Q(L(s),t)}const z="#2563eb",q="editora:ui-color-picker:recent",et=`
|
|
2
2
|
<svg viewBox="0 0 20 20" aria-hidden="true" focusable="false">
|
|
3
3
|
<path d="m5.6 7.6 4.4 4.6 4.4-4.6" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
4
|
</svg>
|
package/dist/color-picker.esm.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { E as V } from "./ElementBase-909688f3.mjs";
|
|
2
|
-
import { r as W, e as K, l as G, i as I, s as X, c as Y } from "./date-time-utils-
|
|
2
|
+
import { r as W, e as K, l as G, i as I, s as X, c as Y } from "./date-time-utils-a2c7af25.mjs";
|
|
3
3
|
import "./calendar-2c11b824.mjs";
|
|
4
4
|
import "./scroll-lock-31da444f.mjs";
|
|
5
|
+
import "./positioner-e9770c66.mjs";
|
|
5
6
|
function g(s, t, e) {
|
|
6
7
|
return Math.max(t, Math.min(e, s));
|
|
7
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-time-utils.d.ts","sourceRoot":"","sources":["../../src/components/date-time-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"date-time-utils.d.ts","sourceRoot":"","sources":["../../src/components/date-time-utils.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,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,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CASlF;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAMnG;AAED,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,OAAO,EACnB,SAAS,EAAE,OAAO,EAClB,OAAO,SAAI,EACX,GAAG,SAAI,EACP,gBAAgB,GAAE,gBAAgB,GAAG,IAAW,GAC/C,eAAe,CAwCjB;AAED,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG;IAAE,GAAG,EAAE,MAAM,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,CAenF;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAKjE;AAED,wBAAgB,cAAc,IAAI,MAAM,IAAI,CAE3C"}
|
|
@@ -15,6 +15,10 @@ export declare class UIContextMenu extends ElementBase {
|
|
|
15
15
|
private _portalSurfaceEl;
|
|
16
16
|
private _portalContentHostEl;
|
|
17
17
|
private _dismissableLayer;
|
|
18
|
+
private _positioner;
|
|
19
|
+
private _positionerPlacement;
|
|
20
|
+
private _positionerOffset;
|
|
21
|
+
private _positionerAnchorEl;
|
|
18
22
|
private _contentAnchor;
|
|
19
23
|
private _contentSourceEl;
|
|
20
24
|
private _contentOriginalParent;
|
|
@@ -79,6 +83,8 @@ export declare class UIContextMenu extends ElementBase {
|
|
|
79
83
|
private _syncDismissableLayer;
|
|
80
84
|
private _cancelScheduledWork;
|
|
81
85
|
private _captureAnchorRect;
|
|
86
|
+
private _pointVirtualAnchor;
|
|
87
|
+
private _rebuildPositioner;
|
|
82
88
|
private _startAnchorTracking;
|
|
83
89
|
private _stopAnchorTracking;
|
|
84
90
|
private _trackAnchorLayout;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-context-menu.d.ts","sourceRoot":"","sources":["../../src/components/ui-context-menu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ui-context-menu.d.ts","sourceRoot":"","sources":["../../src/components/ui-context-menu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAU7C,OAAO,cAAc,CAAC;AAGtB,KAAK,KAAK,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtC,KAAK,gBAAgB,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAwkBjE,qBAAa,aAAc,SAAQ,WAAW;IAC5C,MAAM,KAAK,kBAAkB,aAmB5B;IAED,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,SAAS,CAA4B;IAC7C,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,eAAe,CAA4B;IACnD,OAAO,CAAC,SAAS,CAA4B;IAC7C,OAAO,CAAC,gBAAgB,CAA4B;IACpD,OAAO,CAAC,oBAAoB,CAA0B;IACtD,OAAO,CAAC,iBAAiB,CAAuC;IAChE,OAAO,CAAC,WAAW,CAAiC;IACpD,OAAO,CAAC,oBAAoB,CAAoC;IAChE,OAAO,CAAC,iBAAiB,CAAK;IAC9B,OAAO,CAAC,mBAAmB,CAA4B;IACvD,OAAO,CAAC,cAAc,CAAwB;IAC9C,OAAO,CAAC,gBAAgB,CAA4B;IACpD,OAAO,CAAC,sBAAsB,CAAqB;IACnD,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,eAAe,CAAuB;IAC9C,OAAO,CAAC,gBAAgB,CAAM;IAC9B,OAAO,CAAC,eAAe,CAAuB;IAC9C,OAAO,CAAC,mBAAmB,C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,CAAC,mBAAmB;IAW3B,OAAO,CAAC,kBAAkB;IAS1B,OAAO,CAAC,gBAAgB;IAuBxB,OAAO,CAAC,uBAAuB;IAwB/B,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,aAAa;IAwBrB,OAAO,CAAC,sBAAsB;IAS9B,OAAO,CAAC,eAAe;IA8CvB,OAAO,CAAC,YAAY;IAoBpB,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,mBAAmB;IAK3B,OAAO,CAAC,cAAc;IAetB,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,sBAAsB;IAc9B,OAAO,CAAC,cAAc;IAkEtB,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,iBAAiB;IAMzB,SAAS,CAAC,MAAM,IAAI,IAAI;cAsBL,6BAA6B,IAAI,OAAO;CAG5D"}
|
|
@@ -16,6 +16,9 @@ export declare class UIFloatingToolbar extends ElementBase {
|
|
|
16
16
|
private _raf;
|
|
17
17
|
private _resizeObserver;
|
|
18
18
|
private _mutationObserver;
|
|
19
|
+
private _positioner;
|
|
20
|
+
private _positionerPlacement;
|
|
21
|
+
private _positionerOffset;
|
|
19
22
|
private _globalListenersBound;
|
|
20
23
|
private _isOpen;
|
|
21
24
|
private _closeReason;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-floating-toolbar.d.ts","sourceRoot":"","sources":["../../src/components/ui-floating-toolbar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ui-floating-toolbar.d.ts","sourceRoot":"","sources":["../../src/components/ui-floating-toolbar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAS7C,KAAK,kBAAkB,GACnB,SAAS,GACT,QAAQ,GACR,eAAe,GACf,gBAAgB,GAChB,cAAc,GACd,UAAU,CAAC;AAE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AAmB;IAW3B,OAAO,CAAC,oBAAoB;IAiB5B,OAAO,CAAC,aAAa;IAuBrB,OAAO,CAAC,wBAAwB;IAShC,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,gBAAgB;IA+BxB,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,sBAAsB;IAS9B,OAAO,CAAC,SAAS;IAmDjB,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,sBAAsB;IAS9B,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,eAAe;IAsBvB,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,kBAAkB;IAsB1B,OAAO,CAAC,cAAc;cAYH,MAAM,IAAI,IAAI;CA8BlC"}
|
|
@@ -1,7 +1,36 @@
|
|
|
1
1
|
import { ElementBase } from '../ElementBase';
|
|
2
2
|
export declare class UIGantt extends ElementBase {
|
|
3
3
|
static get observedAttributes(): string[];
|
|
4
|
+
private collapsed;
|
|
5
|
+
private overrides;
|
|
6
|
+
private drag;
|
|
7
|
+
private selectedId;
|
|
8
|
+
private internalFilter;
|
|
9
|
+
private viewportTop;
|
|
10
|
+
private viewportLeft;
|
|
11
|
+
private viewportWidth;
|
|
12
|
+
private viewportHeight;
|
|
13
|
+
private renderedFirstRow;
|
|
14
|
+
private renderedLastRow;
|
|
15
|
+
private scrollFrame;
|
|
16
|
+
private overridesVersion;
|
|
17
|
+
private taskCacheRaw;
|
|
18
|
+
private taskCacheVersion;
|
|
19
|
+
private taskCache;
|
|
20
|
+
private linkCacheRaw;
|
|
21
|
+
private linkCache;
|
|
22
|
+
private visibleCacheKey;
|
|
23
|
+
private visibleCache;
|
|
4
24
|
protected render(): void;
|
|
5
|
-
|
|
25
|
+
private bindEvents;
|
|
26
|
+
private rangeMin;
|
|
27
|
+
private selectTask;
|
|
28
|
+
private selectAdjacentTask;
|
|
29
|
+
private captureViewport;
|
|
30
|
+
private getTasks;
|
|
31
|
+
private getLinks;
|
|
32
|
+
private getVisibleTasks;
|
|
33
|
+
private bumpOverrides;
|
|
34
|
+
protected shouldRenderOnAttributeChange(name: string, _oldValue: string | null, _newValue: string | null): boolean;
|
|
6
35
|
}
|
|
7
36
|
//# sourceMappingURL=ui-gantt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-gantt.d.ts","sourceRoot":"","sources":["../../src/components/ui-gantt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ui-gantt.d.ts","sourceRoot":"","sources":["../../src/components/ui-gantt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAo/B7C,qBAAa,OAAQ,SAAQ,WAAW;IACtC,MAAM,KAAK,kBAAkB,aAE5B;IAED,OAAO,CAAC,SAAS,CAAqB;IACtC,OAAO,CAAC,SAAS,CAAyC;IAC1D,OAAO,CAAC,IAAI,CAA0B;IACtC,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,cAAc,CAAM;IAC5B,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,aAAa,CAAQ;IAC7B,OAAO,CAAC,cAAc,CAAO;IAC7B,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,gBAAgB,CAAM;IAC9B,OAAO,CAAC,SAAS,CAAmB;IACpC,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,SAAS,CAAmB;IACpC,OAAO,CAAC,eAAe,CAAM;IAC7B,OAAO,CAAC,YAAY,CAAqB;cAEtB,MAAM,IAAI,IAAI;IAmMjC,OAAO,CAAC,UAAU;IAgPlB,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,kBAAkB;IAiB1B,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,QAAQ;IAUhB,OAAO,CAAC,QAAQ;IAQhB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,aAAa;cAMF,6BAA6B,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO;CAU5H"}
|
|
@@ -4,6 +4,9 @@ export declare class UIHoverCard extends ElementBase {
|
|
|
4
4
|
private _openTimer;
|
|
5
5
|
private _closeTimer;
|
|
6
6
|
private _positionRaf;
|
|
7
|
+
private _positioner;
|
|
8
|
+
private _positionerPlacement;
|
|
9
|
+
private _positionerOffset;
|
|
7
10
|
private _isOpen;
|
|
8
11
|
private _globalListenersBound;
|
|
9
12
|
constructor();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-hover-card.d.ts","sourceRoot":"","sources":["../../src/components/ui-hover-card.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAuR7C,qBAAa,WAAY,SAAQ,WAAW;IAC1C,MAAM,KAAK,kBAAkB,aAc5B;IAED,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,qBAAqB,CAAS;;IAc7B,iBAAiB,IAAI,IAAI;IAWzB,oBAAoB,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"ui-hover-card.d.ts","sourceRoot":"","sources":["../../src/components/ui-hover-card.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CA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;IAQ9B,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,cAAc;cAgEH,MAAM,IAAI,IAAI;cA0Bd,6BAA6B,CAC9C,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,SAAS,EAAE,MAAM,GAAG,IAAI,GACvB,OAAO;CAGX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-positioner.d.ts","sourceRoot":"","sources":["../../src/components/ui-positioner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAiD7C,qBAAa,YAAa,SAAQ,WAAW;IAC3C,MAAM,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"ui-positioner.d.ts","sourceRoot":"","sources":["../../src/components/ui-positioner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAiD7C,qBAAa,YAAa,SAAQ,WAAW;IAC3C,MAAM,KAAK,kBAAkB,aAmB5B;IAED,OAAO,CAAC,WAAW,CAAiC;IACpD,OAAO,CAAC,SAAS,CAAiC;IAElD,iBAAiB,IAAI,IAAI;IAOzB,oBAAoB,IAAI,IAAI;IAOnB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAKvG,IAAI,IAAI,IAAI;IAIZ,KAAK,IAAI,IAAI;IAIb,cAAc,IAAI,IAAI;IAItB,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,eAAe;IAsCvB,SAAS,CAAC,MAAM,IAAI,IAAI;cAIL,6BAA6B,IAAI,OAAO;CAG5D"}
|
package/dist/context-menu.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const A=require("./ElementBase-1b301e7f.js"),S=require("./portal-c69756c0.js"),P=require("./dismissable-layer-193e3bed.js"),w=require("./positioner-33529bb8.js"),O=require("./menu-item-styles-83ad1e22.js");require("./listbox-ef2f708e.js");require("./collection-a2969ad2.js");require("./collection.cjs.js");const c='.menuitem, [role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [data-menu-item]',b=[":scope > .menuitem",':scope > [role="menuitem"]',':scope > [role="menuitemcheckbox"]',':scope > [role="menuitemradio"]',":scope > [data-menu-item]"].join(", "),L=":scope > .submenu",l=8,R=6,C=420,I=110,k=["--ui-color-primary","--ui-color-primary-hover","--ui-color-foreground-on-primary","--ui-color-background","--ui-color-surface","--ui-color-surface-alt","--ui-color-text","--ui-color-muted","--ui-color-border","--ui-color-focus-ring","--ui-color-success","--ui-color-danger","--ui-color-warning","--ui-primary","--ui-primary-hover","--ui-foreground","--ui-background","--ui-surface","--ui-surface-alt","--ui-text","--ui-muted","--ui-border","--ui-focus-ring","--ui-radius","--color-background","--color-surface","--color-panel","--color-panel-solid","--color-panel-translucent","--color-overlay","--accent-contrast","--accent-surface","--accent-indicator","--accent-track"],T=[{prefix:"--accent-",from:1,to:12},{prefix:"--accent-a",from:1,to:12},{prefix:"--gray-",from:1,to:12},{prefix:"--gray-a",from:1,to:12},{prefix:"--black-a",from:1,to:12},{prefix:"--white-a",from:1,to:12},{prefix:"--shadow-",from:1,to:6},{prefix:"--radius-",from:1,to:6}],z=["--base-context-menu-bg","--base-context-menu-radius","--base-context-menu-shadow","--base-context-menu-min-width","--base-context-menu-padding","--base-context-menu-item-radius","--base-context-menu-item-gap","--base-context-menu-item-height","--base-context-menu-item-padding-y","--base-context-menu-item-padding-x","--base-context-menu-item-font-size","--base-context-menu-item-line-height","--base-context-menu-submenu-radius","--base-context-menu-submenu-padding"],g=`
|
|
2
2
|
:host {
|
|
3
3
|
position: fixed;
|
|
4
4
|
inset: 0;
|
|
@@ -280,14 +280,14 @@
|
|
|
280
280
|
--ui-context-menu-status-border: color-mix(in srgb, #16a34a 46%, var(--ui-context-menu-border-color));
|
|
281
281
|
--ui-context-menu-status-text: #15803d;
|
|
282
282
|
}
|
|
283
|
-
`,
|
|
283
|
+
`,v=`
|
|
284
284
|
ui-context-menu [slot="menu"],
|
|
285
285
|
ui-context-menu [slot="content"] {
|
|
286
286
|
display: flex;
|
|
287
287
|
flex-direction: column;
|
|
288
288
|
gap: 0;
|
|
289
289
|
}
|
|
290
|
-
${
|
|
290
|
+
${O.createSharedMenuItemCss({scopes:['ui-context-menu [slot="menu"]','ui-context-menu [slot="content"]'],prefix:"--ui-context-menu",itemSelectors:[".menuitem",'[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]',"[data-menu-item]"],activeStateSelectors:['.menuitem[data-submenu-open="true"]','[role="menuitem"][data-submenu-open="true"]']})}
|
|
291
291
|
|
|
292
292
|
ui-context-menu [slot="menu"] .submenu,
|
|
293
293
|
ui-context-menu [slot="content"] .submenu {
|
|
@@ -336,22 +336,22 @@
|
|
|
336
336
|
top: auto;
|
|
337
337
|
bottom: -6px;
|
|
338
338
|
}
|
|
339
|
-
`;function B(){if(typeof document>"u")return;const
|
|
340
|
-
${
|
|
341
|
-
${M(E)}`;function y(s,t,e){return Math.min(e,Math.max(t,s))}function q(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function $(s,t){return typeof s=="number"?{x:s,y:typeof t=="number"?t:0}:s}function V(s){return s==="top"||s==="left"||s==="right"?s:"bottom"}function _(s){if(!s)return"";const t=s.trim().toLowerCase();return t==="1"?"sm":t==="2"?"md":t==="3"?"lg":t==="sm"||t==="md"||t==="lg"?t:t==="compact"?"sm":t==="comfortable"?"lg":""}function g(s){if(!s)return"";const t=s.trim().toLowerCase();return t?t==="none"?"0px":t==="sm"?"8px":t==="md"?"12px":t==="lg"?"16px":t==="full"?"999px":t==="square"?"6px":t==="soft"?"16px":/^\d+(\.\d+)?$/.test(t)?`${t}px`:s:""}function N(s){if(!s.isConnected||s.hidden)return!1;const t=window.getComputedStyle(s);return!(t.display==="none"||t.visibility==="hidden")}function G(s){if(!s.isConnected)return!1;const t=window.getComputedStyle(s);if(t.display==="none"||t.visibility==="hidden")return!1;const e=s.getBoundingClientRect();if(e.width>0||e.height>0)return!0;const i=Number.parseFloat(t.width||"0"),n=Number.parseFloat(t.height||"0");return i>0||n>0}function x(s){const t=s.getAttribute("aria-disabled");return s.hasAttribute("disabled")||t==="true"||s.disabled===!0}function U(s){for(const t of s)if(t instanceof HTMLElement&&t.matches(p))return t;return null}function W(s){return{top:s.y,left:s.x,right:s.x,bottom:s.y,width:0,height:0}}function Y(s,t,e,i,n){const o=window.innerWidth||document.documentElement.clientWidth||0,r=window.innerHeight||document.documentElement.clientHeight||0,a=Math.max(u,o-t-u),c=Math.max(u,r-e-u);let l=i,h=i==="left"?s.left-t-n:i==="right"?s.right+n:s.left,m=i==="top"?s.top-e-n:i==="bottom"?s.bottom+n:s.top;return i==="top"||i==="bottom"?l==="bottom"&&m+e>r-u&&s.top-e-n>=u?(l="top",m=s.top-e-n):l==="top"&&m<u&&s.bottom+n+e<=r-u&&(l="bottom",m=s.bottom+n):(i==="left"||i==="right")&&(l==="right"&&h+t>o-u&&s.left-t-n>=u?(l="left",h=s.left-t-n):l==="left"&&h<u&&s.right+n+t<=o-u&&(l="right",h=s.right+n)),h=y(h,u,a),m=y(m,u,c),{x:Math.round(h),y:Math.round(m),placement:l,maxWidth:Math.max(160,o-u*2),maxHeight:Math.max(120,r-u*2)}}class A extends S.ElementBase{constructor(){super(),this._isOpen=!1,this._anchorEl=null,this._point={x:0,y:0},this._restoreFocusEl=null,this._portalEl=null,this._portalSurfaceEl=null,this._portalContentHostEl=null,this._dismissableLayer=null,this._contentAnchor=null,this._contentSourceEl=null,this._contentOriginalParent=null,this._positionRaf=null,this._submenuRaf=null,this._anchorTrackRaf=null,this._typeaheadBuffer="",this._typeaheadTimer=null,this._submenuIntentTimer=null,this._submenuIntentItem=null,this._hoveredItem=null,this._lastAnchorRect=null,this._resizeListenerBound=!1,this._scrollListenerBound=!1,this._nextOpenSource="attribute",this._onRootClick=this._onRootClick.bind(this),this._onRootKeyDown=this._onRootKeyDown.bind(this),this._onRootPointerOver=this._onRootPointerOver.bind(this),this._onRootPointerLeave=this._onRootPointerLeave.bind(this),this._onRootFocusIn=this._onRootFocusIn.bind(this),this._onContextMenu=this._onContextMenu.bind(this),this._onViewportChange=this._onViewportChange.bind(this),this._trackAnchorLayout=this._trackAnchorLayout.bind(this)}static get observedAttributes(){return["open","headless","variant","size","radius","density","shape","elevation","tone","close-on-select","close-on-escape","typeahead","state","state-text","disabled","placement"]}connectedCallback(){super.connectedCallback(),B(),this.addEventListener("contextmenu",this._onContextMenu),this._syncVisualState(),this._syncOpenState()}disconnectedCallback(){this.removeEventListener("contextmenu",this._onContextMenu),this._unbindGlobalListeners(),this._cancelScheduledWork(),this._teardownPortal(),super.disconnectedCallback()}attributeChangedCallback(t,e,i){if(e!==i){if(t==="open"){this._syncOpenState();return}if(t==="headless"){this.headless&&this._isOpen&&this.close(),this._syncSurfaceState(),this._syncPortalVisualState();return}if(t==="disabled"){this.isDisabled&&this._isOpen&&this._setOpen(!1,"attribute"),this._syncSurfaceState(),this._syncPortalVisualState();return}if(t==="state"||t==="state-text"){this._syncPortalVisualState(),this.isConnected&&this.requestRender();return}(t==="variant"||t==="size"||t==="radius"||t==="density"||t==="shape"||t==="elevation"||t==="tone")&&this._syncVisualState(),this._isOpen&&(t==="placement"||t==="variant"||t==="size"||t==="radius"||t==="density"||t==="shape"||t==="elevation"||t==="tone")&&(this._syncPortalVisualState(),this._schedulePosition(),this._scheduleSubmenuLayout())}}get open(){return this.hasAttribute("open")}set open(t){this._setOpen(t,"api")}get headless(){return this.hasAttribute("headless")}set headless(t){t?this.setAttribute("headless",""):this.removeAttribute("headless")}get closeOnSelect(){const t=this.getAttribute("close-on-select");return t==null?!0:t!=="false"&&t!=="0"}set closeOnSelect(t){this.setAttribute("close-on-select",t?"true":"false")}get closeOnEscape(){const t=this.getAttribute("close-on-escape");return t==null?!0:t!=="false"&&t!=="0"}set closeOnEscape(t){this.setAttribute("close-on-escape",t?"true":"false")}get typeahead(){const t=this.getAttribute("typeahead");return t==null?!0:t!=="false"&&t!=="0"}set typeahead(t){this.setAttribute("typeahead",t?"true":"false")}get state(){const t=(this.getAttribute("state")||"idle").toLowerCase();return t==="loading"||t==="error"||t==="success"?t:"idle"}set state(t){t==="idle"?this.removeAttribute("state"):this.setAttribute("state",t)}get isDisabled(){const t=this.getAttribute("disabled");return t==null?!1:t!=="false"&&t!=="0"}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}openAt(t,e){if(!(this.headless||this.isDisabled)){if(this._anchorEl=null,this._point=$(t,e),this._isOpen){this._syncGlobalListeners(!0),this._syncDismissableLayer(),this._schedulePosition(),this._scheduleSubmenuLayout();return}this._setOpen(!0,"api")}}openForAnchor(t){if(this.headless||this.isDisabled)return;this._anchorEl=t;const e=t.getBoundingClientRect();if(this._point={x:e.left,y:e.bottom},this._isOpen){this._syncGlobalListeners(!0),this._syncDismissableLayer(),this._schedulePosition(),this._scheduleSubmenuLayout();return}this._setOpen(!0,"anchor")}openForAnchorId(t){const e=typeof document<"u"?document.getElementById(t):null;e&&this.openForAnchor(e)}showForAnchorId(t){this.openForAnchorId(t)}openFor(t){if(typeof t=="string"){this.openForAnchorId(t);return}this.openForAnchor(t)}close(){this._setOpen(!1,"api")}getPortalContentHost(){return this._portalContentHostEl}refreshLayout(){this._isOpen&&(this._normalizeMenuSemantics(),this._schedulePosition(),this._scheduleSubmenuLayout())}_surface(){return this._portalSurfaceEl||this.root.querySelector(".surface")}_listbox(){return this._portalContentHostEl||this.root.querySelector("ui-listbox.content-host")}_menuHost(){return this._contentSourceEl||this._portalContentHostEl||this.querySelector('[slot="menu"]')||this.querySelector('[slot="content"]')}_stateText(){const t=this.getAttribute("state-text");return t||(this.state==="loading"?"Loading actions":this.state==="error"?"Action unavailable":this.state==="success"?"Action ready":"")}_emitOpenState(t,e,i){const n={open:t,previousOpen:e,source:i};this.dispatchEvent(new CustomEvent(t?"open":"close",{detail:n,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(t?"ui-open":"ui-close",{detail:n,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{...n},bubbles:!0,composed:!0}))}_setOpen(t,e){t!==this.open&&(t&&(this.headless||this.isDisabled)||(this._nextOpenSource=e,t?this.setAttribute("open",""):this.removeAttribute("open")))}_syncOpenState(){var i;const t=this.hasAttribute("open"),e=this._nextOpenSource;if(this._nextOpenSource="attribute",t===this._isOpen){this._syncGlobalListeners(t),t?((!this._portalEl||!this._portalEl.isConnected)&&this._mountPortal(),this._syncPortalVisualState(),this._syncSurfaceState(),this._syncDismissableLayer(),this._schedulePosition(),this._scheduleSubmenuLayout()):this._syncSurfaceState();return}if(this._isOpen=t,this._syncGlobalListeners(t),t){this._restoreFocusEl=document.activeElement instanceof HTMLElement?document.activeElement:null,this._mountPortal(),this._normalizeMenuSemantics(),this._syncSurfaceState(),this._emitOpenState(!0,!1,e),this._schedulePosition(),this._scheduleSubmenuLayout(),requestAnimationFrame(()=>{this._focusFirstItem()});return}if(this._clearSubmenuState(),this._cancelScheduledWork(),this._teardownPortal(),this._syncSurfaceState(),this._anchorEl=null,this._emitOpenState(!1,!0,e),(i=this._restoreFocusEl)!=null&&i.isConnected)try{this._restoreFocusEl.focus()}catch{}this._restoreFocusEl=null}_syncSurfaceState(){const t=this._surface();if(!t)return;const e=this._isOpen&&!this.headless,i=e&&!this.isDisabled&&this.state!=="loading";t.setAttribute("aria-hidden",this._isOpen?"false":"true"),t.setAttribute("aria-busy",this.state==="loading"?"true":"false"),this._isOpen?t.removeAttribute("hidden"):t.setAttribute("hidden",""),t.style.display=this.headless?"none":"block",t.style.visibility=e?"visible":"hidden",t.style.opacity=e?"1":"0",t.style.transform=e?"translateY(0) scale(1)":"translateY(4px) scale(0.985)",t.style.pointerEvents=i?"auto":"none"}_syncVisualState(){const t=_(this.getAttribute("size")||this.getAttribute("density"));t&&t!=="md"?this.setAttribute("data-ui-context-menu-size",t):this.removeAttribute("data-ui-context-menu-size"),t==="sm"?(this.style.setProperty("--ui-context-menu-padding","4px"),this.style.setProperty("--ui-context-menu-item-gap","8px"),this.style.setProperty("--ui-context-menu-item-min-height","32px"),this.style.setProperty("--ui-context-menu-item-pad-y","6px"),this.style.setProperty("--ui-context-menu-item-pad-x","8px"),this.style.setProperty("--ui-context-menu-item-font-size","13px"),this.style.setProperty("--ui-context-menu-item-line-height","18px"),this.style.setProperty("--ui-context-menu-separator-margin","4px 8px")):t==="lg"?(this.style.setProperty("--ui-context-menu-padding","8px"),this.style.setProperty("--ui-context-menu-item-gap","12px"),this.style.setProperty("--ui-context-menu-item-min-height","40px"),this.style.setProperty("--ui-context-menu-item-pad-y","9px"),this.style.setProperty("--ui-context-menu-item-pad-x","12px"),this.style.setProperty("--ui-context-menu-item-font-size","15px"),this.style.setProperty("--ui-context-menu-item-line-height","22px"),this.style.setProperty("--ui-context-menu-separator-margin","8px 12px")):(this.style.removeProperty("--ui-context-menu-padding"),this.style.removeProperty("--ui-context-menu-item-gap"),this.style.removeProperty("--ui-context-menu-item-min-height"),this.style.removeProperty("--ui-context-menu-item-pad-y"),this.style.removeProperty("--ui-context-menu-item-pad-x"),this.style.removeProperty("--ui-context-menu-item-font-size"),this.style.removeProperty("--ui-context-menu-item-line-height"),this.style.removeProperty("--ui-context-menu-separator-margin"));const e=g(this.getAttribute("radius")||this.getAttribute("shape"));e?(this.style.setProperty("--ui-context-menu-radius",e),this.style.setProperty("--ui-context-menu-item-radius",e),this.style.setProperty("--ui-context-menu-submenu-radius",e)):(this.style.removeProperty("--ui-context-menu-radius"),this.style.removeProperty("--ui-context-menu-item-radius"),this.style.removeProperty("--ui-context-menu-submenu-radius"))}_syncGlobalListeners(t){const e=t,i=t&&!!this._anchorEl;e&&!this._resizeListenerBound?(window.addEventListener("resize",this._onViewportChange),this._resizeListenerBound=!0):!e&&this._resizeListenerBound&&(window.removeEventListener("resize",this._onViewportChange),this._resizeListenerBound=!1),i&&!this._scrollListenerBound?(window.addEventListener("scroll",this._onViewportChange,{passive:!0,capture:!0}),this._scrollListenerBound=!0):!i&&this._scrollListenerBound&&(window.removeEventListener("scroll",this._onViewportChange,!0),this._scrollListenerBound=!1),t&&this._anchorEl?this._startAnchorTracking():this._stopAnchorTracking()}_unbindGlobalListeners(){this._syncGlobalListeners(!1)}_bindPortalInteractionListeners(){this._portalEl&&(this._portalEl.addEventListener("click",this._onRootClick),this._portalEl.addEventListener("keydown",this._onRootKeyDown),this._portalEl.addEventListener("pointerover",this._onRootPointerOver),this._portalEl.addEventListener("pointerleave",this._onRootPointerLeave),this._portalEl.addEventListener("focusin",this._onRootFocusIn))}_unbindPortalInteractionListeners(){this._portalEl&&(this._portalEl.removeEventListener("click",this._onRootClick),this._portalEl.removeEventListener("keydown",this._onRootKeyDown),this._portalEl.removeEventListener("pointerover",this._onRootPointerOver),this._portalEl.removeEventListener("pointerleave",this._onRootPointerLeave),this._portalEl.removeEventListener("focusin",this._onRootFocusIn))}_setPortalFlag(t,e){this._portalEl&&(e?this._portalEl.setAttribute(`data-${t}`,"true"):this._portalEl.removeAttribute(`data-${t}`))}_syncPortalThemeVariables(){if(!this._portalEl)return;const t=getComputedStyle(this),e=i=>{const n=t.getPropertyValue(i).trim();n?this._portalEl.style.setProperty(i,n):this._portalEl.style.removeProperty(i)};R.forEach(e),z.forEach(e),T.forEach(({prefix:i,from:n,to:o})=>{for(let r=n;r<=o;r+=1)e(`${i}${r}`)})}_syncPortalVisualState(){if(!this._portalEl)return;const t=_(this.getAttribute("size")||this.getAttribute("density")),e=g(this.getAttribute("radius")||this.getAttribute("shape"));this._syncPortalThemeVariables(),this._setPortalFlag("open",this._isOpen),this._setPortalFlag("headless",this.headless),this._setPortalFlag("disabled",this.isDisabled);const i=this.getAttribute("variant"),n=_(this.getAttribute("size")||this.getAttribute("density")),o=this.getAttribute("density"),r=this.getAttribute("radius"),a=this.getAttribute("shape"),c=this.getAttribute("elevation"),l=this.getAttribute("tone"),h=this.getAttribute("placement");i?this._portalEl.setAttribute("data-variant",i):this._portalEl.removeAttribute("data-variant"),n&&n!=="md"?this._portalEl.setAttribute("data-size",n):this._portalEl.removeAttribute("data-size"),o?this._portalEl.setAttribute("data-density",o):this._portalEl.removeAttribute("data-density"),r?this._portalEl.setAttribute("data-radius",r):this._portalEl.removeAttribute("data-radius"),a?this._portalEl.setAttribute("data-shape",a):this._portalEl.removeAttribute("data-shape"),c?this._portalEl.setAttribute("data-elevation",c):this._portalEl.removeAttribute("data-elevation"),l?this._portalEl.setAttribute("data-tone",l):this._portalEl.removeAttribute("data-tone"),h?this._portalEl.setAttribute("data-placement-request",h):this._portalEl.removeAttribute("data-placement-request"),t==="sm"?(this._portalEl.style.setProperty("--ui-context-menu-padding","4px"),this._portalEl.style.setProperty("--ui-context-menu-item-gap","8px"),this._portalEl.style.setProperty("--ui-context-menu-item-min-height","32px"),this._portalEl.style.setProperty("--ui-context-menu-item-pad-y","6px"),this._portalEl.style.setProperty("--ui-context-menu-item-pad-x","8px"),this._portalEl.style.setProperty("--ui-context-menu-item-font-size","13px"),this._portalEl.style.setProperty("--ui-context-menu-item-line-height","18px"),this._portalEl.style.setProperty("--ui-context-menu-separator-margin","4px 8px")):t==="lg"?(this._portalEl.style.setProperty("--ui-context-menu-padding","8px"),this._portalEl.style.setProperty("--ui-context-menu-item-gap","12px"),this._portalEl.style.setProperty("--ui-context-menu-item-min-height","40px"),this._portalEl.style.setProperty("--ui-context-menu-item-pad-y","9px"),this._portalEl.style.setProperty("--ui-context-menu-item-pad-x","12px"),this._portalEl.style.setProperty("--ui-context-menu-item-font-size","15px"),this._portalEl.style.setProperty("--ui-context-menu-item-line-height","22px"),this._portalEl.style.setProperty("--ui-context-menu-separator-margin","8px 12px")):(this._portalEl.style.removeProperty("--ui-context-menu-padding"),this._portalEl.style.removeProperty("--ui-context-menu-item-gap"),this._portalEl.style.removeProperty("--ui-context-menu-item-min-height"),this._portalEl.style.removeProperty("--ui-context-menu-item-pad-y"),this._portalEl.style.removeProperty("--ui-context-menu-item-pad-x"),this._portalEl.style.removeProperty("--ui-context-menu-item-font-size"),this._portalEl.style.removeProperty("--ui-context-menu-item-line-height"),this._portalEl.style.removeProperty("--ui-context-menu-separator-margin")),e?(this._portalEl.style.setProperty("--ui-context-menu-radius",e),this._portalEl.style.setProperty("--ui-context-menu-item-radius",e),this._portalEl.style.setProperty("--ui-context-menu-submenu-radius",e)):(this._portalEl.style.removeProperty("--ui-context-menu-radius"),this._portalEl.style.removeProperty("--ui-context-menu-item-radius"),this._portalEl.style.removeProperty("--ui-context-menu-submenu-radius")),this.state!=="idle"?this._portalEl.setAttribute("data-state",this.state):this._portalEl.removeAttribute("data-state");const m=this._portalEl.querySelector(".state-row");m&&(m.textContent=this._stateText())}_moveContentIntoPortal(){if(this._contentSourceEl)return;const t=this.querySelector('[slot="menu"]')||this.querySelector('[slot="content"]'),e=this._portalContentHostEl;!t||!e||(this._contentOriginalParent=t.parentNode,this._contentAnchor=document.createComment("ui-context-menu-anchor"),this._contentOriginalParent&&this._contentOriginalParent.insertBefore(this._contentAnchor,t),this._contentSourceEl=t,e.appendChild(t))}_restoreContentFromPortal(){const t=this._contentSourceEl;if(!t)return;const e=this._contentAnchor,i=this._contentOriginalParent;e!=null&&e.parentNode?(e.parentNode.insertBefore(t,e),e.parentNode.removeChild(e)):i&&i.appendChild(t),this._contentSourceEl=null,this._contentAnchor=null,this._contentOriginalParent=null}_mountPortal(){var i,n;if((i=this._portalEl)!=null&&i.isConnected)return;const t=w.createPortalContainer();if(!t)return;const e=document.createElement("div");e.className="ui-context-menu-portal",e.style.position="absolute",e.style.pointerEvents="auto",e.innerHTML=`
|
|
342
|
-
<style>${
|
|
339
|
+
`;function B(){if(typeof document>"u")return;const o="ui-context-menu-light-dom-style";if(document.getElementById(o))return;const t=document.createElement("style");t.id=o,t.textContent=v,document.head.appendChild(t)}function F(o,t){return o.replace(/(^|})\s*([^@}{][^{}]*)\{/g,(e,i,n)=>{const s=n.split(",").map(r=>r.trim()).filter(Boolean).map(r=>r.startsWith(t)?r:`${t} ${r}`).join(", ");return`${i}
|
|
340
|
+
${s} {`})}function H(o){const t=o.replace(/:host\(\[([a-z-]+)(?:="([^"]+)")?\]\)/g,(e,i,n)=>n!=null?`.ui-context-menu-portal[data-${i}="${n}"]`:`.ui-context-menu-portal[data-${i}="true"]`).replace(/:host/g,".ui-context-menu-portal");return F(t,".ui-context-menu-portal")}function D(o){return o.replace(/(^|,)\s*ui-context-menu\b/gm,(t,e)=>`${e} .ui-context-menu-portal`)}const q=`${H(g)}
|
|
341
|
+
${D(v)}`;function M(o){return o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function $(o,t){return typeof o=="number"?{x:o,y:typeof t=="number"?t:0}:o}function V(o){return o==="top"||o==="left"||o==="right"?o:"bottom"}function N(o){return`${o}-start`}function _(o){if(!o)return"";const t=o.trim().toLowerCase();return t==="1"?"sm":t==="2"?"md":t==="3"?"lg":t==="sm"||t==="md"||t==="lg"?t:t==="compact"?"sm":t==="comfortable"?"lg":""}function y(o){if(!o)return"";const t=o.trim().toLowerCase();return t?t==="none"?"0px":t==="sm"?"8px":t==="md"?"12px":t==="lg"?"16px":t==="full"?"999px":t==="square"?"6px":t==="soft"?"16px":/^\d+(\.\d+)?$/.test(t)?`${t}px`:o:""}function W(o){if(!o.isConnected||o.hidden)return!1;const t=window.getComputedStyle(o);return!(t.display==="none"||t.visibility==="hidden")}function U(o){if(!o.isConnected)return!1;const t=window.getComputedStyle(o);if(t.display==="none"||t.visibility==="hidden")return!1;const e=o.getBoundingClientRect();if(e.width>0||e.height>0)return!0;const i=Number.parseFloat(t.width||"0"),n=Number.parseFloat(t.height||"0");return i>0||n>0}function x(o){const t=o.getAttribute("aria-disabled");return o.hasAttribute("disabled")||t==="true"||o.disabled===!0}function G(o){for(const t of o)if(t instanceof HTMLElement&&t.matches(c))return t;return null}class E extends A.ElementBase{constructor(){super(),this._isOpen=!1,this._anchorEl=null,this._point={x:0,y:0},this._restoreFocusEl=null,this._portalEl=null,this._portalSurfaceEl=null,this._portalContentHostEl=null,this._dismissableLayer=null,this._positioner=null,this._positionerPlacement=null,this._positionerOffset=0,this._positionerAnchorEl=null,this._contentAnchor=null,this._contentSourceEl=null,this._contentOriginalParent=null,this._positionRaf=null,this._submenuRaf=null,this._anchorTrackRaf=null,this._typeaheadBuffer="",this._typeaheadTimer=null,this._submenuIntentTimer=null,this._submenuIntentItem=null,this._hoveredItem=null,this._lastAnchorRect=null,this._resizeListenerBound=!1,this._scrollListenerBound=!1,this._nextOpenSource="attribute",this._onRootClick=this._onRootClick.bind(this),this._onRootKeyDown=this._onRootKeyDown.bind(this),this._onRootPointerOver=this._onRootPointerOver.bind(this),this._onRootPointerLeave=this._onRootPointerLeave.bind(this),this._onRootFocusIn=this._onRootFocusIn.bind(this),this._onContextMenu=this._onContextMenu.bind(this),this._onViewportChange=this._onViewportChange.bind(this),this._trackAnchorLayout=this._trackAnchorLayout.bind(this)}static get observedAttributes(){return["open","headless","variant","size","radius","density","shape","elevation","tone","close-on-select","close-on-escape","typeahead","state","state-text","disabled","placement"]}connectedCallback(){super.connectedCallback(),B(),this.addEventListener("contextmenu",this._onContextMenu),this._syncVisualState(),this._syncOpenState()}disconnectedCallback(){this.removeEventListener("contextmenu",this._onContextMenu),this._unbindGlobalListeners(),this._cancelScheduledWork(),this._teardownPortal(),super.disconnectedCallback()}attributeChangedCallback(t,e,i){if(e!==i){if(t==="open"){this._syncOpenState();return}if(t==="headless"){this.headless&&this._isOpen&&this.close(),this._syncSurfaceState(),this._syncPortalVisualState();return}if(t==="disabled"){this.isDisabled&&this._isOpen&&this._setOpen(!1,"attribute"),this._syncSurfaceState(),this._syncPortalVisualState();return}if(t==="state"||t==="state-text"){this._syncPortalVisualState(),this.isConnected&&this.requestRender();return}(t==="variant"||t==="size"||t==="radius"||t==="density"||t==="shape"||t==="elevation"||t==="tone")&&this._syncVisualState(),this._isOpen&&(t==="placement"||t==="variant"||t==="size"||t==="radius"||t==="density"||t==="shape"||t==="elevation"||t==="tone")&&(this._syncPortalVisualState(),this._schedulePosition(),this._scheduleSubmenuLayout())}}get open(){return this.hasAttribute("open")}set open(t){this._setOpen(t,"api")}get headless(){return this.hasAttribute("headless")}set headless(t){t?this.setAttribute("headless",""):this.removeAttribute("headless")}get closeOnSelect(){const t=this.getAttribute("close-on-select");return t==null?!0:t!=="false"&&t!=="0"}set closeOnSelect(t){this.setAttribute("close-on-select",t?"true":"false")}get closeOnEscape(){const t=this.getAttribute("close-on-escape");return t==null?!0:t!=="false"&&t!=="0"}set closeOnEscape(t){this.setAttribute("close-on-escape",t?"true":"false")}get typeahead(){const t=this.getAttribute("typeahead");return t==null?!0:t!=="false"&&t!=="0"}set typeahead(t){this.setAttribute("typeahead",t?"true":"false")}get state(){const t=(this.getAttribute("state")||"idle").toLowerCase();return t==="loading"||t==="error"||t==="success"?t:"idle"}set state(t){t==="idle"?this.removeAttribute("state"):this.setAttribute("state",t)}get isDisabled(){const t=this.getAttribute("disabled");return t==null?!1:t!=="false"&&t!=="0"}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}openAt(t,e){if(!(this.headless||this.isDisabled)){if(this._anchorEl=null,this._point=$(t,e),this._isOpen){this._syncGlobalListeners(!0),this._syncDismissableLayer(),this._schedulePosition(),this._scheduleSubmenuLayout();return}this._setOpen(!0,"api")}}openForAnchor(t){if(this.headless||this.isDisabled)return;this._anchorEl=t;const e=t.getBoundingClientRect();if(this._point={x:e.left,y:e.bottom},this._isOpen){this._syncGlobalListeners(!0),this._syncDismissableLayer(),this._schedulePosition(),this._scheduleSubmenuLayout();return}this._setOpen(!0,"anchor")}openForAnchorId(t){const e=typeof document<"u"?document.getElementById(t):null;e&&this.openForAnchor(e)}showForAnchorId(t){this.openForAnchorId(t)}openFor(t){if(typeof t=="string"){this.openForAnchorId(t);return}this.openForAnchor(t)}close(){this._setOpen(!1,"api")}getPortalContentHost(){return this._portalContentHostEl}refreshLayout(){this._isOpen&&(this._normalizeMenuSemantics(),this._schedulePosition(),this._scheduleSubmenuLayout())}_surface(){return this._portalSurfaceEl||this.root.querySelector(".surface")}_listbox(){return this._portalContentHostEl||this.root.querySelector("ui-listbox.content-host")}_menuHost(){return this._contentSourceEl||this._portalContentHostEl||this.querySelector('[slot="menu"]')||this.querySelector('[slot="content"]')}_stateText(){const t=this.getAttribute("state-text");return t||(this.state==="loading"?"Loading actions":this.state==="error"?"Action unavailable":this.state==="success"?"Action ready":"")}_emitOpenState(t,e,i){const n={open:t,previousOpen:e,source:i};this.dispatchEvent(new CustomEvent(t?"open":"close",{detail:n,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(t?"ui-open":"ui-close",{detail:n,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{...n},bubbles:!0,composed:!0}))}_setOpen(t,e){t!==this.open&&(t&&(this.headless||this.isDisabled)||(this._nextOpenSource=e,t?this.setAttribute("open",""):this.removeAttribute("open")))}_syncOpenState(){var i;const t=this.hasAttribute("open"),e=this._nextOpenSource;if(this._nextOpenSource="attribute",t===this._isOpen){this._syncGlobalListeners(t),t?((!this._portalEl||!this._portalEl.isConnected)&&this._mountPortal(),this._syncPortalVisualState(),this._syncSurfaceState(),this._syncDismissableLayer(),this._schedulePosition(),this._scheduleSubmenuLayout()):this._syncSurfaceState();return}if(this._isOpen=t,this._syncGlobalListeners(t),t){this._restoreFocusEl=document.activeElement instanceof HTMLElement?document.activeElement:null,this._mountPortal(),this._normalizeMenuSemantics(),this._syncSurfaceState(),this._emitOpenState(!0,!1,e),this._schedulePosition(),this._scheduleSubmenuLayout(),requestAnimationFrame(()=>{this._focusFirstItem()});return}if(this._clearSubmenuState(),this._cancelScheduledWork(),this._teardownPortal(),this._syncSurfaceState(),this._anchorEl=null,this._emitOpenState(!1,!0,e),(i=this._restoreFocusEl)!=null&&i.isConnected)try{this._restoreFocusEl.focus()}catch{}this._restoreFocusEl=null}_syncSurfaceState(){const t=this._surface();if(!t)return;const e=this._isOpen&&!this.headless,i=e&&!this.isDisabled&&this.state!=="loading";t.setAttribute("aria-hidden",this._isOpen?"false":"true"),t.setAttribute("aria-busy",this.state==="loading"?"true":"false"),this._isOpen?t.removeAttribute("hidden"):t.setAttribute("hidden",""),t.style.display=this.headless?"none":"block",t.style.visibility=e?"visible":"hidden",t.style.opacity=e?"1":"0",t.style.transform=e?"translateY(0) scale(1)":"translateY(4px) scale(0.985)",t.style.pointerEvents=i?"auto":"none"}_syncVisualState(){const t=_(this.getAttribute("size")||this.getAttribute("density"));t&&t!=="md"?this.setAttribute("data-ui-context-menu-size",t):this.removeAttribute("data-ui-context-menu-size"),t==="sm"?(this.style.setProperty("--ui-context-menu-padding","4px"),this.style.setProperty("--ui-context-menu-item-gap","8px"),this.style.setProperty("--ui-context-menu-item-min-height","32px"),this.style.setProperty("--ui-context-menu-item-pad-y","6px"),this.style.setProperty("--ui-context-menu-item-pad-x","8px"),this.style.setProperty("--ui-context-menu-item-font-size","13px"),this.style.setProperty("--ui-context-menu-item-line-height","18px"),this.style.setProperty("--ui-context-menu-separator-margin","4px 8px")):t==="lg"?(this.style.setProperty("--ui-context-menu-padding","8px"),this.style.setProperty("--ui-context-menu-item-gap","12px"),this.style.setProperty("--ui-context-menu-item-min-height","40px"),this.style.setProperty("--ui-context-menu-item-pad-y","9px"),this.style.setProperty("--ui-context-menu-item-pad-x","12px"),this.style.setProperty("--ui-context-menu-item-font-size","15px"),this.style.setProperty("--ui-context-menu-item-line-height","22px"),this.style.setProperty("--ui-context-menu-separator-margin","8px 12px")):(this.style.removeProperty("--ui-context-menu-padding"),this.style.removeProperty("--ui-context-menu-item-gap"),this.style.removeProperty("--ui-context-menu-item-min-height"),this.style.removeProperty("--ui-context-menu-item-pad-y"),this.style.removeProperty("--ui-context-menu-item-pad-x"),this.style.removeProperty("--ui-context-menu-item-font-size"),this.style.removeProperty("--ui-context-menu-item-line-height"),this.style.removeProperty("--ui-context-menu-separator-margin"));const e=y(this.getAttribute("radius")||this.getAttribute("shape"));e?(this.style.setProperty("--ui-context-menu-radius",e),this.style.setProperty("--ui-context-menu-item-radius",e),this.style.setProperty("--ui-context-menu-submenu-radius",e)):(this.style.removeProperty("--ui-context-menu-radius"),this.style.removeProperty("--ui-context-menu-item-radius"),this.style.removeProperty("--ui-context-menu-submenu-radius"))}_syncGlobalListeners(t){const e=t,i=t&&!!this._anchorEl;e&&!this._resizeListenerBound?(window.addEventListener("resize",this._onViewportChange),this._resizeListenerBound=!0):!e&&this._resizeListenerBound&&(window.removeEventListener("resize",this._onViewportChange),this._resizeListenerBound=!1),i&&!this._scrollListenerBound?(window.addEventListener("scroll",this._onViewportChange,{passive:!0,capture:!0}),this._scrollListenerBound=!0):!i&&this._scrollListenerBound&&(window.removeEventListener("scroll",this._onViewportChange,!0),this._scrollListenerBound=!1),t&&this._anchorEl?this._startAnchorTracking():this._stopAnchorTracking()}_unbindGlobalListeners(){this._syncGlobalListeners(!1)}_bindPortalInteractionListeners(){this._portalEl&&(this._portalEl.addEventListener("click",this._onRootClick),this._portalEl.addEventListener("keydown",this._onRootKeyDown),this._portalEl.addEventListener("pointerover",this._onRootPointerOver),this._portalEl.addEventListener("pointerleave",this._onRootPointerLeave),this._portalEl.addEventListener("focusin",this._onRootFocusIn))}_unbindPortalInteractionListeners(){this._portalEl&&(this._portalEl.removeEventListener("click",this._onRootClick),this._portalEl.removeEventListener("keydown",this._onRootKeyDown),this._portalEl.removeEventListener("pointerover",this._onRootPointerOver),this._portalEl.removeEventListener("pointerleave",this._onRootPointerLeave),this._portalEl.removeEventListener("focusin",this._onRootFocusIn))}_setPortalFlag(t,e){this._portalEl&&(e?this._portalEl.setAttribute(`data-${t}`,"true"):this._portalEl.removeAttribute(`data-${t}`))}_syncPortalThemeVariables(){if(!this._portalEl)return;const t=getComputedStyle(this),e=i=>{const n=t.getPropertyValue(i).trim();n?this._portalEl.style.setProperty(i,n):this._portalEl.style.removeProperty(i)};k.forEach(e),z.forEach(e),T.forEach(({prefix:i,from:n,to:s})=>{for(let r=n;r<=s;r+=1)e(`${i}${r}`)})}_syncPortalVisualState(){if(!this._portalEl)return;const t=_(this.getAttribute("size")||this.getAttribute("density")),e=y(this.getAttribute("radius")||this.getAttribute("shape"));this._syncPortalThemeVariables(),this._setPortalFlag("open",this._isOpen),this._setPortalFlag("headless",this.headless),this._setPortalFlag("disabled",this.isDisabled);const i=this.getAttribute("variant"),n=_(this.getAttribute("size")||this.getAttribute("density")),s=this.getAttribute("density"),r=this.getAttribute("radius"),u=this.getAttribute("shape"),a=this.getAttribute("elevation"),h=this.getAttribute("tone"),m=this.getAttribute("placement");i?this._portalEl.setAttribute("data-variant",i):this._portalEl.removeAttribute("data-variant"),n&&n!=="md"?this._portalEl.setAttribute("data-size",n):this._portalEl.removeAttribute("data-size"),s?this._portalEl.setAttribute("data-density",s):this._portalEl.removeAttribute("data-density"),r?this._portalEl.setAttribute("data-radius",r):this._portalEl.removeAttribute("data-radius"),u?this._portalEl.setAttribute("data-shape",u):this._portalEl.removeAttribute("data-shape"),a?this._portalEl.setAttribute("data-elevation",a):this._portalEl.removeAttribute("data-elevation"),h?this._portalEl.setAttribute("data-tone",h):this._portalEl.removeAttribute("data-tone"),m?this._portalEl.setAttribute("data-placement-request",m):this._portalEl.removeAttribute("data-placement-request"),t==="sm"?(this._portalEl.style.setProperty("--ui-context-menu-padding","4px"),this._portalEl.style.setProperty("--ui-context-menu-item-gap","8px"),this._portalEl.style.setProperty("--ui-context-menu-item-min-height","32px"),this._portalEl.style.setProperty("--ui-context-menu-item-pad-y","6px"),this._portalEl.style.setProperty("--ui-context-menu-item-pad-x","8px"),this._portalEl.style.setProperty("--ui-context-menu-item-font-size","13px"),this._portalEl.style.setProperty("--ui-context-menu-item-line-height","18px"),this._portalEl.style.setProperty("--ui-context-menu-separator-margin","4px 8px")):t==="lg"?(this._portalEl.style.setProperty("--ui-context-menu-padding","8px"),this._portalEl.style.setProperty("--ui-context-menu-item-gap","12px"),this._portalEl.style.setProperty("--ui-context-menu-item-min-height","40px"),this._portalEl.style.setProperty("--ui-context-menu-item-pad-y","9px"),this._portalEl.style.setProperty("--ui-context-menu-item-pad-x","12px"),this._portalEl.style.setProperty("--ui-context-menu-item-font-size","15px"),this._portalEl.style.setProperty("--ui-context-menu-item-line-height","22px"),this._portalEl.style.setProperty("--ui-context-menu-separator-margin","8px 12px")):(this._portalEl.style.removeProperty("--ui-context-menu-padding"),this._portalEl.style.removeProperty("--ui-context-menu-item-gap"),this._portalEl.style.removeProperty("--ui-context-menu-item-min-height"),this._portalEl.style.removeProperty("--ui-context-menu-item-pad-y"),this._portalEl.style.removeProperty("--ui-context-menu-item-pad-x"),this._portalEl.style.removeProperty("--ui-context-menu-item-font-size"),this._portalEl.style.removeProperty("--ui-context-menu-item-line-height"),this._portalEl.style.removeProperty("--ui-context-menu-separator-margin")),e?(this._portalEl.style.setProperty("--ui-context-menu-radius",e),this._portalEl.style.setProperty("--ui-context-menu-item-radius",e),this._portalEl.style.setProperty("--ui-context-menu-submenu-radius",e)):(this._portalEl.style.removeProperty("--ui-context-menu-radius"),this._portalEl.style.removeProperty("--ui-context-menu-item-radius"),this._portalEl.style.removeProperty("--ui-context-menu-submenu-radius")),this.state!=="idle"?this._portalEl.setAttribute("data-state",this.state):this._portalEl.removeAttribute("data-state");const p=this._portalEl.querySelector(".state-row");p&&(p.textContent=this._stateText())}_moveContentIntoPortal(){if(this._contentSourceEl)return;const t=this.querySelector('[slot="menu"]')||this.querySelector('[slot="content"]'),e=this._portalContentHostEl;!t||!e||(this._contentOriginalParent=t.parentNode,this._contentAnchor=document.createComment("ui-context-menu-anchor"),this._contentOriginalParent&&this._contentOriginalParent.insertBefore(this._contentAnchor,t),this._contentSourceEl=t,e.appendChild(t))}_restoreContentFromPortal(){const t=this._contentSourceEl;if(!t)return;const e=this._contentAnchor,i=this._contentOriginalParent;e!=null&&e.parentNode?(e.parentNode.insertBefore(t,e),e.parentNode.removeChild(e)):i&&i.appendChild(t),this._contentSourceEl=null,this._contentAnchor=null,this._contentOriginalParent=null}_mountPortal(){var i,n;if((i=this._portalEl)!=null&&i.isConnected)return;const t=S.createPortalContainer();if(!t)return;const e=document.createElement("div");e.className="ui-context-menu-portal",e.style.position="absolute",e.style.pointerEvents="auto",e.innerHTML=`
|
|
342
|
+
<style>${q}</style>
|
|
343
343
|
<div class="surface" part="menu" role="menu" aria-hidden="true" aria-busy="false" tabindex="-1">
|
|
344
344
|
<div class="state-row" part="state"></div>
|
|
345
|
-
<ui-listbox class="content-host" slot="menu" role="menu" item-selector="${
|
|
345
|
+
<ui-listbox class="content-host" slot="menu" role="menu" item-selector="${c.replace(/"/g,""")}" direct-item-selector="${b.replace(/"/g,""")}" item-role="menuitem" active-attribute="data-active"></ui-listbox>
|
|
346
346
|
</div>
|
|
347
|
-
`,t.appendChild(e),this._portalEl=e,this._portalSurfaceEl=e.querySelector(".surface"),this._portalContentHostEl=e.querySelector("ui-listbox.content-host"),this._moveContentIntoPortal(),(n=this._portalContentHostEl)==null||n.refresh(),this._syncPortalVisualState(),this._syncSurfaceState(),this._bindPortalInteractionListeners(),this._syncDismissableLayer()}_teardownPortal(){var t,e;if((t=this._dismissableLayer)==null||t.destroy(),this._dismissableLayer=null,this._unbindPortalInteractionListeners(),this._restoreContentFromPortal(),this._portalContentHostEl=null,this._portalSurfaceEl=null,(e=this._portalEl)!=null&&e.parentElement)try{this._portalEl.parentElement.removeChild(this._portalEl)}catch{}this._portalEl=null}_syncDismissableLayer(){var e,i;const t=this._portalSurfaceEl;if(!t||!this._isOpen){(e=this._dismissableLayer)==null||e.destroy(),this._dismissableLayer=null;return}(i=this._dismissableLayer)==null||i.destroy(),this._dismissableLayer=P.createDismissableLayer({node:t,trigger:this._anchorEl||this,closeOnEscape:this.closeOnEscape,closeOnPointerOutside:!0,closeOnFocusOutside:!0,onDismiss:n=>{const o=n==="escape-key"?"escape":"outside";this._setOpen(!1,o)}})}_cancelScheduledWork(){this._positionRaf!=null&&(cancelAnimationFrame(this._positionRaf),this._positionRaf=null),this._submenuRaf!=null&&(cancelAnimationFrame(this._submenuRaf),this._submenuRaf=null),this._stopAnchorTracking(),this._cancelSubmenuIntent(),this._resetTypeahead()}_captureAnchorRect(){if(!this._anchorEl)return null;const t=this._anchorEl.getBoundingClientRect();return{top:t.top,left:t.left,right:t.right,bottom:t.bottom,width:t.width,height:t.height}}_startAnchorTracking(){!this._isOpen||!this._anchorEl||this._anchorTrackRaf!=null||(this._lastAnchorRect=this._captureAnchorRect(),this._anchorTrackRaf=requestAnimationFrame(this._trackAnchorLayout))}_stopAnchorTracking(){this._anchorTrackRaf!=null&&(cancelAnimationFrame(this._anchorTrackRaf),this._anchorTrackRaf=null),this._lastAnchorRect=null}_trackAnchorLayout(){if(this._anchorTrackRaf=null,!this._isOpen||!this._anchorEl)return;const t=this._captureAnchorRect(),e=this._lastAnchorRect;if(this._lastAnchorRect=t,!t){this.close();return}!!e&&(t.top!==e.top||t.left!==e.left||t.right!==e.right||t.bottom!==e.bottom||t.width!==e.width||t.height!==e.height)&&(this._positionMenu(),this._layoutSubmenus()),this._anchorTrackRaf=requestAnimationFrame(this._trackAnchorLayout)}_resetTypeahead(){this._typeaheadBuffer="",this._typeaheadTimer!=null&&(window.clearTimeout(this._typeaheadTimer),this._typeaheadTimer=null)}_normalizeMenuSemantics(){var e;const t=this._menuHost();t&&((e=this._listbox())==null||e.syncItemSemantics({container:t}))}_queryMenuItems(t){var i;const e=t||this._menuHost();return e?(((i=this._listbox())==null?void 0:i.queryItems({container:e}))||[]).filter(n=>N(n)):[]}_submenuFor(t){return t.querySelector(O)}_clearHighlights(){this._hoveredItem=null}_focusItem(t){var i;if(!t)return;this._clearHighlights();const e=t.closest(".submenu")||this._menuHost();(i=this._listbox())==null||i.setActiveItem(t,{container:e,focus:!0,owner:this._surface(),scroll:!0}),this._setOpenBranch(t,!1)}_focusFirstItem(){var i;const t=(i=this._listbox())==null?void 0:i.focusBoundary("first",{container:this._menuHost(),focus:!0,owner:this._surface(),scroll:!0});if(t){this._setOpenBranch(t,!1);return}const e=this._surface();if(e)try{e.focus({preventScroll:!0})}catch{e.focus()}}_focusLastItem(){var e;const t=(e=this._listbox())==null?void 0:e.focusBoundary("last",{container:this._menuHost(),focus:!0,owner:this._surface(),scroll:!0});t&&this._setOpenBranch(t,!1)}_findCurrentItem(t){var i;if(t&&typeof t.composedPath=="function"){const n=U(t.composedPath());if(n)return n}const e=document.activeElement;if(e instanceof HTMLElement){const n=e.closest(p);if(n instanceof HTMLElement)return n}return(i=this._hoveredItem)!=null&&i.isConnected?this._hoveredItem:null}_moveFocus(t,e){var o,r,a;const i=t.closest(".submenu")||this._menuHost();if(!i)return;if(e==="first"){const c=(o=this._listbox())==null?void 0:o.focusBoundary("first",{container:i,focus:!0,owner:this._surface(),scroll:!0});c&&this._setOpenBranch(c,!1);return}if(e==="last"){const c=(r=this._listbox())==null?void 0:r.focusBoundary("last",{container:i,focus:!0,owner:this._surface(),scroll:!0});c&&this._setOpenBranch(c,!1);return}const n=(a=this._listbox())==null?void 0:a.move(e==="next"?1:-1,{container:i,current:t,focus:!0,owner:this._surface(),scroll:!0});n&&this._setOpenBranch(n,!1)}_setOpenBranch(t,e){const i=this._menuHost();if(!i||(i.querySelectorAll('[data-submenu-open="true"]').forEach(r=>r.removeAttribute("data-submenu-open")),!t))return;const n=[];let o=t;for(;o;){const r=o.closest(".submenu");if(!r)break;const a=r.parentElement;if(!(a instanceof HTMLElement)||!a.matches(p))break;n.unshift(a),o=a}n.forEach(r=>r.setAttribute("data-submenu-open","true")),e&&this._submenuFor(t)&&t.setAttribute("data-submenu-open","true")}_openSubmenu(t,e){var o;this._cancelSubmenuIntent();const i=this._submenuFor(t);if(!i||x(t))return!1;if(this._setOpenBranch(t,!0),this._scheduleSubmenuLayout(),!e)return!0;const n=(o=this._listbox())==null?void 0:o.focusBoundary("first",{container:i,focus:!0,owner:this._surface(),scroll:!0});return n&&this._setOpenBranch(n,!1),!0}_closeParentSubmenu(t){const e=t.closest(".submenu");if(!e)return!1;const i=e.parentElement;return!(i instanceof HTMLElement)||!i.matches(p)?!1:(this._focusItem(i),this._setOpenBranch(i,!1),i.removeAttribute("data-submenu-open"),!0)}_clearSubmenuState(){var e;this._cancelSubmenuIntent(),this._hoveredItem=null;const t=this._menuHost();t&&(t.querySelectorAll('[data-submenu-open="true"]').forEach(i=>i.removeAttribute("data-submenu-open")),(e=this._listbox())==null||e.clearActive({container:t}))}_handleTypeahead(t,e){var o;if(!this.typeahead||t.ctrlKey||t.altKey||t.metaKey||t.key.length!==1||!/\S/.test(t.key))return!1;const i=(e==null?void 0:e.closest(".submenu"))||this._menuHost();if(!i)return!1;this._typeaheadBuffer=`${this._typeaheadBuffer}${t.key}`.slice(-24),this._typeaheadTimer!=null&&window.clearTimeout(this._typeaheadTimer),this._typeaheadTimer=window.setTimeout(()=>this._resetTypeahead(),I);const n=(o=this._listbox())==null?void 0:o.typeahead(this._typeaheadBuffer,{container:i,current:e,focus:!0,owner:this._surface(),scroll:!0});return n?(t.preventDefault(),this._setOpenBranch(n,!1),!0):!1}_applySelectionBehavior(t){const e=t.getAttribute("role");if(e==="menuitemcheckbox"){const o=t.getAttribute("aria-checked")!=="true";t.setAttribute("aria-checked",o?"true":"false"),t.setAttribute("data-state",o?"checked":"unchecked");return}if(e!=="menuitemradio")return;const i=t.closest(".submenu")||this._menuHost();if(!i)return;const n=t.getAttribute("data-group")||t.getAttribute("name")||"";i.querySelectorAll('[role="menuitemradio"]').forEach(o=>{const r=o.getAttribute("data-group")||o.getAttribute("name")||"";n&&r!==n||(o.setAttribute("aria-checked","false"),o.setAttribute("data-state","unchecked"))}),t.setAttribute("aria-checked","true"),t.setAttribute("data-state","checked")}_emitSelect(t){var o;const e=this._menuHost(),n=(e?Array.from(e.querySelectorAll(p)):[]).indexOf(t);this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{index:n,value:t.getAttribute("data-value")||t.getAttribute("value")||void 0,label:t.getAttribute("aria-label")||((o=t.textContent)==null?void 0:o.trim())||void 0,checked:t.getAttribute("aria-checked")==="true",item:t}}))}_schedulePosition(){this._isOpen&&(this._positionRaf!=null&&cancelAnimationFrame(this._positionRaf),this._positionRaf=requestAnimationFrame(()=>{this._positionRaf=null,this._positionMenu()}))}_positionMenu(){const t=this._surface();if(!t)return;if(this._anchorEl&&!G(this._anchorEl)){this.close();return}const e=this._anchorEl?this._anchorEl.getBoundingClientRect():W(this._point),i=t.getBoundingClientRect(),n=i.width||t.offsetWidth||240,o=i.height||t.offsetHeight||0,r=V(this.getAttribute("placement")),a=Y(e,n,o,r,this._anchorEl?C:0);t.style.left=`${a.x}px`,t.style.top=`${a.y}px`,t.style.maxWidth=`${a.maxWidth}px`,t.style.maxHeight=`${a.maxHeight}px`,t.setAttribute("data-placement",a.placement)}_scheduleSubmenuLayout(){this._isOpen&&(this._submenuRaf!=null&&cancelAnimationFrame(this._submenuRaf),this._submenuRaf=requestAnimationFrame(()=>{this._submenuRaf=null,this._layoutSubmenus()}))}_layoutSubmenus(){const t=this._menuHost();if(!t)return;const e=window.innerWidth||document.documentElement.clientWidth||0,i=window.innerHeight||document.documentElement.clientHeight||0;Array.from(t.querySelectorAll('.menuitem > .submenu, [role="menuitem"] > .submenu')).forEach(o=>{const r=o.parentElement;if(!(r instanceof HTMLElement))return;r.removeAttribute("data-submenu-side"),r.removeAttribute("data-submenu-align");const a=o.style.display,c=o.style.visibility,l=o.style.pointerEvents,h=o.style.opacity,m=o.style.transform;o.style.display="grid",o.style.visibility="hidden",o.style.pointerEvents="none",o.style.opacity="0",o.style.transform="none";const d=r.getBoundingClientRect(),f=o.getBoundingClientRect();d.right+u+f.width>e&&d.left-u-f.width>=u&&r.setAttribute("data-submenu-side","left"),d.top+f.height>i-u&&d.bottom-f.height>=u&&r.setAttribute("data-submenu-align","up"),o.style.display=a,o.style.visibility=c,o.style.pointerEvents=l,o.style.opacity=h,o.style.transform=m})}_onRootClick(t){if(!this._isOpen||this.isDisabled||this.state==="loading")return;const e=this._findCurrentItem(t);if(!(!e||x(e))){if(this._submenuFor(e)){this._openSubmenu(e,!0);return}this._applySelectionBehavior(e),this._emitSelect(e),this.closeOnSelect?this._setOpen(!1,"select"):this._focusItem(e)}}_onRootPointerOver(t){if(!this._isOpen)return;const e=this._findCurrentItem(t);if(!(!e||x(e))){if(this._hoveredItem=e,this._submenuFor(e)){this._scheduleSubmenuIntent(e);return}this._cancelSubmenuIntent(),this._setOpenBranch(e,!1)}}_onRootPointerLeave(){this._cancelSubmenuIntent(),this._clearHighlights()}_onRootFocusIn(t){var n;if(!this._isOpen)return;this._cancelSubmenuIntent();const e=this._findCurrentItem(t);if(!e||x(e))return;const i=e.closest(".submenu")||this._menuHost();(n=this._listbox())==null||n.setActiveItem(e,{container:i,focus:!1,owner:this._surface(),scroll:!1}),this._setOpenBranch(e,!1)}_cancelSubmenuIntent(){this._submenuIntentTimer!=null&&(window.clearTimeout(this._submenuIntentTimer),this._submenuIntentTimer=null),this._submenuIntentItem=null}_scheduleSubmenuIntent(t){this._submenuIntentItem===t&&this._submenuIntentTimer!=null||(this._cancelSubmenuIntent(),this._submenuIntentItem=t,this._submenuIntentTimer=window.setTimeout(()=>{this._submenuIntentTimer=null;const e=this._submenuIntentItem;this._submenuIntentItem=null,!(!e||!e.isConnected||!this._isOpen)&&(this._setOpenBranch(e,!0),this._scheduleSubmenuLayout())},k))}_onRootKeyDown(t){if(!this._isOpen)return;const e=this._findCurrentItem(t);if(!this._handleTypeahead(t,e)){if(t.key==="Escape"){if(!this.closeOnEscape)return;t.preventDefault(),this._setOpen(!1,"escape");return}if(!(this.isDisabled||this.state==="loading")){if(!e){t.key==="ArrowDown"?(t.preventDefault(),this._focusFirstItem()):t.key==="ArrowUp"&&(t.preventDefault(),this._focusLastItem());return}if(t.key==="ArrowDown"){t.preventDefault(),this._moveFocus(e,"next");return}if(t.key==="ArrowUp"){t.preventDefault(),this._moveFocus(e,"prev");return}if(t.key==="Home"){t.preventDefault(),this._moveFocus(e,"first");return}if(t.key==="End"){t.preventDefault(),this._moveFocus(e,"last");return}if(t.key==="ArrowRight"){t.preventDefault(),this._openSubmenu(e,!0);return}if(t.key==="ArrowLeft"){this._closeParentSubmenu(e)&&t.preventDefault();return}(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),e.click())}}}_onContextMenu(t){this.headless||this.isDisabled||t.defaultPrevented||t.target instanceof HTMLElement&&t.target.closest('[slot="menu"], [slot="content"]')||(t.preventDefault(),this._anchorEl=null,this._point={x:t.clientX,y:t.clientY},this._setOpen(!0,"contextmenu"))}_onViewportChange(){this._isOpen&&(this._schedulePosition(),this._scheduleSubmenuLayout())}render(){const t=q(this._stateText());this.setContent(`
|
|
348
|
-
<style>${
|
|
347
|
+
`,t.appendChild(e),this._portalEl=e,this._portalSurfaceEl=e.querySelector(".surface"),this._portalContentHostEl=e.querySelector("ui-listbox.content-host"),this._moveContentIntoPortal(),(n=this._portalContentHostEl)==null||n.refresh(),this._syncPortalVisualState(),this._syncSurfaceState(),this._bindPortalInteractionListeners(),this._syncDismissableLayer()}_teardownPortal(){var t,e,i;if((t=this._dismissableLayer)==null||t.destroy(),this._dismissableLayer=null,(e=this._positioner)==null||e.destroy(),this._positioner=null,this._positionerPlacement=null,this._positionerOffset=0,this._positionerAnchorEl=null,this._unbindPortalInteractionListeners(),this._restoreContentFromPortal(),this._portalContentHostEl=null,this._portalSurfaceEl=null,(i=this._portalEl)!=null&&i.parentElement)try{this._portalEl.parentElement.removeChild(this._portalEl)}catch{}this._portalEl=null}_syncDismissableLayer(){var e,i;const t=this._portalSurfaceEl;if(!t||!this._isOpen){(e=this._dismissableLayer)==null||e.destroy(),this._dismissableLayer=null;return}(i=this._dismissableLayer)==null||i.destroy(),this._dismissableLayer=P.createDismissableLayer({node:t,trigger:this._anchorEl||this,closeOnEscape:this.closeOnEscape,closeOnPointerOutside:!0,closeOnFocusOutside:!0,onDismiss:n=>{const s=n==="escape-key"?"escape":"outside";this._setOpen(!1,s)}})}_cancelScheduledWork(){this._positionRaf!=null&&(cancelAnimationFrame(this._positionRaf),this._positionRaf=null),this._submenuRaf!=null&&(cancelAnimationFrame(this._submenuRaf),this._submenuRaf=null),this._stopAnchorTracking(),this._cancelSubmenuIntent(),this._resetTypeahead()}_captureAnchorRect(){if(!this._anchorEl)return null;const t=this._anchorEl.getBoundingClientRect();return{top:t.top,left:t.left,right:t.right,bottom:t.bottom,width:t.width,height:t.height}}_pointVirtualAnchor(){return{getBoundingClientRect:()=>{const{x:t,y:e}=this._point;return{x:t,y:e,top:e,left:t,right:t,bottom:e,width:0,height:0,toJSON:()=>({})}}}}_rebuildPositioner(t,e,i){var n;(n=this._positioner)==null||n.destroy(),this._positioner=w.createPositioner({anchor:this._anchorEl||this._pointVirtualAnchor(),floating:t,placement:e,strategy:"fixed",offset:i,flip:!0,shift:!0,boundaryPadding:l,observeWindowResize:!1,observeScroll:!1,observeAncestorScroll:!1,observeAncestorResize:!1,observeLayoutShift:!1,observeAnchorResize:!1,observeFloatingResize:!1,onUpdate:s=>{const r=window.innerWidth||document.documentElement.clientWidth||0,u=window.innerHeight||document.documentElement.clientHeight||0;t.style.maxWidth=`${Math.max(160,r-l*2)}px`,t.style.maxHeight=`${Math.max(120,u-l*2)}px`,t.setAttribute("data-placement",s.placement.split("-")[0])}}),this._positionerPlacement=e,this._positionerOffset=i,this._positionerAnchorEl=this._anchorEl}_startAnchorTracking(){!this._isOpen||!this._anchorEl||this._anchorTrackRaf!=null||(this._lastAnchorRect=this._captureAnchorRect(),this._anchorTrackRaf=requestAnimationFrame(this._trackAnchorLayout))}_stopAnchorTracking(){this._anchorTrackRaf!=null&&(cancelAnimationFrame(this._anchorTrackRaf),this._anchorTrackRaf=null),this._lastAnchorRect=null}_trackAnchorLayout(){if(this._anchorTrackRaf=null,!this._isOpen||!this._anchorEl)return;const t=this._captureAnchorRect(),e=this._lastAnchorRect;if(this._lastAnchorRect=t,!t){this.close();return}!!e&&(t.top!==e.top||t.left!==e.left||t.right!==e.right||t.bottom!==e.bottom||t.width!==e.width||t.height!==e.height)&&(this._positionMenu(),this._layoutSubmenus()),this._anchorTrackRaf=requestAnimationFrame(this._trackAnchorLayout)}_resetTypeahead(){this._typeaheadBuffer="",this._typeaheadTimer!=null&&(window.clearTimeout(this._typeaheadTimer),this._typeaheadTimer=null)}_normalizeMenuSemantics(){var e;const t=this._menuHost();t&&((e=this._listbox())==null||e.syncItemSemantics({container:t}))}_queryMenuItems(t){var i;const e=t||this._menuHost();return e?(((i=this._listbox())==null?void 0:i.queryItems({container:e}))||[]).filter(n=>W(n)):[]}_submenuFor(t){return t.querySelector(L)}_clearHighlights(){this._hoveredItem=null}_focusItem(t){var i;if(!t)return;this._clearHighlights();const e=t.closest(".submenu")||this._menuHost();(i=this._listbox())==null||i.setActiveItem(t,{container:e,focus:!0,owner:this._surface(),scroll:!0}),this._setOpenBranch(t,!1)}_focusFirstItem(){var i;const t=(i=this._listbox())==null?void 0:i.focusBoundary("first",{container:this._menuHost(),focus:!0,owner:this._surface(),scroll:!0});if(t){this._setOpenBranch(t,!1);return}const e=this._surface();if(e)try{e.focus({preventScroll:!0})}catch{e.focus()}}_focusLastItem(){var e;const t=(e=this._listbox())==null?void 0:e.focusBoundary("last",{container:this._menuHost(),focus:!0,owner:this._surface(),scroll:!0});t&&this._setOpenBranch(t,!1)}_findCurrentItem(t){var i;if(t&&typeof t.composedPath=="function"){const n=G(t.composedPath());if(n)return n}const e=document.activeElement;if(e instanceof HTMLElement){const n=e.closest(c);if(n instanceof HTMLElement)return n}return(i=this._hoveredItem)!=null&&i.isConnected?this._hoveredItem:null}_moveFocus(t,e){var s,r,u;const i=t.closest(".submenu")||this._menuHost();if(!i)return;if(e==="first"){const a=(s=this._listbox())==null?void 0:s.focusBoundary("first",{container:i,focus:!0,owner:this._surface(),scroll:!0});a&&this._setOpenBranch(a,!1);return}if(e==="last"){const a=(r=this._listbox())==null?void 0:r.focusBoundary("last",{container:i,focus:!0,owner:this._surface(),scroll:!0});a&&this._setOpenBranch(a,!1);return}const n=(u=this._listbox())==null?void 0:u.move(e==="next"?1:-1,{container:i,current:t,focus:!0,owner:this._surface(),scroll:!0});n&&this._setOpenBranch(n,!1)}_setOpenBranch(t,e){const i=this._menuHost();if(!i||(i.querySelectorAll('[data-submenu-open="true"]').forEach(r=>r.removeAttribute("data-submenu-open")),!t))return;const n=[];let s=t;for(;s;){const r=s.closest(".submenu");if(!r)break;const u=r.parentElement;if(!(u instanceof HTMLElement)||!u.matches(c))break;n.unshift(u),s=u}n.forEach(r=>r.setAttribute("data-submenu-open","true")),e&&this._submenuFor(t)&&t.setAttribute("data-submenu-open","true")}_openSubmenu(t,e){var s;this._cancelSubmenuIntent();const i=this._submenuFor(t);if(!i||x(t))return!1;if(this._setOpenBranch(t,!0),this._scheduleSubmenuLayout(),!e)return!0;const n=(s=this._listbox())==null?void 0:s.focusBoundary("first",{container:i,focus:!0,owner:this._surface(),scroll:!0});return n&&this._setOpenBranch(n,!1),!0}_closeParentSubmenu(t){const e=t.closest(".submenu");if(!e)return!1;const i=e.parentElement;return!(i instanceof HTMLElement)||!i.matches(c)?!1:(this._focusItem(i),this._setOpenBranch(i,!1),i.removeAttribute("data-submenu-open"),!0)}_clearSubmenuState(){var e;this._cancelSubmenuIntent(),this._hoveredItem=null;const t=this._menuHost();t&&(t.querySelectorAll('[data-submenu-open="true"]').forEach(i=>i.removeAttribute("data-submenu-open")),(e=this._listbox())==null||e.clearActive({container:t}))}_handleTypeahead(t,e){var s;if(!this.typeahead||t.ctrlKey||t.altKey||t.metaKey||t.key.length!==1||!/\S/.test(t.key))return!1;const i=(e==null?void 0:e.closest(".submenu"))||this._menuHost();if(!i)return!1;this._typeaheadBuffer=`${this._typeaheadBuffer}${t.key}`.slice(-24),this._typeaheadTimer!=null&&window.clearTimeout(this._typeaheadTimer),this._typeaheadTimer=window.setTimeout(()=>this._resetTypeahead(),C);const n=(s=this._listbox())==null?void 0:s.typeahead(this._typeaheadBuffer,{container:i,current:e,focus:!0,owner:this._surface(),scroll:!0});return n?(t.preventDefault(),this._setOpenBranch(n,!1),!0):!1}_applySelectionBehavior(t){const e=t.getAttribute("role");if(e==="menuitemcheckbox"){const s=t.getAttribute("aria-checked")!=="true";t.setAttribute("aria-checked",s?"true":"false"),t.setAttribute("data-state",s?"checked":"unchecked");return}if(e!=="menuitemradio")return;const i=t.closest(".submenu")||this._menuHost();if(!i)return;const n=t.getAttribute("data-group")||t.getAttribute("name")||"";i.querySelectorAll('[role="menuitemradio"]').forEach(s=>{const r=s.getAttribute("data-group")||s.getAttribute("name")||"";n&&r!==n||(s.setAttribute("aria-checked","false"),s.setAttribute("data-state","unchecked"))}),t.setAttribute("aria-checked","true"),t.setAttribute("data-state","checked")}_emitSelect(t){var s;const e=this._menuHost(),n=(e?Array.from(e.querySelectorAll(c)):[]).indexOf(t);this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{index:n,value:t.getAttribute("data-value")||t.getAttribute("value")||void 0,label:t.getAttribute("aria-label")||((s=t.textContent)==null?void 0:s.trim())||void 0,checked:t.getAttribute("aria-checked")==="true",item:t}}))}_schedulePosition(){this._isOpen&&(this._positionRaf!=null&&cancelAnimationFrame(this._positionRaf),this._positionRaf=requestAnimationFrame(()=>{this._positionRaf=null,this._positionMenu()}))}_positionMenu(){var r;const t=this._surface();if(!t)return;if(this._anchorEl&&!U(this._anchorEl)){this.close();return}const e=V(this.getAttribute("placement")),i=N(e),n=this._anchorEl?R:0;if(!this._positioner||this._positionerPlacement!==i||this._positionerOffset!==n||this._positionerAnchorEl!==this._anchorEl){this._rebuildPositioner(t,i,n);return}(r=this._positioner)==null||r.update()}_scheduleSubmenuLayout(){this._isOpen&&(this._submenuRaf!=null&&cancelAnimationFrame(this._submenuRaf),this._submenuRaf=requestAnimationFrame(()=>{this._submenuRaf=null,this._layoutSubmenus()}))}_layoutSubmenus(){const t=this._menuHost();if(!t)return;const e=window.innerWidth||document.documentElement.clientWidth||0,i=window.innerHeight||document.documentElement.clientHeight||0;Array.from(t.querySelectorAll('.menuitem > .submenu, [role="menuitem"] > .submenu')).forEach(s=>{const r=s.parentElement;if(!(r instanceof HTMLElement))return;r.removeAttribute("data-submenu-side"),r.removeAttribute("data-submenu-align");const u=s.style.display,a=s.style.visibility,h=s.style.pointerEvents,m=s.style.opacity,p=s.style.transform;s.style.display="grid",s.style.visibility="hidden",s.style.pointerEvents="none",s.style.opacity="0",s.style.transform="none";const d=r.getBoundingClientRect(),f=s.getBoundingClientRect();d.right+l+f.width>e&&d.left-l-f.width>=l&&r.setAttribute("data-submenu-side","left"),d.top+f.height>i-l&&d.bottom-f.height>=l&&r.setAttribute("data-submenu-align","up"),s.style.display=u,s.style.visibility=a,s.style.pointerEvents=h,s.style.opacity=m,s.style.transform=p})}_onRootClick(t){if(!this._isOpen||this.isDisabled||this.state==="loading")return;const e=this._findCurrentItem(t);if(!(!e||x(e))){if(this._submenuFor(e)){this._openSubmenu(e,!0);return}this._applySelectionBehavior(e),this._emitSelect(e),this.closeOnSelect?this._setOpen(!1,"select"):this._focusItem(e)}}_onRootPointerOver(t){if(!this._isOpen)return;const e=this._findCurrentItem(t);if(!(!e||x(e))){if(this._hoveredItem=e,this._submenuFor(e)){this._scheduleSubmenuIntent(e);return}this._cancelSubmenuIntent(),this._setOpenBranch(e,!1)}}_onRootPointerLeave(){this._cancelSubmenuIntent(),this._clearHighlights()}_onRootFocusIn(t){var n;if(!this._isOpen)return;this._cancelSubmenuIntent();const e=this._findCurrentItem(t);if(!e||x(e))return;const i=e.closest(".submenu")||this._menuHost();(n=this._listbox())==null||n.setActiveItem(e,{container:i,focus:!1,owner:this._surface(),scroll:!1}),this._setOpenBranch(e,!1)}_cancelSubmenuIntent(){this._submenuIntentTimer!=null&&(window.clearTimeout(this._submenuIntentTimer),this._submenuIntentTimer=null),this._submenuIntentItem=null}_scheduleSubmenuIntent(t){this._submenuIntentItem===t&&this._submenuIntentTimer!=null||(this._cancelSubmenuIntent(),this._submenuIntentItem=t,this._submenuIntentTimer=window.setTimeout(()=>{this._submenuIntentTimer=null;const e=this._submenuIntentItem;this._submenuIntentItem=null,!(!e||!e.isConnected||!this._isOpen)&&(this._setOpenBranch(e,!0),this._scheduleSubmenuLayout())},I))}_onRootKeyDown(t){if(!this._isOpen)return;const e=this._findCurrentItem(t);if(!this._handleTypeahead(t,e)){if(t.key==="Escape"){if(!this.closeOnEscape)return;t.preventDefault(),this._setOpen(!1,"escape");return}if(!(this.isDisabled||this.state==="loading")){if(!e){t.key==="ArrowDown"?(t.preventDefault(),this._focusFirstItem()):t.key==="ArrowUp"&&(t.preventDefault(),this._focusLastItem());return}if(t.key==="ArrowDown"){t.preventDefault(),this._moveFocus(e,"next");return}if(t.key==="ArrowUp"){t.preventDefault(),this._moveFocus(e,"prev");return}if(t.key==="Home"){t.preventDefault(),this._moveFocus(e,"first");return}if(t.key==="End"){t.preventDefault(),this._moveFocus(e,"last");return}if(t.key==="ArrowRight"){t.preventDefault(),this._openSubmenu(e,!0);return}if(t.key==="ArrowLeft"){this._closeParentSubmenu(e)&&t.preventDefault();return}(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),e.click())}}}_onContextMenu(t){this.headless||this.isDisabled||t.defaultPrevented||t.target instanceof HTMLElement&&t.target.closest('[slot="menu"], [slot="content"]')||(t.preventDefault(),this._anchorEl=null,this._point={x:t.clientX,y:t.clientY},this._setOpen(!0,"contextmenu"))}_onViewportChange(){this._isOpen&&(this._schedulePosition(),this._scheduleSubmenuLayout())}render(){const t=M(this._stateText());this.setContent(`
|
|
348
|
+
<style>${g}</style>
|
|
349
349
|
<div class="surface" part="menu" role="menu" aria-hidden="true" aria-busy="false" tabindex="-1">
|
|
350
350
|
<div class="state-row" part="state" data-state="${this.state}">${t}</div>
|
|
351
|
-
<ui-listbox class="content-host" part="content" slot="menu" role="menu" item-selector="${
|
|
351
|
+
<ui-listbox class="content-host" part="content" slot="menu" role="menu" item-selector="${c.replace(/"/g,""")}" direct-item-selector="${b.replace(/"/g,""")}" item-role="menuitem" active-attribute="data-active">
|
|
352
352
|
<slot name="menu"></slot>
|
|
353
353
|
<slot name="content"></slot>
|
|
354
354
|
</ui-listbox>
|
|
355
355
|
</div>
|
|
356
356
|
<slot></slot>
|
|
357
|
-
`),this._syncSurfaceState(),this._isOpen&&(this._normalizeMenuSemantics(),this._syncPortalVisualState(),this._schedulePosition(),this._scheduleSubmenuLayout())}shouldRenderOnAttributeChange(){return!1}}typeof customElements<"u"&&!customElements.get("ui-context-menu")&&customElements.define("ui-context-menu",
|
|
357
|
+
`),this._syncSurfaceState(),this._isOpen&&(this._normalizeMenuSemantics(),this._syncPortalVisualState(),this._schedulePosition(),this._scheduleSubmenuLayout())}shouldRenderOnAttributeChange(){return!1}}typeof customElements<"u"&&!customElements.get("ui-context-menu")&&customElements.define("ui-context-menu",E);exports.UIContextMenu=E;
|