@chaibuilder/sdk 2.0.0-beta.13 → 2.0.0-beta.15

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.
@@ -0,0 +1,12 @@
1
+ "use strict";const i=require("lodash-es");function g(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _={},m={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});function o(r,n){return{handler:r,config:n}}o.withOptions=function(r,n=()=>({})){const a=function(s){return{__options:s,handler:r(s),config:n(s)}};return a.__isOptionsFunction=!0,a.__pluginFunction=r,a.__configFunction=n,a};const t=o})(m);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return r}});const o=t(m);function t(n){return n&&n.__esModule?n:{default:n}}const r=o.default})(_);let d=_;var $=(d.__esModule?d:{default:d}).default;const b=g($),y=e=>({fontFamily:e.fontFamily?i.keys(e.fontFamily).reduce((t,r)=>({...t,[r.replace("font-","")]:`var(--${r})`}),{}):{},borderRadius:e.borderRadius?{lg:"var(--radius)",md:"calc(var(--radius) - 2px)",sm:"calc(var(--radius) - 4px)"}:{},colors:e.colors?i.flatten(e.colors.map(t=>Object.entries(t.items))).reduce((t,[r])=>({...t,[r]:`hsl(var(--${r}))`}),{}):{}});function p(e){const o=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);let t=parseInt(o[1],16),r=parseInt(o[2],16),n=parseInt(o[3],16);t/=255,r/=255,n/=255;const a=Math.max(t,r,n),s=Math.min(t,r,n);let u,c;const f=(a+s)/2;if(a==s)u=c=0;else{const l=a-s;switch(c=f>.5?l/(2-a-s):l/(a+s),a){case t:u=(r-n)/l+(r<n?6:0);break;case r:u=(n-t)/l+2;break;case n:u=(t-r)/l+4;break}u/=6}return`${Math.round(u*360)} ${Math.round(c*100)}% ${Math.round(f*100)}%`}const F=e=>`:root {
2
+ ${e.fontFamily&&Object.entries(e.fontFamily).map(([o,t])=>`--font-${o}: "${t}";`).join(`
3
+ `)}
4
+ ${e.borderRadius&&`--radius: ${e.borderRadius};`}
5
+ ${e.colors&&Object.entries(e.colors).map(([o,t])=>`--${o}: ${p(t[0])};`).join(`
6
+ `)}
7
+ }
8
+ .dark {
9
+ ${e.colors&&Object.entries(e.colors).map(([o,t])=>`--${o}: ${p(t[1])};`).join(`
10
+ `)}
11
+ }`,j=e=>i.isEmpty(e.fontFamily)?"":i.uniq(Object.entries(e.fontFamily).map(([,t])=>t)).map(t=>`<link rel="stylesheet" href="${`https://fonts.googleapis.com/css2?family=${t.replace(/\s+/g,"+")}&display=swap`}">`).join(`
12
+ `);exports.getChaiThemeCssVariables=F;exports.getChaiThemeOptions=y;exports.getDefaultExportFromCjs=g;exports.getThemeFontsLinkMarkup=j;exports.plugin=b;
@@ -0,0 +1,114 @@
1
+ import { isEmpty as _, uniq as $, keys as m, flatten as b } from "lodash-es";
2
+ function y(t) {
3
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
4
+ }
5
+ var p = {}, g = {};
6
+ (function(t) {
7
+ Object.defineProperty(t, "__esModule", {
8
+ value: !0
9
+ }), Object.defineProperty(t, "default", {
10
+ enumerable: !0,
11
+ get: function() {
12
+ return e;
13
+ }
14
+ });
15
+ function o(r, n) {
16
+ return {
17
+ handler: r,
18
+ config: n
19
+ };
20
+ }
21
+ o.withOptions = function(r, n = () => ({})) {
22
+ const a = function(s) {
23
+ return {
24
+ __options: s,
25
+ handler: r(s),
26
+ config: n(s)
27
+ };
28
+ };
29
+ return a.__isOptionsFunction = !0, a.__pluginFunction = r, a.__configFunction = n, a;
30
+ };
31
+ const e = o;
32
+ })(g);
33
+ (function(t) {
34
+ Object.defineProperty(t, "__esModule", {
35
+ value: !0
36
+ }), Object.defineProperty(t, "default", {
37
+ enumerable: !0,
38
+ get: function() {
39
+ return r;
40
+ }
41
+ });
42
+ const o = /* @__PURE__ */ e(g);
43
+ function e(n) {
44
+ return n && n.__esModule ? n : {
45
+ default: n
46
+ };
47
+ }
48
+ const r = o.default;
49
+ })(p);
50
+ let c = p;
51
+ var F = (c.__esModule ? c : { default: c }).default;
52
+ const M = /* @__PURE__ */ y(F), v = (t) => ({
53
+ fontFamily: t.fontFamily ? m(t.fontFamily).reduce(
54
+ (e, r) => ({
55
+ ...e,
56
+ [r.replace("font-", "")]: `var(--${r})`
57
+ }),
58
+ {}
59
+ ) : {},
60
+ borderRadius: t.borderRadius ? {
61
+ lg: "var(--radius)",
62
+ md: "calc(var(--radius) - 2px)",
63
+ sm: "calc(var(--radius) - 4px)"
64
+ } : {},
65
+ colors: t.colors ? b(t.colors.map((e) => Object.entries(e.items))).reduce(
66
+ (e, [r]) => ({ ...e, [r]: `hsl(var(--${r}))` }),
67
+ {}
68
+ ) : {}
69
+ });
70
+ function f(t) {
71
+ const o = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);
72
+ let e = parseInt(o[1], 16), r = parseInt(o[2], 16), n = parseInt(o[3], 16);
73
+ e /= 255, r /= 255, n /= 255;
74
+ const a = Math.max(e, r, n), s = Math.min(e, r, n);
75
+ let l, i;
76
+ const d = (a + s) / 2;
77
+ if (a == s)
78
+ l = i = 0;
79
+ else {
80
+ const u = a - s;
81
+ switch (i = d > 0.5 ? u / (2 - a - s) : u / (a + s), a) {
82
+ case e:
83
+ l = (r - n) / u + (r < n ? 6 : 0);
84
+ break;
85
+ case r:
86
+ l = (n - e) / u + 2;
87
+ break;
88
+ case n:
89
+ l = (e - r) / u + 4;
90
+ break;
91
+ }
92
+ l /= 6;
93
+ }
94
+ return `${Math.round(l * 360)} ${Math.round(i * 100)}% ${Math.round(d * 100)}%`;
95
+ }
96
+ const O = (t) => `:root {
97
+ ${t.fontFamily && Object.entries(t.fontFamily).map(([o, e]) => `--font-${o}: "${e}";`).join(`
98
+ `)}
99
+ ${t.borderRadius && `--radius: ${t.borderRadius};`}
100
+ ${t.colors && Object.entries(t.colors).map(([o, e]) => `--${o}: ${f(e[0])};`).join(`
101
+ `)}
102
+ }
103
+ .dark {
104
+ ${t.colors && Object.entries(t.colors).map(([o, e]) => `--${o}: ${f(e[1])};`).join(`
105
+ `)}
106
+ }`, P = (t) => _(t.fontFamily) ? "" : $(Object.entries(t.fontFamily).map(([, e]) => e)).map((e) => `<link rel="stylesheet" href="${`https://fonts.googleapis.com/css2?family=${e.replace(/\s+/g, "+")}&display=swap`}">`).join(`
107
+ `);
108
+ export {
109
+ P as a,
110
+ O as b,
111
+ y as c,
112
+ v as g,
113
+ M as p
114
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),b=require("@monaco-editor/react"),k=require("./context-menu-4nQs6OxC.cjs"),C=require("react-i18next"),u=require("react"),n=require("./core.cjs"),E=require("@radix-ui/react-icons"),R=require("@react-hookz/web");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("class-variance-authority");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-hover-card");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("lodash-es");require("jotai");require("./iconBase-aZzpqff_.cjs");require("./ChaiThemeFn-6Rmrzvu_.cjs");require("lodash");require("./STRINGS-sVplluh6.cjs");require("tree-model");require("@chaibuilder/runtime");require("react-quill");require("flagged");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("react-wrap-balancer");require("react-dom");require("prop-types");require("react-error-boundary");require("re-resizable");require("lucide-react");require("react-arborist");require("himalaya");require("@rjsf/core");require("@rjsf/validator-ajv8");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("framer-motion");const a=s=>{const i=document.createElement("div");return i.innerHTML=s,i.innerHTML};function g(){const{t:s}=C.useTranslation(),[i,d]=u.useState(!1),[l,q]=u.useState(""),[r,o]=n.useCodeEditor(),[c]=n.useSelectedBlockIds(),x=n.useUpdateBlocksProps(),m=n.useUpdateBlocksPropsRealtime(),p=R.useThrottledCallback(t=>{const h=a(t);m([r.blockId],{[r.blockProp]:h})},[],300),j=u.useCallback(()=>{if(i){const t=a(l);x([r.blockId],{[r.blockProp]:t})}},[i,l]);u.useEffect(()=>{c.includes(r==null?void 0:r.blockId)||(j(),o(null))},[c]);const f=()=>{o(null)};return e.jsxRuntimeExports.jsxs("div",{className:"h-full rounded-t-lg border-t-4 border-black bg-black text-white",children:[e.jsxRuntimeExports.jsx("button",{onClick:f,className:"fixed inset-0 z-[100000] cursor-default bg-gray-400/20"}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100001] h-full w-full flex-col gap-y-1",children:[e.jsxRuntimeExports.jsxs("div",{className:"-mt-1 flex items-center justify-between px-2 py-2",children:[e.jsxRuntimeExports.jsxs("h3",{className:"space-x-3 text-sm font-semibold",children:[e.jsxRuntimeExports.jsx("span",{children:s("HTML Code Editor |")}),e.jsxRuntimeExports.jsx("span",{className:"text-xs text-gray-400",children:s("Scripts will be only executed in preview and live mode.")})]}),e.jsxRuntimeExports.jsx("div",{className:"flex gap-x-2",children:e.jsxRuntimeExports.jsx(k.Button,{onClick:()=>o(null),size:"sm",variant:"destructive",className:"h-6 w-fit",children:e.jsxRuntimeExports.jsx(E.Cross2Icon,{})})})]}),e.jsxRuntimeExports.jsx(b,{onMount:t=>{t.setValue(r.initialCode)},onChange:t=>{d(!0),q(t),p(t)},height:"100%",defaultLanguage:"html",theme:"vs-dark",defaultValue:"",options:{minimap:{enabled:!1}}})]})]})}exports.default=g;
@@ -27,8 +27,9 @@ import "tailwind-merge";
27
27
  import "lodash-es";
28
28
  import "jotai";
29
29
  import "./iconBase-Ief2hJUZ.js";
30
- import "./plugin-ooqqxWRQ.js";
30
+ import "./ChaiThemeFn-i9QJeB_e.js";
31
31
  import "lodash";
32
+ import "./STRINGS-hyOI9q1v.js";
32
33
  import "tree-model";
33
34
  import "@chaibuilder/runtime";
34
35
  import "react-quill";
@@ -39,7 +40,6 @@ import "@floating-ui/react-dom";
39
40
  import "@tailwindcss/typography";
40
41
  import "@tailwindcss/forms";
41
42
  import "@tailwindcss/aspect-ratio";
42
- import "./STRINGS-BnWT5XcX.js";
43
43
  import "react-wrap-balancer";
44
44
  import "react-dom";
45
45
  import "prop-types";
@@ -0,0 +1,78 @@
1
+ const F = {
2
+ fontFamily: {
3
+ "font-heading": "Inter",
4
+ "font-body": "Inter"
5
+ },
6
+ borderRadius: "10px",
7
+ colors: [
8
+ {
9
+ group: "Body",
10
+ items: {
11
+ background: ["#FFFFFF", "#121212"],
12
+ foreground: ["#121212", "#FFFFFF"]
13
+ }
14
+ },
15
+ {
16
+ group: "Primary",
17
+ items: {
18
+ primary: ["#2563EB", "#3B82F6"],
19
+ "primary-foreground": ["#FFFFFF", "#FFFFFF"]
20
+ }
21
+ },
22
+ {
23
+ group: "Secondary",
24
+ items: {
25
+ secondary: ["#F3F4F6", "#374151"],
26
+ "secondary-foreground": ["#1F2937", "#F9FAFB"]
27
+ }
28
+ },
29
+ {
30
+ group: "Border, Input & Ring",
31
+ items: {
32
+ border: ["#E5E7EB", "#374151"],
33
+ input: ["#E5E7EB", "#374151"],
34
+ ring: ["#2563EB", "#3B82F6"]
35
+ }
36
+ },
37
+ {
38
+ group: "Card",
39
+ items: {
40
+ card: ["#FFFFFF", "#1F2937"],
41
+ "card-foreground": ["#121212", "#FFFFFF"]
42
+ }
43
+ },
44
+ {
45
+ group: "Popover",
46
+ items: {
47
+ popover: ["#FFFFFF", "#1F2937"],
48
+ "popover-foreground": ["#121212", "#FFFFFF"]
49
+ }
50
+ },
51
+ {
52
+ group: "Muted",
53
+ items: {
54
+ muted: ["#F3F4F6", "#374151"],
55
+ "muted-foreground": ["#6B7280", "#9CA3AF"]
56
+ }
57
+ },
58
+ {
59
+ group: "Accent",
60
+ items: {
61
+ accent: ["#F3F4F6", "#374151"],
62
+ "accent-foreground": ["#1F2937", "#FFFFFF"]
63
+ }
64
+ },
65
+ {
66
+ group: "Destructive",
67
+ items: {
68
+ destructive: ["#DC2626", "#EF4444"],
69
+ "destructive-foreground": ["#FFFFFF", "#FFFFFF"]
70
+ }
71
+ }
72
+ ]
73
+ }, r = "#styles:", o = "__ADD_BLOCK_INTERNAL_ROOT";
74
+ export {
75
+ o as R,
76
+ r as S,
77
+ F as d
78
+ };
@@ -0,0 +1 @@
1
+ "use strict";const F={fontFamily:{"font-heading":"Inter","font-body":"Inter"},borderRadius:"10px",colors:[{group:"Body",items:{background:["#FFFFFF","#121212"],foreground:["#121212","#FFFFFF"]}},{group:"Primary",items:{primary:["#2563EB","#3B82F6"],"primary-foreground":["#FFFFFF","#FFFFFF"]}},{group:"Secondary",items:{secondary:["#F3F4F6","#374151"],"secondary-foreground":["#1F2937","#F9FAFB"]}},{group:"Border, Input & Ring",items:{border:["#E5E7EB","#374151"],input:["#E5E7EB","#374151"],ring:["#2563EB","#3B82F6"]}},{group:"Card",items:{card:["#FFFFFF","#1F2937"],"card-foreground":["#121212","#FFFFFF"]}},{group:"Popover",items:{popover:["#FFFFFF","#1F2937"],"popover-foreground":["#121212","#FFFFFF"]}},{group:"Muted",items:{muted:["#F3F4F6","#374151"],"muted-foreground":["#6B7280","#9CA3AF"]}},{group:"Accent",items:{accent:["#F3F4F6","#374151"],"accent-foreground":["#1F2937","#FFFFFF"]}},{group:"Destructive",items:{destructive:["#DC2626","#EF4444"],"destructive-foreground":["#FFFFFF","#FFFFFF"]}}]},r="#styles:",o="__ADD_BLOCK_INTERNAL_ROOT";exports.ROOT_TEMP_KEY=o;exports.STYLES_KEY=r;exports.defaultThemeOptions=F;
@@ -25,9 +25,10 @@ import "tailwind-merge";
25
25
  import "lodash-es";
26
26
  import "jotai";
27
27
  import "./iconBase-Ief2hJUZ.js";
28
- import "./plugin-ooqqxWRQ.js";
28
+ import "./ChaiThemeFn-i9QJeB_e.js";
29
29
  import "@react-hookz/web";
30
30
  import "lodash";
31
+ import "./STRINGS-hyOI9q1v.js";
31
32
  import "tree-model";
32
33
  import "@chaibuilder/runtime";
33
34
  import "react-quill";
@@ -38,7 +39,6 @@ import "@floating-ui/react-dom";
38
39
  import "@tailwindcss/typography";
39
40
  import "@tailwindcss/forms";
40
41
  import "@tailwindcss/aspect-ratio";
41
- import "./STRINGS-BnWT5XcX.js";
42
42
  import "react-wrap-balancer";
43
43
  import "react-dom";
44
44
  import "prop-types";
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),r=require("react"),s=require("./context-menu-4nQs6OxC.cjs");require("react-i18next");const u=require("./core.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("class-variance-authority");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-hover-card");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("lodash-es");require("jotai");require("./iconBase-aZzpqff_.cjs");require("./ChaiThemeFn-6Rmrzvu_.cjs");require("@react-hookz/web");require("lodash");require("./STRINGS-sVplluh6.cjs");require("tree-model");require("@chaibuilder/runtime");require("react-quill");require("flagged");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("react-wrap-balancer");require("react-dom");require("prop-types");require("react-error-boundary");require("re-resizable");require("lucide-react");require("react-arborist");require("himalaya");require("@rjsf/core");require("@rjsf/validator-ajv8");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("framer-motion");const o=()=>{const t=u.useBuilderProp("topBarComponents.left",[]),n=u.useBuilderProp("topBarComponents.center",[]),q=u.useBuilderProp("topBarComponents.right",[]);return e.jsxRuntimeExports.jsxs("div",{className:"flex h-14 items-center justify-between px-2",children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2 font-bold",children:r.Children.toArray(t.map(i=>e.jsxRuntimeExports.jsx(r.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(i,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:r.Children.toArray(n.map(i=>e.jsxRuntimeExports.jsx(r.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(i,{})})))}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-1",children:r.Children.toArray(q.map(i=>e.jsxRuntimeExports.jsx(r.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(i,{})})))})]})};exports.default=o;