unlayer-types 1.207.0 → 1.208.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 +74 -115
  2. package/package.json +1 -1
package/embed.d.ts CHANGED
@@ -28,7 +28,8 @@ declare module "editor/components/editors/types" {
28
28
  skipFromUndoRedo?: boolean;
29
29
  }) => void;
30
30
  name: string;
31
- data?: object;
31
+ /** @deprecated Use widgetParams instead */
32
+ data?: WidgetParams;
32
33
  disabled?: boolean;
33
34
  isLockedByStyleGuide?: boolean;
34
35
  widgetParams?: WidgetParams;
@@ -1180,12 +1181,31 @@ declare module "editor/themes/types" {
1180
1181
  };
1181
1182
  };
1182
1183
  }
1184
+ declare module "engine/constants" {
1185
+ export const collections: readonly ["bodies", "columns", "contents", "footers", "headers", "pages", "rows"];
1186
+ export const HTMLInputTypeAttributes: readonly ["button", "checkbox", "color", "date", "datetime-local", "email", "file", "hidden", "image", "month", "number", "password", "radio", "range", "reset", "search", "submit", "tel", "text", "time", "url", "week"];
1187
+ }
1188
+ declare module "engine/utils/zod/schemas" {
1189
+ export const DisplayConditionZodSchema: any;
1190
+ export const FontWeightZodSchema: any;
1191
+ export const FontZodSchema: any;
1192
+ export const HintZodSchema: any;
1193
+ export const PercentageZodSchema: any;
1194
+ export const SinglePxZodSchema: any;
1195
+ export const DoublePxZodSchema: any;
1196
+ export const TriplePxZodSchema: any;
1197
+ export const QuadruplePxZodSchema: any;
1198
+ export const MultiplePxZodSchema: any;
1199
+ }
1183
1200
  declare module "state/types/types" {
1184
1201
  import * as Ariakit from '@ariakit/react';
1185
1202
  import { MutableRefObject, ReactInstance } from 'react';
1203
+ import { z } from 'zod';
1186
1204
  import { State as Design } from '../reducer/design';
1187
1205
  import { CollaborationThread } from "editor/components/editors/types";
1188
1206
  import { Theme } from "editor/themes/types";
1207
+ import { collections } from "engine/constants";
1208
+ import { DisplayConditionZodSchema } from "engine/utils/zod/schemas";
1189
1209
  export type DesignMode = 'live' | 'edit';
1190
1210
  export type Device = 'desktop' | 'mobile' | 'tablet';
1191
1211
  export type DisplayMode = 'web' | 'email' | 'popup' | 'document';
@@ -1214,13 +1234,7 @@ declare module "state/types/types" {
1214
1234
  autocompleteTriggerChar?: string;
1215
1235
  sort?: boolean;
1216
1236
  }
1217
- export interface DisplayCondition {
1218
- type: string;
1219
- label: string;
1220
- description: string;
1221
- before?: string;
1222
- after?: string;
1223
- }
1237
+ export type DisplayCondition = z.infer<typeof DisplayConditionZodSchema>;
1224
1238
  export type DisplayConditions = DisplayCondition[];
1225
1239
  export type SpecialLink = {
1226
1240
  name: string;
@@ -1307,7 +1321,7 @@ declare module "state/types/types" {
1307
1321
  export interface Translations {
1308
1322
  [name: string]: object;
1309
1323
  }
1310
- export type Collection = 'bodies' | 'columns' | 'contents' | 'pages' | 'rows' | 'headers' | 'footers';
1324
+ export type Collection = ArrayItem<typeof collections>;
1311
1325
  export type Container = 'body' | 'row' | 'column' | 'content';
1312
1326
  export interface Location {
1313
1327
  collection: Collection;
@@ -1336,7 +1350,7 @@ declare module "state/types/types" {
1336
1350
  export interface Tool {
1337
1351
  active: boolean;
1338
1352
  type: string | null;
1339
- slug: string | null;
1353
+ slug?: string | null;
1340
1354
  }
1341
1355
  export interface Usage {
1342
1356
  brandStyleGuide?: boolean;
@@ -1446,18 +1460,6 @@ declare module "state/types/types" {
1446
1460
  active?: boolean;
1447
1461
  };
1448
1462
  };
1449
- export type SocialIcon = {
1450
- name: string;
1451
- url: string;
1452
- imgUrl?: string;
1453
- };
1454
- export type SocialCustomIcon = {
1455
- name: string;
1456
- url: string;
1457
- icons: {
1458
- [key: string]: string;
1459
- }[];
1460
- };
1461
1463
  export type AppearanceConfig = {
1462
1464
  actionBar?: {
1463
1465
  placement?: 'top' | 'bottom' | 'top_left' | 'top_right' | 'bottom_left' | 'bottom_right' | undefined;
@@ -1520,6 +1522,8 @@ declare module "state/types/types" {
1520
1522
  [toolId: string]: StyleGuideToolConfig | undefined;
1521
1523
  };
1522
1524
  }
1525
+ export interface JSONSchema {
1526
+ }
1523
1527
  }
1524
1528
  declare module "engine/utils/pruneObj" {
1525
1529
  export function pruneObj<T extends Record<string, any>>(obj: T, options?: {
@@ -1656,17 +1660,9 @@ declare module "engine/config/callbacks" {
1656
1660
  };
1657
1661
  }
1658
1662
  declare module "engine/config/fonts" {
1659
- export interface Font {
1660
- defaultFont?: boolean;
1661
- type?: 'google' | string;
1662
- label: string;
1663
- value: string;
1664
- url?: string;
1665
- weights?: number[] | Array<{
1666
- label: string;
1667
- value: number;
1668
- } | number>;
1669
- }
1663
+ import { z } from 'zod';
1664
+ import { FontZodSchema } from "engine/utils/zod/schemas";
1665
+ export type Font = z.infer<typeof FontZodSchema>;
1670
1666
  export type FontList = Font[];
1671
1667
  export interface FontConfig {
1672
1668
  showDefaultFonts?: boolean;
@@ -1961,9 +1957,10 @@ declare module "editor/hooks/useConfig" {
1961
1957
  export function withConfig<C extends React.ComponentType>(Component: C): React.MemoExoticComponent<React.ForwardRefExoticComponent<React.RefAttributes<unknown>>>;
1962
1958
  }
1963
1959
  declare module "engine/utils/position" {
1964
- import { DisplayMode } from "state/types/types";
1960
+ import { ArrayItem, DisplayMode } from "state/types/types";
1965
1961
  export const ENABLE_BACKGROUND_POSITION_FOR_EMAILS = true;
1966
- export type Position = 'top-left' | 'top-center' | 'top-right' | 'center-left' | 'center' | 'center-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
1962
+ export const positions: readonly ["top-left", "top-center", "top-right", "center-left", "center", "center-right", "bottom-left", "bottom-center", "bottom-right"];
1963
+ export type Position = ArrayItem<typeof positions>;
1967
1964
  export function positionToMarginArray(position: Position | undefined): string[] | readonly [0, "auto", "auto", 0] | readonly [0, "auto", "auto", "auto"] | readonly [0, 0, "auto", "auto"] | readonly ["auto", "auto", "auto", 0] | readonly ["auto"] | readonly ["auto", 0, "auto", "auto"] | readonly ["auto", "auto", 0, 0] | readonly ["auto", "auto", 0, "auto"] | readonly ["auto", 0, 0, "auto"];
1968
1965
  export function positionToBackgroundPosition(position: Position | undefined): 'top left' | 'top center' | 'top right' | 'center left' | 'center center' | 'center right' | 'bottom left' | 'bottom center' | 'bottom right' | 'auto auto';
1969
1966
  export function valuesToBackgroundPositionCSS(values: {
@@ -1975,14 +1972,32 @@ declare module "engine/utils/position" {
1975
1972
  export function positionToPercentages(position: Position | 'custom' | undefined): [x: string, y: string] | undefined;
1976
1973
  export function normalizePosition(position: 'top' | 'top-left' | 'top-center' | 'top-right' | 'center' | 'center-left' | 'center-center' | 'center-right' | 'center-top' | 'center-bottom' | 'bottom' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'left' | 'left-top' | 'left-center' | 'left-bottom' | 'right' | 'right-top' | 'right-center' | 'right-bottom' | 'custom' | undefined): Position | undefined;
1977
1974
  }
1975
+ declare module "engine/utils/zod/zodSchemasToJsonSchemas" {
1976
+ import { ZodSchema } from 'zod';
1977
+ import { JSONSchema } from "state/types/types";
1978
+ export function zodSchemasToJsonSchemas<K extends string>(zodSchemas: Record<K, ZodSchema>): Record<K, JSONSchema>;
1979
+ }
1980
+ declare module "engine/utils/zod/propertyEditorSchemas" {
1981
+ import { PropertyEditorZodSchemas } from '../../config';
1982
+ export function propertyEditorZodSchemas<T extends PropertyEditorZodSchemas>(zodSchemas: T): {
1983
+ zodSchemas: T;
1984
+ schemas: Record<string, import("state/types/types").JSONSchema>;
1985
+ };
1986
+ }
1987
+ declare module "engine/utils/zod/types" {
1988
+ import { z } from 'zod';
1989
+ import { EditorProps } from "editor/components/editors/types";
1990
+ import { PropertyEditorZodSchemas } from '../../config';
1991
+ export type EditorPropsFromZodSchemas<T extends PropertyEditorZodSchemas> = EditorProps<z.infer<T['value']>, z.infer<T['widgetParams']>>;
1992
+ }
1978
1993
  declare module "editor/components/editors/PositionEditor" {
1979
1994
  import React from 'react';
1980
- import { EditorProps } from "editor/components/editors/types";
1981
- import { Position } from "engine/utils/position";
1982
- export type PositionEditorValue = Position | 'custom';
1983
- export type PositionEditorProps = EditorProps<PositionEditorValue, {
1984
- positions?: Position[];
1985
- }>;
1995
+ import { EditorPropsFromZodSchemas } from "engine/utils/zod/types";
1996
+ export const schemas: Record<string, import("state/types/types").JSONSchema>, zodSchemas: {
1997
+ value: any;
1998
+ widgetParams: any;
1999
+ };
2000
+ export type PositionEditorProps = EditorPropsFromZodSchemas<typeof zodSchemas>;
1986
2001
  export function PositionEditor(props: PositionEditorProps): React.JSX.Element;
1987
2002
  export function PositionEditorBase(props: Pick<PositionEditorProps, 'updateValue' | 'value' | 'widgetParams'> & {
1988
2003
  className?: string;
@@ -2550,27 +2565,20 @@ declare module "editor/design-system/components/ToggleSwitch" {
2550
2565
  }
2551
2566
  declare module "editor/components/editors/AutoWidthEditor" {
2552
2567
  import * as React from 'react';
2553
- import { EditorProps } from "editor/components/editors/types";
2554
2568
  import { WidgetLabelProps } from "editor/components/editors/common/WidgetLabel";
2555
2569
  import { Device } from "state/types/types";
2556
- export interface AutoWidthEditorValue {
2557
- autoWidth?: boolean;
2558
- width?: number | string;
2559
- }
2560
- export type AutoWidthEditorProps = EditorProps<AutoWidthEditorValue> & {
2561
- widgetParams?: {
2562
- hint?: string | {
2563
- id: string;
2564
- defaultValue: string;
2565
- };
2566
- };
2570
+ import { EditorPropsFromZodSchemas } from "engine/utils/zod/types";
2571
+ export const schemas: Record<string, import("state/types/types").JSONSchema>, zodSchemas: {
2572
+ value: any;
2573
+ widgetParams: any;
2567
2574
  };
2575
+ export type AutoWidthEditorProps = EditorPropsFromZodSchemas<typeof zodSchemas>;
2568
2576
  export interface AutoWidthEditorBaseProps extends Pick<AutoWidthEditorProps, 'value' | 'defaultValue' | 'disabled' | 'isLockedByStyleGuide'> {
2569
2577
  defaultWidthIsCalculated?: boolean;
2570
2578
  deviceName?: Device;
2571
2579
  widgetLabelProps: Omit<WidgetLabelProps, 'defaultValue' | 'onReset'>;
2572
2580
  handlers: {
2573
- onToggleAutoWidth: (autoWidth: AutoWidthEditorValue['autoWidth']) => void;
2581
+ onToggleAutoWidth: (autoWidth: NonNullable<AutoWidthEditorProps['value']>['autoWidth']) => void;
2574
2582
  onChangeWidth: (width: number) => void;
2575
2583
  onReset: NonNullable<WidgetLabelProps['onReset']>;
2576
2584
  };
@@ -2768,35 +2776,12 @@ declare module "editor/components/editors/pixie/PixieImageEditor" {
2768
2776
  export default PixieImageEditor;
2769
2777
  }
2770
2778
  declare module "editor/components/editors/ImageEditor" {
2771
- import { EditorProps } from "editor/components/editors/types";
2772
- export type ImageEditorValue = {
2773
- url: string;
2774
- width?: number;
2775
- height?: number;
2776
- autoWidth?: boolean;
2777
- maxWidth?: string;
2778
- optimistic?: boolean;
2779
- };
2780
- export type ImageEditorProps = EditorProps<ImageEditorValue> & {
2781
- widgetParams?: {
2782
- shouldRender?: {
2783
- dropzone?: boolean;
2784
- editImageButton?: boolean;
2785
- /** @deprecated Use editImageButton instead */
2786
- effects?: boolean;
2787
- moreImages?: boolean;
2788
- stockImages?: boolean;
2789
- uploadButton?: boolean;
2790
- url?: boolean;
2791
- userUploads?: boolean;
2792
- width?: boolean;
2793
- } | false;
2794
- hint?: string | {
2795
- id: string;
2796
- defaultValue: string;
2797
- };
2798
- };
2779
+ import { EditorPropsFromZodSchemas } from "engine/utils/zod/types";
2780
+ export const schemas: Record<string, import("state/types/types").JSONSchema>, zodSchemas: {
2781
+ value: any;
2782
+ widgetParams: any;
2799
2783
  };
2784
+ export type ImageEditorProps = EditorPropsFromZodSchemas<typeof zodSchemas>;
2800
2785
  export function isDefaultImage(imageUrl: string | undefined): boolean;
2801
2786
  }
2802
2787
  declare module "editor/components/common/Dropzone" {
@@ -2883,44 +2868,18 @@ declare module "editor/components/editors/ImageUploader" {
2883
2868
  export const ImageUploader: ({ disabled, shouldRender: _shouldRender, label, optionName, location, maxSize, intl, onDropAccepted, onDropRejected, isUploading, uploadProgress, imageUrl, imageWidth, imageHeight, imageSize, togglePixieModal, imageExists, error, onImageSelect, onImageUpload, onUploadProgressChange, onUploadStatusChange, onErrorChange, imageUploadButtonRef, showError, ...restProps }: ImageUploaderProps) => React.JSX.Element;
2884
2869
  }
2885
2870
  declare module "editor/components/editors/BackgroundImageEditor" {
2886
- import { EditorProps } from "editor/components/editors/types";
2887
- import { Position } from "engine/utils/position";
2888
- export type BackgroundImageEditorValue = {
2889
- url: string | undefined;
2890
- width: number | undefined;
2891
- height: number | undefined;
2892
- fullWidth: boolean | undefined;
2893
- size: 'contain' | 'cover' | 'custom' | undefined;
2894
- customSize: [string, string];
2895
- repeat: 'no-repeat' | 'repeat-x' | 'repeat-y' | 'repeat' | undefined;
2896
- position: Position | 'custom' | undefined;
2897
- customPosition: [string, string];
2871
+ import { EditorPropsFromZodSchemas } from "engine/utils/zod/types";
2872
+ export const schemas: Record<string, import("state/types/types").JSONSchema>, zodSchemas: {
2873
+ value: any;
2874
+ widgetParams: any;
2898
2875
  };
2899
- export type BackgroundImageEditorProps = EditorProps<BackgroundImageEditorValue, {
2900
- shouldRender?: false | {
2901
- dropzone?: boolean;
2902
- editImageButton?: boolean;
2903
- /** @deprecated Use editImageButton instead */
2904
- effects?: boolean;
2905
- moreImages?: boolean;
2906
- stockImages?: boolean;
2907
- uploadButton?: boolean;
2908
- url?: boolean;
2909
- userUploads?: boolean;
2910
- options?: false | {
2911
- containerWidth?: boolean;
2912
- size?: boolean;
2913
- repeat?: boolean;
2914
- position?: boolean;
2915
- };
2916
- };
2917
- }>;
2876
+ export type BackgroundImageEditorProps = EditorPropsFromZodSchemas<typeof zodSchemas>;
2918
2877
  }
2919
2878
  declare module "engine/options/bodies" {
2920
- import { BackgroundImageEditorValue } from "editor/components/editors/BackgroundImageEditor";
2879
+ import { BackgroundImageEditorProps } from "editor/components/editors/BackgroundImageEditor";
2921
2880
  export type BodyValues = {
2922
2881
  backgroundColor: string;
2923
- backgroundImage: BackgroundImageEditorValue;
2882
+ backgroundImage: BackgroundImageEditorProps['value'];
2924
2883
  contentWidth: string;
2925
2884
  fontFamily: {
2926
2885
  label: string;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "unlayer-types",
3
- "version": "1.207.0",
3
+ "version": "1.208.0",
4
4
  "license": "MIT"
5
5
  }