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