import { BarcodeCharacterSet, BarcodeErrorCorrectionLevel, BarcodeType, QuietZone } from './BarcodeTypes'; import { ColorUsage } from './ColorStyleTypes'; import { HasOverrideState, Id, PropertyState } from './CommonTypes'; import { GradientUsage } from './GradientStyleTypes'; import { ComponentGridSettings } from '../types/ComponentGridTypes'; import { CornerRadiusAll, CornerRadiusNone, CornerRadiusOnly, ShapeFrameSource, ShapeType, ShapeContainerProperties } from './ShapeTypes'; export type FrameLayoutType = { id: Id; layoutId: Id; horizontal: FrameAnchor; vertical: FrameAnchor; x: PropertyState; y: PropertyState; width: PropertyState; height: PropertyState; rotationDegrees: PropertyState; scaleX: PropertyState; scaleY: PropertyState; isVisible: PropertyState; fitMode: PropertyState; fitModePosition: PropertyState; smartCropSettings: PropertyState; hasImageCrop: PropertyState; hasFrameSubjectArea: PropertyState; minCopyfitting: PropertyState; maxCopyfitting: PropertyState; enableCopyfitting: PropertyState; autoGrow: AutoGrowSettings; isShowingCustomCroppedAsset: boolean; customCroppedAssetCount: number; subjectId: PropertyState; componentGridSettings: PropertyState; componentFit: PropertyState; } | null; export type FrameType = { id: Id; name: string; type: FrameTypeEnum; imageUrl: string; blendMode: string; opacity: number; }; export type Frame = TextFrame | ImageFrame | ShapeFrame | BarcodeFrame | ComponentFrame | ComponentGridFrame; export type ImageFrameVariableSource = { type: ImageSourceTypeEnum.variable; id: Id; }; export type ImageFrameUrlSource = { type: ImageSourceTypeEnum.url; url: string; }; export type ImageFrameConnectorSource = { type: ImageSourceTypeEnum.connector; assetId: Id; id: Id; }; export type ImageFrameBrandkitMediaSource = { type: ImageSourceTypeEnum.brandKitMedia; name: string; }; export type ImageFrameSource = ImageFrameConnectorSource | ImageFrameVariableSource | ImageFrameUrlSource | ImageFrameBrandkitMediaSource; export type ImageFrame = { id: Id; name: string; opacity: number; type: FrameTypeEnum.image; src?: ImageFrameSource; blendMode: BlendMode; dropShadowSettings?: DropShadowSettings; container: { source: ShapeFrameSource; properties: ShapeContainerProperties; }; }; export type ShapeFrame = { id: Id; name: string; opacity: number; type: FrameTypeEnum.shape; blendMode: BlendMode; shapeProperties: { enableFill: boolean; fillColor: ColorUsage; enableStroke: boolean; strokeWeight: number; strokeColor: ColorUsage; allCornersSame: boolean; }; src: { type: ShapeType; cornerRadius: CornerRadiusNone | CornerRadiusAll | CornerRadiusOnly; sides?: number; }; dropShadowSettings?: DropShadowSettings; gradient?: GradientUsage; }; export type TextFrame = { id: Id; name: string; opacity: number; type: FrameTypeEnum.text; textContent: string; paddingLeft: number; paddingTop: number; paddingRight: number; paddingBottom: number; numberOfColumns: number; columnGap: number; textDirection: TextDirection; flowDirection: FlowDirection; verticalAlign: VerticalAlign; textStroke: boolean; textStrokeWeight: number; textStrokeColor: number; hasClippingPath: boolean; blendMode: BlendMode; dropShadowSettings?: DropShadowSettings; hasVariable?: boolean; }; export type BarcodeFrame = { id: Id; name: string; opacity: number; type: FrameTypeEnum.barcode; blendMode: BlendMode; barcodeProperties: { enableBackground: boolean; backgroundColor: ColorUsage; enableBarColor: boolean; barColor: ColorUsage; enableText: boolean; barHeight: number; magnification: number; quietZone: QuietZone; errorCorrectionLevel?: BarcodeErrorCorrectionLevel; characterSet?: BarcodeCharacterSet; drawStartStopChars: boolean; }; src?: BarcodeSource; barcodeType: BarcodeType; dropShadowSettings?: DropShadowSettings; }; export type BarcodeSource = BarcodeVariableSource | BarcodeTextSource; export type BarcodeVariableSource = { type: BarcodeSourceTypeEnum.variable; id: Id; }; export type BarcodeTextSource = { type: BarcodeSourceTypeEnum.text; text: string; }; export type ComponentFrame = { id: Id; name: string; opacity: number; type: FrameTypeEnum.component; blendMode: BlendMode; src: ComponentSource; variableMappings: VariableMapping[]; /** * How the component fits within the frame. */ fitMode: ComponentFitEnum; }; export type ComponentGridFrame = { id: Id; name: string; opacity: number; type: FrameTypeEnum.componentGrid; blendMode: BlendMode; dataSourceVariableId?: Id | null; src?: ComponentSource | null; variableMappings: GridVariableMapping; }; export type GridVariableMapping = { mappings: Record; }; export type ComponentSource = ConnectorComponentSource; export type ConnectorComponentSource = { type: ComponentSourceTypeEnum.connector; id: Id; assetId: Id | null; }; export type VariableMapping = { source: Id; target: Id; sourceField?: string; }; export declare enum ComponentFitEnum { /** * The component resizes to fit the frame size. */ resize = "resize", /** * The component scales to fit the frame size while maintaining its aspect ratio. */ scale = "scale", /** * The component first scales to fit the frame size while maintaining its aspect ratio, * then resizes to fill the remaining space. */ scaleAndResize = "scaleAndResize" } export type CropSettings = { left: number; top: number; width: number; height: number; rotationDegrees: number; type: 'default'; }; export type NoCropSettings = { type: 'noCrop'; }; export type AutoGrowSettings = { enabled: PropertyState; minWidth: PropertyState; maxWidth: PropertyState; minHeight: PropertyState; maxHeight: PropertyState; directions: PropertyState>; }; export interface AutoGrowDeltaUpdate { enabled?: { value: boolean; }; minWidth?: { value: string | null; }; maxWidth?: { value: string | null; }; minHeight?: { value: string | null; }; maxHeight?: { value: string | null; }; directions?: { value: Array; }; } export type DropShadowSettings = { enabled: boolean; distance: number; angleDegrees: number; blurRadius: number; color: ColorUsage; }; export interface ShadowSettingsDeltaUpdate { distance?: { value: string; }; angleDegrees?: { value: number; }; blurRadius?: { value: number; }; enabled?: { value: boolean; }; color?: { value: ColorUsage; }; } export declare enum AutoGrowDirection { top = "top", bottom = "bottom", left = "left", right = "right" } export declare enum ImageSourceTypeEnum { url = "url", variable = "variable", connector = "connector", brandKitMedia = "brandKitMedia" } export declare enum ComponentSourceTypeEnum { connector = "connector" } export declare enum FrameTypeEnum { text = "text", image = "image", shape = "shape", barcode = "barcode", component = "component", componentGrid = "componentGrid" } export declare enum BarcodeSourceTypeEnum { variable = "variable", text = "text" } export declare enum TextDirection { leftToRight = "leftToRight", rightToLeft = "rightToLeft", weak = "weak" } export declare enum FlowDirection { horizontal = "horizontal", vertical = "vertical", onPath = "onPath" } export declare enum VerticalAlign { top = "top", bottom = "bottom", middle = "middle", justify = "justify" } export declare enum BlendMode { normal = "normal", screen = "screen", overlay = "overlay", darken = "darken", lighten = "lighten", colorDodge = "colorDodge", colorBurn = "colorBurn", hardLight = "hardLight", softLight = "softLight", difference = "difference", exclusion = "exclusion", multiply = "multiply", hue = "hue", saturation = "saturation", color = "color", luminosity = "luminosity" } export declare enum FitMode { fill = "fill", fit = "fit", smartCrop = "smartCrop", manualCrop = "manualCrop" } export declare enum FitModePosition { topLeft = "topLeft", topCenter = "topCenter", topRight = "topRight", centerLeft = "centerLeft", center = "center", centerRight = "centerRight", bottomLeft = "bottomLeft", bottomCenter = "bottomCenter", bottomRight = "bottomRight" } export declare enum UpdateZIndexMethod { bringToFront = "bringToFront", sendToBack = "sendToBack", bringForward = "bringForward", sendBackward = "sendBackward" } export declare enum FrameAnchorType { relative = "relative", start = "start", end = "end", startAndEnd = "startAndEnd", center = "center" } export declare enum AnchorTargetType { page = "page", frame = "frame" } export declare enum AnchorTargetEdgeType { start = "start", end = "end", center = "center" } export declare class PageAnchorTarget { type: AnchorTargetType; } export declare class FrameAnchorTarget { frameId: Id; edge: AnchorTargetEdgeType; type: AnchorTargetType; constructor(id: Id, edge: AnchorTargetEdgeType); } export type AnchorTarget = PageAnchorTarget | FrameAnchorTarget; export type RelativeFrameAnchor = { start: PropertyState; end: PropertyState; target: AnchorTarget; type: FrameAnchorType.relative; } & HasOverrideState; export type StartFrameAnchor = { offset: PropertyState; target: AnchorTarget; type: FrameAnchorType.start; } & HasOverrideState; export type EndFrameAnchor = { offset: PropertyState; target: AnchorTarget; type: FrameAnchorType.end; } & HasOverrideState; export type StartAndEndFrameAnchor = { start: PropertyState; startTarget: AnchorTarget; end: PropertyState; endTarget: AnchorTarget; type: FrameAnchorType.startAndEnd; } & HasOverrideState; export type CenterFrameAnchor = { offset: PropertyState; target: AnchorTarget; type: FrameAnchorType.center; } & HasOverrideState; export type FrameAnchor = RelativeFrameAnchor | StartFrameAnchor | EndFrameAnchor | StartAndEndFrameAnchor | CenterFrameAnchor; export type FrameAnchorProperties = { horizontal: boolean; type: FrameAnchorType; target: AnchorTarget; endTarget?: AnchorTarget | null; }; export type AnchorConfiguration = { allowedTypes: Set; allowedFrameIds: Set; }; export type FrameConfiguration = { horizontal: AnchorConfiguration; vertical: AnchorConfiguration; }; export declare enum CropType { frameCrop = "frameCrop", assetCrop = "assetCrop" } /** * Image-specific editing constraints. */ export type ImageFrameConstraints = { cropAllowed: PropertyState; }; /** * Text-specific editing constraints. */ export type TextFrameConstraints = { editingAllowed: PropertyState; paragraphStyles: PropertyState; characterStyles: PropertyState; colors: PropertyState; fontSizes: PropertyState; }; export interface ManagedConstraint { allowed: boolean; } /** * A managed constraint represented by a set of allowed Id identifiers. * * Example: used to allow only a specific set of paragraph or character styles. * - `allowed`: If true, only the provided `ids` may be used. * - `ids`: The set of allowed Id values. */ export interface IdSetManagedConstraint extends ManagedConstraint { allowed: boolean; ids: Id[]; } /** * A managed constraint that restricts allowed font sizes to a continuous range. * * - `allowed`: If true, restricts allowed font sizes to [min, max] (inclusive). * - `min`: The minimum allowed font size (nullable). * - `max`: The maximum allowed font size (nullable). */ export interface FontSizeRangeManagedConstraint extends ManagedConstraint { allowed: boolean; min: number | null; max: number | null; } /** * Frame editing constraints with optional frame-type-specific sub-properties. */ export type FrameConstraints = { selectionAllowed: PropertyState; horizontalMovementAllowed: PropertyState; verticalMovementAllowed: PropertyState; rotationAllowed: PropertyState; resizeAllowed: PropertyState; proportionLocked: PropertyState; /** Image-specific constraints. */ image?: ImageFrameConstraints; /** Text-specific constraints. */ text?: TextFrameConstraints; }; /** * Image-specific constraints delta update. */ export interface ImageFrameConstraintsDeltaUpdate { cropAllowed?: { value: boolean; }; } /** * Text-specific constraints delta update. */ export interface TextFrameConstraintsDeltaUpdate { editingAllowed?: { value: boolean; }; paragraphStyles?: { value: IdSetManagedConstraint; }; characterStyles?: { value: IdSetManagedConstraint; }; colors?: { value: IdSetManagedConstraint; }; fontSizes?: { value: FontSizeRangeManagedConstraint; }; } /** * Frame constraints delta update with optional frame-type-specific sub-properties. */ export interface FrameConstraintsDeltaUpdate { selectionAllowed?: { value: boolean; }; horizontalMovementAllowed?: { value: boolean; }; verticalMovementAllowed?: { value: boolean; }; rotationAllowed?: { value: boolean; }; resizeAllowed?: { value: boolean; }; proportionLocked?: { value: boolean; }; /** Image-specific constraints update. */ image?: ImageFrameConstraintsDeltaUpdate; /** Text-specific constraints update. */ text?: TextFrameConstraintsDeltaUpdate; } export type SmartCropSettings = SmartCropSettingsV1 | SmartCropSettingsV2; export type SmartCropSettingsV1 = { version: SmartCropVersion.v1; }; export type SmartCropSettingsV2 = { version: SmartCropVersion.v2; horizontalBias: SmartCropAxisBias; verticalBias: SmartCropAxisBias; }; export declare enum SmartCropVersion { v1 = "v1", v2 = "v2" } /** * Latest version of the smart crop algorithm. * Keep in sync with @SmartCropVersion enum. */ export declare const LATEST_SMART_CROP_VERSION = SmartCropVersion.v2; export declare enum SmartCropAxisBias { start = "start", center = "center", end = "end" }