unlayer-types 1.455.0 → 1.456.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.
Files changed (2) hide show
  1. package/embed.d.ts +260 -16
  2. package/package.json +1 -1
package/embed.d.ts CHANGED
@@ -21,7 +21,7 @@ declare module "libs/utils/src/pruneObj" {
21
21
  }): Partial<T>;
22
22
  }
23
23
  declare module "packages/editor/src/editor/components/editors/types" {
24
- import { IconDefinition } from '@fortawesome/pro-regular-svg-icons';
24
+ import type { IconDefinition } from '@fortawesome/pro-regular-svg-icons';
25
25
  import { AppearanceConfig, Device, DisplayMode, Location, UndoRedoBehavior, Variant } from "packages/editor/src/state/types/types";
26
26
  /**
27
27
  * Server-safe configuration for head CSS/JS generation.
@@ -2255,15 +2255,205 @@ declare module "packages/editor/src/engine/config/features" {
2255
2255
  export const getBetaFeatures: () => "assistant"[];
2256
2256
  export function isOnLatestVersion(): boolean;
2257
2257
  export function setFeatures(newFeatures: Features): void;
2258
- export function getFeatureOverrides(): Features;
2258
+ export function getFeatureOverrides(): {
2259
+ audit?: boolean;
2260
+ beta?: boolean | {
2261
+ enabled?: boolean;
2262
+ feedback?: boolean;
2263
+ };
2264
+ blocks?: boolean;
2265
+ collaboration?: boolean;
2266
+ preview?: boolean | {
2267
+ enabled?: boolean;
2268
+ cleanup?: boolean;
2269
+ deviceResolutions?: {
2270
+ showDefaultResolutions?: boolean;
2271
+ customResolutions?: {
2272
+ desktop?: Resolution[];
2273
+ tablet?: Resolution[];
2274
+ mobile?: Resolution[];
2275
+ };
2276
+ };
2277
+ };
2278
+ imageEditor?: {
2279
+ enabled?: boolean;
2280
+ /**
2281
+ * Pin a specific published image-editor bundle version. By default the
2282
+ * editor loads the latest image-editor, so fixes ship without an editor
2283
+ * release; set this to load an exact version (e.g. to reproduce a bug
2284
+ * or stage a risky change). Unknown versions fall forward to the latest.
2285
+ */
2286
+ version?: string;
2287
+ /**
2288
+ * Side the tool tabs (and their properties panel) dock to. Defaults
2289
+ * to `'right'`.
2290
+ */
2291
+ dock?: "left" | "right";
2292
+ tools?: {
2293
+ crop?: ImageEditorToolConfig;
2294
+ /** Rounded-corners control (lives inside the Crop tool). */
2295
+ corners?: ImageEditorToolConfig;
2296
+ resize?: ImageEditorToolConfig;
2297
+ filter?: ImageEditorToolConfig;
2298
+ draw?: ImageEditorToolConfig;
2299
+ text?: ImageEditorToolConfig;
2300
+ shapes?: ImageEditorToolConfig;
2301
+ stickers?: ImageEditorToolConfig;
2302
+ frame?: ImageEditorToolConfig;
2303
+ };
2304
+ } | boolean;
2305
+ preheaderText?: boolean;
2306
+ headersAndFooters?: boolean;
2307
+ stockImages?: {
2308
+ enabled: true;
2309
+ safeSearch: true;
2310
+ defaultSearchTerm: string;
2311
+ } | boolean;
2312
+ userUploads?: boolean | {
2313
+ enabled: boolean;
2314
+ search?: boolean;
2315
+ };
2316
+ devTab?: boolean;
2317
+ undoRedo?: boolean | {
2318
+ enabled: boolean;
2319
+ autoSelect?: boolean;
2320
+ autoFocus?: boolean;
2321
+ };
2322
+ textEditor?: {
2323
+ spellChecker?: boolean;
2324
+ tables?: boolean;
2325
+ cleanPaste?: boolean | "basic" | "confirm";
2326
+ emojis?: boolean;
2327
+ textDirection?: boolean | null;
2328
+ inlineColorGroups?: string[];
2329
+ inlineFontControls?: boolean;
2330
+ defaultFontSize?: string;
2331
+ fontSizes?: string[];
2332
+ customButtons?: TextEditorCustomButton[];
2333
+ };
2334
+ colorPicker?: ColorPicker;
2335
+ legacy?: {
2336
+ disableHoverButtonColors?: boolean;
2337
+ };
2338
+ inboxPreviews?: boolean;
2339
+ pageAnchors?: boolean;
2340
+ svgImageUpload?: boolean;
2341
+ smartMergeTags?: boolean;
2342
+ multiLanguage?: boolean | {
2343
+ enabled: boolean;
2344
+ languages?: Language[];
2345
+ };
2346
+ styleGuide?: boolean;
2347
+ ai?: boolean | {
2348
+ enabled?: boolean;
2349
+ assistant?: boolean;
2350
+ /** @deprecated Use assistant instead. */
2351
+ copilot?: boolean;
2352
+ models?: boolean;
2353
+ /**
2354
+ * Preferred AI model for the assistant. Accepts:
2355
+ *
2356
+ * - a `"<provider>/<modelId>"` pair (e.g. `"openai/gpt-5.5"`,
2357
+ * `"anthropic/claude-opus-4-7"`) — pins both provider and model,
2358
+ * unambiguous;
2359
+ * - a bare model id (e.g. `"gpt-5.5"`);
2360
+ * - a provider name (e.g. `"openai"`, `"anthropic"`) — selects the
2361
+ * vendor and lets Unlayer pick that provider's default model.
2362
+ *
2363
+ * Forwarded to the v3 stream endpoint as the `model` body field.
2364
+ * Overridden when the user picks a model from the picker
2365
+ * (`models: true`). If unset, the server picks via its routing
2366
+ * policy. If the preferred model has a transient provider outage,
2367
+ * the server tries fallback models only when `fallbackModels` is
2368
+ * `true` or an explicit array.
2369
+ */
2370
+ model?: AICopilotModel;
2371
+ /**
2372
+ * Transient-outage fallback controls for assistant text/design calls.
2373
+ *
2374
+ * - unset: use Unlayer's default picks only when `model` is unset;
2375
+ * - `true`: use Unlayer's default fallback picks even for a pinned
2376
+ * `model`;
2377
+ * - `false`: disable the default outage fallback tail;
2378
+ * - array: ordered fallback model list, replacing Unlayer defaults.
2379
+ *
2380
+ * The `model` field remains the first choice. Fallbacks are not used
2381
+ * for invalid requests, invalid API keys, credit exhaustion, or any
2382
+ * other error that requires user/input/configuration changes.
2383
+ */
2384
+ fallbackModels?: AIFallbackModels;
2385
+ /**
2386
+ * Disable full-template, page, and body generation in the AI
2387
+ * Assistant when set to `false` — usually for cost or latency
2388
+ * control. Per-row, per-content, and per-text edits stay
2389
+ * available. Defaults to `true` (enabled) when the AI Assistant
2390
+ * is enabled, and is also gated by the
2391
+ * `aiAssistant.fullTemplateGeneration` server-side entitlement.
2392
+ */
2393
+ fullTemplateGeneration?: boolean;
2394
+ magicImage?: boolean;
2395
+ image?: {
2396
+ /**
2397
+ * Preferred AI image model for Magic Image and image editing.
2398
+ * Accepts the same shapes as `features.ai.model`, but for image
2399
+ * providers:
2400
+ *
2401
+ * - a `"<provider>/<modelId>"` pair (e.g. `"openai/gpt-image-2"`)
2402
+ * — pins both provider and model, unambiguous;
2403
+ * - a bare model id (e.g. `"gpt-image-2"`);
2404
+ * - a provider name (e.g. `"openai"`, `"google"`) — selects the
2405
+ * vendor and lets Unlayer pick that provider's default image
2406
+ * model.
2407
+ *
2408
+ * Forwarded to the image endpoints as the `model` body field.
2409
+ * If unset, the server picks via its image routing policy. If the
2410
+ * preferred image model has a transient provider outage, the
2411
+ * server tries fallback models only when `fallbackModels` is
2412
+ * `true` or an explicit array.
2413
+ */
2414
+ model?: AIImageModel;
2415
+ /**
2416
+ * Transient-outage fallback controls for Magic Image and image
2417
+ * editing.
2418
+ *
2419
+ * - unset: use Unlayer's default picks only when `model` is unset;
2420
+ * - `true`: use Unlayer's default fallback picks even for a pinned
2421
+ * `model`;
2422
+ * - `false`: disable the default outage fallback tail;
2423
+ * - array: ordered fallback model list, replacing Unlayer defaults.
2424
+ *
2425
+ * The `model` field remains the first choice. Fallbacks are not
2426
+ * used for invalid prompts, unsupported model IDs, invalid API
2427
+ * keys, credit exhaustion, or any other error that requires
2428
+ * user/input/configuration changes.
2429
+ */
2430
+ fallbackModels?: AIImageFallbackModels;
2431
+ /**
2432
+ * Quality tier, uniform across providers. Higher tiers cost
2433
+ * more. Mapped internally per provider — OpenAI gpt-image-2 to
2434
+ * its `quality` field, Gemini to image resolution
2435
+ * (`low`→1K, `medium`→2K, `high`→4K). Defaults to `'medium'`.
2436
+ */
2437
+ quality?: "low" | "medium" | "high";
2438
+ };
2439
+ smartButtons?: boolean;
2440
+ smartHeadings?: boolean;
2441
+ smartImageAltText?: boolean;
2442
+ smartText?: boolean;
2443
+ smartParagraph?: boolean;
2444
+ };
2445
+ sendTestEmail?: boolean;
2446
+ syncedBlocks?: boolean;
2447
+ normalizeEmailLineHeights?: boolean;
2448
+ };
2259
2449
  export function setOverrideFeatures(newOverrideFeatures: Features, options?: {
2260
2450
  deepmerge?: boolean;
2261
2451
  }): void;
2262
2452
  export function getFeatures(): Features;
2263
- export function getFeature<Path extends keyof Features | [keyof Features, ...string[]]>(path: Path): Path extends keyof Features ? Features[Path] : any;
2453
+ export function getFeature<Path extends keyof Features | [keyof Features, ...string[]] | (string & {})>(path: Path): Path extends keyof Features ? Features[Path] : any;
2264
2454
  export function normalizeFeatureAsObject<Object extends Record<string, any>, Feature extends boolean | Object>(feature: Feature | undefined): Partial<Feature & object>;
2265
- export function getFeatureAsObject<Path extends keyof Features | [keyof Features, ...string[]]>(path: Path): Partial<(Path extends keyof Features ? Features[Path] : any) & object>;
2266
- export function hasFeature<Path extends keyof Features | [keyof Features, ...string[]]>(path: Path, checkEntitlement?: boolean | string): boolean;
2455
+ export function getFeatureAsObject<Path extends keyof Features | [keyof Features, ...string[]] | (string & {})>(path: Path): Partial<(Path extends keyof Features ? Features[Path] : any) & object>;
2456
+ export function hasFeature<Path extends keyof Features | [keyof Features, ...string[]] | (string & {})>(path: Path, checkEntitlement?: boolean | string): boolean;
2267
2457
  }
2268
2458
  declare module "packages/editor/src/engine/config/offline" {
2269
2459
  export function enableOffline(): void;
@@ -2281,6 +2471,10 @@ declare module "packages/editor/src/engine/config/callbacks" {
2281
2471
  export function registerCallback(type: string, callback: CallbackFn | null | undefined): void;
2282
2472
  export function unregisterCallback(type: string): void;
2283
2473
  export function triggerCallback(type: string, ...args: [...any[], CallbackDoneFn | undefined]): void;
2474
+ export function triggerTextEditorReady(): void;
2475
+ export function onTextEditorReady(handler: () => void): {
2476
+ remove: () => void;
2477
+ };
2284
2478
  export function onRegisterCallback(handler: Handler<{
2285
2479
  type: string;
2286
2480
  callback: CallbackFn;
@@ -2372,7 +2566,7 @@ declare module "packages/editor/src/embed/Config" {
2372
2566
  import type { SafeHtmlOptions } from "packages/editor/src/engine/config/safeHtml";
2373
2567
  import type { TextDirection } from "packages/editor/src/engine/config/intl";
2374
2568
  import type { UnlayerLocale, UnlayerTranslations } from "packages/editor/src/engine/translations/types";
2375
- import type { AppearanceConfig, Audit, DesignTags, DesignTagsConfig, Device, DisplayConditions, DisplayMode, Fonts, JSONTemplate, LinkTypes, LinkTypesSharedConfig, MergeTags, MergeTagsConfig, MergeTagsValues, SpecialLinks, Tabs, ToolsConfig, User } from "packages/editor/src/state/types/types";
2569
+ import type { AppearanceConfig, Audit, DesignTags, DesignTagsConfig, Device, DisplayConditions, DisplayMode, Fonts, JSONTemplate, Language, LinkTypes, LinkTypesSharedConfig, MergeTags, MergeTagsConfig, MergeTagsValues, SpecialLinks, Tabs, ToolsConfig, User } from "packages/editor/src/state/types/types";
2376
2570
  import type { DeepPartial } from "packages/editor/src/editor/components/editors/types";
2377
2571
  export interface Config {
2378
2572
  id?: string;
@@ -2408,6 +2602,8 @@ declare module "packages/editor/src/embed/Config" {
2408
2602
  linkTypes?: LinkTypes;
2409
2603
  linkTypesSharedConfig?: LinkTypesSharedConfig;
2410
2604
  mergeTags?: MergeTags;
2605
+ multiLanguage?: boolean;
2606
+ languages?: Language[];
2411
2607
  displayConditions?: DisplayConditions;
2412
2608
  specialLinks?: SpecialLinks;
2413
2609
  designTags?: DesignTags;
@@ -2511,13 +2707,32 @@ declare module "libs/utils/src/findDeep" {
2511
2707
  }): string[][];
2512
2708
  }
2513
2709
  declare module "packages/editor/src/embed/Frame" {
2514
- export type Message = object;
2710
+ export type Message = Record<string, any>;
2515
2711
  export interface MessageData {
2516
2712
  action: string;
2517
2713
  callbackId: number;
2518
2714
  doneId: number;
2519
- result: unknown | undefined;
2520
- resultArgs: unknown[] | undefined;
2715
+ result: any;
2716
+ resultArgs: any[] | undefined;
2717
+ }
2718
+ export interface FrameOptions {
2719
+ /**
2720
+ * Background color painted on the iframe element + injected into the
2721
+ * iframe document's `<html>` / `<body>` / `#editor` via an inline
2722
+ * `<style>` tag before editor.js runs. Lets the embedder avoid the
2723
+ * white flash that otherwise spans editor.js download + parse +
2724
+ * React mount when a dark theme is configured.
2725
+ */
2726
+ iframeBackgroundColor?: string;
2727
+ /**
2728
+ * Foreground / icon color applied to the iframe element via
2729
+ * `iframe.style.color`. Read back inside the iframe (via
2730
+ * `window.frameElement.style.color`) to seed the
2731
+ * `--unlayer-iframe-color` CSS variable that the boot Loader
2732
+ * spinner uses, so the icon contrasts with the boot background
2733
+ * for the embedder's theme.
2734
+ */
2735
+ iframeTextColor?: string;
2521
2736
  }
2522
2737
  export class Frame {
2523
2738
  id: number;
@@ -2528,8 +2743,8 @@ declare module "packages/editor/src/embed/Frame" {
2528
2743
  callbacks: {
2529
2744
  [key: number]: ((...args: any[]) => any) | undefined;
2530
2745
  };
2531
- constructor(src: string);
2532
- createIframe(src: string): HTMLIFrameElement;
2746
+ constructor(src: string, options?: FrameOptions);
2747
+ createIframe(src: string, { iframeBackgroundColor, iframeTextColor }?: FrameOptions): HTMLIFrameElement;
2533
2748
  destroy: () => void;
2534
2749
  appendTo(el: Element): void;
2535
2750
  onWindowMessage: (event: MessageEvent<any>) => void;
@@ -2609,6 +2824,22 @@ declare module "packages/editor/src/editor/helpers/sortArrayByPosition" {
2609
2824
  position?: number;
2610
2825
  }>(arr: T[]): T[];
2611
2826
  }
2827
+ declare module "packages/editor/src/engine/config/propertyEditorRenderIsolation" {
2828
+ type PropertyEditorRegistration = {
2829
+ schemas?: unknown;
2830
+ zodSchemas?: unknown;
2831
+ };
2832
+ /**
2833
+ * Privately identifies the editor's own property-editor registrations.
2834
+ *
2835
+ * Public `registerPropertyEditor` callers keep the legacy full-props render
2836
+ * behavior, including callers that replace a built-in id. The schema identity
2837
+ * check recognizes the first-party module registration without adding an
2838
+ * internal performance option to the public PropertyEditorConfig contract.
2839
+ */
2840
+ export function markFirstPartyPropertyEditor(registration: object & PropertyEditorRegistration, existingRegistration: object | undefined, builtInSchema: PropertyEditorRegistration | undefined): void;
2841
+ export function isFirstPartyPropertyEditor(registration: object | undefined): boolean;
2842
+ }
2612
2843
  declare module "packages/editor/src/engine/config/tools" {
2613
2844
  import type { JSONSchema } from "packages/editor/src/state/types/types";
2614
2845
  import Mustache from 'mustache';
@@ -2920,8 +3151,8 @@ declare module "packages/editor/src/engine/config/tools" {
2920
3151
  export function hasAISchemas(tool: ToolConfig, { displayMode }?: {
2921
3152
  displayMode?: DisplayMode;
2922
3153
  }): boolean;
2923
- export function getAllTools(): any;
2924
- export function getTools(collection?: Collection): any;
3154
+ export function getAllTools(): ToolConfig<ValueMap, Validator>[];
3155
+ export function getTools(collection?: Collection): ToolConfig<ValueMap, Validator>[];
2925
3156
  export function getCustomToolsCount(): number;
2926
3157
  /**
2927
3158
  * Returns the set of custom-tool ids that fall within the project's
@@ -3082,9 +3313,9 @@ declare module "packages/editor/src/engine/config/tools" {
3082
3313
  displayMode: DisplayMode;
3083
3314
  entitlements: Entitlements;
3084
3315
  }): {
3085
- availableTools: any;
3086
- availableToolsWithDefaultRow: any[];
3087
- classicTools: any;
3316
+ availableTools: ToolConfig<ValueMap, Validator>[];
3317
+ availableToolsWithDefaultRow: ToolConfig<ValueMap, Validator>[];
3318
+ classicTools: ToolConfig<ValueMap, Validator>[];
3088
3319
  };
3089
3320
  }
3090
3321
  declare module "packages/editor/src/engine/config/tabs" {
@@ -3595,6 +3826,11 @@ declare module "packages/editor/src/state/types/callbacks" {
3595
3826
  }) => void;
3596
3827
  }
3597
3828
  }
3829
+ declare module "packages/editor/src/embed/iframeBackground" {
3830
+ export function rememberTheme(theme: unknown): void;
3831
+ export const getIframeBackgroundColor: (theme: unknown) => string | undefined;
3832
+ export const getIframeTextColor: (theme: unknown) => string | undefined;
3833
+ }
3598
3834
  declare module "packages/editor/src/embed/Editor" {
3599
3835
  import { Frame } from "packages/editor/src/embed/Frame";
3600
3836
  import type { Config, ExportFromApiResult, ExportHtmlOptions, ExportHtmlResult, ExportPlainTextResult, ExportImageFromApiOptions, ExportLiveHtmlOptions, ExportPdfFromApiOptions, ExportPlainTextOptions, ExportZipFromApiOptions, SaveDesignOptions, ExportLiveHtmlResult } from "packages/editor/src/embed/Config";
@@ -3617,6 +3853,7 @@ declare module "packages/editor/src/embed/Editor" {
3617
3853
  frame: Frame | null;
3618
3854
  constructor(config?: Config);
3619
3855
  init(config?: Config): void;
3856
+ private captureTargetElement;
3620
3857
  destroy(): void;
3621
3858
  versions: {
3622
3859
  current: string | undefined;
@@ -3626,6 +3863,10 @@ declare module "packages/editor/src/embed/Editor" {
3626
3863
  get version(): string;
3627
3864
  loadEditor(config: Config): void;
3628
3865
  renderEditor(config: Config): void;
3866
+ private targetElement;
3867
+ private lastResolvedBackground;
3868
+ private lastResolvedTextColor;
3869
+ private applyTargetBackground;
3629
3870
  initEditor(config: Config): void;
3630
3871
  registerColumns(cells: number[]): void;
3631
3872
  registerCallback<T extends keyof CallbackTypeMap<TClassDisplayMode>>(type: T, callback: CallbackTypeMap<TClassDisplayMode>[T]): void;
@@ -3665,6 +3906,9 @@ declare module "packages/editor/src/embed/Editor" {
3665
3906
  exportZip<TDisplayMode extends DisplayMode | undefined = TClassDisplayMode>(callback: (data: ExportFromApiResult<TDisplayMode>) => void, options?: ExportZipFromApiOptions): void;
3666
3907
  setAppearance(appearance: DeepPartial<AppearanceConfig>): void;
3667
3908
  setTheme(theme: AppearanceConfig['theme']): void;
3909
+ private applyIframeBackgroundFromTheme;
3910
+ private applyIframeTextColorFromTheme;
3911
+ private postToIframeWithRetry;
3668
3912
  setBodyValues(bodyValues: Partial<BodyValues>, bodyId?: number): void;
3669
3913
  setStyleGuide(styleGuide: StyleGuideConfig): void;
3670
3914
  setDesignTagsConfig(designTagsConfig: DesignTagsConfig): void;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "unlayer-types",
3
- "version": "1.455.0",
3
+ "version": "1.456.0",
4
4
  "license": "MIT"
5
5
  }