@chaibuilder/sdk 1.2.50 → 1.2.52

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 (88) hide show
  1. package/dist/{AddBlocks-IX7HKzSe.js → AddBlocks-GxEmM16E.js} +18 -18
  2. package/dist/{AddBlocks-zwZ63DdP.cjs → AddBlocks-fozauzIV.cjs} +1 -1
  3. package/dist/CanvasArea-NRtblq5d.cjs +56 -0
  4. package/dist/{CanvasArea-ehmBje_E.js → CanvasArea-rdY6SFYn.js} +57 -57
  5. package/dist/{ChaiBuilderEditor-ZRHqW7Gd.cjs → ChaiBuilderEditor-Pga_zJgw.cjs} +55 -55
  6. package/dist/{ChaiBuilderEditor-3xIN-AP_.js → ChaiBuilderEditor-bNZZWYMh.js} +14537 -14544
  7. package/dist/CodeEditor-tqtgia3I.js +115 -0
  8. package/dist/CodeEditor-ye3IXW3i.cjs +1 -0
  9. package/dist/{CurrentPage-qhBjm7th.js → CurrentPage-7NM90y76.js} +8 -8
  10. package/dist/{CurrentPage-HOPNdQZ-.cjs → CurrentPage-sx7KVTmt.cjs} +1 -1
  11. package/dist/ListTree-7Pz6H6eE.cjs +1 -0
  12. package/dist/ListTree-oRbeDNod.js +25724 -0
  13. package/dist/{PagesPanel-kdl4A0IN.cjs → PagesPanel-Nr-908vy.cjs} +1 -1
  14. package/dist/{PagesPanel-5iVsbDP1.js → PagesPanel-XiTUaiq_.js} +5 -5
  15. package/dist/{ProjectPanel-mXPBI-TU.cjs → ProjectPanel-SuFYN60H.cjs} +1 -1
  16. package/dist/{ProjectPanel-c8oTzhQd.js → ProjectPanel-XfknsGkz.js} +5 -5
  17. package/dist/Settings-22Hy7jUT.cjs +1 -0
  18. package/dist/{Settings-0uSGoECC.js → Settings-dJ72rwnH.js} +408 -401
  19. package/dist/{SidePanels-kKram02Q.cjs → SidePanels-5dnRAsJh.cjs} +1 -1
  20. package/dist/{SidePanels-YLWdBer9.js → SidePanels-t9oUA51J.js} +38 -38
  21. package/dist/{ThemeConfiguration-8W1CM4tW.cjs → ThemeConfiguration-2Sbh29qi.cjs} +1 -1
  22. package/dist/{ThemeConfiguration-AAGFJieC.js → ThemeConfiguration-pcHbYiIP.js} +9 -9
  23. package/dist/{Topbar-nX9Muoem.js → Topbar-0DmS6VpB.js} +4 -4
  24. package/dist/{Topbar-CLNUPx7K.cjs → Topbar-ID6Ipphd.cjs} +1 -1
  25. package/dist/{UILibrariesPanel-fKn2nlgI.js → UILibrariesPanel-G9J4KUsZ.js} +6 -6
  26. package/dist/{UILibrariesPanel-cp0Mkaq_.cjs → UILibrariesPanel-sXY6hozJ.cjs} +1 -1
  27. package/dist/{UnsplashImages-56HoW_ZA.cjs → UnsplashImages-HK4_1VVL.cjs} +1 -1
  28. package/dist/{UnsplashImages-zTZa3LjG.js → UnsplashImages-MeS5Cu7a.js} +4 -4
  29. package/dist/{UploadImages-SnfaTrlz.js → UploadImages-AIKATqfP.js} +2 -2
  30. package/dist/{UploadImages-okNGjkXb.cjs → UploadImages-LSnxByGV.cjs} +1 -1
  31. package/dist/{add-page-modal-uDoO0zws.js → add-page-modal-JkD45moJ.js} +9 -9
  32. package/dist/{add-page-modal-Y2RY3x01.cjs → add-page-modal-krxKdX7-.cjs} +1 -1
  33. package/dist/{confirm-alert-aD7AMK_6.cjs → confirm-alert--QTC21Z2.cjs} +1 -1
  34. package/dist/{confirm-alert-9XiVxCc0.js → confirm-alert-NHxthdRK.js} +2 -2
  35. package/dist/core.cjs +1 -1
  36. package/dist/core.d.ts +9 -0
  37. package/dist/core.js +32 -31
  38. package/dist/{delete-page-modal-7sfoFf9r.js → delete-page-modal-8rjPEchH.js} +4 -4
  39. package/dist/{delete-page-modal-ieJ367JA.cjs → delete-page-modal-BIe0kYNH.cjs} +1 -1
  40. package/dist/email.cjs +1 -1
  41. package/dist/email.js +2 -2
  42. package/dist/{form-KWYHDVIf.cjs → form-6OLp5uEG.cjs} +1 -1
  43. package/dist/{form-PQSmqcIl.js → form-PQYPrD_Q.js} +5 -5
  44. package/dist/functions--tdNWQDW.js +30 -0
  45. package/dist/functions-EVUeSwX1.cjs +1 -0
  46. package/dist/html-to-json-9uiQ2Dp2.cjs +1 -0
  47. package/dist/html-to-json-ofq1N3tB.js +186 -0
  48. package/dist/index--mLLy7QQ.cjs +1 -0
  49. package/dist/index-9_b2eou7.js +2201 -0
  50. package/dist/index-VBXQixVm.js +117 -0
  51. package/dist/index-seU0_UZX.cjs +1 -0
  52. package/dist/lib.cjs +1 -1
  53. package/dist/lib.js +11 -11
  54. package/dist/{page-viewer-aoro5JxT.cjs → page-viewer-WwwMC1Kq.cjs} +1 -1
  55. package/dist/{page-viewer-qkwZJ6e-.js → page-viewer-sKluQ_e1.js} +10 -10
  56. package/dist/{project-general-setting-3gkaXq1F.js → project-general-setting-Lc2ByvTt.js} +7 -7
  57. package/dist/{project-general-setting-arXitV5_.cjs → project-general-setting-pRO1ikDV.cjs} +1 -1
  58. package/dist/{project-seo-setting-X8pykTmc.js → project-seo-setting-530_6o9S.js} +3 -3
  59. package/dist/{project-seo-setting-kjtUt-er.cjs → project-seo-setting-BzSrXFVv.cjs} +1 -1
  60. package/dist/render.cjs +1 -1
  61. package/dist/render.js +2 -2
  62. package/dist/{single-page-detail-UsWG0gfh.cjs → single-page-detail-_VP4zaCI.cjs} +1 -1
  63. package/dist/{single-page-detail-ZXZX6Xmw.js → single-page-detail-qDxxtedN.js} +6 -6
  64. package/dist/studio.cjs +1 -1
  65. package/dist/studio.js +4 -4
  66. package/dist/ui.cjs +1 -1
  67. package/dist/ui.js +98 -98
  68. package/dist/useCanvasSettings-5y2fSCpN.js +6 -0
  69. package/dist/useCanvasSettings-pURFQG4q.cjs +1 -0
  70. package/dist/web-blocks.cjs +1 -1
  71. package/dist/web-blocks.js +320 -320
  72. package/package.json +3 -2
  73. package/dist/CanvasArea-URgoG1jc.cjs +0 -56
  74. package/dist/CodeEditor-0F7Dz3AB.js +0 -97
  75. package/dist/CodeEditor-1vu-qNgT.cjs +0 -1
  76. package/dist/ListTree-DkbFFDXB.cjs +0 -1
  77. package/dist/ListTree-sTwXvXST.js +0 -409
  78. package/dist/Settings-3kBSStO6.cjs +0 -1
  79. package/dist/functions-JO0EW8GX.js +0 -30
  80. package/dist/functions-ZZVUnIjD.cjs +0 -1
  81. package/dist/html-to-json-GJ6RioQf.js +0 -221
  82. package/dist/html-to-json-O1OpqICe.cjs +0 -1
  83. package/dist/index-VOrp9ZpX.cjs +0 -1
  84. package/dist/index-YpnaudSM.js +0 -63
  85. package/dist/index-ecnGWzh9.cjs +0 -1
  86. package/dist/index-i2kgLkjC.js +0 -2201
  87. package/dist/useCodeEditor-CtjbxWLf.cjs +0 -1
  88. package/dist/useCodeEditor-yl5V3Hte.js +0 -7
@@ -0,0 +1,186 @@
1
+ import { stringify as m, parse as w } from "himalaya";
2
+ import { g as N, c as k } from "./Functions-7jnEwJyw.js";
3
+ import { isEmpty as g, includes as y, get as l, forEach as L, find as u, set as o, capitalize as S, flatMapDeep as $, filter as C, flatten as A } from "lodash-es";
4
+ import { a as p } from "./MODIFIERS-fd5XOmum.js";
5
+ const B = (t) => {
6
+ const e = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, r = /(?:https?:\/\/)?(?:www\.)?(player)?.vimeo\.com/;
7
+ return e.test(t) || r.test(t);
8
+ }, R = (t) => {
9
+ if (g(t))
10
+ return t;
11
+ const e = /<video[^>]+src=['"]([^'">]+)['"]/, r = /<iframe[^>]+src=['"]([^'">]+)['"]/, a = t.match(e), i = t.match(r), c = a ? a[1] : i ? i[1] : null, s = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, n = /(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;
12
+ return c && (s.test(c) || n.test(c)) ? c : t;
13
+ }, H = {
14
+ img: { alt: "alt", width: "width", height: "height", src: "image" },
15
+ video: {
16
+ src: "url",
17
+ autoplay: "controls.autoPlay",
18
+ muted: "controls.muted",
19
+ loop: "controls.loop",
20
+ controls: "controls.widgets"
21
+ },
22
+ a: {
23
+ href: "link.href",
24
+ target: "link.target",
25
+ type: ""
26
+ // @TODO: Detect here what to url, email, phone, elementId
27
+ },
28
+ input: {
29
+ placeholder: "placeholder",
30
+ required: "required",
31
+ type: "inputType",
32
+ name: "fieldName"
33
+ },
34
+ textarea: {
35
+ placeholder: "placeholder",
36
+ required: "required",
37
+ type: "inputType",
38
+ name: "fieldName"
39
+ },
40
+ select: {
41
+ placeholder: "placeholder",
42
+ required: "required",
43
+ multiple: "multiple",
44
+ name: "fieldName"
45
+ }
46
+ }, M = (t, e) => t.children.length === 1 && y(["Heading", "Paragraph", "Span", "ListItem", "Button", "Label", "TableCell", "Link"], e._type), b = (t) => t.map((e) => e.type === "text" ? l(e, "content", "") : g(e.children) ? "" : b(e.children)).join(""), h = (t) => t === null ? !0 : t, f = (t) => {
47
+ if (t.tagName === "svg")
48
+ return {};
49
+ const e = {}, r = H[t.tagName] || {}, a = t.attributes;
50
+ return L(a, ({ key: i, value: c }) => {
51
+ if (r[i]) {
52
+ if (t.tagName === "img" && i === "src" && !c.startsWith("http")) {
53
+ const s = u(t.attributes, { key: "width" }), n = u(t.attributes, { key: "height" });
54
+ s && n ? c = `https://via.placeholder.com/${s == null ? void 0 : s.value}x${n == null ? void 0 : n.value}` : c = "https://via.placeholder.com/150x150";
55
+ }
56
+ o(e, r[i], h(c));
57
+ } else
58
+ y(["style", "class", "srcset"], i) || o(e, `styles_attrs.${i}`, h(c));
59
+ }), delete e.class, e;
60
+ }, E = (t, e = "styles") => {
61
+ if (!t.attributes)
62
+ return { [e]: `${p},` };
63
+ const r = u(t.attributes, { key: "class" });
64
+ if (r) {
65
+ const a = r.value;
66
+ return { [e]: `${p},${a}` };
67
+ }
68
+ return { [e]: `${p},` };
69
+ }, I = (t) => {
70
+ switch (t.tagName) {
71
+ case "img":
72
+ return { _type: "Image" };
73
+ case "input":
74
+ return { _type: "Input", showLabel: !1 };
75
+ case "hr":
76
+ return { _type: "Divider" };
77
+ case "br":
78
+ return { _type: "LineBreak" };
79
+ case "textarea":
80
+ return { _type: "TextArea", showLabel: !1 };
81
+ case "audio":
82
+ return { _type: "Audio" };
83
+ case "canvas":
84
+ return { _type: "Canvas" };
85
+ case "video":
86
+ case "iframe":
87
+ return { _type: "CustomHTML" };
88
+ case "svg":
89
+ return { _type: "Icon" };
90
+ case "select":
91
+ return { _type: "Select", options: [] };
92
+ case "option":
93
+ return { _type: "Option" };
94
+ case "ul":
95
+ case "ol":
96
+ case "dl":
97
+ return {
98
+ _type: "List",
99
+ tag: t.tagName,
100
+ _listType: t.tagName === "ol" ? "list-decimal" : "list-none"
101
+ };
102
+ case "li":
103
+ case "dt":
104
+ return { _type: "ListItem", tag: t.tagName };
105
+ case "span":
106
+ case "figcaption":
107
+ case "legend":
108
+ return { _type: "Span", tag: t.tagName };
109
+ case "p":
110
+ return { _type: "Paragraph", content: "" };
111
+ case "a":
112
+ return { _type: "Link" };
113
+ case "form":
114
+ return { _type: "Form" };
115
+ case "label":
116
+ return { _type: "Label" };
117
+ case "button":
118
+ return { _type: "Button" };
119
+ case "code":
120
+ return { _type: "Code" };
121
+ case "h1":
122
+ case "h2":
123
+ case "h3":
124
+ case "h4":
125
+ case "h5":
126
+ case "h6":
127
+ return { _type: "Heading", tag: t.tagName };
128
+ case "table":
129
+ return { _type: "Table" };
130
+ case "tr":
131
+ return { _type: "TableRow" };
132
+ case "td":
133
+ case "th":
134
+ return { _type: "TableCell", tag: t.tagName };
135
+ case "thead":
136
+ return { _type: "TableHead" };
137
+ case "tbody":
138
+ return { _type: "TableBody" };
139
+ case "tfoot":
140
+ return { _type: "TableFooter" };
141
+ default:
142
+ const e = l(t, "children", []).length > 0 ? "Box" : "EmptyBox";
143
+ return {
144
+ _type: e,
145
+ tag: t.tagName,
146
+ _name: e == "EmptyBox" || t.tagName === "div" ? e : S(t.tagName)
147
+ };
148
+ }
149
+ }, d = (t, e = null) => $(t, (r) => {
150
+ var c;
151
+ if (r.type === "comment")
152
+ return [];
153
+ let a = { _id: N() };
154
+ if (e && (a._parent = e.block._id), r.type === "text")
155
+ return g(l(r, "content", "")) ? [] : e && M(e.node, e.block) ? (o(e, "block.content", l(r, "content", "")), []) : { ...a, _type: "Text", content: l(r, "content", "") };
156
+ if (a = {
157
+ ...a,
158
+ ...I(r),
159
+ ...f(r),
160
+ ...E(r)
161
+ }, a._type === "Input") {
162
+ const s = a.inputType || "text";
163
+ s === "checkbox" ? o(a, "_type", "Checkbox") : s === "radio" && o(a, "_type", "Radio");
164
+ } else if (r.tagName === "video" || r.tagName === "iframe") {
165
+ const s = m([r]);
166
+ return B(s) && (o(a, "_type", "Video"), o(a, "url", R(s)), o(a, "styles", `${p},absolute top-0 left-0 w-full h-full`), o(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = s, [a];
167
+ } else if (r.tagName === "svg") {
168
+ const s = u(r.attributes, { key: "height" }), n = u(r.attributes, { key: "width" }), _ = l(s, "value") ? `[${l(s, "value")}px]` : "24px", v = l(n, "value") ? `[${l(n, "value")}px]` : "24px", T = l(u(r.attributes, { key: "class" }), "value", "w-full h-full");
169
+ return a.styles = `${p}, ${k(`w-${v} h-${_}`, T)}`.trim(), r.attributes = C(r.attributes, (x) => !y(["style", "width", "height", "class"], x.key)), a.icon = m([r]), [a];
170
+ } else if (r.tagName == "option" && e && ((c = e.block) == null ? void 0 : c._type) === "Select")
171
+ return e.block.options.push({
172
+ label: b(r.children),
173
+ ...f(r)
174
+ }), [];
175
+ const i = d(r.children, { block: a, node: r });
176
+ return [a, ...i];
177
+ }), q = (t) => {
178
+ const e = t.match(/<body[^>]*>[\s\S]*?<\/body>/);
179
+ return (e && e.length > 0 ? e[0].replace(/<body/, "<div").replace(/<\/body>/, "</div>") : t).replace(/\s+/g, " ").replaceAll("> <", "><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").trim();
180
+ }, V = (t) => {
181
+ const e = w(q(t));
182
+ return g(t) ? [] : A(d(e));
183
+ };
184
+ export {
185
+ V as g
186
+ };
@@ -0,0 +1 @@
1
+ "use strict";const s=require("react");var u={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},p=s.createContext&&s.createContext(u),d=["attr","size","title"];function I(e,t){if(e==null)return{};var i=f(e,t),n,o;if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(o=0;o<c.length;o++)n=c[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function f(e,t){if(e==null)return{};var i={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;i[n]=e[n]}return i}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},l.apply(this,arguments)}function h(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,n)}return i}function a(e){for(var t=1;t<arguments.length;t++){var i=arguments[t]!=null?arguments[t]:{};t%2?h(Object(i),!0).forEach(function(n){U(e,n,i[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):h(Object(i)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(i,n))})}return e}function U(e,t,i){return t=j(t),t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function j(e){var t=v(e,"string");return typeof t=="symbol"?t:t+""}function v(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var n=i.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function b(e){return e&&e.map((t,i)=>s.createElement(t.tag,a({key:i},t.attr),b(t.child)))}function y(e){return t=>s.createElement(w,l({attr:a({},e.attr)},t),b(e.child))}function w(e){var t=i=>{var{attr:n,size:o,title:c}=e,g=I(e,d),m=o||i.size||"1em",r;return i.className&&(r=i.className),e.className&&(r=(r?r+" ":"")+e.className),s.createElement("svg",l({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},i.attr,n,g,{className:r,style:a(a({color:e.color||i.color},i.style),e.style),height:m,width:m,xmlns:"http://www.w3.org/2000/svg"}),c&&s.createElement("title",null,c),e.children)};return p!==void 0?s.createElement(p.Consumer,null,i=>t(i)):t(u)}exports.GenIcon=y;