@vonage/vivid 5.2.0 → 5.4.0
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/accordion-item/definition.cjs +2 -1
- package/accordion-item/definition.js +3 -2
- package/alert/definition.cjs +1 -1
- package/alert/definition.js +2 -2
- package/alert/index.cjs +1 -1
- package/alert/index.js +1 -1
- package/audio-player/definition.cjs +4 -2
- package/audio-player/definition.js +4 -2
- package/audio-player/index.cjs +5 -3
- package/audio-player/index.js +5 -3
- package/badge/definition.js +1 -1
- package/badge/index.cjs +2 -2
- package/badge/index.js +4 -4
- package/banner/definition.js +1 -1
- package/banner/index.cjs +3 -3
- package/banner/index.js +6 -6
- package/breadcrumb-item/index.cjs +1 -1
- package/breadcrumb-item/index.js +1 -1
- package/bundled/affix.cjs +7 -7
- package/bundled/affix.js +5 -5
- package/bundled/anchored.cjs +1 -1
- package/bundled/anchored.js +6 -6
- package/bundled/attribute-binding-behaviour.cjs +1 -1
- package/bundled/attribute-binding-behaviour.js +15 -13
- package/bundled/base-color-picker.cjs +13 -0
- package/bundled/base-color-picker.js +194 -0
- package/bundled/button.cjs +1 -1
- package/bundled/button.js +2 -2
- package/bundled/calendar-picker.template.cjs +7 -7
- package/bundled/calendar-picker.template.js +118 -118
- package/bundled/char-count.cjs +1 -1
- package/bundled/char-count.js +1 -1
- package/bundled/children.cjs +1 -1
- package/bundled/children.js +28 -20
- package/bundled/definition.cjs +3 -3
- package/bundled/definition.js +38 -38
- package/bundled/definition10.cjs +72 -18
- package/bundled/definition10.js +351 -65
- package/bundled/definition11.cjs +19 -10
- package/bundled/definition11.js +217 -36
- package/bundled/definition12.cjs +10 -1
- package/bundled/definition12.js +38 -14
- package/bundled/definition13.cjs +1 -73
- package/bundled/definition13.js +15 -354
- package/bundled/definition15.cjs +1 -1
- package/bundled/definition15.js +1 -1
- package/bundled/definition16.cjs +2 -2
- package/bundled/definition16.js +8 -8
- package/bundled/definition17.cjs +7 -7
- package/bundled/definition17.js +17 -17
- package/bundled/definition19.cjs +23 -24
- package/bundled/definition19.js +151 -163
- package/bundled/definition2.cjs +9 -5
- package/bundled/definition2.js +21 -17
- package/bundled/definition22.cjs +9 -9
- package/bundled/definition22.js +31 -31
- package/bundled/definition3.cjs +1 -1
- package/bundled/definition3.js +1 -1
- package/bundled/definition6.cjs +3 -3
- package/bundled/definition6.js +28 -28
- package/bundled/definition7.cjs +1 -1
- package/bundled/definition7.js +6 -6
- package/bundled/definition8.cjs +2 -2
- package/bundled/definition8.js +4 -4
- package/bundled/definition9.cjs +5 -5
- package/bundled/definition9.js +394 -392
- package/bundled/delegates-aria.cjs +1 -1
- package/bundled/delegates-aria.js +59 -46
- package/bundled/form-associated.cjs +1 -1
- package/bundled/form-associated.js +3 -3
- package/bundled/host-semantics.cjs +1 -1
- package/bundled/host-semantics.js +48 -34
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +82 -102
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +51 -36
- package/bundled/mixins.cjs +18 -18
- package/bundled/mixins.js +99 -93
- package/bundled/normalize.cjs +1 -0
- package/bundled/normalize.js +7 -0
- package/bundled/picker-field.template.cjs +1 -1
- package/bundled/picker-field.template.js +4 -4
- package/bundled/ref.cjs +1 -1
- package/bundled/ref.js +8 -25
- package/bundled/repeat.cjs +1 -1
- package/bundled/repeat.js +459 -233
- package/bundled/slider.template.cjs +1 -1
- package/bundled/slider.template.js +2 -2
- package/bundled/slotted.cjs +1 -1
- package/bundled/slotted.js +62 -45
- package/bundled/time-selection-picker.template.cjs +1 -1
- package/bundled/time-selection-picker.template.js +5 -5
- package/bundled/vivid-element.cjs +5 -1
- package/bundled/vivid-element.js +2159 -1162
- package/bundled/when.cjs +1 -1
- package/bundled/when.js +8 -7
- package/calendar/definition.cjs +1 -1
- package/calendar/definition.js +2 -2
- package/calendar/index.cjs +1 -1
- package/calendar/index.js +15 -15
- package/calendar-event/index.cjs +1 -1
- package/calendar-event/index.js +1 -1
- package/card/definition.cjs +11 -3
- package/card/definition.js +11 -3
- package/card/index.cjs +19 -11
- package/card/index.js +35 -27
- package/color-picker/definition.cjs +1079 -0
- package/color-picker/definition.js +1073 -0
- package/color-picker/index.cjs +127 -0
- package/color-picker/index.js +726 -0
- package/combobox/definition.cjs +8 -28
- package/combobox/definition.js +10 -30
- package/combobox/index.cjs +7 -7
- package/combobox/index.js +60 -74
- package/contextual-help/index.cjs +1 -1
- package/contextual-help/index.js +1 -1
- package/custom-elements.json +1670 -163
- package/data-grid/definition.cjs +862 -27
- package/data-grid/definition.js +863 -28
- package/data-grid/index.cjs +25 -25
- package/data-grid/index.js +175 -168
- package/date-picker/definition.cjs +1 -1
- package/date-picker/definition.js +1 -1
- package/date-picker/index.cjs +1 -1
- package/date-picker/index.js +2 -2
- package/date-range-picker/definition.cjs +1 -1
- package/date-range-picker/definition.js +1 -1
- package/date-range-picker/index.cjs +1 -1
- package/date-range-picker/index.js +2 -2
- package/date-time-picker/definition.cjs +1 -1
- package/date-time-picker/definition.js +1 -1
- package/date-time-picker/index.cjs +1 -1
- package/date-time-picker/index.js +2 -2
- package/dial-pad/definition.cjs +4 -0
- package/dial-pad/definition.js +4 -0
- package/dial-pad/index.cjs +3 -3
- package/dial-pad/index.js +42 -39
- package/dialog/definition.cjs +6 -3
- package/dialog/definition.js +6 -3
- package/dialog/index.cjs +22 -19
- package/dialog/index.js +48 -45
- package/elevation/definition.cjs +1 -1
- package/elevation/definition.js +1 -1
- package/empty-state/definition.cjs +7 -2
- package/empty-state/definition.js +7 -2
- package/empty-state/index.cjs +10 -5
- package/empty-state/index.js +18 -13
- package/fab/definition.js +1 -1
- package/fab/index.cjs +2 -2
- package/fab/index.js +4 -4
- package/file-picker/definition.cjs +2 -2
- package/file-picker/definition.js +3 -3
- package/file-picker/index.cjs +1 -1
- package/file-picker/index.js +4 -4
- package/header/definition.cjs +1 -1
- package/header/definition.js +1 -1
- package/icon/definition.cjs +10 -6
- package/icon/definition.js +10 -6
- package/index.cjs +7 -4
- package/index.js +3 -3
- package/lib/accordion/accordion.d.ts +1 -1
- package/lib/accordion/definition.d.ts +1 -1
- package/lib/accordion-item/accordion-item.d.ts +2 -2
- package/lib/action-group/action-group.d.ts +2 -2
- package/lib/alert/alert.d.ts +4 -4
- package/lib/audio-player/audio-player.d.ts +3 -3
- package/lib/avatar/avatar.d.ts +2 -2
- package/lib/badge/badge.d.ts +2 -2
- package/lib/banner/banner.d.ts +6 -6
- package/lib/breadcrumb/breadcrumb.d.ts +2 -2
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +2 -2
- package/lib/button/button.d.ts +6 -6
- package/lib/button/button.template.d.ts +2 -1
- package/lib/calendar/calendar.d.ts +1 -1
- package/lib/calendar-event/calendar-event.d.ts +2 -2
- package/lib/card/card.d.ts +2 -2
- package/lib/checkbox/checkbox.d.ts +12 -12
- package/lib/color-picker/color-picker.d.ts +2420 -0
- package/lib/color-picker/color-picker.template.d.ts +3 -0
- package/lib/color-picker/definition.d.ts +4 -0
- package/lib/color-picker/locale.d.ts +9 -0
- package/lib/combobox/combobox.d.ts +15 -14
- package/lib/combobox/combobox.options.d.ts +1 -1
- package/lib/components.d.ts +1 -0
- package/lib/data-grid/data-grid-cell.d.ts +4 -4
- package/lib/data-grid/data-grid-row.d.ts +3 -4
- package/lib/data-grid/data-grid.d.ts +1 -2
- package/lib/date-picker/date-picker.d.ts +54 -54
- package/lib/date-range-picker/date-range-picker.d.ts +28 -28
- package/lib/date-time-picker/date-time-picker.d.ts +56 -56
- package/lib/dial-pad/dial-pad.d.ts +3 -2
- package/lib/dialog/dialog.d.ts +4 -4
- package/lib/divider/divider.d.ts +3 -3
- package/lib/fab/fab.d.ts +2 -2
- package/lib/file-picker/file-picker.d.ts +14 -14
- package/lib/header/header.d.ts +2 -2
- package/lib/menu/menu.d.ts +4 -4
- package/lib/menu-item/menu-item-role.d.ts +1 -1
- package/lib/menu-item/menu-item.d.ts +4 -4
- package/lib/nav/nav.d.ts +2 -2
- package/lib/nav-disclosure/nav-disclosure.d.ts +4 -4
- package/lib/nav-item/nav-item.d.ts +4 -4
- package/lib/note/note.d.ts +2 -2
- package/lib/number-field/number-field.d.ts +18 -18
- package/lib/option/option.d.ts +4 -4
- package/lib/pagination/pagination.d.ts +2 -2
- package/lib/popup/popup.d.ts +1 -1
- package/lib/progress/progress.d.ts +2 -2
- package/lib/progress-ring/progress-ring.d.ts +2 -2
- package/lib/radio/radio.d.ts +6 -6
- package/lib/radio-group/radio-group.d.ts +2 -2
- package/lib/range-slider/range-slider.d.ts +6 -6
- package/lib/rich-text-editor/menubar/menubar.d.ts +2 -2
- package/lib/rich-text-editor/rich-text-editor.d.ts +2 -2
- package/lib/searchable-select/locale.d.ts +4 -0
- package/lib/searchable-select/option-tag.d.ts +2 -2
- package/lib/searchable-select/searchable-select.d.ts +21 -18
- package/lib/select/select.d.ts +19 -17
- package/lib/selectable-box/selectable-box.d.ts +2 -2
- package/lib/simple-color-picker/locale.d.ts +0 -1
- package/lib/simple-color-picker/simple-color-picker.d.ts +47 -821
- package/lib/slider/slider.d.ts +7 -7
- package/lib/split-button/split-button.d.ts +6 -6
- package/lib/switch/switch.d.ts +4 -4
- package/lib/tab/tab.d.ts +6 -6
- package/lib/tab-panel/tab-panel.d.ts +2 -2
- package/lib/tabs/tabs.d.ts +2 -2
- package/lib/tag/tag.d.ts +6 -6
- package/lib/tag-group/tag-group.d.ts +2 -2
- package/lib/tag-name-map.d.ts +2 -1
- package/lib/text-area/text-area.d.ts +17 -17
- package/lib/text-field/text-field.d.ts +19 -19
- package/lib/time-picker/time-picker.d.ts +28 -28
- package/lib/toggletip/toggletip.d.ts +4 -4
- package/lib/tooltip/tooltip.d.ts +2 -2
- package/lib/tree-item/tree-item.d.ts +4 -4
- package/lib/tree-view/tree-view.d.ts +2 -2
- package/lib/video-player/video-player.d.ts +2 -2
- package/locales/de-DE.cjs +17 -2
- package/locales/de-DE.js +17 -2
- package/locales/en-GB.cjs +17 -2
- package/locales/en-GB.js +17 -2
- package/locales/en-US.cjs +17 -2
- package/locales/en-US.js +17 -2
- package/locales/ja-JP.cjs +17 -2
- package/locales/ja-JP.js +17 -2
- package/locales/zh-CN.cjs +17 -2
- package/locales/zh-CN.js +17 -2
- package/menu/definition.cjs +6 -6
- package/menu/definition.js +7 -7
- package/nav-disclosure/definition.js +1 -1
- package/nav-item/definition.js +1 -1
- package/note/definition.js +1 -1
- package/note/index.cjs +2 -2
- package/note/index.js +4 -4
- package/number-field/definition.cjs +1 -1
- package/number-field/definition.js +3 -3
- package/number-field/index.cjs +5 -5
- package/number-field/index.js +21 -21
- package/option/definition.cjs +6 -77
- package/option/definition.js +3 -78
- package/option/index.cjs +1 -1
- package/option/index.js +1 -1
- package/package.json +34 -8
- package/pagination/definition.cjs +2 -1
- package/pagination/definition.js +2 -1
- package/pagination/index.cjs +12 -12
- package/pagination/index.js +59 -59
- package/popup/definition.cjs +2 -2
- package/popup/definition.js +2 -2
- package/progress/index.cjs +1 -1
- package/progress/index.js +1 -1
- package/radio/definition.cjs +9 -9
- package/radio/definition.js +10 -10
- package/radio-group/definition.cjs +2 -1
- package/radio-group/definition.js +2 -1
- package/radio-group/index.cjs +5 -5
- package/radio-group/index.js +80 -77
- package/range-slider/definition.cjs +1 -1
- package/range-slider/definition.js +1 -1
- package/range-slider/index.cjs +1 -1
- package/range-slider/index.js +1 -1
- package/rich-text-editor/definition.cjs +3 -4
- package/rich-text-editor/definition.js +3 -4
- package/rich-text-editor/index.cjs +27 -27
- package/rich-text-editor/index.js +1208 -1198
- package/searchable-select/definition.cjs +106 -14
- package/searchable-select/definition.js +107 -15
- package/searchable-select/index.cjs +81 -69
- package/searchable-select/index.js +362 -276
- package/select/definition.cjs +25 -42
- package/select/definition.js +26 -43
- package/selectable-box/definition.cjs +1 -1
- package/selectable-box/definition.js +1 -1
- package/selectable-box/index.cjs +3 -3
- package/selectable-box/index.js +20 -20
- package/shared/aria/aria-change-subscription.d.ts +0 -1
- package/shared/aria/aria-mixin.d.ts +3 -3
- package/shared/aria/delegate-aria-behavior.d.ts +5 -10
- package/shared/aria/delegates-aria.d.ts +3 -3
- package/shared/aria/host-semantics-behavior.d.ts +5 -8
- package/shared/aria/host-semantics.d.ts +3 -3
- package/shared/color-picker/base-color-picker.d.ts +436 -0
- package/shared/color-picker/index.d.ts +1 -0
- package/shared/color-picker/locale.d.ts +3 -0
- package/shared/color-picker/utils.d.ts +1 -0
- package/shared/deprecation/replaced-props.d.ts +317 -2
- package/shared/design-system/defineVividComponent.d.ts +2 -2
- package/shared/feedback/feedback-message.d.ts +2 -2
- package/shared/feedback/mixins.d.ts +4 -4
- package/shared/foundation/button/button.d.ts +4 -4
- package/shared/foundation/form-associated/form-associated.d.ts +4 -4
- package/shared/foundation/listbox/listbox.d.ts +4 -0
- package/shared/foundation/vivid-element/vivid-element.d.ts +335 -8
- package/shared/localization/Locale.d.ts +4 -0
- package/shared/patterns/affix.d.ts +4 -4
- package/shared/patterns/anchored.d.ts +4 -4
- package/shared/patterns/char-count/char-count.d.ts +2 -2
- package/shared/patterns/form-elements/form-element.d.ts +4 -4
- package/shared/patterns/form-elements/with-contextual-help.d.ts +6 -6
- package/shared/patterns/form-elements/with-error-text.d.ts +6 -6
- package/shared/patterns/form-elements/with-success-text.d.ts +2 -2
- package/shared/patterns/linkable.d.ts +2 -2
- package/shared/patterns/localized.d.ts +2 -2
- package/shared/patterns/trapped-focus.d.ts +2 -2
- package/shared/picker-field/mixins/calendar-picker.d.ts +14 -14
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +14 -14
- package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +2 -2
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +28 -28
- package/shared/picker-field/mixins/single-date-picker.d.ts +40 -40
- package/shared/picker-field/mixins/single-value-picker.d.ts +12 -12
- package/shared/picker-field/mixins/time-selection-picker.d.ts +29 -29
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +28 -28
- package/shared/picker-field/picker-field.d.ts +14 -14
- package/shared/templating/attribute-binding-behaviour.d.ts +3 -4
- package/shared/templating/render-in-light-dom.d.ts +13 -12
- package/side-drawer/index.cjs +1 -1
- package/side-drawer/index.js +1 -1
- package/simple-color-picker/definition.cjs +29 -216
- package/simple-color-picker/definition.js +30 -217
- package/simple-color-picker/index.cjs +9 -21
- package/simple-color-picker/index.js +71 -185
- package/slider/definition.cjs +1 -1
- package/slider/definition.js +1 -1
- package/split-button/definition.js +1 -1
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/switch/index.cjs +2 -2
- package/switch/index.js +4 -4
- package/tab/definition.js +1 -1
- package/tabs/definition.cjs +1 -1
- package/tabs/definition.js +2 -2
- package/tabs/index.cjs +2 -2
- package/tabs/index.js +16 -16
- package/tag/definition.js +1 -1
- package/tag/index.cjs +1 -1
- package/tag/index.js +1 -1
- package/text-area/index.cjs +3 -3
- package/text-area/index.js +8 -8
- package/text-field/definition.cjs +2 -2
- package/text-field/definition.js +4 -4
- package/text-field/index.cjs +1 -1
- package/text-field/index.js +1 -1
- package/time-picker/definition.cjs +1 -1
- package/time-picker/definition.js +1 -1
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +2 -2
- package/toggletip/definition.cjs +2 -2
- package/toggletip/definition.js +3 -3
- package/tooltip/definition.cjs +1 -1
- package/tooltip/definition.js +1 -1
- package/tree-item/definition.cjs +1 -1
- package/tree-item/definition.js +1 -1
- package/tree-view/definition.cjs +2 -2
- package/tree-view/definition.js +3 -3
- package/tree-view/index.cjs +2 -2
- package/tree-view/index.js +6 -6
- package/unbundled/_commonjsHelpers.cjs +36 -0
- package/unbundled/_commonjsHelpers.js +32 -0
- package/unbundled/affix.cjs +1 -1
- package/unbundled/affix.js +2 -2
- package/unbundled/attribute-binding-behaviour.cjs +11 -10
- package/unbundled/attribute-binding-behaviour.js +11 -10
- package/unbundled/base-color-picker.cjs +278 -0
- package/unbundled/base-color-picker.js +275 -0
- package/unbundled/button.cjs +1 -1
- package/unbundled/button.js +2 -2
- package/unbundled/calendar-picker.template.cjs +4 -4
- package/unbundled/calendar-picker.template.js +5 -5
- package/unbundled/definition.js +1 -1
- package/unbundled/definition2.cjs +1 -1
- package/unbundled/definition2.js +3 -3
- package/unbundled/definition3.cjs +222 -140
- package/unbundled/definition3.js +220 -138
- package/unbundled/definition4.cjs +145 -235
- package/unbundled/definition4.js +143 -233
- package/unbundled/definition5.cjs +269 -27
- package/unbundled/definition5.js +267 -26
- package/unbundled/definition6.cjs +56 -0
- package/unbundled/definition6.js +52 -0
- package/unbundled/delegates-aria.cjs +67 -33
- package/unbundled/delegates-aria.js +69 -35
- package/unbundled/form-associated.cjs +2 -2
- package/unbundled/form-associated.js +3 -3
- package/unbundled/host-semantics.cjs +47 -22
- package/unbundled/host-semantics.js +48 -23
- package/unbundled/listbox.cjs +41 -63
- package/unbundled/listbox.js +39 -61
- package/unbundled/mixins.cjs +34 -27
- package/unbundled/mixins.js +35 -28
- package/unbundled/picker-field.template.cjs +3 -3
- package/unbundled/picker-field.template.js +4 -4
- package/unbundled/slider.template.cjs +1 -1
- package/unbundled/slider.template.js +1 -1
- package/unbundled/time-selection-picker.template.cjs +4 -4
- package/unbundled/time-selection-picker.template.js +5 -5
- package/unbundled/vivid-element.cjs +22 -15
- package/unbundled/vivid-element.js +23 -15
- package/video-player/definition.cjs +69047 -1
- package/video-player/definition.js +69047 -1
- package/video-player/index.cjs +36 -36
- package/video-player/index.js +1895 -1905
- package/visually-hidden/index.cjs +1 -1
- package/visually-hidden/index.js +1 -1
- package/vivid.api.json +719 -224
- package/bundled/option.cjs +0 -1
- package/bundled/option.js +0 -158
- package/unbundled/option.cjs +0 -217
- package/unbundled/option.js +0 -214
|
@@ -0,0 +1,726 @@
|
|
|
1
|
+
import { V as ee, a as x, o as G, n as te, h as n, c as oe, d as se } from "../bundled/vivid-element.js";
|
|
2
|
+
import { P as re, p as ae } from "../bundled/definition9.js";
|
|
3
|
+
import { I as ie, i as le } from "../bundled/definition2.js";
|
|
4
|
+
import { W as ne, f as ce } from "../bundled/mixins.js";
|
|
5
|
+
import { D as de, d as pe } from "../bundled/delegates-aria.js";
|
|
6
|
+
import { B as he, i as f } from "../bundled/base-color-picker.js";
|
|
7
|
+
import { W as ue } from "../bundled/with-contextual-help.js";
|
|
8
|
+
import { W as ve } from "../bundled/with-error-text.js";
|
|
9
|
+
import { W as fe } from "../bundled/with-success-text.js";
|
|
10
|
+
import { T as be, t as me } from "../bundled/definition10.js";
|
|
11
|
+
import { B as ge, b as xe } from "../bundled/definition3.js";
|
|
12
|
+
import { r as u } from "../bundled/ref.js";
|
|
13
|
+
import { w as J } from "../bundled/when.js";
|
|
14
|
+
import { s as L } from "../bundled/slotted.js";
|
|
15
|
+
import { r as Ce } from "../bundled/repeat.js";
|
|
16
|
+
import { c as M } from "../bundled/class-names.js";
|
|
17
|
+
const ye = ".palette{display:grid;grid-template-columns:repeat(var(--swatches-per-row, 7),var(--_color-swatch-size, 24px))}.swatch{position:relative;padding:0;border:none;border-radius:4px;background-color:var(--swatch-color);block-size:var(--_color-swatch-size, 24px);color:var(--vvd-color-canvas);cursor:pointer;inline-size:var(--_color-swatch-size, 24px)}.swatch.contrast{color:var(--vvd-color-canvas-text)}.swatch:focus-visible{outline:none;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent;--focus-inset: -3px}:host{display:inline-block}.base{display:inline-block;min-inline-size:var(--_color-picker-min-inline-size, 280px)}.control{inline-size:100%}.button{display:inline-flex;box-sizing:border-box;align-items:center;border:0 none;border-radius:4px;margin:0;background-color:var(--button-color, var(--vvd-color-canvas-text));block-size:calc(1px*(32 + 4*clamp(-1,var(--vvd-size-density, 0),2)));color:var(--vvd-color-canvas);inline-size:calc(1px*(32 + 4*clamp(-1,var(--vvd-size-density, 0),2)));padding-inline:calc(1px*(32 + 4*clamp(-1,var(--vvd-size-density, 0),2))/4);text-decoration:none;vertical-align:middle}.button.contrast{color:var(--vvd-color-canvas-text)}.button:not(.disabled){cursor:pointer}.button.disabled{background-color:var(--vvd-color-neutral-300);color:var(--vvd-color-neutral-500);cursor:not-allowed}.button:focus-visible{--focus-stroke-gap-color: transparent;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px))}.button [data-vvd-component=icon]{font-size:calc(1px*(32 + 4*clamp(-1,var(--vvd-size-density, 0),2))/2);line-height:1}.dialog{display:flex;flex-direction:column;min-inline-size:var(--_color-picker-popup-min-inline-size, 264px)}.dialog .header{display:inline-flex;align-items:center;justify-content:space-between;padding-block:8px;padding-inline:16px}.dialog .header-title{font:var(--vvd-typography-base-extended-bold)}.dialog .body{display:flex;flex-direction:column;gap:16px;margin-block-end:16px;padding-inline:16px}.dialog .hex-input-wrapper{display:flex;align-items:stretch;gap:8px}.dialog .hex-input-wrapper [data-vvd-component=button]{flex:0 0 auto}.dialog .footer{padding:16px;border-top:1px solid var(--vvd-color-neutral-200)}.dialog .footer-title{display:block;margin-block-end:8px}.dialog .palette{gap:var(--_color-swatches-gap, 8px)}vvd-hex-input{min-width:0;flex:1 1 auto}vvd-hex-input::part(input){width:100%;height:100%;box-sizing:border-box;border:0 none;border-radius:8px;background-color:var(--vvd-color-canvas);box-shadow:inset 0 0 0 1px var(--vvd-color-neutral-500);font:var(--vvd-typography-base);outline:transparent;padding-inline:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2))*.4)}vvd-hex-input::part(input):focus-visible{box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent}vvd-hex-picker{width:auto;height:auto;gap:16px;inline-size:100%}vvd-hex-picker::part(saturation){border-radius:8px;block-size:120px}vvd-hex-picker::part(hue){flex:0 0 8px;border-radius:8px}vvd-hex-picker::part(hue-pointer){width:10px;height:10px}vvd-hex-picker::part(saturation-pointer){width:18px;height:18px}::part(popup-base){inline-size:max-content;min-block-size:var(--_color-picker-popup-min-inline-size, 264px);min-inline-size:var(--_color-picker-popup-min-inline-size, 264px)}", v = (o, e = 0, t = 1) => o > t ? t : o < e ? e : o, l = (o, e = 0, t = Math.pow(10, e)) => Math.round(t * o) / t, $e = (o) => Ee(E(o)), E = (o) => (o[0] === "#" && (o = o.substring(1)), o.length < 6 ? {
|
|
18
|
+
r: parseInt(o[0] + o[0], 16),
|
|
19
|
+
g: parseInt(o[1] + o[1], 16),
|
|
20
|
+
b: parseInt(o[2] + o[2], 16),
|
|
21
|
+
a: o.length === 4 ? l(parseInt(o[3] + o[3], 16) / 255, 2) : 1
|
|
22
|
+
} : {
|
|
23
|
+
r: parseInt(o.substring(0, 2), 16),
|
|
24
|
+
g: parseInt(o.substring(2, 4), 16),
|
|
25
|
+
b: parseInt(o.substring(4, 6), 16),
|
|
26
|
+
a: o.length === 8 ? l(parseInt(o.substring(6, 8), 16) / 255, 2) : 1
|
|
27
|
+
}), ke = (o) => Se(_e(o)), we = ({ h: o, s: e, v: t, a: s }) => {
|
|
28
|
+
const r = (200 - e) * t / 100;
|
|
29
|
+
return {
|
|
30
|
+
h: l(o),
|
|
31
|
+
s: l(r > 0 && r < 200 ? e * t / 100 / (r <= 100 ? r : 200 - r) * 100 : 0),
|
|
32
|
+
l: l(r / 2),
|
|
33
|
+
a: l(s, 2)
|
|
34
|
+
};
|
|
35
|
+
}, H = (o) => {
|
|
36
|
+
const { h: e, s: t, l: s } = we(o);
|
|
37
|
+
return `hsl(${e}, ${t}%, ${s}%)`;
|
|
38
|
+
}, _e = ({ h: o, s: e, v: t, a: s }) => {
|
|
39
|
+
o = o / 360 * 6, e = e / 100, t = t / 100;
|
|
40
|
+
const r = Math.floor(o), a = t * (1 - e), i = t * (1 - (o - r) * e), C = t * (1 - (1 - o + r) * e), y = r % 6;
|
|
41
|
+
return {
|
|
42
|
+
r: l([t, i, a, a, C, t][y] * 255),
|
|
43
|
+
g: l([C, t, t, i, a, a][y] * 255),
|
|
44
|
+
b: l([a, a, C, t, t, i][y] * 255),
|
|
45
|
+
a: l(s, 2)
|
|
46
|
+
};
|
|
47
|
+
}, b = (o) => {
|
|
48
|
+
const e = o.toString(16);
|
|
49
|
+
return e.length < 2 ? "0" + e : e;
|
|
50
|
+
}, Se = ({ r: o, g: e, b: t, a: s }) => {
|
|
51
|
+
const r = s < 1 ? b(l(s * 255)) : "";
|
|
52
|
+
return "#" + b(o) + b(e) + b(t) + r;
|
|
53
|
+
}, Ee = ({ r: o, g: e, b: t, a: s }) => {
|
|
54
|
+
const r = Math.max(o, e, t), a = r - Math.min(o, e, t), i = a ? r === o ? (e - t) / a : r === e ? 2 + (t - o) / a : 4 + (o - e) / a : 0;
|
|
55
|
+
return {
|
|
56
|
+
h: l(60 * (i < 0 ? i + 6 : i)),
|
|
57
|
+
s: l(r ? a / r * 100 : 0),
|
|
58
|
+
v: l(r / 255 * 100),
|
|
59
|
+
a: s
|
|
60
|
+
};
|
|
61
|
+
}, U = (o, e) => {
|
|
62
|
+
if (o === e)
|
|
63
|
+
return !0;
|
|
64
|
+
for (const t in o)
|
|
65
|
+
if (o[t] !== e[t])
|
|
66
|
+
return !1;
|
|
67
|
+
return !0;
|
|
68
|
+
}, He = (o, e) => o.toLowerCase() === e.toLowerCase() ? !0 : U(E(o), E(e)), N = {}, I = (o) => {
|
|
69
|
+
let e = N[o];
|
|
70
|
+
return e || (e = document.createElement("template"), e.innerHTML = o, N[o] = e), e;
|
|
71
|
+
}, A = (o, e, t) => {
|
|
72
|
+
o.dispatchEvent(new CustomEvent(e, {
|
|
73
|
+
bubbles: !0,
|
|
74
|
+
detail: t
|
|
75
|
+
}));
|
|
76
|
+
};
|
|
77
|
+
let d = !1;
|
|
78
|
+
const P = (o) => "touches" in o, Pe = (o) => d && !P(o) ? !1 : (d || (d = P(o)), !0), F = (o, e) => {
|
|
79
|
+
const t = P(e) ? e.touches[0] : e, s = o.el.getBoundingClientRect();
|
|
80
|
+
A(o.el, "move", o.getMove({
|
|
81
|
+
x: v((t.pageX - (s.left + window.pageXOffset)) / s.width),
|
|
82
|
+
y: v((t.pageY - (s.top + window.pageYOffset)) / s.height)
|
|
83
|
+
}));
|
|
84
|
+
}, Te = (o, e) => {
|
|
85
|
+
const t = e.keyCode;
|
|
86
|
+
t > 40 || o.xy && t < 37 || t < 33 || (e.preventDefault(), A(o.el, "move", o.getMove({
|
|
87
|
+
x: t === 39 ? 0.01 : t === 37 ? -0.01 : t === 34 ? 0.05 : t === 33 ? -0.05 : t === 35 ? 1 : t === 36 ? -1 : 0,
|
|
88
|
+
y: t === 40 ? 0.01 : t === 38 ? -0.01 : 0
|
|
89
|
+
}, !0)));
|
|
90
|
+
};
|
|
91
|
+
class Y {
|
|
92
|
+
constructor(e, t, s, r) {
|
|
93
|
+
const a = I(`<div role="slider" tabindex="0" part="${t}" ${s}><div part="${t}-pointer"></div></div>`);
|
|
94
|
+
e.appendChild(a.content.cloneNode(!0));
|
|
95
|
+
const i = e.querySelector(`[part=${t}]`);
|
|
96
|
+
i.addEventListener("mousedown", this), i.addEventListener("touchstart", this), i.addEventListener("keydown", this), this.el = i, this.xy = r, this.nodes = [i.firstChild, i];
|
|
97
|
+
}
|
|
98
|
+
set dragging(e) {
|
|
99
|
+
const t = e ? document.addEventListener : document.removeEventListener;
|
|
100
|
+
t(d ? "touchmove" : "mousemove", this), t(d ? "touchend" : "mouseup", this);
|
|
101
|
+
}
|
|
102
|
+
handleEvent(e) {
|
|
103
|
+
switch (e.type) {
|
|
104
|
+
case "mousedown":
|
|
105
|
+
case "touchstart":
|
|
106
|
+
if (e.preventDefault(), !Pe(e) || !d && e.button != 0)
|
|
107
|
+
return;
|
|
108
|
+
this.el.focus(), F(this, e), this.dragging = !0;
|
|
109
|
+
break;
|
|
110
|
+
case "mousemove":
|
|
111
|
+
case "touchmove":
|
|
112
|
+
e.preventDefault(), F(this, e);
|
|
113
|
+
break;
|
|
114
|
+
case "mouseup":
|
|
115
|
+
case "touchend":
|
|
116
|
+
this.dragging = !1;
|
|
117
|
+
break;
|
|
118
|
+
case "keydown":
|
|
119
|
+
Te(this, e);
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
style(e) {
|
|
124
|
+
e.forEach((t, s) => {
|
|
125
|
+
for (const r in t)
|
|
126
|
+
this.nodes[s].style.setProperty(r, t[r]);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
class ze extends Y {
|
|
131
|
+
constructor(e) {
|
|
132
|
+
super(e, "hue", 'aria-label="Hue" aria-valuemin="0" aria-valuemax="360"', !1);
|
|
133
|
+
}
|
|
134
|
+
update({ h: e }) {
|
|
135
|
+
this.h = e, this.style([
|
|
136
|
+
{
|
|
137
|
+
left: `${e / 360 * 100}%`,
|
|
138
|
+
color: H({ h: e, s: 100, v: 100, a: 1 })
|
|
139
|
+
}
|
|
140
|
+
]), this.el.setAttribute("aria-valuenow", `${l(e)}`);
|
|
141
|
+
}
|
|
142
|
+
getMove(e, t) {
|
|
143
|
+
return { h: t ? v(this.h + e.x * 360, 0, 360) : 360 * e.x };
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
class Ie extends Y {
|
|
147
|
+
constructor(e) {
|
|
148
|
+
super(e, "saturation", 'aria-label="Color"', !0);
|
|
149
|
+
}
|
|
150
|
+
update(e) {
|
|
151
|
+
this.hsva = e, this.style([
|
|
152
|
+
{
|
|
153
|
+
top: `${100 - e.v}%`,
|
|
154
|
+
left: `${e.s}%`,
|
|
155
|
+
color: H(e)
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"background-color": H({ h: e.h, s: 100, v: 100, a: 1 })
|
|
159
|
+
}
|
|
160
|
+
]), this.el.setAttribute("aria-valuetext", `Saturation ${l(e.s)}%, Brightness ${l(e.v)}%`);
|
|
161
|
+
}
|
|
162
|
+
getMove(e, t) {
|
|
163
|
+
return {
|
|
164
|
+
s: t ? v(this.hsva.s + e.x * 100, 0, 100) : e.x * 100,
|
|
165
|
+
v: t ? v(this.hsva.v - e.y * 100, 0, 100) : Math.round(100 - e.y * 100)
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const Ae = ':host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:"";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}', Le = "[part=hue]{flex:0 0 24px;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}[part=hue-pointer]{top:50%;z-index:2}", Me = "[part=saturation]{flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,rgba(255,255,255,0));box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}[part=saturation-pointer]{z-index:3}", m = Symbol("same"), $ = Symbol("color"), O = Symbol("hsva"), k = Symbol("update"), B = Symbol("parts"), R = Symbol("css"), V = Symbol("sliders");
|
|
170
|
+
let Ne = class extends HTMLElement {
|
|
171
|
+
static get observedAttributes() {
|
|
172
|
+
return ["color"];
|
|
173
|
+
}
|
|
174
|
+
get [R]() {
|
|
175
|
+
return [Ae, Le, Me];
|
|
176
|
+
}
|
|
177
|
+
get [V]() {
|
|
178
|
+
return [Ie, ze];
|
|
179
|
+
}
|
|
180
|
+
get color() {
|
|
181
|
+
return this[$];
|
|
182
|
+
}
|
|
183
|
+
set color(e) {
|
|
184
|
+
if (!this[m](e)) {
|
|
185
|
+
const t = this.colorModel.toHsva(e);
|
|
186
|
+
this[k](t), this[$] = e;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
constructor() {
|
|
190
|
+
super();
|
|
191
|
+
const e = I(`<style>${this[R].join("")}</style>`), t = this.attachShadow({ mode: "open" });
|
|
192
|
+
t.appendChild(e.content.cloneNode(!0)), t.addEventListener("move", this), this[B] = this[V].map((s) => new s(t));
|
|
193
|
+
}
|
|
194
|
+
connectedCallback() {
|
|
195
|
+
if (this.hasOwnProperty("color")) {
|
|
196
|
+
const e = this.color;
|
|
197
|
+
delete this.color, this.color = e;
|
|
198
|
+
} else this.color || (this.color = this.colorModel.defaultColor);
|
|
199
|
+
}
|
|
200
|
+
attributeChangedCallback(e, t, s) {
|
|
201
|
+
const r = this.colorModel.fromAttr(s);
|
|
202
|
+
this[m](r) || (this.color = r);
|
|
203
|
+
}
|
|
204
|
+
handleEvent(e) {
|
|
205
|
+
const t = this[O], s = { ...t, ...e.detail };
|
|
206
|
+
this[k](s);
|
|
207
|
+
let r;
|
|
208
|
+
!U(s, t) && !this[m](r = this.colorModel.fromHsva(s)) && (this[$] = r, A(this, "color-changed", { value: r }));
|
|
209
|
+
}
|
|
210
|
+
[m](e) {
|
|
211
|
+
return this.color && this.colorModel.equal(e, this.color);
|
|
212
|
+
}
|
|
213
|
+
[k](e) {
|
|
214
|
+
this[O] = e, this[B].forEach((t) => t.update(e));
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
const Fe = {
|
|
218
|
+
defaultColor: "#000",
|
|
219
|
+
toHsva: $e,
|
|
220
|
+
fromHsva: ({ h: o, s: e, v: t }) => ke({ h: o, s: e, v: t, a: 1 }),
|
|
221
|
+
equal: He,
|
|
222
|
+
fromAttr: (o) => o
|
|
223
|
+
};
|
|
224
|
+
class Oe extends Ne {
|
|
225
|
+
get colorModel() {
|
|
226
|
+
return Fe;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
class Q extends Oe {
|
|
230
|
+
}
|
|
231
|
+
customElements.define("hex-color-picker", Q);
|
|
232
|
+
const Be = /^#?([0-9A-F]{3,8})$/i, w = (o, e) => {
|
|
233
|
+
const t = Be.exec(o), s = t ? t[1].length : 0;
|
|
234
|
+
return s === 3 || // '#rgb' format
|
|
235
|
+
s === 6 || // '#rrggbb' format
|
|
236
|
+
!!e && s === 4 || // '#rgba' format
|
|
237
|
+
!!e && s === 8;
|
|
238
|
+
}, Re = I('<slot><input part="input" spellcheck="false"></slot>'), q = (o, e) => o.replace(/([^0-9A-F]+)/gi, "").substring(0, e ? 8 : 6), D = Symbol("alpha"), g = Symbol("color"), K = Symbol("saved"), _ = Symbol("input"), S = Symbol("init"), W = Symbol("prefix"), h = Symbol("update");
|
|
239
|
+
class Ve extends HTMLElement {
|
|
240
|
+
static get observedAttributes() {
|
|
241
|
+
return ["alpha", "color", "prefixed"];
|
|
242
|
+
}
|
|
243
|
+
get color() {
|
|
244
|
+
return this[g];
|
|
245
|
+
}
|
|
246
|
+
set color(e) {
|
|
247
|
+
this[g] = e, this[h](e);
|
|
248
|
+
}
|
|
249
|
+
get alpha() {
|
|
250
|
+
return this[D];
|
|
251
|
+
}
|
|
252
|
+
set alpha(e) {
|
|
253
|
+
this[D] = e, this.toggleAttribute("alpha", e);
|
|
254
|
+
const t = this.color;
|
|
255
|
+
t && !w(t, e) && (this.color = t.startsWith("#") ? t.substring(0, t.length === 5 ? 4 : 7) : t.substring(0, t.length === 4 ? 3 : 6));
|
|
256
|
+
}
|
|
257
|
+
get prefixed() {
|
|
258
|
+
return this[W];
|
|
259
|
+
}
|
|
260
|
+
set prefixed(e) {
|
|
261
|
+
this[W] = e, this.toggleAttribute("prefixed", e), this[h](this.color);
|
|
262
|
+
}
|
|
263
|
+
constructor() {
|
|
264
|
+
super();
|
|
265
|
+
const e = this.attachShadow({ mode: "open" });
|
|
266
|
+
e.appendChild(Re.content.cloneNode(!0)), e.firstElementChild.addEventListener("slotchange", () => this[S](e));
|
|
267
|
+
}
|
|
268
|
+
connectedCallback() {
|
|
269
|
+
if (this[S](this.shadowRoot), this.hasOwnProperty("alpha")) {
|
|
270
|
+
const e = this.alpha;
|
|
271
|
+
delete this.alpha, this.alpha = e;
|
|
272
|
+
} else
|
|
273
|
+
this.alpha = this.hasAttribute("alpha");
|
|
274
|
+
if (this.hasOwnProperty("prefixed")) {
|
|
275
|
+
const e = this.prefixed;
|
|
276
|
+
delete this.prefixed, this.prefixed = e;
|
|
277
|
+
} else
|
|
278
|
+
this.prefixed = this.hasAttribute("prefixed");
|
|
279
|
+
if (this.hasOwnProperty("color")) {
|
|
280
|
+
const e = this.color;
|
|
281
|
+
delete this.color, this.color = e;
|
|
282
|
+
} else this.color == null ? this.color = this.getAttribute("color") || "" : this[g] && this[h](this[g]);
|
|
283
|
+
}
|
|
284
|
+
handleEvent(e) {
|
|
285
|
+
const t = e.target, { value: s } = t;
|
|
286
|
+
switch (e.type) {
|
|
287
|
+
case "input":
|
|
288
|
+
const r = q(s, this.alpha);
|
|
289
|
+
this[K] = this.color, (w(r, this.alpha) || s === "") && (this.color = r, this.dispatchEvent(new CustomEvent("color-changed", {
|
|
290
|
+
bubbles: !0,
|
|
291
|
+
detail: { value: r ? "#" + r : "" }
|
|
292
|
+
})));
|
|
293
|
+
break;
|
|
294
|
+
case "blur":
|
|
295
|
+
s && !w(s, this.alpha) && (this.color = this[K]);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
attributeChangedCallback(e, t, s) {
|
|
299
|
+
e === "color" && this.color !== s && (this.color = s);
|
|
300
|
+
const r = s != null;
|
|
301
|
+
e === "alpha" && this.alpha !== r && (this.alpha = r), e === "prefixed" && this.prefixed !== r && (this.prefixed = r);
|
|
302
|
+
}
|
|
303
|
+
[S](e) {
|
|
304
|
+
let t = this.querySelector("input");
|
|
305
|
+
if (!t) {
|
|
306
|
+
let s;
|
|
307
|
+
for (; s = this.firstChild; )
|
|
308
|
+
s.remove();
|
|
309
|
+
t = e.querySelector("input");
|
|
310
|
+
}
|
|
311
|
+
t.addEventListener("input", this), t.addEventListener("blur", this), this[_] = t, this[h](this.color);
|
|
312
|
+
}
|
|
313
|
+
[h](e) {
|
|
314
|
+
this[_] && (this[_].value = e == null || e == "" ? "" : (this.prefixed ? "#" : "") + q(e, this.alpha));
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
class Z extends Ve {
|
|
318
|
+
}
|
|
319
|
+
customElements.define("hex-input", Z);
|
|
320
|
+
var qe = Object.defineProperty, p = (o, e, t, s) => {
|
|
321
|
+
for (var r = void 0, a = o.length - 1, i; a >= 0; a--)
|
|
322
|
+
(i = o[a]) && (r = i(e, t, r) || r);
|
|
323
|
+
return r && qe(e, t, r), r;
|
|
324
|
+
};
|
|
325
|
+
const T = "vvd-hex-picker", z = "vvd-hex-input";
|
|
326
|
+
class De extends Q {
|
|
327
|
+
static {
|
|
328
|
+
this.displayName = "VvdHexPicker";
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
class Ke extends Z {
|
|
332
|
+
static {
|
|
333
|
+
this.displayName = "VvdHexInput";
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
customElements.get(T) || customElements.define(T, De);
|
|
337
|
+
customElements.get(z) || customElements.define(z, Ke);
|
|
338
|
+
const X = T, j = z;
|
|
339
|
+
class c extends ue(
|
|
340
|
+
ne(
|
|
341
|
+
ve(fe(de(he(ee))))
|
|
342
|
+
)
|
|
343
|
+
) {
|
|
344
|
+
constructor() {
|
|
345
|
+
super(...arguments), this.disableSavedColors = !1, this.savedColors = [], this.maxSwatches = 6, this.copyIconName = "copy-2-line", this.#e = null, this._copyValueToClipboard = async (e) => {
|
|
346
|
+
try {
|
|
347
|
+
await navigator.clipboard.writeText(e), this._setTemporaryCopyIcon("check-circle-line");
|
|
348
|
+
} catch {
|
|
349
|
+
alert(this.locale?.colorPicker?.copyErrorText), this._setTemporaryCopyIcon("error-line");
|
|
350
|
+
}
|
|
351
|
+
}, this.#t = (e) => {
|
|
352
|
+
this._isInPath(e, this._buttonEl) || this._isInPath(e, this._popupEl) || (this.open = !1);
|
|
353
|
+
}, this.#o = (e) => {
|
|
354
|
+
e.key === "Escape" && (this.open = !1);
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
static {
|
|
358
|
+
this.HEX_COLOR_PATTERN = /^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$/;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* @internal
|
|
362
|
+
*/
|
|
363
|
+
placeholderChanged() {
|
|
364
|
+
this.proxy instanceof HTMLInputElement && (this.proxy.placeholder = this.placeholder);
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Change event handler for inner control.
|
|
368
|
+
* @remarks
|
|
369
|
+
* @internal
|
|
370
|
+
*/
|
|
371
|
+
handleChange() {
|
|
372
|
+
this.$emit("change");
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* @internal
|
|
376
|
+
*/
|
|
377
|
+
savedColorsKeyChanged() {
|
|
378
|
+
this.savedColors = this._loadSavedColors();
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* @internal
|
|
382
|
+
*/
|
|
383
|
+
get _savedColorsStorageKey() {
|
|
384
|
+
return this.savedColorsKey ? this.savedColorsKey : `vvd-saved-colors:${this.tagName.toLowerCase()}`;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* @internal
|
|
388
|
+
*/
|
|
389
|
+
_handleColorSaving() {
|
|
390
|
+
this._saveCurrentColor();
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* @internal
|
|
394
|
+
*/
|
|
395
|
+
get _maxSwatchesNormalized() {
|
|
396
|
+
return Number.isFinite(this.maxSwatches) ? Math.max(0, Math.floor(this.maxSwatches)) : 0;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* @internal
|
|
400
|
+
*/
|
|
401
|
+
maxSwatchesChanged() {
|
|
402
|
+
const e = this._maxSwatchesNormalized;
|
|
403
|
+
this.savedColors?.length > e && (this.savedColors = this.savedColors.slice(0, e), this._setSavedColors(this.savedColors));
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* @internal
|
|
407
|
+
*/
|
|
408
|
+
_onPickerColorChanged(e) {
|
|
409
|
+
typeof e.detail?.value == "string" && (this.value = e.detail?.value);
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* @internal
|
|
413
|
+
*/
|
|
414
|
+
valueChanged(e, t) {
|
|
415
|
+
this._vcHexPickerEl && typeof t == "string" && (this._vcHexPickerEl.color = t), this._vcHexInputEl && typeof t == "string" && (this._vcHexInputEl.color = t);
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* @internal
|
|
419
|
+
*/
|
|
420
|
+
_onTextFieldInput(e) {
|
|
421
|
+
const t = e.currentTarget;
|
|
422
|
+
this.value = t.value;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* @internal
|
|
426
|
+
*/
|
|
427
|
+
get _buttonColor() {
|
|
428
|
+
return this._canvasColor || this._refreshCanvasColor(), this.value && f(this.value) ? this.value : "var(--vvd-color-canvas-text)";
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* @internal
|
|
432
|
+
*/
|
|
433
|
+
_onButtonClick() {
|
|
434
|
+
this.open = !this.open;
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* @internal
|
|
438
|
+
*/
|
|
439
|
+
_handleCloseRequest() {
|
|
440
|
+
this.open = !1;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* @internal
|
|
444
|
+
*/
|
|
445
|
+
_isInPath(e, t) {
|
|
446
|
+
if (!t) return !1;
|
|
447
|
+
const s = e.composedPath?.();
|
|
448
|
+
return !!(s && s.includes(t));
|
|
449
|
+
}
|
|
450
|
+
#e;
|
|
451
|
+
/**
|
|
452
|
+
* @internal
|
|
453
|
+
*/
|
|
454
|
+
_setTemporaryCopyIcon(e, t = 2e3) {
|
|
455
|
+
this.copyIconName = e, this.#e && clearTimeout(this.#e), this.#e = setTimeout(() => {
|
|
456
|
+
this.copyIconName = "copy-2-line", this.#e = null;
|
|
457
|
+
}, t);
|
|
458
|
+
}
|
|
459
|
+
connectedCallback() {
|
|
460
|
+
super.connectedCallback(), this._refreshCanvasColor(), this.savedColors = this._loadSavedColors(), document.addEventListener("mousedown", this.#t, !0), document.addEventListener("keydown", this.#o);
|
|
461
|
+
}
|
|
462
|
+
disconnectedCallback() {
|
|
463
|
+
super.disconnectedCallback(), document.removeEventListener(
|
|
464
|
+
"mousedown",
|
|
465
|
+
this.#t,
|
|
466
|
+
!0
|
|
467
|
+
), document.removeEventListener("keydown", this.#o);
|
|
468
|
+
}
|
|
469
|
+
#t;
|
|
470
|
+
#o;
|
|
471
|
+
/**
|
|
472
|
+
* @internal
|
|
473
|
+
*/
|
|
474
|
+
_saveCurrentColor() {
|
|
475
|
+
const e = this.value;
|
|
476
|
+
if (typeof e != "string" || !f(e)) return;
|
|
477
|
+
const t = Array.isArray(this.savedColors) ? [...this.savedColors] : [], s = t.findIndex((r) => r?.value === e);
|
|
478
|
+
s !== -1 && t.splice(s, 1), t.unshift({ value: e }), this.savedColors = t.slice(0, this._maxSwatchesNormalized), this._setSavedColors(this.savedColors);
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* @internal
|
|
482
|
+
*/
|
|
483
|
+
_loadSavedColors() {
|
|
484
|
+
try {
|
|
485
|
+
const e = localStorage.getItem(this._savedColorsStorageKey);
|
|
486
|
+
if (!e) return [];
|
|
487
|
+
const t = JSON.parse(e);
|
|
488
|
+
return Array.isArray(t) ? t.filter(
|
|
489
|
+
(s) => s && typeof s.value == "string" && f(s.value)
|
|
490
|
+
).map((s) => ({
|
|
491
|
+
value: s.value,
|
|
492
|
+
label: typeof s.label == "string" ? s.label : void 0
|
|
493
|
+
})) : [];
|
|
494
|
+
} catch {
|
|
495
|
+
return [];
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* @internal
|
|
500
|
+
*/
|
|
501
|
+
_setSavedColors(e) {
|
|
502
|
+
try {
|
|
503
|
+
localStorage.setItem(
|
|
504
|
+
this._savedColorsStorageKey,
|
|
505
|
+
JSON.stringify(e)
|
|
506
|
+
);
|
|
507
|
+
} catch {
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Get all color swatches combined, both from swatches property and saved colors
|
|
512
|
+
* @internal
|
|
513
|
+
*/
|
|
514
|
+
get allSwatches() {
|
|
515
|
+
const e = Array.isArray(this.swatches) ? this.swatches : [], t = Array.isArray(this.savedColors) ? this.savedColors : [], s = /* @__PURE__ */ new Set(), r = [], a = (i) => {
|
|
516
|
+
!i || typeof i.value != "string" || !f(i.value) || s.has(i.value) || (s.add(i.value), r.push(i));
|
|
517
|
+
};
|
|
518
|
+
return this.disableSavedColors || t.forEach(a), e.forEach(a), r.slice(0, this._maxSwatchesNormalized);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
p([
|
|
522
|
+
x
|
|
523
|
+
], c.prototype, "placeholder");
|
|
524
|
+
p([
|
|
525
|
+
x({ attribute: "saved-colors-key" })
|
|
526
|
+
], c.prototype, "savedColorsKey");
|
|
527
|
+
p([
|
|
528
|
+
x({
|
|
529
|
+
mode: "boolean",
|
|
530
|
+
attribute: "disable-saved-colors"
|
|
531
|
+
})
|
|
532
|
+
], c.prototype, "disableSavedColors");
|
|
533
|
+
p([
|
|
534
|
+
G
|
|
535
|
+
], c.prototype, "savedColors");
|
|
536
|
+
p([
|
|
537
|
+
x({
|
|
538
|
+
attribute: "max-swatches",
|
|
539
|
+
mode: "fromView",
|
|
540
|
+
converter: te
|
|
541
|
+
})
|
|
542
|
+
], c.prototype, "maxSwatches");
|
|
543
|
+
p([
|
|
544
|
+
G
|
|
545
|
+
], c.prototype, "copyIconName");
|
|
546
|
+
function We(o, e) {
|
|
547
|
+
return n`
|
|
548
|
+
<${o}
|
|
549
|
+
id="text-field"
|
|
550
|
+
class="${(s) => M("control")}"
|
|
551
|
+
pattern="${c.HEX_COLOR_PATTERN.source}"
|
|
552
|
+
maxlength="7"
|
|
553
|
+
label="${(s) => s.label}"
|
|
554
|
+
:value="${(s) => s.value}"
|
|
555
|
+
placeholder="${(s) => s.placeholder}"
|
|
556
|
+
helper-text="${(s) => s.helperText}"
|
|
557
|
+
error-text="${(s) => s.errorValidationMessage}"
|
|
558
|
+
success-text="${(s) => s.successText}"
|
|
559
|
+
?disabled="${(s) => s.disabled}"
|
|
560
|
+
?required="${(s) => s.required}"
|
|
561
|
+
@input='${(s, r) => s._onTextFieldInput(r.event)}'
|
|
562
|
+
@change="${(s) => s.handleChange()}"
|
|
563
|
+
@blur="${(s) => {
|
|
564
|
+
s.$emit("blur", void 0, { bubbles: !1 });
|
|
565
|
+
}}"
|
|
566
|
+
@focus="${(s) => {
|
|
567
|
+
s.$emit("focus", void 0, { bubbles: !1 });
|
|
568
|
+
}}"
|
|
569
|
+
${pe()}
|
|
570
|
+
${u("_textFieldEl")}
|
|
571
|
+
>
|
|
572
|
+
<button
|
|
573
|
+
aria-label="${(s) => s.locale.colorPicker.pickerButtonLabel}"
|
|
574
|
+
class="button ${(s) => M(
|
|
575
|
+
s._applyContrastClass(s._buttonColor) ? "contrast" : "",
|
|
576
|
+
s.disabled ? "disabled" : ""
|
|
577
|
+
)}"
|
|
578
|
+
style="--button-color: ${(s) => s._buttonColor};"
|
|
579
|
+
?disabled="${(s) => s.disabled}"
|
|
580
|
+
@click="${(s) => s._onButtonClick()}"
|
|
581
|
+
slot="action-items"
|
|
582
|
+
${u("_buttonEl")}>
|
|
583
|
+
<${e} name="edit-line"></${e}>
|
|
584
|
+
</button>
|
|
585
|
+
<slot
|
|
586
|
+
slot="${(s) => s._helperTextSlottedContent?.length ? "helper-text" : void 0}"
|
|
587
|
+
name="helper-text"
|
|
588
|
+
${L("_helperTextSlottedContent")}
|
|
589
|
+
></slot>
|
|
590
|
+
<slot
|
|
591
|
+
slot='${(s) => s._contextualHelpSlottedContent?.length ? "contextual-help" : void 0}'
|
|
592
|
+
name='contextual-help'
|
|
593
|
+
${L("_contextualHelpSlottedContent")}
|
|
594
|
+
></slot>
|
|
595
|
+
</${o}>
|
|
596
|
+
`;
|
|
597
|
+
}
|
|
598
|
+
function Xe(o, e) {
|
|
599
|
+
return n`
|
|
600
|
+
<div class="header">
|
|
601
|
+
<span class="header-title" id="color-picker-title">
|
|
602
|
+
<slot name="popup-text">${(t) => t.locale.colorPicker.popupLabel}</slot>
|
|
603
|
+
</span>
|
|
604
|
+
<${o} size="condensed"
|
|
605
|
+
aria-label="${(t) => t.locale.colorPicker.closeButtonLabel}"
|
|
606
|
+
@click="${(t) => t._handleCloseRequest()}">
|
|
607
|
+
<${e} slot="icon" name="close-line"></${e}>
|
|
608
|
+
</${o}>
|
|
609
|
+
</div>
|
|
610
|
+
`;
|
|
611
|
+
}
|
|
612
|
+
function je(o, e) {
|
|
613
|
+
return n`
|
|
614
|
+
<div class="body">
|
|
615
|
+
<${n.partial(X)}
|
|
616
|
+
part="hex-picker"
|
|
617
|
+
color="${(t) => t.value}"
|
|
618
|
+
@color-changed="${(t, s) => t._onPickerColorChanged(s.event)}"
|
|
619
|
+
${u("_vcHexPickerEl")}
|
|
620
|
+
></${n.partial(X)}>
|
|
621
|
+
<div class="hex-input-wrapper">
|
|
622
|
+
<${n.partial(j)}
|
|
623
|
+
part="hex-input"
|
|
624
|
+
prefixed
|
|
625
|
+
color="${(t) => t.value}"
|
|
626
|
+
@color-changed="${(t, s) => t._onPickerColorChanged(s.event)}"
|
|
627
|
+
${u("_vcHexInputEl")}
|
|
628
|
+
></${n.partial(j)}>
|
|
629
|
+
<${o} size="normal"
|
|
630
|
+
aria-label="${(t) => t.locale.colorPicker.copyButtonLabel}"
|
|
631
|
+
@click="${(t) => t._copyValueToClipboard(t.value)}">
|
|
632
|
+
<${e} slot="icon" name="${(t) => t.copyIconName}"></${e}>
|
|
633
|
+
</${o}>
|
|
634
|
+
</div>
|
|
635
|
+
</div>
|
|
636
|
+
`;
|
|
637
|
+
}
|
|
638
|
+
function Ge(o, e) {
|
|
639
|
+
return n`
|
|
640
|
+
<div class="footer">
|
|
641
|
+
<span class="footer-title" id="color-picker-footer-title"
|
|
642
|
+
><slot name="swatches-text"
|
|
643
|
+
>${(t) => t.locale.colorPicker.swatchesLabel}</slot
|
|
644
|
+
></span
|
|
645
|
+
>
|
|
646
|
+
<div
|
|
647
|
+
class="palette"
|
|
648
|
+
role="grid"
|
|
649
|
+
aria-rowcount="${(t) => Math.ceil(t.allSwatches.length / t._getRowLength())}"
|
|
650
|
+
aria-colcount="${(t) => t._getRowLength()}"
|
|
651
|
+
style="--swatches-per-row: ${(t) => t._getRowLength()};"
|
|
652
|
+
aria-labelledby="color-picker-footer-title"
|
|
653
|
+
>
|
|
654
|
+
${Ce(
|
|
655
|
+
(t) => t.allSwatches,
|
|
656
|
+
(t) => t._renderColorSwatch(e),
|
|
657
|
+
{ positioning: !0 }
|
|
658
|
+
)}
|
|
659
|
+
${J(
|
|
660
|
+
(t) => !t.disableSavedColors,
|
|
661
|
+
n`
|
|
662
|
+
<${o}
|
|
663
|
+
appearance="outlined"
|
|
664
|
+
size="super-condensed"
|
|
665
|
+
role="gridcell"
|
|
666
|
+
tabindex="${(t) => t.allSwatches.length ? "-1" : "0"}"
|
|
667
|
+
aria-label="${(t) => t.locale.colorPicker.saveButtonLabel}"
|
|
668
|
+
@click="${(t) => t._saveCurrentColor()}"
|
|
669
|
+
@keydown="${(t, s) => t._handleCellKeydown(
|
|
670
|
+
s.event,
|
|
671
|
+
t.value,
|
|
672
|
+
t.allSwatches.length,
|
|
673
|
+
!0
|
|
674
|
+
)}">
|
|
675
|
+
>
|
|
676
|
+
<${e} slot="icon" name="plus-line"></${e}>
|
|
677
|
+
</${o}>
|
|
678
|
+
`
|
|
679
|
+
)}
|
|
680
|
+
</div>
|
|
681
|
+
</div>
|
|
682
|
+
`;
|
|
683
|
+
}
|
|
684
|
+
const Je = (o) => {
|
|
685
|
+
const e = o.tagFor(be), t = o.tagFor(ie), s = o.tagFor(re), r = o.tagFor(ge);
|
|
686
|
+
return n`
|
|
687
|
+
<div class="base">
|
|
688
|
+
${We(e, t)}
|
|
689
|
+
<${s}
|
|
690
|
+
:open="${(a) => a.open}"
|
|
691
|
+
:anchor="${(a) => a._buttonEl}"
|
|
692
|
+
placement="top"
|
|
693
|
+
offset="10"
|
|
694
|
+
${u("_popupEl")}>
|
|
695
|
+
<div class="dialog"
|
|
696
|
+
role="dialog"
|
|
697
|
+
aria-modal="true"
|
|
698
|
+
aria-labelledby="color-picker-title">
|
|
699
|
+
${Xe(r, t)}
|
|
700
|
+
${je(r, t)}
|
|
701
|
+
${J(
|
|
702
|
+
(a) => !a.disableSavedColors || a.allSwatches.length > 0,
|
|
703
|
+
Ge(r, t)
|
|
704
|
+
)}
|
|
705
|
+
</div>
|
|
706
|
+
</${s}>
|
|
707
|
+
</div>
|
|
708
|
+
`;
|
|
709
|
+
}, Ue = se(
|
|
710
|
+
"color-picker",
|
|
711
|
+
c,
|
|
712
|
+
Je,
|
|
713
|
+
[
|
|
714
|
+
ae,
|
|
715
|
+
le,
|
|
716
|
+
me,
|
|
717
|
+
xe,
|
|
718
|
+
ce
|
|
719
|
+
],
|
|
720
|
+
{
|
|
721
|
+
styles: ye
|
|
722
|
+
}
|
|
723
|
+
), Ye = oe(
|
|
724
|
+
Ue
|
|
725
|
+
);
|
|
726
|
+
Ye();
|