@editora/ui-core 0.1.25 → 0.2.1
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 +132 -0
- package/dist/accordion.cjs.js +13 -12
- package/dist/accordion.esm.js +13 -12
- package/dist/alert-dialog.cjs.js +92 -53
- package/dist/alert-dialog.esm.js +211 -159
- package/dist/alert.cjs.js +42 -33
- package/dist/alert.esm.js +80 -71
- package/dist/animated-beam.cjs.js +42 -50
- package/dist/animated-beam.esm.js +47 -55
- package/dist/animated-list.cjs.js +11 -27
- package/dist/animated-list.esm.js +12 -28
- package/dist/animated-text.cjs.js +9 -9
- package/dist/animated-text.esm.js +9 -9
- package/dist/app-header.cjs.js +17 -12
- package/dist/app-header.esm.js +18 -13
- package/dist/aspect-ratio.cjs.js +10 -12
- package/dist/aspect-ratio.esm.js +11 -13
- package/dist/avatar.cjs.js +16 -20
- package/dist/avatar.esm.js +16 -20
- package/dist/badge.cjs.js +27 -22
- package/dist/badge.esm.js +32 -27
- package/dist/block-controls.cjs.js +11 -12
- package/dist/block-controls.esm.js +8 -9
- package/dist/box.cjs.js +2 -3
- package/dist/box.esm.js +2 -3
- package/dist/breadcrumb.cjs.js +12 -18
- package/dist/breadcrumb.esm.js +11 -17
- package/dist/button.cjs.js +1 -1
- package/dist/button.esm.js +1 -1
- package/dist/{calendar-D-mXMgqc.js → calendar-CzpWDxLc.js} +56 -46
- package/dist/{calendar-B3PUKHQm.mjs → calendar-DkSDFg33.mjs} +127 -117
- package/dist/calendar.cjs.js +1 -1
- package/dist/calendar.esm.js +1 -1
- package/dist/card.cjs.js +6 -7
- package/dist/card.esm.js +5 -6
- package/dist/chart.cjs.js +58 -52
- package/dist/chart.esm.js +101 -95
- package/dist/checkbox.cjs.js +19 -15
- package/dist/checkbox.esm.js +19 -15
- package/dist/collapsible.cjs.js +9 -13
- package/dist/collapsible.esm.js +9 -13
- package/dist/color-picker.cjs.js +38 -19
- package/dist/color-picker.esm.js +134 -115
- package/dist/combobox.cjs.js +60 -57
- package/dist/combobox.esm.js +96 -92
- package/dist/command-palette.cjs.js +1 -0
- package/dist/command-palette.esm.js +1 -0
- package/dist/command.cjs.js +32 -14
- package/dist/command.esm.js +46 -28
- package/dist/components/date-time-utils.d.ts.map +1 -1
- package/dist/components/ui-accordion.d.ts.map +1 -1
- package/dist/components/ui-alert-dialog.d.ts +2 -0
- package/dist/components/ui-alert-dialog.d.ts.map +1 -1
- package/dist/components/ui-alert.d.ts.map +1 -1
- package/dist/components/ui-animated-beam.d.ts.map +1 -1
- package/dist/components/ui-animated-list.d.ts.map +1 -1
- package/dist/components/ui-app-header.d.ts.map +1 -1
- package/dist/components/ui-aspect-ratio.d.ts.map +1 -1
- package/dist/components/ui-avatar.d.ts.map +1 -1
- package/dist/components/ui-badge.d.ts.map +1 -1
- package/dist/components/ui-block-controls.d.ts.map +1 -1
- package/dist/components/ui-box.d.ts.map +1 -1
- package/dist/components/ui-breadcrumb.d.ts.map +1 -1
- package/dist/components/ui-button.d.ts.map +1 -1
- package/dist/components/ui-calendar.d.ts.map +1 -1
- package/dist/components/ui-card.d.ts.map +1 -1
- package/dist/components/ui-chart.d.ts.map +1 -1
- package/dist/components/ui-checkbox.d.ts.map +1 -1
- package/dist/components/ui-collapsible.d.ts.map +1 -1
- package/dist/components/ui-color-picker.d.ts.map +1 -1
- package/dist/components/ui-combobox.d.ts.map +1 -1
- package/dist/components/ui-command-palette.d.ts.map +1 -1
- package/dist/components/ui-command.d.ts.map +1 -1
- package/dist/components/ui-container.d.ts.map +1 -1
- package/dist/components/ui-context-menu.d.ts.map +1 -1
- package/dist/components/ui-data-table.d.ts +7 -0
- package/dist/components/ui-data-table.d.ts.map +1 -1
- package/dist/components/ui-date-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-time-picker.d.ts.map +1 -1
- package/dist/components/ui-date-time-picker.d.ts.map +1 -1
- package/dist/components/ui-dialog.d.ts +2 -0
- package/dist/components/ui-dialog.d.ts.map +1 -1
- package/dist/components/ui-dock.d.ts.map +1 -1
- package/dist/components/ui-drawer.d.ts.map +1 -1
- package/dist/components/ui-dropdown.d.ts.map +1 -1
- package/dist/components/ui-empty-state.d.ts.map +1 -1
- package/dist/components/ui-field.d.ts.map +1 -1
- package/dist/components/ui-fieldset.d.ts.map +1 -1
- package/dist/components/ui-file-upload.d.ts.map +1 -1
- package/dist/components/ui-floating-toolbar.d.ts.map +1 -1
- package/dist/components/ui-form.d.ts.map +1 -1
- package/dist/components/ui-gantt.d.ts.map +1 -1
- package/dist/components/ui-hover-card.d.ts.map +1 -1
- package/dist/components/ui-icon-cloud.d.ts.map +1 -1
- package/dist/components/ui-inline-edit.d.ts.map +1 -1
- package/dist/components/ui-input.d.ts.map +1 -1
- package/dist/components/ui-marquee.d.ts.map +1 -1
- package/dist/components/ui-menu.d.ts.map +1 -1
- package/dist/components/ui-menubar.d.ts.map +1 -1
- package/dist/components/ui-meter.d.ts.map +1 -1
- package/dist/components/ui-multi-select.d.ts.map +1 -1
- package/dist/components/ui-number-field.d.ts.map +1 -1
- package/dist/components/ui-orbiter.d.ts.map +1 -1
- package/dist/components/ui-pagination.d.ts.map +1 -1
- package/dist/components/ui-password-field.d.ts.map +1 -1
- package/dist/components/ui-pin-input.d.ts.map +1 -1
- package/dist/components/ui-popover.d.ts.map +1 -1
- package/dist/components/ui-progress.d.ts.map +1 -1
- package/dist/components/ui-radio-group.d.ts.map +1 -1
- package/dist/components/ui-radio.d.ts.map +1 -1
- package/dist/components/ui-rating.d.ts +1 -0
- package/dist/components/ui-rating.d.ts.map +1 -1
- package/dist/components/ui-scroll-area.d.ts.map +1 -1
- package/dist/components/ui-section.d.ts.map +1 -1
- package/dist/components/ui-select.d.ts.map +1 -1
- package/dist/components/ui-selection-popup.d.ts.map +1 -1
- package/dist/components/ui-sidebar.d.ts.map +1 -1
- package/dist/components/ui-slider.d.ts.map +1 -1
- package/dist/components/ui-sortable.d.ts.map +1 -1
- package/dist/components/ui-spinning-text.d.ts.map +1 -1
- package/dist/components/ui-split-button.d.ts.map +1 -1
- package/dist/components/ui-splitter.d.ts.map +1 -1
- package/dist/components/ui-stepper.d.ts.map +1 -1
- package/dist/components/ui-switch.d.ts.map +1 -1
- package/dist/components/ui-tabs.d.ts.map +1 -1
- package/dist/components/ui-tags-input.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/components/ui-toggle-group.d.ts +2 -0
- package/dist/components/ui-toggle-group.d.ts.map +1 -1
- package/dist/components/ui-toggle.d.ts.map +1 -1
- package/dist/components/ui-toolbar.d.ts +2 -0
- package/dist/components/ui-toolbar.d.ts.map +1 -1
- package/dist/components/ui-tooltip.d.ts.map +1 -1
- package/dist/components/ui-transfer-list.d.ts.map +1 -1
- package/dist/components/ui-tree-item.d.ts.map +1 -1
- package/dist/components/ui-tree.d.ts.map +1 -1
- package/dist/components/ui-wizard.d.ts.map +1 -1
- package/dist/container.cjs.js +6 -12
- package/dist/container.esm.js +8 -14
- package/dist/context-menu.cjs.js +8 -8
- package/dist/context-menu.esm.js +42 -41
- package/dist/data-table.cjs.js +21 -18
- package/dist/data-table.esm.js +210 -190
- package/dist/date-field.cjs.js +9 -9
- package/dist/date-field.esm.js +19 -19
- package/dist/date-picker.cjs.js +29 -20
- package/dist/date-picker.esm.js +59 -50
- package/dist/date-range-picker.cjs.js +24 -19
- package/dist/date-range-picker.esm.js +86 -81
- package/dist/date-range-time-picker.cjs.js +27 -20
- package/dist/date-range-time-picker.esm.js +24 -17
- package/dist/date-time-picker.cjs.js +24 -17
- package/dist/date-time-picker.esm.js +89 -82
- package/dist/date-time-utils-C-4eHTyy.js +1 -0
- package/dist/{date-time-utils-BTlxnz5j.mjs → date-time-utils-zAx4ghvC.mjs} +75 -68
- package/dist/description.cjs.js +4 -4
- package/dist/description.esm.js +4 -4
- package/dist/dialog.cjs.js +59 -43
- package/dist/dialog.esm.js +86 -53
- package/dist/direction-provider.cjs.js +1 -1
- package/dist/direction-provider.esm.js +1 -1
- package/dist/dock.cjs.js +16 -30
- package/dist/dock.esm.js +26 -40
- package/dist/drawer.cjs.js +8 -12
- package/dist/drawer.esm.js +6 -10
- package/dist/dropdown.cjs.js +8 -6
- package/dist/dropdown.esm.js +33 -30
- package/dist/empty-state.cjs.js +17 -15
- package/dist/empty-state.esm.js +13 -11
- package/dist/field-error.cjs.js +1 -1
- package/dist/field-error.esm.js +7 -7
- package/dist/field.cjs.js +23 -14
- package/dist/field.esm.js +30 -21
- package/dist/fieldset.cjs.js +16 -9
- package/dist/fieldset.esm.js +19 -12
- package/dist/file-upload.cjs.js +79 -37
- package/dist/file-upload.esm.js +154 -112
- package/dist/flex.cjs.js +2 -2
- package/dist/flex.esm.js +8 -8
- package/dist/floating-toolbar.cjs.js +6 -7
- package/dist/floating-toolbar.esm.js +8 -9
- package/dist/form.cjs.js +24 -27
- package/dist/form.esm.js +24 -27
- package/dist/gantt.cjs.js +13 -11
- package/dist/gantt.esm.js +13 -11
- package/dist/grid.cjs.js +1 -1
- package/dist/grid.esm.js +1 -1
- package/dist/hover-card.cjs.js +8 -8
- package/dist/hover-card.esm.js +18 -15
- package/dist/icon-cloud.cjs.js +19 -36
- package/dist/icon-cloud.esm.js +41 -58
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +108 -104
- package/dist/inline-edit.cjs.js +50 -22
- package/dist/inline-edit.esm.js +77 -49
- package/dist/input.cjs.js +45 -38
- package/dist/input.esm.js +60 -53
- package/dist/label.cjs.js +6 -6
- package/dist/label.esm.js +6 -6
- package/dist/layout.cjs.js +3 -3
- package/dist/layout.esm.js +3 -3
- package/dist/marquee.cjs.js +7 -10
- package/dist/marquee.esm.js +7 -10
- package/dist/masonry-grid.cjs.js +2 -2
- package/dist/masonry-grid.esm.js +11 -11
- package/dist/{menu-item-styles-IGSFLAHu.mjs → menu-item-styles-CdqxPUuw.mjs} +15 -15
- package/dist/{menu-item-styles-B4onAr4C.js → menu-item-styles-DUdyjQ7i.js} +10 -10
- package/dist/menu.cjs.js +8 -24
- package/dist/menu.esm.js +52 -72
- package/dist/menubar.cjs.js +9 -31
- package/dist/menubar.esm.js +127 -153
- package/dist/meter.cjs.js +4 -9
- package/dist/meter.esm.js +6 -11
- package/dist/multi-select.cjs.js +53 -40
- package/dist/multi-select.esm.js +87 -73
- package/dist/navigation-menu.cjs.js +10 -10
- package/dist/navigation-menu.esm.js +33 -33
- package/dist/number-field.cjs.js +28 -17
- package/dist/number-field.esm.js +37 -26
- package/dist/number-ticker.cjs.js +4 -4
- package/dist/number-ticker.esm.js +10 -10
- package/dist/odometer.cjs.js +9 -9
- package/dist/odometer.esm.js +17 -17
- package/dist/orbiter.cjs.js +11 -28
- package/dist/orbiter.esm.js +28 -45
- package/dist/overlay-motion-B56x1GoY.js +49 -0
- package/dist/overlay-motion-BX3dPLay.mjs +120 -0
- package/dist/pagination.cjs.js +28 -25
- package/dist/pagination.esm.js +54 -51
- package/dist/password-field.cjs.js +39 -34
- package/dist/password-field.esm.js +63 -58
- package/dist/pin-input.cjs.js +18 -14
- package/dist/pin-input.esm.js +24 -20
- package/dist/placement-grid.cjs.js +1 -1
- package/dist/placement-grid.esm.js +1 -1
- package/dist/plugin-panel.cjs.js +1 -1
- package/dist/plugin-panel.esm.js +1 -1
- package/dist/popover.cjs.js +16 -28
- package/dist/popover.esm.js +29 -45
- package/dist/portal-DeaM1tYY.mjs +121 -0
- package/dist/portal-XbYR3m_q.js +1 -0
- package/dist/portal.cjs.js +1 -1
- package/dist/portal.d.ts +3 -1
- package/dist/portal.d.ts.map +1 -1
- package/dist/portal.esm.js +1 -1
- package/dist/{positioner-D0VGxtYU.mjs → positioner-BE8Nbho2.mjs} +5 -3
- package/dist/{positioner-D_fqyx_j.js → positioner-DZ1FW6A9.js} +1 -1
- package/dist/positioner.cjs.js +1 -1
- package/dist/positioner.esm.js +1 -1
- package/dist/presence.cjs.js +1 -1
- package/dist/presence.esm.js +1 -1
- package/dist/primitives/overlay-motion.d.ts +47 -0
- package/dist/primitives/overlay-motion.d.ts.map +1 -0
- package/dist/primitives/positioner.d.ts.map +1 -1
- package/dist/progress.cjs.js +11 -16
- package/dist/progress.esm.js +37 -42
- package/dist/quick-actions.cjs.js +14 -14
- package/dist/quick-actions.esm.js +12 -12
- package/dist/radio-group.cjs.js +50 -26
- package/dist/radio-group.esm.js +53 -29
- package/dist/radio.cjs.js +16 -13
- package/dist/radio.esm.js +16 -13
- package/dist/rating.cjs.js +11 -15
- package/dist/rating.esm.js +48 -50
- package/dist/{runtime-CFnK53iC.mjs → runtime-BRT7E4A8.mjs} +563 -531
- package/dist/runtime-CXw4SGV9.js +5 -0
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.d.ts +3 -2
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.esm.js +36 -32
- package/dist/scroll-area.cjs.js +3 -4
- package/dist/scroll-area.esm.js +3 -4
- package/dist/section.cjs.js +2 -4
- package/dist/section.esm.js +2 -4
- package/dist/select.cjs.js +42 -75
- package/dist/select.esm.js +57 -89
- package/dist/selection-popup.cjs.js +3 -4
- package/dist/selection-popup.esm.js +3 -4
- package/dist/semantic-tokens.d.ts +17 -0
- package/dist/semantic-tokens.d.ts.map +1 -0
- package/dist/separator.cjs.js +6 -6
- package/dist/separator.esm.js +7 -7
- package/dist/sidebar.cjs.js +29 -28
- package/dist/sidebar.esm.js +32 -31
- package/dist/skeleton.cjs.js +2 -2
- package/dist/skeleton.esm.js +2 -2
- package/dist/slider.cjs.js +22 -26
- package/dist/slider.esm.js +25 -29
- package/dist/slot.cjs.js +1 -1
- package/dist/slot.esm.js +1 -1
- package/dist/sortable.cjs.js +10 -11
- package/dist/sortable.esm.js +10 -11
- package/dist/spinning-text.cjs.js +4 -13
- package/dist/spinning-text.esm.js +4 -13
- package/dist/split-button.cjs.js +7 -7
- package/dist/split-button.esm.js +17 -16
- package/dist/splitter.cjs.js +52 -10
- package/dist/splitter.esm.js +55 -13
- package/dist/stepper.cjs.js +31 -65
- package/dist/stepper.esm.js +32 -66
- package/dist/switch.cjs.js +20 -22
- package/dist/switch.esm.js +20 -22
- package/dist/table.cjs.js +5 -5
- package/dist/table.esm.js +20 -20
- package/dist/tabs.cjs.js +101 -26
- package/dist/tabs.esm.js +187 -112
- package/dist/tags-input.cjs.js +43 -17
- package/dist/tags-input.esm.js +75 -49
- package/dist/textarea.cjs.js +34 -35
- package/dist/textarea.esm.js +50 -51
- package/dist/theme.d.ts +25 -1
- package/dist/theme.d.ts.map +1 -1
- package/dist/time-field.cjs.js +8 -8
- package/dist/time-field.esm.js +29 -29
- package/dist/time-picker.cjs.js +17 -14
- package/dist/time-picker.esm.js +28 -25
- package/dist/timeline.cjs.js +10 -10
- package/dist/timeline.esm.js +7 -7
- package/dist/toast.cjs.js +2 -2
- package/dist/toast.esm.js +2 -2
- package/dist/toggle-group.cjs.js +13 -13
- package/dist/toggle-group.esm.js +66 -61
- package/dist/toggle.cjs.js +52 -34
- package/dist/toggle.esm.js +80 -62
- package/dist/toolbar.cjs.js +14 -14
- package/dist/toolbar.esm.js +41 -33
- package/dist/tooltip.cjs.js +3 -3
- package/dist/tooltip.esm.js +39 -33
- package/dist/transfer-list.cjs.js +37 -38
- package/dist/transfer-list.esm.js +32 -33
- package/dist/{tree-B_oQput6.mjs → tree-33fVNnaf.mjs} +6 -5
- package/dist/{tree-SivHxcAy.js → tree-Dc02MChE.js} +6 -5
- package/dist/tree-item.cjs.js +9 -8
- package/dist/tree-item.esm.js +13 -12
- package/dist/tree.cjs.js +1 -1
- package/dist/tree.esm.js +1 -1
- package/dist/{ui-button-Co8Sid6t.mjs → ui-button-C3OmI7Sn.mjs} +152 -154
- package/dist/{ui-button-BPrzJScZ.js → ui-button-CnLwXBnx.js} +107 -109
- package/dist/wizard.cjs.js +51 -39
- package/dist/wizard.esm.js +51 -39
- package/package.json +1 -1
- package/dist/date-time-utils-y3AvNvGe.js +0 -1
- package/dist/portal-DgpQ3Jo1.js +0 -1
- package/dist/portal-bR42gHvG.mjs +0 -118
- package/dist/runtime-DwE-tizc.js +0 -1
package/dist/popover.cjs.js
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
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 f=require("./ElementBase-DxbvhLJs.js"),b=require("./portal-XbYR3m_q.js"),g=require("./dismissable-layer-DNfrKA20.js"),m=require("./positioner-DZ1FW6A9.js"),s=require("./overlay-motion-B56x1GoY.js"),_=`
|
|
2
|
+
${s.OVERLAY_MOTION_CSS}
|
|
3
|
+
|
|
2
4
|
.popover-shell {
|
|
3
5
|
--ui-popover-accent: var(--ui-color-primary, var(--ui-primary, #2563eb));
|
|
4
|
-
--ui-popover-bg:
|
|
5
|
-
linear-gradient(
|
|
6
|
-
180deg,
|
|
7
|
-
color-mix(in srgb, var(--ui-color-surface, #ffffff) 98%, transparent) 0%,
|
|
8
|
-
color-mix(in srgb, var(--ui-color-surface-elevated, #f8fafc) 24%, var(--ui-color-surface, #ffffff)) 100%
|
|
9
|
-
);
|
|
6
|
+
--ui-popover-bg: var(--color-panel-solid, var(--ui-color-surface-elevated, var(--ui-color-surface, #ffffff)));
|
|
10
7
|
--ui-popover-text: var(--ui-color-text, #0f172a);
|
|
11
8
|
--ui-popover-muted: var(--ui-color-muted, #526175);
|
|
12
|
-
--ui-popover-border-color: color-mix(in srgb, var(--ui-color-border, #cbd5e1) 70%, transparent);
|
|
9
|
+
--ui-popover-border-color: var(--ui-color-line-subtle, color-mix(in srgb, var(--ui-color-border, #cbd5e1) 70%, transparent));
|
|
13
10
|
--ui-popover-border: 1px solid var(--ui-popover-border-color);
|
|
14
|
-
--ui-popover-shadow:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
--ui-popover-radius: 14px;
|
|
18
|
-
--ui-popover-padding: 14px;
|
|
11
|
+
--ui-popover-shadow: var(--shadow-5, 0 8px 24px rgba(15, 23, 42, 0.12));
|
|
12
|
+
--ui-popover-radius: calc(var(--ui-radius, 6px) + 2px);
|
|
13
|
+
--ui-popover-padding: 16px;
|
|
19
14
|
--ui-popover-backdrop: none;
|
|
20
15
|
--ui-popover-font-size: var(--ui-default-font-size, var(--font-size-2, var(--ui-font-size-md, 14px)));
|
|
21
16
|
--ui-popover-line-height: var(--ui-default-line-height, var(--line-height-2, 20px));
|
|
@@ -24,22 +19,22 @@
|
|
|
24
19
|
|
|
25
20
|
.popover-shell[data-size="sm"],
|
|
26
21
|
.popover-shell[data-size="1"] {
|
|
27
|
-
--ui-popover-radius:
|
|
28
|
-
--ui-popover-padding:
|
|
22
|
+
--ui-popover-radius: var(--ui-radius, 6px);
|
|
23
|
+
--ui-popover-padding: 12px;
|
|
29
24
|
--ui-popover-font-size: 13px;
|
|
30
25
|
--ui-popover-line-height: 18px;
|
|
31
26
|
}
|
|
32
27
|
|
|
33
28
|
.popover-shell[data-size="md"],
|
|
34
29
|
.popover-shell[data-size="2"] {
|
|
35
|
-
--ui-popover-radius:
|
|
36
|
-
--ui-popover-padding:
|
|
30
|
+
--ui-popover-radius: calc(var(--ui-radius, 6px) + 2px);
|
|
31
|
+
--ui-popover-padding: 16px;
|
|
37
32
|
}
|
|
38
33
|
|
|
39
34
|
.popover-shell[data-size="lg"],
|
|
40
35
|
.popover-shell[data-size="3"] {
|
|
41
|
-
--ui-popover-radius:
|
|
42
|
-
--ui-popover-padding:
|
|
36
|
+
--ui-popover-radius: calc(var(--ui-radius, 6px) + 4px);
|
|
37
|
+
--ui-popover-padding: 20px;
|
|
43
38
|
--ui-popover-font-size: 15px;
|
|
44
39
|
--ui-popover-line-height: 22px;
|
|
45
40
|
}
|
|
@@ -146,16 +141,12 @@
|
|
|
146
141
|
padding: var(--ui-popover-padding);
|
|
147
142
|
box-shadow: var(--ui-popover-shadow);
|
|
148
143
|
backdrop-filter: var(--ui-popover-backdrop);
|
|
149
|
-
font:
|
|
144
|
+
font: 400 var(--ui-popover-font-size)/var(--ui-popover-line-height) var(--ui-font-family, system-ui, sans-serif);
|
|
150
145
|
letter-spacing: var(--ui-popover-letter-spacing);
|
|
151
|
-
opacity: 0;
|
|
152
|
-
transform: translateY(6px) scale(0.99);
|
|
153
|
-
transition: opacity var(--ui-motion-base, 200ms) var(--ui-motion-easing, ease), transform var(--ui-motion-base, 200ms) var(--ui-motion-easing, ease);
|
|
154
146
|
position: relative;
|
|
155
147
|
min-inline-size: min(180px, calc(100vw - 24px));
|
|
156
148
|
max-inline-size: min(360px, calc(100vw - 24px));
|
|
157
149
|
}
|
|
158
|
-
.panel.show { opacity: 1; transform: translateY(0) scale(1); }
|
|
159
150
|
|
|
160
151
|
.content {
|
|
161
152
|
display: grid;
|
|
@@ -249,9 +240,6 @@
|
|
|
249
240
|
transform: rotate(-90deg);
|
|
250
241
|
}
|
|
251
242
|
|
|
252
|
-
@media (prefers-reduced-motion: reduce) {
|
|
253
|
-
.panel { transition: none !important; transform: none !important; }
|
|
254
|
-
}
|
|
255
243
|
|
|
256
244
|
@media (prefers-contrast: more) {
|
|
257
245
|
.panel {
|
|
@@ -283,4 +271,4 @@
|
|
|
283
271
|
box-shadow: none;
|
|
284
272
|
}
|
|
285
273
|
}
|
|
286
|
-
`;class d extends
|
|
274
|
+
`;class d extends f.ElementBase{constructor(){super(),this._portalEl=null,this._panelEl=null,this._positioner=null,this._layer=null,this._isOpen=!1,this._restoreFocusEl=null,this._contentObserver=null,this._hostObserver=null,this._syncPortalScheduled=!1,this._onHostClick=this._handleHostClick.bind(this)}static get observedAttributes(){return["open","placement","offset","flip","shift","close-on-escape","close-on-outside","variant","tone","size","radius","elevation"]}attributeChangedCallback(e,t,r){if(t!==r){if(e==="open"){this._syncOpenState();return}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())}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._onHostClick),this._observeHost(),this._syncOpenState()}disconnectedCallback(){this.removeEventListener("click",this._onHostClick),this._hostObserver?.disconnect(),this._hostObserver=null,this._teardownPortal(),super.disconnectedCallback()}_handleHostClick(e){const t=this._getTrigger();if(!t)return;const r=typeof e.composedPath=="function"?e.composedPath():[],o=e.target instanceof Node?e.target:null;(r.includes(t)||o&&(t===o||t.contains(o)))&&this.toggle()}open(){this.setAttribute("open","")}close(){this.removeAttribute("open")}toggle(){this.hasAttribute("open")?this.close():this.open()}updatePosition(){this._positioner?.update()}_getTrigger(){return this.querySelector('[slot="trigger"]')}_buildPortalContent(){const e=document.createElement("div");e.className="popover-shell",e.style.pointerEvents="auto";const t=this.getAttribute("variant");t&&(e.dataset.variant=t);const r=this.getAttribute("tone");r&&(e.dataset.tone=r);const o=this.getAttribute("size");o&&(e.dataset.size=o);const a=this.getAttribute("elevation");a&&(e.dataset.elevation=a);const n=this.getAttribute("radius");if(n&&n.trim()){const l=n.trim(),h=/^-?\d+(\.\d+)?$/.test(l)?`${l}px`:l;e.style.setProperty("--ui-popover-radius",h)}const c=document.createElement("style");c.textContent=_,e.appendChild(c);const i=document.createElement("div");i.className="panel show",this._panelEl=i;const u=document.createElement("div");u.className="arrow",i.appendChild(u);const v=this.querySelector('[slot="content"]'),p=document.createElement("div");return p.className="content",v&&p.appendChild(v.cloneNode(!0)),i.appendChild(p),e.appendChild(i),e}_getContentSource(){return this.querySelector('[slot="content"]')}_placement(){const e=this.getAttribute("placement");return e||"bottom"}_offset(){const e=Number(this.getAttribute("offset"));return Number.isFinite(e)?e:8}_closeOnEscape(){return this.getAttribute("close-on-escape")!=="false"}_closeOnOutside(){return this.getAttribute("close-on-outside")!=="false"}_syncDismissableLayer(){const e=this._getTrigger();!e||!this._panelEl||(this._layer?.destroy(),this._layer=g.createDismissableLayer({node:this._panelEl,trigger:e,closeOnEscape:this._closeOnEscape(),closeOnPointerOutside:this._closeOnOutside(),onDismiss:()=>this.close()}))}_teardownPortal(e=!1){this._contentObserver?.disconnect(),this._contentObserver=null,this._layer?.destroy(),this._layer=null,this._positioner?.destroy(),this._positioner=null,this._panelEl=null,e?s.retireOverlay(this._portalEl):s.removeOverlay(this._portalEl),this._portalEl=null}_schedulePortalSync(){this._syncPortalScheduled||!this._isOpen||(this._syncPortalScheduled=!0,queueMicrotask(()=>{this._syncPortalScheduled=!1,this._isOpen&&this._mountPortal()}))}_observeContent(){this._contentObserver?.disconnect(),this._contentObserver=null;const e=this._getContentSource();!e||typeof MutationObserver>"u"||(this._contentObserver=new MutationObserver(()=>this._schedulePortalSync()),this._contentObserver.observe(e,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))}_observeHost(){this._hostObserver?.disconnect(),this._hostObserver=null,!(typeof MutationObserver>"u")&&(this._hostObserver=new MutationObserver(()=>this._schedulePortalSync()),this._hostObserver.observe(this,{childList:!0,subtree:!1}))}_mountPortal(){const e=this._getTrigger();if(!e)return;this._teardownPortal(),this._portalEl=this._buildPortalContent();const t=b.createPortalContainer();t&&(t.appendChild(this._portalEl),this._observeContent(),this._positioner=m.createPositioner({anchor:e,floating:this._portalEl,placement:this._placement(),offset:this._offset(),shift:this.getAttribute("shift")!=="false",flip:this.getAttribute("flip")!=="false",arrow:this._portalEl.querySelector(".arrow")}),s.openOverlay(this._portalEl),this._syncDismissableLayer())}_syncOpenState(){const e=this.hasAttribute("open");if(e===this._isOpen){e&&(!this._portalEl||!this._portalEl.isConnected?this._mountPortal():this._positioner?.update());return}if(this._isOpen=e,e){this._restoreFocusEl=document.activeElement instanceof HTMLElement?document.activeElement:null,this._mountPortal(),this.dispatchEvent(new CustomEvent("open",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("open-change",{detail:{open:!0},bubbles:!0,composed:!0}));return}this._teardownPortal(!0),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("open-change",{detail:{open:!1},bubbles:!0,composed:!0}));const t=this._getTrigger(),r=this._restoreFocusEl;this._restoreFocusEl=null;const o=(t&&t.isConnected?t:r)||null;if(o&&o.isConnected)try{o.focus()}catch{}}render(){this.setContent('<slot name="trigger"></slot>')}shouldRenderOnAttributeChange(e,t,r){return!1}}typeof customElements<"u"&&!customElements.get("ui-popover")&&customElements.define("ui-popover",d);exports.UIPopover=d;
|
package/dist/popover.esm.js
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
import { E as
|
|
2
|
-
import { b as h } from "./portal-
|
|
1
|
+
import { E as d } from "./ElementBase-BeZT54Hj.mjs";
|
|
2
|
+
import { b as h } from "./portal-DeaM1tYY.mjs";
|
|
3
3
|
import { c as f } from "./dismissable-layer-BmPIoK80.mjs";
|
|
4
|
-
import { e as b } from "./positioner-
|
|
5
|
-
|
|
4
|
+
import { e as b } from "./positioner-BE8Nbho2.mjs";
|
|
5
|
+
import { O as g, r as m, a as _, o as x } from "./overlay-motion-BX3dPLay.mjs";
|
|
6
|
+
const w = `
|
|
7
|
+
${g}
|
|
8
|
+
|
|
6
9
|
.popover-shell {
|
|
7
10
|
--ui-popover-accent: var(--ui-color-primary, var(--ui-primary, #2563eb));
|
|
8
|
-
--ui-popover-bg:
|
|
9
|
-
linear-gradient(
|
|
10
|
-
180deg,
|
|
11
|
-
color-mix(in srgb, var(--ui-color-surface, #ffffff) 98%, transparent) 0%,
|
|
12
|
-
color-mix(in srgb, var(--ui-color-surface-elevated, #f8fafc) 24%, var(--ui-color-surface, #ffffff)) 100%
|
|
13
|
-
);
|
|
11
|
+
--ui-popover-bg: var(--color-panel-solid, var(--ui-color-surface-elevated, var(--ui-color-surface, #ffffff)));
|
|
14
12
|
--ui-popover-text: var(--ui-color-text, #0f172a);
|
|
15
13
|
--ui-popover-muted: var(--ui-color-muted, #526175);
|
|
16
|
-
--ui-popover-border-color: color-mix(in srgb, var(--ui-color-border, #cbd5e1) 70%, transparent);
|
|
14
|
+
--ui-popover-border-color: var(--ui-color-line-subtle, color-mix(in srgb, var(--ui-color-border, #cbd5e1) 70%, transparent));
|
|
17
15
|
--ui-popover-border: 1px solid var(--ui-popover-border-color);
|
|
18
|
-
--ui-popover-shadow:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
--ui-popover-radius: 14px;
|
|
22
|
-
--ui-popover-padding: 14px;
|
|
16
|
+
--ui-popover-shadow: var(--shadow-5, 0 8px 24px rgba(15, 23, 42, 0.12));
|
|
17
|
+
--ui-popover-radius: calc(var(--ui-radius, 6px) + 2px);
|
|
18
|
+
--ui-popover-padding: 16px;
|
|
23
19
|
--ui-popover-backdrop: none;
|
|
24
20
|
--ui-popover-font-size: var(--ui-default-font-size, var(--font-size-2, var(--ui-font-size-md, 14px)));
|
|
25
21
|
--ui-popover-line-height: var(--ui-default-line-height, var(--line-height-2, 20px));
|
|
@@ -28,22 +24,22 @@ const g = `
|
|
|
28
24
|
|
|
29
25
|
.popover-shell[data-size="sm"],
|
|
30
26
|
.popover-shell[data-size="1"] {
|
|
31
|
-
--ui-popover-radius:
|
|
32
|
-
--ui-popover-padding:
|
|
27
|
+
--ui-popover-radius: var(--ui-radius, 6px);
|
|
28
|
+
--ui-popover-padding: 12px;
|
|
33
29
|
--ui-popover-font-size: 13px;
|
|
34
30
|
--ui-popover-line-height: 18px;
|
|
35
31
|
}
|
|
36
32
|
|
|
37
33
|
.popover-shell[data-size="md"],
|
|
38
34
|
.popover-shell[data-size="2"] {
|
|
39
|
-
--ui-popover-radius:
|
|
40
|
-
--ui-popover-padding:
|
|
35
|
+
--ui-popover-radius: calc(var(--ui-radius, 6px) + 2px);
|
|
36
|
+
--ui-popover-padding: 16px;
|
|
41
37
|
}
|
|
42
38
|
|
|
43
39
|
.popover-shell[data-size="lg"],
|
|
44
40
|
.popover-shell[data-size="3"] {
|
|
45
|
-
--ui-popover-radius:
|
|
46
|
-
--ui-popover-padding:
|
|
41
|
+
--ui-popover-radius: calc(var(--ui-radius, 6px) + 4px);
|
|
42
|
+
--ui-popover-padding: 20px;
|
|
47
43
|
--ui-popover-font-size: 15px;
|
|
48
44
|
--ui-popover-line-height: 22px;
|
|
49
45
|
}
|
|
@@ -150,16 +146,12 @@ const g = `
|
|
|
150
146
|
padding: var(--ui-popover-padding);
|
|
151
147
|
box-shadow: var(--ui-popover-shadow);
|
|
152
148
|
backdrop-filter: var(--ui-popover-backdrop);
|
|
153
|
-
font:
|
|
149
|
+
font: 400 var(--ui-popover-font-size)/var(--ui-popover-line-height) var(--ui-font-family, system-ui, sans-serif);
|
|
154
150
|
letter-spacing: var(--ui-popover-letter-spacing);
|
|
155
|
-
opacity: 0;
|
|
156
|
-
transform: translateY(6px) scale(0.99);
|
|
157
|
-
transition: opacity var(--ui-motion-base, 200ms) var(--ui-motion-easing, ease), transform var(--ui-motion-base, 200ms) var(--ui-motion-easing, ease);
|
|
158
151
|
position: relative;
|
|
159
152
|
min-inline-size: min(180px, calc(100vw - 24px));
|
|
160
153
|
max-inline-size: min(360px, calc(100vw - 24px));
|
|
161
154
|
}
|
|
162
|
-
.panel.show { opacity: 1; transform: translateY(0) scale(1); }
|
|
163
155
|
|
|
164
156
|
.content {
|
|
165
157
|
display: grid;
|
|
@@ -253,9 +245,6 @@ const g = `
|
|
|
253
245
|
transform: rotate(-90deg);
|
|
254
246
|
}
|
|
255
247
|
|
|
256
|
-
@media (prefers-reduced-motion: reduce) {
|
|
257
|
-
.panel { transition: none !important; transform: none !important; }
|
|
258
|
-
}
|
|
259
248
|
|
|
260
249
|
@media (prefers-contrast: more) {
|
|
261
250
|
.panel {
|
|
@@ -288,7 +277,7 @@ const g = `
|
|
|
288
277
|
}
|
|
289
278
|
}
|
|
290
279
|
`;
|
|
291
|
-
class
|
|
280
|
+
class y extends d {
|
|
292
281
|
constructor() {
|
|
293
282
|
super(), this._portalEl = null, this._panelEl = null, this._positioner = null, this._layer = null, this._isOpen = !1, this._restoreFocusEl = null, this._contentObserver = null, this._hostObserver = null, this._syncPortalScheduled = !1, this._onHostClick = this._handleHostClick.bind(this);
|
|
294
283
|
}
|
|
@@ -357,11 +346,11 @@ class m extends v {
|
|
|
357
346
|
a && (e.dataset.elevation = a);
|
|
358
347
|
const s = this.getAttribute("radius");
|
|
359
348
|
if (s && s.trim()) {
|
|
360
|
-
const p = s.trim(),
|
|
361
|
-
e.style.setProperty("--ui-popover-radius",
|
|
349
|
+
const p = s.trim(), v = /^-?\d+(\.\d+)?$/.test(p) ? `${p}px` : p;
|
|
350
|
+
e.style.setProperty("--ui-popover-radius", v);
|
|
362
351
|
}
|
|
363
352
|
const l = document.createElement("style");
|
|
364
|
-
l.textContent =
|
|
353
|
+
l.textContent = w, e.appendChild(l);
|
|
365
354
|
const i = document.createElement("div");
|
|
366
355
|
i.className = "panel show", this._panelEl = i;
|
|
367
356
|
const c = document.createElement("div");
|
|
@@ -396,13 +385,8 @@ class m extends v {
|
|
|
396
385
|
onDismiss: () => this.close()
|
|
397
386
|
}));
|
|
398
387
|
}
|
|
399
|
-
_teardownPortal() {
|
|
400
|
-
|
|
401
|
-
try {
|
|
402
|
-
this._portalEl.parentElement.removeChild(this._portalEl);
|
|
403
|
-
} catch {
|
|
404
|
-
}
|
|
405
|
-
this._portalEl = null;
|
|
388
|
+
_teardownPortal(e = !1) {
|
|
389
|
+
this._contentObserver?.disconnect(), this._contentObserver = null, this._layer?.destroy(), this._layer = null, this._positioner?.destroy(), this._positioner = null, this._panelEl = null, e ? m(this._portalEl) : _(this._portalEl), this._portalEl = null;
|
|
406
390
|
}
|
|
407
391
|
_schedulePortalSync() {
|
|
408
392
|
this._syncPortalScheduled || !this._isOpen || (this._syncPortalScheduled = !0, queueMicrotask(() => {
|
|
@@ -438,7 +422,7 @@ class m extends v {
|
|
|
438
422
|
shift: this.getAttribute("shift") !== "false",
|
|
439
423
|
flip: this.getAttribute("flip") !== "false",
|
|
440
424
|
arrow: this._portalEl.querySelector(".arrow")
|
|
441
|
-
}), this._syncDismissableLayer());
|
|
425
|
+
}), x(this._portalEl), this._syncDismissableLayer());
|
|
442
426
|
}
|
|
443
427
|
_syncOpenState() {
|
|
444
428
|
const e = this.hasAttribute("open");
|
|
@@ -450,7 +434,7 @@ class m extends v {
|
|
|
450
434
|
this._restoreFocusEl = document.activeElement instanceof HTMLElement ? document.activeElement : null, this._mountPortal(), this.dispatchEvent(new CustomEvent("open", { bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("open-change", { detail: { open: !0 }, bubbles: !0, composed: !0 }));
|
|
451
435
|
return;
|
|
452
436
|
}
|
|
453
|
-
this._teardownPortal(), this.dispatchEvent(new CustomEvent("close", { bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("open-change", { detail: { open: !1 }, bubbles: !0, composed: !0 }));
|
|
437
|
+
this._teardownPortal(!0), this.dispatchEvent(new CustomEvent("close", { bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("open-change", { detail: { open: !1 }, bubbles: !0, composed: !0 }));
|
|
454
438
|
const t = this._getTrigger(), r = this._restoreFocusEl;
|
|
455
439
|
this._restoreFocusEl = null;
|
|
456
440
|
const o = (t && t.isConnected ? t : r) || null;
|
|
@@ -467,7 +451,7 @@ class m extends v {
|
|
|
467
451
|
return !1;
|
|
468
452
|
}
|
|
469
453
|
}
|
|
470
|
-
typeof customElements < "u" && !customElements.get("ui-popover") && customElements.define("ui-popover",
|
|
454
|
+
typeof customElements < "u" && !customElements.get("ui-popover") && customElements.define("ui-popover", y);
|
|
471
455
|
export {
|
|
472
|
-
|
|
456
|
+
y as UIPopover
|
|
473
457
|
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { a as M, c as W } from "./positioner-BE8Nbho2.mjs";
|
|
2
|
+
function D(o = "ui-portal-root") {
|
|
3
|
+
if (typeof document > "u") return null;
|
|
4
|
+
let e = document.getElementById(o);
|
|
5
|
+
return e || (e = document.createElement("div"), e.id = o, 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;
|
|
6
|
+
}
|
|
7
|
+
function v(o, e, i = "top") {
|
|
8
|
+
const t = typeof i == "string" ? { placement: i } : i, f = e instanceof HTMLElement ? e : typeof e.getBoundingClientRect == "function" ? e.getBoundingClientRect() : e, n = W(o, f, {
|
|
9
|
+
placement: t.placement || "top",
|
|
10
|
+
strategy: t.strategy || "fixed",
|
|
11
|
+
offset: typeof t.offset == "number" ? t.offset : 8,
|
|
12
|
+
flip: t.flip,
|
|
13
|
+
shift: t.shift,
|
|
14
|
+
arrow: t.arrow ?? null,
|
|
15
|
+
boundary: t.boundary ?? null,
|
|
16
|
+
boundaryPadding: t.boundaryPadding,
|
|
17
|
+
dir: t.dir,
|
|
18
|
+
autoPlacement: t.autoPlacement,
|
|
19
|
+
allowedPlacements: t.allowedPlacements,
|
|
20
|
+
fallbackPlacements: t.fallbackPlacements,
|
|
21
|
+
inline: t.inline,
|
|
22
|
+
hideWhenDetached: t.hideWhenDetached
|
|
23
|
+
}), l = o.getBoundingClientRect(), g = n.middlewareData?.arrow?.x ?? Math.round(l.left + l.width / 2 - n.x), b = n.middlewareData?.arrow?.y ?? Math.round(l.top + l.height / 2 - n.y);
|
|
24
|
+
return {
|
|
25
|
+
top: n.y,
|
|
26
|
+
left: n.x,
|
|
27
|
+
placement: n.placement,
|
|
28
|
+
x: g,
|
|
29
|
+
y: b,
|
|
30
|
+
strategy: n.strategy,
|
|
31
|
+
availableWidth: n.availableWidth,
|
|
32
|
+
availableHeight: n.availableHeight,
|
|
33
|
+
middlewareData: n.middlewareData,
|
|
34
|
+
referenceHidden: n.referenceHidden,
|
|
35
|
+
escaped: n.escaped
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function R(o, e, i, t = {}) {
|
|
39
|
+
return M(o, e, i, t);
|
|
40
|
+
}
|
|
41
|
+
function S(o, e, i = "top") {
|
|
42
|
+
const t = typeof i == "string" ? { placement: i } : i, f = t.placement || "top", n = typeof t.offset == "number" ? t.offset : 8, l = t.flip !== !1, g = !!t.shift, b = D();
|
|
43
|
+
if (!b) return;
|
|
44
|
+
e.style.position = "absolute", e.style.pointerEvents = "auto", b.appendChild(e);
|
|
45
|
+
let w = () => {
|
|
46
|
+
};
|
|
47
|
+
function C(s, h, c) {
|
|
48
|
+
const a = t.arrow || e.querySelector(".arrow");
|
|
49
|
+
if (!a) return;
|
|
50
|
+
const p = o.getBoundingClientRect(), P = p.left + p.width / 2, d = p.top + p.height / 2;
|
|
51
|
+
if (c === "top" || c === "bottom") {
|
|
52
|
+
const u = P - h, m = 8, y = e.offsetWidth - 8, r = Math.max(m, Math.min(y, u));
|
|
53
|
+
a.style.left = `${Math.round(r)}px`, a.style.top = "";
|
|
54
|
+
} else {
|
|
55
|
+
const u = d - s, m = 8, y = e.offsetHeight - 8, r = Math.max(m, Math.min(y, u));
|
|
56
|
+
a.style.top = `${Math.round(r)}px`, a.style.left = "";
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function x() {
|
|
60
|
+
if (o && typeof o.getBoundingClientRect == "function" && o instanceof HTMLElement) {
|
|
61
|
+
const d = o, u = d.getRootNode?.(), m = u instanceof ShadowRoot ? u.host : null, y = d.isConnected || document.body.contains(d) || (m ? document.body.contains(m) : !1), r = window.getComputedStyle(d), H = r.display !== "none" && r.visibility !== "hidden" && parseFloat(r.opacity || "1") > 0;
|
|
62
|
+
if (!y || !H) {
|
|
63
|
+
try {
|
|
64
|
+
e.parentElement && e.parentElement.removeChild(e);
|
|
65
|
+
} catch {
|
|
66
|
+
}
|
|
67
|
+
w();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const s = v(o, e, {
|
|
72
|
+
placement: f,
|
|
73
|
+
offset: n,
|
|
74
|
+
flip: l,
|
|
75
|
+
shift: g,
|
|
76
|
+
strategy: t.strategy || "fixed",
|
|
77
|
+
boundary: t.boundary ?? null,
|
|
78
|
+
boundaryPadding: t.boundaryPadding,
|
|
79
|
+
dir: t.dir,
|
|
80
|
+
autoPlacement: t.autoPlacement,
|
|
81
|
+
allowedPlacements: t.allowedPlacements,
|
|
82
|
+
fallbackPlacements: t.fallbackPlacements,
|
|
83
|
+
inline: t.inline,
|
|
84
|
+
hideWhenDetached: t.hideWhenDetached,
|
|
85
|
+
arrow: t.arrow ?? null
|
|
86
|
+
}), h = window.innerWidth || document.documentElement.clientWidth, c = window.innerHeight || document.documentElement.clientHeight;
|
|
87
|
+
let a = s;
|
|
88
|
+
l && (s.top < 0 && f === "top" || s.top + e.offsetHeight > c && f === "bottom") && (a = v(o, e, {
|
|
89
|
+
placement: f === "top" ? "bottom" : "top",
|
|
90
|
+
offset: n,
|
|
91
|
+
flip: l,
|
|
92
|
+
shift: g,
|
|
93
|
+
strategy: t.strategy || "fixed",
|
|
94
|
+
boundary: t.boundary ?? null,
|
|
95
|
+
boundaryPadding: t.boundaryPadding,
|
|
96
|
+
dir: t.dir,
|
|
97
|
+
autoPlacement: t.autoPlacement,
|
|
98
|
+
allowedPlacements: t.allowedPlacements,
|
|
99
|
+
fallbackPlacements: t.fallbackPlacements,
|
|
100
|
+
inline: t.inline,
|
|
101
|
+
hideWhenDetached: t.hideWhenDetached,
|
|
102
|
+
arrow: t.arrow ?? null
|
|
103
|
+
})), a.left < 4 && (a.left = 4), a.left + e.offsetWidth > h - 4 && (a.left = h - e.offsetWidth - 4), a.top < 4 && (a.top = 4), a.top + e.offsetHeight > c - 4 && (a.top = c - e.offsetHeight - 4), e.style.top = `${Math.round(a.top)}px`, e.style.left = `${Math.round(a.left)}px`, C(a.top, a.left, a.placement), e.setAttribute("data-placement", a.placement);
|
|
104
|
+
const [p, P] = String(a.placement).split("-");
|
|
105
|
+
e.setAttribute("data-side", p || "bottom"), e.setAttribute("data-align", P || "center");
|
|
106
|
+
}
|
|
107
|
+
return x(), w = R(o, e, x), (s) => {
|
|
108
|
+
if (s?.remove !== !1)
|
|
109
|
+
try {
|
|
110
|
+
e.parentElement && e.parentElement.removeChild(e);
|
|
111
|
+
} catch {
|
|
112
|
+
}
|
|
113
|
+
w();
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
export {
|
|
117
|
+
R as a,
|
|
118
|
+
D as b,
|
|
119
|
+
v as c,
|
|
120
|
+
S as s
|
|
121
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const C=require("./positioner-DZ1FW6A9.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,i="top"){const t=typeof i=="string"?{placement:i}:i,f=e instanceof HTMLElement?e:typeof e.getBoundingClientRect=="function"?e.getBoundingClientRect():e,n=C.computePositionState(a,f,{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}),l=a.getBoundingClientRect(),g=n.middlewareData?.arrow?.x??Math.round(l.left+l.width/2-n.x),b=n.middlewareData?.arrow?.y??Math.round(l.top+l.height/2-n.y);return{top:n.y,left:n.x,placement:n.placement,x:g,y:b,strategy:n.strategy,availableWidth:n.availableWidth,availableHeight:n.availableHeight,middlewareData:n.middlewareData,referenceHidden:n.referenceHidden,escaped:n.escaped}}function M(a,e,i,t={}){return C.autoUpdatePositioner(a,e,i,t)}function R(a,e,i="top"){const t=typeof i=="string"?{placement:i}:i,f=t.placement||"top",n=typeof t.offset=="number"?t.offset:8,l=t.flip!==!1,g=!!t.shift,b=H();if(!b)return;e.style.position="absolute",e.style.pointerEvents="auto",b.appendChild(e);let w=()=>{};function W(s,h,c){const o=t.arrow||e.querySelector(".arrow");if(!o)return;const u=a.getBoundingClientRect(),P=u.left+u.width/2,d=u.top+u.height/2;if(c==="top"||c==="bottom"){const p=P-h,m=8,y=e.offsetWidth-8,r=Math.max(m,Math.min(y,p));o.style.left=`${Math.round(r)}px`,o.style.top=""}else{const p=d-s,m=8,y=e.offsetHeight-8,r=Math.max(m,Math.min(y,p));o.style.top=`${Math.round(r)}px`,o.style.left=""}}function v(){if(a&&typeof a.getBoundingClientRect=="function"&&a instanceof HTMLElement){const d=a,p=d.getRootNode?.(),m=p instanceof ShadowRoot?p.host:null,y=d.isConnected||document.body.contains(d)||(m?document.body.contains(m):!1),r=window.getComputedStyle(d),D=r.display!=="none"&&r.visibility!=="hidden"&&parseFloat(r.opacity||"1")>0;if(!y||!D){try{e.parentElement&&e.parentElement.removeChild(e)}catch{}w();return}}const s=x(a,e,{placement:f,offset:n,flip:l,shift:g,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}),h=window.innerWidth||document.documentElement.clientWidth,c=window.innerHeight||document.documentElement.clientHeight;let o=s;l&&(s.top<0&&f==="top"||s.top+e.offsetHeight>c&&f==="bottom")&&(o=x(a,e,{placement:f==="top"?"bottom":"top",offset:n,flip:l,shift:g,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>h-4&&(o.left=h-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);const[u,P]=String(o.placement).split("-");e.setAttribute("data-side",u||"bottom"),e.setAttribute("data-align",P||"center")}return v(),w=M(a,e,v),s=>{if(s?.remove!==!1)try{e.parentElement&&e.parentElement.removeChild(e)}catch{}w()}}exports.autoUpdatePosition=M;exports.computePosition=x;exports.createPortalContainer=H;exports.showPortalFor=R;
|
package/dist/portal.cjs.js
CHANGED
package/dist/portal.d.ts
CHANGED
|
@@ -50,5 +50,7 @@ export type ShowPortalOptions = {
|
|
|
50
50
|
hideWhenDetached?: boolean;
|
|
51
51
|
arrow?: HTMLElement | null;
|
|
52
52
|
};
|
|
53
|
-
export declare function showPortalFor(anchor: HTMLElement | VirtualElement, contentEl: HTMLElement, placementOrOptions?: Placement | ShowPortalOptions): ((
|
|
53
|
+
export declare function showPortalFor(anchor: HTMLElement | VirtualElement, contentEl: HTMLElement, placementOrOptions?: Placement | ShowPortalOptions): ((options?: {
|
|
54
|
+
remove?: boolean;
|
|
55
|
+
}) => void) | undefined;
|
|
54
56
|
//# sourceMappingURL=portal.d.ts.map
|
package/dist/portal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../src/portal.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,2BAA2B,EAChC,KAAK,mBAAmB,EACzB,MAAM,yBAAyB,CAAC;AAEjC,wBAAgB,qBAAqB,CAAC,EAAE,SAAmB,yBAiB1D;AAED,MAAM,MAAM,SAAS,GAAG,mBAAmB,CAAC;AAE5C,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAChC,QAAQ,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iBAAiB,CAAC,EAAE,SAAS,EAAE,CAAC;IAChC,kBAAkB,CAAC,EAAE,SAAS,EAAE,CAAC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAAE,qBAAqB,EAAE,MAAM,OAAO,CAAA;CAAE,CAAC;AAEtE,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,kBAAkB,GAAE,SAAS,GAAG,cAAsB;;;;;;;;;;;;EAwCjJ;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,WAAW,GAAG,cAAc,EACpC,SAAS,EAAE,WAAW,EACtB,QAAQ,EAAE,MAAM,IAAI,EACpB,OAAO,GAAE,2BAAgC,cAG1C;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAChC,QAAQ,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iBAAiB,CAAC,EAAE,SAAS,EAAE,CAAC;IAChC,kBAAkB,CAAC,EAAE,SAAS,EAAE,CAAC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,kBAAkB,GAAE,SAAS,GAAG,iBAAyB,
|
|
1
|
+
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../src/portal.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,2BAA2B,EAChC,KAAK,mBAAmB,EACzB,MAAM,yBAAyB,CAAC;AAEjC,wBAAgB,qBAAqB,CAAC,EAAE,SAAmB,yBAiB1D;AAED,MAAM,MAAM,SAAS,GAAG,mBAAmB,CAAC;AAE5C,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAChC,QAAQ,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iBAAiB,CAAC,EAAE,SAAS,EAAE,CAAC;IAChC,kBAAkB,CAAC,EAAE,SAAS,EAAE,CAAC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAAE,qBAAqB,EAAE,MAAM,OAAO,CAAA;CAAE,CAAC;AAEtE,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,kBAAkB,GAAE,SAAS,GAAG,cAAsB;;;;;;;;;;;;EAwCjJ;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,WAAW,GAAG,cAAc,EACpC,SAAS,EAAE,WAAW,EACtB,QAAQ,EAAE,MAAM,IAAI,EACpB,OAAO,GAAE,2BAAgC,cAG1C;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAChC,QAAQ,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iBAAiB,CAAC,EAAE,SAAS,EAAE,CAAC;IAChC,kBAAkB,CAAC,EAAE,SAAS,EAAE,CAAC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,kBAAkB,GAAE,SAAS,GAAG,iBAAyB,eA0HjI;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,uBAMvC"}
|
package/dist/portal.esm.js
CHANGED
|
@@ -505,10 +505,12 @@ function ae(e, t) {
|
|
|
505
505
|
}
|
|
506
506
|
function de(e, t, n, r) {
|
|
507
507
|
if (e.style.position = n, e.style.left = `${Math.round(t.x)}px`, e.style.top = `${Math.round(t.y)}px`, e.style.setProperty("--ui-positioner-x", `${Math.round(t.x)}px`), e.style.setProperty("--ui-positioner-y", `${Math.round(t.y)}px`), r.matchWidth) {
|
|
508
|
-
const
|
|
509
|
-
e.style.width = `${Math.round(
|
|
508
|
+
const c = x(r.anchor);
|
|
509
|
+
e.style.width = `${Math.round(c.width)}px`;
|
|
510
510
|
}
|
|
511
|
-
r.fitViewport && (e.style.maxWidth = `${Math.round(t.availableWidth)}px`, e.style.maxHeight = `${Math.round(t.availableHeight)}px`), e.setAttribute("data-placement", t.placement)
|
|
511
|
+
r.fitViewport && (e.style.maxWidth = `${Math.round(t.availableWidth)}px`, e.style.maxHeight = `${Math.round(t.availableHeight)}px`), e.setAttribute("data-placement", t.placement);
|
|
512
|
+
const [i, o] = String(t.placement).split("-");
|
|
513
|
+
e.setAttribute("data-side", i || "bottom"), e.setAttribute("data-align", o || "center"), typeof t.referenceHidden == "boolean" || typeof t.escaped == "boolean" ? (e.setAttribute("data-reference-hidden", t.referenceHidden ? "true" : "false"), e.setAttribute("data-escaped", t.escaped ? "true" : "false")) : (e.removeAttribute("data-reference-hidden"), e.removeAttribute("data-escaped")), r.arrow instanceof HTMLElement && (t.middlewareData?.arrow ? ae(r.arrow, t) : le(r.arrow, t, x(r.anchor), e.getBoundingClientRect()));
|
|
512
514
|
}
|
|
513
515
|
function me(e) {
|
|
514
516
|
if (!(e.floating instanceof HTMLElement))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const X=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"];function z(e){return e instanceof HTMLElement}function Y(e){return!!e&&typeof e.top=="number"&&typeof e.left=="number"}function $(e){return!!e&&typeof e.getBoundingClientRect=="function"}function C(e){const t=e.x??0,n=e.y??0;return typeof DOMRect.fromRect=="function"?DOMRect.fromRect({x:t,y:n,width:e.width,height:e.height}):new DOMRect(t,n,e.width,e.height)}function p(e){return e instanceof DOMRect?e:C({x:e.x??e.left,y:e.y??e.top,width:e.width,height:e.height})}function w(e){return z(e)?e.getBoundingClientRect():Y(e)?p(e):p(e.getBoundingClientRect())}function _(e,t){const n=t?.getClientRects?.(e);if(n)return Array.from(n).map(i=>p(i)).filter(i=>i.width>0||i.height>0);const r=(z(e)||$(e))&&typeof e.getClientRects=="function"?e.getClientRects():null;return r?Array.from(r).map(i=>p(i)).filter(i=>i.width>0||i.height>0):[]}function j(e,t,n,r){if(!n)return w(e);const i=_(e,r);if(i.length===0)return w(e);const{side:o}=x(t);return o==="bottom"||o==="right"?i[i.length-1]||w(e):i[0]||w(e)}function H(e){return z(e)?e:$(e)&&e.contextElement instanceof HTMLElement?e.contextElement:null}function G(e,t,n){if(n)return n;const r=H(e)||(t instanceof HTMLElement?t:null);return r&&window.getComputedStyle(r).direction==="rtl"?"rtl":"ltr"}function J(e,t,n){return{getBoundingClientRect:()=>C({x:e,y:t,width:0,height:0}),contextElement:n}}function K(e,t){const n=C({x:e.x??e.left,y:e.y??e.top,width:e.width,height:e.height});return{getBoundingClientRect:()=>n,contextElement:t}}function Q(e,t){return{getBoundingClientRect:()=>p(e.getBoundingClientRect()),getClientRects:()=>e.getClientRects(),contextElement:t}}function Z(){const e=window.innerWidth||document.documentElement.clientWidth||0,t=window.innerHeight||document.documentElement.clientHeight||0;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}function L(e){return{top:e.top,left:e.left,right:e.right,bottom:e.bottom,width:e.width,height:e.height}}function ee(e,t){const n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),i=Math.min(e.right,t.right),o=Math.min(e.bottom,t.bottom);return{top:r,left:n,right:i,bottom:o,width:Math.max(0,i-n),height:Math.max(0,o-r)}}function te(e){const t=window.getComputedStyle(e),n=`${t.overflow}${t.overflowX}${t.overflowY}`;return/(auto|scroll|overlay|hidden|clip)/.test(n)}function R(e){const t=[];let n=e?.parentElement??null;for(;n&&n!==document.body&&n!==document.documentElement;)te(n)&&t.push(n),n=n.parentElement;return t.push(window),t}function ne(e,t,n){let r=n instanceof HTMLElement?L(n.getBoundingClientRect()):Z();if(n instanceof HTMLElement)return r;const i=new Set,o=H(e);return o&&R(o).forEach(c=>{c instanceof Element&&i.add(c)}),t instanceof HTMLElement&&R(t).forEach(c=>{c instanceof Element&&i.add(c)}),i.forEach(c=>{r=ee(r,L(c.getBoundingClientRect()))}),r}function x(e){const[t,n]=e.split("-");return{side:t,align:n||"center"}}function re(e){return e==="top"?"bottom":e==="bottom"?"top":e==="left"?"right":"left"}function ie(e){const{side:t,align:n}=x(e);return`${re(t)}${n==="center"?"":`-${n}`}`}function O(e,t,n,r=0,i=0,o=!1){const{side:c,align:a}=x(n);let l=0,d=0;return c==="top"||c==="bottom"?(a==="start"?l=o?e.right-t.width:e.left:a==="end"?l=o?e.left:e.right-t.width:l=e.left+(e.width-t.width)/2,d=c==="top"?e.top-t.height-r:e.bottom+r,l+=i):(a==="start"?d=e.top:a==="end"?d=e.bottom-t.height:d=e.top+(e.height-t.height)/2,l=c==="left"?e.left-t.width-r:e.right+r,d+=i),{x:l,y:d}}function E(e,t,n){return Math.min(n,Math.max(t,e))}function P(e){return Math.max(0,e.top)+Math.max(0,e.right)+Math.max(0,e.bottom)+Math.max(0,e.left)}function D(e,t){const{side:n}=x(e);return Math.max(0,t[n])}function oe(e,t){const{side:n}=x(e);return n==="top"||n==="bottom"?Math.max(0,t.left)+Math.max(0,t.right):Math.max(0,t.top)+Math.max(0,t.bottom)}function b(e,t={}){const n=t.padding??e.padding,r=t.elementContext==="reference"?{x:e.rects.reference.left,y:e.rects.reference.top,width:e.rects.reference.width,height:e.rects.reference.height}:{x:e.x,y:e.y,width:e.rects.floating.width,height:e.rects.floating.height};return{top:e.boundary.top+n-r.y,right:r.x+r.width-(e.boundary.right-n),bottom:r.y+r.height-(e.boundary.bottom-n),left:e.boundary.left+n-r.x}}function F(e=0){return{name:"offset",options:e,fn(t){const n=typeof e=="number"?{mainAxis:e,crossAxis:0}:{mainAxis:e.mainAxis??0,crossAxis:e.crossAxis??0},r=O(t.rects.reference,t.rects.floating,t.placement,n.mainAxis,n.crossAxis,t.rtl);return{x:r.x,y:r.y,data:{x:r.x-t.x,y:r.y-t.y}}}}}function V(e={}){return{name:"flip",options:e,fn(t){const n=e.fallbackPlacements?.length?e.fallbackPlacements:[ie(t.initialPlacement)],i=[t.placement,...n].map(l=>{const d=t.getAnchorRect(l),f=t.getCoords(l,d),s=b({...t,x:f.x,y:f.y,rects:{...t.rects,reference:d}},{padding:e.padding??t.padding});return{placement:l,overflow:s,coords:f,reference:d}}),o=i[0];if(!o||D(t.placement,o.overflow)<=0)return{data:{overflows:i.map(({placement:l,overflow:d})=>({placement:l,overflow:d}))}};const a=i.find(({placement:l,overflow:d})=>D(l,d)<=0&&oe(l,d)<=0)||i.reduce((l,d)=>P(d.overflow)<P(l.overflow)?d:l,o);return a.placement===t.placement?{data:{overflows:i.map(({placement:l,overflow:d})=>({placement:l,overflow:d}))}}:{x:a.coords.x,y:a.coords.y,placement:a.placement,data:{overflows:i.map(({placement:l,overflow:d})=>({placement:l,overflow:d}))}}}}}function T(e={}){return{name:"autoPlacement",options:e,fn(t){const n=e.allowedPlacements?.length?e.allowedPlacements:X,r=n.map(o=>{const c=t.getAnchorRect(o),a=t.getCoords(o,c),l=b({...t,x:a.x,y:a.y,rects:{...t.rects,reference:c}},{padding:e.padding??t.padding});return{placement:o,overflow:l,coords:a,reference:c}}),i=r.reduce((o,c)=>{const a=P(c.overflow),l=P(o.overflow);if(a!==l)return a<l?c:o;const d=Math.max(0,t.boundary.right-c.coords.x)*Math.max(0,t.boundary.bottom-c.coords.y),f=Math.max(0,t.boundary.right-o.coords.x)*Math.max(0,t.boundary.bottom-o.coords.y);return d>f?c:o},r[0]);if(i)return{x:i.coords.x,y:i.coords.y,placement:i.placement,data:{index:n.indexOf(i.placement),overflows:r.map(({placement:o,overflow:c})=>({placement:o,overflow:c}))}}}}}function B(e={}){return{name:"shift",options:e,fn(t){const n=e.mainAxis??!0,r=e.crossAxis??!0,{side:i}=x(t.placement),o=b(t,{padding:e.padding??t.padding});let c=t.x,a=t.y;return i==="top"||i==="bottom"?(r&&(c+=Math.max(0,o.left)-Math.max(0,o.right)),n&&(a+=i==="top"?Math.max(0,o.top):-Math.max(0,o.bottom))):(r&&(a+=Math.max(0,o.top)-Math.max(0,o.bottom)),n&&(c+=i==="left"?Math.max(0,o.left):-Math.max(0,o.right))),{x:c,y:a,data:{x:c-t.x,y:a-t.y}}}}}function I(e={}){return{name:"size",options:e,fn(t){const n=e.padding??t.padding,r=Math.max(0,t.boundary.right-t.x-n),i=Math.max(0,t.boundary.bottom-t.y-n);return e.apply?.({availableWidth:r,availableHeight:i,rects:t.rects,elements:t.elements}),{data:{availableWidth:r,availableHeight:i}}}}}function k(e={}){return{name:"arrow",options:e,fn(t){const{side:n}=x(t.placement),r=e.padding??8,i=e.element?.getBoundingClientRect(),o=i?.width||e.element?.offsetWidth||0,c=i?.height||e.element?.offsetHeight||0,a=t.rects.reference.left+t.rects.reference.width/2,l=t.rects.reference.top+t.rects.reference.height/2;if(n==="top"||n==="bottom"){const u=o/2,y=r,v=Math.max(y,t.rects.floating.width-r-o),M=a-t.x-u,A=E(M,y,v);return{data:{x:A,centerOffset:M-A}}}const d=c/2,f=r,s=Math.max(f,t.rects.floating.height-r-c),g=l-t.y-d,m=E(g,f,s);return{data:{y:m,centerOffset:g-m}}}}}function q(e={}){return{name:"hide",options:e,fn(t){const n=e.padding??t.padding,r=b(t,{elementContext:"reference",padding:n}),i=b(t,{padding:n}),o=Object.values(r).some(a=>a>0),c=Object.values(i).some(a=>a>0);return{data:{referenceHidden:o,escaped:c,referenceHiddenOffsets:r,escapedOffsets:i}}}}}function ce(e){const t=typeof e.boundaryPadding=="number"?e.boundaryPadding:4,n=[];return e.autoPlacement?n.push(T({padding:t,allowedPlacements:e.allowedPlacements})):e.flip&&n.push(V({padding:t,fallbackPlacements:e.fallbackPlacements})),n.push(F({mainAxis:typeof e.offset=="number"?e.offset:8,crossAxis:typeof e.crossOffset=="number"?e.crossOffset:0})),(e.shift||e.fitViewport)&&n.push(B({padding:t})),(e.matchWidth||e.fitViewport)&&n.push(I({padding:t})),e.arrow&&n.push(k({element:e.arrow,padding:e.arrowPadding})),e.hideWhenDetached&&n.push(q({padding:t})),e.middleware?.length&&n.push(...e.middleware),n}function le(e,t,n){if(!n)return;typeof n.x=="number"&&(e.x=n.x),typeof n.y=="number"&&(e.y=n.y);const i=(typeof n.reset=="object"?n.reset.placement:void 0)||n.placement;if(i&&i!==e.placement){e.placement=i,e.rects=e.getRects(i);const o=e.getCoords(i,e.rects.reference);e.x=typeof n.x=="number"?n.x:o.x,e.y=typeof n.y=="number"?n.y:o.y}typeof n.x=="number"&&(e.x=n.x),typeof n.y=="number"&&(e.y=n.y),n.data!==void 0&&(e.middlewareData[t.name]=n.data)}function S(e,t,n={}){const r=z(t)?t.getBoundingClientRect():t,i=n.placement||"bottom",o=n.strategy||"fixed",c=typeof n.boundaryPadding=="number"?n.boundaryPadding:4,a=G(e,t,n.dir)==="rtl",l=h=>n.platform?.getElementRects?.({anchor:e,floating:t,placement:h,inline:!!n.inline})??{reference:j(e,h,!!n.inline,n.platform),floating:r},d=h=>l(h).reference,f=l(i),s=O(f.reference,f.floating,i,0,0,a),g={},m=n.platform?.getClippingRect?.({anchor:e,floating:t,boundary:n.boundary??null})??ne(e,t,n.boundary??null),u={x:s.x,y:s.y,initialPlacement:i,placement:i,strategy:o,rects:f,elements:{anchor:e,floating:t},boundary:m,padding:c,rtl:a,middlewareData:g,getRects:l,getAnchorRect:d,getCoords:(h,U=d(h))=>O(U,u.rects.floating,h,0,0,a)};ce(n).forEach(h=>{le(u,h,h.fn(u))});const y=g.size,v=g.hide,M=y?.availableWidth??Math.max(0,u.boundary.right-u.x-c),A=y?.availableHeight??Math.max(0,u.boundary.bottom-u.y-c);return{x:u.x,y:u.y,placement:u.placement,strategy:o,availableWidth:M,availableHeight:A,middlewareData:g,referenceHidden:v?.referenceHidden,escaped:v?.escaped,rects:u.rects}}function W(e,t){return t!=="absolute"?e:{...e,x:e.x+window.scrollX,y:e.y+window.scrollY}}function ae(e,t){if(typeof IntersectionObserver>"u")return()=>{};let n=()=>{};return(()=>{n();const i=e.getBoundingClientRect(),o=document.documentElement,c=`${-Math.floor(i.top)}px ${-Math.floor(o.clientWidth-i.right)}px ${-Math.floor(o.clientHeight-i.bottom)}px ${-Math.floor(i.left)}px`,a=new IntersectionObserver(()=>t(),{rootMargin:c,threshold:1});a.observe(e),n=()=>a.disconnect()})(),()=>n()}function de(e,t,n,r){let i=0,o=0,c=null,a=null,l=null;const d=[],f=H(e),s=()=>{i||(i=requestAnimationFrame(()=>{i=0,n()}))};if(r.observeWindowResize&&(window.addEventListener("resize",s),d.push(()=>window.removeEventListener("resize",s))),r.observeScroll&&(window.addEventListener("scroll",s,{passive:!0,capture:!0}),d.push(()=>window.removeEventListener("scroll",s,!0))),(r.observeAncestorScroll||r.observeAncestorResize?new Set([...f?R(f):[],...R(t)]):new Set).forEach(m=>{m!==window&&(r.observeAncestorScroll&&(m.addEventListener("scroll",s,{passive:!0}),d.push(()=>m.removeEventListener("scroll",s))),r.observeAncestorResize&&(m.addEventListener("resize",s),d.push(()=>m.removeEventListener("resize",s))))}),f&&r.observeLayoutShift&&d.push(ae(f,s)),typeof ResizeObserver<"u"&&(r.observeAnchorResize&&f&&(a=new ResizeObserver(s),a.observe(f)),r.observeFloatingResize&&(l=new ResizeObserver(s),l.observe(t))),r.animationFrame){c=w(e);const m=()=>{const u=w(e);c&&(c.top!==u.top||c.left!==u.left||c.width!==u.width||c.height!==u.height)&&s(),c=u,o=requestAnimationFrame(m)};o=requestAnimationFrame(m)}return()=>{d.forEach(m=>m()),a&&a.disconnect(),l&&l.disconnect(),i&&cancelAnimationFrame(i),o&&cancelAnimationFrame(o)}}function N(e,t,n,r={}){return de(e,t,n,{observeWindowResize:r.observeWindowResize??!0,observeScroll:r.observeScroll??!0,observeAncestorScroll:r.observeAncestorScroll??!0,observeAncestorResize:r.observeAncestorResize??!0,observeLayoutShift:r.observeLayoutShift??!0,observeAnchorResize:r.observeAnchorResize??!0,observeFloatingResize:r.observeFloatingResize??!0,animationFrame:r.animationFrame??!1})}function fe(e,t,n,r){const{side:i}=x(t.placement),o=n.left+n.width/2,c=n.top+n.height/2;if(i==="top"||i==="bottom"){const l=Math.max(8,r.width-8),d=E(o-t.x,8,l);e.style.left=`${Math.round(d)}px`}else{const l=Math.max(8,r.height-8),d=E(c-t.y,8,l);e.style.top=`${Math.round(d)}px`}}function se(e,t){const n=t.middlewareData?.arrow;n&&(typeof n.x=="number"&&(e.style.left=`${Math.round(n.x)}px`),typeof n.y=="number"&&(e.style.top=`${Math.round(n.y)}px`))}function ue(e,t,n,r){if(e.style.position=n,e.style.left=`${Math.round(t.x)}px`,e.style.top=`${Math.round(t.y)}px`,e.style.setProperty("--ui-positioner-x",`${Math.round(t.x)}px`),e.style.setProperty("--ui-positioner-y",`${Math.round(t.y)}px`),r.matchWidth){const i=w(r.anchor);e.style.width=`${Math.round(i.width)}px`}r.fitViewport&&(e.style.maxWidth=`${Math.round(t.availableWidth)}px`,e.style.maxHeight=`${Math.round(t.availableHeight)}px`),e.setAttribute("data-placement",t.placement),typeof t.referenceHidden=="boolean"||typeof t.escaped=="boolean"?(e.setAttribute("data-reference-hidden",t.referenceHidden?"true":"false"),e.setAttribute("data-escaped",t.escaped?"true":"false")):(e.removeAttribute("data-reference-hidden"),e.removeAttribute("data-escaped")),r.arrow instanceof HTMLElement&&(t.middlewareData?.arrow?se(r.arrow,t):fe(r.arrow,t,w(r.anchor),e.getBoundingClientRect()))}function me(e){if(!(e.floating instanceof HTMLElement))throw new Error("createPositioner requires a valid floating HTMLElement");const t=e.strategy||"fixed",n=e.floating;let r=W(S(e.anchor,n,e),t);const i=N(e.anchor,n,o,{observeWindowResize:e.observeWindowResize??!0,observeScroll:e.observeScroll??!0,observeAncestorScroll:e.observeAncestorScroll??!0,observeAncestorResize:e.observeAncestorResize??!0,observeLayoutShift:e.observeLayoutShift??!0,observeAnchorResize:e.observeAnchorResize??!0,observeFloatingResize:e.observeFloatingResize??!(e.fitViewport||e.matchWidth),animationFrame:e.animationFrame??!1});function o(){const c=W(S(e.anchor,n,e),t);return r=c,ue(n,c,t,e),e.onUpdate?.(c),r}return o(),{update:o,destroy(){i()}}}exports.arrowMiddleware=k;exports.autoPlacementMiddleware=T;exports.autoUpdatePositioner=N;exports.computePositionState=S;exports.createPositioner=me;exports.createVirtualPoint=J;exports.createVirtualRange=Q;exports.createVirtualRect=K;exports.detectPositionerOverflow=b;exports.flipMiddleware=V;exports.hideMiddleware=q;exports.offsetMiddleware=F;exports.shiftMiddleware=B;exports.sizeMiddleware=I;
|
|
1
|
+
"use strict";const X=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"];function z(e){return e instanceof HTMLElement}function Y(e){return!!e&&typeof e.top=="number"&&typeof e.left=="number"}function $(e){return!!e&&typeof e.getBoundingClientRect=="function"}function C(e){const t=e.x??0,n=e.y??0;return typeof DOMRect.fromRect=="function"?DOMRect.fromRect({x:t,y:n,width:e.width,height:e.height}):new DOMRect(t,n,e.width,e.height)}function p(e){return e instanceof DOMRect?e:C({x:e.x??e.left,y:e.y??e.top,width:e.width,height:e.height})}function w(e){return z(e)?e.getBoundingClientRect():Y(e)?p(e):p(e.getBoundingClientRect())}function _(e,t){const n=t?.getClientRects?.(e);if(n)return Array.from(n).map(i=>p(i)).filter(i=>i.width>0||i.height>0);const r=(z(e)||$(e))&&typeof e.getClientRects=="function"?e.getClientRects():null;return r?Array.from(r).map(i=>p(i)).filter(i=>i.width>0||i.height>0):[]}function j(e,t,n,r){if(!n)return w(e);const i=_(e,r);if(i.length===0)return w(e);const{side:o}=x(t);return o==="bottom"||o==="right"?i[i.length-1]||w(e):i[0]||w(e)}function H(e){return z(e)?e:$(e)&&e.contextElement instanceof HTMLElement?e.contextElement:null}function G(e,t,n){if(n)return n;const r=H(e)||(t instanceof HTMLElement?t:null);return r&&window.getComputedStyle(r).direction==="rtl"?"rtl":"ltr"}function J(e,t,n){return{getBoundingClientRect:()=>C({x:e,y:t,width:0,height:0}),contextElement:n}}function K(e,t){const n=C({x:e.x??e.left,y:e.y??e.top,width:e.width,height:e.height});return{getBoundingClientRect:()=>n,contextElement:t}}function Q(e,t){return{getBoundingClientRect:()=>p(e.getBoundingClientRect()),getClientRects:()=>e.getClientRects(),contextElement:t}}function Z(){const e=window.innerWidth||document.documentElement.clientWidth||0,t=window.innerHeight||document.documentElement.clientHeight||0;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}function L(e){return{top:e.top,left:e.left,right:e.right,bottom:e.bottom,width:e.width,height:e.height}}function ee(e,t){const n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),i=Math.min(e.right,t.right),o=Math.min(e.bottom,t.bottom);return{top:r,left:n,right:i,bottom:o,width:Math.max(0,i-n),height:Math.max(0,o-r)}}function te(e){const t=window.getComputedStyle(e),n=`${t.overflow}${t.overflowX}${t.overflowY}`;return/(auto|scroll|overlay|hidden|clip)/.test(n)}function R(e){const t=[];let n=e?.parentElement??null;for(;n&&n!==document.body&&n!==document.documentElement;)te(n)&&t.push(n),n=n.parentElement;return t.push(window),t}function ne(e,t,n){let r=n instanceof HTMLElement?L(n.getBoundingClientRect()):Z();if(n instanceof HTMLElement)return r;const i=new Set,o=H(e);return o&&R(o).forEach(c=>{c instanceof Element&&i.add(c)}),t instanceof HTMLElement&&R(t).forEach(c=>{c instanceof Element&&i.add(c)}),i.forEach(c=>{r=ee(r,L(c.getBoundingClientRect()))}),r}function x(e){const[t,n]=e.split("-");return{side:t,align:n||"center"}}function re(e){return e==="top"?"bottom":e==="bottom"?"top":e==="left"?"right":"left"}function ie(e){const{side:t,align:n}=x(e);return`${re(t)}${n==="center"?"":`-${n}`}`}function O(e,t,n,r=0,i=0,o=!1){const{side:c,align:a}=x(n);let l=0,d=0;return c==="top"||c==="bottom"?(a==="start"?l=o?e.right-t.width:e.left:a==="end"?l=o?e.left:e.right-t.width:l=e.left+(e.width-t.width)/2,d=c==="top"?e.top-t.height-r:e.bottom+r,l+=i):(a==="start"?d=e.top:a==="end"?d=e.bottom-t.height:d=e.top+(e.height-t.height)/2,l=c==="left"?e.left-t.width-r:e.right+r,d+=i),{x:l,y:d}}function E(e,t,n){return Math.min(n,Math.max(t,e))}function P(e){return Math.max(0,e.top)+Math.max(0,e.right)+Math.max(0,e.bottom)+Math.max(0,e.left)}function D(e,t){const{side:n}=x(e);return Math.max(0,t[n])}function oe(e,t){const{side:n}=x(e);return n==="top"||n==="bottom"?Math.max(0,t.left)+Math.max(0,t.right):Math.max(0,t.top)+Math.max(0,t.bottom)}function b(e,t={}){const n=t.padding??e.padding,r=t.elementContext==="reference"?{x:e.rects.reference.left,y:e.rects.reference.top,width:e.rects.reference.width,height:e.rects.reference.height}:{x:e.x,y:e.y,width:e.rects.floating.width,height:e.rects.floating.height};return{top:e.boundary.top+n-r.y,right:r.x+r.width-(e.boundary.right-n),bottom:r.y+r.height-(e.boundary.bottom-n),left:e.boundary.left+n-r.x}}function F(e=0){return{name:"offset",options:e,fn(t){const n=typeof e=="number"?{mainAxis:e,crossAxis:0}:{mainAxis:e.mainAxis??0,crossAxis:e.crossAxis??0},r=O(t.rects.reference,t.rects.floating,t.placement,n.mainAxis,n.crossAxis,t.rtl);return{x:r.x,y:r.y,data:{x:r.x-t.x,y:r.y-t.y}}}}}function V(e={}){return{name:"flip",options:e,fn(t){const n=e.fallbackPlacements?.length?e.fallbackPlacements:[ie(t.initialPlacement)],i=[t.placement,...n].map(l=>{const d=t.getAnchorRect(l),f=t.getCoords(l,d),s=b({...t,x:f.x,y:f.y,rects:{...t.rects,reference:d}},{padding:e.padding??t.padding});return{placement:l,overflow:s,coords:f,reference:d}}),o=i[0];if(!o||D(t.placement,o.overflow)<=0)return{data:{overflows:i.map(({placement:l,overflow:d})=>({placement:l,overflow:d}))}};const a=i.find(({placement:l,overflow:d})=>D(l,d)<=0&&oe(l,d)<=0)||i.reduce((l,d)=>P(d.overflow)<P(l.overflow)?d:l,o);return a.placement===t.placement?{data:{overflows:i.map(({placement:l,overflow:d})=>({placement:l,overflow:d}))}}:{x:a.coords.x,y:a.coords.y,placement:a.placement,data:{overflows:i.map(({placement:l,overflow:d})=>({placement:l,overflow:d}))}}}}}function T(e={}){return{name:"autoPlacement",options:e,fn(t){const n=e.allowedPlacements?.length?e.allowedPlacements:X,r=n.map(o=>{const c=t.getAnchorRect(o),a=t.getCoords(o,c),l=b({...t,x:a.x,y:a.y,rects:{...t.rects,reference:c}},{padding:e.padding??t.padding});return{placement:o,overflow:l,coords:a,reference:c}}),i=r.reduce((o,c)=>{const a=P(c.overflow),l=P(o.overflow);if(a!==l)return a<l?c:o;const d=Math.max(0,t.boundary.right-c.coords.x)*Math.max(0,t.boundary.bottom-c.coords.y),f=Math.max(0,t.boundary.right-o.coords.x)*Math.max(0,t.boundary.bottom-o.coords.y);return d>f?c:o},r[0]);if(i)return{x:i.coords.x,y:i.coords.y,placement:i.placement,data:{index:n.indexOf(i.placement),overflows:r.map(({placement:o,overflow:c})=>({placement:o,overflow:c}))}}}}}function B(e={}){return{name:"shift",options:e,fn(t){const n=e.mainAxis??!0,r=e.crossAxis??!0,{side:i}=x(t.placement),o=b(t,{padding:e.padding??t.padding});let c=t.x,a=t.y;return i==="top"||i==="bottom"?(r&&(c+=Math.max(0,o.left)-Math.max(0,o.right)),n&&(a+=i==="top"?Math.max(0,o.top):-Math.max(0,o.bottom))):(r&&(a+=Math.max(0,o.top)-Math.max(0,o.bottom)),n&&(c+=i==="left"?Math.max(0,o.left):-Math.max(0,o.right))),{x:c,y:a,data:{x:c-t.x,y:a-t.y}}}}}function I(e={}){return{name:"size",options:e,fn(t){const n=e.padding??t.padding,r=Math.max(0,t.boundary.right-t.x-n),i=Math.max(0,t.boundary.bottom-t.y-n);return e.apply?.({availableWidth:r,availableHeight:i,rects:t.rects,elements:t.elements}),{data:{availableWidth:r,availableHeight:i}}}}}function k(e={}){return{name:"arrow",options:e,fn(t){const{side:n}=x(t.placement),r=e.padding??8,i=e.element?.getBoundingClientRect(),o=i?.width||e.element?.offsetWidth||0,c=i?.height||e.element?.offsetHeight||0,a=t.rects.reference.left+t.rects.reference.width/2,l=t.rects.reference.top+t.rects.reference.height/2;if(n==="top"||n==="bottom"){const u=o/2,y=r,v=Math.max(y,t.rects.floating.width-r-o),M=a-t.x-u,A=E(M,y,v);return{data:{x:A,centerOffset:M-A}}}const d=c/2,f=r,s=Math.max(f,t.rects.floating.height-r-c),g=l-t.y-d,m=E(g,f,s);return{data:{y:m,centerOffset:g-m}}}}}function q(e={}){return{name:"hide",options:e,fn(t){const n=e.padding??t.padding,r=b(t,{elementContext:"reference",padding:n}),i=b(t,{padding:n}),o=Object.values(r).some(a=>a>0),c=Object.values(i).some(a=>a>0);return{data:{referenceHidden:o,escaped:c,referenceHiddenOffsets:r,escapedOffsets:i}}}}}function ce(e){const t=typeof e.boundaryPadding=="number"?e.boundaryPadding:4,n=[];return e.autoPlacement?n.push(T({padding:t,allowedPlacements:e.allowedPlacements})):e.flip&&n.push(V({padding:t,fallbackPlacements:e.fallbackPlacements})),n.push(F({mainAxis:typeof e.offset=="number"?e.offset:8,crossAxis:typeof e.crossOffset=="number"?e.crossOffset:0})),(e.shift||e.fitViewport)&&n.push(B({padding:t})),(e.matchWidth||e.fitViewport)&&n.push(I({padding:t})),e.arrow&&n.push(k({element:e.arrow,padding:e.arrowPadding})),e.hideWhenDetached&&n.push(q({padding:t})),e.middleware?.length&&n.push(...e.middleware),n}function le(e,t,n){if(!n)return;typeof n.x=="number"&&(e.x=n.x),typeof n.y=="number"&&(e.y=n.y);const i=(typeof n.reset=="object"?n.reset.placement:void 0)||n.placement;if(i&&i!==e.placement){e.placement=i,e.rects=e.getRects(i);const o=e.getCoords(i,e.rects.reference);e.x=typeof n.x=="number"?n.x:o.x,e.y=typeof n.y=="number"?n.y:o.y}typeof n.x=="number"&&(e.x=n.x),typeof n.y=="number"&&(e.y=n.y),n.data!==void 0&&(e.middlewareData[t.name]=n.data)}function S(e,t,n={}){const r=z(t)?t.getBoundingClientRect():t,i=n.placement||"bottom",o=n.strategy||"fixed",c=typeof n.boundaryPadding=="number"?n.boundaryPadding:4,a=G(e,t,n.dir)==="rtl",l=h=>n.platform?.getElementRects?.({anchor:e,floating:t,placement:h,inline:!!n.inline})??{reference:j(e,h,!!n.inline,n.platform),floating:r},d=h=>l(h).reference,f=l(i),s=O(f.reference,f.floating,i,0,0,a),g={},m=n.platform?.getClippingRect?.({anchor:e,floating:t,boundary:n.boundary??null})??ne(e,t,n.boundary??null),u={x:s.x,y:s.y,initialPlacement:i,placement:i,strategy:o,rects:f,elements:{anchor:e,floating:t},boundary:m,padding:c,rtl:a,middlewareData:g,getRects:l,getAnchorRect:d,getCoords:(h,U=d(h))=>O(U,u.rects.floating,h,0,0,a)};ce(n).forEach(h=>{le(u,h,h.fn(u))});const y=g.size,v=g.hide,M=y?.availableWidth??Math.max(0,u.boundary.right-u.x-c),A=y?.availableHeight??Math.max(0,u.boundary.bottom-u.y-c);return{x:u.x,y:u.y,placement:u.placement,strategy:o,availableWidth:M,availableHeight:A,middlewareData:g,referenceHidden:v?.referenceHidden,escaped:v?.escaped,rects:u.rects}}function W(e,t){return t!=="absolute"?e:{...e,x:e.x+window.scrollX,y:e.y+window.scrollY}}function ae(e,t){if(typeof IntersectionObserver>"u")return()=>{};let n=()=>{};return(()=>{n();const i=e.getBoundingClientRect(),o=document.documentElement,c=`${-Math.floor(i.top)}px ${-Math.floor(o.clientWidth-i.right)}px ${-Math.floor(o.clientHeight-i.bottom)}px ${-Math.floor(i.left)}px`,a=new IntersectionObserver(()=>t(),{rootMargin:c,threshold:1});a.observe(e),n=()=>a.disconnect()})(),()=>n()}function de(e,t,n,r){let i=0,o=0,c=null,a=null,l=null;const d=[],f=H(e),s=()=>{i||(i=requestAnimationFrame(()=>{i=0,n()}))};if(r.observeWindowResize&&(window.addEventListener("resize",s),d.push(()=>window.removeEventListener("resize",s))),r.observeScroll&&(window.addEventListener("scroll",s,{passive:!0,capture:!0}),d.push(()=>window.removeEventListener("scroll",s,!0))),(r.observeAncestorScroll||r.observeAncestorResize?new Set([...f?R(f):[],...R(t)]):new Set).forEach(m=>{m!==window&&(r.observeAncestorScroll&&(m.addEventListener("scroll",s,{passive:!0}),d.push(()=>m.removeEventListener("scroll",s))),r.observeAncestorResize&&(m.addEventListener("resize",s),d.push(()=>m.removeEventListener("resize",s))))}),f&&r.observeLayoutShift&&d.push(ae(f,s)),typeof ResizeObserver<"u"&&(r.observeAnchorResize&&f&&(a=new ResizeObserver(s),a.observe(f)),r.observeFloatingResize&&(l=new ResizeObserver(s),l.observe(t))),r.animationFrame){c=w(e);const m=()=>{const u=w(e);c&&(c.top!==u.top||c.left!==u.left||c.width!==u.width||c.height!==u.height)&&s(),c=u,o=requestAnimationFrame(m)};o=requestAnimationFrame(m)}return()=>{d.forEach(m=>m()),a&&a.disconnect(),l&&l.disconnect(),i&&cancelAnimationFrame(i),o&&cancelAnimationFrame(o)}}function N(e,t,n,r={}){return de(e,t,n,{observeWindowResize:r.observeWindowResize??!0,observeScroll:r.observeScroll??!0,observeAncestorScroll:r.observeAncestorScroll??!0,observeAncestorResize:r.observeAncestorResize??!0,observeLayoutShift:r.observeLayoutShift??!0,observeAnchorResize:r.observeAnchorResize??!0,observeFloatingResize:r.observeFloatingResize??!0,animationFrame:r.animationFrame??!1})}function fe(e,t,n,r){const{side:i}=x(t.placement),o=n.left+n.width/2,c=n.top+n.height/2;if(i==="top"||i==="bottom"){const l=Math.max(8,r.width-8),d=E(o-t.x,8,l);e.style.left=`${Math.round(d)}px`}else{const l=Math.max(8,r.height-8),d=E(c-t.y,8,l);e.style.top=`${Math.round(d)}px`}}function se(e,t){const n=t.middlewareData?.arrow;n&&(typeof n.x=="number"&&(e.style.left=`${Math.round(n.x)}px`),typeof n.y=="number"&&(e.style.top=`${Math.round(n.y)}px`))}function ue(e,t,n,r){if(e.style.position=n,e.style.left=`${Math.round(t.x)}px`,e.style.top=`${Math.round(t.y)}px`,e.style.setProperty("--ui-positioner-x",`${Math.round(t.x)}px`),e.style.setProperty("--ui-positioner-y",`${Math.round(t.y)}px`),r.matchWidth){const c=w(r.anchor);e.style.width=`${Math.round(c.width)}px`}r.fitViewport&&(e.style.maxWidth=`${Math.round(t.availableWidth)}px`,e.style.maxHeight=`${Math.round(t.availableHeight)}px`),e.setAttribute("data-placement",t.placement);const[i,o]=String(t.placement).split("-");e.setAttribute("data-side",i||"bottom"),e.setAttribute("data-align",o||"center"),typeof t.referenceHidden=="boolean"||typeof t.escaped=="boolean"?(e.setAttribute("data-reference-hidden",t.referenceHidden?"true":"false"),e.setAttribute("data-escaped",t.escaped?"true":"false")):(e.removeAttribute("data-reference-hidden"),e.removeAttribute("data-escaped")),r.arrow instanceof HTMLElement&&(t.middlewareData?.arrow?se(r.arrow,t):fe(r.arrow,t,w(r.anchor),e.getBoundingClientRect()))}function me(e){if(!(e.floating instanceof HTMLElement))throw new Error("createPositioner requires a valid floating HTMLElement");const t=e.strategy||"fixed",n=e.floating;let r=W(S(e.anchor,n,e),t);const i=N(e.anchor,n,o,{observeWindowResize:e.observeWindowResize??!0,observeScroll:e.observeScroll??!0,observeAncestorScroll:e.observeAncestorScroll??!0,observeAncestorResize:e.observeAncestorResize??!0,observeLayoutShift:e.observeLayoutShift??!0,observeAnchorResize:e.observeAnchorResize??!0,observeFloatingResize:e.observeFloatingResize??!(e.fitViewport||e.matchWidth),animationFrame:e.animationFrame??!1});function o(){const c=W(S(e.anchor,n,e),t);return r=c,ue(n,c,t,e),e.onUpdate?.(c),r}return o(),{update:o,destroy(){i()}}}exports.arrowMiddleware=k;exports.autoPlacementMiddleware=T;exports.autoUpdatePositioner=N;exports.computePositionState=S;exports.createPositioner=me;exports.createVirtualPoint=J;exports.createVirtualRange=Q;exports.createVirtualRect=K;exports.detectPositionerOverflow=b;exports.flipMiddleware=V;exports.hideMiddleware=q;exports.offsetMiddleware=F;exports.shiftMiddleware=B;exports.sizeMiddleware=I;
|
package/dist/positioner.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("./ElementBase-DxbvhLJs.js"),h=require("./positioner-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("./ElementBase-DxbvhLJs.js"),h=require("./positioner-DZ1FW6A9.js"),a=require("./selector-BvAh35ve.js"),d=`
|
|
2
2
|
:host {
|
|
3
3
|
display: contents;
|
|
4
4
|
color-scheme: light dark;
|
package/dist/positioner.esm.js
CHANGED
package/dist/presence.cjs.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
--ui-presence-filter-enter: none;
|
|
11
11
|
--ui-presence-filter-exit: none;
|
|
12
12
|
--ui-presence-perspective: 860px;
|
|
13
|
-
--ui-presence-color:
|
|
13
|
+
--ui-presence-color: inherit;
|
|
14
14
|
display: contents;
|
|
15
15
|
color: var(--ui-presence-color);
|
|
16
16
|
color-scheme: light dark;
|
package/dist/presence.esm.js
CHANGED
|
@@ -11,7 +11,7 @@ const d = `
|
|
|
11
11
|
--ui-presence-filter-enter: none;
|
|
12
12
|
--ui-presence-filter-exit: none;
|
|
13
13
|
--ui-presence-perspective: 860px;
|
|
14
|
-
--ui-presence-color:
|
|
14
|
+
--ui-presence-color: inherit;
|
|
15
15
|
display: contents;
|
|
16
16
|
color: var(--ui-presence-color);
|
|
17
17
|
color-scheme: light dark;
|