@chaibuilder/sdk 3.0.28 → 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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./index-BtVNiUIw.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-CzZ7Fvt7.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;
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;
@@ -1,5 +1,5 @@
1
1
  import { jsx as o, jsxs as d } from "react/jsx-runtime";
2
- import { u as C, a as k, b as v, c as g } from "./index-Ct0lOt4c.js";
2
+ import { u as C, a as k, b as v, c as g } from "./index-0I-fi22L.js";
3
3
  import "lodash-es";
4
4
  import "clsx";
5
5
  import "tailwind-merge";
@@ -9,7 +9,7 @@ import "jotai";
9
9
  import "@chaibuilder/runtime";
10
10
  import "sonner";
11
11
  import { useTranslation as w } from "react-i18next";
12
- import { a1 as N, a3 as E, a6 as D, a9 as H, b1 as P } from "./tooltip-Bz2MxMHf.js";
12
+ import { a1 as N, a3 as E, a6 as D, a9 as H, b1 as P } from "./tooltip-4-b9QGDK.js";
13
13
  import { useThrottledCallback as B } from "@react-hookz/web";
14
14
  const p = (a) => {
15
15
  const t = document.createElement("div");
package/dist/core.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BtVNiUIw.cjs"),s=require("./common-functions-BZmyleS1.cjs"),a=require("./apply-binding-BIYK6lOq.cjs"),i=require("react-i18next"),r=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.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.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.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=r;
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
- _tempProps?: Record<string, any>;
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 i, f as o, k as r, B as l, e as t, C as u, i as c, D as d, l as g, I as C, L as k, g as B, T as n, U as h, h as S, x as p, P as m, m as P, n as F, o as T, r as y, y as A, z as I, q as M, s as b, p as v, t as L, v as f, w as R, J as D, K as E, M as H, O as U, Q as x, au as O, R as W, S as w, V as z, av as j, W as q, E as Z, F as G, u as J, X 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, H as ia, a6 as oa, a7 as ra, a8 as la, a9 as ta, aa as ua, ab as ca, ac as da, ad as ga, ae as Ca, af as ka, ag as Ba, ah as na, aw as ha, ai as Sa, aj as pa, ak as ma, a as Pa, al as Fa, am as Ta, ax as ya, an as Aa, ay as Ia, ao as Ma, ap as ba, aq as va, ar as La, G as fa, as as Ra, b as Da, c as Ea, at as Ha } from "./index-Ct0lOt4c.js";
2
- import { g as xa, c as Oa } from "./common-functions-BGzDsf1z.js";
3
- import { h as wa, h as za } from "./apply-binding-YbVf4970.js";
4
- import { useTranslation as qa } from "react-i18next";
5
- import { default as Ga } from "i18next";
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
- i as ChaiAddBlocksPanel,
9
- o as ChaiAskAiUserPrompt,
10
- r as ChaiBlockAttributesEditor,
11
- l as ChaiBlockPropsEditor,
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
- g as ChaiDefaultBlocks,
17
- C as ChaiImportHTML,
18
- k as ChaiOutline,
19
- B as ChaiScreenSizes,
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
- S as ChaiUndoRedo,
23
- p as IfChaiFeatureFlag,
22
+ p as ChaiUndoRedo,
23
+ S as IfChaiFeatureFlag,
24
24
  m as PERMISSIONS,
25
- wa as convertHTMLToChaiBlocks,
26
- xa as generateBlockId,
27
- za as getBlocksFromHTML,
28
- Ga as i18n,
29
- Oa as mergeClasses,
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
- y as registerChaiAddBlockTab,
34
- A as registerChaiFeatureFlag,
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
- D as useAddBlock,
43
- E as useAddClassesToBlocks,
44
- H as useAskAi,
42
+ H as useAddBlock,
43
+ D as useAddClassesToBlocks,
44
+ E as useAskAi,
45
45
  U as useBlockHighlight,
46
- x as useBlocksStore,
47
- O as useBlocksStoreUndoableActions,
48
- W as useBrandingOptions,
49
- w as useBuilderProp,
50
- z as useBuilderReset,
51
- j as useCanvasDisplayWidth,
52
- q as useCanvasZoom,
53
- Z as useChaiFeatureFlag,
54
- G as useChaiFeatureFlags,
55
- J as useCodeEditor,
56
- K as useCopyBlockIds,
57
- N as useCopyToClipboard,
58
- Q as useCurrentPage,
59
- V as useCutBlockIds,
60
- X as useDarkMode,
61
- Y as useDuplicateBlocks,
62
- _ as useHighlightBlockId,
63
- $ as useInlineEditing,
64
- aa as useIsPageLoaded,
65
- sa as useLanguages,
66
- ea as useLibraryBlocks,
67
- ia as useMediaManagerComponent,
68
- oa as usePartailBlocksStore,
69
- ra as usePartialBlocksList,
70
- la as usePasteBlocks,
71
- ta as usePermissions,
72
- ua as usePreviewMode,
73
- ca as useRemoveAllClassesForBlock,
74
- da as useRemoveBlocks,
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
- Ca as useReplaceBlock,
77
- ka as useResetBlockStyles,
78
- Ba as useRightPanel,
79
- na as useSavePage,
80
- ha as useScreenSizeWidth,
81
- Sa as useSelectedBlock,
82
- pa as useSelectedBlockAllClasses,
83
- ma as useSelectedBlockCurrentClasses,
84
- Pa as useSelectedBlockIds,
85
- Fa as useSelectedBlocksDisplayChild,
86
- Ta as useSelectedBreakpoints,
87
- ya as useSelectedLibrary,
88
- Aa as useSelectedStylingBlocks,
89
- Ia as useSidebarActivePanel,
90
- Ma as useStylingBreakpoint,
91
- ba as useStylingState,
92
- va as useTheme,
93
- La as useThemeOptions,
94
- fa as useToggleChaiFeatureFlag,
95
- qa as useTranslation,
96
- Ra as useUndoManager,
97
- Da as useUpdateBlocksProps,
98
- Ea as useUpdateBlocksPropsRealtime,
99
- Ha as useWrapperBlock
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
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as a, jsxs as m } from "react/jsx-runtime";
2
2
  import * as x from "react";
3
- import { a1 as V, a3 as T, a6 as N, a9 as R, a4 as E, v as y, au as I, b1 as D, a5 as A } from "./tooltip-Bz2MxMHf.js";
3
+ import { a1 as V, a3 as T, a6 as N, a9 as R, a4 as E, v as y, au as I, b1 as D, a5 as A } from "./tooltip-4-b9QGDK.js";
4
4
  import * as b from "culori";
5
5
  import { getAllRegisteredFonts as P } from "@chaibuilder/runtime";
6
6
  import { useTranslation as H } from "react-i18next";
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),w=require("react"),i=require("./tooltip-CzZ7Fvt7.cjs"),T=require("culori"),V=require("@chaibuilder/runtime"),N=require("react-i18next");function $(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const S=$(w),y=$(T),f=e=>e?e%1===0?e:e.toFixed(4):"0",R=e=>`hsl(${f(e.h)} ${f(e.s*100)}% ${f(e.l*100)}%)`,E=(e,o="hsl",t="4")=>{try{const r=y.parse(e);if(!r)throw new Error("Invalid color input");switch(o){case"hsl":{const s=y.converter("hsl")(r);return t==="4"?R(s):`${f(s.h)} ${f(s.s*100)}% ${f(s.l*100)}%`}case"rgb":return y.formatRgb(r);case"oklch":{const s=y.converter("oklch")(r);return`oklch(${f(s.l)} ${f(s.c)} ${f(s.h)})`}case"hex":return y.formatHex(r);default:return e}}catch(r){return console.error(`Failed to convert color: ${e}`,r),e}},b=e=>E(e,"hex"),I=e=>{const o={fontFamily:{heading:"",body:""},borderRadius:"",colors:{}};try{const t=F(e);if(!t.isValid)return console.warn("CSS validation failed:",t.error),k();const r=C(e,":root"),s=C(e,".dark"),c=m(r,"--font-sans")||m(r,"--font-family")||m(r,"--font-heading")||m(r,"--font-body"),a=D(c);o.fontFamily={heading:a,body:a};const u=m(r,"--radius")||m(r,"--border-radius")||"0.5rem";o.borderRadius=P(u),["background","foreground","primary","primary-foreground","secondary","secondary-foreground","muted","muted-foreground","accent","accent-foreground","destructive","destructive-foreground","border","input","ring","card","card-foreground","popover","popover-foreground"].forEach(l=>{const p=m(r,`--${l}`),g=m(s,`--${l}`);if(p||g){const d=p?v(p):"#000000",x=g?v(g):d;o.colors[l]=[d,x]}})}catch(t){return console.error("Error parsing CSS to ChaiThemeValues:",t),k()}return o},C=(e,o)=>{var r,s;const t=new RegExp(`${j(o)}\\s*{([^}]+)}`);return((s=(r=e.match(t))==null?void 0:r[1])==null?void 0:s.trim())||null},m=(e,o)=>{var s;if(!e)return null;const t=new RegExp(`${j(o)}\\s*:\\s*([^;]+)`),r=e.match(t);return((s=r==null?void 0:r[1])==null?void 0:s.trim())||null},v=e=>{if(!e||typeof e!="string")return"#000000";try{const o=e.replace(/var\([^)]+\)/g,"").trim();if(!o)return"#000000";if(/^[a-z]+$/i.test(o))return b(o)||"#000000";if(/^#?([0-9A-F]{3,4}|[0-9A-F]{6}|[0-9A-F]{8})$/i.test(o.replace(/#/g,""))){const r=o.startsWith("#")?o:`#${o}`;return r.length<=5?`#${r.slice(1).split("").map(s=>s+s).join("")}`.slice(0,7):r.length>7?r.slice(0,7):r}if(/^(rgb|hsl|oklch)a?\(/i.test(o))return b(o)||"#000000";const t=o.match(/^(\d+\.?\d*)\s+(\d+\.?\d*)%\s+(\d+\.?\d*)%$/);if(t){const[r,s,c,a]=t,u=`hsl(${s} ${c}% ${a}%)`;return b(u)||"#000000"}if(/^[\d.]+[\s,]+[\d.]+[\s,]+[\d.]+(?:[\s,/]+[\d.]+)?$/.test(o)){const r=o.split(/[\s,]+/).filter(Boolean);if(r.length>=3){const c=r.some(a=>a.includes("%"))?`hsl(${r[0]} ${r[1]} ${r[2]})`:`rgb(${r[0]}, ${r[1]}, ${r[2]})`;return b(c)||"#000000"}}return b(o)||"#000000"}catch(o){return console.warn("Failed to process color:",e,o),"#000000"}},D=e=>{const o=V.getAllRegisteredFonts();if(!e)return"ui-sans-serif, system-ui, sans-serif";try{const r=e.replace(/["']/g,"").trim().split(",")[0].trim(),s=o.find(c=>c.family.toLowerCase()===r.toLowerCase());return(s==null?void 0:s.family)||"ui-sans-serif, system-ui, sans-serif"}catch(t){return console.warn("Error processing font family:",e,t),"ui-sans-serif, system-ui, sans-serif"}},P=e=>{if(!e)return"8px";try{const o=e.trim();if(o.endsWith("px"))return o;if(o.endsWith("rem")){const r=parseFloat(o.replace("rem",""));if(!isNaN(r))return`${Math.round(r*16)}px`}if(o.endsWith("em")){const r=parseFloat(o.replace("em",""));if(!isNaN(r))return`${Math.round(r*16)}px`}const t=parseFloat(o);return isNaN(t)?"8px":`${Math.round(t)}px`}catch(o){return console.warn("Error converting border radius to px:",e,o),"8px"}},k=()=>({fontFamily:{heading:"ui-sans-serif, system-ui, sans-serif",body:"ui-sans-serif, system-ui, sans-serif"},borderRadius:"8px",colors:{background:["#ffffff","#000000"],foreground:["#000000","#ffffff"],primary:["#3b82f6","#60a5fa"],"primary-foreground":["#ffffff","#1e293b"],secondary:["#f1f5f9","#334155"],"secondary-foreground":["#0f172a","#f8fafc"],muted:["#f8fafc","#1e293b"],"muted-foreground":["#64748b","#94a3b8"],accent:["#f1f5f9","#334155"],"accent-foreground":["#0f172a","#f8fafc"],destructive:["#ef4444","#f87171"],"destructive-foreground":["#ffffff","#1e293b"],border:["#e2e8f0","#475569"],input:["#e2e8f0","#475569"],ring:["#3b82f6","#60a5fa"],card:["#ffffff","#0f172a"],"card-foreground":["#000000","#f8fafc"],popover:["#ffffff","#0f172a"],"popover-foreground":["#000000","#f8fafc"]}}),j=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=e=>["background","foreground","primary","primary-foreground"].every(r=>e.colors[r]&&Array.isArray(e.colors[r])&&e.colors[r].length>=2)&&!!e.fontFamily.heading&&!!e.fontFamily.body&&!!e.borderRadius,F=e=>{if(!e||typeof e!="string")return{isValid:!1,error:"Please enter valid CSS content"};const o=e.trim();if(!o)return{isValid:!1,error:"Please enter CSS content"};try{if(!o.includes("{")||!o.includes("}"))return{isValid:!1,error:"Invalid CSS format. CSS should contain proper block structure with { }"};const t=(o.match(/{/g)||[]).length,r=(o.match(/}/g)||[]).length;return t!==r?{isValid:!1,error:"Invalid CSS format. Unmatched braces detected"}:!o.includes("--")||!o.includes(":")?{isValid:!1,error:"Invalid CSS format. CSS should contain variable definitions like --primary: #color"}:!o.includes(":root")&&!o.includes(".dark")?{isValid:!1,error:"CSS should contain at least :root or .dark selector with theme variables"}:{isValid:!0}}catch(t){return console.error("CSS validation error:",t),{isValid:!1,error:"Failed to parse CSS. Please check your syntax."}}},M=`:root {
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),w=require("react"),i=require("./tooltip-C2BCZ8Al.cjs"),T=require("culori"),V=require("@chaibuilder/runtime"),N=require("react-i18next");function $(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const S=$(w),y=$(T),f=e=>e?e%1===0?e:e.toFixed(4):"0",R=e=>`hsl(${f(e.h)} ${f(e.s*100)}% ${f(e.l*100)}%)`,E=(e,o="hsl",t="4")=>{try{const r=y.parse(e);if(!r)throw new Error("Invalid color input");switch(o){case"hsl":{const s=y.converter("hsl")(r);return t==="4"?R(s):`${f(s.h)} ${f(s.s*100)}% ${f(s.l*100)}%`}case"rgb":return y.formatRgb(r);case"oklch":{const s=y.converter("oklch")(r);return`oklch(${f(s.l)} ${f(s.c)} ${f(s.h)})`}case"hex":return y.formatHex(r);default:return e}}catch(r){return console.error(`Failed to convert color: ${e}`,r),e}},b=e=>E(e,"hex"),I=e=>{const o={fontFamily:{heading:"",body:""},borderRadius:"",colors:{}};try{const t=F(e);if(!t.isValid)return console.warn("CSS validation failed:",t.error),k();const r=C(e,":root"),s=C(e,".dark"),c=m(r,"--font-sans")||m(r,"--font-family")||m(r,"--font-heading")||m(r,"--font-body"),a=D(c);o.fontFamily={heading:a,body:a};const u=m(r,"--radius")||m(r,"--border-radius")||"0.5rem";o.borderRadius=P(u),["background","foreground","primary","primary-foreground","secondary","secondary-foreground","muted","muted-foreground","accent","accent-foreground","destructive","destructive-foreground","border","input","ring","card","card-foreground","popover","popover-foreground"].forEach(l=>{const p=m(r,`--${l}`),g=m(s,`--${l}`);if(p||g){const d=p?v(p):"#000000",x=g?v(g):d;o.colors[l]=[d,x]}})}catch(t){return console.error("Error parsing CSS to ChaiThemeValues:",t),k()}return o},C=(e,o)=>{var r,s;const t=new RegExp(`${j(o)}\\s*{([^}]+)}`);return((s=(r=e.match(t))==null?void 0:r[1])==null?void 0:s.trim())||null},m=(e,o)=>{var s;if(!e)return null;const t=new RegExp(`${j(o)}\\s*:\\s*([^;]+)`),r=e.match(t);return((s=r==null?void 0:r[1])==null?void 0:s.trim())||null},v=e=>{if(!e||typeof e!="string")return"#000000";try{const o=e.replace(/var\([^)]+\)/g,"").trim();if(!o)return"#000000";if(/^[a-z]+$/i.test(o))return b(o)||"#000000";if(/^#?([0-9A-F]{3,4}|[0-9A-F]{6}|[0-9A-F]{8})$/i.test(o.replace(/#/g,""))){const r=o.startsWith("#")?o:`#${o}`;return r.length<=5?`#${r.slice(1).split("").map(s=>s+s).join("")}`.slice(0,7):r.length>7?r.slice(0,7):r}if(/^(rgb|hsl|oklch)a?\(/i.test(o))return b(o)||"#000000";const t=o.match(/^(\d+\.?\d*)\s+(\d+\.?\d*)%\s+(\d+\.?\d*)%$/);if(t){const[r,s,c,a]=t,u=`hsl(${s} ${c}% ${a}%)`;return b(u)||"#000000"}if(/^[\d.]+[\s,]+[\d.]+[\s,]+[\d.]+(?:[\s,/]+[\d.]+)?$/.test(o)){const r=o.split(/[\s,]+/).filter(Boolean);if(r.length>=3){const c=r.some(a=>a.includes("%"))?`hsl(${r[0]} ${r[1]} ${r[2]})`:`rgb(${r[0]}, ${r[1]}, ${r[2]})`;return b(c)||"#000000"}}return b(o)||"#000000"}catch(o){return console.warn("Failed to process color:",e,o),"#000000"}},D=e=>{const o=V.getAllRegisteredFonts();if(!e)return"ui-sans-serif, system-ui, sans-serif";try{const r=e.replace(/["']/g,"").trim().split(",")[0].trim(),s=o.find(c=>c.family.toLowerCase()===r.toLowerCase());return(s==null?void 0:s.family)||"ui-sans-serif, system-ui, sans-serif"}catch(t){return console.warn("Error processing font family:",e,t),"ui-sans-serif, system-ui, sans-serif"}},P=e=>{if(!e)return"8px";try{const o=e.trim();if(o.endsWith("px"))return o;if(o.endsWith("rem")){const r=parseFloat(o.replace("rem",""));if(!isNaN(r))return`${Math.round(r*16)}px`}if(o.endsWith("em")){const r=parseFloat(o.replace("em",""));if(!isNaN(r))return`${Math.round(r*16)}px`}const t=parseFloat(o);return isNaN(t)?"8px":`${Math.round(t)}px`}catch(o){return console.warn("Error converting border radius to px:",e,o),"8px"}},k=()=>({fontFamily:{heading:"ui-sans-serif, system-ui, sans-serif",body:"ui-sans-serif, system-ui, sans-serif"},borderRadius:"8px",colors:{background:["#ffffff","#000000"],foreground:["#000000","#ffffff"],primary:["#3b82f6","#60a5fa"],"primary-foreground":["#ffffff","#1e293b"],secondary:["#f1f5f9","#334155"],"secondary-foreground":["#0f172a","#f8fafc"],muted:["#f8fafc","#1e293b"],"muted-foreground":["#64748b","#94a3b8"],accent:["#f1f5f9","#334155"],"accent-foreground":["#0f172a","#f8fafc"],destructive:["#ef4444","#f87171"],"destructive-foreground":["#ffffff","#1e293b"],border:["#e2e8f0","#475569"],input:["#e2e8f0","#475569"],ring:["#3b82f6","#60a5fa"],card:["#ffffff","#0f172a"],"card-foreground":["#000000","#f8fafc"],popover:["#ffffff","#0f172a"],"popover-foreground":["#000000","#f8fafc"]}}),j=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=e=>["background","foreground","primary","primary-foreground"].every(r=>e.colors[r]&&Array.isArray(e.colors[r])&&e.colors[r].length>=2)&&!!e.fontFamily.heading&&!!e.fontFamily.body&&!!e.borderRadius,F=e=>{if(!e||typeof e!="string")return{isValid:!1,error:"Please enter valid CSS content"};const o=e.trim();if(!o)return{isValid:!1,error:"Please enter CSS content"};try{if(!o.includes("{")||!o.includes("}"))return{isValid:!1,error:"Invalid CSS format. CSS should contain proper block structure with { }"};const t=(o.match(/{/g)||[]).length,r=(o.match(/}/g)||[]).length;return t!==r?{isValid:!1,error:"Invalid CSS format. Unmatched braces detected"}:!o.includes("--")||!o.includes(":")?{isValid:!1,error:"Invalid CSS format. CSS should contain variable definitions like --primary: #color"}:!o.includes(":root")&&!o.includes(".dark")?{isValid:!1,error:"CSS should contain at least :root or .dark selector with theme variables"}:{isValid:!0}}catch(t){return console.error("CSS validation error:",t),{isValid:!1,error:"Failed to parse CSS. Please check your syntax."}}},M=`:root {
2
2
  --background: 0 0% 100%;
3
3
  --foreground: oklch(0.52 0.13 144.17);
4
4
  --primary: #3e2723;