@feedmepos/mf-brand-app-builder 0.5.17 → 0.5.18

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.
Files changed (176) hide show
  1. package/dist/App-CKxXz-yv.js +109 -0
  2. package/dist/{AssetsSettings-CqLnxCVp.js → AssetsSettings-D7stEXBP.js} +11 -10
  3. package/dist/BaDivider-DWZv3fqi.js +10 -0
  4. package/dist/BrandkitView-CGFsc8gN.js +8434 -0
  5. package/dist/BuilderView-h-AD0K_z.js +9403 -0
  6. package/dist/ColorPicker-BsSFgHSF.js +156 -0
  7. package/dist/ColorPicker-CHzKbuCD.js +543 -0
  8. package/dist/{ImageUpload-CSFXBbR9.js → ImageUpload-Bu1QY9Tu.js} +11 -11
  9. package/dist/{LinkButton-BW3l1VVh.js → LinkButton-DS5DH9B8.js} +57 -56
  10. package/dist/{ListRepeater-ClJTp-6r.js → ListRepeater-Bjq_VTKB.js} +1 -1
  11. package/dist/{ManagementSettings-BC4fKORI.js → ManagementSettings-DWh1pA_2.js} +70 -56
  12. package/dist/ProjectView-BweZwCAj.js +680 -0
  13. package/dist/Select-DQrjO2Su.js +91 -0
  14. package/dist/StepperField-BeeZ_sl9.js +30 -0
  15. package/dist/_commonjsHelpers-DaMA6jEr.js +8 -0
  16. package/dist/{app-PkUx7Ubo.js → app-DKN3IiyF.js} +143 -76
  17. package/dist/app.js +1 -1
  18. package/dist/brand-core/src/entity.d.ts +52 -0
  19. package/dist/{components → client/components}/src/components/ButtonList.vue.d.ts +2 -0
  20. package/dist/{components → client/components}/src/components/Homepage.vue.d.ts +2 -0
  21. package/dist/client/components/src/components/Member/MemberAchievements.vue.d.ts +33 -0
  22. package/dist/client/components/src/components/Member/MemberCards.vue.d.ts +19 -0
  23. package/dist/client/components/src/components/Member/MemberSummary.vue.d.ts +24 -0
  24. package/dist/client/components/src/components/Member/TransactionList.vue.d.ts +5 -0
  25. package/dist/client/components/src/components/NavigationBar.vue.d.ts +17 -0
  26. package/dist/{components → client/components}/src/components/atoms/Container.vue.d.ts +1 -0
  27. package/dist/{components → client/components}/src/main.d.ts +9 -1
  28. package/dist/client/components/src/utils/date.d.ts +22 -0
  29. package/dist/client/components/src/views/_Credit.vue.d.ts +20 -0
  30. package/dist/client/components/src/views/_MemberProfile.vue.d.ts +46 -0
  31. package/dist/client/components/src/views/_Point.vue.d.ts +20 -0
  32. package/dist/client/components/src/views/_Referral.vue.d.ts +31 -0
  33. package/dist/client/components/src/views/_ReferralTutorial.vue.d.ts +24 -0
  34. package/dist/{merchant → client/merchant}/src/api/business/index.d.ts +14 -0
  35. package/dist/{merchant → client/merchant}/src/api/template/index.d.ts +2 -2
  36. package/dist/{merchant → client/merchant}/src/app.d.ts +1 -1
  37. package/dist/client/merchant/src/components/brandkit/ColorSelection.vue.d.ts +15 -0
  38. package/dist/client/merchant/src/components/element-sidebar/ElementSidebar.vue.d.ts +2 -0
  39. package/dist/{merchant → client/merchant}/src/components/element-sidebar/all-elements.d.ts +1 -0
  40. package/dist/{merchant → client/merchant}/src/components/inputs/ColorPicker.vue.d.ts +2 -1
  41. package/dist/client/merchant/src/components/inputs/LinkBrandkitColor.vue.d.ts +9 -0
  42. package/dist/client/merchant/src/components/template/TemplatePreview.vue.d.ts +8 -0
  43. package/dist/{merchant → client/merchant}/src/composables/useNode/index.d.ts +1 -1
  44. package/dist/client/merchant/src/composables/useToast/index.d.ts +8 -0
  45. package/dist/{merchant → client/merchant}/src/node-configs/branch-list/props.d.ts +1 -0
  46. package/dist/{merchant → client/merchant}/src/node-configs/button-list/props.d.ts +3 -0
  47. package/dist/{merchant → client/merchant}/src/node-configs/carousel/props.d.ts +1 -0
  48. package/dist/client/merchant/src/node-configs/container/props.d.ts +85 -0
  49. package/dist/{merchant → client/merchant}/src/node-configs/display-image/props.d.ts +1 -0
  50. package/dist/{merchant → client/merchant}/src/node-configs/display-text/props.d.ts +1 -0
  51. package/dist/client/merchant/src/node-configs/member-achievements/mock-data.d.ts +15 -0
  52. package/dist/client/merchant/src/node-configs/member-achievements/props.d.ts +40 -0
  53. package/dist/client/merchant/src/node-configs/member-achievements/schema.d.ts +2 -0
  54. package/dist/{merchant → client/merchant}/src/node-configs/member-card/props.d.ts +1 -0
  55. package/dist/client/merchant/src/node-configs/member-cards/mock-data.d.ts +3 -0
  56. package/dist/client/merchant/src/node-configs/member-cards/props.d.ts +24 -0
  57. package/dist/client/merchant/src/node-configs/member-cards/schema.d.ts +2 -0
  58. package/dist/client/merchant/src/node-configs/member-history/mock-data.d.ts +843 -0
  59. package/dist/client/merchant/src/node-configs/member-history/props.d.ts +1692 -0
  60. package/dist/client/merchant/src/node-configs/member-history/schema.d.ts +3 -0
  61. package/dist/client/merchant/src/node-configs/member-profile/props.d.ts +449 -0
  62. package/dist/client/merchant/src/node-configs/member-profile/schema.d.ts +2 -0
  63. package/dist/client/merchant/src/node-configs/member-referral/props.d.ts +98 -0
  64. package/dist/client/merchant/src/node-configs/member-referral/schema.d.ts +2 -0
  65. package/dist/client/merchant/src/node-configs/member-referral-tutorial/props.d.ts +8 -0
  66. package/dist/client/merchant/src/node-configs/member-referral-tutorial/schema.d.ts +2 -0
  67. package/dist/client/merchant/src/node-configs/member-summary/mock-data.d.ts +9 -0
  68. package/dist/client/merchant/src/node-configs/member-summary/props.d.ts +32 -0
  69. package/dist/client/merchant/src/node-configs/member-summary/schema.d.ts +2 -0
  70. package/dist/client/merchant/src/node-configs/mock-data.d.ts +7 -0
  71. package/dist/{merchant → client/merchant}/src/node-configs/order-history-card/props.d.ts +1 -0
  72. package/dist/{merchant → client/merchant}/src/node-configs/order-method/props.d.ts +1 -0
  73. package/dist/{merchant → client/merchant}/src/node-configs/props.d.ts +8 -1
  74. package/dist/{merchant → client/merchant}/src/node-configs/schema.d.ts +8 -1
  75. package/dist/client/merchant/src/stores/business/index.d.ts +262 -0
  76. package/dist/{merchant → client/merchant}/src/stores/editor/index.d.ts +1 -1
  77. package/dist/{merchant → client/merchant}/src/stores/template/index.d.ts +88 -9
  78. package/dist/client/merchant/src/views/BuilderView.vue.d.ts +5 -0
  79. package/dist/client/merchant/src/views/views.d.ts +101 -0
  80. package/dist/{image-CZHt-VXw.js → image-BYlGZH0E.js} +1 -1
  81. package/dist/index-BvuwuHni.js +30 -0
  82. package/dist/index-DBOAICnu.js +198 -0
  83. package/dist/{index-C9F3TTHx.js → index-DDahVJiF.js} +206 -205
  84. package/dist/index-DzaJbB6y.js +40 -0
  85. package/dist/index-bSKZrhdP.js +90 -0
  86. package/dist/main-pKSbpQEA.js +7928 -0
  87. package/dist/package.json +8 -2
  88. package/dist/style.css +1 -1
  89. package/dist/views-BDWw3w14.js +119 -0
  90. package/dist/{index-BekN4F_2.js → vue-sonner-PX6Req0V.js} +263 -333
  91. package/package.json +8 -2
  92. package/dist/App-BK8oMq3l.js +0 -101
  93. package/dist/BuilderView-DRVOcsVV.js +0 -5501
  94. package/dist/ColorPicker-DAysa9fA.js +0 -22
  95. package/dist/Select-CbQFoAzb.js +0 -25
  96. package/dist/StepperField-DrHM9EDn.js +0 -29
  97. package/dist/index-B-LGv3nI.js +0 -188
  98. package/dist/index-BaHmjvBz.js +0 -25
  99. package/dist/main-DT3xX1S6.js +0 -6736
  100. package/dist/merchant/src/node-configs/container/props.d.ts +0 -57
  101. package/dist/merchant/src/node-configs/mock-data.d.ts +0 -3
  102. package/dist/merchant/src/stores/business/index.d.ts +0 -59
  103. package/dist/merchant/src/views/HomeView.vue.d.ts +0 -2
  104. /package/dist/{components → client/components}/src/components/BranchList.vue.d.ts +0 -0
  105. /package/dist/{components → client/components}/src/components/CountrySwitcher.vue.d.ts +0 -0
  106. /package/dist/{components → client/components}/src/components/ImageCarousel.vue.d.ts +0 -0
  107. /package/dist/{components → client/components}/src/components/ImageDisplay.vue.d.ts +0 -0
  108. /package/dist/{components → client/components}/src/components/MemberCard.vue.d.ts +0 -0
  109. /package/dist/{components → client/components}/src/components/OrderHistoryCard.vue.d.ts +0 -0
  110. /package/dist/{components → client/components}/src/components/OrderMethod.vue.d.ts +0 -0
  111. /package/dist/{components → client/components}/src/components/TextDisplay.vue.d.ts +0 -0
  112. /package/dist/{components → client/components}/src/components/atoms/Button.vue.d.ts +0 -0
  113. /package/dist/{components → client/components}/src/components/atoms/CircularProgress.vue.d.ts +0 -0
  114. /package/dist/{components → client/components}/src/components/atoms/Divider.vue.d.ts +0 -0
  115. /package/dist/{components → client/components}/src/components/atoms/Icon.vue.d.ts +0 -0
  116. /package/dist/{components → client/components}/src/components/atoms/LinkSlot.vue.d.ts +0 -0
  117. /package/dist/{components → client/components}/src/components/atoms/OrderTypeChip.vue.d.ts +0 -0
  118. /package/dist/{components → client/components}/src/utils/image.d.ts +0 -0
  119. /package/dist/{components → client/components}/src/views/OrderDetails.vue.d.ts +0 -0
  120. /package/dist/{merchant → client/merchant}/src/App.vue.d.ts +0 -0
  121. /package/dist/{merchant → client/merchant}/src/Entry.vue.d.ts +0 -0
  122. /package/dist/{merchant → client/merchant}/src/api/image/index.d.ts +0 -0
  123. /package/dist/{merchant → client/merchant}/src/api/index.d.ts +0 -0
  124. /package/dist/{merchant → client/merchant}/src/components/atoms/BaButtonGroup.vue.d.ts +0 -0
  125. /package/dist/{merchant → client/merchant}/src/components/atoms/BaDivider.vue.d.ts +0 -0
  126. /package/dist/{merchant → client/merchant}/src/components/atoms/index.d.ts +0 -0
  127. /package/dist/{merchant → client/merchant}/src/components/editor/Editor.vue.d.ts +0 -0
  128. /package/dist/{merchant → client/merchant}/src/components/editor/EditorFloatingToobar.vue.d.ts +0 -0
  129. /package/dist/{merchant → client/merchant}/src/components/editor/toolbar/EditorToolbar.vue.d.ts +0 -0
  130. /package/dist/{merchant → client/merchant}/src/components/editor/toolbar/PreviewQrCode.vue.d.ts +0 -0
  131. /package/dist/{merchant → client/merchant}/src/components/editor/toolbar/TemplatePicker.vue.d.ts +0 -0
  132. /package/dist/{merchant → client/merchant}/src/components/editor/toolbar/TemplateShareMenu.vue.d.ts +0 -0
  133. /package/dist/{merchant → client/merchant}/src/components/inputs/ButtonGroup.vue.d.ts +0 -0
  134. /package/dist/{merchant → client/merchant}/src/components/inputs/ImageUpload.vue.d.ts +0 -0
  135. /package/dist/{merchant → client/merchant}/src/components/inputs/LinkButton.vue.d.ts +0 -0
  136. /package/dist/{merchant → client/merchant}/src/components/inputs/ListRepeater.vue.d.ts +0 -0
  137. /package/dist/{merchant → client/merchant}/src/components/inputs/Select.vue.d.ts +0 -0
  138. /package/dist/{merchant → client/merchant}/src/components/inputs/StepperField.vue.d.ts +0 -0
  139. /package/dist/{merchant → client/merchant}/src/components/inputs/Switch.vue.d.ts +0 -0
  140. /package/dist/{merchant → client/merchant}/src/components/inputs/TextAlign.vue.d.ts +0 -0
  141. /package/dist/{merchant → client/merchant}/src/components/inputs/TextDecorators.vue.d.ts +0 -0
  142. /package/dist/{merchant → client/merchant}/src/components/inputs/TextField.vue.d.ts +0 -0
  143. /package/dist/{merchant → client/merchant}/src/components/inputs/TextStyleList.vue.d.ts +0 -0
  144. /package/dist/{merchant → client/merchant}/src/components/inputs/index.d.ts +0 -0
  145. /package/dist/{merchant → client/merchant}/src/components/inspector/Inspector.vue.d.ts +0 -0
  146. /package/dist/{merchant → client/merchant}/src/components/inspector/atoms/ConfigSection.vue.d.ts +0 -0
  147. /package/dist/{merchant → client/merchant}/src/components/inspector/atoms/ConfigTab.vue.d.ts +0 -0
  148. /package/dist/{merchant → client/merchant}/src/components/inspector/atoms/ConfigTabItem.vue.d.ts +0 -0
  149. /package/dist/{merchant → client/merchant}/src/components/inspector/atoms/ConfigTabTitle.vue.d.ts +0 -0
  150. /package/dist/{merchant → client/merchant}/src/components/navigation-sidebar/NavigationSidebar.vue.d.ts +0 -0
  151. /package/dist/{merchant → client/merchant}/src/components/settings/AssetsSettings.vue.d.ts +0 -0
  152. /package/dist/{merchant → client/merchant}/src/components/settings/ManagementSettings.vue.d.ts +0 -0
  153. /package/dist/{merchant → client/merchant}/src/helpers/businessUrl.d.ts +0 -0
  154. /package/dist/{merchant → client/merchant}/src/main.d.ts +0 -0
  155. /package/dist/{merchant → client/merchant}/src/node-configs/branch-list/schema.d.ts +0 -0
  156. /package/dist/{merchant → client/merchant}/src/node-configs/button-list/schema.d.ts +0 -0
  157. /package/dist/{merchant → client/merchant}/src/node-configs/carousel/schema.d.ts +0 -0
  158. /package/dist/{merchant → client/merchant}/src/node-configs/container/schema.d.ts +0 -0
  159. /package/dist/{merchant → client/merchant}/src/node-configs/display-image/schema.d.ts +0 -0
  160. /package/dist/{merchant → client/merchant}/src/node-configs/display-text/schema.d.ts +0 -0
  161. /package/dist/{merchant → client/merchant}/src/node-configs/homepage/props.d.ts +0 -0
  162. /package/dist/{merchant → client/merchant}/src/node-configs/homepage/schema.d.ts +0 -0
  163. /package/dist/{merchant → client/merchant}/src/node-configs/member-card/mock-data.d.ts +0 -0
  164. /package/dist/{merchant → client/merchant}/src/node-configs/member-card/schema.d.ts +0 -0
  165. /package/dist/{merchant → client/merchant}/src/node-configs/order-history-card/mock-data.d.ts +0 -0
  166. /package/dist/{merchant → client/merchant}/src/node-configs/order-history-card/schema.d.ts +0 -0
  167. /package/dist/{merchant → client/merchant}/src/node-configs/order-method/schema.d.ts +0 -0
  168. /package/dist/{merchant → client/merchant}/src/plugin/formkit.d.ts +0 -0
  169. /package/dist/{merchant → client/merchant}/src/router/index.d.ts +0 -0
  170. /package/dist/{merchant → client/merchant}/src/router/shared.d.ts +0 -0
  171. /package/dist/{merchant → client/merchant}/src/utils/deep-to-raw.d.ts +0 -0
  172. /package/dist/{merchant → client/merchant}/src/utils/image.d.ts +0 -0
  173. /package/dist/{merchant → client/merchant}/src/utils/provider-keys.d.ts +0 -0
  174. /package/dist/{merchant/src/components/element-sidebar/ElementSidebar.vue.d.ts → client/merchant/src/views/BrandkitView.vue.d.ts} +0 -0
  175. /package/dist/{merchant/src/views/BuilderView.vue.d.ts → client/merchant/src/views/ProjectView.vue.d.ts} +0 -0
  176. /package/dist/{merchant → client/merchant}/src/views/SettingsView.vue.d.ts +0 -0
@@ -0,0 +1,156 @@
1
+ import { defineComponent as x, ref as f, watch as w, resolveComponent as m, openBlock as y, createBlock as h, withCtx as d, createVNode as i, createTextVNode as F, createElementVNode as t, createElementBlock as C, Fragment as B, renderList as V, normalizeClass as $, normalizeStyle as k, toDisplayString as P, computed as S, unref as D } from "vue";
2
+ import { K as E } from "./ColorPicker-CHzKbuCD.js";
3
+ const L = { class: "grid grid-cols-4 place-items-center items-start gap-16 flex-wrap pb-24" }, N = { class: "flex flex-col items-center" }, z = ["onClick"], K = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary text-center" }, R = { class: "w-full flex gap-8 justify-end items-center" }, T = /* @__PURE__ */ x({
4
+ __name: "LinkBrandkitColor",
5
+ props: {
6
+ color: {}
7
+ },
8
+ emits: ["update"],
9
+ setup(v, { emit: n }) {
10
+ const p = v, l = f(p.color);
11
+ w(
12
+ () => p.color,
13
+ (o) => {
14
+ l.value = o;
15
+ }
16
+ );
17
+ const a = f(!1), b = n, s = [
18
+ "--brand-color-primary",
19
+ "--brand-color-secondary",
20
+ "--brand-color-accent",
21
+ "--brand-color-background-base",
22
+ "--brand-color-background-elevated",
23
+ "--brand-color-neutral-light",
24
+ "--brand-color-neutral-mid",
25
+ "--brand-color-neutral-dark",
26
+ "--brand-color-typo-on-primary",
27
+ "--brand-color-typo-primary",
28
+ "--brand-color-typo-secondary",
29
+ "--brand-color-typo-tertiary",
30
+ "--brand-color-status-success",
31
+ "--brand-color-status-warning",
32
+ "--brand-color-status-error",
33
+ "--brand-color-status-info"
34
+ ];
35
+ return (o, e) => {
36
+ const u = m("FmButton"), c = m("FmDialog");
37
+ return y(), h(c, {
38
+ modelValue: a.value,
39
+ "onUpdate:modelValue": e[2] || (e[2] = (r) => a.value = r),
40
+ "dismiss-away": ""
41
+ }, {
42
+ "dialog-button": d(() => [
43
+ i(u, {
44
+ variant: "plain",
45
+ icon: "link"
46
+ })
47
+ ]),
48
+ "dialog-header": d(() => e[3] || (e[3] = [
49
+ F(" Link with brandkit color ")
50
+ ])),
51
+ default: d(() => [
52
+ t("div", L, [
53
+ (y(), C(B, null, V(s, (r) => {
54
+ var g, _;
55
+ return t("div", N, [
56
+ t("div", {
57
+ onClick: (q) => l.value = r,
58
+ class: $(["p-[2px] border-1 rounded-sm", {
59
+ "border-fm-color-primary": (g = l.value) == null ? void 0 : g.includes(r),
60
+ "border-fm-color-neutral-gray-200": !((_ = l.value) != null && _.includes(r))
61
+ }])
62
+ }, [
63
+ t("div", {
64
+ class: "h-[40px] aspect-square cursor-pointer",
65
+ style: k({ backgroundColor: `var(${r})` })
66
+ }, null, 4)
67
+ ], 10, z),
68
+ t("div", K, P(r.replace("--brand-color-", "").replace(/-/g, " ")), 1)
69
+ ]);
70
+ }), 64))
71
+ ])
72
+ ]),
73
+ "dialog-footer": d(() => [
74
+ t("div", R, [
75
+ i(u, {
76
+ variant: "secondary",
77
+ label: "Close",
78
+ onClick: e[0] || (e[0] = (r) => a.value = !1)
79
+ }),
80
+ i(u, {
81
+ label: "Confirm",
82
+ onClick: e[1] || (e[1] = (r) => (b("update", `var(${l.value})`), a.value = !1))
83
+ })
84
+ ])
85
+ ]),
86
+ _: 1
87
+ }, 8, ["modelValue"]);
88
+ };
89
+ }
90
+ }), U = { class: "flex items-center gap-8" }, j = { class: "shadow-lg rounded-lg p-8" }, A = /* @__PURE__ */ x({
91
+ __name: "ColorPicker",
92
+ props: {
93
+ context: {}
94
+ },
95
+ setup(v) {
96
+ const n = v, p = f(), l = async (s) => {
97
+ await n.context.node.input(s);
98
+ }, a = (s) => {
99
+ navigator.clipboard.writeText(s);
100
+ }, b = S(() => n.context._value.startsWith("var") ? getComputedStyle(document.documentElement).getPropertyValue(
101
+ n.context._value.slice(
102
+ 4,
103
+ n.context._value.length - 1
104
+ )
105
+ ).trim() : n.context._value);
106
+ return (s, o) => {
107
+ const e = m("FmButton"), u = m("FmPopover");
108
+ return y(), C("div", U, [
109
+ i(u, null, {
110
+ "popover-button": d(() => [
111
+ t("div", {
112
+ ref_key: "elRef",
113
+ ref: p,
114
+ class: "w-[50px] h-[25px] relative border border-gray-400 rounded overflow-hidden"
115
+ }, [
116
+ o[3] || (o[3] = t("div", { class: "absolute inset-0 bg-checkerboard" }, null, -1)),
117
+ t("div", {
118
+ class: "absolute inset-0",
119
+ style: k({ backgroundColor: s.context._value })
120
+ }, null, 4)
121
+ ], 512)
122
+ ]),
123
+ default: d(() => [
124
+ t("div", j, [
125
+ i(D(E), {
126
+ copy: a,
127
+ onColorCopy: o[0] || (o[0] = (c) => a(c.cssColor)),
128
+ "default-format": "hex",
129
+ color: b.value,
130
+ "visible-formats": ["hex"],
131
+ onColorChange: o[1] || (o[1] = (c) => l(c.cssColor))
132
+ }, {
133
+ "copy-button": d(() => [
134
+ i(e, {
135
+ class: "w-full h-32",
136
+ variant: "secondary",
137
+ icon: "content_copy"
138
+ })
139
+ ]),
140
+ _: 1
141
+ }, 8, ["color"])
142
+ ])
143
+ ]),
144
+ _: 1
145
+ }),
146
+ i(T, {
147
+ color: n.context._value,
148
+ onUpdate: o[2] || (o[2] = (c) => l(c))
149
+ }, null, 8, ["color"])
150
+ ]);
151
+ };
152
+ }
153
+ });
154
+ export {
155
+ A as default
156
+ };
@@ -0,0 +1,543 @@
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
+ };