@chaibuilder/sdk 2.2.26 → 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, }: {
@@ -356,22 +378,6 @@ export declare const ChaiUILibrariesPanel: ({ parentId, position }: {
356
378
  position?: number;
357
379
  }) => JSX_2.Element;
358
380
 
359
- declare type ChaiUILibrary<T = Record<string, any>> = {
360
- id: string;
361
- name: string;
362
- blocks?: ChaiUILibraryBlock[];
363
- description?: string;
364
- } & T;
365
-
366
- declare type ChaiUILibraryBlock<T = Record<string, any>> = {
367
- id: string;
368
- group: string;
369
- name: string;
370
- preview?: string;
371
- tags?: string[];
372
- description?: string;
373
- } & T;
374
-
375
381
  export declare const ChaiUndoRedo: () => JSX_2.Element;
376
382
 
377
383
  declare type ClassDerivedObject = {
@@ -473,6 +479,8 @@ export declare const registerBlockSettingWidget: (id: string, component: React.C
473
479
 
474
480
  export declare const registerChaiAddBlockTab: (id: string, tab: Omit<AddBlockTab, "id">) => void;
475
481
 
482
+ export declare const registerChaiLibrary: (id: string, library: Omit<ChaiLibraryConfig, "id">) => void;
483
+
476
484
  export declare const registerChaiMediaManager: (component: React.ComponentType<MediaManagerProps>) => void;
477
485
 
478
486
  export declare const registerChaiSaveToLibrary: (component: ComponentType<SaveToLibraryProps>) => void;
@@ -598,7 +606,7 @@ export declare const useLanguages: () => {
598
606
  setSelectedLang: (lang: string) => void;
599
607
  };
600
608
 
601
- export declare const useLibraryBlocks: (library?: Partial<ChaiUILibrary> & {
609
+ export declare const useLibraryBlocks: (library?: Partial<ChaiLibrary> & {
602
610
  id: string;
603
611
  }) => {
604
612
  data: any;
@@ -755,11 +763,6 @@ export declare const useThemeOptions: () => ChaiBuilderThemeOptions;
755
763
 
756
764
  export { useTranslation }
757
765
 
758
- export declare const useUILibraryBlocks: () => {
759
- data: any[];
760
- isLoading: boolean;
761
- };
762
-
763
766
  export declare const useUndoManager: () => {
764
767
  add: (action: any) => void;
765
768
  undo: () => void;