@chaibuilder/sdk 2.0.0-r19-beta.53 → 2.0.0
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 +4 -0
- package/dist/CodeEditor-C-jeR5bt.js +65 -0
- package/dist/CodeEditor-SZJ1H4vl.cjs +1 -0
- package/dist/Functions-BGzDsf1z.js +14 -0
- package/dist/Functions-BZmyleS1.cjs +1 -0
- package/dist/Topbar-DSfx67NF.cjs +1 -0
- package/dist/Topbar-DZ2jHLv7.js +16 -0
- package/dist/chaibuilder-logo.png +0 -0
- package/dist/core.cjs +12 -248
- package/dist/core.d.ts +58 -44
- package/dist/core.js +5187 -29267
- package/dist/getSplitClasses-DodqA_KW.cjs +1 -0
- package/dist/getSplitClasses-DphwgQiE.js +48 -0
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +13 -3
- package/dist/render.js +149 -115
- package/dist/runtime.d.ts +6 -0
- package/dist/sdk.css +1 -6
- package/dist/tailwind.d.ts +6 -0
- package/dist/tooltip-1Uu2avkZ.cjs +1 -0
- package/dist/tooltip-PKiP886L.js +647 -0
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +26 -78
- package/dist/ui.js +305 -274
- package/dist/web-blocks.cjs +2 -2
- package/dist/web-blocks.d.ts +6 -0
- package/dist/web-blocks.js +511 -668
- package/package.json +36 -27
- package/dist/CodeEditor-C5hkhszC.cjs +0 -1
- package/dist/CodeEditor-DmPiW1eD.js +0 -77
- package/dist/STRINGS-DtEft2kY.js +0 -5
- package/dist/STRINGS-n7COZtKr.cjs +0 -1
- package/dist/Topbar-XpkgGUK2.js +0 -16
- package/dist/Topbar-Zby0BmoN.cjs +0 -1
- package/dist/context-menu-BsI3Hqio.js +0 -834
- package/dist/context-menu-dsqhw1Ub.cjs +0 -1
- package/dist/iconBase-Cn2BsTrq.cjs +0 -1
- package/dist/iconBase-DHfFLkem.js +0 -124
- package/dist/jsx-runtime-DGh1k5sI.cjs +0 -31
- package/dist/jsx-runtime-Dx-03ztt.js +0 -445
package/README.md
CHANGED
|
@@ -4,6 +4,10 @@ Chai Builder is an Open Source Low Code React + Tailwind CSS Visual Builder.
|
|
|
4
4
|
It allows you to create web pages 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
|
+
Demo: https://chaibuilder-sdk.vercel.app/
|
|
8
|
+
|
|
9
|
+
NextJS Starter: https://github.com/chaibuilder/chaibuilder-nextjs
|
|
10
|
+
|
|
7
11
|
---
|
|
8
12
|
|
|
9
13
|
### Manual installation:
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsxs as a, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { Cross2Icon as k } from "@radix-ui/react-icons";
|
|
3
|
+
import { useThrottledCallback as C } from "@react-hookz/web";
|
|
4
|
+
import { useState as d, useCallback as v, useEffect as g } from "react";
|
|
5
|
+
import { useTranslation as N } from "react-i18next";
|
|
6
|
+
import { B as w } from "./tooltip-PKiP886L.js";
|
|
7
|
+
import { useCodeEditor as y, useSelectedBlockIds as T, useUpdateBlocksProps as B, useUpdateBlocksPropsRealtime as E } from "./core.js";
|
|
8
|
+
const u = (o) => {
|
|
9
|
+
const l = document.createElement("div");
|
|
10
|
+
return l.innerHTML = o, l.innerHTML;
|
|
11
|
+
};
|
|
12
|
+
function S() {
|
|
13
|
+
const { t: o } = N(), [l, m] = d(!1), [c, f] = d(""), [e, i] = y(), [r] = T(), p = B(), h = E(), x = C(
|
|
14
|
+
(s) => {
|
|
15
|
+
const n = u(s);
|
|
16
|
+
h([e.blockId], { [e.blockProp]: n });
|
|
17
|
+
},
|
|
18
|
+
[],
|
|
19
|
+
300
|
|
20
|
+
), b = v(() => {
|
|
21
|
+
if (l) {
|
|
22
|
+
const s = u(c);
|
|
23
|
+
p([e.blockId], { [e.blockProp]: s });
|
|
24
|
+
}
|
|
25
|
+
}, [l, c]);
|
|
26
|
+
return g(() => {
|
|
27
|
+
r.includes(e == null ? void 0 : e.blockId) || (b(), i(null));
|
|
28
|
+
}, [r]), /* @__PURE__ */ a("div", { className: "h-full text-white bg-black border-t-4 border-black rounded-t-lg", children: [
|
|
29
|
+
/* @__PURE__ */ t("button", { onClick: () => {
|
|
30
|
+
i(null);
|
|
31
|
+
}, className: "fixed inset-0 z-[100000] cursor-default bg-gray-400/20" }),
|
|
32
|
+
/* @__PURE__ */ a("div", { className: "relative z-[100001] h-full w-full flex-col gap-y-1", children: [
|
|
33
|
+
/* @__PURE__ */ a("div", { className: "flex items-center justify-between px-2 py-2 -mt-1", children: [
|
|
34
|
+
/* @__PURE__ */ a("h3", { className: "space-x-3 text-sm font-semibold", children: [
|
|
35
|
+
/* @__PURE__ */ t("span", { children: o("HTML Code Editor |") }),
|
|
36
|
+
/* @__PURE__ */ t("span", { className: "text-xs text-gray-400", children: o("Scripts will be only executed in preview and live mode.") })
|
|
37
|
+
] }),
|
|
38
|
+
/* @__PURE__ */ t("div", { className: "flex gap-x-2", children: /* @__PURE__ */ t(
|
|
39
|
+
w,
|
|
40
|
+
{
|
|
41
|
+
onClick: () => i(null),
|
|
42
|
+
size: "sm",
|
|
43
|
+
variant: "destructive",
|
|
44
|
+
className: "h-6 w-fit",
|
|
45
|
+
children: /* @__PURE__ */ t(k, {})
|
|
46
|
+
}
|
|
47
|
+
) })
|
|
48
|
+
] }),
|
|
49
|
+
/* @__PURE__ */ t(
|
|
50
|
+
"textarea",
|
|
51
|
+
{
|
|
52
|
+
className: "w-full h-full p-2 font-mono text-xs bg-black text-white/90",
|
|
53
|
+
value: c || e.initialCode,
|
|
54
|
+
onChange: (s) => {
|
|
55
|
+
const n = s.target.value;
|
|
56
|
+
m(!0), f(n), x(n);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
] })
|
|
61
|
+
] });
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
S as default
|
|
65
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),C=require("@radix-ui/react-icons"),v=require("@react-hookz/web"),n=require("react"),j=require("react-i18next"),g=require("./tooltip-1Uu2avkZ.cjs"),a=require("./core.cjs"),u=o=>{const s=document.createElement("div");return s.innerHTML=o,s.innerHTML};function y(){const{t:o}=j.useTranslation(),[s,x]=n.useState(!1),[i,m]=n.useState(""),[t,r]=a.useCodeEditor(),[d]=a.useSelectedBlockIds(),b=a.useUpdateBlocksProps(),f=a.useUpdateBlocksPropsRealtime(),p=v.useThrottledCallback(l=>{const c=u(l);f([t.blockId],{[t.blockProp]:c})},[],300),h=n.useCallback(()=>{if(s){const l=u(i);b([t.blockId],{[t.blockProp]:l})}},[s,i]);n.useEffect(()=>{d.includes(t==null?void 0:t.blockId)||(h(),r(null))},[d]);const k=()=>{r(null)};return e.jsxs("div",{className:"h-full text-white bg-black border-t-4 border-black rounded-t-lg",children:[e.jsx("button",{onClick:k,className:"fixed inset-0 z-[100000] cursor-default bg-gray-400/20"}),e.jsxs("div",{className:"relative z-[100001] h-full w-full flex-col gap-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between px-2 py-2 -mt-1",children:[e.jsxs("h3",{className:"space-x-3 text-sm font-semibold",children:[e.jsx("span",{children:o("HTML Code Editor |")}),e.jsx("span",{className:"text-xs text-gray-400",children:o("Scripts will be only executed in preview and live mode.")})]}),e.jsx("div",{className:"flex gap-x-2",children:e.jsx(g.Button,{onClick:()=>r(null),size:"sm",variant:"destructive",className:"h-6 w-fit",children:e.jsx(C.Cross2Icon,{})})})]}),e.jsx("textarea",{className:"w-full h-full p-2 font-mono text-xs bg-black text-white/90",value:i||t.initialCode,onChange:l=>{const c=l.target.value;x(!0),m(c),p(c)}})]})]})}exports.default=y;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "lodash-es";
|
|
2
|
+
import { clsx as n } from "clsx";
|
|
3
|
+
import { twMerge as a } from "tailwind-merge";
|
|
4
|
+
function c(e = 6, o = "abcdefghijklmnopqrstuvwxyzABCD") {
|
|
5
|
+
let r = "";
|
|
6
|
+
for (let t = e; t > 0; --t) r += o[Math.floor(Math.random() * o.length)];
|
|
7
|
+
return r;
|
|
8
|
+
}
|
|
9
|
+
const f = (e) => e >= 1536 ? "2XL" : e >= 1280 ? "XL" : e >= 1024 ? "LG" : e >= 768 ? "MD" : e >= 640 ? "SM" : "XS", g = (...e) => a(n(e));
|
|
10
|
+
export {
|
|
11
|
+
f as a,
|
|
12
|
+
g as c,
|
|
13
|
+
c as g
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require("lodash-es");const o=require("clsx"),l=require("tailwind-merge");function a(e=6,r="abcdefghijklmnopqrstuvwxyzABCD"){let t="";for(let n=e;n>0;--n)t+=r[Math.floor(Math.random()*r.length)];return t}const c=e=>e>=1536?"2XL":e>=1280?"XL":e>=1024?"LG":e>=768?"MD":e>=640?"SM":"XS",u=(...e)=>l.twMerge(o.clsx(e));exports.cn=u;exports.generateUUID=a;exports.getBreakpointValue=c;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),r=require("./tooltip-1Uu2avkZ.cjs");require("react-i18next");const c=require("./core.cjs"),i=()=>{const l=c.useBuilderProp("topBarComponents.left",[]),o=c.useBuilderProp("topBarComponents.center",[]),a=c.useBuilderProp("topBarComponents.right",[]);return e.jsxs("div",{className:"flex h-14 items-center justify-between px-2",children:[e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx("div",{className:"flex items-center space-x-2 font-bold",children:l.map((s,t)=>e.jsx(n.Suspense,{fallback:e.jsx(r.Skeleton,{className:"h-10"}),children:e.jsx(s,{})},`left-${t}`))})}),e.jsx("div",{className:"flex items-center space-x-2",children:o.map((s,t)=>e.jsx(n.Suspense,{fallback:e.jsx(r.Skeleton,{className:"h-10"}),children:e.jsx(s,{})},`center-${t}`))}),e.jsx("div",{className:"flex items-center space-x-1",children:a.map((s,t)=>e.jsx(n.Suspense,{fallback:e.jsx(r.Skeleton,{className:"h-10"}),children:e.jsx(s,{})},`right-${t}`))})]})};exports.default=i;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsxs as m, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense as n } from "react";
|
|
3
|
+
import { S as r } from "./tooltip-PKiP886L.js";
|
|
4
|
+
import "react-i18next";
|
|
5
|
+
import { useBuilderProp as a } from "./core.js";
|
|
6
|
+
const x = () => {
|
|
7
|
+
const c = a("topBarComponents.left", []), l = a("topBarComponents.center", []), o = a("topBarComponents.right", []);
|
|
8
|
+
return /* @__PURE__ */ m("div", { className: "flex h-14 items-center justify-between px-2", children: [
|
|
9
|
+
/* @__PURE__ */ e("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ e("div", { className: "flex items-center space-x-2 font-bold", children: c.map((s, t) => /* @__PURE__ */ e(n, { fallback: /* @__PURE__ */ e(r, { className: "h-10" }), children: /* @__PURE__ */ e(s, {}) }, `left-${t}`)) }) }),
|
|
10
|
+
/* @__PURE__ */ e("div", { className: "flex items-center space-x-2", children: l.map((s, t) => /* @__PURE__ */ e(n, { fallback: /* @__PURE__ */ e(r, { className: "h-10" }), children: /* @__PURE__ */ e(s, {}) }, `center-${t}`)) }),
|
|
11
|
+
/* @__PURE__ */ e("div", { className: "flex items-center space-x-1", children: o.map((s, t) => /* @__PURE__ */ e(n, { fallback: /* @__PURE__ */ e(r, { className: "h-10" }), children: /* @__PURE__ */ e(s, {}) }, `right-${t}`)) })
|
|
12
|
+
] });
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
x as default
|
|
16
|
+
};
|
|
Binary file
|