@vonage/vivid 5.15.1 → 5.17.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/definition.cjs +7 -207
- package/accordion/definition.js +2 -199
- package/accordion/index.cjs +4 -4
- package/accordion/index.js +93 -127
- package/accordion-item/definition.cjs +6 -146
- package/accordion-item/definition.js +2 -139
- package/accordion-item/index.cjs +1 -1
- package/accordion-item/index.js +6 -2
- package/action-group/definition.cjs +5 -69
- package/action-group/definition.js +1 -62
- package/action-group/index.cjs +4 -4
- package/action-group/index.js +16 -46
- package/alert/definition.cjs +6 -201
- package/alert/definition.js +2 -194
- package/alert/index.cjs +15 -15
- package/alert/index.js +90 -136
- package/audio-player/definition.cjs +6 -459
- package/audio-player/definition.js +2 -452
- package/audio-player/index.cjs +49 -49
- package/audio-player/index.js +234 -302
- package/avatar/definition.cjs +6 -117
- package/avatar/definition.js +2 -110
- package/avatar/index.cjs +14 -14
- package/avatar/index.js +44 -84
- package/badge/definition.cjs +6 -85
- package/badge/definition.js +2 -78
- package/badge/index.cjs +4 -4
- package/badge/index.js +21 -65
- package/banner/definition.cjs +6 -160
- package/banner/definition.js +2 -153
- package/banner/index.cjs +13 -13
- package/banner/index.js +76 -109
- package/breadcrumb/definition.cjs +5 -97
- package/breadcrumb/definition.js +1 -90
- package/breadcrumb/index.cjs +4 -4
- package/breadcrumb/index.js +33 -59
- package/breadcrumb-item/definition.cjs +7 -47
- package/breadcrumb-item/definition.js +3 -40
- package/breadcrumb-item/index.cjs +5 -5
- package/breadcrumb-item/index.js +20 -32
- package/bundled/affix.cjs +10 -10
- package/bundled/affix.js +44 -57
- package/bundled/anchored.cjs +3 -3
- package/bundled/anchored.js +47 -65
- package/bundled/aria.cjs +1 -1
- package/bundled/aria.js +6 -6
- package/bundled/attribute-binding-behaviour.cjs +1 -1
- package/bundled/attribute-binding-behaviour.js +17 -28
- package/bundled/base-color-picker.cjs +10 -10
- package/bundled/base-color-picker.js +115 -197
- package/bundled/base-progress.cjs +1 -1
- package/bundled/base-progress.js +29 -56
- package/bundled/breadcrumb-item.cjs +1 -1
- package/bundled/breadcrumb-item.js +11 -20
- package/bundled/button.cjs +1 -1
- package/bundled/button.js +65 -100
- package/bundled/calendar-event.cjs +1 -1
- package/bundled/calendar-event.js +11 -34
- package/bundled/calendar-picker.template.cjs +77 -77
- package/bundled/calendar-picker.template.js +2883 -3347
- package/bundled/char-count.cjs +7 -7
- package/bundled/char-count.js +31 -46
- package/bundled/children.cjs +1 -1
- package/bundled/children.js +27 -45
- package/bundled/class-names.cjs +1 -1
- package/bundled/class-names.js +8 -8
- package/bundled/data-grid.options.cjs +1 -1
- package/bundled/data-grid.options.js +22 -26
- package/bundled/decorate.cjs +1 -0
- package/bundled/decorate.js +9 -0
- package/bundled/definition.cjs +1 -39
- package/bundled/definition.js +5 -122
- package/bundled/definition10.cjs +18 -72
- package/bundled/definition10.js +74 -355
- package/bundled/definition11.cjs +10 -12
- package/bundled/definition11.js +28 -92
- package/bundled/definition12.cjs +72 -18
- package/bundled/definition12.js +192 -222
- package/bundled/definition13.cjs +20 -10
- package/bundled/definition13.js +55 -41
- package/bundled/definition14.cjs +5 -1
- package/bundled/definition14.js +11 -20
- package/bundled/definition15.cjs +19 -5
- package/bundled/definition15.js +77 -28
- package/bundled/definition16.cjs +12 -29
- package/bundled/definition16.js +80 -78
- package/bundled/definition17.cjs +17 -17
- package/bundled/definition17.js +126 -98
- package/bundled/definition18.cjs +87 -13
- package/bundled/definition18.js +423 -134
- package/bundled/definition19.cjs +5 -87
- package/bundled/definition19.js +16 -742
- package/bundled/definition2.cjs +8 -8
- package/bundled/definition2.js +79 -122
- package/bundled/definition20.cjs +26 -16
- package/bundled/definition20.js +153 -98
- package/bundled/definition21.cjs +29 -5
- package/bundled/definition21.js +174 -18
- package/bundled/definition22.cjs +38 -23
- package/bundled/definition22.js +70 -149
- package/bundled/definition3.cjs +1 -29
- package/bundled/definition3.js +183 -194
- package/bundled/definition4.cjs +24 -6
- package/bundled/definition4.js +88 -40
- package/bundled/definition5.cjs +30 -1
- package/bundled/definition5.js +48 -346
- package/bundled/definition6.cjs +28 -30
- package/bundled/definition6.js +110 -264
- package/bundled/definition7.cjs +6 -30
- package/bundled/definition7.js +22 -288
- package/bundled/definition8.cjs +13 -18
- package/bundled/definition8.js +150 -132
- package/bundled/definition9.cjs +12 -14
- package/bundled/definition9.js +67 -235
- package/bundled/delegates-aria.cjs +1 -1
- package/bundled/delegates-aria.js +56 -88
- package/bundled/dialog.cjs +1 -0
- package/bundled/dialog.js +6 -0
- package/bundled/divider.cjs +1 -1
- package/bundled/divider.js +16 -33
- package/bundled/dom.cjs +1 -1
- package/bundled/dom.js +5 -5
- package/bundled/enums.cjs +1 -1
- package/bundled/enums.js +16 -9
- package/bundled/floating-ui.dom.cjs +1 -1
- package/bundled/floating-ui.dom.js +953 -1238
- package/bundled/form-associated.cjs +1 -1
- package/bundled/form-associated.js +165 -318
- package/bundled/form-element.cjs +1 -1
- package/bundled/form-element.js +33 -55
- package/bundled/host-semantics.cjs +1 -1
- package/bundled/host-semantics.js +46 -69
- package/bundled/key-codes.cjs +1 -1
- package/bundled/key-codes.js +4 -16
- package/bundled/linkable.cjs +6 -6
- package/bundled/linkable.js +25 -45
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +176 -351
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +451 -564
- package/bundled/mixins.cjs +20 -20
- package/bundled/mixins.js +162 -210
- package/bundled/normalize.cjs +1 -1
- package/bundled/normalize.js +6 -6
- package/bundled/numbers.cjs +1 -1
- package/bundled/numbers.js +9 -11
- package/bundled/picker-field.template.cjs +23 -23
- package/bundled/picker-field.template.js +108 -171
- package/bundled/playbackRates.cjs +1 -1
- package/bundled/playbackRates.js +10 -10
- package/bundled/ref.cjs +1 -1
- package/bundled/ref.js +10 -14
- package/bundled/repeat.cjs +1 -1
- package/bundled/repeat.js +421 -552
- package/bundled/scrollIntoView.cjs +1 -1
- package/bundled/scrollIntoView.js +26 -29
- package/bundled/single-date-picker.cjs +1 -1
- package/bundled/single-date-picker.js +23 -38
- package/bundled/single-value-picker.cjs +1 -1
- package/bundled/single-value-picker.js +58 -86
- package/bundled/slider.template.cjs +14 -14
- package/bundled/slider.template.js +67 -78
- package/bundled/slottable-request.cjs +4 -4
- package/bundled/slottable-request.js +1907 -2904
- package/bundled/slotted.cjs +1 -1
- package/bundled/slotted.js +47 -97
- package/bundled/strings.cjs +1 -1
- package/bundled/strings.js +6 -6
- package/bundled/text-field.cjs +1 -1
- package/bundled/text-field.js +4 -4
- package/bundled/time-selection-picker.template.cjs +26 -26
- package/bundled/time-selection-picker.template.js +355 -552
- package/bundled/trapped-focus.cjs +1 -1
- package/bundled/trapped-focus.js +18 -25
- package/bundled/vivid-element.cjs +4 -5
- package/bundled/vivid-element.js +1781 -2806
- package/bundled/when.cjs +1 -1
- package/bundled/when.js +10 -10
- package/bundled/with-contextual-help.cjs +1 -1
- package/bundled/with-contextual-help.js +15 -31
- package/bundled/with-error-text.cjs +1 -1
- package/bundled/with-error-text.js +25 -38
- package/bundled/with-success-text.cjs +1 -1
- package/bundled/with-success-text.js +8 -15
- package/button/definition.cjs +6 -14
- package/button/definition.js +3 -4
- package/button/index.cjs +1 -1
- package/button/index.js +6 -2
- package/calendar/definition.cjs +5 -358
- package/calendar/definition.js +1 -351
- package/calendar/index.cjs +20 -20
- package/calendar/index.js +165 -427
- package/calendar-event/definition.cjs +6 -58
- package/calendar-event/definition.js +2 -51
- package/calendar-event/index.cjs +7 -7
- package/calendar-event/index.js +25 -41
- package/card/definition.cjs +6 -194
- package/card/definition.js +2 -187
- package/card/index.cjs +37 -34
- package/card/index.js +83 -133
- package/checkbox/definition.cjs +6 -209
- package/checkbox/definition.js +2 -202
- package/checkbox/index.cjs +1 -1
- package/checkbox/index.js +6 -2
- package/color-picker/definition.cjs +6 -1175
- package/color-picker/definition.js +2 -1168
- package/color-picker/index.cjs +94 -94
- package/color-picker/index.js +605 -737
- package/combobox/definition.cjs +6 -647
- package/combobox/definition.js +2 -640
- package/combobox/index.cjs +38 -37
- package/combobox/index.js +258 -458
- package/contextual-help/definition.cjs +6 -63
- package/contextual-help/definition.js +2 -56
- package/contextual-help/index.cjs +1 -1
- package/contextual-help/index.js +6 -2
- package/country/definition.cjs +6 -340
- package/country/definition.js +2 -333
- package/country/index.cjs +6 -6
- package/country/index.js +1209 -308
- package/custom-elements.json +1247 -1173
- package/data-grid/definition.cjs +10 -2350
- package/data-grid/definition.js +2 -2339
- package/data-grid/index.cjs +65 -65
- package/data-grid/index.js +644 -997
- package/date-picker/definition.cjs +6 -152
- package/date-picker/definition.js +2 -145
- package/date-picker/index.cjs +1 -1
- package/date-picker/index.js +66 -114
- package/date-range-picker/definition.cjs +6 -467
- package/date-range-picker/definition.js +2 -460
- package/date-range-picker/index.cjs +1 -1
- package/date-range-picker/index.js +218 -334
- package/date-time-picker/definition.cjs +6 -285
- package/date-time-picker/definition.js +2 -278
- package/date-time-picker/index.cjs +4 -4
- package/date-time-picker/index.js +116 -211
- package/dial-pad/definition.cjs +6 -460
- package/dial-pad/definition.js +2 -453
- package/dial-pad/index.cjs +44 -43
- package/dial-pad/index.js +197 -288
- package/dialog/definition.cjs +6 -349
- package/dialog/definition.js +2 -342
- package/dialog/index.cjs +28 -28
- package/dialog/index.js +148 -229
- package/divider/definition.cjs +6 -42
- package/divider/definition.js +2 -35
- package/divider/index.cjs +1 -1
- package/divider/index.js +5 -2
- package/elevation/definition.cjs +4 -11
- package/elevation/definition.js +2 -2
- package/elevation/index.cjs +1 -1
- package/elevation/index.js +5 -2
- package/empty-state/definition.cjs +6 -86
- package/empty-state/definition.js +2 -79
- package/empty-state/index.cjs +9 -9
- package/empty-state/index.js +28 -60
- package/fab/definition.cjs +6 -105
- package/fab/definition.js +2 -98
- package/fab/index.cjs +17 -17
- package/fab/index.js +46 -81
- package/file-picker/definition.cjs +6 -523
- package/file-picker/definition.js +2 -516
- package/file-picker/index.cjs +32 -29
- package/file-picker/index.js +254 -356
- package/header/definition.cjs +5 -78
- package/header/definition.js +1 -71
- package/header/index.cjs +6 -6
- package/header/index.js +28 -42
- package/icon/definition.cjs +5 -202
- package/icon/definition.js +1 -195
- package/icon/index.cjs +1 -1
- package/icon/index.js +5 -2
- package/index.cjs +353 -356
- package/index.js +79 -78
- package/layout/definition.cjs +5 -72
- package/layout/definition.js +1 -65
- package/layout/index.cjs +2 -2
- package/layout/index.js +10 -51
- package/lib/alert/alert.d.ts +0 -1
- package/lib/audio-player/audio-player.d.ts +0 -1
- package/lib/banner/banner.d.ts +0 -2
- package/lib/button/button.d.ts +0 -1
- package/lib/calendar/calendar.d.ts +0 -1
- package/lib/combobox/combobox.d.ts +0 -3
- package/lib/data-grid/data-grid-cell.d.ts +0 -3
- package/lib/data-grid/data-grid-row.d.ts +0 -3
- package/lib/data-grid/data-grid.d.ts +0 -1
- package/lib/date-time-picker/date-time-picker.d.ts +0 -4
- package/lib/dial-pad/dial-pad.d.ts +6 -2
- package/lib/dialog/dialog.d.ts +0 -1
- package/lib/fab/fab.d.ts +0 -1
- package/lib/file-picker/file-picker.d.ts +1 -1
- package/lib/icon/icon.d.ts +0 -1
- package/lib/menu/menu.d.ts +0 -1
- package/lib/option/option.d.ts +4 -1
- package/lib/pagination/pagination.d.ts +0 -4
- package/lib/popover/popover.d.ts +0 -5
- package/lib/rich-text-editor/rte/exports.d.ts +1 -0
- package/lib/rich-text-editor/rte/features/alignment.d.ts +1 -1
- package/lib/rich-text-editor/rte/features/character-count.d.ts +21 -0
- package/lib/rich-text-editor/rte/features/font-size-picker.d.ts +1 -1
- package/lib/rich-text-editor/rte/features/internal/basic-text-blocks.d.ts +1 -1
- package/lib/rich-text-editor/rte/features/keyboard-shortcuts.d.ts +1 -1
- package/lib/rich-text-editor/rte/features/text-color-picker.d.ts +1 -1
- package/lib/rich-text-editor/rte/public-interface.d.ts +6 -0
- package/lib/searchable-select/option-tag.d.ts +0 -1
- package/lib/split-button/split-button.d.ts +0 -2
- package/lib/tab/tab.d.ts +0 -2
- package/lib/table/definition.d.ts +2 -1
- package/lib/table/table-header-cell.d.ts +3 -0
- package/lib/table/table-sorting-button.d.ts +415 -0
- package/lib/table/table-sorting-button.template.d.ts +3 -0
- package/lib/tag/tag.d.ts +0 -2
- package/lib/toggletip/toggletip.d.ts +0 -1
- package/lib/tree-item/tree-item.d.ts +0 -2
- package/lib/tree-view/tree-view.d.ts +0 -1
- package/locales/de-DE.cjs +266 -550
- package/locales/de-DE.js +264 -548
- package/locales/en-GB.cjs +266 -382
- package/locales/en-GB.js +264 -380
- package/locales/en-US.cjs +266 -550
- package/locales/en-US.js +264 -548
- package/locales/ja-JP.cjs +266 -549
- package/locales/ja-JP.js +264 -547
- package/locales/zh-CN.cjs +266 -551
- package/locales/zh-CN.js +264 -549
- package/menu/definition.cjs +6 -393
- package/menu/definition.js +2 -386
- package/menu/index.cjs +1 -1
- package/menu/index.js +6 -2
- package/menu-item/definition.cjs +7 -14
- package/menu-item/definition.js +3 -3
- package/menu-item/index.cjs +1 -1
- package/menu-item/index.js +6 -2
- package/nav/definition.cjs +5 -27
- package/nav/definition.js +1 -20
- package/nav/index.cjs +3 -3
- package/nav/index.js +7 -10
- package/nav-disclosure/definition.cjs +6 -122
- package/nav-disclosure/definition.js +2 -115
- package/nav-disclosure/index.cjs +8 -8
- package/nav-disclosure/index.js +49 -86
- package/nav-item/definition.cjs +6 -79
- package/nav-item/definition.js +2 -72
- package/nav-item/index.cjs +2 -2
- package/nav-item/index.js +33 -58
- package/note/definition.cjs +6 -61
- package/note/definition.js +2 -54
- package/note/index.cjs +5 -5
- package/note/index.js +24 -38
- package/number-field/definition.cjs +6 -440
- package/number-field/definition.js +2 -433
- package/number-field/index.cjs +31 -31
- package/number-field/index.js +160 -328
- package/option/definition.cjs +6 -13
- package/option/definition.js +3 -3
- package/option/index.cjs +1 -1
- package/option/index.js +6 -2
- package/package.json +15 -17
- package/pagination/definition.cjs +6 -254
- package/pagination/definition.js +2 -247
- package/pagination/index.cjs +37 -37
- package/pagination/index.js +148 -186
- package/popover/definition.cjs +6 -356
- package/popover/definition.js +2 -349
- package/popover/index.cjs +16 -16
- package/popover/index.js +161 -239
- package/popup/definition.cjs +5 -13
- package/popup/definition.js +3 -4
- package/popup/index.cjs +1 -1
- package/popup/index.js +6 -2
- package/progress/definition.cjs +5 -87
- package/progress/definition.js +1 -80
- package/progress/index.cjs +9 -9
- package/progress/index.js +33 -55
- package/progress-ring/definition.cjs +5 -95
- package/progress-ring/definition.js +1 -88
- package/progress-ring/index.cjs +1 -1
- package/progress-ring/index.js +5 -2
- package/radio/definition.cjs +5 -227
- package/radio/definition.js +1 -220
- package/radio/index.cjs +1 -1
- package/radio/index.js +5 -2
- package/radio-group/definition.cjs +6 -361
- package/radio-group/definition.js +2 -354
- package/radio-group/index.cjs +10 -10
- package/radio-group/index.js +160 -242
- package/range-slider/definition.cjs +6 -632
- package/range-slider/definition.js +2 -625
- package/range-slider/index.cjs +41 -41
- package/range-slider/index.js +259 -429
- package/rich-text-editor/definition.cjs +33 -15694
- package/rich-text-editor/definition.js +3 -15662
- package/rich-text-editor/index.cjs +18 -18
- package/rich-text-editor/index.js +9129 -11475
- package/rich-text-view/definition.cjs +5 -171
- package/rich-text-view/definition.js +1 -164
- package/rich-text-view/index.cjs +1 -1
- package/rich-text-view/index.js +68 -102
- package/searchable-select/definition.cjs +5 -1401
- package/searchable-select/definition.js +2 -1395
- package/searchable-select/index.cjs +94 -94
- package/searchable-select/index.js +600 -1015
- package/select/definition.cjs +6 -1002
- package/select/definition.js +2 -995
- package/select/index.cjs +1 -1
- package/select/index.js +6 -2
- package/selectable-box/definition.cjs +6 -174
- package/selectable-box/definition.js +2 -167
- package/selectable-box/index.cjs +18 -18
- package/selectable-box/index.js +66 -127
- package/shared/foundation/test-utilities/fixture.d.ts +1 -1
- package/shared/patterns/linkable.d.ts +1 -1
- package/side-drawer/definition.cjs +5 -130
- package/side-drawer/definition.js +1 -123
- package/side-drawer/index.cjs +7 -7
- package/side-drawer/index.js +47 -89
- package/simple-color-picker/definition.cjs +6 -225
- package/simple-color-picker/definition.js +2 -218
- package/simple-color-picker/index.cjs +15 -15
- package/simple-color-picker/index.js +98 -135
- package/slider/definition.cjs +6 -499
- package/slider/definition.js +2 -492
- package/slider/index.cjs +1 -1
- package/slider/index.js +6 -2
- package/split-button/definition.cjs +6 -176
- package/split-button/definition.js +2 -169
- package/split-button/index.cjs +15 -15
- package/split-button/index.js +74 -135
- package/status/definition.cjs +6 -82
- package/status/definition.js +2 -75
- package/status/index.cjs +7 -7
- package/status/index.js +35 -52
- package/switch/definition.cjs +6 -148
- package/switch/definition.js +2 -141
- package/switch/index.cjs +8 -8
- package/switch/index.js +48 -92
- package/tab/definition.cjs +6 -127
- package/tab/definition.js +2 -120
- package/tab/index.cjs +1 -1
- package/tab/index.js +6 -2
- package/tab-panel/definition.cjs +5 -29
- package/tab-panel/definition.js +1 -22
- package/tab-panel/index.cjs +1 -1
- package/tab-panel/index.js +5 -2
- package/table/definition.cjs +18 -174
- package/table/definition.js +3 -158
- package/table/index.cjs +19 -10
- package/table/index.js +74 -82
- package/tabs/definition.cjs +7 -467
- package/tabs/definition.js +2 -459
- package/tabs/index.cjs +11 -11
- package/tabs/index.js +169 -296
- package/tag/definition.cjs +6 -176
- package/tag/definition.js +2 -169
- package/tag/index.cjs +26 -26
- package/tag/index.js +64 -125
- package/tag-group/definition.cjs +5 -40
- package/tag-group/definition.js +1 -33
- package/tag-group/index.cjs +4 -4
- package/tag-group/index.js +10 -21
- package/text-area/definition.cjs +6 -355
- package/text-area/definition.js +2 -348
- package/text-area/index.cjs +11 -11
- package/text-area/index.js +153 -260
- package/text-field/definition.cjs +6 -423
- package/text-field/definition.js +2 -416
- package/text-field/index.cjs +1 -1
- package/text-field/index.js +6 -2
- package/time-picker/definition.cjs +7 -43
- package/time-picker/definition.js +3 -36
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +24 -29
- package/toggletip/definition.cjs +6 -159
- package/toggletip/definition.js +2 -152
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +6 -2
- package/tooltip/definition.cjs +6 -139
- package/tooltip/definition.js +2 -132
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.js +6 -2
- package/tree-item/definition.cjs +6 -13
- package/tree-item/definition.js +3 -3
- package/tree-item/index.cjs +1 -1
- package/tree-item/index.js +6 -2
- package/tree-view/definition.cjs +6 -302
- package/tree-view/definition.js +2 -295
- package/tree-view/index.cjs +11 -11
- package/tree-view/index.js +145 -174
- package/unbundled/affix.cjs +89 -62
- package/unbundled/affix.js +58 -55
- package/unbundled/anchored.cjs +87 -94
- package/unbundled/anchored.js +74 -90
- package/unbundled/attribute-binding-behaviour.cjs +37 -42
- package/unbundled/attribute-binding-behaviour.js +31 -40
- package/unbundled/base-color-picker.cjs +226 -275
- package/unbundled/base-color-picker.js +214 -272
- package/unbundled/base-progress.cjs +63 -78
- package/unbundled/base-progress.js +57 -76
- package/unbundled/breadcrumb-item.cjs +24 -28
- package/unbundled/breadcrumb-item.js +18 -26
- package/unbundled/button.cjs +115 -166
- package/unbundled/button.js +109 -164
- package/unbundled/calendar-event.cjs +28 -41
- package/unbundled/calendar-event.js +22 -39
- package/unbundled/calendar-picker.template.cjs +4967 -792
- package/unbundled/calendar-picker.template.js +4907 -781
- package/unbundled/char-count.cjs +50 -80
- package/unbundled/char-count.js +44 -78
- package/unbundled/chunk.cjs +28 -0
- package/unbundled/data-grid.options.cjs +80 -29
- package/unbundled/data-grid.options.js +51 -23
- package/unbundled/decorate.cjs +14 -0
- package/unbundled/decorate.js +9 -0
- package/unbundled/definition.cjs +42 -405
- package/unbundled/definition.js +24 -399
- package/unbundled/definition10.cjs +253 -0
- package/unbundled/definition10.js +229 -0
- package/unbundled/definition11.cjs +397 -0
- package/unbundled/definition11.js +379 -0
- package/unbundled/definition12.cjs +317 -0
- package/unbundled/definition12.js +287 -0
- package/unbundled/definition13.cjs +321 -0
- package/unbundled/definition13.js +303 -0
- package/unbundled/definition14.cjs +406 -0
- package/unbundled/definition14.js +388 -0
- package/unbundled/definition15.cjs +107 -0
- package/unbundled/definition15.js +89 -0
- package/unbundled/definition16.cjs +63 -0
- package/unbundled/definition16.js +45 -0
- package/unbundled/definition17.cjs +151 -0
- package/unbundled/definition17.js +133 -0
- package/unbundled/definition18.cjs +47 -0
- package/unbundled/definition18.js +35 -0
- package/unbundled/definition19.cjs +98 -0
- package/unbundled/definition19.js +80 -0
- package/unbundled/definition2.cjs +180 -220
- package/unbundled/definition2.js +162 -215
- package/unbundled/definition20.cjs +56 -0
- package/unbundled/definition20.js +43 -0
- package/unbundled/definition21.cjs +304 -0
- package/unbundled/definition21.js +285 -0
- package/unbundled/definition22.cjs +179 -0
- package/unbundled/definition22.js +161 -0
- package/unbundled/definition23.cjs +161 -0
- package/unbundled/definition23.js +143 -0
- package/unbundled/definition24.cjs +157 -0
- package/unbundled/definition24.js +139 -0
- package/unbundled/definition25.cjs +75 -0
- package/unbundled/definition25.js +57 -0
- package/unbundled/definition26.cjs +363 -0
- package/unbundled/definition26.js +345 -0
- package/unbundled/definition27.cjs +137 -0
- package/unbundled/definition27.js +119 -0
- package/unbundled/definition28.cjs +538 -0
- package/unbundled/definition28.js +520 -0
- package/unbundled/definition29.cjs +236 -0
- package/unbundled/definition29.js +212 -0
- package/unbundled/definition3.cjs +131 -284
- package/unbundled/definition3.js +113 -279
- package/unbundled/definition30.cjs +559 -0
- package/unbundled/definition30.js +541 -0
- package/unbundled/definition31.cjs +1265 -0
- package/unbundled/definition31.js +1247 -0
- package/unbundled/definition32.cjs +1908 -0
- package/unbundled/definition32.js +1866 -0
- package/unbundled/definition33.cjs +346 -0
- package/unbundled/definition33.js +256 -0
- package/unbundled/definition34.cjs +46 -0
- package/unbundled/definition34.js +33 -0
- package/unbundled/definition35.cjs +152 -0
- package/unbundled/definition35.js +134 -0
- package/unbundled/definition36.cjs +426 -0
- package/unbundled/definition36.js +408 -0
- package/unbundled/definition37.cjs +247 -0
- package/unbundled/definition37.js +229 -0
- package/unbundled/definition38.cjs +411 -0
- package/unbundled/definition38.js +393 -0
- package/unbundled/definition39.cjs +299 -0
- package/unbundled/definition39.js +281 -0
- package/unbundled/definition4.cjs +186 -205
- package/unbundled/definition4.js +162 -200
- package/unbundled/definition40.cjs +81 -0
- package/unbundled/definition40.js +63 -0
- package/unbundled/definition41.cjs +100 -0
- package/unbundled/definition41.js +82 -0
- package/unbundled/definition42.cjs +468 -0
- package/unbundled/definition42.js +450 -0
- package/unbundled/definition43.cjs +86 -0
- package/unbundled/definition43.js +68 -0
- package/unbundled/definition44.cjs +60 -0
- package/unbundled/definition44.js +41 -0
- package/unbundled/definition45.cjs +124 -0
- package/unbundled/definition45.js +106 -0
- package/unbundled/definition46.cjs +85 -0
- package/unbundled/definition46.js +67 -0
- package/unbundled/definition47.cjs +52 -0
- package/unbundled/definition47.js +31 -0
- package/unbundled/definition48.cjs +69 -0
- package/unbundled/definition48.js +51 -0
- package/unbundled/definition49.cjs +377 -0
- package/unbundled/definition49.js +359 -0
- package/unbundled/definition5.cjs +69 -298
- package/unbundled/definition5.js +44 -293
- package/unbundled/definition50.cjs +246 -0
- package/unbundled/definition50.js +228 -0
- package/unbundled/definition51.cjs +337 -0
- package/unbundled/definition51.js +319 -0
- package/unbundled/definition52.cjs +86 -0
- package/unbundled/definition52.js +67 -0
- package/unbundled/definition53.cjs +193 -0
- package/unbundled/definition53.js +174 -0
- package/unbundled/definition54.cjs +297 -0
- package/unbundled/definition54.js +279 -0
- package/unbundled/definition55.cjs +510 -0
- package/unbundled/definition55.js +492 -0
- package/unbundled/definition56.cjs +3659 -0
- package/unbundled/definition56.js +3478 -0
- package/unbundled/definition57.cjs +837 -0
- package/unbundled/definition57.js +819 -0
- package/unbundled/definition58.cjs +147 -0
- package/unbundled/definition58.js +129 -0
- package/unbundled/definition59.cjs +1081 -0
- package/unbundled/definition59.js +1063 -0
- package/unbundled/definition6.cjs +88 -56
- package/unbundled/definition6.js +69 -52
- package/unbundled/definition60.cjs +149 -0
- package/unbundled/definition60.js +131 -0
- package/unbundled/definition61.cjs +116 -0
- package/unbundled/definition61.js +97 -0
- package/unbundled/definition62.cjs +213 -0
- package/unbundled/definition62.js +195 -0
- package/unbundled/definition63.cjs +159 -0
- package/unbundled/definition63.js +141 -0
- package/unbundled/definition64.cjs +86 -0
- package/unbundled/definition64.js +68 -0
- package/unbundled/definition65.cjs +126 -0
- package/unbundled/definition65.js +107 -0
- package/unbundled/definition66.cjs +49 -0
- package/unbundled/definition66.js +28 -0
- package/unbundled/definition67.cjs +119 -0
- package/unbundled/definition67.js +101 -0
- package/unbundled/definition68.cjs +374 -0
- package/unbundled/definition68.js +349 -0
- package/unbundled/definition69.cjs +57 -0
- package/unbundled/definition69.js +38 -0
- package/unbundled/definition7.cjs +190 -0
- package/unbundled/definition7.js +166 -0
- package/unbundled/definition70.cjs +155 -0
- package/unbundled/definition70.js +137 -0
- package/unbundled/definition71.cjs +302 -0
- package/unbundled/definition71.js +284 -0
- package/unbundled/definition72.cjs +48 -0
- package/unbundled/definition72.js +37 -0
- package/unbundled/definition73.cjs +171 -0
- package/unbundled/definition73.js +147 -0
- package/unbundled/definition74.cjs +232 -0
- package/unbundled/definition74.js +213 -0
- package/unbundled/definition75.cjs +533 -0
- package/unbundled/definition75.js +513 -0
- package/unbundled/definition8.cjs +63 -0
- package/unbundled/definition8.js +44 -0
- package/unbundled/definition9.cjs +183 -0
- package/unbundled/definition9.js +165 -0
- package/unbundled/delegates-aria.cjs +90 -131
- package/unbundled/delegates-aria.js +77 -127
- package/unbundled/dialog.cjs +15 -0
- package/unbundled/dialog.js +10 -0
- package/unbundled/divider.cjs +42 -50
- package/unbundled/divider.js +30 -47
- package/unbundled/enums.cjs +166 -107
- package/unbundled/enums.js +95 -94
- package/unbundled/form-associated.cjs +408 -463
- package/unbundled/form-associated.js +396 -460
- package/unbundled/form-element.cjs +74 -83
- package/unbundled/form-element.js +68 -81
- package/unbundled/host-semantics.cjs +70 -89
- package/unbundled/host-semantics.js +57 -85
- package/unbundled/key-codes.cjs +16 -10
- package/unbundled/key-codes.js +5 -7
- package/unbundled/linkable.cjs +35 -56
- package/unbundled/linkable.js +27 -52
- package/unbundled/listbox.cjs +363 -465
- package/unbundled/listbox.js +357 -463
- package/unbundled/localized.cjs +79 -74
- package/unbundled/localized.js +61 -70
- package/unbundled/mixins.cjs +222 -223
- package/unbundled/mixins.js +186 -211
- package/unbundled/picker-field.template.cjs +188 -217
- package/unbundled/picker-field.template.js +165 -208
- package/unbundled/playbackRates.cjs +18 -11
- package/unbundled/playbackRates.js +13 -9
- package/unbundled/scrollIntoView.cjs +38 -43
- package/unbundled/scrollIntoView.js +33 -41
- package/unbundled/single-date-picker.cjs +48 -45
- package/unbundled/single-date-picker.js +43 -43
- package/unbundled/single-value-picker.cjs +106 -114
- package/unbundled/single-value-picker.js +101 -112
- package/unbundled/slider.template.cjs +107 -73
- package/unbundled/slider.template.js +67 -62
- package/unbundled/slottable-request.cjs +145 -3700
- package/unbundled/slottable-request.js +98 -3681
- package/unbundled/text-field.cjs +9 -5
- package/unbundled/text-field.js +4 -3
- package/unbundled/time-selection-picker.template.cjs +611 -755
- package/unbundled/time-selection-picker.template.js +554 -742
- package/unbundled/trapped-focus.cjs +45 -35
- package/unbundled/trapped-focus.js +34 -32
- package/unbundled/vivid-element.cjs +281 -274
- package/unbundled/vivid-element.js +239 -266
- package/unbundled/with-contextual-help.cjs +35 -39
- package/unbundled/with-contextual-help.js +29 -37
- package/unbundled/with-error-text.cjs +45 -55
- package/unbundled/with-error-text.js +39 -53
- package/unbundled/with-success-text.cjs +18 -22
- package/unbundled/with-success-text.js +12 -20
- package/video-player/definition.cjs +5 -69835
- package/video-player/definition.js +1 -69828
- package/video-player/index.cjs +44 -39
- package/video-player/index.js +23517 -35507
- package/visually-hidden/definition.cjs +5 -30
- package/visually-hidden/definition.js +1 -23
- package/visually-hidden/index.cjs +1 -1
- package/visually-hidden/index.js +5 -2
- package/vivid.api.json +331 -1874
- package/bundled/index.cjs +0 -1
- package/bundled/index.js +0 -6
- package/unbundled/_commonjsHelpers.cjs +0 -40
- package/unbundled/_commonjsHelpers.js +0 -36
- package/unbundled/index.cjs +0 -11
- package/unbundled/index.js +0 -9
package/color-picker/index.js
CHANGED
|
@@ -1,812 +1,680 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import { T as e, d as t, l as n, o as r, s as i, t as a, u as o } from "../bundled/vivid-element.js";
|
|
2
|
+
import { n as s } from "../bundled/repeat.js";
|
|
3
|
+
import { t as c } from "../bundled/ref.js";
|
|
4
|
+
import { t as l } from "../bundled/when.js";
|
|
5
|
+
import { t as u } from "../bundled/slotted.js";
|
|
6
|
+
import { r as ee, t as te } from "../bundled/definition2.js";
|
|
7
|
+
import { t as d } from "../bundled/decorate.js";
|
|
8
|
+
import { t as f } from "../bundled/with-success-text.js";
|
|
9
|
+
import { t as ne } from "../bundled/with-error-text.js";
|
|
10
|
+
import { t as re } from "../bundled/with-contextual-help.js";
|
|
11
|
+
import { t as ie } from "../bundled/trapped-focus.js";
|
|
12
|
+
import { n as ae, t as oe } from "../bundled/delegates-aria.js";
|
|
13
|
+
import { t as p } from "../bundled/class-names.js";
|
|
14
|
+
import { i as m, t as se } from "../bundled/definition6.js";
|
|
15
|
+
import { i as ce, t as le } from "../bundled/definition8.js";
|
|
16
|
+
import { n as ue, r as de } from "../bundled/definition9.js";
|
|
17
|
+
import { t as fe } from "../bundled/dialog.js";
|
|
18
|
+
import { a as pe, t as me } from "../bundled/mixins.js";
|
|
19
|
+
import { n as he, r as ge } from "../bundled/definition12.js";
|
|
20
|
+
import { n as h, t as _e } from "../bundled/base-color-picker.js";
|
|
21
|
+
//#region src/lib/color-picker/color-picker.scss?inline
|
|
22
|
+
var ve = ".palette{grid-template-columns:repeat(var(--swatches-per-row,7), var(--_color-swatch-size,24px));display:grid}.swatch{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);border-radius:4px;padding:0;position:relative}.swatch:not(.contrast){border:none}.swatch.contrast{border:1px solid var(--vvd-color-neutral-400);color:var(--vvd-color-canvas-text)}.swatch:focus-visible{box-shadow:0 0 0 4px color-mix(in srgb, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:none;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{--_low-ink-color:var(--vvd-color-neutral-600);display:inline-block}.base{min-inline-size:var(--_color-picker-min-inline-size,280px);display:inline-block}.control{inline-size:100%}.button{box-sizing:border-box;background-color:var(--button-color,var(--vvd-color-canvas-text));block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8));color:var(--vvd-color-canvas);inline-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8));padding-inline:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8)) / 4);vertical-align:middle;border:0;border-radius:4px;align-items:center;margin:0;text-decoration:none;display:inline-flex}.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(--focus-stroke-color,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(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8)) / 2);line-height:1}.dialog{min-inline-size:var(--_color-picker-popup-min-inline-size,264px);flex-direction:column;display:flex}.dialog .header{justify-content:space-between;align-items:center;padding-block:8px;padding-inline:16px;display:inline-flex}.dialog .header-title{font:var(--vvd-typography-base-extended-bold);margin-block:0}.dialog .body{flex-direction:column;gap:16px;margin-block-end:16px;padding-inline:16px;display:flex}.dialog .hex-input-wrapper{align-items:stretch;gap:8px;display:flex}.dialog .hex-input-wrapper [data-vvd-component=button]{flex:none}.dialog .footer{border-top:1px solid var(--vvd-color-neutral-200);padding:16px}.dialog .footer-header{margin-block-end:8px}.dialog .swatches-count{color:var(--_low-ink-color);font:var(--vvd-typography-base)}.dialog .palette{gap:var(--_color-swatches-gap,8px)}vvd-hex-input{flex:auto;min-width:0}vvd-hex-input::part(input),vvd-hex-input>input{box-sizing:border-box;background-color:var(--vvd-color-canvas);width:100%;height:100%;box-shadow:inset 0 0 0 1px var(--vvd-color-neutral-500);font:var(--vvd-typography-base);padding-inline:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);border:0;border-radius:8px;outline:#0000}vvd-hex-input::part(input):focus-visible,vvd-hex-input>input:focus-visible{box-shadow:0 0 0 4px color-mix(in srgb, var(--focus-stroke-color,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){border-radius:8px;flex:0 0 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)}.visually-hidden{clip:rect(0 0 0 0);border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}", g = (e, t = 0, n = 1) => e > n ? n : e < t ? t : e, _ = (e, t = 0, n = 10 ** t) => Math.round(n * e) / n;
|
|
23
|
+
360 / (Math.PI * 2);
|
|
24
|
+
var ye = (e) => we(v(e)), v = (e) => (e[0] === "#" && (e = e.substring(1)), e.length < 6 ? {
|
|
25
|
+
r: parseInt(e[0] + e[0], 16),
|
|
26
|
+
g: parseInt(e[1] + e[1], 16),
|
|
27
|
+
b: parseInt(e[2] + e[2], 16),
|
|
28
|
+
a: e.length === 4 ? _(parseInt(e[3] + e[3], 16) / 255, 2) : 1
|
|
25
29
|
} : {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
30
|
+
r: parseInt(e.substring(0, 2), 16),
|
|
31
|
+
g: parseInt(e.substring(2, 4), 16),
|
|
32
|
+
b: parseInt(e.substring(4, 6), 16),
|
|
33
|
+
a: e.length === 8 ? _(parseInt(e.substring(6, 8), 16) / 255, 2) : 1
|
|
34
|
+
}), be = (e) => Ce(Se(e)), xe = ({ h: e, s: t, v: n, a: r }) => {
|
|
35
|
+
let i = (200 - t) * n / 100;
|
|
36
|
+
return {
|
|
37
|
+
h: _(e),
|
|
38
|
+
s: _(i > 0 && i < 200 ? t * n / 100 / (i <= 100 ? i : 200 - i) * 100 : 0),
|
|
39
|
+
l: _(i / 2),
|
|
40
|
+
a: _(r, 2)
|
|
41
|
+
};
|
|
42
|
+
}, y = (e) => {
|
|
43
|
+
let { h: t, s: n, l: r } = xe(e);
|
|
44
|
+
return `hsl(${t}, ${n}%, ${r}%)`;
|
|
45
|
+
}, Se = ({ h: e, s: t, v: n, a: r }) => {
|
|
46
|
+
e = e / 360 * 6, t /= 100, n /= 100;
|
|
47
|
+
let i = Math.floor(e), a = n * (1 - t), o = n * (1 - (e - i) * t), s = n * (1 - (1 - e + i) * t), c = i % 6;
|
|
48
|
+
return {
|
|
49
|
+
r: _([
|
|
50
|
+
n,
|
|
51
|
+
o,
|
|
52
|
+
a,
|
|
53
|
+
a,
|
|
54
|
+
s,
|
|
55
|
+
n
|
|
56
|
+
][c] * 255),
|
|
57
|
+
g: _([
|
|
58
|
+
s,
|
|
59
|
+
n,
|
|
60
|
+
n,
|
|
61
|
+
o,
|
|
62
|
+
a,
|
|
63
|
+
a
|
|
64
|
+
][c] * 255),
|
|
65
|
+
b: _([
|
|
66
|
+
a,
|
|
67
|
+
a,
|
|
68
|
+
s,
|
|
69
|
+
n,
|
|
70
|
+
n,
|
|
71
|
+
o
|
|
72
|
+
][c] * 255),
|
|
73
|
+
a: _(r, 2)
|
|
74
|
+
};
|
|
75
|
+
}, b = (e) => {
|
|
76
|
+
let t = e.toString(16);
|
|
77
|
+
return t.length < 2 ? "0" + t : t;
|
|
78
|
+
}, Ce = ({ r: e, g: t, b: n, a: r }) => {
|
|
79
|
+
let i = r < 1 ? b(_(r * 255)) : "";
|
|
80
|
+
return "#" + b(e) + b(t) + b(n) + i;
|
|
81
|
+
}, we = ({ r: e, g: t, b: n, a: r }) => {
|
|
82
|
+
let i = Math.max(e, t, n), a = i - Math.min(e, t, n), o = a ? i === e ? (t - n) / a : i === t ? 2 + (n - e) / a : 4 + (e - t) / a : 0;
|
|
83
|
+
return {
|
|
84
|
+
h: _(60 * (o < 0 ? o + 6 : o)),
|
|
85
|
+
s: _(i ? a / i * 100 : 0),
|
|
86
|
+
v: _(i / 255 * 100),
|
|
87
|
+
a: r
|
|
88
|
+
};
|
|
89
|
+
}, x = (e, t) => {
|
|
90
|
+
if (e === t) return !0;
|
|
91
|
+
for (let n in e) if (e[n] !== t[n]) return !1;
|
|
92
|
+
return !0;
|
|
93
|
+
}, Te = (e, t) => e.toLowerCase() === t.toLowerCase() ? !0 : x(v(e), v(t)), S = {}, C = (e) => {
|
|
94
|
+
let t = S[e];
|
|
95
|
+
return t || (t = document.createElement("template"), t.innerHTML = e, S[e] = t), t;
|
|
96
|
+
}, w = (e, t, n) => {
|
|
97
|
+
e.dispatchEvent(new CustomEvent(t, {
|
|
98
|
+
bubbles: !0,
|
|
99
|
+
detail: n
|
|
100
|
+
}));
|
|
101
|
+
}, T = !1, E = (e) => "touches" in e, D = (e) => T && !E(e) ? !1 : (T ||= E(e), !0), O = (e, t) => {
|
|
102
|
+
let n = E(t) ? t.touches[0] : t, r = e.el.getBoundingClientRect();
|
|
103
|
+
w(e.el, "move", e.getMove({
|
|
104
|
+
x: g((n.pageX - (r.left + window.pageXOffset)) / r.width),
|
|
105
|
+
y: g((n.pageY - (r.top + window.pageYOffset)) / r.height)
|
|
106
|
+
}));
|
|
107
|
+
}, Ee = (e, t) => {
|
|
108
|
+
let n = t.keyCode;
|
|
109
|
+
n > 40 || e.xy && n < 37 || n < 33 || (t.preventDefault(), w(e.el, "move", e.getMove({
|
|
110
|
+
x: n === 39 ? .01 : n === 37 ? -.01 : n === 34 ? .05 : n === 33 ? -.05 : n === 35 ? 1 : n === 36 ? -1 : 0,
|
|
111
|
+
y: n === 40 ? .01 : n === 38 ? -.01 : 0
|
|
112
|
+
}, !0)));
|
|
113
|
+
}, k = class {
|
|
114
|
+
constructor(e, t, n, r) {
|
|
115
|
+
let i = C(`<div role="slider" tabindex="0" part="${t}" ${n}><div part="${t}-pointer"></div></div>`);
|
|
116
|
+
e.appendChild(i.content.cloneNode(!0));
|
|
117
|
+
let a = e.querySelector(`[part=${t}]`);
|
|
118
|
+
a.addEventListener("mousedown", this), a.addEventListener("touchstart", this), a.addEventListener("keydown", this), this.el = a, this.xy = r, this.nodes = [a.firstChild, a];
|
|
119
|
+
}
|
|
120
|
+
set dragging(e) {
|
|
121
|
+
let t = e ? document.addEventListener : document.removeEventListener;
|
|
122
|
+
t(T ? "touchmove" : "mousemove", this), t(T ? "touchend" : "mouseup", this);
|
|
123
|
+
}
|
|
124
|
+
handleEvent(e) {
|
|
125
|
+
switch (e.type) {
|
|
126
|
+
case "mousedown":
|
|
127
|
+
case "touchstart":
|
|
128
|
+
if (e.preventDefault(), !D(e) || !T && e.button != 0) return;
|
|
129
|
+
this.el.focus(), O(this, e), this.dragging = !0;
|
|
130
|
+
break;
|
|
131
|
+
case "mousemove":
|
|
132
|
+
case "touchmove":
|
|
133
|
+
e.preventDefault(), O(this, e);
|
|
134
|
+
break;
|
|
135
|
+
case "mouseup":
|
|
136
|
+
case "touchend":
|
|
137
|
+
this.dragging = !1;
|
|
138
|
+
break;
|
|
139
|
+
case "keydown":
|
|
140
|
+
Ee(this, e);
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
style(e) {
|
|
145
|
+
e.forEach((e, t) => {
|
|
146
|
+
for (let n in e) this.nodes[t].style.setProperty(n, e[n]);
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}, De = class extends k {
|
|
150
|
+
constructor(e) {
|
|
151
|
+
super(e, "hue", "aria-label=\"Hue\" aria-valuemin=\"0\" aria-valuemax=\"360\"", !1);
|
|
152
|
+
}
|
|
153
|
+
update({ h: e }) {
|
|
154
|
+
this.h = e, this.style([{
|
|
155
|
+
left: `${e / 360 * 100}%`,
|
|
156
|
+
color: y({
|
|
157
|
+
h: e,
|
|
158
|
+
s: 100,
|
|
159
|
+
v: 100,
|
|
160
|
+
a: 1
|
|
161
|
+
})
|
|
162
|
+
}]), this.el.setAttribute("aria-valuenow", `${_(e)}`);
|
|
163
|
+
}
|
|
164
|
+
getMove(e, t) {
|
|
165
|
+
return { h: t ? g(this.h + e.x * 360, 0, 360) : 360 * e.x };
|
|
166
|
+
}
|
|
167
|
+
}, Oe = class extends k {
|
|
168
|
+
constructor(e) {
|
|
169
|
+
super(e, "saturation", "aria-label=\"Color\"", !0);
|
|
170
|
+
}
|
|
171
|
+
update(e) {
|
|
172
|
+
this.hsva = e, this.style([{
|
|
173
|
+
top: `${100 - e.v}%`,
|
|
174
|
+
left: `${e.s}%`,
|
|
175
|
+
color: y(e)
|
|
176
|
+
}, { "background-color": y({
|
|
177
|
+
h: e.h,
|
|
178
|
+
s: 100,
|
|
179
|
+
v: 100,
|
|
180
|
+
a: 1
|
|
181
|
+
}) }]), this.el.setAttribute("aria-valuetext", `Saturation ${_(e.s)}%, Brightness ${_(e.v)}%`);
|
|
182
|
+
}
|
|
183
|
+
getMove(e, t) {
|
|
184
|
+
return {
|
|
185
|
+
s: t ? g(this.hsva.s + e.x * 100, 0, 100) : e.x * 100,
|
|
186
|
+
v: t ? g(this.hsva.v - e.y * 100, 0, 100) : Math.round(100 - e.y * 100)
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
}, ke = ":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)}", Ae = "[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}", je = "[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}", A = Symbol("same"), j = Symbol("color"), M = Symbol("hsva"), N = Symbol("update"), P = Symbol("parts"), F = Symbol("css"), I = Symbol("sliders"), L = class extends HTMLElement {
|
|
190
|
+
static get observedAttributes() {
|
|
191
|
+
return ["color"];
|
|
192
|
+
}
|
|
193
|
+
get [F]() {
|
|
194
|
+
return [
|
|
195
|
+
ke,
|
|
196
|
+
Ae,
|
|
197
|
+
je
|
|
198
|
+
];
|
|
199
|
+
}
|
|
200
|
+
get [I]() {
|
|
201
|
+
return [Oe, De];
|
|
202
|
+
}
|
|
203
|
+
get color() {
|
|
204
|
+
return this[j];
|
|
205
|
+
}
|
|
206
|
+
set color(e) {
|
|
207
|
+
if (!this[A](e)) {
|
|
208
|
+
let t = this.colorModel.toHsva(e);
|
|
209
|
+
this[N](t), this[j] = e;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
constructor() {
|
|
213
|
+
super();
|
|
214
|
+
let e = C(`<style>${this[F].join("")}</style>`), t = this.attachShadow({ mode: "open" });
|
|
215
|
+
t.appendChild(e.content.cloneNode(!0)), t.addEventListener("move", this), this[P] = this[I].map((e) => new e(t));
|
|
216
|
+
}
|
|
217
|
+
connectedCallback() {
|
|
218
|
+
if (this.hasOwnProperty("color")) {
|
|
219
|
+
let e = this.color;
|
|
220
|
+
delete this.color, this.color = e;
|
|
221
|
+
} else this.color ||= this.colorModel.defaultColor;
|
|
222
|
+
}
|
|
223
|
+
attributeChangedCallback(e, t, n) {
|
|
224
|
+
let r = this.colorModel.fromAttr(n);
|
|
225
|
+
this[A](r) || (this.color = r);
|
|
226
|
+
}
|
|
227
|
+
handleEvent(e) {
|
|
228
|
+
let t = this[M], n = {
|
|
229
|
+
...t,
|
|
230
|
+
...e.detail
|
|
231
|
+
};
|
|
232
|
+
this[N](n);
|
|
233
|
+
let r;
|
|
234
|
+
!x(n, t) && !this[A](r = this.colorModel.fromHsva(n)) && (this[j] = r, w(this, "color-changed", { value: r }));
|
|
235
|
+
}
|
|
236
|
+
[A](e) {
|
|
237
|
+
return this.color && this.colorModel.equal(e, this.color);
|
|
238
|
+
}
|
|
239
|
+
[N](e) {
|
|
240
|
+
this[M] = e, this[P].forEach((t) => t.update(e));
|
|
241
|
+
}
|
|
242
|
+
}, Me = {
|
|
243
|
+
defaultColor: "#000",
|
|
244
|
+
toHsva: ye,
|
|
245
|
+
fromHsva: ({ h: e, s: t, v: n }) => be({
|
|
246
|
+
h: e,
|
|
247
|
+
s: t,
|
|
248
|
+
v: n,
|
|
249
|
+
a: 1
|
|
250
|
+
}),
|
|
251
|
+
equal: Te,
|
|
252
|
+
fromAttr: (e) => e
|
|
253
|
+
}, Ne = class extends L {
|
|
254
|
+
get colorModel() {
|
|
255
|
+
return Me;
|
|
256
|
+
}
|
|
257
|
+
}, R = class extends Ne {};
|
|
258
|
+
customElements.define("hex-color-picker", R);
|
|
259
|
+
//#endregion
|
|
260
|
+
//#region ../../node_modules/.pnpm/vanilla-colorful@0.7.2/node_modules/vanilla-colorful/lib/utils/validate.js
|
|
261
|
+
var Pe = /^#?([0-9A-F]{3,8})$/i, z = (e, t) => {
|
|
262
|
+
let n = Pe.exec(e), r = n ? n[1].length : 0;
|
|
263
|
+
return r === 3 || r === 6 || !!t && r === 4 || !!t && r === 8;
|
|
264
|
+
}, Fe = C("<slot><input part=\"input\" spellcheck=\"false\"></slot>"), B = (e, t) => e.replace(/([^0-9A-F]+)/gi, "").substring(0, t ? 8 : 6), V = Symbol("alpha"), H = Symbol("color"), U = Symbol("saved"), W = Symbol("input"), G = Symbol("init"), K = Symbol("prefix"), q = Symbol("update"), Ie = class extends HTMLElement {
|
|
265
|
+
static get observedAttributes() {
|
|
266
|
+
return [
|
|
267
|
+
"alpha",
|
|
268
|
+
"color",
|
|
269
|
+
"prefixed"
|
|
270
|
+
];
|
|
271
|
+
}
|
|
272
|
+
get color() {
|
|
273
|
+
return this[H];
|
|
274
|
+
}
|
|
275
|
+
set color(e) {
|
|
276
|
+
this[H] = e, this[q](e);
|
|
277
|
+
}
|
|
278
|
+
get alpha() {
|
|
279
|
+
return this[V];
|
|
280
|
+
}
|
|
281
|
+
set alpha(e) {
|
|
282
|
+
this[V] = e, this.toggleAttribute("alpha", e);
|
|
283
|
+
let t = this.color;
|
|
284
|
+
t && !z(t, e) && (this.color = t.startsWith("#") ? t.substring(0, t.length === 5 ? 4 : 7) : t.substring(0, t.length === 4 ? 3 : 6));
|
|
285
|
+
}
|
|
286
|
+
get prefixed() {
|
|
287
|
+
return this[K];
|
|
288
|
+
}
|
|
289
|
+
set prefixed(e) {
|
|
290
|
+
this[K] = e, this.toggleAttribute("prefixed", e), this[q](this.color);
|
|
291
|
+
}
|
|
292
|
+
constructor() {
|
|
293
|
+
super();
|
|
294
|
+
let e = this.attachShadow({ mode: "open" });
|
|
295
|
+
e.appendChild(Fe.content.cloneNode(!0)), e.firstElementChild.addEventListener("slotchange", () => this[G](e));
|
|
296
|
+
}
|
|
297
|
+
connectedCallback() {
|
|
298
|
+
if (this[G](this.shadowRoot), this.hasOwnProperty("alpha")) {
|
|
299
|
+
let e = this.alpha;
|
|
300
|
+
delete this.alpha, this.alpha = e;
|
|
301
|
+
} else this.alpha = this.hasAttribute("alpha");
|
|
302
|
+
if (this.hasOwnProperty("prefixed")) {
|
|
303
|
+
let e = this.prefixed;
|
|
304
|
+
delete this.prefixed, this.prefixed = e;
|
|
305
|
+
} else this.prefixed = this.hasAttribute("prefixed");
|
|
306
|
+
if (this.hasOwnProperty("color")) {
|
|
307
|
+
let e = this.color;
|
|
308
|
+
delete this.color, this.color = e;
|
|
309
|
+
} else this.color == null ? this.color = this.getAttribute("color") || "" : this[H] && this[q](this[H]);
|
|
310
|
+
}
|
|
311
|
+
handleEvent(e) {
|
|
312
|
+
let { value: t } = e.target;
|
|
313
|
+
switch (e.type) {
|
|
314
|
+
case "input":
|
|
315
|
+
let e = B(t, this.alpha);
|
|
316
|
+
this[U] = this.color, (z(e, this.alpha) || t === "") && (this.color = e, this.dispatchEvent(new CustomEvent("color-changed", {
|
|
317
|
+
bubbles: !0,
|
|
318
|
+
detail: { value: e ? "#" + e : "" }
|
|
319
|
+
})));
|
|
320
|
+
break;
|
|
321
|
+
case "blur": t && !z(t, this.alpha) && (this.color = this[U]);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
attributeChangedCallback(e, t, n) {
|
|
325
|
+
e === "color" && this.color !== n && (this.color = n);
|
|
326
|
+
let r = n != null;
|
|
327
|
+
e === "alpha" && this.alpha !== r && (this.alpha = r), e === "prefixed" && this.prefixed !== r && (this.prefixed = r);
|
|
328
|
+
}
|
|
329
|
+
[G](e) {
|
|
330
|
+
let t = this.querySelector("input");
|
|
331
|
+
if (!t) {
|
|
332
|
+
let n;
|
|
333
|
+
for (; n = this.firstChild;) n.remove();
|
|
334
|
+
t = e.querySelector("input");
|
|
335
|
+
}
|
|
336
|
+
t.addEventListener("input", this), t.addEventListener("blur", this), this[W] = t, this[q](this.color);
|
|
337
|
+
}
|
|
338
|
+
[q](e) {
|
|
339
|
+
this[W] && (this[W].value = e == null || e == "" ? "" : (this.prefixed ? "#" : "") + B(e, this.alpha));
|
|
340
|
+
}
|
|
341
|
+
}, J = class extends Ie {};
|
|
342
|
+
customElements.define("hex-input", J);
|
|
343
|
+
//#endregion
|
|
344
|
+
//#region src/lib/color-picker/color-picker.ts
|
|
345
|
+
var Y = "vvd-hex-picker", X = "vvd-hex-input", Le = class extends R {
|
|
346
|
+
static {
|
|
347
|
+
this.displayName = "VvdHexPicker";
|
|
348
|
+
}
|
|
349
|
+
}, Re = class extends J {
|
|
350
|
+
static {
|
|
351
|
+
this.displayName = "VvdHexInput";
|
|
352
|
+
}
|
|
79
353
|
};
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
354
|
+
/* v8 ignore if -- @preserve */
|
|
355
|
+
customElements.get(Y) || customElements.define(Y, Le), customElements.get(X) || customElements.define(X, Re);
|
|
356
|
+
var Z = Y, Q = X, $ = class extends re(me(ne(f(oe(ie(_e(a))))))) {
|
|
357
|
+
constructor(...e) {
|
|
358
|
+
super(...e), this.disableSavedColors = !1, this.savedColors = [], this.maxSwatches = 6, this.copyIconName = "copy-2-line", this._copyValueToClipboard = async (e) => {
|
|
359
|
+
try {
|
|
360
|
+
await navigator.clipboard.writeText(e), this._setTemporaryCopyIcon("check-circle-line"), this._ariaLiveDescription = this.locale.colorPicker.copySuccessMessage(e);
|
|
361
|
+
} catch {
|
|
362
|
+
alert(this.locale.colorPicker.copyErrorText), this._setTemporaryCopyIcon("error-line"), this._ariaLiveDescription = this.locale.colorPicker.copyErrorText;
|
|
363
|
+
}
|
|
364
|
+
}, this._ariaLiveDescription = "";
|
|
365
|
+
}
|
|
366
|
+
static {
|
|
367
|
+
this.HEX_COLOR_PATTERN = /^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$/;
|
|
368
|
+
}
|
|
369
|
+
placeholderChanged() {
|
|
370
|
+
/* v8 ignore if -- @preserve */
|
|
371
|
+
this.proxy instanceof HTMLInputElement && (this.proxy.placeholder = this.placeholder);
|
|
372
|
+
}
|
|
373
|
+
handleChange() {
|
|
374
|
+
this.$emit("change");
|
|
375
|
+
}
|
|
376
|
+
openChanged(e, t) {
|
|
377
|
+
t && this.isConnected && requestAnimationFrame(() => {
|
|
378
|
+
this._refreshCanvasColor();
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
savedColorsKeyChanged() {
|
|
382
|
+
this.savedColors = this._loadSavedColors();
|
|
383
|
+
}
|
|
384
|
+
get _savedColorsStorageKey() {
|
|
385
|
+
return this.savedColorsKey ? this.savedColorsKey : `vvd-saved-colors:${this.tagName.toLowerCase()}`;
|
|
386
|
+
}
|
|
387
|
+
_handleColorSaving() {
|
|
388
|
+
this._saveCurrentColor();
|
|
389
|
+
}
|
|
390
|
+
_saveCurrentColor() {
|
|
391
|
+
let e = this.value;
|
|
392
|
+
if (typeof e != "string" || !h(e)) return;
|
|
393
|
+
let t = Array.isArray(this.savedColors) ? [...this.savedColors] : [], n = t.findIndex((t) => t?.value === e);
|
|
394
|
+
n !== -1 && t.splice(n, 1), t.unshift({ value: e }), this.savedColors = t.slice(0, this._maxSwatchesNormalized), this._setSavedColors(this.savedColors);
|
|
395
|
+
}
|
|
396
|
+
_loadSavedColors() {
|
|
397
|
+
try {
|
|
398
|
+
let e = localStorage.getItem(this._savedColorsStorageKey);
|
|
399
|
+
if (!e) return [];
|
|
400
|
+
let t = JSON.parse(e);
|
|
401
|
+
return Array.isArray(t) ? t.filter((e) => e && typeof e.value == "string" && h(e.value)).map((e) => ({
|
|
402
|
+
value: e.value,
|
|
403
|
+
label: typeof e.label == "string" ? e.label : void 0
|
|
404
|
+
})) : [];
|
|
405
|
+
} catch {
|
|
406
|
+
return [];
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
_setSavedColors(e) {
|
|
410
|
+
try {
|
|
411
|
+
localStorage.setItem(this._savedColorsStorageKey, JSON.stringify(e));
|
|
412
|
+
} catch {}
|
|
413
|
+
}
|
|
414
|
+
get allSwatches() {
|
|
415
|
+
let e = Array.isArray(this.swatches) ? this.swatches : [], t = Array.isArray(this.savedColors) ? this.savedColors : [], n = /* @__PURE__ */ new Set(), r = [], i = (e) => {
|
|
416
|
+
!e || typeof e.value != "string" || !h(e.value) || n.has(e.value) || (n.add(e.value), r.push(e));
|
|
417
|
+
};
|
|
418
|
+
return this.disableSavedColors || t.forEach(i), e.forEach(i), r.slice(0, this._maxSwatchesNormalized);
|
|
419
|
+
}
|
|
420
|
+
get _maxSwatchesNormalized() {
|
|
421
|
+
return Number.isFinite(this.maxSwatches) ? Math.max(0, Math.floor(this.maxSwatches)) : 0;
|
|
422
|
+
}
|
|
423
|
+
maxSwatchesChanged() {
|
|
424
|
+
let e = this._maxSwatchesNormalized;
|
|
425
|
+
this.savedColors?.length > e && (this.savedColors = this.savedColors.slice(0, e), this._setSavedColors(this.savedColors));
|
|
426
|
+
}
|
|
427
|
+
_onPickerColorChanged(e) {
|
|
428
|
+
typeof e.detail?.value == "string" && (this.value = e.detail?.value);
|
|
429
|
+
}
|
|
430
|
+
valueChanged(e, t) {
|
|
431
|
+
this._vcHexPickerEl && typeof t == "string" && (this._vcHexPickerEl.color = t), this._vcHexInputEl && typeof t == "string" && (this._vcHexInputEl.color = t);
|
|
432
|
+
}
|
|
433
|
+
_onTextFieldInput(e) {
|
|
434
|
+
this.value = e.currentTarget.value;
|
|
435
|
+
}
|
|
436
|
+
get _buttonColor() {
|
|
437
|
+
return this._canvasColor || this._refreshCanvasColor(), this.value && h(this.value) ? this.value : "var(--vvd-color-canvas-text)";
|
|
438
|
+
}
|
|
439
|
+
_onButtonClick() {
|
|
440
|
+
this.open = !this.open;
|
|
441
|
+
}
|
|
442
|
+
_handleCloseRequest() {
|
|
443
|
+
this.open = !1;
|
|
444
|
+
}
|
|
445
|
+
_isInPath(e, t) {
|
|
446
|
+
if (!t) return !1;
|
|
447
|
+
let n = e.composedPath?.();
|
|
448
|
+
return !!(n && n.includes(t));
|
|
449
|
+
}
|
|
450
|
+
#e = (e) => {
|
|
451
|
+
this._isInPath(e, this._buttonEl) || this._isInPath(e, this._popupEl) || (this.open = !1);
|
|
452
|
+
};
|
|
453
|
+
connectedCallback() {
|
|
454
|
+
super.connectedCallback(), this.savedColors = this._loadSavedColors(), document.addEventListener("mousedown", this.#e, !0);
|
|
455
|
+
}
|
|
456
|
+
disconnectedCallback() {
|
|
457
|
+
super.disconnectedCallback(), document.removeEventListener("mousedown", this.#e, !0);
|
|
458
|
+
}
|
|
459
|
+
#t = null;
|
|
460
|
+
_setTemporaryCopyIcon(e, t = 2e3) {
|
|
461
|
+
this.copyIconName = e, this.#t && clearTimeout(this.#t), this.#t = setTimeout(() => {
|
|
462
|
+
this.copyIconName = "copy-2-line", this.#t = null;
|
|
463
|
+
}, t);
|
|
464
|
+
}
|
|
465
|
+
_onBaseKeydown(e) {
|
|
466
|
+
return this.open && fe(e) ? (this.open = !1, !1) : !this._trappedFocus(e, () => this._focusableElsWithinDialog());
|
|
467
|
+
}
|
|
468
|
+
_focusableElsWithinDialog() {
|
|
469
|
+
return this._popupEl.querySelectorAll("button:not([role=\"gridcell\"]), [data-vvd-component=\"button\"], vwc-button:not([role=\"gridcell\"])");
|
|
470
|
+
}
|
|
471
|
+
_handleCellKeydown(e, t, n, r) {
|
|
472
|
+
if (e.key === "Tab") {
|
|
473
|
+
e.preventDefault();
|
|
474
|
+
let t = this._focusableElsWithinDialog(), n = Array.prototype.indexOf.call(t, e.currentTarget);
|
|
475
|
+
return t[e.shiftKey ? (n - 1 + t.length) % t.length : (n + 1) % t.length]?.focus(), !1;
|
|
476
|
+
}
|
|
477
|
+
return super._handleCellKeydown(e, t, n, r);
|
|
478
|
+
}
|
|
479
|
+
_handleSwatchSelection(e) {
|
|
480
|
+
this.value !== e && (this._ariaLiveDescription = this.locale.colorPicker.selectionSuccessMessage(e)), super._handleSwatchSelection(e);
|
|
481
|
+
}
|
|
93
482
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
case "mousedown":
|
|
108
|
-
case "touchstart":
|
|
109
|
-
if (e.preventDefault(), !Le(e) || !h && e.button != 0)
|
|
110
|
-
return;
|
|
111
|
-
this.el.focus(), B(this, e), this.dragging = !0;
|
|
112
|
-
break;
|
|
113
|
-
case "mousemove":
|
|
114
|
-
case "touchmove":
|
|
115
|
-
e.preventDefault(), B(this, e);
|
|
116
|
-
break;
|
|
117
|
-
case "mouseup":
|
|
118
|
-
case "touchend":
|
|
119
|
-
this.dragging = !1;
|
|
120
|
-
break;
|
|
121
|
-
case "keydown":
|
|
122
|
-
Ae(this, e);
|
|
123
|
-
break;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
style(e) {
|
|
127
|
-
e.forEach((o, t) => {
|
|
128
|
-
for (const s in o)
|
|
129
|
-
this.nodes[t].style.setProperty(s, o[s]);
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
class Me extends Y {
|
|
134
|
-
constructor(e) {
|
|
135
|
-
super(e, "hue", 'aria-label="Hue" aria-valuemin="0" aria-valuemax="360"', !1);
|
|
136
|
-
}
|
|
137
|
-
update({ h: e }) {
|
|
138
|
-
this.h = e, this.style([
|
|
139
|
-
{
|
|
140
|
-
left: `${e / 360 * 100}%`,
|
|
141
|
-
color: T({ h: e, s: 100, v: 100, a: 1 })
|
|
142
|
-
}
|
|
143
|
-
]), this.el.setAttribute("aria-valuenow", `${l(e)}`);
|
|
144
|
-
}
|
|
145
|
-
getMove(e, o) {
|
|
146
|
-
return { h: o ? f(this.h + e.x * 360, 0, 360) : 360 * e.x };
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
class Fe extends Y {
|
|
150
|
-
constructor(e) {
|
|
151
|
-
super(e, "saturation", 'aria-label="Color"', !0);
|
|
152
|
-
}
|
|
153
|
-
update(e) {
|
|
154
|
-
this.hsva = e, this.style([
|
|
155
|
-
{
|
|
156
|
-
top: `${100 - e.v}%`,
|
|
157
|
-
left: `${e.s}%`,
|
|
158
|
-
color: T(e)
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
"background-color": T({ h: e.h, s: 100, v: 100, a: 1 })
|
|
162
|
-
}
|
|
163
|
-
]), this.el.setAttribute("aria-valuetext", `Saturation ${l(e.s)}%, Brightness ${l(e.v)}%`);
|
|
164
|
-
}
|
|
165
|
-
getMove(e, o) {
|
|
166
|
-
return {
|
|
167
|
-
s: o ? f(this.hsva.s + e.x * 100, 0, 100) : e.x * 100,
|
|
168
|
-
v: o ? f(this.hsva.v - e.y * 100, 0, 100) : Math.round(100 - e.y * 100)
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
const Ne = ':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)}', De = "[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}", Be = "[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}", g = /* @__PURE__ */ Symbol("same"), $ = /* @__PURE__ */ Symbol("color"), O = /* @__PURE__ */ Symbol("hsva"), k = /* @__PURE__ */ Symbol("update"), R = /* @__PURE__ */ Symbol("parts"), K = /* @__PURE__ */ Symbol("css"), V = /* @__PURE__ */ Symbol("sliders");
|
|
173
|
-
let Oe = class extends HTMLElement {
|
|
174
|
-
static get observedAttributes() {
|
|
175
|
-
return ["color"];
|
|
176
|
-
}
|
|
177
|
-
get [K]() {
|
|
178
|
-
return [Ne, De, Be];
|
|
179
|
-
}
|
|
180
|
-
get [V]() {
|
|
181
|
-
return [Fe, Me];
|
|
182
|
-
}
|
|
183
|
-
get color() {
|
|
184
|
-
return this[$];
|
|
185
|
-
}
|
|
186
|
-
set color(e) {
|
|
187
|
-
if (!this[g](e)) {
|
|
188
|
-
const o = this.colorModel.toHsva(e);
|
|
189
|
-
this[k](o), this[$] = e;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
constructor() {
|
|
193
|
-
super();
|
|
194
|
-
const e = A(`<style>${this[K].join("")}</style>`), o = this.attachShadow({ mode: "open" });
|
|
195
|
-
o.appendChild(e.content.cloneNode(!0)), o.addEventListener("move", this), this[R] = this[V].map((t) => new t(o));
|
|
196
|
-
}
|
|
197
|
-
connectedCallback() {
|
|
198
|
-
if (this.hasOwnProperty("color")) {
|
|
199
|
-
const e = this.color;
|
|
200
|
-
delete this.color, this.color = e;
|
|
201
|
-
} else this.color || (this.color = this.colorModel.defaultColor);
|
|
202
|
-
}
|
|
203
|
-
attributeChangedCallback(e, o, t) {
|
|
204
|
-
const s = this.colorModel.fromAttr(t);
|
|
205
|
-
this[g](s) || (this.color = s);
|
|
206
|
-
}
|
|
207
|
-
handleEvent(e) {
|
|
208
|
-
const o = this[O], t = { ...o, ...e.detail };
|
|
209
|
-
this[k](t);
|
|
210
|
-
let s;
|
|
211
|
-
!U(t, o) && !this[g](s = this.colorModel.fromHsva(t)) && (this[$] = s, M(this, "color-changed", { value: s }));
|
|
212
|
-
}
|
|
213
|
-
[g](e) {
|
|
214
|
-
return this.color && this.colorModel.equal(e, this.color);
|
|
215
|
-
}
|
|
216
|
-
[k](e) {
|
|
217
|
-
this[O] = e, this[R].forEach((o) => o.update(e));
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
const Re = {
|
|
221
|
-
defaultColor: "#000",
|
|
222
|
-
toHsva: Se,
|
|
223
|
-
fromHsva: ({ h: r, s: e, v: o }) => Ee({ h: r, s: e, v: o, a: 1 }),
|
|
224
|
-
equal: ze,
|
|
225
|
-
fromAttr: (r) => r
|
|
226
|
-
};
|
|
227
|
-
class Ke extends Oe {
|
|
228
|
-
get colorModel() {
|
|
229
|
-
return Re;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
class Q extends Ke {
|
|
233
|
-
}
|
|
234
|
-
customElements.define("hex-color-picker", Q);
|
|
235
|
-
const Ve = /^#?([0-9A-F]{3,8})$/i, w = (r, e) => {
|
|
236
|
-
const o = Ve.exec(r), t = o ? o[1].length : 0;
|
|
237
|
-
return t === 3 || // '#rgb' format
|
|
238
|
-
t === 6 || // '#rrggbb' format
|
|
239
|
-
!!e && t === 4 || // '#rgba' format
|
|
240
|
-
!!e && t === 8;
|
|
241
|
-
}, qe = A('<slot><input part="input" spellcheck="false"></slot>'), q = (r, e) => r.replace(/([^0-9A-F]+)/gi, "").substring(0, e ? 8 : 6), W = /* @__PURE__ */ Symbol("alpha"), x = /* @__PURE__ */ Symbol("color"), X = /* @__PURE__ */ Symbol("saved"), _ = /* @__PURE__ */ Symbol("input"), S = /* @__PURE__ */ Symbol("init"), j = /* @__PURE__ */ Symbol("prefix"), u = /* @__PURE__ */ Symbol("update");
|
|
242
|
-
class We extends HTMLElement {
|
|
243
|
-
static get observedAttributes() {
|
|
244
|
-
return ["alpha", "color", "prefixed"];
|
|
245
|
-
}
|
|
246
|
-
get color() {
|
|
247
|
-
return this[x];
|
|
248
|
-
}
|
|
249
|
-
set color(e) {
|
|
250
|
-
this[x] = e, this[u](e);
|
|
251
|
-
}
|
|
252
|
-
get alpha() {
|
|
253
|
-
return this[W];
|
|
254
|
-
}
|
|
255
|
-
set alpha(e) {
|
|
256
|
-
this[W] = e, this.toggleAttribute("alpha", e);
|
|
257
|
-
const o = this.color;
|
|
258
|
-
o && !w(o, e) && (this.color = o.startsWith("#") ? o.substring(0, o.length === 5 ? 4 : 7) : o.substring(0, o.length === 4 ? 3 : 6));
|
|
259
|
-
}
|
|
260
|
-
get prefixed() {
|
|
261
|
-
return this[j];
|
|
262
|
-
}
|
|
263
|
-
set prefixed(e) {
|
|
264
|
-
this[j] = e, this.toggleAttribute("prefixed", e), this[u](this.color);
|
|
265
|
-
}
|
|
266
|
-
constructor() {
|
|
267
|
-
super();
|
|
268
|
-
const e = this.attachShadow({ mode: "open" });
|
|
269
|
-
e.appendChild(qe.content.cloneNode(!0)), e.firstElementChild.addEventListener("slotchange", () => this[S](e));
|
|
270
|
-
}
|
|
271
|
-
connectedCallback() {
|
|
272
|
-
if (this[S](this.shadowRoot), this.hasOwnProperty("alpha")) {
|
|
273
|
-
const e = this.alpha;
|
|
274
|
-
delete this.alpha, this.alpha = e;
|
|
275
|
-
} else
|
|
276
|
-
this.alpha = this.hasAttribute("alpha");
|
|
277
|
-
if (this.hasOwnProperty("prefixed")) {
|
|
278
|
-
const e = this.prefixed;
|
|
279
|
-
delete this.prefixed, this.prefixed = e;
|
|
280
|
-
} else
|
|
281
|
-
this.prefixed = this.hasAttribute("prefixed");
|
|
282
|
-
if (this.hasOwnProperty("color")) {
|
|
283
|
-
const e = this.color;
|
|
284
|
-
delete this.color, this.color = e;
|
|
285
|
-
} else this.color == null ? this.color = this.getAttribute("color") || "" : this[x] && this[u](this[x]);
|
|
286
|
-
}
|
|
287
|
-
handleEvent(e) {
|
|
288
|
-
const o = e.target, { value: t } = o;
|
|
289
|
-
switch (e.type) {
|
|
290
|
-
case "input":
|
|
291
|
-
const s = q(t, this.alpha);
|
|
292
|
-
this[X] = this.color, (w(s, this.alpha) || t === "") && (this.color = s, this.dispatchEvent(new CustomEvent("color-changed", {
|
|
293
|
-
bubbles: !0,
|
|
294
|
-
detail: { value: s ? "#" + s : "" }
|
|
295
|
-
})));
|
|
296
|
-
break;
|
|
297
|
-
case "blur":
|
|
298
|
-
t && !w(t, this.alpha) && (this.color = this[X]);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
attributeChangedCallback(e, o, t) {
|
|
302
|
-
e === "color" && this.color !== t && (this.color = t);
|
|
303
|
-
const s = t != null;
|
|
304
|
-
e === "alpha" && this.alpha !== s && (this.alpha = s), e === "prefixed" && this.prefixed !== s && (this.prefixed = s);
|
|
305
|
-
}
|
|
306
|
-
[S](e) {
|
|
307
|
-
let o = this.querySelector("input");
|
|
308
|
-
if (!o) {
|
|
309
|
-
let t;
|
|
310
|
-
for (; t = this.firstChild; )
|
|
311
|
-
t.remove();
|
|
312
|
-
o = e.querySelector("input");
|
|
313
|
-
}
|
|
314
|
-
o.addEventListener("input", this), o.addEventListener("blur", this), this[_] = o, this[u](this.color);
|
|
315
|
-
}
|
|
316
|
-
[u](e) {
|
|
317
|
-
this[_] && (this[_].value = e == null || e == "" ? "" : (this.prefixed ? "#" : "") + q(e, this.alpha));
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
class Z extends We {
|
|
321
|
-
}
|
|
322
|
-
customElements.define("hex-input", Z);
|
|
323
|
-
var Xe = Object.defineProperty, p = (r, e, o, t) => {
|
|
324
|
-
for (var s = void 0, i = r.length - 1, a; i >= 0; i--)
|
|
325
|
-
(a = r[i]) && (s = a(e, o, s) || s);
|
|
326
|
-
return s && Xe(e, o, s), s;
|
|
327
|
-
};
|
|
328
|
-
const I = "vvd-hex-picker", z = "vvd-hex-input";
|
|
329
|
-
class je extends Q {
|
|
330
|
-
static {
|
|
331
|
-
this.displayName = "VvdHexPicker";
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
class Ge extends Z {
|
|
335
|
-
static {
|
|
336
|
-
this.displayName = "VvdHexInput";
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
customElements.get(I) || customElements.define(I, je);
|
|
340
|
-
customElements.get(z) || customElements.define(z, Ge);
|
|
341
|
-
const G = I, J = z;
|
|
342
|
-
class c extends ve(
|
|
343
|
-
ne(
|
|
344
|
-
fe(
|
|
345
|
-
be(
|
|
346
|
-
de(me(ue(ee)))
|
|
347
|
-
)
|
|
348
|
-
)
|
|
349
|
-
)
|
|
350
|
-
) {
|
|
351
|
-
constructor() {
|
|
352
|
-
super(...arguments), this.disableSavedColors = !1, this.savedColors = [], this.maxSwatches = 6, this.#t = (e) => {
|
|
353
|
-
this._isInPath(e, this._buttonEl) || this._isInPath(e, this._popupEl) || (this.open = !1);
|
|
354
|
-
}, this.copyIconName = "copy-2-line", this.#e = null, this._copyValueToClipboard = async (e) => {
|
|
355
|
-
try {
|
|
356
|
-
await navigator.clipboard.writeText(e), this._setTemporaryCopyIcon("check-circle-line"), this._ariaLiveDescription = this.locale.colorPicker.copySuccessMessage(e);
|
|
357
|
-
} catch {
|
|
358
|
-
alert(this.locale.colorPicker.copyErrorText), this._setTemporaryCopyIcon("error-line"), this._ariaLiveDescription = this.locale.colorPicker.copyErrorText;
|
|
359
|
-
}
|
|
360
|
-
}, this._ariaLiveDescription = "";
|
|
361
|
-
}
|
|
362
|
-
static {
|
|
363
|
-
this.HEX_COLOR_PATTERN = /^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$/;
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* @internal
|
|
367
|
-
*/
|
|
368
|
-
placeholderChanged() {
|
|
369
|
-
this.proxy instanceof HTMLInputElement && (this.proxy.placeholder = this.placeholder);
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* Change event handler for inner control.
|
|
373
|
-
* @remarks
|
|
374
|
-
* @internal
|
|
375
|
-
*/
|
|
376
|
-
handleChange() {
|
|
377
|
-
this.$emit("change");
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* @internal
|
|
381
|
-
*/
|
|
382
|
-
openChanged(e, o) {
|
|
383
|
-
o && this.isConnected && requestAnimationFrame(() => {
|
|
384
|
-
this._refreshCanvasColor();
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* @internal
|
|
389
|
-
*/
|
|
390
|
-
savedColorsKeyChanged() {
|
|
391
|
-
this.savedColors = this._loadSavedColors();
|
|
392
|
-
}
|
|
393
|
-
/**
|
|
394
|
-
* @internal
|
|
395
|
-
*/
|
|
396
|
-
get _savedColorsStorageKey() {
|
|
397
|
-
return this.savedColorsKey ? this.savedColorsKey : `vvd-saved-colors:${this.tagName.toLowerCase()}`;
|
|
398
|
-
}
|
|
399
|
-
/**
|
|
400
|
-
* @internal
|
|
401
|
-
*/
|
|
402
|
-
_handleColorSaving() {
|
|
403
|
-
this._saveCurrentColor();
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* @internal
|
|
407
|
-
*/
|
|
408
|
-
_saveCurrentColor() {
|
|
409
|
-
const e = this.value;
|
|
410
|
-
if (typeof e != "string" || !b(e)) return;
|
|
411
|
-
const o = Array.isArray(this.savedColors) ? [...this.savedColors] : [], t = o.findIndex((s) => s?.value === e);
|
|
412
|
-
t !== -1 && o.splice(t, 1), o.unshift({ value: e }), this.savedColors = o.slice(0, this._maxSwatchesNormalized), this._setSavedColors(this.savedColors);
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* @internal
|
|
416
|
-
*/
|
|
417
|
-
_loadSavedColors() {
|
|
418
|
-
try {
|
|
419
|
-
const e = localStorage.getItem(this._savedColorsStorageKey);
|
|
420
|
-
if (!e) return [];
|
|
421
|
-
const o = JSON.parse(e);
|
|
422
|
-
return Array.isArray(o) ? o.filter(
|
|
423
|
-
(t) => t && typeof t.value == "string" && b(t.value)
|
|
424
|
-
).map((t) => ({
|
|
425
|
-
value: t.value,
|
|
426
|
-
label: typeof t.label == "string" ? t.label : void 0
|
|
427
|
-
})) : [];
|
|
428
|
-
} catch {
|
|
429
|
-
return [];
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
/**
|
|
433
|
-
* @internal
|
|
434
|
-
*/
|
|
435
|
-
_setSavedColors(e) {
|
|
436
|
-
try {
|
|
437
|
-
localStorage.setItem(
|
|
438
|
-
this._savedColorsStorageKey,
|
|
439
|
-
JSON.stringify(e)
|
|
440
|
-
);
|
|
441
|
-
} catch {
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
/**
|
|
445
|
-
* Get all color swatches combined, both from swatches property and saved colors
|
|
446
|
-
* @internal
|
|
447
|
-
*/
|
|
448
|
-
get allSwatches() {
|
|
449
|
-
const e = Array.isArray(this.swatches) ? this.swatches : [], o = Array.isArray(this.savedColors) ? this.savedColors : [], t = /* @__PURE__ */ new Set(), s = [], i = (a) => {
|
|
450
|
-
!a || typeof a.value != "string" || !b(a.value) || t.has(a.value) || (t.add(a.value), s.push(a));
|
|
451
|
-
};
|
|
452
|
-
return this.disableSavedColors || o.forEach(i), e.forEach(i), s.slice(0, this._maxSwatchesNormalized);
|
|
453
|
-
}
|
|
454
|
-
/**
|
|
455
|
-
* @internal
|
|
456
|
-
*/
|
|
457
|
-
get _maxSwatchesNormalized() {
|
|
458
|
-
return Number.isFinite(this.maxSwatches) ? Math.max(0, Math.floor(this.maxSwatches)) : 0;
|
|
459
|
-
}
|
|
460
|
-
/**
|
|
461
|
-
* @internal
|
|
462
|
-
*/
|
|
463
|
-
maxSwatchesChanged() {
|
|
464
|
-
const e = this._maxSwatchesNormalized;
|
|
465
|
-
this.savedColors?.length > e && (this.savedColors = this.savedColors.slice(0, e), this._setSavedColors(this.savedColors));
|
|
466
|
-
}
|
|
467
|
-
/**
|
|
468
|
-
* @internal
|
|
469
|
-
*/
|
|
470
|
-
_onPickerColorChanged(e) {
|
|
471
|
-
typeof e.detail?.value == "string" && (this.value = e.detail?.value);
|
|
472
|
-
}
|
|
473
|
-
/**
|
|
474
|
-
* @internal
|
|
475
|
-
*/
|
|
476
|
-
valueChanged(e, o) {
|
|
477
|
-
this._vcHexPickerEl && typeof o == "string" && (this._vcHexPickerEl.color = o), this._vcHexInputEl && typeof o == "string" && (this._vcHexInputEl.color = o);
|
|
478
|
-
}
|
|
479
|
-
/**
|
|
480
|
-
* @internal
|
|
481
|
-
*/
|
|
482
|
-
_onTextFieldInput(e) {
|
|
483
|
-
const o = e.currentTarget;
|
|
484
|
-
this.value = o.value;
|
|
485
|
-
}
|
|
486
|
-
/**
|
|
487
|
-
* @internal
|
|
488
|
-
*/
|
|
489
|
-
get _buttonColor() {
|
|
490
|
-
return this._canvasColor || this._refreshCanvasColor(), this.value && b(this.value) ? this.value : "var(--vvd-color-canvas-text)";
|
|
491
|
-
}
|
|
492
|
-
/**
|
|
493
|
-
* @internal
|
|
494
|
-
*/
|
|
495
|
-
_onButtonClick() {
|
|
496
|
-
this.open = !this.open;
|
|
497
|
-
}
|
|
498
|
-
/**
|
|
499
|
-
* @internal
|
|
500
|
-
*/
|
|
501
|
-
_handleCloseRequest() {
|
|
502
|
-
this.open = !1;
|
|
503
|
-
}
|
|
504
|
-
/**
|
|
505
|
-
* @internal
|
|
506
|
-
*/
|
|
507
|
-
_isInPath(e, o) {
|
|
508
|
-
if (!o) return !1;
|
|
509
|
-
const t = e.composedPath?.();
|
|
510
|
-
return !!(t && t.includes(o));
|
|
511
|
-
}
|
|
512
|
-
#t;
|
|
513
|
-
connectedCallback() {
|
|
514
|
-
super.connectedCallback(), this.savedColors = this._loadSavedColors(), document.addEventListener("mousedown", this.#t, !0);
|
|
515
|
-
}
|
|
516
|
-
disconnectedCallback() {
|
|
517
|
-
super.disconnectedCallback(), document.removeEventListener(
|
|
518
|
-
"mousedown",
|
|
519
|
-
this.#t,
|
|
520
|
-
!0
|
|
521
|
-
);
|
|
522
|
-
}
|
|
523
|
-
#e;
|
|
524
|
-
/**
|
|
525
|
-
* @internal
|
|
526
|
-
*/
|
|
527
|
-
_setTemporaryCopyIcon(e, o = 2e3) {
|
|
528
|
-
this.copyIconName = e, this.#e && clearTimeout(this.#e), this.#e = setTimeout(() => {
|
|
529
|
-
this.copyIconName = "copy-2-line", this.#e = null;
|
|
530
|
-
}, o);
|
|
531
|
-
}
|
|
532
|
-
// --- Trapped focus ---
|
|
533
|
-
/**
|
|
534
|
-
* @internal
|
|
535
|
-
*/
|
|
536
|
-
_onBaseKeydown(e) {
|
|
537
|
-
return this.open && he(e) ? (this.open = !1, !1) : !this._trappedFocus(e, () => this._focusableElsWithinDialog());
|
|
538
|
-
}
|
|
539
|
-
/**
|
|
540
|
-
* @internal
|
|
541
|
-
*/
|
|
542
|
-
_focusableElsWithinDialog() {
|
|
543
|
-
return this._popupEl.querySelectorAll(
|
|
544
|
-
'button:not([role="gridcell"]), [data-vvd-component="button"], vwc-button:not([role="gridcell"])'
|
|
545
|
-
);
|
|
546
|
-
}
|
|
547
|
-
/**
|
|
548
|
-
* @internal
|
|
549
|
-
*/
|
|
550
|
-
_handleCellKeydown(e, o, t, s) {
|
|
551
|
-
if (e.key === "Tab") {
|
|
552
|
-
e.preventDefault();
|
|
553
|
-
const i = this._focusableElsWithinDialog(), a = Array.prototype.indexOf.call(
|
|
554
|
-
i,
|
|
555
|
-
e.currentTarget
|
|
556
|
-
), d = e.shiftKey ? (a - 1 + i.length) % i.length : (a + 1) % i.length;
|
|
557
|
-
return i[d]?.focus(), !1;
|
|
558
|
-
}
|
|
559
|
-
return super._handleCellKeydown(e, o, t, s);
|
|
560
|
-
}
|
|
561
|
-
/**
|
|
562
|
-
* @internal
|
|
563
|
-
*/
|
|
564
|
-
_handleSwatchSelection(e) {
|
|
565
|
-
this.value !== e && (this._ariaLiveDescription = this.locale.colorPicker.selectionSuccessMessage(e)), super._handleSwatchSelection(e);
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
p([
|
|
569
|
-
y
|
|
570
|
-
], c.prototype, "placeholder");
|
|
571
|
-
p([
|
|
572
|
-
y({ attribute: "saved-colors-key" })
|
|
573
|
-
], c.prototype, "savedColorsKey");
|
|
574
|
-
p([
|
|
575
|
-
y({
|
|
576
|
-
mode: "boolean",
|
|
577
|
-
attribute: "disable-saved-colors"
|
|
578
|
-
})
|
|
579
|
-
], c.prototype, "disableSavedColors");
|
|
580
|
-
p([
|
|
581
|
-
L
|
|
582
|
-
], c.prototype, "savedColors");
|
|
583
|
-
p([
|
|
584
|
-
y({
|
|
585
|
-
attribute: "max-swatches",
|
|
586
|
-
mode: "fromView",
|
|
587
|
-
converter: te
|
|
588
|
-
})
|
|
589
|
-
], c.prototype, "maxSwatches");
|
|
590
|
-
p([
|
|
591
|
-
L
|
|
592
|
-
], c.prototype, "copyIconName");
|
|
593
|
-
p([
|
|
594
|
-
L
|
|
595
|
-
], c.prototype, "_ariaLiveDescription");
|
|
596
|
-
function Je(r, e) {
|
|
597
|
-
return n`
|
|
598
|
-
<${r}
|
|
483
|
+
d([n], $.prototype, "placeholder", void 0), d([n({ attribute: "saved-colors-key" })], $.prototype, "savedColorsKey", void 0), d([n({
|
|
484
|
+
mode: "boolean",
|
|
485
|
+
attribute: "disable-saved-colors"
|
|
486
|
+
})], $.prototype, "disableSavedColors", void 0), d([e], $.prototype, "savedColors", void 0), d([n({
|
|
487
|
+
attribute: "max-swatches",
|
|
488
|
+
mode: "fromView",
|
|
489
|
+
converter: o
|
|
490
|
+
})], $.prototype, "maxSwatches", void 0), d([e], $.prototype, "copyIconName", void 0), d([e], $.prototype, "_ariaLiveDescription", void 0);
|
|
491
|
+
//#endregion
|
|
492
|
+
//#region src/lib/color-picker/color-picker.template.ts
|
|
493
|
+
function ze(e, n) {
|
|
494
|
+
return t`
|
|
495
|
+
<${e}
|
|
599
496
|
id="text-field"
|
|
600
|
-
class="${(
|
|
601
|
-
pattern="${
|
|
497
|
+
class="${(e) => p("control")}"
|
|
498
|
+
pattern="${$.HEX_COLOR_PATTERN.source}"
|
|
602
499
|
maxlength="7"
|
|
603
|
-
label="${(
|
|
604
|
-
:value="${(
|
|
605
|
-
placeholder="${(
|
|
606
|
-
helper-text="${(
|
|
607
|
-
error-text="${(
|
|
608
|
-
success-text="${(
|
|
609
|
-
?disabled="${(
|
|
610
|
-
?required="${(
|
|
611
|
-
@input='${(
|
|
612
|
-
@change="${(
|
|
613
|
-
@blur="${(
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
@focus="${(
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
${
|
|
620
|
-
${
|
|
500
|
+
label="${(e) => e.label}"
|
|
501
|
+
:value="${(e) => e.value}"
|
|
502
|
+
placeholder="${(e) => e.placeholder}"
|
|
503
|
+
helper-text="${(e) => e.helperText}"
|
|
504
|
+
error-text="${(e) => e.errorValidationMessage}"
|
|
505
|
+
success-text="${(e) => e.successText}"
|
|
506
|
+
?disabled="${(e) => e.disabled}"
|
|
507
|
+
?required="${(e) => e.required}"
|
|
508
|
+
@input='${(e, t) => e._onTextFieldInput(t.event)}'
|
|
509
|
+
@change="${(e) => e.handleChange()}"
|
|
510
|
+
@blur="${(e) => {
|
|
511
|
+
e.$emit("blur", void 0, { bubbles: !1 });
|
|
512
|
+
}}"
|
|
513
|
+
@focus="${(e) => {
|
|
514
|
+
e.$emit("focus", void 0, { bubbles: !1 });
|
|
515
|
+
}}"
|
|
516
|
+
${ae()}
|
|
517
|
+
${c("_textFieldEl")}
|
|
621
518
|
>
|
|
622
519
|
<button
|
|
623
|
-
aria-label="${(
|
|
624
|
-
aria-expanded="${(
|
|
520
|
+
aria-label="${(e) => e.locale.colorPicker.pickerButtonLabel}"
|
|
521
|
+
aria-expanded="${(e) => e.open}"
|
|
625
522
|
aria-haspopup="dialog"
|
|
626
|
-
class="button ${(
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
style="--button-color: ${(t) => t._buttonColor};"
|
|
631
|
-
?disabled="${(t) => t.disabled}"
|
|
632
|
-
@click="${(t) => t._onButtonClick()}"
|
|
523
|
+
class="button ${(e) => p(e._applyContrastClass(e._buttonColor) ? "contrast" : "", e.disabled ? "disabled" : "")}"
|
|
524
|
+
style="--button-color: ${(e) => e._buttonColor};"
|
|
525
|
+
?disabled="${(e) => e.disabled}"
|
|
526
|
+
@click="${(e) => e._onButtonClick()}"
|
|
633
527
|
slot="action-items"
|
|
634
|
-
${
|
|
635
|
-
<${
|
|
528
|
+
${c("_buttonEl")}>
|
|
529
|
+
<${n} name="edit-line"></${n}>
|
|
636
530
|
</button>
|
|
637
531
|
<slot
|
|
638
|
-
slot="${(
|
|
532
|
+
slot="${(e) => e._helperTextSlottedContent?.length ? "helper-text" : void 0}"
|
|
639
533
|
name="helper-text"
|
|
640
|
-
${
|
|
534
|
+
${u("_helperTextSlottedContent")}
|
|
641
535
|
></slot>
|
|
642
536
|
<slot
|
|
643
|
-
slot='${(
|
|
537
|
+
slot='${(e) => e._contextualHelpSlottedContent?.length ? "contextual-help" : void 0}'
|
|
644
538
|
name='contextual-help'
|
|
645
|
-
${
|
|
539
|
+
${u("_contextualHelpSlottedContent")}
|
|
646
540
|
></slot>
|
|
647
|
-
</${
|
|
541
|
+
</${e}>
|
|
648
542
|
`;
|
|
649
543
|
}
|
|
650
|
-
function
|
|
651
|
-
|
|
544
|
+
function Be(e, n) {
|
|
545
|
+
return t`
|
|
652
546
|
<div class="header">
|
|
653
547
|
<h2 class="header-title" id="color-picker-title">
|
|
654
|
-
<slot name="popup-text">${(
|
|
548
|
+
<slot name="popup-text">${(e) => e.locale.colorPicker.popupLabel}</slot>
|
|
655
549
|
</h2>
|
|
656
|
-
<${
|
|
657
|
-
aria-label="${(
|
|
658
|
-
@click="${(
|
|
659
|
-
<${
|
|
660
|
-
</${
|
|
550
|
+
<${e} size="condensed"
|
|
551
|
+
aria-label="${(e) => e.locale.colorPicker.closeButtonLabel}"
|
|
552
|
+
@click="${(e) => e._handleCloseRequest()}">
|
|
553
|
+
<${n} slot="icon" name="close-line"></${n}>
|
|
554
|
+
</${e}>
|
|
661
555
|
</div>
|
|
662
556
|
`;
|
|
663
557
|
}
|
|
664
|
-
function
|
|
665
|
-
|
|
558
|
+
function Ve(e, n, r) {
|
|
559
|
+
return t`
|
|
666
560
|
<div class="body">
|
|
667
|
-
<${
|
|
561
|
+
<${t.partial(Z)}
|
|
668
562
|
part="hex-picker"
|
|
669
|
-
color="${(
|
|
670
|
-
@color-changed="${(
|
|
671
|
-
${
|
|
672
|
-
></${
|
|
563
|
+
color="${(e) => e.value}"
|
|
564
|
+
@color-changed="${(e, t) => e._onPickerColorChanged(t.event)}"
|
|
565
|
+
${c("_vcHexPickerEl")}
|
|
566
|
+
></${t.partial(Z)}>
|
|
673
567
|
<div class="hex-input-wrapper">
|
|
674
|
-
<${
|
|
568
|
+
<${t.partial(Q)}
|
|
675
569
|
part="hex-input"
|
|
676
570
|
prefixed
|
|
677
|
-
color="${(
|
|
678
|
-
@color-changed="${(
|
|
679
|
-
${
|
|
571
|
+
color="${(e) => e.value}"
|
|
572
|
+
@color-changed="${(e, t) => e._onPickerColorChanged(t.event)}"
|
|
573
|
+
${c("_vcHexInputEl")}
|
|
680
574
|
>
|
|
681
|
-
<input name="hex-code-input" aria-label="${(
|
|
682
|
-
placeholder="${(
|
|
683
|
-
@blur="${(
|
|
575
|
+
<input name="hex-code-input" aria-label="${(e) => e.locale.colorPicker.hexInputLabel}"
|
|
576
|
+
placeholder="${(e) => e.placeholder}"
|
|
577
|
+
@blur="${(e, t) => t.event.stopImmediatePropagation()}"
|
|
684
578
|
part="input">
|
|
685
|
-
</${
|
|
686
|
-
<${
|
|
687
|
-
text="${(
|
|
579
|
+
</${t.partial(Q)}>
|
|
580
|
+
<${r} placement="top"
|
|
581
|
+
text="${(e) => e.locale.colorPicker.copyButtonLabel}"
|
|
688
582
|
exportparts="vvd-theme-alternate">
|
|
689
|
-
<${
|
|
583
|
+
<${e}
|
|
690
584
|
slot="anchor" size="normal"
|
|
691
|
-
aria-label="${(
|
|
692
|
-
@click="${(
|
|
693
|
-
<${
|
|
694
|
-
</${
|
|
695
|
-
</${
|
|
585
|
+
aria-label="${(e) => e.locale.colorPicker.copyButtonLabel}"
|
|
586
|
+
@click="${(e) => e._copyValueToClipboard(e.value)}">
|
|
587
|
+
<${n} slot="icon" name="${(e) => e.copyIconName}"></${n}>
|
|
588
|
+
</${e}>
|
|
589
|
+
</${r}>
|
|
696
590
|
</div>
|
|
697
591
|
</div>
|
|
698
592
|
`;
|
|
699
593
|
}
|
|
700
|
-
function
|
|
701
|
-
|
|
594
|
+
function He(e, n, r) {
|
|
595
|
+
return t`
|
|
702
596
|
<div class="footer">
|
|
703
597
|
<div class="footer-header">
|
|
704
598
|
<span class="footer-title" id="color-picker-footer-title"
|
|
705
599
|
><slot name="swatches-text"
|
|
706
|
-
>${(
|
|
600
|
+
>${(e) => e.locale.colorPicker.swatchesLabel}</slot
|
|
707
601
|
></span
|
|
708
602
|
>
|
|
709
|
-
${
|
|
603
|
+
${l((e) => !e.disableSavedColors, Ue())}
|
|
710
604
|
</div>
|
|
711
605
|
<div
|
|
712
606
|
class="palette"
|
|
713
607
|
role="grid"
|
|
714
|
-
aria-rowcount="${(
|
|
715
|
-
aria-colcount="${(
|
|
716
|
-
style="--swatches-per-row: ${(
|
|
608
|
+
aria-rowcount="${(e) => Math.ceil(e.allSwatches.length / e._getRowLength())}"
|
|
609
|
+
aria-colcount="${(e) => e._getRowLength()}"
|
|
610
|
+
style="--swatches-per-row: ${(e) => e._getRowLength()};"
|
|
717
611
|
aria-labelledby="color-picker-footer-title"
|
|
718
612
|
>
|
|
719
|
-
${
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
)}
|
|
724
|
-
${E(
|
|
725
|
-
(t) => !t.disableSavedColors,
|
|
726
|
-
n`
|
|
727
|
-
<${o} placement="top"
|
|
728
|
-
text="${(t) => t.locale.colorPicker.saveButtonLabel}"
|
|
613
|
+
${s((e) => e.allSwatches, (e) => e._renderColorSwatch(n, r), { positioning: !0 })}
|
|
614
|
+
${l((e) => !e.disableSavedColors, t`
|
|
615
|
+
<${r} placement="top"
|
|
616
|
+
text="${(e) => e.locale.colorPicker.saveButtonLabel}"
|
|
729
617
|
exportparts="vvd-theme-alternate">
|
|
730
|
-
<${
|
|
618
|
+
<${e}
|
|
731
619
|
slot="anchor"
|
|
732
620
|
appearance="outlined"
|
|
733
621
|
size="super-condensed"
|
|
734
622
|
role="gridcell"
|
|
735
|
-
tabindex="${(
|
|
736
|
-
aria-label="${(
|
|
737
|
-
@click="${(
|
|
738
|
-
@keydown="${(
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
)}">
|
|
744
|
-
<${e} slot="icon" name="plus-line"></${e}>
|
|
745
|
-
</${r}>
|
|
746
|
-
</${o}>
|
|
747
|
-
`
|
|
748
|
-
)}
|
|
623
|
+
tabindex="${(e) => e.allSwatches.length ? "-1" : "0"}"
|
|
624
|
+
aria-label="${(e) => e.locale.colorPicker.saveButtonLabel}"
|
|
625
|
+
@click="${(e) => e._saveCurrentColor()}"
|
|
626
|
+
@keydown="${(e, t) => e._handleCellKeydown(t.event, e.value, e.allSwatches.length, !0)}">
|
|
627
|
+
<${n} slot="icon" name="plus-line"></${n}>
|
|
628
|
+
</${e}>
|
|
629
|
+
</${r}>
|
|
630
|
+
`)}
|
|
749
631
|
</div>
|
|
750
632
|
</div>
|
|
751
633
|
`;
|
|
752
634
|
}
|
|
753
|
-
function
|
|
754
|
-
|
|
635
|
+
function Ue() {
|
|
636
|
+
return t`
|
|
755
637
|
<span
|
|
756
638
|
id="swatches-count"
|
|
757
639
|
class="swatches-count"
|
|
758
|
-
aria-label="${(
|
|
759
|
-
|
|
760
|
-
r.maxSwatches
|
|
761
|
-
)}"
|
|
762
|
-
>${(r) => `${r.allSwatches.length}/${r.maxSwatches}`}</span
|
|
640
|
+
aria-label="${(e) => e.locale.colorPicker.maxSwatchesMessage(e.allSwatches.length, e.maxSwatches)}"
|
|
641
|
+
>${(e) => `${e.allSwatches.length}/${e.maxSwatches}`}</span
|
|
763
642
|
>
|
|
764
643
|
`;
|
|
765
644
|
}
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
645
|
+
//#endregion
|
|
646
|
+
//#region src/lib/color-picker/index.ts
|
|
647
|
+
i(r("color-picker", $, (e) => {
|
|
648
|
+
let n = e.tagFor(ge), r = e.tagFor(ee), i = e.tagFor(ce), a = e.tagFor(m), o = e.tagFor(de);
|
|
649
|
+
return t`
|
|
650
|
+
<div class="base" @keydown="${(e, { event: t }) => e._onBaseKeydown(t)}">
|
|
770
651
|
<span aria-live="assertive" aria-relevant="text" class="visually-hidden">
|
|
771
|
-
${(
|
|
652
|
+
${(e) => e._ariaLiveDescription}
|
|
772
653
|
</span>
|
|
773
|
-
${
|
|
774
|
-
<${
|
|
775
|
-
:open="${(
|
|
776
|
-
:anchor="${(
|
|
654
|
+
${ze(n, r)}
|
|
655
|
+
<${i}
|
|
656
|
+
:open="${(e) => e.open}"
|
|
657
|
+
:anchor="${(e) => e._buttonEl}"
|
|
777
658
|
placement="top"
|
|
778
659
|
offset="10"
|
|
779
|
-
${
|
|
660
|
+
${c("_popupEl")}>
|
|
780
661
|
<div class="dialog"
|
|
781
662
|
role="dialog"
|
|
782
663
|
aria-modal="true"
|
|
783
664
|
aria-labelledby="color-picker-title">
|
|
784
|
-
${
|
|
785
|
-
${
|
|
786
|
-
${
|
|
787
|
-
(a) => !a.disableSavedColors || a.allSwatches.length > 0,
|
|
788
|
-
Qe(s, o, i)
|
|
789
|
-
)}
|
|
665
|
+
${Be(a, r)}
|
|
666
|
+
${Ve(a, r, o)}
|
|
667
|
+
${l((e) => !e.disableSavedColors || e.allSwatches.length > 0, He(a, r, o))}
|
|
790
668
|
</div>
|
|
791
|
-
</${
|
|
669
|
+
</${i}>
|
|
792
670
|
</div>
|
|
793
671
|
`;
|
|
794
|
-
},
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
ke,
|
|
804
|
-
ce
|
|
805
|
-
],
|
|
806
|
-
{
|
|
807
|
-
styles: _e
|
|
808
|
-
}
|
|
809
|
-
), ot = oe(
|
|
810
|
-
tt
|
|
811
|
-
);
|
|
812
|
-
ot();
|
|
672
|
+
}, [
|
|
673
|
+
le,
|
|
674
|
+
te,
|
|
675
|
+
he,
|
|
676
|
+
se,
|
|
677
|
+
ue,
|
|
678
|
+
pe
|
|
679
|
+
], { styles: ve }))();
|
|
680
|
+
//#endregion
|