@chaibuilder/sdk 2.0.0-beta.3 → 2.0.0-beta.30
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/ChaiThemeFn--DgGggh_.js +190 -0
- package/dist/ChaiThemeFn-bugxb1Cl.cjs +13 -0
- package/dist/{CodeEditor-0eH8iZVR.js → CodeEditor-4lhmWkV8.js} +18 -19
- package/dist/CodeEditor-TiCZr6Ta.cjs +1 -0
- package/dist/STRINGS-26RPxXyi.cjs +1 -0
- package/dist/STRINGS-BnWT5XcX.js +5 -0
- package/dist/Topbar-Rar8liE-.cjs +1 -0
- package/dist/Topbar-iARshVmF.js +72 -0
- package/dist/{context-menu-I8woggB3.js → context-menu-EDKTnqIV.js} +65 -65
- package/dist/core.cjs +61 -1
- package/dist/core.d.ts +89 -53
- package/dist/core.js +8829 -106
- package/dist/plugin-4xaTkTNB.cjs +1 -0
- package/dist/plugin-GuIj4Ul0.js +24 -0
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +34 -16
- package/dist/render.js +118 -121
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.d.ts +0 -1
- package/dist/runtime.js +0 -20
- package/dist/style.css +1 -1
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.d.ts +26 -25
- package/dist/tailwind.js +2 -2
- package/dist/ui.js +2 -2
- package/dist/web-blocks.cjs +2 -2
- package/dist/web-blocks.js +1279 -684
- package/package.json +6 -9
- package/dist/CodeEditor-11MpHO6f.cjs +0 -1
- package/dist/STRINGS-Xxstm-7I.js +0 -7
- package/dist/STRINGS-Yl7cSWDc.cjs +0 -1
- package/dist/Topbar-mYNWDS80.js +0 -160
- package/dist/Topbar-wetkUwFe.cjs +0 -1
- package/dist/controls-lEwMTdPQ.js +0 -234
- package/dist/controls-p9IwFnPx.cjs +0 -1
- package/dist/index-ElguMY6B.js +0 -8540
- package/dist/index-kmPTldAW.cjs +0 -63
- package/dist/plugin-UiUFs2fK.js +0 -44
- package/dist/plugin-f6SDZ_Or.js +0 -108
- package/dist/plugin-jum1MjXp.cjs +0 -1
- package/dist/plugin-xOpS-UNV.cjs +0 -1
package/dist/core.d.ts
CHANGED
|
@@ -16,10 +16,11 @@ declare type AddBlocks = {
|
|
|
16
16
|
|
|
17
17
|
export declare const AddBlocksDialog: () => JSX_2.Element;
|
|
18
18
|
|
|
19
|
-
export declare const AddBlocksPanel: ({ className, showHeading, parentId, }: {
|
|
19
|
+
export declare const AddBlocksPanel: ({ className, showHeading, parentId, position, }: {
|
|
20
20
|
parentId?: string;
|
|
21
21
|
showHeading?: boolean;
|
|
22
22
|
className?: string;
|
|
23
|
+
position?: number;
|
|
23
24
|
}) => JSX_2.Element;
|
|
24
25
|
|
|
25
26
|
export declare const AISetContext: () => JSX_2.Element;
|
|
@@ -46,6 +47,8 @@ export declare function BlockPropsEditor(): JSX_2.Element;
|
|
|
46
47
|
|
|
47
48
|
export declare function BlockStyleEditor(): JSX_2.Element;
|
|
48
49
|
|
|
50
|
+
declare type BorderRadiusValue = false | string;
|
|
51
|
+
|
|
49
52
|
declare type Breakpoint = {
|
|
50
53
|
title: string;
|
|
51
54
|
content: string;
|
|
@@ -60,13 +63,13 @@ export declare const CHAI_BUILDER_EVENTS: {
|
|
|
60
63
|
SHOW_BLOCK_SETTINGS: string;
|
|
61
64
|
};
|
|
62
65
|
|
|
63
|
-
export declare type ChaiBlock = {
|
|
66
|
+
export declare type ChaiBlock<T = Record<string, any>> = {
|
|
64
67
|
_id: string;
|
|
65
|
-
_type: string;
|
|
66
68
|
_name?: string;
|
|
67
69
|
_parent?: string | null | undefined;
|
|
68
70
|
_bindings?: Record<string, string>;
|
|
69
|
-
|
|
71
|
+
_type: string;
|
|
72
|
+
} & T;
|
|
70
73
|
|
|
71
74
|
export declare const ChaiBuilderCanvas: React_3.FC;
|
|
72
75
|
|
|
@@ -76,6 +79,9 @@ export declare const ChaiBuilderCanvas: React_3.FC;
|
|
|
76
79
|
export declare const ChaiBuilderEditor: React_3.FC<ChaiBuilderEditorProps>;
|
|
77
80
|
|
|
78
81
|
export declare interface ChaiBuilderEditorProps {
|
|
82
|
+
themePresets?: Record<string, Partial<ChaiBuilderThemeValues>>[];
|
|
83
|
+
themeOptions?: ChaiBuilderThemeOptions | ((defaultThemeOptions: ChaiBuilderThemeOptions) => ChaiBuilderThemeOptions);
|
|
84
|
+
theme?: Partial<ChaiBuilderThemeValues>;
|
|
79
85
|
/**
|
|
80
86
|
* onError callback function
|
|
81
87
|
* @param error
|
|
@@ -104,6 +110,14 @@ export declare interface ChaiBuilderEditorProps {
|
|
|
104
110
|
mediaManagerComponent?: React_3.ComponentType<{
|
|
105
111
|
onSelect: (url: string) => void;
|
|
106
112
|
}>;
|
|
113
|
+
/**
|
|
114
|
+
* Add blocks dialog components
|
|
115
|
+
*/
|
|
116
|
+
addBlocksDialogTabs?: {
|
|
117
|
+
key: string;
|
|
118
|
+
tab: ReactComponentType;
|
|
119
|
+
tabContent: ReactComponentType;
|
|
120
|
+
}[];
|
|
107
121
|
/**
|
|
108
122
|
* HTML direction.
|
|
109
123
|
*/
|
|
@@ -159,7 +173,7 @@ export declare interface ChaiBuilderEditorProps {
|
|
|
159
173
|
uiLibraries?: Omit<UILibrary, "blocks">[];
|
|
160
174
|
getUILibraryBlocks?: (library: UILibrary) => Promise<UiLibraryBlock[]>;
|
|
161
175
|
getUILibraryBlock?: (library: UILibrary, uiLibBlock: UiLibraryBlock) => Promise<ChaiBlock[]>;
|
|
162
|
-
|
|
176
|
+
getBlockAsyncProps?: (block: ChaiBlock) => Promise<string>;
|
|
163
177
|
/**
|
|
164
178
|
* Get Global blocks
|
|
165
179
|
*/
|
|
@@ -175,9 +189,7 @@ export declare interface ChaiBuilderEditorProps {
|
|
|
175
189
|
* Blocks for the page
|
|
176
190
|
*/
|
|
177
191
|
blocks?: ChaiBlock[];
|
|
178
|
-
onSave?: ({ blocks,
|
|
179
|
-
brandingOptions?: Record<string, string>;
|
|
180
|
-
theme?: Record<string, string>;
|
|
192
|
+
onSave?: ({ blocks, theme, autoSave }: SavePageData) => Promise<boolean | Error>;
|
|
181
193
|
/**
|
|
182
194
|
* onSaveStateChange callback function
|
|
183
195
|
* @param syncStatus
|
|
@@ -210,14 +222,6 @@ export declare interface ChaiBuilderEditorProps {
|
|
|
210
222
|
* Outline menu items
|
|
211
223
|
*/
|
|
212
224
|
outlineMenuItems?: OutlineMenuItems;
|
|
213
|
-
/**
|
|
214
|
-
* Deprecated: getPages callback function. use collections instead
|
|
215
|
-
*/
|
|
216
|
-
getPages?: () => Promise<ChaiPage[]>;
|
|
217
|
-
/**
|
|
218
|
-
* Unsplash access key
|
|
219
|
-
*/
|
|
220
|
-
unsplashAccessKey?: string;
|
|
221
225
|
_flags?: Record<string, boolean>;
|
|
222
226
|
/**
|
|
223
227
|
* Content locale
|
|
@@ -225,20 +229,29 @@ export declare interface ChaiBuilderEditorProps {
|
|
|
225
229
|
fallbackLang?: string;
|
|
226
230
|
languages?: Array<string>;
|
|
227
231
|
/**
|
|
228
|
-
*
|
|
232
|
+
* Page Types props
|
|
229
233
|
*/
|
|
230
|
-
|
|
231
|
-
|
|
234
|
+
pageTypes?: PageType[];
|
|
235
|
+
searchPageTypeItems?: (pageTypeKey: string, query: string) => Promise<PageTypeItem[] | Error>;
|
|
232
236
|
}
|
|
233
237
|
|
|
234
238
|
declare type ChaiBuilderInstance = {
|
|
235
239
|
setBlocks: (blocks: ChaiBlock[]) => void;
|
|
236
240
|
};
|
|
237
241
|
|
|
238
|
-
declare type
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
+
declare type ChaiBuilderThemeOptions = {
|
|
243
|
+
fontFamily: false | Record<VariableKey, string>;
|
|
244
|
+
borderRadius: BorderRadiusValue;
|
|
245
|
+
colors: false | {
|
|
246
|
+
group: string;
|
|
247
|
+
items: Record<VariableKey, [HSLColor, HSLColor]>;
|
|
248
|
+
}[];
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
declare type ChaiBuilderThemeValues = {
|
|
252
|
+
fontFamily: Record<string, string>;
|
|
253
|
+
borderRadius: string;
|
|
254
|
+
colors: Record<string, string[]>;
|
|
242
255
|
};
|
|
243
256
|
|
|
244
257
|
declare type ClassDerivedObject = {
|
|
@@ -257,30 +270,15 @@ declare type CodeEditorProps = {
|
|
|
257
270
|
placeholder?: string;
|
|
258
271
|
};
|
|
259
272
|
|
|
260
|
-
declare type Collection = {
|
|
261
|
-
key: string;
|
|
262
|
-
name: string;
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
declare type CollectionItem = {
|
|
266
|
-
id: string;
|
|
267
|
-
name: string;
|
|
268
|
-
slug?: string;
|
|
269
|
-
};
|
|
270
|
-
|
|
271
273
|
declare type CopiedValue = string | null;
|
|
272
274
|
|
|
273
275
|
declare type CopyFn = (text: string) => Promise<boolean>;
|
|
274
276
|
|
|
275
277
|
export declare function DarkModeSwitcher(): JSX_2.Element;
|
|
276
278
|
|
|
277
|
-
declare
|
|
278
|
-
providerKey: string;
|
|
279
|
-
args: Record<string, any>;
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
export declare const DefaultChaiBlocks: ({ parentId, gridCols }: {
|
|
279
|
+
export declare const DefaultChaiBlocks: ({ parentId, position, gridCols, }: {
|
|
283
280
|
parentId?: string;
|
|
281
|
+
position?: number;
|
|
284
282
|
gridCols?: string;
|
|
285
283
|
}) => JSX_2.Element;
|
|
286
284
|
|
|
@@ -312,10 +310,13 @@ declare type GlobalBlockList = Record<string, {
|
|
|
312
310
|
description?: string;
|
|
313
311
|
}>;
|
|
314
312
|
|
|
313
|
+
declare type HSLColor = string;
|
|
314
|
+
|
|
315
315
|
export { i18n }
|
|
316
316
|
|
|
317
|
-
export declare const ImportHTML: ({ parentId }: {
|
|
317
|
+
export declare const ImportHTML: ({ parentId, position }: {
|
|
318
318
|
parentId?: string;
|
|
319
|
+
position?: number;
|
|
319
320
|
}) => JSX_2.Element;
|
|
320
321
|
|
|
321
322
|
declare type LayoutVariant = "SINGLE_SIDE_PANEL" | "DUAL_SIDE_PANEL" | "DUAL_SIDE_PANEL_ADVANCED";
|
|
@@ -333,6 +334,17 @@ declare type OutlineMenuItem = {
|
|
|
333
334
|
|
|
334
335
|
declare type OutlineMenuItems = OutlineMenuItem[];
|
|
335
336
|
|
|
337
|
+
declare type PageType = {
|
|
338
|
+
key: string;
|
|
339
|
+
name: string;
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
declare type PageTypeItem = {
|
|
343
|
+
id: string;
|
|
344
|
+
name: string;
|
|
345
|
+
slug?: string;
|
|
346
|
+
};
|
|
347
|
+
|
|
336
348
|
declare type ReactComponentType = React_3.ComponentType<any>;
|
|
337
349
|
|
|
338
350
|
export { registerChaiBlock }
|
|
@@ -342,17 +354,16 @@ declare type RichText = string;
|
|
|
342
354
|
declare type SavePageData = {
|
|
343
355
|
autoSave: boolean;
|
|
344
356
|
blocks: ChaiBlock[];
|
|
345
|
-
|
|
346
|
-
brandingOptions?: Record<string, any>;
|
|
347
|
-
themeConfiguration?: Record<string, any>;
|
|
357
|
+
theme?: Record<string, any>;
|
|
348
358
|
};
|
|
349
359
|
|
|
350
360
|
export declare const ScreenSizes: () => JSX_2.Element;
|
|
351
361
|
|
|
352
|
-
|
|
362
|
+
declare interface ThemeConfigProps {
|
|
353
363
|
className?: string;
|
|
354
|
-
|
|
355
|
-
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export declare const ThemeOptions: React_2.FC<ThemeConfigProps>;
|
|
356
367
|
|
|
357
368
|
declare type TimeInSeconds = number;
|
|
358
369
|
|
|
@@ -362,8 +373,9 @@ declare type TStyleBlock = {
|
|
|
362
373
|
prop: string;
|
|
363
374
|
};
|
|
364
375
|
|
|
365
|
-
export declare const UILibraries: ({ parentId }: {
|
|
376
|
+
export declare const UILibraries: ({ parentId, position }: {
|
|
366
377
|
parentId?: string;
|
|
378
|
+
position?: number;
|
|
367
379
|
}) => JSX_2.Element;
|
|
368
380
|
|
|
369
381
|
declare interface UILibrary {
|
|
@@ -391,8 +403,14 @@ export declare const useAddBlock: () => AddBlocks;
|
|
|
391
403
|
|
|
392
404
|
export declare const useAddClassesToBlocks: () => Function;
|
|
393
405
|
|
|
406
|
+
export declare const useAskAi: () => {
|
|
407
|
+
askAi: (type: "styles" | "content", blockId: string, prompt: string, onComplete?: (response?: AskAiResponse) => void) => Promise<void>;
|
|
408
|
+
loading: boolean;
|
|
409
|
+
error: any;
|
|
410
|
+
};
|
|
411
|
+
|
|
394
412
|
export declare const useBlockHighlight: () => {
|
|
395
|
-
highlightBlock: (
|
|
413
|
+
highlightBlock: (elementOrID: HTMLElement | string) => void;
|
|
396
414
|
clearHighlight: () => void;
|
|
397
415
|
lastHighlighted: HTMLElement;
|
|
398
416
|
};
|
|
@@ -437,7 +455,7 @@ export declare const useCanvasZoom: () => [number, (args_0: number | typeof RESE
|
|
|
437
455
|
*/
|
|
438
456
|
export declare const useCodeEditor: () => [CodeEditorProps, never];
|
|
439
457
|
|
|
440
|
-
export declare const useCopyBlockIds: () => [Array<string
|
|
458
|
+
export declare const useCopyBlockIds: () => [string[], (blockIds: Array<string>) => void];
|
|
441
459
|
|
|
442
460
|
export declare const useCopyToClipboard: () => [CopiedValue, CopyFn];
|
|
443
461
|
|
|
@@ -485,8 +503,8 @@ export declare const useLanguages: () => {
|
|
|
485
503
|
export declare const useLayoutVariant: () => readonly [LayoutVariant, (args_0: LayoutVariant | typeof RESET | ((prev: LayoutVariant) => LayoutVariant | typeof RESET)) => void];
|
|
486
504
|
|
|
487
505
|
export declare const usePasteBlocks: () => {
|
|
488
|
-
canPaste: (newParentId: string) => boolean
|
|
489
|
-
pasteBlocks:
|
|
506
|
+
canPaste: (newParentId: string) => Promise<boolean>;
|
|
507
|
+
pasteBlocks: (newParentId: string | string[]) => Promise<void>;
|
|
490
508
|
};
|
|
491
509
|
|
|
492
510
|
/**
|
|
@@ -498,6 +516,8 @@ export declare const useRemoveBlocks: () => (blockIds: Array<string>) => void;
|
|
|
498
516
|
|
|
499
517
|
export declare const useRemoveClassesFromBlocks: () => Function;
|
|
500
518
|
|
|
519
|
+
export declare const useRightPanel: () => ["theme" | "block" | "ai", (args_0: "theme" | "block" | "ai" | ((prev: "theme" | "block" | "ai") => "theme" | "block" | "ai")) => void];
|
|
520
|
+
|
|
501
521
|
export declare const useSavePage: () => {
|
|
502
522
|
savePage: ThrottledFunction<(autoSave?: boolean) => Promise<boolean>>;
|
|
503
523
|
saveState: "UNSAVED" | "SAVED" | "SAVING";
|
|
@@ -516,7 +536,7 @@ export declare const useSelectedBlockCurrentClasses: () => Array<ClassDerivedObj
|
|
|
516
536
|
/**
|
|
517
537
|
*
|
|
518
538
|
*/
|
|
519
|
-
export declare const useSelectedBlockIds: () => [
|
|
539
|
+
export declare const useSelectedBlockIds: () => readonly [string[], (args_0: string[] | ((prev: string[]) => string[])) => void, (blockId: string) => void];
|
|
520
540
|
|
|
521
541
|
/**
|
|
522
542
|
* Hook to get selected block ids
|
|
@@ -538,6 +558,18 @@ export declare const useStylingBreakpoint: () => [string, (args_0: string | type
|
|
|
538
558
|
|
|
539
559
|
export declare const useStylingState: () => [unknown, (...args: unknown[]) => unknown];
|
|
540
560
|
|
|
561
|
+
export declare const useTheme: () => readonly [{
|
|
562
|
+
readonly fontFamily: Record<string, string>;
|
|
563
|
+
readonly borderRadius: string;
|
|
564
|
+
readonly colors: Record<string, string[]>;
|
|
565
|
+
} | {
|
|
566
|
+
fontFamily?: Record<string, string>;
|
|
567
|
+
borderRadius?: string;
|
|
568
|
+
colors?: Record<string, string[]>;
|
|
569
|
+
}, (args_0: ChaiBuilderThemeValues | Partial<ChaiBuilderThemeValues> | ((prev: ChaiBuilderThemeValues | Partial<ChaiBuilderThemeValues>) => ChaiBuilderThemeValues | Partial<ChaiBuilderThemeValues>)) => void];
|
|
570
|
+
|
|
571
|
+
export declare const useThemeOptions: () => ChaiBuilderThemeOptions;
|
|
572
|
+
|
|
541
573
|
export { useTranslation }
|
|
542
574
|
|
|
543
575
|
export declare const useUILibraryBlocks: () => {
|
|
@@ -561,4 +593,8 @@ export declare const useUpdateBlocksProps: () => (blockIds: Array<string>, props
|
|
|
561
593
|
|
|
562
594
|
export declare const useUpdateBlocksPropsRealtime: () => (blockIds: Array<string>, props: Record<string, any>) => void;
|
|
563
595
|
|
|
596
|
+
export declare const useWrapperBlock: () => any;
|
|
597
|
+
|
|
598
|
+
declare type VariableKey = string;
|
|
599
|
+
|
|
564
600
|
export { }
|