@chaibuilder/sdk 1.1.15 → 1.1.16

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