@chaibuilder/sdk 1.0.13 → 1.0.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.
Files changed (168) hide show
  1. package/dist/{AddBlocks-H7BZYHUC.js → AddBlocks-eoo1CzaK.js} +114 -111
  2. package/dist/AddBlocks-jU0NwP_s.cjs +3 -0
  3. package/dist/BrandingOptions-WSCFnWAf.cjs +1 -0
  4. package/dist/{BrandingOptions-PAgY-kvj.js → BrandingOptions-_Og7VUHA.js} +57 -41
  5. package/dist/{CanvasArea-zn2ox-5h.js → CanvasArea-cky_d2Lu.js} +517 -519
  6. package/dist/CanvasArea-hT9uHhkz.cjs +46 -0
  7. package/dist/Class-RZuPYbUS.cjs +1 -0
  8. package/dist/{Class-l7qYbuoN.js → Class-nQk08vqd.js} +204 -124
  9. package/dist/{CurrentPage-6Jp4xAWK.js → CurrentPage--OlBwyNE.js} +58 -40
  10. package/dist/CurrentPage-x6Ez11gP.cjs +1 -0
  11. package/dist/Layers-gEA0qWYP.cjs +1 -0
  12. package/dist/{Layers-WkZ48AUm.js → Layers-uzA3QA-4.js} +158 -141
  13. package/dist/MarkAsGlobalBlock-lYL8cO9x.cjs +1 -0
  14. package/dist/MarkAsGlobalBlock-ySc-D4SB.js +84 -0
  15. package/dist/PagesPanel-5t0bV9T2.cjs +1 -0
  16. package/dist/PagesPanel-tH6c9Mnv.js +70 -0
  17. package/dist/ProjectPanel-NdrR6a8t.cjs +1 -0
  18. package/dist/ProjectPanel-Q2-15-In.js +91 -0
  19. package/dist/Settings-DBiwm1hY.cjs +1 -0
  20. package/dist/{Settings-fH8fZKpm.js → Settings-LOqpvQ_1.js} +411 -408
  21. package/dist/SidePanels-8JWYXGqN.cjs +1 -0
  22. package/dist/{SidePanels-w8ZHKJaR.js → SidePanels-F7ccs2Xf.js} +106 -88
  23. package/dist/{Topbar-hm1D_5sb.js → Topbar-lX9OMPwj.js} +47 -45
  24. package/dist/Topbar-qi5ab8rR.cjs +1 -0
  25. package/dist/UnsplashImages-a2r7b3kB.cjs +1 -0
  26. package/dist/{UnsplashImages-gPcBLjgB.js → UnsplashImages-u_QTABzi.js} +56 -44
  27. package/dist/{UploadImages-_ZyUU66E.js → UploadImages-gV5xDHIu.js} +55 -34
  28. package/dist/UploadImages-jLQgLujd.cjs +1 -0
  29. package/dist/add-page-modal-U5ramelz.js +110 -0
  30. package/dist/add-page-modal-tIt3N8jH.cjs +1 -0
  31. package/dist/confirm-alert-ZQ-sxX0X.js +58 -0
  32. package/dist/confirm-alert-z74-fGOT.cjs +1 -0
  33. package/dist/core.cjs +1 -1
  34. package/dist/core.js +99 -124
  35. package/dist/delete-page-modal-5XuSfQT0.cjs +1 -0
  36. package/dist/delete-page-modal-_E87bVUZ.js +89 -0
  37. package/dist/form-Osm1AmO5.cjs +1 -0
  38. package/dist/{form-dVpOAyRl.js → form-zZJyZuNH.js} +12 -12
  39. package/dist/index-2EHcmZqL.js +2947 -0
  40. package/dist/index-RVm8Txnj.js +1149 -0
  41. package/dist/index-_jFEo7h5.cjs +206 -0
  42. package/dist/index-c8zW_D2V.cjs +1 -0
  43. package/dist/index-cU5eyVRU.js +40872 -0
  44. package/dist/index-fwo4wa7u.cjs +1 -0
  45. package/dist/index-gmZcUXyn.js +25 -0
  46. package/dist/index-m2muA80V.cjs +9 -0
  47. package/dist/{jsx-runtime-JYMCiFoE.cjs → jsx-runtime-WKRPbKtm.cjs} +7 -7
  48. package/dist/{jsx-runtime-Sp0orL4X.js → jsx-runtime-qAwJ85SY.js} +109 -106
  49. package/dist/lib.cjs +2 -1
  50. package/dist/lib.js +1333 -71
  51. package/dist/page-viewer-BSc-5M4B.cjs +1 -0
  52. package/dist/{page-viewer-Y4YiaZ_m.js → page-viewer-nLqIs_9w.js} +62 -44
  53. package/dist/project-general-setting-14MA_cX5.cjs +1 -0
  54. package/dist/{project-general-setting-U4S_KlhU.js → project-general-setting-kXh5myAr.js} +46 -36
  55. package/dist/project-seo-setting-POGPEJZ8.cjs +1 -0
  56. package/dist/project-seo-setting-nT1qo1Bb.js +89 -0
  57. package/dist/render.cjs +1 -1
  58. package/dist/render.js +23 -19
  59. package/dist/server.cjs +1 -1
  60. package/dist/server.js +1 -1
  61. package/dist/single-page-detail-EgQd9TSA.cjs +1 -0
  62. package/dist/{single-page-detail-pAxCy_Pe.js → single-page-detail-fV-A6vJR.js} +90 -80
  63. package/dist/studio.cjs +1 -1
  64. package/dist/studio.js +45 -25
  65. package/dist/ui.cjs +1 -1
  66. package/dist/ui.js +156 -357
  67. package/package.json +1 -1
  68. package/dist/AddBlocks-7ACJv8LW.cjs +0 -3
  69. package/dist/BrandingOptions-5j-XszLM.cjs +0 -1
  70. package/dist/CanvasArea-Dnm-yeus.cjs +0 -46
  71. package/dist/ChaiBuilderEditor-BoE-sArB.cjs +0 -163
  72. package/dist/ChaiBuilderEditor-hEuUONQ3.js +0 -27094
  73. package/dist/Class-_uCzl5v1.cjs +0 -1
  74. package/dist/CurrentPage-YMpqOqx7.cjs +0 -1
  75. package/dist/ImagesPanel-6us7hiLN.cjs +0 -1
  76. package/dist/ImagesPanel-oaHOD-Ex.js +0 -27
  77. package/dist/Layers-EzOZdWvd.cjs +0 -1
  78. package/dist/MODIFIERS-DsEzQ3aH.js +0 -73
  79. package/dist/MODIFIERS-Fx6WAZcw.cjs +0 -1
  80. package/dist/MarkAsGlobalBlock-0HubcRkY.js +0 -77
  81. package/dist/MarkAsGlobalBlock-HmeIyLCP.cjs +0 -1
  82. package/dist/PagesPanel-6JuwBLFQ.js +0 -50
  83. package/dist/PagesPanel-zJq8p1ja.cjs +0 -1
  84. package/dist/ProjectPanel-Zml2F8b9.cjs +0 -1
  85. package/dist/ProjectPanel-cu2QSDW9.js +0 -73
  86. package/dist/Settings-lc9PfnmG.cjs +0 -1
  87. package/dist/SidePanels-VH72zFE2.cjs +0 -1
  88. package/dist/Topbar-vQPo9xSY.cjs +0 -1
  89. package/dist/UnsplashImages-BoBBSi1a.cjs +0 -1
  90. package/dist/UploadImages-T6kW0s3G.cjs +0 -1
  91. package/dist/accordion-oPUeqPCZ.js +0 -42
  92. package/dist/accordion-ynvFtV_p.cjs +0 -1
  93. package/dist/add-page-modal--qZSwJuB.cjs +0 -1
  94. package/dist/add-page-modal-bj7qbZuK.js +0 -99
  95. package/dist/alert-dialog-GNfnpqFB.js +0 -64
  96. package/dist/alert-dialog-Mv0-wAvS.cjs +0 -1
  97. package/dist/command-ThdTuUxt.cjs +0 -1
  98. package/dist/command-VHca6CcN.js +0 -97
  99. package/dist/confirm-alert-8EHe0OOd.cjs +0 -1
  100. package/dist/confirm-alert-b0e_BLhF.js +0 -36
  101. package/dist/context-menu-8dC9uGXj.js +0 -122
  102. package/dist/context-menu-IgLbIuth.cjs +0 -1
  103. package/dist/controls-Ni5kEzLz.js +0 -103
  104. package/dist/controls-W97-POR_.cjs +0 -1
  105. package/dist/controls-enQY7NI8.js +0 -118
  106. package/dist/controls-xUKa23ic.cjs +0 -1
  107. package/dist/delete-page-modal-2LuDLEiP.cjs +0 -1
  108. package/dist/delete-page-modal-cnrR8tWH.js +0 -69
  109. package/dist/dialog-S_QbL1iq.cjs +0 -1
  110. package/dist/dialog-jrw9DF1f.js +0 -65
  111. package/dist/dropdown-menu-S03K_fNs.js +0 -164
  112. package/dist/dropdown-menu-sMXR59cB.cjs +0 -1
  113. package/dist/form-nRAvKPQj.cjs +0 -1
  114. package/dist/functions-nNTuSTsR.js +0 -1106
  115. package/dist/functions-pcUZhFJM.js +0 -12
  116. package/dist/functions-sCuB7nvZ.cjs +0 -2
  117. package/dist/functions-uw7QP2kT.cjs +0 -1
  118. package/dist/html-to-json-P6GpbcQX.cjs +0 -1
  119. package/dist/html-to-json-pdHQfRkN.js +0 -178
  120. package/dist/index-HAue58ea.cjs +0 -1
  121. package/dist/index-T4_wfKl5.js +0 -2256
  122. package/dist/index-X9ZgD09V.cjs +0 -1
  123. package/dist/index-ehKdBRUK.js +0 -18
  124. package/dist/label-KaP7MRrs.js +0 -10
  125. package/dist/label-tFm8HZdb.cjs +0 -1
  126. package/dist/link-6o6n2Tnd.js +0 -204
  127. package/dist/link-ece8dZGH.cjs +0 -1
  128. package/dist/page-viewer-IARz6OSp.cjs +0 -1
  129. package/dist/popover-a84pbVhQ.js +0 -23
  130. package/dist/popover-fKjgcRUx.cjs +0 -1
  131. package/dist/project-general-setting-eSl3t-VH.cjs +0 -1
  132. package/dist/project-seo-setting-Ga9v_ECU.js +0 -67
  133. package/dist/project-seo-setting-rankm1z3.cjs +0 -1
  134. package/dist/scroll-area-FiHvy-TZ.cjs +0 -1
  135. package/dist/scroll-area-ewXbxc3n.js +0 -30
  136. package/dist/select-7bjg-rr9.cjs +0 -1
  137. package/dist/select-POGdEDHT.js +0 -75
  138. package/dist/separator-3Civ-6hb.cjs +0 -1
  139. package/dist/separator-SctTn0Qi.js +0 -18
  140. package/dist/single-page-detail-yPgnu2AI.cjs +0 -1
  141. package/dist/skeleton-CU_FIbg3.js +0 -239
  142. package/dist/skeleton-JHP9zwL2.cjs +0 -1
  143. package/dist/tabs-Gb9v5dVb.js +0 -46
  144. package/dist/tabs-iWeaaVrg.cjs +0 -1
  145. package/dist/textarea-1kZEh7ki.cjs +0 -1
  146. package/dist/textarea-b2QvVhrK.js +0 -73
  147. package/dist/toggle-ASJRAaGP.js +0 -30
  148. package/dist/toggle-ehNIPmme.cjs +0 -1
  149. package/dist/useAddBlock-WJc3OgG8.js +0 -86
  150. package/dist/useAddBlock-dCKRFPRU.cjs +0 -1
  151. package/dist/useAllBlocks-6hvuNuyw.cjs +0 -1
  152. package/dist/useAllBlocks-PQKYvs-e.js +0 -20
  153. package/dist/useChaiExternalData-4K9WxANa.js +0 -6
  154. package/dist/useChaiExternalData-DkyBJ81C.cjs +0 -1
  155. package/dist/useDarkMode-ZKCO_gkt.js +0 -23
  156. package/dist/useDarkMode-dV6FM6l-.cjs +0 -1
  157. package/dist/useFeatureSupport-OLwNgEZb.js +0 -16
  158. package/dist/useFeatureSupport-c9IgPW2t.cjs +0 -1
  159. package/dist/useHiddenBlocks-3MsGOJ1s.js +0 -15
  160. package/dist/useHiddenBlocks-oJuQDmTy.cjs +0 -1
  161. package/dist/useLanguage-NKKKaxVM.cjs +0 -1
  162. package/dist/useLanguage-gVC5rxO5.js +0 -216
  163. package/dist/useMarkAsGlobalBlock-X73Vny8u.js +0 -25
  164. package/dist/useMarkAsGlobalBlock-ebBVGHg4.cjs +0 -1
  165. package/dist/useUiLibraries-4hPOi8DI.js +0 -12
  166. package/dist/useUiLibraries-9FhQCpKo.cjs +0 -1
  167. package/dist/utils-dze1SGvB.js +0 -6
  168. package/dist/utils-qK_SjzzV.cjs +0 -1
@@ -1,20 +0,0 @@
1
- import { get as o, isEmpty as i } from "lodash";
2
- import { useAtomValue as c } from "jotai";
3
- import { O as a } from "./ChaiBuilderEditor-hEuUONQ3.js";
4
- const r = (t) => ["Box", "Slot", "Form", "DataProvider", "Link", "List", "ListItem", "Row", "Column", "Table", "TableCell"].includes(
5
- t
6
- ), k = (t) => !["Slot"].includes(t), B = (t) => !["Slot"].includes(t);
7
- function u(t, l) {
8
- return t === "Slot" || l === "List" && t !== "ListItem" || l === "Row" && t !== "Column" ? !1 : r(l);
9
- }
10
- const p = (t, { dragSource: l, dropTarget: s }) => {
11
- const e = o(l, "data._type", ""), n = o(s, "data._type", "");
12
- return e === "Slot" || o(l, "id") && o(l, "id") === o(s, "id") ? !1 : i(n) ? !0 : u(e, n);
13
- }, A = () => c(a);
14
- export {
15
- B as a,
16
- p as b,
17
- k as c,
18
- r as d,
19
- A as u
20
- };
@@ -1,6 +0,0 @@
1
- import { useAtom as a } from "jotai";
2
- import { i as t } from "./skeleton-CU_FIbg3.js";
3
- const m = () => a(t);
4
- export {
5
- m as u
6
- };
@@ -1 +0,0 @@
1
- "use strict";const t=require("jotai"),a=require("./skeleton-JHP9zwL2.cjs"),e=()=>t.useAtom(a.chaiExternalDataAtom);exports.useChaiExternalData=e;
@@ -1,23 +0,0 @@
1
- import { useAtom as s, atom as c, useAtomValue as m } from "jotai";
2
- import { useEffect as d } from "react";
3
- import { a as u } from "./functions-pcUZhFJM.js";
4
- import { M as k, F as n } from "./ChaiBuilderEditor-hEuUONQ3.js";
5
- const p = () => s(k), i = n("canvasWidth", 800), f = c((t) => {
6
- const o = t(i);
7
- return u(o).toLowerCase();
8
- }), W = () => {
9
- const [t, o] = s(i), a = m(f), [e, r] = p();
10
- return d(() => {
11
- e !== "xs" && r(a);
12
- }, [a, e, r]), [t, a, o];
13
- }, h = n("darkMode", !1), g = () => {
14
- const [t, o] = s(h);
15
- return [t, o];
16
- };
17
- export {
18
- g as a,
19
- p as b,
20
- f as c,
21
- h as d,
22
- W as u
23
- };
@@ -1 +0,0 @@
1
- "use strict";const o=require("jotai"),k=require("react"),m=require("./functions-uw7QP2kT.cjs"),a=require("./ChaiBuilderEditor-BoE-sArB.cjs"),i=()=>o.useAtom(a.styleBreakpointAtom),c=a.atomWithStorage("canvasWidth",800),u=o.atom(t=>{const e=t(c);return m.getBreakpointValue(e).toLowerCase()}),h=()=>{const[t,e]=o.useAtom(c),s=o.useAtomValue(u),[n,r]=i();return k.useEffect(()=>{n!=="xs"&&r(s)},[s,n,r]),[t,s,e]},d=a.atomWithStorage("darkMode",!1),A=()=>{const[t,e]=o.useAtom(d);return[t,e]};exports.canvasBreakpointAtom=u;exports.darkModeAtom=d;exports.useCanvasWidth=h;exports.useDarkMode=A;exports.useStylingBreakpoint=i;
@@ -1,16 +0,0 @@
1
- import { useAtom as e } from "jotai";
2
- import { F as s } from "./ChaiBuilderEditor-hEuUONQ3.js";
3
- import { get as a } from "lodash";
4
- import { h as n } from "./skeleton-CU_FIbg3.js";
5
- const m = s("canvasZoom", 100), l = () => e(m), c = s("selectedBreakpoints", ["XS", "MD", "XL"]), B = () => {
6
- const [o, t] = e(c);
7
- return [o, t];
8
- }, k = (o, t) => {
9
- const [r] = e(n);
10
- return a(r, o, t);
11
- };
12
- export {
13
- l as a,
14
- B as b,
15
- k as u
16
- };
@@ -1 +0,0 @@
1
- "use strict";const o=require("jotai"),s=require("./ChaiBuilderEditor-BoE-sArB.cjs"),a=require("lodash"),n=require("./skeleton-JHP9zwL2.cjs"),u=s.atomWithStorage("canvasZoom",100),c=()=>o.useAtom(u),i=s.atomWithStorage("selectedBreakpoints",["XS","MD","XL"]),m=()=>{const[e,t]=o.useAtom(i);return[e,t]},p=(e,t)=>{const[r]=o.useAtom(n.chaiBuilderPropsAtom);return a.get(r,e,t)};exports.useCanvasZoom=c;exports.useFeatureSupport=p;exports.useSelectedBreakpoints=m;
@@ -1,15 +0,0 @@
1
- import { atom as n, useAtom as c } from "jotai";
2
- import { includes as i, without as d } from "lodash";
3
- import { useCallback as r } from "react";
4
- const u = n([]), k = () => {
5
- const [e, o] = c(u), m = r(
6
- (t) => {
7
- o((s) => i(s, t) ? d(s, t) : [...s, t]);
8
- },
9
- [o]
10
- );
11
- return [e, o, m];
12
- };
13
- export {
14
- k as u
15
- };
@@ -1 +0,0 @@
1
- "use strict";const c=require("jotai"),o=require("lodash"),i=require("react"),u=c.atom([]),l=()=>{const[n,s]=c.useAtom(u),d=i.useCallback(t=>{s(e=>o.includes(e,t)?o.without(e,t):[...e,t])},[s]);return[n,s,d]};exports.useHiddenBlockIds=l;
@@ -1 +0,0 @@
1
- "use strict";const f=require("react"),r=require("jotai"),t=require("lodash"),p=require("./ChaiBuilderEditor-BoE-sArB.cjs"),A=require("./Class-_uCzl5v1.cjs"),C=require("./MODIFIERS-Fx6WAZcw.cjs"),B=require("./useDarkMode-dV6FM6l-.cjs"),T=s=>{const e=s.replace(C.STYLES_KEY,"").split(",");return{baseClasses:e[0],classes:e[1]}},y={xs:420,sm:620,md:768,lg:1024,xl:1280,"2xl":1536},b=["xs","sm","md","lg","xl","2xl"];function $(s,e){if(e===null)return"baseClasses";const l=e.mq;if(l==="xs"||e.dark||e.mod!=="")return"classes";let o="baseClasses",c=b.indexOf(l);for(;c>0;){const a=b[c-1];if(t.find(s,{mq:a,property:e.property})){o="classes";break}c--}return o}const x=[];function Y(s="",e="",l=[]){s=s.trim().replace(/ +/g,"");let o=t.filter(t.map(s.split(" "),A.constructClassObject),n=>!t.isNull(n)),c=t.filter(t.map(e.split(" "),A.constructClassObject),n=>!t.isNull(n));c=t.filter(c,n=>!t.includes(x,n.property));const a=[],m=[];t.each(l,n=>{const i=A.constructClassObject(n),k=t.find(o,t.pick(i,["dark","mq","mod","property"]));if(k&&(o=t.filter(o,u=>u.fullCls!==(k==null?void 0:k.fullCls))),a.push(i),i.mq==="xs"&&!i.dark&&i.mod===""&&(c=t.filter(c,u=>u.property!==i.property)),$(o,i)==="baseClasses"&&!t.includes(x,i.property)){const u=t.find(c,t.pick(i,["property"]));k&&(c=t.filter(c,S=>S.fullCls!==(u==null?void 0:u.fullCls))),m.push({...i,fullCls:i.cls,mq:"xs"})}});const d=t.map(t.sortBy([...o,...a],n=>y[n.mq]),"fullCls").join(" ");return`${t.map(t.sortBy([...c,...m],n=>y[n.mq]),"fullCls").join(" ").trim()},${d.trim()}`.trim().replace(/ +/g,"")}const P=s=>{const e=s.replace(C.STYLES_KEY,"").split(",");return{baseClasses:e[0],classes:e[1]}},R=r.atom(null,(s,e,{blockIds:l,newClasses:o,dispatch:c})=>{const a=t.filter(s(p.pageBlocksAtomsAtom),d=>l.includes(s(d)._id)),m=t.first(s(p.selectedStylingBlocksAtom));t.each(a,d=>{const g=s(d),n=t.get(g,m.prop,`${C.STYLES_KEY},`),{baseClasses:i,classes:k}=P(n);c({type:"update_props_realtime",payload:{ids:[g._id],props:{[m.prop]:`${C.STYLES_KEY}${Y(k,i,o)}`}}})})}),D=()=>{const s=p.useDispatch(),e=r.useSetAtom(R);return f.useCallback((l,o,c)=>{e({blockIds:l,newClasses:o,dispatch:s}),c&&setTimeout(()=>s({type:"create_snapshot"}),500)},[s,e])},K=r.atom(null,(s,e,{blockIds:l,fullClasses:o,dispatch:c})=>{const a=t.first(s(p.selectedStylingBlocksAtom)),m=t.filter(s(p.pageBlocksAtomsAtom),d=>l.includes(s(d)._id));t.each(m,d=>{const g=s(d),n=o;let{classes:i,baseClasses:k}=T(t.get(g,a.prop,"styles:,"));t.each(n,u=>{const S=new RegExp(`(^| )${u.replace("[","\\[").replace("]","\\]")}($| )`,"g");i=i.replace(S," ").replace(/ +/g," ").trim();const L=t.first(u.split(":"));t.includes(["2xl","xl","lg","md","sm"],L)&&n.push(u.split(":").pop().trim())}),t.each(n,u=>{const S=new RegExp(`(^| )${u.replace("[","\\[").replace("]","\\]")}($| )`,"g");k=k.replace(S," ").replace(/ +/g," ").trim()}),c({type:"update_props_realtime",payload:{ids:[g._id],props:{[a.prop]:`${C.STYLES_KEY}${k},${i}`}}})})}),v=()=>{const s=p.useDispatch(),e=r.useSetAtom(K);return f.useCallback((l,o)=>{e({blockIds:l,fullClasses:o,dispatch:s}),setTimeout(()=>s({type:"create_snapshot"}))},[s,e])},E=r.atom(s=>{const e=t.first(s(p.selectedStylingBlocksAtom)),l=s(p.selectedBlockAtom);if(!e||e.blockId!==t.get(l,"_id",null))return[];const c=t.get(l,e.prop,`${C.STYLES_KEY},`).replace(C.STYLES_KEY,"").split(",").join(" ");return t.filter(t.map(c.trim().split(" "),A.constructClassObject),a=>!t.isNull(a))}),w=()=>r.useAtomValue(E),_={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5},I=r.atom(s=>{const e=s(B.canvasBreakpointAtom),l=s(p.styleStateAtom),o=s(B.darkModeAtom),c=j(e);let a=t.filter(s(E),{mod:l});return t.startsWith(l,"_")||(a=t.filter(a,m=>c.includes(m.mq))),a=a.sort((m,d)=>_[m.mq]-_[d.mq]),o||(a=t.filter(a,{dark:!1})),a}),j=s=>{let e=[];switch(s){case"xs":e=["xs"];break;case"sm":e=["xs","sm"];break;case"md":e=["xs","sm","md"];break;case"lg":e=["xs","sm","md","lg"];break;case"xl":e=["xs","sm","md","lg","xl"];break;case"2xl":e=["xs","sm","md","lg","xl","2xl"];break;default:e=["xs"];break}return e},F=()=>r.useAtomValue(I),O=()=>r.useAtom(p.styleStateAtom),h=r.atom(null,(s,e,{blockIds:l,props:o,dispatch:c})=>{c({type:"update_props_realtime",payload:{ids:l,props:o}})}),M=()=>{const{createSnapshot:s}=p.useCanvasHistory(),e=p.useDispatch(),l=r.useSetAtom(h);return f.useCallback((o,c)=>{l({blockIds:o,props:c,dispatch:e}),s()},[s,e,l])},N=()=>{const s=p.useDispatch(),e=r.useSetAtom(h);return f.useCallback((l,o)=>{e({blockIds:l,props:o,dispatch:s})},[s,e])},U=r.atom("en"),Q=r.atom("en"),V=r.atom(["en"]),q=()=>r.useAtom(U),G=()=>r.useAtom(Q),H=()=>r.useAtom(V),W=(s,e)=>{const[l]=q(),o=`${s}${l?`-${l}`:""}`;return{content:t.get(e,o,t.get(e,s,"")),propKey:s}};exports.useActiveLanguage=q;exports.useAddClassesToBlocks=D;exports.useBlockContentByLanguage=W;exports.useLanguages=H;exports.usePrimaryLanguage=G;exports.useRemoveClassesFromBlocks=v;exports.useSelectedBlockAllClasses=w;exports.useSelectedBlockCurrentClasses=F;exports.useStylingState=O;exports.useUpdateBlocksProps=M;exports.useUpdateBlocksPropsRealtime=N;
@@ -1,216 +0,0 @@
1
- import { useCallback as b } from "react";
2
- import { atom as d, useSetAtom as S, useAtomValue as F, useAtom as _ } from "jotai";
3
- import { filter as i, map as x, isNull as E, includes as q, each as y, find as T, pick as $, sortBy as w, first as B, get as g, startsWith as N } from "lodash";
4
- import { H as j, I as L, J as h, K as O, L as D, a as U } from "./ChaiBuilderEditor-hEuUONQ3.js";
5
- import { c as A } from "./Class-l7qYbuoN.js";
6
- import { S as k } from "./MODIFIERS-DsEzQ3aH.js";
7
- import { c as H, d as Y } from "./useDarkMode-ZKCO_gkt.js";
8
- const G = (s) => {
9
- const e = s.replace(k, "").split(",");
10
- return { baseClasses: e[0], classes: e[1] };
11
- }, P = {
12
- xs: 420,
13
- sm: 620,
14
- md: 768,
15
- lg: 1024,
16
- xl: 1280,
17
- "2xl": 1536
18
- }, I = ["xs", "sm", "md", "lg", "xl", "2xl"];
19
- function J(s, e) {
20
- if (e === null)
21
- return "baseClasses";
22
- const t = e.mq;
23
- if (t === "xs" || e.dark || e.mod !== "")
24
- return "classes";
25
- let o = "baseClasses", l = I.indexOf(t);
26
- for (; l > 0; ) {
27
- const a = I[l - 1];
28
- if (T(s, {
29
- mq: a,
30
- property: e.property
31
- })) {
32
- o = "classes";
33
- break;
34
- }
35
- l--;
36
- }
37
- return o;
38
- }
39
- const v = [];
40
- function V(s = "", e = "", t = []) {
41
- s = s.trim().replace(/ +/g, "");
42
- let o = i(
43
- x(s.split(" "), A),
44
- (c) => !E(c)
45
- ), l = i(x(e.split(" "), A), (c) => !E(c));
46
- l = i(
47
- l,
48
- (c) => !q(v, c.property)
49
- );
50
- const a = [], p = [];
51
- y(t, (c) => {
52
- const r = A(c), u = T(o, $(r, ["dark", "mq", "mod", "property"]));
53
- if (u && (o = i(
54
- o,
55
- (n) => n.fullCls !== (u == null ? void 0 : u.fullCls)
56
- )), a.push(r), r.mq === "xs" && !r.dark && r.mod === "" && (l = i(l, (n) => n.property !== r.property)), J(o, r) === "baseClasses" && !q(v, r.property)) {
57
- const n = T(l, $(r, ["property"]));
58
- u && (l = i(
59
- l,
60
- (f) => f.fullCls !== (n == null ? void 0 : n.fullCls)
61
- )), p.push({
62
- ...r,
63
- fullCls: r.cls,
64
- mq: "xs"
65
- });
66
- }
67
- });
68
- const m = x(
69
- w([...o, ...a], (c) => P[c.mq]),
70
- "fullCls"
71
- ).join(" ");
72
- return `${x(
73
- w([...l, ...p], (c) => P[c.mq]),
74
- "fullCls"
75
- ).join(" ").trim()},${m.trim()}`.trim().replace(/ +/g, "");
76
- }
77
- const W = (s) => {
78
- const e = s.replace(k, "").split(",");
79
- return { baseClasses: e[0], classes: e[1] };
80
- }, z = d(null, (s, e, { blockIds: t, newClasses: o, dispatch: l }) => {
81
- const a = i(
82
- s(j),
83
- (m) => (
84
- // @ts-ignore
85
- t.includes(s(m)._id)
86
- )
87
- ), p = B(s(L));
88
- y(a, (m) => {
89
- const C = s(m), c = g(C, p.prop, `${k},`), { baseClasses: r, classes: u } = W(c);
90
- l({
91
- type: "update_props_realtime",
92
- payload: {
93
- ids: [C._id],
94
- props: { [p.prop]: `${k}${V(u, r, o)}` }
95
- }
96
- });
97
- });
98
- }), us = () => {
99
- const s = h(), e = S(z);
100
- return b(
101
- (t, o, l) => {
102
- e({ blockIds: t, newClasses: o, dispatch: s }), l && setTimeout(() => s({ type: "create_snapshot" }), 500);
103
- },
104
- [s, e]
105
- );
106
- }, X = d(null, (s, e, { blockIds: t, fullClasses: o, dispatch: l }) => {
107
- const a = B(s(L)), p = i(
108
- s(j),
109
- (m) => (
110
- // @ts-ignore
111
- t.includes(s(m)._id)
112
- )
113
- );
114
- y(p, (m) => {
115
- const C = s(m), c = o;
116
- let { classes: r, baseClasses: u } = G(g(C, a.prop, "styles:,"));
117
- y(c, (n) => {
118
- const f = new RegExp(`(^| )${n.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
119
- r = r.replace(f, " ").replace(/ +/g, " ").trim();
120
- const Q = B(n.split(":"));
121
- q(["2xl", "xl", "lg", "md", "sm"], Q) && c.push(n.split(":").pop().trim());
122
- }), y(c, (n) => {
123
- const f = new RegExp(`(^| )${n.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
124
- u = u.replace(f, " ").replace(/ +/g, " ").trim();
125
- }), l({
126
- type: "update_props_realtime",
127
- payload: {
128
- ids: [C._id],
129
- props: {
130
- [a.prop]: `${k}${u},${r}`
131
- }
132
- }
133
- });
134
- });
135
- }), ds = () => {
136
- const s = h(), e = S(X);
137
- return b(
138
- (t, o) => {
139
- e({ blockIds: t, fullClasses: o, dispatch: s }), setTimeout(() => s({ type: "create_snapshot" }));
140
- },
141
- [s, e]
142
- );
143
- }, K = d((s) => {
144
- const e = B(s(L)), t = s(O);
145
- if (!e || e.blockId !== g(t, "_id", null))
146
- return [];
147
- const l = g(t, e.prop, `${k},`).replace(k, "").split(",").join(" ");
148
- return i(x(l.trim().split(" "), A), (a) => !E(a));
149
- }), ks = () => F(K), R = { xs: 0, sm: 1, md: 2, lg: 3, xl: 4, "2xl": 5 }, Z = d((s) => {
150
- const e = s(H), t = s(D), o = s(Y), l = ss(e);
151
- let a = i(s(K), { mod: t });
152
- return N(t, "_") || (a = i(a, (p) => l.includes(p.mq))), a = a.sort((p, m) => R[p.mq] - R[m.mq]), o || (a = i(a, { dark: !1 })), a;
153
- }), ss = (s) => {
154
- let e = [];
155
- switch (s) {
156
- case "xs":
157
- e = ["xs"];
158
- break;
159
- case "sm":
160
- e = ["xs", "sm"];
161
- break;
162
- case "md":
163
- e = ["xs", "sm", "md"];
164
- break;
165
- case "lg":
166
- e = ["xs", "sm", "md", "lg"];
167
- break;
168
- case "xl":
169
- e = ["xs", "sm", "md", "lg", "xl"];
170
- break;
171
- case "2xl":
172
- e = ["xs", "sm", "md", "lg", "xl", "2xl"];
173
- break;
174
- default:
175
- e = ["xs"];
176
- break;
177
- }
178
- return e;
179
- }, Cs = () => F(Z), gs = () => _(D), M = d(null, (s, e, { blockIds: t, props: o, dispatch: l }) => {
180
- l({
181
- type: "update_props_realtime",
182
- payload: { ids: t, props: o }
183
- });
184
- }), fs = () => {
185
- const { createSnapshot: s } = U(), e = h(), t = S(M);
186
- return b(
187
- (o, l) => {
188
- t({ blockIds: o, props: l, dispatch: e }), s();
189
- },
190
- [s, e, t]
191
- );
192
- }, xs = () => {
193
- const s = h(), e = S(M);
194
- return b(
195
- (t, o) => {
196
- e({ blockIds: t, props: o, dispatch: s });
197
- },
198
- [s, e]
199
- );
200
- }, es = d("en"), ts = d("en"), os = d(["en"]), ls = () => _(es), ys = () => _(ts), As = () => _(os), Bs = (s, e) => {
201
- const [t] = ls(), o = `${s}${t ? `-${t}` : ""}`;
202
- return { content: g(e, o, g(e, s, "")), propKey: s };
203
- };
204
- export {
205
- ds as a,
206
- Cs as b,
207
- ks as c,
208
- gs as d,
209
- fs as e,
210
- xs as f,
211
- ls as g,
212
- ys as h,
213
- As as i,
214
- Bs as j,
215
- us as u
216
- };
@@ -1,25 +0,0 @@
1
- import { useCallback as c } from "react";
2
- import { useAtomValue as e } from "jotai";
3
- import { map as k } from "lodash";
4
- import { R as u, O as i, J as B, f as d } from "./ChaiBuilderEditor-hEuUONQ3.js";
5
- import { g } from "./functions-pcUZhFJM.js";
6
- import { C as b } from "./index-ehKdBRUK.js";
7
- const f = () => {
8
- }, G = () => {
9
- const o = b(), s = e(u), l = () => {
10
- }, t = c(() => f(), []);
11
- return [o, s, l, t];
12
- }, C = () => {
13
- const o = e(i), s = B(), l = d(), [, , t] = G();
14
- return c(
15
- async (r, n) => {
16
- const m = g(16), p = k(o, (a) => (a._id === r && (a._globalBlockId = m, a._name = n), a));
17
- s({ type: "set_page_blocks", payload: p }), t();
18
- },
19
- [o, s, l, t]
20
- );
21
- };
22
- export {
23
- C as a,
24
- G as u
25
- };
@@ -1 +0,0 @@
1
- "use strict";const a=require("react"),n=require("jotai"),B=require("lodash"),c=require("./ChaiBuilderEditor-BoE-sArB.cjs"),b=require("./functions-uw7QP2kT.cjs"),g=require("./index-HAue58ea.cjs"),p=()=>{},r=()=>{const s=g.C(),o=n.useAtomValue(c.globalBlocksAtom),l=()=>{},e=a.useCallback(()=>p(),[]);return[s,o,l,e]},m=()=>{const s=n.useAtomValue(c.presentBlocksAtom),o=c.useDispatch(),l=c.useGetPageData(),[,,e]=r();return a.useCallback(async(u,i)=>{const k=b.generateUUID(16),d=B.map(s,t=>(t._id===u&&(t._globalBlockId=k,t._name=i),t));o({type:"set_page_blocks",payload:d}),e()},[s,o,l,e])};exports.useBuildingBlocks=r;exports.useMarkAsGlobalBlock=m;
@@ -1,12 +0,0 @@
1
- import { useState as a, useEffect as c } from "react";
2
- import { atom as i, useAtom as l } from "jotai";
3
- import { u as n } from "./skeleton-CU_FIbg3.js";
4
- const u = i([]), B = () => {
5
- const [o, s] = a(!1), [t, r] = l(u), e = n("getUILibraryBlocks", () => []);
6
- return c(() => {
7
- (async () => t.length > 0 || (s(!0), r(await e()), s(!1)))();
8
- }, []), { data: t, isLoading: o };
9
- };
10
- export {
11
- B as u
12
- };
@@ -1 +0,0 @@
1
- "use strict";const t=require("react"),o=require("jotai"),i=require("./skeleton-JHP9zwL2.cjs"),n=o.atom([]),u=()=>{const[r,s]=t.useState(!1),[e,c]=o.useAtom(n),a=i.useBuilderProp("getUILibraryBlocks",()=>[]);return t.useEffect(()=>{(async()=>e.length>0||(s(!0),c(await a()),s(!1)))()},[]),{data:e,isLoading:r}};exports.useUILibraryBlocks=u;
@@ -1,6 +0,0 @@
1
- import { clsx as r } from "clsx";
2
- import { twMerge as t } from "tailwind-merge";
3
- const e = (...o) => t(r(o));
4
- export {
5
- e as c
6
- };
@@ -1 +0,0 @@
1
- "use strict";const c=require("clsx"),r=require("tailwind-merge"),s=(...e)=>r.twMerge(c.clsx(e));exports.cn=s;