@chaibuilder/sdk 2.2.26 → 2.2.28

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,33 @@ 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 type ChaiLibraryConfig<T> = {
312
+ id: string;
313
+ name: string;
314
+ description: string;
315
+ getBlocksList: (library: ChaiLibrary) => Promise<ChaiLibraryBlock<T>[]>;
316
+ getBlock: ({ library, block, }: {
317
+ library: ChaiLibrary;
318
+ block: ChaiLibraryBlock<T>;
319
+ }) => Promise<HTMLString | ChaiBlock_2[]>;
320
+ };
321
+
297
322
  export declare const ChaiOutline: () => JSX_2.Element;
298
323
 
299
324
  export declare const ChaiScreenSizes: ({ openDelay, canvas, tooltip, }: {
@@ -356,22 +381,6 @@ export declare const ChaiUILibrariesPanel: ({ parentId, position }: {
356
381
  position?: number;
357
382
  }) => JSX_2.Element;
358
383
 
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
384
  export declare const ChaiUndoRedo: () => JSX_2.Element;
376
385
 
377
386
  declare type ClassDerivedObject = {
@@ -420,6 +429,8 @@ declare type HexColor = string;
420
429
 
421
430
  declare type HSLColor = string;
422
431
 
432
+ declare type HTMLString = string;
433
+
423
434
  export { i18n }
424
435
 
425
436
  declare type MediaManagerProps = {
@@ -473,6 +484,8 @@ export declare const registerBlockSettingWidget: (id: string, component: React.C
473
484
 
474
485
  export declare const registerChaiAddBlockTab: (id: string, tab: Omit<AddBlockTab, "id">) => void;
475
486
 
487
+ export declare const registerChaiLibrary: <T extends Record<string, any> = Record<string, any>>(id: string, library: Omit<ChaiLibraryConfig<T>, "id">) => void;
488
+
476
489
  export declare const registerChaiMediaManager: (component: React.ComponentType<MediaManagerProps>) => void;
477
490
 
478
491
  export declare const registerChaiSaveToLibrary: (component: ComponentType<SaveToLibraryProps>) => void;
@@ -598,7 +611,7 @@ export declare const useLanguages: () => {
598
611
  setSelectedLang: (lang: string) => void;
599
612
  };
600
613
 
601
- export declare const useLibraryBlocks: (library?: Partial<ChaiUILibrary> & {
614
+ export declare const useLibraryBlocks: (library?: Partial<ChaiLibrary> & {
602
615
  id: string;
603
616
  }) => {
604
617
  data: any;
@@ -755,11 +768,6 @@ export declare const useThemeOptions: () => ChaiBuilderThemeOptions;
755
768
 
756
769
  export { useTranslation }
757
770
 
758
- export declare const useUILibraryBlocks: () => {
759
- data: any[];
760
- isLoading: boolean;
761
- };
762
-
763
771
  export declare const useUndoManager: () => {
764
772
  add: (action: any) => void;
765
773
  undo: () => void;