@feedmepos/mf-brand-app-builder 0.5.22-dev.0 → 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.
Files changed (203) hide show
  1. package/dist/{App-DSjCJtmn.js → App-BRIDkK5d.js} +5 -5
  2. package/dist/{AssetsSettings-e8FjbJ_2.js → AssetsSettings-DhprCc4v.js} +6 -6
  3. package/dist/{BaDivider-DWZv3fqi.js → BaDivider-Cp9gfB4r.js} +2 -2
  4. package/dist/{BrandkitView-YRlmRZnS.js → BrandkitView-DzLVTHjo.js} +2867 -2033
  5. package/dist/{BuilderView-BLM7vEZA.js → BuilderView-BwXnOIit.js} +460 -474
  6. package/dist/{ButtonGroup-D_HkX122.js → ButtonGroup-2ilMTPHH.js} +2 -2
  7. package/dist/{CircularProgress-h90pbjU3.js → CircularProgress-DdblYCtV.js} +4 -4
  8. package/dist/ColorPicker-RKWzhLBO.js +543 -0
  9. package/dist/{ColorPicker-I6CkNIxt.js → ColorPicker-dVFIiu94.js} +14 -14
  10. package/dist/{Icon.vue_vue_type_style_index_0_lang-CVCHCcWR.js → Icon.vue_vue_type_style_index_0_lang-BcRjQndc.js} +2 -2
  11. package/dist/{ImageUpload-CDR7v2YB.js → ImageUpload-OqPKnQQI.js} +9 -9
  12. package/dist/{LinkButton-DvF93Arq.js → LinkButton-De-YNclu.js} +4 -4
  13. package/dist/{ListRepeater-Dri1M_Xh.js → ListRepeater-DIlTKjtE.js} +2 -2
  14. package/dist/{ManagementSettings-CROYjeuM.js → ManagementSettings-Cz4HkNm1.js} +4 -4
  15. package/dist/ProjectView-ByxaVBFb.js +428 -0
  16. package/dist/{Select-BRYuMWoQ.js → Select-DQx6OfZx.js} +9 -9
  17. package/dist/{SettingsView-DHA7hXUx.js → SettingsView-uft0uKio.js} +2 -2
  18. package/dist/{StepperField-BeeZ_sl9.js → StepperField-nyaUK9ht.js} +2 -2
  19. package/dist/{Switch-8mmNQUDo.js → Switch-uc_zN-mb.js} +2 -2
  20. package/dist/{TextAlign-BOC8ekaH.js → TextAlign-BSp1Xi7F.js} +2 -2
  21. package/dist/{TextDecorators-BJC4umDR.js → TextDecorators-1C54q7us.js} +4 -4
  22. package/dist/{TextField-BiVH5rLX.js → TextField-DfBJB6vQ.js} +2 -2
  23. package/dist/{TextStyleList-CuPE80Py.js → TextStyleList-Bef3irUx.js} +3 -3
  24. package/dist/{app-OPl2Khtq.js → app-CY0-wVrG.js} +6513 -3895
  25. package/dist/app.js +1 -1
  26. package/dist/brand-core/src/brandkit.d.ts +5 -0
  27. package/dist/brand-core/src/entity.d.ts +89 -0
  28. package/dist/{components → client/components}/src/components/BranchList.vue.d.ts +1 -1
  29. package/dist/{components → client/components}/src/components/ButtonList.vue.d.ts +1 -1
  30. package/dist/{components → client/components}/src/components/CountrySwitcher.vue.d.ts +1 -1
  31. package/dist/client/components/src/components/Homepage.vue.d.ts +19 -0
  32. package/dist/{components → client/components}/src/components/ImageCarousel.vue.d.ts +1 -1
  33. package/dist/{components → client/components}/src/components/ImageDisplay.vue.d.ts +1 -1
  34. package/dist/{components → client/components}/src/components/Member/TransactionList.vue.d.ts +1 -1
  35. package/dist/{components → client/components}/src/components/MemberCard.vue.d.ts +1 -1
  36. package/dist/{components → client/components}/src/components/NavigationBar.vue.d.ts +4 -4
  37. package/dist/{components → client/components}/src/components/OrderHistoryCard.vue.d.ts +4 -3
  38. package/dist/{components → client/components}/src/components/OrderMethod.vue.d.ts +1 -1
  39. package/dist/{components → client/components}/src/components/TextDisplay.vue.d.ts +1 -1
  40. package/dist/{components → client/components}/src/components/atoms/Button.vue.d.ts +4 -4
  41. package/dist/{components → client/components}/src/components/atoms/CircularProgress.vue.d.ts +2 -2
  42. package/dist/{components → client/components}/src/components/atoms/Container.vue.d.ts +3 -3
  43. package/dist/{components → client/components}/src/components/atoms/Icon.vue.d.ts +1 -1
  44. package/dist/{components → client/components}/src/components/atoms/LinkSlot.vue.d.ts +4 -4
  45. package/dist/{components → client/components}/src/views/OrderDetails.vue.d.ts +1 -1
  46. package/dist/{components → client/components}/src/views/_Credit.vue.d.ts +1 -1
  47. package/dist/{components → client/components}/src/views/_MemberProfile.vue.d.ts +4 -4
  48. package/dist/{components → client/components}/src/views/_Point.vue.d.ts +1 -1
  49. package/dist/{components → client/components}/src/views/_Referral.vue.d.ts +4 -4
  50. package/dist/{components → client/components}/src/views/_ReferralTutorial.vue.d.ts +4 -4
  51. package/dist/{merchant → client/merchant}/src/api/business/index.d.ts +41 -1
  52. package/dist/{merchant → client/merchant}/src/app.d.ts +2614 -0
  53. package/dist/{merchant → client/merchant}/src/components/atoms/BaButtonGroup.vue.d.ts +1 -1
  54. package/dist/{merchant → client/merchant}/src/components/brandkit/ColorSelection.vue.d.ts +1 -1
  55. package/dist/client/merchant/src/components/editor/EditorFloatingToobar.vue.d.ts +2 -0
  56. package/dist/client/merchant/src/components/editor/toolbar/EditorToolbar.vue.d.ts +2 -0
  57. package/dist/client/merchant/src/components/editor/toolbar/PreviewQrCode.vue.d.ts +2 -0
  58. package/dist/client/merchant/src/components/editor/toolbar/TemplatePicker.vue.d.ts +2 -0
  59. package/dist/client/merchant/src/components/editor/toolbar/TemplateShareMenu.vue.d.ts +2 -0
  60. package/dist/client/merchant/src/components/element-sidebar/ElementSidebar.vue.d.ts +2 -0
  61. package/dist/{merchant → client/merchant}/src/components/inputs/ColorPicker.vue.d.ts +1 -1
  62. package/dist/{merchant → client/merchant}/src/components/inputs/ImageUpload.vue.d.ts +1 -1
  63. package/dist/{merchant → client/merchant}/src/components/inputs/TextAlign.vue.d.ts +1 -1
  64. package/dist/{merchant → client/merchant}/src/components/inputs/TextDecorators.vue.d.ts +1 -1
  65. package/dist/{merchant → client/merchant}/src/components/inputs/TextStyleList.vue.d.ts +1 -1
  66. package/dist/client/merchant/src/components/inspector/Inspector.vue.d.ts +2 -0
  67. package/dist/client/merchant/src/components/inspector/atoms/ConfigSection.vue.d.ts +12 -0
  68. package/dist/client/merchant/src/components/inspector/atoms/ConfigTab.vue.d.ts +18 -0
  69. package/dist/client/merchant/src/components/inspector/atoms/ConfigTabItem.vue.d.ts +13 -0
  70. package/dist/{merchant → client/merchant}/src/components/inspector/atoms/ConfigTabTitle.vue.d.ts +1 -1
  71. package/dist/client/merchant/src/components/navigation-sidebar/NavigationSidebar.vue.d.ts +2 -0
  72. package/dist/client/merchant/src/components/order-template/LayoutTemplateSection.vue.d.ts +14 -0
  73. package/dist/client/merchant/src/components/order-template/OrderTemplateEditorButton.vue.d.ts +10 -0
  74. package/dist/client/merchant/src/components/order-template/OrderTemplateEditorForm.vue.d.ts +14 -0
  75. package/dist/client/merchant/src/components/order-template/TemplateVersionHistory.vue.d.ts +18 -0
  76. package/dist/client/merchant/src/components/settings/AssetsSettings.vue.d.ts +2 -0
  77. package/dist/client/merchant/src/components/settings/ManagementSettings.vue.d.ts +2 -0
  78. package/dist/{merchant → client/merchant}/src/components/template/TemplatePreview.vue.d.ts +1 -1
  79. package/dist/{merchant → client/merchant}/src/stores/business/index.d.ts +217 -1
  80. package/dist/client/merchant/src/views/BrandkitView.vue.d.ts +2 -0
  81. package/dist/{merchant → client/merchant}/src/views/BuilderView.vue.d.ts +1 -1
  82. package/dist/client/merchant/src/views/ProjectView.vue.d.ts +2 -0
  83. package/dist/client/merchant/src/views/SettingsView.vue.d.ts +2 -0
  84. package/dist/dayjs.min-DnbY0e60.js +282 -0
  85. package/dist/{image-HDqbMgOR.js → image-D_Djf1PS.js} +1 -1
  86. package/dist/{index-V999lx_3.js → index-Bk6TOZrx.js} +2 -2
  87. package/dist/{index-BodukiEf.js → index-C1rSMuKA.js} +1 -1
  88. package/dist/index-C4vwWvn_.js +112 -0
  89. package/dist/index-D0LOMBBD.js +1822 -0
  90. package/dist/{main--RZvbXYz.js → main-DzMHu5qo.js} +3566 -3577
  91. package/dist/package.json +7 -4
  92. package/dist/style.css +1 -1
  93. package/dist/{v4-ANoOI1Qw.js → v4-CKwdnpQf.js} +8 -8
  94. package/dist/{vue-sonner-PX6Req0V.js → vue-sonner-CBFYmm8_.js} +129 -125
  95. package/package.json +7 -4
  96. package/dist/ColorPicker-CHzKbuCD.js +0 -543
  97. package/dist/ProjectView-Tb44Sm_z.js +0 -705
  98. package/dist/components/src/components/Homepage.vue.d.ts +0 -19
  99. package/dist/components/src/components/atoms/Divider.vue.d.ts +0 -2
  100. package/dist/index-CvbnxMT4.js +0 -1736
  101. package/dist/index-DbvZZQr6.js +0 -90
  102. package/dist/merchant/src/components/atoms/BaDivider.vue.d.ts +0 -2
  103. package/dist/merchant/src/components/editor/Editor.vue.d.ts +0 -2
  104. package/dist/merchant/src/components/editor/EditorFloatingToobar.vue.d.ts +0 -2
  105. package/dist/merchant/src/components/editor/toolbar/EditorToolbar.vue.d.ts +0 -2
  106. package/dist/merchant/src/components/element-sidebar/ElementSidebar.vue.d.ts +0 -2
  107. package/dist/merchant/src/components/inspector/Inspector.vue.d.ts +0 -2
  108. package/dist/merchant/src/components/inspector/atoms/ConfigSection.vue.d.ts +0 -12
  109. package/dist/merchant/src/components/inspector/atoms/ConfigTab.vue.d.ts +0 -18
  110. package/dist/merchant/src/components/inspector/atoms/ConfigTabItem.vue.d.ts +0 -13
  111. package/dist/merchant/src/components/navigation-sidebar/NavigationSidebar.vue.d.ts +0 -2
  112. package/dist/merchant/src/components/settings/AssetsSettings.vue.d.ts +0 -2
  113. package/dist/merchant/src/components/settings/ManagementSettings.vue.d.ts +0 -2
  114. package/dist/merchant/src/views/BrandkitView.vue.d.ts +0 -2
  115. package/dist/merchant/src/views/ProjectView.vue.d.ts +0 -2
  116. package/dist/merchant/src/views/SettingsView.vue.d.ts +0 -2
  117. /package/dist/{components → client/components}/src/components/Member/MemberAchievements.vue.d.ts +0 -0
  118. /package/dist/{components → client/components}/src/components/Member/MemberCards.vue.d.ts +0 -0
  119. /package/dist/{components → client/components}/src/components/Member/MemberSummary.vue.d.ts +0 -0
  120. /package/dist/{merchant/src/App.vue.d.ts → client/components/src/components/atoms/Divider.vue.d.ts} +0 -0
  121. /package/dist/{components → client/components}/src/components/atoms/OrderTypeChip.vue.d.ts +0 -0
  122. /package/dist/{components → client/components}/src/i18n.d.ts +0 -0
  123. /package/dist/{components → client/components}/src/main.d.ts +0 -0
  124. /package/dist/{components → client/components}/src/utils/date.d.ts +0 -0
  125. /package/dist/{components → client/components}/src/utils/image.d.ts +0 -0
  126. /package/dist/{merchant/src/Entry.vue.d.ts → client/merchant/src/App.vue.d.ts} +0 -0
  127. /package/dist/{merchant/src/components/editor/toolbar/PreviewQrCode.vue.d.ts → client/merchant/src/Entry.vue.d.ts} +0 -0
  128. /package/dist/{merchant → client/merchant}/src/api/image/index.d.ts +0 -0
  129. /package/dist/{merchant → client/merchant}/src/api/index.d.ts +0 -0
  130. /package/dist/{merchant → client/merchant}/src/api/template/index.d.ts +0 -0
  131. /package/dist/{merchant/src/components/editor/toolbar/TemplatePicker.vue.d.ts → client/merchant/src/components/atoms/BaDivider.vue.d.ts} +0 -0
  132. /package/dist/{merchant → client/merchant}/src/components/atoms/index.d.ts +0 -0
  133. /package/dist/{merchant/src/components/editor/toolbar/TemplateShareMenu.vue.d.ts → client/merchant/src/components/editor/Editor.vue.d.ts} +0 -0
  134. /package/dist/{merchant → client/merchant}/src/components/element-sidebar/all-elements.d.ts +0 -0
  135. /package/dist/{merchant → client/merchant}/src/components/inputs/ButtonGroup.vue.d.ts +0 -0
  136. /package/dist/{merchant → client/merchant}/src/components/inputs/LinkBrandkitColor.vue.d.ts +0 -0
  137. /package/dist/{merchant → client/merchant}/src/components/inputs/LinkButton.vue.d.ts +0 -0
  138. /package/dist/{merchant → client/merchant}/src/components/inputs/ListRepeater.vue.d.ts +0 -0
  139. /package/dist/{merchant → client/merchant}/src/components/inputs/Select.vue.d.ts +0 -0
  140. /package/dist/{merchant → client/merchant}/src/components/inputs/StepperField.vue.d.ts +0 -0
  141. /package/dist/{merchant → client/merchant}/src/components/inputs/Switch.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/index.d.ts +0 -0
  144. /package/dist/{merchant → client/merchant}/src/components/modals/TemplateSelectionModal.vue.d.ts +0 -0
  145. /package/dist/{merchant → client/merchant}/src/composables/useNode/index.d.ts +0 -0
  146. /package/dist/{merchant → client/merchant}/src/composables/useToast/index.d.ts +0 -0
  147. /package/dist/{merchant → client/merchant}/src/config/defaultTemplateConfig.d.ts +0 -0
  148. /package/dist/{merchant → client/merchant}/src/helpers/businessUrl.d.ts +0 -0
  149. /package/dist/{merchant → client/merchant}/src/main.d.ts +0 -0
  150. /package/dist/{merchant → client/merchant}/src/node-configs/branch-list/props.d.ts +0 -0
  151. /package/dist/{merchant → client/merchant}/src/node-configs/branch-list/schema.d.ts +0 -0
  152. /package/dist/{merchant → client/merchant}/src/node-configs/button-list/props.d.ts +0 -0
  153. /package/dist/{merchant → client/merchant}/src/node-configs/button-list/schema.d.ts +0 -0
  154. /package/dist/{merchant → client/merchant}/src/node-configs/carousel/props.d.ts +0 -0
  155. /package/dist/{merchant → client/merchant}/src/node-configs/carousel/schema.d.ts +0 -0
  156. /package/dist/{merchant → client/merchant}/src/node-configs/container/props.d.ts +0 -0
  157. /package/dist/{merchant → client/merchant}/src/node-configs/container/schema.d.ts +0 -0
  158. /package/dist/{merchant → client/merchant}/src/node-configs/display-image/props.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/props.d.ts +0 -0
  161. /package/dist/{merchant → client/merchant}/src/node-configs/display-text/schema.d.ts +0 -0
  162. /package/dist/{merchant → client/merchant}/src/node-configs/homepage/props.d.ts +0 -0
  163. /package/dist/{merchant → client/merchant}/src/node-configs/homepage/schema.d.ts +0 -0
  164. /package/dist/{merchant → client/merchant}/src/node-configs/member-achievements/mock-data.d.ts +0 -0
  165. /package/dist/{merchant → client/merchant}/src/node-configs/member-achievements/props.d.ts +0 -0
  166. /package/dist/{merchant → client/merchant}/src/node-configs/member-achievements/schema.d.ts +0 -0
  167. /package/dist/{merchant → client/merchant}/src/node-configs/member-card/mock-data.d.ts +0 -0
  168. /package/dist/{merchant → client/merchant}/src/node-configs/member-card/props.d.ts +0 -0
  169. /package/dist/{merchant → client/merchant}/src/node-configs/member-card/schema.d.ts +0 -0
  170. /package/dist/{merchant → client/merchant}/src/node-configs/member-cards/mock-data.d.ts +0 -0
  171. /package/dist/{merchant → client/merchant}/src/node-configs/member-cards/props.d.ts +0 -0
  172. /package/dist/{merchant → client/merchant}/src/node-configs/member-cards/schema.d.ts +0 -0
  173. /package/dist/{merchant → client/merchant}/src/node-configs/member-history/mock-data.d.ts +0 -0
  174. /package/dist/{merchant → client/merchant}/src/node-configs/member-history/props.d.ts +0 -0
  175. /package/dist/{merchant → client/merchant}/src/node-configs/member-history/schema.d.ts +0 -0
  176. /package/dist/{merchant → client/merchant}/src/node-configs/member-profile/props.d.ts +0 -0
  177. /package/dist/{merchant → client/merchant}/src/node-configs/member-profile/schema.d.ts +0 -0
  178. /package/dist/{merchant → client/merchant}/src/node-configs/member-referral/props.d.ts +0 -0
  179. /package/dist/{merchant → client/merchant}/src/node-configs/member-referral/schema.d.ts +0 -0
  180. /package/dist/{merchant → client/merchant}/src/node-configs/member-referral-tutorial/props.d.ts +0 -0
  181. /package/dist/{merchant → client/merchant}/src/node-configs/member-referral-tutorial/schema.d.ts +0 -0
  182. /package/dist/{merchant → client/merchant}/src/node-configs/member-summary/mock-data.d.ts +0 -0
  183. /package/dist/{merchant → client/merchant}/src/node-configs/member-summary/props.d.ts +0 -0
  184. /package/dist/{merchant → client/merchant}/src/node-configs/member-summary/schema.d.ts +0 -0
  185. /package/dist/{merchant → client/merchant}/src/node-configs/mock-data.d.ts +0 -0
  186. /package/dist/{merchant → client/merchant}/src/node-configs/order-history-card/mock-data.d.ts +0 -0
  187. /package/dist/{merchant → client/merchant}/src/node-configs/order-history-card/props.d.ts +0 -0
  188. /package/dist/{merchant → client/merchant}/src/node-configs/order-history-card/schema.d.ts +0 -0
  189. /package/dist/{merchant → client/merchant}/src/node-configs/order-method/props.d.ts +0 -0
  190. /package/dist/{merchant → client/merchant}/src/node-configs/order-method/schema.d.ts +0 -0
  191. /package/dist/{merchant → client/merchant}/src/node-configs/props.d.ts +0 -0
  192. /package/dist/{merchant → client/merchant}/src/node-configs/schema.d.ts +0 -0
  193. /package/dist/{merchant → client/merchant}/src/plugin/formkit-i18n.d.ts +0 -0
  194. /package/dist/{merchant → client/merchant}/src/plugin/formkit.d.ts +0 -0
  195. /package/dist/{merchant → client/merchant}/src/plugin/i18n.d.ts +0 -0
  196. /package/dist/{merchant → client/merchant}/src/router/index.d.ts +0 -0
  197. /package/dist/{merchant → client/merchant}/src/router/shared.d.ts +0 -0
  198. /package/dist/{merchant → client/merchant}/src/stores/editor/index.d.ts +0 -0
  199. /package/dist/{merchant → client/merchant}/src/stores/template/index.d.ts +0 -0
  200. /package/dist/{merchant → client/merchant}/src/utils/deep-to-raw.d.ts +0 -0
  201. /package/dist/{merchant → client/merchant}/src/utils/image.d.ts +0 -0
  202. /package/dist/{merchant → client/merchant}/src/utils/provider-keys.d.ts +0 -0
  203. /package/dist/{merchant → client/merchant}/src/views/views.d.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-brand-app-builder",
3
- "version": "0.5.22-dev.0",
3
+ "version": "0.5.23-dev.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -14,20 +14,23 @@
14
14
  "./style": "./dist/style.css"
15
15
  },
16
16
  "dependencies": {
17
- "@feedmepos/brand-core": "0.0.2-alpha.1",
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.5.5",
20
+ "@feedmepos/ui-library": "1.8.4",
20
21
  "@formkit/core": "^1.6.7",
21
22
  "@formkit/vue": "^1.6.7",
23
+ "@monaco-editor/loader": "^1.5.0",
22
24
  "axios": "^1.7.2",
23
25
  "dayjs": "^1.11.13",
24
26
  "dotenv": "^16.4.5",
25
27
  "i18next": "^25.1.1",
28
+ "monaco-editor": "^0.52.2",
26
29
  "opentype.js": "^1.3.4",
27
30
  "pinia": "^2.1.7",
28
31
  "qrcode": "^1.5.4",
29
32
  "uuid": "^9.0.1",
30
- "vue": "^3.5.12",
33
+ "vue": "3.5.13",
31
34
  "vue-accessible-color-picker": "^5.2.0",
32
35
  "vue-i18n": "^11.1.3",
33
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
- };