@bygga.dev/editor 0.3.1 → 1.0.0

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/element.d.ts CHANGED
@@ -4,17 +4,30 @@ type Brand = {
4
4
  fonts?: BrandFont[];
5
5
  };
6
6
 
7
- declare const brand: unique symbol;
7
+ declare const brand$1: unique symbol;
8
8
  type Document = {
9
- readonly [brand]: 'Document';
9
+ readonly [brand$1]: 'Document';
10
10
  };
11
11
  declare function parseDocument(json: unknown): Document;
12
12
  declare function createEmptyDocument(): Document;
13
13
 
14
+ declare const brand: unique symbol;
15
+ type SavedBlockContent = {
16
+ readonly [brand]: 'SavedBlockContent';
17
+ };
18
+ type SavedBlock = {
19
+ id: string;
20
+ name: string;
21
+ content: SavedBlockContent;
22
+ };
23
+ declare function parseSavedBlock(json: unknown): SavedBlock;
24
+
14
25
  type EditorConfig = {
15
26
  uploadImage(image: Blob): Promise<string>;
16
27
  saveDocument?(document: Document, compiled: string | null): Promise<void>;
17
28
  onImageError?(error: unknown): void;
29
+ saveBlock?(saved: SavedBlock): Promise<void>;
30
+ deleteSavedBlock?(id: string): Promise<void>;
18
31
  };
19
32
 
20
33
  declare const SUPPORTED_LOCALES: readonly ["en", "sv"];
@@ -52,6 +65,7 @@ interface ByggaEditorElement extends HTMLElement {
52
65
  removeEventListener<K extends keyof ByggaEditorEventMap>(type: K, listener: (this: ByggaEditorElement, event: ByggaEditorEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
53
66
  removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
54
67
  save(): Promise<void>;
68
+ savedBlocks?: SavedBlock[];
55
69
  }
56
70
  declare global {
57
71
  interface HTMLElementTagNameMap {
@@ -59,5 +73,5 @@ declare global {
59
73
  }
60
74
  }
61
75
 
62
- export { ByggaEditor, DEFAULT_LOCALE, EDITOR_TAG, SUPPORTED_LOCALES, createEmptyDocument, parseDocument };
63
- export type { Brand, BrandFont, ByggaEditorElement, ByggaEditorEventMap, Document, EditorConfig, LicenseError, LicenseErrorReason, Locale, MergeTagLabels, MergeTags };
76
+ export { ByggaEditor, DEFAULT_LOCALE, EDITOR_TAG, SUPPORTED_LOCALES, createEmptyDocument, parseDocument, parseSavedBlock };
77
+ export type { Brand, BrandFont, ByggaEditorElement, ByggaEditorEventMap, Document, EditorConfig, LicenseError, LicenseErrorReason, Locale, MergeTagLabels, MergeTags, SavedBlock, SavedBlockContent };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bygga.dev/editor",
3
- "version": "0.3.1",
3
+ "version": "1.0.0",
4
4
  "description": "Visual content builder shipped as the <bygga-editor> custom element",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",