@divkitframework/visual-editor 0.4.9 → 0.4.11

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.
@@ -1,3 +1,5 @@
1
+ import { VideoSource } from '@divkitframework/divkit/typings/common';
2
+
1
3
  interface Loc {
2
4
  line: number;
3
5
  column: number;
@@ -59,6 +61,10 @@ interface CardLocale {
59
61
  id: string;
60
62
  text: Record<string, string>;
61
63
  }
64
+ type StringValueFilter = RegExp | ((value: string) => boolean);
65
+ interface ValueFilters {
66
+ actionUrl?: StringValueFilter;
67
+ }
62
68
  interface EditorOptions {
63
69
  node: HTMLElement;
64
70
  shadowRoot?: ShadowRoot;
@@ -84,12 +90,38 @@ interface TranslationVariant {
84
90
  }
85
91
  type GetTranslationSuggest = (query: string, locale: string) => Promise<TranslationVariant[]>;
86
92
  type GetTranslationKey = (key: string) => Promise<Record<string, string> | undefined>;
93
+ interface FileDialogValue {
94
+ url: string;
95
+ width?: number;
96
+ height?: number;
97
+ }
98
+ type FileDialogCallback = (opts: FileDialogValue) => void;
99
+ interface FileDialogShowProps {
100
+ value: FileDialogValue;
101
+ title: string;
102
+ subtype: 'image' | 'gif' | 'lottie' | 'video' | 'image_preview';
103
+ direction?: 'left' | 'right';
104
+ hasSize?: boolean;
105
+ hasDelete?: boolean;
106
+ target: HTMLElement;
107
+ disabled?: boolean;
108
+ generateFromVideo?: VideoSource[];
109
+ generateFromLottie?: string;
110
+ callback: FileDialogCallback;
111
+ onHide?(): void;
112
+ }
113
+ interface FileDialogApi {
114
+ canShow(props: FileDialogShowProps): boolean;
115
+ show(props: FileDialogShowProps): void;
116
+ hide(): void;
117
+ }
87
118
  interface DivProEditorApi {
88
119
  uploadFile?(file: File): Promise<string>;
89
120
  editorFabric?(opts: EditorOptions): EditorInstance;
90
121
  onChange?(): void;
91
122
  getTranslationSuggest?: GetTranslationSuggest;
92
123
  getTranslationKey?: GetTranslationKey;
124
+ fileDialog?: FileDialogApi;
93
125
  }
94
126
  interface Source {
95
127
  key: string;
@@ -107,6 +139,10 @@ interface FileLimits {
107
139
  video?: FileLimit;
108
140
  upload?: FileLimit;
109
141
  }
142
+ type SafeAreaEmulation = Record<'top' | 'right' | 'bottom' | 'left', {
143
+ name: string;
144
+ value: number;
145
+ }>;
110
146
  interface DivProEditorOptions {
111
147
  renderTo: HTMLElement;
112
148
  shadowRoot?: ShadowRoot;
@@ -127,11 +163,14 @@ interface DivProEditorOptions {
127
163
  warnFileLimit?: number;
128
164
  errorFileLimit?: number;
129
165
  fileLimits?: FileLimits;
166
+ valueFilters?: ValueFilters;
130
167
  rootConfigurable?: boolean;
131
168
  customFontFaces?: FontFaceDesc[];
132
169
  directionSelector?: boolean;
133
170
  direction?: 'ltr' | 'rtl';
134
171
  perThemeProps?: boolean;
172
+ safeAreaEmulation?: SafeAreaEmulation;
173
+ fitViewportOnCreate?: boolean;
135
174
  }
136
175
  interface EditorError {
137
176
  message: string;
@@ -153,4 +192,4 @@ declare const DivProEditor: {
153
192
  init(opts: DivProEditorOptions): DivProEditorInstance;
154
193
  };
155
194
 
156
- export { type ActionArg, type ActionArgBase, type ActionArgString, type ActionDesc, type Card, type CardLocale, DivProEditor, type DivProEditorApi, type DivProEditorInstance, type DivProEditorOptions, type EditorError, type EditorInstance, type EditorOptions, type FileLimit, type FileLimits, type FontFaceDesc, type GetTranslationKey, type GetTranslationSuggest, type Layout, type LayoutColumn, type LayoutItem, type Locale, type Meta, type Source, type TankerMeta, type Theme, type TranslationVariant, addTemplatesSuffix, convertDictToPalette, convertPaletteToDict, removeTemplatesSuffix };
195
+ export { type ActionArg, type ActionArgBase, type ActionArgString, type ActionDesc, type Card, type CardLocale, DivProEditor, type DivProEditorApi, type DivProEditorInstance, type DivProEditorOptions, type EditorError, type EditorInstance, type EditorOptions, type FileDialogApi, type FileDialogCallback, type FileDialogShowProps, type FileDialogValue, type FileLimit, type FileLimits, type FontFaceDesc, type GetTranslationKey, type GetTranslationSuggest, type Layout, type LayoutColumn, type LayoutItem, type Locale, type Meta, type SafeAreaEmulation, type Source, type StringValueFilter, type TankerMeta, type Theme, type TranslationVariant, type ValueFilters, addTemplatesSuffix, convertDictToPalette, convertPaletteToDict, removeTemplatesSuffix };