@chaibuilder/sdk 1.2.9 → 1.2.10-7.beta.1

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 (122) hide show
  1. package/README.md +26 -21
  2. package/dist/CodeEditor-3Vp79cuE.cjs +1 -0
  3. package/dist/CodeEditor-bUqM7eCa.js +129 -0
  4. package/dist/STRINGS-Xxstm-7I.js +7 -0
  5. package/dist/STRINGS-Yl7cSWDc.cjs +1 -0
  6. package/dist/Topbar-P7-9Rps1.js +124 -0
  7. package/dist/Topbar-xwQ4JUZD.cjs +1 -0
  8. package/dist/UnsplashImages-BxgbXGB6.cjs +1 -0
  9. package/dist/UnsplashImages-nQSvWPU0.js +244 -0
  10. package/dist/UploadImages-L9LlI-jl.cjs +1 -0
  11. package/dist/UploadImages-SVnIHigg.js +153 -0
  12. package/dist/context-menu-YGd09SE1.js +979 -0
  13. package/dist/context-menu-sQn7ryJ6.cjs +1 -0
  14. package/dist/{controls-XPXGHKht.js → controls-lEwMTdPQ.js} +96 -44
  15. package/dist/controls-p9IwFnPx.cjs +1 -0
  16. package/dist/core.cjs +1 -1
  17. package/dist/core.d.ts +344 -119
  18. package/dist/core.js +111 -88
  19. package/dist/iconBase-Ief2hJUZ.js +130 -0
  20. package/dist/iconBase-aZzpqff_.cjs +1 -0
  21. package/dist/index-3NV_rst1.js +9051 -0
  22. package/dist/index-qTKBamQ6.cjs +63 -0
  23. package/dist/jsx-runtime-JYMCiFoE.cjs +27 -0
  24. package/dist/{jsx-runtime-WbnYoNE9.js → jsx-runtime-Sp0orL4X.js} +106 -109
  25. package/dist/mockServiceWorker.js +18 -10
  26. package/dist/plugin-UiUFs2fK.js +44 -0
  27. package/dist/plugin-f6SDZ_Or.js +108 -0
  28. package/dist/plugin-jum1MjXp.cjs +1 -0
  29. package/dist/plugin-xOpS-UNV.cjs +1 -0
  30. package/dist/render.cjs +3 -1
  31. package/dist/render.d.ts +21 -40
  32. package/dist/render.js +129 -85
  33. package/dist/runtime.cjs +1 -0
  34. package/dist/runtime.d.ts +5 -0
  35. package/dist/runtime.js +21 -0
  36. package/dist/style.css +2 -2
  37. package/dist/tailwind.cjs +1 -1
  38. package/dist/tailwind.d.ts +49 -8
  39. package/dist/tailwind.js +16 -20
  40. package/dist/ui.cjs +1 -1
  41. package/dist/ui.d.ts +3 -13
  42. package/dist/ui.js +363 -163
  43. package/dist/web-blocks.cjs +3 -9
  44. package/dist/web-blocks.d.ts +1 -1
  45. package/dist/web-blocks.js +722 -770
  46. package/package.json +66 -83
  47. package/dist/AddBlocks-tMxKPoen.js +0 -225
  48. package/dist/AddBlocks-x2LkOHSj.cjs +0 -1
  49. package/dist/BrandingOptions-EzT9UYd6.cjs +0 -1
  50. package/dist/BrandingOptions-QJJ1y5ez.js +0 -194
  51. package/dist/CanvasArea-mlNKmCOh.js +0 -1425
  52. package/dist/CanvasArea-xs4wM64L.cjs +0 -60
  53. package/dist/CurrentPage-aaU4F7wi.cjs +0 -1
  54. package/dist/CurrentPage-lBy25sZn.js +0 -111
  55. package/dist/Functions-7jnEwJyw.js +0 -15
  56. package/dist/Functions-N3yhPYKY.cjs +0 -1
  57. package/dist/Layers-3Xs4A5i8.js +0 -404
  58. package/dist/Layers-eaHy5PK9.cjs +0 -1
  59. package/dist/MODIFIERS-2FeVfZQ9.cjs +0 -1
  60. package/dist/MODIFIERS-RiXS5Mn1.js +0 -67
  61. package/dist/MarkAsGlobalBlock-BjP-Rqlf.js +0 -88
  62. package/dist/MarkAsGlobalBlock-X5dNmZcb.cjs +0 -1
  63. package/dist/PagesPanel--BZhafnt.js +0 -69
  64. package/dist/PagesPanel-gGKCV394.cjs +0 -1
  65. package/dist/ProjectPanel-YcLkM-DW.js +0 -90
  66. package/dist/ProjectPanel-yFJRy0_E.cjs +0 -1
  67. package/dist/Settings-7wlLcvoh.cjs +0 -1
  68. package/dist/Settings-TAgX4hov.js +0 -2186
  69. package/dist/SidePanels-5H4j0mIs.cjs +0 -1
  70. package/dist/SidePanels-btVQQkVK.js +0 -349
  71. package/dist/Topbar-V8xCetWF.cjs +0 -1
  72. package/dist/Topbar-j4t4AgCq.js +0 -116
  73. package/dist/UnsplashImages-41Y3q5_Q.js +0 -200
  74. package/dist/UnsplashImages-DbHky6cj.cjs +0 -1
  75. package/dist/UploadImages-DnQ95_NW.cjs +0 -1
  76. package/dist/UploadImages-xBg-kbKv.js +0 -138
  77. package/dist/_commonjsHelpers-UyOWmZb0.js +0 -8
  78. package/dist/_commonjsHelpers-wDK0ZLPo.cjs +0 -1
  79. package/dist/add-page-modal-MwS7iXn_.cjs +0 -1
  80. package/dist/add-page-modal-cm8damU2.js +0 -108
  81. package/dist/confirm-alert-U7-NcG7G.cjs +0 -1
  82. package/dist/confirm-alert-i4pM3mOt.js +0 -62
  83. package/dist/controls-Dy1qa8Dc.cjs +0 -1
  84. package/dist/delete-page-modal-5o4jXu-z.cjs +0 -1
  85. package/dist/delete-page-modal-YrIBvfFA.js +0 -88
  86. package/dist/email-blocks.cjs +0 -1
  87. package/dist/email-blocks.d.ts +0 -3
  88. package/dist/email-blocks.js +0 -274
  89. package/dist/form-OVmsLOrc.js +0 -125
  90. package/dist/form-VbouZlAW.cjs +0 -1
  91. package/dist/functions-Ox_svtKm.cjs +0 -1
  92. package/dist/functions-xIebp8Aw.js +0 -23
  93. package/dist/html-to-json-2PeOCVey.cjs +0 -1
  94. package/dist/html-to-json-57841sEK.js +0 -183
  95. package/dist/index-H6vIwGfD.cjs +0 -1
  96. package/dist/index-N50dZnlC.cjs +0 -206
  97. package/dist/index-e0c8PmRQ.js +0 -205
  98. package/dist/index-gi1LIOCw.cjs +0 -1
  99. package/dist/index-niHREMmR.js +0 -2938
  100. package/dist/index-pZhGT8uT.js +0 -41620
  101. package/dist/jsx-runtime-Z_BpKhVy.cjs +0 -27
  102. package/dist/lib.cjs +0 -4
  103. package/dist/lib.d.ts +0 -78
  104. package/dist/lib.js +0 -1322
  105. package/dist/page-viewer-SLt8XgYv.cjs +0 -1
  106. package/dist/page-viewer-feqJr1QI.js +0 -115
  107. package/dist/project-general-setting-SgagORzW.js +0 -83
  108. package/dist/project-general-setting-ym0yCdOq.cjs +0 -1
  109. package/dist/project-seo-setting-Snn2nZgS.cjs +0 -1
  110. package/dist/project-seo-setting-wxAGEkd_.js +0 -85
  111. package/dist/server.cjs +0 -1
  112. package/dist/server.d.ts +0 -299
  113. package/dist/server.js +0 -216
  114. package/dist/single-page-detail-IPod1o5P.cjs +0 -1
  115. package/dist/single-page-detail-dnWMyg6P.js +0 -222
  116. package/dist/studio.cjs +0 -1
  117. package/dist/studio.d.ts +0 -13
  118. package/dist/studio.js +0 -58
  119. package/dist/useAddBlockByDrop-_nwI4W3q.js +0 -20
  120. package/dist/useAddBlockByDrop-inkD7Lck.cjs +0 -1
  121. package/dist/utils-AvyFzbPC.js +0 -1075
  122. package/dist/utils-PTxFk6qT.cjs +0 -1
@@ -1,2186 +0,0 @@
1
- import { j as e } from "./jsx-runtime-WbnYoNE9.js";
2
- import * as ne from "react";
3
- import I, { useState as j, useMemo as _, useEffect as O, useCallback as B, memo as ct, createContext as Me, useContext as se } from "react";
4
- import { useThrottledCallback as fe } from "@react-hookz/web";
5
- import { forEach as ke, isArray as ie, omit as pt, truncate as ut, includes as P, get as x, first as ue, split as xt, startCase as Y, toLower as le, isEmpty as m, map as C, find as gt, last as ve, filter as we, set as Oe, keys as ht, cloneDeep as yt, each as bt, capitalize as mt, reject as ft, nth as Ve, startsWith as W, isNumber as vt, parseInt as wt, isNaN as Xe, findLast as jt, flatten as U, intersection as Ye, has as ye, isNull as Ct } from "lodash-es";
6
- import { useTranslation as K } from "react-i18next";
7
- import { PlusIcon as Ne, Cross2Icon as Fe, EyeOpenIcon as kt, EyeClosedIcon as He, BorderAllIcon as A, WidthIcon as T, HeightIcon as R, ArrowUpIcon as Q, ArrowRightIcon as ee, ArrowDownIcon as te, ArrowLeftIcon as re, ArrowTopLeftIcon as Nt, ArrowTopRightIcon as _t, ArrowBottomRightIcon as St, ArrowBottomLeftIcon as Tt, AlignLeftIcon as Rt, AlignCenterHorizontallyIcon as Vt, AlignRightIcon as Ht, StretchHorizontallyIcon as Bt, FontItalicIcon as Dt, UnderlineIcon as $t, OverlineIcon as It, LetterCaseUppercaseIcon as At, Cross1Icon as Pt, InfoCircledIcon as _e, MinusIcon as Et, BoxIcon as ze, RowSpacingIcon as Lt, TriangleDownIcon as Mt, CrossCircledIcon as Ot, TrashIcon as Xt, MixerHorizontalIcon as Ze } from "@radix-ui/react-icons";
8
- import { a$ as Yt, b0 as Ft, B as xe, b1 as zt, b2 as Zt, b3 as Wt, b4 as Ut, b5 as Kt, b6 as qt, b7 as Gt, a7 as q, an as Jt, ao as Qt, ap as er, b8 as tr, al as rr, b9 as lr, am as sr, aD as F, aE as z, aG as Z, ba as or, bb as ar, bc as nr, bd as ir, be as dr, bf as cr, p as We, ad as Ue, i as pr, bg as Ke, bh as de, bi as ce, bj as pe, ak as Se, Q as qe, a4 as Ge, j as Je, aI as Te, bk as ur, bl as xr, a5 as ge, X as gr, aa as Qe, U as Be, ah as hr, ae as yr, bm as br, ar as mr, as as fr, at as vr, au as wr, av as V, bn as et, ax as jr, ay as Cr, az as De, aA as $e } from "./index-niHREMmR.js";
9
- import { u as kr } from "./controls-XPXGHKht.js";
10
- import { Check as Nr, EditIcon as _r, TrashIcon as Sr } from "lucide-react";
11
- import { getBlockComponent as tt, getChaiDataProviders as Tr } from "@chaibuilder/runtime";
12
- import { E as rt, u as lt } from "./index-pZhGT8uT.js";
13
- import { J as Rr, a as Vr, d as Hr } from "./index-e0c8PmRQ.js";
14
- import Br from "@rjsf/core";
15
- import Dr from "@rjsf/validator-ajv8";
16
- import { useAtom as $r } from "jotai";
17
- import Ir from "react-autosuggest";
18
- import Ar from "fuse.js";
19
- import { A as Pr, C as he, g as Er } from "./utils-AvyFzbPC.js";
20
- import { a as Lr } from "./MODIFIERS-RiXS5Mn1.js";
21
- import "./_commonjsHelpers-UyOWmZb0.js";
22
- import "@radix-ui/react-toggle";
23
- import "class-variance-authority";
24
- import "@radix-ui/react-switch";
25
- import "@radix-ui/react-slot";
26
- import "@radix-ui/react-accordion";
27
- import "@radix-ui/react-alert-dialog";
28
- import "@radix-ui/react-dialog";
29
- import "@radix-ui/react-label";
30
- import "@radix-ui/react-scroll-area";
31
- import "@radix-ui/react-tabs";
32
- import "@radix-ui/react-tooltip";
33
- import "@radix-ui/react-popover";
34
- import "@radix-ui/react-menubar";
35
- import "@radix-ui/react-hover-card";
36
- import "@radix-ui/react-select";
37
- import "@radix-ui/react-dropdown-menu";
38
- import "@radix-ui/react-separator";
39
- import "@radix-ui/react-toast";
40
- import "cmdk";
41
- import "@radix-ui/react-context-menu";
42
- import "react-icons-picker";
43
- import "react-dom";
44
- import "react-quill";
45
- import "flat-to-nested";
46
- import "./Functions-7jnEwJyw.js";
47
- import "clsx";
48
- import "tailwind-merge";
49
- import "redux-undo";
50
- import "lodash";
51
- import "i18next";
52
- import "@floating-ui/react-dom";
53
- import "react-textarea-autosize";
54
- import "flagged";
55
- import "react-dnd";
56
- import "@minoru/react-dnd-treeview";
57
- import "react-hotkeys-hook";
58
- import "sonner";
59
- import "./html-to-json-57841sEK.js";
60
- import "himalaya";
61
- import "./web-blocks.js";
62
- function Mr(r) {
63
- const s = [], t = {};
64
- function o(l, d) {
65
- ke(d, (a, c) => {
66
- const i = l ? `${l}.${c}` : c, p = ie(a) ? "list" : typeof a;
67
- s.push(i), t[i] = p === "string" ? "text" : p === "object" ? "model" : p, p === "object" && !ie(a) && o(i, a);
68
- });
69
- }
70
- return o("", pt(r, ["styles", "_type", "_id", "_name", "_bindings"])), { paths: s, pathsType: t };
71
- }
72
- const je = ({ data: r, fullView: s }) => {
73
- if (!r)
74
- return null;
75
- const t = typeof r;
76
- return s ? typeof r == "object" ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
77
- /* @__PURE__ */ e.jsx("div", { className: "h-3" }),
78
- /* @__PURE__ */ e.jsx(rt, { children: /* @__PURE__ */ e.jsx(
79
- Rr,
80
- {
81
- data: r,
82
- shouldExpandNode: Vr,
83
- style: {
84
- ...Hr,
85
- container: "max-h-[40vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",
86
- stringValue: "text-orange-600",
87
- label: "text-green-900 font-semibold pr-1 tracking-wider"
88
- }
89
- }
90
- ) })
91
- ] }) : /* @__PURE__ */ e.jsxs("div", { className: "max-h-36 w-full overflow-y-auto overflow-x-hidden text-[12px] leading-4 text-gray-800/50", children: [
92
- /* @__PURE__ */ e.jsx("span", { className: "font-medium text-gray-800/80", children: "Content: " }),
93
- r
94
- ] }) : /* @__PURE__ */ e.jsx("div", { className: "w-full overflow-hidden whitespace-nowrap text-[10px] leading-3 text-gray-800/50", children: ut(t === "object" ? JSON.stringify(r) : r, { length: 40 }) });
95
- }, Ie = ({
96
- type: r,
97
- value: s = "",
98
- setValue: t,
99
- data: o,
100
- onChange: l,
101
- dataType: d,
102
- appliedBindings: a
103
- }) => {
104
- const { paths: c, pathsType: i } = Mr(o), p = r === "PROP" ? tt(o == null ? void 0 : o._type) : {}, y = r === "PROP", [n, h] = j(!1), g = _(() => r === "PROP" ? c.filter(
105
- (u) => !P(a, u) && x(p, `props.${ue(xt(u, "."))}.binding`)
106
- ) : c.filter((u) => d === x(i, u, "")), [r, c, a, d, p]);
107
- return O(() => {
108
- s && l(s);
109
- }, [s, r]), /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
110
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-4", children: [
111
- /* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground", children: Y(le(r)) }),
112
- /* @__PURE__ */ e.jsxs(Yt, { open: n, onOpenChange: h, children: [
113
- /* @__PURE__ */ e.jsx(Ft, { asChild: !0, children: /* @__PURE__ */ e.jsx(
114
- xe,
115
- {
116
- variant: "outline",
117
- size: "sm",
118
- className: ` ${m(s) ? "w-44 justify-center bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white" : "min-w-[350px] items-center justify-between"}`,
119
- children: s ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
120
- /* @__PURE__ */ e.jsxs("span", { className: "pr-8 text-sm", children: [
121
- y && /* @__PURE__ */ e.jsx("span", { className: "mr-2 rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: Y(d) }),
122
- s
123
- ] }),
124
- /* @__PURE__ */ e.jsx("span", { className: "cursor-pointer text-[9px] text-blue-400 underline hover:text-blue-700", children: "Change" })
125
- ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
126
- "+ Set ",
127
- Y(le(r))
128
- ] })
129
- }
130
- ) }),
131
- /* @__PURE__ */ e.jsx(zt, { className: "z-[999] min-w-[300px] p-0", side: "right", align: "start", children: /* @__PURE__ */ e.jsxs(Zt, { children: [
132
- /* @__PURE__ */ e.jsx(Wt, { placeholder: `Choose ${le(r)}...` }),
133
- /* @__PURE__ */ e.jsxs(Ut, { children: [
134
- /* @__PURE__ */ e.jsx(Kt, { children: "No results found." }),
135
- /* @__PURE__ */ e.jsx(qt, { children: C(g, (u) => /* @__PURE__ */ e.jsxs(
136
- Gt,
137
- {
138
- value: u,
139
- className: `cursor-pointer ${y ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
140
- onSelect: (f) => {
141
- t(gt(g, (k) => k === f) || null), h(!1);
142
- },
143
- children: [
144
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-x-2", children: [
145
- /* @__PURE__ */ e.jsx(Nr, { className: `h-4 w-4 text-green-500 ${s === u ? "" : "opacity-0"}` }),
146
- u
147
- ] }),
148
- y ? /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx("span", { className: "rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: Y(x(i, u, "")) }) }) : /* @__PURE__ */ e.jsx("div", { className: "pl-6", children: /* @__PURE__ */ e.jsx(je, { data: x(o, u) }) })
149
- ]
150
- },
151
- u
152
- )) })
153
- ] })
154
- ] }) })
155
- ] })
156
- ] }),
157
- !y && !m(s) && /* @__PURE__ */ e.jsx("div", { className: "pt-2", children: /* @__PURE__ */ e.jsx(je, { data: x(o, s, ""), fullView: !0 }) })
158
- ] });
159
- }, Or = ({
160
- appliedBindings: r = [],
161
- onAddBinding: s,
162
- editMode: t,
163
- item: o
164
- }) => {
165
- const [l, d] = j(t ? o.key : ""), [a, c] = j(t ? o.value : ""), i = q(), [p] = lt(), y = B(
166
- (g, u) => {
167
- if (m(g))
168
- return "";
169
- {
170
- const f = x(u === "PROP" ? i : p, g, "");
171
- if (ie(f))
172
- return "list";
173
- const k = typeof f;
174
- return k === "string" ? "text" : k === "object" ? "model" : k;
175
- }
176
- },
177
- [i, p]
178
- ), [n, h] = j(t ? y(o.key, "PROP") : "");
179
- return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
180
- /* @__PURE__ */ e.jsxs(Jt, { children: [
181
- /* @__PURE__ */ e.jsx(Qt, { children: "Add Data Binding" }),
182
- /* @__PURE__ */ e.jsx(er, { className: "text-xs", children: "Add prop and path of binding. Click save when you're done." })
183
- ] }),
184
- /* @__PURE__ */ e.jsxs("div", { className: "relative flex flex-col gap-1", children: [
185
- /* @__PURE__ */ e.jsx(
186
- Ie,
187
- {
188
- type: "PROP",
189
- isDisabled: !1,
190
- placeholder: "Enter prop key",
191
- value: l,
192
- setValue: d,
193
- onChange: (g) => {
194
- const u = y(g, "PROP");
195
- d(g), n !== u && c(""), h(u);
196
- },
197
- data: i,
198
- dataType: n,
199
- appliedBindings: r
200
- }
201
- ),
202
- /* @__PURE__ */ e.jsx("div", { className: "h-2" }),
203
- /* @__PURE__ */ e.jsx(
204
- Ie,
205
- {
206
- type: "PATH",
207
- isDisabled: m(l),
208
- placeholder: "Enter data path",
209
- value: a,
210
- setValue: c,
211
- onChange: (g) => {
212
- const u = y(g, "PATH");
213
- c(n === u ? g : "");
214
- },
215
- data: p,
216
- dataType: n,
217
- appliedBindings: r
218
- }
219
- )
220
- ] }),
221
- /* @__PURE__ */ e.jsx(tr, { children: /* @__PURE__ */ e.jsx(
222
- xe,
223
- {
224
- type: "submit",
225
- className: "mt-4",
226
- disabled: m(l) && m(a),
227
- onClick: () => s({ key: l, value: a }),
228
- children: "Save"
229
- }
230
- ) })
231
- ] });
232
- }, st = ({ disabled: r, children: s, onAddBinding: t, appliedBindings: o, editMode: l = !0, item: d = {} }) => {
233
- const [a, c] = j(!1);
234
- return /* @__PURE__ */ e.jsxs(rr, { children: [
235
- /* @__PURE__ */ e.jsx(lr, { disabled: r, asChild: !0, onClick: () => c(!0), children: s }),
236
- a && /* @__PURE__ */ e.jsx(sr, { children: /* @__PURE__ */ e.jsx(
237
- Or,
238
- {
239
- item: d,
240
- editMode: l,
241
- appliedBindings: o,
242
- onAddBinding: (i) => {
243
- t(i), c(!1);
244
- }
245
- }
246
- ) })
247
- ] });
248
- }, Xr = ({
249
- item: r,
250
- onAddBinding: s,
251
- onRemove: t,
252
- selectedBlock: o,
253
- dataProvider: l,
254
- appliedBindings: d
255
- }) => {
256
- const [a, c] = j("string"), i = (p, y) => {
257
- if (m(p))
258
- return "";
259
- {
260
- const n = x(y === "PROP" ? o : l, p, "");
261
- if (ie(n))
262
- return "list";
263
- const h = typeof n;
264
- return h === "string" ? "text" : h === "object" ? "model" : h;
265
- }
266
- };
267
- return O(() => c(() => i(r.key, "PROP")), [r.key]), /* @__PURE__ */ e.jsxs("div", { className: "relative flex flex-col rounded-md border border-gray-200 p-2", children: [
268
- /* @__PURE__ */ e.jsx("div", { className: "text-sm font-normal text-gray-500", children: r.key }),
269
- /* @__PURE__ */ e.jsx("div", { className: "font-medium leading-5", children: r.value }),
270
- /* @__PURE__ */ e.jsx(je, { data: x(l, r.value, "") }),
271
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
272
- /* @__PURE__ */ e.jsx(st, { editMode: !0, onAddBinding: s, appliedBindings: d, item: r, children: /* @__PURE__ */ e.jsx(_r, { className: "mt-1 h-6 w-6 cursor-pointer rounded border border-blue-400 p-1 text-blue-400 duration-200 hover:scale-105 hover:bg-blue-400 hover:text-white" }) }),
273
- /* @__PURE__ */ e.jsx(
274
- Sr,
275
- {
276
- onClick: () => t(),
277
- className: "mt-1 h-6 w-6 cursor-pointer rounded border border-red-400 p-1 text-red-400 duration-200 hover:scale-105 hover:bg-red-400 hover:text-white"
278
- }
279
- )
280
- ] }),
281
- !m(a) && !m(r.key) && /* @__PURE__ */ e.jsx("div", { className: "absolute right-0 top-1 mt-px flex h-4 items-center rounded-full px-2 text-[10px] font-medium text-purple-600", children: Y(a) })
282
- ] });
283
- }, Yr = ({ bindingData: r, onChange: s }) => {
284
- const t = q(), [o] = lt(), l = Tr(), [d, a] = j(
285
- C(r, (n, h) => ({ key: h, value: n }))
286
- );
287
- O(() => {
288
- a(C(r, (n, h) => ({ key: h, value: n })));
289
- }, [t == null ? void 0 : t._id]);
290
- const c = _(() => {
291
- if (m(o))
292
- return !0;
293
- if (m(d))
294
- return !1;
295
- const n = ve(d);
296
- return m(n == null ? void 0 : n.key) || m(n == null ? void 0 : n.value);
297
- }, [o, d]), i = (n) => {
298
- const h = we(d, (g) => g.key !== n.key);
299
- a([...h, n]), y([...h, n]);
300
- }, p = (n) => {
301
- const h = we(d, (g, u) => n !== u);
302
- y([...h]);
303
- }, y = B(
304
- (n = []) => {
305
- if (a(n), m(n)) {
306
- s({});
307
- return;
308
- }
309
- const h = {};
310
- ke(n, (g) => {
311
- !m(g == null ? void 0 : g.key) && !m(g == null ? void 0 : g.value) && Oe(h, g.key, g.value);
312
- }), s(h);
313
- },
314
- [s]
315
- );
316
- return m(l) ? /* @__PURE__ */ e.jsx("div", { className: "flex w-full items-center justify-center", children: /* @__PURE__ */ e.jsxs("p", { className: "mb-1.5 text-xs text-gray-500", children: [
317
- "You have no data providers registered. Please add a data provider to your project. ",
318
- /* @__PURE__ */ e.jsx("br", {}),
319
- /* @__PURE__ */ e.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: "Learn more" })
320
- ] }) }) : /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
321
- C(d, (n, h) => /* @__PURE__ */ e.jsx(
322
- Xr,
323
- {
324
- item: n,
325
- onAddBinding: i,
326
- onRemove: () => p(h),
327
- selectedBlock: t,
328
- dataProvider: o,
329
- appliedBindings: C(d, "key")
330
- },
331
- n.key
332
- )),
333
- /* @__PURE__ */ e.jsxs(F, { delayDuration: 200, children: [
334
- /* @__PURE__ */ e.jsx(z, { className: "w-full", children: /* @__PURE__ */ e.jsx(
335
- st,
336
- {
337
- disabled: c,
338
- appliedBindings: C(d, "key"),
339
- onAddBinding: i,
340
- children: /* @__PURE__ */ e.jsx(
341
- "span",
342
- {
343
- className: `w-full rounded-md px-5 py-1.5 text-xs font-medium duration-200 ${c ? "cursor-not-allowed bg-gray-200 text-gray-400" : "bg-blue-700/20 text-blue-800 hover:bg-blue-700/30"}`,
344
- children: m(o) ? /* @__PURE__ */ e.jsx("small", { className: "text-[9.5px] text-gray-500", children: "No data provider has been set up for this page" }) : "+ Add Data Binding"
345
- }
346
- )
347
- }
348
- ) }),
349
- c && /* @__PURE__ */ e.jsx(Z, { sideOffset: -55, className: "text-[11px]", children: m(o) ? "No data provider has been set up for this page." : "Complete last added data binding to add more" })
350
- ] })
351
- ] });
352
- }, Fr = () => /* @__PURE__ */ e.jsx("div", { className: "text-xs border rounded-sm p-1 mt-1 border-orange-500 text-orange-500 bg-orange-100", children: "Data binding is set for this field" }), be = ct(({ createHistorySnapshot: r, properties: s, formData: t, onChange: o }) => {
353
- const l = { type: "object", properties: {} }, d = {};
354
- return Object.keys(s).forEach((a) => {
355
- const c = s[a];
356
- if (P(["slot", "styles"], c.type))
357
- return;
358
- const i = a;
359
- l.properties[i] = or(c), d[i] = ar(c);
360
- }), /* @__PURE__ */ e.jsx(
361
- Br,
362
- {
363
- widgets: {
364
- binding: Fr,
365
- richtext: nr,
366
- icon: ir,
367
- image: dr
368
- },
369
- fields: { link: cr },
370
- idSeparator: ".",
371
- autoComplete: "off",
372
- omitExtraData: !1,
373
- liveOmit: !1,
374
- liveValidate: !1,
375
- validator: Dr,
376
- uiSchema: d,
377
- onBlur: r,
378
- schema: l,
379
- formData: t,
380
- onChange: o
381
- }
382
- );
383
- });
384
- function zr() {
385
- const r = q(), { createSnapshot: s } = We(), t = Ue(), o = tt(r._type), l = { ...r }, d = pr("dataBindingSupport", !1), a = () => s(), c = ({ formData: n }, h) => {
386
- if (h) {
387
- const g = h.replace("root.", "");
388
- t([r._id], { [g]: x(n, g) });
389
- }
390
- }, i = {
391
- _name: kr({
392
- title: "Name",
393
- default: x(r, "_name", r._type)
394
- })
395
- }, p = ht(x(l, "_bindings", {})), y = _(() => {
396
- const n = yt(x(o, "props", {}));
397
- return d && bt(p, (h) => delete n[h]), n;
398
- }, [o, p, d]);
399
- return /* @__PURE__ */ e.jsxs("div", { className: "overflow-x-hidden", children: [
400
- /* @__PURE__ */ e.jsx(
401
- be,
402
- {
403
- onChange: c,
404
- createHistorySnapshot: a,
405
- formData: l,
406
- properties: i
407
- }
408
- ),
409
- /* @__PURE__ */ e.jsx("hr", { className: "mt-4" }),
410
- d ? /* @__PURE__ */ e.jsxs(Ke, { type: "multiple", defaultValue: ["STATIC", "BINDING"], className: "h-full w-full", children: [
411
- /* @__PURE__ */ e.jsxs(de, { value: "BINDING", children: [
412
- /* @__PURE__ */ e.jsx(ce, { className: "bg-gray-100 px-3 py-2 text-xs hover:no-underline", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-x-2", children: [
413
- /* @__PURE__ */ e.jsx(
414
- "div",
415
- {
416
- className: `h-[8px] w-[8px] rounded-full ${m(x(r, "_bindings", {})) ? "bg-gray-300" : "bg-blue-500"}`
417
- }
418
- ),
419
- "Data Binding"
420
- ] }) }),
421
- /* @__PURE__ */ e.jsx(pe, { className: "px-4 pt-4", children: /* @__PURE__ */ e.jsx(
422
- Yr,
423
- {
424
- bindingData: x(l, "_bindings", {}),
425
- onChange: (n) => {
426
- c({ formData: { ...l, _bindings: n } }, "root._bindings");
427
- }
428
- }
429
- ) })
430
- ] }),
431
- /* @__PURE__ */ e.jsxs(de, { value: "STATIC", children: [
432
- /* @__PURE__ */ e.jsx(ce, { className: "bg-gray-100 px-3 py-2 text-xs hover:no-underline", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-x-2", children: [
433
- /* @__PURE__ */ e.jsx("div", { className: "h-[8px] w-[8px] rounded-full bg-blue-500" }),
434
- "Static Content"
435
- ] }) }),
436
- /* @__PURE__ */ e.jsxs(pe, { className: "pt-4", children: [
437
- m(p) ? null : /* @__PURE__ */ e.jsxs("div", { className: "mx-4 mb-1 mt-0 rounded-sm border border-orange-500 bg-orange-100 p-1 text-xs text-orange-500", children: [
438
- "Data binding is set for ",
439
- /* @__PURE__ */ e.jsx("b", { children: C(p, mt).join(", ") }),
440
- " ",
441
- p.length === 1 ? "property" : "properties",
442
- ". Remove data binding to edit static content."
443
- ] }),
444
- /* @__PURE__ */ e.jsx(
445
- be,
446
- {
447
- onChange: c,
448
- createHistorySnapshot: a,
449
- formData: l,
450
- properties: y
451
- }
452
- )
453
- ] })
454
- ] })
455
- ] }) : /* @__PURE__ */ e.jsx(
456
- be,
457
- {
458
- onChange: c,
459
- createHistorySnapshot: a,
460
- formData: l,
461
- properties: y
462
- }
463
- ),
464
- /* @__PURE__ */ e.jsx("div", { className: "pb-60" })
465
- ] });
466
- }
467
- const Ae = new Ar(Pr, {
468
- isCaseSensitive: !1,
469
- threshold: 0.2,
470
- minMatchCharLength: 2,
471
- keys: ["name"]
472
- });
473
- function Zr() {
474
- var E;
475
- const [r] = Se(), s = q(), t = qe(), o = Ge(), [l] = Je(), [d, a] = j(""), c = (E = ue(r)) == null ? void 0 : E.prop, i = ft((x(s, c, "").replace(Lr, "").split(",").pop() || "").split(" "), m), p = () => {
476
- const w = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
477
- t(l, w, !0), a("");
478
- }, [y, n] = j([]), h = ({ value: w }) => {
479
- const $ = w.trim().toLowerCase(), L = $.match(/.+:/g);
480
- let N = [];
481
- if (L && L.length > 0) {
482
- const [D] = L, X = $.replace(D, "");
483
- N = Ae.search(X).map((b) => ({
484
- ...b,
485
- item: { ...b.item, name: D + b.item.name }
486
- }));
487
- } else
488
- N = Ae.search($);
489
- n(C(N, "item"));
490
- }, g = () => {
491
- n([]);
492
- }, u = (w) => w.name, f = (w) => /* @__PURE__ */ e.jsx("div", { className: "rounded-md p-1", children: w.name }), k = {
493
- autoComplete: "off",
494
- autoCorrect: "off",
495
- autoCapitalize: "off",
496
- spellCheck: !1,
497
- placeholder: "Enter class name",
498
- value: d,
499
- onKeyDown: (w) => {
500
- w.key === "Enter" && d.trim() !== "" && p();
501
- },
502
- onChange: (w, { newValue: $ }) => a($),
503
- className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
504
- };
505
- return /* @__PURE__ */ e.jsxs(
506
- "div",
507
- {
508
- className: `no-scrollbar flex ${y.length > 0 ? "min-h-[300px]" : "min-h-max"} w-full flex-col gap-y-5 overflow-y-auto bg-gray-100 px-px`,
509
- children: [
510
- /* @__PURE__ */ e.jsx(Te, { className: "mt-2", children: "Add Tailwind classes" }),
511
- /* @__PURE__ */ e.jsxs("div", { className: "relative -mt-4 flex items-center gap-x-3", children: [
512
- /* @__PURE__ */ e.jsx("div", { className: "relative flex w-full items-center gap-x-3", children: /* @__PURE__ */ e.jsx(
513
- Ir,
514
- {
515
- suggestions: y,
516
- onSuggestionsFetchRequested: h,
517
- onSuggestionsClearRequested: g,
518
- getSuggestionValue: u,
519
- renderSuggestion: f,
520
- inputProps: k,
521
- containerProps: {
522
- className: "relative h-8 w-full gap-y-1 py-1 border-gray-600"
523
- },
524
- theme: {
525
- suggestion: "bg-transparent",
526
- suggestionHighlighted: "bg-gray-700 ",
527
- suggestionsContainerOpen: "absolute bg-gray-100 z-50 max-h-[230px] overflow-y-auto w-full border border-gray-600 rounded-md"
528
- }
529
- }
530
- ) }),
531
- /* @__PURE__ */ e.jsx(
532
- xe,
533
- {
534
- variant: "outline",
535
- className: "h-6 border-gray-700",
536
- onClick: p,
537
- disabled: d.trim() === "",
538
- size: "sm",
539
- children: /* @__PURE__ */ e.jsx(Ne, {})
540
- }
541
- )
542
- ] }),
543
- /* @__PURE__ */ e.jsxs("div", { className: "flex w-full flex-wrap gap-2", children: [
544
- m(i) && /* @__PURE__ */ e.jsx("div", { className: "flex h-10 w-full items-center justify-center text-center text-sm text-gray-400", children: "No class added" }),
545
- ne.Children.toArray(
546
- i.map((w) => /* @__PURE__ */ e.jsxs(
547
- "div",
548
- {
549
- className: "group relative flex cursor-default items-center gap-x-1 rounded-full border border-blue-600 bg-blue-500 p-px px-1.5 text-[11px] text-white hover:border-blue-900",
550
- children: [
551
- w,
552
- /* @__PURE__ */ e.jsx(
553
- Fe,
554
- {
555
- onClick: () => o(l, [w]),
556
- className: "invisible absolute right-1 hover:text-white group-hover:visible group-hover:cursor-pointer"
557
- }
558
- )
559
- ]
560
- },
561
- w
562
- ))
563
- )
564
- ] })
565
- ]
566
- }
567
- );
568
- }
569
- const H = ["px", "%", "em", "rem", "ch", "vh", "vw"], Wr = {
570
- heading: "flex.heading",
571
- items: [
572
- { type: "arbitrary", label: "flex.basis", units: H, property: "flexBasis" },
573
- { type: "range", label: "flex.order", property: "order" },
574
- { type: "dropdown", label: "flex.flex", property: "flexGrowShrink" },
575
- { type: "dropdown", label: "flex.grow", property: "flexGrow" },
576
- { type: "dropdown", label: "flex.shrink", property: "flexShrink" }
577
- ]
578
- }, Ur = {
579
- heading: "grid.heading",
580
- items: [
581
- { type: "range", label: "grid.col_span", property: "gridColSpan" },
582
- { type: "range", label: "grid.col_start", property: "gridColStart" },
583
- { type: "range", label: "grid.col_end", property: "gridColEnd" },
584
- { type: "range", label: "grid.row_span", property: "gridRowSpan" },
585
- { type: "range", label: "grid.row_start", property: "gridRowStart" },
586
- { type: "range", label: "grid.row_end", property: "gridRowEnd" },
587
- { type: "range", label: "grid.order", property: "order" }
588
- ]
589
- }, Kr = [
590
- {
591
- heading: "layout.heading",
592
- items: [
593
- { type: "arbitrary", label: "layout.width", units: H.concat("auto"), property: "width" },
594
- { type: "arbitrary", label: "layout.height", units: H.concat("auto"), property: "height" },
595
- {
596
- styleType: "multiple",
597
- label: "layout.margin",
598
- negative: !0,
599
- units: [...H, "auto"],
600
- options: [
601
- { key: "margin", label: "layout.margin_all" },
602
- { key: "marginX", label: "layout.margin_lr" },
603
- { key: "marginY", label: "layout.margin_tb" },
604
- { key: "marginTop", label: "layout.margin_top" },
605
- { key: "marginRight", label: "layout.margin_right" },
606
- { key: "marginBottom", label: "layout.margin_bottom" },
607
- { key: "marginLeft", label: "layout.margin_left" }
608
- ]
609
- },
610
- {
611
- styleType: "multiple",
612
- label: "layout.padding",
613
- options: [
614
- { key: "padding", label: "layout.padding_all" },
615
- { key: "paddingX", label: "layout.padding_lr" },
616
- { key: "paddingY", label: "layout.padding_tb" },
617
- { key: "paddingTop", label: "layout.padding_top" },
618
- { key: "paddingRight", label: "layout.padding_right" },
619
- { key: "paddingBottom", label: "layout.padding_bottom" },
620
- { key: "paddingLeft", label: "layout.padding_left" }
621
- ]
622
- },
623
- {
624
- styleType: "multiple",
625
- label: "layout.space_bt",
626
- options: [
627
- { key: "spaceX", label: "layout.space_lr" },
628
- { key: "spaceY", label: "layout.space_tb" }
629
- ]
630
- }
631
- ]
632
- },
633
- {
634
- heading: "size.heading",
635
- items: [
636
- {
637
- styleType: "accordion",
638
- heading: "size.min_width_height",
639
- items: [
640
- { type: "arbitrary", label: "size.min_width", units: H.concat("auto"), property: "minWidth" },
641
- { type: "arbitrary", label: "size.min_height", units: H.concat("auto"), property: "minHeight" }
642
- ]
643
- },
644
- {
645
- styleType: "accordion",
646
- heading: "size.max_width_height",
647
- items: [
648
- { type: "arbitrary", label: "size.max_width", units: H.concat("auto"), property: "maxWidth" },
649
- { type: "arbitrary", label: "size.max_height", units: H.concat("auto"), property: "maxHeight" }
650
- ]
651
- },
652
- {
653
- styleType: "accordion",
654
- heading: "size.object_options_aspect_ratio",
655
- items: [
656
- { type: "dropdown", label: "size.aspect", property: "aspectRatio" },
657
- { type: "dropdown", label: "size.fit", property: "objectFit" },
658
- { type: "dropdown", label: "size.position", property: "objectPosition" }
659
- ]
660
- }
661
- ]
662
- },
663
- {
664
- heading: "display.heading",
665
- items: [
666
- { type: "dropdown", label: "display.display", property: "display", units: H },
667
- {
668
- styleType: "accordion",
669
- heading: "display.flex_options",
670
- items: [
671
- { type: "dropdown", label: "display.flex_direction", property: "flexDirection" },
672
- { type: "dropdown", label: "display.flex_wrap", property: "flexWrap" },
673
- { type: "dropdown", label: "display.justify_content", property: "justifyContent" },
674
- { type: "dropdown", label: "display.align_content", property: "alignContent" },
675
- { type: "dropdown", label: "display.align_items", property: "alignItems" },
676
- {
677
- styleType: "multiple",
678
- label: "display.gap",
679
- options: [
680
- { key: "gap", label: "display.gap_all" },
681
- { key: "gapX", label: "display.gap_lr" },
682
- { key: "gapY", label: "display.gap_tb" }
683
- ]
684
- }
685
- ],
686
- conditions: { display: "flex" }
687
- },
688
- {
689
- styleType: "accordion",
690
- heading: "display.grid_options",
691
- items: [
692
- { type: "range", label: "display.grid_columns", property: "gridColumns" },
693
- { type: "range", label: "display.grid_rows", property: "gridRows" },
694
- { type: "dropdown", label: "display.grid_auto_flow", property: "gridAutoFlow" },
695
- { type: "dropdown", label: "display.grid_auto_cols", property: "gridAutoColumns" },
696
- { type: "dropdown", label: "display.grid_auto_rows", property: "gridAutoRows" },
697
- { type: "dropdown", label: "display.justify_content", property: "justifyContent" },
698
- { type: "dropdown", label: "display.align_content", property: "alignContent" },
699
- { type: "dropdown", label: "display.align_items", property: "alignItems" },
700
- {
701
- styleType: "multiple",
702
- label: "display.gap",
703
- units: ["px", "rem"],
704
- options: [
705
- { key: "gap", label: "display.gap_all" },
706
- { key: "gapX", label: "display.gap_lr" },
707
- { key: "gapY", label: "display.gap_tb" }
708
- ]
709
- }
710
- ],
711
- conditions: { display: "grid" }
712
- },
713
- {
714
- styleType: "accordion",
715
- heading: "display.visibility_opacity",
716
- items: [
717
- { type: "dropdown", label: "display.visibility", property: "visibility", units: H },
718
- { type: "arbitrary", label: "display.opacity", property: "opacity", units: ["-"] }
719
- ]
720
- }
721
- ]
722
- },
723
- {
724
- heading: "position.heading",
725
- items: [
726
- { type: "icons", label: "position.position", property: "position" },
727
- {
728
- styleType: "accordion",
729
- heading: "position.options",
730
- items: [
731
- {
732
- styleType: "multiple",
733
- label: "position.direction",
734
- options: [
735
- { key: "top", label: "position.top" },
736
- { key: "right", label: "position.right" },
737
- { key: "bottom", label: "position.bottom" },
738
- { key: "left", label: "position.left" }
739
- ]
740
- },
741
- {
742
- styleType: "multiple",
743
- label: "position.inset",
744
- options: [
745
- { key: "inset", label: "position.all" },
746
- { key: "insetX", label: "position.lr" },
747
- { key: "insetY", label: "position.tb" }
748
- ]
749
- },
750
- { type: "arbitrary", label: "position.z_index", units: ["-", "auto"], property: "zIndex" }
751
- ]
752
- },
753
- {
754
- styleType: "accordion",
755
- heading: "position.float_clear",
756
- items: [
757
- { type: "icons", label: "position.float", property: "float" },
758
- { type: "dropdown", label: "position.clear", property: "clear" }
759
- ]
760
- },
761
- {
762
- styleType: "accordion",
763
- heading: "position.overflow_overscroll",
764
- items: [
765
- {
766
- styleType: "multiple",
767
- type: "dropdown",
768
- label: "position.overflow",
769
- options: [
770
- { key: "overflow", label: "position.all" },
771
- { key: "overflowX", label: "position.lr" },
772
- { key: "overflowY", label: "position.tb" }
773
- ]
774
- },
775
- {
776
- styleType: "multiple",
777
- type: "dropdown",
778
- label: "position.overscroll",
779
- options: [
780
- { key: "overscroll", label: "position.all" },
781
- { key: "overscrollX", label: "position.lr" },
782
- { key: "overscrollY", label: "position.tb" }
783
- ]
784
- }
785
- ]
786
- }
787
- ]
788
- },
789
- {
790
- heading: "typography.heading",
791
- items: [
792
- { type: "dropdown", property: "fontFamily", label: "typography.font" },
793
- { type: "arbitrary", property: "fontSize", label: "typography.size", units: H },
794
- { type: "arbitrary", property: "lineHeight", label: "typography.height", units: H.concat("-") },
795
- { type: "range", property: "fontWeight", label: "typography.weight" },
796
- { type: "color", property: "textColor", label: "typography.color" },
797
- {
798
- styleType: "accordion",
799
- heading: "typography.alignments",
800
- items: [
801
- { type: "dropdown", property: "textAlign", label: "typography.align" },
802
- { type: "dropdown", property: "verticalAlign", label: "typography.valign" }
803
- ]
804
- },
805
- {
806
- styleType: "accordion",
807
- heading: "typography.spacing_decoration_more",
808
- items: [
809
- { type: "dropdown", property: "letterSpacing", label: "typography.spacing" },
810
- { type: "dropdown", property: "textDecoration", label: "typography.decoration" },
811
- { type: "range", property: "textDecorationThickness", label: "typography.thickness" },
812
- { type: "dropdown", property: "textTransform", label: "typography.transform" }
813
- ]
814
- },
815
- {
816
- styleType: "accordion",
817
- heading: "typography.whitespace_breaks",
818
- items: [
819
- { type: "dropdown", property: "whitespace", label: "typography.whitespace" },
820
- { type: "dropdown", property: "wordbreak", label: "typography.wordbreak" }
821
- ]
822
- }
823
- ]
824
- },
825
- {
826
- heading: "background.heading",
827
- items: [
828
- { type: "color", label: "background.bgcolor", property: "backgroundColor" },
829
- {
830
- styleType: "accordion",
831
- heading: "background.position_size_more",
832
- items: [
833
- { type: "dropdown", label: "background.attachment", property: "backgroundAttachment" },
834
- { type: "dropdown", label: "background.clipping", property: "backgroundClip" },
835
- { type: "dropdown", label: "background.origin", property: "backgroundOrigin" },
836
- { type: "dropdown", label: "background.position", property: "backgroundPosition" },
837
- { type: "dropdown", label: "background.repeat", property: "backgroundRepeat" },
838
- { type: "dropdown", label: "background.size", property: "backgroundSize" }
839
- ]
840
- },
841
- { type: "dropdown", label: "background.gradient", property: "backgroundGradient" },
842
- {
843
- styleType: "accordion",
844
- heading: "background.gradient_colors",
845
- items: [
846
- { type: "color", label: "background.from_color", property: "fromColor" },
847
- { type: "color", label: "background.via_color", property: "viaColor" },
848
- { type: "color", label: "background.to_color", property: "toColor" }
849
- ]
850
- }
851
- ]
852
- },
853
- {
854
- heading: "border.heading",
855
- items: [
856
- {
857
- styleType: "multiple",
858
- type: "dropdown",
859
- label: "border.width",
860
- options: [
861
- { key: "border", label: "border.all" },
862
- { key: "borderX", label: "border.lr" },
863
- { key: "borderY", label: "border.tb" },
864
- { key: "borderTop", label: "border.top" },
865
- { key: "borderRight", label: "border.right" },
866
- { key: "borderBottom", label: "border.bottom" },
867
- { key: "borderLeft", label: "border.left" }
868
- ]
869
- },
870
- {
871
- styleType: "multiple",
872
- type: "dropdown",
873
- label: "border.corners",
874
- options: [
875
- { key: "borderRadius", label: "border.all" },
876
- { key: "borderRadiusTop", label: "border.top" },
877
- { key: "borderRadiusRight", label: "border.right" },
878
- { key: "borderRadiusBottom", label: "border.bottom" },
879
- { key: "borderRadiusLeft", label: "border.left" },
880
- { key: "borderRadiusTopLeft", label: "border.top_left" },
881
- { key: "borderRadiusTopRight", label: "border.top_right" },
882
- { key: "borderRadiusBottomRight", label: "border.bottom_right" },
883
- { key: "borderRadiusBottomLeft", label: "border.bottom_left" }
884
- ]
885
- },
886
- { type: "color", label: "border.color", property: "borderColor" },
887
- { type: "dropdown", label: "border.style", property: "borderStyle" },
888
- {
889
- styleType: "accordion",
890
- heading: "border.divide_options",
891
- items: [
892
- {
893
- styleType: "multiple",
894
- type: "range",
895
- label: "border.width",
896
- options: [
897
- { key: "divideXWidth", label: "border.lr" },
898
- { key: "divideYWidth", label: "border.tb" }
899
- ]
900
- },
901
- { type: "color", label: "border.divide_color", property: "divideColor" },
902
- { type: "dropdown", label: "border.divide_style", property: "divideStyle" }
903
- ]
904
- },
905
- {
906
- styleType: "accordion",
907
- heading: "border.outline_styling",
908
- items: [
909
- { type: "range", label: "border.outline_width", property: "outlineWidth" },
910
- { type: "range", label: "border.outline_offset", property: "outlineOffset" },
911
- { type: "dropdown", label: "border.outline_style", property: "outlineStyle" }
912
- ]
913
- },
914
- {
915
- styleType: "accordion",
916
- heading: "border.ring_options",
917
- items: [
918
- { type: "range", label: "border.ring_width", property: "ringWidth" },
919
- { type: "color", label: "border.ring_color", property: "ringColor" },
920
- { type: "range", label: "border.ring_offset_width", property: "ringOffsetWidth" },
921
- { type: "color", label: "border.ring_offset_color", property: "ringOffsetColor" }
922
- ]
923
- }
924
- ]
925
- },
926
- {
927
- heading: "effect.heading",
928
- items: [
929
- { type: "range", label: "effect.shadow", property: "boxShadow" },
930
- { type: "color", label: "effect.color", property: "boxShadowColor" },
931
- { type: "dropdown", label: "effect.cursor", property: "cursor" },
932
- {
933
- styleType: "accordion",
934
- heading: "effect.blend_cursor",
935
- items: [
936
- { type: "dropdown", label: "effect.mix_blend", property: "mixBlendMode" },
937
- { type: "dropdown", label: "effect.bg_blend", property: "bgBlendMode" }
938
- ]
939
- },
940
- {
941
- styleType: "accordion",
942
- heading: "effect.transform",
943
- items: [
944
- { type: "dropdown", label: "effect.origin", property: "transformOrigin" },
945
- {
946
- styleType: "multiple",
947
- label: "effect.scale",
948
- units: ["-"],
949
- options: [
950
- { key: "scale", label: "effect.all" },
951
- { key: "scaleX", label: "effect.lr" },
952
- { key: "scaleY", label: "effect.tb" }
953
- ]
954
- },
955
- {
956
- styleType: "multiple",
957
- label: "effect.skew",
958
- units: ["deg"],
959
- options: [
960
- { key: "skewX", label: "effect.lr" },
961
- { key: "skewY", label: "effect.tb" }
962
- ]
963
- },
964
- {
965
- styleType: "multiple",
966
- label: "effect.translate",
967
- negative: !0,
968
- options: [
969
- { key: "translateX", label: "effect.lr" },
970
- { key: "translateY", label: "effect.tb" }
971
- ]
972
- },
973
- { type: "arbitrary", units: ["deg"], negative: !0, label: "effect.rotate", property: "rotate" }
974
- ]
975
- },
976
- {
977
- styleType: "accordion",
978
- heading: "effect.animation",
979
- items: [
980
- { type: "dropdown", label: "effect.animation", property: "animation" },
981
- { type: "dropdown", label: "effect.transition", property: "transition" },
982
- { type: "dropdown", label: "effect.easing", property: "transitionEase" },
983
- { type: "arbitrary", units: ["ms"], label: "effect.duration", property: "duration" },
984
- { type: "arbitrary", units: ["ms"], label: "effect.delay", property: "delay" }
985
- ]
986
- }
987
- ]
988
- },
989
- {
990
- heading: "classes.heading",
991
- items: [{ component: Zr }]
992
- }
993
- ], ot = {
994
- "not-italic": () => /* @__PURE__ */ e.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ e.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M9 3H11V5H9V11H11V13H5V11H7V5H5V3H9Z", fill: "white" }) }),
995
- // visibility
996
- visible: kt,
997
- invisible: He,
998
- // display
999
- hidden: He,
1000
- gap: A,
1001
- gapX: T,
1002
- gapY: R,
1003
- spaceX: T,
1004
- spaceY: R,
1005
- overscroll: A,
1006
- overscrollX: T,
1007
- overscrollY: R,
1008
- overflow: A,
1009
- overflowX: T,
1010
- overflowY: R,
1011
- top: Q,
1012
- right: ee,
1013
- bottom: te,
1014
- left: re,
1015
- inset: A,
1016
- insetX: T,
1017
- insetY: R,
1018
- border: A,
1019
- borderX: T,
1020
- borderY: R,
1021
- borderTop: Q,
1022
- borderRight: ee,
1023
- borderBottom: te,
1024
- borderLeft: re,
1025
- borderRadius: A,
1026
- borderRadiusX: T,
1027
- borderRadiusY: R,
1028
- borderRadiusTop: Q,
1029
- borderRadiusRight: ee,
1030
- borderRadiusBottom: te,
1031
- borderRadiusLeft: re,
1032
- borderRadiusTopLeft: Nt,
1033
- borderRadiusTopRight: _t,
1034
- borderRadiusBottomRight: St,
1035
- borderRadiusBottomLeft: Tt,
1036
- divideXWidth: T,
1037
- divideYWidth: R,
1038
- scale: A,
1039
- scaleX: T,
1040
- scaleY: R,
1041
- skewX: T,
1042
- skewY: R,
1043
- translateX: T,
1044
- translateY: R,
1045
- // padding
1046
- padding: A,
1047
- paddingX: T,
1048
- paddingY: R,
1049
- paddingTop: Q,
1050
- paddingRight: ee,
1051
- paddingBottom: te,
1052
- paddingLeft: re,
1053
- // margin
1054
- margin: A,
1055
- marginX: T,
1056
- marginY: R,
1057
- marginTop: Q,
1058
- marginRight: ee,
1059
- marginBottom: te,
1060
- marginLeft: re,
1061
- // text-align
1062
- textLeft: Rt,
1063
- textCenter: Vt,
1064
- textRight: Ht,
1065
- textJustify: Bt,
1066
- // font style
1067
- italic: Dt,
1068
- // "not-italic": "",
1069
- // decoration
1070
- underline: $t,
1071
- overline: It,
1072
- // transform
1073
- uppercase: At,
1074
- block: () => /* @__PURE__ */ e.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
1075
- /* @__PURE__ */ e.jsx(
1076
- "path",
1077
- {
1078
- opacity: "0.6",
1079
- fillRule: "evenodd",
1080
- clipRule: "evenodd",
1081
- d: "M2 2H14V14H2V2ZM1 1H15V15H1V1Z",
1082
- fill: "currentColor"
1083
- }
1084
- ),
1085
- /* @__PURE__ */ e.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M7 4H4V12H7V4ZM9 4H12V12H9V4Z", fill: "currentColor" })
1086
- ] }),
1087
- // floats
1088
- "float-right": () => /* @__PURE__ */ e.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
1089
- /* @__PURE__ */ e.jsx("path", { d: "M8 4H16V12H8V4Z", fill: "currentColor" }),
1090
- /* @__PURE__ */ e.jsx(
1091
- "path",
1092
- {
1093
- opacity: "0.6",
1094
- fillRule: "evenodd",
1095
- clipRule: "evenodd",
1096
- d: "M0 4H6V6H0V4ZM0 7H6V9H0V7ZM4 10H0V12H4V10Z",
1097
- fill: "currentColor"
1098
- }
1099
- )
1100
- ] }),
1101
- "float-left": () => /* @__PURE__ */ e.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
1102
- /* @__PURE__ */ e.jsx("path", { d: "M0 4H8V12H0V4Z", fill: "currentColor" }),
1103
- /* @__PURE__ */ e.jsx(
1104
- "path",
1105
- {
1106
- opacity: "0.6",
1107
- fillRule: "evenodd",
1108
- clipRule: "evenodd",
1109
- d: "M10 4H16V6H10V4ZM10 7H16V9H10V7ZM14 10H10V12H14V10Z",
1110
- fill: "currentColor"
1111
- }
1112
- )
1113
- ] }),
1114
- "float-none": Fe,
1115
- // position
1116
- fixed: () => /* @__PURE__ */ e.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
1117
- /* @__PURE__ */ e.jsx(
1118
- "path",
1119
- {
1120
- opacity: "0.6",
1121
- fillRule: "evenodd",
1122
- clipRule: "evenodd",
1123
- d: "M15 2H14V4H13V5H14V6H15V2ZM10 5V4H9V2H1V8H2V5H10ZM7 4V3H5V4H7ZM4 4V3H2V4H4ZM1 13H7V14H1V13Z",
1124
- fill: "currentColor"
1125
- }
1126
- ),
1127
- /* @__PURE__ */ e.jsx(
1128
- "path",
1129
- {
1130
- fillRule: "evenodd",
1131
- clipRule: "evenodd",
1132
- d: "M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",
1133
- fill: "currentColor"
1134
- }
1135
- )
1136
- ] }),
1137
- absolute: () => /* @__PURE__ */ e.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
1138
- /* @__PURE__ */ e.jsx(
1139
- "path",
1140
- {
1141
- opacity: "0.6",
1142
- fillRule: "evenodd",
1143
- clipRule: "evenodd",
1144
- d: "M14 2H15V6H14V2ZM9 3V2H1V8H2V3H9ZM7 13H1V14H7V13Z",
1145
- fill: "currentColor"
1146
- }
1147
- ),
1148
- /* @__PURE__ */ e.jsx(
1149
- "path",
1150
- {
1151
- fillRule: "evenodd",
1152
- clipRule: "evenodd",
1153
- d: "M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",
1154
- fill: "currentColor"
1155
- }
1156
- )
1157
- ] }),
1158
- relative: () => /* @__PURE__ */ e.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ e.jsx(
1159
- "path",
1160
- {
1161
- fillRule: "evenodd",
1162
- clipRule: "evenodd",
1163
- d: "M11 2H9V3H11V6H12V3H14V2H11ZM2 8H1V13H2V11H7V10H2V8ZM15 7H8V14H15V7Z",
1164
- fill: "currentColor"
1165
- }
1166
- ) }),
1167
- sticky: () => /* @__PURE__ */ e.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
1168
- /* @__PURE__ */ e.jsx(
1169
- "path",
1170
- {
1171
- d: "M12.9998 7C13.6558 7 14.2937 6.78498 14.8158 6.38787C15.338 5.99076 15.7156 5.43345 15.8908 4.80128C16.066 4.16912 16.0292 3.49694 15.7859 2.8877C15.5427 2.27846 15.1065 1.76573 14.5441 1.42804C13.9817 1.09034 13.3241 0.946293 12.672 1.01795C12.02 1.08961 11.4094 1.37303 10.9337 1.8248C10.4581 2.27658 10.1436 2.8718 10.0385 3.51932C9.93341 4.16685 10.0434 4.83097 10.3518 5.41L6.88176 8.88C6.80034 8.96122 6.73572 9.05769 6.69158 9.16388C6.64744 9.27008 6.62465 9.38393 6.62451 9.49894C6.62437 9.61395 6.64689 9.72785 6.69077 9.83416C6.73465 9.94046 6.79904 10.0371 6.88026 10.1185C6.96149 10.1999 7.05795 10.2645 7.16415 10.3087C7.27035 10.3528 7.3842 10.3756 7.4992 10.3758C7.61421 10.3759 7.72812 10.3534 7.83442 10.3095C7.94072 10.2656 8.03734 10.2012 8.11876 10.12L11.5888 6.648C12.0088 6.873 12.4888 7 12.9988 7H12.9998Z",
1172
- fill: "currentColor"
1173
- }
1174
- ),
1175
- /* @__PURE__ */ e.jsx(
1176
- "path",
1177
- {
1178
- opacity: "0.6",
1179
- fillRule: "evenodd",
1180
- clipRule: "evenodd",
1181
- d: "M9.535 2H1V14H15V7.465C14.69 7.645 14.355 7.783 14 7.875V13H2V5H9.126C8.86504 3.98486 9.01223 2.90789 9.536 2H9.535ZM7 3V4H5V3H7ZM4 3V4H2V3H4Z",
1182
- fill: "currentColor"
1183
- }
1184
- )
1185
- ] }),
1186
- static: Pt
1187
- }, oe = Me({ canReset: !1, canChange: !0 }), qr = ({ children: r, canReset: s = !1, canChange: t = !0 }) => (
1188
- // eslint-disable-next-line react/jsx-no-constructed-context-values
1189
- /* @__PURE__ */ e.jsx(oe.Provider, { value: { canReset: s, canChange: t }, children: r })
1190
- ), at = ({ label: r, property: s, onChange: t }) => {
1191
- const o = _(() => x(he, `${s}.classes`, [""]), [s]), l = ae(s), d = _(() => x(l, "cls", ""), [l]), { canChange: a } = se(oe), c = /\[.*\]/g.test(d);
1192
- return /* @__PURE__ */ e.jsx("div", { className: r ? "w-full rounded " : "grow", children: c ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
1193
- /* @__PURE__ */ e.jsx(ur, { className: "w-[70%] rounded py-1", readOnly: !0, value: d }),
1194
- /* @__PURE__ */ e.jsxs(F, { delayDuration: 100, children: [
1195
- /* @__PURE__ */ e.jsx(z, { asChild: !0, children: /* @__PURE__ */ e.jsx("button", { type: "button", className: "invisible ml-3 mt-1 text-blue-600 group-hover:visible", children: /* @__PURE__ */ e.jsx(_e, {}) }) }),
1196
- /* @__PURE__ */ e.jsx(Z, { children: "Current value is using a Tailwind arbitrary value." })
1197
- ] })
1198
- ] }) : /* @__PURE__ */ e.jsx(
1199
- Ce,
1200
- {
1201
- rounded: r,
1202
- onChange: (i) => t(i, s),
1203
- selected: d,
1204
- options: o,
1205
- disabled: !a
1206
- }
1207
- ) });
1208
- };
1209
- function Ce({ selected: r, onChange: s, rounded: t = !1, options: o, disabled: l = !1 }) {
1210
- const d = r.replace(/.*:/g, "").trim(), { undo: a, redo: c } = We();
1211
- return /* @__PURE__ */ e.jsxs(
1212
- "select",
1213
- {
1214
- disabled: !o.length || l,
1215
- className: `${t ? "rounded-md border border-border" : "border-0"} w-full disable:bg-gray-500 h-full truncate rounded bg-background px-2 py-1 text-xs outline-none disabled:cursor-not-allowed`,
1216
- onChange: (i) => s(i.target.value),
1217
- onKeyDown: (i) => {
1218
- i.ctrlKey && (i.key === "z" && a(), i.key === "y" && c());
1219
- },
1220
- value: d,
1221
- children: [
1222
- /* @__PURE__ */ e.jsx("option", { className: "bg-transparent", value: "" }),
1223
- I.Children.toArray(
1224
- o.map((i) => /* @__PURE__ */ e.jsx("option", { className: "bg-transparent", value: i, children: i }))
1225
- )
1226
- ]
1227
- }
1228
- );
1229
- }
1230
- const Gr = ({ property: r, onChange: s }) => {
1231
- const { canReset: t, canChange: o } = se(oe), l = ae(r), d = _(() => x(l, "cls", ""), [l]), a = _(() => x(he, `${r}.classes`, [""]), [r]), c = a.indexOf(d) > -1 ? a.indexOf(d) : 0, i = /\[.*\]/g.test(d);
1232
- return /* @__PURE__ */ e.jsx("div", { className: "flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs", children: i ? /* @__PURE__ */ e.jsx("div", { className: "py-[5px] px-2", children: d }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1233
- /* @__PURE__ */ e.jsx(
1234
- "button",
1235
- {
1236
- type: "button",
1237
- className: "box-border w-2/12 rounded-tl rounded-bl bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",
1238
- disabled: !o && (!t || c - 1 < 0),
1239
- onClick: () => s(Ve(a, c - 1), r),
1240
- children: /* @__PURE__ */ e.jsx("span", { className: "flex items-center justify-center", children: /* @__PURE__ */ e.jsx(
1241
- Et,
1242
- {
1243
- className: !o && (!t || c - 1 < 0) ? "text-gray-500" : "text-black/60 dark:text-white/60"
1244
- }
1245
- ) })
1246
- }
1247
- ),
1248
- /* @__PURE__ */ e.jsx("div", { className: "w-8/12 text-center", children: /* @__PURE__ */ e.jsx(at, { label: !1, property: r, onChange: s }) }),
1249
- /* @__PURE__ */ e.jsx(
1250
- "button",
1251
- {
1252
- type: "button",
1253
- className: "w-2/12 rounded-tr rounded-br bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",
1254
- disabled: !o && (!t || c + 1 >= a.length),
1255
- onClick: () => s(Ve(a, c + 1), r),
1256
- children: /* @__PURE__ */ e.jsx("span", { className: "flex items-center justify-center", children: /* @__PURE__ */ e.jsx(
1257
- Ne,
1258
- {
1259
- className: !o && (!t || c + 1 >= a.length) ? "text-gray-500" : "text-black/60 dark:text-white/60"
1260
- }
1261
- ) })
1262
- }
1263
- )
1264
- ] }) });
1265
- }, Jr = ({ property: r, onChange: s }) => {
1266
- const t = _(() => x(he, `${r}.classes`, [""]), [r]), { canChange: o } = se(oe), l = ae(r), d = _(() => x(l, "cls", ""), [l]);
1267
- return /* @__PURE__ */ e.jsx("div", { className: "flex grow flex-wrap gap-1", children: C(t, (a) => /* @__PURE__ */ e.jsxs(F, { children: [
1268
- /* @__PURE__ */ e.jsx(z, { asChild: !0, children: /* @__PURE__ */ e.jsx(
1269
- "button",
1270
- {
1271
- type: "button",
1272
- disabled: !o,
1273
- onClick: () => s(a, r),
1274
- className: `cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${d === a ? " bg-blue-500 text-white" : "disabled:bg-gray-600 disabled:text-gray-400"}`,
1275
- children: I.createElement(x(ot, a, ze))
1276
- }
1277
- ) }),
1278
- /* @__PURE__ */ e.jsx(Z, { children: Y(le(a)) })
1279
- ] })) });
1280
- }, Qr = {
1281
- backgroundColor: "bg",
1282
- textColor: "text",
1283
- borderColor: "border",
1284
- boxShadowColor: "shadow",
1285
- outlineColor: "outline",
1286
- divideColor: "divide",
1287
- fromColor: "from",
1288
- viaColor: "via",
1289
- toColor: "to",
1290
- ringColor: "ring",
1291
- ringOffsetColor: "ring-offset"
1292
- }, el = ({ property: r, onChange: s }) => {
1293
- const t = ae(r), o = _(() => x(t, "cls", ""), [t]), { canChange: l } = se(oe), [d, a] = j([]), [c, i] = j({ color: "", shade: "" }), p = o.split("-"), y = x(p, "1", ""), n = x(p, "2", ""), h = B(
1294
- // eslint-disable-next-line no-shadow
1295
- (u) => {
1296
- ["current", "inherit", "transparent", "black", "white"].includes(u) ? (a([]), i({ color: u })) : (a(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), i((f) => ({ ...f, color: u, shade: f.shade ? f.shade : "500" })));
1297
- },
1298
- [a, i]
1299
- );
1300
- O(() => {
1301
- if (["current", "inherit", "transparent", "black", "white"].includes(y))
1302
- return a([]);
1303
- a(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
1304
- }, [y]);
1305
- const g = B(
1306
- // eslint-disable-next-line no-shadow
1307
- (u) => {
1308
- i({ color: y, shade: u });
1309
- },
1310
- [y]
1311
- );
1312
- return O(() => {
1313
- i({ color: "", shade: "" });
1314
- }, [t]), O(() => {
1315
- const f = `${x(Qr, r, "")}-${c.color}${c.shade ? `-${c.shade}` : ""}`;
1316
- f.match(new RegExp(x(he, `${r}.regExp`, ""))) && s(f, r);
1317
- }, [c, s, r]), /* @__PURE__ */ e.jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-border text-xs", children: [
1318
- /* @__PURE__ */ e.jsx("div", { className: "grow text-center", children: /* @__PURE__ */ e.jsx(
1319
- Ce,
1320
- {
1321
- disabled: !l,
1322
- rounded: !0,
1323
- selected: y,
1324
- onChange: h,
1325
- options: [
1326
- "current",
1327
- "transparent",
1328
- "primary",
1329
- "secondary",
1330
- "black",
1331
- "white",
1332
- "slate",
1333
- "gray",
1334
- "zinc",
1335
- "neutral",
1336
- "stone",
1337
- "red",
1338
- "orange",
1339
- "amber",
1340
- "yellow",
1341
- "lime",
1342
- "green",
1343
- "emerald",
1344
- "teal",
1345
- "cyan",
1346
- "sky",
1347
- "blue",
1348
- "indigo",
1349
- "violet",
1350
- "purple",
1351
- "fuchsia",
1352
- "pink",
1353
- "rose"
1354
- ]
1355
- }
1356
- ) }),
1357
- /* @__PURE__ */ e.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ e.jsx(Ce, { rounded: !0, selected: n, disabled: !y || !l, onChange: g, options: d }) })
1358
- ] });
1359
- }, Pe = (r, s) => {
1360
- r = r.toLowerCase();
1361
- let t = r.trim().replace(/ |\+/g, "");
1362
- if ((t === "auto" || t === "none") && s.includes(t))
1363
- return { value: "", unit: t };
1364
- const o = s.length ? new RegExp(s.join("|"), "g") : /XXXXXX/g;
1365
- t = t.replace(o, "");
1366
- const l = r.match(o), d = l && l.length > 1, a = !m(t) && Number.isNaN(Number(t));
1367
- return d || a ? { error: "Invalid value" } : l && (l[0] === "auto" || l[0] === "none") ? { value: l[0], unit: "" } : { value: t, unit: l ? l[0] : "" };
1368
- };
1369
- const tl = (r) => {
1370
- const s = r.startsWith("-") ? "-" : "", t = r.split("-").pop();
1371
- if (["auto", "none"].includes(t))
1372
- return { value: "", unit: t };
1373
- if (t === "px")
1374
- return { value: "1", unit: "px" };
1375
- if (t === "screen")
1376
- return { value: "100", unit: r.indexOf("w-") !== -1 ? "vw" : "vh" };
1377
- if (t === "full")
1378
- return { value: "100", unit: "%" };
1379
- if (P(r, "skew-"))
1380
- return { value: `${s}${t}`, unit: "deg" };
1381
- if (P(r, "rotate-"))
1382
- return { value: `${s}${t}`, unit: "deg" };
1383
- if (P(r, "opacity-"))
1384
- return { value: `${t / 100}`, unit: "-" };
1385
- if (P(r, "duration-") || P(r, "delay-"))
1386
- return { value: `${t}`, unit: "ms" };
1387
- if (P(r, "translate-") && !t.includes("/"))
1388
- return { value: `${s}${`${t / 4}`}`, unit: "rem" };
1389
- if (P(r, "scale-"))
1390
- return { value: `${s}${`${t / 100}`}`, unit: "-" };
1391
- if (W(r, "border")) {
1392
- const o = r.match(/border-?(x|y|t|r|b|l)?\d+/g);
1393
- if (o)
1394
- return { value: o[0].split("-").pop(), unit: "px" };
1395
- if (r.match(/border-?(x|y|t|r|b|l)?/g))
1396
- return { value: "1", unit: "px" };
1397
- }
1398
- if (W(r, "max-w-")) {
1399
- if (r === "max-w-screen-sm")
1400
- return { value: "640", unit: "px" };
1401
- if (r === "max-w-screen-md")
1402
- return { value: "768", unit: "px" };
1403
- if (r === "max-w-screen-lg")
1404
- return { value: "1024", unit: "px" };
1405
- if (r === "max-w-screen-xl")
1406
- return { value: "1280", unit: "px" };
1407
- if (r === "max-w-screen-2xl")
1408
- return { value: "1536", unit: "px" };
1409
- if (t === "xs")
1410
- return { value: "320", unit: "px" };
1411
- if (t === "sm")
1412
- return { value: "384", unit: "px" };
1413
- if (t === "md")
1414
- return { value: "448", unit: "px" };
1415
- if (t === "lg")
1416
- return { value: "512", unit: "px" };
1417
- if (t === "xl")
1418
- return { value: "576", unit: "px" };
1419
- if (t === "2xl")
1420
- return { value: "672", unit: "px" };
1421
- if (t === "3xl")
1422
- return { value: "768", unit: "px" };
1423
- if (t === "4xl")
1424
- return { value: "896", unit: "px" };
1425
- if (t === "5xl")
1426
- return { value: "1024", unit: "px" };
1427
- if (t === "6xl")
1428
- return { value: "1152", unit: "px" };
1429
- if (t === "7xl")
1430
- return { value: "1280", unit: "px" };
1431
- if (t === "prose")
1432
- return { value: "65", unit: "ch" };
1433
- }
1434
- if (W(r, "text-")) {
1435
- if (t === "xs")
1436
- return { value: "12", unit: "px" };
1437
- if (t === "sm")
1438
- return { value: "14", unit: "px" };
1439
- if (t === "base")
1440
- return { value: "16", unit: "px" };
1441
- if (t === "lg")
1442
- return { value: "18", unit: "px" };
1443
- if (t === "xl")
1444
- return { value: "20", unit: "px" };
1445
- if (t === "2xl")
1446
- return { value: "24", unit: "px" };
1447
- if (t === "3xl")
1448
- return { value: "30", unit: "px" };
1449
- if (t === "4xl")
1450
- return { value: "36", unit: "px" };
1451
- if (t === "5xl")
1452
- return { value: "48", unit: "px" };
1453
- if (t === "6xl")
1454
- return { value: "60", unit: "px" };
1455
- if (t === "7xl")
1456
- return { value: "72", unit: "px" };
1457
- if (t === "8xl")
1458
- return { value: "96", unit: "px" };
1459
- if (t === "9xl")
1460
- return { value: "128", unit: "px" };
1461
- }
1462
- if (W(r, "leading-")) {
1463
- if (t === "none")
1464
- return { value: "1", unit: "-" };
1465
- if (t === "tight")
1466
- return { value: "1.25", unit: "-" };
1467
- if (t === "snug")
1468
- return { value: "1.375", unit: "-" };
1469
- if (t === "normal")
1470
- return { value: "1.5", unit: "-" };
1471
- if (t === "relaxed")
1472
- return { value: "1.625", unit: "-" };
1473
- if (t === "loose")
1474
- return { value: "2", unit: "-" };
1475
- }
1476
- if (W(r, "tracking-")) {
1477
- if (t === "tighter")
1478
- return { value: "-0.05", unit: "em" };
1479
- if (t === "tight")
1480
- return { value: "-0.025", unit: "em" };
1481
- if (t === "normal")
1482
- return { value: "0", unit: "em" };
1483
- if (t === "wide")
1484
- return { value: "0.025", unit: "em" };
1485
- if (t === "wider")
1486
- return { value: "0.05", unit: "em" };
1487
- if (t === "widest")
1488
- return { value: "0.1", unit: "em" };
1489
- }
1490
- if (["max", "min", "fit"].includes(t))
1491
- return { value: r, unit: "class" };
1492
- if (t.includes("/")) {
1493
- const [o, l] = C(t.split("/"), (d) => parseInt(d, 10));
1494
- return { value: s + (o / l * 100).toFixed(2).replace(".00", ""), unit: "%" };
1495
- }
1496
- return vt(parseFloat(t)) ? { value: `${s + parseFloat(t) * 4}`, unit: "px" } : { value: t, unit: "class" };
1497
- };
1498
- const rl = (r) => {
1499
- if (m(r))
1500
- return { value: "", unit: "" };
1501
- const s = r.match(/\[.*\]/g);
1502
- if (s === null)
1503
- return ll(r);
1504
- const t = x(s, "0", "").replace(/\[|\]/g, ""), o = r.startsWith("-") ? "-" : "", l = ue(t.match(/\d+.\d+|\d+/g));
1505
- return { value: `${o}${l}`, unit: t.replace(l, "") };
1506
- }, ll = (r) => m(r) ? { value: "", unit: "" } : tl(r), nt = I.createContext({
1507
- setDragData: () => {
1508
- }
1509
- }), sl = ({
1510
- unit: r,
1511
- currentValue: s,
1512
- onDrag: t,
1513
- onDragEnd: o,
1514
- onDragStart: l,
1515
- negative: d,
1516
- cssProperty: a
1517
- }) => {
1518
- const { setDragData: c } = se(nt);
1519
- return /* @__PURE__ */ e.jsx(
1520
- "button",
1521
- {
1522
- type: "button",
1523
- onMouseDown: (i) => {
1524
- const p = {
1525
- onDrag: t,
1526
- onDragEnd: o,
1527
- dragging: !0,
1528
- dragStartY: i.pageY,
1529
- dragStartValue: `${s}`,
1530
- dragUnit: r,
1531
- negative: d,
1532
- cssProperty: a
1533
- };
1534
- l(p), c(p);
1535
- },
1536
- color: void 0,
1537
- className: "relative z-50 ml-1 hidden h-6 cursor-row-resize rounded bg-background/70 px-2 group-hover:inline",
1538
- children: /* @__PURE__ */ e.jsx(Lt, {})
1539
- }
1540
- );
1541
- }, ol = ({ onSelect: r, current: s, units: t }) => /* @__PURE__ */ e.jsx("div", { "data-theme": "light", className: "-m-[7px] -mx-[13px] flex w-9 flex-col", children: t.map((o) => /* @__PURE__ */ e.jsx(
1542
- xe,
1543
- {
1544
- className: "h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",
1545
- color: s === o ? "primary" : void 0,
1546
- size: "sm",
1547
- onClick: (l) => {
1548
- l.stopPropagation(), r(o);
1549
- },
1550
- children: o
1551
- },
1552
- o
1553
- )) }), Ee = 50, al = (r) => {
1554
- const [s, t] = j(!1), [o, l] = j(""), { currentClass: d, onChange: a, classPrefix: c, cssProperty: i, units: p, negative: y } = r, [n, h] = j(i != null && i.toLowerCase().includes("width") ? "%" : p[0]), [g, u] = j(!1), [f, k] = j(""), [E, w] = j(!1), [$, L] = j(!1);
1555
- O(() => {
1556
- const { value: b, unit: v } = rl(d);
1557
- if (v === "") {
1558
- l(b), h(i != null && i.toLowerCase().includes("width") ? "%" : ue(p));
1559
- return;
1560
- }
1561
- h(v), l(v === "class" || m(b) ? "" : b);
1562
- }, [d, i, p]);
1563
- const N = fe((b) => a(b), [a], Ee), D = fe((b) => a(b, !1), [a], Ee), X = B(
1564
- (b = !1) => {
1565
- const v = Pe(`${o}`, p);
1566
- if (x(v, "error", !1)) {
1567
- u(!0);
1568
- return;
1569
- }
1570
- const S = x(v, "unit") !== "" ? x(v, "unit") : n;
1571
- if (S === "auto" || S === "none") {
1572
- N(`${c}${S}`);
1573
- return;
1574
- }
1575
- if (x(v, "value") === "")
1576
- return;
1577
- const J = `${x(v, "value", "").startsWith("-") ? "-" : ""}${c}[${x(v, "value", "").replace("-", "")}${S === "-" ? "" : S}]`;
1578
- b ? D(J) : N(J);
1579
- },
1580
- [N, D, o, n, c, p]
1581
- ), G = B(
1582
- (b) => {
1583
- const v = Pe(`${o}`, p);
1584
- if (x(v, "error", !1)) {
1585
- u(!0);
1586
- return;
1587
- }
1588
- if (b === "auto" || b === "none") {
1589
- N(`${c}${b}`);
1590
- return;
1591
- }
1592
- if (x(v, "value") === "")
1593
- return;
1594
- const S = x(v, "unit") !== "" ? x(v, "unit") : b, J = `${x(v, "value", "").startsWith("-") ? "-" : ""}${c}[${x(v, "value", "").replace("-", "")}${S === "-" ? "" : S}]`;
1595
- N(J);
1596
- },
1597
- [N, o, c, p]
1598
- );
1599
- return /* @__PURE__ */ e.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-start", children: n === "class" ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1600
- /* @__PURE__ */ e.jsx("input", { className: "w-20 rounded py-1", readOnly: !0, value: d }),
1601
- /* @__PURE__ */ e.jsxs(F, { children: [
1602
- /* @__PURE__ */ e.jsx(z, { asChild: !0, children: /* @__PURE__ */ e.jsx("button", { type: "button", className: "invisible ml-3 mt-1 text-blue-600 group-hover:visible", children: /* @__PURE__ */ e.jsx(_e, {}) }) }),
1603
- /* @__PURE__ */ e.jsx(Z, { children: "Current value is using a Tailwind preset class." })
1604
- ] })
1605
- ] }) : /* @__PURE__ */ e.jsxs("div", { className: `group relative flex items-center ${E ? "z-auto" : ""}`, children: [
1606
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
1607
- ["none", "auto"].indexOf(n) !== -1 ? null : /* @__PURE__ */ e.jsx(
1608
- "input",
1609
- {
1610
- readOnly: n === "class",
1611
- onKeyPress: (b) => {
1612
- b.key === "Enter" && X();
1613
- },
1614
- onKeyDown: (b) => {
1615
- if (b.keyCode !== 38 && b.keyCode !== 40)
1616
- return;
1617
- b.preventDefault(), L(!0);
1618
- const v = wt(b.target.value);
1619
- let S = Xe(v) ? 0 : v;
1620
- b.keyCode === 38 && (S += 1), b.keyCode === 40 && (S -= 1);
1621
- const M = `${S}`, dt = `${M.startsWith("-") ? "-" : ""}${c}[${M.replace("-", "")}${n === "-" ? "" : n}]`;
1622
- D(dt);
1623
- },
1624
- onKeyUp: (b) => {
1625
- $ && (b.preventDefault(), L(!1));
1626
- },
1627
- onBlur: () => X(),
1628
- onChange: (b) => {
1629
- u(!1), l(b.target.value);
1630
- },
1631
- onClick: (b) => {
1632
- var v;
1633
- (v = b == null ? void 0 : b.target) == null || v.select(), t(!1);
1634
- },
1635
- value: E ? f : o,
1636
- className: "h-6 w-14 rounded rounded-r-none bg-background pl-2 text-sm focus-visible:outline-0 ".concat(
1637
- " ",
1638
- g ? "border-red-500 text-red-500" : "border-foreground/20"
1639
- )
1640
- }
1641
- ),
1642
- /* @__PURE__ */ e.jsxs(F, { open: s, delayDuration: 100, children: [
1643
- /* @__PURE__ */ e.jsx(z, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
1644
- "button",
1645
- {
1646
- type: "button",
1647
- onClick: () => t(!s),
1648
- className: "flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",
1649
- children: [
1650
- /* @__PURE__ */ e.jsx("span", { className: `inline-block ${p.length === 1 ? "px-2 font-semibold" : ""}`, children: n }),
1651
- p.length > 1 ? /* @__PURE__ */ e.jsx(Mt, {}) : null
1652
- ]
1653
- }
1654
- ) }),
1655
- /* @__PURE__ */ e.jsx(xr, { children: /* @__PURE__ */ e.jsx(Z, { className: "bg-background", children: /* @__PURE__ */ e.jsx(
1656
- ol,
1657
- {
1658
- units: p,
1659
- current: n,
1660
- onSelect: (b) => {
1661
- t(!1), h(b), G(b);
1662
- }
1663
- }
1664
- ) }) })
1665
- ] })
1666
- ] }),
1667
- ["none", "auto"].indexOf(n) !== -1 || E ? null : /* @__PURE__ */ e.jsx(
1668
- sl,
1669
- {
1670
- onDragStart: () => w(!0),
1671
- onDragEnd: (b) => {
1672
- if (k(() => ""), w(!1), m(b))
1673
- return;
1674
- const v = `${b}`, M = `${v.startsWith("-") ? "-" : ""}${c}[${v.replace("-", "")}${n === "-" ? "" : n}]`;
1675
- N(M);
1676
- },
1677
- onDrag: (b) => {
1678
- if (m(b))
1679
- return;
1680
- k(b);
1681
- const v = `${b}`, M = `${v.startsWith("-") ? "-" : ""}${c}[${v.replace("-", "")}${n === "-" ? "" : n}]`;
1682
- D(M);
1683
- },
1684
- currentValue: o,
1685
- unit: n,
1686
- negative: y,
1687
- cssProperty: i
1688
- }
1689
- )
1690
- ] }) }) });
1691
- }, ae = (r) => {
1692
- const s = ge();
1693
- return jt(s, { property: r });
1694
- }, nl = (r, s) => {
1695
- const t = {
1696
- xs: 0,
1697
- sm: 1,
1698
- md: 2,
1699
- lg: 3,
1700
- xl: 4,
1701
- "2xl": 5
1702
- };
1703
- return t[x(r, "mq", "xs")] <= t[s];
1704
- }, il = {
1705
- width: "w-",
1706
- height: "h-",
1707
- minWidth: "min-w-",
1708
- minHeight: "min-h-",
1709
- maxWidth: "max-w-",
1710
- maxHeight: "max-h-",
1711
- zIndex: "z-",
1712
- gap: "gap-",
1713
- gapX: "gap-x-",
1714
- gapY: "gap-y-",
1715
- margin: "m-",
1716
- marginX: "mx-",
1717
- marginY: "my-",
1718
- marginTop: "mt-",
1719
- marginBottom: "mb-",
1720
- marginLeft: "ml-",
1721
- marginRight: "mr-",
1722
- padding: "p-",
1723
- paddingX: "px-",
1724
- paddingY: "py-",
1725
- paddingTop: "pt-",
1726
- paddingBottom: "pb-",
1727
- paddingLeft: "pl-",
1728
- paddingRight: "pr-",
1729
- spaceX: "space-x-",
1730
- spaceY: "space-y-",
1731
- border: "border-",
1732
- borderTop: "border-t-",
1733
- borderBottom: "border-b-",
1734
- borderLeft: "border-l-",
1735
- borderRight: "border-r-",
1736
- borderX: "border-x-",
1737
- borderY: "border-y-",
1738
- borderRadius: "rounded-",
1739
- borderRadiusTop: "rounded-t-",
1740
- borderRadiusRight: "rounded-r-",
1741
- borderRadiusBottom: "rounded-b-",
1742
- borderRadiusLeft: "rounded-l-",
1743
- borderRadiusTopLeft: "rounded-tl-",
1744
- borderRadiusTopRight: "rounded-tr-",
1745
- borderRadiusBottomRight: "rounded-br-",
1746
- borderRadiusBottomLeft: "rounded-bl-",
1747
- fontSize: "text-",
1748
- lineHeight: "leading-",
1749
- letterSpacing: "tracking-",
1750
- textIndent: "indent-",
1751
- rotate: "rotate-",
1752
- duration: "duration-",
1753
- transitionDelay: "delay-",
1754
- scale: "scale-",
1755
- scaleX: "scale-x-",
1756
- scaleY: "scale-y-",
1757
- translateX: "translate-x-",
1758
- translateY: "translate-y-",
1759
- skewX: "skew-x-",
1760
- skewY: "skew-y-",
1761
- top: "top-",
1762
- bottom: "bottom-",
1763
- left: "left-",
1764
- right: "right-",
1765
- inset: "inset-",
1766
- insetX: "inset-x-",
1767
- insetY: "inset-y-",
1768
- opacity: "opacity-",
1769
- flexBasis: "basis-"
1770
- }, Le = {
1771
- xs: "",
1772
- sm: "640px",
1773
- md: "768px",
1774
- lg: "1024px",
1775
- xl: "1280px",
1776
- "2xl": "1536px"
1777
- }, dl = (r) => `${r.toUpperCase()} ${Le[r] ? `(${Le[r]} & up)` : ""}`, Re = (r) => {
1778
- const { t: s } = K(), { type: t = "icons", label: o, property: l, onEmitChange: d = () => {
1779
- }, units: a, negative: c = !1 } = r, [i] = gr(), [p] = Qe(), [, y] = Be(), n = ae(l), h = qe(), g = Ge(), [u] = Je(), f = _(() => x(n, "fullCls", ""), [n]), k = B(
1780
- (D, X = !0) => {
1781
- const G = { dark: i, mq: y, mod: p, cls: D, property: l, fullCls: "" };
1782
- (i || p !== "") && (G.mq = "xs");
1783
- const b = Er(G);
1784
- h(u, [b], X);
1785
- },
1786
- [u, i, y, p, l, h]
1787
- ), E = B(() => {
1788
- g(u, [f]);
1789
- }, [u, f, g]), w = _(() => nl(n, y), [n, y]);
1790
- O(() => {
1791
- d(w, n);
1792
- }, [w, d, n]);
1793
- const [, , $] = Be(), L = B(
1794
- (D) => {
1795
- $({
1796
- xs: 400,
1797
- sm: 640,
1798
- md: 800,
1799
- lg: 1024,
1800
- xl: 1420,
1801
- "2xl": 1920
1802
- }[D]);
1803
- },
1804
- [$]
1805
- ), N = x(n, "dark", null) === i && x(n, "mod", null) === p && x(n, "mq", null) === y;
1806
- return /* @__PURE__ */ e.jsx(qr, { canChange: w, canReset: n && N, children: /* @__PURE__ */ e.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
1807
- /* @__PURE__ */ e.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ e.jsx("span", { className: `text-[11px] ${n && !N ? "text-foreground" : ""}`, children: s(o) }) }),
1808
- /* @__PURE__ */ e.jsxs("div", { className: "flex flex-row items-center", children: [
1809
- /* @__PURE__ */ e.jsxs("div", { className: "w-[150px]", children: [
1810
- t === "arbitrary" ? /* @__PURE__ */ e.jsx(
1811
- al,
1812
- {
1813
- currentClass: x(n, "cls", ""),
1814
- classPrefix: x(il, l, ""),
1815
- units: a || [],
1816
- onChange: k,
1817
- negative: c,
1818
- cssProperty: l
1819
- }
1820
- ) : null,
1821
- t === "icons" && /* @__PURE__ */ e.jsx(Jr, { property: l, onChange: k }),
1822
- t === "range" && /* @__PURE__ */ e.jsx(Gr, { property: l, onChange: k }),
1823
- t === "color" && /* @__PURE__ */ e.jsx(el, { property: l, onChange: k }),
1824
- t === "dropdown" && /* @__PURE__ */ e.jsx(at, { label: o, property: l, onChange: k })
1825
- ] }),
1826
- /* @__PURE__ */ e.jsx("div", { className: `w-[30px] cursor-pointer ${f ? "visible" : "invisible"}`, children: N ? /* @__PURE__ */ e.jsx("button", { type: "button", onClick: () => E(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ e.jsx(Ot, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : w && n ? /* @__PURE__ */ e.jsxs(F, { delayDuration: 100, children: [
1827
- /* @__PURE__ */ e.jsx(z, { asChild: !0, children: /* @__PURE__ */ e.jsx(
1828
- "button",
1829
- {
1830
- type: "button",
1831
- className: "invisible ml-3 mt-1 rounded-full bg-blue-500 text-white group-hover:visible",
1832
- children: /* @__PURE__ */ e.jsx(_e, {})
1833
- }
1834
- ) }),
1835
- /* @__PURE__ */ e.jsx(Z, { children: /* @__PURE__ */ e.jsx("div", { className: "text-right", children: /* @__PURE__ */ e.jsxs("div", { children: [
1836
- "Current style is set at  ",
1837
- /* @__PURE__ */ e.jsxs("span", { className: "font-bold ", children: [
1838
- dl(x(n, "mq")),
1839
- i && !n.dark ? "(Light mode)" : ""
1840
- ] }),
1841
- /* @__PURE__ */ e.jsx("br", {}),
1842
- /* @__PURE__ */ e.jsxs(
1843
- "button",
1844
- {
1845
- type: "button",
1846
- onClick: () => L(x(n, "mq")),
1847
- className: "block w-full cursor-default text-right font-semibold text-blue-500",
1848
- children: [
1849
- "Switch to ",
1850
- x(n, "mq").toUpperCase()
1851
- ]
1852
- }
1853
- )
1854
- ] }) }) })
1855
- ] }) : null })
1856
- ] })
1857
- ] }) });
1858
- }, cl = ["px", "%", "em", "rem", "ch", "vh", "vw"], it = ({
1859
- label: r,
1860
- options: s,
1861
- borderB: t = !1,
1862
- borderT: o = !1,
1863
- type: l = "arbitrary",
1864
- units: d = cl,
1865
- negative: a = !1
1866
- }) => {
1867
- const { t: c } = K(), [i, p] = j(s[0].key), y = ge(), n = B((h) => C(y, "property").includes(h), [y]);
1868
- return /* @__PURE__ */ e.jsxs(
1869
- "div",
1870
- {
1871
- className: `mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${t ? "border-b" : ""} ${o ? "border-t" : ""}`,
1872
- children: [
1873
- /* @__PURE__ */ e.jsxs("div", { className: "flex flex-row text-xs", children: [
1874
- r && /* @__PURE__ */ e.jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: c(r) }),
1875
- /* @__PURE__ */ e.jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: I.Children.toArray(
1876
- s.map(({ label: h, key: g }) => /* @__PURE__ */ e.jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ e.jsxs(F, { children: [
1877
- /* @__PURE__ */ e.jsx(z, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
1878
- "button",
1879
- {
1880
- type: "button",
1881
- onClick: () => p(g),
1882
- className: `relative cursor-pointer rounded-full p-1 text-[8px] ${g === i ? " bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
1883
- children: [
1884
- I.createElement("div", {
1885
- className: n(g) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
1886
- }),
1887
- I.createElement(x(ot, g, ze), { className: "text-inherit w-3 h-3" })
1888
- ]
1889
- }
1890
- ) }),
1891
- /* @__PURE__ */ e.jsx(Z, { children: Y(le(h)) })
1892
- ] }) }))
1893
- ) })
1894
- ] }),
1895
- /* @__PURE__ */ e.jsx("div", { className: "mt-0 flex items-center", children: /* @__PURE__ */ e.jsx(
1896
- Re,
1897
- {
1898
- type: l,
1899
- units: [...d],
1900
- label: "",
1901
- property: i,
1902
- negative: a
1903
- }
1904
- ) })
1905
- ]
1906
- }
1907
- );
1908
- }, pl = ({ heading: r, items: s }) => {
1909
- const { t } = K(), o = ge(), l = _(() => {
1910
- const d = (i) => U(
1911
- i.map((p) => p.styleType === "multiple" ? C(p.options, "key") : p.property)
1912
- ), a = U(
1913
- s.map((i) => i.styleType === "accordion" ? d(i.items) : i.styleType === "multiple" ? C(i.options, "key") : i.property)
1914
- ), c = C(o, "property");
1915
- return Ye(a, c).length > 0;
1916
- }, [o, s]);
1917
- return /* @__PURE__ */ e.jsxs("details", { children: [
1918
- /* @__PURE__ */ e.jsx("summary", { className: "my-px cursor-default rounded-md bg-background p-px px-2 text-[11px] text-foreground", children: /* @__PURE__ */ e.jsxs("div", { className: "inline", children: [
1919
- t(r),
1920
- l ? /* @__PURE__ */ e.jsx(
1921
- "span",
1922
- {
1923
- className: `ml-1 mr-2 inline-block h-[8px] w-[8px] rounded-full ${l ? "bg-blue-500" : "bg-gray-300"}`
1924
- }
1925
- ) : null
1926
- ] }) }),
1927
- /* @__PURE__ */ e.jsx("div", { className: "p-2", children: s.map((d) => d.styleType === "multiple" ? /* @__PURE__ */ e.jsx(it, { ...d }, d.label) : /* @__PURE__ */ e.jsx(Re, { ...d }, d.label)) })
1928
- ] });
1929
- }, ul = Me({}), me = ({ section: r }) => {
1930
- const { t: s } = K(), t = ge(), o = B(
1931
- (a = []) => {
1932
- const c = {};
1933
- for (let p = 0; p < t.length; p++)
1934
- c[t[p].property] = t[p].cls;
1935
- let i = !0;
1936
- for (const p in a)
1937
- if (!ye(c, p) || c[p] !== a[p]) {
1938
- i = !1;
1939
- break;
1940
- }
1941
- return i;
1942
- },
1943
- [t]
1944
- ), l = _(() => {
1945
- if (t.length > 0 && r.heading === "classes.heading")
1946
- return !0;
1947
- const a = (p) => U(
1948
- p.map((y) => y.styleType === "multiple" ? U(C(y.options, "key")) : y.property)
1949
- ), c = U(
1950
- r.items.map((p) => p.styleType === "accordion" ? a(p.items) : p.styleType === "multiple" ? U(C(p.options, "key")) : p.property)
1951
- ), i = C(t, "property");
1952
- return Ye(c, i).length > 0;
1953
- }, [t, r.heading, r.items]), d = _(() => ({}), []);
1954
- return /* @__PURE__ */ e.jsx(ul.Provider, { value: d, children: /* @__PURE__ */ e.jsxs(de, { value: r.heading, children: [
1955
- /* @__PURE__ */ e.jsx(ce, { className: "px-3 py-2 text-xs hover:no-underline", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-x-2", children: [
1956
- /* @__PURE__ */ e.jsx("div", { className: `h-[8px] w-[8px] rounded-full ${l ? "bg-blue-500" : "bg-gray-300"}` }),
1957
- s(r.heading)
1958
- ] }) }),
1959
- /* @__PURE__ */ e.jsx(pe, { className: "bg-gray-100 px-3.5 py-2", children: I.Children.toArray(
1960
- r.items.map((a) => ye(a, "component") ? I.createElement(a.component, { key: a.label }) : ye(a, "styleType") ? a.styleType === "multiple" ? /* @__PURE__ */ e.jsx(it, { ...a }, a.label) : a.styleType === "accordion" && o(a == null ? void 0 : a.conditions) ? /* @__PURE__ */ e.jsx(pl, { ...a }, a.label) : null : /* @__PURE__ */ e.jsx(Re, { ...a }, a.label))
1961
- ) })
1962
- ] }) });
1963
- }, xl = ({
1964
- item: r,
1965
- index: s,
1966
- canDelete: t,
1967
- onChange: o,
1968
- onRemove: l
1969
- }) => /* @__PURE__ */ e.jsxs("div", { className: `flex flex-col gap-1 border-gray-400 py-2 ${t ? "border-b" : ""}`, children: [
1970
- /* @__PURE__ */ e.jsx(
1971
- "input",
1972
- {
1973
- name: "key",
1974
- onChange: (d) => o(d, s),
1975
- value: r.key,
1976
- placeholder: "Key",
1977
- className: "w-full rounded border-gray-300 bg-background p-0.5 pl-2 text-sm focus-visible:outline-0",
1978
- autoComplete: "off",
1979
- autoCapitalize: "off"
1980
- }
1981
- ),
1982
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-x-1.5", children: [
1983
- /* @__PURE__ */ e.jsx(
1984
- "input",
1985
- {
1986
- name: "value",
1987
- onChange: (d) => m(r.key) ? {} : o(d, s),
1988
- value: r.value,
1989
- placeholder: "Value",
1990
- className: "w-full rounded border-gray-300 bg-background p-0.5 pl-2 text-sm focus-visible:outline-0",
1991
- autoComplete: "off",
1992
- autoCapitalize: "off"
1993
- }
1994
- ),
1995
- /* @__PURE__ */ e.jsx(
1996
- Xt,
1997
- {
1998
- onClick: l,
1999
- className: "h-6 w-6 cursor-pointer rounded border border-red-400 p-1 text-red-400 hover:opacity-80"
2000
- }
2001
- )
2002
- ] })
2003
- ] }), gl = ({ section: r }) => {
2004
- var h;
2005
- const { setSyncState: s } = hr(), t = q(), [o, l] = j([]), [d] = Se(), a = Ue(), c = `${x(d, "0.prop")}_attrs`;
2006
- ne.useEffect(() => {
2007
- const g = C(x(t, c), (u, f) => ({ key: f, value: u }));
2008
- m(g) ? l([]) : l(g);
2009
- }, [x(t, c)]);
2010
- const i = () => l([...o, { key: "", value: "" }]), p = (g) => {
2011
- const u = we(o, (f, k) => g !== k);
2012
- n(u);
2013
- }, y = (g, u) => {
2014
- const f = [...o];
2015
- f[u][g.target.name] = g.target.value, n(f);
2016
- }, n = ne.useCallback(
2017
- (g = []) => {
2018
- const u = {};
2019
- ke(g, (f) => {
2020
- m(f.key) || Oe(u, f.key, f.value);
2021
- }), a([x(t, "_id")], { [c]: u }), s("UNSAVED");
2022
- },
2023
- [t, s, a, c]
2024
- );
2025
- return /* @__PURE__ */ e.jsxs(de, { value: r.heading, children: [
2026
- /* @__PURE__ */ e.jsx(ce, { className: "px-3 py-2 text-xs hover:no-underline", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-x-2", children: [
2027
- /* @__PURE__ */ e.jsx(
2028
- "div",
2029
- {
2030
- className: `h-[8px] w-[8px] rounded-full ${m(x(t, c)) ? "bg-gray-300" : "bg-blue-500"}`
2031
- }
2032
- ),
2033
- "Attributes"
2034
- ] }) }),
2035
- /* @__PURE__ */ e.jsx(pe, { className: "bg-gray-100 px-3.5 py-2", children: /* @__PURE__ */ e.jsxs("div", { className: "no-scrollbar flex min-h-max flex-col gap-y-2 overflow-y-auto bg-gray-100 p-px", children: [
2036
- /* @__PURE__ */ e.jsxs(Te, { className: "mt-2 flex w-full items-center justify-between", children: [
2037
- "Add Custom attributes",
2038
- /* @__PURE__ */ e.jsxs(
2039
- "div",
2040
- {
2041
- className: `flex h-6 w-max items-center justify-center gap-x-0.5 rounded-full border p-1 px-2 text-xs ${!m(o) && m((h = ve(o)) == null ? void 0 : h.key) ? "cursor-not-allowed border-gray-400 text-gray-400" : "cursor-pointer border-blue-400 text-blue-400 hover:bg-blue-400 hover:text-white"}`,
2042
- onClick: () => {
2043
- var g;
2044
- !m(o) && m((g = ve(o)) == null ? void 0 : g.key) || i();
2045
- },
2046
- children: [
2047
- /* @__PURE__ */ e.jsx(Ne, { width: 12, height: 12 }),
2048
- " Add"
2049
- ]
2050
- }
2051
- )
2052
- ] }),
2053
- /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col", children: [
2054
- m(o) && /* @__PURE__ */ e.jsx("div", { className: "flex h-12 items-center justify-center text-sm text-gray-400", children: "Click + Add to add attributes" }),
2055
- ne.Children.toArray(
2056
- C(o, (g, u) => {
2057
- const f = o.length > 0 && u < o.length - 1;
2058
- return /* @__PURE__ */ e.jsx(
2059
- xl,
2060
- {
2061
- item: g,
2062
- index: u,
2063
- canDelete: f,
2064
- onChange: y,
2065
- onRemove: () => p(u)
2066
- }
2067
- );
2068
- })
2069
- )
2070
- ] })
2071
- ] }) })
2072
- ] });
2073
- };
2074
- function hl() {
2075
- const [r, s] = Qe(), { flexChild: t, gridChild: o } = yr(), [, l] = $r(br), { t: d } = K(), [a] = Se();
2076
- return m(a) ? /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 rounded-xl p-4", children: [
2077
- /* @__PURE__ */ e.jsx(Ze, { className: "mx-auto text-3xl" }),
2078
- /* @__PURE__ */ e.jsx("h1", { children: d("no_styling_block_selected") }),
2079
- /* @__PURE__ */ e.jsxs("p", { className: "text-xs ", children: [
2080
- "Hint: Styling allowed blocks are highlighted with",
2081
- " ",
2082
- /* @__PURE__ */ e.jsx("span", { className: "border border-orange-500 p-px", children: "orange" }),
2083
- " border"
2084
- ] })
2085
- ] }) }) : (
2086
- // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
2087
- /* @__PURE__ */ e.jsxs("div", { onClick: () => l(!1), className: "flex h-full flex-col", children: [
2088
- /* @__PURE__ */ e.jsx("div", { className: "flex flex-col space-x-4 space-y-3 border-b h-12 border-border px-4 py-1", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-end gap-x-1.5", children: [
2089
- /* @__PURE__ */ e.jsx(Te, { htmlFor: "", className: "flex gap-x-1.5 text-xs italic", children: "State" }),
2090
- /* @__PURE__ */ e.jsxs(mr, { defaultValue: r, onValueChange: (c) => s(c), children: [
2091
- /* @__PURE__ */ e.jsx(fr, { className: "h-auto w-fit p-1 px-3", children: /* @__PURE__ */ e.jsx(vr, { placeholder: "State" }) }),
2092
- /* @__PURE__ */ e.jsxs(wr, { children: [
2093
- /* @__PURE__ */ e.jsx(V, { value: "", children: "Normal" }),
2094
- /* @__PURE__ */ e.jsx(V, { value: "hover", children: "Hover" }),
2095
- /* @__PURE__ */ e.jsx(V, { value: "active", children: "Active" }),
2096
- /* @__PURE__ */ e.jsx(V, { value: "focus", children: "Focus" }),
2097
- /* @__PURE__ */ e.jsx(V, { value: "before", children: "Before" }),
2098
- /* @__PURE__ */ e.jsx(V, { value: "after", children: "After" }),
2099
- /* @__PURE__ */ e.jsx(V, { value: "only", children: "Only" }),
2100
- /* @__PURE__ */ e.jsx(V, { value: "first", children: "First" }),
2101
- /* @__PURE__ */ e.jsx(V, { value: "last", children: "Last" }),
2102
- /* @__PURE__ */ e.jsx(V, { value: "first-letter", children: "First Letter" }),
2103
- /* @__PURE__ */ e.jsx(V, { value: "first-line", children: "First Line" }),
2104
- /* @__PURE__ */ e.jsx(V, { value: "disabled", children: "Disabled" })
2105
- ] })
2106
- ] })
2107
- ] }) }),
2108
- /* @__PURE__ */ e.jsx(et, { className: "no-scrollbar -mx-1 flex-1 max-h-full overflow-y-hidden overflow-x-hidden", children: /* @__PURE__ */ e.jsxs(Ke, { defaultValue: ["Layout"], type: "multiple", className: "w-full", children: [
2109
- t && /* @__PURE__ */ e.jsx(me, { section: Wr }),
2110
- o ? /* @__PURE__ */ e.jsx(me, { section: Ur }) : null,
2111
- Kr.map((c) => /* @__PURE__ */ e.jsx(me, { section: c }, c.heading)),
2112
- /* @__PURE__ */ e.jsx(gl, { section: { heading: "Attributes" } })
2113
- ] }) })
2114
- ] })
2115
- );
2116
- }
2117
- const yl = {
2118
- px: 1,
2119
- "%": 1,
2120
- em: 100,
2121
- rem: 100,
2122
- ch: 1,
2123
- vw: 1,
2124
- vh: 1,
2125
- "-": 1,
2126
- deg: 1,
2127
- ms: 0.1
2128
- }, Cs = () => {
2129
- const r = q(), { t: s } = K(), [t, o] = I.useState(""), [l, d] = I.useState({
2130
- onDrag: (i) => i,
2131
- onDragEnd: (i) => i,
2132
- dragStartY: 0,
2133
- dragging: !1,
2134
- dragStartValue: 0,
2135
- dragUnit: "",
2136
- negative: !1,
2137
- cssProperty: ""
2138
- }), a = fe(
2139
- (i) => {
2140
- const p = !x(l, "negative", !1), y = x(l, "cssProperty", "");
2141
- let n = parseFloat(l.dragStartValue);
2142
- n = Xe(n) ? 0 : n;
2143
- let h = yl[l.dragUnit];
2144
- (W(y, "scale") || y === "opacity") && (h = 10);
2145
- let u = (l.dragStartY - i.pageY) / h + n;
2146
- p && u < 0 && (u = 0), y === "opacity" && u > 1 && (u = 1), l.onDrag(`${u}`), o(`${u}`);
2147
- },
2148
- [l],
2149
- 50
2150
- ), c = B(() => {
2151
- setTimeout(() => l.onDragEnd(`${t}`), 100), d({
2152
- onDrag: (i) => i,
2153
- onDragEnd: (i) => i,
2154
- dragStartY: 0,
2155
- dragging: !1,
2156
- dragStartValue: 0,
2157
- dragUnit: "",
2158
- negative: !1,
2159
- cssProperty: ""
2160
- });
2161
- }, [l, t, d]);
2162
- return Ct(r) ? /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 rounded-xl p-4", children: [
2163
- /* @__PURE__ */ e.jsx(Ze, { className: "mx-auto text-3xl" }),
2164
- /* @__PURE__ */ e.jsx("h1", { children: s("no_block_selected_for_styling") })
2165
- ] }) }) : /* @__PURE__ */ e.jsx(rt, { children: /* @__PURE__ */ e.jsxs(nt.Provider, { value: { setDragData: d }, children: [
2166
- l.dragging ? /* @__PURE__ */ e.jsx(
2167
- "div",
2168
- {
2169
- onMouseMove: a,
2170
- onMouseUp: () => c(),
2171
- className: "absolute inset-0 z-30 cursor-row-resize bg-gray-300/10"
2172
- }
2173
- ) : null,
2174
- /* @__PURE__ */ e.jsxs(jr, { defaultValue: "settings", className: "flex h-full w-full flex-col py-1", children: [
2175
- /* @__PURE__ */ e.jsxs(Cr, { className: "mx-1 grid grid-cols-2", children: [
2176
- /* @__PURE__ */ e.jsx(De, { value: "settings", children: s("settings") }),
2177
- /* @__PURE__ */ e.jsx(De, { value: "styling", children: s("styling") })
2178
- ] }),
2179
- /* @__PURE__ */ e.jsx($e, { value: "settings", className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ e.jsx(et, { className: "no-scrollbar max-h-full flex-1 overflow-x-hidden overflow-y-hidden pb-5", children: /* @__PURE__ */ e.jsx(zr, {}) }) }),
2180
- /* @__PURE__ */ e.jsx($e, { value: "styling", className: "h-full flex-1 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ e.jsx(hl, {}) })
2181
- ] })
2182
- ] }) });
2183
- };
2184
- export {
2185
- Cs as default
2186
- };