@chaibuilder/sdk 2.2.25 → 2.2.27

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/core.d.ts CHANGED
@@ -70,6 +70,16 @@ export declare type ChaiBlock<T = Record<string, any>> = {
70
70
  _libBlock?: string;
71
71
  } & T;
72
72
 
73
+ declare type ChaiBlock_2<T = Record<string, any>> = {
74
+ _id: string;
75
+ _name?: string;
76
+ _parent?: string | null | undefined;
77
+ _bindings?: Record<string, string>;
78
+ _libBlock?: string;
79
+ _type: string;
80
+ _partialBlockId?: string;
81
+ } & T;
82
+
73
83
  export declare const ChaiBlockAttributesEditor: React_2.MemoExoticComponent<() => JSX_2.Element>;
74
84
 
75
85
  /**
@@ -190,18 +200,6 @@ export declare interface ChaiBuilderEditorProps {
190
200
  */
191
201
  askAiCallBack?: (type: "styles" | "content", prompt: string, blocks: ChaiBlock[], lang: string) => Promise<AskAiResponse>;
192
202
  saveAiContextCallback?: (content: string) => Promise<true | Error>;
193
- /**
194
- * UI libraries
195
- */
196
- uiLibraries?: Omit<ChaiUILibrary, "blocks">[];
197
- /**
198
- * Get library blocks
199
- */
200
- getUILibraryBlocks?: (library: ChaiUILibrary) => Promise<ChaiUILibraryBlock[]>;
201
- /**
202
- * Get library block
203
- */
204
- getUILibraryBlock?: (library: ChaiUILibrary, uiLibBlock: ChaiUILibraryBlock) => Promise<ChaiBlock[]>;
205
203
  /**
206
204
  * Get partial blocks
207
205
  * @returns {Record<string, { type: string; name: string; description?: string }>}
@@ -294,6 +292,30 @@ export declare const ChaiImportHTML: ({ parentId, position }: {
294
292
  position?: number;
295
293
  }) => JSX_2.Element;
296
294
 
295
+ export declare type ChaiLibrary<T = Record<string, any>> = {
296
+ id: string;
297
+ name: string;
298
+ blocks?: ChaiLibraryBlock[];
299
+ description?: string;
300
+ } & T;
301
+
302
+ export declare type ChaiLibraryBlock<T = Record<string, any>> = {
303
+ id: string;
304
+ group: string;
305
+ name: string;
306
+ preview?: string;
307
+ tags?: string[];
308
+ description?: string;
309
+ } & T;
310
+
311
+ declare interface ChaiLibraryConfig {
312
+ id: string;
313
+ name: string;
314
+ description: string;
315
+ getBlocksList: (library: ChaiLibrary) => Promise<ChaiLibraryBlock[]>;
316
+ getBlock: (library: ChaiLibrary, libBlock: ChaiLibraryBlock) => Promise<string | ChaiBlock_2[]>;
317
+ }
318
+
297
319
  export declare const ChaiOutline: () => JSX_2.Element;
298
320
 
299
321
  export declare const ChaiScreenSizes: ({ openDelay, canvas, tooltip, }: {
@@ -316,6 +338,7 @@ export declare interface ChaiSidebarPanel {
316
338
  panel?: ComponentType;
317
339
  width?: number;
318
340
  isInternal?: boolean;
341
+ icon?: React.ReactNode;
319
342
  }
320
343
 
321
344
  export declare const ChaiThemeConfigPanel: React_2.FC<ThemeConfigProps>;
@@ -355,22 +378,6 @@ export declare const ChaiUILibrariesPanel: ({ parentId, position }: {
355
378
  position?: number;
356
379
  }) => JSX_2.Element;
357
380
 
358
- declare type ChaiUILibrary<T = Record<string, any>> = {
359
- id: string;
360
- name: string;
361
- blocks?: ChaiUILibraryBlock[];
362
- description?: string;
363
- } & T;
364
-
365
- declare type ChaiUILibraryBlock<T = Record<string, any>> = {
366
- id: string;
367
- group: string;
368
- name: string;
369
- preview?: string;
370
- tags?: string[];
371
- description?: string;
372
- } & T;
373
-
374
381
  export declare const ChaiUndoRedo: () => JSX_2.Element;
375
382
 
376
383
  declare type ClassDerivedObject = {
@@ -472,6 +479,8 @@ export declare const registerBlockSettingWidget: (id: string, component: React.C
472
479
 
473
480
  export declare const registerChaiAddBlockTab: (id: string, tab: Omit<AddBlockTab, "id">) => void;
474
481
 
482
+ export declare const registerChaiLibrary: (id: string, library: Omit<ChaiLibraryConfig, "id">) => void;
483
+
475
484
  export declare const registerChaiMediaManager: (component: React.ComponentType<MediaManagerProps>) => void;
476
485
 
477
486
  export declare const registerChaiSaveToLibrary: (component: ComponentType<SaveToLibraryProps>) => void;
@@ -597,7 +606,7 @@ export declare const useLanguages: () => {
597
606
  setSelectedLang: (lang: string) => void;
598
607
  };
599
608
 
600
- export declare const useLibraryBlocks: (library?: Partial<ChaiUILibrary> & {
609
+ export declare const useLibraryBlocks: (library?: Partial<ChaiLibrary> & {
601
610
  id: string;
602
611
  }) => {
603
612
  data: any;
@@ -754,11 +763,6 @@ export declare const useThemeOptions: () => ChaiBuilderThemeOptions;
754
763
 
755
764
  export { useTranslation }
756
765
 
757
- export declare const useUILibraryBlocks: () => {
758
- data: any[];
759
- isLoading: boolean;
760
- };
761
-
762
766
  export declare const useUndoManager: () => {
763
767
  add: (action: any) => void;
764
768
  undo: () => void;