@chaibuilder/sdk 2.0.0-beta.9 → 2.0.0-beta.91
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/README.md +1 -3
- package/dist/ChaiThemeFn-DcE5RdLQ.cjs +236 -0
- package/dist/ChaiThemeFn-DzirXKjI.js +237 -0
- package/dist/CodeEditor-C8_JzwHn.cjs +81 -0
- package/dist/CodeEditor-DdIk_PEV.js +81 -0
- package/dist/Topbar-62QmCKWL.cjs +18 -0
- package/dist/Topbar-Cqt0j3Yt.js +18 -0
- package/dist/chaibuilder-logo.png +0 -0
- package/dist/context-menu-DHla8ofZ.js +893 -0
- package/dist/context-menu-DawHUIXd.cjs +923 -0
- package/dist/core.cjs +11589 -18
- package/dist/core.d.ts +108 -47
- package/dist/core.js +9555 -6679
- package/dist/getSplitClasses-BuALfSLX.js +54 -0
- package/dist/getSplitClasses-mbQmvwI3.cjs +53 -0
- package/dist/iconBase-BSrIcOaG.cjs +146 -0
- package/dist/iconBase-CWgVxu0A.js +147 -0
- package/dist/mockServiceWorker.js +39 -24
- package/dist/plugin-BcTnEZwx.cjs +26 -0
- package/dist/plugin-DGEKY3uC.js +27 -0
- package/dist/render.cjs +247 -2
- package/dist/render.d.ts +41 -16
- package/dist/render.js +224 -142
- package/dist/runtime.cjs +9 -1
- package/dist/runtime.d.ts +6 -1
- package/dist/runtime.js +0 -20
- package/dist/sdk.css +1341 -0
- package/dist/tailwind.cjs +78 -1
- package/dist/tailwind.d.ts +37 -26
- package/dist/tailwind.js +21 -21
- package/dist/ui.cjs +378 -1
- package/dist/ui.d.ts +12 -51
- package/dist/ui.js +262 -349
- package/dist/web-blocks.cjs +1679 -2
- package/dist/web-blocks.d.ts +6 -0
- package/dist/web-blocks.js +1502 -856
- package/package.json +135 -132
- package/dist/CodeEditor-19TqmVgI.cjs +0 -1
- package/dist/CodeEditor-b5DU6y6j.js +0 -126
- package/dist/STRINGS-Xxstm-7I.js +0 -7
- package/dist/STRINGS-Yl7cSWDc.cjs +0 -1
- package/dist/Topbar-lGFRGO4j.js +0 -73
- package/dist/Topbar-ql6BS8c6.cjs +0 -1
- package/dist/context-menu-MPtzs1fu.cjs +0 -1
- package/dist/context-menu-XEyVy2qm.js +0 -903
- package/dist/controls-lEwMTdPQ.js +0 -234
- package/dist/controls-p9IwFnPx.cjs +0 -1
- package/dist/iconBase-Ief2hJUZ.js +0 -130
- package/dist/iconBase-aZzpqff_.cjs +0 -1
- package/dist/jsx-runtime-JYMCiFoE.cjs +0 -27
- package/dist/jsx-runtime-Sp0orL4X.js +0 -631
- package/dist/plugin-Dm5EFGnP.cjs +0 -1
- package/dist/plugin-KIpT3NWi.cjs +0 -1
- package/dist/plugin-PFjzFeON.js +0 -97
- package/dist/plugin-ooqqxWRQ.js +0 -55
- package/dist/style.css +0 -6
package/dist/core.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { Atom } from 'jotai';
|
|
2
|
+
import { ChaiBlock as ChaiBlock_2 } from '@chaibuilder/runtime';
|
|
1
3
|
import { ClassValue } from 'clsx';
|
|
2
|
-
import
|
|
4
|
+
import { default as default_2 } from 'react';
|
|
5
|
+
import { default as i18n } from 'i18next';
|
|
3
6
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
4
7
|
import * as React_2 from 'react';
|
|
5
|
-
import { default as React_3 } from 'react';
|
|
6
8
|
import { ReactNode } from 'react';
|
|
7
9
|
import { registerChaiBlock } from '@chaibuilder/runtime';
|
|
8
10
|
import { RESET } from 'jotai/utils';
|
|
@@ -16,10 +18,11 @@ declare type AddBlocks = {
|
|
|
16
18
|
|
|
17
19
|
export declare const AddBlocksDialog: () => JSX_2.Element;
|
|
18
20
|
|
|
19
|
-
export declare const AddBlocksPanel: ({ className, showHeading, parentId, }: {
|
|
21
|
+
export declare const AddBlocksPanel: ({ className, showHeading, parentId, position, }: {
|
|
20
22
|
parentId?: string;
|
|
21
23
|
showHeading?: boolean;
|
|
22
24
|
className?: string;
|
|
25
|
+
position?: number;
|
|
23
26
|
}) => JSX_2.Element;
|
|
24
27
|
|
|
25
28
|
export declare const AISetContext: () => JSX_2.Element;
|
|
@@ -52,7 +55,7 @@ declare type Breakpoint = {
|
|
|
52
55
|
title: string;
|
|
53
56
|
content: string;
|
|
54
57
|
breakpoint: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | string;
|
|
55
|
-
icon:
|
|
58
|
+
icon: default_2.ReactNode | Element;
|
|
56
59
|
width: number;
|
|
57
60
|
};
|
|
58
61
|
|
|
@@ -62,25 +65,44 @@ export declare const CHAI_BUILDER_EVENTS: {
|
|
|
62
65
|
SHOW_BLOCK_SETTINGS: string;
|
|
63
66
|
};
|
|
64
67
|
|
|
65
|
-
export declare type ChaiBlock = {
|
|
68
|
+
export declare type ChaiBlock<T = Record<string, any>> = {
|
|
66
69
|
_id: string;
|
|
67
|
-
_type: string;
|
|
68
70
|
_name?: string;
|
|
69
71
|
_parent?: string | null | undefined;
|
|
70
72
|
_bindings?: Record<string, string>;
|
|
71
|
-
|
|
73
|
+
_type: string;
|
|
74
|
+
} & T;
|
|
75
|
+
|
|
76
|
+
declare type ChaiBuilderBlockWithAtom = {
|
|
77
|
+
_type: string;
|
|
78
|
+
_id: string;
|
|
79
|
+
_parent: string | null;
|
|
80
|
+
_atom: Atom<ChaiBlock>;
|
|
81
|
+
};
|
|
72
82
|
|
|
73
|
-
export declare const ChaiBuilderCanvas:
|
|
83
|
+
export declare const ChaiBuilderCanvas: default_2.FC;
|
|
74
84
|
|
|
75
85
|
/**
|
|
76
86
|
* ChaiBuilder is the main entry point for the Chai Builder Studio.
|
|
77
87
|
*/
|
|
78
|
-
export declare const ChaiBuilderEditor:
|
|
88
|
+
export declare const ChaiBuilderEditor: default_2.FC<ChaiBuilderEditorProps>;
|
|
79
89
|
|
|
80
90
|
export declare interface ChaiBuilderEditorProps {
|
|
81
|
-
|
|
82
|
-
|
|
91
|
+
/**
|
|
92
|
+
* RJSF Fields and Widgets
|
|
93
|
+
*/
|
|
94
|
+
rjsfFields?: Record<string, default_2.ComponentType<any>>;
|
|
95
|
+
rjsfWidgets?: Record<string, default_2.ComponentType<any>>;
|
|
96
|
+
rjsfTemplates?: Record<string, default_2.ComponentType<any>>;
|
|
97
|
+
/**
|
|
98
|
+
* Optional pageId. If not provided, a random pageId will be generated
|
|
99
|
+
*/
|
|
100
|
+
pageId?: string;
|
|
101
|
+
pageExternalData?: Record<string, any>;
|
|
102
|
+
themePresets?: Record<string, Partial<ChaiBuilderThemeValues>>[];
|
|
103
|
+
themeOptions?: ChaiBuilderThemeOptions | ((defaultThemeOptions: ChaiBuilderThemeOptions) => ChaiBuilderThemeOptions);
|
|
83
104
|
theme?: Partial<ChaiBuilderThemeValues>;
|
|
105
|
+
themePanelComponent?: ReactComponentType;
|
|
84
106
|
/**
|
|
85
107
|
* onError callback function
|
|
86
108
|
* @param error
|
|
@@ -98,7 +120,7 @@ export declare interface ChaiBuilderEditorProps {
|
|
|
98
120
|
/**
|
|
99
121
|
* Custom layout component
|
|
100
122
|
*/
|
|
101
|
-
layout?:
|
|
123
|
+
layout?: default_2.ComponentType;
|
|
102
124
|
/**
|
|
103
125
|
* Layout variant. Not supported with custom layout
|
|
104
126
|
*/
|
|
@@ -106,9 +128,17 @@ export declare interface ChaiBuilderEditorProps {
|
|
|
106
128
|
/**
|
|
107
129
|
* Custom media Manager component
|
|
108
130
|
*/
|
|
109
|
-
mediaManagerComponent?:
|
|
131
|
+
mediaManagerComponent?: default_2.ComponentType<{
|
|
110
132
|
onSelect: (url: string) => void;
|
|
111
133
|
}>;
|
|
134
|
+
/**
|
|
135
|
+
* Add blocks dialog components
|
|
136
|
+
*/
|
|
137
|
+
addBlocksDialogTabs?: {
|
|
138
|
+
key: string;
|
|
139
|
+
tab: ReactComponentType;
|
|
140
|
+
tabContent: ReactComponentType;
|
|
141
|
+
}[];
|
|
112
142
|
/**
|
|
113
143
|
* HTML direction.
|
|
114
144
|
*/
|
|
@@ -164,7 +194,7 @@ export declare interface ChaiBuilderEditorProps {
|
|
|
164
194
|
uiLibraries?: Omit<UILibrary, "blocks">[];
|
|
165
195
|
getUILibraryBlocks?: (library: UILibrary) => Promise<UiLibraryBlock[]>;
|
|
166
196
|
getUILibraryBlock?: (library: UILibrary, uiLibBlock: UiLibraryBlock) => Promise<ChaiBlock[]>;
|
|
167
|
-
|
|
197
|
+
getBlockAsyncProps?: (block: ChaiBlock) => Promise<string>;
|
|
168
198
|
/**
|
|
169
199
|
* Get Global blocks
|
|
170
200
|
*/
|
|
@@ -220,10 +250,10 @@ export declare interface ChaiBuilderEditorProps {
|
|
|
220
250
|
fallbackLang?: string;
|
|
221
251
|
languages?: Array<string>;
|
|
222
252
|
/**
|
|
223
|
-
*
|
|
253
|
+
* Page Types props
|
|
224
254
|
*/
|
|
225
|
-
|
|
226
|
-
|
|
255
|
+
pageTypes?: PageType[];
|
|
256
|
+
searchPageTypeItems?: (pageTypeKey: string, query: string) => Promise<PageTypeItem[] | Error>;
|
|
227
257
|
}
|
|
228
258
|
|
|
229
259
|
declare type ChaiBuilderInstance = {
|
|
@@ -261,25 +291,15 @@ declare type CodeEditorProps = {
|
|
|
261
291
|
placeholder?: string;
|
|
262
292
|
};
|
|
263
293
|
|
|
264
|
-
declare type Collection = {
|
|
265
|
-
key: string;
|
|
266
|
-
name: string;
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
declare type CollectionItem = {
|
|
270
|
-
id: string;
|
|
271
|
-
name: string;
|
|
272
|
-
slug?: string;
|
|
273
|
-
};
|
|
274
|
-
|
|
275
294
|
declare type CopiedValue = string | null;
|
|
276
295
|
|
|
277
296
|
declare type CopyFn = (text: string) => Promise<boolean>;
|
|
278
297
|
|
|
279
298
|
export declare function DarkModeSwitcher(): JSX_2.Element;
|
|
280
299
|
|
|
281
|
-
export declare const DefaultChaiBlocks: ({ parentId, gridCols }: {
|
|
300
|
+
export declare const DefaultChaiBlocks: ({ parentId, position, gridCols, }: {
|
|
282
301
|
parentId?: string;
|
|
302
|
+
position?: number;
|
|
283
303
|
gridCols?: string;
|
|
284
304
|
}) => JSX_2.Element;
|
|
285
305
|
|
|
@@ -315,8 +335,9 @@ declare type HSLColor = string;
|
|
|
315
335
|
|
|
316
336
|
export { i18n }
|
|
317
337
|
|
|
318
|
-
export declare const ImportHTML: ({ parentId }: {
|
|
338
|
+
export declare const ImportHTML: ({ parentId, position }: {
|
|
319
339
|
parentId?: string;
|
|
340
|
+
position?: number;
|
|
320
341
|
}) => JSX_2.Element;
|
|
321
342
|
|
|
322
343
|
declare type LayoutVariant = "SINGLE_SIDE_PANEL" | "DUAL_SIDE_PANEL" | "DUAL_SIDE_PANEL_ADVANCED";
|
|
@@ -326,7 +347,7 @@ export declare const mergeClasses: (...inputs: ClassValue[]) => string;
|
|
|
326
347
|
export declare const Outline: () => JSX_2.Element;
|
|
327
348
|
|
|
328
349
|
declare type OutlineMenuItem = {
|
|
329
|
-
item:
|
|
350
|
+
item: default_2.ComponentType<{
|
|
330
351
|
blockId: string;
|
|
331
352
|
}>;
|
|
332
353
|
tooltip: string | ReactNode;
|
|
@@ -334,7 +355,18 @@ declare type OutlineMenuItem = {
|
|
|
334
355
|
|
|
335
356
|
declare type OutlineMenuItems = OutlineMenuItem[];
|
|
336
357
|
|
|
337
|
-
declare type
|
|
358
|
+
declare type PageType = {
|
|
359
|
+
key: string;
|
|
360
|
+
name: string;
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
declare type PageTypeItem = {
|
|
364
|
+
id: string;
|
|
365
|
+
name: string;
|
|
366
|
+
slug?: string;
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
declare type ReactComponentType = default_2.ComponentType<any>;
|
|
338
370
|
|
|
339
371
|
export { registerChaiBlock }
|
|
340
372
|
|
|
@@ -362,8 +394,9 @@ declare type TStyleBlock = {
|
|
|
362
394
|
prop: string;
|
|
363
395
|
};
|
|
364
396
|
|
|
365
|
-
export declare const UILibraries: ({ parentId }: {
|
|
397
|
+
export declare const UILibraries: ({ parentId, position }: {
|
|
366
398
|
parentId?: string;
|
|
399
|
+
position?: number;
|
|
367
400
|
}) => JSX_2.Element;
|
|
368
401
|
|
|
369
402
|
declare interface UILibrary {
|
|
@@ -389,23 +422,29 @@ export declare const UndoRedo: () => JSX_2.Element;
|
|
|
389
422
|
|
|
390
423
|
export declare const useAddBlock: () => AddBlocks;
|
|
391
424
|
|
|
392
|
-
export declare const useAddClassesToBlocks: () =>
|
|
425
|
+
export declare const useAddClassesToBlocks: () => (blockIds: Array<string>, newClasses: Array<string>, undo?: boolean) => void;
|
|
426
|
+
|
|
427
|
+
export declare const useAskAi: () => {
|
|
428
|
+
askAi: (type: "styles" | "content", blockId: string, prompt: string, onComplete?: (response?: AskAiResponse) => void) => Promise<void>;
|
|
429
|
+
loading: boolean;
|
|
430
|
+
error: any;
|
|
431
|
+
};
|
|
393
432
|
|
|
394
433
|
export declare const useBlockHighlight: () => {
|
|
395
|
-
highlightBlock: (
|
|
434
|
+
highlightBlock: (elementOrID: HTMLElement | string) => void;
|
|
396
435
|
clearHighlight: () => void;
|
|
397
436
|
lastHighlighted: HTMLElement;
|
|
398
437
|
};
|
|
399
438
|
|
|
400
|
-
export declare const useBlocksStore: () => [
|
|
439
|
+
export declare const useBlocksStore: () => [ChaiBuilderBlockWithAtom[], (args_0: ChaiBuilderBlockWithAtom[] | ((prev: ChaiBuilderBlockWithAtom[]) => ChaiBuilderBlockWithAtom[])) => void];
|
|
401
440
|
|
|
402
441
|
export declare const useBlocksStoreUndoableActions: () => {
|
|
403
442
|
moveBlocks: (blockIds: string[], parent: string | undefined, position: number) => void;
|
|
404
|
-
addBlocks: (newBlocks:
|
|
405
|
-
removeBlocks: (blocks:
|
|
443
|
+
addBlocks: (newBlocks: ChaiBuilderBlockWithAtom[], parent?: string, position?: number) => void;
|
|
444
|
+
removeBlocks: (blocks: ChaiBuilderBlockWithAtom[]) => void;
|
|
406
445
|
updateBlocks: (blockIds: string[], props: Partial<ChaiBlock>, oldPropsState?: Partial<ChaiBlock>) => void;
|
|
407
446
|
updateBlocksRuntime: (blockIds: string[], props: Record<string, any>) => void;
|
|
408
|
-
setNewBlocks: (newBlocks:
|
|
447
|
+
setNewBlocks: (newBlocks: ChaiBuilderBlockWithAtom[]) => void;
|
|
409
448
|
updateMultipleBlocksProps: (blocks: Array<{
|
|
410
449
|
_id: string;
|
|
411
450
|
} & Partial<ChaiBlock>>) => void;
|
|
@@ -428,7 +467,7 @@ export declare const useCanvasWidth: () => [number, string, Function];
|
|
|
428
467
|
/**
|
|
429
468
|
* Wrapper hook around useAtom
|
|
430
469
|
*/
|
|
431
|
-
export declare const useCanvasZoom: () => [number, (args_0: number |
|
|
470
|
+
export declare const useCanvasZoom: () => [number, (args_0: number | RESET | ((prev: number) => number | RESET)) => void];
|
|
432
471
|
|
|
433
472
|
/**
|
|
434
473
|
* Custom hook to access the current state of the code editor.
|
|
@@ -437,7 +476,7 @@ export declare const useCanvasZoom: () => [number, (args_0: number | typeof RESE
|
|
|
437
476
|
*/
|
|
438
477
|
export declare const useCodeEditor: () => [CodeEditorProps, never];
|
|
439
478
|
|
|
440
|
-
export declare const useCopyBlockIds: () => [Array<string>,
|
|
479
|
+
export declare const useCopyBlockIds: () => [Array<string>, (blockIds: Array<string>) => void];
|
|
441
480
|
|
|
442
481
|
export declare const useCopyToClipboard: () => [CopiedValue, CopyFn];
|
|
443
482
|
|
|
@@ -464,7 +503,7 @@ export declare const useGlobalBlocksList: () => {
|
|
|
464
503
|
};
|
|
465
504
|
|
|
466
505
|
export declare const useGlobalBlocksStore: () => {
|
|
467
|
-
getGlobalBlocks: (
|
|
506
|
+
getGlobalBlocks: (globalBlockId: string) => any;
|
|
468
507
|
reset: () => void;
|
|
469
508
|
};
|
|
470
509
|
|
|
@@ -482,11 +521,11 @@ export declare const useLanguages: () => {
|
|
|
482
521
|
setSelectedLang: (lang: string) => void;
|
|
483
522
|
};
|
|
484
523
|
|
|
485
|
-
export declare const useLayoutVariant: () => readonly [LayoutVariant, (args_0:
|
|
524
|
+
export declare const useLayoutVariant: () => readonly [LayoutVariant, (args_0: RESET | LayoutVariant | ((prev: LayoutVariant) => RESET | LayoutVariant)) => void];
|
|
486
525
|
|
|
487
526
|
export declare const usePasteBlocks: () => {
|
|
488
|
-
canPaste: (newParentId: string) => boolean
|
|
489
|
-
pasteBlocks:
|
|
527
|
+
canPaste: (newParentId: string) => Promise<boolean>;
|
|
528
|
+
pasteBlocks: (newParentId: string | string[]) => Promise<void>;
|
|
490
529
|
};
|
|
491
530
|
|
|
492
531
|
/**
|
|
@@ -498,6 +537,8 @@ export declare const useRemoveBlocks: () => (blockIds: Array<string>) => void;
|
|
|
498
537
|
|
|
499
538
|
export declare const useRemoveClassesFromBlocks: () => Function;
|
|
500
539
|
|
|
540
|
+
export declare const useRightPanel: () => ["theme" | "block" | "ai" | "settings", (args_0: "theme" | "block" | "ai" | "settings" | ((prev: "theme" | "block" | "ai" | "settings") => "theme" | "block" | "ai" | "settings")) => void];
|
|
541
|
+
|
|
501
542
|
export declare const useSavePage: () => {
|
|
502
543
|
savePage: ThrottledFunction<(autoSave?: boolean) => Promise<boolean>>;
|
|
503
544
|
saveState: "UNSAVED" | "SAVED" | "SAVING";
|
|
@@ -516,7 +557,7 @@ export declare const useSelectedBlockCurrentClasses: () => Array<ClassDerivedObj
|
|
|
516
557
|
/**
|
|
517
558
|
*
|
|
518
559
|
*/
|
|
519
|
-
export declare const useSelectedBlockIds: () => [
|
|
560
|
+
export declare const useSelectedBlockIds: () => readonly [string[], (args_0: string[] | ((prev: string[]) => string[])) => void, (blockId: string) => void];
|
|
520
561
|
|
|
521
562
|
/**
|
|
522
563
|
* Hook to get selected block ids
|
|
@@ -534,10 +575,22 @@ export declare const useSelectedBreakpoints: () => [string[], Function];
|
|
|
534
575
|
*/
|
|
535
576
|
export declare const useSelectedStylingBlocks: () => [TStyleBlock[], (args_0: TStyleBlock[] | ((prev: TStyleBlock[]) => TStyleBlock[])) => void];
|
|
536
577
|
|
|
537
|
-
export declare const useStylingBreakpoint: () => [string, (args_0: string |
|
|
578
|
+
export declare const useStylingBreakpoint: () => [string, (args_0: string | RESET | ((prev: string) => string | RESET)) => void];
|
|
538
579
|
|
|
539
580
|
export declare const useStylingState: () => [unknown, (...args: unknown[]) => unknown];
|
|
540
581
|
|
|
582
|
+
export declare const useTheme: () => readonly [{
|
|
583
|
+
fontFamily: Record<string, string>;
|
|
584
|
+
borderRadius: string;
|
|
585
|
+
colors: Record<string, string[]>;
|
|
586
|
+
} | {
|
|
587
|
+
fontFamily?: Record<string, string>;
|
|
588
|
+
borderRadius?: string;
|
|
589
|
+
colors?: Record<string, string[]>;
|
|
590
|
+
}, (args_0: ChaiBuilderThemeValues | Partial<ChaiBuilderThemeValues> | ((prev: ChaiBuilderThemeValues | Partial<ChaiBuilderThemeValues>) => ChaiBuilderThemeValues | Partial<ChaiBuilderThemeValues>)) => void];
|
|
591
|
+
|
|
592
|
+
export declare const useThemeOptions: () => ChaiBuilderThemeOptions;
|
|
593
|
+
|
|
541
594
|
export { useTranslation }
|
|
542
595
|
|
|
543
596
|
export declare const useUILibraryBlocks: () => {
|
|
@@ -561,6 +614,14 @@ export declare const useUpdateBlocksProps: () => (blockIds: Array<string>, props
|
|
|
561
614
|
|
|
562
615
|
export declare const useUpdateBlocksPropsRealtime: () => (blockIds: Array<string>, props: Record<string, any>) => void;
|
|
563
616
|
|
|
617
|
+
export declare const useWrapperBlock: () => ChaiBlock_2;
|
|
618
|
+
|
|
564
619
|
declare type VariableKey = string;
|
|
565
620
|
|
|
566
621
|
export { }
|
|
622
|
+
|
|
623
|
+
declare global {
|
|
624
|
+
interface Window {
|
|
625
|
+
clarity: any;
|
|
626
|
+
}
|
|
627
|
+
}
|