@chaibuilder/sdk 1.2.6 → 1.2.7

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 (96) hide show
  1. package/dist/AddBlocks-MKhgtI8x.cjs +1 -0
  2. package/dist/{AddBlocks-gbfzju1d.js → AddBlocks-pjLrzkvz.js} +52 -53
  3. package/dist/{BrandingOptions-mZXO7thQ.js → BrandingOptions-PXCI0z-H.js} +57 -53
  4. package/dist/BrandingOptions-tZaUILYP.cjs +1 -0
  5. package/dist/CanvasArea-C2ak1ui1.cjs +60 -0
  6. package/dist/{CanvasArea-7GpvsKP6.js → CanvasArea-Fhg-6_nZ.js} +407 -407
  7. package/dist/CurrentPage-4O-iqW3w.cjs +1 -0
  8. package/dist/{CurrentPage-C52wu_r7.js → CurrentPage-Zz9LEdez.js} +15 -17
  9. package/dist/{Layers-NDtp2-im.js → Layers-cgmxKAP9.js} +173 -152
  10. package/dist/Layers-uo4KpGCs.cjs +1 -0
  11. package/dist/MarkAsGlobalBlock-1kOwPbPm.cjs +1 -0
  12. package/dist/{MarkAsGlobalBlock-SPWd6Flk.js → MarkAsGlobalBlock-htrpRVJM.js} +6 -6
  13. package/dist/{PagesPanel-qV7yGT-K.js → PagesPanel-TYBKN2Am.js} +8 -10
  14. package/dist/PagesPanel-z5qHpU24.cjs +1 -0
  15. package/dist/{ProjectPanel-RJqNz-uq.js → ProjectPanel-PJ1iPaLY.js} +15 -17
  16. package/dist/ProjectPanel-mEVh8sLb.cjs +1 -0
  17. package/dist/{Settings-t0I7LKxe.js → Settings-Na0NVS-E.js} +175 -175
  18. package/dist/Settings-YNxmjfAl.cjs +1 -0
  19. package/dist/{SidePanels-rXx-fGjB.js → SidePanels-bHll6xCt.js} +99 -98
  20. package/dist/SidePanels-jsHvSEtM.cjs +1 -0
  21. package/dist/{Topbar-ks1ckGLz.js → Topbar-JKdXHH8P.js} +4 -4
  22. package/dist/Topbar-jWRuTvxv.cjs +1 -0
  23. package/dist/UnsplashImages-dBdqJNux.cjs +1 -0
  24. package/dist/{UnsplashImages-8vJPuqrF.js → UnsplashImages-jiOES16m.js} +7 -7
  25. package/dist/UploadImages-OD3RPS7j.cjs +1 -0
  26. package/dist/{UploadImages-6N6UrjLo.js → UploadImages-imersU7l.js} +4 -4
  27. package/dist/{add-page-modal-2VlONTs5.js → add-page-modal-EQWWxbry.js} +10 -11
  28. package/dist/add-page-modal-nFQ8TUBM.cjs +1 -0
  29. package/dist/{confirm-alert-biqvaLT-.js → confirm-alert-HOs52FKE.js} +4 -4
  30. package/dist/confirm-alert-j6hcFSlG.cjs +1 -0
  31. package/dist/{controls-XPXGHKht.js → controls-QGClapUl.js} +9 -45
  32. package/dist/{controls-Dy1qa8Dc.cjs → controls-hpe3HxsR.cjs} +1 -1
  33. package/dist/core.cjs +1 -1
  34. package/dist/core.js +56 -58
  35. package/dist/{delete-page-modal-_8O4RCkG.js → delete-page-modal-DU388lPm.js} +21 -23
  36. package/dist/delete-page-modal-bkSWhTxz.cjs +1 -0
  37. package/dist/email-blocks.cjs +1 -1
  38. package/dist/email-blocks.js +263 -24
  39. package/dist/{form-Moz_psOw.js → form-7E1GY3U7.js} +1 -1
  40. package/dist/{form-lJhy9DEC.cjs → form-lF5eSfMe.cjs} +1 -1
  41. package/dist/html-to-json-JS8zQjYB.cjs +1 -0
  42. package/dist/{html-to-json-yjzEN9OX.js → html-to-json-lNLC8Y7D.js} +26 -27
  43. package/dist/{index-482XFRhB.js → index-7vwIQQ-T.js} +5402 -5366
  44. package/dist/index-98CxilGX.cjs +1 -0
  45. package/dist/{index-3OU9zl6c.cjs → index-Hf23Fq9m.cjs} +33 -33
  46. package/dist/{index-_OgCuSUz.js → index-WKIG_VPl.js} +1043 -1036
  47. package/dist/index-e0c8PmRQ.js +205 -0
  48. package/dist/index-gi1LIOCw.cjs +1 -0
  49. package/dist/lib.cjs +2 -2
  50. package/dist/lib.js +20 -22
  51. package/dist/mockServiceWorker.js +1 -1
  52. package/dist/page-viewer-6a4GFMUg.cjs +1 -0
  53. package/dist/{page-viewer-ajtG_WZC.js → page-viewer-fohh_Dwv.js} +9 -11
  54. package/dist/{project-general-setting-TIHLI4Qg.js → project-general-setting-Ryf5OhPd.js} +10 -11
  55. package/dist/project-general-setting-j4lKlLUE.cjs +1 -0
  56. package/dist/project-seo-setting-CATo4bEL.cjs +1 -0
  57. package/dist/{project-seo-setting-dXclexQW.js → project-seo-setting-KKOCl416.js} +6 -6
  58. package/dist/{single-page-detail-lST7hWvC.js → single-page-detail-mJBo7VRe.js} +11 -12
  59. package/dist/single-page-detail-zms-5Fa_.cjs +1 -0
  60. package/dist/studio.cjs +1 -1
  61. package/dist/studio.js +7 -9
  62. package/dist/style.css +1 -1
  63. package/dist/ui.cjs +1 -1
  64. package/dist/ui.js +18 -18
  65. package/dist/{useAddBlockByDrop-uPXvrg4G.js → useAddBlockByDrop-CmSt8dRr.js} +1 -1
  66. package/dist/{useAddBlockByDrop-_nd8yZBa.cjs → useAddBlockByDrop-pVcDjcgp.cjs} +1 -1
  67. package/dist/{utils-AvyFzbPC.js → utils-Jw11nj1S.js} +35 -26
  68. package/dist/utils-j7Kg63NR.cjs +1 -0
  69. package/dist/web-blocks.cjs +1 -9
  70. package/dist/web-blocks.js +3 -1049
  71. package/package.json +5 -5
  72. package/dist/AddBlocks-wuKI1ieB.cjs +0 -1
  73. package/dist/BrandingOptions-arKT1zCy.cjs +0 -1
  74. package/dist/CanvasArea-jvwkPvtQ.cjs +0 -59
  75. package/dist/CurrentPage-tHBommaV.cjs +0 -1
  76. package/dist/Functions-7jnEwJyw.js +0 -15
  77. package/dist/Functions-N3yhPYKY.cjs +0 -1
  78. package/dist/Layers-4G-0aNk9.cjs +0 -1
  79. package/dist/MarkAsGlobalBlock-S2BhHTsK.cjs +0 -1
  80. package/dist/PagesPanel-qZ_-tybb.cjs +0 -1
  81. package/dist/ProjectPanel-vzyFbBNU.cjs +0 -1
  82. package/dist/Settings-SV08lVcH.cjs +0 -1
  83. package/dist/SidePanels-TOJotvzn.cjs +0 -1
  84. package/dist/Topbar-u5XKdWgQ.cjs +0 -1
  85. package/dist/UnsplashImages-V8oKEHfi.cjs +0 -1
  86. package/dist/UploadImages-eHYxwWAp.cjs +0 -1
  87. package/dist/add-page-modal-a8r8poMY.cjs +0 -1
  88. package/dist/confirm-alert-f3DYO5Hj.cjs +0 -1
  89. package/dist/delete-page-modal-NmwHGjZP.cjs +0 -1
  90. package/dist/html-to-json-5UoswV2Q.cjs +0 -1
  91. package/dist/index-IIJ_o44s.cjs +0 -1
  92. package/dist/page-viewer-k2VlWE3T.cjs +0 -1
  93. package/dist/project-general-setting-tAgCjUtR.cjs +0 -1
  94. package/dist/project-seo-setting-9JGBPzcA.cjs +0 -1
  95. package/dist/single-page-detail-6btKDNjs.cjs +0 -1
  96. package/dist/utils-PTxFk6qT.cjs +0 -1
@@ -1,16 +1,16 @@
1
- import { j as r } from "./jsx-runtime-WbnYoNE9.js";
2
- import { D as s, E as l, F as n, H as d, I as a, K as c, B as u } from "./index-_OgCuSUz.js";
3
- import { j as x } from "./index-482XFRhB.js";
1
+ import { j as e } from "./jsx-runtime-WbnYoNE9.js";
2
+ import { E as s, F as l, G as n, I as d, J as a, L as c, B as u } from "./index-WKIG_VPl.js";
3
+ import { j as x } from "./index-7vwIQQ-T.js";
4
4
  import { TrashIcon as h } from "@radix-ui/react-icons";
5
5
  import "./_commonjsHelpers-UyOWmZb0.js";
6
6
  import "react";
7
7
  import "@radix-ui/react-toggle";
8
8
  import "class-variance-authority";
9
- import "./utils-AvyFzbPC.js";
9
+ import "./utils-Jw11nj1S.js";
10
10
  import "lodash-es";
11
- import "./MODIFIERS-RiXS5Mn1.js";
12
11
  import "clsx";
13
12
  import "tailwind-merge";
13
+ import "./MODIFIERS-RiXS5Mn1.js";
14
14
  import "@radix-ui/react-switch";
15
15
  import "@radix-ui/react-slot";
16
16
  import "@radix-ui/react-accordion";
@@ -34,9 +34,9 @@ import "react-dom";
34
34
  import "react-quill";
35
35
  import "jotai";
36
36
  import "flat-to-nested";
37
- import "./Functions-7jnEwJyw.js";
38
37
  import "redux-undo";
39
38
  import "@chaibuilder/runtime";
39
+ import "lodash";
40
40
  import "@react-hookz/web";
41
41
  import "react-i18next";
42
42
  import "i18next";
@@ -47,42 +47,40 @@ import "react-dnd";
47
47
  import "@minoru/react-dnd-treeview";
48
48
  import "react-hotkeys-hook";
49
49
  import "sonner";
50
- import "./html-to-json-yjzEN9OX.js";
50
+ import "./html-to-json-lNLC8Y7D.js";
51
51
  import "himalaya";
52
- import "lodash";
53
52
  import "lucide-react";
54
53
  import "./web-blocks.js";
55
- import "./controls-XPXGHKht.js";
56
- const jr = ({ pageData: e, projectData: i }) => {
57
- const m = {}, t = x(), o = e.uuid === i.homepage, p = () => {
58
- t.mutate(e, {
54
+ const he = ({ pageData: r, projectData: i }) => {
55
+ const m = {}, t = x(), o = r.uuid === i.homepage, p = () => {
56
+ t.mutate(r, {
59
57
  onSuccess: () => {
60
58
  m({ uuid: i.homepage, slug: "/home" });
61
59
  }
62
60
  });
63
61
  };
64
- return /* @__PURE__ */ r.jsxs(s, { children: [
65
- /* @__PURE__ */ r.jsx(l, { disabled: o, children: /* @__PURE__ */ r.jsx(
62
+ return /* @__PURE__ */ e.jsxs(s, { children: [
63
+ /* @__PURE__ */ e.jsx(l, { disabled: o, children: /* @__PURE__ */ e.jsx(
66
64
  "div",
67
65
  {
68
66
  className: `flex h-full items-center justify-center rounded-md border px-2 py-2 font-medium hover:bg-red-400 hover:text-white ${o ? "cursor-not-allowed border-red-200 text-red-200" : "cursor-pointer border-red-400 text-red-400"}`,
69
- children: /* @__PURE__ */ r.jsx(h, {})
67
+ children: /* @__PURE__ */ e.jsx(h, {})
70
68
  }
71
69
  ) }),
72
- /* @__PURE__ */ r.jsxs(n, { children: [
73
- /* @__PURE__ */ r.jsxs(d, { children: [
70
+ /* @__PURE__ */ e.jsxs(n, { children: [
71
+ /* @__PURE__ */ e.jsxs(d, { children: [
74
72
  "Are you sure you want to delete ",
75
- /* @__PURE__ */ r.jsx("i", { className: "text-red-500", children: e.name }),
73
+ /* @__PURE__ */ e.jsx("i", { className: "text-red-500", children: r.name }),
76
74
  " page?"
77
75
  ] }),
78
- /* @__PURE__ */ r.jsx(a, { children: "This action cannot be undone. This will permanently delete your page." }),
79
- /* @__PURE__ */ r.jsxs("div", { className: "flex items-center justify-end gap-x-3", children: [
80
- /* @__PURE__ */ r.jsx(c, { disabled: t.isPending, children: "Cancel" }),
81
- /* @__PURE__ */ r.jsx(u, { variant: "destructive", onClick: p, disabled: t.isPending, children: "Yes, Delete" })
76
+ /* @__PURE__ */ e.jsx(a, { children: "This action cannot be undone. This will permanently delete your page." }),
77
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-end gap-x-3", children: [
78
+ /* @__PURE__ */ e.jsx(c, { disabled: t.isPending, children: "Cancel" }),
79
+ /* @__PURE__ */ e.jsx(u, { variant: "destructive", onClick: p, disabled: t.isPending, children: "Yes, Delete" })
82
80
  ] })
83
81
  ] })
84
82
  ] });
85
83
  };
86
84
  export {
87
- jr as default
85
+ he as default
88
86
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("./index-98CxilGX.cjs"),l=require("./index-Hf23Fq9m.cjs"),q=require("@radix-ui/react-icons");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-j7Kg63NR.cjs");require("lodash-es");require("clsx");require("tailwind-merge");require("./MODIFIERS-2FeVfZQ9.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");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-menubar");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-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("lodash");require("@react-hookz/web");require("react-i18next");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-JS8zQjYB.cjs");require("himalaya");require("lucide-react");require("./web-blocks.cjs");const d=({pageData:i,projectData:t})=>{const n={},u=l.useDeletePage(),s=i.uuid===t.homepage,o=()=>{u.mutate(i,{onSuccess:()=>{n({uuid:t.homepage,slug:"/home"})}})};return e.jsxRuntimeExports.jsxs(r.AlertDialog,{children:[e.jsxRuntimeExports.jsx(r.AlertDialogTrigger,{disabled:s,children:e.jsxRuntimeExports.jsx("div",{className:`flex h-full items-center justify-center rounded-md border px-2 py-2 font-medium hover:bg-red-400 hover:text-white ${s?"cursor-not-allowed border-red-200 text-red-200":"cursor-pointer border-red-400 text-red-400"}`,children:e.jsxRuntimeExports.jsx(q.TrashIcon,{})})}),e.jsxRuntimeExports.jsxs(r.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(r.AlertDialogTitle,{children:["Are you sure you want to delete ",e.jsxRuntimeExports.jsx("i",{className:"text-red-500",children:i.name})," page?"]}),e.jsxRuntimeExports.jsx(r.AlertDialogDescription,{children:"This action cannot be undone. This will permanently delete your page."}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-3",children:[e.jsxRuntimeExports.jsx(r.AlertDialogCancel,{disabled:u.isPending,children:"Cancel"}),e.jsxRuntimeExports.jsx(r.Button,{variant:"destructive",onClick:o,disabled:u.isPending,children:"Yes, Delete"})]})]})]})};exports.default=d;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("@react-email/components"),s=require("@chaibuilder/runtime"),i=require("./controls-Dy1qa8Dc.cjs"),c=require("lodash-es");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");const l=({blockProps:o,styles:t,children:n})=>e.jsxRuntimeExports.jsxs(r.Container,{...o,...t,children:[e.jsxRuntimeExports.jsx("h1",{children:"Hello"}),e.jsxRuntimeExports.jsx(r.Button,{href:"https://example.com",className:"c-bg-red-500 c-px-4 c-py-1 c-border c-rounded-md c-inline-block c-text-white c-font-bold",children:"Click me"}),e.jsxRuntimeExports.jsx(r.Hr,{}),e.jsxRuntimeExports.jsx(r.CodeInline,{children:"@react-email/code-inline"}),";",n]});s.registerChaiBlock(l,{type:"Container",label:"Container",group:"basic",category:"core",props:{styles:i.S({default:""})}});const u=c.noop;exports.loadEmailBlocks=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("lodash-es"),l=require("./jsx-runtime-Z_BpKhVy.cjs"),c=require("@react-email/components"),i=require("@chaibuilder/runtime"),r=require("./controls-hpe3HxsR.cjs"),s=require("@radix-ui/react-icons");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");const p=({blockProps:e,styles:t,children:o})=>l.jsxRuntimeExports.jsx(c.Container,{...e,...t,children:o});i.registerChaiBlock(p,{type:"Container",label:"Container",group:"basic",category:"core",props:{styles:r.S({default:""})},canAcceptBlock:()=>!0,canMove:()=>!0,canDelete:()=>!1,canDuplicate:()=>!1});const x=({blockProps:e,styles:t,children:o})=>l.jsxRuntimeExports.jsx(c.Section,{...e,...t,children:o});i.registerChaiBlock(x,{type:"Section",label:"Section",group:"basic",category:"core",icon:s.ImageIcon,props:{styles:r.S({default:"w-full"}),align:r.f({title:"Align",default:"",options:[{value:"",title:"None"},{value:"left",title:"left"},{value:"center",title:"center"},{value:"right",title:"right"}]})},canAcceptBlock:()=>!0});const g=({blockProps:e,styles:t,children:o})=>l.jsxRuntimeExports.jsx(c.Row,{...e,...t,children:o});i.registerChaiBlock(g,{type:"Row",label:"Row",group:"basic",category:"core",icon:s.ImageIcon,props:{styles:r.S({default:""})},canAcceptBlock:e=>e==="Column"});const m=({blockProps:e,styles:t,children:o,align:n})=>l.jsxRuntimeExports.jsx(c.Column,{...e,...t,align:n,children:o});i.registerChaiBlock(m,{type:"Column",label:"Column",group:"basic",category:"core",icon:s.ImageIcon,props:{styles:r.S({default:""}),align:r.f({title:"Align",default:"",options:[{value:"",title:"None"},{value:"left",title:"left"},{value:"center",title:"center"},{value:"right",title:"right"}]})},canAcceptBlock:()=>!0});const h=({level:e,blockProps:t,styles:o,content:n})=>l.jsxRuntimeExports.jsx(c.Heading,{as:e,...t,...o,children:n}),k=({blockProps:e,styles:t,content:o})=>l.jsxRuntimeExports.jsx("h1",{...e,...t,children:o});i.registerChaiBlock(h,{type:"Heading",label:"Heading",group:"basic",category:"core",icon:s.HeadingIcon,builderComponent:k,props:{content:r.u({title:"Content",default:"Enter your heading here..."}),styles:r.S({default:"text-xl"}),level:r.f({title:"Level",default:"h1",binding:!1,options:[{value:"h1",title:"h1"},{value:"h2",title:"h2"},{value:"h3",title:"h3"},{value:"h4",title:"h4"},{value:"h5",title:"h5"},{value:"h6",title:"h6"}]})},canAcceptBlock:e=>["Link","RawText"].includes(e)});const b=({blockProps:e,styles:t,content:o})=>l.jsxRuntimeExports.jsx(c.Text,{...e,...t,children:o}),B=({content:e,blockProps:t,styles:o})=>l.jsxRuntimeExports.jsx("p",{...t,...o,children:e});i.registerChaiBlock(b,{type:"Text",label:"Text",group:"basic",category:"core",icon:s.TextIcon,builderComponent:B,props:{content:r.g({title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam in dui mauris. Vivamus hendrerit arcu sed erat molestie vehicula. Sed auctor neque eu tellus rhoncus ut eleifend nibh porttitor. Ut in nulla enim."}),styles:r.S({default:""})},canAcceptBlock:e=>["Link","RawText"].includes(e)});const f=({content:e})=>e,C=({content:e,blockProps:t})=>l.jsxRuntimeExports.jsx("span",{...t,children:e});i.registerChaiBlock(f,{type:"RawText",label:"Raw Text",group:"basic",category:"core",icon:s.TextIcon,hidden:!0,builderComponent:C,props:{content:r.g({title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam in dui mauris. "})}});const j=({blockProps:e,styles:t,link:o,content:n})=>l.jsxRuntimeExports.jsx(c.Button,{...e,...t,href:o.href,children:n}),y=({blockProps:e,styles:t,content:o})=>l.jsxRuntimeExports.jsx("button",{type:"button",...e,...t,children:o});i.registerChaiBlock(j,{type:"Button",label:"Button",group:"basic",category:"core",builderComponent:y,props:{content:r.u({title:"Content",default:"Click me"}),link:r.q({title:"Link",default:{href:"https://chaibuilder.com",target:"_blank",type:"url"}}),styles:r.S({default:"bg-primary text-white px-4 py-2 rounded-md"})}});const v=({blockProps:e,styles:t,href:o,content:n,target:a})=>l.jsxRuntimeExports.jsx(c.Link,{...e,...t,href:o,target:a,children:n}),R=({blockProps:e,styles:t,content:o,children:n})=>l.jsxRuntimeExports.jsx("span",{...e,...t,children:n||o});i.registerChaiBlock(v,{type:"Link",label:"Link",group:"basic",category:"core",icon:s.Link1Icon,blocks:[{_id:"a",_type:"Link"},{_id:"b",_parent:"a",_type:"RawText",content:"I am a link."}],builderComponent:R,props:{content:r.u({title:"Content",default:"I am a link."}),link:r.q({title:"Link",default:{href:"https://chaibuilder.com",target:"_blank",type:"url"}}),styles:r.S({default:"font-bold text-blue-500"})},canAcceptBlock:()=>!0});const E=({blockProps:e,styles:t,children:o})=>l.jsxRuntimeExports.jsx(c.Preview,{...e,...t,children:o}),I=({blockProps:e,styles:t,content:o})=>l.jsxRuntimeExports.jsx("div",{...e,...t,children:o});i.registerChaiBlock(E,{type:"Preview",label:"Preview",group:"basic",category:"core",builderComponent:I,canAcceptBlock:()=>!0,canDuplicate:()=>!1});const w=({blockProps:e,content:t})=>l.jsxRuntimeExports.jsx(c.Markdown,{children:t,...e});i.registerChaiBlock(w,{type:"Markdown",label:"Markdown",group:"basic",category:"core",props:{content:r.g({default:"# This is a ~~strikethrough~~",title:"Markdown"})}});const S=({blockProps:e,styles:t,alt:o,image:n,width:a,height:u})=>l.jsxRuntimeExports.jsx(c.Img,{...e,...t,src:n,alt:o,width:a,height:u}),L=({blockProps:e,styles:t,alt:o,image:n,width:a,height:u})=>l.jsxRuntimeExports.jsx("img",{...e,...t,src:n,alt:o,width:a,height:u});i.registerChaiBlock(S,{type:"Image",label:"Image",group:"basic",category:"core",icon:s.ImageIcon,builderComponent:L,props:{styles:r.S({default:"w-full"}),image:r.o({title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas"}),alt:r.u({title:"Alt",default:""}),width:r.u({title:"Width",default:""}),height:r.u({title:"Height",default:""})}});const T=({blockProps:e,styles:t})=>l.jsxRuntimeExports.jsx(c.Hr,{...e,...t}),H=({blockProps:e,styles:t})=>l.jsxRuntimeExports.jsx("hr",{...e,...t});i.registerChaiBlock(T,{type:"Divider",label:"Divider",group:"basic",category:"core",icon:s.DividerHorizontalIcon,builderComponent:H,props:{styles:r.S({default:"w-full h-2"})}});const q=({blockProps:e,styles:t,code:o,lineNumbers:n,theme:a,language:u})=>l.jsxRuntimeExports.jsx(c.CodeBlock,{...e,...t,code:o,linenumbers:n,theme:a,language:u}),A=({blockProps:e,styles:t,code:o})=>l.jsxRuntimeExports.jsx("div",{...e,...t,children:l.jsxRuntimeExports.jsx("code",{children:o})});i.registerChaiBlock(q,{type:"CodeBlock",label:"Code Block",group:"basic",category:"core",hidden:!0,icon:s.CodeSandboxLogoIcon,builderComponent:A,props:{styles:r.S({default:""}),code:r.g({title:"Code",default:"console.log('Hello, world!');"}),theme:r.u({title:"Theme",default:"dracula"}),lineNumbers:r.r({title:"Line number",default:!1}),language:r.f({title:"Language",default:"javascript",binding:!1,options:[{value:"javascript",title:"JavaScript"},{value:"html",title:"HTML"},{value:"css",title:"CSS"}]})}});const D=({blockProps:e,styles:t,code:o})=>l.jsxRuntimeExports.jsx(c.CodeInline,{...e,...t,children:o}),M=({blockProps:e,styles:t,code:o})=>l.jsxRuntimeExports.jsx("code",{...e,...t,children:o});i.registerChaiBlock(D,{type:"CodeInline",label:"Code Inline",group:"basic",category:"core",icon:s.CodeSandboxLogoIcon,builderComponent:M,props:{styles:r.S({default:""}),code:r.g({title:"Code",default:"console.log('Hello, world!');"})}});const _=d.noop;exports.loadEmailBlocks=_;
@@ -1,35 +1,274 @@
1
- import { j as o } from "./jsx-runtime-WbnYoNE9.js";
2
- import { Container as i, Button as c, Hr as n, CodeInline as l } from "@react-email/components";
3
- import { registerChaiBlock as m } from "@chaibuilder/runtime";
4
- import { S as s } from "./controls-XPXGHKht.js";
5
- import { noop as p } from "lodash-es";
1
+ import { noop as b } from "lodash-es";
2
+ import { j as l } from "./jsx-runtime-WbnYoNE9.js";
3
+ import { Container as f, Section as k, Row as y, Column as x, Heading as B, Text as C, Button as v, Link as j, Preview as w, Markdown as I, Img as L, Hr as T, CodeBlock as H, CodeInline as A } from "@react-email/components";
4
+ import { registerChaiBlock as r } from "@chaibuilder/runtime";
5
+ import { S as i, f as d, u as a, g as s, q as g, o as R, r as S } from "./controls-QGClapUl.js";
6
+ import { ImageIcon as p, HeadingIcon as D, TextIcon as m, Link1Icon as M, DividerHorizontalIcon as _, CodeSandboxLogoIcon as h } from "@radix-ui/react-icons";
6
7
  import "./_commonjsHelpers-UyOWmZb0.js";
7
8
  import "react";
8
- const a = ({ blockProps: e, styles: r, children: t }) => /* @__PURE__ */ o.jsxs(i, { ...e, ...r, children: [
9
- /* @__PURE__ */ o.jsx("h1", { children: "Hello" }),
10
- /* @__PURE__ */ o.jsx(
11
- c,
12
- {
13
- href: "https://example.com",
14
- className: "c-bg-red-500 c-px-4 c-py-1 c-border c-rounded-md c-inline-block c-text-white c-font-bold",
15
- children: "Click me"
16
- }
17
- ),
18
- /* @__PURE__ */ o.jsx(n, {}),
19
- /* @__PURE__ */ o.jsx(l, { children: "@react-email/code-inline" }),
20
- ";",
21
- t
22
- ] });
23
- m(a, {
9
+ const N = ({ blockProps: e, styles: t, children: o }) => /* @__PURE__ */ l.jsx(f, { ...e, ...t, children: o });
10
+ r(N, {
24
11
  type: "Container",
25
12
  label: "Container",
26
13
  group: "basic",
27
14
  category: "core",
15
+ props: { styles: i({ default: "" }) },
16
+ canAcceptBlock: () => !0,
17
+ canMove: () => !0,
18
+ canDelete: () => !1,
19
+ canDuplicate: () => !1
20
+ });
21
+ const P = ({ blockProps: e, styles: t, children: o }) => /* @__PURE__ */ l.jsx(k, { ...e, ...t, children: o });
22
+ r(P, {
23
+ type: "Section",
24
+ label: "Section",
25
+ group: "basic",
26
+ category: "core",
27
+ icon: p,
28
+ props: {
29
+ styles: i({ default: "w-full" }),
30
+ align: d({
31
+ title: "Align",
32
+ default: "",
33
+ options: [
34
+ { value: "", title: "None" },
35
+ { value: "left", title: "left" },
36
+ { value: "center", title: "center" },
37
+ { value: "right", title: "right" }
38
+ ]
39
+ })
40
+ },
41
+ canAcceptBlock: () => !0
42
+ });
43
+ const $ = ({ blockProps: e, styles: t, children: o }) => /* @__PURE__ */ l.jsx(y, { ...e, ...t, children: o });
44
+ r($, {
45
+ type: "Row",
46
+ label: "Row",
47
+ group: "basic",
48
+ category: "core",
49
+ icon: p,
50
+ props: {
51
+ styles: i({ default: "" })
52
+ },
53
+ canAcceptBlock: (e) => e === "Column"
54
+ });
55
+ const E = ({ blockProps: e, styles: t, children: o, align: n }) => /* @__PURE__ */ l.jsx(x, { ...e, ...t, align: n, children: o });
56
+ r(E, {
57
+ type: "Column",
58
+ label: "Column",
59
+ group: "basic",
60
+ category: "core",
61
+ icon: p,
62
+ props: {
63
+ styles: i({ default: "" }),
64
+ align: d({
65
+ title: "Align",
66
+ default: "",
67
+ options: [
68
+ { value: "", title: "None" },
69
+ { value: "left", title: "left" },
70
+ { value: "center", title: "center" },
71
+ { value: "right", title: "right" }
72
+ ]
73
+ })
74
+ },
75
+ canAcceptBlock: () => !0
76
+ });
77
+ const q = ({ level: e, blockProps: t, styles: o, content: n }) => /* @__PURE__ */ l.jsx(B, { as: e, ...t, ...o, children: n }), z = ({ blockProps: e, styles: t, content: o }) => /* @__PURE__ */ l.jsx("h1", { ...e, ...t, children: o });
78
+ r(q, {
79
+ type: "Heading",
80
+ label: "Heading",
81
+ group: "basic",
82
+ category: "core",
83
+ icon: D,
84
+ builderComponent: z,
85
+ props: {
86
+ content: a({ title: "Content", default: "Enter your heading here..." }),
87
+ styles: i({ default: "text-xl" }),
88
+ level: d({
89
+ title: "Level",
90
+ default: "h1",
91
+ binding: !1,
92
+ options: [
93
+ { value: "h1", title: "h1" },
94
+ { value: "h2", title: "h2" },
95
+ { value: "h3", title: "h3" },
96
+ { value: "h4", title: "h4" },
97
+ { value: "h5", title: "h5" },
98
+ { value: "h6", title: "h6" }
99
+ ]
100
+ })
101
+ },
102
+ canAcceptBlock: (e) => ["Link", "RawText"].includes(e)
103
+ });
104
+ const J = ({ blockProps: e, styles: t, content: o }) => /* @__PURE__ */ l.jsx(C, { ...e, ...t, children: o }), U = ({ content: e, blockProps: t, styles: o }) => /* @__PURE__ */ l.jsx("p", { ...t, ...o, children: e });
105
+ r(J, {
106
+ type: "Text",
107
+ label: "Text",
108
+ group: "basic",
109
+ category: "core",
110
+ icon: m,
111
+ builderComponent: U,
112
+ props: {
113
+ content: s({
114
+ title: "Content",
115
+ default: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam in dui mauris. Vivamus hendrerit arcu sed erat molestie vehicula. Sed auctor neque eu tellus rhoncus ut eleifend nibh porttitor. Ut in nulla enim."
116
+ }),
117
+ styles: i({ default: "" })
118
+ },
119
+ canAcceptBlock: (e) => ["Link", "RawText"].includes(e)
120
+ });
121
+ const V = ({ content: e }) => e, W = ({ content: e, blockProps: t }) => /* @__PURE__ */ l.jsx("span", { ...t, children: e });
122
+ r(V, {
123
+ type: "RawText",
124
+ label: "Raw Text",
125
+ group: "basic",
126
+ category: "core",
127
+ icon: m,
128
+ hidden: !0,
129
+ builderComponent: W,
130
+ props: {
131
+ content: s({
132
+ title: "Content",
133
+ default: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam in dui mauris. "
134
+ })
135
+ }
136
+ });
137
+ const F = ({ blockProps: e, styles: t, link: o, content: n }) => /* @__PURE__ */ l.jsx(v, { ...e, ...t, href: o.href, children: n }), G = ({ blockProps: e, styles: t, content: o }) => /* @__PURE__ */ l.jsx("button", { type: "button", ...e, ...t, children: o });
138
+ r(F, {
139
+ type: "Button",
140
+ label: "Button",
141
+ group: "basic",
142
+ category: "core",
143
+ builderComponent: G,
144
+ props: {
145
+ content: a({ title: "Content", default: "Click me" }),
146
+ link: g({ title: "Link", default: { href: "https://chaibuilder.com", target: "_blank", type: "url" } }),
147
+ styles: i({ default: "bg-primary text-white px-4 py-2 rounded-md" })
148
+ }
149
+ });
150
+ const K = ({ blockProps: e, styles: t, href: o, content: n, target: c }) => /* @__PURE__ */ l.jsx(j, { ...e, ...t, href: o, target: c, children: n }), O = ({ blockProps: e, styles: t, content: o, children: n }) => /* @__PURE__ */ l.jsx("span", { ...e, ...t, children: n || o });
151
+ r(K, {
152
+ type: "Link",
153
+ label: "Link",
154
+ group: "basic",
155
+ category: "core",
156
+ icon: M,
157
+ blocks: [
158
+ {
159
+ _id: "a",
160
+ _type: "Link"
161
+ },
162
+ {
163
+ _id: "b",
164
+ _parent: "a",
165
+ _type: "RawText",
166
+ content: "I am a link."
167
+ }
168
+ ],
169
+ builderComponent: O,
170
+ props: {
171
+ content: a({ title: "Content", default: "I am a link." }),
172
+ link: g({ title: "Link", default: { href: "https://chaibuilder.com", target: "_blank", type: "url" } }),
173
+ styles: i({ default: "font-bold text-blue-500" })
174
+ },
175
+ canAcceptBlock: () => !0
176
+ });
177
+ const Q = ({ blockProps: e, styles: t, children: o }) => /* @__PURE__ */ l.jsx(w, { ...e, ...t, children: o }), X = ({ blockProps: e, styles: t, content: o }) => /* @__PURE__ */ l.jsx("div", { ...e, ...t, children: o });
178
+ r(Q, {
179
+ type: "Preview",
180
+ label: "Preview",
181
+ group: "basic",
182
+ category: "core",
183
+ builderComponent: X,
184
+ canAcceptBlock: () => !0,
185
+ canDuplicate: () => !1
186
+ });
187
+ const Y = ({ blockProps: e, content: t }) => /* @__PURE__ */ l.jsx(I, { children: t, ...e });
188
+ r(Y, {
189
+ type: "Markdown",
190
+ label: "Markdown",
191
+ group: "basic",
192
+ category: "core",
193
+ props: {
194
+ content: s({ default: "# This is a ~~strikethrough~~", title: "Markdown" })
195
+ }
196
+ });
197
+ const Z = ({ blockProps: e, styles: t, alt: o, image: n, width: c, height: u }) => /* @__PURE__ */ l.jsx(L, { ...e, ...t, src: n, alt: o, width: c, height: u }), ee = ({ blockProps: e, styles: t, alt: o, image: n, width: c, height: u }) => /* @__PURE__ */ l.jsx("img", { ...e, ...t, src: n, alt: o, width: c, height: u });
198
+ r(Z, {
199
+ type: "Image",
200
+ label: "Image",
201
+ group: "basic",
202
+ category: "core",
203
+ icon: p,
204
+ builderComponent: ee,
205
+ props: {
206
+ styles: i({ default: "w-full" }),
207
+ image: R({
208
+ title: "Image",
209
+ default: "https://fakeimg.pl/400x200?text=Choose&font=bebas"
210
+ }),
211
+ alt: a({ title: "Alt", default: "" }),
212
+ width: a({ title: "Width", default: "" }),
213
+ height: a({ title: "Height", default: "" })
214
+ }
215
+ });
216
+ const te = ({ blockProps: e, styles: t }) => /* @__PURE__ */ l.jsx(T, { ...e, ...t }), oe = ({ blockProps: e, styles: t }) => /* @__PURE__ */ l.jsx("hr", { ...e, ...t });
217
+ r(te, {
218
+ type: "Divider",
219
+ label: "Divider",
220
+ group: "basic",
221
+ category: "core",
222
+ icon: _,
223
+ builderComponent: oe,
224
+ props: {
225
+ styles: i({ default: "w-full h-2" })
226
+ }
227
+ });
228
+ const le = ({ blockProps: e, styles: t, code: o, lineNumbers: n, theme: c, language: u }) => /* @__PURE__ */ l.jsx(H, { ...e, ...t, code: o, linenumbers: n, theme: c, language: u }), ne = ({ blockProps: e, styles: t, code: o }) => /* @__PURE__ */ l.jsx("div", { ...e, ...t, children: /* @__PURE__ */ l.jsx("code", { children: o }) });
229
+ r(le, {
230
+ type: "CodeBlock",
231
+ label: "Code Block",
232
+ group: "basic",
233
+ category: "core",
234
+ hidden: !0,
235
+ icon: h,
236
+ builderComponent: ne,
237
+ props: {
238
+ styles: i({ default: "" }),
239
+ code: s({ title: "Code", default: "console.log('Hello, world!');" }),
240
+ theme: a({ title: "Theme", default: "dracula" }),
241
+ lineNumbers: S({
242
+ title: "Line number",
243
+ default: !1
244
+ }),
245
+ language: d({
246
+ title: "Language",
247
+ default: "javascript",
248
+ binding: !1,
249
+ options: [
250
+ { value: "javascript", title: "JavaScript" },
251
+ { value: "html", title: "HTML" },
252
+ { value: "css", title: "CSS" }
253
+ //add more options
254
+ ]
255
+ })
256
+ }
257
+ });
258
+ const re = ({ blockProps: e, styles: t, code: o }) => /* @__PURE__ */ l.jsx(A, { ...e, ...t, children: o }), ie = ({ blockProps: e, styles: t, code: o }) => /* @__PURE__ */ l.jsx("code", { ...e, ...t, children: o });
259
+ r(re, {
260
+ type: "CodeInline",
261
+ label: "Code Inline",
262
+ group: "basic",
263
+ category: "core",
264
+ icon: h,
265
+ builderComponent: ie,
28
266
  props: {
29
- styles: s({ default: "" })
267
+ styles: i({ default: "" }),
268
+ code: s({ title: "Code", default: "console.log('Hello, world!');" })
30
269
  }
31
270
  });
32
- const u = p;
271
+ const he = b;
33
272
  export {
34
- u as loadEmailBlocks
273
+ he as loadEmailBlocks
35
274
  };
@@ -2,7 +2,7 @@ import { j as u } from "./jsx-runtime-WbnYoNE9.js";
2
2
  import b from "@rjsf/core";
3
3
  import x from "@rjsf/validator-ajv8";
4
4
  import { includes as h, get as a, set as $, first as F } from "lodash-es";
5
- import { bc as P, bd as E, be as O, bf as S } from "./index-_OgCuSUz.js";
5
+ import { bc as P, bd as E, be as O, bf as S } from "./index-WKIG_VPl.js";
6
6
  const d = (i, l = "") => {
7
7
  switch (i.type) {
8
8
  case "singular":
@@ -1 +1 @@
1
- "use strict";const f=require("./jsx-runtime-Z_BpKhVy.cjs"),y=require("@rjsf/core"),E=require("@rjsf/validator-ajv8"),i=require("lodash-es"),d=require("./index-IIJ_o44s.cjs"),h=(c,n="")=>{switch(c.type){case"singular":return c.uiSchema;case"model":const{properties:p}=c,u={};return Object.keys(p).forEach(r=>{const e=p[r];if(i.includes(["slot","styles"],e.type))return;const o=i.get(e,"i18n",!1)?`${r}-${n}`:r;u[o]=h(e,n)}),u;case"list":const{itemProperties:m}=c,l={items:{}};return Object.keys(m).forEach(r=>{const e=m[r];if(i.includes(["slot","styles"],e.type))return;const o=i.get(e,"i18n",!1)?`${r}-${n}`:r;l.items[o]=h(e,n)}),l;default:return{}}},x=(c,n="")=>{switch(c.type){case"singular":return c.schema;case"model":const{properties:p,title:u}=c,m={title:u,type:"object",properties:{}};return Object.keys(p).forEach(o=>{const t=p[o];if(i.includes(["slot","styles"],t.type))return;const s=i.get(t,"i18n",!1)?`${o}-${n}`:o;m.properties[s]=x(t,n)}),m;case"list":const{itemProperties:l,title:r}=c,e={title:r,type:"array",items:{type:"object",properties:{}}};return Object.keys(l).forEach(o=>{const t=l[o];if(i.includes(["slot","styles"],t.type))return;const s=i.get(t,"i18n",!1)?`${o}-${n}`:o;e.items.properties[s]=x(t,n),i.set(e.items,"title",i.get(t,"itemTitle",`${r} item`))}),e;default:return{}}},$=({title:c,properties:n={},formData:p,onChange:u,disabled:m=!1,activeLang:l=""})=>{const r={type:"object",properties:{}},e={};Object.keys(n).forEach(t=>{const s=n[t];if(i.includes(["slot","styles"],s.type))return;const a=i.get(s,"i18n",!1)?`${t}-${l}`:t;r.properties[a]=x(s,l),e[a]=h(s,l)});const o=({...t},s)=>{const a=s==null?void 0:s.replace("root.","").split("/").pop();if(!s||!a)return;const j=i.first(a.split("."));s&&j&&u({...t},j)};return f.jsxRuntimeExports.jsxs(f.jsxRuntimeExports.Fragment,{children:[c&&f.jsxRuntimeExports.jsx("h1",{className:"px-1 text-sm font-semibold underline",children:c}),f.jsxRuntimeExports.jsx("div",{className:"-mx-3",children:f.jsxRuntimeExports.jsx(y,{widgets:{richtext:d.RichTextEditorField,icon:d.IconPickerField,image:d.ImagePickerField},fields:{link:d.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:e,schema:r,formData:p,validator:E,onChange:o,disabled:m})})]})};exports.Form=$;
1
+ "use strict";const f=require("./jsx-runtime-Z_BpKhVy.cjs"),y=require("@rjsf/core"),E=require("@rjsf/validator-ajv8"),i=require("lodash-es"),d=require("./index-98CxilGX.cjs"),h=(c,n="")=>{switch(c.type){case"singular":return c.uiSchema;case"model":const{properties:p}=c,u={};return Object.keys(p).forEach(r=>{const e=p[r];if(i.includes(["slot","styles"],e.type))return;const o=i.get(e,"i18n",!1)?`${r}-${n}`:r;u[o]=h(e,n)}),u;case"list":const{itemProperties:m}=c,l={items:{}};return Object.keys(m).forEach(r=>{const e=m[r];if(i.includes(["slot","styles"],e.type))return;const o=i.get(e,"i18n",!1)?`${r}-${n}`:r;l.items[o]=h(e,n)}),l;default:return{}}},x=(c,n="")=>{switch(c.type){case"singular":return c.schema;case"model":const{properties:p,title:u}=c,m={title:u,type:"object",properties:{}};return Object.keys(p).forEach(o=>{const t=p[o];if(i.includes(["slot","styles"],t.type))return;const s=i.get(t,"i18n",!1)?`${o}-${n}`:o;m.properties[s]=x(t,n)}),m;case"list":const{itemProperties:l,title:r}=c,e={title:r,type:"array",items:{type:"object",properties:{}}};return Object.keys(l).forEach(o=>{const t=l[o];if(i.includes(["slot","styles"],t.type))return;const s=i.get(t,"i18n",!1)?`${o}-${n}`:o;e.items.properties[s]=x(t,n),i.set(e.items,"title",i.get(t,"itemTitle",`${r} item`))}),e;default:return{}}},$=({title:c,properties:n={},formData:p,onChange:u,disabled:m=!1,activeLang:l=""})=>{const r={type:"object",properties:{}},e={};Object.keys(n).forEach(t=>{const s=n[t];if(i.includes(["slot","styles"],s.type))return;const a=i.get(s,"i18n",!1)?`${t}-${l}`:t;r.properties[a]=x(s,l),e[a]=h(s,l)});const o=({...t},s)=>{const a=s==null?void 0:s.replace("root.","").split("/").pop();if(!s||!a)return;const j=i.first(a.split("."));s&&j&&u({...t},j)};return f.jsxRuntimeExports.jsxs(f.jsxRuntimeExports.Fragment,{children:[c&&f.jsxRuntimeExports.jsx("h1",{className:"px-1 text-sm font-semibold underline",children:c}),f.jsxRuntimeExports.jsx("div",{className:"-mx-3",children:f.jsxRuntimeExports.jsx(y,{widgets:{richtext:d.RichTextEditorField,icon:d.IconPickerField,image:d.ImagePickerField},fields:{link:d.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:e,schema:r,formData:p,validator:E,onChange:o,disabled:m})})]})};exports.Form=$;
@@ -0,0 +1 @@
1
+ "use strict";const u=require("himalaya"),p=require("./utils-j7Kg63NR.cjs"),e=require("lodash-es"),o=require("./MODIFIERS-2FeVfZQ9.cjs"),T=t=>{const s=/(?: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/;return s.test(t)||r.test(t)},v=t=>{if(e.isEmpty(t))return t;const s=/<video[^>]+src=['"]([^'">]+)['"]/,r=/<iframe[^>]+src=['"]([^'">]+)['"]/,a=t.match(s),l=t.match(r),i=a?a[1]:l?l[1]:null,c=/(?: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/;return i&&(c.test(i)||n.test(i))?i:t},w={img:{alt:"alt",width:"width",height:"height",src:"image"},video:{src:"url",autoplay:"controls.autoPlay",muted:"controls.muted",loop:"controls.loop",controls:"controls.widgets"},a:{href:"link.href",target:"link.target",type:""},input:{placeholder:"placeholder",required:"required",type:"inputType",name:"fieldName"},textarea:{placeholder:"placeholder",required:"required",type:"inputType",name:"fieldName"},select:{placeholder:"placeholder",required:"required",multiple:"multiple",name:"fieldName"}},x=(t,s)=>t.children.length===1&&e.includes(["Heading","Paragraph","Span","ListItem","Button","Label","TableCell","Link"],s._type),h=t=>t.map(s=>s.type==="text"?e.get(s,"content",""):e.isEmpty(s.children)?"":h(s.children)).join(""),g=t=>t===null?!0:t,y=t=>{const s={},r=w[t.tagName]||{},a=t.attributes;return e.forEach(a,({key:l,value:i})=>{if(r[l]){if(t.tagName==="img"&&l==="src"&&!i.startsWith("http")){const c=e.find(t.attributes,{key:"width"}),n=e.find(t.attributes,{key:"height"});c&&n?i=`https://via.placeholder.com/${c==null?void 0:c.value}x${n==null?void 0:n.value}`:i="https://via.placeholder.com/150x150"}e.set(s,r[l],g(i))}else e.includes(["style","class","srcset"],l)||e.set(s,`styles_attrs.${l}`,g(i))}),delete s.class,s},S=(t,s="styles")=>{if(!t.attributes)return{[s]:`${o.STYLES_KEY},`};const r=e.find(t.attributes,{key:"class"});if(r){const a=r.value;return{[s]:`${o.STYLES_KEY},${a}`}}return{[s]:`${o.STYLES_KEY},`}},L=t=>{switch(t.tagName){case"img":return{_type:"Image"};case"input":return{_type:"Input",showLabel:!1};case"hr":return{_type:"Divider"};case"br":return{_type:"LineBreak"};case"textarea":return{_type:"TextArea",showLabel:!1};case"audio":return{_type:"Audio"};case"canvas":return{_type:"Canvas"};case"video":case"iframe":return{_type:"CustomHTML"};case"svg":return{_type:"Icon"};case"select":return{_type:"Select",options:[]};case"option":return{_type:"Option"};case"ul":case"ol":case"dl":return{_type:"List",tag:t.tagName,_listType:t.tagName==="ol"?"list-decimal":"list-none"};case"li":case"dt":return{_type:"ListItem",tag:t.tagName};case"span":case"figcaption":case"legend":return{_type:"Span",tag:t.tagName};case"p":return{_type:"Paragraph",content:""};case"a":return{_type:"Link"};case"form":return{_type:"Form"};case"label":return{_type:"Label"};case"button":return{_type:"Button"};case"code":return{_type:"Code"};case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return{_type:"Heading",tag:t.tagName};case"table":return{_type:"Table"};case"tr":return{_type:"TableRow"};case"td":case"th":return{_type:"TableCell",tag:t.tagName};case"thead":return{_type:"TableHead"};case"tbody":return{_type:"TableBody"};case"tfoot":return{_type:"TableFooter"};default:return{_type:"Box",tag:t.tagName,_name:t.tagName==="div"?"Box":e.capitalize(t.tagName)}}},m=(t,s=null)=>e.flatMapDeep(t,r=>{var i;if(r.type==="comment")return[];let a={_id:p.generateUUID()};if(s&&(a._parent=s.block._id),r.type==="text")return e.isEmpty(e.get(r,"content",""))?[]:s&&x(s.node,s.block)?(e.set(s,"block.content",e.get(r,"content","")),[]):{...a,_type:"Text",content:e.get(r,"content","")};if(a={...a,...L(r),...y(r),...S(r)},a._type==="Input"){const c=a.inputType||"text";c==="checkbox"?e.set(a,"_type","Checkbox"):c==="radio"&&e.set(a,"_type","Radio")}else if(r.tagName==="video"||r.tagName==="iframe"){const c=u.stringify([r]);return T(c)&&(e.set(a,"_type","Video"),e.set(a,"url",v(c)),e.set(a,"styles",`${o.STYLES_KEY},absolute top-0 left-0 w-full h-full`),e.set(a,"controls",{autoPlay:!1,muted:!0,loop:!1,controls:!1})),a.content=c,[a]}else if(r.tagName==="svg"){const c=e.find(r.attributes,{key:"height"}),n=e.find(r.attributes,{key:"width"}),f=e.get(c,"value")?`[${e.get(c,"value")}px]`:"24px",d=e.get(n,"value")?`[${e.get(n,"value")}px]`:"24px",b=e.get(e.find(r.attributes,{key:"class"}),"value","w-full h-full");return a.styles=`${o.STYLES_KEY}, ${p.cn$1(`w-${d} h-${f}`,b)}`.trim(),r.attributes=e.filter(r.attributes,_=>!e.includes(["style","width","height","class"],_.key)),a.icon=u.stringify([r]),e.set(a,"styles_attrs",e.omit(e.get(a,"styles_attrs")||{},["height","width","style","class"])),[a]}else if(r.tagName=="option"&&s&&((i=s.block)==null?void 0:i._type)==="Select")return s.block.options.push({label:h(r.children),...y(r)}),[];const l=m(r.children,{block:a,node:r});return[a,...l]}),N=t=>{const s=t.match(/<body[^>]*>[\s\S]*?<\/body>/);return(s&&s.length>0?s[0].replace(/<body/,"<div").replace(/<\/body>/,"</div>"):t).replace(/\s+/g," ").replaceAll("> <","><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").trim()},k=t=>{const s=u.parse(N(t));return e.isEmpty(t)?[]:e.flatten(m(s))};exports.getBlocksFromHTML=k;
@@ -1,17 +1,16 @@
1
1
  import { stringify as m, parse as x } from "himalaya";
2
- import { g as N, c as k } from "./Functions-7jnEwJyw.js";
3
- import { includes as y, get as l, isEmpty as g, forEach as L, find as u, set as o, capitalize as S, flatMapDeep as $, filter as C, flatten as A } from "lodash-es";
2
+ import { g as N, d as k } from "./utils-Jw11nj1S.js";
3
+ import { isEmpty as y, includes as g, get as l, forEach as L, find as u, set as n, capitalize as S, flatMapDeep as $, filter as C, omit as A, flatten as R } from "lodash-es";
4
4
  import { a as p } from "./MODIFIERS-RiXS5Mn1.js";
5
- import { isEmpty as R, omit as B } from "lodash";
6
- const H = (t) => {
5
+ const B = (t) => {
7
6
  const e = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, a = /(?:https?:\/\/)?(?:www\.)?(player)?.vimeo\.com/;
8
7
  return e.test(t) || a.test(t);
9
- }, M = (t) => {
10
- if (R(t))
8
+ }, H = (t) => {
9
+ if (y(t))
11
10
  return t;
12
- const e = /<video[^>]+src=['"]([^'">]+)['"]/, a = /<iframe[^>]+src=['"]([^'">]+)['"]/, r = t.match(e), i = t.match(a), c = r ? r[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/;
13
- return c && (s.test(c) || n.test(c)) ? c : t;
14
- }, E = {
11
+ const e = /<video[^>]+src=['"]([^'">]+)['"]/, a = /<iframe[^>]+src=['"]([^'">]+)['"]/, r = t.match(e), i = t.match(a), c = r ? r[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})/, o = /(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;
12
+ return c && (s.test(c) || o.test(c)) ? c : t;
13
+ }, M = {
15
14
  img: { alt: "alt", width: "width", height: "height", src: "image" },
16
15
  video: {
17
16
  src: "url",
@@ -44,17 +43,17 @@ const H = (t) => {
44
43
  multiple: "multiple",
45
44
  name: "fieldName"
46
45
  }
47
- }, I = (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) => {
48
- const e = {}, a = E[t.tagName] || {}, r = t.attributes;
46
+ }, I = (t, e) => t.children.length === 1 && g(["Heading", "Paragraph", "Span", "ListItem", "Button", "Label", "TableCell", "Link"], e._type), b = (t) => t.map((e) => e.type === "text" ? l(e, "content", "") : y(e.children) ? "" : b(e.children)).join(""), h = (t) => t === null ? !0 : t, f = (t) => {
47
+ const e = {}, a = M[t.tagName] || {}, r = t.attributes;
49
48
  return L(r, ({ key: i, value: c }) => {
50
49
  if (a[i]) {
51
50
  if (t.tagName === "img" && i === "src" && !c.startsWith("http")) {
52
- const s = u(t.attributes, { key: "width" }), n = u(t.attributes, { key: "height" });
53
- 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";
51
+ const s = u(t.attributes, { key: "width" }), o = u(t.attributes, { key: "height" });
52
+ s && o ? c = `https://via.placeholder.com/${s == null ? void 0 : s.value}x${o == null ? void 0 : o.value}` : c = "https://via.placeholder.com/150x150";
54
53
  }
55
- o(e, a[i], h(c));
54
+ n(e, a[i], h(c));
56
55
  } else
57
- y(["style", "class", "srcset"], i) || o(e, `styles_attrs.${i}`, h(c));
56
+ g(["style", "class", "srcset"], i) || n(e, `styles_attrs.${i}`, h(c));
58
57
  }), delete e.class, e;
59
58
  }, q = (t, e = "styles") => {
60
59
  if (!t.attributes)
@@ -65,7 +64,7 @@ const H = (t) => {
65
64
  return { [e]: `${p},${r}` };
66
65
  }
67
66
  return { [e]: `${p},` };
68
- }, P = (t) => {
67
+ }, E = (t) => {
69
68
  switch (t.tagName) {
70
69
  case "img":
71
70
  return { _type: "Image" };
@@ -150,21 +149,21 @@ const H = (t) => {
150
149
  return [];
151
150
  let r = { _id: N() };
152
151
  if (e && (r._parent = e.block._id), a.type === "text")
153
- return g(l(a, "content", "")) ? [] : e && I(e.node, e.block) ? (o(e, "block.content", l(a, "content", "")), []) : { ...r, _type: "Text", content: l(a, "content", "") };
152
+ return y(l(a, "content", "")) ? [] : e && I(e.node, e.block) ? (n(e, "block.content", l(a, "content", "")), []) : { ...r, _type: "Text", content: l(a, "content", "") };
154
153
  if (r = {
155
154
  ...r,
156
- ...P(a),
155
+ ...E(a),
157
156
  ...f(a),
158
157
  ...q(a)
159
158
  }, r._type === "Input") {
160
159
  const s = r.inputType || "text";
161
- s === "checkbox" ? o(r, "_type", "Checkbox") : s === "radio" && o(r, "_type", "Radio");
160
+ s === "checkbox" ? n(r, "_type", "Checkbox") : s === "radio" && n(r, "_type", "Radio");
162
161
  } else if (a.tagName === "video" || a.tagName === "iframe") {
163
162
  const s = m([a]);
164
- return H(s) && (o(r, "_type", "Video"), o(r, "url", M(s)), o(r, "styles", `${p},absolute top-0 left-0 w-full h-full`), o(r, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), r.content = s, [r];
163
+ return B(s) && (n(r, "_type", "Video"), n(r, "url", H(s)), n(r, "styles", `${p},absolute top-0 left-0 w-full h-full`), n(r, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), r.content = s, [r];
165
164
  } else if (a.tagName === "svg") {
166
- const s = u(a.attributes, { key: "height" }), n = u(a.attributes, { key: "width" }), _ = l(s, "value") ? `[${l(s, "value")}px]` : "24px", v = l(n, "value") ? `[${l(n, "value")}px]` : "24px", T = l(u(a.attributes, { key: "class" }), "value", "w-full h-full");
167
- return r.styles = `${p}, ${k(`w-${v} h-${_}`, T)}`.trim(), a.attributes = C(a.attributes, (w) => !y(["style", "width", "height", "class"], w.key)), r.icon = m([a]), o(r, "styles_attrs", B(l(r, "styles_attrs") || {}, ["height", "width", "style", "class"])), [r];
165
+ const s = u(a.attributes, { key: "height" }), o = u(a.attributes, { key: "width" }), _ = l(s, "value") ? `[${l(s, "value")}px]` : "24px", v = l(o, "value") ? `[${l(o, "value")}px]` : "24px", T = l(u(a.attributes, { key: "class" }), "value", "w-full h-full");
166
+ return r.styles = `${p}, ${k(`w-${v} h-${_}`, T)}`.trim(), a.attributes = C(a.attributes, (w) => !g(["style", "width", "height", "class"], w.key)), r.icon = m([a]), n(r, "styles_attrs", A(l(r, "styles_attrs") || {}, ["height", "width", "style", "class"])), [r];
168
167
  } else if (a.tagName == "option" && e && ((c = e.block) == null ? void 0 : c._type) === "Select")
169
168
  return e.block.options.push({
170
169
  label: b(a.children),
@@ -172,13 +171,13 @@ const H = (t) => {
172
171
  }), [];
173
172
  const i = d(a.children, { block: r, node: a });
174
173
  return [r, ...i];
175
- }), z = (t) => {
174
+ }), P = (t) => {
176
175
  const e = t.match(/<body[^>]*>[\s\S]*?<\/body>/);
177
176
  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();
178
- }, Y = (t) => {
179
- const e = x(z(t));
180
- return g(t) ? [] : A(d(e));
177
+ }, D = (t) => {
178
+ const e = x(P(t));
179
+ return y(t) ? [] : R(d(e));
181
180
  };
182
181
  export {
183
- Y as g
182
+ D as g
184
183
  };