@bygga.dev/editor 1.3.0 → 1.5.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
@@ -58,6 +58,16 @@ type SavedBlock = {
58
58
  };
59
59
  declare function parseSavedBlock(json: unknown): SavedBlock;
60
60
 
61
+ type AiAction = 'proofread' | 'rewrite' | 'shorten' | 'expand';
62
+ type AiRequest = {
63
+ action: AiAction;
64
+ text: string;
65
+ locale: string;
66
+ };
67
+ type AiAssistant = {
68
+ actions: readonly AiAction[];
69
+ run(request: AiRequest): Promise<string>;
70
+ };
61
71
  type EditorConfig = {
62
72
  uploadImage(image: Blob): Promise<string>;
63
73
  saveDocument?(document: Document, compiled: string | null): Promise<void>;
@@ -65,6 +75,7 @@ type EditorConfig = {
65
75
  saveBlock?(saved: SavedBlock): Promise<void>;
66
76
  deleteSavedBlock?(id: string): Promise<void>;
67
77
  plugins?: readonly BlockPlugin[];
78
+ ai?: AiAssistant;
68
79
  };
69
80
 
70
81
  declare const SUPPORTED_LOCALES: readonly ["en", "sv"];
@@ -77,7 +88,15 @@ type LicenseError = {
77
88
  };
78
89
 
79
90
  type MergeTagLabels = Partial<Record<Locale, string>>;
80
- type MergeTags = Record<string, MergeTagLabels>;
91
+ type MergeTagOption = {
92
+ value: string;
93
+ label: string;
94
+ };
95
+ type MergeTagEntry = MergeTagLabels & {
96
+ options?: MergeTagOption[];
97
+ conditionOnly?: boolean;
98
+ };
99
+ type MergeTags = Record<string, MergeTagEntry>;
81
100
 
82
101
  declare const EDITOR_TAG = "bygga-editor";
83
102
  declare const ByggaEditor: CustomElementConstructor;
@@ -111,4 +130,4 @@ declare global {
111
130
  }
112
131
 
113
132
  export { ByggaEditor, DEFAULT_LOCALE, EDITOR_TAG, SUPPORTED_LOCALES, createEmptyDocument, parseDocument, parseSavedBlock };
114
- export type { BlockPlugin, BlockPluginGlobalSettings, BlockPluginGlobalsContext, BlockPluginSettingsContext, Brand, BrandCustomFont, BrandFont, ByggaEditorElement, ByggaEditorEventMap, Document, EditorConfig, LicenseError, LicenseErrorReason, Locale, MergeTagLabels, MergeTags, SavedBlock, SavedBlockContent };
133
+ export type { AiAction, AiAssistant, AiRequest, BlockPlugin, BlockPluginGlobalSettings, BlockPluginGlobalsContext, BlockPluginSettingsContext, Brand, BrandCustomFont, BrandFont, ByggaEditorElement, ByggaEditorEventMap, Document, EditorConfig, LicenseError, LicenseErrorReason, Locale, MergeTagEntry, MergeTagLabels, MergeTagOption, MergeTags, SavedBlock, SavedBlockContent };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bygga.dev/editor",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "description": "Visual content builder shipped as the <bygga-editor> custom element",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",