@chaibuilder/sdk 1.2.103 → 1.2.104
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/CodeEditor-BOeEt5yL.cjs +1 -0
- package/dist/{CodeEditor-NKqXoCPq.js → CodeEditor-xKHFmP7r.js} +4 -5
- package/dist/Topbar-Ulmx0c7w.cjs +1 -0
- package/dist/{Topbar-yEANMgiO.js → Topbar-Z4cQD_EP.js} +13 -14
- package/dist/{UnsplashImages-Z3xcNddA.js → UnsplashImages-C9snpLoA.js} +4 -5
- package/dist/UnsplashImages-z3brw7hu.cjs +1 -0
- package/dist/{UploadImages-v50EQZLT.js → UploadImages-yrFhyBgy.js} +10 -11
- package/dist/UploadImages-zMZiwU9y.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +73 -74
- package/dist/{index-K9hzPq-7.cjs → index-7bVOae6Z.cjs} +6 -6
- package/dist/{index-aV4x9E1G.js → index-dB_zEyAf.js} +493 -492
- package/dist/plugin-UiUFs2fK.js +44 -0
- package/dist/plugin-f6SDZ_Or.js +108 -0
- package/dist/plugin-jum1MjXp.cjs +1 -0
- package/dist/plugin-xOpS-UNV.cjs +1 -0
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +2 -2
- package/dist/render.js +77 -89
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.d.ts +5 -9
- package/dist/tailwind.js +5 -17
- package/package.json +2 -2
- package/dist/CodeEditor-x97t1x8H.cjs +0 -1
- package/dist/Topbar-76FfrmEx.cjs +0 -1
- package/dist/UnsplashImages-LpHbt_-q.cjs +0 -1
- package/dist/UploadImages-PYkTPdPr.cjs +0 -1
- package/dist/plugin-3Y9Uv3RT.cjs +0 -1
- package/dist/plugin-KIpT3NWi.cjs +0 -1
- package/dist/plugin-LKCHtO27.js +0 -43
- package/dist/plugin-ooqqxWRQ.js +0 -55
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { get as n, set as d } from "lodash-es";
|
|
2
|
+
import { s as p, p as e } from "./plugin-f6SDZ_Or.js";
|
|
3
|
+
const T = (o) => {
|
|
4
|
+
const r = n(o, "primaryColor", "#000"), a = n(o, "secondaryColor", "#ccc"), s = n(o, "headingFont", "Inter"), i = n(o, "bodyFont", "Inter"), c = n(o, "roundedCorners", "0"), l = n(o, "bodyBgLightColor", "#fff"), g = n(o, "bodyBgDarkColor", "#000"), y = n(o, "bodyTextLightColor", "#000"), b = n(o, "bodyTextDarkColor", "#fff"), t = p({
|
|
5
|
+
colors: [r, a],
|
|
6
|
+
names: ["primary", "secondary"]
|
|
7
|
+
});
|
|
8
|
+
d(t, "primary.DEFAULT", r), d(t, "secondary.DEFAULT", a);
|
|
9
|
+
const f = {
|
|
10
|
+
"bg-light": l,
|
|
11
|
+
"bg-dark": g,
|
|
12
|
+
"text-dark": b,
|
|
13
|
+
"text-light": y
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
container: {
|
|
17
|
+
center: !0,
|
|
18
|
+
padding: "1rem",
|
|
19
|
+
screens: { "2xl": "1400px" }
|
|
20
|
+
},
|
|
21
|
+
fontFamily: { heading: [s], body: [i] },
|
|
22
|
+
borderRadius: { DEFAULT: `${c || "0px"}px` },
|
|
23
|
+
colors: { ...t, ...f }
|
|
24
|
+
};
|
|
25
|
+
}, x = e(function({ addBase: o, theme: r }) {
|
|
26
|
+
o({
|
|
27
|
+
"h1,h2,h3,h4,h5,h6": {
|
|
28
|
+
fontFamily: r("fontFamily.heading")
|
|
29
|
+
},
|
|
30
|
+
body: {
|
|
31
|
+
fontFamily: r("fontFamily.body"),
|
|
32
|
+
color: r("colors.text-light"),
|
|
33
|
+
backgroundColor: r("colors.bg-light")
|
|
34
|
+
},
|
|
35
|
+
".dark body": {
|
|
36
|
+
color: r("colors.text-dark"),
|
|
37
|
+
backgroundColor: r("colors.bg-dark")
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
export {
|
|
42
|
+
x as c,
|
|
43
|
+
T as g
|
|
44
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
function $(e) {
|
|
2
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3
|
+
}
|
|
4
|
+
var j = ({ hex: e, preserve: o, shades: h }) => {
|
|
5
|
+
const a = ((r) => {
|
|
6
|
+
const i = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(r) || [];
|
|
7
|
+
try {
|
|
8
|
+
let n = parseInt(i[1], 16), s = parseInt(i[2], 16), c = parseInt(i[3], 16);
|
|
9
|
+
n /= 255, s /= 255, c /= 255;
|
|
10
|
+
const d = Math.max(n, s, c), g = Math.min(n, s, c);
|
|
11
|
+
let m, f = 0, p = (d + g) / 2;
|
|
12
|
+
if (d == g)
|
|
13
|
+
f = m = 0;
|
|
14
|
+
else {
|
|
15
|
+
const l = d - g;
|
|
16
|
+
switch (m = p > 0.5 ? l / (2 - d - g) : l / (d + g), d) {
|
|
17
|
+
case n:
|
|
18
|
+
f = (s - c) / l + (s < c ? 6 : 0);
|
|
19
|
+
break;
|
|
20
|
+
case s:
|
|
21
|
+
f = (c - n) / l + 2;
|
|
22
|
+
break;
|
|
23
|
+
case c:
|
|
24
|
+
f = (n - s) / l + 4;
|
|
25
|
+
}
|
|
26
|
+
f /= 6;
|
|
27
|
+
}
|
|
28
|
+
const _ = { h: 0, s: 0, l: 0 };
|
|
29
|
+
return _.h = Math.round(360 * f), _.s = Math.round(100 * m), _.l = Math.round(100 * p), _;
|
|
30
|
+
} catch {
|
|
31
|
+
return console.log(r), { h: 0, s: 0, l: 0 };
|
|
32
|
+
}
|
|
33
|
+
})(e), t = {}, u = h.reduce((r, { name: i, lightness: n }) => {
|
|
34
|
+
const { h: s, s: c, l: d } = a, g = (({ h: m, s: f, l: p }) => {
|
|
35
|
+
p /= 100;
|
|
36
|
+
const _ = f * Math.min(p, 1 - p) / 100, l = (O) => {
|
|
37
|
+
const M = (O + m / 30) % 12, P = p - _ * Math.max(Math.min(M - 3, 9 - M, 1), -1);
|
|
38
|
+
return Math.round(255 * P).toString(16).padStart(2, "0");
|
|
39
|
+
};
|
|
40
|
+
return `#${l(0)}${l(8)}${l(4)}`;
|
|
41
|
+
})({ h: s, s: c, l: n });
|
|
42
|
+
return r[i] = g, o && (t[i] = Math.abs(d - n)), r;
|
|
43
|
+
}, {});
|
|
44
|
+
if (o) {
|
|
45
|
+
const [r] = Object.keys(t).sort((i, n) => t[i] - t[n]);
|
|
46
|
+
u[r] = e;
|
|
47
|
+
}
|
|
48
|
+
return u;
|
|
49
|
+
}, q = (e) => {
|
|
50
|
+
typeof e == "string" && (e = { colors: [e] }), typeof e == "object" && Array.isArray(e) && (e = { colors: e }), e = Object.assign({ colors: [], names: ["primary", "secondary", "tertiary", "quaternary", "quinary", "senary", "septenary", "octonary", "nonary", "denary"], preserve: !0, shades: [{ name: "50", lightness: 98 }, { name: "100", lightness: 95 }, { name: "200", lightness: 90 }, { name: "300", lightness: 82 }, { name: "400", lightness: 64 }, { name: "500", lightness: 46 }, { name: "600", lightness: 33 }, { name: "700", lightness: 24 }, { name: "800", lightness: 14 }, { name: "900", lightness: 7 }, { name: "950", lightness: 4 }] }, e);
|
|
51
|
+
const { colors: o, names: h, preserve: a, shades: t } = e;
|
|
52
|
+
return o === void 0 || h === void 0 || a === void 0 || t === void 0 ? {} : o.reduce((u, r, i) => {
|
|
53
|
+
const n = h[i], s = j({ hex: r, preserve: a, shades: t });
|
|
54
|
+
return u[n] = s, u;
|
|
55
|
+
}, {});
|
|
56
|
+
}, v = {}, b = {};
|
|
57
|
+
(function(e) {
|
|
58
|
+
Object.defineProperty(e, "__esModule", {
|
|
59
|
+
value: !0
|
|
60
|
+
}), Object.defineProperty(e, "default", {
|
|
61
|
+
enumerable: !0,
|
|
62
|
+
get: function() {
|
|
63
|
+
return h;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
function o(a, t) {
|
|
67
|
+
return {
|
|
68
|
+
handler: a,
|
|
69
|
+
config: t
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
o.withOptions = function(a, t = () => ({})) {
|
|
73
|
+
const u = function(r) {
|
|
74
|
+
return {
|
|
75
|
+
__options: r,
|
|
76
|
+
handler: a(r),
|
|
77
|
+
config: t(r)
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
return u.__isOptionsFunction = !0, u.__pluginFunction = a, u.__configFunction = t, u;
|
|
81
|
+
};
|
|
82
|
+
const h = o;
|
|
83
|
+
})(b);
|
|
84
|
+
(function(e) {
|
|
85
|
+
Object.defineProperty(e, "__esModule", {
|
|
86
|
+
value: !0
|
|
87
|
+
}), Object.defineProperty(e, "default", {
|
|
88
|
+
enumerable: !0,
|
|
89
|
+
get: function() {
|
|
90
|
+
return a;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
const o = /* @__PURE__ */ h(b);
|
|
94
|
+
function h(t) {
|
|
95
|
+
return t && t.__esModule ? t : {
|
|
96
|
+
default: t
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const a = o.default;
|
|
100
|
+
})(v);
|
|
101
|
+
let y = v;
|
|
102
|
+
var k = (y.__esModule ? y : { default: y }).default;
|
|
103
|
+
const w = /* @__PURE__ */ $(k);
|
|
104
|
+
export {
|
|
105
|
+
$ as g,
|
|
106
|
+
w as p,
|
|
107
|
+
q as s
|
|
108
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const r=require("lodash-es"),s=require("./plugin-xOpS-UNV.cjs"),b=o=>{const n=r.get(o,"primaryColor","#000"),c=r.get(o,"secondaryColor","#ccc"),d=r.get(o,"headingFont","Inter"),a=r.get(o,"bodyFont","Inter"),i=r.get(o,"roundedCorners","0"),l=r.get(o,"bodyBgLightColor","#fff"),g=r.get(o,"bodyBgDarkColor","#000"),e=r.get(o,"bodyTextLightColor","#000"),y=r.get(o,"bodyTextDarkColor","#fff"),t=s.s({colors:[n,c],names:["primary","secondary"]});r.set(t,"primary.DEFAULT",n),r.set(t,"secondary.DEFAULT",c);const u={"bg-light":l,"bg-dark":g,"text-dark":y,"text-light":e};return{container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},fontFamily:{heading:[d],body:[a]},borderRadius:{DEFAULT:`${i||"0px"}px`},colors:{...t,...u}}},T=s.plugin(function({addBase:o,theme:n}){o({"h1,h2,h3,h4,h5,h6":{fontFamily:n("fontFamily.heading")},body:{fontFamily:n("fontFamily.body"),color:n("colors.text-light"),backgroundColor:n("colors.bg-light")},".dark body":{color:n("colors.text-dark"),backgroundColor:n("colors.bg-dark")}})});exports.chaiBuilderPlugin=T;exports.getChaiBuilderTheme=b;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function v(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $=({hex:e,preserve:o,shades:h})=>{const a=(r=>{const i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(r)||[];try{let n=parseInt(i[1],16),s=parseInt(i[2],16),l=parseInt(i[3],16);n/=255,s/=255,l/=255;const d=Math.max(n,s,l),g=Math.min(n,s,l);let _,f=0,p=(d+g)/2;if(d==g)f=_=0;else{const c=d-g;switch(_=p>.5?c/(2-d-g):c/(d+g),d){case n:f=(s-l)/c+(s<l?6:0);break;case s:f=(l-n)/c+2;break;case l:f=(n-s)/c+4}f/=6}const m={h:0,s:0,l:0};return m.h=Math.round(360*f),m.s=Math.round(100*_),m.l=Math.round(100*p),m}catch{return console.log(r),{h:0,s:0,l:0}}})(e),t={},u=h.reduce((r,{name:i,lightness:n})=>{const{h:s,s:l,l:d}=a,g=(({h:_,s:f,l:p})=>{p/=100;const m=f*Math.min(p,1-p)/100,c=P=>{const M=(P+_/30)%12,j=p-m*Math.max(Math.min(M-3,9-M,1),-1);return Math.round(255*j).toString(16).padStart(2,"0")};return`#${c(0)}${c(8)}${c(4)}`})({h:s,s:l,l:n});return r[i]=g,o&&(t[i]=Math.abs(d-n)),r},{});if(o){const[r]=Object.keys(t).sort((i,n)=>t[i]-t[n]);u[r]=e}return u},F=e=>{typeof e=="string"&&(e={colors:[e]}),typeof e=="object"&&Array.isArray(e)&&(e={colors:e}),e=Object.assign({colors:[],names:["primary","secondary","tertiary","quaternary","quinary","senary","septenary","octonary","nonary","denary"],preserve:!0,shades:[{name:"50",lightness:98},{name:"100",lightness:95},{name:"200",lightness:90},{name:"300",lightness:82},{name:"400",lightness:64},{name:"500",lightness:46},{name:"600",lightness:33},{name:"700",lightness:24},{name:"800",lightness:14},{name:"900",lightness:7},{name:"950",lightness:4}]},e);const{colors:o,names:h,preserve:a,shades:t}=e;return o===void 0||h===void 0||a===void 0||t===void 0?{}:o.reduce((u,r,i)=>{const n=h[i],s=$({hex:r,preserve:a,shades:t});return u[n]=s,u},{})},b={},O={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return h}});function o(a,t){return{handler:a,config:t}}o.withOptions=function(a,t=()=>({})){const u=function(r){return{__options:r,handler:a(r),config:t(r)}};return u.__isOptionsFunction=!0,u.__pluginFunction=a,u.__configFunction=t,u};const h=o})(O);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return a}});const o=h(O);function h(t){return t&&t.__esModule?t:{default:t}}const a=o.default})(b);let y=b;var k=(y.__esModule?y:{default:y}).default;const q=v(k);exports.getDefaultExportFromCjs=v;exports.plugin=q;exports.s=F;
|
package/dist/render.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("lodash-es"),a=require("./STRINGS-Yl7cSWDc.cjs"),d=require("./jsx-runtime-JYMCiFoE.cjs"),y=require("react"),x=require("tailwind-merge"),T=require("@chaibuilder/runtime"),B=require("@mhsdesign/jit-browser-tailwindcss"),C=require("@tailwindcss/forms"),q=require("@tailwindcss/typography"),R=require("@tailwindcss/aspect-ratio"),j=require("./plugin-jum1MjXp.cjs");require("./plugin-xOpS-UNV.cjs");const Y=(t,n="")=>{const s=t.replace(a.STYLES_KEY,"").split(",").map(i=>i.split(" ").map(l=>{if(l==="")return"";if(l.includes(":")){const u=l.split(":");return u[u.length-1]=n+r.last(u),u.join(":")}return`${n}${l}`}).join(" "));return r.flattenDeep(s).join(" ")},O=t=>{if(!t)return[];try{return JSON.parse(A(t)).filter(e=>!e._type.startsWith("@chai"))}catch{return[{_type:"Paragraph",_id:"error",content:"Invalid JSON. Please check the JSON string."}]}};function A(t){const n=/(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;return t.replace(n,e=>{const s=decodeURIComponent(e),i=s.indexOf("public");return i!==-1?s.substring(i+6):s})}const K=t=>{const n={};return Object.keys(t).forEach(e=>{r.isString(t[e])&&t[e].startsWith(a.SLOT_KEY)&&(n[e]=t[e].replace(a.SLOT_KEY,"").split(","))}),n},L=r.memoize((t,n)=>{const e=t.replace(a.STYLES_KEY,"").split(","),s=x.twMerge(e[0],e[1]);return n===""?s.replace(a.STYLES_KEY,"").trim():Y(s,n).replace(a.STYLES_KEY,"").trim()});function N(t,n){const e=r.get(t,`${n}_attrs`,{});r.has(e,"data-ai-key")&&delete e["data-ai-key"];const s=r.keys(e).join(" ");return r.includes(s,"x-show")&&!r.includes(s,"x-transition")&&(e["x-transition"]=""),e}function $(t,n){const e={};return Object.keys(t).forEach(s=>{if(r.isString(t[s])&&t[s].startsWith(a.STYLES_KEY)){const i=L(t[s],n);e[s]={className:i,...N(t,s)}}}),e}function P(t,n){const e=r.get(t,"_bindings",{});return r.isEmpty(e)?{...t}:(r.each(e,(s,i)=>{r.isString(s)&&r.get(n,s,null)&&(t[i]=r.get(n,s,null))}),t)}function v(t,n,e){if(r.isEmpty(n))return t;const s=r.cloneDeep(t);return r.forEach(r.keys(s),i=>{r.get(e,["props",i,"i18n"])&&!r.isEmpty(n)&&(s[i]=r.get(s,`${i}-${n}`,s[i]))}),s}function E({blocks:t,parent:n,classPrefix:e="",externalData:s={},blockModifierCallback:i,lang:p}){const g=t,l=o=>$(o,e),u=n?r.filter(t,{_parent:n}):r.filter(t,o=>r.isEmpty(o._parent));return d.jsxRuntimeExports.jsx(d.jsxRuntimeExports.Fragment,{children:y.Children.toArray(u.map((o,_)=>{const m=K(o),h={};r.isEmpty(m)||Object.keys(m).forEach(c=>{h[c]=y.Children.toArray(m[c].map(S=>d.jsxRuntimeExports.jsx(E,{externalData:s,classPrefix:e,blocks:g,parent:S,lang:p})))});const w=r.filter(g,{_parent:o._id});h.children=w.length>0?d.jsxRuntimeExports.jsx(E,{externalData:s,classPrefix:e,parent:o._id,blocks:g,lang:p}):null;const f=T.getBlockComponent(o._type);if(f!==null){let c=o;const S=f.component;return c={...f.defaults,...o},i&&(c=i(c)),y.createElement(S,r.omit({blockProps:{},inBuilder:!1,...c,index:_,...P(v(o,p,f),s),...l(c),...h},["_parent"]))}return d.jsxRuntimeExports.jsxs("noscript",{children:[o._type," not found"]})}))})}async function I(t,n,e=[],s="",i=!1){return await B.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:e,theme:{extend:j.getChaiBuilderTheme(t)},plugins:[C,q,R,j.chaiBuilderPlugin],corePlugins:{preflight:i},...s?{prefix:`${s}`}:{}}}).generateStylesFromContent(` ${i?"@tailwind base;":""}
|
|
2
2
|
@tailwind components;
|
|
3
|
-
@tailwind utilities;`,
|
|
3
|
+
@tailwind utilities;`,n)}const J=(t,n,e=!1)=>I(n,[r.replace(JSON.stringify(t),/#styles:,?/g,"")],[],"",e),F=async(t,n={},e=!0)=>await J(t,n,e);exports.RenderChaiBlocks=E;exports.convertToBlocks=O;exports.getStylesForBlocks=F;
|
package/dist/render.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ declare type ChaiBlock = {
|
|
|
8
8
|
_bindings?: Record<string, string>;
|
|
9
9
|
} & Record<string, any>;
|
|
10
10
|
|
|
11
|
-
declare type ChaiBuilderTailwindTheme<T extends Record<string, unknown> =
|
|
11
|
+
declare type ChaiBuilderTailwindTheme<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
12
12
|
primaryColor: string;
|
|
13
13
|
secondaryColor: string;
|
|
14
14
|
headingFont: string;
|
|
@@ -26,7 +26,7 @@ declare type ChaiBuilderTailwindTheme<T extends Record<string, unknown> = {}> =
|
|
|
26
26
|
*/
|
|
27
27
|
export declare const convertToBlocks: (chaiFormatContent: string) => ChaiBlock[];
|
|
28
28
|
|
|
29
|
-
export declare const getStylesForBlocks: (blocks: ChaiBlock[], theme?: ChaiBuilderTailwindTheme | Record<string, string>,
|
|
29
|
+
export declare const getStylesForBlocks: (blocks: ChaiBlock[], theme?: ChaiBuilderTailwindTheme | Record<string, string>, includeBaseStyles?: boolean) => Promise<string>;
|
|
30
30
|
|
|
31
31
|
export declare function RenderChaiBlocks({ blocks, parent, classPrefix, externalData, blockModifierCallback, lang, }: {
|
|
32
32
|
blocks: ChaiBlock[];
|
package/dist/render.js
CHANGED
|
@@ -1,122 +1,121 @@
|
|
|
1
|
-
import { last as
|
|
2
|
-
import { S as
|
|
3
|
-
import { j as
|
|
1
|
+
import { last as T, flattenDeep as $, memoize as N, filter as _, isEmpty as d, omit as R, isString as j, get as l, each as J, cloneDeep as P, forEach as I, keys as x, has as K, includes as C, replace as L } from "lodash-es";
|
|
2
|
+
import { S as f, a as B } from "./STRINGS-Xxstm-7I.js";
|
|
3
|
+
import { j as u } from "./jsx-runtime-Sp0orL4X.js";
|
|
4
4
|
import w from "react";
|
|
5
|
-
import { twMerge as
|
|
6
|
-
import { getBlockComponent as
|
|
7
|
-
import { createTailwindcss as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { g as
|
|
12
|
-
import "
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
const e = t.replace(p, "").split(",").map((n) => n.split(" ").map((a) => {
|
|
5
|
+
import { twMerge as W } from "tailwind-merge";
|
|
6
|
+
import { getBlockComponent as Y } from "@chaibuilder/runtime";
|
|
7
|
+
import { createTailwindcss as v } from "@mhsdesign/jit-browser-tailwindcss";
|
|
8
|
+
import F from "@tailwindcss/forms";
|
|
9
|
+
import U from "@tailwindcss/typography";
|
|
10
|
+
import z from "@tailwindcss/aspect-ratio";
|
|
11
|
+
import { g as M, c as q } from "./plugin-UiUFs2fK.js";
|
|
12
|
+
import "./plugin-f6SDZ_Or.js";
|
|
13
|
+
const D = (t, r = "") => {
|
|
14
|
+
const s = t.replace(f, "").split(",").map((n) => n.split(" ").map((a) => {
|
|
16
15
|
if (a === "")
|
|
17
16
|
return "";
|
|
18
17
|
if (a.includes(":")) {
|
|
19
18
|
const c = a.split(":");
|
|
20
|
-
return c[c.length - 1] = r +
|
|
19
|
+
return c[c.length - 1] = r + T(c), c.join(":");
|
|
21
20
|
}
|
|
22
21
|
return `${r}${a}`;
|
|
23
22
|
}).join(" "));
|
|
24
|
-
return
|
|
25
|
-
},
|
|
23
|
+
return $(s).join(" ");
|
|
24
|
+
}, dt = (t) => {
|
|
26
25
|
if (!t)
|
|
27
26
|
return [];
|
|
28
27
|
try {
|
|
29
|
-
return JSON.parse(
|
|
28
|
+
return JSON.parse(G(t)).filter((e) => !e._type.startsWith("@chai"));
|
|
30
29
|
} catch {
|
|
31
30
|
return [{ _type: "Paragraph", _id: "error", content: "Invalid JSON. Please check the JSON string." }];
|
|
32
31
|
}
|
|
33
32
|
};
|
|
34
|
-
function
|
|
33
|
+
function G(t) {
|
|
35
34
|
const r = /(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;
|
|
36
|
-
return t.replace(r, (
|
|
37
|
-
const
|
|
38
|
-
return n !== -1 ?
|
|
35
|
+
return t.replace(r, (e) => {
|
|
36
|
+
const s = decodeURIComponent(e), n = s.indexOf("public");
|
|
37
|
+
return n !== -1 ? s.substring(n + 6) : s;
|
|
39
38
|
});
|
|
40
39
|
}
|
|
41
|
-
const
|
|
40
|
+
const H = (t) => {
|
|
42
41
|
const r = {};
|
|
43
|
-
return Object.keys(t).forEach((
|
|
44
|
-
j(t[
|
|
42
|
+
return Object.keys(t).forEach((e) => {
|
|
43
|
+
j(t[e]) && t[e].startsWith(B) && (r[e] = t[e].replace(B, "").split(","));
|
|
45
44
|
}), r;
|
|
46
|
-
},
|
|
47
|
-
const
|
|
48
|
-
return r === "" ?
|
|
45
|
+
}, Q = N((t, r) => {
|
|
46
|
+
const e = t.replace(f, "").split(","), s = W(e[0], e[1]);
|
|
47
|
+
return r === "" ? s.replace(f, "").trim() : D(s, r).replace(f, "").trim();
|
|
49
48
|
});
|
|
50
|
-
function
|
|
51
|
-
const
|
|
52
|
-
K(
|
|
53
|
-
const
|
|
54
|
-
return C(
|
|
49
|
+
function V(t, r) {
|
|
50
|
+
const e = l(t, `${r}_attrs`, {});
|
|
51
|
+
K(e, "data-ai-key") && delete e["data-ai-key"];
|
|
52
|
+
const s = x(e).join(" ");
|
|
53
|
+
return C(s, "x-show") && !C(s, "x-transition") && (e["x-transition"] = ""), e;
|
|
55
54
|
}
|
|
56
|
-
function
|
|
57
|
-
const
|
|
58
|
-
return Object.keys(t).forEach((
|
|
59
|
-
if (j(t[
|
|
60
|
-
const n =
|
|
61
|
-
s
|
|
55
|
+
function X(t, r) {
|
|
56
|
+
const e = {};
|
|
57
|
+
return Object.keys(t).forEach((s) => {
|
|
58
|
+
if (j(t[s]) && t[s].startsWith(f)) {
|
|
59
|
+
const n = Q(t[s], r);
|
|
60
|
+
e[s] = {
|
|
62
61
|
className: n,
|
|
63
|
-
...
|
|
62
|
+
...V(t, s)
|
|
64
63
|
};
|
|
65
64
|
}
|
|
66
|
-
}),
|
|
65
|
+
}), e;
|
|
67
66
|
}
|
|
68
|
-
function
|
|
69
|
-
const
|
|
70
|
-
return d(
|
|
71
|
-
j(
|
|
67
|
+
function Z(t, r) {
|
|
68
|
+
const e = l(t, "_bindings", {});
|
|
69
|
+
return d(e) ? { ...t } : (J(e, (s, n) => {
|
|
70
|
+
j(s) && l(r, s, null) && (t[n] = l(r, s, null));
|
|
72
71
|
}), t);
|
|
73
72
|
}
|
|
74
|
-
function
|
|
73
|
+
function b(t, r, e) {
|
|
75
74
|
if (d(r))
|
|
76
75
|
return t;
|
|
77
|
-
const
|
|
78
|
-
return I(x(
|
|
79
|
-
l(
|
|
80
|
-
}),
|
|
76
|
+
const s = P(t);
|
|
77
|
+
return I(x(s), (n) => {
|
|
78
|
+
l(e, ["props", n, "i18n"]) && !d(r) && (s[n] = l(s, `${n}-${r}`, s[n]));
|
|
79
|
+
}), s;
|
|
81
80
|
}
|
|
82
81
|
function E({
|
|
83
82
|
blocks: t,
|
|
84
83
|
parent: r,
|
|
85
|
-
classPrefix:
|
|
86
|
-
externalData:
|
|
84
|
+
classPrefix: e = "",
|
|
85
|
+
externalData: s = {},
|
|
87
86
|
blockModifierCallback: n,
|
|
88
|
-
lang:
|
|
87
|
+
lang: p
|
|
89
88
|
}) {
|
|
90
|
-
const m = t, a = (i) =>
|
|
91
|
-
return /* @__PURE__ */
|
|
92
|
-
c.map((i,
|
|
93
|
-
const h =
|
|
89
|
+
const m = t, a = (i) => X(i, e), c = r ? _(t, { _parent: r }) : _(t, (i) => d(i._parent));
|
|
90
|
+
return /* @__PURE__ */ u.jsx(u.Fragment, { children: w.Children.toArray(
|
|
91
|
+
c.map((i, O) => {
|
|
92
|
+
const h = H(i), y = {};
|
|
94
93
|
d(h) || Object.keys(h).forEach((o) => {
|
|
95
94
|
y[o] = w.Children.toArray(
|
|
96
|
-
h[o].map((S) => /* @__PURE__ */
|
|
95
|
+
h[o].map((S) => /* @__PURE__ */ u.jsx(
|
|
97
96
|
E,
|
|
98
97
|
{
|
|
99
|
-
externalData:
|
|
100
|
-
classPrefix:
|
|
98
|
+
externalData: s,
|
|
99
|
+
classPrefix: e,
|
|
101
100
|
blocks: m,
|
|
102
101
|
parent: S,
|
|
103
|
-
lang:
|
|
102
|
+
lang: p
|
|
104
103
|
}
|
|
105
104
|
))
|
|
106
105
|
);
|
|
107
106
|
});
|
|
108
107
|
const A = _(m, { _parent: i._id });
|
|
109
|
-
y.children = A.length > 0 ? /* @__PURE__ */
|
|
108
|
+
y.children = A.length > 0 ? /* @__PURE__ */ u.jsx(
|
|
110
109
|
E,
|
|
111
110
|
{
|
|
112
|
-
externalData:
|
|
113
|
-
classPrefix:
|
|
111
|
+
externalData: s,
|
|
112
|
+
classPrefix: e,
|
|
114
113
|
parent: i._id,
|
|
115
114
|
blocks: m,
|
|
116
|
-
lang:
|
|
115
|
+
lang: p
|
|
117
116
|
}
|
|
118
117
|
) : null;
|
|
119
|
-
const g =
|
|
118
|
+
const g = Y(i._type);
|
|
120
119
|
if (g !== null) {
|
|
121
120
|
let o = i;
|
|
122
121
|
const S = g.component;
|
|
@@ -127,8 +126,8 @@ function E({
|
|
|
127
126
|
blockProps: {},
|
|
128
127
|
inBuilder: !1,
|
|
129
128
|
...o,
|
|
130
|
-
index:
|
|
131
|
-
...b(
|
|
129
|
+
index: O,
|
|
130
|
+
...Z(b(i, p, g), s),
|
|
132
131
|
...a(o),
|
|
133
132
|
...y
|
|
134
133
|
},
|
|
@@ -136,22 +135,22 @@ function E({
|
|
|
136
135
|
)
|
|
137
136
|
);
|
|
138
137
|
}
|
|
139
|
-
return /* @__PURE__ */
|
|
138
|
+
return /* @__PURE__ */ u.jsxs("noscript", { children: [
|
|
140
139
|
i._type,
|
|
141
140
|
" not found"
|
|
142
141
|
] });
|
|
143
142
|
})
|
|
144
143
|
) });
|
|
145
144
|
}
|
|
146
|
-
async function
|
|
147
|
-
return await
|
|
145
|
+
async function k(t, r, e = [], s = "", n = !1) {
|
|
146
|
+
return await v({
|
|
148
147
|
tailwindConfig: {
|
|
149
148
|
darkMode: "class",
|
|
150
|
-
safelist:
|
|
151
|
-
theme: { extend:
|
|
152
|
-
plugins: [
|
|
149
|
+
safelist: e,
|
|
150
|
+
theme: { extend: M(t) },
|
|
151
|
+
plugins: [F, U, z, q],
|
|
153
152
|
corePlugins: { preflight: n },
|
|
154
|
-
...
|
|
153
|
+
...s ? { prefix: `${s}` } : {}
|
|
155
154
|
}
|
|
156
155
|
}).generateStylesFromContent(
|
|
157
156
|
` ${n ? "@tailwind base;" : ""}
|
|
@@ -160,20 +159,9 @@ async function tt(t, r, s = [], e = "", n = !1) {
|
|
|
160
159
|
r
|
|
161
160
|
);
|
|
162
161
|
}
|
|
163
|
-
const
|
|
164
|
-
const e = {};
|
|
165
|
-
return Object.keys(s).forEach((n) => {
|
|
166
|
-
Y(s[n], p) && (e[n] = O(s[n], r));
|
|
167
|
-
}), e;
|
|
168
|
-
}), et = (t, r, s = "", e = !1) => tt(
|
|
169
|
-
r,
|
|
170
|
-
[L(JSON.stringify(st(t, s)), /#styles:,?/g, "")],
|
|
171
|
-
[],
|
|
172
|
-
s,
|
|
173
|
-
e
|
|
174
|
-
), yt = async (t, r = {}, s = "", e = !0) => await et(t, r, s, e);
|
|
162
|
+
const tt = (t, r, e = !1) => k(r, [L(JSON.stringify(t), /#styles:,?/g, "")], [], "", e), mt = async (t, r = {}, e = !0) => await tt(t, r, e);
|
|
175
163
|
export {
|
|
176
164
|
E as RenderChaiBlocks,
|
|
177
|
-
|
|
178
|
-
|
|
165
|
+
dt as convertToBlocks,
|
|
166
|
+
mt as getStylesForBlocks
|
|
179
167
|
};
|
package/dist/tailwind.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@tailwindcss/typography"),a=require("@tailwindcss/forms"),i=require("@tailwindcss/aspect-ratio"),n=require("tailwindcss-animate"),r=require("./plugin-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@tailwindcss/typography"),a=require("@tailwindcss/forms"),i=require("@tailwindcss/aspect-ratio"),n=require("tailwindcss-animate"),r=require("./plugin-jum1MjXp.cjs");require("lodash-es");require("./plugin-xOpS-UNV.cjs");function d(){return{colors:{border:"hsl(var(--border))",input:"hsl(var(--input))",ring:"hsl(var(--ring))",background:"hsl(var(--background))",foreground:"hsl(var(--foreground))",primary:{DEFAULT:"hsl(var(--primary))",foreground:"hsl(var(--primary-foreground))"},secondary:{DEFAULT:"hsl(var(--secondary))",foreground:"hsl(var(--secondary-foreground))"},destructive:{DEFAULT:"hsl(var(--destructive))",foreground:"hsl(var(--destructive-foreground))"},muted:{DEFAULT:"hsl(var(--muted))",foreground:"hsl(var(--muted-foreground))"},accent:{DEFAULT:"hsl(var(--accent))",foreground:"hsl(var(--accent-foreground))"},popover:{DEFAULT:"hsl(var(--popover))",foreground:"hsl(var(--popover-foreground))"},card:{DEFAULT:"hsl(var(--card))",foreground:"hsl(var(--card-foreground))"}},borderRadius:{lg:"var(--radius)",md:"calc(var(--radius) - 2px)",sm:"calc(var(--radius) - 4px)"},keyframes:{"accordion-down":{from:{height:"0"},to:{height:"var(--radix-accordion-content-height)"}},"accordion-up":{from:{height:"var(--radix-accordion-content-height)"},to:{height:"0"}}},animation:{"accordion-down":"accordion-down 0.2s ease-out","accordion-up":"accordion-up 0.2s ease-out"}}}const u=e=>({darkMode:"class",content:[...e,"node_modules/@chaibuilder/sdk/dist/*.{js,cjs}"],theme:{extend:d()},plugins:[n,o,a,i]});exports.chaiBuilderPlugin=r.chaiBuilderPlugin;exports.getChaiBuilderTheme=r.getChaiBuilderTheme;exports.getChaiBuilderTailwindConfig=u;
|
package/dist/tailwind.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare const chaiBuilderPlugin: {
|
|
|
11
11
|
config?: Partial<Config>;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
declare type ChaiBuilderTailwindTheme<T extends Record<string, unknown> =
|
|
14
|
+
declare type ChaiBuilderTailwindTheme<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
15
15
|
primaryColor: string;
|
|
16
16
|
secondaryColor: string;
|
|
17
17
|
headingFont: string;
|
|
@@ -27,13 +27,6 @@ export declare const getChaiBuilderTailwindConfig: (content: string[]) => {
|
|
|
27
27
|
darkMode: string;
|
|
28
28
|
content: string[];
|
|
29
29
|
theme: {
|
|
30
|
-
container: {
|
|
31
|
-
center: boolean;
|
|
32
|
-
padding: string;
|
|
33
|
-
screens: {
|
|
34
|
-
"2xl": string;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
30
|
extend: {
|
|
38
31
|
colors: {
|
|
39
32
|
border: string;
|
|
@@ -118,7 +111,10 @@ export declare const getChaiBuilderTheme: (theme: ChaiBuilderTailwindTheme) => {
|
|
|
118
111
|
DEFAULT: string;
|
|
119
112
|
};
|
|
120
113
|
colors: {
|
|
121
|
-
[x: string]: string |
|
|
114
|
+
[x: string]: string | {
|
|
115
|
+
[x: string]: string;
|
|
116
|
+
[x: number]: string;
|
|
117
|
+
};
|
|
122
118
|
};
|
|
123
119
|
};
|
|
124
120
|
|
package/dist/tailwind.js
CHANGED
|
@@ -2,10 +2,9 @@ import o from "@tailwindcss/typography";
|
|
|
2
2
|
import e from "@tailwindcss/forms";
|
|
3
3
|
import a from "@tailwindcss/aspect-ratio";
|
|
4
4
|
import d from "tailwindcss-animate";
|
|
5
|
-
import { c as
|
|
5
|
+
import { c as m, g as p } from "./plugin-UiUFs2fK.js";
|
|
6
6
|
import "lodash-es";
|
|
7
|
-
import "
|
|
8
|
-
import "./plugin-ooqqxWRQ.js";
|
|
7
|
+
import "./plugin-f6SDZ_Or.js";
|
|
9
8
|
function n() {
|
|
10
9
|
return {
|
|
11
10
|
colors: {
|
|
@@ -66,25 +65,14 @@ function n() {
|
|
|
66
65
|
}
|
|
67
66
|
const g = (r) => ({
|
|
68
67
|
darkMode: "class",
|
|
69
|
-
content: [
|
|
70
|
-
...r,
|
|
71
|
-
"node_modules/@chaibuilder/sdk/dist/*.{js,cjs}",
|
|
72
|
-
"node_modules/@chaibuilder/runtime/dist/*.{js,cjs}"
|
|
73
|
-
],
|
|
68
|
+
content: [...r, "node_modules/@chaibuilder/sdk/dist/*.{js,cjs}"],
|
|
74
69
|
theme: {
|
|
75
|
-
container: {
|
|
76
|
-
center: !0,
|
|
77
|
-
padding: "2rem",
|
|
78
|
-
screens: {
|
|
79
|
-
"2xl": "1400px"
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
70
|
extend: n()
|
|
83
71
|
},
|
|
84
72
|
plugins: [d, o, e, a]
|
|
85
73
|
});
|
|
86
74
|
export {
|
|
87
|
-
|
|
75
|
+
m as chaiBuilderPlugin,
|
|
88
76
|
g as getChaiBuilderTailwindConfig,
|
|
89
|
-
|
|
77
|
+
p as getChaiBuilderTheme
|
|
90
78
|
};
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"author": "Suraj Air",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"homepage": "https://chaibuilder.com",
|
|
8
|
-
"version": "1.2.
|
|
8
|
+
"version": "1.2.104",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
+
"@bobthered/tailwindcss-palette-generator": "^4.0.0",
|
|
70
71
|
"@chaibuilder/runtime": "0.2.12",
|
|
71
72
|
"@floating-ui/dom": "1.4.5",
|
|
72
73
|
"@floating-ui/react-dom": "2.0.1",
|
|
@@ -131,7 +132,6 @@
|
|
|
131
132
|
"react-quill": "^2.0.0",
|
|
132
133
|
"react-wrap-balancer": "^1.1.0",
|
|
133
134
|
"tailwind-merge": "2.3.0",
|
|
134
|
-
"tailwindcss-palette-generator": "0.7.0",
|
|
135
135
|
"tree-model": "^1.0.7",
|
|
136
136
|
"undo-manager": "^1.1.1",
|
|
137
137
|
"unsplash-js": "^7.0.18"
|
|
@@ -1 +0,0 @@
|
|
|
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-sQn7ryJ6.cjs"),C=require("react-i18next"),u=require("react"),n=require("./index-K9hzPq-7.cjs"),E=require("@radix-ui/react-icons"),R=require("@react-hookz/web");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("class-variance-authority");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");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-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("lodash-es");require("jotai");require("./iconBase-aZzpqff_.cjs");require("@chaibuilder/runtime");require("./plugin-KIpT3NWi.cjs");require("tree-model");require("react-quill");require("./STRINGS-Yl7cSWDc.cjs");require("flagged");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("react-event-hook");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("react-wrap-balancer");require("react-dom");require("prop-types");require("react-error-boundary");require("re-resizable");require("lucide-react");require("@rjsf/validator-ajv8");require("@rjsf/core");require("./controls-p9IwFnPx.cjs");require("react-arborist");require("himalaya");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,q]=u.useState(!1),[l,d]=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=>{q(!0),d(t),p(t)},height:"100%",defaultLanguage:"html",theme:"vs-dark",defaultValue:"",options:{minimap:{enabled:!1}}})]})]})}exports.default=g;
|
package/dist/Topbar-76FfrmEx.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),n=require("react"),u=require("./context-menu-sQn7ryJ6.cjs"),s=require("./index-K9hzPq-7.cjs"),x=require("react-i18next"),c=require("./iconBase-aZzpqff_.cjs"),l=require("@radix-ui/react-icons");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("class-variance-authority");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");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-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("lodash-es");require("jotai");require("@chaibuilder/runtime");require("./plugin-KIpT3NWi.cjs");require("@react-hookz/web");require("tree-model");require("react-quill");require("./STRINGS-Yl7cSWDc.cjs");require("flagged");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("react-event-hook");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("react-wrap-balancer");require("react-dom");require("prop-types");require("react-error-boundary");require("re-resizable");require("lucide-react");require("@rjsf/validator-ajv8");require("@rjsf/core");require("./controls-p9IwFnPx.cjs");require("react-arborist");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("framer-motion");const p=()=>{const{savePage:a,saveState:r}=s.useSavePage(),{t:i}=x.useTranslation(),o=e.jsxRuntimeExports.jsxs(u.Button,{disabled:r==="SAVING",onClick:t=>{t.preventDefault(),a()},className:c.cn("flex h-auto w-fit items-center gap-x-2 p-1 px-2","bg-gray-200 text-gray-500 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-400",{"animate-pulse bg-gray-300 text-gray-900":r==="SAVING","bg-green-500 text-white hover:bg-green-600 hover:text-white dark:bg-green-600 dark:text-white":r==="SAVED"}),size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(s.FaCheck,{className:"text-sm text-white"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:i(r==="SAVING"?"saving":r==="SAVED"?"saved":"unsaved")})]});return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:o})},m=function(){const r=s.useBuilderProp("previewComponent"),[,i]=s.usePreviewMode(),{t:o}=x.useTranslation();return r?e.jsxRuntimeExports.jsxs(u.Button,{onClick:t=>{t.preventDefault(),i(!0)},className:"flex h-auto w-fit items-center gap-x-2 p-1 px-2",size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(l.EyeOpenIcon,{className:"text-xs"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:o("preview")})]}):null},q=()=>{const a=s.useBuilderProp("topBarComponents.left",[]),r=s.useBuilderProp("topBarComponents.center",[]),i=s.useBuilderProp("topBarComponents.right",[]),o=s.useBuilderProp("editable",!0);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:n.Children.toArray(a.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(u.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:n.Children.toArray(r.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(u.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsxRuntimeExports.jsx(m,{}),e.jsxRuntimeExports.jsx(u.Separator,{orientation:"vertical"}),o?e.jsxRuntimeExports.jsx(p,{}):null,n.Children.toArray(i.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(u.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))]})]})};exports.default=q;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),n=require("react"),p=require("lodash-es"),A=require("unsplash-js"),f=require("./context-menu-sQn7ryJ6.cjs"),_=require("react-i18next"),g=require("./index-K9hzPq-7.cjs"),T=require("@react-hookz/web"),B=require("lucide-react");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("class-variance-authority");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");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-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("jotai");require("./iconBase-aZzpqff_.cjs");require("@chaibuilder/runtime");require("./plugin-KIpT3NWi.cjs");require("tree-model");require("react-quill");require("./STRINGS-Yl7cSWDc.cjs");require("flagged");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("react-event-hook");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("react-wrap-balancer");require("react-dom");require("prop-types");require("react-error-boundary");require("re-resizable");require("@rjsf/validator-ajv8");require("@rjsf/core");require("./controls-p9IwFnPx.cjs");require("react-arborist");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("framer-motion");const v=async(h,j)=>new Promise((i,a)=>{A.createApi({accessKey:j}).search.getPhotos(h).then(l=>{i(l)}).catch(l=>a(l))}),D=({isModalView:h,onSelect:j})=>{const i=g.useBuilderProp("unsplashAccessKey",""),[a,q]=n.useState([]),[l,b]=n.useState(0),[o,w]=n.useState(),[u,k]=n.useState(),[C,y]=n.useState(0),[d,P]=T.useDebouncedState("",1e3),[m,c]=n.useState(!1),{t:E}=_.useTranslation(),I=async r=>{if(p.isEmpty(d))return;let t=l+1;r&&(r.preventDefault(),t=1),c(!0),b(t);const x={query:d,page:t};o&&(x.orientation=o),u&&(x.color=u),v(x,i).then(s=>{var R,N,S;q(t===1?((R=s==null?void 0:s.response)==null?void 0:R.results)||[]:[...a,...((N=s==null?void 0:s.response)==null?void 0:N.results)||[]]),y((S=s==null?void 0:s.response)==null?void 0:S.total_pages),c(!1)}).catch(()=>{c(!1)})};return n.useEffect(()=>{if(!p.isEmpty(d)&&i){c(!0);const r={query:d,page:1};o&&(r.orientation=o),u&&(r.color=u),b(1),v(r,i).then(t=>{var x,s;q(((x=t==null?void 0:t.response)==null?void 0:x.results)||[]),y((s=t==null?void 0:t.response)==null?void 0:s.total_pages),c(!1)}).catch(()=>{c(!1)})}},[o,u,d,i]),p.isEmpty(i)?e.jsxRuntimeExports.jsx("div",{className:"flex h-full flex-col items-center justify-center",children:e.jsxRuntimeExports.jsxs("p",{className:"max-w-3xl text-center text-gray-500",children:["To enable Unsplash, kindly provide your",e.jsxRuntimeExports.jsx("a",{href:"https://unsplash.com/documentation#public-authentication",className:"px-1 underline hover:text-blue-400",target:"_blank",rel:"noopener noreferrer",children:"Unsplash Access Key"})]})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("form",{className:"flex items-center gap-x-2 rounded-md border border-border bg-background p-px",children:[e.jsxRuntimeExports.jsx(f.Input,{type:"text",name:"query",className:"text-foreground",placeholder:'Try "dog" or "apple"',onChange:r=>P(r.target.value)}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(g.ChaiSelect,{className:"w-40",placeholder:E("Orientation"),options:[{value:"",label:"All"},{value:"landscape",label:"Landscape"},{value:"portrait",label:"Portrait"},{value:"squarish",label:"Square"}],defaultValue:o,onValueChange:r=>w(r)})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(g.ChaiSelect,{placeholder:E("Color"),options:[{value:"",label:"All"},{value:"black_and_white",label:"Black and White"},{value:"black",label:"Black"},{value:"white",label:"White"},{value:"night",label:"Night"},{value:"warm",label:"Warm"},{value:"cool",label:"Cool"},{value:"sepia",label:"Sepia"}],defaultValue:u,onValueChange:r=>k(r)})})]}),e.jsxRuntimeExports.jsxs(f.ScrollArea,{className:`h-full ${h&&!p.isEmpty(a)?"-mx-2 flex flex-wrap px-2":"-mx-2 flex flex-col pb-8 pt-2"}`,children:[p.isEmpty(a)&&!m&&e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center justify-center py-6",children:[e.jsxRuntimeExports.jsx("div",{className:"font-medium",children:"No Data"}),e.jsxRuntimeExports.jsx("div",{className:"text-sm text-gray-500",children:"Enter query and press enter"})]}),h?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:a.map(r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>j(r.urls.regular),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:r.alt_description,src:r.urls.small})})},r.id))}):a.map(r=>e.jsxRuntimeExports.jsx("div",{className:"w-full px-2 py-1",children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:r.alt_description,src:r.urls.small})})},r.id)),m&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsxRuntimeExports.jsx(B.Loader,{className:"h-6 w-6 animate-spin"})," Loading..."]}),!p.isEmpty(a)&&l<C&&!m&&e.jsxRuntimeExports.jsx(f.Button,{size:"sm",variant:"link",className:"w-full",onClick:()=>I(void 0),disabled:m,children:m?"":"Load More"})]})]})};exports.default=D;exports.fetchImage=v;
|