@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/color-picker.esm.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { E as q } from "./ElementBase-BeZT54Hj.mjs";
|
|
2
|
-
import { r as O, e as F, l as U, i as A, s as N, c as V } from "./date-time-utils-
|
|
3
|
-
function g(
|
|
4
|
-
return Math.max(t, Math.min(e,
|
|
2
|
+
import { r as O, e as F, l as U, i as A, s as N, c as V } from "./date-time-utils-zAx4ghvC.mjs";
|
|
3
|
+
function g(o, t, e) {
|
|
4
|
+
return Math.max(t, Math.min(e, o));
|
|
5
5
|
}
|
|
6
|
-
function m(
|
|
6
|
+
function m(o, t = 3) {
|
|
7
7
|
const e = 10 ** t;
|
|
8
|
-
return Math.round(
|
|
8
|
+
return Math.round(o * e) / e;
|
|
9
9
|
}
|
|
10
|
-
function S(
|
|
11
|
-
return g(Math.round(
|
|
10
|
+
function S(o) {
|
|
11
|
+
return g(Math.round(o), 0, 255);
|
|
12
12
|
}
|
|
13
|
-
function D(
|
|
14
|
-
const t =
|
|
13
|
+
function D(o) {
|
|
14
|
+
const t = o.trim();
|
|
15
15
|
if (!t) return null;
|
|
16
16
|
if (t.endsWith("%")) {
|
|
17
17
|
const r = Number(t.slice(0, -1));
|
|
@@ -20,8 +20,8 @@ function D(s) {
|
|
|
20
20
|
const e = Number(t);
|
|
21
21
|
return Number.isFinite(e) ? g(e, 0, 1) : null;
|
|
22
22
|
}
|
|
23
|
-
function C(
|
|
24
|
-
const t =
|
|
23
|
+
function C(o) {
|
|
24
|
+
const t = o.trim();
|
|
25
25
|
if (!t) return null;
|
|
26
26
|
if (t.endsWith("%")) {
|
|
27
27
|
const r = Number(t.slice(0, -1));
|
|
@@ -30,14 +30,14 @@ function C(s) {
|
|
|
30
30
|
const e = Number(t);
|
|
31
31
|
return Number.isFinite(e) ? S(e) : null;
|
|
32
32
|
}
|
|
33
|
-
function B(
|
|
34
|
-
const t =
|
|
33
|
+
function B(o) {
|
|
34
|
+
const t = o.trim();
|
|
35
35
|
if (!t.endsWith("%")) return null;
|
|
36
36
|
const e = Number(t.slice(0, -1));
|
|
37
37
|
return Number.isFinite(e) ? g(e, 0, 100) : null;
|
|
38
38
|
}
|
|
39
|
-
function W(
|
|
40
|
-
const t =
|
|
39
|
+
function W(o) {
|
|
40
|
+
const t = o.trim().toLowerCase();
|
|
41
41
|
if (!t) return null;
|
|
42
42
|
if (t.endsWith("deg")) {
|
|
43
43
|
const r = Number(t.slice(0, -3));
|
|
@@ -54,12 +54,12 @@ function W(s) {
|
|
|
54
54
|
const e = Number(t);
|
|
55
55
|
return Number.isFinite(e) ? y(e) : null;
|
|
56
56
|
}
|
|
57
|
-
function y(
|
|
58
|
-
const t =
|
|
57
|
+
function y(o) {
|
|
58
|
+
const t = o % 360;
|
|
59
59
|
return t < 0 ? t + 360 : t;
|
|
60
60
|
}
|
|
61
|
-
function T(
|
|
62
|
-
const t =
|
|
61
|
+
function T(o) {
|
|
62
|
+
const t = o.trim();
|
|
63
63
|
if (!t) return null;
|
|
64
64
|
if (t.includes("/")) {
|
|
65
65
|
const [r, i] = t.split("/");
|
|
@@ -83,18 +83,18 @@ function T(s) {
|
|
|
83
83
|
alpha: e[3] ?? null
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
|
-
function K(
|
|
87
|
-
const t =
|
|
86
|
+
function K(o) {
|
|
87
|
+
const t = o.trim().replace(/^#/, "");
|
|
88
88
|
if (![3, 4, 6, 8].includes(t.length) || !/^[0-9a-f]+$/i.test(t)) return null;
|
|
89
89
|
if (t.length === 3 || t.length === 4) {
|
|
90
|
-
const n = parseInt(t[0] + t[0], 16),
|
|
91
|
-
return b({ r: n, g:
|
|
90
|
+
const n = parseInt(t[0] + t[0], 16), s = parseInt(t[1] + t[1], 16), l = parseInt(t[2] + t[2], 16), c = t.length === 4 ? parseInt(t[3] + t[3], 16) / 255 : 1;
|
|
91
|
+
return b({ r: n, g: s, b: l, a: c });
|
|
92
92
|
}
|
|
93
93
|
const e = parseInt(t.slice(0, 2), 16), r = parseInt(t.slice(2, 4), 16), i = parseInt(t.slice(4, 6), 16), a = t.length === 8 ? parseInt(t.slice(6, 8), 16) / 255 : 1;
|
|
94
94
|
return b({ r: e, g: r, b: i, a });
|
|
95
95
|
}
|
|
96
|
-
function G(
|
|
97
|
-
const t = /^rgba?\((.+)\)$/i.exec(
|
|
96
|
+
function G(o) {
|
|
97
|
+
const t = /^rgba?\((.+)\)$/i.exec(o.trim());
|
|
98
98
|
if (!t) return null;
|
|
99
99
|
const e = T(t[1]);
|
|
100
100
|
if (!e || e.channels.length < 3) return null;
|
|
@@ -103,8 +103,8 @@ function G(s) {
|
|
|
103
103
|
const n = e.alpha != null ? D(e.alpha) : 1;
|
|
104
104
|
return n == null ? null : b({ r, g: i, b: a, a: n });
|
|
105
105
|
}
|
|
106
|
-
function X(
|
|
107
|
-
const t = /^hsla?\((.+)\)$/i.exec(
|
|
106
|
+
function X(o) {
|
|
107
|
+
const t = /^hsla?\((.+)\)$/i.exec(o.trim());
|
|
108
108
|
if (!t) return null;
|
|
109
109
|
const e = T(t[1]);
|
|
110
110
|
if (!e || e.channels.length < 3) return null;
|
|
@@ -113,35 +113,35 @@ function X(s) {
|
|
|
113
113
|
const n = e.alpha != null ? D(e.alpha) : 1;
|
|
114
114
|
return n == null ? null : $({ h: r, s: i, l: a, a: n });
|
|
115
115
|
}
|
|
116
|
-
function b(
|
|
116
|
+
function b(o) {
|
|
117
117
|
return {
|
|
118
|
-
r: S(
|
|
119
|
-
g: S(
|
|
120
|
-
b: S(
|
|
121
|
-
a: m(g(
|
|
118
|
+
r: S(o.r),
|
|
119
|
+
g: S(o.g),
|
|
120
|
+
b: S(o.b),
|
|
121
|
+
a: m(g(o.a, 0, 1), 4)
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
const t = (
|
|
124
|
+
function v(o) {
|
|
125
|
+
const t = (o || "").trim();
|
|
126
126
|
return t ? t.startsWith("#") ? K(t) : /^rgba?\(/i.test(t) ? G(t) : /^hsla?\(/i.test(t) ? X(t) : null : null;
|
|
127
127
|
}
|
|
128
|
-
function Y(
|
|
129
|
-
const e = b(
|
|
128
|
+
function Y(o, t = !1) {
|
|
129
|
+
const e = b(o), r = (a) => a.toString(16).padStart(2, "0"), i = `#${r(e.r)}${r(e.g)}${r(e.b)}`;
|
|
130
130
|
return t ? `${i}${r(Math.round(e.a * 255))}` : i;
|
|
131
131
|
}
|
|
132
|
-
function j(
|
|
133
|
-
const e = b(
|
|
132
|
+
function j(o, t = !0) {
|
|
133
|
+
const e = b(o);
|
|
134
134
|
return !t || e.a >= 1 ? `rgb(${e.r} ${e.g} ${e.b})` : `rgb(${e.r} ${e.g} ${e.b} / ${m(e.a, 3)})`;
|
|
135
135
|
}
|
|
136
|
-
function J(
|
|
137
|
-
const e = Math.round(y(
|
|
136
|
+
function J(o, t = !0) {
|
|
137
|
+
const e = Math.round(y(o.h)), r = Math.round(g(o.s, 0, 100)), i = Math.round(g(o.l, 0, 100)), a = m(g(o.a, 0, 1), 3);
|
|
138
138
|
return !t || a >= 1 ? `hsl(${e} ${r}% ${i}%)` : `hsl(${e} ${r}% ${i}% / ${a})`;
|
|
139
139
|
}
|
|
140
|
-
function z(
|
|
141
|
-
const t = b(
|
|
140
|
+
function z(o) {
|
|
141
|
+
const t = b(o), e = t.r / 255, r = t.g / 255, i = t.b / 255, a = Math.max(e, r, i), n = Math.min(e, r, i), s = a - n;
|
|
142
142
|
let l = 0;
|
|
143
|
-
|
|
144
|
-
const c = a === 0 ? 0 :
|
|
143
|
+
s !== 0 && (a === e ? l = (r - i) / s % 6 : a === r ? l = (i - e) / s + 2 : l = (e - r) / s + 4, l *= 60, l < 0 && (l += 360));
|
|
144
|
+
const c = a === 0 ? 0 : s / a * 100, p = a * 100;
|
|
145
145
|
return {
|
|
146
146
|
h: m(l, 3),
|
|
147
147
|
s: m(c, 3),
|
|
@@ -149,44 +149,44 @@ function z(s) {
|
|
|
149
149
|
a: t.a
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
|
-
function Q(
|
|
153
|
-
const t = y(
|
|
154
|
-
let
|
|
155
|
-
return t < 60 ? (
|
|
156
|
-
r: (
|
|
152
|
+
function Q(o) {
|
|
153
|
+
const t = y(o.h), e = g(o.s, 0, 100) / 100, r = g(o.v, 0, 100) / 100, i = r * e, a = i * (1 - Math.abs(t / 60 % 2 - 1)), n = r - i;
|
|
154
|
+
let s = 0, l = 0, c = 0;
|
|
155
|
+
return t < 60 ? (s = i, l = a) : t < 120 ? (s = a, l = i) : t < 180 ? (l = i, c = a) : t < 240 ? (l = a, c = i) : t < 300 ? (s = a, c = i) : (s = i, c = a), b({
|
|
156
|
+
r: (s + n) * 255,
|
|
157
157
|
g: (l + n) * 255,
|
|
158
158
|
b: (c + n) * 255,
|
|
159
|
-
a:
|
|
159
|
+
a: o.a
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
|
-
function M(
|
|
163
|
-
const t = b(
|
|
162
|
+
function M(o) {
|
|
163
|
+
const t = b(o), e = t.r / 255, r = t.g / 255, i = t.b / 255, a = Math.max(e, r, i), n = Math.min(e, r, i), s = a - n, l = (a + n) / 2;
|
|
164
164
|
let c = 0, p = 0;
|
|
165
|
-
return
|
|
165
|
+
return s !== 0 && (p = s / (1 - Math.abs(2 * l - 1)), a === e ? c = (r - i) / s % 6 : a === r ? c = (i - e) / s + 2 : c = (e - r) / s + 4, c *= 60, c < 0 && (c += 360)), {
|
|
166
166
|
h: m(c, 3),
|
|
167
167
|
s: m(p * 100, 3),
|
|
168
168
|
l: m(l * 100, 3),
|
|
169
169
|
a: t.a
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
|
-
function $(
|
|
173
|
-
const t = y(
|
|
174
|
-
let
|
|
175
|
-
return t < 60 ? (
|
|
176
|
-
r: (
|
|
172
|
+
function $(o) {
|
|
173
|
+
const t = y(o.h), e = g(o.s, 0, 100) / 100, r = g(o.l, 0, 100) / 100, i = (1 - Math.abs(2 * r - 1)) * e, a = i * (1 - Math.abs(t / 60 % 2 - 1)), n = r - i / 2;
|
|
174
|
+
let s = 0, l = 0, c = 0;
|
|
175
|
+
return t < 60 ? (s = i, l = a) : t < 120 ? (s = a, l = i) : t < 180 ? (l = i, c = a) : t < 240 ? (l = a, c = i) : t < 300 ? (s = a, c = i) : (s = i, c = a), b({
|
|
176
|
+
r: (s + n) * 255,
|
|
177
177
|
g: (l + n) * 255,
|
|
178
178
|
b: (c + n) * 255,
|
|
179
|
-
a:
|
|
179
|
+
a: o.a
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
|
-
function _(
|
|
183
|
-
return Y(
|
|
182
|
+
function _(o, t) {
|
|
183
|
+
return Y(o, t).toUpperCase();
|
|
184
184
|
}
|
|
185
|
-
function w(
|
|
186
|
-
return j(
|
|
185
|
+
function w(o, t) {
|
|
186
|
+
return j(o, t);
|
|
187
187
|
}
|
|
188
|
-
function Z(
|
|
189
|
-
return J(M(
|
|
188
|
+
function Z(o, t) {
|
|
189
|
+
return J(M(o), t);
|
|
190
190
|
}
|
|
191
191
|
const I = "#2563eb", L = "editora:ui-color-picker:recent", tt = `
|
|
192
192
|
<svg viewBox="0 0 20 20" aria-hidden="true" focusable="false">
|
|
@@ -194,15 +194,15 @@ const I = "#2563eb", L = "editora:ui-color-picker:recent", tt = `
|
|
|
194
194
|
</svg>
|
|
195
195
|
`, H = `
|
|
196
196
|
:host {
|
|
197
|
-
--ui-cp-bg: color-
|
|
198
|
-
--ui-cp-border: color-mix(in srgb, var(--ui-color-border, #cbd5e1) 74%, transparent);
|
|
197
|
+
--ui-cp-bg: var(--color-panel-solid, var(--ui-color-surface, #ffffff));
|
|
198
|
+
--ui-cp-border: var(--ui-color-line-subtle, color-mix(in srgb, var(--ui-color-border, #cbd5e1) 74%, transparent));
|
|
199
199
|
--ui-cp-text: var(--ui-color-text, #0f172a);
|
|
200
200
|
--ui-cp-muted: var(--ui-color-muted, #526175);
|
|
201
201
|
--ui-cp-accent: var(--ui-color-primary, #2563eb);
|
|
202
202
|
--ui-cp-success: var(--ui-color-success, #15803d);
|
|
203
203
|
--ui-cp-warning: var(--ui-color-warning, #b45309);
|
|
204
204
|
--ui-cp-danger: var(--ui-color-danger, #dc2626);
|
|
205
|
-
--ui-cp-radius:
|
|
205
|
+
--ui-cp-radius: calc(var(--ui-radius, 6px) + 2px);
|
|
206
206
|
--ui-cp-shadow: none;
|
|
207
207
|
--ui-cp-padding: 10px;
|
|
208
208
|
--ui-cp-duration: 160ms;
|
|
@@ -441,7 +441,7 @@ const I = "#2563eb", L = "editora:ui-color-picker:recent", tt = `
|
|
|
441
441
|
padding: 0 8px;
|
|
442
442
|
border: 1px solid color-mix(in srgb, var(--ui-cp-accent) 36%, var(--ui-cp-border));
|
|
443
443
|
background: color-mix(in srgb, var(--ui-cp-accent) 12%, transparent);
|
|
444
|
-
color: color-mix(in srgb, var(--ui-cp-accent)
|
|
444
|
+
color: color-mix(in srgb, var(--ui-cp-accent) 45%, var(--ui-cp-text));
|
|
445
445
|
font: 650 10px/1 "Inter", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
446
446
|
letter-spacing: 0.04em;
|
|
447
447
|
text-transform: uppercase;
|
|
@@ -457,7 +457,7 @@ const I = "#2563eb", L = "editora:ui-color-picker:recent", tt = `
|
|
|
457
457
|
color: var(--ui-cp-text);
|
|
458
458
|
min-inline-size: 32px;
|
|
459
459
|
block-size: 30px;
|
|
460
|
-
border-radius:
|
|
460
|
+
border-radius: var(--ui-control-radius-1, var(--ui-radius, 6px));
|
|
461
461
|
padding: 0 8px;
|
|
462
462
|
display: inline-grid;
|
|
463
463
|
place-items: center;
|
|
@@ -497,7 +497,7 @@ const I = "#2563eb", L = "editora:ui-color-picker:recent", tt = `
|
|
|
497
497
|
position: relative;
|
|
498
498
|
inline-size: 100%;
|
|
499
499
|
block-size: clamp(128px, 16vw, 156px);
|
|
500
|
-
border-radius:
|
|
500
|
+
border-radius: var(--ui-control-radius-3, var(--ui-radius, 6px));
|
|
501
501
|
border: 1px solid color-mix(in srgb, var(--ui-cp-border) 82%, transparent);
|
|
502
502
|
overflow: visible;
|
|
503
503
|
cursor: crosshair;
|
|
@@ -602,7 +602,7 @@ const I = "#2563eb", L = "editora:ui-color-picker:recent", tt = `
|
|
|
602
602
|
display: inline-grid;
|
|
603
603
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
604
604
|
border: 1px solid color-mix(in srgb, var(--ui-cp-border) 84%, transparent);
|
|
605
|
-
border-radius:
|
|
605
|
+
border-radius: var(--ui-control-radius-3, var(--ui-radius, 6px));
|
|
606
606
|
overflow: hidden;
|
|
607
607
|
}
|
|
608
608
|
|
|
@@ -618,6 +618,11 @@ const I = "#2563eb", L = "editora:ui-color-picker:recent", tt = `
|
|
|
618
618
|
color var(--ui-cp-duration) var(--ui-cp-ease);
|
|
619
619
|
}
|
|
620
620
|
|
|
621
|
+
.tab:hover:not([data-active="true"]) {
|
|
622
|
+
background: color-mix(in srgb, var(--ui-cp-accent) 8%, transparent);
|
|
623
|
+
color: var(--ui-cp-text);
|
|
624
|
+
}
|
|
625
|
+
|
|
621
626
|
.tab[data-active="true"] {
|
|
622
627
|
background: color-mix(in srgb, var(--ui-cp-accent) 15%, transparent);
|
|
623
628
|
color: var(--ui-cp-text);
|
|
@@ -665,7 +670,7 @@ const I = "#2563eb", L = "editora:ui-color-picker:recent", tt = `
|
|
|
665
670
|
min-inline-size: 0;
|
|
666
671
|
inline-size: 100%;
|
|
667
672
|
min-block-size: 28px;
|
|
668
|
-
border-radius:
|
|
673
|
+
border-radius: var(--ui-control-radius-2, var(--ui-radius, 6px));
|
|
669
674
|
border: 1px solid color-mix(in srgb, var(--ui-cp-border) 86%, transparent);
|
|
670
675
|
background: color-mix(in srgb, var(--ui-cp-bg) 95%, transparent);
|
|
671
676
|
color: var(--ui-cp-text);
|
|
@@ -714,9 +719,7 @@ const I = "#2563eb", L = "editora:ui-color-picker:recent", tt = `
|
|
|
714
719
|
}
|
|
715
720
|
|
|
716
721
|
.swatch:hover {
|
|
717
|
-
|
|
718
|
-
border-color: color-mix(in srgb, var(--ui-cp-accent) 40%, var(--ui-cp-border));
|
|
719
|
-
box-shadow: 0 2px 8px rgba(2, 6, 23, 0.18);
|
|
722
|
+
border-color: color-mix(in srgb, var(--ui-cp-accent) 55%, var(--ui-cp-border));
|
|
720
723
|
}
|
|
721
724
|
|
|
722
725
|
.swatch[data-selected="true"] {
|
|
@@ -731,7 +734,7 @@ const I = "#2563eb", L = "editora:ui-color-picker:recent", tt = `
|
|
|
731
734
|
|
|
732
735
|
.error {
|
|
733
736
|
min-block-size: 16px;
|
|
734
|
-
color: var(--ui-color-danger, #dc2626);
|
|
737
|
+
color: var(--ui-color-danger-text, var(--ui-color-danger, #dc2626));
|
|
735
738
|
font: 500 11px/1.2 "Inter", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
736
739
|
}
|
|
737
740
|
|
|
@@ -747,7 +750,7 @@ const I = "#2563eb", L = "editora:ui-color-picker:recent", tt = `
|
|
|
747
750
|
|
|
748
751
|
.actions .btn {
|
|
749
752
|
min-block-size: 28px;
|
|
750
|
-
border-radius:
|
|
753
|
+
border-radius: var(--ui-control-radius-2, var(--ui-radius, 6px));
|
|
751
754
|
border: 1px solid color-mix(in srgb, var(--ui-cp-border) 84%, transparent);
|
|
752
755
|
background: color-mix(in srgb, var(--ui-cp-bg) 95%, transparent);
|
|
753
756
|
color: var(--ui-cp-text);
|
|
@@ -760,9 +763,25 @@ const I = "#2563eb", L = "editora:ui-color-picker:recent", tt = `
|
|
|
760
763
|
color var(--ui-cp-duration) var(--ui-cp-ease);
|
|
761
764
|
}
|
|
762
765
|
|
|
766
|
+
.actions .btn:hover {
|
|
767
|
+
background: color-mix(in srgb, var(--ui-cp-accent) 10%, var(--ui-cp-bg));
|
|
768
|
+
border-color: color-mix(in srgb, var(--ui-cp-accent) 34%, var(--ui-cp-border));
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
.actions .btn[data-tone="primary"]:hover {
|
|
772
|
+
border-color: transparent;
|
|
773
|
+
background: color-mix(in srgb, var(--ui-color-primary, var(--ui-cp-accent)) 88%, #000);
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
.actions .btn:focus-visible {
|
|
777
|
+
outline: 2px solid color-mix(in srgb, var(--ui-cp-accent) 64%, transparent);
|
|
778
|
+
outline-offset: 2px;
|
|
779
|
+
}
|
|
780
|
+
|
|
763
781
|
.actions .btn[data-tone="primary"] {
|
|
764
|
-
border-color:
|
|
765
|
-
background: color-
|
|
782
|
+
border-color: transparent;
|
|
783
|
+
background: var(--ui-color-primary, var(--ui-cp-accent));
|
|
784
|
+
color: var(--ui-color-foreground-on-primary, #ffffff);
|
|
766
785
|
}
|
|
767
786
|
|
|
768
787
|
.actions .btn[hidden] {
|
|
@@ -897,18 +916,18 @@ const I = "#2563eb", L = "editora:ui-color-picker:recent", tt = `
|
|
|
897
916
|
overflow: auto;
|
|
898
917
|
}
|
|
899
918
|
`;
|
|
900
|
-
function u(
|
|
901
|
-
return Math.max(t, Math.min(e,
|
|
919
|
+
function u(o, t, e) {
|
|
920
|
+
return Math.max(t, Math.min(e, o));
|
|
902
921
|
}
|
|
903
|
-
function E(
|
|
904
|
-
return Math.abs(
|
|
922
|
+
function E(o, t) {
|
|
923
|
+
return Math.abs(o - t) <= 5e-4;
|
|
905
924
|
}
|
|
906
|
-
function k(
|
|
907
|
-
return
|
|
925
|
+
function k(o) {
|
|
926
|
+
return o.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
908
927
|
}
|
|
909
928
|
class rt extends q {
|
|
910
929
|
constructor() {
|
|
911
|
-
super(), this._syncing = !1, this._initialized = !1, this._rgba = b(
|
|
930
|
+
super(), this._syncing = !1, this._initialized = !1, this._rgba = b(v(I) || { r: 37, g: 99, b: 235, a: 1 }), this._hsva = z(this._rgba), this._format = "hex", this._open = !1, this._error = "", this._presets = [], this._recentColors = [], this._panelCache = /* @__PURE__ */ new WeakMap(), this._overlay = null, this._overlayRoot = null, this._releaseScrollLock = null, this._restoreFocusEl = null, this._isSheetOpen = !1, this._dragTarget = null, this._dragPointerId = -1, this._dragRect = null, this._dragX = 0, this._dragY = 0, this._dragRaf = 0, this._dragChanged = !1, this._dragSource = "drag", this._renderingSwatches = !1, this._scheduleOverlayPosition = O(() => this._positionOverlay()), this._onRootClickBound = (t) => this._onPanelClick(t, "root"), this._onRootInputBound = (t) => this._onPanelInput(t, "root"), this._onRootChangeBound = (t) => this._onPanelChange(t, "root"), this._onRootKeyDownBound = (t) => this._onPanelKeyDown(t, "root"), this._onRootPointerDownBound = (t) => this._onPanelPointerDown(t, "root"), this._onRootPointerMoveBound = (t) => this._onPanelPointerMove(t), this._onRootPointerUpBound = (t) => this._onPanelPointerUp(t), this._onRootPointerCancelBound = (t) => this._onPanelPointerCancel(t), this._onDocumentPointerDownBound = (t) => this._onDocumentPointerDown(t), this._onDocumentKeyDownBound = (t) => this._onDocumentKeyDown(t), this._onWindowResizeBound = () => this._scheduleOverlayPosition.run(), this._onWindowScrollBound = (t) => {
|
|
912
931
|
F(t, [this._overlay]) || this._scheduleOverlayPosition.run();
|
|
913
932
|
}, this._applyValueAttribute(!1), this._applyFormatAttribute(), this._open = this.hasAttribute("open"), this._parsePresetsAttribute();
|
|
914
933
|
}
|
|
@@ -994,7 +1013,7 @@ class rt extends q {
|
|
|
994
1013
|
this._setOpen(t, "api");
|
|
995
1014
|
}
|
|
996
1015
|
setColor(t) {
|
|
997
|
-
const e =
|
|
1016
|
+
const e = v(t || "");
|
|
998
1017
|
if (!e) {
|
|
999
1018
|
this._setInvalid(t, "Invalid color format");
|
|
1000
1019
|
return;
|
|
@@ -1218,10 +1237,10 @@ class rt extends q {
|
|
|
1218
1237
|
_applyValueAttribute(t) {
|
|
1219
1238
|
const e = this.getAttribute("value");
|
|
1220
1239
|
if (!e) {
|
|
1221
|
-
this._applyRgba(
|
|
1240
|
+
this._applyRgba(v(I) || this._rgba, !1);
|
|
1222
1241
|
return;
|
|
1223
1242
|
}
|
|
1224
|
-
const r =
|
|
1243
|
+
const r = v(e);
|
|
1225
1244
|
if (!r) {
|
|
1226
1245
|
t && this._setInvalid(e, "Unable to parse color value");
|
|
1227
1246
|
return;
|
|
@@ -1243,7 +1262,7 @@ class rt extends q {
|
|
|
1243
1262
|
const r = [];
|
|
1244
1263
|
for (const i of e) {
|
|
1245
1264
|
if (typeof i != "string") continue;
|
|
1246
|
-
const a =
|
|
1265
|
+
const a = v(i);
|
|
1247
1266
|
if (!a) continue;
|
|
1248
1267
|
const n = _(this._normalizeByAlpha(a), this._alphaEnabled());
|
|
1249
1268
|
r.includes(n) || r.push(n);
|
|
@@ -1264,7 +1283,7 @@ class rt extends q {
|
|
|
1264
1283
|
if (!t) return;
|
|
1265
1284
|
const e = JSON.parse(t);
|
|
1266
1285
|
if (!Array.isArray(e)) return;
|
|
1267
|
-
this._recentColors = e.filter((r) => typeof r == "string").map((r) =>
|
|
1286
|
+
this._recentColors = e.filter((r) => typeof r == "string").map((r) => v(r)).filter((r) => !!r).map((r) => _(this._normalizeByAlpha(r), this._alphaEnabled())).slice(0, this._maxRecent());
|
|
1268
1287
|
} catch {
|
|
1269
1288
|
this._recentColors = [];
|
|
1270
1289
|
}
|
|
@@ -1479,12 +1498,12 @@ class rt extends q {
|
|
|
1479
1498
|
return this._isPopoverMode() && this._open && this._overlayRoot ? this._overlayRoot.querySelector('[data-cp-panel="overlay"]') : this.root.querySelector('[data-cp-panel="inline"]');
|
|
1480
1499
|
}
|
|
1481
1500
|
_updateUI(t, e = !1) {
|
|
1482
|
-
const r = this.root.querySelector('[data-role="trigger-wrap"]'), i = this.root.querySelector(".trigger"), a = this.root.querySelector('[data-role="trigger-value"]'), n = this.root.querySelector('[data-role="trigger-preview"]'),
|
|
1483
|
-
r && (r.hidden = !l), i && (i.disabled = h ||
|
|
1501
|
+
const r = this.root.querySelector('[data-role="trigger-wrap"]'), i = this.root.querySelector(".trigger"), a = this.root.querySelector('[data-role="trigger-value"]'), n = this.root.querySelector('[data-role="trigger-preview"]'), s = this.root.querySelector('[data-role="inline-panel"]'), l = this._isPopoverMode(), c = this._state(), p = this._tone(), f = c === "loading", h = this._isDisabled(), x = this._isReadonly(), R = this._serializeValue() || this._placeholder();
|
|
1502
|
+
r && (r.hidden = !l), i && (i.disabled = h || f, i.dataset.state = c, i.dataset.tone = p, i.setAttribute("aria-expanded", l && this._open ? "true" : "false"), this._applyAria(i, R)), a && (a.textContent = R), n && (n.style.background = w(this._rgba, !0)), s && (s.hidden = l), this._forEachPanel((d) => this._updatePanel(d, { skipSwatches: t, disabled: h, readonly: x, loading: f, state: c, tone: p, modePopover: l, liveOnly: e }));
|
|
1484
1503
|
}
|
|
1485
1504
|
_updatePanel(t, e) {
|
|
1486
|
-
const r = this._rgba, i = M(r), a = this._hsva, n = `hsl(${Math.round(a.h)} 100% 50%)`,
|
|
1487
|
-
if (this._applyAria(t.panel), t.panel.dataset.state = l ? "error" : e.state, t.panel.dataset.tone = e.tone, t.panel.setAttribute("aria-busy", e.loading ? "true" : "false"),
|
|
1505
|
+
const r = this._rgba, i = M(r), a = this._hsva, n = `hsl(${Math.round(a.h)} 100% 50%)`, s = t.panel.getAttribute("data-cp-panel") === "overlay", l = !!this._error || e.state === "error", c = e.disabled || e.readonly || e.loading;
|
|
1506
|
+
if (this._applyAria(t.panel), t.panel.dataset.state = l ? "error" : e.state, t.panel.dataset.tone = e.tone, t.panel.setAttribute("aria-busy", e.loading ? "true" : "false"), s && e.modePopover ? (t.panel.setAttribute("role", "dialog"), t.panel.setAttribute("aria-modal", "true"), t.panel.tabIndex = -1) : (t.panel.removeAttribute("role"), t.panel.removeAttribute("aria-modal"), t.panel.removeAttribute("tabindex")), t.label && (t.label.textContent = this._labelText()), t.valueText && (t.valueText.textContent = this._serializeValue()), t.preview && (t.preview.style.background = w(r, !0)), t.status) {
|
|
1488
1507
|
let d = "";
|
|
1489
1508
|
l ? d = "Error" : e.state === "loading" ? d = "Syncing" : e.state === "success" && (d = "Saved"), t.status.hidden = !d, t.status.textContent = d, t.status.dataset.tone = e.tone;
|
|
1490
1509
|
}
|
|
@@ -1499,7 +1518,7 @@ class rt extends q {
|
|
|
1499
1518
|
linear-gradient(-45deg, transparent 75%, var(--ui-cp-checker-a) 75%),
|
|
1500
1519
|
linear-gradient(to right, rgba(${r.r}, ${r.g}, ${r.b}, 0), rgba(${r.r}, ${r.g}, ${r.b}, 1))
|
|
1501
1520
|
`), t.alphaThumb && (t.alphaThumb.style.left = `${u(a.a * 100, 1, 99)}%`);
|
|
1502
|
-
const p = t.panel.getRootNode(),
|
|
1521
|
+
const p = t.panel.getRootNode(), f = p instanceof ShadowRoot ? p.activeElement : t.panel.ownerDocument.activeElement, h = f && t.panel.contains(f) ? f.getAttribute("data-input") : null;
|
|
1503
1522
|
if (t.inputHex && h !== "hex" && (t.inputHex.value = _(r, this._alphaEnabled())), t.inputR && h !== "r" && (t.inputR.value = String(r.r)), t.inputG && h !== "g" && (t.inputG.value = String(r.g)), t.inputB && h !== "b" && (t.inputB.value = String(r.b)), t.inputA1 && h !== "a1" && (t.inputA1.value = this._alphaEnabled() ? String(Number(r.a.toFixed(3))) : "1"), t.inputH && h !== "h" && (t.inputH.value = String(Math.round(i.h))), t.inputS && h !== "s" && (t.inputS.value = String(Math.round(i.s))), t.inputL && h !== "l" && (t.inputL.value = String(Math.round(i.l))), t.inputA2 && h !== "a2" && (t.inputA2.value = this._alphaEnabled() ? String(Number(r.a.toFixed(3))) : "1"), e.liveOnly) return;
|
|
1504
1523
|
if (t.tabHex && (t.tabHex.dataset.active = String(this._format === "hex")), t.tabRgb && (t.tabRgb.dataset.active = String(this._format === "rgb")), t.tabHsl && (t.tabHsl.dataset.active = String(this._format === "hsl")), t.groupHex && (t.groupHex.hidden = this._format !== "hex"), t.groupRgb && (t.groupRgb.hidden = this._format !== "rgb"), t.groupHsl && (t.groupHsl.hidden = this._format !== "hsl"), t.inputA1 && (t.inputA1.disabled = !this._alphaEnabled() || c), t.inputA2 && (t.inputA2.disabled = !this._alphaEnabled() || c), t.error) {
|
|
1505
1524
|
const d = this._error || (e.state === "error" ? "Unable to validate current color value." : "");
|
|
@@ -1525,12 +1544,12 @@ class rt extends q {
|
|
|
1525
1544
|
_renderSwatches(t) {
|
|
1526
1545
|
const e = this._currentHex().toLowerCase();
|
|
1527
1546
|
t.presets && (t.presets.innerHTML = this._presets.map((r) => {
|
|
1528
|
-
const i =
|
|
1547
|
+
const i = v(r);
|
|
1529
1548
|
if (!i) return "";
|
|
1530
1549
|
const a = _(this._normalizeByAlpha(i), this._alphaEnabled()), n = a.toLowerCase() === e ? ' data-selected="true"' : "";
|
|
1531
1550
|
return `<button type="button" class="swatch" part="swatch" data-action="preset" data-color="${k(a)}"${n} title="${k(a)}" style="background:${k(w(i, !0))}"></button>`;
|
|
1532
1551
|
}).join("")), t.recentTitle && (t.recentTitle.hidden = !this._recentEnabled() || this._recentColors.length === 0), t.recent && (t.recent.hidden = !this._recentEnabled() || this._recentColors.length === 0, t.recent.innerHTML = this._recentColors.map((r) => {
|
|
1533
|
-
const i =
|
|
1552
|
+
const i = v(r);
|
|
1534
1553
|
if (!i) return "";
|
|
1535
1554
|
const a = _(this._normalizeByAlpha(i), this._alphaEnabled()), n = a.toLowerCase() === e ? ' data-selected="true"' : "";
|
|
1536
1555
|
return `<button type="button" class="swatch" part="swatch recent" data-action="recent" data-color="${k(a)}"${n} title="${k(a)}" style="background:${k(w(i, !0))}"></button>`;
|
|
@@ -1572,7 +1591,7 @@ class rt extends q {
|
|
|
1572
1591
|
}
|
|
1573
1592
|
if (a === "clear") {
|
|
1574
1593
|
if (this._isReadonly()) return;
|
|
1575
|
-
const n =
|
|
1594
|
+
const n = v(I);
|
|
1576
1595
|
n && (this._applyRgba(n, !1), this._error = "", this._syncValueAttribute(), this._emitInput("text"), this._emitChange("text"), this._pushRecent(this._currentHex()), this._updateUI(!1));
|
|
1577
1596
|
return;
|
|
1578
1597
|
}
|
|
@@ -1582,10 +1601,10 @@ class rt extends q {
|
|
|
1582
1601
|
}
|
|
1583
1602
|
if (a === "preset" || a === "recent") {
|
|
1584
1603
|
if (this._isReadonly()) return;
|
|
1585
|
-
const n = i.getAttribute("data-color") || "",
|
|
1586
|
-
if (!
|
|
1604
|
+
const n = i.getAttribute("data-color") || "", s = v(n);
|
|
1605
|
+
if (!s) return;
|
|
1587
1606
|
const l = a === "preset" ? "preset" : "recent";
|
|
1588
|
-
this._applyRgba(
|
|
1607
|
+
this._applyRgba(s, !0), this._error = "", this._syncValueAttribute(), this._emitInput(l), this._emitChange(l), this._pushRecent(this._currentHex()), this._updateUI(!1);
|
|
1589
1608
|
return;
|
|
1590
1609
|
}
|
|
1591
1610
|
}
|
|
@@ -1628,18 +1647,18 @@ class rt extends q {
|
|
|
1628
1647
|
if (!i || this._isReadonly() || this._isLoading()) return;
|
|
1629
1648
|
const a = t.shiftKey ? 5 : 1;
|
|
1630
1649
|
let n = !1;
|
|
1631
|
-
const
|
|
1650
|
+
const s = { ...this._hsva };
|
|
1632
1651
|
if (i === "sv") {
|
|
1633
|
-
t.key === "ArrowLeft" ? (
|
|
1652
|
+
t.key === "ArrowLeft" ? (s.s = u(s.s - a, 0, 100), n = !0) : t.key === "ArrowRight" ? (s.s = u(s.s + a, 0, 100), n = !0) : t.key === "ArrowUp" ? (s.v = u(s.v + a, 0, 100), n = !0) : t.key === "ArrowDown" ? (s.v = u(s.v - a, 0, 100), n = !0) : t.key === "Home" ? (s.s = 0, s.v = 100, n = !0) : t.key === "End" && (s.s = 100, s.v = 0, n = !0), n && (t.preventDefault(), this._commitHsva(s, "drag"));
|
|
1634
1653
|
return;
|
|
1635
1654
|
}
|
|
1636
1655
|
if (i === "hue") {
|
|
1637
|
-
t.key === "ArrowLeft" || t.key === "ArrowDown" ? (
|
|
1656
|
+
t.key === "ArrowLeft" || t.key === "ArrowDown" ? (s.h = u(s.h - a, 0, 360), n = !0) : t.key === "ArrowRight" || t.key === "ArrowUp" ? (s.h = u(s.h + a, 0, 360), n = !0) : t.key === "Home" ? (s.h = 0, n = !0) : t.key === "End" && (s.h = 360, n = !0), n && (t.preventDefault(), this._commitHsva(s, "slider"));
|
|
1638
1657
|
return;
|
|
1639
1658
|
}
|
|
1640
1659
|
if (i === "alpha" && this._alphaEnabled()) {
|
|
1641
1660
|
const l = t.shiftKey ? 0.1 : 0.01;
|
|
1642
|
-
t.key === "ArrowLeft" || t.key === "ArrowDown" ? (
|
|
1661
|
+
t.key === "ArrowLeft" || t.key === "ArrowDown" ? (s.a = u(s.a - l, 0, 1), n = !0) : t.key === "ArrowRight" || t.key === "ArrowUp" ? (s.a = u(s.a + l, 0, 1), n = !0) : t.key === "Home" ? (s.a = 0, n = !0) : t.key === "End" && (s.a = 1, n = !0), n && (t.preventDefault(), this._commitHsva(s, "slider"));
|
|
1643
1662
|
}
|
|
1644
1663
|
}
|
|
1645
1664
|
_commitHsva(t, e) {
|
|
@@ -1649,22 +1668,22 @@ class rt extends q {
|
|
|
1649
1668
|
if (!t) return null;
|
|
1650
1669
|
const e = this._panelRefs(t);
|
|
1651
1670
|
if (this._format === "hex") {
|
|
1652
|
-
const l = e.inputHex?.value || "", c = l.trim().startsWith("#") ? l.trim() : `#${l.trim()}`, p =
|
|
1671
|
+
const l = e.inputHex?.value || "", c = l.trim().startsWith("#") ? l.trim() : `#${l.trim()}`, p = v(c);
|
|
1653
1672
|
return p ? this._normalizeByAlpha(p) : null;
|
|
1654
1673
|
}
|
|
1655
1674
|
if (this._format === "rgb") {
|
|
1656
|
-
const l = Number(e.inputR?.value ?? ""), c = Number(e.inputG?.value ?? ""), p = Number(e.inputB?.value ?? ""),
|
|
1657
|
-
return [l, c, p,
|
|
1675
|
+
const l = Number(e.inputR?.value ?? ""), c = Number(e.inputG?.value ?? ""), p = Number(e.inputB?.value ?? ""), f = this._alphaEnabled() ? Number(e.inputA1?.value ?? "") : 1;
|
|
1676
|
+
return [l, c, p, f].every((h) => Number.isFinite(h)) ? this._normalizeByAlpha({ r: l, g: c, b: p, a: f }) : null;
|
|
1658
1677
|
}
|
|
1659
1678
|
const r = Number(e.inputH?.value ?? ""), i = Number(e.inputS?.value ?? ""), a = Number(e.inputL?.value ?? ""), n = this._alphaEnabled() ? Number(e.inputA2?.value ?? "") : 1;
|
|
1660
1679
|
if (![r, i, a, n].every((l) => Number.isFinite(l))) return null;
|
|
1661
|
-
const
|
|
1680
|
+
const s = {
|
|
1662
1681
|
h: u(r, 0, 360),
|
|
1663
1682
|
s: u(i, 0, 100),
|
|
1664
1683
|
l: u(a, 0, 100),
|
|
1665
1684
|
a: u(n, 0, 1)
|
|
1666
1685
|
};
|
|
1667
|
-
return this._normalizeByAlpha($(
|
|
1686
|
+
return this._normalizeByAlpha($(s));
|
|
1668
1687
|
}
|
|
1669
1688
|
_onPanelPointerDown(t, e) {
|
|
1670
1689
|
if (this._isDisabled() || this._isReadonly() || this._isLoading()) return;
|
|
@@ -1728,7 +1747,7 @@ class rt extends q {
|
|
|
1728
1747
|
const t = window.EyeDropper;
|
|
1729
1748
|
if (typeof t == "function")
|
|
1730
1749
|
try {
|
|
1731
|
-
const r = await new t().open(), i =
|
|
1750
|
+
const r = await new t().open(), i = v(r?.sRGBHex || "");
|
|
1732
1751
|
if (!i) return;
|
|
1733
1752
|
this._applyRgba(i, !0), this._error = "", this._syncValueAttribute(), this._emitInput("eyedropper"), this._emitChange("eyedropper"), this._pushRecent(this._currentHex()), this._updateUI(!1);
|
|
1734
1753
|
} catch {
|
|
@@ -1765,9 +1784,9 @@ class rt extends q {
|
|
|
1765
1784
|
this.dispatchEvent(new CustomEvent("toast", { detail: { message: r }, bubbles: !0, composed: !0 }));
|
|
1766
1785
|
}
|
|
1767
1786
|
_applyAria(t, e = "") {
|
|
1768
|
-
const r = this.getAttribute("aria-labelledby"), i = this.getAttribute("aria-describedby"), a = this.getAttribute("aria-label"), n = this.getRootNode(),
|
|
1787
|
+
const r = this.getAttribute("aria-labelledby"), i = this.getAttribute("aria-describedby"), a = this.getAttribute("aria-label"), n = this.getRootNode(), s = r ? r.split(/\s+/).map((p) => n.getElementById?.(p)?.textContent?.trim() || "").filter(Boolean).join(" ") : "";
|
|
1769
1788
|
t.removeAttribute("aria-labelledby"), i ? t.setAttribute("aria-describedby", i) : t.removeAttribute("aria-describedby");
|
|
1770
|
-
const l =
|
|
1789
|
+
const l = s || a || "Color picker", c = e && !l.includes(e) ? `${l}, ${e}` : l;
|
|
1771
1790
|
t.setAttribute("aria-label", c);
|
|
1772
1791
|
}
|
|
1773
1792
|
}
|