@chaibuilder/sdk 1.2.18 → 1.2.20
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.
- package/dist/{AddBlocks-uCdu9Xpr.js → AddBlocks-VIWJkaHJ.js} +24 -25
- package/dist/AddBlocks-X9eh8OWJ.cjs +1 -0
- package/dist/{BrandingOptions-JbHRN7V5.js → BrandingOptions-5ss0k1nb.js} +12 -13
- package/dist/BrandingOptions-PzPdafIT.cjs +1 -0
- package/dist/CanvasArea-TTGqlBKO.js +908 -0
- package/dist/CanvasArea-hoyr4dfb.cjs +55 -0
- package/dist/CurrentPage-EddxgHU-.cjs +1 -0
- package/dist/{CurrentPage-AlOLPG4o.js → CurrentPage-a3T2uy8Q.js} +10 -12
- package/dist/ListTree-kergCZrw.js +126 -0
- package/dist/ListTree-tADrgsqZ.cjs +1 -0
- package/dist/Outline-3IHYlOzF.cjs +1 -0
- package/dist/Outline-rNFJGkap.js +294 -0
- package/dist/{PagesPanel-VbSQHEu_.js → PagesPanel-0bL28ofN.js} +5 -7
- package/dist/PagesPanel-B33hWN11.cjs +1 -0
- package/dist/ProjectPanel-qtRTXNOP.cjs +1 -0
- package/dist/{ProjectPanel-fqux215P.js → ProjectPanel-sBRkUXnY.js} +15 -17
- package/dist/{Settings-IhWI1ice.js → Settings-HgGe1ANj.js} +587 -554
- package/dist/Settings-rXxS3RGM.cjs +1 -0
- package/dist/{SidePanels-lMCXrchR.js → SidePanels-R_g9rSjP.js} +132 -134
- package/dist/SidePanels-aAm-2A3s.cjs +1 -0
- package/dist/{Topbar-DYiisBtw.js → Topbar-AUTKpVHO.js} +3 -4
- package/dist/Topbar-cXtxVswU.cjs +1 -0
- package/dist/TypeIcon-ElNNPazl.cjs +1 -0
- package/dist/TypeIcon-qO96rNbV.js +69 -0
- package/dist/{UnsplashImages-lGLcqo4M.js → UnsplashImages-1RFHZIte.js} +13 -14
- package/dist/UnsplashImages-p34UJJWJ.cjs +1 -0
- package/dist/UploadImages-CLfyNo1i.cjs +1 -0
- package/dist/{UploadImages-06m6vjbL.js → UploadImages-G2orrhmZ.js} +8 -9
- package/dist/{add-page-modal-mEbIXSKX.js → add-page-modal-DUthvJNJ.js} +7 -9
- package/dist/add-page-modal-KCy_Khfe.cjs +1 -0
- package/dist/confirm-alert-T8vimDRx.cjs +1 -0
- package/dist/{confirm-alert-YETlIRpE.js → confirm-alert-nk2WQHud.js} +3 -4
- package/dist/{controls-Dy1qa8Dc.cjs → controls-KK2oLIa8.cjs} +1 -1
- package/dist/{controls-XPXGHKht.js → controls-OfJWSEqC.js} +29 -28
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +2 -1
- package/dist/core.js +45 -47
- package/dist/defaultTheme-7Lk2zq60.cjs +1 -0
- package/dist/{defaultTheme-s0cpA5Oy.js → defaultTheme-gunU_Fe5.js} +31 -33
- package/dist/{delete-page-modal-J_SmPWrw.js → delete-page-modal-WvWRQUgU.js} +8 -10
- package/dist/delete-page-modal-_pFjWLJn.cjs +1 -0
- package/dist/email-blocks.cjs +1 -1
- package/dist/email-blocks.js +81 -81
- package/dist/email.cjs +1 -1
- package/dist/email.d.ts +2 -0
- package/dist/email.js +4 -6
- package/dist/{form-Y0Vb4m04.cjs → form-YnnWtUGk.cjs} +1 -1
- package/dist/{form-2xJcQs_Y.js → form-kXQX4L2W.js} +1 -1
- package/dist/{index-627XtO9e.js → index--Pt4B5bv.js} +3 -3
- package/dist/index-DeHH1q_1.cjs +1 -0
- package/dist/{index-3TQsdso6.cjs → index-JqRQZLN5.cjs} +1 -1
- package/dist/{index-LF3KXx4u.js → index-QIbDWoML.js} +8308 -8162
- package/dist/{index-ZwpjuB-N.cjs → index-e5cgISUO.cjs} +51 -51
- package/dist/{index-ZBqiaKhx.js → index-la4rqGKN.js} +802 -794
- package/dist/lib.cjs +1 -1
- package/dist/lib.js +1 -1
- package/dist/page-viewer-6phtctz6.cjs +1 -0
- package/dist/{page-viewer-7u0SWWmO.js → page-viewer-s_lHBVfx.js} +6 -8
- package/dist/project-general-setting-SaNOMXEl.cjs +1 -0
- package/dist/{project-general-setting-SqC85J7F.js → project-general-setting-gj4A0X5W.js} +7 -9
- package/dist/{project-seo-setting-TlQherop.js → project-seo-setting-aCPg-IIc.js} +5 -6
- package/dist/project-seo-setting-bMDdgKRZ.cjs +1 -0
- package/dist/render.cjs +1 -1
- package/dist/render.d.ts +10 -0
- package/dist/render.js +164 -78
- package/dist/{single-page-detail-ClZYIdSO.js → single-page-detail-TP-cxVIT.js} +36 -38
- package/dist/single-page-detail-er8i2FIF.cjs +1 -0
- package/dist/studio.cjs +1 -1
- package/dist/studio.d.ts +2 -0
- package/dist/studio.js +4 -6
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +130 -131
- package/dist/{useAddBlockByDrop-E343zoB3.cjs → useAddBlockByDrop-LSV8adwE.cjs} +1 -1
- package/dist/{useAddBlockByDrop-sPX4lN-O.js → useAddBlockByDrop-_vczk5o_.js} +1 -1
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +1 -1
- package/package.json +4 -14
- package/dist/AddBlocks-5Q5w5lPJ.cjs +0 -1
- package/dist/BrandingOptions-xrGQI1Kn.cjs +0 -1
- package/dist/CanvasArea-aWzbzB9p.js +0 -1403
- package/dist/CanvasArea-oUIvLfdq.cjs +0 -60
- package/dist/CurrentPage-atmd8UrZ.cjs +0 -1
- package/dist/Outline-oGoAdnBw.js +0 -355
- package/dist/Outline-uMUTwN-R.cjs +0 -1
- package/dist/PagesPanel-nN3QUwXp.cjs +0 -1
- package/dist/ProjectPanel-UIEFhref.cjs +0 -1
- package/dist/Settings-8qUW0Iow.cjs +0 -1
- package/dist/SidePanels-cOHgPE9y.cjs +0 -1
- package/dist/Topbar-vLD-rWl5.cjs +0 -1
- package/dist/UnsplashImages-1JWfKlBc.cjs +0 -1
- package/dist/UploadImages-T4MYMOhW.cjs +0 -1
- package/dist/add-page-modal-niwhffYL.cjs +0 -1
- package/dist/confirm-alert-ZpEIxh3X.cjs +0 -1
- package/dist/defaultTheme-1XwPZT2b.cjs +0 -1
- package/dist/delete-page-modal-sOqRlmKb.cjs +0 -1
- package/dist/index-T3wfa1kz.cjs +0 -1
- package/dist/page-viewer-6UDraUKW.cjs +0 -1
- package/dist/project-general-setting-AW5Vtmgx.cjs +0 -1
- package/dist/project-seo-setting-cWiNZcxW.cjs +0 -1
- package/dist/single-page-detail-kJUW6FE9.cjs +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import v, { createElement as M, useState as f, useCallback as
|
|
2
|
+
import v, { createElement as M, useState as f, useCallback as q, useMemo as z, useEffect as O, Suspense as U } from "react";
|
|
3
3
|
import { has as L, first as h, omit as V, noop as K, isEmpty as g, filter as j, values as b, groupBy as k, mergeWith as R, isArray as _, keys as W, get as Y, map as w, uniq as J, includes as Q, find as X, reject as P } from "lodash-es";
|
|
4
4
|
import { useAtom as B } from "jotai";
|
|
5
5
|
import { useTranslation as I } from "react-i18next";
|
|
6
|
-
import { L as C, r as A, Y as Z, at as T, ap as $, aq as ee, ar as se, h as F, a3 as E, aj as re, ak as te, al as oe, am as ae, an as S,
|
|
6
|
+
import { L as C, r as A, Y as Z, at as T, ap as $, aq as ee, ar as se, h as F, a3 as E, aj as re, ak as te, al as oe, am as ae, an as S, bj as le, bk as ce, bl as ie, bm as ne, aB as de, bn as me, bo as pe, B as ue, bp as xe, bq as he, br as fe, au as ge, av as je, aw as N, bf as be, b9 as ve, ba as ye, bb as Be, bc as Ne, S as ke } from "./index-la4rqGKN.js";
|
|
7
7
|
import { BoxIcon as we } from "@radix-ui/react-icons";
|
|
8
8
|
import { syncBlocksWithDefaults as H, useChaiBlocks as D } from "@chaibuilder/runtime";
|
|
9
9
|
import { useFeature as Ce } from "flagged";
|
|
@@ -15,7 +15,6 @@ import "./_commonjsHelpers-UyOWmZb0.js";
|
|
|
15
15
|
import "./Functions-7jnEwJyw.js";
|
|
16
16
|
import "clsx";
|
|
17
17
|
import "tailwind-merge";
|
|
18
|
-
import "flat-to-nested";
|
|
19
18
|
import "@react-hookz/web";
|
|
20
19
|
import "@radix-ui/react-toggle";
|
|
21
20
|
import "class-variance-authority";
|
|
@@ -43,8 +42,8 @@ import "react-dom";
|
|
|
43
42
|
import "react-quill";
|
|
44
43
|
import "himalaya";
|
|
45
44
|
const Se = ({ block: s }) => {
|
|
46
|
-
const { type: o, icon:
|
|
47
|
-
L(s, "blocks") ?
|
|
45
|
+
const { type: o, icon: i, label: l } = s, { addCoreBlock: d, addPredefinedBlock: c } = C(), [n, r] = A(), [, x] = Z(), [, p] = B(T), a = () => {
|
|
46
|
+
L(s, "blocks") ? c(H(s.blocks), h(n)) : d(s, h(n)), p(y);
|
|
48
47
|
}, t = Ce("dnd");
|
|
49
48
|
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs($, { children: [
|
|
50
49
|
/* @__PURE__ */ e.jsx(ee, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
@@ -60,7 +59,7 @@ const Se = ({ block: s }) => {
|
|
|
60
59
|
draggable: t ? "true" : "false",
|
|
61
60
|
className: "space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 " + (t ? "cursor-grab" : "cursor-pointer"),
|
|
62
61
|
children: [
|
|
63
|
-
M(
|
|
62
|
+
M(i || we, { className: "w-4 h-4 mx-auto" }),
|
|
64
63
|
/* @__PURE__ */ e.jsx("p", { className: "truncate text-xs", children: l || o })
|
|
65
64
|
]
|
|
66
65
|
}
|
|
@@ -69,16 +68,16 @@ const Se = ({ block: s }) => {
|
|
|
69
68
|
] }) });
|
|
70
69
|
}, Le = ({ block: s, closePopover: o }) => {
|
|
71
70
|
var t;
|
|
72
|
-
const [
|
|
71
|
+
const [i, l] = f(!1), d = F("getExternalPredefinedBlock", K()), { addCoreBlock: c, addPredefinedBlock: n } = C(), [r] = A(), [, x, p] = Te(
|
|
73
72
|
() => ({
|
|
74
73
|
type: "CHAI_BLOCK",
|
|
75
74
|
item: s
|
|
76
75
|
}),
|
|
77
76
|
[s]
|
|
78
|
-
), a =
|
|
77
|
+
), a = q(
|
|
79
78
|
async (u) => {
|
|
80
79
|
if (u.stopPropagation(), L(s, "component")) {
|
|
81
|
-
|
|
80
|
+
c(s, h(r)), o();
|
|
82
81
|
return;
|
|
83
82
|
}
|
|
84
83
|
l(!0);
|
|
@@ -99,11 +98,11 @@ const Se = ({ block: s }) => {
|
|
|
99
98
|
"div",
|
|
100
99
|
{
|
|
101
100
|
ref: x,
|
|
102
|
-
onClick:
|
|
101
|
+
onClick: i ? () => {
|
|
103
102
|
} : a,
|
|
104
103
|
className: "relative cursor-pointer overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",
|
|
105
104
|
children: [
|
|
106
|
-
|
|
105
|
+
i && /* @__PURE__ */ e.jsxs("div", { className: "absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70", children: [
|
|
107
106
|
/* @__PURE__ */ e.jsx(Ae, { className: "animate-spin", size: 15, color: "white" }),
|
|
108
107
|
" ",
|
|
109
108
|
/* @__PURE__ */ e.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
|
|
@@ -121,17 +120,17 @@ const Se = ({ block: s }) => {
|
|
|
121
120
|
)
|
|
122
121
|
] });
|
|
123
122
|
}, Ie = () => {
|
|
124
|
-
const { data: s } = E(), o = D(),
|
|
123
|
+
const { data: s } = E(), o = D(), i = j(b(o), { category: "custom" }), l = k(i, "group"), d = k(s, "group"), c = z(() => R(l, d, (a, t) => {
|
|
125
124
|
if (_(a) && _(t))
|
|
126
125
|
return [...a, ...t];
|
|
127
|
-
}), [l, d]), [n, r] = f(h(W(
|
|
126
|
+
}), [l, d]), [n, r] = f(h(W(c)) || ""), [, x] = B(T), p = Y(c, n, []);
|
|
128
127
|
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden py-2", children: [
|
|
129
128
|
/* @__PURE__ */ e.jsx("div", { className: "sticky top-0 flex w-full items-center p-3", children: /* @__PURE__ */ e.jsxs(re, { value: n, onValueChange: (a) => r(a), children: [
|
|
130
129
|
/* @__PURE__ */ e.jsx(te, { className: "w-full", children: /* @__PURE__ */ e.jsx(oe, { placeholder: "Select a provider" }) }),
|
|
131
130
|
/* @__PURE__ */ e.jsxs(ae, { children: [
|
|
132
131
|
/* @__PURE__ */ e.jsx(S, { value: "", children: "Choose" }),
|
|
133
132
|
v.Children.toArray(
|
|
134
|
-
w(
|
|
133
|
+
w(c, (a, t) => /* @__PURE__ */ e.jsx(S, { value: t, children: t }, t))
|
|
135
134
|
)
|
|
136
135
|
] })
|
|
137
136
|
] }) }),
|
|
@@ -140,12 +139,12 @@ const Se = ({ block: s }) => {
|
|
|
140
139
|
) })
|
|
141
140
|
] });
|
|
142
141
|
}, Fe = () => {
|
|
143
|
-
const { t: s } = I(), [o,
|
|
142
|
+
const { t: s } = I(), [o, i] = f(""), { addPredefinedBlock: l } = C(), [d] = A(), [, c] = B(T), n = () => {
|
|
144
143
|
const r = Pe(o);
|
|
145
|
-
l([...r], h(d) || null),
|
|
144
|
+
l([...r], h(d) || null), i(""), c(y);
|
|
146
145
|
};
|
|
147
146
|
return /* @__PURE__ */ e.jsxs(le, { className: "border-border/0 p-0 shadow-none", children: [
|
|
148
|
-
/* @__PURE__ */ e.jsx(
|
|
147
|
+
/* @__PURE__ */ e.jsx(ce, { className: "p-3", children: /* @__PURE__ */ e.jsx(ie, { children: s("html_snippet_description") }) }),
|
|
149
148
|
/* @__PURE__ */ e.jsx(ne, { className: "space-y-2 px-3 py-0", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
|
|
150
149
|
/* @__PURE__ */ e.jsx(de, { htmlFor: "current", className: "text-sm", children: s("tailwind_html_snippet") }),
|
|
151
150
|
/* @__PURE__ */ e.jsx(
|
|
@@ -154,7 +153,7 @@ const Se = ({ block: s }) => {
|
|
|
154
153
|
autoFocus: !0,
|
|
155
154
|
tabIndex: 1,
|
|
156
155
|
ref: (r) => r && r.focus(),
|
|
157
|
-
onChange: (r) =>
|
|
156
|
+
onChange: (r) => i(r.target.value),
|
|
158
157
|
rows: 12,
|
|
159
158
|
value: o,
|
|
160
159
|
placeholder: s("enter_code_snippet"),
|
|
@@ -167,15 +166,15 @@ const Se = ({ block: s }) => {
|
|
|
167
166
|
/* @__PURE__ */ e.jsx(xe, { variant: "default", className: "mt-2 border-none p-1 text-gray-400", children: /* @__PURE__ */ e.jsx(he, { className: "text-xs font-normal leading-4", children: s("note_imported_html") }) })
|
|
168
167
|
] })
|
|
169
168
|
] });
|
|
170
|
-
}, Ee = () => !0,
|
|
171
|
-
const { t: s } = I(), [o,
|
|
172
|
-
j(
|
|
169
|
+
}, Ee = () => !0, ws = () => {
|
|
170
|
+
const { t: s } = I(), [o, i] = f("core"), [l, d] = f("basic"), c = D(), [, n] = B(fe), r = F("importHTMLSupport", !0), { data: x, isLoading: p } = E(), a = k(
|
|
171
|
+
j(c, () => Ee()),
|
|
173
172
|
"category"
|
|
174
173
|
), t = J(w(a.core, "group"));
|
|
175
|
-
|
|
174
|
+
O(() => {
|
|
176
175
|
!Q(t, l) && !g(t) && !g(l) && d(h(t));
|
|
177
176
|
}, [t, l]);
|
|
178
|
-
const u = !p && !g(x) || X(b(
|
|
177
|
+
const u = !p && !g(x) || X(b(c), { category: "custom" }) !== void 0;
|
|
179
178
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
|
|
180
179
|
/* @__PURE__ */ e.jsxs("div", { className: "mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1", children: [
|
|
181
180
|
/* @__PURE__ */ e.jsx("h1", { className: "flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col", children: s("add_block") }),
|
|
@@ -185,7 +184,7 @@ const Se = ({ block: s }) => {
|
|
|
185
184
|
ge,
|
|
186
185
|
{
|
|
187
186
|
onValueChange: (m) => {
|
|
188
|
-
n(""),
|
|
187
|
+
n(""), i(m);
|
|
189
188
|
},
|
|
190
189
|
value: o,
|
|
191
190
|
className: "h-max",
|
|
@@ -220,5 +219,5 @@ const Se = ({ block: s }) => {
|
|
|
220
219
|
] });
|
|
221
220
|
};
|
|
222
221
|
export {
|
|
223
|
-
|
|
222
|
+
ws as default
|
|
224
223
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),c=require("react"),t=require("lodash-es"),E=require("jotai"),v=require("react-i18next"),s=require("./index-DeHH1q_1.cjs"),B=require("@radix-ui/react-icons"),R=require("@chaibuilder/runtime"),q=require("flagged"),g=require("./MODIFIERS-9EwxLM8V.cjs"),k=require("lucide-react"),y=require("react-dnd"),N=require("./html-to-json-FGufPv9R.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-MmCxz2Ay.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("himalaya");const A=({block:r})=>{const{type:n,icon:d,label:a}=r,{addCoreBlock:m,addPredefinedBlock:u}=s.useAddBlock(),[x,o]=s.useSelectedBlockIds(),[,f]=s.useHighlightBlockId(),[,j]=E.useAtom(s.activePanelAtom),l=()=>{t.has(r,"blocks")?u(R.syncBlocksWithDefaults(r.blocks),t.first(x)):m(r,t.first(x)),j(g.OUTLINE_KEY)},i=q.useFeature("dnd");return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:l,type:"button",onDragStart:h=>{h.dataTransfer.setData("text/plain",JSON.stringify(t.omit(r,["component","icon"]))),setTimeout(()=>{o([]),f(null),j(g.OUTLINE_KEY)},200)},draggable:i?"true":"false",className:"space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 "+(i?"cursor-grab":"cursor-pointer"),children:[c.createElement(d||B.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:a||n})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:a||n})})]})})},C=({block:r,closePopover:n})=>{var i;const[d,a]=c.useState(!1),m=s.useBuilderProp("getExternalPredefinedBlock",t.noop()),{addCoreBlock:u,addPredefinedBlock:x}=s.useAddBlock(),[o]=s.useSelectedBlockIds(),[,f,j]=y.useDrag(()=>({type:"CHAI_BLOCK",item:r}),[r]),l=c.useCallback(async h=>{if(h.stopPropagation(),t.has(r,"component")){u(r,t.first(o)),n();return}a(!0);const p=await m(r);t.isEmpty(p)||x(R.syncBlocksWithDefaults(p),t.first(o)),n()},[r]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(y.DragPreviewImage,{connect:j,src:"https://placehold.co/100x30/000000/FFF?text="+((i=r.name||r.label)==null?void 0:i.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:f,onClick:d?()=>{}:l,className:"relative cursor-pointer overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",children:[d&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(k.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),r.preview?e.jsxRuntimeExports.jsx("img",{src:r.preview,className:"min-h-[50px] w-full rounded-md border border-gray-300",alt:r.label}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:r.label})})]})]})},T=()=>{const{data:r}=s.useUILibraryBlocks(),n=R.useChaiBlocks(),d=t.filter(t.values(n),{category:"custom"}),a=t.groupBy(d,"group"),m=t.groupBy(r,"group"),u=c.useMemo(()=>t.mergeWith(a,m,(l,i)=>{if(t.isArray(l)&&t.isArray(i))return[...l,...i]}),[a,m]),[x,o]=c.useState(t.first(t.keys(u))||""),[,f]=E.useAtom(s.activePanelAtom),j=t.get(u,x,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full flex-col overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("div",{className:"sticky top-0 flex w-full items-center p-3",children:e.jsxRuntimeExports.jsxs(s.Select,{value:x,onValueChange:l=>o(l),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Select a provider"})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:"Choose"}),c.Children.toArray(t.map(u,(l,i)=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:i,children:i},i)))]})]})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-2",children:c.Children.toArray(j.map(l=>e.jsxRuntimeExports.jsx(C,{block:l,closePopover:()=>f(g.OUTLINE_KEY)})))})]})},w=()=>{const{t:r}=v.useTranslation(),[n,d]=c.useState(""),{addPredefinedBlock:a}=s.useAddBlock(),[m]=s.useSelectedBlockIds(),[,u]=E.useAtom(s.activePanelAtom),x=()=>{const o=N.getBlocksFromHTML(n);a([...o],t.first(m)||null),d(""),u(g.OUTLINE_KEY)};return e.jsxRuntimeExports.jsxs(s.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsx(s.CardHeader,{className:"p-3",children:e.jsxRuntimeExports.jsx(s.CardDescription,{children:r("html_snippet_description")})}),e.jsxRuntimeExports.jsx(s.CardContent,{className:"space-y-2 px-3 py-0",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx(s.Label,{htmlFor:"current",className:"text-sm",children:r("tailwind_html_snippet")}),e.jsxRuntimeExports.jsx(s.Textarea,{autoFocus:!0,tabIndex:1,ref:o=>o&&o.focus(),onChange:o=>d(o.target.value),rows:12,value:n,placeholder:r("enter_code_snippet"),className:"resize-none overflow-x-auto whitespace-pre bg-gray-100 font-mono text-xs font-normal"})]})}),e.jsxRuntimeExports.jsxs(s.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(s.Button,{disabled:n.trim()==="",onClick:()=>x(),size:"sm",className:"w-full",children:r("import_html")}),e.jsxRuntimeExports.jsx(s.Alert,{variant:"default",className:"mt-2 border-none p-1 text-gray-400",children:e.jsxRuntimeExports.jsx(s.AlertTitle,{className:"text-xs font-normal leading-4",children:r("note_imported_html")})})]})]})},S=()=>!0,I=()=>{const{t:r}=v.useTranslation(),[n,d]=c.useState("core"),[a,m]=c.useState("basic"),u=R.useChaiBlocks(),[,x]=E.useAtom(s.showPredefinedBlockCategoryAtom),o=s.useBuilderProp("importHTMLSupport",!0),{data:f,isLoading:j}=s.useUILibraryBlocks(),l=t.groupBy(t.filter(u,()=>S()),"category"),i=t.uniq(t.map(l.core,"group"));c.useEffect(()=>{!t.includes(i,a)&&!t.isEmpty(i)&&!t.isEmpty(a)&&m(t.first(i))},[i,a]);const h=!j&&!t.isEmpty(f)||t.find(t.values(u),{category:"custom"})!==void 0;return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col",children:r("add_block")}),e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:r(n==="html"?"enter_paste_tailwind_html":"click_to_add_block")})]}),e.jsxRuntimeExports.jsx(s.Tabs,{onValueChange:p=>{x(""),d(p)},value:n,className:"h-max",children:e.jsxRuntimeExports.jsxs(s.TabsList,{className:"grid w-full "+(h&&o?"grid-cols-3":h&&!o||!h&&o?"grid-cols-2":"grid-cols-1"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:r("Blocks")}),h?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"ui-blocks",children:r("ui_library")}):null,o?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"html",children:r("import")}):null]})}),n==="core"&&e.jsxRuntimeExports.jsx(s.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx("div",{className:"mt-2 w-full",children:c.Children.toArray(t.map(i,p=>t.reject(t.filter(t.values(l.core),{group:p}),{hidden:!0}).length?e.jsxRuntimeExports.jsx(s.Accordion,{type:"single",value:p,collapsible:!0,className:"w-full",children:e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:p,children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"rounded-md bg-gray-100 px-4 py-2 capitalize",children:p}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"p-3",children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3 gap-2",children:c.Children.toArray(t.reject(t.filter(t.values(l.core),{group:p}),{hidden:!0}).map(b=>e.jsxRuntimeExports.jsx(A,{block:b})))})})]})}):null))})}),n==="ui-blocks"&&e.jsxRuntimeExports.jsx(c.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(T,{})}),n==="html"&&o?e.jsxRuntimeExports.jsx(w,{}):null]})};exports.default=I;
|
|
@@ -2,16 +2,15 @@ import { j as t } from "./jsx-runtime-WbnYoNE9.js";
|
|
|
2
2
|
import * as c from "react";
|
|
3
3
|
import N from "@rjsf/validator-ajv8";
|
|
4
4
|
import j from "@rjsf/core";
|
|
5
|
-
import { h as k, F as
|
|
6
|
-
import { f, c as
|
|
7
|
-
import { debounce as
|
|
5
|
+
import { h as k, F as w, bw as D } from "./index-la4rqGKN.js";
|
|
6
|
+
import { s as f, c as P, f as a } from "./controls-OfJWSEqC.js";
|
|
7
|
+
import { debounce as R, noop as F, isEqual as L } from "lodash-es";
|
|
8
8
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
9
9
|
import "./Functions-7jnEwJyw.js";
|
|
10
10
|
import "clsx";
|
|
11
11
|
import "tailwind-merge";
|
|
12
12
|
import "@chaibuilder/runtime";
|
|
13
13
|
import "jotai";
|
|
14
|
-
import "flat-to-nested";
|
|
15
14
|
import "./MODIFIERS-WQdaNvb8.js";
|
|
16
15
|
import "@react-hookz/web";
|
|
17
16
|
import "@radix-ui/react-toggle";
|
|
@@ -41,7 +40,7 @@ import "react-dom";
|
|
|
41
40
|
import "react-quill";
|
|
42
41
|
import "react-i18next";
|
|
43
42
|
const M = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
44
|
-
const i =
|
|
43
|
+
const i = R(e, 200), m = (l) => i(l.target.value);
|
|
45
44
|
return /* @__PURE__ */ t.jsx("div", { className: "mt-1.5 flex items-center gap-x-3", children: /* @__PURE__ */ t.jsx("div", { className: "flex w-3/5 flex-col", children: /* @__PURE__ */ t.jsx(
|
|
46
45
|
"input",
|
|
47
46
|
{
|
|
@@ -102,8 +101,8 @@ const M = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
|
102
101
|
{ title: "Lustria", value: "Lustria" },
|
|
103
102
|
{ title: "Ovo", value: "Ovo" },
|
|
104
103
|
{ title: "Suranna", value: "Suranna" }
|
|
105
|
-
],
|
|
106
|
-
const u = k("onSaveBrandingOptions", F), [e, p] =
|
|
104
|
+
], Ct = () => {
|
|
105
|
+
const u = k("onSaveBrandingOptions", F), [e, p] = w(), [d] = D(), i = c.useRef(e);
|
|
107
106
|
c.useEffect(() => () => {
|
|
108
107
|
L(e, i.current) || u(i.current);
|
|
109
108
|
}, []);
|
|
@@ -113,8 +112,8 @@ const M = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
|
113
112
|
bodyFont: l,
|
|
114
113
|
headingFont: h,
|
|
115
114
|
primaryColor: x,
|
|
116
|
-
bodyTextDarkColor:
|
|
117
|
-
bodyTextLightColor:
|
|
115
|
+
bodyTextDarkColor: b,
|
|
116
|
+
bodyTextLightColor: y,
|
|
118
117
|
bodyBgDarkColor: C,
|
|
119
118
|
secondaryColor: S,
|
|
120
119
|
bodyBgLightColor: B,
|
|
@@ -131,7 +130,7 @@ const M = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
|
131
130
|
default: l,
|
|
132
131
|
options: g
|
|
133
132
|
}),
|
|
134
|
-
roundedCorners:
|
|
133
|
+
roundedCorners: P({
|
|
135
134
|
title: "Rounded Corner",
|
|
136
135
|
default: parseInt(O || 5, 10)
|
|
137
136
|
}),
|
|
@@ -146,7 +145,7 @@ const M = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
|
146
145
|
}),
|
|
147
146
|
bodyTextLightColor: a({
|
|
148
147
|
title: "Body Text (Light Mode)",
|
|
149
|
-
default:
|
|
148
|
+
default: b
|
|
150
149
|
}),
|
|
151
150
|
bodyBgDarkColor: a({
|
|
152
151
|
title: "Body Background (Dark mode)",
|
|
@@ -154,7 +153,7 @@ const M = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
|
154
153
|
}),
|
|
155
154
|
bodyTextDarkColor: a({
|
|
156
155
|
title: "Body Text (Dark mode)",
|
|
157
|
-
default:
|
|
156
|
+
default: y
|
|
158
157
|
})
|
|
159
158
|
});
|
|
160
159
|
const n = {
|
|
@@ -185,5 +184,5 @@ const M = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
|
185
184
|
] });
|
|
186
185
|
};
|
|
187
186
|
export {
|
|
188
|
-
|
|
187
|
+
Ct as default
|
|
189
188
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./jsx-runtime-Z_BpKhVy.cjs"),B=require("react"),R=require("@rjsf/validator-ajv8"),E=require("@rjsf/core"),p=require("./index-DeHH1q_1.cjs"),r=require("./controls-KK2oLIa8.cjs"),f=require("lodash-es");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("./MODIFIERS-9EwxLM8V.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-MmCxz2Ay.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("react-i18next");function N(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const l=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const x=N(B),k=({value:t,onChange:e,id:i,onBlur:l})=>{const n=f.debounce(e,200),v=u=>n(u.target.value);return a.jsxRuntimeExports.jsx("div",{className:"mt-1.5 flex items-center gap-x-3",children:a.jsxRuntimeExports.jsx("div",{className:"flex w-3/5 flex-col",children:a.jsxRuntimeExports.jsx("input",{type:"color",className:"text-xs p-0",value:t,onBlur:({target:{value:u}})=>l(i,u),onChange:v})})})},m=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"}],P=()=>{const t=p.useBuilderProp("onSaveBrandingOptions",f.noop),[e,i]=p.useBrandingOptions(),[l]=p.useBlocksContainer(),n=x.useRef(e);x.useEffect(()=>()=>{f.isEqual(e,n.current)||t(n.current)},[]);const v=({formData:o},c)=>{c&&(i(o),n.current=o)},{bodyFont:u,headingFont:q,primaryColor:b,bodyTextDarkColor:h,bodyTextLightColor:y,bodyBgDarkColor:S,secondaryColor:C,bodyBgLightColor:O,roundedCorners:j}=e;let s={headingFont:r.s({title:"Heading font",default:q,options:m}),bodyFont:r.s({title:"Body font",default:u,options:m}),roundedCorners:r.c({title:"Rounded Corner",default:parseInt(j||5,10)}),primaryColor:r.f({title:"Primary",default:b}),secondaryColor:r.f({title:"Secondary",default:C})};l||(s={...s,bodyBgLightColor:r.f({title:"Body Background (Light Mode)",default:O}),bodyTextLightColor:r.f({title:"Body Text (Light Mode)",default:h}),bodyBgDarkColor:r.f({title:"Body Background (Dark mode)",default:S}),bodyTextDarkColor:r.f({title:"Body Text (Dark mode)",default:y})});const d={type:"object",properties:{}},g={};return Object.keys(s).forEach(o=>{const c=s[o];return d.properties||(d.properties={}),d.properties[o]=c.schema,g[o]=c.uiSchema,!0}),a.jsxRuntimeExports.jsxs("div",{className:"flex h-full select-none flex-col",children:[a.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:a.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Branding Options"})}),a.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:a.jsxRuntimeExports.jsx(E,{widgets:{color:k},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:g,schema:d,formData:e,validator:R,onChange:v})})]})};exports.default=P;
|