@chaibuilder/sdk 3.0.29 → 3.1.0
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/apply-binding-BEdnEDe4.cjs +1 -0
- package/dist/apply-binding-FoDMumPo.js +704 -0
- package/dist/{code-editor-BHRtO5S6.cjs → code-editor-BF_Dj7wT.cjs} +1 -1
- package/dist/{code-editor-DlWYye4v.js → code-editor-DHjchara.js} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +15 -2
- package/dist/core.js +82 -78
- package/dist/{index-CtXUapBz.js → index-0I-fi22L.js} +1172 -1156
- package/dist/index-kJFsIwFo.cjs +128 -0
- package/dist/render.cjs +1 -1
- package/dist/render.js +2 -2
- package/dist/{rte-widget-modal-B4C7jBcN.cjs → rte-widget-modal-BZJ8UA08.cjs} +1 -1
- package/dist/{rte-widget-modal-CqBZ4WKt.js → rte-widget-modal-DxyV3u6C.js} +1 -1
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +326 -322
- package/package.json +2 -2
- package/dist/apply-binding-BIYK6lOq.cjs +0 -1
- package/dist/apply-binding-YbVf4970.js +0 -685
- package/dist/index-DY3WTMms.cjs +0 -128
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./index-kJFsIwFo.cjs");require("lodash-es");require("clsx");require("tailwind-merge");require("tree-model");const i=require("react");require("jotai");require("@chaibuilder/runtime");require("sonner");const q=require("react-i18next"),r=require("./tooltip-C2BCZ8Al.cjs"),g=require("@react-hookz/web"),m=n=>{const s=document.createElement("div");return s.innerHTML=n,s.innerHTML};function j(){const{t:n}=q.useTranslation(),[s,h]=i.useState(!1),[a,p]=i.useState(""),[t,d]=c.useCodeEditor(),[u]=c.useSelectedBlockIds(),b=c.useUpdateBlocksProps(),f=c.useUpdateBlocksPropsRealtime(),C=g.useThrottledCallback(o=>{const l=m(o);f([t.blockId],{[t.blockProp]:l})},[],300),x=i.useCallback(()=>{if(s){const o=m(a);b([t.blockId],{[t.blockProp]:o})}},[s,a]);i.useEffect(()=>{u.includes(t==null?void 0:t.blockId)||(x(),d(null))},[u]);const k=()=>{x(),d(null)};return e.jsx(r.Dialog,{open:!0,onOpenChange:k,children:e.jsxs(r.DialogContent,{className:"flex max-h-[400px] min-h-[200px] max-w-4xl flex-col border-gray-700 text-black",children:[e.jsx(r.DialogHeader,{className:"shrink-0 border-b border-gray-700 pb-3",children:e.jsx(r.DialogTitle,{className:"flex items-center justify-between text-black",children:e.jsxs("div",{className:"space-x-3 text-sm font-semibold",children:[e.jsx("span",{children:n("HTML Code Editor |")}),e.jsx("span",{className:"text-xs text-gray-400",children:n("Scripts will be only executed in preview and live mode.")})]})})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(r.Textarea,{className:"h-full w-full resize-none font-mono text-xs",value:a||t.initialCode,onChange:o=>{const l=o.target.value;h(!0),p(l),C(l)},rows:10,placeholder:"Enter your code here..."})})]})})}exports.default=j;
|
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-kJFsIwFo.cjs"),s=require("./common-functions-BZmyleS1.cjs"),a=require("./apply-binding-BEdnEDe4.cjs"),i=require("react-i18next"),l=require("i18next");exports.ChaiAddBlocksDialog=e.AddBlocksDialog;exports.ChaiAddBlocksPanel=e.AddBlocksPanel;exports.ChaiAskAiUserPrompt=e.AIUserPrompt;exports.ChaiBlockAttributesEditor=e.BlockAttributesEditor;exports.ChaiBlockPropsEditor=e.BlockSettings;exports.ChaiBlockStyleEditor=e.BlockStyling;exports.ChaiBuilderCanvas=e.CanvasArea;exports.ChaiBuilderEditor=e.ChaiBuilderEditor;exports.ChaiDarkModeSwitcher=e.DarkMode;exports.ChaiDefaultBlocks=e.DefaultChaiBlocks;exports.ChaiImportHTML=e.ImportHTML;exports.ChaiOutline=e.ListTree;exports.ChaiScreenSizes=e.Breakpoints;exports.ChaiThemeConfigPanel=e.ThemeConfigPanel;exports.ChaiUILibrariesPanel=e.UILibrariesPanel;exports.ChaiUndoRedo=e.UndoRedo;exports.IfChaiFeatureFlag=e.IfChaiFeatureFlag;exports.PERMISSIONS=e.PERMISSIONS;exports.registerBlockSettingField=e.registerBlockSettingField;exports.registerBlockSettingTemplate=e.registerBlockSettingTemplate;exports.registerBlockSettingWidget=e.registerBlockSettingWidget;exports.registerChaiAddBlockTab=e.registerChaiAddBlockTab;exports.registerChaiFeatureFlag=e.registerChaiFeatureFlag;exports.registerChaiFeatureFlags=e.registerChaiFeatureFlags;exports.registerChaiLibrary=e.registerChaiLibrary;exports.registerChaiMediaManager=e.registerChaiMediaManager;exports.registerChaiPreImportHTMLHook=e.registerChaiPreImportHTMLHook;exports.registerChaiSaveToLibrary=e.registerChaiSaveToLibrary;exports.registerChaiSidebarPanel=e.registerChaiSidebarPanel;exports.registerChaiTopBar=e.registerChaiTopBar;exports.useAddBlock=e.useAddBlock;exports.useAddClassesToBlocks=e.useAddClassesToBlocks;exports.useAskAi=e.useAskAi;exports.useBlockHighlight=e.useBlockHighlight;exports.useBlocksHtmlForAi=e.useBlocksHtmlForAi;exports.useBlocksStore=e.useBlocksStore;exports.useBlocksStoreUndoableActions=e.useBlocksStoreUndoableActions;exports.useBrandingOptions=e.useBrandingOptions;exports.useBuilderProp=e.useBuilderProp;exports.useBuilderReset=e.useBuilderReset;exports.useCanvasDisplayWidth=e.useCanvasDisplayWidth;exports.useCanvasZoom=e.useCanvasZoom;exports.useChaiFeatureFlag=e.useChaiFeatureFlag;exports.useChaiFeatureFlags=e.useChaiFeatureFlags;exports.useCodeEditor=e.useCodeEditor;exports.useCopyBlockIds=e.useCopyBlocks;exports.useCopyToClipboard=e.useCopyToClipboard;exports.useCurrentPage=e.useCurrentPage;exports.useCutBlockIds=e.useCutBlockIds;exports.useDarkMode=e.useDarkMode;exports.useDuplicateBlocks=e.useDuplicateBlocks;exports.useHighlightBlockId=e.useHighlightBlockId;exports.useHtmlToBlocks=e.useHtmlToBlocks;exports.useI18nBlocks=e.useI18nBlocks;exports.useInlineEditing=e.useInlineEditing;exports.useIsPageLoaded=e.useIsPageLoaded;exports.useLanguages=e.useLanguages;exports.useLibraryBlocks=e.useLibraryBlocks;exports.useMediaManagerComponent=e.useMediaManagerComponent;exports.usePartailBlocksStore=e.usePartialBlocksStore;exports.usePartialBlocksList=e.usePartialBlocksList;exports.usePasteBlocks=e.usePasteBlocks;exports.usePermissions=e.usePermissions;exports.usePreviewMode=e.usePreviewMode;exports.useRemoveAllClassesForBlock=e.useRemoveAllClassesForBlock;exports.useRemoveBlocks=e.useRemoveBlocks;exports.useRemoveClassesFromBlocks=e.useRemoveClassesFromBlocks;exports.useReplaceBlock=e.useReplaceBlock;exports.useResetBlockStyles=e.useResetBlockStyles;exports.useRightPanel=e.useRightPanel;exports.useSavePage=e.useSavePage;exports.useScreenSizeWidth=e.useScreenSizeWidth;exports.useSelectedBlock=e.useSelectedBlock;exports.useSelectedBlockAllClasses=e.useSelectedBlockAllClasses;exports.useSelectedBlockCurrentClasses=e.useSelectedBlockCurrentClasses;exports.useSelectedBlockIds=e.useSelectedBlockIds;exports.useSelectedBlocksDisplayChild=e.useSelectedBlocksDisplayChild;exports.useSelectedBreakpoints=e.useSelectedBreakpoints;exports.useSelectedLibrary=e.useSelectedLibrary;exports.useSelectedStylingBlocks=e.useSelectedStylingBlocks;exports.useSidebarActivePanel=e.useSidebarActivePanel;exports.useStreamMultipleBlocksProps=e.useStreamMultipleBlocksProps;exports.useStylingBreakpoint=e.useStylingBreakpoint;exports.useStylingState=e.useStylingState;exports.useTheme=e.useTheme;exports.useThemeOptions=e.useThemeOptions;exports.useToggleChaiFeatureFlag=e.useToggleChaiFeatureFlag;exports.useUndoManager=e.useUndoManager;exports.useUpdateBlocksProps=e.useUpdateBlocksProps;exports.useUpdateBlocksPropsRealtime=e.useUpdateBlocksPropsRealtime;exports.useWrapperBlock=e.useWrapperBlock;exports.generateBlockId=s.generateUUID;exports.mergeClasses=s.cn;exports.convertHTMLToChaiBlocks=a.getBlocksFromHTML;exports.getBlocksFromHTML=a.getBlocksFromHTML;Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:()=>i.useTranslation});exports.i18n=l;
|
package/dist/core.d.ts
CHANGED
|
@@ -264,7 +264,10 @@ export declare interface ChaiBuilderEditorProps {
|
|
|
264
264
|
/**
|
|
265
265
|
* temporary props. Not to be used in production
|
|
266
266
|
*/
|
|
267
|
-
|
|
267
|
+
flags?: {
|
|
268
|
+
librarySite?: boolean;
|
|
269
|
+
useClipboard?: boolean;
|
|
270
|
+
};
|
|
268
271
|
}
|
|
269
272
|
|
|
270
273
|
declare type ChaiBuilderThemeOptions = {
|
|
@@ -563,6 +566,8 @@ export declare const useBlockHighlight: () => {
|
|
|
563
566
|
lastHighlighted: HTMLElement;
|
|
564
567
|
};
|
|
565
568
|
|
|
569
|
+
export declare const useBlocksHtmlForAi: () => () => any;
|
|
570
|
+
|
|
566
571
|
export declare const useBlocksStore: () => [any[], (args_0: any[] | ((prev: any[]) => any[])) => void];
|
|
567
572
|
|
|
568
573
|
export declare const useBlocksStoreUndoableActions: () => {
|
|
@@ -582,7 +587,7 @@ export declare const useBlocksStoreUndoableActions: () => {
|
|
|
582
587
|
*/
|
|
583
588
|
export declare const useBrandingOptions: () => readonly [any, (args_0: any) => void];
|
|
584
589
|
|
|
585
|
-
export declare const useBuilderProp: <T>(propKey: keyof Omit<ChaiBuilderEditorProps, ExcludedBuilderProps> | "languages", defaultValue?: T) => T;
|
|
590
|
+
export declare const useBuilderProp: <T>(propKey: keyof Omit<ChaiBuilderEditorProps, ExcludedBuilderProps> | "languages" | string, defaultValue?: T) => T;
|
|
586
591
|
|
|
587
592
|
export declare const useBuilderReset: () => () => void;
|
|
588
593
|
|
|
@@ -629,6 +634,10 @@ export declare const useDuplicateBlocks: () => Function;
|
|
|
629
634
|
*/
|
|
630
635
|
export declare const useHighlightBlockId: () => [string, Function];
|
|
631
636
|
|
|
637
|
+
export declare const useHtmlToBlocks: () => (html: string) => ChaiBlock[];
|
|
638
|
+
|
|
639
|
+
export declare const useI18nBlocks: () => (lang?: string | "ALL") => Pick<any, string>[];
|
|
640
|
+
|
|
632
641
|
export declare const useInlineEditing: () => {
|
|
633
642
|
editingBlockId: string;
|
|
634
643
|
editingItemIndex: number;
|
|
@@ -755,6 +764,10 @@ export declare const useSelectedStylingBlocks: () => [TStyleBlock[], (args_0: TS
|
|
|
755
764
|
|
|
756
765
|
export declare const useSidebarActivePanel: () => [string, (args_0: string | ((prev: string) => string)) => void];
|
|
757
766
|
|
|
767
|
+
export declare const useStreamMultipleBlocksProps: () => (blocks: Array<{
|
|
768
|
+
_id: string;
|
|
769
|
+
} & Partial<ChaiBlock>>) => Promise<void>;
|
|
770
|
+
|
|
758
771
|
export declare const useStylingBreakpoint: () => [string, (args_0: string | RESET | ((prev: string) => string | RESET)) => void];
|
|
759
772
|
|
|
760
773
|
export declare const useStylingState: () => [unknown, (...args: unknown[]) => unknown];
|
package/dist/core.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { j as e, A as
|
|
2
|
-
import { g as
|
|
3
|
-
import { h as
|
|
4
|
-
import { useTranslation as
|
|
5
|
-
import { default as
|
|
1
|
+
import { j as e, A as o, f as i, k as l, B as r, e as t, C as u, i as c, D as d, l as B, I as k, L as C, g, T as n, U as h, h as p, x as S, P as m, m as P, n as F, o as T, r as A, y, z as I, q as M, s as b, p as v, t as L, v as f, w as R, J as H, K as D, M as E, O as U, Q as x, R as O, ay as W, S as w, V as z, W as j, az as q, X as Z, E as G, F as J, u as K, Y as N, Z as Q, _ as V, $ as X, a0 as Y, a1 as _, a2 as $, a3 as aa, a4 as sa, a5 as ea, a6 as oa, a7 as ia, a8 as la, H as ra, a9 as ta, aa as ua, ab as ca, ac as da, ad as Ba, ae as ka, af as Ca, ag as ga, ah as na, ai as ha, aj as pa, ak as Sa, aA as ma, al as Pa, am as Fa, an as Ta, a as Aa, ao as ya, ap as Ia, aB as Ma, aq as ba, aC as va, ar as La, as as fa, at as Ra, au as Ha, av as Da, G as Ea, aw as Ua, b as xa, c as Oa, ax as Wa } from "./index-0I-fi22L.js";
|
|
2
|
+
import { g as za, c as ja } from "./common-functions-BGzDsf1z.js";
|
|
3
|
+
import { h as Za, h as Ga } from "./apply-binding-FoDMumPo.js";
|
|
4
|
+
import { useTranslation as Ka } from "react-i18next";
|
|
5
|
+
import { default as Qa } from "i18next";
|
|
6
6
|
export {
|
|
7
7
|
e as ChaiAddBlocksDialog,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
o as ChaiAddBlocksPanel,
|
|
9
|
+
i as ChaiAskAiUserPrompt,
|
|
10
|
+
l as ChaiBlockAttributesEditor,
|
|
11
|
+
r as ChaiBlockPropsEditor,
|
|
12
12
|
t as ChaiBlockStyleEditor,
|
|
13
13
|
u as ChaiBuilderCanvas,
|
|
14
14
|
c as ChaiBuilderEditor,
|
|
15
15
|
d as ChaiDarkModeSwitcher,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
B as ChaiDefaultBlocks,
|
|
17
|
+
k as ChaiImportHTML,
|
|
18
|
+
C as ChaiOutline,
|
|
19
|
+
g as ChaiScreenSizes,
|
|
20
20
|
n as ChaiThemeConfigPanel,
|
|
21
21
|
h as ChaiUILibrariesPanel,
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
p as ChaiUndoRedo,
|
|
23
|
+
S as IfChaiFeatureFlag,
|
|
24
24
|
m as PERMISSIONS,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
Za as convertHTMLToChaiBlocks,
|
|
26
|
+
za as generateBlockId,
|
|
27
|
+
Ga as getBlocksFromHTML,
|
|
28
|
+
Qa as i18n,
|
|
29
|
+
ja as mergeClasses,
|
|
30
30
|
P as registerBlockSettingField,
|
|
31
31
|
F as registerBlockSettingTemplate,
|
|
32
32
|
T as registerBlockSettingWidget,
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
A as registerChaiAddBlockTab,
|
|
34
|
+
y as registerChaiFeatureFlag,
|
|
35
35
|
I as registerChaiFeatureFlags,
|
|
36
36
|
M as registerChaiLibrary,
|
|
37
37
|
b as registerChaiMediaManager,
|
|
@@ -39,62 +39,66 @@ export {
|
|
|
39
39
|
L as registerChaiSaveToLibrary,
|
|
40
40
|
f as registerChaiSidebarPanel,
|
|
41
41
|
R as registerChaiTopBar,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
H as useAddBlock,
|
|
43
|
+
D as useAddClassesToBlocks,
|
|
44
|
+
E as useAskAi,
|
|
45
45
|
U as useBlockHighlight,
|
|
46
|
-
x as
|
|
47
|
-
O as
|
|
48
|
-
W as
|
|
49
|
-
w as
|
|
50
|
-
z as
|
|
51
|
-
j as
|
|
52
|
-
q as
|
|
53
|
-
Z as
|
|
54
|
-
G as
|
|
55
|
-
J as
|
|
56
|
-
K as
|
|
57
|
-
N as
|
|
58
|
-
Q as
|
|
59
|
-
V as
|
|
60
|
-
X as
|
|
61
|
-
Y as
|
|
62
|
-
_ as
|
|
63
|
-
$ as
|
|
64
|
-
aa as
|
|
65
|
-
sa as
|
|
66
|
-
ea as
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
ta as
|
|
72
|
-
ua as
|
|
73
|
-
ca as
|
|
74
|
-
da as
|
|
46
|
+
x as useBlocksHtmlForAi,
|
|
47
|
+
O as useBlocksStore,
|
|
48
|
+
W as useBlocksStoreUndoableActions,
|
|
49
|
+
w as useBrandingOptions,
|
|
50
|
+
z as useBuilderProp,
|
|
51
|
+
j as useBuilderReset,
|
|
52
|
+
q as useCanvasDisplayWidth,
|
|
53
|
+
Z as useCanvasZoom,
|
|
54
|
+
G as useChaiFeatureFlag,
|
|
55
|
+
J as useChaiFeatureFlags,
|
|
56
|
+
K as useCodeEditor,
|
|
57
|
+
N as useCopyBlockIds,
|
|
58
|
+
Q as useCopyToClipboard,
|
|
59
|
+
V as useCurrentPage,
|
|
60
|
+
X as useCutBlockIds,
|
|
61
|
+
Y as useDarkMode,
|
|
62
|
+
_ as useDuplicateBlocks,
|
|
63
|
+
$ as useHighlightBlockId,
|
|
64
|
+
aa as useHtmlToBlocks,
|
|
65
|
+
sa as useI18nBlocks,
|
|
66
|
+
ea as useInlineEditing,
|
|
67
|
+
oa as useIsPageLoaded,
|
|
68
|
+
ia as useLanguages,
|
|
69
|
+
la as useLibraryBlocks,
|
|
70
|
+
ra as useMediaManagerComponent,
|
|
71
|
+
ta as usePartailBlocksStore,
|
|
72
|
+
ua as usePartialBlocksList,
|
|
73
|
+
ca as usePasteBlocks,
|
|
74
|
+
da as usePermissions,
|
|
75
|
+
Ba as usePreviewMode,
|
|
76
|
+
ka as useRemoveAllClassesForBlock,
|
|
77
|
+
Ca as useRemoveBlocks,
|
|
75
78
|
ga as useRemoveClassesFromBlocks,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
79
|
+
na as useReplaceBlock,
|
|
80
|
+
ha as useResetBlockStyles,
|
|
81
|
+
pa as useRightPanel,
|
|
82
|
+
Sa as useSavePage,
|
|
83
|
+
ma as useScreenSizeWidth,
|
|
84
|
+
Pa as useSelectedBlock,
|
|
85
|
+
Fa as useSelectedBlockAllClasses,
|
|
86
|
+
Ta as useSelectedBlockCurrentClasses,
|
|
87
|
+
Aa as useSelectedBlockIds,
|
|
88
|
+
ya as useSelectedBlocksDisplayChild,
|
|
89
|
+
Ia as useSelectedBreakpoints,
|
|
90
|
+
Ma as useSelectedLibrary,
|
|
91
|
+
ba as useSelectedStylingBlocks,
|
|
92
|
+
va as useSidebarActivePanel,
|
|
93
|
+
La as useStreamMultipleBlocksProps,
|
|
94
|
+
fa as useStylingBreakpoint,
|
|
95
|
+
Ra as useStylingState,
|
|
96
|
+
Ha as useTheme,
|
|
97
|
+
Da as useThemeOptions,
|
|
98
|
+
Ea as useToggleChaiFeatureFlag,
|
|
99
|
+
Ka as useTranslation,
|
|
100
|
+
Ua as useUndoManager,
|
|
101
|
+
xa as useUpdateBlocksProps,
|
|
102
|
+
Oa as useUpdateBlocksPropsRealtime,
|
|
103
|
+
Wa as useWrapperBlock
|
|
100
104
|
};
|