@chaibuilder/sdk 1.2.64 → 1.2.66
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/AddBlocks-Mm5byzEC.js +124 -0
- package/dist/AddBlocks-jaxiAG4L.cjs +1 -0
- package/dist/CanvasArea-8NXGRRYC.js +137 -0
- package/dist/CanvasArea-SkeoJz9W.cjs +1 -0
- package/dist/{CodeEditor-37od44Ou.js → CodeEditor-3l-mFvg4.js} +61 -46
- package/dist/CodeEditor-o-CkvDnY.cjs +1 -0
- package/dist/STRINGS--j49GZJP.js +7 -0
- package/dist/STRINGS-gPz7CUOk.cjs +1 -0
- package/dist/SettingsPanel-2uYGx-MQ.cjs +1 -0
- package/dist/SettingsPanel-Q3xQQm81.js +82 -0
- package/dist/{SidePanels-UQj0XTnb.js → SidePanels-JyziIpDA.js} +125 -116
- package/dist/SidePanels-d04PONzN.cjs +1 -0
- package/dist/{Topbar-1O05wogM.js → Topbar-Xgd6YI66.js} +68 -57
- package/dist/Topbar-eIenyfZu.cjs +1 -0
- package/dist/UILibrariesPanel-ADjJse3_.cjs +1 -0
- package/dist/{UILibrariesPanel-vshiYI6G.js → UILibrariesPanel-a7TrMuAU.js} +98 -86
- package/dist/{UnsplashImages-Eq7hprBO.js → UnsplashImages-6Bj8nQ8n.js} +65 -49
- package/dist/UnsplashImages-hLdMtY12.cjs +1 -0
- package/dist/{UploadImages-lco2Tea3.js → UploadImages-4PxhlZMB.js} +58 -44
- package/dist/UploadImages-uL2R7fju.cjs +1 -0
- package/dist/badge-7BVT3zxN.cjs +1 -0
- package/dist/badge-pJqQSA13.js +23 -0
- package/dist/context-menu-_8TFbFEJ.cjs +1 -0
- package/dist/context-menu-sks9vdzC.js +906 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +45 -21
- package/dist/core.js +93 -79
- package/dist/iconBase-vJD0OXxU.cjs +1 -0
- package/dist/iconBase-zweRWSz0.js +323 -0
- package/dist/index-Dgo2PNEV.js +33210 -0
- package/dist/index-jhNzBWrV.cjs +223 -0
- package/dist/jsx-runtime-JYMCiFoE.cjs +27 -0
- package/dist/{jsx-runtime-WbnYoNE9.js → jsx-runtime-Sp0orL4X.js} +106 -109
- package/dist/plugin-P0tpo_XZ.cjs +1 -0
- package/dist/plugin-_F-KZp1i.cjs +1 -0
- package/dist/plugin-f5uJtdXY.js +43 -0
- package/dist/plugin-sJ3Hzvpv.js +57 -0
- package/dist/render.cjs +3 -1
- package/dist/render.d.ts +19 -52
- package/dist/render.js +136 -183
- package/dist/select-JW3OMYm-.js +75 -0
- package/dist/select-fXj5tdMX.cjs +1 -0
- package/dist/separator-hT24N-xp.cjs +1 -0
- package/dist/separator-sgwOa1FE.js +18 -0
- package/dist/style.css +2 -2
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.d.ts +41 -1
- package/dist/tailwind.js +16 -8
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +0 -10
- package/dist/ui.js +345 -163
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.d.ts +1 -1
- package/dist/web-blocks.js +489 -724
- package/package.json +15 -45
- package/dist/AddBlocks-6dJmFSgk.js +0 -142
- package/dist/AddBlocks-doCNVVbk.cjs +0 -1
- package/dist/CanvasArea-kB6ky_uL.js +0 -164
- package/dist/CanvasArea-kdnkFfKR.cjs +0 -1
- package/dist/CodeEditor-ypUx3RAV.cjs +0 -1
- package/dist/CurrentPage-Ekl5Cwbv.cjs +0 -1
- package/dist/CurrentPage-bHq9Uusr.js +0 -108
- package/dist/Functions-7jnEwJyw.js +0 -15
- package/dist/Functions-N3yhPYKY.cjs +0 -1
- package/dist/MODIFIERS-fd5XOmum.js +0 -60
- package/dist/MODIFIERS-mVmfEGgo.cjs +0 -1
- package/dist/PagesPanel-SMHrEmCb.cjs +0 -1
- package/dist/PagesPanel-wIPAyjJK.js +0 -66
- package/dist/ProjectPanel-L-SlDizV.js +0 -87
- package/dist/ProjectPanel-YruLal65.cjs +0 -1
- package/dist/Settings-WXkCyhAv.js +0 -2380
- package/dist/Settings-_5VHcgFC.cjs +0 -1
- package/dist/SidePanels-UeIZB3e1.cjs +0 -1
- package/dist/StaticCanvas-7C52tXAv.js +0 -749
- package/dist/StaticCanvas-ll9VTXI5.cjs +0 -60
- package/dist/ThemeConfigPanel-_86vVxLz.cjs +0 -1
- package/dist/ThemeConfigPanel-gw8B2zvx.js +0 -194
- package/dist/Topbar-gb17oHdJ.cjs +0 -1
- package/dist/UILibrariesPanel-03Y3F3A_.cjs +0 -1
- package/dist/UnsplashImages-6UjgojvF.cjs +0 -1
- package/dist/UploadImages-3h0cRsvr.cjs +0 -1
- package/dist/_commonjsHelpers-UyOWmZb0.js +0 -8
- package/dist/_commonjsHelpers-wDK0ZLPo.cjs +0 -1
- package/dist/add-page-modal-qr7rvJzN.js +0 -106
- package/dist/add-page-modal-rOKavDFX.cjs +0 -1
- package/dist/atoms-KQpaDRnF.cjs +0 -1
- package/dist/atoms-Oomqut88.js +0 -6
- package/dist/confirm-alert-P6TAevaP.js +0 -60
- package/dist/confirm-alert-v1lG8ex4.cjs +0 -1
- package/dist/controls-rRZhz0vu.cjs +0 -1
- package/dist/controls-yjgoZzB6.js +0 -199
- package/dist/delete-page-modal-55oioI9i.js +0 -85
- package/dist/delete-page-modal-wdAiMVnL.cjs +0 -1
- package/dist/email-blocks.cjs +0 -1
- package/dist/email-blocks.d.ts +0 -3
- package/dist/email-blocks.js +0 -294
- package/dist/email.cjs +0 -1
- package/dist/email.d.ts +0 -171
- package/dist/email.js +0 -75
- package/dist/empty-slot-Lsxjts7Q.js +0 -6
- package/dist/empty-slot-Sy930lX6.cjs +0 -1
- package/dist/form-4jTocVbZ.cjs +0 -1
- package/dist/form-5ke_lZv8.js +0 -125
- package/dist/functions--tdNWQDW.js +0 -30
- package/dist/functions-EVUeSwX1.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--mLLy7QQ.cjs +0 -1
- package/dist/index-6w-6HYBd.cjs +0 -1
- package/dist/index-VBXQixVm.js +0 -117
- package/dist/index-aeDphKpP.cjs +0 -1
- package/dist/index-audsIPBC.cjs +0 -231
- package/dist/index-b33n_-zO.js +0 -3141
- package/dist/index-e0c8PmRQ.js +0 -205
- package/dist/index-fnkMn4Pk.js +0 -2201
- package/dist/index-gi1LIOCw.cjs +0 -1
- package/dist/index-wRAIA8zZ.js +0 -80248
- package/dist/jsx-runtime-Z_BpKhVy.cjs +0 -27
- package/dist/lib.cjs +0 -3
- package/dist/lib.d.ts +0 -80
- package/dist/lib.js +0 -1350
- package/dist/page-viewer-t44DP65U.js +0 -112
- package/dist/page-viewer-wU7T0f48.cjs +0 -1
- package/dist/plugin-2hf9pCRy.cjs +0 -1
- package/dist/plugin-wDnsBVPp.js +0 -54
- package/dist/project-general-setting-87cX9vvO.cjs +0 -1
- package/dist/project-general-setting-NEkNjf7V.js +0 -81
- package/dist/project-seo-setting-YmspOYsF.js +0 -83
- package/dist/project-seo-setting-o0V9acCV.cjs +0 -1
- package/dist/server.cjs +0 -1
- package/dist/server.d.ts +0 -299
- package/dist/server.js +0 -216
- package/dist/single-page-detail-27UjWK8L.cjs +0 -1
- package/dist/single-page-detail-jHzoDP7B.js +0 -220
- package/dist/studio.cjs +0 -1
- package/dist/studio.d.ts +0 -176
- package/dist/studio.js +0 -55
- package/dist/utils-D_vtk3zK.cjs +0 -1
- package/dist/utils-VpVqnC9m.js +0 -1075
package/dist/email.d.ts
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
2
|
-
import { default as React_2 } from 'react';
|
|
3
|
-
import { ReactNode } from 'react';
|
|
4
|
-
|
|
5
|
-
declare type AskAiResponse = {
|
|
6
|
-
blocks?: Array<{
|
|
7
|
-
_id: string;
|
|
8
|
-
} & Partial<ChaiBlock>>;
|
|
9
|
-
usage?: Record<any, number>;
|
|
10
|
-
error?: any;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
declare interface Block {
|
|
14
|
-
type: string;
|
|
15
|
-
[key: string]: any;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
declare type Breakpoint = {
|
|
19
|
-
title: string;
|
|
20
|
-
content: string;
|
|
21
|
-
breakpoint: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | string;
|
|
22
|
-
icon: React_2.ReactNode | Element;
|
|
23
|
-
width: number;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
declare type ChaiBlock = {
|
|
27
|
-
_id: string;
|
|
28
|
-
_type: string;
|
|
29
|
-
_name?: string;
|
|
30
|
-
_parent?: string | null | undefined;
|
|
31
|
-
_bindings?: Record<string, string>;
|
|
32
|
-
} & Record<string, any>;
|
|
33
|
-
|
|
34
|
-
declare interface ChaiBuilderEditorProps {
|
|
35
|
-
onLoad?: (editorInstance: ChaiBuilderInstance) => void;
|
|
36
|
-
customRootLayout?: React_2.ComponentType;
|
|
37
|
-
htmlDir?: "ltr" | "rtl";
|
|
38
|
-
hideSaveButton?: boolean;
|
|
39
|
-
filterChaiBlock?: (block: any) => boolean;
|
|
40
|
-
showDebugLogs?: boolean;
|
|
41
|
-
autoSaveSupport?: boolean;
|
|
42
|
-
autoSaveInterval?: TimeInSeconds;
|
|
43
|
-
breakpoints?: Breakpoint[];
|
|
44
|
-
editable?: boolean;
|
|
45
|
-
loading?: boolean;
|
|
46
|
-
locale?: string;
|
|
47
|
-
nonEditableComponent?: ReactComponentType;
|
|
48
|
-
canvas?: React_2.FC<any>;
|
|
49
|
-
canvasTopBarComponents?: {
|
|
50
|
-
right?: ReactComponentType[];
|
|
51
|
-
};
|
|
52
|
-
previewLink?: string;
|
|
53
|
-
dataBindingSupport?: boolean;
|
|
54
|
-
dataProviders?: DataProvider[];
|
|
55
|
-
darkMode?: boolean;
|
|
56
|
-
dndOptions?: any;
|
|
57
|
-
importHTMLSupport?: boolean;
|
|
58
|
-
fetchMediaCallback?: (limit?: number, offset?: number) => Promise<any[]>;
|
|
59
|
-
uploadMediaCallback?: (file: File) => Promise<{
|
|
60
|
-
url: string;
|
|
61
|
-
}>;
|
|
62
|
-
askAiCallBack?: (type: "styles" | "content", prompt: string, blocks: ChaiBlock[]) => Promise<AskAiResponse>;
|
|
63
|
-
saveAiContextCallback?: (content: string) => Promise<true | Error>;
|
|
64
|
-
aiContext?: string;
|
|
65
|
-
getExternalPredefinedBlock?: (block: PredefinedBlock) => Promise<PredefinedBlock & {
|
|
66
|
-
blocks: ChaiBlock[];
|
|
67
|
-
html: string;
|
|
68
|
-
}>;
|
|
69
|
-
uiLibraries?: Omit<UILibrary, "blocks">[];
|
|
70
|
-
getUILibraryBlocks?: (library: UILibrary) => Promise<UiLibraryBlock[]>;
|
|
71
|
-
getUILibraryBlock?: (library: UILibrary, uiLibBlock: UiLibraryBlock) => Promise<ChaiBlock[]>;
|
|
72
|
-
subPages?: Block[];
|
|
73
|
-
subPagesSupport?: boolean;
|
|
74
|
-
blocks?: ChaiBlock[];
|
|
75
|
-
onSaveBlocks?: ({ blocks, providers }: any) => Promise<any>;
|
|
76
|
-
onSavePage?: ({ blocks, providers }: SavePageData) => Promise<boolean | Error>;
|
|
77
|
-
onSave?: ({ blocks, providers }: SavePageData) => Promise<boolean | Error>;
|
|
78
|
-
brandingOptions?: Record<string, string>;
|
|
79
|
-
onSaveBrandingOptions?: (brandingOptions: Record<string, any>) => Promise<boolean | Error>;
|
|
80
|
-
onSaveStateChange?: (syncStatus: "UNSAVED" | "SAVED" | "SAVING") => void;
|
|
81
|
-
previewComponent?: ReactComponentType;
|
|
82
|
-
sideBarComponents?: {
|
|
83
|
-
bottom?: ReactComponentType[];
|
|
84
|
-
top?: {
|
|
85
|
-
icon: ReactComponentType | string;
|
|
86
|
-
name: string;
|
|
87
|
-
panel: ReactComponentType;
|
|
88
|
-
}[];
|
|
89
|
-
};
|
|
90
|
-
topBarComponents?: {
|
|
91
|
-
center?: ReactComponentType[];
|
|
92
|
-
left?: ReactComponentType[];
|
|
93
|
-
right?: ReactComponentType[];
|
|
94
|
-
};
|
|
95
|
-
outlineMenuItems?: OutlineMenuItems;
|
|
96
|
-
getPages?: () => Promise<ChaiPage[]>;
|
|
97
|
-
unsplashAccessKey?: string;
|
|
98
|
-
_flags?: Record<string, boolean>;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export declare const ChaiBuilderEmail: (props: ChaiBuilderEditorProps) => JSX_2.Element;
|
|
102
|
-
|
|
103
|
-
declare type ChaiBuilderInstance = {
|
|
104
|
-
setBlocks: (blocks: ChaiBlock[]) => void;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
declare type ChaiPage = {
|
|
108
|
-
uuid?: string;
|
|
109
|
-
page_name?: string;
|
|
110
|
-
blocks: ChaiBlock[];
|
|
111
|
-
custom_code: string;
|
|
112
|
-
seo_data: Record<string, string>;
|
|
113
|
-
slug: string;
|
|
114
|
-
translations: Record<string, Record<string, string>>;
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
declare type DataProvider = {
|
|
118
|
-
providerKey: string;
|
|
119
|
-
args: Record<string, any>;
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
declare type OutlineMenuItem = {
|
|
123
|
-
item: React_2.ComponentType<{
|
|
124
|
-
blockId: string;
|
|
125
|
-
}>;
|
|
126
|
-
tooltip: string | ReactNode;
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
declare type OutlineMenuItems = OutlineMenuItem[];
|
|
130
|
-
|
|
131
|
-
declare type PredefinedBlock = {
|
|
132
|
-
uuid: string;
|
|
133
|
-
name: string;
|
|
134
|
-
preview: string;
|
|
135
|
-
blocks?: ChaiBlock[];
|
|
136
|
-
html?: string;
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
declare type ReactComponentType = React_2.ComponentType<any>;
|
|
140
|
-
|
|
141
|
-
declare type RichText = string;
|
|
142
|
-
|
|
143
|
-
declare type SavePageData = {
|
|
144
|
-
blocks: ChaiBlock[];
|
|
145
|
-
providers?: DataProvider[];
|
|
146
|
-
brandingOptions?: Record<string, any>;
|
|
147
|
-
themeConfiguration?: Record<string, any>;
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
declare type TimeInSeconds = number;
|
|
151
|
-
|
|
152
|
-
declare interface UILibrary {
|
|
153
|
-
uuid: string;
|
|
154
|
-
name: string;
|
|
155
|
-
url: string;
|
|
156
|
-
blocks?: UiLibraryBlock[];
|
|
157
|
-
link?: string;
|
|
158
|
-
description?: RichText;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
declare type UiLibraryBlock = {
|
|
162
|
-
uuid: string;
|
|
163
|
-
group: string;
|
|
164
|
-
name?: string;
|
|
165
|
-
path: string;
|
|
166
|
-
preview?: string;
|
|
167
|
-
tags?: string[];
|
|
168
|
-
description?: string;
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
export { }
|
package/dist/email.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { j as i } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { C as p } from "./index-wRAIA8zZ.js";
|
|
3
|
-
import { MobileIcon as t } from "@radix-ui/react-icons";
|
|
4
|
-
import { includes as e } from "lodash-es";
|
|
5
|
-
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
6
|
-
import "react";
|
|
7
|
-
import "i18next";
|
|
8
|
-
import "react-i18next";
|
|
9
|
-
import "jotai";
|
|
10
|
-
import "@react-hookz/web";
|
|
11
|
-
import "react-arborist";
|
|
12
|
-
import "./index-b33n_-zO.js";
|
|
13
|
-
import "@radix-ui/react-toggle";
|
|
14
|
-
import "class-variance-authority";
|
|
15
|
-
import "./utils-VpVqnC9m.js";
|
|
16
|
-
import "./MODIFIERS-fd5XOmum.js";
|
|
17
|
-
import "clsx";
|
|
18
|
-
import "tailwind-merge";
|
|
19
|
-
import "@radix-ui/react-switch";
|
|
20
|
-
import "@radix-ui/react-slot";
|
|
21
|
-
import "@radix-ui/react-accordion";
|
|
22
|
-
import "@radix-ui/react-alert-dialog";
|
|
23
|
-
import "@radix-ui/react-dialog";
|
|
24
|
-
import "@radix-ui/react-label";
|
|
25
|
-
import "@radix-ui/react-scroll-area";
|
|
26
|
-
import "@radix-ui/react-tabs";
|
|
27
|
-
import "@radix-ui/react-tooltip";
|
|
28
|
-
import "@radix-ui/react-popover";
|
|
29
|
-
import "@radix-ui/react-menubar";
|
|
30
|
-
import "@radix-ui/react-hover-card";
|
|
31
|
-
import "@radix-ui/react-select";
|
|
32
|
-
import "@radix-ui/react-dropdown-menu";
|
|
33
|
-
import "@radix-ui/react-separator";
|
|
34
|
-
import "@radix-ui/react-toast";
|
|
35
|
-
import "cmdk";
|
|
36
|
-
import "@radix-ui/react-context-menu";
|
|
37
|
-
import "react-icons-picker";
|
|
38
|
-
import "react-dom";
|
|
39
|
-
import "react-quill";
|
|
40
|
-
import "./Functions-7jnEwJyw.js";
|
|
41
|
-
import "@chaibuilder/runtime";
|
|
42
|
-
import "tree-model";
|
|
43
|
-
import "lucide-react";
|
|
44
|
-
import "./index-VBXQixVm.js";
|
|
45
|
-
import "@floating-ui/react-dom";
|
|
46
|
-
import "flagged";
|
|
47
|
-
import "react-hotkeys-hook";
|
|
48
|
-
const n = [
|
|
49
|
-
{
|
|
50
|
-
title: "Mobile",
|
|
51
|
-
content: "Mobile email client",
|
|
52
|
-
breakpoint: "xs",
|
|
53
|
-
icon: /* @__PURE__ */ i.jsx(t, {}),
|
|
54
|
-
width: 400
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
title: "Email Client",
|
|
58
|
-
content: "Content as seen inside an email client",
|
|
59
|
-
breakpoint: "sm",
|
|
60
|
-
icon: /* @__PURE__ */ i.jsx(t, { className: "rotate-90" }),
|
|
61
|
-
width: 700
|
|
62
|
-
}
|
|
63
|
-
], ti = (o) => {
|
|
64
|
-
const r = {
|
|
65
|
-
...o,
|
|
66
|
-
filterChaiBlock: (m) => e(m.type, "Email/"),
|
|
67
|
-
importHTMLSupport: !1,
|
|
68
|
-
dataBindingSupport: !1,
|
|
69
|
-
breakpoints: n
|
|
70
|
-
};
|
|
71
|
-
return /* @__PURE__ */ i.jsx(p, { ...r });
|
|
72
|
-
};
|
|
73
|
-
export {
|
|
74
|
-
ti as ChaiBuilderEmail
|
|
75
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { c as n } from "./Functions-7jnEwJyw.js";
|
|
3
|
-
const i = ({ className: t = "", inBuilder: l }) => l ? /* @__PURE__ */ e.jsx("div", { className: n("pointer-events-none flex h-20 flex-col items-center justify-center p-2", t), children: /* @__PURE__ */ e.jsx("div", { className: "h-full w-full rounded bg-gray-200 p-2", children: /* @__PURE__ */ e.jsx("div", { className: "flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300" }) }) }) : null;
|
|
4
|
-
export {
|
|
5
|
-
i as E
|
|
6
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./jsx-runtime-Z_BpKhVy.cjs"),s=require("./Functions-N3yhPYKY.cjs"),l=({className:t="",inBuilder:n})=>n?e.jsxRuntimeExports.jsx("div",{className:s.cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2",t),children:e.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-2",children:e.jsxRuntimeExports.jsx("div",{className:"flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300"})})}):null;exports.EmptySlot=l;
|
package/dist/form-4jTocVbZ.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
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-aeDphKpP.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=$;
|
package/dist/form-5ke_lZv8.js
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { j as u } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import b from "@rjsf/core";
|
|
3
|
-
import x from "@rjsf/validator-ajv8";
|
|
4
|
-
import { includes as h, get as a, set as $, first as F } from "lodash-es";
|
|
5
|
-
import { b3 as P, b4 as E, b5 as O, b6 as S } from "./index-b33n_-zO.js";
|
|
6
|
-
const d = (i, l = "") => {
|
|
7
|
-
switch (i.type) {
|
|
8
|
-
case "singular":
|
|
9
|
-
return i.uiSchema;
|
|
10
|
-
case "model":
|
|
11
|
-
const { properties: c } = i, m = {};
|
|
12
|
-
return Object.keys(c).forEach((r) => {
|
|
13
|
-
const e = c[r];
|
|
14
|
-
if (h(["slot", "styles"], e.type))
|
|
15
|
-
return;
|
|
16
|
-
const o = a(e, "i18n", !1) ? `${r}-${l}` : r;
|
|
17
|
-
m[o] = d(e, l);
|
|
18
|
-
}), m;
|
|
19
|
-
case "list":
|
|
20
|
-
const { itemProperties: n } = i, p = {
|
|
21
|
-
items: {}
|
|
22
|
-
};
|
|
23
|
-
return Object.keys(n).forEach((r) => {
|
|
24
|
-
const e = n[r];
|
|
25
|
-
if (h(["slot", "styles"], e.type))
|
|
26
|
-
return;
|
|
27
|
-
const o = a(e, "i18n", !1) ? `${r}-${l}` : r;
|
|
28
|
-
p.items[o] = d(e, l);
|
|
29
|
-
}), p;
|
|
30
|
-
default:
|
|
31
|
-
return {};
|
|
32
|
-
}
|
|
33
|
-
}, y = (i, l = "") => {
|
|
34
|
-
switch (i.type) {
|
|
35
|
-
case "singular":
|
|
36
|
-
return i.schema;
|
|
37
|
-
case "model":
|
|
38
|
-
const { properties: c, title: m } = i, n = {
|
|
39
|
-
title: m,
|
|
40
|
-
type: "object",
|
|
41
|
-
properties: {}
|
|
42
|
-
};
|
|
43
|
-
return Object.keys(c).forEach((o) => {
|
|
44
|
-
const t = c[o];
|
|
45
|
-
if (h(["slot", "styles"], t.type))
|
|
46
|
-
return;
|
|
47
|
-
const s = a(t, "i18n", !1) ? `${o}-${l}` : o;
|
|
48
|
-
n.properties[s] = y(t, l);
|
|
49
|
-
}), n;
|
|
50
|
-
case "list":
|
|
51
|
-
const { itemProperties: p, title: r } = i, e = {
|
|
52
|
-
title: r,
|
|
53
|
-
type: "array",
|
|
54
|
-
items: {
|
|
55
|
-
type: "object",
|
|
56
|
-
properties: {}
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
return Object.keys(p).forEach((o) => {
|
|
60
|
-
const t = p[o];
|
|
61
|
-
if (h(["slot", "styles"], t.type))
|
|
62
|
-
return;
|
|
63
|
-
const s = a(t, "i18n", !1) ? `${o}-${l}` : o;
|
|
64
|
-
e.items.properties[s] = y(t, l), $(e.items, "title", a(t, "itemTitle", `${r} item`));
|
|
65
|
-
}), e;
|
|
66
|
-
default:
|
|
67
|
-
return {};
|
|
68
|
-
}
|
|
69
|
-
}, C = ({
|
|
70
|
-
title: i,
|
|
71
|
-
properties: l = {},
|
|
72
|
-
formData: c,
|
|
73
|
-
onChange: m,
|
|
74
|
-
disabled: n = !1,
|
|
75
|
-
activeLang: p = ""
|
|
76
|
-
}) => {
|
|
77
|
-
const r = {
|
|
78
|
-
type: "object",
|
|
79
|
-
properties: {}
|
|
80
|
-
}, e = {};
|
|
81
|
-
Object.keys(l).forEach((t) => {
|
|
82
|
-
const s = l[t];
|
|
83
|
-
if (h(["slot", "styles"], s.type))
|
|
84
|
-
return;
|
|
85
|
-
const f = a(s, "i18n", !1) ? `${t}-${p}` : t;
|
|
86
|
-
r.properties[f] = y(s, p), e[f] = d(s, p);
|
|
87
|
-
});
|
|
88
|
-
const o = ({ ...t }, s) => {
|
|
89
|
-
const f = s == null ? void 0 : s.replace("root.", "").split("/").pop();
|
|
90
|
-
if (!s || !f)
|
|
91
|
-
return;
|
|
92
|
-
const j = F(f.split("."));
|
|
93
|
-
s && j && m({ ...t }, j);
|
|
94
|
-
};
|
|
95
|
-
return /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
|
96
|
-
i && /* @__PURE__ */ u.jsx("h1", { className: "px-1 text-sm font-semibold underline", children: i }),
|
|
97
|
-
/* @__PURE__ */ u.jsx("div", { className: "-mx-3", children: /* @__PURE__ */ u.jsx(
|
|
98
|
-
b,
|
|
99
|
-
{
|
|
100
|
-
widgets: {
|
|
101
|
-
richtext: P,
|
|
102
|
-
icon: E,
|
|
103
|
-
image: O
|
|
104
|
-
},
|
|
105
|
-
fields: {
|
|
106
|
-
link: S
|
|
107
|
-
},
|
|
108
|
-
idSeparator: ".",
|
|
109
|
-
autoComplete: "off",
|
|
110
|
-
omitExtraData: !0,
|
|
111
|
-
liveOmit: !0,
|
|
112
|
-
liveValidate: !0,
|
|
113
|
-
uiSchema: e,
|
|
114
|
-
schema: r,
|
|
115
|
-
formData: c,
|
|
116
|
-
validator: x,
|
|
117
|
-
onChange: o,
|
|
118
|
-
disabled: n
|
|
119
|
-
}
|
|
120
|
-
) })
|
|
121
|
-
] });
|
|
122
|
-
};
|
|
123
|
-
export {
|
|
124
|
-
C as F
|
|
125
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { get as o, last as g, flattenDeep as $ } from "lodash-es";
|
|
2
|
-
import { a as d } from "./MODIFIERS-fd5XOmum.js";
|
|
3
|
-
const b = (s, t = "") => {
|
|
4
|
-
const r = o(s, "bodyTextLightColor", "#64748b"), c = o(s, "bodyTextDarkColor", "#94a3b8"), l = o(s, "bodyBgLightColor", "#FFFFFF"), n = o(s, "bodyBgDarkColor", "#0f172a");
|
|
5
|
-
return `${t}font-body ${t}antialiased ${t}text-[${r}] ${t}bg-[${l}] dark:${t}text-[${c}] dark:${t}bg-[${n}]`;
|
|
6
|
-
}, i = (s, t = "") => {
|
|
7
|
-
const c = s.replace(d, "").split(",").map((l) => l.split(" ").map((a) => {
|
|
8
|
-
if (a === "")
|
|
9
|
-
return "";
|
|
10
|
-
if (a.includes(":")) {
|
|
11
|
-
const e = a.split(":");
|
|
12
|
-
return e[e.length - 1] = t + g(e), e.join(":");
|
|
13
|
-
}
|
|
14
|
-
return `${t}${a}`;
|
|
15
|
-
}).join(" "));
|
|
16
|
-
return $(c).join(" ");
|
|
17
|
-
}, k = (s) => {
|
|
18
|
-
if (!s)
|
|
19
|
-
return [];
|
|
20
|
-
try {
|
|
21
|
-
return JSON.parse(s).filter((r) => !r._type.startsWith("@chai"));
|
|
22
|
-
} catch {
|
|
23
|
-
return [{ _type: "Paragraph", _id: "error", content: "Invalid JSON. Please check the JSON string." }];
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
export {
|
|
27
|
-
i as a,
|
|
28
|
-
k as c,
|
|
29
|
-
b as g
|
|
30
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("lodash-es"),g=require("./MODIFIERS-mVmfEGgo.cjs"),d=(s,t="")=>{const r=e.get(s,"bodyTextLightColor","#64748b"),c=e.get(s,"bodyTextDarkColor","#94a3b8"),n=e.get(s,"bodyBgLightColor","#FFFFFF"),l=e.get(s,"bodyBgDarkColor","#0f172a");return`${t}font-body ${t}antialiased ${t}text-[${r}] ${t}bg-[${n}] dark:${t}text-[${c}] dark:${t}bg-[${l}]`},u=(s,t="")=>{const c=s.replace(g.STYLES_KEY,"").split(",").map(n=>n.split(" ").map(a=>{if(a==="")return"";if(a.includes(":")){const o=a.split(":");return o[o.length-1]=t+e.last(o),o.join(":")}return`${t}${a}`}).join(" "));return e.flattenDeep(c).join(" ")},i=s=>{if(!s)return[];try{return JSON.parse(s).filter(r=>!r._type.startsWith("@chai"))}catch{return[{_type:"Paragraph",_id:"error",content:"Invalid JSON. Please check the JSON string."}]}};exports.addPrefixToClasses=u;exports.convertToBlocks=i;exports.getBrandingClasses=d;
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import { stringify as y, parse as N } from "himalaya";
|
|
2
|
-
import { g as L, c as k } from "./Functions-7jnEwJyw.js";
|
|
3
|
-
import { isEmpty as m, includes as g, get as n, forEach as S, find as u, set as o, capitalize as $, flatMapDeep as A, filter as B, flatten as C } from "lodash-es";
|
|
4
|
-
import { a as p } from "./MODIFIERS-fd5XOmum.js";
|
|
5
|
-
import { has as R, startsWith as E } from "lodash";
|
|
6
|
-
const M = (t) => {
|
|
7
|
-
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
|
-
return e.test(t) || a.test(t);
|
|
9
|
-
}, H = (t) => {
|
|
10
|
-
if (m(t))
|
|
11
|
-
return t;
|
|
12
|
-
const e = /<video[^>]+src=['"]([^'">]+)['"]/, a = /<iframe[^>]+src=['"]([^'">]+)['"]/, r = t.match(e), c = t.match(a), i = r ? r[1] : c ? c[1] : null, s = /(?: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/;
|
|
13
|
-
return i && (s.test(i) || l.test(i)) ? i : t;
|
|
14
|
-
}, b = "$name", I = {
|
|
15
|
-
img: { alt: "alt", width: "width", height: "height", src: "image" },
|
|
16
|
-
video: {
|
|
17
|
-
src: "url",
|
|
18
|
-
autoplay: "controls.autoPlay",
|
|
19
|
-
muted: "controls.muted",
|
|
20
|
-
loop: "controls.loop",
|
|
21
|
-
controls: "controls.widgets"
|
|
22
|
-
},
|
|
23
|
-
a: {
|
|
24
|
-
href: "link.href",
|
|
25
|
-
target: "link.target",
|
|
26
|
-
type: ""
|
|
27
|
-
// @TODO: Detect here what to url, email, phone, elementId
|
|
28
|
-
},
|
|
29
|
-
input: {
|
|
30
|
-
placeholder: "placeholder",
|
|
31
|
-
required: "required",
|
|
32
|
-
type: "inputType",
|
|
33
|
-
name: "fieldName"
|
|
34
|
-
},
|
|
35
|
-
textarea: {
|
|
36
|
-
placeholder: "placeholder",
|
|
37
|
-
required: "required",
|
|
38
|
-
type: "inputType",
|
|
39
|
-
name: "fieldName"
|
|
40
|
-
},
|
|
41
|
-
select: {
|
|
42
|
-
placeholder: "placeholder",
|
|
43
|
-
required: "required",
|
|
44
|
-
multiple: "multiple",
|
|
45
|
-
name: "fieldName"
|
|
46
|
-
}
|
|
47
|
-
}, q = (t, e) => t.children.length === 1 && g(["Heading", "Paragraph", "Span", "ListItem", "Button", "Label", "TableCell", "Link"], e._type), _ = (t) => t.map((e) => e.type === "text" ? n(e, "content", "") : m(e.children) ? "" : _(e.children)).join(""), h = (t) => t === null ? "" : t, f = (t) => {
|
|
48
|
-
if (t.tagName === "svg")
|
|
49
|
-
return {};
|
|
50
|
-
const e = {}, a = I[t.tagName] || {}, r = t.attributes;
|
|
51
|
-
return S(r, ({ key: c, value: i }) => {
|
|
52
|
-
if (c !== b)
|
|
53
|
-
if (a[c]) {
|
|
54
|
-
if (t.tagName === "img" && c === "src" && !i.startsWith("http")) {
|
|
55
|
-
const s = u(t.attributes, { key: "width" }), l = u(t.attributes, { key: "height" });
|
|
56
|
-
s && l ? i = `https://via.placeholder.com/${s == null ? void 0 : s.value}x${l == null ? void 0 : l.value}` : i = "https://via.placeholder.com/150x150";
|
|
57
|
-
}
|
|
58
|
-
o(e, a[c], h(i));
|
|
59
|
-
} else
|
|
60
|
-
g(["style", "class", "srcset"], c) || (R(e, "styles_attrs") || (e.styles_attrs = {}), E(c, "@") && (c = c.replace("@", "x-on:")), e.styles_attrs[`${c}`] = h(i));
|
|
61
|
-
}), delete e.class, e;
|
|
62
|
-
}, P = (t, e = "styles") => {
|
|
63
|
-
if (!t.attributes)
|
|
64
|
-
return { [e]: `${p},` };
|
|
65
|
-
const a = u(t.attributes, { key: "class" });
|
|
66
|
-
if (a) {
|
|
67
|
-
const r = a.value;
|
|
68
|
-
return { [e]: `${p},${r}` };
|
|
69
|
-
}
|
|
70
|
-
return { [e]: `${p},` };
|
|
71
|
-
}, U = (t) => {
|
|
72
|
-
switch (t.tagName) {
|
|
73
|
-
case "img":
|
|
74
|
-
return { _type: "Image" };
|
|
75
|
-
case "input":
|
|
76
|
-
return { _type: "Input", showLabel: !1 };
|
|
77
|
-
case "hr":
|
|
78
|
-
return { _type: "Divider" };
|
|
79
|
-
case "br":
|
|
80
|
-
return { _type: "LineBreak" };
|
|
81
|
-
case "textarea":
|
|
82
|
-
return { _type: "TextArea", showLabel: !1 };
|
|
83
|
-
case "audio":
|
|
84
|
-
return { _type: "Audio" };
|
|
85
|
-
case "canvas":
|
|
86
|
-
return { _type: "Canvas" };
|
|
87
|
-
case "video":
|
|
88
|
-
case "iframe":
|
|
89
|
-
return { _type: "CustomHTML" };
|
|
90
|
-
case "svg":
|
|
91
|
-
return { _type: "Icon" };
|
|
92
|
-
case "select":
|
|
93
|
-
return { _type: "Select", options: [] };
|
|
94
|
-
case "option":
|
|
95
|
-
return { _type: "Option" };
|
|
96
|
-
case "ul":
|
|
97
|
-
case "ol":
|
|
98
|
-
case "dl":
|
|
99
|
-
return {
|
|
100
|
-
_type: "List",
|
|
101
|
-
tag: t.tagName,
|
|
102
|
-
_listType: t.tagName === "ol" ? "list-decimal" : "list-none"
|
|
103
|
-
};
|
|
104
|
-
case "li":
|
|
105
|
-
case "dt":
|
|
106
|
-
return { _type: "ListItem", tag: t.tagName };
|
|
107
|
-
case "span":
|
|
108
|
-
case "figcaption":
|
|
109
|
-
case "legend":
|
|
110
|
-
return { _type: "Span", tag: t.tagName };
|
|
111
|
-
case "p":
|
|
112
|
-
return { _type: "Paragraph", content: "" };
|
|
113
|
-
case "a":
|
|
114
|
-
return { _type: "Link" };
|
|
115
|
-
case "form":
|
|
116
|
-
return { _type: "Form" };
|
|
117
|
-
case "label":
|
|
118
|
-
return { _type: "Label" };
|
|
119
|
-
case "button":
|
|
120
|
-
return { _type: "Button" };
|
|
121
|
-
case "code":
|
|
122
|
-
return { _type: "Code" };
|
|
123
|
-
case "h1":
|
|
124
|
-
case "h2":
|
|
125
|
-
case "h3":
|
|
126
|
-
case "h4":
|
|
127
|
-
case "h5":
|
|
128
|
-
case "h6":
|
|
129
|
-
return { _type: "Heading", tag: t.tagName };
|
|
130
|
-
case "table":
|
|
131
|
-
return { _type: "Table" };
|
|
132
|
-
case "tr":
|
|
133
|
-
return { _type: "TableRow" };
|
|
134
|
-
case "td":
|
|
135
|
-
case "th":
|
|
136
|
-
return { _type: "TableCell", tag: t.tagName };
|
|
137
|
-
case "thead":
|
|
138
|
-
return { _type: "TableHead" };
|
|
139
|
-
case "tbody":
|
|
140
|
-
return { _type: "TableBody" };
|
|
141
|
-
case "tfoot":
|
|
142
|
-
return { _type: "TableFooter" };
|
|
143
|
-
default:
|
|
144
|
-
const e = n(t, "children", []).length > 0 ? "Box" : "EmptyBox";
|
|
145
|
-
return {
|
|
146
|
-
_type: e,
|
|
147
|
-
tag: t.tagName,
|
|
148
|
-
_name: e == "EmptyBox" || t.tagName === "div" ? e : $(t.tagName)
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
}, d = (t, e = null) => A(t, (a) => {
|
|
152
|
-
var i;
|
|
153
|
-
if (a.type === "comment")
|
|
154
|
-
return [];
|
|
155
|
-
let r = { _id: L() };
|
|
156
|
-
if (e && (r._parent = e.block._id), a.type === "text")
|
|
157
|
-
return m(n(a, "content", "")) ? [] : e && q(e.node, e.block) ? (o(e, "block.content", n(a, "content", "")), []) : { ...r, _type: "Text", content: n(a, "content", "") };
|
|
158
|
-
if (r = {
|
|
159
|
-
...r,
|
|
160
|
-
...U(a),
|
|
161
|
-
...f(a),
|
|
162
|
-
...P(a)
|
|
163
|
-
}, a.attributes) {
|
|
164
|
-
const s = a.attributes.find((l) => l.key === b);
|
|
165
|
-
s && (r._name = s.value);
|
|
166
|
-
}
|
|
167
|
-
if (r._type === "Input") {
|
|
168
|
-
const s = r.inputType || "text";
|
|
169
|
-
s === "checkbox" ? o(r, "_type", "Checkbox") : s === "radio" && o(r, "_type", "Radio");
|
|
170
|
-
} else if (a.tagName === "video" || a.tagName === "iframe") {
|
|
171
|
-
const s = y([a]);
|
|
172
|
-
return M(s) && (o(r, "_type", "Video"), o(r, "url", H(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];
|
|
173
|
-
} else if (a.tagName === "svg") {
|
|
174
|
-
const s = u(a.attributes, { key: "height" }), l = u(a.attributes, { key: "width" }), v = n(s, "value") ? `[${n(s, "value")}px]` : "24px", T = n(l, "value") ? `[${n(l, "value")}px]` : "24px", x = n(u(a.attributes, { key: "class" }), "value", "w-full h-full");
|
|
175
|
-
return r.styles = `${p}, ${k(`w-${T} h-${v}`, x)}`.trim(), a.attributes = B(a.attributes, (w) => !g(["style", "width", "height", "class"], w.key)), r.icon = y([a]), [r];
|
|
176
|
-
} else if (a.tagName == "option" && e && ((i = e.block) == null ? void 0 : i._type) === "Select")
|
|
177
|
-
return e.block.options.push({
|
|
178
|
-
label: _(a.children),
|
|
179
|
-
...f(a)
|
|
180
|
-
}), [];
|
|
181
|
-
const c = d(a.children, { block: r, node: a });
|
|
182
|
-
return [r, ...c];
|
|
183
|
-
}), z = (t) => {
|
|
184
|
-
const e = t.match(/<body[^>]*>[\s\S]*?<\/body>/);
|
|
185
|
-
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();
|
|
186
|
-
}, Z = (t) => {
|
|
187
|
-
const e = N(z(t));
|
|
188
|
-
return m(t) ? [] : C(d(e));
|
|
189
|
-
};
|
|
190
|
-
export {
|
|
191
|
-
Z as g
|
|
192
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const u=require("himalaya"),p=require("./Functions-N3yhPYKY.cjs"),r=require("lodash-es"),o=require("./MODIFIERS-mVmfEGgo.cjs"),g=require("lodash"),x=t=>{const e=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,s=/(?:https?:\/\/)?(?:www\.)?(player)?.vimeo\.com/;return e.test(t)||s.test(t)},w=t=>{if(r.isEmpty(t))return t;const e=/<video[^>]+src=['"]([^'">]+)['"]/,s=/<iframe[^>]+src=['"]([^'">]+)['"]/,a=t.match(e),c=t.match(s),l=a?a[1]:c?c[1]:null,i=/(?: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 l&&(i.test(l)||n.test(l))?l:t},h="$name",S={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"}},E=(t,e)=>t.children.length===1&&r.includes(["Heading","Paragraph","Span","ListItem","Button","Label","TableCell","Link"],e._type),f=t=>t.map(e=>e.type==="text"?r.get(e,"content",""):r.isEmpty(e.children)?"":f(e.children)).join(""),y=t=>t===null?"":t,m=t=>{if(t.tagName==="svg")return{};const e={},s=S[t.tagName]||{},a=t.attributes;return r.forEach(a,({key:c,value:l})=>{if(c!==h)if(s[c]){if(t.tagName==="img"&&c==="src"&&!l.startsWith("http")){const i=r.find(t.attributes,{key:"width"}),n=r.find(t.attributes,{key:"height"});i&&n?l=`https://via.placeholder.com/${i==null?void 0:i.value}x${n==null?void 0:n.value}`:l="https://via.placeholder.com/150x150"}r.set(e,s[c],y(l))}else r.includes(["style","class","srcset"],c)||(g.has(e,"styles_attrs")||(e.styles_attrs={}),g.startsWith(c,"@")&&(c=c.replace("@","x-on:")),e.styles_attrs[`${c}`]=y(l))}),delete e.class,e},N=(t,e="styles")=>{if(!t.attributes)return{[e]:`${o.STYLES_KEY},`};const s=r.find(t.attributes,{key:"class"});if(s){const a=s.value;return{[e]:`${o.STYLES_KEY},${a}`}}return{[e]:`${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:const e=r.get(t,"children",[]).length>0?"Box":"EmptyBox";return{_type:e,tag:t.tagName,_name:e=="EmptyBox"||t.tagName==="div"?e:r.capitalize(t.tagName)}}},b=(t,e=null)=>r.flatMapDeep(t,s=>{var l;if(s.type==="comment")return[];let a={_id:p.generateUUID()};if(e&&(a._parent=e.block._id),s.type==="text")return r.isEmpty(r.get(s,"content",""))?[]:e&&E(e.node,e.block)?(r.set(e,"block.content",r.get(s,"content","")),[]):{...a,_type:"Text",content:r.get(s,"content","")};if(a={...a,...L(s),...m(s),...N(s)},s.attributes){const i=s.attributes.find(n=>n.key===h);i&&(a._name=i.value)}if(a._type==="Input"){const i=a.inputType||"text";i==="checkbox"?r.set(a,"_type","Checkbox"):i==="radio"&&r.set(a,"_type","Radio")}else if(s.tagName==="video"||s.tagName==="iframe"){const i=u.stringify([s]);return x(i)&&(r.set(a,"_type","Video"),r.set(a,"url",w(i)),r.set(a,"styles",`${o.STYLES_KEY},absolute top-0 left-0 w-full h-full`),r.set(a,"controls",{autoPlay:!1,muted:!0,loop:!1,controls:!1})),a.content=i,[a]}else if(s.tagName==="svg"){const i=r.find(s.attributes,{key:"height"}),n=r.find(s.attributes,{key:"width"}),d=r.get(i,"value")?`[${r.get(i,"value")}px]`:"24px",_=r.get(n,"value")?`[${r.get(n,"value")}px]`:"24px",T=r.get(r.find(s.attributes,{key:"class"}),"value","w-full h-full");return a.styles=`${o.STYLES_KEY}, ${p.cn(`w-${_} h-${d}`,T)}`.trim(),s.attributes=r.filter(s.attributes,v=>!r.includes(["style","width","height","class"],v.key)),a.icon=u.stringify([s]),[a]}else if(s.tagName=="option"&&e&&((l=e.block)==null?void 0:l._type)==="Select")return e.block.options.push({label:f(s.children),...m(s)}),[];const c=b(s.children,{block:a,node:s});return[a,...c]}),k=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()},$=t=>{const e=u.parse(k(t));return r.isEmpty(t)?[]:r.flatten(b(e))};exports.getBlocksFromHTML=$;
|
package/dist/index--mLLy7QQ.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;
|