@feedmepos/mf-brand-app-builder 0.5.22-dev.1 → 0.5.23-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-D5eO5srB.js → App-BRIDkK5d.js} +5 -5
- package/dist/{AssetsSettings-D_E8q7eK.js → AssetsSettings-DhprCc4v.js} +6 -6
- package/dist/{BaDivider-DWZv3fqi.js → BaDivider-Cp9gfB4r.js} +2 -2
- package/dist/{BrandkitView-BlJhBYi6.js → BrandkitView-DzLVTHjo.js} +2150 -1931
- package/dist/{BuilderView-Dfl1VhES.js → BuilderView-BwXnOIit.js} +427 -444
- package/dist/{ButtonGroup-D_HkX122.js → ButtonGroup-2ilMTPHH.js} +2 -2
- package/dist/{CircularProgress-h90pbjU3.js → CircularProgress-DdblYCtV.js} +4 -4
- package/dist/ColorPicker-RKWzhLBO.js +543 -0
- package/dist/{ColorPicker-I6CkNIxt.js → ColorPicker-dVFIiu94.js} +14 -14
- package/dist/{Icon.vue_vue_type_style_index_0_lang-CVCHCcWR.js → Icon.vue_vue_type_style_index_0_lang-BcRjQndc.js} +2 -2
- package/dist/{ImageUpload-FyvXrDKK.js → ImageUpload-OqPKnQQI.js} +9 -9
- package/dist/{LinkButton-C9OU3Rcs.js → LinkButton-De-YNclu.js} +4 -4
- package/dist/{ListRepeater-BnVoFhhm.js → ListRepeater-DIlTKjtE.js} +2 -2
- package/dist/{ManagementSettings-CtvF5d9C.js → ManagementSettings-Cz4HkNm1.js} +4 -4
- package/dist/ProjectView-ByxaVBFb.js +428 -0
- package/dist/{Select-BRYuMWoQ.js → Select-DQx6OfZx.js} +9 -9
- package/dist/{SettingsView-DHA7hXUx.js → SettingsView-uft0uKio.js} +2 -2
- package/dist/{StepperField-BeeZ_sl9.js → StepperField-nyaUK9ht.js} +2 -2
- package/dist/{Switch-8mmNQUDo.js → Switch-uc_zN-mb.js} +2 -2
- package/dist/{TextAlign-BOC8ekaH.js → TextAlign-BSp1Xi7F.js} +2 -2
- package/dist/{TextDecorators-BJC4umDR.js → TextDecorators-1C54q7us.js} +4 -4
- package/dist/{TextField-BiVH5rLX.js → TextField-DfBJB6vQ.js} +2 -2
- package/dist/{TextStyleList-CuPE80Py.js → TextStyleList-Bef3irUx.js} +3 -3
- package/dist/{app-CJ2VgCHp.js → app-CY0-wVrG.js} +6513 -3895
- package/dist/app.js +1 -1
- package/dist/brand-core/src/brandkit.d.ts +5 -0
- package/dist/brand-core/src/entity.d.ts +22 -14
- package/dist/client/components/src/components/BranchList.vue.d.ts +1 -1
- package/dist/client/components/src/components/ButtonList.vue.d.ts +1 -1
- package/dist/client/components/src/components/CountrySwitcher.vue.d.ts +1 -1
- package/dist/client/components/src/components/Homepage.vue.d.ts +3 -3
- package/dist/client/components/src/components/ImageCarousel.vue.d.ts +1 -1
- package/dist/client/components/src/components/ImageDisplay.vue.d.ts +1 -1
- package/dist/client/components/src/components/Member/TransactionList.vue.d.ts +1 -1
- package/dist/client/components/src/components/MemberCard.vue.d.ts +1 -1
- package/dist/client/components/src/components/NavigationBar.vue.d.ts +4 -4
- package/dist/client/components/src/components/OrderHistoryCard.vue.d.ts +4 -3
- package/dist/client/components/src/components/OrderMethod.vue.d.ts +1 -1
- package/dist/client/components/src/components/TextDisplay.vue.d.ts +1 -1
- package/dist/client/components/src/components/atoms/Button.vue.d.ts +4 -4
- package/dist/client/components/src/components/atoms/CircularProgress.vue.d.ts +2 -2
- package/dist/client/components/src/components/atoms/Container.vue.d.ts +3 -3
- package/dist/client/components/src/components/atoms/Divider.vue.d.ts +1 -1
- package/dist/client/components/src/components/atoms/Icon.vue.d.ts +1 -1
- package/dist/client/components/src/components/atoms/LinkSlot.vue.d.ts +4 -4
- package/dist/client/components/src/views/OrderDetails.vue.d.ts +1 -1
- package/dist/client/components/src/views/_Credit.vue.d.ts +1 -1
- package/dist/client/components/src/views/_MemberProfile.vue.d.ts +4 -4
- package/dist/client/components/src/views/_Point.vue.d.ts +1 -1
- package/dist/client/components/src/views/_Referral.vue.d.ts +4 -4
- package/dist/client/components/src/views/_ReferralTutorial.vue.d.ts +4 -4
- package/dist/client/merchant/src/api/business/index.d.ts +41 -1
- package/dist/client/merchant/src/app.d.ts +2614 -0
- package/dist/client/merchant/src/components/atoms/BaButtonGroup.vue.d.ts +1 -1
- package/dist/client/merchant/src/components/atoms/BaDivider.vue.d.ts +1 -1
- package/dist/client/merchant/src/components/brandkit/ColorSelection.vue.d.ts +1 -1
- package/dist/client/merchant/src/components/editor/Editor.vue.d.ts +1 -1
- package/dist/client/merchant/src/components/editor/EditorFloatingToobar.vue.d.ts +1 -1
- package/dist/client/merchant/src/components/editor/toolbar/EditorToolbar.vue.d.ts +1 -1
- package/dist/client/merchant/src/components/element-sidebar/ElementSidebar.vue.d.ts +1 -1
- package/dist/client/merchant/src/components/inputs/ColorPicker.vue.d.ts +1 -1
- package/dist/client/merchant/src/components/inputs/ImageUpload.vue.d.ts +1 -1
- package/dist/client/merchant/src/components/inputs/TextAlign.vue.d.ts +1 -1
- package/dist/client/merchant/src/components/inputs/TextDecorators.vue.d.ts +1 -1
- package/dist/client/merchant/src/components/inputs/TextStyleList.vue.d.ts +1 -1
- package/dist/client/merchant/src/components/inspector/Inspector.vue.d.ts +1 -1
- package/dist/client/merchant/src/components/inspector/atoms/ConfigSection.vue.d.ts +3 -3
- package/dist/client/merchant/src/components/inspector/atoms/ConfigTab.vue.d.ts +3 -3
- package/dist/client/merchant/src/components/inspector/atoms/ConfigTabItem.vue.d.ts +3 -3
- package/dist/client/merchant/src/components/inspector/atoms/ConfigTabTitle.vue.d.ts +1 -1
- package/dist/client/merchant/src/components/navigation-sidebar/NavigationSidebar.vue.d.ts +1 -1
- package/dist/client/merchant/src/components/order-template/LayoutTemplateSection.vue.d.ts +3 -3
- package/dist/client/merchant/src/components/order-template/OrderTemplateEditorButton.vue.d.ts +1 -1
- package/dist/client/merchant/src/components/order-template/OrderTemplateEditorForm.vue.d.ts +1 -1
- package/dist/client/merchant/src/components/order-template/TemplateVersionHistory.vue.d.ts +18 -0
- package/dist/client/merchant/src/components/settings/AssetsSettings.vue.d.ts +1 -1
- package/dist/client/merchant/src/components/settings/ManagementSettings.vue.d.ts +1 -1
- package/dist/client/merchant/src/components/template/TemplatePreview.vue.d.ts +1 -1
- package/dist/client/merchant/src/stores/business/index.d.ts +145 -13
- package/dist/client/merchant/src/views/BrandkitView.vue.d.ts +1 -1
- package/dist/client/merchant/src/views/BuilderView.vue.d.ts +1 -1
- package/dist/client/merchant/src/views/ProjectView.vue.d.ts +1 -1
- package/dist/client/merchant/src/views/SettingsView.vue.d.ts +1 -1
- package/dist/dayjs.min-DnbY0e60.js +282 -0
- package/dist/{image-BtHlnsmY.js → image-D_Djf1PS.js} +1 -1
- package/dist/{index-ChMgx2Hq.js → index-Bk6TOZrx.js} +2 -2
- package/dist/{index-5BRydZO9.js → index-C1rSMuKA.js} +1 -1
- package/dist/index-C4vwWvn_.js +112 -0
- package/dist/index-D0LOMBBD.js +1822 -0
- package/dist/{main-8cObQmGm.js → main-DzMHu5qo.js} +3536 -3547
- package/dist/package.json +4 -3
- package/dist/style.css +1 -1
- package/dist/{v4-ANoOI1Qw.js → v4-CKwdnpQf.js} +8 -8
- package/dist/{vue-sonner-PX6Req0V.js → vue-sonner-CBFYmm8_.js} +129 -125
- package/package.json +4 -3
- package/dist/ColorPicker-CHzKbuCD.js +0 -543
- package/dist/ProjectView-Bq0vBJ3V.js +0 -705
- package/dist/index-BEAkOquM.js +0 -90
- package/dist/index-BXwbQwb-.js +0 -1736
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feedmepos/mf-brand-app-builder",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.23-dev.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -15,8 +15,9 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@feedmepos/brand-core": "0.0.2-beta.2",
|
|
18
|
+
"@feedmepos/core": "^2.14.46",
|
|
18
19
|
"@feedmepos/mf-common": "^1.26.3",
|
|
19
|
-
"@feedmepos/ui-library": "1.
|
|
20
|
+
"@feedmepos/ui-library": "1.8.4",
|
|
20
21
|
"@formkit/core": "^1.6.7",
|
|
21
22
|
"@formkit/vue": "^1.6.7",
|
|
22
23
|
"@monaco-editor/loader": "^1.5.0",
|
|
@@ -29,7 +30,7 @@
|
|
|
29
30
|
"pinia": "^2.1.7",
|
|
30
31
|
"qrcode": "^1.5.4",
|
|
31
32
|
"uuid": "^9.0.1",
|
|
32
|
-
"vue": "
|
|
33
|
+
"vue": "3.5.13",
|
|
33
34
|
"vue-accessible-color-picker": "^5.2.0",
|
|
34
35
|
"vue-i18n": "^11.1.3",
|
|
35
36
|
"vue-router": "^4.3.2",
|
|
@@ -1,543 +0,0 @@
|
|
|
1
|
-
import { defineComponent as fe, ref as A, reactive as pe, computed as q, watch as ve, onMounted as de, onBeforeUnmount as me, openBlock as y, createElementBlock as $, createElementVNode as h, renderSlot as L, createTextVNode as G, createCommentVNode as Z, Fragment as ge, renderList as be, toDisplayString as we } from "vue";
|
|
2
|
-
function E(e, n, o) {
|
|
3
|
-
return Math.max(n, Math.min(e, o));
|
|
4
|
-
}
|
|
5
|
-
function xe(e, n) {
|
|
6
|
-
if (typeof e == "string" || typeof n == "string")
|
|
7
|
-
return e === n;
|
|
8
|
-
for (const o in e)
|
|
9
|
-
if (e[o] !== n[o])
|
|
10
|
-
return !1;
|
|
11
|
-
return !0;
|
|
12
|
-
}
|
|
13
|
-
function F(e) {
|
|
14
|
-
const n = [], o = e.length > 5 ? 2 : 1;
|
|
15
|
-
for (let l = 1; l < e.length; l += o) {
|
|
16
|
-
const a = e.substring(l, l + o).repeat(o % 2 + 1), f = parseInt(a, 16);
|
|
17
|
-
n.push(l === 3 * o + 1 ? f / 255 : f);
|
|
18
|
-
}
|
|
19
|
-
return n.length === 3 && n.push(1), {
|
|
20
|
-
r: n[0],
|
|
21
|
-
g: n[1],
|
|
22
|
-
b: n[2],
|
|
23
|
-
a: n[3]
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
function ee(e) {
|
|
27
|
-
const n = e.l / 100, o = n + e.s / 100 * Math.min(n, 1 - n), l = o === 0 ? 0 : 200 * (1 - n / o);
|
|
28
|
-
return {
|
|
29
|
-
h: e.h,
|
|
30
|
-
s: l,
|
|
31
|
-
v: o * 100,
|
|
32
|
-
a: e.a
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
function S(e) {
|
|
36
|
-
let n = e.h % 360;
|
|
37
|
-
n < 0 && (n += 360);
|
|
38
|
-
const o = e.s / 100, l = e.l / 100;
|
|
39
|
-
return {
|
|
40
|
-
r: V(0, n, o, l) * 255,
|
|
41
|
-
g: V(8, n, o, l) * 255,
|
|
42
|
-
b: V(4, n, o, l) * 255,
|
|
43
|
-
a: e.a
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
function V(e, n, o, l) {
|
|
47
|
-
const a = (e + n / 30) % 12, f = o * Math.min(l, 1 - l);
|
|
48
|
-
return l - f * Math.max(-1, Math.min(a - 3, 9 - a, 1));
|
|
49
|
-
}
|
|
50
|
-
function te(e) {
|
|
51
|
-
const n = e.s / 100, o = e.v / 100, l = o * (1 - n / 2);
|
|
52
|
-
return {
|
|
53
|
-
h: e.h,
|
|
54
|
-
s: l === 0 || l === 1 ? 0 : (o - l) / Math.min(l, 1 - l) * 100,
|
|
55
|
-
l: l * 100,
|
|
56
|
-
a: e.a
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
function ne(e) {
|
|
60
|
-
return {
|
|
61
|
-
h: e.h,
|
|
62
|
-
w: e.v * (100 - e.s) / 100,
|
|
63
|
-
b: 100 - e.v,
|
|
64
|
-
a: e.a
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
function N(e) {
|
|
68
|
-
return S(te(e));
|
|
69
|
-
}
|
|
70
|
-
function k(e) {
|
|
71
|
-
const n = e.w / 100, o = e.b / 100;
|
|
72
|
-
let l, a;
|
|
73
|
-
const f = n + o;
|
|
74
|
-
return f >= 1 ? (l = 0, a = n / f) : (a = 1 - o, l = (1 - n / a) * 100), {
|
|
75
|
-
h: e.h,
|
|
76
|
-
s: l,
|
|
77
|
-
v: a * 100,
|
|
78
|
-
a: e.a
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
function j(e) {
|
|
82
|
-
const { r: n, g: o, b: l, a } = e, f = Math.min(n, o, l), d = Math.max(n, o, l), u = d - f, v = (d + f) / 2;
|
|
83
|
-
let m = 0;
|
|
84
|
-
u !== 0 && (d === n ? m = (o - l) / u + (o < l ? 6 : 0) : d === o ? m = (l - n) / u + 2 : d === l && (m = (n - o) / u + 4), m *= 60);
|
|
85
|
-
let p = 0;
|
|
86
|
-
return v !== 0 && v !== 255 && (p = (d - v) / Math.min(v, 255 - v)), {
|
|
87
|
-
h: m,
|
|
88
|
-
s: p * 100,
|
|
89
|
-
l: v / 255 * 100,
|
|
90
|
-
a
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
function T(e) {
|
|
94
|
-
return "#" + Object.values(e).map((n, o) => Math.round(o === 3 ? n * 255 : n).toString(16).padStart(2, "0")).join("");
|
|
95
|
-
}
|
|
96
|
-
function C(e) {
|
|
97
|
-
return ne(ee(j(e)));
|
|
98
|
-
}
|
|
99
|
-
const ye = {
|
|
100
|
-
hex: {
|
|
101
|
-
hex: (e) => e,
|
|
102
|
-
hsl: (e) => j(F(e)),
|
|
103
|
-
hsv: (e) => k(C(F(e))),
|
|
104
|
-
hwb: (e) => C(F(e)),
|
|
105
|
-
rgb: F
|
|
106
|
-
},
|
|
107
|
-
hsl: {
|
|
108
|
-
hex: (e) => T(S(e)),
|
|
109
|
-
hsl: (e) => e,
|
|
110
|
-
hsv: ee,
|
|
111
|
-
hwb: (e) => C(S(e)),
|
|
112
|
-
rgb: S
|
|
113
|
-
},
|
|
114
|
-
hsv: {
|
|
115
|
-
hex: (e) => T(N(e)),
|
|
116
|
-
hsl: te,
|
|
117
|
-
hsv: (e) => e,
|
|
118
|
-
hwb: ne,
|
|
119
|
-
rgb: N
|
|
120
|
-
},
|
|
121
|
-
hwb: {
|
|
122
|
-
hex: (e) => T(N(k(e))),
|
|
123
|
-
hsl: (e) => j(N(k(e))),
|
|
124
|
-
hsv: k,
|
|
125
|
-
hwb: (e) => e,
|
|
126
|
-
rgb: (e) => N(k(e))
|
|
127
|
-
},
|
|
128
|
-
rgb: {
|
|
129
|
-
hex: T,
|
|
130
|
-
hsl: j,
|
|
131
|
-
hsv: (e) => k(C(e)),
|
|
132
|
-
hwb: C,
|
|
133
|
-
rgb: (e) => e
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
function $e(e, n, o) {
|
|
137
|
-
return ye[e][n](o);
|
|
138
|
-
}
|
|
139
|
-
function ke(e, n) {
|
|
140
|
-
const o = e.toFixed(n);
|
|
141
|
-
return o.includes(".") ? o.replace(/\.?0+$/, "") : o;
|
|
142
|
-
}
|
|
143
|
-
const Me = {
|
|
144
|
-
deg: 1,
|
|
145
|
-
grad: 0.9,
|
|
146
|
-
rad: 180 / Math.PI,
|
|
147
|
-
turn: 360
|
|
148
|
-
}, O = {
|
|
149
|
-
from(e) {
|
|
150
|
-
return e.endsWith("%") ? M.from(e, { referenceValue: 1 }) : w.from(e, { min: 0, max: 1 });
|
|
151
|
-
},
|
|
152
|
-
to(e) {
|
|
153
|
-
return w.to(e);
|
|
154
|
-
}
|
|
155
|
-
}, J = {
|
|
156
|
-
from(e) {
|
|
157
|
-
const n = e.match(/deg|g?rad|turn$/);
|
|
158
|
-
if (n === null)
|
|
159
|
-
return w.from(e);
|
|
160
|
-
const o = n[0];
|
|
161
|
-
return w.from(e.slice(0, -o.length)) * Me[o];
|
|
162
|
-
},
|
|
163
|
-
to(e) {
|
|
164
|
-
return w.to(e);
|
|
165
|
-
}
|
|
166
|
-
}, w = {
|
|
167
|
-
from(e, { min: n = Number.NEGATIVE_INFINITY, max: o = Number.POSITIVE_INFINITY } = {}) {
|
|
168
|
-
return e.endsWith(".") ? NaN : E(Number(e), n, o);
|
|
169
|
-
},
|
|
170
|
-
to(e) {
|
|
171
|
-
return ke(e, 2);
|
|
172
|
-
}
|
|
173
|
-
}, M = {
|
|
174
|
-
from(e, { referenceValue: n = 100, min: o = 0, max: l = 100 } = {}) {
|
|
175
|
-
return e.endsWith("%") ? w.from(e.slice(0, -1), { min: o, max: l }) * n / 100 : NaN;
|
|
176
|
-
},
|
|
177
|
-
to(e) {
|
|
178
|
-
return w.to(e) + "%";
|
|
179
|
-
}
|
|
180
|
-
}, _ = {
|
|
181
|
-
from(e) {
|
|
182
|
-
return e.endsWith("%") ? M.from(e, { referenceValue: 255 }) : w.from(e, { min: 0, max: 255 });
|
|
183
|
-
},
|
|
184
|
-
to(e) {
|
|
185
|
-
return w.to(e);
|
|
186
|
-
}
|
|
187
|
-
}, Ne = {
|
|
188
|
-
hsl: {
|
|
189
|
-
h: J,
|
|
190
|
-
s: M,
|
|
191
|
-
l: M
|
|
192
|
-
},
|
|
193
|
-
hwb: {
|
|
194
|
-
h: J,
|
|
195
|
-
w: M,
|
|
196
|
-
b: M
|
|
197
|
-
},
|
|
198
|
-
rgb: {
|
|
199
|
-
r: _,
|
|
200
|
-
g: _,
|
|
201
|
-
b: _
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
function D(e, n) {
|
|
205
|
-
return Ne[e][n];
|
|
206
|
-
}
|
|
207
|
-
function z({ format: e, color: n }, o) {
|
|
208
|
-
if (e === "hex")
|
|
209
|
-
return o && [5, 9].includes(n.length) ? n.substring(0, n.length - (n.length - 1) / 4) : n;
|
|
210
|
-
const l = Object.entries(n).slice(0, o ? 3 : 4).map(([a, f]) => {
|
|
211
|
-
const d = a === "a" ? O : D(e, a);
|
|
212
|
-
return (a === "a" ? "/ " : "") + d.to(f);
|
|
213
|
-
});
|
|
214
|
-
return `${e}(${l.join(" ")})`;
|
|
215
|
-
}
|
|
216
|
-
function re(e) {
|
|
217
|
-
return /^#(?:(?:[A-F0-9]{2}){3,4}|[A-F0-9]{3,4})$/i.test(e);
|
|
218
|
-
}
|
|
219
|
-
function Ce(e) {
|
|
220
|
-
return "r" in e ? "rgb" : "w" in e ? "hwb" : "v" in e ? "hsv" : "s" in e ? "hsl" : null;
|
|
221
|
-
}
|
|
222
|
-
const Q = {
|
|
223
|
-
hsl: ["h", "s", "l", "a"],
|
|
224
|
-
hwb: ["h", "w", "b", "a"],
|
|
225
|
-
rgb: ["r", "g", "b", "a"]
|
|
226
|
-
};
|
|
227
|
-
function Ee(e) {
|
|
228
|
-
if (typeof e != "string") {
|
|
229
|
-
const u = Ce(e);
|
|
230
|
-
return u === null ? null : { format: u, color: e };
|
|
231
|
-
}
|
|
232
|
-
if (e.startsWith("#"))
|
|
233
|
-
return re(e) ? { format: "hex", color: e } : null;
|
|
234
|
-
if (!e.includes("(")) {
|
|
235
|
-
const u = document.createElement("canvas").getContext("2d");
|
|
236
|
-
u.fillStyle = e;
|
|
237
|
-
const v = u.fillStyle;
|
|
238
|
-
return v === "#000000" && e !== "black" ? null : { format: "hex", color: v };
|
|
239
|
-
}
|
|
240
|
-
const [n, o] = e.split("("), l = n.substring(0, 3);
|
|
241
|
-
if (!(l in Q))
|
|
242
|
-
return null;
|
|
243
|
-
const a = o.replace(/[,/)]/g, " ").replace(/\s+/g, " ").trim().split(" ");
|
|
244
|
-
a.length === 3 && a.push("1");
|
|
245
|
-
const f = Q[l], d = Object.fromEntries(f.map((u, v) => {
|
|
246
|
-
const m = u === "a" ? O : D(l, u);
|
|
247
|
-
return [
|
|
248
|
-
u,
|
|
249
|
-
m.from(a[v])
|
|
250
|
-
];
|
|
251
|
-
}));
|
|
252
|
-
return { format: l, color: d };
|
|
253
|
-
}
|
|
254
|
-
function Ie(e, n, o) {
|
|
255
|
-
const l = e.getBoundingClientRect(), a = n - l.left, f = o - l.top;
|
|
256
|
-
return {
|
|
257
|
-
x: l.width === 0 ? 0 : E(a / l.width * 100, 0, 100),
|
|
258
|
-
y: l.height === 0 ? 0 : E((1 - f / l.height) * 100, 0, 100)
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
const Ae = { class: "vacp-range-input-group" }, Le = ["for"], Fe = { class: "vacp-range-input-label-text vacp-range-input-label-text--hue" }, Te = ["id", "value"], Se = ["for"], je = { class: "vacp-range-input-label-text vacp-range-input-label-text--alpha" }, Oe = ["id", "value"], De = { class: "vacp-color-inputs" }, He = { class: "vacp-color-input-group" }, Pe = ["for"], Ve = ["id", "value"], _e = ["id", "for", "onInput"], ze = { class: "vacp-color-input-label-text" }, Ke = ["id", "value", "onInput"], Be = /* @__PURE__ */ fe({
|
|
262
|
-
__name: "ColorPicker",
|
|
263
|
-
props: {
|
|
264
|
-
color: { default: "#ffffffff" },
|
|
265
|
-
copy: { type: Function, default: void 0 },
|
|
266
|
-
id: { default: "color-picker" },
|
|
267
|
-
visibleFormats: { default: () => ["hex", "hsl", "hwb", "rgb"] },
|
|
268
|
-
defaultFormat: { default: "hsl" },
|
|
269
|
-
alphaChannel: { default: "show" }
|
|
270
|
-
},
|
|
271
|
-
emits: ["color-change", "color-copy"],
|
|
272
|
-
setup(e, { expose: n, emit: o }) {
|
|
273
|
-
const l = ["hex", "hsl", "hsv", "hwb", "rgb"], a = e, f = o;
|
|
274
|
-
n({
|
|
275
|
-
copyColor: U
|
|
276
|
-
});
|
|
277
|
-
const d = A(null), u = A(null), v = A(null);
|
|
278
|
-
let m = !1;
|
|
279
|
-
const p = A(a.visibleFormats.includes(a.defaultFormat) ? a.defaultFormat : a.visibleFormats[0]), i = pe({
|
|
280
|
-
hex: "#ffffffff",
|
|
281
|
-
hsl: { h: 0, s: 0, l: 100, a: 1 },
|
|
282
|
-
hsv: { h: 0, s: 0, v: 100, a: 1 },
|
|
283
|
-
hwb: { h: 0, w: 100, b: 0, a: 1 },
|
|
284
|
-
rgb: { r: 255, g: 255, b: 255, a: 1 }
|
|
285
|
-
}), oe = q(function() {
|
|
286
|
-
const r = p.value, t = i[r];
|
|
287
|
-
return r.split("").map((s) => {
|
|
288
|
-
const c = t[s];
|
|
289
|
-
return {
|
|
290
|
-
value: D(r, s).to(c),
|
|
291
|
-
channel: s,
|
|
292
|
-
label: s.toUpperCase()
|
|
293
|
-
};
|
|
294
|
-
}).concat(a.alphaChannel === "show" ? [{
|
|
295
|
-
value: O.to(t.a),
|
|
296
|
-
channel: "a",
|
|
297
|
-
label: "Alpha"
|
|
298
|
-
}] : []);
|
|
299
|
-
}), le = q(function() {
|
|
300
|
-
return a.alphaChannel === "hide" && [5, 9].includes(i.hex.length) ? i.hex.substring(0, i.hex.length - (i.hex.length - 1) / 4) : i.hex;
|
|
301
|
-
});
|
|
302
|
-
ve(() => a.color, W), de(function() {
|
|
303
|
-
document.addEventListener("mousemove", H, { passive: !1 }), document.addEventListener("touchmove", P, { passive: !1 }), document.addEventListener("mouseup", I), document.addEventListener("touchend", I), W(a.color);
|
|
304
|
-
}), me(function() {
|
|
305
|
-
document.removeEventListener("mousemove", H), document.removeEventListener("touchmove", P), document.removeEventListener("mouseup", I), document.removeEventListener("touchend", I);
|
|
306
|
-
});
|
|
307
|
-
function ae() {
|
|
308
|
-
const r = (a.visibleFormats.findIndex((t) => t === p.value) + 1) % a.visibleFormats.length;
|
|
309
|
-
p.value = a.visibleFormats[r];
|
|
310
|
-
}
|
|
311
|
-
function se(r) {
|
|
312
|
-
m = !0, H(r);
|
|
313
|
-
}
|
|
314
|
-
function ce(r) {
|
|
315
|
-
m = !0, P(r);
|
|
316
|
-
}
|
|
317
|
-
function I() {
|
|
318
|
-
m = !1;
|
|
319
|
-
}
|
|
320
|
-
function H(r) {
|
|
321
|
-
r.buttons !== 1 || m === !1 || !(u.value instanceof HTMLElement) || K(u.value, r.clientX, r.clientY);
|
|
322
|
-
}
|
|
323
|
-
function P(r) {
|
|
324
|
-
if (m === !1 || !(u.value instanceof HTMLElement))
|
|
325
|
-
return;
|
|
326
|
-
r.preventDefault();
|
|
327
|
-
const t = r.touches[0];
|
|
328
|
-
K(u.value, t.clientX, t.clientY);
|
|
329
|
-
}
|
|
330
|
-
function K(r, t, s) {
|
|
331
|
-
const c = Ie(r, t, s), g = Object.assign({}, i.hsv);
|
|
332
|
-
g.s = c.x, g.v = c.y, x("hsv", g);
|
|
333
|
-
}
|
|
334
|
-
function ie(r) {
|
|
335
|
-
if (!["ArrowUp", "ArrowRight", "ArrowDown", "ArrowLeft"].includes(r.key))
|
|
336
|
-
return;
|
|
337
|
-
r.preventDefault();
|
|
338
|
-
const t = ["ArrowLeft", "ArrowDown"].includes(r.key) ? -1 : 1, s = ["ArrowLeft", "ArrowRight"].includes(r.key) ? "s" : "v", c = r.shiftKey ? 10 : 1, g = i.hsv[s] + t * c, b = Object.assign({}, i.hsv);
|
|
339
|
-
b[s] = E(g, 0, 100), x("hsv", b);
|
|
340
|
-
}
|
|
341
|
-
function W(r) {
|
|
342
|
-
const t = Ee(r);
|
|
343
|
-
t !== null && x(t.format, t.color);
|
|
344
|
-
}
|
|
345
|
-
function B(r, t) {
|
|
346
|
-
const s = r.currentTarget, c = Object.assign({}, i.hsv);
|
|
347
|
-
c[t] = Number(s.value), x("hsv", c);
|
|
348
|
-
}
|
|
349
|
-
function ue(r) {
|
|
350
|
-
const t = r.target;
|
|
351
|
-
re(t.value) && x("hex", t.value);
|
|
352
|
-
}
|
|
353
|
-
function R(r, t) {
|
|
354
|
-
const s = r.target, c = p.value, g = Object.assign({}, i[c]), b = (t === "a" ? O : D(c, t)).from(s.value);
|
|
355
|
-
Number.isNaN(b) || b === void 0 || (g[t] = b, x(c, g));
|
|
356
|
-
}
|
|
357
|
-
function x(r, t) {
|
|
358
|
-
let s = t;
|
|
359
|
-
if (a.alphaChannel === "hide")
|
|
360
|
-
if (typeof t != "string")
|
|
361
|
-
t.a = 1, s = t;
|
|
362
|
-
else if ([5, 9].includes(t.length)) {
|
|
363
|
-
const c = (t.length - 1) / 4;
|
|
364
|
-
s = t.substring(0, t.length - c) + "f".repeat(c);
|
|
365
|
-
} else [4, 7].includes(t.length) && (s = t + "f".repeat((t.length - 1) / 3));
|
|
366
|
-
if (!xe(i[r], s)) {
|
|
367
|
-
i[r] = s;
|
|
368
|
-
for (const c of l)
|
|
369
|
-
c !== r && (i[c] = $e(r, c, s));
|
|
370
|
-
f("color-change", Y());
|
|
371
|
-
}
|
|
372
|
-
d.value instanceof HTMLElement && u.value instanceof HTMLElement && v.value instanceof HTMLElement && he(d.value, u.value, v.value);
|
|
373
|
-
}
|
|
374
|
-
async function U() {
|
|
375
|
-
const r = i[p.value], t = a.alphaChannel === "hide", s = z({ color: r, format: p.value }, t);
|
|
376
|
-
await (a.copy ? a.copy : window.navigator.clipboard.writeText)(s), f("color-copy", Y());
|
|
377
|
-
}
|
|
378
|
-
function he(r, t, s) {
|
|
379
|
-
const c = z({ format: "hsl", color: i.hsl }, !0);
|
|
380
|
-
r.style.setProperty("--vacp-color", c), t.style.position = "relative", t.style.backgroundColor = `hsl(${i.hsl.h} 100% 50%)`, t.style.backgroundImage = "linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent)", s.style.boxSizing = "border-box", s.style.position = "absolute", s.style.left = `${i.hsv.s}%`, s.style.bottom = `${i.hsv.v}%`;
|
|
381
|
-
}
|
|
382
|
-
function Y() {
|
|
383
|
-
const r = a.alphaChannel === "hide", t = z({ color: i[p.value], format: p.value }, r);
|
|
384
|
-
return {
|
|
385
|
-
colors: i,
|
|
386
|
-
cssColor: t
|
|
387
|
-
};
|
|
388
|
-
}
|
|
389
|
-
function X(r) {
|
|
390
|
-
if (!["ArrowUp", "ArrowRight", "ArrowDown", "ArrowLeft"].includes(r.key) || !r.shiftKey)
|
|
391
|
-
return;
|
|
392
|
-
const t = r.currentTarget, s = Number(t.step), c = ["ArrowLeft", "ArrowDown"].includes(r.key) ? -1 : 1, g = Number(t.value) + c * s * 10, b = E(g, Number(t.min), Number(t.max));
|
|
393
|
-
t.value = String(b - c * s);
|
|
394
|
-
}
|
|
395
|
-
return (r, t) => (y(), $("div", {
|
|
396
|
-
ref_key: "colorPicker",
|
|
397
|
-
ref: d,
|
|
398
|
-
class: "vacp-color-picker"
|
|
399
|
-
}, [
|
|
400
|
-
h("div", {
|
|
401
|
-
ref_key: "colorSpace",
|
|
402
|
-
ref: u,
|
|
403
|
-
class: "vacp-color-space",
|
|
404
|
-
onMousedown: se,
|
|
405
|
-
onTouchstart: ce
|
|
406
|
-
}, [
|
|
407
|
-
h("div", {
|
|
408
|
-
ref_key: "thumb",
|
|
409
|
-
ref: v,
|
|
410
|
-
class: "vacp-color-space-thumb",
|
|
411
|
-
tabindex: "0",
|
|
412
|
-
"aria-label": "Color space thumb",
|
|
413
|
-
onKeydown: ie
|
|
414
|
-
}, null, 544)
|
|
415
|
-
], 544),
|
|
416
|
-
h("div", Ae, [
|
|
417
|
-
h("label", {
|
|
418
|
-
class: "vacp-range-input-label vacp-range-input-label--hue",
|
|
419
|
-
for: `${r.id}-hue-slider`
|
|
420
|
-
}, [
|
|
421
|
-
h("span", Fe, [
|
|
422
|
-
L(r.$slots, "hue-range-input-label", {}, () => [
|
|
423
|
-
t[2] || (t[2] = G("Hue"))
|
|
424
|
-
])
|
|
425
|
-
]),
|
|
426
|
-
h("input", {
|
|
427
|
-
id: `${r.id}-hue-slider`,
|
|
428
|
-
class: "vacp-range-input vacp-range-input--hue",
|
|
429
|
-
value: i.hsv.h,
|
|
430
|
-
type: "range",
|
|
431
|
-
min: "0",
|
|
432
|
-
max: "360",
|
|
433
|
-
step: "1",
|
|
434
|
-
onKeydownPassive: X,
|
|
435
|
-
onInput: t[0] || (t[0] = (s) => B(s, "h"))
|
|
436
|
-
}, null, 40, Te)
|
|
437
|
-
], 8, Le),
|
|
438
|
-
r.alphaChannel === "show" ? (y(), $("label", {
|
|
439
|
-
key: 0,
|
|
440
|
-
class: "vacp-range-input-label vacp-range-input-label--alpha",
|
|
441
|
-
for: `${r.id}-alpha-slider`
|
|
442
|
-
}, [
|
|
443
|
-
h("span", je, [
|
|
444
|
-
L(r.$slots, "alpha-range-input-label", {}, () => [
|
|
445
|
-
t[3] || (t[3] = G("Alpha"))
|
|
446
|
-
])
|
|
447
|
-
]),
|
|
448
|
-
h("input", {
|
|
449
|
-
id: `${r.id}-alpha-slider`,
|
|
450
|
-
class: "vacp-range-input vacp-range-input--alpha",
|
|
451
|
-
value: i.hsv.a,
|
|
452
|
-
type: "range",
|
|
453
|
-
min: "0",
|
|
454
|
-
max: "1",
|
|
455
|
-
step: "0.01",
|
|
456
|
-
onKeydownPassive: X,
|
|
457
|
-
onInput: t[1] || (t[1] = (s) => B(s, "a"))
|
|
458
|
-
}, null, 40, Oe)
|
|
459
|
-
], 8, Se)) : Z("", !0)
|
|
460
|
-
]),
|
|
461
|
-
h("button", {
|
|
462
|
-
class: "vacp-copy-button",
|
|
463
|
-
type: "button",
|
|
464
|
-
onClick: U
|
|
465
|
-
}, [
|
|
466
|
-
L(r.$slots, "copy-button", {}, () => [
|
|
467
|
-
t[4] || (t[4] = h("span", { class: "vacp-visually-hidden" }, "Copy color", -1)),
|
|
468
|
-
t[5] || (t[5] = h("svg", {
|
|
469
|
-
class: "vacp-icon",
|
|
470
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
471
|
-
"aria-hidden": "true",
|
|
472
|
-
width: "24",
|
|
473
|
-
height: "24",
|
|
474
|
-
viewBox: "0 0 32 32"
|
|
475
|
-
}, [
|
|
476
|
-
h("path", {
|
|
477
|
-
d: "M25.313 28v-18.688h-14.625v18.688h14.625zM25.313 6.688c1.438 0 2.688 1.188 2.688 2.625v18.688c0 1.438-1.25 2.688-2.688 2.688h-14.625c-1.438 0-2.688-1.25-2.688-2.688v-18.688c0-1.438 1.25-2.625 2.688-2.625h14.625zM21.313 1.313v2.688h-16v18.688h-2.625v-18.688c0-1.438 1.188-2.688 2.625-2.688h16z",
|
|
478
|
-
fill: "currentColor"
|
|
479
|
-
})
|
|
480
|
-
], -1))
|
|
481
|
-
])
|
|
482
|
-
]),
|
|
483
|
-
h("div", De, [
|
|
484
|
-
h("div", He, [
|
|
485
|
-
p.value === "hex" ? (y(), $("label", {
|
|
486
|
-
key: 0,
|
|
487
|
-
class: "vacp-color-input-label",
|
|
488
|
-
for: `${r.id}-color-hex`
|
|
489
|
-
}, [
|
|
490
|
-
t[6] || (t[6] = h("span", { class: "vacp-color-input-label-text" }, " Hex ", -1)),
|
|
491
|
-
h("input", {
|
|
492
|
-
id: `${r.id}-color-hex`,
|
|
493
|
-
class: "vacp-color-input",
|
|
494
|
-
type: "text",
|
|
495
|
-
value: le.value,
|
|
496
|
-
onInput: ue
|
|
497
|
-
}, null, 40, Ve)
|
|
498
|
-
], 8, Pe)) : (y(!0), $(ge, { key: 1 }, be(oe.value, ({ value: s, channel: c, label: g }) => (y(), $("label", {
|
|
499
|
-
id: `${r.id}-color-${p.value}-${c}-label`,
|
|
500
|
-
key: `${r.id}-color-${p.value}-${c}-label`,
|
|
501
|
-
class: "vacp-color-input-label",
|
|
502
|
-
for: `${r.id}-color-${p.value}-${c}`,
|
|
503
|
-
onInput: (b) => R(b, c)
|
|
504
|
-
}, [
|
|
505
|
-
h("span", ze, we(g), 1),
|
|
506
|
-
h("input", {
|
|
507
|
-
id: `${r.id}-color-${p.value}-${c}`,
|
|
508
|
-
class: "vacp-color-input",
|
|
509
|
-
type: "text",
|
|
510
|
-
value: s,
|
|
511
|
-
onInput: (b) => R(b, c)
|
|
512
|
-
}, null, 40, Ke)
|
|
513
|
-
], 40, _e))), 128))
|
|
514
|
-
]),
|
|
515
|
-
r.visibleFormats.length > 1 ? (y(), $("button", {
|
|
516
|
-
key: 0,
|
|
517
|
-
class: "vacp-format-switch-button",
|
|
518
|
-
type: "button",
|
|
519
|
-
onClick: ae
|
|
520
|
-
}, [
|
|
521
|
-
L(r.$slots, "format-switch-button", {}, () => [
|
|
522
|
-
t[7] || (t[7] = h("span", { class: "vacp-visually-hidden" }, "Switch format", -1)),
|
|
523
|
-
t[8] || (t[8] = h("svg", {
|
|
524
|
-
class: "vacp-icon",
|
|
525
|
-
"aria-hidden": "true",
|
|
526
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
527
|
-
width: "16",
|
|
528
|
-
height: "15"
|
|
529
|
-
}, [
|
|
530
|
-
h("path", {
|
|
531
|
-
d: "M8 15l5-5-1-1-4 2-4-2-1 1zm4-9l1-1-5-5-5 5 1 1 4-2z",
|
|
532
|
-
fill: "currentColor"
|
|
533
|
-
})
|
|
534
|
-
], -1))
|
|
535
|
-
])
|
|
536
|
-
])) : Z("", !0)
|
|
537
|
-
])
|
|
538
|
-
], 512));
|
|
539
|
-
}
|
|
540
|
-
});
|
|
541
|
-
export {
|
|
542
|
-
Be as K
|
|
543
|
-
};
|