@pantograph/vue 0.10.1 → 0.10.2
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/dist/ActionButton/ActionButton.d.ts +79 -3
- package/dist/ActionButton/index.js.js +1 -1
- package/dist/ActionButton/index.umd.cjs.js +1 -1
- package/dist/{ActionButton.vue_vue_type_script_setup_true_lang-KL8JuFlI.js → ActionButton.vue_vue_type_script_setup_true_lang-B8F78aq-.js} +1 -2
- package/dist/ActionButton.vue_vue_type_script_setup_true_lang-DYj83ijm.js +1 -0
- package/dist/Avatar/Avatar.d.ts +14 -7
- package/dist/Avatar/index.js.js +1 -1
- package/dist/Avatar/index.umd.cjs.js +1 -1
- package/dist/Avatar.vue_vue_type_style_index_0_lang-BwkELI0y.js +1 -0
- package/dist/Avatar.vue_vue_type_style_index_0_lang-DheqjJPa.js +182 -0
- package/dist/AvatarGroup/AvatarGroup.d.ts +2 -5
- package/dist/AvatarGroup/index.js.js +1 -1
- package/dist/AvatarGroup/index.umd.cjs.js +1 -1
- package/dist/Badge/Badge.d.ts +9 -2
- package/dist/Badge/index.js.js +1 -1
- package/dist/Badge/index.umd.cjs.js +1 -1
- package/dist/{Badge.vue_vue_type_script_setup_true_lang-nmw9qfJ_.js → Badge.vue_vue_type_script_setup_true_lang-CCIamdNB.js} +1 -2
- package/dist/Badge.vue_vue_type_script_setup_true_lang-ooDlpl8j.js +1 -0
- package/dist/Base/BaseBadge/BaseBadge.d.ts +12 -7
- package/dist/Base/BaseButton/BaseButton.d.ts +14 -7
- package/dist/BaseBadge.vue_vue_type_style_index_0_lang-BNs69VP4.js +1 -0
- package/dist/{BaseBadge.vue_vue_type_style_index_0_lang-MM6bsdzR.js → BaseBadge.vue_vue_type_style_index_0_lang-Bh1152XC.js} +46 -52
- package/dist/BaseButton.vue_vue_type_style_index_0_lang-CgEN8K4D.js +1 -0
- package/dist/BaseButton.vue_vue_type_style_index_0_lang-D7irHU-6.js +153 -0
- package/dist/Button/Button.d.ts +79 -3
- package/dist/Button/index.js.js +1 -1
- package/dist/Button/index.umd.cjs.js +1 -1
- package/dist/Button.vue_vue_type_script_setup_true_lang-BA3bxjLD.js +1 -0
- package/dist/{Button.vue_vue_type_script_setup_true_lang-DIj3gT2D.js → Button.vue_vue_type_script_setup_true_lang-NKY7YYCC.js} +5 -6
- package/dist/ButtonGroup/ButtonGroup.d.ts +3 -5
- package/dist/ButtonGroup/index.js.js +1 -1
- package/dist/ButtonGroup/index.umd.cjs.js +1 -1
- package/dist/ButtonGroup.vue_vue_type_script_setup_true_lang-CT_Kgpjf.js +47 -0
- package/dist/ButtonGroup.vue_vue_type_script_setup_true_lang-D486_o-Z.js +1 -0
- package/dist/Checkbox/Checkbox.d.ts +12 -4
- package/dist/Checkbox/index.js.js +1 -1
- package/dist/Checkbox/index.umd.cjs.js +1 -1
- package/dist/Checkbox.vue_vue_type_style_index_0_lang-CSmeTeZh.js +209 -0
- package/dist/Checkbox.vue_vue_type_style_index_0_lang-D0sF0-hW.js +1 -0
- package/dist/CheckboxGroup/CheckboxGroup.d.ts +2 -5
- package/dist/CheckboxGroup/index.js.js +1 -1
- package/dist/CheckboxGroup/index.umd.cjs.js +1 -1
- package/dist/ColorPicker/index.js.js +1 -1
- package/dist/ColorPicker/index.umd.cjs.js +1 -1
- package/dist/{ColorPicker.vue_vue_type_style_index_0_lang-C36JPo4m.js → ColorPicker.vue_vue_type_style_index_0_lang-B1Rst4Q9.js} +1 -1
- package/dist/{ColorPicker.vue_vue_type_style_index_0_lang-Dq-kFXox.js → ColorPicker.vue_vue_type_style_index_0_lang-CEz3bIJG.js} +2 -2
- package/dist/ColorSwatch/ColorSwatch.d.ts +11 -4
- package/dist/ColorSwatch/index.js.js +1 -1
- package/dist/ColorSwatch/index.umd.cjs.js +1 -1
- package/dist/ColorSwatch.vue_vue_type_style_index_0_lang-BH-NSALx.js +1 -0
- package/dist/ColorSwatch.vue_vue_type_style_index_0_lang-CL9dd69H.js +100 -0
- package/dist/ColorSwatchGroup/ColorSwatchGroup.d.ts +17 -11
- package/dist/ColorSwatchGroup/index.js.js +1 -1
- package/dist/ColorSwatchGroup/index.umd.cjs.js +1 -1
- package/dist/ColorSwatchGroup.vue_vue_type_style_index_0_lang-CpgTgIuE.js +1 -0
- package/dist/ColorSwatchGroup.vue_vue_type_style_index_0_lang-Cwh2REmh.js +159 -0
- package/dist/ColorTrigger/ColorTrigger.d.ts +13 -5
- package/dist/ColorTrigger/index.js.js +1 -1
- package/dist/ColorTrigger/index.umd.cjs.js +1 -1
- package/dist/ColorTrigger.vue_vue_type_style_index_0_lang-BNFu93Ns.js +86 -0
- package/dist/ColorTrigger.vue_vue_type_style_index_0_lang-C8kPa338.js +1 -0
- package/dist/ConfigProvider/index.d.ts +6 -6
- package/dist/ConfigProvider/utils.d.ts +2 -2
- package/dist/Divider/Divider.d.ts +13 -8
- package/dist/Divider/index.js.js +1 -1
- package/dist/Divider/index.umd.cjs.js +1 -1
- package/dist/Divider.vue_vue_type_style_index_0_lang-BELWThBf.js +1 -0
- package/dist/Divider.vue_vue_type_style_index_0_lang-CRs1KEcj.js +34 -0
- package/dist/FloatButton/FloatButton.d.ts +79 -3
- package/dist/FloatButton/index.js.js +1 -1
- package/dist/FloatButton/index.umd.cjs.js +1 -1
- package/dist/{FloatButton.vue_vue_type_script_setup_true_lang-Bapsnc_p.js → FloatButton.vue_vue_type_script_setup_true_lang-BAxKXFb0.js} +1 -2
- package/dist/FloatButton.vue_vue_type_script_setup_true_lang-C5hAAZZQ.js +1 -0
- package/dist/GraphicalObject/GraphicalObject.d.ts +9 -2
- package/dist/GraphicalObject/index.js.js +1 -1
- package/dist/GraphicalObject/index.umd.cjs.js +1 -1
- package/dist/{GraphicalObject.vue_vue_type_script_setup_true_lang-B3FouRlw.js → GraphicalObject.vue_vue_type_script_setup_true_lang-BEZ6FkRf.js} +1 -2
- package/dist/GraphicalObject.vue_vue_type_script_setup_true_lang-CdO2zArd.js +1 -0
- package/dist/Icon/Icon.d.ts +11 -4
- package/dist/IconButton/IconButton.d.ts +79 -3
- package/dist/IconButton/index.js.js +1 -1
- package/dist/IconButton/index.umd.cjs.js +1 -1
- package/dist/{IconButton.vue_vue_type_script_setup_true_lang-dI6-RNyi.js → IconButton.vue_vue_type_script_setup_true_lang-CchpvdkX.js} +1 -2
- package/dist/IconButton.vue_vue_type_script_setup_true_lang-c16Xu6mm.js +1 -0
- package/dist/Image/Image.d.ts +16 -8
- package/dist/Image/index.js.js +1 -1
- package/dist/Image/index.umd.cjs.js +1 -1
- package/dist/{Image.vue_vue_type_style_index_0_lang-DbqKKOAs.js → Image.vue_vue_type_style_index_0_lang-Hg1jFz-L.js} +1 -1
- package/dist/{Image.vue_vue_type_style_index_0_lang-Cku5hiNE.js → Image.vue_vue_type_style_index_0_lang-pkzjPQyu.js} +2 -2
- package/dist/IndentLevel/IndentLevel.d.ts +14 -8
- package/dist/IndentLevel/index.js.js +1 -1
- package/dist/IndentLevel/index.umd.cjs.js +1 -1
- package/dist/IndentLevel.vue_vue_type_style_index_0_lang-DqqJTrDF.js +1 -0
- package/dist/IndentLevel.vue_vue_type_style_index_0_lang-ZZ1uEhji.js +94 -0
- package/dist/Indicator/Indicator.d.ts +9 -2
- package/dist/Indicator/index.js.js +1 -1
- package/dist/Indicator/index.umd.cjs.js +1 -1
- package/dist/{Indicator.vue_vue_type_script_setup_true_lang-ICqvLVbq.js → Indicator.vue_vue_type_script_setup_true_lang-B16OmZLF.js} +1 -2
- package/dist/Indicator.vue_vue_type_script_setup_true_lang-BibzfVax.js +1 -0
- package/dist/Input/Input.d.ts +15 -7
- package/dist/Input/index.js.js +1 -1
- package/dist/Input/index.umd.cjs.js +1 -1
- package/dist/Input.vue_vue_type_style_index_0_lang-CcR6oCIR.js +407 -0
- package/dist/Input.vue_vue_type_style_index_0_lang-DVN491cI.js +1 -0
- package/dist/Kbd/Kbd.d.ts +13 -9
- package/dist/Kbd/index.js.js +1 -1
- package/dist/Kbd/index.umd.cjs.js +1 -1
- package/dist/Kbd.vue_vue_type_style_index_0_lang-CpDjSQqg.js +1 -0
- package/dist/Kbd.vue_vue_type_style_index_0_lang-D1y-0kBN.js +47 -0
- package/dist/Menu/Menu.d.ts +9 -10
- package/dist/Menu/index.js.js +1 -1
- package/dist/Menu/index.umd.cjs.js +1 -1
- package/dist/Menu.vue_vue_type_style_index_0_lang-B64mJSxF.js +481 -0
- package/dist/Menu.vue_vue_type_style_index_0_lang-Sq_kFrSI.js +1 -0
- package/dist/MenuItem/MenuItem.d.ts +1 -1
- package/dist/MenuItem/index.js.js +1 -1
- package/dist/MenuItem/index.umd.cjs.js +1 -1
- package/dist/Popover/Popover.d.ts +82 -5
- package/dist/RadioGroup/RadioGroup.d.ts +12 -5
- package/dist/RadioGroup/RadioGroupItem.d.ts +11 -3
- package/dist/RadioGroup/index.d.ts +1 -1
- package/dist/RadioGroup/index.js.js +3 -2
- package/dist/RadioGroup/index.umd.cjs.js +1 -1
- package/dist/RadioGroup.vue_vue_type_script_setup_true_lang-C8nd4TEI.js +100 -0
- package/dist/RadioGroup.vue_vue_type_script_setup_true_lang-DjEHmvMo.js +1 -0
- package/dist/Shortcut/Shortcut.d.ts +1 -2
- package/dist/Shortcut/index.js.js +1 -1
- package/dist/Shortcut/index.umd.cjs.js +1 -1
- package/dist/Shortcut.vue_vue_type_style_index_0_lang-D4xo_UgO.js +32 -0
- package/dist/Shortcut.vue_vue_type_style_index_0_lang-D8_aLpYM.js +1 -0
- package/dist/Skeleton/Skeleton.d.ts +3 -7
- package/dist/Skeleton/index.js.js +1 -1
- package/dist/Skeleton/index.umd.cjs.js +1 -1
- package/dist/Skeleton.vue_vue_type_style_index_0_lang-C1I-p4Yn.js +1 -0
- package/dist/Skeleton.vue_vue_type_style_index_0_lang-IQEtEnZx.js +58 -0
- package/dist/Spinner/Spinner.d.ts +11 -6
- package/dist/Spinner/index.js.js +1 -1
- package/dist/Spinner/index.umd.cjs.js +1 -1
- package/dist/Spinner.vue_vue_type_style_index_0_lang-BP7P5xu8.js +1 -0
- package/dist/Spinner.vue_vue_type_style_index_0_lang-BYqqSQAx.js +73 -0
- package/dist/Switch/Switch.d.ts +14 -3
- package/dist/Switch/index.js.js +1 -1
- package/dist/Switch/index.umd.cjs.js +1 -1
- package/dist/Switch.vue_vue_type_style_index_0_lang-CoXu3YJ-.js +1 -0
- package/dist/Switch.vue_vue_type_style_index_0_lang-CvWay8Wa.js +106 -0
- package/dist/Tree/Tree.d.ts +12 -3
- package/dist/Tree/TreeNode.d.ts +11 -2
- package/dist/Tree/index.js.js +1 -1
- package/dist/Tree/index.umd.cjs.js +1 -1
- package/dist/Tree.vue_vue_type_style_index_0_lang-BCYjSwUH.js +545 -0
- package/dist/Tree.vue_vue_type_style_index_0_lang-CvskECfv.js +1 -0
- package/dist/index.js.js +66 -62
- package/dist/index.umd.cjs.js +1 -1
- package/dist/style/index.css +1 -1
- package/dist/useId-DvOSMFGX.js +9 -0
- package/dist/useId-Ku3O_8TK.js +1 -0
- package/dist/useInputDataStates-CZbdWpyp.js +26 -0
- package/dist/useInputDataStates-CbRgNQqU.js +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js.js +10 -6
- package/dist/utils/index.umd.cjs.js +1 -1
- package/dist/utils/useId.d.ts +1 -0
- package/dist/utils/useInputDataStates.d.ts +19 -0
- package/package.json +5 -3
- package/dist/ActionButton.vue_vue_type_script_setup_true_lang-BVtP6mpl.js +0 -1
- package/dist/Avatar.vue_vue_type_style_index_0_lang-BHYcXGuX.js +0 -188
- package/dist/Avatar.vue_vue_type_style_index_0_lang-DKGY3npY.js +0 -1
- package/dist/Badge.vue_vue_type_script_setup_true_lang-BcdNUohN.js +0 -1
- package/dist/Base/Primitive.d.ts +0 -39
- package/dist/Base/Slot.d.ts +0 -6
- package/dist/BaseBadge.vue_vue_type_style_index_0_lang-OEeJw0Sy.js +0 -1
- package/dist/BaseButton.vue_vue_type_style_index_0_lang-BrQJfrgg.js +0 -159
- package/dist/BaseButton.vue_vue_type_style_index_0_lang-CTK5nNR6.js +0 -1
- package/dist/Button.vue_vue_type_script_setup_true_lang-7V57ztN4.js +0 -1
- package/dist/ButtonGroup.vue_vue_type_script_setup_true_lang-BSj1Y1j2.js +0 -1
- package/dist/ButtonGroup.vue_vue_type_script_setup_true_lang-CdSgBboA.js +0 -52
- package/dist/Checkbox.vue_vue_type_style_index_0_lang-C6Mdufam.js +0 -1
- package/dist/Checkbox.vue_vue_type_style_index_0_lang-DNlvOQmv.js +0 -216
- package/dist/ColorSwatch.vue_vue_type_style_index_0_lang-Bo-zDAyc.js +0 -1
- package/dist/ColorSwatch.vue_vue_type_style_index_0_lang-DmLhCPh4.js +0 -102
- package/dist/ColorSwatchGroup.vue_vue_type_style_index_0_lang-CIkTvqD_.js +0 -165
- package/dist/ColorSwatchGroup.vue_vue_type_style_index_0_lang-T_L-D2SS.js +0 -1
- package/dist/ColorTrigger.vue_vue_type_style_index_0_lang-DSZ8fAZ9.js +0 -91
- package/dist/ColorTrigger.vue_vue_type_style_index_0_lang-DwyinKNj.js +0 -1
- package/dist/Divider.vue_vue_type_style_index_0_lang-B_4XMyuu.js +0 -40
- package/dist/Divider.vue_vue_type_style_index_0_lang-C6Suy0tD.js +0 -1
- package/dist/FloatButton.vue_vue_type_script_setup_true_lang-C56u1xaL.js +0 -1
- package/dist/GraphicalObject.vue_vue_type_script_setup_true_lang-DlMeNk_1.js +0 -1
- package/dist/IconButton.vue_vue_type_script_setup_true_lang-7QB-mmyg.js +0 -1
- package/dist/IndentLevel.vue_vue_type_style_index_0_lang-CM6s5E6c.js +0 -1
- package/dist/IndentLevel.vue_vue_type_style_index_0_lang-nGsyFkwr.js +0 -104
- package/dist/Indicator.vue_vue_type_script_setup_true_lang-C4Ecg4iy.js +0 -1
- package/dist/Input.vue_vue_type_style_index_0_lang-D0zx-hd_.js +0 -1
- package/dist/Input.vue_vue_type_style_index_0_lang-cjYJlwXf.js +0 -413
- package/dist/Kbd.vue_vue_type_style_index_0_lang-BqEaW_kJ.js +0 -1
- package/dist/Kbd.vue_vue_type_style_index_0_lang-DbtLbpq-.js +0 -60
- package/dist/Menu.vue_vue_type_style_index_0_lang-DHGED80D.js +0 -481
- package/dist/Menu.vue_vue_type_style_index_0_lang-DU0Rexv8.js +0 -1
- package/dist/Primitive-BT1RjuGS.js +0 -1
- package/dist/Primitive-nOVjbfuc.js +0 -47
- package/dist/RadioGroup.vue_vue_type_script_setup_true_lang-DWfKIuDH.js +0 -100
- package/dist/RadioGroup.vue_vue_type_script_setup_true_lang-s-m7W1By.js +0 -1
- package/dist/Shortcut.vue_vue_type_style_index_0_lang-BQb7DjFe.js +0 -41
- package/dist/Shortcut.vue_vue_type_style_index_0_lang-C49ZdQFd.js +0 -1
- package/dist/Skeleton.vue_vue_type_style_index_0_lang-B6bCkLlD.js +0 -66
- package/dist/Skeleton.vue_vue_type_style_index_0_lang-PNNUgKOq.js +0 -1
- package/dist/Spinner.vue_vue_type_style_index_0_lang-CxNO28J7.js +0 -1
- package/dist/Spinner.vue_vue_type_style_index_0_lang-D6nB06Z8.js +0 -85
- package/dist/Switch.vue_vue_type_style_index_0_lang-BzC8-ylY.js +0 -103
- package/dist/Switch.vue_vue_type_style_index_0_lang-DnNHGn1c.js +0 -1
- package/dist/Tree.vue_vue_type_style_index_0_lang-B-BPV_p7.js +0 -547
- package/dist/Tree.vue_vue_type_style_index_0_lang-BIpFWo5L.js +0 -1
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { defineComponent as S, ref as _, watch as L, computed as c, createElementBlock as v, openBlock as n, renderSlot as G, createCommentVNode as V, Fragment as E, renderList as O, createBlock as w, mergeProps as $, useSlots as T, unref as s, createVNode as B, withCtx as y, normalizeClass as x, createTextVNode as j, toDisplayString as F } from "vue";
|
|
2
|
+
import { createContext as R, CheckboxRoot as H, CheckboxIndicator as J } from "radix-vue";
|
|
3
|
+
import { prefixTokens as i } from "@pantograph/tokens";
|
|
4
|
+
import { g as K, a as M, b as f } from "./class-DziTeW9B.js";
|
|
5
|
+
import { cva as Q } from "class-variance-authority";
|
|
6
|
+
import { g as P } from "./options-JBqnVZUl.js";
|
|
7
|
+
import { o as W } from "./omit-BEkBWXra.js";
|
|
8
|
+
import { _ as X } from "./Icon.vue_vue_type_style_index_0_lang-BfPcw6PU.js";
|
|
9
|
+
import { u as Y } from "./useId-DvOSMFGX.js";
|
|
10
|
+
import { U as Z } from "./useInputDataStates-CZbdWpyp.js";
|
|
11
|
+
const ee = ["2xsm", "xsm"], be = (t) => ({
|
|
12
|
+
"--ptc-checkbox-bg": `var(--${i}-${t}-5)`,
|
|
13
|
+
"--ptc-checkbox-bg-hover": `var(--${i}-${t}-4)`,
|
|
14
|
+
"--ptc-checkbox-bg-focus": `var(--${i}-${t}-6)`,
|
|
15
|
+
"--ptc-checkbox-br-focus": `var(--${i}-${t}-6)`,
|
|
16
|
+
"--ptc-checkbox-bg-active": `var(--${i}-${t}-7)`
|
|
17
|
+
}), he = (t) => ({
|
|
18
|
+
"--ptc-group-checkbox-bg": `var(--${i}-${t}-5)`,
|
|
19
|
+
"--ptc-group-checkbox-bg-hover": `var(--${i}-${t}-4)`,
|
|
20
|
+
"--ptc-group-checkbox-bg-focus": `var(--${i}-${t}-6)`,
|
|
21
|
+
"--ptc-group-checkbox-br-focus": `var(--${i}-${t}-6)`,
|
|
22
|
+
"--ptc-group-checkbox-bg-active": `var(--${i}-${t}-7)`
|
|
23
|
+
}), [ae, te] = R("CheckboxGroup"), fe = /* @__PURE__ */ S({
|
|
24
|
+
...P("CheckboxGroup"),
|
|
25
|
+
__name: "CheckboxGroup",
|
|
26
|
+
props: {
|
|
27
|
+
value: {},
|
|
28
|
+
size: {},
|
|
29
|
+
disabled: { type: Boolean },
|
|
30
|
+
name: {},
|
|
31
|
+
options: {}
|
|
32
|
+
},
|
|
33
|
+
emits: ["update:value", "change"],
|
|
34
|
+
setup(t, { emit: k }) {
|
|
35
|
+
const l = k, e = t, o = _(e.value ?? []);
|
|
36
|
+
L(
|
|
37
|
+
() => e.value,
|
|
38
|
+
() => {
|
|
39
|
+
o.value = e.value ?? [];
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
const u = c({
|
|
43
|
+
get() {
|
|
44
|
+
return e.value ? e.value : o.value;
|
|
45
|
+
},
|
|
46
|
+
set(r) {
|
|
47
|
+
e.value || (o.value = r), l("update:value", r), l("change", r);
|
|
48
|
+
}
|
|
49
|
+
}), C = c(() => e.size), d = c(() => e.disabled ? !0 : void 0);
|
|
50
|
+
return te({
|
|
51
|
+
model: u,
|
|
52
|
+
size: C,
|
|
53
|
+
disabled: d
|
|
54
|
+
}), (r, g) => (n(), v("div", null, [
|
|
55
|
+
G(r.$slots, "default", {}, () => {
|
|
56
|
+
var m;
|
|
57
|
+
return [
|
|
58
|
+
(m = r.options) != null && m.length ? (n(!0), v(E, { key: 0 }, O(r.options, (b) => (n(), w(se, $({
|
|
59
|
+
key: b.value,
|
|
60
|
+
ref_for: !0
|
|
61
|
+
}, b), null, 16))), 128)) : V("", !0)
|
|
62
|
+
];
|
|
63
|
+
})
|
|
64
|
+
]));
|
|
65
|
+
}
|
|
66
|
+
}), oe = ["for"], se = /* @__PURE__ */ S({
|
|
67
|
+
...P("Checkbox"),
|
|
68
|
+
__name: "Checkbox",
|
|
69
|
+
props: {
|
|
70
|
+
size: { default: "xsm" },
|
|
71
|
+
class: {},
|
|
72
|
+
rootCls: {},
|
|
73
|
+
indicatorCls: {},
|
|
74
|
+
indeterminateCls: {},
|
|
75
|
+
labelCls: {},
|
|
76
|
+
label: {},
|
|
77
|
+
value: {},
|
|
78
|
+
id: {},
|
|
79
|
+
valueAsLabel: { type: Boolean, default: !0 },
|
|
80
|
+
defaultChecked: { type: Boolean },
|
|
81
|
+
checked: { type: [Boolean, String], default: void 0 },
|
|
82
|
+
disabled: { type: Boolean },
|
|
83
|
+
required: { type: Boolean },
|
|
84
|
+
name: {}
|
|
85
|
+
},
|
|
86
|
+
emits: ["update:checked", "change", "blur", "focus"],
|
|
87
|
+
setup(t, { emit: k }) {
|
|
88
|
+
const l = K("checkbox"), e = t, o = ae({}), u = k, C = T(), d = _(e.checked ?? !1);
|
|
89
|
+
L(
|
|
90
|
+
() => e.checked,
|
|
91
|
+
() => {
|
|
92
|
+
d.value = e.checked ?? !1;
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
const r = c({
|
|
96
|
+
get() {
|
|
97
|
+
var a;
|
|
98
|
+
return (a = o.model) != null && a.value ? e.value !== void 0 && o.model.value.includes(e.value) : e.checked !== void 0 ? e.checked : d.value;
|
|
99
|
+
},
|
|
100
|
+
set(a) {
|
|
101
|
+
var p;
|
|
102
|
+
if ((p = o.model) != null && p.value) {
|
|
103
|
+
if (e.value !== void 0) {
|
|
104
|
+
const h = o.model.value.indexOf(e.value);
|
|
105
|
+
a && h === -1 ? o.model.value = [...o.model.value, e.value] : !a && h !== -1 && (o.model.value = o.model.value.filter(
|
|
106
|
+
(U) => U !== e.value
|
|
107
|
+
));
|
|
108
|
+
}
|
|
109
|
+
} else
|
|
110
|
+
e.checked === void 0 && (d.value = a), u("update:checked", a), u("change", a);
|
|
111
|
+
}
|
|
112
|
+
}), g = c(() => e.id ?? Y(l)), m = c(() => {
|
|
113
|
+
var a;
|
|
114
|
+
return {
|
|
115
|
+
disabled: ((a = o.disabled) == null ? void 0 : a.value) ?? e.disabled,
|
|
116
|
+
...N.value,
|
|
117
|
+
...W(
|
|
118
|
+
e,
|
|
119
|
+
"size",
|
|
120
|
+
"class",
|
|
121
|
+
"label",
|
|
122
|
+
"disabled",
|
|
123
|
+
"checked",
|
|
124
|
+
"id",
|
|
125
|
+
"rootCls",
|
|
126
|
+
"indicatorCls",
|
|
127
|
+
"indeterminateCls",
|
|
128
|
+
"labelCls"
|
|
129
|
+
)
|
|
130
|
+
};
|
|
131
|
+
}), b = Q(l, {
|
|
132
|
+
variants: {
|
|
133
|
+
size: M(ee, l)
|
|
134
|
+
}
|
|
135
|
+
}), q = c(() => e.label || C.default || e.value && e.valueAsLabel), A = c(() => {
|
|
136
|
+
if (e.label) return e.label;
|
|
137
|
+
if (e.value && e.valueAsLabel) return e.value;
|
|
138
|
+
}), z = c(() => {
|
|
139
|
+
var a;
|
|
140
|
+
return ((a = o.size) == null ? void 0 : a.value) ?? e.size;
|
|
141
|
+
}), D = c(() => {
|
|
142
|
+
switch (z.value) {
|
|
143
|
+
case "xsm":
|
|
144
|
+
return "2xsm";
|
|
145
|
+
case "2xsm":
|
|
146
|
+
default:
|
|
147
|
+
return "3xsm";
|
|
148
|
+
}
|
|
149
|
+
}), { rootBindings: I, inputBindings: N } = Z({
|
|
150
|
+
getDisabled: () => {
|
|
151
|
+
var a;
|
|
152
|
+
return ((a = o.disabled) == null ? void 0 : a.value) ?? e.disabled;
|
|
153
|
+
},
|
|
154
|
+
emit: u
|
|
155
|
+
});
|
|
156
|
+
return (a, p) => (n(), v("div", $({
|
|
157
|
+
class: [s(f)(s(l), "root"), a.rootCls]
|
|
158
|
+
}, s(I)), [
|
|
159
|
+
B(s(H), $(m.value, {
|
|
160
|
+
checked: r.value,
|
|
161
|
+
"onUpdate:checked": p[0] || (p[0] = (h) => r.value = h),
|
|
162
|
+
id: g.value,
|
|
163
|
+
class: [s(b)({ size: z.value }), e.class]
|
|
164
|
+
}), {
|
|
165
|
+
default: y(() => [
|
|
166
|
+
B(s(J), {
|
|
167
|
+
class: x([s(f)(s(l), "indicator"), a.indicatorCls]),
|
|
168
|
+
asChild: ""
|
|
169
|
+
}, {
|
|
170
|
+
default: y(() => [
|
|
171
|
+
e.checked != "indeterminate" ? (n(), w(X, {
|
|
172
|
+
key: 0,
|
|
173
|
+
icon: "tabler:check",
|
|
174
|
+
size: D.value
|
|
175
|
+
}, null, 8, ["size"])) : (n(), v("span", {
|
|
176
|
+
key: 1,
|
|
177
|
+
class: x([s(f)(s(l), "indeterminate"), a.indeterminateCls])
|
|
178
|
+
}, null, 2))
|
|
179
|
+
]),
|
|
180
|
+
_: 1
|
|
181
|
+
}, 8, ["class"])
|
|
182
|
+
]),
|
|
183
|
+
_: 1
|
|
184
|
+
}, 16, ["checked", "id", "class"]),
|
|
185
|
+
q.value ? (n(), v("label", {
|
|
186
|
+
key: 0,
|
|
187
|
+
for: g.value,
|
|
188
|
+
class: x([s(f)(s(l), "label"), a.labelCls])
|
|
189
|
+
}, [
|
|
190
|
+
G(a.$slots, "default", {
|
|
191
|
+
checked: a.checked,
|
|
192
|
+
disabled: a.disabled,
|
|
193
|
+
required: a.required
|
|
194
|
+
}, () => [
|
|
195
|
+
j(F(A.value), 1)
|
|
196
|
+
])
|
|
197
|
+
], 10, oe)) : V("", !0)
|
|
198
|
+
], 16));
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
export {
|
|
202
|
+
ee as C,
|
|
203
|
+
se as _,
|
|
204
|
+
he as a,
|
|
205
|
+
fe as b,
|
|
206
|
+
ae as i,
|
|
207
|
+
te as p,
|
|
208
|
+
be as u
|
|
209
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),h=require("radix-vue"),r=require("@pantograph/tokens"),l=require("./class-CjZYGZDW.js"),G=require("class-variance-authority"),x=require("./options-B4iSAKol.js"),V=require("./omit-BKPbELUG.js"),P=require("./Icon.vue_vue_type_style_index_0_lang-BvHCdzZP.js"),L=require("./useId-Ku3O_8TK.js"),w=require("./useInputDataStates-CbRgNQqU.js"),g=["2xsm","xsm"],I=a=>({"--ptc-checkbox-bg":`var(--${r.prefixTokens}-${a}-5)`,"--ptc-checkbox-bg-hover":`var(--${r.prefixTokens}-${a}-4)`,"--ptc-checkbox-bg-focus":`var(--${r.prefixTokens}-${a}-6)`,"--ptc-checkbox-br-focus":`var(--${r.prefixTokens}-${a}-6)`,"--ptc-checkbox-bg-active":`var(--${r.prefixTokens}-${a}-7)`}),N=a=>({"--ptc-group-checkbox-bg":`var(--${r.prefixTokens}-${a}-5)`,"--ptc-group-checkbox-bg-hover":`var(--${r.prefixTokens}-${a}-4)`,"--ptc-group-checkbox-bg-focus":`var(--${r.prefixTokens}-${a}-6)`,"--ptc-group-checkbox-br-focus":`var(--${r.prefixTokens}-${a}-6)`,"--ptc-group-checkbox-bg-active":`var(--${r.prefixTokens}-${a}-7)`}),[B,$]=h.createContext("CheckboxGroup"),A=e.defineComponent({...x.getComponentOptions("CheckboxGroup"),__name:"CheckboxGroup",props:{value:{},size:{},disabled:{type:Boolean},name:{},options:{}},emits:["update:value","change"],setup(a,{emit:v}){const n=v,t=a,s=e.ref(t.value??[]);e.watch(()=>t.value,()=>{s.value=t.value??[]});const u=e.computed({get(){return t.value?t.value:s.value},set(c){t.value||(s.value=c),n("update:value",c),n("change",c)}}),f=e.computed(()=>t.size),i=e.computed(()=>t.disabled?!0:void 0);return $({model:u,size:f,disabled:i}),(c,b)=>(e.openBlock(),e.createElementBlock("div",null,[e.renderSlot(c.$slots,"default",{},()=>{var p;return[(p=c.options)!=null&&p.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(c.options,k=>(e.openBlock(),e.createBlock(z,e.mergeProps({key:k.value,ref_for:!0},k),null,16))),128)):e.createCommentVNode("",!0)]})]))}}),D=["for"],z=e.defineComponent({...x.getComponentOptions("Checkbox"),__name:"Checkbox",props:{size:{default:"xsm"},class:{},rootCls:{},indicatorCls:{},indeterminateCls:{},labelCls:{},label:{},value:{},id:{},valueAsLabel:{type:Boolean,default:!0},defaultChecked:{type:Boolean},checked:{type:[Boolean,String],default:void 0},disabled:{type:Boolean},required:{type:Boolean},name:{}},emits:["update:checked","change","blur","focus"],setup(a,{emit:v}){const n=l.getBemBlock("checkbox"),t=a,s=B({}),u=v,f=e.useSlots(),i=e.ref(t.checked??!1);e.watch(()=>t.checked,()=>{i.value=t.checked??!1});const c=e.computed({get(){var o;return(o=s.model)!=null&&o.value?t.value!==void 0&&s.model.value.includes(t.value):t.checked!==void 0?t.checked:i.value},set(o){var d;if((d=s.model)!=null&&d.value){if(t.value!==void 0){const m=s.model.value.indexOf(t.value);o&&m===-1?s.model.value=[...s.model.value,t.value]:!o&&m!==-1&&(s.model.value=s.model.value.filter(E=>E!==t.value))}}else t.checked===void 0&&(i.value=o),u("update:checked",o),u("change",o)}}),b=e.computed(()=>t.id??L.usePCId(n)),p=e.computed(()=>{var o;return{disabled:((o=s.disabled)==null?void 0:o.value)??t.disabled,...T.value,...V.omit(t,"size","class","label","disabled","checked","id","rootCls","indicatorCls","indeterminateCls","labelCls")}}),k=G.cva(n,{variants:{size:l.generateVariantClassList(g,n)}}),_=e.computed(()=>t.label||f.default||t.value&&t.valueAsLabel),y=e.computed(()=>{if(t.label)return t.label;if(t.value&&t.valueAsLabel)return t.value}),C=e.computed(()=>{var o;return((o=s.size)==null?void 0:o.value)??t.size}),q=e.computed(()=>{switch(C.value){case"xsm":return"2xsm";case"2xsm":default:return"3xsm"}}),{rootBindings:S,inputBindings:T}=w.UseInputDataStates({getDisabled:()=>{var o;return((o=s.disabled)==null?void 0:o.value)??t.disabled},emit:u});return(o,d)=>(e.openBlock(),e.createElementBlock("div",e.mergeProps({class:[e.unref(l.getBemElement)(e.unref(n),"root"),o.rootCls]},e.unref(S)),[e.createVNode(e.unref(h.CheckboxRoot),e.mergeProps(p.value,{checked:c.value,"onUpdate:checked":d[0]||(d[0]=m=>c.value=m),id:b.value,class:[e.unref(k)({size:C.value}),t.class]}),{default:e.withCtx(()=>[e.createVNode(e.unref(h.CheckboxIndicator),{class:e.normalizeClass([e.unref(l.getBemElement)(e.unref(n),"indicator"),o.indicatorCls]),asChild:""},{default:e.withCtx(()=>[t.checked!="indeterminate"?(e.openBlock(),e.createBlock(P._sfc_main,{key:0,icon:"tabler:check",size:q.value},null,8,["size"])):(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass([e.unref(l.getBemElement)(e.unref(n),"indeterminate"),o.indeterminateCls])},null,2))]),_:1},8,["class"])]),_:1},16,["checked","id","class"]),_.value?(e.openBlock(),e.createElementBlock("label",{key:0,for:b.value,class:e.normalizeClass([e.unref(l.getBemElement)(e.unref(n),"label"),o.labelCls])},[e.renderSlot(o.$slots,"default",{checked:o.checked,disabled:o.disabled,required:o.required},()=>[e.createTextVNode(e.toDisplayString(y.value),1)])],10,D)):e.createCommentVNode("",!0)],16))}});exports.CheckboxSizes=g;exports._sfc_main=z;exports._sfc_main$1=A;exports.injectCheckboxGroupContext=B;exports.provideCheckboxGroupContext=$;exports.useColoredPantographCheckbox=I;exports.useColoredPantographCheckboxGroup=N;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CheckboxSize } from '../Checkbox/Checkbox.model';
|
|
2
|
-
import { PrimitiveProps } from 'radix-vue';
|
|
3
2
|
import { ComputedRef, Ref } from 'vue';
|
|
4
3
|
export interface CheckboxGroupOption {
|
|
5
4
|
value?: string;
|
|
@@ -7,7 +6,7 @@ export interface CheckboxGroupOption {
|
|
|
7
6
|
label?: string;
|
|
8
7
|
}
|
|
9
8
|
type Value = (number | string)[];
|
|
10
|
-
export type CheckboxGroupProps =
|
|
9
|
+
export type CheckboxGroupProps = {
|
|
11
10
|
value?: Value;
|
|
12
11
|
size?: CheckboxSize;
|
|
13
12
|
disabled?: boolean;
|
|
@@ -26,9 +25,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<Ch
|
|
|
26
25
|
}, string, import('vue').PublicProps, Readonly<CheckboxGroupProps> & Readonly<{
|
|
27
26
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
28
27
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
29
|
-
}>, {
|
|
30
|
-
asChild: boolean;
|
|
31
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
|
|
28
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
|
|
32
29
|
default?(_: {}): any;
|
|
33
30
|
}>;
|
|
34
31
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../Checkbox.vue_vue_type_style_index_0_lang-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../Checkbox.vue_vue_type_style_index_0_lang-D0sF0-hW.js");exports.CheckboxGroup=e._sfc_main$1;exports.injectCheckboxGroupContext=e.injectCheckboxGroupContext;exports.provideCheckboxGroupContext=e.provideCheckboxGroupContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../ColorPicker.vue_vue_type_style_index_0_lang-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../ColorPicker.vue_vue_type_style_index_0_lang-B1Rst4Q9.js");exports.ColorPicker=e._sfc_main;exports.default=e._sfc_main;exports.injectColorPickerContext=e.injectColorPickerContext;exports.provideColorPickerContext=e.provideColorPickerContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o=require("vue"),ae=require("./ActionButton.vue_vue_type_script_setup_true_lang-BVtP6mpl.js"),U=require("./Input.vue_vue_type_style_index_0_lang-D0zx-hd_.js"),ie=require("./Icon.vue_vue_type_style_index_0_lang-BvHCdzZP.js"),j=require("@vueuse/core"),x=require("./class-CjZYGZDW.js"),fe=require("radix-vue");function A(e,t,r){return Math.max(t,Math.min(e,r))}function me(e,t){if(typeof e=="string"||typeof t=="string")return e===t;if(e){if(!t)return!1;for(const r in e)if(e[r]!==t[r])return!1}return!0}function H(e){const t=[],r=e.length>5?2:1;for(let n=1;n<e.length;n+=r){const c=e.substring(n,n+r).repeat(r%2+1),a=parseInt(c,16);t.push(n===3*r+1?a/255:a)}return t.length===3&&t.push(1),{r:t[0],g:t[1],b:t[2],a:t[3]}}function J(e){const t=e.l/100,r=t+e.s/100*Math.min(t,1-t),n=r===0?0:200*(1-t/r);return{h:e.h,s:n,v:r*100,a:e.a}}function L(e){let t=e.h%360;t<0&&(t+=360);const r=e.s/100,n=e.l/100;return{r:$(0,t,r,n)*255,g:$(8,t,r,n)*255,b:$(4,t,r,n)*255,a:e.a}}function $(e,t,r,n){const c=(e+t/30)%12,a=r*Math.min(n,1-n);return n-a*Math.max(-1,Math.min(c-3,9-c,1))}function Q(e){const t=e.s/100,r=e.v/100,n=r*(1-t/2);return{h:e.h,s:n===0||n===1?0:(r-n)/Math.min(n,1-n)*100,l:n*100,a:e.a}}function Z(e){return{h:e.h,w:e.v*(100-e.s)/100,b:100-e.v,a:e.a}}function N(e){return L(Q(e))}function k(e){const t=e.w/100,r=e.b/100;let n,c;const a=t+r;return a>=1?(n=0,c=t/a):(c=1-r,n=(1-t/c)*100),{h:e.h,s:n,v:c*100,a:e.a}}function I(e){const{r:t,g:r,b:n,a:c}=e,a=Math.min(t,r,n),h=Math.max(t,r,n),m=h-a,d=(h+a)/2;let v=0;m!==0&&(h===t?v=(r-n)/m+(r<n?6:0):h===r?v=(n-t)/m+2:h===n&&(v=(t-r)/m+4),v*=60);let b=0;return d!==0&&d!==255&&(b=(h-d)/Math.min(d,255-d)),{h:v,s:b*100,l:d/255*100,a:c}}function S(e){return"#"+Object.values(e).map((t,r)=>Math.round(r===3?t*255:t).toString(16).padStart(2,"0")).join("")}function M(e){return Z(J(I(e)))}const he={hex:{hex:e=>e,hsl:e=>I(H(e)),hsv:e=>k(M(H(e))),hwb:e=>M(H(e)),rgb:H},hsl:{hex:e=>S(L(e)),hsl:e=>e,hsv:J,hwb:e=>M(L(e)),rgb:L},hsv:{hex:e=>S(N(e)),hsl:Q,hsv:e=>e,hwb:Z,rgb:N},hwb:{hex:e=>S(N(k(e))),hsl:e=>I(N(k(e))),hsv:k,hwb:e=>e,rgb:e=>N(k(e))},rgb:{hex:S,hsl:I,hsv:e=>k(M(e)),hwb:M,rgb:e=>e}};function Y(e,t,r){return he[e][t](r)}function de(e,t){const r=e.toFixed(t);return r.includes(".")?r.replace(/\.?0+$/,""):r}const pe={deg:1,grad:.9,rad:180/Math.PI,turn:360},R={from(e){return e.endsWith("%")?E.from(e,{referenceValue:1}):y.from(e,{min:0,max:1})},to(e){return y.to(e)}},K={from(e){const t=e.match(/deg|g?rad|turn$/);if(t===null)return y.from(e);const r=t[0];return y.from(e.slice(0,-r.length))*pe[r]},to(e){return y.to(e)}},y={from(e,{min:t=Number.NEGATIVE_INFINITY,max:r=Number.POSITIVE_INFINITY}={}){return e.endsWith(".")?NaN:A(Number(e),t,r)},to(e){return de(e,2)}},E={from(e,{referenceValue:t=100,min:r=0,max:n=100}={}){return e.endsWith("%")?y.from(e.slice(0,-1),{min:r,max:n})*t/100:NaN},to(e){return y.to(e)+"%"}},z={from(e){return e.endsWith("%")?E.from(e,{referenceValue:255}):y.from(e,{min:0,max:255})},to(e){return y.to(e)}},ve={hsl:{h:K,s:E,l:E},hwb:{h:K,w:E,b:E},rgb:{r:z,g:z,b:z}};function F(e,t){return ve[e][t]}function O({format:e,color:t},r){if(e==="hex")return r&&[5,9].includes(t.length)?t.substring(0,t.length-(t.length-1)/4):t;const n=Object.entries(t).slice(0,r?3:4).map(([c,a])=>{const h=c==="a"?R:F(e,c);return(c==="a"?"/ ":"")+h.to(a)});return`${e}(${n.join(" ")})`}function ee(e){return/^#(?:(?:[A-F0-9]{2}){3,4}|[A-F0-9]{3,4})$/i.test(e)}function ge(e){return"r"in e?"rgb":"w"in e?"hwb":"v"in e?"hsv":"s"in e?"hsl":null}const G={hsl:["h","s","l","a"],hwb:["h","w","b","a"],rgb:["r","g","b","a"]};function X(e){if(!e)return null;if(typeof e!="string"){const m=ge(e);return m===null?null:{format:m,color:e}}if(e.startsWith("#"))return ee(e)?{format:"hex",color:e}:null;if(!e.includes("(")){const m=document.createElement("canvas").getContext("2d");m.fillStyle=e;const d=m.fillStyle;return d==="#000000"&&e!=="black"?null:{format:"hex",color:d}}const[t,r]=e.split("("),n=t.substring(0,3);if(!(n in G))return null;const c=r.replace(/[,/)]/g," ").replace(/\s+/g," ").trim().split(" ");c.length===3&&c.push("1");const a=G[n],h=Object.fromEntries(a.map((m,d)=>{const v=m==="a"?R:F(n,m);return[m,v.from(c[d])]}));return{format:n,color:h}}const be=typeof window<"u",te=be&&"EyeDropper"in window,we=e=>{const t=new AbortController;o.onUnmounted(()=>t.abort());async function r(){if(!te)return;const n=new window.EyeDropper;try{let a=(await n.open({signal:t.signal})).sRGBHex;if(a.startsWith("rgba")){const h=a.match(/rgba?\((?<r>\d+), (?<g>\d+), (?<b>\d+), (?<a>[\d.]+)\)/);if(h){const[m,d,v,b,i]=h;a=`rgba(${d}, ${v}, ${b}, ${parseFloat(i)===0?"1":i})`}}e(a)}catch(c){console.log("e ===>",c)}}return{openEyeDropper:r,abortController:t}};function ye(e,t,r){const n=e.getBoundingClientRect(),c=t-n.left,a=r-n.top;return{x:n.width===0?0:A(c/n.width*100,0,100),y:n.height===0?0:A((1-a/n.height)*100,0,100)}}const xe=o.defineComponent({__name:"ColorPickerSpace",setup(e){const t=ne();let r=!1,n;function c(i){n=document.body.style.userSelect,document.body.style.userSelect="none",r=!0,m(i)}function a(i){r=!0,d(i)}function h(){document.body.style.userSelect=n,r=!1}function m(i){i.buttons!==1||!r||!(t.colorSpace.value instanceof HTMLElement)||v(t.colorSpace.value,i.clientX,i.clientY)}function d(i){if(!r||!(t.colorSpace.value instanceof HTMLElement))return;i.preventDefault();const g=i.touches[0];v(t.colorSpace.value,g.clientX,g.clientY)}function v(i,g,_){const C=ye(i,g,_),f={...t.colors.hsv};f.s=C.x,f.v=C.y,t.setColor("hsv",f)}function b(i){if(!["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"].includes(i.key))return;i.preventDefault();const g=["ArrowLeft","ArrowDown"].includes(i.key)?-1:1,_=["ArrowLeft","ArrowRight"].includes(i.key)?"s":"v",C=i.shiftKey?10:1,f=t.colors.hsv[_]+g*C,w={...t.colors.hsv};w[_]=A(f,0,100),t.setColor("hsv",w)}return o.onMounted(()=>{document.addEventListener("mousemove",m,{passive:!1}),document.addEventListener("touchmove",d,{passive:!1}),document.addEventListener("mouseup",h),document.addEventListener("touchend",h)}),o.onBeforeUnmount(()=>{document.removeEventListener("mousemove",m),document.removeEventListener("touchmove",d),document.removeEventListener("mouseup",h),document.removeEventListener("touchend",h)}),(i,g)=>(o.openBlock(),o.createElementBlock("div",{ref:o.unref(t).colorSpace,class:o.normalizeClass([o.unref(x.getBemElement)(o.unref(V),"space")]),onMousedown:c,onTouchstart:a},[o.createElementVNode("button",{ref:o.unref(t).thumb,class:o.normalizeClass([o.unref(x.getBemElement)(o.unref(V),"thumb")]),tabindex:"0","aria-label":"Color space thumb",onKeydown:b},null,34)],34))}}),Ce=["value"],_e=["value"],[ne,oe]=fe.createContext("ColorPicker"),V=x.getBemBlock("color_picker"),ke=o.defineComponent({__name:"ColorPicker",props:{class:{},color:{},defaultColor:{default:"#ffffffff"},format:{},defaultFormat:{default:"hex"},hideAlpha:{type:Boolean}},emits:["update:color","update:format","change"],setup(e,{emit:t}){const r=["hex","hsl","hsv","hwb","rgb"],n=e,c=t,a=o.ref(null),h=o.ref(null),m=o.ref(null),d=j.useVModel(n,"format",c,{defaultValue:n.defaultFormat,passive:n.format===void 0}),v=o.computed(()=>d.value&&r.includes(d.value)?d.value:"hex"),b=j.useVModel(n,"color",c,{defaultValue:n.defaultColor,passive:n.color===void 0}),i="#ffffffff",g=o.computed(()=>b.value??n.defaultColor??i);o.watch(g,D);const _=o.computed(()=>{const u=v.value,s=f[u];return u.split("").map(l=>{const p=s[l];return{value:F(u,l).to(p),channel:l,label:l.toUpperCase()}}).concat(n.hideAlpha?[]:[{value:R.to(s.a),channel:"a",label:"Alpha"}])}),C=o.computed({get(){return n.hideAlpha&&[5,9].includes(f.hex.length)?f.hex.substring(0,f.hex.length-(f.hex.length-1)/4):f.hex},set(u){ee(u)&&w("hex",u)}}),f=o.reactive({hex:i,hsl:{h:0,s:0,l:100,a:1},hsv:{h:0,s:0,v:100,a:1},hwb:{h:0,w:100,b:0,a:1},rgb:{r:255,g:255,b:255,a:1}});function w(u,s){let l=s;if(n.hideAlpha)if(typeof s!="string")s.a=1,l=s;else if([5,9].includes(s.length)){const p=(s.length-1)/4;l=s.substring(0,s.length-p)+"f".repeat(p)}else[4,7].includes(s.length)&&(l=s+"f".repeat((s.length-1)/3));if(!me(f[u],l)){f[u]=l;for(const p of r)p!==u&&(f[p]=Y(u,p,l));b.value=O({color:Y(u,v.value,l),format:v.value},n.hideAlpha),c("change",ue())}a.value instanceof HTMLElement&&h.value instanceof HTMLElement&&m.value instanceof HTMLElement&&le(a.value,h.value,m.value)}function D(u){const s=X(u);if(s!==null)w(s.format,s.color);else{const l=X(i);l!==null&&w(l.format,l.color)}}function re(u){d.value=u}function W(u,s){const l=u.currentTarget,p={...f.hsv};p[s]=Number(l.value),w("hsv",p)}function se(u,s){const l=v.value,p={...f[l]},P=(s==="a"?R:F(l,s)).from(u);Number.isNaN(u)||u===void 0||(p[s]=P,w(l,p))}function le(u,s,l){const p=O({format:"hsl",color:f.hsl},!0);u.style.setProperty("--vacp-color",p),s.style.position="relative",s.style.backgroundColor=`hsl(${f.hsl.h} 100% 50%)`,s.style.backgroundImage="linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent)",l.style.boxSizing="border-box",l.style.position="absolute",l.style.left=`${f.hsv.s}%`,l.style.bottom=`${f.hsv.v}%`}function ue(){const u=O({color:f[v.value],format:v.value},n.hideAlpha);return{colors:f,cssColor:u}}function q(u){if(!["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"].includes(u.key)||!u.shiftKey)return;const s=u.currentTarget,l=Number(s.step),p=["ArrowLeft","ArrowDown"].includes(u.key)?-1:1,T=Number(s.value)+p*l*10,P=A(T,Number(s.min),Number(s.max));s.value=String(P-p*l)}const{openEyeDropper:ce}=we(D);o.onMounted(()=>D(g.value)),oe({colorSpace:h,thumb:m,colors:f,setColor:w});const B=x.getBemElement(V,"slider");return(u,s)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"colorPicker",ref:a,class:o.normalizeClass([o.unref(V),n.class])},[o.createVNode(xe),o.createElementVNode("div",{class:o.normalizeClass(o.unref(x.getBemElement)(o.unref(V),"sliders"))},[o.createElementVNode("input",{class:o.normalizeClass([o.unref(B),o.unref(x.getBemModifier)(o.unref(B),"hue")]),value:f.hsv.h,type:"range",min:"0",max:"360",step:"1",onKeydownPassive:q,onInput:s[0]||(s[0]=l=>W(l,"h"))},null,42,Ce),u.hideAlpha?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("input",{key:0,class:o.normalizeClass([o.unref(B),o.unref(x.getBemModifier)(o.unref(B),"alpha")]),value:f.hsv.a,type:"range",min:"0",max:"1",step:"0.01",onKeydownPassive:q,onInput:s[1]||(s[1]=l=>W(l,"a"))},null,42,_e))],2),o.createElementVNode("div",{class:o.normalizeClass(o.unref(x.getBemElement)(o.unref(V),"inputs"))},[o.createElementVNode("button",{disabled:!0,class:"fake-select",onClick:s[2]||(s[2]=l=>re("rgb"))},[s[4]||(s[4]=o.createElementVNode("div",null,"Hex",-1)),o.createVNode(ie._sfc_main,{icon:"tabler:chevron-down",size:"2xsm",class:"fake-select-icon"})]),v.value==="hex"?(o.openBlock(),o.createBlock(U._sfc_main,{key:0,class:"flex-1",size:"sm",modelValue:C.value,"onUpdate:modelValue":s[3]||(s[3]=l=>C.value=l)},null,8,["modelValue"])):(o.openBlock(!0),o.createElementBlock(o.Fragment,{key:1},o.renderList(_.value,({value:l,channel:p})=>(o.openBlock(),o.createBlock(U._sfc_main,{modelValue:l,"onUpdate:modelValue":T=>se(T,p),size:"sm"},null,8,["modelValue","onUpdate:modelValue"]))),256)),o.unref(te)?(o.openBlock(),o.createBlock(ae._sfc_main,{key:2,onClick:o.unref(ce),icon:"tabler:color-picker",size:"sm",type:"outline",variant:"icon"},null,8,["onClick"])):o.createCommentVNode("",!0)],2)],2))}});exports._sfc_main=ke;exports.injectColorPickerContext=ne;exports.provideColorPickerContext=oe;
|
|
1
|
+
"use strict";const o=require("vue"),ae=require("./ActionButton.vue_vue_type_script_setup_true_lang-DYj83ijm.js"),U=require("./Input.vue_vue_type_style_index_0_lang-DVN491cI.js"),ie=require("./Icon.vue_vue_type_style_index_0_lang-BvHCdzZP.js"),j=require("@vueuse/core"),x=require("./class-CjZYGZDW.js"),fe=require("radix-vue");function A(e,t,r){return Math.max(t,Math.min(e,r))}function me(e,t){if(typeof e=="string"||typeof t=="string")return e===t;if(e){if(!t)return!1;for(const r in e)if(e[r]!==t[r])return!1}return!0}function H(e){const t=[],r=e.length>5?2:1;for(let n=1;n<e.length;n+=r){const c=e.substring(n,n+r).repeat(r%2+1),a=parseInt(c,16);t.push(n===3*r+1?a/255:a)}return t.length===3&&t.push(1),{r:t[0],g:t[1],b:t[2],a:t[3]}}function J(e){const t=e.l/100,r=t+e.s/100*Math.min(t,1-t),n=r===0?0:200*(1-t/r);return{h:e.h,s:n,v:r*100,a:e.a}}function L(e){let t=e.h%360;t<0&&(t+=360);const r=e.s/100,n=e.l/100;return{r:$(0,t,r,n)*255,g:$(8,t,r,n)*255,b:$(4,t,r,n)*255,a:e.a}}function $(e,t,r,n){const c=(e+t/30)%12,a=r*Math.min(n,1-n);return n-a*Math.max(-1,Math.min(c-3,9-c,1))}function Q(e){const t=e.s/100,r=e.v/100,n=r*(1-t/2);return{h:e.h,s:n===0||n===1?0:(r-n)/Math.min(n,1-n)*100,l:n*100,a:e.a}}function Z(e){return{h:e.h,w:e.v*(100-e.s)/100,b:100-e.v,a:e.a}}function N(e){return L(Q(e))}function k(e){const t=e.w/100,r=e.b/100;let n,c;const a=t+r;return a>=1?(n=0,c=t/a):(c=1-r,n=(1-t/c)*100),{h:e.h,s:n,v:c*100,a:e.a}}function I(e){const{r:t,g:r,b:n,a:c}=e,a=Math.min(t,r,n),h=Math.max(t,r,n),m=h-a,d=(h+a)/2;let v=0;m!==0&&(h===t?v=(r-n)/m+(r<n?6:0):h===r?v=(n-t)/m+2:h===n&&(v=(t-r)/m+4),v*=60);let b=0;return d!==0&&d!==255&&(b=(h-d)/Math.min(d,255-d)),{h:v,s:b*100,l:d/255*100,a:c}}function S(e){return"#"+Object.values(e).map((t,r)=>Math.round(r===3?t*255:t).toString(16).padStart(2,"0")).join("")}function M(e){return Z(J(I(e)))}const he={hex:{hex:e=>e,hsl:e=>I(H(e)),hsv:e=>k(M(H(e))),hwb:e=>M(H(e)),rgb:H},hsl:{hex:e=>S(L(e)),hsl:e=>e,hsv:J,hwb:e=>M(L(e)),rgb:L},hsv:{hex:e=>S(N(e)),hsl:Q,hsv:e=>e,hwb:Z,rgb:N},hwb:{hex:e=>S(N(k(e))),hsl:e=>I(N(k(e))),hsv:k,hwb:e=>e,rgb:e=>N(k(e))},rgb:{hex:S,hsl:I,hsv:e=>k(M(e)),hwb:M,rgb:e=>e}};function Y(e,t,r){return he[e][t](r)}function de(e,t){const r=e.toFixed(t);return r.includes(".")?r.replace(/\.?0+$/,""):r}const pe={deg:1,grad:.9,rad:180/Math.PI,turn:360},R={from(e){return e.endsWith("%")?E.from(e,{referenceValue:1}):y.from(e,{min:0,max:1})},to(e){return y.to(e)}},K={from(e){const t=e.match(/deg|g?rad|turn$/);if(t===null)return y.from(e);const r=t[0];return y.from(e.slice(0,-r.length))*pe[r]},to(e){return y.to(e)}},y={from(e,{min:t=Number.NEGATIVE_INFINITY,max:r=Number.POSITIVE_INFINITY}={}){return e.endsWith(".")?NaN:A(Number(e),t,r)},to(e){return de(e,2)}},E={from(e,{referenceValue:t=100,min:r=0,max:n=100}={}){return e.endsWith("%")?y.from(e.slice(0,-1),{min:r,max:n})*t/100:NaN},to(e){return y.to(e)+"%"}},z={from(e){return e.endsWith("%")?E.from(e,{referenceValue:255}):y.from(e,{min:0,max:255})},to(e){return y.to(e)}},ve={hsl:{h:K,s:E,l:E},hwb:{h:K,w:E,b:E},rgb:{r:z,g:z,b:z}};function F(e,t){return ve[e][t]}function O({format:e,color:t},r){if(e==="hex")return r&&[5,9].includes(t.length)?t.substring(0,t.length-(t.length-1)/4):t;const n=Object.entries(t).slice(0,r?3:4).map(([c,a])=>{const h=c==="a"?R:F(e,c);return(c==="a"?"/ ":"")+h.to(a)});return`${e}(${n.join(" ")})`}function ee(e){return/^#(?:(?:[A-F0-9]{2}){3,4}|[A-F0-9]{3,4})$/i.test(e)}function ge(e){return"r"in e?"rgb":"w"in e?"hwb":"v"in e?"hsv":"s"in e?"hsl":null}const G={hsl:["h","s","l","a"],hwb:["h","w","b","a"],rgb:["r","g","b","a"]};function X(e){if(!e)return null;if(typeof e!="string"){const m=ge(e);return m===null?null:{format:m,color:e}}if(e.startsWith("#"))return ee(e)?{format:"hex",color:e}:null;if(!e.includes("(")){const m=document.createElement("canvas").getContext("2d");m.fillStyle=e;const d=m.fillStyle;return d==="#000000"&&e!=="black"?null:{format:"hex",color:d}}const[t,r]=e.split("("),n=t.substring(0,3);if(!(n in G))return null;const c=r.replace(/[,/)]/g," ").replace(/\s+/g," ").trim().split(" ");c.length===3&&c.push("1");const a=G[n],h=Object.fromEntries(a.map((m,d)=>{const v=m==="a"?R:F(n,m);return[m,v.from(c[d])]}));return{format:n,color:h}}const be=typeof window<"u",te=be&&"EyeDropper"in window,we=e=>{const t=new AbortController;o.onUnmounted(()=>t.abort());async function r(){if(!te)return;const n=new window.EyeDropper;try{let a=(await n.open({signal:t.signal})).sRGBHex;if(a.startsWith("rgba")){const h=a.match(/rgba?\((?<r>\d+), (?<g>\d+), (?<b>\d+), (?<a>[\d.]+)\)/);if(h){const[m,d,v,b,i]=h;a=`rgba(${d}, ${v}, ${b}, ${parseFloat(i)===0?"1":i})`}}e(a)}catch(c){console.log("e ===>",c)}}return{openEyeDropper:r,abortController:t}};function ye(e,t,r){const n=e.getBoundingClientRect(),c=t-n.left,a=r-n.top;return{x:n.width===0?0:A(c/n.width*100,0,100),y:n.height===0?0:A((1-a/n.height)*100,0,100)}}const xe=o.defineComponent({__name:"ColorPickerSpace",setup(e){const t=ne();let r=!1,n;function c(i){n=document.body.style.userSelect,document.body.style.userSelect="none",r=!0,m(i)}function a(i){r=!0,d(i)}function h(){document.body.style.userSelect=n,r=!1}function m(i){i.buttons!==1||!r||!(t.colorSpace.value instanceof HTMLElement)||v(t.colorSpace.value,i.clientX,i.clientY)}function d(i){if(!r||!(t.colorSpace.value instanceof HTMLElement))return;i.preventDefault();const g=i.touches[0];v(t.colorSpace.value,g.clientX,g.clientY)}function v(i,g,_){const C=ye(i,g,_),f={...t.colors.hsv};f.s=C.x,f.v=C.y,t.setColor("hsv",f)}function b(i){if(!["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"].includes(i.key))return;i.preventDefault();const g=["ArrowLeft","ArrowDown"].includes(i.key)?-1:1,_=["ArrowLeft","ArrowRight"].includes(i.key)?"s":"v",C=i.shiftKey?10:1,f=t.colors.hsv[_]+g*C,w={...t.colors.hsv};w[_]=A(f,0,100),t.setColor("hsv",w)}return o.onMounted(()=>{document.addEventListener("mousemove",m,{passive:!1}),document.addEventListener("touchmove",d,{passive:!1}),document.addEventListener("mouseup",h),document.addEventListener("touchend",h)}),o.onBeforeUnmount(()=>{document.removeEventListener("mousemove",m),document.removeEventListener("touchmove",d),document.removeEventListener("mouseup",h),document.removeEventListener("touchend",h)}),(i,g)=>(o.openBlock(),o.createElementBlock("div",{ref:o.unref(t).colorSpace,class:o.normalizeClass([o.unref(x.getBemElement)(o.unref(V),"space")]),onMousedown:c,onTouchstart:a},[o.createElementVNode("button",{ref:o.unref(t).thumb,class:o.normalizeClass([o.unref(x.getBemElement)(o.unref(V),"thumb")]),tabindex:"0","aria-label":"Color space thumb",onKeydown:b},null,34)],34))}}),Ce=["value"],_e=["value"],[ne,oe]=fe.createContext("ColorPicker"),V=x.getBemBlock("color_picker"),ke=o.defineComponent({__name:"ColorPicker",props:{class:{},color:{},defaultColor:{default:"#ffffffff"},format:{},defaultFormat:{default:"hex"},hideAlpha:{type:Boolean}},emits:["update:color","update:format","change"],setup(e,{emit:t}){const r=["hex","hsl","hsv","hwb","rgb"],n=e,c=t,a=o.ref(null),h=o.ref(null),m=o.ref(null),d=j.useVModel(n,"format",c,{defaultValue:n.defaultFormat,passive:n.format===void 0}),v=o.computed(()=>d.value&&r.includes(d.value)?d.value:"hex"),b=j.useVModel(n,"color",c,{defaultValue:n.defaultColor,passive:n.color===void 0}),i="#ffffffff",g=o.computed(()=>b.value??n.defaultColor??i);o.watch(g,D);const _=o.computed(()=>{const u=v.value,s=f[u];return u.split("").map(l=>{const p=s[l];return{value:F(u,l).to(p),channel:l,label:l.toUpperCase()}}).concat(n.hideAlpha?[]:[{value:R.to(s.a),channel:"a",label:"Alpha"}])}),C=o.computed({get(){return n.hideAlpha&&[5,9].includes(f.hex.length)?f.hex.substring(0,f.hex.length-(f.hex.length-1)/4):f.hex},set(u){ee(u)&&w("hex",u)}}),f=o.reactive({hex:i,hsl:{h:0,s:0,l:100,a:1},hsv:{h:0,s:0,v:100,a:1},hwb:{h:0,w:100,b:0,a:1},rgb:{r:255,g:255,b:255,a:1}});function w(u,s){let l=s;if(n.hideAlpha)if(typeof s!="string")s.a=1,l=s;else if([5,9].includes(s.length)){const p=(s.length-1)/4;l=s.substring(0,s.length-p)+"f".repeat(p)}else[4,7].includes(s.length)&&(l=s+"f".repeat((s.length-1)/3));if(!me(f[u],l)){f[u]=l;for(const p of r)p!==u&&(f[p]=Y(u,p,l));b.value=O({color:Y(u,v.value,l),format:v.value},n.hideAlpha),c("change",ue())}a.value instanceof HTMLElement&&h.value instanceof HTMLElement&&m.value instanceof HTMLElement&&le(a.value,h.value,m.value)}function D(u){const s=X(u);if(s!==null)w(s.format,s.color);else{const l=X(i);l!==null&&w(l.format,l.color)}}function re(u){d.value=u}function W(u,s){const l=u.currentTarget,p={...f.hsv};p[s]=Number(l.value),w("hsv",p)}function se(u,s){const l=v.value,p={...f[l]},P=(s==="a"?R:F(l,s)).from(u);Number.isNaN(u)||u===void 0||(p[s]=P,w(l,p))}function le(u,s,l){const p=O({format:"hsl",color:f.hsl},!0);u.style.setProperty("--vacp-color",p),s.style.position="relative",s.style.backgroundColor=`hsl(${f.hsl.h} 100% 50%)`,s.style.backgroundImage="linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent)",l.style.boxSizing="border-box",l.style.position="absolute",l.style.left=`${f.hsv.s}%`,l.style.bottom=`${f.hsv.v}%`}function ue(){const u=O({color:f[v.value],format:v.value},n.hideAlpha);return{colors:f,cssColor:u}}function q(u){if(!["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"].includes(u.key)||!u.shiftKey)return;const s=u.currentTarget,l=Number(s.step),p=["ArrowLeft","ArrowDown"].includes(u.key)?-1:1,T=Number(s.value)+p*l*10,P=A(T,Number(s.min),Number(s.max));s.value=String(P-p*l)}const{openEyeDropper:ce}=we(D);o.onMounted(()=>D(g.value)),oe({colorSpace:h,thumb:m,colors:f,setColor:w});const B=x.getBemElement(V,"slider");return(u,s)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"colorPicker",ref:a,class:o.normalizeClass([o.unref(V),n.class])},[o.createVNode(xe),o.createElementVNode("div",{class:o.normalizeClass(o.unref(x.getBemElement)(o.unref(V),"sliders"))},[o.createElementVNode("input",{class:o.normalizeClass([o.unref(B),o.unref(x.getBemModifier)(o.unref(B),"hue")]),value:f.hsv.h,type:"range",min:"0",max:"360",step:"1",onKeydownPassive:q,onInput:s[0]||(s[0]=l=>W(l,"h"))},null,42,Ce),u.hideAlpha?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("input",{key:0,class:o.normalizeClass([o.unref(B),o.unref(x.getBemModifier)(o.unref(B),"alpha")]),value:f.hsv.a,type:"range",min:"0",max:"1",step:"0.01",onKeydownPassive:q,onInput:s[1]||(s[1]=l=>W(l,"a"))},null,42,_e))],2),o.createElementVNode("div",{class:o.normalizeClass(o.unref(x.getBemElement)(o.unref(V),"inputs"))},[o.createElementVNode("button",{disabled:!0,class:"fake-select",onClick:s[2]||(s[2]=l=>re("rgb"))},[s[4]||(s[4]=o.createElementVNode("div",null,"Hex",-1)),o.createVNode(ie._sfc_main,{icon:"tabler:chevron-down",size:"2xsm",class:"fake-select-icon"})]),v.value==="hex"?(o.openBlock(),o.createBlock(U._sfc_main,{key:0,class:"flex-1",size:"sm",modelValue:C.value,"onUpdate:modelValue":s[3]||(s[3]=l=>C.value=l)},null,8,["modelValue"])):(o.openBlock(!0),o.createElementBlock(o.Fragment,{key:1},o.renderList(_.value,({value:l,channel:p})=>(o.openBlock(),o.createBlock(U._sfc_main,{modelValue:l,"onUpdate:modelValue":T=>se(T,p),size:"sm"},null,8,["modelValue","onUpdate:modelValue"]))),256)),o.unref(te)?(o.openBlock(),o.createBlock(ae._sfc_main,{key:2,onClick:o.unref(ce),icon:"tabler:color-picker",size:"sm",type:"outline",variant:"icon"},null,8,["onClick"])):o.createCommentVNode("",!0)],2)],2))}});exports._sfc_main=ke;exports.injectColorPickerContext=ne;exports.provideColorPickerContext=oe;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { onUnmounted as we, defineComponent as ue, onMounted as ae, onBeforeUnmount as ye, createElementBlock as D, openBlock as C, normalizeClass as T, unref as v, createElementVNode as E, ref as j, computed as R, watch as xe, reactive as Ce, createVNode as Q, createCommentVNode as Z, createBlock as Y, Fragment as Te, renderList as Ve } from "vue";
|
|
2
|
-
import { _ as ke } from "./ActionButton.vue_vue_type_script_setup_true_lang-
|
|
3
|
-
import { _ as ee } from "./Input.vue_vue_type_style_index_0_lang-
|
|
2
|
+
import { _ as ke } from "./ActionButton.vue_vue_type_script_setup_true_lang-B8F78aq-.js";
|
|
3
|
+
import { _ as ee } from "./Input.vue_vue_type_style_index_0_lang-CcR6oCIR.js";
|
|
4
4
|
import { _ as Ee } from "./Icon.vue_vue_type_style_index_0_lang-BfPcw6PU.js";
|
|
5
5
|
import { useVModel as te } from "@vueuse/core";
|
|
6
6
|
import { b as P, g as Me, c as ne } from "./class-DziTeW9B.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GraphicalObjectProps } from '../GraphicalObject/GraphicalObject';
|
|
2
2
|
import { ColorSwatchType, ColorSwatchSize } from './ColorSwatch.model';
|
|
3
|
-
export type ColorSwatchProps =
|
|
3
|
+
export type ColorSwatchProps = GraphicalObjectProps & {
|
|
4
4
|
selected?: boolean;
|
|
5
5
|
size?: ColorSwatchSize;
|
|
6
6
|
type?: ColorSwatchType;
|
|
@@ -14,11 +14,18 @@ export interface ColorSwatchSlots {
|
|
|
14
14
|
value?: string;
|
|
15
15
|
}) => never;
|
|
16
16
|
}
|
|
17
|
-
declare
|
|
17
|
+
declare function __VLS_template(): {
|
|
18
|
+
slots: Readonly<ColorSwatchSlots> & ColorSwatchSlots;
|
|
19
|
+
refs: {};
|
|
20
|
+
attrs: Partial<{}>;
|
|
21
|
+
};
|
|
22
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
23
|
+
declare const __VLS_component: import('vue').DefineComponent<ColorSwatchProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ColorSwatchProps> & Readonly<{}>, {
|
|
18
24
|
size: "sm" | "md";
|
|
19
|
-
type:
|
|
25
|
+
type: ColorSwatchType;
|
|
20
26
|
customPickerIcon: string;
|
|
21
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any
|
|
27
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
22
29
|
export default _default;
|
|
23
30
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
24
31
|
new (): {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as s, C as r, a as t, _ as e } from "../ColorSwatch.vue_vue_type_style_index_0_lang-
|
|
1
|
+
import { _ as s, C as r, a as t, _ as e } from "../ColorSwatch.vue_vue_type_style_index_0_lang-CL9dd69H.js";
|
|
2
2
|
export {
|
|
3
3
|
s as ColorSwatch,
|
|
4
4
|
r as ColorSwatchSizes,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../ColorSwatch.vue_vue_type_style_index_0_lang-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../ColorSwatch.vue_vue_type_style_index_0_lang-BH-NSALx.js");exports.ColorSwatch=e._sfc_main;exports.ColorSwatchSizes=e.ColorSwatchSizes;exports.ColorSwatchTypes=e.ColorSwatchTypes;exports.default=e._sfc_main;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),v=require("./GraphicalObject.vue_vue_type_script_setup_true_lang-CdO2zArd.js"),k=require("./options-B4iSAKol.js"),_=require("./omit-BKPbELUG.js"),r=require("./class-CjZYGZDW.js"),C=require("class-variance-authority"),h=require("./IconButton.vue_vue_type_script_setup_true_lang-c16Xu6mm.js"),c=["sm","md"],l=["color","remover","custom-picker"],z={key:1,height:"100%",width:"100%",viewBox:"0 0 19 18",fill:"none"},f=e.defineComponent({...k.getComponentOptions("ColorTrigger"),__name:"ColorSwatch",props:{class:{},icon:{},fg:{},bg:{},br:{},size:{default:"md"},selected:{type:Boolean},type:{default:"color"},customPickerIcon:{default:"tabler:palette"}},setup(p){const o=p,s=r.getBemBlock("color_swatch"),u=C.cva(s,{variants:{selected:r.generateVariantClassList("selected",s),size:r.generateVariantClassList(c,s),type:r.generateVariantClassList(l,s)}}),n=e.computed(()=>o.size&&c.includes(o.size)?o.size:"md"),m=e.computed(()=>({size:n.value,..._.omit(o,"size","class","type","selected")})),d=e.useSlots(),y=e.computed(()=>{switch(o.type){case"color":return"div";case"custom-picker":return h._sfc_main;case"remover":return"div"}}),g=e.computed(()=>{const t={};return o.type==="custom-picker"&&(t.size=n.value,t.icon=o.customPickerIcon,t.color="gray",t.type="outline"),t});return(t,i)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(y.value),e.mergeProps({class:[e.unref(u)({selected:t.type!=="custom-picker"&&o.selected,size:t.size,type:t.type}),o.class]},g.value),{icon:e.withCtx(()=>[e.renderSlot(t.$slots,"icon",e.normalizeProps(e.guardReactiveProps(o)))]),default:e.withCtx(()=>[t.type==="color"?(e.openBlock(),e.createBlock(v._sfc_main,e.normalizeProps(e.mergeProps({key:0},m.value)),e.createSlots({_:2},[e.renderList(Object.keys(d),a=>({name:a,fn:e.withCtx(()=>[e.renderSlot(t.$slots,a,e.normalizeProps(e.guardReactiveProps(o)))])}))]),1040)):t.type==="remover"?(e.openBlock(),e.createElementBlock("svg",z,i[0]||(i[0]=[e.createElementVNode("path",{id:"Empty Indicator",d:"M17.5 1L1.5 17",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1)]))):e.createCommentVNode("",!0),t.type==="custom-picker"?e.renderSlot(t.$slots,"default",e.normalizeProps(e.mergeProps({key:2},o))):e.createCommentVNode("",!0)]),_:3},16,["class"]))}});exports.ColorSwatchSizes=c;exports.ColorSwatchTypes=l;exports._sfc_main=f;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { defineComponent as B, computed as s, useSlots as S, createBlock as d, openBlock as c, resolveDynamicComponent as _, mergeProps as n, unref as P, withCtx as i, createElementBlock as b, createCommentVNode as f, renderSlot as a, normalizeProps as r, createSlots as $, renderList as E, guardReactiveProps as y, createElementVNode as I } from "vue";
|
|
2
|
+
import { _ as L } from "./GraphicalObject.vue_vue_type_script_setup_true_lang-BEZ6FkRf.js";
|
|
3
|
+
import { g as V } from "./options-JBqnVZUl.js";
|
|
4
|
+
import { o as N } from "./omit-BEkBWXra.js";
|
|
5
|
+
import { g as O, a as l } from "./class-DziTeW9B.js";
|
|
6
|
+
import { cva as T } from "class-variance-authority";
|
|
7
|
+
import { _ as j } from "./IconButton.vue_vue_type_script_setup_true_lang-CchpvdkX.js";
|
|
8
|
+
const g = ["sm", "md"], D = ["color", "remover", "custom-picker"], M = {
|
|
9
|
+
key: 1,
|
|
10
|
+
height: "100%",
|
|
11
|
+
width: "100%",
|
|
12
|
+
viewBox: "0 0 19 18",
|
|
13
|
+
fill: "none"
|
|
14
|
+
}, K = /* @__PURE__ */ B({
|
|
15
|
+
...V("ColorTrigger"),
|
|
16
|
+
__name: "ColorSwatch",
|
|
17
|
+
props: {
|
|
18
|
+
class: {},
|
|
19
|
+
icon: {},
|
|
20
|
+
fg: {},
|
|
21
|
+
bg: {},
|
|
22
|
+
br: {},
|
|
23
|
+
size: { default: "md" },
|
|
24
|
+
selected: { type: Boolean },
|
|
25
|
+
type: { default: "color" },
|
|
26
|
+
customPickerIcon: { default: "tabler:palette" }
|
|
27
|
+
},
|
|
28
|
+
setup(k) {
|
|
29
|
+
const o = k, t = O("color_swatch"), v = T(t, {
|
|
30
|
+
variants: {
|
|
31
|
+
selected: l("selected", t),
|
|
32
|
+
size: l(g, t),
|
|
33
|
+
type: l(D, t)
|
|
34
|
+
}
|
|
35
|
+
}), m = s(
|
|
36
|
+
() => o.size && g.includes(o.size) ? o.size : "md"
|
|
37
|
+
), z = s(() => ({
|
|
38
|
+
size: m.value,
|
|
39
|
+
...N(
|
|
40
|
+
o,
|
|
41
|
+
"size",
|
|
42
|
+
"class",
|
|
43
|
+
"type",
|
|
44
|
+
"selected"
|
|
45
|
+
/*'fg', 'bg', 'br'*/
|
|
46
|
+
)
|
|
47
|
+
})), C = S(), h = s(() => {
|
|
48
|
+
switch (o.type) {
|
|
49
|
+
case "color":
|
|
50
|
+
return "div";
|
|
51
|
+
case "custom-picker":
|
|
52
|
+
return j;
|
|
53
|
+
case "remover":
|
|
54
|
+
return "div";
|
|
55
|
+
}
|
|
56
|
+
}), w = s(() => {
|
|
57
|
+
const e = {};
|
|
58
|
+
return o.type === "custom-picker" && (e.size = m.value, e.icon = o.customPickerIcon, e.color = "gray", e.type = "outline"), e;
|
|
59
|
+
});
|
|
60
|
+
return (e, p) => (c(), d(_(h.value), n({
|
|
61
|
+
class: [
|
|
62
|
+
P(v)({
|
|
63
|
+
selected: e.type !== "custom-picker" && o.selected,
|
|
64
|
+
size: e.size,
|
|
65
|
+
type: e.type
|
|
66
|
+
}),
|
|
67
|
+
o.class
|
|
68
|
+
]
|
|
69
|
+
}, w.value), {
|
|
70
|
+
icon: i(() => [
|
|
71
|
+
a(e.$slots, "icon", r(y(o)))
|
|
72
|
+
]),
|
|
73
|
+
default: i(() => [
|
|
74
|
+
e.type === "color" ? (c(), d(L, r(n({ key: 0 }, z.value)), $({ _: 2 }, [
|
|
75
|
+
E(Object.keys(C), (u) => ({
|
|
76
|
+
name: u,
|
|
77
|
+
fn: i(() => [
|
|
78
|
+
a(e.$slots, u, r(y(o)))
|
|
79
|
+
])
|
|
80
|
+
}))
|
|
81
|
+
]), 1040)) : e.type === "remover" ? (c(), b("svg", M, p[0] || (p[0] = [
|
|
82
|
+
I("path", {
|
|
83
|
+
id: "Empty Indicator",
|
|
84
|
+
d: "M17.5 1L1.5 17",
|
|
85
|
+
stroke: "currentColor",
|
|
86
|
+
"stroke-width": "2",
|
|
87
|
+
"stroke-linecap": "round"
|
|
88
|
+
}, null, -1)
|
|
89
|
+
]))) : f("", !0),
|
|
90
|
+
e.type === "custom-picker" ? a(e.$slots, "default", r(n({ key: 2 }, o))) : f("", !0)
|
|
91
|
+
]),
|
|
92
|
+
_: 3
|
|
93
|
+
}, 16, ["class"]));
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
export {
|
|
97
|
+
g as C,
|
|
98
|
+
K as _,
|
|
99
|
+
D as a
|
|
100
|
+
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PrimitiveProps } from 'radix-vue';
|
|
2
1
|
import { Class } from '../types';
|
|
3
2
|
import { ColorSwatchProps, ColorSwatchSlots } from '../ColorSwatch/ColorSwatch';
|
|
4
3
|
import { ColorSwatchSize } from '../ColorSwatch/ColorSwatch.model';
|
|
@@ -10,7 +9,7 @@ interface ColorObject extends Partial<Pick<ColorSwatchProps, 'bg' | 'fg' | 'br'
|
|
|
10
9
|
}
|
|
11
10
|
export type ColorSwatchItem = ColorObject | string;
|
|
12
11
|
type ColorMode = 'subtle' | 'bold';
|
|
13
|
-
export type ColorSwatchGroupProps = Omit<
|
|
12
|
+
export type ColorSwatchGroupProps = Omit<ColorPickerProps, 'class' | 'color' | 'defaultColor'> & Partial<Pick<ColorSwatchProps, 'size' | 'customPickerIcon' | 'icon'>> & {
|
|
14
13
|
class?: Class;
|
|
15
14
|
size?: ColorSwatchSize;
|
|
16
15
|
noRemover?: boolean;
|
|
@@ -33,7 +32,17 @@ export interface ColorSwatchGroupEmits {
|
|
|
33
32
|
(e: 'update:format', value: VisibleColorFormat): void;
|
|
34
33
|
(e: 'update:modelValue', value?: string): void;
|
|
35
34
|
}
|
|
36
|
-
declare
|
|
35
|
+
declare function __VLS_template(): {
|
|
36
|
+
slots: Readonly<ColorSwatchSlots & {
|
|
37
|
+
header: () => never;
|
|
38
|
+
}> & ColorSwatchSlots & {
|
|
39
|
+
header: () => never;
|
|
40
|
+
};
|
|
41
|
+
refs: {};
|
|
42
|
+
attrs: Partial<{}>;
|
|
43
|
+
};
|
|
44
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
45
|
+
declare const __VLS_component: import('vue').DefineComponent<ColorSwatchGroupProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
37
46
|
"update:modelValue": (value?: string | undefined) => any;
|
|
38
47
|
"update:format": (value: VisibleColorFormat) => any;
|
|
39
48
|
}, string, import('vue').PublicProps, Readonly<ColorSwatchGroupProps> & Readonly<{
|
|
@@ -42,16 +51,13 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<Co
|
|
|
42
51
|
}>, {
|
|
43
52
|
size: "sm" | "md";
|
|
44
53
|
colorMode: ColorMode | {
|
|
45
|
-
fg?: ColorMode
|
|
46
|
-
bg?: ColorMode
|
|
47
|
-
br?: ColorMode
|
|
54
|
+
fg?: ColorMode;
|
|
55
|
+
bg?: ColorMode;
|
|
56
|
+
br?: ColorMode;
|
|
48
57
|
value: ColorMode;
|
|
49
58
|
};
|
|
50
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any
|
|
51
|
-
|
|
52
|
-
}> & ColorSwatchSlots & {
|
|
53
|
-
header: () => never;
|
|
54
|
-
}>;
|
|
59
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
60
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
55
61
|
export default _default;
|
|
56
62
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
57
63
|
new (): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../ColorSwatchGroup.vue_vue_type_style_index_0_lang-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../ColorSwatchGroup.vue_vue_type_style_index_0_lang-CpgTgIuE.js");exports.ColorSwatchGroup=e._sfc_main;exports.default=e._sfc_main;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),S=require("./options-B4iSAKol.js"),q=require("radix-vue"),i=require("./ColorSwatch.vue_vue_type_style_index_0_lang-BH-NSALx.js"),g=require("./isString-CKmTJsel.js"),m=require("./_flatRest-R59G2N4m.js"),$=require("@vueuse/core"),u=require("./class-CjZYGZDW.js"),j=require("class-variance-authority"),w=require("./omit-BKPbELUG.js"),E=require("./Popover.vue_vue_type_style_index_0_lang-CM8qMFEi.js"),N=require("./ColorPicker.vue_vue_type_style_index_0_lang-B1Rst4Q9.js"),k=require("./pick-C-ap2Lj0.js"),O=e.defineComponent({...S.getComponentOptions("ColorSwatchGroup"),__name:"ColorSwatchGroup",props:{format:{},defaultFormat:{},hideAlpha:{type:Boolean},size:{default:"md"},customPickerIcon:{},icon:{},class:{},noRemover:{type:Boolean},noCustomPicker:{type:Boolean},modelValue:{},headerCls:{},header:{},colorsCls:{},defaultValue:{},colors:{},colorMode:{default:"bold"},popoverProps:{}},emits:["update:format","update:modelValue"],setup(C,{emit:b}){const t=C,_=e.useSlots(),p=b,l=$.useVModel(t,"modelValue",p,{defaultValue:t.defaultValue,passive:t.modelValue===void 0}),y=o=>{if(g.isString(o))return{selected:l.value===o,icon:t.icon,bg:o};if(m.isObject(o))return{...w.omit(o,"value"),icon:o.icon??t.icon,selected:l.value===o.value}},a=u.getBemBlock("color_swatch_group"),h=j.cva(a,{variants:{size:u.generateVariantClassList(i.ColorSwatchSizes,a)}}),f=e.ref(!1),c=o=>m.isObject(o)?o.value:o??void 0,v=o=>{const r=c(o);l.value=r,f.value=!r},d=e.computed(()=>{if(t.colors)return t.colors;const o=["red","orange","yellow","lime","green","sky","blue","violet"];return t.colorMode==="subtle"?o.map(r=>`${r}-subtle`):typeof t.colorMode=="object"&&t.colorMode.value&&(t.colorMode.bg||t.colorMode.br||t.colorMode.fg)?o.map(r=>{const s={value:typeof t.colorMode=="object"&&t.colorMode.value==="subtle"?`${r}-subtle`:r};return typeof t.colorMode=="object"&&t.colorMode.bg&&(s.bg=t.colorMode.bg==="subtle"?`${r}-subtle`:r),typeof t.colorMode=="object"&&t.colorMode.br&&(s.br=t.colorMode.br==="subtle"?`${r}-subtle`:r),typeof t.colorMode=="object"&&t.colorMode.fg&&(s.fg=t.colorMode.fg==="subtle"?`${r}-subtle`:r),s}):o}),P=e.computed(()=>{var o;if(!((o=d.value)!=null&&o.length&&d.value.some(r=>g.isString(r)&&r===l.value||m.isObject(r)&&l.value===r.value)))return l.value}),V=o=>{o&&(l.value=o)},B=q.useEmitAsProps(p),M=e.computed(()=>({...k.pick(B,"onUpdate:format"),...k.pick(t,"format","defaultFormat","hideAlpha")}));return(o,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([t.class,e.unref(h)({size:o.size})])},[_.header||o.header?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([e.unref(u.getBemElement)(e.unref(a),"header"),o.headerCls])},[e.renderSlot(o.$slots,"header",{},()=>[e.createTextVNode(e.toDisplayString(o.header),1)])],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass([e.unref(u.getBemElement)(e.unref(a),"colors"),o.colorsCls])},[o.noRemover?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(i._sfc_main,{key:0,type:"remover",size:o.size,onClick:r[0]||(r[0]=s=>v()),selected:!e.unref(l)&&f.value},null,8,["size","selected"])),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,s=>(e.openBlock(),e.createBlock(i._sfc_main,e.mergeProps({type:"color",size:o.size,icon:o.icon,ref_for:!0},y(s),{key:c(s),onClick:n=>v(s)}),e.createSlots({_:2},[e.renderList(Object.keys(o.$slots),n=>({name:n,fn:e.withCtx(z=>[e.renderSlot(o.$slots,n,e.mergeProps({ref_for:!0},{...z,value:c(s)}))])}))]),1040,["size","icon","onClick"]))),128)),o.noCustomPicker?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(E._sfc_main,e.mergeProps({key:1,trigger:"click","reverse-placement-on-dir":"rtl",placement:"right-start","side-offset":4},o.popoverProps||{}),{content:e.withCtx(()=>[e.createVNode(N._sfc_main,e.mergeProps({defaultColor:P.value,"onUpdate:color":V},M.value),null,16,["defaultColor"])]),default:e.withCtx(()=>[e.createVNode(i._sfc_main,{type:"custom-picker",size:o.size,customPickerIcon:o.customPickerIcon},e.createSlots({_:2},[e.renderList(Object.keys(o.$slots),s=>({name:s,fn:e.withCtx(n=>[e.renderSlot(o.$slots,s,e.normalizeProps(e.guardReactiveProps(n)))])}))]),1032,["size","customPickerIcon"])]),_:3},16))],2)],2))}});exports._sfc_main=O;
|