@youcan/celeste 0.6.27 → 0.6.29
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/package.json +3 -3
- package/src/components/checkbox/checkbox-label.vue +112 -0
- package/src/components/checkbox/checkbox.vue +2 -1
- package/src/components/checkbox/index.ts +3 -0
- package/src/components/checkbox/stories/checkbox.stories.ts +37 -20
- package/dist/celeste.css +0 -3996
- package/dist/cjs/alert.js +0 -111
- package/dist/cjs/alpha-slider.js +0 -3
- package/dist/cjs/badge.js +0 -55
- package/dist/cjs/button.js +0 -39
- package/dist/cjs/checkbox.js +0 -3
- package/dist/cjs/chunks/_plugin-vue_export-helper.js +0 -9
- package/dist/cjs/chunks/alpha-slider.js +0 -127
- package/dist/cjs/chunks/checkbox.vue_vue_type_style_index_0_lang.js +0 -38
- package/dist/cjs/chunks/clsx.js +0 -15
- package/dist/cjs/chunks/combobox-anchor.js +0 -31
- package/dist/cjs/chunks/content-divider.vue_vue_type_style_index_0_lang.js +0 -52
- package/dist/cjs/chunks/dropdown-menu-content.vue_vue_type_style_index_0_lang.js +0 -51
- package/dist/cjs/chunks/dropdown-menu-sub-content.vue_vue_type_style_index_0_lang.js +0 -49
- package/dist/cjs/chunks/dropdown-menu-sub-trigger.vue_vue_type_style_index_0_lang.js +0 -32
- package/dist/cjs/chunks/dropdown-menu-sub.js +0 -25
- package/dist/cjs/chunks/index.js +0 -9073
- package/dist/cjs/chunks/modal-close.js +0 -22
- package/dist/cjs/chunks/modal-trigger.js +0 -22
- package/dist/cjs/chunks/modal.js +0 -26
- package/dist/cjs/chunks/popover.js +0 -26
- package/dist/cjs/chunks/scroll-area.js +0 -41
- package/dist/cjs/chunks/select-group.js +0 -22
- package/dist/cjs/chunks/select.js +0 -38
- package/dist/cjs/chunks/slider.vue_vue_type_style_index_0_lang.js +0 -52
- package/dist/cjs/chunks/switch.vue_vue_type_style_index_0_lang.js +0 -38
- package/dist/cjs/chunks/use-color-model.js +0 -992
- package/dist/cjs/color-area.js +0 -175
- package/dist/cjs/color-picker.js +0 -514
- package/dist/cjs/color-swatch.js +0 -59
- package/dist/cjs/color.js +0 -102
- package/dist/cjs/combobox-anchor.js +0 -3
- package/dist/cjs/combobox-empty.js +0 -32
- package/dist/cjs/combobox-group.js +0 -42
- package/dist/cjs/combobox-input.js +0 -63
- package/dist/cjs/combobox-item.js +0 -109
- package/dist/cjs/combobox-list.js +0 -62
- package/dist/cjs/combobox-root.js +0 -40
- package/dist/cjs/combobox-separator.js +0 -32
- package/dist/cjs/combobox-trigger.js +0 -47
- package/dist/cjs/combobox.js +0 -233
- package/dist/cjs/command-group.js +0 -41
- package/dist/cjs/command-input.js +0 -42
- package/dist/cjs/command-item.js +0 -34
- package/dist/cjs/command-list.js +0 -52
- package/dist/cjs/command-root.js +0 -45
- package/dist/cjs/command-separator.js +0 -32
- package/dist/cjs/compact-button.js +0 -42
- package/dist/cjs/content-divider.js +0 -3
- package/dist/cjs/context-menu-item.js +0 -134
- package/dist/cjs/crypto.js +0 -8
- package/dist/cjs/dropdown-item.js +0 -99
- package/dist/cjs/dropdown-menu-content.js +0 -3
- package/dist/cjs/dropdown-menu-group.js +0 -24
- package/dist/cjs/dropdown-menu-item.js +0 -68
- package/dist/cjs/dropdown-menu-label.js +0 -31
- package/dist/cjs/dropdown-menu-separator.js +0 -25
- package/dist/cjs/dropdown-menu-sub-content.js +0 -3
- package/dist/cjs/dropdown-menu-sub-trigger.js +0 -3
- package/dist/cjs/dropdown-menu-sub.js +0 -3
- package/dist/cjs/dropdown-menu-trigger.js +0 -26
- package/dist/cjs/dropdown-menu.js +0 -32
- package/dist/cjs/dropdown.js +0 -291
- package/dist/cjs/fancy-button.js +0 -38
- package/dist/cjs/hint-text.js +0 -36
- package/dist/cjs/hue-slider.js +0 -133
- package/dist/cjs/index.js +0 -217
- package/dist/cjs/label.js +0 -55
- package/dist/cjs/link-button.js +0 -44
- package/dist/cjs/modal-body.js +0 -22
- package/dist/cjs/modal-close.js +0 -3
- package/dist/cjs/modal-content.js +0 -48
- package/dist/cjs/modal-footer.js +0 -22
- package/dist/cjs/modal-header.js +0 -81
- package/dist/cjs/modal-trigger.js +0 -3
- package/dist/cjs/modal.js +0 -3
- package/dist/cjs/popover-content.js +0 -104
- package/dist/cjs/popover-trigger.js +0 -24
- package/dist/cjs/popover.js +0 -3
- package/dist/cjs/scroll-area.js +0 -3
- package/dist/cjs/scroll-bar.js +0 -39
- package/dist/cjs/segmented-control-item.js +0 -41
- package/dist/cjs/segmented-control.js +0 -40
- package/dist/cjs/select-content.js +0 -61
- package/dist/cjs/select-group.js +0 -3
- package/dist/cjs/select-icon.js +0 -25
- package/dist/cjs/select-item.js +0 -44
- package/dist/cjs/select-label.js +0 -32
- package/dist/cjs/select-separator.js +0 -26
- package/dist/cjs/select-trigger.js +0 -40
- package/dist/cjs/select-value.js +0 -31
- package/dist/cjs/select.js +0 -3
- package/dist/cjs/shims.js +0 -1
- package/dist/cjs/slider.js +0 -3
- package/dist/cjs/social-button.js +0 -45
- package/dist/cjs/status-badge.js +0 -49
- package/dist/cjs/switch.js +0 -3
- package/dist/cjs/tab-menu-content.js +0 -32
- package/dist/cjs/tab-menu-item.js +0 -44
- package/dist/cjs/tab-menu-list.js +0 -34
- package/dist/cjs/tab-menu.js +0 -32
- package/dist/cjs/text-input-affix.js +0 -27
- package/dist/cjs/text-input-button.js +0 -31
- package/dist/cjs/text-input.js +0 -119
- package/dist/cjs/textarea.js +0 -56
- package/dist/cjs/tooltip.js +0 -115
- package/dist/cjs/use-color-model.js +0 -6
- package/dist/cjs/use-delegated-props.js +0 -14
- package/dist/cjs/use-user-select.js +0 -39
- package/dist/components/alert/alert.d.ts +0 -30
- package/dist/components/alert/index.d.ts +0 -2
- package/dist/components/badge/badge.d.ts +0 -17
- package/dist/components/badge/index.d.ts +0 -4
- package/dist/components/badge/status-badge.d.ts +0 -13
- package/dist/components/button/button.d.ts +0 -22
- package/dist/components/button/compact-button.d.ts +0 -15
- package/dist/components/button/fancy-button.d.ts +0 -20
- package/dist/components/button/index.d.ts +0 -10
- package/dist/components/button/link-button.d.ts +0 -22
- package/dist/components/button/social-button.d.ts +0 -10
- package/dist/components/checkbox/checkbox.d.ts +0 -11
- package/dist/components/checkbox/index.d.ts +0 -2
- package/dist/components/color-picker/alpha-slider.d.ts +0 -15
- package/dist/components/color-picker/color-area.d.ts +0 -9
- package/dist/components/color-picker/color-picker.d.ts +0 -47
- package/dist/components/color-picker/color-swatch.d.ts +0 -19
- package/dist/components/color-picker/composable/use-color-model.d.ts +0 -7
- package/dist/components/color-picker/composable/use-user-select.d.ts +0 -8
- package/dist/components/color-picker/hue-slider.d.ts +0 -14
- package/dist/components/color-picker/index.d.ts +0 -10
- package/dist/components/combobox/combobox-anchor.d.ts +0 -22
- package/dist/components/combobox/combobox-empty.d.ts +0 -22
- package/dist/components/combobox/combobox-group.d.ts +0 -23
- package/dist/components/combobox/combobox-input.d.ts +0 -17
- package/dist/components/combobox/combobox-item.d.ts +0 -31
- package/dist/components/combobox/combobox-list.d.ts +0 -36
- package/dist/components/combobox/combobox-root.d.ts +0 -29
- package/dist/components/combobox/combobox-separator.d.ts +0 -22
- package/dist/components/combobox/combobox-trigger.d.ts +0 -20
- package/dist/components/combobox/combobox.d.ts +0 -42
- package/dist/components/combobox/index.d.ts +0 -20
- package/dist/components/content-divider/content-divider.d.ts +0 -10
- package/dist/components/content-divider/index.d.ts +0 -2
- package/dist/components/dropdown/context-menu-item.d.ts +0 -39
- package/dist/components/dropdown/dropdown-item.d.ts +0 -30
- package/dist/components/dropdown/dropdown.d.ts +0 -55
- package/dist/components/dropdown/index.d.ts +0 -6
- package/dist/components/dropdown-menu/dropdown-menu-content.d.ts +0 -36
- package/dist/components/dropdown-menu/dropdown-menu-group.d.ts +0 -18
- package/dist/components/dropdown-menu/dropdown-menu-item.d.ts +0 -26
- package/dist/components/dropdown-menu/dropdown-menu-label.d.ts +0 -22
- package/dist/components/dropdown-menu/dropdown-menu-separator.d.ts +0 -7
- package/dist/components/dropdown-menu/dropdown-menu-sub-content.d.ts +0 -38
- package/dist/components/dropdown-menu/dropdown-menu-sub-trigger.d.ts +0 -22
- package/dist/components/dropdown-menu/dropdown-menu-sub.d.ts +0 -22
- package/dist/components/dropdown-menu/dropdown-menu-trigger.d.ts +0 -18
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +0 -18
- package/dist/components/dropdown-menu/index.d.ts +0 -20
- package/dist/components/hint-text/hint-text.d.ts +0 -11
- package/dist/components/hint-text/index.d.ts +0 -2
- package/dist/components/index.d.ts +0 -21
- package/dist/components/label/index.d.ts +0 -2
- package/dist/components/label/label.d.ts +0 -29
- package/dist/components/modal/index.d.ts +0 -14
- package/dist/components/modal/modal-body.d.ts +0 -21
- package/dist/components/modal/modal-close.d.ts +0 -18
- package/dist/components/modal/modal-content.d.ts +0 -37
- package/dist/components/modal/modal-footer.d.ts +0 -21
- package/dist/components/modal/modal-header.d.ts +0 -16
- package/dist/components/modal/modal-trigger.d.ts +0 -18
- package/dist/components/modal/modal.d.ts +0 -22
- package/dist/components/popover/index.d.ts +0 -6
- package/dist/components/popover/popover-content.d.ts +0 -41
- package/dist/components/popover/popover-trigger.d.ts +0 -18
- package/dist/components/popover/popover.d.ts +0 -22
- package/dist/components/scroll-area/index.d.ts +0 -2
- package/dist/components/scroll-area/scroll-area.d.ts +0 -22
- package/dist/components/scroll-area/scroll-bar.d.ts +0 -9
- package/dist/components/segmented-control/index.d.ts +0 -4
- package/dist/components/segmented-control/segmented-control-item.d.ts +0 -22
- package/dist/components/segmented-control/segmented-control.d.ts +0 -26
- package/dist/components/select/index.d.ts +0 -18
- package/dist/components/select/select-content.d.ts +0 -33
- package/dist/components/select/select-group.d.ts +0 -18
- package/dist/components/select/select-icon.d.ts +0 -21
- package/dist/components/select/select-item.d.ts +0 -22
- package/dist/components/select/select-label.d.ts +0 -22
- package/dist/components/select/select-separator.d.ts +0 -7
- package/dist/components/select/select-trigger.d.ts +0 -28
- package/dist/components/select/select-value.d.ts +0 -22
- package/dist/components/select/select.d.ts +0 -28
- package/dist/components/slider/index.d.ts +0 -2
- package/dist/components/slider/slider.d.ts +0 -13
- package/dist/components/switch/index.d.ts +0 -2
- package/dist/components/switch/switch.d.ts +0 -11
- package/dist/components/tab-menu/index.d.ts +0 -8
- package/dist/components/tab-menu/tab-menu-content.d.ts +0 -22
- package/dist/components/tab-menu/tab-menu-item.d.ts +0 -24
- package/dist/components/tab-menu/tab-menu-list.d.ts +0 -22
- package/dist/components/tab-menu/tab-menu.d.ts +0 -23
- package/dist/components/text-input/index.d.ts +0 -6
- package/dist/components/text-input/text-input-affix.d.ts +0 -23
- package/dist/components/text-input/text-input-button.d.ts +0 -23
- package/dist/components/text-input/text-input.d.ts +0 -32
- package/dist/components/textarea/index.d.ts +0 -2
- package/dist/components/textarea/textarea.d.ts +0 -22
- package/dist/components/tooltip/index.d.ts +0 -2
- package/dist/components/tooltip/tooltip.d.ts +0 -29
- package/dist/composables/use-delegated-props.d.ts +0 -2
- package/dist/es/alert.js +0 -112
- package/dist/es/alpha-slider.js +0 -4
- package/dist/es/badge.js +0 -56
- package/dist/es/button.js +0 -40
- package/dist/es/checkbox.js +0 -4
- package/dist/es/chunks/_plugin-vue_export-helper.js +0 -10
- package/dist/es/chunks/alpha-slider.js +0 -128
- package/dist/es/chunks/checkbox.vue_vue_type_style_index_0_lang.js +0 -39
- package/dist/es/chunks/clsx.js +0 -16
- package/dist/es/chunks/combobox-anchor.js +0 -32
- package/dist/es/chunks/content-divider.vue_vue_type_style_index_0_lang.js +0 -53
- package/dist/es/chunks/dropdown-menu-content.vue_vue_type_style_index_0_lang.js +0 -52
- package/dist/es/chunks/dropdown-menu-sub-content.vue_vue_type_style_index_0_lang.js +0 -50
- package/dist/es/chunks/dropdown-menu-sub-trigger.vue_vue_type_style_index_0_lang.js +0 -33
- package/dist/es/chunks/dropdown-menu-sub.js +0 -26
- package/dist/es/chunks/index.js +0 -9058
- package/dist/es/chunks/modal-close.js +0 -23
- package/dist/es/chunks/modal-trigger.js +0 -23
- package/dist/es/chunks/modal.js +0 -27
- package/dist/es/chunks/popover.js +0 -27
- package/dist/es/chunks/scroll-area.js +0 -42
- package/dist/es/chunks/select-group.js +0 -23
- package/dist/es/chunks/select.js +0 -39
- package/dist/es/chunks/slider.vue_vue_type_style_index_0_lang.js +0 -53
- package/dist/es/chunks/switch.vue_vue_type_style_index_0_lang.js +0 -39
- package/dist/es/chunks/use-color-model.js +0 -993
- package/dist/es/color-area.js +0 -176
- package/dist/es/color-picker.js +0 -515
- package/dist/es/color-swatch.js +0 -60
- package/dist/es/color.js +0 -102
- package/dist/es/combobox-anchor.js +0 -4
- package/dist/es/combobox-empty.js +0 -33
- package/dist/es/combobox-group.js +0 -43
- package/dist/es/combobox-input.js +0 -64
- package/dist/es/combobox-item.js +0 -110
- package/dist/es/combobox-list.js +0 -63
- package/dist/es/combobox-root.js +0 -41
- package/dist/es/combobox-separator.js +0 -33
- package/dist/es/combobox-trigger.js +0 -48
- package/dist/es/combobox.js +0 -234
- package/dist/es/command-group.js +0 -42
- package/dist/es/command-input.js +0 -43
- package/dist/es/command-item.js +0 -35
- package/dist/es/command-list.js +0 -53
- package/dist/es/command-root.js +0 -46
- package/dist/es/command-separator.js +0 -33
- package/dist/es/compact-button.js +0 -43
- package/dist/es/content-divider.js +0 -4
- package/dist/es/context-menu-item.js +0 -135
- package/dist/es/crypto.js +0 -8
- package/dist/es/dropdown-item.js +0 -100
- package/dist/es/dropdown-menu-content.js +0 -4
- package/dist/es/dropdown-menu-group.js +0 -25
- package/dist/es/dropdown-menu-item.js +0 -69
- package/dist/es/dropdown-menu-label.js +0 -32
- package/dist/es/dropdown-menu-separator.js +0 -26
- package/dist/es/dropdown-menu-sub-content.js +0 -4
- package/dist/es/dropdown-menu-sub-trigger.js +0 -4
- package/dist/es/dropdown-menu-sub.js +0 -4
- package/dist/es/dropdown-menu-trigger.js +0 -27
- package/dist/es/dropdown-menu.js +0 -33
- package/dist/es/dropdown.js +0 -292
- package/dist/es/fancy-button.js +0 -39
- package/dist/es/hint-text.js +0 -37
- package/dist/es/hue-slider.js +0 -134
- package/dist/es/index.js +0 -217
- package/dist/es/label.js +0 -56
- package/dist/es/link-button.js +0 -45
- package/dist/es/modal-body.js +0 -23
- package/dist/es/modal-close.js +0 -4
- package/dist/es/modal-content.js +0 -49
- package/dist/es/modal-footer.js +0 -23
- package/dist/es/modal-header.js +0 -82
- package/dist/es/modal-trigger.js +0 -4
- package/dist/es/modal.js +0 -4
- package/dist/es/popover-content.js +0 -105
- package/dist/es/popover-trigger.js +0 -25
- package/dist/es/popover.js +0 -4
- package/dist/es/scroll-area.js +0 -4
- package/dist/es/scroll-bar.js +0 -40
- package/dist/es/segmented-control-item.js +0 -42
- package/dist/es/segmented-control.js +0 -41
- package/dist/es/select-content.js +0 -62
- package/dist/es/select-group.js +0 -4
- package/dist/es/select-icon.js +0 -26
- package/dist/es/select-item.js +0 -45
- package/dist/es/select-label.js +0 -33
- package/dist/es/select-separator.js +0 -27
- package/dist/es/select-trigger.js +0 -41
- package/dist/es/select-value.js +0 -32
- package/dist/es/select.js +0 -4
- package/dist/es/shims.js +0 -1
- package/dist/es/slider.js +0 -4
- package/dist/es/social-button.js +0 -46
- package/dist/es/status-badge.js +0 -50
- package/dist/es/switch.js +0 -4
- package/dist/es/tab-menu-content.js +0 -33
- package/dist/es/tab-menu-item.js +0 -45
- package/dist/es/tab-menu-list.js +0 -35
- package/dist/es/tab-menu.js +0 -33
- package/dist/es/text-input-affix.js +0 -28
- package/dist/es/text-input-button.js +0 -32
- package/dist/es/text-input.js +0 -120
- package/dist/es/textarea.js +0 -57
- package/dist/es/tooltip.js +0 -116
- package/dist/es/use-color-model.js +0 -6
- package/dist/es/use-delegated-props.js +0 -14
- package/dist/es/use-user-select.js +0 -39
- package/dist/index.d.ts +0 -5
- package/dist/utils/color.d.ts +0 -26
- package/dist/utils/crypto.d.ts +0 -1
package/dist/es/color-picker.js
DELETED
|
@@ -1,515 +0,0 @@
|
|
|
1
|
-
import { defineComponent, useCssVars, ref, computed, watch, openBlock, createBlock, unref, withCtx, createVNode, createElementVNode, createTextVNode, toDisplayString, mergeProps, isRef, createElementBlock, Fragment, renderList, createCommentVNode, withKeys, withModifiers, renderSlot } from "vue";
|
|
2
|
-
import { useDelegatedProps } from "./use-delegated-props.js";
|
|
3
|
-
import { truncColorValue, COLOR_NUMBER_VALIDATION_PATTERN, HEX_VALIDATION_PATTERN, resolveArrowDirection, getColorConstraints, clamp, bumpColorValue } from "./color.js";
|
|
4
|
-
import { x as xe } from "./chunks/index.js";
|
|
5
|
-
import { d as defineColorModel, t as tinycolor } from "./chunks/use-color-model.js";
|
|
6
|
-
import Button from "./button.js";
|
|
7
|
-
import "./compact-button.js";
|
|
8
|
-
/* empty css */
|
|
9
|
-
/* empty css */
|
|
10
|
-
/* empty css */
|
|
11
|
-
import PopoverContent from "./popover-content.js";
|
|
12
|
-
import PopoverTrigger from "./popover-trigger.js";
|
|
13
|
-
import { _ as _sfc_main$1 } from "./chunks/popover.js";
|
|
14
|
-
import SelectContent from "./select-content.js";
|
|
15
|
-
/* empty css */
|
|
16
|
-
import SelectItem from "./select-item.js";
|
|
17
|
-
/* empty css */
|
|
18
|
-
/* empty css */
|
|
19
|
-
import SelectTrigger from "./select-trigger.js";
|
|
20
|
-
import SelectValue from "./select-value.js";
|
|
21
|
-
import { _ as _sfc_main$3 } from "./chunks/select.js";
|
|
22
|
-
/* empty css */
|
|
23
|
-
import "./text-input-button.js";
|
|
24
|
-
import TextInput from "./text-input.js";
|
|
25
|
-
import { _ as _sfc_main$2 } from "./chunks/alpha-slider.js";
|
|
26
|
-
import ColorArea from "./color-area.js";
|
|
27
|
-
import ColorSwatch from "./color-swatch.js";
|
|
28
|
-
import HueSlider from "./hue-slider.js";
|
|
29
|
-
import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
|
|
30
|
-
const _hoisted_1 = { class: "celeste-color-picker" };
|
|
31
|
-
const _hoisted_2 = { class: "celeste-color-control-panel" };
|
|
32
|
-
const _hoisted_3 = { class: "celeste-color-format" };
|
|
33
|
-
const _hoisted_4 = { class: "celeste-color-controls" };
|
|
34
|
-
const _hoisted_5 = { class: "celeste-color-format-inputs" };
|
|
35
|
-
const _hoisted_6 = { class: "celeste-color-swatches" };
|
|
36
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
37
|
-
__name: "color-picker",
|
|
38
|
-
props: {
|
|
39
|
-
modelValue: { default: "hsl(240, 100%, 50%)" },
|
|
40
|
-
label: { default: "Pick Color" },
|
|
41
|
-
class: {},
|
|
42
|
-
formats: { default: () => ["hex", "rgb", "hsl", "hsb"] },
|
|
43
|
-
defaultFormat: {}
|
|
44
|
-
},
|
|
45
|
-
emits: ["update:modelValue"],
|
|
46
|
-
setup(__props, { emit: __emit }) {
|
|
47
|
-
useCssVars((_ctx) => ({
|
|
48
|
-
"88e786d6": _ctx.modelValue
|
|
49
|
-
}));
|
|
50
|
-
const props = __props;
|
|
51
|
-
const emit = __emit;
|
|
52
|
-
const delegatedProps = useDelegatedProps(props, "class");
|
|
53
|
-
const forwarded = xe(delegatedProps, emit);
|
|
54
|
-
const tinyColorRef = defineColorModel(props, emit);
|
|
55
|
-
const hueRef = ref(tinyColorRef.value.toHsl().h);
|
|
56
|
-
const currentColorFormat = ref(props.defaultFormat || "hex");
|
|
57
|
-
const eyeDropper = ref(null);
|
|
58
|
-
const hex = computed({
|
|
59
|
-
get: () => tinyColorRef.value.toHexString().toUpperCase(),
|
|
60
|
-
set: () => {
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
const rgb = computed(() => {
|
|
64
|
-
return tinyColorRef.value.toRgb();
|
|
65
|
-
});
|
|
66
|
-
const hsl = computed(() => {
|
|
67
|
-
const { h, s, l } = tinyColorRef.value.toHsl();
|
|
68
|
-
return {
|
|
69
|
-
h: `${h.toFixed()}°`,
|
|
70
|
-
s: `${(s * 100).toFixed()}%`,
|
|
71
|
-
l: `${(l * 100).toFixed()}%`,
|
|
72
|
-
a: tinyColorRef.value.getAlpha()
|
|
73
|
-
};
|
|
74
|
-
});
|
|
75
|
-
const hsv = computed(() => {
|
|
76
|
-
const { h, s, v } = tinyColorRef.value.toHsv();
|
|
77
|
-
return {
|
|
78
|
-
h: `${h.toFixed()}°`,
|
|
79
|
-
s: `${(s * 100).toFixed()}%`,
|
|
80
|
-
v: `${(v * 100).toFixed()}%`
|
|
81
|
-
};
|
|
82
|
-
});
|
|
83
|
-
watch(tinyColorRef, (tinyColorInstance) => {
|
|
84
|
-
const newHue = tinyColorInstance.toHsl().h;
|
|
85
|
-
const saturation = tinyColorInstance.toHsl().s;
|
|
86
|
-
if (saturation === 0 && hueRef.value !== 0) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
hueRef.value = newHue;
|
|
90
|
-
}, { immediate: true });
|
|
91
|
-
if (window.EyeDropper) {
|
|
92
|
-
eyeDropper.value = new window.EyeDropper();
|
|
93
|
-
}
|
|
94
|
-
function sipColor() {
|
|
95
|
-
if (!eyeDropper.value) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
eyeDropper.value.open().then((result) => {
|
|
99
|
-
const newColor = tinycolor(result.sRGBHex);
|
|
100
|
-
tinyColorRef.value = newColor;
|
|
101
|
-
}).catch((e) => {
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
function getCurrentColorValue(key) {
|
|
105
|
-
let currentValue = 0;
|
|
106
|
-
if (key === "r" || key === "g" || key === "b") {
|
|
107
|
-
currentValue = rgb.value[key];
|
|
108
|
-
} else if (key === "h") {
|
|
109
|
-
currentValue = tinyColorRef.value.toHsl().h;
|
|
110
|
-
} else if (key === "s" || key === "l" || key === "v") {
|
|
111
|
-
if (currentColorFormat.value === "hsl") {
|
|
112
|
-
const currentHsl = tinyColorRef.value.toHsl();
|
|
113
|
-
currentValue = key === "s" ? currentHsl.s * 100 : currentHsl.l * 100;
|
|
114
|
-
} else {
|
|
115
|
-
const currentHsv = tinyColorRef.value.toHsv();
|
|
116
|
-
currentValue = key === "s" ? currentHsv.s * 100 : currentHsv.v * 100;
|
|
117
|
-
}
|
|
118
|
-
} else if (key === "a") {
|
|
119
|
-
currentValue = tinyColorRef.value.getAlpha() * 100;
|
|
120
|
-
}
|
|
121
|
-
return currentValue;
|
|
122
|
-
}
|
|
123
|
-
function validateInput(event) {
|
|
124
|
-
const input = event.target;
|
|
125
|
-
const inputEvent = event;
|
|
126
|
-
const newValue = truncColorValue(input.value) + (inputEvent.data ?? "");
|
|
127
|
-
if (!COLOR_NUMBER_VALIDATION_PATTERN.test(newValue)) {
|
|
128
|
-
event.preventDefault();
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
function validateHexInput(event) {
|
|
132
|
-
const input = event.target;
|
|
133
|
-
const inputEvent = event;
|
|
134
|
-
const newValue = input.value + (inputEvent.data ?? "");
|
|
135
|
-
if (!HEX_VALIDATION_PATTERN.test(newValue)) {
|
|
136
|
-
event.preventDefault();
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
function inputChangeHex(event) {
|
|
140
|
-
var _a;
|
|
141
|
-
const colorInput = (_a = event.target) == null ? void 0 : _a.value;
|
|
142
|
-
if (!colorInput) {
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
tinyColorRef.value = tinycolor(colorInput);
|
|
146
|
-
}
|
|
147
|
-
function inputChangeRGB(event, key) {
|
|
148
|
-
var _a;
|
|
149
|
-
const value = Number((_a = event.target) == null ? void 0 : _a.value);
|
|
150
|
-
const currentRgb = rgb.value;
|
|
151
|
-
const newRgb = { ...currentRgb, [key]: value };
|
|
152
|
-
tinyColorRef.value = tinycolor(newRgb);
|
|
153
|
-
}
|
|
154
|
-
function inputChangeHSL(event, key) {
|
|
155
|
-
var _a;
|
|
156
|
-
const HSLInput = (_a = event.target) == null ? void 0 : _a.value;
|
|
157
|
-
let newHSLValue = truncColorValue(HSLInput);
|
|
158
|
-
if (key === "s" || key === "l") {
|
|
159
|
-
newHSLValue /= 100;
|
|
160
|
-
}
|
|
161
|
-
if (Number.isNaN(newHSLValue)) {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
const newHSL = { [key]: newHSLValue };
|
|
165
|
-
tinyColorRef.value = {
|
|
166
|
-
...tinyColorRef.value.toHsl(),
|
|
167
|
-
...newHSL
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
function inputChangeHSB(event, key) {
|
|
171
|
-
var _a;
|
|
172
|
-
const HSBInput = (_a = event.target) == null ? void 0 : _a.value;
|
|
173
|
-
const HSBValue = truncColorValue(HSBInput);
|
|
174
|
-
if (Number.isNaN(HSBValue)) {
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
const newHSB = { [key]: HSBValue };
|
|
178
|
-
tinyColorRef.value = {
|
|
179
|
-
...tinyColorRef.value.toHsv(),
|
|
180
|
-
...newHSB
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
function inputChangeAlpha(event) {
|
|
184
|
-
var _a;
|
|
185
|
-
const alphaInput = (_a = event.target) == null ? void 0 : _a.value;
|
|
186
|
-
const alphaValue = truncColorValue(alphaInput) / 100;
|
|
187
|
-
if (Number.isNaN(alphaValue)) {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
tinyColorRef.value = tinyColorRef.value.setAlpha(Math.max(0, Math.min(1, alphaValue)));
|
|
191
|
-
}
|
|
192
|
-
function handleColorValueKeyDown(event, key) {
|
|
193
|
-
const direction = resolveArrowDirection(event);
|
|
194
|
-
const currentValue = getCurrentColorValue(key);
|
|
195
|
-
const { min, max } = getColorConstraints(key);
|
|
196
|
-
const newValue = clamp(bumpColorValue(currentValue, direction), min, max);
|
|
197
|
-
if (key === "r" || key === "g" || key === "b") {
|
|
198
|
-
const newColor = tinycolor({ ...rgb.value, [key]: newValue });
|
|
199
|
-
emit("update:modelValue", newColor.toString());
|
|
200
|
-
} else if (key === "h") {
|
|
201
|
-
if (currentColorFormat.value === "hsl") {
|
|
202
|
-
const newColor = tinycolor({ ...tinyColorRef.value.toHsl(), h: newValue });
|
|
203
|
-
emit("update:modelValue", newColor.toString());
|
|
204
|
-
} else {
|
|
205
|
-
const newColor = tinycolor({ ...tinyColorRef.value.toHsv(), h: newValue });
|
|
206
|
-
emit("update:modelValue", newColor.toString());
|
|
207
|
-
}
|
|
208
|
-
} else if (key === "s" || key === "l" || key === "v") {
|
|
209
|
-
if (currentColorFormat.value === "hsl") {
|
|
210
|
-
const newColor = tinycolor({ ...tinyColorRef.value.toHsl(), [key]: newValue / 100 });
|
|
211
|
-
emit("update:modelValue", newColor.toString());
|
|
212
|
-
} else {
|
|
213
|
-
const currentHsv = tinyColorRef.value.toHsv();
|
|
214
|
-
const newColor = tinycolor({ ...currentHsv, [key]: newValue / 100 });
|
|
215
|
-
emit("update:modelValue", newColor.toString());
|
|
216
|
-
}
|
|
217
|
-
} else if (key === "a") {
|
|
218
|
-
const newColor = tinyColorRef.value.setAlpha(newValue / 100);
|
|
219
|
-
emit("update:modelValue", newColor.toString());
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
return (_ctx, _cache) => {
|
|
223
|
-
return openBlock(), createBlock(unref(_sfc_main$1), null, {
|
|
224
|
-
default: withCtx(() => [
|
|
225
|
-
createVNode(unref(PopoverTrigger), null, {
|
|
226
|
-
default: withCtx(() => [
|
|
227
|
-
createVNode(unref(Button), {
|
|
228
|
-
class: "celeste-picker-trigger",
|
|
229
|
-
intent: "neutral",
|
|
230
|
-
variant: "stroke"
|
|
231
|
-
}, {
|
|
232
|
-
default: withCtx(() => [
|
|
233
|
-
_cache[53] || (_cache[53] = createElementVNode("span", { class: "celeste-selected-color" }, null, -1)),
|
|
234
|
-
createTextVNode(" " + toDisplayString(_ctx.label), 1)
|
|
235
|
-
]),
|
|
236
|
-
_: 1
|
|
237
|
-
})
|
|
238
|
-
]),
|
|
239
|
-
_: 1
|
|
240
|
-
}),
|
|
241
|
-
createVNode(unref(PopoverContent), { dismissible: false }, {
|
|
242
|
-
default: withCtx(() => [
|
|
243
|
-
createElementVNode("div", mergeProps({ class: "celeste-color-picker-wrapper" }, unref(forwarded)), [
|
|
244
|
-
createElementVNode("div", _hoisted_1, [
|
|
245
|
-
createVNode(unref(ColorArea), {
|
|
246
|
-
modelValue: unref(tinyColorRef),
|
|
247
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(tinyColorRef) ? tinyColorRef.value = $event : null),
|
|
248
|
-
hue: hueRef.value
|
|
249
|
-
}, null, 8, ["modelValue", "hue"]),
|
|
250
|
-
createVNode(unref(HueSlider), {
|
|
251
|
-
modelValue: hueRef.value,
|
|
252
|
-
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => hueRef.value = $event)
|
|
253
|
-
}, null, 8, ["modelValue"]),
|
|
254
|
-
createVNode(_sfc_main$2, {
|
|
255
|
-
modelValue: unref(tinyColorRef),
|
|
256
|
-
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(tinyColorRef) ? tinyColorRef.value = $event : null)
|
|
257
|
-
}, null, 8, ["modelValue"]),
|
|
258
|
-
createElementVNode("div", _hoisted_2, [
|
|
259
|
-
createVNode(unref(_sfc_main$3), {
|
|
260
|
-
modelValue: currentColorFormat.value,
|
|
261
|
-
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => currentColorFormat.value = $event),
|
|
262
|
-
name: "color-format"
|
|
263
|
-
}, {
|
|
264
|
-
default: withCtx(() => [
|
|
265
|
-
createVNode(unref(SelectTrigger), { variant: "inline" }, {
|
|
266
|
-
default: withCtx(() => [
|
|
267
|
-
createVNode(unref(SelectValue), {
|
|
268
|
-
placeholder: "HEX",
|
|
269
|
-
class: "celeste-selected-color-format"
|
|
270
|
-
}, {
|
|
271
|
-
default: withCtx(() => [
|
|
272
|
-
createTextVNode(toDisplayString(currentColorFormat.value), 1)
|
|
273
|
-
]),
|
|
274
|
-
_: 1
|
|
275
|
-
})
|
|
276
|
-
]),
|
|
277
|
-
_: 1
|
|
278
|
-
}),
|
|
279
|
-
createVNode(unref(SelectContent), { width: "fit" }, {
|
|
280
|
-
default: withCtx(() => [
|
|
281
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(props.formats, (format) => {
|
|
282
|
-
return openBlock(), createBlock(unref(SelectItem), {
|
|
283
|
-
key: format,
|
|
284
|
-
value: format
|
|
285
|
-
}, {
|
|
286
|
-
default: withCtx(() => [
|
|
287
|
-
createElementVNode("span", _hoisted_3, toDisplayString(format), 1)
|
|
288
|
-
]),
|
|
289
|
-
_: 2
|
|
290
|
-
}, 1032, ["value"]);
|
|
291
|
-
}), 128))
|
|
292
|
-
]),
|
|
293
|
-
_: 1
|
|
294
|
-
})
|
|
295
|
-
]),
|
|
296
|
-
_: 1
|
|
297
|
-
}, 8, ["modelValue"]),
|
|
298
|
-
createElementVNode("div", _hoisted_4, [
|
|
299
|
-
eyeDropper.value ? (openBlock(), createBlock(unref(Button), {
|
|
300
|
-
key: 0,
|
|
301
|
-
class: "celeste-color-sip",
|
|
302
|
-
variant: "stroke",
|
|
303
|
-
size: "xxs",
|
|
304
|
-
intent: "neutral",
|
|
305
|
-
onClick: sipColor
|
|
306
|
-
}, {
|
|
307
|
-
default: withCtx(() => _cache[54] || (_cache[54] = [
|
|
308
|
-
createElementVNode("i", { class: "i-celeste-sip-line" }, null, -1)
|
|
309
|
-
])),
|
|
310
|
-
_: 1
|
|
311
|
-
})) : createCommentVNode("", true),
|
|
312
|
-
createElementVNode("div", _hoisted_5, [
|
|
313
|
-
currentColorFormat.value === "hex" ? (openBlock(), createBlock(unref(TextInput), {
|
|
314
|
-
key: 0,
|
|
315
|
-
modelValue: hex.value,
|
|
316
|
-
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => hex.value = $event),
|
|
317
|
-
autocomplete: "off",
|
|
318
|
-
name: "hex",
|
|
319
|
-
placeholder: "#FFFFFF",
|
|
320
|
-
type: "text",
|
|
321
|
-
class: "color-input",
|
|
322
|
-
size: "xs",
|
|
323
|
-
onBeforeinput: validateHexInput,
|
|
324
|
-
onFocusout: inputChangeHex,
|
|
325
|
-
onKeydown: withKeys(withModifiers(inputChangeHex, ["prevent"]), ["enter"])
|
|
326
|
-
}, null, 8, ["modelValue", "onKeydown"])) : currentColorFormat.value === "rgb" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
327
|
-
createVNode(unref(TextInput), {
|
|
328
|
-
modelValue: rgb.value.r,
|
|
329
|
-
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => rgb.value.r = $event),
|
|
330
|
-
autocomplete: "off",
|
|
331
|
-
name: "red",
|
|
332
|
-
type: "text",
|
|
333
|
-
class: "color-input",
|
|
334
|
-
size: "xs",
|
|
335
|
-
onBeforeinput: validateInput,
|
|
336
|
-
onFocusout: _cache[6] || (_cache[6] = (e) => inputChangeRGB(e, "r")),
|
|
337
|
-
onKeydown: [
|
|
338
|
-
_cache[7] || (_cache[7] = withKeys(withModifiers((e) => inputChangeRGB(e, "r"), ["prevent"]), ["enter"])),
|
|
339
|
-
_cache[8] || (_cache[8] = withKeys(withModifiers((e) => handleColorValueKeyDown(e, "r"), ["prevent", "stop"]), ["up"])),
|
|
340
|
-
_cache[9] || (_cache[9] = withKeys(withModifiers((e) => handleColorValueKeyDown(e, "r"), ["prevent", "stop"]), ["down"]))
|
|
341
|
-
]
|
|
342
|
-
}, null, 8, ["modelValue"]),
|
|
343
|
-
createVNode(unref(TextInput), {
|
|
344
|
-
modelValue: rgb.value.g,
|
|
345
|
-
"onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => rgb.value.g = $event),
|
|
346
|
-
autocomplete: "off",
|
|
347
|
-
name: "green",
|
|
348
|
-
type: "text",
|
|
349
|
-
class: "color-input",
|
|
350
|
-
size: "xs",
|
|
351
|
-
onBeforeinput: validateInput,
|
|
352
|
-
onFocusout: _cache[11] || (_cache[11] = (e) => inputChangeRGB(e, "g")),
|
|
353
|
-
onKeydown: [
|
|
354
|
-
_cache[12] || (_cache[12] = withKeys(withModifiers((e) => inputChangeRGB(e, "g"), ["prevent"]), ["enter"])),
|
|
355
|
-
_cache[13] || (_cache[13] = withKeys(withModifiers((e) => handleColorValueKeyDown(e, "g"), ["prevent", "stop"]), ["up"])),
|
|
356
|
-
_cache[14] || (_cache[14] = withKeys(withModifiers((e) => handleColorValueKeyDown(e, "g"), ["prevent", "stop"]), ["down"]))
|
|
357
|
-
]
|
|
358
|
-
}, null, 8, ["modelValue"]),
|
|
359
|
-
createVNode(unref(TextInput), {
|
|
360
|
-
modelValue: rgb.value.b,
|
|
361
|
-
"onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => rgb.value.b = $event),
|
|
362
|
-
autocomplete: "off",
|
|
363
|
-
name: "blue",
|
|
364
|
-
type: "text",
|
|
365
|
-
class: "color-input",
|
|
366
|
-
size: "xs",
|
|
367
|
-
onBeforeinput: validateInput,
|
|
368
|
-
onFocusout: _cache[16] || (_cache[16] = (e) => inputChangeRGB(e, "b")),
|
|
369
|
-
onKeydown: [
|
|
370
|
-
_cache[17] || (_cache[17] = withKeys(withModifiers((e) => inputChangeRGB(e, "b"), ["prevent"]), ["enter"])),
|
|
371
|
-
_cache[18] || (_cache[18] = withKeys(withModifiers((e) => handleColorValueKeyDown(e, "b"), ["prevent", "stop"]), ["up"])),
|
|
372
|
-
_cache[19] || (_cache[19] = withKeys(withModifiers((e) => handleColorValueKeyDown(e, "b"), ["prevent", "stop"]), ["down"]))
|
|
373
|
-
]
|
|
374
|
-
}, null, 8, ["modelValue"])
|
|
375
|
-
], 64)) : currentColorFormat.value === "hsl" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
376
|
-
createVNode(unref(TextInput), {
|
|
377
|
-
modelValue: hsl.value.h,
|
|
378
|
-
"onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => hsl.value.h = $event),
|
|
379
|
-
autocomplete: "off",
|
|
380
|
-
name: "hue",
|
|
381
|
-
type: "text",
|
|
382
|
-
class: "color-input",
|
|
383
|
-
size: "xs",
|
|
384
|
-
onBeforeinput: validateInput,
|
|
385
|
-
onFocusout: _cache[21] || (_cache[21] = (e) => inputChangeHSL(e, "h")),
|
|
386
|
-
onKeydown: [
|
|
387
|
-
_cache[22] || (_cache[22] = withKeys(withModifiers((e) => inputChangeHSL(e, "h"), ["prevent"]), ["enter"])),
|
|
388
|
-
_cache[23] || (_cache[23] = withKeys(withModifiers((e) => handleColorValueKeyDown(e, "h"), ["prevent", "stop"]), ["up"])),
|
|
389
|
-
_cache[24] || (_cache[24] = withKeys(withModifiers((e) => handleColorValueKeyDown(e, "h"), ["prevent", "stop"]), ["down"]))
|
|
390
|
-
]
|
|
391
|
-
}, null, 8, ["modelValue"]),
|
|
392
|
-
createVNode(unref(TextInput), {
|
|
393
|
-
modelValue: hsl.value.s,
|
|
394
|
-
"onUpdate:modelValue": _cache[25] || (_cache[25] = ($event) => hsl.value.s = $event),
|
|
395
|
-
autocomplete: "off",
|
|
396
|
-
name: "saturation",
|
|
397
|
-
type: "text",
|
|
398
|
-
class: "color-input",
|
|
399
|
-
size: "xs",
|
|
400
|
-
onBeforeinput: validateInput,
|
|
401
|
-
onFocusout: _cache[26] || (_cache[26] = (e) => inputChangeHSL(e, "s")),
|
|
402
|
-
onKeydown: [
|
|
403
|
-
_cache[27] || (_cache[27] = withKeys(withModifiers((e) => inputChangeHSL(e, "s"), ["prevent"]), ["enter"])),
|
|
404
|
-
_cache[28] || (_cache[28] = withKeys(withModifiers((e) => handleColorValueKeyDown(e, "s"), ["prevent", "stop"]), ["up"])),
|
|
405
|
-
_cache[29] || (_cache[29] = withKeys(withModifiers((e) => handleColorValueKeyDown(e, "s"), ["prevent", "stop"]), ["down"]))
|
|
406
|
-
]
|
|
407
|
-
}, null, 8, ["modelValue"]),
|
|
408
|
-
createVNode(unref(TextInput), {
|
|
409
|
-
modelValue: hsl.value.l,
|
|
410
|
-
"onUpdate:modelValue": _cache[30] || (_cache[30] = ($event) => hsl.value.l = $event),
|
|
411
|
-
autocomplete: "off",
|
|
412
|
-
name: "lightness",
|
|
413
|
-
type: "text",
|
|
414
|
-
class: "color-input",
|
|
415
|
-
size: "xs",
|
|
416
|
-
onBeforeinput: validateInput,
|
|
417
|
-
onFocusout: _cache[31] || (_cache[31] = (e) => inputChangeHSL(e, "l")),
|
|
418
|
-
onKeydown: [
|
|
419
|
-
_cache[32] || (_cache[32] = withKeys(withModifiers((e) => inputChangeHSL(e, "l"), ["prevent"]), ["enter"])),
|
|
420
|
-
_cache[33] || (_cache[33] = withKeys(withModifiers((e) => handleColorValueKeyDown(e, "l"), ["prevent", "stop"]), ["up"])),
|
|
421
|
-
_cache[34] || (_cache[34] = withKeys(withModifiers((e) => handleColorValueKeyDown(e, "l"), ["prevent", "stop"]), ["down"]))
|
|
422
|
-
]
|
|
423
|
-
}, null, 8, ["modelValue"])
|
|
424
|
-
], 64)) : currentColorFormat.value === "hsb" ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
|
|
425
|
-
createVNode(unref(TextInput), {
|
|
426
|
-
modelValue: hsv.value.h,
|
|
427
|
-
"onUpdate:modelValue": _cache[35] || (_cache[35] = ($event) => hsv.value.h = $event),
|
|
428
|
-
autocomplete: "off",
|
|
429
|
-
name: "hue",
|
|
430
|
-
type: "text",
|
|
431
|
-
class: "color-input",
|
|
432
|
-
size: "xs",
|
|
433
|
-
onBeforeinput: validateInput,
|
|
434
|
-
onFocusout: _cache[36] || (_cache[36] = (e) => inputChangeHSB(e, "h")),
|
|
435
|
-
onKeydown: [
|
|
436
|
-
_cache[37] || (_cache[37] = withKeys(withModifiers((e) => inputChangeHSB(e, "h"), ["prevent"]), ["enter"])),
|
|
437
|
-
_cache[38] || (_cache[38] = withKeys(withModifiers((e) => handleColorValueKeyDown(e, "h"), ["prevent", "stop"]), ["up"])),
|
|
438
|
-
_cache[39] || (_cache[39] = withKeys(withModifiers((e) => handleColorValueKeyDown(e, "h"), ["prevent", "stop"]), ["down"]))
|
|
439
|
-
]
|
|
440
|
-
}, null, 8, ["modelValue"]),
|
|
441
|
-
createVNode(unref(TextInput), {
|
|
442
|
-
modelValue: hsv.value.s,
|
|
443
|
-
"onUpdate:modelValue": _cache[40] || (_cache[40] = ($event) => hsv.value.s = $event),
|
|
444
|
-
autocomplete: "off",
|
|
445
|
-
name: "saturation",
|
|
446
|
-
type: "text",
|
|
447
|
-
class: "color-input",
|
|
448
|
-
size: "xs",
|
|
449
|
-
onBeforeinput: validateInput,
|
|
450
|
-
onFocusout: _cache[41] || (_cache[41] = (e) => inputChangeHSB(e, "s")),
|
|
451
|
-
onKeydown: [
|
|
452
|
-
_cache[42] || (_cache[42] = withKeys(withModifiers((e) => inputChangeHSB(e, "s"), ["prevent"]), ["enter"])),
|
|
453
|
-
_cache[43] || (_cache[43] = withKeys(withModifiers((e) => handleColorValueKeyDown(e, "s"), ["prevent", "stop"]), ["up"])),
|
|
454
|
-
_cache[44] || (_cache[44] = withKeys(withModifiers((e) => handleColorValueKeyDown(e, "s"), ["prevent", "stop"]), ["down"]))
|
|
455
|
-
]
|
|
456
|
-
}, null, 8, ["modelValue"]),
|
|
457
|
-
createVNode(unref(TextInput), {
|
|
458
|
-
modelValue: hsv.value.v,
|
|
459
|
-
"onUpdate:modelValue": _cache[45] || (_cache[45] = ($event) => hsv.value.v = $event),
|
|
460
|
-
autocomplete: "off",
|
|
461
|
-
name: "brightness",
|
|
462
|
-
type: "text",
|
|
463
|
-
class: "color-input",
|
|
464
|
-
size: "xs",
|
|
465
|
-
onBeforeinput: validateInput,
|
|
466
|
-
onFocusout: _cache[46] || (_cache[46] = (e) => inputChangeHSB(e, "v")),
|
|
467
|
-
onKeydown: [
|
|
468
|
-
_cache[47] || (_cache[47] = withKeys(withModifiers((e) => inputChangeHSB(e, "v"), ["prevent"]), ["enter"])),
|
|
469
|
-
_cache[48] || (_cache[48] = withKeys(withModifiers((e) => handleColorValueKeyDown(e, "v"), ["prevent", "stop"]), ["up"])),
|
|
470
|
-
_cache[49] || (_cache[49] = withKeys(withModifiers((e) => handleColorValueKeyDown(e, "v"), ["prevent", "stop"]), ["down"]))
|
|
471
|
-
]
|
|
472
|
-
}, null, 8, ["modelValue"])
|
|
473
|
-
], 64)) : createCommentVNode("", true),
|
|
474
|
-
createVNode(unref(TextInput), {
|
|
475
|
-
autocomplete: "off",
|
|
476
|
-
name: "alpha",
|
|
477
|
-
placeholder: "100",
|
|
478
|
-
type: "text",
|
|
479
|
-
class: "color-input",
|
|
480
|
-
size: "xs",
|
|
481
|
-
value: `${(unref(tinyColorRef).getAlpha() * 100).toFixed()}%`,
|
|
482
|
-
onBeforeinput: validateInput,
|
|
483
|
-
onFocusout: inputChangeAlpha,
|
|
484
|
-
onKeydown: [
|
|
485
|
-
withKeys(withModifiers(inputChangeAlpha, ["prevent", "stop"]), ["enter"]),
|
|
486
|
-
_cache[50] || (_cache[50] = withKeys(withModifiers((e) => handleColorValueKeyDown(e, "a"), ["prevent", "stop"]), ["up"])),
|
|
487
|
-
_cache[51] || (_cache[51] = withKeys(withModifiers((e) => handleColorValueKeyDown(e, "a"), ["prevent", "stop"]), ["down"]))
|
|
488
|
-
]
|
|
489
|
-
}, null, 8, ["value", "onKeydown"])
|
|
490
|
-
])
|
|
491
|
-
])
|
|
492
|
-
])
|
|
493
|
-
]),
|
|
494
|
-
createElementVNode("div", _hoisted_6, [
|
|
495
|
-
_ctx.$slots.swatches ? renderSlot(_ctx.$slots, "swatches", { key: 0 }, void 0, true) : (openBlock(), createBlock(ColorSwatch, {
|
|
496
|
-
key: 1,
|
|
497
|
-
modelValue: unref(tinyColorRef),
|
|
498
|
-
"onUpdate:modelValue": _cache[52] || (_cache[52] = ($event) => isRef(tinyColorRef) ? tinyColorRef.value = $event : null),
|
|
499
|
-
hue: hueRef.value
|
|
500
|
-
}, null, 8, ["modelValue", "hue"]))
|
|
501
|
-
])
|
|
502
|
-
], 16)
|
|
503
|
-
]),
|
|
504
|
-
_: 3
|
|
505
|
-
})
|
|
506
|
-
]),
|
|
507
|
-
_: 3
|
|
508
|
-
});
|
|
509
|
-
};
|
|
510
|
-
}
|
|
511
|
-
});
|
|
512
|
-
const colorPicker = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-5d801c64"]]);
|
|
513
|
-
export {
|
|
514
|
-
colorPicker as default
|
|
515
|
-
};
|
package/dist/es/color-swatch.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { defineComponent, useCssVars, computed, openBlock, createElementBlock, createElementVNode, toDisplayString, Fragment, renderList, normalizeStyle, withKeys } from "vue";
|
|
2
|
-
import { DEFAULT_SWATCH } from "./color.js";
|
|
3
|
-
import { d as defineColorModel, t as tinycolor } from "./chunks/use-color-model.js";
|
|
4
|
-
import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
|
|
5
|
-
const _hoisted_1 = { class: "celeste-color-swatch" };
|
|
6
|
-
const _hoisted_2 = { class: "swatch-label" };
|
|
7
|
-
const _hoisted_3 = { class: "color-palette" };
|
|
8
|
-
const _hoisted_4 = ["aria-selected", "title", "aria-label", "onClick", "onKeydown"];
|
|
9
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
10
|
-
__name: "color-swatch",
|
|
11
|
-
props: {
|
|
12
|
-
modelValue: {},
|
|
13
|
-
label: { default: "Recommended Colors" },
|
|
14
|
-
swatch: { default: () => DEFAULT_SWATCH },
|
|
15
|
-
defaultColor: {}
|
|
16
|
-
},
|
|
17
|
-
emits: ["update:modelValue"],
|
|
18
|
-
setup(__props, { emit: __emit }) {
|
|
19
|
-
useCssVars((_ctx) => ({
|
|
20
|
-
"0829b6e2": activeSwatchColorBg.value
|
|
21
|
-
}));
|
|
22
|
-
const props = __props;
|
|
23
|
-
const emit = __emit;
|
|
24
|
-
const tinyColorRef = defineColorModel(props, emit);
|
|
25
|
-
const activeSwatchColorBg = computed(() => {
|
|
26
|
-
return `0 0 0 2px var(--color-bg-white-0), 0 0 0 4px ${tinyColorRef.value.toRgbString()}`;
|
|
27
|
-
});
|
|
28
|
-
function handleSwatchColorClick(newColor) {
|
|
29
|
-
tinyColorRef.value = tinycolor(newColor);
|
|
30
|
-
}
|
|
31
|
-
function isSwatchColorSelected(color) {
|
|
32
|
-
return tinyColorRef.value.toHex8String().toLocaleLowerCase() === tinycolor(color).toHex8String().toLocaleLowerCase();
|
|
33
|
-
}
|
|
34
|
-
return (_ctx, _cache) => {
|
|
35
|
-
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
36
|
-
createElementVNode("span", _hoisted_2, toDisplayString(_ctx.label), 1),
|
|
37
|
-
createElementVNode("div", _hoisted_3, [
|
|
38
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.swatch, (swatchColor) => {
|
|
39
|
-
return openBlock(), createElementBlock("div", {
|
|
40
|
-
key: swatchColor,
|
|
41
|
-
class: "palette-color",
|
|
42
|
-
style: normalizeStyle({ background: swatchColor }),
|
|
43
|
-
"aria-selected": isSwatchColorSelected(swatchColor.toLowerCase()),
|
|
44
|
-
title: swatchColor,
|
|
45
|
-
"aria-label": `Color:${swatchColor}`,
|
|
46
|
-
role: "option",
|
|
47
|
-
tabindex: "0",
|
|
48
|
-
onClick: ($event) => handleSwatchColorClick(swatchColor),
|
|
49
|
-
onKeydown: withKeys(($event) => handleSwatchColorClick(swatchColor), ["space"])
|
|
50
|
-
}, null, 44, _hoisted_4);
|
|
51
|
-
}), 128))
|
|
52
|
-
])
|
|
53
|
-
]);
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
const ColorSwatch = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-095c22f0"]]);
|
|
58
|
-
export {
|
|
59
|
-
ColorSwatch as default
|
|
60
|
-
};
|
package/dist/es/color.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
const COLOR_NUMBER_VALIDATION_PATTERN = /^\d*\s?[%°]?$/;
|
|
2
|
-
const HEX_VALIDATION_PATTERN = /^#?[0-9a-f]{0,6}$/i;
|
|
3
|
-
const DEFAULT_SWATCH = [
|
|
4
|
-
"#717784ff",
|
|
5
|
-
"#335cffff",
|
|
6
|
-
"#ff8547ff",
|
|
7
|
-
"#fb3747ff",
|
|
8
|
-
"#1fc16bff",
|
|
9
|
-
"#f6b51eff",
|
|
10
|
-
"#7e52f4ff",
|
|
11
|
-
"#47c2ffff"
|
|
12
|
-
];
|
|
13
|
-
function getFractionDigit(data) {
|
|
14
|
-
const str = data.toString();
|
|
15
|
-
if (str.includes(".")) {
|
|
16
|
-
return str.split(".")[1].length;
|
|
17
|
-
}
|
|
18
|
-
return 0;
|
|
19
|
-
}
|
|
20
|
-
function clamp(value, min, max) {
|
|
21
|
-
return Math.min(Math.max(value, min), max);
|
|
22
|
-
}
|
|
23
|
-
function truncColorValue(value) {
|
|
24
|
-
return Math.trunc(Number(value.replace(/[%°]/g, "").trim()));
|
|
25
|
-
}
|
|
26
|
-
function getColorConstraints(key) {
|
|
27
|
-
const min = 0;
|
|
28
|
-
let max = 0;
|
|
29
|
-
if (key === "r" || key === "g" || key === "b") {
|
|
30
|
-
max = 255;
|
|
31
|
-
}
|
|
32
|
-
if (key === "h") {
|
|
33
|
-
max = 359;
|
|
34
|
-
}
|
|
35
|
-
if (["s", "l", "v", "a"].includes(key)) {
|
|
36
|
-
max = 100;
|
|
37
|
-
}
|
|
38
|
-
return {
|
|
39
|
-
min,
|
|
40
|
-
max
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
function bumpColorValue(value, direction) {
|
|
44
|
-
let multiplier = 0;
|
|
45
|
-
switch (direction) {
|
|
46
|
-
case "down":
|
|
47
|
-
multiplier = -1;
|
|
48
|
-
break;
|
|
49
|
-
case "up":
|
|
50
|
-
multiplier = 1;
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
return value + multiplier;
|
|
54
|
-
}
|
|
55
|
-
function getPageXYFromEvent(e) {
|
|
56
|
-
const coordinates = { x: 0, y: 0 };
|
|
57
|
-
if (e instanceof MouseEvent) {
|
|
58
|
-
coordinates.x = e.pageX;
|
|
59
|
-
coordinates.y = e.pageY;
|
|
60
|
-
}
|
|
61
|
-
if (typeof TouchEvent !== "undefined" && e instanceof TouchEvent) {
|
|
62
|
-
coordinates.x = e.touches ? e.touches[0].pageX : e.changedTouches ? e.changedTouches[0].pageX : 0;
|
|
63
|
-
coordinates.y = e.touches ? e.touches[0].pageY : e.changedTouches ? e.changedTouches[0].pageY : 0;
|
|
64
|
-
}
|
|
65
|
-
return coordinates;
|
|
66
|
-
}
|
|
67
|
-
function getScrollXY() {
|
|
68
|
-
const x = window.scrollX || window.pageXOffset || document.documentElement.scrollLeft || 0;
|
|
69
|
-
const y = window.scrollY || window.pageYOffset || document.documentElement.scrollTop || 0;
|
|
70
|
-
return { x, y };
|
|
71
|
-
}
|
|
72
|
-
function getAbsolutePosition(container) {
|
|
73
|
-
const { x: scrollX, y: scrollY } = getScrollXY();
|
|
74
|
-
const rect = container.getBoundingClientRect();
|
|
75
|
-
return {
|
|
76
|
-
x: rect.left + scrollX,
|
|
77
|
-
y: rect.top + scrollY
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
function resolveArrowDirection(e) {
|
|
81
|
-
const arrowMap = {
|
|
82
|
-
ArrowUp: "up",
|
|
83
|
-
ArrowDown: "down",
|
|
84
|
-
ArrowLeft: "left",
|
|
85
|
-
ArrowRight: "right"
|
|
86
|
-
};
|
|
87
|
-
return arrowMap[e.code];
|
|
88
|
-
}
|
|
89
|
-
export {
|
|
90
|
-
COLOR_NUMBER_VALIDATION_PATTERN,
|
|
91
|
-
DEFAULT_SWATCH,
|
|
92
|
-
HEX_VALIDATION_PATTERN,
|
|
93
|
-
bumpColorValue,
|
|
94
|
-
clamp,
|
|
95
|
-
getAbsolutePosition,
|
|
96
|
-
getColorConstraints,
|
|
97
|
-
getFractionDigit,
|
|
98
|
-
getPageXYFromEvent,
|
|
99
|
-
getScrollXY,
|
|
100
|
-
resolveArrowDirection,
|
|
101
|
-
truncColorValue
|
|
102
|
-
};
|