@chaibuilder/sdk 1.2.65 → 1.2.67

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 (125) hide show
  1. package/dist/AddBlocks-TVOOPK2w.cjs +1 -0
  2. package/dist/AddBlocks-mbuhydG3.js +123 -0
  3. package/dist/CanvasArea-KJMcis97.cjs +1 -0
  4. package/dist/CanvasArea-kg3Rgg9t.js +136 -0
  5. package/dist/CodeEditor-QP6l0mv4.cjs +1 -0
  6. package/dist/{CodeEditor-Qff4q7sx.js → CodeEditor-q5unEaUI.js} +60 -46
  7. package/dist/STRINGS--j49GZJP.js +7 -0
  8. package/dist/STRINGS-gPz7CUOk.cjs +1 -0
  9. package/dist/SettingsPanel-MWeQjDWs.cjs +1 -0
  10. package/dist/SettingsPanel-pomLrOxB.js +81 -0
  11. package/dist/SidePanels-9sbERNEv.cjs +1 -0
  12. package/dist/{SidePanels-ijaUKSek.js → SidePanels-YpRrvfiH.js} +87 -93
  13. package/dist/{Topbar-vHlnfxPs.js → Topbar-kVBx7pp4.js} +56 -61
  14. package/dist/Topbar-veJ2_blW.cjs +1 -0
  15. package/dist/{UILibrariesPanel-NVUMUPUj.js → UILibrariesPanel-ES8YzN9C.js} +92 -101
  16. package/dist/UILibrariesPanel-H8t36R6M.cjs +1 -0
  17. package/dist/UnsplashImages--MXx-DYM.cjs +1 -0
  18. package/dist/{UnsplashImages-UkHihhA5.js → UnsplashImages-sotLcz6r.js} +72 -57
  19. package/dist/{UploadImages-HtuJZJlo.js → UploadImages-I0QQ6vj1.js} +57 -44
  20. package/dist/UploadImages-xhxeYKkl.cjs +1 -0
  21. package/dist/badge-7BVT3zxN.cjs +1 -0
  22. package/dist/badge-pJqQSA13.js +23 -0
  23. package/dist/context-menu-_8TFbFEJ.cjs +1 -0
  24. package/dist/context-menu-sks9vdzC.js +906 -0
  25. package/dist/core.cjs +1 -1
  26. package/dist/core.d.ts +45 -20
  27. package/dist/core.js +85 -87
  28. package/dist/iconBase-vJD0OXxU.cjs +1 -0
  29. package/dist/iconBase-zweRWSz0.js +323 -0
  30. package/dist/index-5hfuDpYs.cjs +223 -0
  31. package/dist/index-Zu-K_BX7.js +33933 -0
  32. package/dist/jsx-runtime-JYMCiFoE.cjs +27 -0
  33. package/dist/{jsx-runtime-WbnYoNE9.js → jsx-runtime-Sp0orL4X.js} +106 -109
  34. package/dist/plugin-P0tpo_XZ.cjs +1 -0
  35. package/dist/plugin-_F-KZp1i.cjs +1 -0
  36. package/dist/plugin-f5uJtdXY.js +43 -0
  37. package/dist/plugin-sJ3Hzvpv.js +57 -0
  38. package/dist/render.cjs +3 -1
  39. package/dist/render.d.ts +19 -52
  40. package/dist/render.js +136 -183
  41. package/dist/select-JW3OMYm-.js +75 -0
  42. package/dist/select-fXj5tdMX.cjs +1 -0
  43. package/dist/separator-hT24N-xp.cjs +1 -0
  44. package/dist/separator-sgwOa1FE.js +18 -0
  45. package/dist/style.css +1 -1
  46. package/dist/tailwind.cjs +1 -1
  47. package/dist/tailwind.d.ts +41 -1
  48. package/dist/tailwind.js +16 -8
  49. package/dist/ui.cjs +1 -1
  50. package/dist/ui.d.ts +0 -10
  51. package/dist/ui.js +345 -163
  52. package/dist/web-blocks.cjs +1 -1
  53. package/dist/web-blocks.d.ts +1 -1
  54. package/dist/web-blocks.js +489 -724
  55. package/package.json +15 -45
  56. package/dist/CanvasArea-fSdH_RiN.cjs +0 -1
  57. package/dist/CanvasArea-ut5yknzX.js +0 -168
  58. package/dist/CodeEditor-ypUx3RAV.cjs +0 -1
  59. package/dist/CurrentPage-jHSVy3hq.js +0 -120
  60. package/dist/CurrentPage-p_AM4lrF.cjs +0 -1
  61. package/dist/Functions-7jnEwJyw.js +0 -15
  62. package/dist/Functions-N3yhPYKY.cjs +0 -1
  63. package/dist/MODIFIERS-fd5XOmum.js +0 -60
  64. package/dist/MODIFIERS-mVmfEGgo.cjs +0 -1
  65. package/dist/PagesPanel-U3InJ9Db.js +0 -78
  66. package/dist/PagesPanel-wqDb4D-x.cjs +0 -1
  67. package/dist/ProjectPanel-XODJTO4J.js +0 -99
  68. package/dist/ProjectPanel-fWESzHr6.cjs +0 -1
  69. package/dist/SidePanels-lrMQqc0h.cjs +0 -1
  70. package/dist/Topbar-RrCDxd0i.cjs +0 -1
  71. package/dist/UILibrariesPanel-7btHgBD0.cjs +0 -1
  72. package/dist/UnsplashImages-6UjgojvF.cjs +0 -1
  73. package/dist/UploadImages-3h0cRsvr.cjs +0 -1
  74. package/dist/_commonjsHelpers-UyOWmZb0.js +0 -8
  75. package/dist/_commonjsHelpers-wDK0ZLPo.cjs +0 -1
  76. package/dist/add-page-modal-RwIj1FxH.cjs +0 -1
  77. package/dist/add-page-modal-TOfMfmPA.js +0 -115
  78. package/dist/confirm-alert-eIp2cAkc.js +0 -60
  79. package/dist/confirm-alert-v1lG8ex4.cjs +0 -1
  80. package/dist/controls-rRZhz0vu.cjs +0 -1
  81. package/dist/controls-yjgoZzB6.js +0 -199
  82. package/dist/delete-page-modal-4bxjpVBD.js +0 -97
  83. package/dist/delete-page-modal-qYDZmpgT.cjs +0 -1
  84. package/dist/email-blocks.cjs +0 -1
  85. package/dist/email-blocks.d.ts +0 -3
  86. package/dist/email-blocks.js +0 -294
  87. package/dist/email.cjs +0 -1
  88. package/dist/email.d.ts +0 -171
  89. package/dist/email.js +0 -90
  90. package/dist/empty-slot-Lsxjts7Q.js +0 -6
  91. package/dist/empty-slot-Sy930lX6.cjs +0 -1
  92. package/dist/form-4jTocVbZ.cjs +0 -1
  93. package/dist/form-NAzFjGs0.js +0 -125
  94. package/dist/functions--tdNWQDW.js +0 -30
  95. package/dist/functions-EVUeSwX1.cjs +0 -1
  96. package/dist/html-to-json-NqRjgFqp.cjs +0 -1
  97. package/dist/html-to-json-l_mw5y-e.js +0 -243
  98. package/dist/index--k2M8kzI.cjs +0 -1
  99. package/dist/index--mLLy7QQ.cjs +0 -1
  100. package/dist/index-5XyNUAjc.cjs +0 -290
  101. package/dist/index-C7mB4XFm.js +0 -3141
  102. package/dist/index-VBXQixVm.js +0 -117
  103. package/dist/index-YZhtVcj_.js +0 -2201
  104. package/dist/index-aeDphKpP.cjs +0 -1
  105. package/dist/index-lFgDm1oa.js +0 -83780
  106. package/dist/jsx-runtime-Z_BpKhVy.cjs +0 -27
  107. package/dist/lib.cjs +0 -3
  108. package/dist/lib.d.ts +0 -80
  109. package/dist/lib.js +0 -1350
  110. package/dist/page-viewer-4wrnWnK0.js +0 -124
  111. package/dist/page-viewer-ra0GLx1p.cjs +0 -1
  112. package/dist/project-general-setting-IwZUkYF3.js +0 -90
  113. package/dist/project-general-setting-lFjTUhHD.cjs +0 -1
  114. package/dist/project-seo-setting-e1fTqVsd.js +0 -83
  115. package/dist/project-seo-setting-o0V9acCV.cjs +0 -1
  116. package/dist/server.cjs +0 -1
  117. package/dist/server.d.ts +0 -299
  118. package/dist/server.js +0 -216
  119. package/dist/single-page-detail-ZNWFKqLW.js +0 -229
  120. package/dist/single-page-detail-g55Anu7R.cjs +0 -1
  121. package/dist/studio.cjs +0 -1
  122. package/dist/studio.d.ts +0 -176
  123. package/dist/studio.js +0 -67
  124. package/dist/utils-D_vtk3zK.cjs +0 -1
  125. 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,90 +0,0 @@
1
- import { j as i } from "./jsx-runtime-WbnYoNE9.js";
2
- import { C as p } from "./index-lFgDm1oa.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-C7mB4XFm.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 "prop-types";
46
- import "react-hotkeys-hook";
47
- import "@floating-ui/dom";
48
- import "@floating-ui/react-dom";
49
- import "flagged";
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";
63
- const n = [
64
- {
65
- title: "Mobile",
66
- content: "Mobile email client",
67
- breakpoint: "xs",
68
- icon: /* @__PURE__ */ i.jsx(t, {}),
69
- width: 400
70
- },
71
- {
72
- title: "Email Client",
73
- content: "Content as seen inside an email client",
74
- breakpoint: "sm",
75
- icon: /* @__PURE__ */ i.jsx(t, { className: "rotate-90" }),
76
- width: 700
77
- }
78
- ], bi = (o) => {
79
- const r = {
80
- ...o,
81
- filterChaiBlock: (m) => e(m.type, "Email/"),
82
- importHTMLSupport: !1,
83
- dataBindingSupport: !1,
84
- breakpoints: n
85
- };
86
- return /* @__PURE__ */ i.jsx(p, { ...r });
87
- };
88
- export {
89
- bi as ChaiBuilderEmail
90
- };
@@ -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;
@@ -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=$;
@@ -1,125 +0,0 @@
1
- import { j as u } from "./jsx-runtime-WbnYoNE9.js";
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
- 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), F(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 = P(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
- x,
99
- {
100
- widgets: {
101
- richtext: b,
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: $,
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 +0,0 @@
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;