@chaibuilder/sdk 2.2.3 → 2.2.4

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 (35) hide show
  1. package/dist/CodeEditor-B7r9YjDC.cjs +1 -0
  2. package/dist/CodeEditor-HKrlrH8b.js +71 -0
  3. package/dist/core.cjs +5 -5
  4. package/dist/core.d.ts +3 -4
  5. package/dist/core.js +4355 -4390
  6. package/dist/get-chai-builder-theme-ByeXCyGx.js +12 -0
  7. package/dist/get-chai-builder-theme-CeaKvOZ8.cjs +1 -0
  8. package/dist/mockServiceWorker.js +1 -1
  9. package/dist/plugin-C01tjI6V.cjs +22 -0
  10. package/dist/{chai-theme-helpers-CfZwxV6S.js → plugin-fnBB3TCm.js} +111 -99
  11. package/dist/render-chai-blocks-6SVNwoLW.js +201 -0
  12. package/dist/render-chai-blocks-Bvl2_fRE.cjs +1 -0
  13. package/dist/render.cjs +2 -2
  14. package/dist/render.js +38 -188
  15. package/dist/sooner-AJ7QkeLS.cjs +1 -0
  16. package/dist/sooner-DGhT8-JI.js +831 -0
  17. package/dist/tailwind.cjs +1 -1
  18. package/dist/tailwind.js +3 -2
  19. package/dist/ui.cjs +1 -1
  20. package/dist/ui.d.ts +37 -29
  21. package/dist/ui.js +232 -196
  22. package/dist/web-blocks.cjs +2 -2
  23. package/dist/web-blocks.js +1210 -1069
  24. package/package.json +3 -2
  25. package/dist/CodeEditor-CPR3N3wa.cjs +0 -1
  26. package/dist/CodeEditor-CuhsobXe.js +0 -65
  27. package/dist/chai-theme-helpers-utzv3TbX.cjs +0 -22
  28. package/dist/getSplitClasses-DodqA_KW.cjs +0 -1
  29. package/dist/getSplitClasses-DphwgQiE.js +0 -48
  30. package/dist/plugin-DW1HhfzA.js +0 -24
  31. package/dist/plugin-kqWzHDpF.cjs +0 -1
  32. package/dist/tooltip-BF2E5xPf.cjs +0 -1
  33. package/dist/tooltip-DGVZAvLU.js +0 -755
  34. /package/dist/{Functions-BGzDsf1z.js → common-functions-BGzDsf1z.js} +0 -0
  35. /package/dist/{Functions-BZmyleS1.cjs → common-functions-BZmyleS1.cjs} +0 -0
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("./core.cjs");require("lodash-es");require("clsx");require("tailwind-merge");require("tree-model");const c=require("react");require("jotai");require("@chaibuilder/runtime");const C=require("react-i18next"),v=require("./sooner-AJ7QkeLS.cjs"),j=require("@radix-ui/react-icons"),q=require("@react-hookz/web"),d=o=>{const s=document.createElement("div");return s.innerHTML=o,s.innerHTML};function g(){const{t:o}=C.useTranslation(),[s,x]=c.useState(!1),[i,m]=c.useState(""),[t,a]=n.useCodeEditor(),[u]=n.useSelectedBlockIds(),b=n.useUpdateBlocksProps(),f=n.useUpdateBlocksPropsRealtime(),h=q.useThrottledCallback(l=>{const r=d(l);f([t.blockId],{[t.blockProp]:r})},[],300),p=c.useCallback(()=>{if(s){const l=d(i);b([t.blockId],{[t.blockProp]:l})}},[s,i]);c.useEffect(()=>{u.includes(t==null?void 0:t.blockId)||(p(),a(null))},[u]);const k=()=>{a(null)};return e.jsxs("div",{className:"h-full rounded-t-lg border-t-4 border-black bg-black text-white",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:"-mt-1 flex items-center justify-between px-2 py-2",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(v.Button,{onClick:()=>a(null),size:"sm",variant:"destructive",className:"h-6 w-fit",children:e.jsx(j.Cross2Icon,{})})})]}),e.jsx("textarea",{className:"h-full w-full bg-black p-2 font-mono text-xs text-white/90",value:i||t.initialCode,onChange:l=>{const r=l.target.value;x(!0),m(r),h(r)}})]})]})}exports.default=g;
@@ -0,0 +1,71 @@
1
+ import { jsxs as n, jsx as t } from "react/jsx-runtime";
2
+ import { useCodeEditor as k, useSelectedBlockIds as C, useUpdateBlocksProps as v, useUpdateBlocksPropsRealtime as g } from "./core.js";
3
+ import "lodash-es";
4
+ import "clsx";
5
+ import "tailwind-merge";
6
+ import "tree-model";
7
+ import { useState as d, useCallback as N, useEffect as w } from "react";
8
+ import "jotai";
9
+ import "@chaibuilder/runtime";
10
+ import { useTranslation as y } from "react-i18next";
11
+ import { B as T } from "./sooner-DGhT8-JI.js";
12
+ import { Cross2Icon as B } from "@radix-ui/react-icons";
13
+ import { useThrottledCallback as E } from "@react-hookz/web";
14
+ const m = (s) => {
15
+ const o = document.createElement("div");
16
+ return o.innerHTML = s, o.innerHTML;
17
+ };
18
+ function F() {
19
+ const { t: s } = y(), [o, u] = d(!1), [r, p] = d(""), [e, a] = k(), [c] = C(), f = v(), h = g(), x = E(
20
+ (l) => {
21
+ const i = m(l);
22
+ h([e.blockId], { [e.blockProp]: i });
23
+ },
24
+ [],
25
+ 300
26
+ ), b = N(() => {
27
+ if (o) {
28
+ const l = m(r);
29
+ f([e.blockId], { [e.blockProp]: l });
30
+ }
31
+ }, [o, r]);
32
+ return w(() => {
33
+ c.includes(e == null ? void 0 : e.blockId) || (b(), a(null));
34
+ }, [c]), /* @__PURE__ */ n("div", { className: "h-full rounded-t-lg border-t-4 border-black bg-black text-white", children: [
35
+ /* @__PURE__ */ t("button", { onClick: () => {
36
+ a(null);
37
+ }, className: "fixed inset-0 z-[100000] cursor-default bg-gray-400/20" }),
38
+ /* @__PURE__ */ n("div", { className: "relative z-[100001] h-full w-full flex-col gap-y-1", children: [
39
+ /* @__PURE__ */ n("div", { className: "-mt-1 flex items-center justify-between px-2 py-2", children: [
40
+ /* @__PURE__ */ n("h3", { className: "space-x-3 text-sm font-semibold", children: [
41
+ /* @__PURE__ */ t("span", { children: s("HTML Code Editor |") }),
42
+ /* @__PURE__ */ t("span", { className: "text-xs text-gray-400", children: s("Scripts will be only executed in preview and live mode.") })
43
+ ] }),
44
+ /* @__PURE__ */ t("div", { className: "flex gap-x-2", children: /* @__PURE__ */ t(
45
+ T,
46
+ {
47
+ onClick: () => a(null),
48
+ size: "sm",
49
+ variant: "destructive",
50
+ className: "h-6 w-fit",
51
+ children: /* @__PURE__ */ t(B, {})
52
+ }
53
+ ) })
54
+ ] }),
55
+ /* @__PURE__ */ t(
56
+ "textarea",
57
+ {
58
+ className: "h-full w-full bg-black p-2 font-mono text-xs text-white/90",
59
+ value: r || e.initialCode,
60
+ onChange: (l) => {
61
+ const i = l.target.value;
62
+ u(!0), p(i), x(i);
63
+ }
64
+ }
65
+ )
66
+ ] })
67
+ ] });
68
+ }
69
+ export {
70
+ F as default
71
+ };