@chaibuilder/sdk 1.2.60 → 1.2.62
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/README.md +1 -1
- package/dist/AddBlocks-Wja5xsTO.cjs +1 -0
- package/dist/{AddBlocks-L-3Io1jR.js → AddBlocks-ucNQHhx7.js} +18 -18
- package/dist/CanvasArea-1lUzUorh.js +975 -0
- package/dist/CanvasArea-dsxnMndK.cjs +60 -0
- package/dist/{CodeEditor-cY6z8D4N.js → CodeEditor-LeNocbY6.js} +1 -1
- package/dist/{CodeEditor-NuzOGqRn.cjs → CodeEditor-kk0bmQ3P.cjs} +1 -1
- package/dist/{CurrentPage-XXy2OzNq.js → CurrentPage-huy7O-ih.js} +3 -3
- package/dist/{CurrentPage-ccOL3l6S.cjs → CurrentPage-oPzQ-MY2.cjs} +1 -1
- package/dist/{ListTree-yoltG7gq.js → ListTree-5T-2KuBE.js} +1 -1
- package/dist/{ListTree-8jpTvI-s.cjs → ListTree-Fwl6Dtgc.cjs} +1 -1
- package/dist/{PagesPanel-t3NlycIl.cjs → PagesPanel-85U4O4ex.cjs} +1 -1
- package/dist/{PagesPanel-XUtE4Aou.js → PagesPanel-IT7AmWMs.js} +4 -4
- package/dist/{ProjectPanel-UClucyIl.cjs → ProjectPanel-NiOqTkub.cjs} +1 -1
- package/dist/{ProjectPanel-3zkDX3az.js → ProjectPanel-hhxqbHEX.js} +4 -4
- package/dist/{Settings-GVs7UvAX.cjs → Settings-NqIs7PLQ.cjs} +1 -1
- package/dist/{Settings-C9AegLbF.js → Settings-UO9zB4rm.js} +2 -2
- package/dist/{SidePanels-Y3z3wyQx.js → SidePanels-2ZXeWnl7.js} +3 -3
- package/dist/{SidePanels--qxWuuF-.cjs → SidePanels-n5WUkXLw.cjs} +1 -1
- package/dist/{ThemeConfiguration-03I3INEI.cjs → ThemeConfiguration-UNRnCxnU.cjs} +1 -1
- package/dist/{ThemeConfiguration-e_4e_ZcS.js → ThemeConfiguration-VSQaQn9_.js} +4 -4
- package/dist/{Topbar-lnCz7TLm.js → Topbar-Tkn___pR.js} +2 -2
- package/dist/{Topbar-Yrhyc6IQ.cjs → Topbar-m48Xdj0O.cjs} +1 -1
- package/dist/UILibrariesPanel-0NMxbnSZ.js +215 -0
- package/dist/UILibrariesPanel-9V4REpxW.cjs +1 -0
- package/dist/{UnsplashImages-Y0TGxNbH.js → UnsplashImages-LU3fiooG.js} +1 -1
- package/dist/{UnsplashImages-5JbDig-S.cjs → UnsplashImages-fm761J9M.cjs} +1 -1
- package/dist/{UploadImages-f6wPPJxc.cjs → UploadImages-2_SIuRI7.cjs} +1 -1
- package/dist/{UploadImages-Dh35M55S.js → UploadImages-MjYi7gfH.js} +1 -1
- package/dist/{add-page-modal-j2foeVKa.cjs → add-page-modal-QdlPDeMk.cjs} +1 -1
- package/dist/{add-page-modal-sKH5SHMa.js → add-page-modal-TWTjEGxY.js} +4 -4
- package/dist/{atoms-a0H_593V.cjs → atoms-KQpaDRnF.cjs} +1 -1
- package/dist/{atoms-ZOWyNoiC.js → atoms-Oomqut88.js} +2 -2
- package/dist/{confirm-alert-pGxJwZ2Q.js → confirm-alert-RNzVJyhU.js} +1 -1
- package/dist/{confirm-alert-C3wsf6lk.cjs → confirm-alert-gFBHhF1C.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +2 -2
- package/dist/{delete-page-modal-XObwAnNB.cjs → delete-page-modal-B5W3a1ZW.cjs} +1 -1
- package/dist/{delete-page-modal-4Tp_VPx1.js → delete-page-modal-sUlXQ02P.js} +3 -3
- package/dist/email.cjs +1 -1
- package/dist/email.js +2 -2
- package/dist/{form-pya-o19L.js → form-c4b4A8Ap.js} +1 -1
- package/dist/{form-D9cWMUJ4.cjs → form-lqNXs-pv.cjs} +1 -1
- package/dist/{index-1teL5Lld.js → index-0M3H1dVb.js} +3 -3
- package/dist/{index-TzLilp-0.js → index-SyrshOUV.js} +399 -402
- package/dist/{index-849lneVZ.cjs → index-TKS5_SlD.cjs} +1 -1
- package/dist/{index-ZZTdYO7r.js → index-WN67ca4z.js} +9 -9
- package/dist/{index-8Fxmy4tt.cjs → index-afblGXKA.cjs} +2 -2
- package/dist/index-upb0eDoG.cjs +1 -0
- package/dist/lib.cjs +2 -2
- package/dist/lib.js +97 -146
- package/dist/{page-viewer-Q-eOjWmS.js → page-viewer-qb3ot43w.js} +4 -4
- package/dist/{page-viewer-tNzhbu_E.cjs → page-viewer-v4K0Wkhx.cjs} +1 -1
- package/dist/plugin-2hf9pCRy.cjs +1 -0
- package/dist/plugin-wDnsBVPp.js +54 -0
- package/dist/{project-general-setting-uDDo2ktT.js → project-general-setting-LfoijnjK.js} +4 -4
- package/dist/{project-general-setting-9fI_iZ_Q.cjs → project-general-setting-Q7hgQy5G.cjs} +1 -1
- package/dist/{project-seo-setting-rjrO9KDR.cjs → project-seo-setting-rjVkahzj.cjs} +1 -1
- package/dist/{project-seo-setting-PXJe5SSV.js → project-seo-setting-ztis1_yw.js} +2 -2
- package/dist/{single-page-detail-0ipAHwTX.js → single-page-detail-Neoai4eq.js} +11 -11
- package/dist/{single-page-detail-s_kkO9Zj.cjs → single-page-detail-tR7Qp9T4.cjs} +1 -1
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +3 -3
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +44 -44
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +1 -1
- package/package.json +1 -1
- package/dist/AddBlocks-BtMNa99n.cjs +0 -1
- package/dist/CanvasArea-KBfW2Hh3.js +0 -978
- package/dist/CanvasArea-ZNRxUJR7.cjs +0 -59
- package/dist/UILibrariesPanel-LGbh-IZP.cjs +0 -1
- package/dist/UILibrariesPanel-PP4QDQRZ.js +0 -216
- package/dist/index-cH1CfTbV.cjs +0 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Chai Builder is an Open Source Low Code React + Tailwind CSS Visual Builder.
|
|
|
4
4
|
It allows you to create web pages & email templates visually by dragging and dropping elements onto the canvas.
|
|
5
5
|
It is a simple React component that renders a full-fledged visual builder into any React application.
|
|
6
6
|
|
|
7
|
-
### [Try Chai Builder](https://chaibuilder.com/
|
|
7
|
+
### [Try Chai Builder](https://chaibuilder.com/demos/web)
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),u=require("react"),t=require("lodash-es"),h=require("jotai"),q=require("react-i18next"),s=require("./index-upb0eDoG.cjs"),b=require("@radix-ui/react-icons"),R=require("@chaibuilder/runtime"),E=require("./MODIFIERS-mVmfEGgo.cjs"),T=require("./atoms-KQpaDRnF.cjs"),N=require("flagged"),k=require("./html-to-json-ndxaXRT8.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("clsx");require("tailwind-merge");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("./Functions-N3yhPYKY.cjs");require("@react-hookz/web");require("tree-model");require("himalaya");require("lodash");const y=({block:r})=>{const[,i]=h.useAtom(T.draggedBlockAtom),{type:l,icon:c,label:d}=r,{addCoreBlock:p,addPredefinedBlock:j}=s.useAddBlock(),[o,g]=s.useSelectedBlockIds(),[,f]=s.useHighlightBlockId(),[,x]=h.useAtom(s.activePanelAtom),a=()=>{if(t.has(r,"blocks")){const m=t.isFunction(r.blocks)?r.blocks():r.blocks;j(R.syncBlocksWithDefaults(m),t.first(o))}else p(r,t.first(o));x(E.OUTLINE_KEY)},n=N.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:a,type:"button",onDragStart:m=>{m.dataTransfer.setData("text/plain",JSON.stringify(t.omit(r,["component","icon"]))),m.dataTransfer.setDragImage(new Image,0,0),i(t.omit(r,["component","icon"])),setTimeout(()=>{g([]),f(null),x(E.OUTLINE_KEY)},200)},draggable:n?"true":"false",className:"cursor-pointer space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50",children:[u.createElement(c||b.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"text-xs",children:d||l})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:d||l})})]})})},B=()=>{const{t:r}=q.useTranslation(),[i,l]=u.useState(""),{addPredefinedBlock:c}=s.useAddBlock(),[d]=s.useSelectedBlockIds(),[,p]=h.useAtom(s.activePanelAtom),j=()=>{const o=k.getBlocksFromHTML(i);c([...o],t.first(d)||null),l(""),p(E.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=>l(o.target.value),rows:12,value:i,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:i.trim()==="",onClick:()=>j(),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")})})]})]})},v=()=>{const{t:r}=q.useTranslation(),[i,l]=u.useState("core"),[c,d]=u.useState("basic"),p=R.useChaiBlocks(),[,j]=h.useAtom(s.showPredefinedBlockCategoryAtom),o=s.useBuilderProp("importHTMLSupport",!0),g=s.useBuilderProp("filterChaiBlock",()=>!0),f=t.filter(p,g),x=t.groupBy(f,"category"),a=t.uniq(t.map(x.core,"group"));return u.useEffect(()=>{!t.includes(a,c)&&!t.isEmpty(a)&&!t.isEmpty(c)&&d(t.first(a))},[a,c]),e.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-72 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(i==="html"?"enter_paste_tailwind_html":"click_to_add_block")})]}),e.jsxRuntimeExports.jsx(s.Tabs,{onValueChange:n=>{j(""),l(n)},value:i,className:"h-max",children:e.jsxRuntimeExports.jsxs(s.TabsList,{className:"grid w-full "+(o?"grid-cols-2":"grid-cols-1"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:r("Blocks")}),o?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"html",children:r("import")}):null]})}),i==="core"&&e.jsxRuntimeExports.jsx(s.ScrollArea,{className:"-mx-1.5 h-[calc(100vh-156px)] overflow-y-auto",children:e.jsxRuntimeExports.jsx("div",{className:"mt-2 w-full",children:u.Children.toArray(t.map(a,n=>t.reject(t.filter(t.values(x.core),{group:n}),{hidden:!0}).length?e.jsxRuntimeExports.jsx(s.Accordion,{type:"single",value:n,collapsible:!0,className:"w-full",children:e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:n,children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"rounded-md bg-gray-100 px-4 py-2 capitalize",children:n}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"p-3",children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3 gap-2",children:u.Children.toArray(t.reject(t.filter(t.values(x.core),{group:n}),{hidden:!0}).map(m=>e.jsxRuntimeExports.jsx(y,{block:m})))})})]})}):null))})}),i==="html"&&o?e.jsxRuntimeExports.jsx(B,{}):null]})};exports.default=v;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import N, { createElement as P, useState as
|
|
3
|
-
import { has as H, isFunction as S, first as x, omit as k, filter as g, groupBy as
|
|
2
|
+
import N, { createElement as P, useState as j, useEffect as F } from "react";
|
|
3
|
+
import { has as H, isFunction as S, first as x, omit as k, filter as g, groupBy as D, uniq as E, map as y, includes as M, isEmpty as B, reject as C, values as v } from "lodash-es";
|
|
4
4
|
import { useAtom as h } from "jotai";
|
|
5
|
-
import { useTranslation as
|
|
6
|
-
import { a2 as
|
|
5
|
+
import { useTranslation as w } from "react-i18next";
|
|
6
|
+
import { a2 as A, r as I, ad as z, aJ as L, aF as O, aG as q, aH as G, bs as J, bt as K, bu as R, bv as U, aX as V, T as W, bw as X, B as Y, bx as Q, by as Z, bz as $, h as T, aK as ee, aL as te, aM as _, bp as se, L as oe, M as re, N as ae, O as le } from "./index-SyrshOUV.js";
|
|
7
7
|
import { BoxIcon as ie } from "@radix-ui/react-icons";
|
|
8
8
|
import { syncBlocksWithDefaults as ce, useChaiBlocks as ne } from "@chaibuilder/runtime";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import { O as b } from "./MODIFIERS-fd5XOmum.js";
|
|
10
|
+
import { d as de } from "./atoms-Oomqut88.js";
|
|
11
|
+
import { useFeature as me } from "flagged";
|
|
12
12
|
import { g as pe } from "./html-to-json-_01DXd-a.js";
|
|
13
13
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
14
14
|
import "@radix-ui/react-toggle";
|
|
@@ -43,14 +43,14 @@ import "tree-model";
|
|
|
43
43
|
import "himalaya";
|
|
44
44
|
import "lodash";
|
|
45
45
|
const xe = ({ block: t }) => {
|
|
46
|
-
const [, o] = h(
|
|
46
|
+
const [, o] = h(de), { type: a, icon: l, label: c } = t, { addCoreBlock: m, addPredefinedBlock: p } = A(), [s, u] = I(), [, f] = z(), [, n] = h(L), i = () => {
|
|
47
47
|
if (H(t, "blocks")) {
|
|
48
48
|
const d = S(t.blocks) ? t.blocks() : t.blocks;
|
|
49
49
|
p(ce(d), x(s));
|
|
50
50
|
} else
|
|
51
51
|
m(t, x(s));
|
|
52
|
-
n(
|
|
53
|
-
}, r =
|
|
52
|
+
n(b);
|
|
53
|
+
}, r = me("dnd");
|
|
54
54
|
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(O, { children: [
|
|
55
55
|
/* @__PURE__ */ e.jsx(q, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
56
56
|
"button",
|
|
@@ -59,11 +59,11 @@ const xe = ({ block: t }) => {
|
|
|
59
59
|
type: "button",
|
|
60
60
|
onDragStart: (d) => {
|
|
61
61
|
d.dataTransfer.setData("text/plain", JSON.stringify(k(t, ["component", "icon"]))), d.dataTransfer.setDragImage(new Image(), 0, 0), o(k(t, ["component", "icon"])), setTimeout(() => {
|
|
62
|
-
u([]), f(null), n(
|
|
62
|
+
u([]), f(null), n(b);
|
|
63
63
|
}, 200);
|
|
64
64
|
},
|
|
65
|
-
draggable: "true",
|
|
66
|
-
className: "space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50
|
|
65
|
+
draggable: r ? "true" : "false",
|
|
66
|
+
className: "cursor-pointer space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50",
|
|
67
67
|
children: [
|
|
68
68
|
P(l || ie, { className: "w-4 h-4 mx-auto" }),
|
|
69
69
|
/* @__PURE__ */ e.jsx("p", { className: "text-xs", children: c || a })
|
|
@@ -73,9 +73,9 @@ const xe = ({ block: t }) => {
|
|
|
73
73
|
/* @__PURE__ */ e.jsx(G, { children: /* @__PURE__ */ e.jsx("p", { children: c || a }) })
|
|
74
74
|
] }) });
|
|
75
75
|
}, he = () => {
|
|
76
|
-
const { t } =
|
|
76
|
+
const { t } = w(), [o, a] = j(""), { addPredefinedBlock: l } = A(), [c] = I(), [, m] = h(L), p = () => {
|
|
77
77
|
const s = pe(o);
|
|
78
|
-
l([...s], x(c) || null), a(""), m(
|
|
78
|
+
l([...s], x(c) || null), a(""), m(b);
|
|
79
79
|
};
|
|
80
80
|
return /* @__PURE__ */ e.jsxs(J, { className: "border-border/0 p-0 shadow-none", children: [
|
|
81
81
|
/* @__PURE__ */ e.jsx(K, { className: "p-3", children: /* @__PURE__ */ e.jsx(R, { children: t("html_snippet_description") }) }),
|
|
@@ -101,7 +101,7 @@ const xe = ({ block: t }) => {
|
|
|
101
101
|
] })
|
|
102
102
|
] });
|
|
103
103
|
}, at = () => {
|
|
104
|
-
const { t } =
|
|
104
|
+
const { t } = w(), [o, a] = j("core"), [l, c] = j("basic"), m = ne(), [, p] = h($), s = T("importHTMLSupport", !0), u = T("filterChaiBlock", () => !0), f = g(m, u), n = D(f, "category"), i = E(y(n.core, "group"));
|
|
105
105
|
return F(() => {
|
|
106
106
|
!M(i, l) && !B(i) && !B(l) && c(x(i));
|
|
107
107
|
}, [i, l]), /* @__PURE__ */ e.jsxs("div", { className: "flex h-full w-72 flex-col overflow-hidden", children: [
|
|
@@ -118,8 +118,8 @@ const xe = ({ block: t }) => {
|
|
|
118
118
|
value: o,
|
|
119
119
|
className: "h-max",
|
|
120
120
|
children: /* @__PURE__ */ e.jsxs(te, { className: "grid w-full " + (s ? "grid-cols-2" : "grid-cols-1"), children: [
|
|
121
|
-
/* @__PURE__ */ e.jsx(
|
|
122
|
-
s ? /* @__PURE__ */ e.jsx(
|
|
121
|
+
/* @__PURE__ */ e.jsx(_, { value: "core", children: t("Blocks") }),
|
|
122
|
+
s ? /* @__PURE__ */ e.jsx(_, { value: "html", children: t("import") }) : null
|
|
123
123
|
] })
|
|
124
124
|
}
|
|
125
125
|
),
|