@editora/ui-core 0.1.19 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ElementBase-1b301e7f.js → ElementBase-EV6mVBUV.js} +1 -1
- package/dist/{ElementBase-909688f3.mjs → ElementBase-YlTLMsGk.mjs} +3 -3
- package/dist/accordion.cjs.js +3 -3
- package/dist/accordion.esm.js +39 -62
- package/dist/alert-dialog.cjs.js +19 -19
- package/dist/alert-dialog.esm.js +69 -87
- package/dist/alert.cjs.js +1 -1
- package/dist/alert.esm.js +4 -7
- package/dist/anchor.cjs.js +2 -2
- package/dist/anchor.esm.js +3 -3
- package/dist/animated-beam.cjs.js +83 -83
- package/dist/animated-beam.esm.js +250 -277
- package/dist/animated-list.cjs.js +4 -4
- package/dist/animated-list.esm.js +47 -61
- package/dist/animated-text.cjs.js +2 -2
- package/dist/animated-text.esm.js +13 -24
- package/dist/app-header.cjs.js +3 -3
- package/dist/app-header.esm.js +11 -13
- package/dist/aspect-ratio.cjs.js +1 -1
- package/dist/aspect-ratio.esm.js +4 -7
- package/dist/avatar.cjs.js +1 -1
- package/dist/avatar.esm.js +7 -13
- package/dist/badge.cjs.js +1 -1
- package/dist/badge.esm.js +4 -7
- package/dist/block-controls.cjs.js +2 -2
- package/dist/block-controls.esm.js +19 -35
- package/dist/box.cjs.js +1 -1
- package/dist/box.esm.js +8 -15
- package/dist/breadcrumb.cjs.js +2 -2
- package/dist/breadcrumb.esm.js +20 -37
- package/dist/button.cjs.js +1 -521
- package/dist/button.esm.js +2 -671
- package/dist/{calendar-2c11b824.mjs → calendar-DLY4acgn.mjs} +293 -342
- package/dist/{calendar-a8735e40.js → calendar-Dkof-FTK.js} +25 -25
- package/dist/calendar.cjs.js +1 -1
- package/dist/calendar.esm.js +8 -9
- package/dist/card.cjs.js +4 -4
- package/dist/card.esm.js +13 -19
- package/dist/chart.cjs.js +64 -64
- package/dist/chart.esm.js +223 -254
- package/dist/checkbox.cjs.js +1 -1
- package/dist/checkbox.esm.js +2 -3
- package/dist/collapsible.cjs.js +1 -1
- package/dist/collapsible.esm.js +5 -9
- package/dist/{collection-a1aac0c6.mjs → collection-C7URGjEI.mjs} +8 -14
- package/dist/collection.cjs.js +1 -1
- package/dist/collection.esm.js +30 -29
- package/dist/color-picker.cjs.js +10 -10
- package/dist/color-picker.esm.js +190 -253
- package/dist/combobox.cjs.js +13 -13
- package/dist/combobox.esm.js +93 -126
- package/dist/command-palette.cjs.js +3 -3
- package/dist/command-palette.esm.js +19 -30
- package/dist/command.cjs.js +4 -4
- package/dist/command.esm.js +41 -53
- package/dist/components/ui-collection.d.ts.map +1 -1
- package/dist/components/ui-multi-select.d.ts.map +1 -1
- package/dist/components/ui-orbiter.d.ts.map +1 -1
- package/dist/components/ui-portal.d.ts.map +1 -1
- package/dist/components/ui-positioner.d.ts.map +1 -1
- package/dist/components/ui-skeleton.d.ts.map +1 -1
- package/dist/components/ui-sortable.d.ts +8 -0
- package/dist/components/ui-sortable.d.ts.map +1 -1
- package/dist/components/ui-split-button.d.ts +1 -0
- package/dist/components/ui-split-button.d.ts.map +1 -1
- package/dist/components/ui-tabs.d.ts.map +1 -1
- package/dist/components/ui-textarea.d.ts.map +1 -1
- package/dist/components/ui-time-picker.d.ts.map +1 -1
- package/dist/container.cjs.js +2 -2
- package/dist/container.esm.js +2 -3
- package/dist/context-menu.cjs.js +8 -8
- package/dist/context-menu.esm.js +157 -219
- package/dist/control-group.cjs.js +1 -1
- package/dist/control-group.esm.js +2 -3
- package/dist/data-table.cjs.js +4 -4
- package/dist/data-table.esm.js +299 -381
- package/dist/date-field.cjs.js +3 -3
- package/dist/date-field.esm.js +68 -80
- package/dist/date-picker.cjs.js +9 -9
- package/dist/date-picker.esm.js +69 -97
- package/dist/date-range-picker.cjs.js +3 -3
- package/dist/date-range-picker.esm.js +32 -56
- package/dist/date-range-time-picker.cjs.js +9 -9
- package/dist/date-range-time-picker.esm.js +111 -140
- package/dist/date-time-picker.cjs.js +7 -7
- package/dist/date-time-picker.esm.js +115 -147
- package/dist/date-time-utils-Dmost5Ee.js +1 -0
- package/dist/date-time-utils-y1N2gvG2.mjs +268 -0
- package/dist/description.cjs.js +1 -1
- package/dist/description.esm.js +3 -5
- package/dist/dialog.cjs.js +12 -12
- package/dist/dialog.esm.js +44 -63
- package/dist/direction-provider.cjs.js +1 -1
- package/dist/direction-provider.esm.js +2 -3
- package/dist/{dismissable-layer-9c7e6b58.mjs → dismissable-layer-BmPIoK80.mjs} +29 -33
- package/dist/dismissable-layer-DNfrKA20.js +1 -0
- package/dist/dismissable-layer.cjs.js +2 -2
- package/dist/dismissable-layer.esm.js +4 -6
- package/dist/dock.cjs.js +5 -5
- package/dist/dock.esm.js +134 -155
- package/dist/drawer.cjs.js +2 -2
- package/dist/drawer.esm.js +18 -35
- package/dist/dropdown.cjs.js +2 -2
- package/dist/dropdown.esm.js +119 -149
- package/dist/dropzone.cjs.js +1 -1
- package/dist/dropzone.esm.js +0 -1
- package/dist/empty-state.cjs.js +1 -1
- package/dist/empty-state.esm.js +1 -1
- package/dist/field-error.cjs.js +1 -1
- package/dist/field-error.esm.js +3 -5
- package/dist/field.cjs.js +5 -5
- package/dist/field.esm.js +27 -34
- package/dist/fieldset.cjs.js +4 -4
- package/dist/fieldset.esm.js +19 -24
- package/dist/file-upload.cjs.js +4 -4
- package/dist/file-upload.esm.js +69 -93
- package/dist/flex.cjs.js +1 -1
- package/dist/flex.esm.js +5 -9
- package/dist/floating-toolbar.cjs.js +4 -4
- package/dist/floating-toolbar.esm.js +60 -85
- package/dist/focus-scope-Bwug2gDv.js +1 -0
- package/dist/{focus-scope-103833ee.mjs → focus-scope-CmEsG5UZ.mjs} +39 -48
- package/dist/focus-scope.cjs.js +2 -2
- package/dist/focus-scope.esm.js +15 -20
- package/dist/form.cjs.js +2 -2
- package/dist/form.esm.js +26 -53
- package/dist/gantt.cjs.js +43 -43
- package/dist/gantt.esm.js +295 -322
- package/dist/grid.cjs.js +1 -1
- package/dist/grid.esm.js +5 -9
- package/dist/hover-card.cjs.js +4 -4
- package/dist/hover-card.esm.js +22 -28
- package/dist/icon-cloud.cjs.js +7 -7
- package/dist/icon-cloud.esm.js +48 -62
- package/dist/icon.cjs.js +1 -1
- package/dist/icon.esm.js +2 -4
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +378 -390
- package/dist/inline-edit.cjs.js +11 -11
- package/dist/inline-edit.esm.js +32 -36
- package/dist/input.cjs.js +17 -17
- package/dist/input.esm.js +50 -63
- package/dist/label.cjs.js +2 -2
- package/dist/label.esm.js +8 -17
- package/dist/layout.cjs.js +2 -2
- package/dist/layout.esm.js +20 -26
- package/dist/listbox-B6QgECax.js +46 -0
- package/dist/listbox-DJamVeFj.mjs +200 -0
- package/dist/listbox.cjs.js +1 -1
- package/dist/listbox.esm.js +2 -4
- package/dist/marquee.cjs.js +5 -5
- package/dist/marquee.esm.js +33 -50
- package/dist/masonry-grid.cjs.js +1 -1
- package/dist/masonry-grid.esm.js +5 -9
- package/dist/menu.cjs.js +3 -3
- package/dist/menu.esm.js +106 -126
- package/dist/menubar.cjs.js +5 -5
- package/dist/menubar.esm.js +118 -164
- package/dist/meter.cjs.js +2 -2
- package/dist/meter.esm.js +4 -4
- package/dist/multi-select.cjs.js +5 -5
- package/dist/multi-select.esm.js +125 -137
- package/dist/navigation-menu.cjs.js +4 -4
- package/dist/navigation-menu.esm.js +44 -55
- package/dist/number-field.cjs.js +2 -2
- package/dist/number-field.esm.js +73 -98
- package/dist/number-ticker.cjs.js +3 -3
- package/dist/number-ticker.esm.js +22 -43
- package/dist/odometer.cjs.js +1 -1
- package/dist/odometer.esm.js +5 -9
- package/dist/orbiter.cjs.js +13 -13
- package/dist/orbiter.esm.js +79 -90
- package/dist/{overlayManager-5bbd4dc3.mjs → overlayManager-BJjU1VA8.mjs} +4 -5
- package/dist/{overlayManager-0eda4e08.js → overlayManager-CSy3fJmJ.js} +1 -1
- package/dist/pagination.cjs.js +2 -2
- package/dist/pagination.esm.js +14 -18
- package/dist/{panel-group-a376cc5e.mjs → panel-group-8sVNnGxg.mjs} +24 -46
- package/dist/panel-group-CaD0_KQf.js +36 -0
- package/dist/panel-group.cjs.js +1 -1
- package/dist/panel-group.esm.js +2 -5
- package/dist/panel.cjs.js +4 -4
- package/dist/panel.esm.js +8 -10
- package/dist/password-field.cjs.js +9 -9
- package/dist/password-field.esm.js +62 -82
- package/dist/pin-input.cjs.js +3 -3
- package/dist/pin-input.esm.js +33 -39
- package/dist/placement-grid.cjs.js +4 -4
- package/dist/placement-grid.esm.js +108 -131
- package/dist/plugin-panel.cjs.js +7 -7
- package/dist/plugin-panel.esm.js +13 -15
- package/dist/popover.cjs.js +2 -2
- package/dist/popover.esm.js +21 -31
- package/dist/portal-DgpQ3Jo1.js +1 -0
- package/dist/{portal-fe73e5cc.mjs → portal-bR42gHvG.mjs} +43 -48
- package/dist/portal.cjs.js +3 -3
- package/dist/portal.esm.js +20 -28
- package/dist/{positioner-e9770c66.mjs → positioner-D0VGxtYU.mjs} +189 -209
- package/dist/positioner-D_fqyx_j.js +1 -0
- package/dist/positioner.cjs.js +2 -2
- package/dist/positioner.esm.js +22 -28
- package/dist/presence.cjs.js +1 -1
- package/dist/presence.esm.js +7 -13
- package/dist/primitives/auto-scroll.d.ts +9 -0
- package/dist/primitives/auto-scroll.d.ts.map +1 -0
- package/dist/primitives/selector.d.ts +4 -0
- package/dist/primitives/selector.d.ts.map +1 -0
- package/dist/progress.cjs.js +1 -1
- package/dist/progress.esm.js +5 -9
- package/dist/quick-actions.cjs.js +6 -6
- package/dist/quick-actions.esm.js +52 -62
- package/dist/radio-group.cjs.js +13 -13
- package/dist/radio-group.esm.js +39 -51
- package/dist/radio.cjs.js +1 -1
- package/dist/radio.esm.js +5 -9
- package/dist/rating.cjs.js +1 -1
- package/dist/rating.esm.js +12 -23
- package/dist/{roving-focus-group-4350c9a7.mjs → roving-focus-group-Dbm1Jko_.mjs} +3 -6
- package/dist/roving-focus-group.cjs.js +1 -1
- package/dist/roving-focus-group.esm.js +3 -5
- package/dist/runtime-CTaOSmBj.js +1 -0
- package/dist/{runtime-161f68a2.mjs → runtime-D1gFh1fS.mjs} +338 -366
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.esm.js +6 -6
- package/dist/scroll-area.cjs.js +3 -3
- package/dist/scroll-area.esm.js +38 -46
- package/dist/{scroll-lock-31da444f.mjs → scroll-lock-LfqXXqsu.mjs} +5 -9
- package/dist/section.cjs.js +1 -1
- package/dist/section.esm.js +1 -1
- package/dist/select.cjs.js +7 -7
- package/dist/select.esm.js +67 -97
- package/dist/selection-popup.cjs.js +1 -1
- package/dist/selection-popup.esm.js +8 -15
- package/dist/selector-BvAh35ve.js +1 -0
- package/dist/selector-WI8pD7YO.mjs +18 -0
- package/dist/separator.cjs.js +1 -1
- package/dist/separator.esm.js +1 -1
- package/dist/sidebar.cjs.js +18 -18
- package/dist/sidebar.esm.js +117 -139
- package/dist/skeleton.cjs.js +11 -11
- package/dist/skeleton.esm.js +27 -24
- package/dist/slider.cjs.js +1 -1
- package/dist/slider.esm.js +6 -11
- package/dist/slot.cjs.js +4 -4
- package/dist/slot.esm.js +16 -19
- package/dist/sortable.cjs.js +79 -65
- package/dist/sortable.esm.js +714 -734
- package/dist/spinning-text.cjs.js +12 -12
- package/dist/spinning-text.esm.js +80 -92
- package/dist/split-button.cjs.js +4 -4
- package/dist/split-button.esm.js +77 -62
- package/dist/splitter.cjs.js +1 -1
- package/dist/splitter.esm.js +1 -1
- package/dist/stepper.cjs.js +8 -8
- package/dist/stepper.esm.js +32 -52
- package/dist/switch.cjs.js +7 -7
- package/dist/switch.esm.js +23 -31
- package/dist/table.cjs.js +2 -2
- package/dist/table.esm.js +46 -56
- package/dist/tabs.cjs.js +8 -8
- package/dist/tabs.esm.js +89 -109
- package/dist/tags-input.cjs.js +4 -4
- package/dist/tags-input.esm.js +45 -62
- package/dist/textarea.cjs.js +10 -10
- package/dist/textarea.esm.js +49 -52
- package/dist/time-field.cjs.js +4 -4
- package/dist/time-field.esm.js +70 -84
- package/dist/time-picker.cjs.js +22 -22
- package/dist/time-picker.esm.js +88 -110
- package/dist/timeline.cjs.js +1 -1
- package/dist/timeline.esm.js +3 -5
- package/dist/toast.cjs.js +2 -2
- package/dist/toast.esm.js +33 -47
- package/dist/toggle-group.cjs.js +6 -6
- package/dist/toggle-group.esm.js +85 -105
- package/dist/toggle.cjs.js +1 -1
- package/dist/toggle.esm.js +3 -5
- package/dist/toolbar.cjs.js +1 -1
- package/dist/toolbar.esm.js +13 -24
- package/dist/tooltip.cjs.js +2 -2
- package/dist/tooltip.esm.js +31 -42
- package/dist/transfer-list.cjs.js +31 -31
- package/dist/transfer-list.esm.js +114 -127
- package/dist/{tree-dcd74a4a.mjs → tree-B3kE8ESs.mjs} +55 -62
- package/dist/tree-Dx_kv_ih.js +39 -0
- package/dist/tree-item.cjs.js +2 -2
- package/dist/tree-item.esm.js +2 -3
- package/dist/tree.cjs.js +1 -1
- package/dist/tree.esm.js +2 -5
- package/dist/ui-button-Q0GNNWKC.mjs +665 -0
- package/dist/ui-button-rXQOS9QJ.js +521 -0
- package/dist/{icon-9e9da03b.js → ui-icon-BzVNC_lr.js} +4 -4
- package/dist/{icon-e2a85cc1.mjs → ui-icon-YI6lyuqU.mjs} +58 -65
- package/dist/visually-hidden.cjs.js +1 -1
- package/dist/visually-hidden.esm.js +1 -1
- package/dist/wizard.cjs.js +14 -14
- package/dist/wizard.esm.js +85 -105
- package/package.json +2 -2
- package/dist/date-time-utils-66480de4.js +0 -1
- package/dist/date-time-utils-a2c7af25.mjs +0 -307
- package/dist/dismissable-layer-193e3bed.js +0 -1
- package/dist/focus-scope-2b12b4e7.js +0 -1
- package/dist/listbox-308789a0.mjs +0 -210
- package/dist/listbox-ef2f708e.js +0 -46
- package/dist/panel-group-40254cdd.js +0 -36
- package/dist/portal-c69756c0.js +0 -1
- package/dist/positioner-33529bb8.js +0 -1
- package/dist/runtime-3f13807b.js +0 -1
- package/dist/tree-0a7a8d05.js +0 -39
- /package/dist/{collection-a2969ad2.js → collection-qv8A8rq4.js} +0 -0
- /package/dist/{menu-item-styles-27fdbac4.mjs → menu-item-styles-CZiPwPwl.mjs} +0 -0
- /package/dist/{menu-item-styles-83ad1e22.js → menu-item-styles-CbNUEwP2.js} +0 -0
- /package/dist/{roving-focus-group-5c059bf9.js → roving-focus-group-BdJ_4Njm.js} +0 -0
- /package/dist/{scroll-lock-d7b0df21.js → scroll-lock-BX6e3Ced.js} +0 -0
package/dist/popover.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { E as v } from "./ElementBase-
|
|
2
|
-
import {
|
|
3
|
-
import { c as f } from "./dismissable-layer-
|
|
4
|
-
import {
|
|
1
|
+
import { E as v } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
|
+
import { b as h } from "./portal-bR42gHvG.mjs";
|
|
3
|
+
import { c as f } from "./dismissable-layer-BmPIoK80.mjs";
|
|
4
|
+
import { e as b } from "./positioner-D0VGxtYU.mjs";
|
|
5
5
|
const g = `
|
|
6
6
|
.popover-shell {
|
|
7
7
|
--ui-popover-accent: var(--ui-color-primary, var(--ui-primary, #2563eb));
|
|
@@ -309,28 +309,25 @@ class m extends v {
|
|
|
309
309
|
];
|
|
310
310
|
}
|
|
311
311
|
attributeChangedCallback(e, t, r) {
|
|
312
|
-
var o;
|
|
313
312
|
if (t !== r) {
|
|
314
313
|
if (e === "open") {
|
|
315
314
|
this._syncOpenState();
|
|
316
315
|
return;
|
|
317
316
|
}
|
|
318
|
-
this._isOpen &&
|
|
317
|
+
this._isOpen && this._portalEl?.isConnected && (e === "placement" || e === "offset" || e === "flip" || e === "shift" || e === "variant" || e === "tone" || e === "size" || e === "radius" || e === "elevation" ? this._mountPortal() : (e === "close-on-escape" || e === "close-on-outside") && this._syncDismissableLayer());
|
|
319
318
|
}
|
|
320
319
|
}
|
|
321
320
|
connectedCallback() {
|
|
322
321
|
super.connectedCallback(), this.addEventListener("click", this._onHostClick), this._observeHost(), this._syncOpenState();
|
|
323
322
|
}
|
|
324
323
|
disconnectedCallback() {
|
|
325
|
-
|
|
326
|
-
this.removeEventListener("click", this._onHostClick), (e = this._hostObserver) == null || e.disconnect(), this._hostObserver = null, this._teardownPortal(), super.disconnectedCallback();
|
|
324
|
+
this.removeEventListener("click", this._onHostClick), this._hostObserver?.disconnect(), this._hostObserver = null, this._teardownPortal(), super.disconnectedCallback();
|
|
327
325
|
}
|
|
328
326
|
_handleHostClick(e) {
|
|
329
327
|
const t = this._getTrigger();
|
|
330
|
-
if (!t)
|
|
331
|
-
return;
|
|
328
|
+
if (!t) return;
|
|
332
329
|
const r = typeof e.composedPath == "function" ? e.composedPath() : [], o = e.target instanceof Node ? e.target : null;
|
|
333
|
-
(r.includes(t) ||
|
|
330
|
+
(r.includes(t) || o && (t === o || t.contains(o))) && this.toggle();
|
|
334
331
|
}
|
|
335
332
|
open() {
|
|
336
333
|
this.setAttribute("open", "");
|
|
@@ -342,8 +339,7 @@ class m extends v {
|
|
|
342
339
|
this.hasAttribute("open") ? this.close() : this.open();
|
|
343
340
|
}
|
|
344
341
|
updatePosition() {
|
|
345
|
-
|
|
346
|
-
(e = this._positioner) == null || e.update();
|
|
342
|
+
this._positioner?.update();
|
|
347
343
|
}
|
|
348
344
|
_getTrigger() {
|
|
349
345
|
return this.querySelector('[slot="trigger"]');
|
|
@@ -357,8 +353,8 @@ class m extends v {
|
|
|
357
353
|
r && (e.dataset.tone = r);
|
|
358
354
|
const o = this.getAttribute("size");
|
|
359
355
|
o && (e.dataset.size = o);
|
|
360
|
-
const
|
|
361
|
-
|
|
356
|
+
const a = this.getAttribute("elevation");
|
|
357
|
+
a && (e.dataset.elevation = a);
|
|
362
358
|
const s = this.getAttribute("radius");
|
|
363
359
|
if (s && s.trim()) {
|
|
364
360
|
const p = s.trim(), d = /^-?\d+(\.\d+)?$/.test(p) ? `${p}px` : p;
|
|
@@ -366,12 +362,12 @@ class m extends v {
|
|
|
366
362
|
}
|
|
367
363
|
const l = document.createElement("style");
|
|
368
364
|
l.textContent = g, e.appendChild(l);
|
|
369
|
-
const
|
|
370
|
-
|
|
365
|
+
const i = document.createElement("div");
|
|
366
|
+
i.className = "panel show", this._panelEl = i;
|
|
371
367
|
const c = document.createElement("div");
|
|
372
|
-
c.className = "arrow",
|
|
368
|
+
c.className = "arrow", i.appendChild(c);
|
|
373
369
|
const u = this.querySelector('[slot="content"]'), n = document.createElement("div");
|
|
374
|
-
return n.className = "content", u && n.appendChild(u.cloneNode(!0)),
|
|
370
|
+
return n.className = "content", u && n.appendChild(u.cloneNode(!0)), i.appendChild(n), e.appendChild(i), e;
|
|
375
371
|
}
|
|
376
372
|
_getContentSource() {
|
|
377
373
|
return this.querySelector('[slot="content"]');
|
|
@@ -391,9 +387,8 @@ class m extends v {
|
|
|
391
387
|
return this.getAttribute("close-on-outside") !== "false";
|
|
392
388
|
}
|
|
393
389
|
_syncDismissableLayer() {
|
|
394
|
-
var t;
|
|
395
390
|
const e = this._getTrigger();
|
|
396
|
-
!e || !this._panelEl || (
|
|
391
|
+
!e || !this._panelEl || (this._layer?.destroy(), this._layer = f({
|
|
397
392
|
node: this._panelEl,
|
|
398
393
|
trigger: e,
|
|
399
394
|
closeOnEscape: this._closeOnEscape(),
|
|
@@ -402,8 +397,7 @@ class m extends v {
|
|
|
402
397
|
}));
|
|
403
398
|
}
|
|
404
399
|
_teardownPortal() {
|
|
405
|
-
|
|
406
|
-
if ((e = this._contentObserver) == null || e.disconnect(), this._contentObserver = null, (t = this._layer) == null || t.destroy(), this._layer = null, (r = this._positioner) == null || r.destroy(), this._positioner = null, this._panelEl = null, (o = this._portalEl) != null && o.parentElement)
|
|
400
|
+
if (this._contentObserver?.disconnect(), this._contentObserver = null, this._layer?.destroy(), this._layer = null, this._positioner?.destroy(), this._positioner = null, this._panelEl = null, this._portalEl?.parentElement)
|
|
407
401
|
try {
|
|
408
402
|
this._portalEl.parentElement.removeChild(this._portalEl);
|
|
409
403
|
} catch {
|
|
@@ -416,8 +410,7 @@ class m extends v {
|
|
|
416
410
|
}));
|
|
417
411
|
}
|
|
418
412
|
_observeContent() {
|
|
419
|
-
|
|
420
|
-
(t = this._contentObserver) == null || t.disconnect(), this._contentObserver = null;
|
|
413
|
+
this._contentObserver?.disconnect(), this._contentObserver = null;
|
|
421
414
|
const e = this._getContentSource();
|
|
422
415
|
!e || typeof MutationObserver > "u" || (this._contentObserver = new MutationObserver(() => this._schedulePortalSync()), this._contentObserver.observe(e, {
|
|
423
416
|
attributes: !0,
|
|
@@ -427,16 +420,14 @@ class m extends v {
|
|
|
427
420
|
}));
|
|
428
421
|
}
|
|
429
422
|
_observeHost() {
|
|
430
|
-
|
|
431
|
-
(e = this._hostObserver) == null || e.disconnect(), this._hostObserver = null, !(typeof MutationObserver > "u") && (this._hostObserver = new MutationObserver(() => this._schedulePortalSync()), this._hostObserver.observe(this, {
|
|
423
|
+
this._hostObserver?.disconnect(), this._hostObserver = null, !(typeof MutationObserver > "u") && (this._hostObserver = new MutationObserver(() => this._schedulePortalSync()), this._hostObserver.observe(this, {
|
|
432
424
|
childList: !0,
|
|
433
425
|
subtree: !1
|
|
434
426
|
}));
|
|
435
427
|
}
|
|
436
428
|
_mountPortal() {
|
|
437
429
|
const e = this._getTrigger();
|
|
438
|
-
if (!e)
|
|
439
|
-
return;
|
|
430
|
+
if (!e) return;
|
|
440
431
|
this._teardownPortal(), this._portalEl = this._buildPortalContent();
|
|
441
432
|
const t = h();
|
|
442
433
|
t && (t.appendChild(this._portalEl), this._observeContent(), this._positioner = b({
|
|
@@ -450,10 +441,9 @@ class m extends v {
|
|
|
450
441
|
}), this._syncDismissableLayer());
|
|
451
442
|
}
|
|
452
443
|
_syncOpenState() {
|
|
453
|
-
var i;
|
|
454
444
|
const e = this.hasAttribute("open");
|
|
455
445
|
if (e === this._isOpen) {
|
|
456
|
-
e && (!this._portalEl || !this._portalEl.isConnected ? this._mountPortal() :
|
|
446
|
+
e && (!this._portalEl || !this._portalEl.isConnected ? this._mountPortal() : this._positioner?.update());
|
|
457
447
|
return;
|
|
458
448
|
}
|
|
459
449
|
if (this._isOpen = e, e) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const C=require("./positioner-D_fqyx_j.js");function H(a="ui-portal-root"){if(typeof document>"u")return null;let e=document.getElementById(a);return e||(e=document.createElement("div"),e.id=a,e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="0",e.style.pointerEvents="none",e.style.zIndex="var(--ui-portal-z, 1600)",document.body.appendChild(e)),e.style.zIndex||(e.style.zIndex="var(--ui-portal-z, 1600)"),e}function x(a,e,l="top"){const t=typeof l=="string"?{placement:l}:l,r=e instanceof HTMLElement?e:typeof e.getBoundingClientRect=="function"?e.getBoundingClientRect():e,n=C.computePositionState(a,r,{placement:t.placement||"top",strategy:t.strategy||"fixed",offset:typeof t.offset=="number"?t.offset:8,flip:t.flip,shift:t.shift,arrow:t.arrow??null,boundary:t.boundary??null,boundaryPadding:t.boundaryPadding,dir:t.dir,autoPlacement:t.autoPlacement,allowedPlacements:t.allowedPlacements,fallbackPlacements:t.fallbackPlacements,inline:t.inline,hideWhenDetached:t.hideWhenDetached}),d=a.getBoundingClientRect(),m=n.middlewareData?.arrow?.x??Math.round(d.left+d.width/2-n.x),h=n.middlewareData?.arrow?.y??Math.round(d.top+d.height/2-n.y);return{top:n.y,left:n.x,placement:n.placement,x:m,y:h,strategy:n.strategy,availableWidth:n.availableWidth,availableHeight:n.availableHeight,middlewareData:n.middlewareData,referenceHidden:n.referenceHidden,escaped:n.escaped}}function M(a,e,l,t={}){return C.autoUpdatePositioner(a,e,l,t)}function D(a,e,l="top"){const t=typeof l=="string"?{placement:l}:l,r=t.placement||"top",n=typeof t.offset=="number"?t.offset:8,d=t.flip!==!1,m=!!t.shift,h=H();if(!h)return;e.style.position="absolute",e.style.pointerEvents="auto",h.appendChild(e);let P=()=>{};function W(f,y,c){const o=t.arrow||e.querySelector(".arrow");if(!o)return;const i=a.getBoundingClientRect(),g=i.left+i.width/2,w=i.top+i.height/2;if(c==="top"||c==="bottom"){const u=g-y,s=8,p=e.offsetWidth-8,b=Math.max(s,Math.min(p,u));o.style.left=`${Math.round(b)}px`,o.style.top=""}else{const u=w-f,s=8,p=e.offsetHeight-8,b=Math.max(s,Math.min(p,u));o.style.top=`${Math.round(b)}px`,o.style.left=""}}function v(){if(a&&typeof a.getBoundingClientRect=="function"&&a instanceof HTMLElement){const i=a,g=i.getRootNode?.(),w=g instanceof ShadowRoot?g.host:null,u=i.isConnected||document.body.contains(i)||(w?document.body.contains(w):!1),s=window.getComputedStyle(i),p=s.display!=="none"&&s.visibility!=="hidden"&&parseFloat(s.opacity||"1")>0;if(!u||!p){try{e.parentElement&&e.parentElement.removeChild(e)}catch{}P();return}}const f=x(a,e,{placement:r,offset:n,flip:d,shift:m,strategy:t.strategy||"fixed",boundary:t.boundary??null,boundaryPadding:t.boundaryPadding,dir:t.dir,autoPlacement:t.autoPlacement,allowedPlacements:t.allowedPlacements,fallbackPlacements:t.fallbackPlacements,inline:t.inline,hideWhenDetached:t.hideWhenDetached,arrow:t.arrow??null}),y=window.innerWidth||document.documentElement.clientWidth,c=window.innerHeight||document.documentElement.clientHeight;let o=f;d&&(f.top<0&&r==="top"||f.top+e.offsetHeight>c&&r==="bottom")&&(o=x(a,e,{placement:r==="top"?"bottom":"top",offset:n,flip:d,shift:m,strategy:t.strategy||"fixed",boundary:t.boundary??null,boundaryPadding:t.boundaryPadding,dir:t.dir,autoPlacement:t.autoPlacement,allowedPlacements:t.allowedPlacements,fallbackPlacements:t.fallbackPlacements,inline:t.inline,hideWhenDetached:t.hideWhenDetached,arrow:t.arrow??null})),o.left<4&&(o.left=4),o.left+e.offsetWidth>y-4&&(o.left=y-e.offsetWidth-4),o.top<4&&(o.top=4),o.top+e.offsetHeight>c-4&&(o.top=c-e.offsetHeight-4),e.style.top=`${Math.round(o.top)}px`,e.style.left=`${Math.round(o.left)}px`,W(o.top,o.left,o.placement),e.setAttribute("data-placement",o.placement)}return v(),P=M(a,e,v),()=>{try{e.parentElement&&e.parentElement.removeChild(e)}catch{}P()}}exports.autoUpdatePosition=M;exports.computePosition=x;exports.createPortalContainer=H;exports.showPortalFor=D;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as H, c as M } from "./positioner-D0VGxtYU.mjs";
|
|
2
2
|
function W(a = "ui-portal-root") {
|
|
3
|
-
if (typeof document > "u")
|
|
4
|
-
return null;
|
|
3
|
+
if (typeof document > "u") return null;
|
|
5
4
|
let e = document.getElementById(a);
|
|
6
5
|
return e || (e = document.createElement("div"), e.id = a, e.style.position = "fixed", e.style.top = "0", e.style.left = "0", e.style.width = "100%", e.style.height = "0", e.style.pointerEvents = "none", e.style.zIndex = "var(--ui-portal-z, 1600)", document.body.appendChild(e)), e.style.zIndex || (e.style.zIndex = "var(--ui-portal-z, 1600)"), e;
|
|
7
6
|
}
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
const t = typeof i == "string" ? { placement: i } : i, c = e instanceof HTMLElement ? e : typeof e.getBoundingClientRect == "function" ? e.getBoundingClientRect() : e, n = H(a, c, {
|
|
7
|
+
function v(a, e, l = "top") {
|
|
8
|
+
const t = typeof l == "string" ? { placement: l } : l, r = e instanceof HTMLElement ? e : typeof e.getBoundingClientRect == "function" ? e.getBoundingClientRect() : e, n = M(a, r, {
|
|
11
9
|
placement: t.placement || "top",
|
|
12
10
|
strategy: t.strategy || "fixed",
|
|
13
11
|
offset: typeof t.offset == "number" ? t.offset : 8,
|
|
@@ -22,13 +20,13 @@ function C(a, e, i = "top") {
|
|
|
22
20
|
fallbackPlacements: t.fallbackPlacements,
|
|
23
21
|
inline: t.inline,
|
|
24
22
|
hideWhenDetached: t.hideWhenDetached
|
|
25
|
-
}),
|
|
23
|
+
}), s = a.getBoundingClientRect(), m = n.middlewareData?.arrow?.x ?? Math.round(s.left + s.width / 2 - n.x), h = n.middlewareData?.arrow?.y ?? Math.round(s.top + s.height / 2 - n.y);
|
|
26
24
|
return {
|
|
27
25
|
top: n.y,
|
|
28
26
|
left: n.x,
|
|
29
27
|
placement: n.placement,
|
|
30
|
-
x:
|
|
31
|
-
y:
|
|
28
|
+
x: m,
|
|
29
|
+
y: h,
|
|
32
30
|
strategy: n.strategy,
|
|
33
31
|
availableWidth: n.availableWidth,
|
|
34
32
|
availableHeight: n.availableHeight,
|
|
@@ -37,47 +35,44 @@ function C(a, e, i = "top") {
|
|
|
37
35
|
escaped: n.escaped
|
|
38
36
|
};
|
|
39
37
|
}
|
|
40
|
-
function D(a, e,
|
|
41
|
-
return
|
|
38
|
+
function D(a, e, l, t = {}) {
|
|
39
|
+
return H(a, e, l, t);
|
|
42
40
|
}
|
|
43
|
-
function
|
|
44
|
-
const t = typeof
|
|
45
|
-
if (!
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
let p = () => {
|
|
41
|
+
function k(a, e, l = "top") {
|
|
42
|
+
const t = typeof l == "string" ? { placement: l } : l, r = t.placement || "top", n = typeof t.offset == "number" ? t.offset : 8, s = t.flip !== !1, m = !!t.shift, h = W();
|
|
43
|
+
if (!h) return;
|
|
44
|
+
e.style.position = "absolute", e.style.pointerEvents = "auto", h.appendChild(e);
|
|
45
|
+
let P = () => {
|
|
49
46
|
};
|
|
50
|
-
function
|
|
47
|
+
function C(f, y, c) {
|
|
51
48
|
const o = t.arrow || e.querySelector(".arrow");
|
|
52
|
-
if (!o)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
o.style.left = `${Math.round(g)}px`, o.style.top = "";
|
|
49
|
+
if (!o) return;
|
|
50
|
+
const i = a.getBoundingClientRect(), g = i.left + i.width / 2, w = i.top + i.height / 2;
|
|
51
|
+
if (c === "top" || c === "bottom") {
|
|
52
|
+
const p = g - y, d = 8, u = e.offsetWidth - 8, b = Math.max(d, Math.min(u, p));
|
|
53
|
+
o.style.left = `${Math.round(b)}px`, o.style.top = "";
|
|
58
54
|
} else {
|
|
59
|
-
const
|
|
60
|
-
o.style.top = `${Math.round(
|
|
55
|
+
const p = w - f, d = 8, u = e.offsetHeight - 8, b = Math.max(d, Math.min(u, p));
|
|
56
|
+
o.style.top = `${Math.round(b)}px`, o.style.left = "";
|
|
61
57
|
}
|
|
62
58
|
}
|
|
63
|
-
function
|
|
64
|
-
var r;
|
|
59
|
+
function x() {
|
|
65
60
|
if (a && typeof a.getBoundingClientRect == "function" && a instanceof HTMLElement) {
|
|
66
|
-
const
|
|
67
|
-
if (!
|
|
61
|
+
const i = a, g = i.getRootNode?.(), w = g instanceof ShadowRoot ? g.host : null, p = i.isConnected || document.body.contains(i) || (w ? document.body.contains(w) : !1), d = window.getComputedStyle(i), u = d.display !== "none" && d.visibility !== "hidden" && parseFloat(d.opacity || "1") > 0;
|
|
62
|
+
if (!p || !u) {
|
|
68
63
|
try {
|
|
69
64
|
e.parentElement && e.parentElement.removeChild(e);
|
|
70
65
|
} catch {
|
|
71
66
|
}
|
|
72
|
-
|
|
67
|
+
P();
|
|
73
68
|
return;
|
|
74
69
|
}
|
|
75
70
|
}
|
|
76
|
-
const
|
|
77
|
-
placement:
|
|
71
|
+
const f = v(a, e, {
|
|
72
|
+
placement: r,
|
|
78
73
|
offset: n,
|
|
79
|
-
flip:
|
|
80
|
-
shift:
|
|
74
|
+
flip: s,
|
|
75
|
+
shift: m,
|
|
81
76
|
strategy: t.strategy || "fixed",
|
|
82
77
|
boundary: t.boundary ?? null,
|
|
83
78
|
boundaryPadding: t.boundaryPadding,
|
|
@@ -88,13 +83,13 @@ function B(a, e, i = "top") {
|
|
|
88
83
|
inline: t.inline,
|
|
89
84
|
hideWhenDetached: t.hideWhenDetached,
|
|
90
85
|
arrow: t.arrow ?? null
|
|
91
|
-
}),
|
|
92
|
-
let o =
|
|
93
|
-
|
|
94
|
-
placement:
|
|
86
|
+
}), y = window.innerWidth || document.documentElement.clientWidth, c = window.innerHeight || document.documentElement.clientHeight;
|
|
87
|
+
let o = f;
|
|
88
|
+
s && (f.top < 0 && r === "top" || f.top + e.offsetHeight > c && r === "bottom") && (o = v(a, e, {
|
|
89
|
+
placement: r === "top" ? "bottom" : "top",
|
|
95
90
|
offset: n,
|
|
96
|
-
flip:
|
|
97
|
-
shift:
|
|
91
|
+
flip: s,
|
|
92
|
+
shift: m,
|
|
98
93
|
strategy: t.strategy || "fixed",
|
|
99
94
|
boundary: t.boundary ?? null,
|
|
100
95
|
boundaryPadding: t.boundaryPadding,
|
|
@@ -105,19 +100,19 @@ function B(a, e, i = "top") {
|
|
|
105
100
|
inline: t.inline,
|
|
106
101
|
hideWhenDetached: t.hideWhenDetached,
|
|
107
102
|
arrow: t.arrow ?? null
|
|
108
|
-
})), o.left < 4 && (o.left = 4), o.left + e.offsetWidth >
|
|
103
|
+
})), o.left < 4 && (o.left = 4), o.left + e.offsetWidth > y - 4 && (o.left = y - e.offsetWidth - 4), o.top < 4 && (o.top = 4), o.top + e.offsetHeight > c - 4 && (o.top = c - e.offsetHeight - 4), e.style.top = `${Math.round(o.top)}px`, e.style.left = `${Math.round(o.left)}px`, C(o.top, o.left, o.placement), e.setAttribute("data-placement", o.placement);
|
|
109
104
|
}
|
|
110
|
-
return
|
|
105
|
+
return x(), P = D(a, e, x), () => {
|
|
111
106
|
try {
|
|
112
107
|
e.parentElement && e.parentElement.removeChild(e);
|
|
113
108
|
} catch {
|
|
114
109
|
}
|
|
115
|
-
|
|
110
|
+
P();
|
|
116
111
|
};
|
|
117
112
|
}
|
|
118
113
|
export {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
114
|
+
D as a,
|
|
115
|
+
W as b,
|
|
116
|
+
v as c,
|
|
117
|
+
k as s
|
|
123
118
|
};
|
package/dist/portal.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("./ElementBase-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("./ElementBase-EV6mVBUV.js"),l=require("./selector-BvAh35ve.js"),a=`
|
|
2
2
|
:host {
|
|
3
3
|
display: contents;
|
|
4
4
|
color-scheme: light dark;
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
--ui-portal-color: CanvasText;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
`;function
|
|
35
|
-
<style>${
|
|
34
|
+
`;function h(r){return r==="prepend"?"prepend":"append"}function u(r){return r.nodeType===Node.ELEMENT_NODE?!0:r.nodeType===Node.TEXT_NODE?!!r.textContent?.trim():!1}function c(r){return r.nodeType===Node.ELEMENT_NODE||r.nodeType===Node.TEXT_NODE}class n extends o.ElementBase{constructor(){super(),this._headless=!1,this._strategy="append",this._target=null,this._slot=null,this._entries=[],this._syncing=!1,this._guardTimer=null,this._targetObserver=null,this._pendingSlotSync=!1,this._onSlotChange=this._onSlotChange.bind(this),this._onTargetMutations=this._onTargetMutations.bind(this)}static get observedAttributes(){return["target","headless","strategy","disabled"]}connectedCallback(){super.connectedCallback(),this._syncConfig(),this._mountAllFromSlot()}disconnectedCallback(){this._guardTimer!=null&&(window.clearTimeout(this._guardTimer),this._guardTimer=null),this._slot&&(this._slot.removeEventListener("slotchange",this._onSlotChange),this._slot=null),this._disconnectTargetObserver(),this._restoreAll(),super.disconnectedCallback()}attributeChangedCallback(t,e,s){if(e!==s){if(this._syncConfig(),this._headless){this._restoreAll();return}(t==="target"||t==="strategy"||t==="disabled"||t==="headless")&&this._moveAllToTarget()}}_syncConfig(){this._headless=this.hasAttribute("headless")||this.hasAttribute("disabled"),this._strategy=h(this.getAttribute("strategy")),this._target=this._resolveTarget(),this._connectTargetObserver()}_resolveTarget(){const t=this.getAttribute("target");if(t){const e=l.safeQuerySelector(document,t);if(e instanceof HTMLElement)return e;this.dispatchEvent(new CustomEvent("target-missing",{detail:{target:t},bubbles:!0}))}return document.body}_connectTargetObserver(){this._disconnectTargetObserver(),!(!this._target||typeof MutationObserver>"u")&&(this._targetObserver=new MutationObserver(this._onTargetMutations),this._targetObserver.observe(this._target,{childList:!0,subtree:!0}))}_disconnectTargetObserver(){this._targetObserver&&(this._targetObserver.disconnect(),this._targetObserver=null)}_onTargetMutations(){if(this._syncing)return;let t=!1;this._entries=this._entries.filter(e=>{if(e.node.isConnected)return!0;try{e.anchor.parentNode&&e.anchor.parentNode.removeChild(e.anchor)}catch{}return t=!0,!1}),t&&this.dispatchEvent(new CustomEvent("sync",{detail:{count:this._entries.length},bubbles:!0}))}_beginSync(){this._syncing=!0,this._guardTimer!=null&&window.clearTimeout(this._guardTimer),this._guardTimer=window.setTimeout(()=>{this._syncing=!1,this._guardTimer=null,this._pendingSlotSync&&(this._pendingSlotSync=!1,this._mountAllFromSlot())},0)}_findEntry(t){return this._entries.find(e=>e.node===t)}_portalNode(t){if(!this._target||this._headless||!c(t)||this._findEntry(t)||!this.contains(t))return;const e=document.createComment("ui-portal-anchor"),s=t.parentNode;s&&(this._beginSync(),s.insertBefore(e,t),this._strategy==="prepend"?this._target.insertBefore(t,this._target.firstChild):this._target.appendChild(t),this._entries.push({node:t,anchor:e}))}_restoreEntry(t){const{node:e,anchor:s}=t;this._beginSync(),s.parentNode&&(s.parentNode.insertBefore(e,s),s.parentNode.removeChild(s))}_restoreAll(){if(!this._entries.length)return;const t=[...this._entries];this._entries=[],t.forEach(e=>this._restoreEntry(e)),this.dispatchEvent(new CustomEvent("unmount",{detail:{count:t.length},bubbles:!0}))}_moveAllToTarget(){if(this._headless){this._restoreAll();return}const t=[...this._entries];this._entries=[],t.forEach(e=>{const s=e.anchor,i=e.node;s.parentNode&&(this._beginSync(),this._strategy==="prepend"?this._target.insertBefore(i,this._target.firstChild):this._target.appendChild(i),this._entries.push({node:i,anchor:s}))}),this.dispatchEvent(new CustomEvent("mount",{detail:{count:this._entries.length},bubbles:!0}))}_mountAllFromSlot(){if(this._headless)return;const t=this._slot||this.root.querySelector("slot");if(!t)return;const e=t.assignedNodes({flatten:!0}).filter(s=>u(s));e.forEach(s=>this._portalNode(s)),e.length&&this.dispatchEvent(new CustomEvent("mount",{detail:{count:this._entries.length},bubbles:!0}))}_pruneDetachedEntries(){this._entries.length&&(this._entries=this._entries.filter(t=>{if(t.node.isConnected)return!0;try{t.anchor.parentNode&&t.anchor.parentNode.removeChild(t.anchor)}catch{}return!1}))}_onSlotChange(){if(!this._headless){if(this._syncing){this._pendingSlotSync=!0;return}this._pruneDetachedEntries(),this._mountAllFromSlot()}}render(){this.setContent(`
|
|
35
|
+
<style>${a}</style>
|
|
36
36
|
<div class="source" part="source">
|
|
37
37
|
<slot></slot>
|
|
38
38
|
</div>
|
package/dist/portal.esm.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { E as n } from "./ElementBase-
|
|
2
|
-
|
|
1
|
+
import { E as n } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
|
+
import { s as o } from "./selector-WI8pD7YO.mjs";
|
|
3
|
+
const a = `
|
|
3
4
|
:host {
|
|
4
5
|
display: contents;
|
|
5
6
|
color-scheme: light dark;
|
|
@@ -36,14 +37,13 @@ const o = `
|
|
|
36
37
|
function l(r) {
|
|
37
38
|
return r === "prepend" ? "prepend" : "append";
|
|
38
39
|
}
|
|
39
|
-
function a(r) {
|
|
40
|
-
var t;
|
|
41
|
-
return r.nodeType === Node.ELEMENT_NODE ? !0 : r.nodeType === Node.TEXT_NODE ? !!((t = r.textContent) != null && t.trim()) : !1;
|
|
42
|
-
}
|
|
43
40
|
function h(r) {
|
|
41
|
+
return r.nodeType === Node.ELEMENT_NODE ? !0 : r.nodeType === Node.TEXT_NODE ? !!r.textContent?.trim() : !1;
|
|
42
|
+
}
|
|
43
|
+
function u(r) {
|
|
44
44
|
return r.nodeType === Node.ELEMENT_NODE || r.nodeType === Node.TEXT_NODE;
|
|
45
45
|
}
|
|
46
|
-
class
|
|
46
|
+
class c extends n {
|
|
47
47
|
constructor() {
|
|
48
48
|
super(), this._headless = !1, this._strategy = "append", this._target = null, this._slot = null, this._entries = [], this._syncing = !1, this._guardTimer = null, this._targetObserver = null, this._pendingSlotSync = !1, this._onSlotChange = this._onSlotChange.bind(this), this._onTargetMutations = this._onTargetMutations.bind(this);
|
|
49
49
|
}
|
|
@@ -71,9 +71,8 @@ class u extends n {
|
|
|
71
71
|
_resolveTarget() {
|
|
72
72
|
const t = this.getAttribute("target");
|
|
73
73
|
if (t) {
|
|
74
|
-
const e = document
|
|
75
|
-
if (e instanceof HTMLElement)
|
|
76
|
-
return e;
|
|
74
|
+
const e = o(document, t);
|
|
75
|
+
if (e instanceof HTMLElement) return e;
|
|
77
76
|
this.dispatchEvent(
|
|
78
77
|
new CustomEvent("target-missing", {
|
|
79
78
|
detail: { target: t },
|
|
@@ -90,12 +89,10 @@ class u extends n {
|
|
|
90
89
|
this._targetObserver && (this._targetObserver.disconnect(), this._targetObserver = null);
|
|
91
90
|
}
|
|
92
91
|
_onTargetMutations() {
|
|
93
|
-
if (this._syncing)
|
|
94
|
-
return;
|
|
92
|
+
if (this._syncing) return;
|
|
95
93
|
let t = !1;
|
|
96
94
|
this._entries = this._entries.filter((e) => {
|
|
97
|
-
if (e.node.isConnected)
|
|
98
|
-
return !0;
|
|
95
|
+
if (e.node.isConnected) return !0;
|
|
99
96
|
try {
|
|
100
97
|
e.anchor.parentNode && e.anchor.parentNode.removeChild(e.anchor);
|
|
101
98
|
} catch {
|
|
@@ -112,8 +109,7 @@ class u extends n {
|
|
|
112
109
|
return this._entries.find((e) => e.node === t);
|
|
113
110
|
}
|
|
114
111
|
_portalNode(t) {
|
|
115
|
-
if (!this._target || this._headless || !
|
|
116
|
-
return;
|
|
112
|
+
if (!this._target || this._headless || !u(t) || this._findEntry(t) || !this.contains(t)) return;
|
|
117
113
|
const e = document.createComment("ui-portal-anchor"), s = t.parentNode;
|
|
118
114
|
s && (this._beginSync(), s.insertBefore(e, t), this._strategy === "prepend" ? this._target.insertBefore(t, this._target.firstChild) : this._target.appendChild(t), this._entries.push({ node: t, anchor: e }));
|
|
119
115
|
}
|
|
@@ -122,8 +118,7 @@ class u extends n {
|
|
|
122
118
|
this._beginSync(), s.parentNode && (s.parentNode.insertBefore(e, s), s.parentNode.removeChild(s));
|
|
123
119
|
}
|
|
124
120
|
_restoreAll() {
|
|
125
|
-
if (!this._entries.length)
|
|
126
|
-
return;
|
|
121
|
+
if (!this._entries.length) return;
|
|
127
122
|
const t = [...this._entries];
|
|
128
123
|
this._entries = [], t.forEach((e) => this._restoreEntry(e)), this.dispatchEvent(new CustomEvent("unmount", { detail: { count: t.length }, bubbles: !0 }));
|
|
129
124
|
}
|
|
@@ -139,18 +134,15 @@ class u extends n {
|
|
|
139
134
|
}), this.dispatchEvent(new CustomEvent("mount", { detail: { count: this._entries.length }, bubbles: !0 }));
|
|
140
135
|
}
|
|
141
136
|
_mountAllFromSlot() {
|
|
142
|
-
if (this._headless)
|
|
143
|
-
return;
|
|
137
|
+
if (this._headless) return;
|
|
144
138
|
const t = this._slot || this.root.querySelector("slot");
|
|
145
|
-
if (!t)
|
|
146
|
-
|
|
147
|
-
const e = t.assignedNodes({ flatten: !0 }).filter((s) => a(s));
|
|
139
|
+
if (!t) return;
|
|
140
|
+
const e = t.assignedNodes({ flatten: !0 }).filter((s) => h(s));
|
|
148
141
|
e.forEach((s) => this._portalNode(s)), e.length && this.dispatchEvent(new CustomEvent("mount", { detail: { count: this._entries.length }, bubbles: !0 }));
|
|
149
142
|
}
|
|
150
143
|
_pruneDetachedEntries() {
|
|
151
144
|
this._entries.length && (this._entries = this._entries.filter((t) => {
|
|
152
|
-
if (t.node.isConnected)
|
|
153
|
-
return !0;
|
|
145
|
+
if (t.node.isConnected) return !0;
|
|
154
146
|
try {
|
|
155
147
|
t.anchor.parentNode && t.anchor.parentNode.removeChild(t.anchor);
|
|
156
148
|
} catch {
|
|
@@ -169,7 +161,7 @@ class u extends n {
|
|
|
169
161
|
}
|
|
170
162
|
render() {
|
|
171
163
|
this.setContent(`
|
|
172
|
-
<style>${
|
|
164
|
+
<style>${a}</style>
|
|
173
165
|
<div class="source" part="source">
|
|
174
166
|
<slot></slot>
|
|
175
167
|
</div>
|
|
@@ -181,7 +173,7 @@ class u extends n {
|
|
|
181
173
|
return !1;
|
|
182
174
|
}
|
|
183
175
|
}
|
|
184
|
-
typeof customElements < "u" && !customElements.get("ui-portal") && customElements.define("ui-portal",
|
|
176
|
+
typeof customElements < "u" && !customElements.get("ui-portal") && customElements.define("ui-portal", c);
|
|
185
177
|
export {
|
|
186
|
-
|
|
178
|
+
c as UIPortal
|
|
187
179
|
};
|