@unlayer/types 1.455.0 → 1.457.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/dist/editor/editor.d.ts +35 -5
- package/package.json +12 -6
package/dist/editor/editor.d.ts
CHANGED
|
@@ -161,6 +161,8 @@ interface Config {
|
|
|
161
161
|
linkTypes?: LinkTypes;
|
|
162
162
|
linkTypesSharedConfig?: LinkTypesSharedConfig;
|
|
163
163
|
mergeTags?: MergeTags;
|
|
164
|
+
multiLanguage?: boolean;
|
|
165
|
+
languages?: Language[];
|
|
164
166
|
displayConditions?: DisplayConditions;
|
|
165
167
|
specialLinks?: SpecialLinks;
|
|
166
168
|
designTags?: DesignTags;
|
|
@@ -181,14 +183,34 @@ interface Config {
|
|
|
181
183
|
tabs?: Tabs;
|
|
182
184
|
}
|
|
183
185
|
|
|
184
|
-
type Message =
|
|
186
|
+
type Message = Record<string, any>;
|
|
185
187
|
|
|
186
188
|
interface MessageData {
|
|
187
189
|
action: string;
|
|
188
190
|
callbackId: number;
|
|
189
191
|
doneId: number;
|
|
190
|
-
result:
|
|
191
|
-
resultArgs:
|
|
192
|
+
result: any;
|
|
193
|
+
resultArgs: any[] | undefined;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export interface FrameOptions {
|
|
197
|
+
/**
|
|
198
|
+
* Background color painted on the iframe element + injected into the
|
|
199
|
+
* iframe document's `<html>` / `<body>` / `#editor` via an inline
|
|
200
|
+
* `<style>` tag before editor.js runs. Lets the embedder avoid the
|
|
201
|
+
* white flash that otherwise spans editor.js download + parse +
|
|
202
|
+
* React mount when a dark theme is configured.
|
|
203
|
+
*/
|
|
204
|
+
iframeBackgroundColor?: string;
|
|
205
|
+
/**
|
|
206
|
+
* Foreground / icon color applied to the iframe element via
|
|
207
|
+
* `iframe.style.color`. Read back inside the iframe (via
|
|
208
|
+
* `window.frameElement.style.color`) to seed the
|
|
209
|
+
* `--unlayer-iframe-color` CSS variable that the boot Loader
|
|
210
|
+
* spinner uses, so the icon contrasts with the boot background
|
|
211
|
+
* for the embedder's theme.
|
|
212
|
+
*/
|
|
213
|
+
iframeTextColor?: string;
|
|
192
214
|
}
|
|
193
215
|
|
|
194
216
|
declare class Frame {
|
|
@@ -200,8 +222,8 @@ declare class Frame {
|
|
|
200
222
|
callbacks: {
|
|
201
223
|
[key: number]: ((...args: any[]) => any) | undefined;
|
|
202
224
|
};
|
|
203
|
-
constructor(src: string);
|
|
204
|
-
createIframe(src: string): HTMLIFrameElement;
|
|
225
|
+
constructor(src: string, options?: FrameOptions);
|
|
226
|
+
createIframe(src: string, { iframeBackgroundColor, iframeTextColor }?: FrameOptions): HTMLIFrameElement;
|
|
205
227
|
destroy: () => void;
|
|
206
228
|
appendTo(el: Element): void;
|
|
207
229
|
onWindowMessage: (event: MessageEvent<any>) => void;
|
|
@@ -219,6 +241,7 @@ declare class EditorClass<TClassDisplayMode extends DisplayMode | undefined = un
|
|
|
219
241
|
frame: Frame | null;
|
|
220
242
|
constructor(config?: Config);
|
|
221
243
|
init(config?: Config): void;
|
|
244
|
+
private captureTargetElement;
|
|
222
245
|
destroy(): void;
|
|
223
246
|
versions: {
|
|
224
247
|
current: string | undefined;
|
|
@@ -228,6 +251,10 @@ declare class EditorClass<TClassDisplayMode extends DisplayMode | undefined = un
|
|
|
228
251
|
get version(): string;
|
|
229
252
|
loadEditor(config: Config): void;
|
|
230
253
|
renderEditor(config: Config): void;
|
|
254
|
+
private targetElement;
|
|
255
|
+
private lastResolvedBackground;
|
|
256
|
+
private lastResolvedTextColor;
|
|
257
|
+
private applyTargetBackground;
|
|
231
258
|
initEditor(config: Config): void;
|
|
232
259
|
registerColumns(cells: number[]): void;
|
|
233
260
|
registerCallback<T extends keyof CallbackTypeMap<TClassDisplayMode>>(type: T, callback: CallbackTypeMap<TClassDisplayMode>[T]): void;
|
|
@@ -267,6 +294,9 @@ declare class EditorClass<TClassDisplayMode extends DisplayMode | undefined = un
|
|
|
267
294
|
exportZip<TDisplayMode extends DisplayMode | undefined = TClassDisplayMode>(callback: (data: ExportFromApiResult<TDisplayMode>) => void, options?: ExportZipFromApiOptions): void;
|
|
268
295
|
setAppearance(appearance: DeepPartial<AppearanceConfig>): void;
|
|
269
296
|
setTheme(theme: AppearanceConfig['theme']): void;
|
|
297
|
+
private applyIframeBackgroundFromTheme;
|
|
298
|
+
private applyIframeTextColorFromTheme;
|
|
299
|
+
private postToIframeWithRetry;
|
|
270
300
|
setBodyValues(bodyValues: Partial<BodyValues>, bodyId?: number): void;
|
|
271
301
|
setStyleGuide(styleGuide: StyleGuideConfig): void;
|
|
272
302
|
setDesignTagsConfig(designTagsConfig: DesignTagsConfig): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unlayer/types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.457.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -33,14 +33,20 @@
|
|
|
33
33
|
"scripts": {
|
|
34
34
|
"clean": "rm -rf dist __generated__",
|
|
35
35
|
"gen-translation-types": "node scripts/gen-translation-types.js",
|
|
36
|
-
"prebuild": "
|
|
36
|
+
"prebuild": "pnpm run clean && pnpm run gen-translation-types && pnpm run build:legacy-unlayer-types",
|
|
37
37
|
"build": "node scripts/build-types.js && node scripts/build-values-types.js",
|
|
38
|
-
"prebuild:legacy-unlayer-types": "
|
|
39
|
-
"build:legacy-unlayer-types": "cd ../../packages/editor/src/embed;
|
|
40
|
-
"test": "
|
|
38
|
+
"prebuild:legacy-unlayer-types": "pnpm run clean",
|
|
39
|
+
"build:legacy-unlayer-types": "cd ../../packages/editor/src/embed; pnpm exec tsc > /dev/null; cd ../../../../packages/unlayer-types; mkdir -p ../../packages/unlayer-types/__generated__/; cp -r ../../packages/editor/src/embed/__generated__/embed.d.ts ../../packages/unlayer-types/__generated__/legacy-unlayer-types.d.ts",
|
|
40
|
+
"test": "pnpm run test:types && pnpm run test:unit",
|
|
41
|
+
"test:types": "node scripts/test-types.js",
|
|
42
|
+
"test:unit": "echo \"SKIP unit tests: no test files in this workspace\"",
|
|
43
|
+
"typecheck": "pnpm run build && tsc --noEmit --project tests/tsconfig.json",
|
|
41
44
|
"release": "node scripts/release.js"
|
|
42
45
|
},
|
|
43
46
|
"devDependencies": {
|
|
44
|
-
"typescript": "5.9.3"
|
|
47
|
+
"typescript": "5.9.3",
|
|
48
|
+
"jest": "29.7.0",
|
|
49
|
+
"@types/jest": "29.5.13",
|
|
50
|
+
"ts-jest": "29.4.11"
|
|
45
51
|
}
|
|
46
52
|
}
|