@chaibuilder/sdk 1.2.63 → 1.2.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CanvasArea-fSdH_RiN.cjs +1 -0
- package/dist/{CanvasArea-DvfLxy0w.js → CanvasArea-ut5yknzX.js} +58 -54
- package/dist/{CodeEditor-QPwyZNgA.js → CodeEditor-Qff4q7sx.js} +1 -1
- package/dist/{CurrentPage-rOUX01kk.js → CurrentPage-jHSVy3hq.js} +38 -26
- package/dist/CurrentPage-p_AM4lrF.cjs +1 -0
- package/dist/{PagesPanel-6P4VkMP-.js → PagesPanel-U3InJ9Db.js} +20 -8
- package/dist/PagesPanel-wqDb4D-x.cjs +1 -0
- package/dist/{ProjectPanel-Cn3teDRW.js → ProjectPanel-XODJTO4J.js} +36 -24
- package/dist/ProjectPanel-fWESzHr6.cjs +1 -0
- package/dist/{SidePanels-_Im6sF4f.js → SidePanels-ijaUKSek.js} +84 -70
- package/dist/SidePanels-lrMQqc0h.cjs +1 -0
- package/dist/Topbar-RrCDxd0i.cjs +1 -0
- package/dist/{Topbar-SuY-S0im.js → Topbar-vHlnfxPs.js} +45 -30
- package/dist/UILibrariesPanel-7btHgBD0.cjs +1 -0
- package/dist/{UILibrariesPanel-RI9mo293.js → UILibrariesPanel-NVUMUPUj.js} +83 -63
- package/dist/{UnsplashImages-dasLGrBn.js → UnsplashImages-UkHihhA5.js} +16 -16
- package/dist/{UploadImages-Gh2AQpk1.js → UploadImages-HtuJZJlo.js} +7 -7
- package/dist/add-page-modal-RwIj1FxH.cjs +1 -0
- package/dist/{add-page-modal-zCiyvKEa.js → add-page-modal-TOfMfmPA.js} +32 -23
- package/dist/{confirm-alert-9XYi0a4k.js → confirm-alert-eIp2cAkc.js} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +10 -7
- package/dist/core.js +74 -59
- package/dist/{delete-page-modal-pzagU_6y.js → delete-page-modal-4bxjpVBD.js} +33 -21
- package/dist/delete-page-modal-qYDZmpgT.cjs +1 -0
- package/dist/email.cjs +1 -1
- package/dist/email.js +20 -5
- package/dist/{form-EjiQiiEY.js → form-NAzFjGs0.js} +9 -9
- package/dist/html-to-json-NqRjgFqp.cjs +1 -0
- package/dist/html-to-json-l_mw5y-e.js +243 -0
- package/dist/{index-DzAuS11k.cjs → index--k2M8kzI.cjs} +1 -1
- package/dist/{index-BbW1Uw_k.cjs → index-5XyNUAjc.cjs} +81 -22
- package/dist/{index-bscJUvUx.js → index-C7mB4XFm.js} +117 -117
- package/dist/{index-qSbpzIA4.js → index-YZhtVcj_.js} +4 -4
- package/dist/{index-EEcKvBh3.js → index-lFgDm1oa.js} +48587 -45055
- package/dist/lib.cjs +2 -2
- package/dist/lib.js +22 -22
- package/dist/page-viewer-4wrnWnK0.js +124 -0
- package/dist/page-viewer-ra0GLx1p.cjs +1 -0
- package/dist/{project-general-setting-5B7s5swF.js → project-general-setting-IwZUkYF3.js} +18 -9
- package/dist/project-general-setting-lFjTUhHD.cjs +1 -0
- package/dist/{project-seo-setting-aAGnwBrw.js → project-seo-setting-e1fTqVsd.js} +2 -2
- package/dist/{single-page-detail-Yr0EbBJJ.js → single-page-detail-ZNWFKqLW.js} +69 -60
- package/dist/single-page-detail-g55Anu7R.cjs +1 -0
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +18 -6
- package/dist/style.css +2 -2
- package/dist/ui.js +67 -67
- package/package.json +1 -1
- package/dist/AddBlocks-4wpxOF2K.cjs +0 -1
- package/dist/AddBlocks-ChNxwRrx.js +0 -142
- package/dist/CanvasArea-hGLbDJlM.cjs +0 -1
- package/dist/CurrentPage-fMCaBGwl.cjs +0 -1
- package/dist/PagesPanel-ZCZjs7Bi.cjs +0 -1
- package/dist/ProjectPanel-XSVWRr6v.cjs +0 -1
- package/dist/Settings-Amh8Mtm7.cjs +0 -1
- package/dist/Settings-dbB2VPAj.js +0 -2378
- package/dist/SidePanels-5adH7U3T.cjs +0 -1
- package/dist/StaticCanvas-fDhBK35X.cjs +0 -60
- package/dist/StaticCanvas-goU42OMU.js +0 -749
- package/dist/ThemeConfigPanel-N6l317II.cjs +0 -1
- package/dist/ThemeConfigPanel-aEN4tTYi.js +0 -191
- package/dist/Topbar-ag6qdgbe.cjs +0 -1
- package/dist/UILibrariesPanel-03Y3F3A_.cjs +0 -1
- package/dist/add-page-modal-80cVOM7i.cjs +0 -1
- package/dist/atoms-KQpaDRnF.cjs +0 -1
- package/dist/atoms-Oomqut88.js +0 -6
- package/dist/delete-page-modal-foPRP--l.cjs +0 -1
- package/dist/html-to-json-_01DXd-a.js +0 -192
- package/dist/html-to-json-ndxaXRT8.cjs +0 -1
- package/dist/index-e0c8PmRQ.js +0 -205
- package/dist/index-gi1LIOCw.cjs +0 -1
- package/dist/page-viewer-XFTCHu_2.cjs +0 -1
- package/dist/page-viewer-Z1wXyzzc.js +0 -112
- package/dist/plugin-2hf9pCRy.cjs +0 -1
- package/dist/plugin-wDnsBVPp.js +0 -54
- package/dist/project-general-setting-HV3X_wHI.cjs +0 -1
- package/dist/single-page-detail-6C1WP3s5.cjs +0 -1
package/dist/core.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import "
|
|
3
|
-
import {
|
|
4
|
-
import { useTranslation as js } from "react-i18next";
|
|
1
|
+
import { A as ps, e as ms, B as ls, S as us, C as ds, L as cs, T as Bs, U as ks } from "./index-lFgDm1oa.js";
|
|
2
|
+
import { bi as Cs, bu as bs, U as Ss, bv as gs, aC as Ps, bt as vs, i as ys, X as As, h as hs, u as Is, J as Rs, R as Us, ak as Ds, bj as Ms, bk as Ts, bl as fs, bm as xs, Y as Hs, n as Os, bn as js, bo as Es, V as Fs, bp as Ls, a2 as qs, bh as ws, k as zs, aD as Gs, b9 as Js, l as Ks, bq as Ns, aH as Vs, j as Ws, aN as Xs, K as Ys, z as Zs, br as Qs, aI as _s, bs as $s, F as so, y as oo, at as eo } from "./index-C7mB4XFm.js";
|
|
3
|
+
import { useTranslation as ao } from "react-i18next";
|
|
5
4
|
import "i18next";
|
|
6
5
|
import "./jsx-runtime-WbnYoNE9.js";
|
|
7
6
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
7
|
+
import "react";
|
|
8
8
|
import "jotai";
|
|
9
9
|
import "@react-hookz/web";
|
|
10
10
|
import "react-arborist";
|
|
@@ -16,15 +16,31 @@ import "@radix-ui/react-icons";
|
|
|
16
16
|
import "lucide-react";
|
|
17
17
|
import "./index-VBXQixVm.js";
|
|
18
18
|
import "react-dom";
|
|
19
|
-
import "
|
|
19
|
+
import "prop-types";
|
|
20
|
+
import "react-quill";
|
|
21
|
+
import "react-hotkeys-hook";
|
|
22
|
+
import "@floating-ui/dom";
|
|
20
23
|
import "@floating-ui/react-dom";
|
|
21
24
|
import "flagged";
|
|
22
|
-
import "
|
|
25
|
+
import "@tailwindcss/typography";
|
|
26
|
+
import "@tailwindcss/forms";
|
|
27
|
+
import "@tailwindcss/aspect-ratio";
|
|
28
|
+
import "tailwindcss-palette-generator";
|
|
29
|
+
import "./html-to-json-l_mw5y-e.js";
|
|
30
|
+
import "himalaya";
|
|
31
|
+
import "./MODIFIERS-fd5XOmum.js";
|
|
32
|
+
import "lodash";
|
|
23
33
|
import "@chaibuilder/runtime";
|
|
34
|
+
import "react-wrap-balancer";
|
|
35
|
+
import "@rjsf/core";
|
|
36
|
+
import "@rjsf/validator-ajv8";
|
|
37
|
+
import "react-autosuggest";
|
|
38
|
+
import "fuse.js";
|
|
39
|
+
import "./utils-VpVqnC9m.js";
|
|
40
|
+
import "./controls-yjgoZzB6.js";
|
|
41
|
+
import "@radix-ui/react-scroll-area";
|
|
24
42
|
import "@radix-ui/react-toggle";
|
|
25
43
|
import "class-variance-authority";
|
|
26
|
-
import "./utils-VpVqnC9m.js";
|
|
27
|
-
import "./MODIFIERS-fd5XOmum.js";
|
|
28
44
|
import "@radix-ui/react-switch";
|
|
29
45
|
import "@radix-ui/react-slot";
|
|
30
46
|
import "@radix-ui/react-accordion";
|
|
@@ -43,57 +59,56 @@ import "@radix-ui/react-toast";
|
|
|
43
59
|
import "cmdk";
|
|
44
60
|
import "@radix-ui/react-context-menu";
|
|
45
61
|
import "react-icons-picker";
|
|
46
|
-
import "react-quill";
|
|
47
62
|
import "tree-model";
|
|
48
63
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
64
|
+
ps as AddBlocksPanel,
|
|
65
|
+
ms as BlockSettings,
|
|
66
|
+
ls as Breakpoints,
|
|
67
|
+
us as BuilderCanvas,
|
|
68
|
+
ds as ChaiBuilderEditor,
|
|
69
|
+
cs as Outline,
|
|
70
|
+
Bs as ThemeConfigPanel,
|
|
71
|
+
ks as UndoRedo,
|
|
72
|
+
Cs as useActiveModal,
|
|
73
|
+
bs as useActivePanel,
|
|
74
|
+
Ss as useAddBlock,
|
|
75
|
+
gs as useAddBlockParent,
|
|
76
|
+
Ps as useAddClassesToBlocks,
|
|
77
|
+
vs as useAllBlocks,
|
|
78
|
+
ys as useBlocksStore,
|
|
79
|
+
As as useBrandingOptions,
|
|
80
|
+
hs as useBuilderProp,
|
|
81
|
+
Is as useBuilderReset,
|
|
82
|
+
Rs as useCanvasWidth,
|
|
83
|
+
Us as useCanvasZoom,
|
|
84
|
+
Ds as useCodeEditor,
|
|
85
|
+
Ms as useCopyBlockIds,
|
|
86
|
+
Ts as useCopyToClipboard,
|
|
87
|
+
fs as useCurrentPage,
|
|
88
|
+
xs as useCutBlockIds,
|
|
89
|
+
Hs as useDarkMode,
|
|
90
|
+
Os as useDuplicateBlocks,
|
|
91
|
+
js as useGetPageData,
|
|
92
|
+
Es as useHiddenBlockIds,
|
|
93
|
+
Fs as useHighlightBlockId,
|
|
94
|
+
Ls as usePasteBlocks,
|
|
95
|
+
qs as usePreviewMode,
|
|
96
|
+
ws as useReadOnlyMode,
|
|
97
|
+
zs as useRemoveBlocks,
|
|
98
|
+
Gs as useRemoveClassesFromBlocks,
|
|
99
|
+
Js as useSavePage,
|
|
100
|
+
Ks as useSelectedBlock,
|
|
101
|
+
Ns as useSelectedBlockAllClasses,
|
|
102
|
+
Vs as useSelectedBlockCurrentClasses,
|
|
103
|
+
Ws as useSelectedBlockIds,
|
|
104
|
+
Xs as useSelectedBlocksDisplayChild,
|
|
105
|
+
Ys as useSelectedBreakpoints,
|
|
106
|
+
Zs as useSelectedStylingBlocks,
|
|
107
|
+
Qs as useStylingBreakpoint,
|
|
108
|
+
_s as useStylingState,
|
|
109
|
+
ao as useTranslation,
|
|
110
|
+
$s as useUILibraryBlocks,
|
|
111
|
+
so as useUndoManager,
|
|
112
|
+
oo as useUpdateBlocksProps,
|
|
113
|
+
eo as useUpdateBlocksPropsRealtime
|
|
99
114
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { A as
|
|
3
|
-
import { h } from "./index-
|
|
1
|
+
import { j as r } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
+
import { A as s, a as l, b as n, d, e as a, g as c, B as u } from "./index-C7mB4XFm.js";
|
|
3
|
+
import { h } from "./index-YZhtVcj_.js";
|
|
4
4
|
import { TrashIcon as x } from "@radix-ui/react-icons";
|
|
5
5
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
6
6
|
import "react";
|
|
@@ -38,48 +38,60 @@ import "jotai";
|
|
|
38
38
|
import "@react-hookz/web";
|
|
39
39
|
import "tree-model";
|
|
40
40
|
import "react-i18next";
|
|
41
|
-
import "./index-
|
|
41
|
+
import "./index-lFgDm1oa.js";
|
|
42
42
|
import "i18next";
|
|
43
43
|
import "react-arborist";
|
|
44
44
|
import "lucide-react";
|
|
45
45
|
import "./index-VBXQixVm.js";
|
|
46
|
+
import "prop-types";
|
|
47
|
+
import "react-hotkeys-hook";
|
|
48
|
+
import "@floating-ui/dom";
|
|
46
49
|
import "@floating-ui/react-dom";
|
|
47
50
|
import "flagged";
|
|
48
|
-
import "
|
|
49
|
-
import "
|
|
50
|
-
import "
|
|
51
|
+
import "@tailwindcss/typography";
|
|
52
|
+
import "@tailwindcss/forms";
|
|
53
|
+
import "@tailwindcss/aspect-ratio";
|
|
54
|
+
import "tailwindcss-palette-generator";
|
|
55
|
+
import "./html-to-json-l_mw5y-e.js";
|
|
51
56
|
import "himalaya";
|
|
52
57
|
import "lodash";
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
import "react-wrap-balancer";
|
|
59
|
+
import "@rjsf/core";
|
|
60
|
+
import "@rjsf/validator-ajv8";
|
|
61
|
+
import "react-autosuggest";
|
|
62
|
+
import "fuse.js";
|
|
63
|
+
import "./controls-yjgoZzB6.js";
|
|
64
|
+
import "sonner";
|
|
65
|
+
const Tr = ({ pageData: t, projectData: i }) => {
|
|
66
|
+
const m = {}, e = h(), o = t.uuid === i.homepage, p = () => {
|
|
67
|
+
e.mutate(t, {
|
|
56
68
|
onSuccess: () => {
|
|
57
69
|
m({ uuid: i.homepage, slug: "/home" });
|
|
58
70
|
}
|
|
59
71
|
});
|
|
60
72
|
};
|
|
61
|
-
return /* @__PURE__ */
|
|
62
|
-
/* @__PURE__ */
|
|
73
|
+
return /* @__PURE__ */ r.jsxs(s, { children: [
|
|
74
|
+
/* @__PURE__ */ r.jsx(l, { disabled: o, children: /* @__PURE__ */ r.jsx(
|
|
63
75
|
"div",
|
|
64
76
|
{
|
|
65
77
|
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"}`,
|
|
66
|
-
children: /* @__PURE__ */
|
|
78
|
+
children: /* @__PURE__ */ r.jsx(x, {})
|
|
67
79
|
}
|
|
68
80
|
) }),
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
/* @__PURE__ */
|
|
81
|
+
/* @__PURE__ */ r.jsxs(n, { children: [
|
|
82
|
+
/* @__PURE__ */ r.jsxs(d, { children: [
|
|
71
83
|
"Are you sure you want to delete ",
|
|
72
|
-
/* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ r.jsx("i", { className: "text-red-500", children: t.name }),
|
|
73
85
|
" page?"
|
|
74
86
|
] }),
|
|
75
|
-
/* @__PURE__ */
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ r.jsx(a, { children: "This action cannot be undone. This will permanently delete your page." }),
|
|
88
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex items-center justify-end gap-x-3", children: [
|
|
89
|
+
/* @__PURE__ */ r.jsx(c, { disabled: e.isPending, children: "Cancel" }),
|
|
90
|
+
/* @__PURE__ */ r.jsx(u, { variant: "destructive", onClick: p, disabled: e.isPending, children: "Yes, Delete" })
|
|
79
91
|
] })
|
|
80
92
|
] })
|
|
81
93
|
] });
|
|
82
94
|
};
|
|
83
95
|
export {
|
|
84
|
-
|
|
96
|
+
Tr as default
|
|
85
97
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("./index-aeDphKpP.cjs"),o=require("./index--k2M8kzI.cjs"),l=require("@radix-ui/react-icons");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("lodash-es");require("./MODIFIERS-mVmfEGgo.cjs");require("clsx");require("tailwind-merge");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("./Functions-N3yhPYKY.cjs");require("@chaibuilder/runtime");require("jotai");require("@react-hookz/web");require("tree-model");require("react-i18next");require("./index-5XyNUAjc.cjs");require("i18next");require("react-arborist");require("lucide-react");require("./index--mLLy7QQ.cjs");require("prop-types");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("flagged");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("./html-to-json-NqRjgFqp.cjs");require("himalaya");require("lodash");require("react-wrap-balancer");require("@rjsf/core");require("@rjsf/validator-ajv8");require("react-autosuggest");require("fuse.js");require("./controls-rRZhz0vu.cjs");require("sonner");const d=({pageData:i,projectData:t})=>{const n={},u=o.useDeletePage(),s=i.uuid===t.homepage,q=()=>{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(l.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:q,disabled:u.isPending,children:"Yes, Delete"})]})]})]})};exports.default=d;
|
package/dist/email.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),t=require("./index-5XyNUAjc.cjs"),r=require("@radix-ui/react-icons"),o=require("lodash-es");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");require("i18next");require("react-i18next");require("jotai");require("@react-hookz/web");require("react-arborist");require("./index-aeDphKpP.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("./MODIFIERS-mVmfEGgo.cjs");require("clsx");require("tailwind-merge");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("./Functions-N3yhPYKY.cjs");require("@chaibuilder/runtime");require("tree-model");require("lucide-react");require("./index--mLLy7QQ.cjs");require("prop-types");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("flagged");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("./html-to-json-NqRjgFqp.cjs");require("himalaya");require("lodash");require("react-wrap-balancer");require("@rjsf/core");require("@rjsf/validator-ajv8");require("react-autosuggest");require("fuse.js");require("./controls-rRZhz0vu.cjs");const n=[{title:"Mobile",content:"Mobile email client",breakpoint:"xs",icon:e.jsxRuntimeExports.jsx(r.MobileIcon,{}),width:400},{title:"Email Client",content:"Content as seen inside an email client",breakpoint:"sm",icon:e.jsxRuntimeExports.jsx(r.MobileIcon,{className:"rotate-90"}),width:700}],s=i=>{const u={...i,filterChaiBlock:q=>o.includes(q.type,"Email/"),importHTMLSupport:!1,dataBindingSupport:!1,breakpoints:n};return e.jsxRuntimeExports.jsx(t.ChaiBuilderEditor,{...u})};exports.ChaiBuilderEmail=s;
|
package/dist/email.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as i } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { C as p } from "./index-
|
|
2
|
+
import { C as p } from "./index-lFgDm1oa.js";
|
|
3
3
|
import { MobileIcon as t } from "@radix-ui/react-icons";
|
|
4
4
|
import { includes as e } from "lodash-es";
|
|
5
5
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
@@ -9,7 +9,7 @@ import "react-i18next";
|
|
|
9
9
|
import "jotai";
|
|
10
10
|
import "@react-hookz/web";
|
|
11
11
|
import "react-arborist";
|
|
12
|
-
import "./index-
|
|
12
|
+
import "./index-C7mB4XFm.js";
|
|
13
13
|
import "@radix-ui/react-toggle";
|
|
14
14
|
import "class-variance-authority";
|
|
15
15
|
import "./utils-VpVqnC9m.js";
|
|
@@ -42,9 +42,24 @@ import "@chaibuilder/runtime";
|
|
|
42
42
|
import "tree-model";
|
|
43
43
|
import "lucide-react";
|
|
44
44
|
import "./index-VBXQixVm.js";
|
|
45
|
+
import "prop-types";
|
|
46
|
+
import "react-hotkeys-hook";
|
|
47
|
+
import "@floating-ui/dom";
|
|
45
48
|
import "@floating-ui/react-dom";
|
|
46
49
|
import "flagged";
|
|
47
|
-
import "
|
|
50
|
+
import "@tailwindcss/typography";
|
|
51
|
+
import "@tailwindcss/forms";
|
|
52
|
+
import "@tailwindcss/aspect-ratio";
|
|
53
|
+
import "tailwindcss-palette-generator";
|
|
54
|
+
import "./html-to-json-l_mw5y-e.js";
|
|
55
|
+
import "himalaya";
|
|
56
|
+
import "lodash";
|
|
57
|
+
import "react-wrap-balancer";
|
|
58
|
+
import "@rjsf/core";
|
|
59
|
+
import "@rjsf/validator-ajv8";
|
|
60
|
+
import "react-autosuggest";
|
|
61
|
+
import "fuse.js";
|
|
62
|
+
import "./controls-yjgoZzB6.js";
|
|
48
63
|
const n = [
|
|
49
64
|
{
|
|
50
65
|
title: "Mobile",
|
|
@@ -60,7 +75,7 @@ const n = [
|
|
|
60
75
|
icon: /* @__PURE__ */ i.jsx(t, { className: "rotate-90" }),
|
|
61
76
|
width: 700
|
|
62
77
|
}
|
|
63
|
-
],
|
|
78
|
+
], bi = (o) => {
|
|
64
79
|
const r = {
|
|
65
80
|
...o,
|
|
66
81
|
filterChaiBlock: (m) => e(m.type, "Email/"),
|
|
@@ -71,5 +86,5 @@ const n = [
|
|
|
71
86
|
return /* @__PURE__ */ i.jsx(p, { ...r });
|
|
72
87
|
};
|
|
73
88
|
export {
|
|
74
|
-
|
|
89
|
+
bi as ChaiBuilderEmail
|
|
75
90
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { j as u } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { includes as h, get as a, set as
|
|
5
|
-
import {
|
|
2
|
+
import x from "@rjsf/core";
|
|
3
|
+
import $ from "@rjsf/validator-ajv8";
|
|
4
|
+
import { includes as h, get as a, set as F, first as P } from "lodash-es";
|
|
5
|
+
import { an as b, ao as E, ap as O, aq as S } from "./index-C7mB4XFm.js";
|
|
6
6
|
const d = (i, l = "") => {
|
|
7
7
|
switch (i.type) {
|
|
8
8
|
case "singular":
|
|
@@ -61,7 +61,7 @@ const d = (i, l = "") => {
|
|
|
61
61
|
if (h(["slot", "styles"], t.type))
|
|
62
62
|
return;
|
|
63
63
|
const s = a(t, "i18n", !1) ? `${o}-${l}` : o;
|
|
64
|
-
e.items.properties[s] = y(t, l),
|
|
64
|
+
e.items.properties[s] = y(t, l), F(e.items, "title", a(t, "itemTitle", `${r} item`));
|
|
65
65
|
}), e;
|
|
66
66
|
default:
|
|
67
67
|
return {};
|
|
@@ -89,16 +89,16 @@ const d = (i, l = "") => {
|
|
|
89
89
|
const f = s == null ? void 0 : s.replace("root.", "").split("/").pop();
|
|
90
90
|
if (!s || !f)
|
|
91
91
|
return;
|
|
92
|
-
const j =
|
|
92
|
+
const j = P(f.split("."));
|
|
93
93
|
s && j && m({ ...t }, j);
|
|
94
94
|
};
|
|
95
95
|
return /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
|
96
96
|
i && /* @__PURE__ */ u.jsx("h1", { className: "px-1 text-sm font-semibold underline", children: i }),
|
|
97
97
|
/* @__PURE__ */ u.jsx("div", { className: "-mx-3", children: /* @__PURE__ */ u.jsx(
|
|
98
|
-
|
|
98
|
+
x,
|
|
99
99
|
{
|
|
100
100
|
widgets: {
|
|
101
|
-
richtext:
|
|
101
|
+
richtext: b,
|
|
102
102
|
icon: E,
|
|
103
103
|
image: O
|
|
104
104
|
},
|
|
@@ -113,7 +113,7 @@ const d = (i, l = "") => {
|
|
|
113
113
|
uiSchema: e,
|
|
114
114
|
schema: r,
|
|
115
115
|
formData: c,
|
|
116
|
-
validator:
|
|
116
|
+
validator: $,
|
|
117
117
|
onChange: o,
|
|
118
118
|
disabled: n
|
|
119
119
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const S=require("./_commonjsHelpers-wDK0ZLPo.cjs"),p=require("himalaya"),g=require("./Functions-N3yhPYKY.cjs"),s=require("lodash-es"),u=require("./MODIFIERS-mVmfEGgo.cjs"),f=require("lodash");var h={},_={};(function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return r}});function e(a,n){return{handler:a,config:n}}e.withOptions=function(a,n=()=>({})){const c=function(i){return{__options:i,handler:a(i),config:n(i)}};return c.__isOptionsFunction=!0,c.__pluginFunction=a,c.__configFunction=n,c};const r=e})(_);(function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return a}});const e=r(_);function r(n){return n&&n.__esModule?n:{default:n}}const a=e.default})(h);let o=h;var N=(o.__esModule?o:{default:o}).default;const L=S.getDefaultExportFromCjs(N),$=t=>{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/;return e.test(t)||r.test(t)},P=t=>{if(s.isEmpty(t))return t;const e=/<video[^>]+src=['"]([^'">]+)['"]/,r=/<iframe[^>]+src=['"]([^'">]+)['"]/,a=t.match(e),n=t.match(r),c=a?a[1]:n?n[1]:null,i=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,l=/(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;return c&&(i.test(c)||l.test(c))?c:t},d="$name",k={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"}},M=(t,e)=>t.children.length===1&&s.includes(["Heading","Paragraph","Span","ListItem","Button","Label","TableCell","Link"],e._type),b=t=>t.map(e=>e.type==="text"?s.get(e,"content",""):s.isEmpty(e.children)?"":b(e.children)).join(""),y=t=>t===null?"":t,m=t=>{if(t.tagName==="svg")return{};const e={},r=k[t.tagName]||{},a=t.attributes;return s.forEach(a,({key:n,value:c})=>{if(n!==d)if(r[n]){if(t.tagName==="img"&&n==="src"&&!c.startsWith("http")){const i=s.find(t.attributes,{key:"width"}),l=s.find(t.attributes,{key:"height"});i&&l?c=`https://via.placeholder.com/${i==null?void 0:i.value}x${l==null?void 0:l.value}`:c="https://via.placeholder.com/150x150"}s.set(e,r[n],y(c))}else s.includes(["style","class","srcset"],n)||(f.has(e,"styles_attrs")||(e.styles_attrs={}),f.startsWith(n,"@")&&(n=n.replace("@","x-on:")),e.styles_attrs[`${n}`]=y(c))}),delete e.class,e},C=(t,e="styles")=>{if(!t.attributes)return{[e]:`${u.STYLES_KEY},`};const r=s.find(t.attributes,{key:"class"});if(r){const a=r.value;return{[e]:`${u.STYLES_KEY},${a}`}}return{[e]:`${u.STYLES_KEY},`}},q=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:const e=s.get(t,"children",[]).length>0?"Box":"EmptyBox";return{_type:e,tag:t.tagName,_name:e=="EmptyBox"||t.tagName==="div"?e:s.capitalize(t.tagName)}}},v=(t,e=null)=>s.flatMapDeep(t,r=>{var c;if(r.type==="comment")return[];let a={_id:g.generateUUID()};if(e&&(a._parent=e.block._id),r.type==="text")return s.isEmpty(s.get(r,"content",""))?[]:e&&M(e.node,e.block)?(s.set(e,"block.content",s.get(r,"content","")),[]):{...a,_type:"Text",content:s.get(r,"content","")};if(a={...a,...q(r),...m(r),...C(r)},r.attributes){const i=r.attributes.find(l=>l.key===d);i&&(a._name=i.value)}if(a._type==="Input"){const i=a.inputType||"text";i==="checkbox"?s.set(a,"_type","Checkbox"):i==="radio"&&s.set(a,"_type","Radio")}else if(r.tagName==="video"||r.tagName==="iframe"){const i=p.stringify([r]);return $(i)&&(s.set(a,"_type","Video"),s.set(a,"url",P(i)),s.set(a,"styles",`${u.STYLES_KEY},absolute top-0 left-0 w-full h-full`),s.set(a,"controls",{autoPlay:!1,muted:!0,loop:!1,controls:!1})),a.content=i,[a]}else if(r.tagName==="svg"){const i=s.find(r.attributes,{key:"height"}),l=s.find(r.attributes,{key:"width"}),T=s.get(i,"value")?`[${s.get(i,"value")}px]`:"24px",x=s.get(l,"value")?`[${s.get(l,"value")}px]`:"24px",w=s.get(s.find(r.attributes,{key:"class"}),"value","w-full h-full");return a.styles=`${u.STYLES_KEY}, ${g.cn(`w-${x} h-${T}`,w)}`.trim(),r.attributes=s.filter(r.attributes,E=>!s.includes(["style","width","height","class"],E.key)),a.icon=p.stringify([r]),[a]}else if(r.tagName=="option"&&e&&((c=e.block)==null?void 0:c._type)==="Select")return e.block.options.push({label:b(r.children),...m(r)}),[];const n=v(r.children,{block:a,node:r});return[a,...n]}),A=t=>{const e=t.match(/<body[^>]*>[\s\S]*?<\/body>/);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()},B=t=>{const e=p.parse(A(t));return s.isEmpty(t)?[]:s.flatten(v(e))};exports.getBlocksFromHTML=B;exports.plugin=L;
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { g as P } from "./_commonjsHelpers-UyOWmZb0.js";
|
|
2
|
+
import { stringify as y, parse as k } from "himalaya";
|
|
3
|
+
import { g as S, c as M } from "./Functions-7jnEwJyw.js";
|
|
4
|
+
import { isEmpty as g, includes as m, get as l, forEach as A, find as o, set as u, capitalize as C, flatMapDeep as B, filter as E, flatten as R } from "lodash-es";
|
|
5
|
+
import { a as p } from "./MODIFIERS-fd5XOmum.js";
|
|
6
|
+
import { has as H, startsWith as I } from "lodash";
|
|
7
|
+
var d = {}, b = {};
|
|
8
|
+
(function(t) {
|
|
9
|
+
"use strict";
|
|
10
|
+
Object.defineProperty(t, "__esModule", {
|
|
11
|
+
value: !0
|
|
12
|
+
}), Object.defineProperty(t, "default", {
|
|
13
|
+
enumerable: !0,
|
|
14
|
+
get: function() {
|
|
15
|
+
return r;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
function e(a, s) {
|
|
19
|
+
return {
|
|
20
|
+
handler: a,
|
|
21
|
+
config: s
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
e.withOptions = function(a, s = () => ({})) {
|
|
25
|
+
const c = function(n) {
|
|
26
|
+
return {
|
|
27
|
+
__options: n,
|
|
28
|
+
handler: a(n),
|
|
29
|
+
config: s(n)
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
return c.__isOptionsFunction = !0, c.__pluginFunction = a, c.__configFunction = s, c;
|
|
33
|
+
};
|
|
34
|
+
const r = e;
|
|
35
|
+
})(b);
|
|
36
|
+
(function(t) {
|
|
37
|
+
"use strict";
|
|
38
|
+
Object.defineProperty(t, "__esModule", {
|
|
39
|
+
value: !0
|
|
40
|
+
}), Object.defineProperty(t, "default", {
|
|
41
|
+
enumerable: !0,
|
|
42
|
+
get: function() {
|
|
43
|
+
return a;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const e = /* @__PURE__ */ r(b);
|
|
47
|
+
function r(s) {
|
|
48
|
+
return s && s.__esModule ? s : {
|
|
49
|
+
default: s
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const a = e.default;
|
|
53
|
+
})(d);
|
|
54
|
+
let f = d;
|
|
55
|
+
var q = (f.__esModule ? f : { default: f }).default;
|
|
56
|
+
const X = /* @__PURE__ */ P(q), F = (t) => {
|
|
57
|
+
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/;
|
|
58
|
+
return e.test(t) || r.test(t);
|
|
59
|
+
}, O = (t) => {
|
|
60
|
+
if (g(t))
|
|
61
|
+
return t;
|
|
62
|
+
const e = /<video[^>]+src=['"]([^'">]+)['"]/, r = /<iframe[^>]+src=['"]([^'">]+)['"]/, a = t.match(e), s = t.match(r), c = a ? a[1] : s ? s[1] : null, n = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, i = /(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;
|
|
63
|
+
return c && (n.test(c) || i.test(c)) ? c : t;
|
|
64
|
+
}, v = "$name", U = {
|
|
65
|
+
img: { alt: "alt", width: "width", height: "height", src: "image" },
|
|
66
|
+
video: {
|
|
67
|
+
src: "url",
|
|
68
|
+
autoplay: "controls.autoPlay",
|
|
69
|
+
muted: "controls.muted",
|
|
70
|
+
loop: "controls.loop",
|
|
71
|
+
controls: "controls.widgets"
|
|
72
|
+
},
|
|
73
|
+
a: {
|
|
74
|
+
href: "link.href",
|
|
75
|
+
target: "link.target",
|
|
76
|
+
type: ""
|
|
77
|
+
// @TODO: Detect here what to url, email, phone, elementId
|
|
78
|
+
},
|
|
79
|
+
input: {
|
|
80
|
+
placeholder: "placeholder",
|
|
81
|
+
required: "required",
|
|
82
|
+
type: "inputType",
|
|
83
|
+
name: "fieldName"
|
|
84
|
+
},
|
|
85
|
+
textarea: {
|
|
86
|
+
placeholder: "placeholder",
|
|
87
|
+
required: "required",
|
|
88
|
+
type: "inputType",
|
|
89
|
+
name: "fieldName"
|
|
90
|
+
},
|
|
91
|
+
select: {
|
|
92
|
+
placeholder: "placeholder",
|
|
93
|
+
required: "required",
|
|
94
|
+
multiple: "multiple",
|
|
95
|
+
name: "fieldName"
|
|
96
|
+
}
|
|
97
|
+
}, z = (t, e) => t.children.length === 1 && m(["Heading", "Paragraph", "Span", "ListItem", "Button", "Label", "TableCell", "Link"], e._type), T = (t) => t.map((e) => e.type === "text" ? l(e, "content", "") : g(e.children) ? "" : T(e.children)).join(""), h = (t) => t === null ? "" : t, _ = (t) => {
|
|
98
|
+
if (t.tagName === "svg")
|
|
99
|
+
return {};
|
|
100
|
+
const e = {}, r = U[t.tagName] || {}, a = t.attributes;
|
|
101
|
+
return A(a, ({ key: s, value: c }) => {
|
|
102
|
+
if (s !== v)
|
|
103
|
+
if (r[s]) {
|
|
104
|
+
if (t.tagName === "img" && s === "src" && !c.startsWith("http")) {
|
|
105
|
+
const n = o(t.attributes, { key: "width" }), i = o(t.attributes, { key: "height" });
|
|
106
|
+
n && i ? c = `https://via.placeholder.com/${n == null ? void 0 : n.value}x${i == null ? void 0 : i.value}` : c = "https://via.placeholder.com/150x150";
|
|
107
|
+
}
|
|
108
|
+
u(e, r[s], h(c));
|
|
109
|
+
} else
|
|
110
|
+
m(["style", "class", "srcset"], s) || (H(e, "styles_attrs") || (e.styles_attrs = {}), I(s, "@") && (s = s.replace("@", "x-on:")), e.styles_attrs[`${s}`] = h(c));
|
|
111
|
+
}), delete e.class, e;
|
|
112
|
+
}, D = (t, e = "styles") => {
|
|
113
|
+
if (!t.attributes)
|
|
114
|
+
return { [e]: `${p},` };
|
|
115
|
+
const r = o(t.attributes, { key: "class" });
|
|
116
|
+
if (r) {
|
|
117
|
+
const a = r.value;
|
|
118
|
+
return { [e]: `${p},${a}` };
|
|
119
|
+
}
|
|
120
|
+
return { [e]: `${p},` };
|
|
121
|
+
}, V = (t) => {
|
|
122
|
+
switch (t.tagName) {
|
|
123
|
+
case "img":
|
|
124
|
+
return { _type: "Image" };
|
|
125
|
+
case "input":
|
|
126
|
+
return { _type: "Input", showLabel: !1 };
|
|
127
|
+
case "hr":
|
|
128
|
+
return { _type: "Divider" };
|
|
129
|
+
case "br":
|
|
130
|
+
return { _type: "LineBreak" };
|
|
131
|
+
case "textarea":
|
|
132
|
+
return { _type: "TextArea", showLabel: !1 };
|
|
133
|
+
case "audio":
|
|
134
|
+
return { _type: "Audio" };
|
|
135
|
+
case "canvas":
|
|
136
|
+
return { _type: "Canvas" };
|
|
137
|
+
case "video":
|
|
138
|
+
case "iframe":
|
|
139
|
+
return { _type: "CustomHTML" };
|
|
140
|
+
case "svg":
|
|
141
|
+
return { _type: "Icon" };
|
|
142
|
+
case "select":
|
|
143
|
+
return { _type: "Select", options: [] };
|
|
144
|
+
case "option":
|
|
145
|
+
return { _type: "Option" };
|
|
146
|
+
case "ul":
|
|
147
|
+
case "ol":
|
|
148
|
+
case "dl":
|
|
149
|
+
return {
|
|
150
|
+
_type: "List",
|
|
151
|
+
tag: t.tagName,
|
|
152
|
+
_listType: t.tagName === "ol" ? "list-decimal" : "list-none"
|
|
153
|
+
};
|
|
154
|
+
case "li":
|
|
155
|
+
case "dt":
|
|
156
|
+
return { _type: "ListItem", tag: t.tagName };
|
|
157
|
+
case "span":
|
|
158
|
+
case "figcaption":
|
|
159
|
+
case "legend":
|
|
160
|
+
return { _type: "Span", tag: t.tagName };
|
|
161
|
+
case "p":
|
|
162
|
+
return { _type: "Paragraph", content: "" };
|
|
163
|
+
case "a":
|
|
164
|
+
return { _type: "Link" };
|
|
165
|
+
case "form":
|
|
166
|
+
return { _type: "Form" };
|
|
167
|
+
case "label":
|
|
168
|
+
return { _type: "Label" };
|
|
169
|
+
case "button":
|
|
170
|
+
return { _type: "Button" };
|
|
171
|
+
case "code":
|
|
172
|
+
return { _type: "Code" };
|
|
173
|
+
case "h1":
|
|
174
|
+
case "h2":
|
|
175
|
+
case "h3":
|
|
176
|
+
case "h4":
|
|
177
|
+
case "h5":
|
|
178
|
+
case "h6":
|
|
179
|
+
return { _type: "Heading", tag: t.tagName };
|
|
180
|
+
case "table":
|
|
181
|
+
return { _type: "Table" };
|
|
182
|
+
case "tr":
|
|
183
|
+
return { _type: "TableRow" };
|
|
184
|
+
case "td":
|
|
185
|
+
case "th":
|
|
186
|
+
return { _type: "TableCell", tag: t.tagName };
|
|
187
|
+
case "thead":
|
|
188
|
+
return { _type: "TableHead" };
|
|
189
|
+
case "tbody":
|
|
190
|
+
return { _type: "TableBody" };
|
|
191
|
+
case "tfoot":
|
|
192
|
+
return { _type: "TableFooter" };
|
|
193
|
+
default:
|
|
194
|
+
const e = l(t, "children", []).length > 0 ? "Box" : "EmptyBox";
|
|
195
|
+
return {
|
|
196
|
+
_type: e,
|
|
197
|
+
tag: t.tagName,
|
|
198
|
+
_name: e == "EmptyBox" || t.tagName === "div" ? e : C(t.tagName)
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
}, x = (t, e = null) => B(t, (r) => {
|
|
202
|
+
var c;
|
|
203
|
+
if (r.type === "comment")
|
|
204
|
+
return [];
|
|
205
|
+
let a = { _id: S() };
|
|
206
|
+
if (e && (a._parent = e.block._id), r.type === "text")
|
|
207
|
+
return g(l(r, "content", "")) ? [] : e && z(e.node, e.block) ? (u(e, "block.content", l(r, "content", "")), []) : { ...a, _type: "Text", content: l(r, "content", "") };
|
|
208
|
+
if (a = {
|
|
209
|
+
...a,
|
|
210
|
+
...V(r),
|
|
211
|
+
..._(r),
|
|
212
|
+
...D(r)
|
|
213
|
+
}, r.attributes) {
|
|
214
|
+
const n = r.attributes.find((i) => i.key === v);
|
|
215
|
+
n && (a._name = n.value);
|
|
216
|
+
}
|
|
217
|
+
if (a._type === "Input") {
|
|
218
|
+
const n = a.inputType || "text";
|
|
219
|
+
n === "checkbox" ? u(a, "_type", "Checkbox") : n === "radio" && u(a, "_type", "Radio");
|
|
220
|
+
} else if (r.tagName === "video" || r.tagName === "iframe") {
|
|
221
|
+
const n = y([r]);
|
|
222
|
+
return F(n) && (u(a, "_type", "Video"), u(a, "url", O(n)), u(a, "styles", `${p},absolute top-0 left-0 w-full h-full`), u(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = n, [a];
|
|
223
|
+
} else if (r.tagName === "svg") {
|
|
224
|
+
const n = o(r.attributes, { key: "height" }), i = o(r.attributes, { key: "width" }), w = l(n, "value") ? `[${l(n, "value")}px]` : "24px", N = l(i, "value") ? `[${l(i, "value")}px]` : "24px", $ = l(o(r.attributes, { key: "class" }), "value", "w-full h-full");
|
|
225
|
+
return a.styles = `${p}, ${M(`w-${N} h-${w}`, $)}`.trim(), r.attributes = E(r.attributes, (L) => !m(["style", "width", "height", "class"], L.key)), a.icon = y([r]), [a];
|
|
226
|
+
} else if (r.tagName == "option" && e && ((c = e.block) == null ? void 0 : c._type) === "Select")
|
|
227
|
+
return e.block.options.push({
|
|
228
|
+
label: T(r.children),
|
|
229
|
+
..._(r)
|
|
230
|
+
}), [];
|
|
231
|
+
const s = x(r.children, { block: a, node: r });
|
|
232
|
+
return [a, ...s];
|
|
233
|
+
}), j = (t) => {
|
|
234
|
+
const e = t.match(/<body[^>]*>[\s\S]*?<\/body>/);
|
|
235
|
+
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();
|
|
236
|
+
}, K = (t) => {
|
|
237
|
+
const e = k(j(t));
|
|
238
|
+
return g(t) ? [] : R(x(e));
|
|
239
|
+
};
|
|
240
|
+
export {
|
|
241
|
+
K as g,
|
|
242
|
+
X as p
|
|
243
|
+
};
|