@chili-publish/studio-sdk 1.44.0 → 1.45.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/_bundles/main.js +2 -2
- package/_bundles/main.js.map +1 -1
- package/lib/src/controllers/BrandKitController.cjs.js +13 -64
- package/lib/src/controllers/BrandKitController.cjs.js.map +1 -1
- package/lib/src/controllers/BrandKitController.d.ts +22 -30
- package/lib/src/controllers/BrandKitController.es.js +13 -64
- package/lib/src/controllers/BrandKitController.es.js.map +1 -1
- package/lib/src/controllers/ComponentController.cjs.js.map +1 -1
- package/lib/src/controllers/ComponentController.d.ts +1 -1
- package/lib/src/controllers/ComponentController.es.js.map +1 -1
- package/lib/src/controllers/ConnectorController.cjs.js.map +1 -1
- package/lib/src/controllers/ConnectorController.d.ts +5 -5
- package/lib/src/controllers/ConnectorController.es.js.map +1 -1
- package/lib/src/exceptions/AsyncExceptions.cjs.js.map +1 -1
- package/lib/src/exceptions/AsyncExceptions.d.ts +1 -0
- package/lib/src/exceptions/AsyncExceptions.es.js.map +1 -1
- package/lib/src/exceptions/Helpers.cjs.js.map +1 -1
- package/lib/src/exceptions/Helpers.es.js.map +1 -1
- package/lib/src/index.cjs.js +3 -2
- package/lib/src/index.cjs.js.map +1 -1
- package/lib/src/index.d.ts +2 -1
- package/lib/src/index.es.js +2 -1
- package/lib/src/next/NextInitiator.cjs.js +0 -2
- package/lib/src/next/NextInitiator.cjs.js.map +1 -1
- package/lib/src/next/NextInitiator.d.ts +0 -2
- package/lib/src/next/NextInitiator.es.js +0 -2
- package/lib/src/next/NextInitiator.es.js.map +1 -1
- package/lib/src/next/index.d.ts +0 -1
- package/lib/src/sdk/editor-engine.json.cjs.js +1 -1
- package/lib/src/sdk/editor-engine.json.es.js +1 -1
- package/lib/src/sdk/package.json.cjs.js +1 -1
- package/lib/src/sdk/package.json.es.js +1 -1
- package/lib/src/sdk.cjs.js +116 -78
- package/lib/src/sdk.cjs.js.map +1 -1
- package/lib/src/sdk.d.ts +52 -34
- package/lib/src/sdk.es.js +116 -78
- package/lib/src/sdk.es.js.map +1 -1
- package/lib/src/types/BrandKitTypes.d.ts +70 -108
- package/lib/src/types/ColorStyleTypes.cjs.js +10 -0
- package/lib/src/types/ColorStyleTypes.cjs.js.map +1 -1
- package/lib/src/types/ColorStyleTypes.es.js +10 -0
- package/lib/src/types/ColorStyleTypes.es.js.map +1 -1
- package/lib/src/types/CommonTypes.cjs.js +1 -0
- package/lib/src/types/CommonTypes.cjs.js.map +1 -1
- package/lib/src/types/CommonTypes.d.ts +2 -1
- package/lib/src/types/CommonTypes.es.js +1 -0
- package/lib/src/types/CommonTypes.es.js.map +1 -1
- package/lib/src/types/ConnectorTypes.cjs.js +6 -2
- package/lib/src/types/ConnectorTypes.cjs.js.map +1 -1
- package/lib/src/types/ConnectorTypes.d.ts +10 -1
- package/lib/src/types/ConnectorTypes.es.js +6 -2
- package/lib/src/types/ConnectorTypes.es.js.map +1 -1
- package/lib/src/types/FrameTypes.cjs.js.map +1 -1
- package/lib/src/types/FrameTypes.d.ts +1 -4
- package/lib/src/types/FrameTypes.es.js.map +1 -1
- package/lib/src/types/MethodInvocationTypes.d.ts +27 -0
- package/lib/src/utils/EngineEventTrigger.cjs.js +4 -1
- package/lib/src/utils/EngineEventTrigger.cjs.js.map +1 -1
- package/lib/src/utils/EngineEventTrigger.d.ts +2 -1
- package/lib/src/utils/EngineEventTrigger.es.js +5 -2
- package/lib/src/utils/EngineEventTrigger.es.js.map +1 -1
- package/lib/src/utils/MethodInstrumentation.cjs.js +176 -0
- package/lib/src/utils/MethodInstrumentation.cjs.js.map +1 -0
- package/lib/src/utils/MethodInstrumentation.d.ts +10 -0
- package/lib/src/utils/MethodInstrumentation.es.js +176 -0
- package/lib/src/utils/MethodInstrumentation.es.js.map +1 -0
- package/lib/src/utils/SdkEvent.cjs.js +29 -0
- package/lib/src/utils/SdkEvent.cjs.js.map +1 -0
- package/lib/src/utils/SdkEvent.d.ts +13 -0
- package/lib/src/utils/SdkEvent.es.js +29 -0
- package/lib/src/utils/SdkEvent.es.js.map +1 -0
- package/lib/src/utils/SdkEvents.cjs.js +11 -0
- package/lib/src/utils/SdkEvents.cjs.js.map +1 -0
- package/lib/src/utils/SdkEvents.d.ts +19 -0
- package/lib/src/utils/SdkEvents.es.js +11 -0
- package/lib/src/utils/SdkEvents.es.js.map +1 -0
- package/package.json +1 -1
- package/lib/src/next/controllers/BrandKitController.cjs.js +0 -34
- package/lib/src/next/controllers/BrandKitController.cjs.js.map +0 -1
- package/lib/src/next/controllers/BrandKitController.d.ts +0 -24
- package/lib/src/next/controllers/BrandKitController.es.js +0 -34
- package/lib/src/next/controllers/BrandKitController.es.js.map +0 -1
- package/lib/src/next/types/BrandKitTypes.d.ts +0 -52
- package/lib/src/utils/BrandKitAdapter.cjs.js +0 -42
- package/lib/src/utils/BrandKitAdapter.cjs.js.map +0 -1
- package/lib/src/utils/BrandKitAdapter.d.ts +0 -9
- package/lib/src/utils/BrandKitAdapter.es.js +0 -42
- package/lib/src/utils/BrandKitAdapter.es.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrameTypes.cjs.js","sources":["../../../src/types/FrameTypes.ts"],"sourcesContent":["// FramePropertiesDto\nimport { BarcodeCharacterSet, BarcodeErrorCorrectionLevel, BarcodeType, QuietZone } from './BarcodeTypes';\nimport { ColorUsage } from './ColorStyleTypes';\nimport { HasOverrideState, Id, PropertyState } from './CommonTypes';\nimport { GradientUsage } from './GradientStyleTypes';\nimport { ComponentGridSettings } from '../types/ComponentGridTypes';\nimport {\n CornerRadiusAll,\n CornerRadiusNone,\n CornerRadiusOnly,\n ShapeFrameSource,\n ShapeType,\n ShapeContainerProperties,\n} from './ShapeTypes';\n\nexport type FrameLayoutType = {\n id: Id;\n layoutId: Id;\n horizontal: FrameAnchor;\n vertical: FrameAnchor;\n x: PropertyState<number>;\n y: PropertyState<number>;\n width: PropertyState<number>;\n height: PropertyState<number>;\n rotationDegrees: PropertyState<number>;\n scaleX: PropertyState<number>;\n scaleY: PropertyState<number>;\n isVisible: PropertyState<boolean>;\n fitMode: PropertyState<FitMode>;\n fitModePosition: PropertyState<FitModePosition>;\n smartCropSettings: PropertyState<SmartCropSettings>;\n hasImageCrop: PropertyState<boolean>;\n hasFrameSubjectArea: PropertyState<boolean>;\n minCopyfitting: PropertyState<number>;\n maxCopyfitting: PropertyState<number>;\n enableCopyfitting: PropertyState<boolean>;\n autoGrow: AutoGrowSettings;\n isShowingCustomCroppedAsset: boolean;\n customCroppedAssetCount: number;\n subjectId: PropertyState<Id | null>;\n componentGridSettings: PropertyState<ComponentGridSettings>;\n} | null;\n\n//Frame.image\nexport type FrameType = {\n id: Id;\n name: string;\n type: FrameTypeEnum;\n // `imageUrl` is not generic: should be removed from model\n imageUrl: string;\n blendMode: string;\n opacity: number;\n};\n\nexport type Frame = TextFrame | ImageFrame | ShapeFrame | BarcodeFrame | ComponentFrame | ComponentGridFrame;\n\nexport type ImageFrameVariableSource = {\n type: ImageSourceTypeEnum.variable;\n id: Id;\n};\n\nexport type ImageFrameUrlSource = {\n type: ImageSourceTypeEnum.url;\n url: string;\n};\n\nexport type ImageFrameConnectorSource = {\n type: ImageSourceTypeEnum.connector;\n assetId: Id;\n id: Id;\n};\n\nexport type ImageFrameBrandkitMediaSource = {\n type: ImageSourceTypeEnum.brandKitMedia;\n name: string;\n};\n\nexport type ImageFrameSource =\n | ImageFrameConnectorSource\n | ImageFrameVariableSource\n | ImageFrameUrlSource\n | ImageFrameBrandkitMediaSource;\n\n// used by new getter methods\nexport type ImageFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.image;\n src?: ImageFrameSource;\n blendMode: BlendMode;\n dropShadowSettings?: DropShadowSettings;\n container: {\n source: ShapeFrameSource;\n properties: ShapeContainerProperties;\n };\n};\n\nexport type ShapeFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.shape;\n blendMode: BlendMode;\n shapeProperties: {\n enableFill: boolean;\n fillColor: ColorUsage;\n enableStroke: boolean;\n strokeWeight: number;\n strokeColor: ColorUsage;\n allCornersSame: boolean;\n };\n src: {\n type: ShapeType;\n cornerRadius: CornerRadiusNone | CornerRadiusAll | CornerRadiusOnly;\n sides?: number;\n };\n dropShadowSettings?: DropShadowSettings;\n gradient?: GradientUsage;\n};\n\nexport type TextFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.text;\n textContent: string;\n paddingLeft: number;\n paddingTop: number;\n paddingRight: number;\n paddingBottom: number;\n numberOfColumns: number;\n columnGap: number;\n textDirection: TextDirection;\n flowDirection: FlowDirection;\n verticalAlign: VerticalAlign;\n textStroke: boolean;\n textStrokeWeight: number;\n textStrokeColor: number;\n hasClippingPath: boolean;\n blendMode: BlendMode;\n dropShadowSettings?: DropShadowSettings;\n hasVariable?: boolean;\n};\n\nexport type BarcodeFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.barcode;\n blendMode: BlendMode;\n barcodeProperties: {\n enableBackground: boolean;\n backgroundColor: ColorUsage;\n enableBarColor: boolean;\n barColor: ColorUsage;\n enableText: boolean;\n barHeight: number;\n magnification: number;\n quietZone: QuietZone;\n errorCorrectionLevel?: BarcodeErrorCorrectionLevel;\n characterSet?: BarcodeCharacterSet;\n drawStartStopChars: boolean;\n };\n src?: BarcodeSource;\n barcodeType: BarcodeType;\n dropShadowSettings?: DropShadowSettings;\n};\n\nexport type BarcodeSource = BarcodeVariableSource | BarcodeTextSource;\n\nexport type BarcodeVariableSource = {\n type: BarcodeSourceTypeEnum.variable;\n id: Id;\n};\n\nexport type BarcodeTextSource = {\n type: BarcodeSourceTypeEnum.text;\n text: string;\n};\n\nexport type ComponentFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.component;\n blendMode: BlendMode;\n src: ComponentSource;\n variableMappings: VariableMapping[];\n\n /**\n * How the component fits within the frame.\n */\n fitMode: ComponentFitEnum;\n};\n\nexport type ComponentGridFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.componentGrid;\n blendMode: BlendMode;\n dataSourceVariableId?: Id | null;\n src?: ComponentSource | null;\n variableMappings: GridVariableMapping;\n\n /**\n * How the component grid fits within the frame.\n */\n fitMode: ComponentFitEnum;\n};\n\nexport type GridVariableMapping = {\n mappings: Record<string, VariableMapping[] | null>;\n}\n\nexport type ComponentSource = ConnectorComponentSource;\n\nexport type ConnectorComponentSource = {\n type: ComponentSourceTypeEnum.connector;\n id: Id;\n assetId: Id | null;\n};\n\nexport type VariableMapping = {\n source: Id;\n target: Id;\n sourceField?: string;\n};\n\nexport enum ComponentFitEnum {\n /**\n * The component resizes to fit the frame size.\n */\n resize = 'resize',\n\n /**\n * The component scales to fit the frame size while maintaining its aspect ratio.\n */\n scale = 'scale',\n\n /**\n * The component first scales to fit the frame size while maintaining its aspect ratio,\n * then resizes to fill the remaining space.\n */\n scaleAndResize = 'scaleAndResize',\n}\n\nexport type CropSettings = {\n left: number;\n top: number;\n width: number;\n height: number;\n rotationDegrees: number;\n type: 'default';\n};\n\nexport type NoCropSettings = {\n type: 'noCrop';\n};\n\nexport type AutoGrowSettings = {\n enabled: PropertyState<boolean>;\n minWidth: PropertyState<number>;\n maxWidth: PropertyState<number>;\n minHeight: PropertyState<number>;\n maxHeight: PropertyState<number>;\n directions: PropertyState<Array<AutoGrowDirection>>;\n};\n\nexport interface AutoGrowDeltaUpdate {\n enabled?: {\n value: boolean;\n };\n minWidth?: {\n value: string | null;\n };\n maxWidth?: {\n value: string | null;\n };\n minHeight?: {\n value: string | null;\n };\n maxHeight?: {\n value: string | null;\n };\n directions?: {\n value: Array<AutoGrowDirection>;\n };\n}\n\nexport type DropShadowSettings = {\n enabled: boolean;\n distance: number;\n angleDegrees: number;\n blurRadius: number;\n color: ColorUsage;\n};\n\nexport interface ShadowSettingsDeltaUpdate {\n distance?: {\n value: string;\n };\n angleDegrees?: {\n value: number;\n };\n blurRadius?: {\n value: number;\n };\n enabled?: {\n value: boolean;\n };\n color?: {\n value: ColorUsage;\n };\n}\n\nexport enum AutoGrowDirection {\n top = 'top',\n bottom = 'bottom',\n left = 'left',\n right = 'right',\n}\n\nexport enum ImageSourceTypeEnum {\n url = 'url',\n variable = 'variable',\n connector = 'connector',\n brandKitMedia = 'brandKitMedia',\n}\n\nexport enum ComponentSourceTypeEnum {\n connector = 'connector',\n}\n\nexport enum FrameTypeEnum {\n text = 'text',\n image = 'image',\n shape = 'shape',\n barcode = 'barcode',\n component = 'component',\n componentGrid = 'componentGrid',\n}\n\nexport enum BarcodeSourceTypeEnum {\n variable = 'variable',\n text = 'text',\n}\n\nexport enum TextDirection {\n leftToRight = 'leftToRight',\n rightToLeft = 'rightToLeft',\n weak = 'weak',\n}\n\nexport enum FlowDirection {\n horizontal = 'horizontal',\n vertical = 'vertical',\n onPath = 'onPath',\n}\n\nexport enum VerticalAlign {\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n justify = 'justify',\n}\n\nexport enum BlendMode {\n normal = 'normal',\n screen = 'screen',\n overlay = 'overlay',\n darken = 'darken',\n lighten = 'lighten',\n colorDodge = 'colorDodge',\n colorBurn = 'colorBurn',\n hardLight = 'hardLight',\n softLight = 'softLight',\n difference = 'difference',\n exclusion = 'exclusion',\n multiply = 'multiply',\n hue = 'hue',\n saturation = 'saturation',\n color = 'color',\n luminosity = 'luminosity',\n}\n\nexport enum FitMode {\n fill = 'fill',\n fit = 'fit',\n smartCrop = 'smartCrop',\n manualCrop = 'manualCrop',\n}\n\nexport enum FitModePosition {\n topLeft = 'topLeft',\n topCenter = 'topCenter',\n topRight = 'topRight',\n centerLeft = 'centerLeft',\n center = 'center',\n centerRight = 'centerRight',\n bottomLeft = 'bottomLeft',\n bottomCenter = 'bottomCenter',\n bottomRight = 'bottomRight',\n}\n\nexport enum UpdateZIndexMethod {\n bringToFront = 'bringToFront',\n sendToBack = 'sendToBack',\n bringForward = 'bringForward',\n sendBackward = 'sendBackward',\n}\n\nexport enum FrameAnchorType {\n relative = 'relative',\n start = 'start',\n end = 'end',\n startAndEnd = 'startAndEnd',\n center = 'center',\n}\n\nexport enum AnchorTargetType {\n page = 'page',\n frame = 'frame',\n}\n\nexport enum AnchorTargetEdgeType {\n start = 'start',\n end = 'end',\n center = 'center',\n}\n\nexport class PageAnchorTarget {\n type = AnchorTargetType.page;\n}\n\nexport class FrameAnchorTarget {\n frameId: Id;\n edge: AnchorTargetEdgeType;\n type = AnchorTargetType.frame;\n\n constructor(id: Id, edge: AnchorTargetEdgeType) {\n (this.frameId = id), (this.edge = edge);\n }\n}\n\nexport type AnchorTarget = PageAnchorTarget | FrameAnchorTarget;\n\nexport type RelativeFrameAnchor = {\n start: PropertyState<number>;\n end: PropertyState<number>;\n target: AnchorTarget;\n type: FrameAnchorType.relative;\n} & HasOverrideState;\n\nexport type StartFrameAnchor = {\n offset: PropertyState<number>;\n target: AnchorTarget;\n type: FrameAnchorType.start;\n} & HasOverrideState;\n\nexport type EndFrameAnchor = {\n offset: PropertyState<number>;\n target: AnchorTarget;\n type: FrameAnchorType.end;\n} & HasOverrideState;\n\nexport type StartAndEndFrameAnchor = {\n start: PropertyState<number>;\n startTarget: AnchorTarget;\n end: PropertyState<number>;\n endTarget: AnchorTarget;\n type: FrameAnchorType.startAndEnd;\n} & HasOverrideState;\n\nexport type CenterFrameAnchor = {\n offset: PropertyState<number>;\n target: AnchorTarget;\n type: FrameAnchorType.center;\n} & HasOverrideState;\n\nexport type FrameAnchor =\n | RelativeFrameAnchor\n | StartFrameAnchor\n | EndFrameAnchor\n | StartAndEndFrameAnchor\n | CenterFrameAnchor;\n\nexport type FrameAnchorProperties = {\n horizontal: boolean;\n type: FrameAnchorType;\n target: AnchorTarget;\n endTarget?: AnchorTarget | null;\n};\n\nexport type AnchorConfiguration = {\n allowedTypes: Set<FrameAnchorType>;\n allowedFrameIds: Set<Id>;\n};\n\nexport type FrameConfiguration = {\n horizontal: AnchorConfiguration;\n vertical: AnchorConfiguration;\n};\n\nexport enum CropType {\n frameCrop = 'frameCrop',\n assetCrop = 'assetCrop',\n}\n\n/**\n * Image-specific editing constraints.\n */\nexport type ImageFrameConstraints = {\n cropAllowed: PropertyState<boolean>;\n};\n\n/**\n * Text-specific editing constraints.\n */\nexport type TextFrameConstraints = {\n editingAllowed: PropertyState<boolean>;\n paragraphStyles: PropertyState<IdSetManagedConstraint>;\n characterStyles: PropertyState<IdSetManagedConstraint>;\n colors: PropertyState<IdSetManagedConstraint>;\n fontSizes: PropertyState<FontSizeRangeManagedConstraint>;\n};\n\nexport interface ManagedConstraint {\n allowed: boolean;\n}\n\n/**\n * A managed constraint represented by a set of allowed Id identifiers.\n *\n * Example: used to allow only a specific set of paragraph or character styles.\n * - `allowed`: If true, only the provided `ids` may be used.\n * - `ids`: The set of allowed Id values.\n */\nexport interface IdSetManagedConstraint extends ManagedConstraint {\n allowed: boolean;\n ids: Id[];\n}\n\n/**\n * A managed constraint that restricts allowed font sizes to a continuous range.\n *\n * - `allowed`: If true, restricts allowed font sizes to [min, max] (inclusive).\n * - `min`: The minimum allowed font size (nullable).\n * - `max`: The maximum allowed font size (nullable).\n */\nexport interface FontSizeRangeManagedConstraint extends ManagedConstraint {\n allowed: boolean;\n min: number | null;\n max: number | null;\n}\n\n/**\n * Frame editing constraints with optional frame-type-specific sub-properties.\n */\nexport type FrameConstraints = {\n selectionAllowed: PropertyState<boolean>;\n horizontalMovementAllowed: PropertyState<boolean>;\n verticalMovementAllowed: PropertyState<boolean>;\n rotationAllowed: PropertyState<boolean>;\n resizeAllowed: PropertyState<boolean>;\n proportionLocked: PropertyState<boolean>;\n /** Image-specific constraints. */\n image?: ImageFrameConstraints;\n /** Text-specific constraints. */\n text?: TextFrameConstraints;\n};\n\n/**\n * Image-specific constraints delta update.\n */\nexport interface ImageFrameConstraintsDeltaUpdate {\n cropAllowed?: {\n value: boolean;\n };\n}\n\n/**\n * Text-specific constraints delta update.\n */\nexport interface TextFrameConstraintsDeltaUpdate {\n editingAllowed?: {\n value: boolean;\n };\n paragraphStyles?: {\n value: IdSetManagedConstraint;\n };\n characterStyles?: {\n value: IdSetManagedConstraint;\n };\n colors?: {\n value: IdSetManagedConstraint;\n };\n fontSizes?: {\n value: FontSizeRangeManagedConstraint;\n };\n}\n\n/**\n * Frame constraints delta update with optional frame-type-specific sub-properties.\n */\nexport interface FrameConstraintsDeltaUpdate {\n selectionAllowed?: {\n value: boolean;\n };\n horizontalMovementAllowed?: {\n value: boolean;\n };\n verticalMovementAllowed?: {\n value: boolean;\n };\n rotationAllowed?: {\n value: boolean;\n };\n resizeAllowed?: {\n value: boolean;\n };\n proportionLocked?: {\n value: boolean;\n };\n /** Image-specific constraints update. */\n image?: ImageFrameConstraintsDeltaUpdate;\n /** Text-specific constraints update. */\n text?: TextFrameConstraintsDeltaUpdate;\n}\n\nexport type SmartCropSettings = SmartCropSettingsV1 | SmartCropSettingsV2;\n\nexport type SmartCropSettingsV1 = {\n version: SmartCropVersion.v1;\n};\n\nexport type SmartCropSettingsV2 = {\n version: SmartCropVersion.v2;\n horizontalBias: SmartCropAxisBias;\n verticalBias: SmartCropAxisBias;\n};\n\nexport enum SmartCropVersion {\n v1 = 'v1',\n v2 = 'v2',\n}\n\n/**\n * Latest version of the smart crop algorithm.\n * Keep in sync with @SmartCropVersion enum.\n */\nexport const LATEST_SMART_CROP_VERSION = SmartCropVersion.v2;\n\nexport enum SmartCropAxisBias {\n start = 'start',\n center = 'center',\n end = 'end',\n}\n"],"names":["ComponentFitEnum","AutoGrowDirection","ImageSourceTypeEnum","ComponentSourceTypeEnum","FrameTypeEnum","BarcodeSourceTypeEnum","TextDirection","FlowDirection","VerticalAlign","BlendMode","FitMode","FitModePosition","UpdateZIndexMethod","FrameAnchorType","AnchorTargetType","AnchorTargetEdgeType","CropType","SmartCropVersion","SmartCropAxisBias"],"mappings":";;AAsOO,IAAK,qCAAAA,sBAAL;AAIHA,oBAAA,QAAA,IAAS;AAKTA,oBAAA,OAAA,I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;AACHA,mBAAA,UAAA,IAAW;AACXA,mBAAA,OAAA,IAAQ;AACRA,mBAAA,KAAA,IAAM;AACNA,mBAAA,aAAA,IAAc;AACdA,mBAAA,QAAA,IAAS;AALD,SAAAA;AAAA,GAAA,mBAAA,CAAA,CAAA;AAQL,IAAK,qCAAAC,sBAAL;AACHA,oBAAA,MAAA,IAAO;AACPA,oBAAA,OAAA,IAAQ;AAFA,SAAAA;AAAA,GAAA,oBAAA,CAAA,CAAA;AAKL,IAAK,yCAAAC,0BAAL;AACHA,wBAAA,OAAA,IAAQ;AACRA,wBAAA,KAAA,IAAM;AACNA,wBAAA,QAAA,IAAS;AAHD,SAAAA;AAAA,GAAA,wBAAA,CAAA,CAAA;AAML,MAAM,iBAAiB;AAAA,EAAvB,cAAA;AACH,SAAA,OAAO;AAAA,EAAA;AACX;AAEO,MAAM,kBAAkB;AAAA,EAK3B,YAAY,IAAQ,MAA4B;AAFhD,SAAA,OAAO;AAGF,SAAK,UAAU,IAAM,KAAK,OAAO;AAAA,EACtC;AACJ;AA6DO,IAAK,6BAAAC,cAAL;AACHA,YAAA,WAAA,IAAY;AACZA,YAAA,WAAA,IAAY;AAFJ,SAAAA;AAAA,GAAA,YAAA,CAAA,CAAA;AA0IL,IAAK,qCAAAC,sBAAL;AACHA,oBAAA,IAAA,IAAK;AACLA,oBAAA,IAAA,IAAK;AAFG,SAAAA;AAAA,GAAA,oBAAA,CAAA,CAAA;AASL,MAAM,4BAA4B;AAElC,IAAK,sCAAAC,uBAAL;AACHA,qBAAA,OAAA,IAAQ;AACRA,qBAAA,QAAA,IAAS;AACTA,qBAAA,KAAA,IAAM;AAHE,SAAAA;AAAA,GAAA,qBAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"FrameTypes.cjs.js","sources":["../../../src/types/FrameTypes.ts"],"sourcesContent":["// FramePropertiesDto\nimport { BarcodeCharacterSet, BarcodeErrorCorrectionLevel, BarcodeType, QuietZone } from './BarcodeTypes';\nimport { ColorUsage } from './ColorStyleTypes';\nimport { HasOverrideState, Id, PropertyState } from './CommonTypes';\nimport { GradientUsage } from './GradientStyleTypes';\nimport { ComponentGridSettings } from '../types/ComponentGridTypes';\nimport {\n CornerRadiusAll,\n CornerRadiusNone,\n CornerRadiusOnly,\n ShapeFrameSource,\n ShapeType,\n ShapeContainerProperties,\n} from './ShapeTypes';\n\nexport type FrameLayoutType = {\n id: Id;\n layoutId: Id;\n horizontal: FrameAnchor;\n vertical: FrameAnchor;\n x: PropertyState<number>;\n y: PropertyState<number>;\n width: PropertyState<number>;\n height: PropertyState<number>;\n rotationDegrees: PropertyState<number>;\n scaleX: PropertyState<number>;\n scaleY: PropertyState<number>;\n isVisible: PropertyState<boolean>;\n fitMode: PropertyState<FitMode>;\n fitModePosition: PropertyState<FitModePosition>;\n smartCropSettings: PropertyState<SmartCropSettings>;\n hasImageCrop: PropertyState<boolean>;\n hasFrameSubjectArea: PropertyState<boolean>;\n minCopyfitting: PropertyState<number>;\n maxCopyfitting: PropertyState<number>;\n enableCopyfitting: PropertyState<boolean>;\n autoGrow: AutoGrowSettings;\n isShowingCustomCroppedAsset: boolean;\n customCroppedAssetCount: number;\n subjectId: PropertyState<Id | null>;\n componentGridSettings: PropertyState<ComponentGridSettings>;\n componentFit: PropertyState<ComponentFitEnum>;\n} | null;\n\n//Frame.image\nexport type FrameType = {\n id: Id;\n name: string;\n type: FrameTypeEnum;\n // `imageUrl` is not generic: should be removed from model\n imageUrl: string;\n blendMode: string;\n opacity: number;\n};\n\nexport type Frame = TextFrame | ImageFrame | ShapeFrame | BarcodeFrame | ComponentFrame | ComponentGridFrame;\n\nexport type ImageFrameVariableSource = {\n type: ImageSourceTypeEnum.variable;\n id: Id;\n};\n\nexport type ImageFrameUrlSource = {\n type: ImageSourceTypeEnum.url;\n url: string;\n};\n\nexport type ImageFrameConnectorSource = {\n type: ImageSourceTypeEnum.connector;\n assetId: Id;\n id: Id;\n};\n\nexport type ImageFrameBrandkitMediaSource = {\n type: ImageSourceTypeEnum.brandKitMedia;\n name: string;\n};\n\nexport type ImageFrameSource =\n | ImageFrameConnectorSource\n | ImageFrameVariableSource\n | ImageFrameUrlSource\n | ImageFrameBrandkitMediaSource;\n\n// used by new getter methods\nexport type ImageFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.image;\n src?: ImageFrameSource;\n blendMode: BlendMode;\n dropShadowSettings?: DropShadowSettings;\n container: {\n source: ShapeFrameSource;\n properties: ShapeContainerProperties;\n };\n};\n\nexport type ShapeFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.shape;\n blendMode: BlendMode;\n shapeProperties: {\n enableFill: boolean;\n fillColor: ColorUsage;\n enableStroke: boolean;\n strokeWeight: number;\n strokeColor: ColorUsage;\n allCornersSame: boolean;\n };\n src: {\n type: ShapeType;\n cornerRadius: CornerRadiusNone | CornerRadiusAll | CornerRadiusOnly;\n sides?: number;\n };\n dropShadowSettings?: DropShadowSettings;\n gradient?: GradientUsage;\n};\n\nexport type TextFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.text;\n textContent: string;\n paddingLeft: number;\n paddingTop: number;\n paddingRight: number;\n paddingBottom: number;\n numberOfColumns: number;\n columnGap: number;\n textDirection: TextDirection;\n flowDirection: FlowDirection;\n verticalAlign: VerticalAlign;\n textStroke: boolean;\n textStrokeWeight: number;\n textStrokeColor: number;\n hasClippingPath: boolean;\n blendMode: BlendMode;\n dropShadowSettings?: DropShadowSettings;\n hasVariable?: boolean;\n};\n\nexport type BarcodeFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.barcode;\n blendMode: BlendMode;\n barcodeProperties: {\n enableBackground: boolean;\n backgroundColor: ColorUsage;\n enableBarColor: boolean;\n barColor: ColorUsage;\n enableText: boolean;\n barHeight: number;\n magnification: number;\n quietZone: QuietZone;\n errorCorrectionLevel?: BarcodeErrorCorrectionLevel;\n characterSet?: BarcodeCharacterSet;\n drawStartStopChars: boolean;\n };\n src?: BarcodeSource;\n barcodeType: BarcodeType;\n dropShadowSettings?: DropShadowSettings;\n};\n\nexport type BarcodeSource = BarcodeVariableSource | BarcodeTextSource;\n\nexport type BarcodeVariableSource = {\n type: BarcodeSourceTypeEnum.variable;\n id: Id;\n};\n\nexport type BarcodeTextSource = {\n type: BarcodeSourceTypeEnum.text;\n text: string;\n};\n\nexport type ComponentFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.component;\n blendMode: BlendMode;\n src: ComponentSource;\n variableMappings: VariableMapping[];\n\n /**\n * How the component fits within the frame.\n */\n fitMode: ComponentFitEnum;\n};\n\nexport type ComponentGridFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.componentGrid;\n blendMode: BlendMode;\n dataSourceVariableId?: Id | null;\n src?: ComponentSource | null;\n variableMappings: GridVariableMapping;\n};\n\nexport type GridVariableMapping = {\n mappings: Record<string, VariableMapping[] | null>;\n}\n\nexport type ComponentSource = ConnectorComponentSource;\n\nexport type ConnectorComponentSource = {\n type: ComponentSourceTypeEnum.connector;\n id: Id;\n assetId: Id | null;\n};\n\nexport type VariableMapping = {\n source: Id;\n target: Id;\n sourceField?: string;\n};\n\nexport enum ComponentFitEnum {\n /**\n * The component resizes to fit the frame size.\n */\n resize = 'resize',\n\n /**\n * The component scales to fit the frame size while maintaining its aspect ratio.\n */\n scale = 'scale',\n\n /**\n * The component first scales to fit the frame size while maintaining its aspect ratio,\n * then resizes to fill the remaining space.\n */\n scaleAndResize = 'scaleAndResize',\n}\n\nexport type CropSettings = {\n left: number;\n top: number;\n width: number;\n height: number;\n rotationDegrees: number;\n type: 'default';\n};\n\nexport type NoCropSettings = {\n type: 'noCrop';\n};\n\nexport type AutoGrowSettings = {\n enabled: PropertyState<boolean>;\n minWidth: PropertyState<number>;\n maxWidth: PropertyState<number>;\n minHeight: PropertyState<number>;\n maxHeight: PropertyState<number>;\n directions: PropertyState<Array<AutoGrowDirection>>;\n};\n\nexport interface AutoGrowDeltaUpdate {\n enabled?: {\n value: boolean;\n };\n minWidth?: {\n value: string | null;\n };\n maxWidth?: {\n value: string | null;\n };\n minHeight?: {\n value: string | null;\n };\n maxHeight?: {\n value: string | null;\n };\n directions?: {\n value: Array<AutoGrowDirection>;\n };\n}\n\nexport type DropShadowSettings = {\n enabled: boolean;\n distance: number;\n angleDegrees: number;\n blurRadius: number;\n color: ColorUsage;\n};\n\nexport interface ShadowSettingsDeltaUpdate {\n distance?: {\n value: string;\n };\n angleDegrees?: {\n value: number;\n };\n blurRadius?: {\n value: number;\n };\n enabled?: {\n value: boolean;\n };\n color?: {\n value: ColorUsage;\n };\n}\n\nexport enum AutoGrowDirection {\n top = 'top',\n bottom = 'bottom',\n left = 'left',\n right = 'right',\n}\n\nexport enum ImageSourceTypeEnum {\n url = 'url',\n variable = 'variable',\n connector = 'connector',\n brandKitMedia = 'brandKitMedia',\n}\n\nexport enum ComponentSourceTypeEnum {\n connector = 'connector',\n}\n\nexport enum FrameTypeEnum {\n text = 'text',\n image = 'image',\n shape = 'shape',\n barcode = 'barcode',\n component = 'component',\n componentGrid = 'componentGrid',\n}\n\nexport enum BarcodeSourceTypeEnum {\n variable = 'variable',\n text = 'text',\n}\n\nexport enum TextDirection {\n leftToRight = 'leftToRight',\n rightToLeft = 'rightToLeft',\n weak = 'weak',\n}\n\nexport enum FlowDirection {\n horizontal = 'horizontal',\n vertical = 'vertical',\n onPath = 'onPath',\n}\n\nexport enum VerticalAlign {\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n justify = 'justify',\n}\n\nexport enum BlendMode {\n normal = 'normal',\n screen = 'screen',\n overlay = 'overlay',\n darken = 'darken',\n lighten = 'lighten',\n colorDodge = 'colorDodge',\n colorBurn = 'colorBurn',\n hardLight = 'hardLight',\n softLight = 'softLight',\n difference = 'difference',\n exclusion = 'exclusion',\n multiply = 'multiply',\n hue = 'hue',\n saturation = 'saturation',\n color = 'color',\n luminosity = 'luminosity',\n}\n\nexport enum FitMode {\n fill = 'fill',\n fit = 'fit',\n smartCrop = 'smartCrop',\n manualCrop = 'manualCrop',\n}\n\nexport enum FitModePosition {\n topLeft = 'topLeft',\n topCenter = 'topCenter',\n topRight = 'topRight',\n centerLeft = 'centerLeft',\n center = 'center',\n centerRight = 'centerRight',\n bottomLeft = 'bottomLeft',\n bottomCenter = 'bottomCenter',\n bottomRight = 'bottomRight',\n}\n\nexport enum UpdateZIndexMethod {\n bringToFront = 'bringToFront',\n sendToBack = 'sendToBack',\n bringForward = 'bringForward',\n sendBackward = 'sendBackward',\n}\n\nexport enum FrameAnchorType {\n relative = 'relative',\n start = 'start',\n end = 'end',\n startAndEnd = 'startAndEnd',\n center = 'center',\n}\n\nexport enum AnchorTargetType {\n page = 'page',\n frame = 'frame',\n}\n\nexport enum AnchorTargetEdgeType {\n start = 'start',\n end = 'end',\n center = 'center',\n}\n\nexport class PageAnchorTarget {\n type = AnchorTargetType.page;\n}\n\nexport class FrameAnchorTarget {\n frameId: Id;\n edge: AnchorTargetEdgeType;\n type = AnchorTargetType.frame;\n\n constructor(id: Id, edge: AnchorTargetEdgeType) {\n (this.frameId = id), (this.edge = edge);\n }\n}\n\nexport type AnchorTarget = PageAnchorTarget | FrameAnchorTarget;\n\nexport type RelativeFrameAnchor = {\n start: PropertyState<number>;\n end: PropertyState<number>;\n target: AnchorTarget;\n type: FrameAnchorType.relative;\n} & HasOverrideState;\n\nexport type StartFrameAnchor = {\n offset: PropertyState<number>;\n target: AnchorTarget;\n type: FrameAnchorType.start;\n} & HasOverrideState;\n\nexport type EndFrameAnchor = {\n offset: PropertyState<number>;\n target: AnchorTarget;\n type: FrameAnchorType.end;\n} & HasOverrideState;\n\nexport type StartAndEndFrameAnchor = {\n start: PropertyState<number>;\n startTarget: AnchorTarget;\n end: PropertyState<number>;\n endTarget: AnchorTarget;\n type: FrameAnchorType.startAndEnd;\n} & HasOverrideState;\n\nexport type CenterFrameAnchor = {\n offset: PropertyState<number>;\n target: AnchorTarget;\n type: FrameAnchorType.center;\n} & HasOverrideState;\n\nexport type FrameAnchor =\n | RelativeFrameAnchor\n | StartFrameAnchor\n | EndFrameAnchor\n | StartAndEndFrameAnchor\n | CenterFrameAnchor;\n\nexport type FrameAnchorProperties = {\n horizontal: boolean;\n type: FrameAnchorType;\n target: AnchorTarget;\n endTarget?: AnchorTarget | null;\n};\n\nexport type AnchorConfiguration = {\n allowedTypes: Set<FrameAnchorType>;\n allowedFrameIds: Set<Id>;\n};\n\nexport type FrameConfiguration = {\n horizontal: AnchorConfiguration;\n vertical: AnchorConfiguration;\n};\n\nexport enum CropType {\n frameCrop = 'frameCrop',\n assetCrop = 'assetCrop',\n}\n\n/**\n * Image-specific editing constraints.\n */\nexport type ImageFrameConstraints = {\n cropAllowed: PropertyState<boolean>;\n};\n\n/**\n * Text-specific editing constraints.\n */\nexport type TextFrameConstraints = {\n editingAllowed: PropertyState<boolean>;\n paragraphStyles: PropertyState<IdSetManagedConstraint>;\n characterStyles: PropertyState<IdSetManagedConstraint>;\n colors: PropertyState<IdSetManagedConstraint>;\n fontSizes: PropertyState<FontSizeRangeManagedConstraint>;\n};\n\nexport interface ManagedConstraint {\n allowed: boolean;\n}\n\n/**\n * A managed constraint represented by a set of allowed Id identifiers.\n *\n * Example: used to allow only a specific set of paragraph or character styles.\n * - `allowed`: If true, only the provided `ids` may be used.\n * - `ids`: The set of allowed Id values.\n */\nexport interface IdSetManagedConstraint extends ManagedConstraint {\n allowed: boolean;\n ids: Id[];\n}\n\n/**\n * A managed constraint that restricts allowed font sizes to a continuous range.\n *\n * - `allowed`: If true, restricts allowed font sizes to [min, max] (inclusive).\n * - `min`: The minimum allowed font size (nullable).\n * - `max`: The maximum allowed font size (nullable).\n */\nexport interface FontSizeRangeManagedConstraint extends ManagedConstraint {\n allowed: boolean;\n min: number | null;\n max: number | null;\n}\n\n/**\n * Frame editing constraints with optional frame-type-specific sub-properties.\n */\nexport type FrameConstraints = {\n selectionAllowed: PropertyState<boolean>;\n horizontalMovementAllowed: PropertyState<boolean>;\n verticalMovementAllowed: PropertyState<boolean>;\n rotationAllowed: PropertyState<boolean>;\n resizeAllowed: PropertyState<boolean>;\n proportionLocked: PropertyState<boolean>;\n /** Image-specific constraints. */\n image?: ImageFrameConstraints;\n /** Text-specific constraints. */\n text?: TextFrameConstraints;\n};\n\n/**\n * Image-specific constraints delta update.\n */\nexport interface ImageFrameConstraintsDeltaUpdate {\n cropAllowed?: {\n value: boolean;\n };\n}\n\n/**\n * Text-specific constraints delta update.\n */\nexport interface TextFrameConstraintsDeltaUpdate {\n editingAllowed?: {\n value: boolean;\n };\n paragraphStyles?: {\n value: IdSetManagedConstraint;\n };\n characterStyles?: {\n value: IdSetManagedConstraint;\n };\n colors?: {\n value: IdSetManagedConstraint;\n };\n fontSizes?: {\n value: FontSizeRangeManagedConstraint;\n };\n}\n\n/**\n * Frame constraints delta update with optional frame-type-specific sub-properties.\n */\nexport interface FrameConstraintsDeltaUpdate {\n selectionAllowed?: {\n value: boolean;\n };\n horizontalMovementAllowed?: {\n value: boolean;\n };\n verticalMovementAllowed?: {\n value: boolean;\n };\n rotationAllowed?: {\n value: boolean;\n };\n resizeAllowed?: {\n value: boolean;\n };\n proportionLocked?: {\n value: boolean;\n };\n /** Image-specific constraints update. */\n image?: ImageFrameConstraintsDeltaUpdate;\n /** Text-specific constraints update. */\n text?: TextFrameConstraintsDeltaUpdate;\n}\n\nexport type SmartCropSettings = SmartCropSettingsV1 | SmartCropSettingsV2;\n\nexport type SmartCropSettingsV1 = {\n version: SmartCropVersion.v1;\n};\n\nexport type SmartCropSettingsV2 = {\n version: SmartCropVersion.v2;\n horizontalBias: SmartCropAxisBias;\n verticalBias: SmartCropAxisBias;\n};\n\nexport enum SmartCropVersion {\n v1 = 'v1',\n v2 = 'v2',\n}\n\n/**\n * Latest version of the smart crop algorithm.\n * Keep in sync with @SmartCropVersion enum.\n */\nexport const LATEST_SMART_CROP_VERSION = SmartCropVersion.v2;\n\nexport enum SmartCropAxisBias {\n start = 'start',\n center = 'center',\n end = 'end',\n}\n"],"names":["ComponentFitEnum","AutoGrowDirection","ImageSourceTypeEnum","ComponentSourceTypeEnum","FrameTypeEnum","BarcodeSourceTypeEnum","TextDirection","FlowDirection","VerticalAlign","BlendMode","FitMode","FitModePosition","UpdateZIndexMethod","FrameAnchorType","AnchorTargetType","AnchorTargetEdgeType","CropType","SmartCropVersion","SmartCropAxisBias"],"mappings":";;AAkOO,IAAK,qCAAAA,sBAAL;AAIHA,oBAAA,QAAA,IAAS;AAKTA,oBAAA,OAAA,IAAQ;AAMRA,oBAAA,gBAAA,IAAiB;AAfT,SAAAA;AAAA,GAAA,oBAAA,CAAA,CAAA;AAuFL,IAAK,sCAAAC,uBAAL;AACHA,qBAAA,KAAA,IAAM;AACNA,qBAAA,QAAA,IAAS;AACTA,qBAAA,MAAA,IAAO;AACPA,qBAAA,OAAA,IAAQ;AAJA,SAAAA;AAAA,GAAA,qBAAA,CAAA,CAAA;AAOL,IAAK,wCAAAC,yBAAL;AACHA,uBAAA,KAAA,IAAM;AACNA,uBAAA,UAAA,IAAW;AACXA,uBAAA,WAAA,IAAY;AACZA,uBAAA,eAAA,IAAgB;AAJR,SAAAA;AAAA,GAAA,uBAAA,CAAA,CAAA;AAOL,IAAK,4CAAAC,6BAAL;AACHA,2BAAA,WAAA,IAAY;AADJ,SAAAA;AAAA,GAAA,2BAAA,CAAA,CAAA;AAIL,IAAK,kCAAAC,mBAAL;AACHA,iBAAA,MAAA,IAAO;AACPA,iBAAA,OAAA,IAAQ;AACRA,iBAAA,OAAA,IAAQ;AACRA,iBAAA,SAAA,IAAU;AACVA,iBAAA,WAAA,IAAY;AACZA,iBAAA,eAAA,IAAgB;AANR,SAAAA;AAAA,GAAA,iBAAA,CAAA,CAAA;AASL,IAAK,0CAAAC,2BAAL;AACHA,yBAAA,UAAA,IAAW;AACXA,yBAAA,MAAA,IAAO;AAFC,SAAAA;AAAA,GAAA,yBAAA,CAA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AA,oBAAA,CAAA,CAAA;AASL,MAAM,4BAA4B;AAElC,IAAK,sCAAAC,uBAAL;AACHA,qBAAA,OAAA,IAAQ;AACRA,qBAAA,QAAA,IAAS;AACTA,qBAAA,KAAA,IAAM;AAHE,SAAAA;AAAA,GAAA,qBAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -30,6 +30,7 @@ export type FrameLayoutType = {
|
|
|
30
30
|
customCroppedAssetCount: number;
|
|
31
31
|
subjectId: PropertyState<Id | null>;
|
|
32
32
|
componentGridSettings: PropertyState<ComponentGridSettings>;
|
|
33
|
+
componentFit: PropertyState<ComponentFitEnum>;
|
|
33
34
|
} | null;
|
|
34
35
|
export type FrameType = {
|
|
35
36
|
id: Id;
|
|
@@ -170,10 +171,6 @@ export type ComponentGridFrame = {
|
|
|
170
171
|
dataSourceVariableId?: Id | null;
|
|
171
172
|
src?: ComponentSource | null;
|
|
172
173
|
variableMappings: GridVariableMapping;
|
|
173
|
-
/**
|
|
174
|
-
* How the component grid fits within the frame.
|
|
175
|
-
*/
|
|
176
|
-
fitMode: ComponentFitEnum;
|
|
177
174
|
};
|
|
178
175
|
export type GridVariableMapping = {
|
|
179
176
|
mappings: Record<string, VariableMapping[] | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrameTypes.es.js","sources":["../../../src/types/FrameTypes.ts"],"sourcesContent":["// FramePropertiesDto\nimport { BarcodeCharacterSet, BarcodeErrorCorrectionLevel, BarcodeType, QuietZone } from './BarcodeTypes';\nimport { ColorUsage } from './ColorStyleTypes';\nimport { HasOverrideState, Id, PropertyState } from './CommonTypes';\nimport { GradientUsage } from './GradientStyleTypes';\nimport { ComponentGridSettings } from '../types/ComponentGridTypes';\nimport {\n CornerRadiusAll,\n CornerRadiusNone,\n CornerRadiusOnly,\n ShapeFrameSource,\n ShapeType,\n ShapeContainerProperties,\n} from './ShapeTypes';\n\nexport type FrameLayoutType = {\n id: Id;\n layoutId: Id;\n horizontal: FrameAnchor;\n vertical: FrameAnchor;\n x: PropertyState<number>;\n y: PropertyState<number>;\n width: PropertyState<number>;\n height: PropertyState<number>;\n rotationDegrees: PropertyState<number>;\n scaleX: PropertyState<number>;\n scaleY: PropertyState<number>;\n isVisible: PropertyState<boolean>;\n fitMode: PropertyState<FitMode>;\n fitModePosition: PropertyState<FitModePosition>;\n smartCropSettings: PropertyState<SmartCropSettings>;\n hasImageCrop: PropertyState<boolean>;\n hasFrameSubjectArea: PropertyState<boolean>;\n minCopyfitting: PropertyState<number>;\n maxCopyfitting: PropertyState<number>;\n enableCopyfitting: PropertyState<boolean>;\n autoGrow: AutoGrowSettings;\n isShowingCustomCroppedAsset: boolean;\n customCroppedAssetCount: number;\n subjectId: PropertyState<Id | null>;\n componentGridSettings: PropertyState<ComponentGridSettings>;\n} | null;\n\n//Frame.image\nexport type FrameType = {\n id: Id;\n name: string;\n type: FrameTypeEnum;\n // `imageUrl` is not generic: should be removed from model\n imageUrl: string;\n blendMode: string;\n opacity: number;\n};\n\nexport type Frame = TextFrame | ImageFrame | ShapeFrame | BarcodeFrame | ComponentFrame | ComponentGridFrame;\n\nexport type ImageFrameVariableSource = {\n type: ImageSourceTypeEnum.variable;\n id: Id;\n};\n\nexport type ImageFrameUrlSource = {\n type: ImageSourceTypeEnum.url;\n url: string;\n};\n\nexport type ImageFrameConnectorSource = {\n type: ImageSourceTypeEnum.connector;\n assetId: Id;\n id: Id;\n};\n\nexport type ImageFrameBrandkitMediaSource = {\n type: ImageSourceTypeEnum.brandKitMedia;\n name: string;\n};\n\nexport type ImageFrameSource =\n | ImageFrameConnectorSource\n | ImageFrameVariableSource\n | ImageFrameUrlSource\n | ImageFrameBrandkitMediaSource;\n\n// used by new getter methods\nexport type ImageFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.image;\n src?: ImageFrameSource;\n blendMode: BlendMode;\n dropShadowSettings?: DropShadowSettings;\n container: {\n source: ShapeFrameSource;\n properties: ShapeContainerProperties;\n };\n};\n\nexport type ShapeFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.shape;\n blendMode: BlendMode;\n shapeProperties: {\n enableFill: boolean;\n fillColor: ColorUsage;\n enableStroke: boolean;\n strokeWeight: number;\n strokeColor: ColorUsage;\n allCornersSame: boolean;\n };\n src: {\n type: ShapeType;\n cornerRadius: CornerRadiusNone | CornerRadiusAll | CornerRadiusOnly;\n sides?: number;\n };\n dropShadowSettings?: DropShadowSettings;\n gradient?: GradientUsage;\n};\n\nexport type TextFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.text;\n textContent: string;\n paddingLeft: number;\n paddingTop: number;\n paddingRight: number;\n paddingBottom: number;\n numberOfColumns: number;\n columnGap: number;\n textDirection: TextDirection;\n flowDirection: FlowDirection;\n verticalAlign: VerticalAlign;\n textStroke: boolean;\n textStrokeWeight: number;\n textStrokeColor: number;\n hasClippingPath: boolean;\n blendMode: BlendMode;\n dropShadowSettings?: DropShadowSettings;\n hasVariable?: boolean;\n};\n\nexport type BarcodeFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.barcode;\n blendMode: BlendMode;\n barcodeProperties: {\n enableBackground: boolean;\n backgroundColor: ColorUsage;\n enableBarColor: boolean;\n barColor: ColorUsage;\n enableText: boolean;\n barHeight: number;\n magnification: number;\n quietZone: QuietZone;\n errorCorrectionLevel?: BarcodeErrorCorrectionLevel;\n characterSet?: BarcodeCharacterSet;\n drawStartStopChars: boolean;\n };\n src?: BarcodeSource;\n barcodeType: BarcodeType;\n dropShadowSettings?: DropShadowSettings;\n};\n\nexport type BarcodeSource = BarcodeVariableSource | BarcodeTextSource;\n\nexport type BarcodeVariableSource = {\n type: BarcodeSourceTypeEnum.variable;\n id: Id;\n};\n\nexport type BarcodeTextSource = {\n type: BarcodeSourceTypeEnum.text;\n text: string;\n};\n\nexport type ComponentFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.component;\n blendMode: BlendMode;\n src: ComponentSource;\n variableMappings: VariableMapping[];\n\n /**\n * How the component fits within the frame.\n */\n fitMode: ComponentFitEnum;\n};\n\nexport type ComponentGridFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.componentGrid;\n blendMode: BlendMode;\n dataSourceVariableId?: Id | null;\n src?: ComponentSource | null;\n variableMappings: GridVariableMapping;\n\n /**\n * How the component grid fits within the frame.\n */\n fitMode: ComponentFitEnum;\n};\n\nexport type GridVariableMapping = {\n mappings: Record<string, VariableMapping[] | null>;\n}\n\nexport type ComponentSource = ConnectorComponentSource;\n\nexport type ConnectorComponentSource = {\n type: ComponentSourceTypeEnum.connector;\n id: Id;\n assetId: Id | null;\n};\n\nexport type VariableMapping = {\n source: Id;\n target: Id;\n sourceField?: string;\n};\n\nexport enum ComponentFitEnum {\n /**\n * The component resizes to fit the frame size.\n */\n resize = 'resize',\n\n /**\n * The component scales to fit the frame size while maintaining its aspect ratio.\n */\n scale = 'scale',\n\n /**\n * The component first scales to fit the frame size while maintaining its aspect ratio,\n * then resizes to fill the remaining space.\n */\n scaleAndResize = 'scaleAndResize',\n}\n\nexport type CropSettings = {\n left: number;\n top: number;\n width: number;\n height: number;\n rotationDegrees: number;\n type: 'default';\n};\n\nexport type NoCropSettings = {\n type: 'noCrop';\n};\n\nexport type AutoGrowSettings = {\n enabled: PropertyState<boolean>;\n minWidth: PropertyState<number>;\n maxWidth: PropertyState<number>;\n minHeight: PropertyState<number>;\n maxHeight: PropertyState<number>;\n directions: PropertyState<Array<AutoGrowDirection>>;\n};\n\nexport interface AutoGrowDeltaUpdate {\n enabled?: {\n value: boolean;\n };\n minWidth?: {\n value: string | null;\n };\n maxWidth?: {\n value: string | null;\n };\n minHeight?: {\n value: string | null;\n };\n maxHeight?: {\n value: string | null;\n };\n directions?: {\n value: Array<AutoGrowDirection>;\n };\n}\n\nexport type DropShadowSettings = {\n enabled: boolean;\n distance: number;\n angleDegrees: number;\n blurRadius: number;\n color: ColorUsage;\n};\n\nexport interface ShadowSettingsDeltaUpdate {\n distance?: {\n value: string;\n };\n angleDegrees?: {\n value: number;\n };\n blurRadius?: {\n value: number;\n };\n enabled?: {\n value: boolean;\n };\n color?: {\n value: ColorUsage;\n };\n}\n\nexport enum AutoGrowDirection {\n top = 'top',\n bottom = 'bottom',\n left = 'left',\n right = 'right',\n}\n\nexport enum ImageSourceTypeEnum {\n url = 'url',\n variable = 'variable',\n connector = 'connector',\n brandKitMedia = 'brandKitMedia',\n}\n\nexport enum ComponentSourceTypeEnum {\n connector = 'connector',\n}\n\nexport enum FrameTypeEnum {\n text = 'text',\n image = 'image',\n shape = 'shape',\n barcode = 'barcode',\n component = 'component',\n componentGrid = 'componentGrid',\n}\n\nexport enum BarcodeSourceTypeEnum {\n variable = 'variable',\n text = 'text',\n}\n\nexport enum TextDirection {\n leftToRight = 'leftToRight',\n rightToLeft = 'rightToLeft',\n weak = 'weak',\n}\n\nexport enum FlowDirection {\n horizontal = 'horizontal',\n vertical = 'vertical',\n onPath = 'onPath',\n}\n\nexport enum VerticalAlign {\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n justify = 'justify',\n}\n\nexport enum BlendMode {\n normal = 'normal',\n screen = 'screen',\n overlay = 'overlay',\n darken = 'darken',\n lighten = 'lighten',\n colorDodge = 'colorDodge',\n colorBurn = 'colorBurn',\n hardLight = 'hardLight',\n softLight = 'softLight',\n difference = 'difference',\n exclusion = 'exclusion',\n multiply = 'multiply',\n hue = 'hue',\n saturation = 'saturation',\n color = 'color',\n luminosity = 'luminosity',\n}\n\nexport enum FitMode {\n fill = 'fill',\n fit = 'fit',\n smartCrop = 'smartCrop',\n manualCrop = 'manualCrop',\n}\n\nexport enum FitModePosition {\n topLeft = 'topLeft',\n topCenter = 'topCenter',\n topRight = 'topRight',\n centerLeft = 'centerLeft',\n center = 'center',\n centerRight = 'centerRight',\n bottomLeft = 'bottomLeft',\n bottomCenter = 'bottomCenter',\n bottomRight = 'bottomRight',\n}\n\nexport enum UpdateZIndexMethod {\n bringToFront = 'bringToFront',\n sendToBack = 'sendToBack',\n bringForward = 'bringForward',\n sendBackward = 'sendBackward',\n}\n\nexport enum FrameAnchorType {\n relative = 'relative',\n start = 'start',\n end = 'end',\n startAndEnd = 'startAndEnd',\n center = 'center',\n}\n\nexport enum AnchorTargetType {\n page = 'page',\n frame = 'frame',\n}\n\nexport enum AnchorTargetEdgeType {\n start = 'start',\n end = 'end',\n center = 'center',\n}\n\nexport class PageAnchorTarget {\n type = AnchorTargetType.page;\n}\n\nexport class FrameAnchorTarget {\n frameId: Id;\n edge: AnchorTargetEdgeType;\n type = AnchorTargetType.frame;\n\n constructor(id: Id, edge: AnchorTargetEdgeType) {\n (this.frameId = id), (this.edge = edge);\n }\n}\n\nexport type AnchorTarget = PageAnchorTarget | FrameAnchorTarget;\n\nexport type RelativeFrameAnchor = {\n start: PropertyState<number>;\n end: PropertyState<number>;\n target: AnchorTarget;\n type: FrameAnchorType.relative;\n} & HasOverrideState;\n\nexport type StartFrameAnchor = {\n offset: PropertyState<number>;\n target: AnchorTarget;\n type: FrameAnchorType.start;\n} & HasOverrideState;\n\nexport type EndFrameAnchor = {\n offset: PropertyState<number>;\n target: AnchorTarget;\n type: FrameAnchorType.end;\n} & HasOverrideState;\n\nexport type StartAndEndFrameAnchor = {\n start: PropertyState<number>;\n startTarget: AnchorTarget;\n end: PropertyState<number>;\n endTarget: AnchorTarget;\n type: FrameAnchorType.startAndEnd;\n} & HasOverrideState;\n\nexport type CenterFrameAnchor = {\n offset: PropertyState<number>;\n target: AnchorTarget;\n type: FrameAnchorType.center;\n} & HasOverrideState;\n\nexport type FrameAnchor =\n | RelativeFrameAnchor\n | StartFrameAnchor\n | EndFrameAnchor\n | StartAndEndFrameAnchor\n | CenterFrameAnchor;\n\nexport type FrameAnchorProperties = {\n horizontal: boolean;\n type: FrameAnchorType;\n target: AnchorTarget;\n endTarget?: AnchorTarget | null;\n};\n\nexport type AnchorConfiguration = {\n allowedTypes: Set<FrameAnchorType>;\n allowedFrameIds: Set<Id>;\n};\n\nexport type FrameConfiguration = {\n horizontal: AnchorConfiguration;\n vertical: AnchorConfiguration;\n};\n\nexport enum CropType {\n frameCrop = 'frameCrop',\n assetCrop = 'assetCrop',\n}\n\n/**\n * Image-specific editing constraints.\n */\nexport type ImageFrameConstraints = {\n cropAllowed: PropertyState<boolean>;\n};\n\n/**\n * Text-specific editing constraints.\n */\nexport type TextFrameConstraints = {\n editingAllowed: PropertyState<boolean>;\n paragraphStyles: PropertyState<IdSetManagedConstraint>;\n characterStyles: PropertyState<IdSetManagedConstraint>;\n colors: PropertyState<IdSetManagedConstraint>;\n fontSizes: PropertyState<FontSizeRangeManagedConstraint>;\n};\n\nexport interface ManagedConstraint {\n allowed: boolean;\n}\n\n/**\n * A managed constraint represented by a set of allowed Id identifiers.\n *\n * Example: used to allow only a specific set of paragraph or character styles.\n * - `allowed`: If true, only the provided `ids` may be used.\n * - `ids`: The set of allowed Id values.\n */\nexport interface IdSetManagedConstraint extends ManagedConstraint {\n allowed: boolean;\n ids: Id[];\n}\n\n/**\n * A managed constraint that restricts allowed font sizes to a continuous range.\n *\n * - `allowed`: If true, restricts allowed font sizes to [min, max] (inclusive).\n * - `min`: The minimum allowed font size (nullable).\n * - `max`: The maximum allowed font size (nullable).\n */\nexport interface FontSizeRangeManagedConstraint extends ManagedConstraint {\n allowed: boolean;\n min: number | null;\n max: number | null;\n}\n\n/**\n * Frame editing constraints with optional frame-type-specific sub-properties.\n */\nexport type FrameConstraints = {\n selectionAllowed: PropertyState<boolean>;\n horizontalMovementAllowed: PropertyState<boolean>;\n verticalMovementAllowed: PropertyState<boolean>;\n rotationAllowed: PropertyState<boolean>;\n resizeAllowed: PropertyState<boolean>;\n proportionLocked: PropertyState<boolean>;\n /** Image-specific constraints. */\n image?: ImageFrameConstraints;\n /** Text-specific constraints. */\n text?: TextFrameConstraints;\n};\n\n/**\n * Image-specific constraints delta update.\n */\nexport interface ImageFrameConstraintsDeltaUpdate {\n cropAllowed?: {\n value: boolean;\n };\n}\n\n/**\n * Text-specific constraints delta update.\n */\nexport interface TextFrameConstraintsDeltaUpdate {\n editingAllowed?: {\n value: boolean;\n };\n paragraphStyles?: {\n value: IdSetManagedConstraint;\n };\n characterStyles?: {\n value: IdSetManagedConstraint;\n };\n colors?: {\n value: IdSetManagedConstraint;\n };\n fontSizes?: {\n value: FontSizeRangeManagedConstraint;\n };\n}\n\n/**\n * Frame constraints delta update with optional frame-type-specific sub-properties.\n */\nexport interface FrameConstraintsDeltaUpdate {\n selectionAllowed?: {\n value: boolean;\n };\n horizontalMovementAllowed?: {\n value: boolean;\n };\n verticalMovementAllowed?: {\n value: boolean;\n };\n rotationAllowed?: {\n value: boolean;\n };\n resizeAllowed?: {\n value: boolean;\n };\n proportionLocked?: {\n value: boolean;\n };\n /** Image-specific constraints update. */\n image?: ImageFrameConstraintsDeltaUpdate;\n /** Text-specific constraints update. */\n text?: TextFrameConstraintsDeltaUpdate;\n}\n\nexport type SmartCropSettings = SmartCropSettingsV1 | SmartCropSettingsV2;\n\nexport type SmartCropSettingsV1 = {\n version: SmartCropVersion.v1;\n};\n\nexport type SmartCropSettingsV2 = {\n version: SmartCropVersion.v2;\n horizontalBias: SmartCropAxisBias;\n verticalBias: SmartCropAxisBias;\n};\n\nexport enum SmartCropVersion {\n v1 = 'v1',\n v2 = 'v2',\n}\n\n/**\n * Latest version of the smart crop algorithm.\n * Keep in sync with @SmartCropVersion enum.\n */\nexport const LATEST_SMART_CROP_VERSION = SmartCropVersion.v2;\n\nexport enum SmartCropAxisBias {\n start = 'start',\n center = 'center',\n end = 'end',\n}\n"],"names":["ComponentFitEnum","AutoGrowDirection","ImageSourceTypeEnum","ComponentSourceTypeEnum","FrameTypeEnum","BarcodeSourceTypeEnum","TextDirection","FlowDirection","VerticalAlign","BlendMode","FitMode","FitModePosition","UpdateZIndexMethod","FrameAnchorType","AnchorTargetType","AnchorTargetEdgeType","CropType","SmartCropVersion","SmartCrop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ePropertiesDto\nimport { BarcodeCharacterSet, BarcodeErrorCorrectionLevel, BarcodeType, QuietZone } from './BarcodeTypes';\nimport { ColorUsage } from './ColorStyleTypes';\nimport { HasOverrideState, Id, PropertyState } from './CommonTypes';\nimport { GradientUsage } from './GradientStyleTypes';\nimport { ComponentGridSettings } from '../types/ComponentGridTypes';\nimport {\n CornerRadiusAll,\n CornerRadiusNone,\n CornerRadiusOnly,\n ShapeFrameSource,\n ShapeType,\n ShapeContainerProperties,\n} from './ShapeTypes';\n\nexport type FrameLayoutType = {\n id: Id;\n layoutId: Id;\n horizontal: FrameAnchor;\n vertical: FrameAnchor;\n x: PropertyState<number>;\n y: PropertyState<number>;\n width: PropertyState<number>;\n height: PropertyState<number>;\n rotationDegrees: PropertyState<number>;\n scaleX: PropertyState<number>;\n scaleY: PropertyState<number>;\n isVisible: PropertyState<boolean>;\n fitMode: PropertyState<FitMode>;\n fitModePosition: PropertyState<FitModePosition>;\n smartCropSettings: PropertyState<SmartCropSettings>;\n hasImageCrop: PropertyState<boolean>;\n hasFrameSubjectArea: PropertyState<boolean>;\n minCopyfitting: PropertyState<number>;\n maxCopyfitting: PropertyState<number>;\n enableCopyfitting: PropertyState<boolean>;\n autoGrow: AutoGrowSettings;\n isShowingCustomCroppedAsset: boolean;\n customCroppedAssetCount: number;\n subjectId: PropertyState<Id | null>;\n componentGridSettings: PropertyState<ComponentGridSettings>;\n componentFit: PropertyState<ComponentFitEnum>;\n} | null;\n\n//Frame.image\nexport type FrameType = {\n id: Id;\n name: string;\n type: FrameTypeEnum;\n // `imageUrl` is not generic: should be removed from model\n imageUrl: string;\n blendMode: string;\n opacity: number;\n};\n\nexport type Frame = TextFrame | ImageFrame | ShapeFrame | BarcodeFrame | ComponentFrame | ComponentGridFrame;\n\nexport type ImageFrameVariableSource = {\n type: ImageSourceTypeEnum.variable;\n id: Id;\n};\n\nexport type ImageFrameUrlSource = {\n type: ImageSourceTypeEnum.url;\n url: string;\n};\n\nexport type ImageFrameConnectorSource = {\n type: ImageSourceTypeEnum.connector;\n assetId: Id;\n id: Id;\n};\n\nexport type ImageFrameBrandkitMediaSource = {\n type: ImageSourceTypeEnum.brandKitMedia;\n name: string;\n};\n\nexport type ImageFrameSource =\n | ImageFrameConnectorSource\n | ImageFrameVariableSource\n | ImageFrameUrlSource\n | ImageFrameBrandkitMediaSource;\n\n// used by new getter methods\nexport type ImageFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.image;\n src?: ImageFrameSource;\n blendMode: BlendMode;\n dropShadowSettings?: DropShadowSettings;\n container: {\n source: ShapeFrameSource;\n properties: ShapeContainerProperties;\n };\n};\n\nexport type ShapeFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.shape;\n blendMode: BlendMode;\n shapeProperties: {\n enableFill: boolean;\n fillColor: ColorUsage;\n enableStroke: boolean;\n strokeWeight: number;\n strokeColor: ColorUsage;\n allCornersSame: boolean;\n };\n src: {\n type: ShapeType;\n cornerRadius: CornerRadiusNone | CornerRadiusAll | CornerRadiusOnly;\n sides?: number;\n };\n dropShadowSettings?: DropShadowSettings;\n gradient?: GradientUsage;\n};\n\nexport type TextFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.text;\n textContent: string;\n paddingLeft: number;\n paddingTop: number;\n paddingRight: number;\n paddingBottom: number;\n numberOfColumns: number;\n columnGap: number;\n textDirection: TextDirection;\n flowDirection: FlowDirection;\n verticalAlign: VerticalAlign;\n textStroke: boolean;\n textStrokeWeight: number;\n textStrokeColor: number;\n hasClippingPath: boolean;\n blendMode: BlendMode;\n dropShadowSettings?: DropShadowSettings;\n hasVariable?: boolean;\n};\n\nexport type BarcodeFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.barcode;\n blendMode: BlendMode;\n barcodeProperties: {\n enableBackground: boolean;\n backgroundColor: ColorUsage;\n enableBarColor: boolean;\n barColor: ColorUsage;\n enableText: boolean;\n barHeight: number;\n magnification: number;\n quietZone: QuietZone;\n errorCorrectionLevel?: BarcodeErrorCorrectionLevel;\n characterSet?: BarcodeCharacterSet;\n drawStartStopChars: boolean;\n };\n src?: BarcodeSource;\n barcodeType: BarcodeType;\n dropShadowSettings?: DropShadowSettings;\n};\n\nexport type BarcodeSource = BarcodeVariableSource | BarcodeTextSource;\n\nexport type BarcodeVariableSource = {\n type: BarcodeSourceTypeEnum.variable;\n id: Id;\n};\n\nexport type BarcodeTextSource = {\n type: BarcodeSourceTypeEnum.text;\n text: string;\n};\n\nexport type ComponentFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.component;\n blendMode: BlendMode;\n src: ComponentSource;\n variableMappings: VariableMapping[];\n\n /**\n * How the component fits within the frame.\n */\n fitMode: ComponentFitEnum;\n};\n\nexport type ComponentGridFrame = {\n id: Id;\n name: string;\n opacity: number;\n type: FrameTypeEnum.componentGrid;\n blendMode: BlendMode;\n dataSourceVariableId?: Id | null;\n src?: ComponentSource | null;\n variableMappings: GridVariableMapping;\n};\n\nexport type GridVariableMapping = {\n mappings: Record<string, VariableMapping[] | null>;\n}\n\nexport type ComponentSource = ConnectorComponentSource;\n\nexport type ConnectorComponentSource = {\n type: ComponentSourceTypeEnum.connector;\n id: Id;\n assetId: Id | null;\n};\n\nexport type VariableMapping = {\n source: Id;\n target: Id;\n sourceField?: string;\n};\n\nexport enum ComponentFitEnum {\n /**\n * The component resizes to fit the frame size.\n */\n resize = 'resize',\n\n /**\n * The component scales to fit the frame size while maintaining its aspect ratio.\n */\n scale = 'scale',\n\n /**\n * The component first scales to fit the frame size while maintaining its aspect ratio,\n * then resizes to fill the remaining space.\n */\n scaleAndResize = 'scaleAndResize',\n}\n\nexport type CropSettings = {\n left: number;\n top: number;\n width: number;\n height: number;\n rotationDegrees: number;\n type: 'default';\n};\n\nexport type NoCropSettings = {\n type: 'noCrop';\n};\n\nexport type AutoGrowSettings = {\n enabled: PropertyState<boolean>;\n minWidth: PropertyState<number>;\n maxWidth: PropertyState<number>;\n minHeight: PropertyState<number>;\n maxHeight: PropertyState<number>;\n directions: PropertyState<Array<AutoGrowDirection>>;\n};\n\nexport interface AutoGrowDeltaUpdate {\n enabled?: {\n value: boolean;\n };\n minWidth?: {\n value: string | null;\n };\n maxWidth?: {\n value: string | null;\n };\n minHeight?: {\n value: string | null;\n };\n maxHeight?: {\n value: string | null;\n };\n directions?: {\n value: Array<AutoGrowDirection>;\n };\n}\n\nexport type DropShadowSettings = {\n enabled: boolean;\n distance: number;\n angleDegrees: number;\n blurRadius: number;\n color: ColorUsage;\n};\n\nexport interface ShadowSettingsDeltaUpdate {\n distance?: {\n value: string;\n };\n angleDegrees?: {\n value: number;\n };\n blurRadius?: {\n value: number;\n };\n enabled?: {\n value: boolean;\n };\n color?: {\n value: ColorUsage;\n };\n}\n\nexport enum AutoGrowDirection {\n top = 'top',\n bottom = 'bottom',\n left = 'left',\n right = 'right',\n}\n\nexport enum ImageSourceTypeEnum {\n url = 'url',\n variable = 'variable',\n connector = 'connector',\n brandKitMedia = 'brandKitMedia',\n}\n\nexport enum ComponentSourceTypeEnum {\n connector = 'connector',\n}\n\nexport enum FrameTypeEnum {\n text = 'text',\n image = 'image',\n shape = 'shape',\n barcode = 'barcode',\n component = 'component',\n componentGrid = 'componentGrid',\n}\n\nexport enum BarcodeSourceTypeEnum {\n variable = 'variable',\n text = 'text',\n}\n\nexport enum TextDirection {\n leftToRight = 'leftToRight',\n rightToLeft = 'rightToLeft',\n weak = 'weak',\n}\n\nexport enum FlowDirection {\n horizontal = 'horizontal',\n vertical = 'vertical',\n onPath = 'onPath',\n}\n\nexport enum VerticalAlign {\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n justify = 'justify',\n}\n\nexport enum BlendMode {\n normal = 'normal',\n screen = 'screen',\n overlay = 'overlay',\n darken = 'darken',\n lighten = 'lighten',\n colorDodge = 'colorDodge',\n colorBurn = 'colorBurn',\n hardLight = 'hardLight',\n softLight = 'softLight',\n difference = 'difference',\n exclusion = 'exclusion',\n multiply = 'multiply',\n hue = 'hue',\n saturation = 'saturation',\n color = 'color',\n luminosity = 'luminosity',\n}\n\nexport enum FitMode {\n fill = 'fill',\n fit = 'fit',\n smartCrop = 'smartCrop',\n manualCrop = 'manualCrop',\n}\n\nexport enum FitModePosition {\n topLeft = 'topLeft',\n topCenter = 'topCenter',\n topRight = 'topRight',\n centerLeft = 'centerLeft',\n center = 'center',\n centerRight = 'centerRight',\n bottomLeft = 'bottomLeft',\n bottomCenter = 'bottomCenter',\n bottomRight = 'bottomRight',\n}\n\nexport enum UpdateZIndexMethod {\n bringToFront = 'bringToFront',\n sendToBack = 'sendToBack',\n bringForward = 'bringForward',\n sendBackward = 'sendBackward',\n}\n\nexport enum FrameAnchorType {\n relative = 'relative',\n start = 'start',\n end = 'end',\n startAndEnd = 'startAndEnd',\n center = 'center',\n}\n\nexport enum AnchorTargetType {\n page = 'page',\n frame = 'frame',\n}\n\nexport enum AnchorTargetEdgeType {\n start = 'start',\n end = 'end',\n center = 'center',\n}\n\nexport class PageAnchorTarget {\n type = AnchorTargetType.page;\n}\n\nexport class FrameAnchorTarget {\n frameId: Id;\n edge: AnchorTargetEdgeType;\n type = AnchorTargetType.frame;\n\n constructor(id: Id, edge: AnchorTargetEdgeType) {\n (this.frameId = id), (this.edge = edge);\n }\n}\n\nexport type AnchorTarget = PageAnchorTarget | FrameAnchorTarget;\n\nexport type RelativeFrameAnchor = {\n start: PropertyState<number>;\n end: PropertyState<number>;\n target: AnchorTarget;\n type: FrameAnchorType.relative;\n} & HasOverrideState;\n\nexport type StartFrameAnchor = {\n offset: PropertyState<number>;\n target: AnchorTarget;\n type: FrameAnchorType.start;\n} & HasOverrideState;\n\nexport type EndFrameAnchor = {\n offset: PropertyState<number>;\n target: AnchorTarget;\n type: FrameAnchorType.end;\n} & HasOverrideState;\n\nexport type StartAndEndFrameAnchor = {\n start: PropertyState<number>;\n startTarget: AnchorTarget;\n end: PropertyState<number>;\n endTarget: AnchorTarget;\n type: FrameAnchorType.startAndEnd;\n} & HasOverrideState;\n\nexport type CenterFrameAnchor = {\n offset: PropertyState<number>;\n target: AnchorTarget;\n type: FrameAnchorType.center;\n} & HasOverrideState;\n\nexport type FrameAnchor =\n | RelativeFrameAnchor\n | StartFrameAnchor\n | EndFrameAnchor\n | StartAndEndFrameAnchor\n | CenterFrameAnchor;\n\nexport type FrameAnchorProperties = {\n horizontal: boolean;\n type: FrameAnchorType;\n target: AnchorTarget;\n endTarget?: AnchorTarget | null;\n};\n\nexport type AnchorConfiguration = {\n allowedTypes: Set<FrameAnchorType>;\n allowedFrameIds: Set<Id>;\n};\n\nexport type FrameConfiguration = {\n horizontal: AnchorConfiguration;\n vertical: AnchorConfiguration;\n};\n\nexport enum CropType {\n frameCrop = 'frameCrop',\n assetCrop = 'assetCrop',\n}\n\n/**\n * Image-specific editing constraints.\n */\nexport type ImageFrameConstraints = {\n cropAllowed: PropertyState<boolean>;\n};\n\n/**\n * Text-specific editing constraints.\n */\nexport type TextFrameConstraints = {\n editingAllowed: PropertyState<boolean>;\n paragraphStyles: PropertyState<IdSetManagedConstraint>;\n characterStyles: PropertyState<IdSetManagedConstraint>;\n colors: PropertyState<IdSetManagedConstraint>;\n fontSizes: PropertyState<FontSizeRangeManagedConstraint>;\n};\n\nexport interface ManagedConstraint {\n allowed: boolean;\n}\n\n/**\n * A managed constraint represented by a set of allowed Id identifiers.\n *\n * Example: used to allow only a specific set of paragraph or character styles.\n * - `allowed`: If true, only the provided `ids` may be used.\n * - `ids`: The set of allowed Id values.\n */\nexport interface IdSetManagedConstraint extends ManagedConstraint {\n allowed: boolean;\n ids: Id[];\n}\n\n/**\n * A managed constraint that restricts allowed font sizes to a continuous range.\n *\n * - `allowed`: If true, restricts allowed font sizes to [min, max] (inclusive).\n * - `min`: The minimum allowed font size (nullable).\n * - `max`: The maximum allowed font size (nullable).\n */\nexport interface FontSizeRangeManagedConstraint extends ManagedConstraint {\n allowed: boolean;\n min: number | null;\n max: number | null;\n}\n\n/**\n * Frame editing constraints with optional frame-type-specific sub-properties.\n */\nexport type FrameConstraints = {\n selectionAllowed: PropertyState<boolean>;\n horizontalMovementAllowed: PropertyState<boolean>;\n verticalMovementAllowed: PropertyState<boolean>;\n rotationAllowed: PropertyState<boolean>;\n resizeAllowed: PropertyState<boolean>;\n proportionLocked: PropertyState<boolean>;\n /** Image-specific constraints. */\n image?: ImageFrameConstraints;\n /** Text-specific constraints. */\n text?: TextFrameConstraints;\n};\n\n/**\n * Image-specific constraints delta update.\n */\nexport interface ImageFrameConstraintsDeltaUpdate {\n cropAllowed?: {\n value: boolean;\n };\n}\n\n/**\n * Text-specific constraints delta update.\n */\nexport interface TextFrameConstraintsDeltaUpdate {\n editingAllowed?: {\n value: boolean;\n };\n paragraphStyles?: {\n value: IdSetManagedConstraint;\n };\n characterStyles?: {\n value: IdSetManagedConstraint;\n };\n colors?: {\n value: IdSetManagedConstraint;\n };\n fontSizes?: {\n value: FontSizeRangeManagedConstraint;\n };\n}\n\n/**\n * Frame constraints delta update with optional frame-type-specific sub-properties.\n */\nexport interface FrameConstraintsDeltaUpdate {\n selectionAllowed?: {\n value: boolean;\n };\n horizontalMovementAllowed?: {\n value: boolean;\n };\n verticalMovementAllowed?: {\n value: boolean;\n };\n rotationAllowed?: {\n value: boolean;\n };\n resizeAllowed?: {\n value: boolean;\n };\n proportionLocked?: {\n value: boolean;\n };\n /** Image-specific constraints update. */\n image?: ImageFrameConstraintsDeltaUpdate;\n /** Text-specific constraints update. */\n text?: TextFrameConstraintsDeltaUpdate;\n}\n\nexport type SmartCropSettings = SmartCropSettingsV1 | SmartCropSettingsV2;\n\nexport type SmartCropSettingsV1 = {\n version: SmartCropVersion.v1;\n};\n\nexport type SmartCropSettingsV2 = {\n version: SmartCropVersion.v2;\n horizontalBias: SmartCropAxisBias;\n verticalBias: SmartCropAxisBias;\n};\n\nexport enum SmartCropVersion {\n v1 = 'v1',\n v2 = 'v2',\n}\n\n/**\n * Latest version of the smart crop algorithm.\n * Keep in sync with @SmartCropVersion enum.\n */\nexport const LATEST_SMART_CROP_VERSION = SmartCropVersion.v2;\n\nexport enum SmartCropAxisBias {\n start = 'start',\n center = 'center',\n end = 'end',\n}\n"],"names":["ComponentFitEnum","AutoGrowDirection","ImageSourceTypeEnum","ComponentSourceTypeEnum","FrameTypeEnum","BarcodeSourceTypeEnum","TextDirection","FlowDirection","VerticalAlign","BlendMode","FitMode","FitModePosition","UpdateZIndexMethod","FrameAnchorType","AnchorTargetType","AnchorTargetEdgeType","CropType","SmartCropVersion","SmartCropAxisBias"],"mappings":"AAkOO,IAAK,qCAAAA,sBAAL;AAIHA,oBAAA,QAAA,IAAS;AAKTA,oBAAA,OAAA,IAAQ;AAMRA,oBAAA,gBAAA,IAAiB;AAfT,SAAAA;AAAA,GAAA,oBAAA,CAAA,CAAA;AAuFL,IAAK,sCAAAC,uBAAL;AACHA,qBAAA,KAAA,IAAM;AACNA,qBAAA,QAAA,IAAS;AACTA,qBAAA,MAAA,IAAO;AACPA,qBAAA,OAAA,IAAQ;AAJA,SAAAA;AAAA,GAAA,qBAAA,CAAA,CAAA;AAOL,IAAK,wCAAAC,yBAAL;AACHA,uBAAA,KAAA,IAAM;AACNA,uBAAA,UAAA,IAAW;AACXA,uBAAA,WAAA,IAAY;AACZA,uBAAA,eAAA,IAAgB;AAJR,SAAAA;AAAA,GAAA,uBAAA,CAAA,CAAA;AAOL,IAAK,4CAAAC,6BAAL;AACHA,2BAAA,WAAA,IAAY;AADJ,SAAAA;AAAA,GAAA,2BAAA,CAAA,CAAA;AAIL,IAAK,kCAAAC,mBAAL;AACHA,iBAAA,MAAA,IAAO;AACPA,iBAAA,OAAA,IAAQ;AACRA,iBAAA,OAAA,IAAQ;AACRA,iBAAA,SAAA,IAAU;AACVA,iBAAA,WAAA,IAAY;AACZA,iBAAA,eAAA,IAAgB;AANR,SAAAA;AAAA,GAAA,iBAAA,CAAA,CAAA;AASL,IAAK,0CAAAC,2BAAL;AACHA,yBAAA,UAAA,IAAW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AA,IAAA,IAAK;AACLA,oBAAA,IAAA,IAAK;AAFG,SAAAA;AAAA,GAAA,oBAAA,CAAA,CAAA;AASL,MAAM,4BAA4B;AAElC,IAAK,sCAAAC,uBAAL;AACHA,qBAAA,OAAA,IAAQ;AACRA,qBAAA,QAAA,IAAS;AACTA,qBAAA,KAAA,IAAM;AAHE,SAAAA;AAAA,GAAA,qBAAA,CAAA,CAAA;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type MethodInvocationBase = {
|
|
2
|
+
path: string;
|
|
3
|
+
controller: string;
|
|
4
|
+
method: string;
|
|
5
|
+
args: unknown[];
|
|
6
|
+
};
|
|
7
|
+
export type MethodInvokeEvent = MethodInvocationBase & {
|
|
8
|
+
phase: 'invoke';
|
|
9
|
+
};
|
|
10
|
+
export type MethodCompleteEvent = MethodInvocationBase & {
|
|
11
|
+
phase: 'complete';
|
|
12
|
+
success: boolean;
|
|
13
|
+
result?: unknown;
|
|
14
|
+
error?: unknown;
|
|
15
|
+
};
|
|
16
|
+
export type MethodInvocationEvent = MethodInvokeEvent | MethodCompleteEvent;
|
|
17
|
+
export type MethodInvocationListener = (event: MethodInvocationEvent) => void;
|
|
18
|
+
export interface Unsubscriber {
|
|
19
|
+
(): void;
|
|
20
|
+
}
|
|
21
|
+
export type MethodListenable<T extends (...args: any[]) => any> = T & {
|
|
22
|
+
addEventListener(listener: MethodInvocationListener): Unsubscriber;
|
|
23
|
+
removeEventListener(listener: MethodInvocationListener): void;
|
|
24
|
+
};
|
|
25
|
+
export type Instrumented<T> = {
|
|
26
|
+
[K in keyof T]: T[K] extends (...args: any[]) => any ? MethodListenable<T[K]> : T[K] extends object ? Instrumented<T[K]> : T[K];
|
|
27
|
+
};
|
|
@@ -5,6 +5,9 @@ class EngineEventTrigger {
|
|
|
5
5
|
constructor(logger) {
|
|
6
6
|
this.logger = logger;
|
|
7
7
|
}
|
|
8
|
+
getLogCategory() {
|
|
9
|
+
return CommonTypes.LogCategory.event;
|
|
10
|
+
}
|
|
8
11
|
createEventHandlerFn(callbackFn, errorBehavior) {
|
|
9
12
|
const wrapper = (...args) => {
|
|
10
13
|
try {
|
|
@@ -22,7 +25,7 @@ class EngineEventTrigger {
|
|
|
22
25
|
handleError(error, errorBehavior, fnName) {
|
|
23
26
|
var _a;
|
|
24
27
|
if (errorBehavior === CommonTypes.CallbackErrorBehavior.log) {
|
|
25
|
-
(_a = this.logger) == null ? void 0 : _a.call(this, CommonTypes.LogLevel.error,
|
|
28
|
+
(_a = this.logger) == null ? void 0 : _a.call(this, CommonTypes.LogLevel.error, this.getLogCategory(), `Error in callback ${fnName}: ${error}`);
|
|
26
29
|
} else {
|
|
27
30
|
throw error;
|
|
28
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineEventTrigger.cjs.js","sources":["../../../src/utils/EngineEventTrigger.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { CallbackErrorBehavior, LogCategory, LoggerFunction, LogLevel } from '../types/CommonTypes';\nexport abstract class EngineEventTrigger<T extends (...args: any[]) => any> {\n constructor(protected logger?: LoggerFunction) {}\n\n abstract trigger(...args: Parameters<T>): ReturnType<T>;\n\n protected createEventHandlerFn(callbackFn: T, errorBehavior: CallbackErrorBehavior): T {\n const wrapper: any = (...args: Parameters<T>) => {\n try {\n const result = callbackFn(...args);\n // If the callback returns a promise, we need to await it\n if (result instanceof Promise) {\n return result.catch((error) => this.handleError(error, errorBehavior, callbackFn.name));\n }\n return result;\n } catch (error) {\n this.handleError(error, errorBehavior, callbackFn.name);\n }\n };\n return wrapper;\n }\n\n private handleError(error: unknown, errorBehavior: CallbackErrorBehavior, fnName: string) {\n if (errorBehavior === CallbackErrorBehavior.log) {\n this.logger?.(LogLevel.error,
|
|
1
|
+
{"version":3,"file":"EngineEventTrigger.cjs.js","sources":["../../../src/utils/EngineEventTrigger.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { CallbackErrorBehavior, LogCategory, LoggerFunction, LogLevel } from '../types/CommonTypes';\nexport abstract class EngineEventTrigger<T extends (...args: any[]) => any> {\n constructor(protected logger?: LoggerFunction) {}\n\n abstract trigger(...args: Parameters<T>): ReturnType<T>;\n\n protected getLogCategory(): LogCategory {\n return LogCategory.event;\n }\n\n protected createEventHandlerFn(callbackFn: T, errorBehavior: CallbackErrorBehavior): T {\n const wrapper: any = (...args: Parameters<T>) => {\n try {\n const result = callbackFn(...args);\n // If the callback returns a promise, we need to await it\n if (result instanceof Promise) {\n return result.catch((error) => this.handleError(error, errorBehavior, callbackFn.name));\n }\n return result;\n } catch (error) {\n this.handleError(error, errorBehavior, callbackFn.name);\n }\n };\n return wrapper;\n }\n\n private handleError(error: unknown, errorBehavior: CallbackErrorBehavior, fnName: string) {\n if (errorBehavior === CallbackErrorBehavior.log) {\n this.logger?.(LogLevel.error, this.getLogCategory(), `Error in callback ${fnName}: ${error}`);\n } else {\n throw error;\n }\n }\n}\n"],"names":["LogCategory","CallbackErrorBehavior","LogLevel"],"mappings":";;;AAEO,MAAe,mBAAsD;AAAA,EACxE,YAAsB,QAAyB;AAAzB,SAAA,SAAA;AAAA,EAA0B;AAAA,EAItC,iBAA8B;AACpC,WAAOA,YAAAA,YAAY;AAAA,EACvB;AAAA,EAEU,qBAAqB,YAAe,eAAyC;AACnF,UAAM,UAAe,IAAI,SAAwB;AAC7C,UAAI;AACA,cAAM,SAAS,WAAW,GAAG,IAAI;AAEjC,YAAI,kBAAkB,SAAS;AAC3B,iBAAO,OAAO,MAAM,CAAC,UAAU,KAAK,YAAY,OAAO,eAAe,WAAW,IAAI,CAAC;AAAA,QAC1F;AACA,eAAO;AAAA,MACX,SAAS,OAAO;AACZ,aAAK,YAAY,OAAO,eAAe,WAAW,IAAI;AAAA,MAC1D;AAAA,IACJ;AACA,WAAO;AAAA,EACX;AAAA,EAEQ,YAAY,OAAgB,eAAsC,QAAgB;;AACtF,QAAI,kBAAkBC,YAAAA,sBAAsB,KAAK;AAC7C,iBAAK,WAAL,8BAAcC,qBAAS,OAAO,KAAK,kBAAkB,qBAAqB,MAAM,KAAK,KAAK;AAAA,IAC9F,OAAO;AACH,YAAM;AAAA,IACV;AAAA,EACJ;AACJ;;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { CallbackErrorBehavior, LoggerFunction } from '../types/CommonTypes';
|
|
1
|
+
import { CallbackErrorBehavior, LogCategory, LoggerFunction } from '../types/CommonTypes';
|
|
2
2
|
export declare abstract class EngineEventTrigger<T extends (...args: any[]) => any> {
|
|
3
3
|
protected logger?: LoggerFunction | undefined;
|
|
4
4
|
constructor(logger?: LoggerFunction | undefined);
|
|
5
5
|
abstract trigger(...args: Parameters<T>): ReturnType<T>;
|
|
6
|
+
protected getLogCategory(): LogCategory;
|
|
6
7
|
protected createEventHandlerFn(callbackFn: T, errorBehavior: CallbackErrorBehavior): T;
|
|
7
8
|
private handleError;
|
|
8
9
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { CallbackErrorBehavior, LogLevel
|
|
1
|
+
import { LogCategory, CallbackErrorBehavior, LogLevel } from "../types/CommonTypes.es.js";
|
|
2
2
|
class EngineEventTrigger {
|
|
3
3
|
constructor(logger) {
|
|
4
4
|
this.logger = logger;
|
|
5
5
|
}
|
|
6
|
+
getLogCategory() {
|
|
7
|
+
return LogCategory.event;
|
|
8
|
+
}
|
|
6
9
|
createEventHandlerFn(callbackFn, errorBehavior) {
|
|
7
10
|
const wrapper = (...args) => {
|
|
8
11
|
try {
|
|
@@ -20,7 +23,7 @@ class EngineEventTrigger {
|
|
|
20
23
|
handleError(error, errorBehavior, fnName) {
|
|
21
24
|
var _a;
|
|
22
25
|
if (errorBehavior === CallbackErrorBehavior.log) {
|
|
23
|
-
(_a = this.logger) == null ? void 0 : _a.call(this, LogLevel.error,
|
|
26
|
+
(_a = this.logger) == null ? void 0 : _a.call(this, LogLevel.error, this.getLogCategory(), `Error in callback ${fnName}: ${error}`);
|
|
24
27
|
} else {
|
|
25
28
|
throw error;
|
|
26
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineEventTrigger.es.js","sources":["../../../src/utils/EngineEventTrigger.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { CallbackErrorBehavior, LogCategory, LoggerFunction, LogLevel } from '../types/CommonTypes';\nexport abstract class EngineEventTrigger<T extends (...args: any[]) => any> {\n constructor(protected logger?: LoggerFunction) {}\n\n abstract trigger(...args: Parameters<T>): ReturnType<T>;\n\n protected createEventHandlerFn(callbackFn: T, errorBehavior: CallbackErrorBehavior): T {\n const wrapper: any = (...args: Parameters<T>) => {\n try {\n const result = callbackFn(...args);\n // If the callback returns a promise, we need to await it\n if (result instanceof Promise) {\n return result.catch((error) => this.handleError(error, errorBehavior, callbackFn.name));\n }\n return result;\n } catch (error) {\n this.handleError(error, errorBehavior, callbackFn.name);\n }\n };\n return wrapper;\n }\n\n private handleError(error: unknown, errorBehavior: CallbackErrorBehavior, fnName: string) {\n if (errorBehavior === CallbackErrorBehavior.log) {\n this.logger?.(LogLevel.error,
|
|
1
|
+
{"version":3,"file":"EngineEventTrigger.es.js","sources":["../../../src/utils/EngineEventTrigger.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { CallbackErrorBehavior, LogCategory, LoggerFunction, LogLevel } from '../types/CommonTypes';\nexport abstract class EngineEventTrigger<T extends (...args: any[]) => any> {\n constructor(protected logger?: LoggerFunction) {}\n\n abstract trigger(...args: Parameters<T>): ReturnType<T>;\n\n protected getLogCategory(): LogCategory {\n return LogCategory.event;\n }\n\n protected createEventHandlerFn(callbackFn: T, errorBehavior: CallbackErrorBehavior): T {\n const wrapper: any = (...args: Parameters<T>) => {\n try {\n const result = callbackFn(...args);\n // If the callback returns a promise, we need to await it\n if (result instanceof Promise) {\n return result.catch((error) => this.handleError(error, errorBehavior, callbackFn.name));\n }\n return result;\n } catch (error) {\n this.handleError(error, errorBehavior, callbackFn.name);\n }\n };\n return wrapper;\n }\n\n private handleError(error: unknown, errorBehavior: CallbackErrorBehavior, fnName: string) {\n if (errorBehavior === CallbackErrorBehavior.log) {\n this.logger?.(LogLevel.error, this.getLogCategory(), `Error in callback ${fnName}: ${error}`);\n } else {\n throw error;\n }\n }\n}\n"],"names":[],"mappings":";AAEO,MAAe,mBAAsD;AAAA,EACxE,YAAsB,QAAyB;AAAzB,SAAA,SAAA;AAAA,EAA0B;AAAA,EAItC,iBAA8B;AACpC,WAAO,YAAY;AAAA,EACvB;AAAA,EAEU,qBAAqB,YAAe,eAAyC;AACnF,UAAM,UAAe,IAAI,SAAwB;AAC7C,UAAI;AACA,cAAM,SAAS,WAAW,GAAG,IAAI;AAEjC,YAAI,kBAAkB,SAAS;AAC3B,iBAAO,OAAO,MAAM,CAAC,UAAU,KAAK,YAAY,OAAO,eAAe,WAAW,IAAI,CAAC;AAAA,QAC1F;AACA,eAAO;AAAA,MACX,SAAS,OAAO;AACZ,aAAK,YAAY,OAAO,eAAe,WAAW,IAAI;AAAA,MAC1D;AAAA,IACJ;AACA,WAAO;AAAA,EACX;AAAA,EAEQ,YAAY,OAAgB,eAAsC,QAAgB;;AACtF,QAAI,kBAAkB,sBAAsB,KAAK;AAC7C,iBAAK,WAAL,8BAAc,SAAS,OAAO,KAAK,kBAAkB,qBAAqB,MAAM,KAAK,KAAK;AAAA,IAC9F,OAAO;AACH,YAAM;AAAA,IACV;AAAA,EACJ;AACJ;"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const CommonTypes = require("../types/CommonTypes.cjs.js");
|
|
4
|
+
const NOOP_UNSUBSCRIBER = () => void 0;
|
|
5
|
+
class MethodListenerRegistry {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.listeners = /* @__PURE__ */ new Map();
|
|
8
|
+
}
|
|
9
|
+
add(path, listener) {
|
|
10
|
+
if (typeof listener !== "function") {
|
|
11
|
+
return NOOP_UNSUBSCRIBER;
|
|
12
|
+
}
|
|
13
|
+
const subscriptions = this.listeners.get(path) ?? /* @__PURE__ */ new Set();
|
|
14
|
+
subscriptions.add(listener);
|
|
15
|
+
this.listeners.set(path, subscriptions);
|
|
16
|
+
return () => {
|
|
17
|
+
this.remove(path, listener);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
remove(path, listener) {
|
|
21
|
+
const subscriptions = this.listeners.get(path);
|
|
22
|
+
if (!subscriptions) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
subscriptions.delete(listener);
|
|
26
|
+
if (subscriptions.size === 0) {
|
|
27
|
+
this.listeners.delete(path);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
getListeners(path) {
|
|
31
|
+
return [...this.listeners.get(path) ?? []];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const isThenable = (value) => {
|
|
35
|
+
if (!value || typeof value !== "object") {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
return typeof value.then === "function";
|
|
39
|
+
};
|
|
40
|
+
const isInstrumentableObject = (value) => {
|
|
41
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
return true;
|
|
45
|
+
};
|
|
46
|
+
const reportListenerError = (path, error, logger) => {
|
|
47
|
+
logger == null ? void 0 : logger(CommonTypes.LogLevel.error, CommonTypes.LogCategory.sdk, `Error in method listener for ${path}: ${String(error)}`);
|
|
48
|
+
};
|
|
49
|
+
const notifyListeners = (path, event, listenerRegistry, sdkEvents, logger) => {
|
|
50
|
+
for (const callback of listenerRegistry.getListeners(path)) {
|
|
51
|
+
try {
|
|
52
|
+
callback(event);
|
|
53
|
+
} catch (error) {
|
|
54
|
+
reportListenerError(path, error, logger);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
if (event.phase === "invoke") {
|
|
59
|
+
sdkEvents.onMethodInvoked.trigger(event);
|
|
60
|
+
} else {
|
|
61
|
+
sdkEvents.onMethodCompleted.trigger(event);
|
|
62
|
+
}
|
|
63
|
+
} catch (error) {
|
|
64
|
+
reportListenerError(path, error, logger);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
function wrapWithInvocationObserver(target, basePath, listenerRegistry, sdkEvents, logger) {
|
|
68
|
+
const methodWrappers = /* @__PURE__ */ new Map();
|
|
69
|
+
const nestedControllers = /* @__PURE__ */ new Map();
|
|
70
|
+
return new Proxy(target, {
|
|
71
|
+
get(targetController, propKey, receiver) {
|
|
72
|
+
const value = Reflect.get(targetController, propKey, receiver);
|
|
73
|
+
if (typeof propKey === "symbol") {
|
|
74
|
+
return value;
|
|
75
|
+
}
|
|
76
|
+
if (typeof value === "function") {
|
|
77
|
+
if (methodWrappers.has(propKey)) {
|
|
78
|
+
return methodWrappers.get(propKey);
|
|
79
|
+
}
|
|
80
|
+
const methodPath = `${basePath}.${String(propKey)}`;
|
|
81
|
+
const controllerName = basePath.split(".")[0] || basePath;
|
|
82
|
+
const methodName = String(propKey);
|
|
83
|
+
const wrappedMethod = ((...args) => {
|
|
84
|
+
const invokeEvent = {
|
|
85
|
+
phase: "invoke",
|
|
86
|
+
path: methodPath,
|
|
87
|
+
controller: controllerName,
|
|
88
|
+
method: methodName,
|
|
89
|
+
args: [...args]
|
|
90
|
+
};
|
|
91
|
+
notifyListeners(methodPath, invokeEvent, listenerRegistry, sdkEvents, logger);
|
|
92
|
+
try {
|
|
93
|
+
const result = value.apply(targetController, args);
|
|
94
|
+
if (isThenable(result)) {
|
|
95
|
+
return result.then((resolvedValue) => {
|
|
96
|
+
const completeEvent2 = {
|
|
97
|
+
phase: "complete",
|
|
98
|
+
path: methodPath,
|
|
99
|
+
controller: controllerName,
|
|
100
|
+
method: methodName,
|
|
101
|
+
args: [...args],
|
|
102
|
+
success: true,
|
|
103
|
+
result: resolvedValue
|
|
104
|
+
};
|
|
105
|
+
notifyListeners(methodPath, completeEvent2, listenerRegistry, sdkEvents, logger);
|
|
106
|
+
return resolvedValue;
|
|
107
|
+
}).catch((error) => {
|
|
108
|
+
const completeEvent2 = {
|
|
109
|
+
phase: "complete",
|
|
110
|
+
path: methodPath,
|
|
111
|
+
controller: controllerName,
|
|
112
|
+
method: methodName,
|
|
113
|
+
args: [...args],
|
|
114
|
+
success: false,
|
|
115
|
+
error
|
|
116
|
+
};
|
|
117
|
+
notifyListeners(methodPath, completeEvent2, listenerRegistry, sdkEvents, logger);
|
|
118
|
+
throw error;
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
const completeEvent = {
|
|
122
|
+
phase: "complete",
|
|
123
|
+
path: methodPath,
|
|
124
|
+
controller: controllerName,
|
|
125
|
+
method: methodName,
|
|
126
|
+
args: [...args],
|
|
127
|
+
success: true,
|
|
128
|
+
result
|
|
129
|
+
};
|
|
130
|
+
notifyListeners(methodPath, completeEvent, listenerRegistry, sdkEvents, logger);
|
|
131
|
+
return result;
|
|
132
|
+
} catch (error) {
|
|
133
|
+
const completeEvent = {
|
|
134
|
+
phase: "complete",
|
|
135
|
+
path: methodPath,
|
|
136
|
+
controller: controllerName,
|
|
137
|
+
method: methodName,
|
|
138
|
+
args: [...args],
|
|
139
|
+
success: false,
|
|
140
|
+
error
|
|
141
|
+
};
|
|
142
|
+
notifyListeners(methodPath, completeEvent, listenerRegistry, sdkEvents, logger);
|
|
143
|
+
throw error;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
wrappedMethod.addEventListener = (listener) => {
|
|
147
|
+
return listenerRegistry.add(methodPath, listener);
|
|
148
|
+
};
|
|
149
|
+
wrappedMethod.removeEventListener = (listener) => {
|
|
150
|
+
listenerRegistry.remove(methodPath, listener);
|
|
151
|
+
};
|
|
152
|
+
methodWrappers.set(propKey, wrappedMethod);
|
|
153
|
+
return wrappedMethod;
|
|
154
|
+
}
|
|
155
|
+
if (isInstrumentableObject(value)) {
|
|
156
|
+
if (nestedControllers.has(propKey)) {
|
|
157
|
+
return nestedControllers.get(propKey);
|
|
158
|
+
}
|
|
159
|
+
const nestedPath = `${basePath}.${String(propKey)}`;
|
|
160
|
+
const wrappedNestedController = wrapWithInvocationObserver(
|
|
161
|
+
value,
|
|
162
|
+
nestedPath,
|
|
163
|
+
listenerRegistry,
|
|
164
|
+
sdkEvents,
|
|
165
|
+
logger
|
|
166
|
+
);
|
|
167
|
+
nestedControllers.set(propKey, wrappedNestedController);
|
|
168
|
+
return wrappedNestedController;
|
|
169
|
+
}
|
|
170
|
+
return value;
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
exports.MethodListenerRegistry = MethodListenerRegistry;
|
|
175
|
+
exports.wrapWithInvocationObserver = wrapWithInvocationObserver;
|
|
176
|
+
//# sourceMappingURL=MethodInstrumentation.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MethodInstrumentation.cjs.js","sources":["../../../src/utils/MethodInstrumentation.ts"],"sourcesContent":["import { LogCategory, LoggerFunction, LogLevel } from '../types/CommonTypes';\nimport {\n Instrumented,\n MethodCompleteEvent,\n MethodInvocationEvent,\n MethodInvocationListener,\n MethodInvokeEvent,\n MethodListenable,\n Unsubscriber,\n} from '../types/MethodInvocationTypes';\nimport { SdkEvents } from './SdkEvents';\n\nconst NOOP_UNSUBSCRIBER: Unsubscriber = () => undefined;\n\nexport class MethodListenerRegistry {\n private listeners = new Map<string, Set<MethodInvocationListener>>();\n\n add(path: string, listener: MethodInvocationListener): Unsubscriber {\n if (typeof listener !== 'function') {\n return NOOP_UNSUBSCRIBER;\n }\n\n const subscriptions = this.listeners.get(path) ?? new Set<MethodInvocationListener>();\n subscriptions.add(listener);\n this.listeners.set(path, subscriptions);\n\n return () => {\n this.remove(path, listener);\n };\n }\n\n remove(path: string, listener: MethodInvocationListener): void {\n const subscriptions = this.listeners.get(path);\n if (!subscriptions) {\n return;\n }\n\n subscriptions.delete(listener);\n\n if (subscriptions.size === 0) {\n this.listeners.delete(path);\n }\n }\n\n getListeners(path: string): MethodInvocationListener[] {\n return [...(this.listeners.get(path) ?? [])];\n }\n}\n\nconst isThenable = (value: unknown): value is Promise<unknown> => {\n if (!value || typeof value !== 'object') {\n return false;\n }\n\n return typeof (value as Promise<unknown>).then === 'function';\n};\n\nconst isInstrumentableObject = (value: unknown): value is Record<string, unknown> => {\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n return false;\n }\n\n return true;\n};\n\nconst reportListenerError = (path: string, error: unknown, logger?: LoggerFunction) => {\n logger?.(LogLevel.error, LogCategory.sdk, `Error in method listener for ${path}: ${String(error)}`);\n};\n\nconst notifyListeners = (\n path: string,\n event: MethodInvocationEvent,\n listenerRegistry: MethodListenerRegistry,\n sdkEvents: SdkEvents,\n logger?: LoggerFunction,\n) => {\n for (const callback of listenerRegistry.getListeners(path)) {\n try {\n callback(event);\n } catch (error) {\n reportListenerError(path, error, logger);\n }\n }\n\n try {\n if (event.phase === 'invoke') {\n sdkEvents.onMethodInvoked.trigger(event);\n } else {\n sdkEvents.onMethodCompleted.trigger(event);\n }\n } catch (error) {\n reportListenerError(path, error, logger);\n }\n};\n\nexport function wrapWithInvocationObserver<T extends object>(\n target: T,\n basePath: string,\n listenerRegistry: MethodListenerRegistry,\n sdkEvents: SdkEvents,\n logger?: LoggerFunction,\n): Instrumented<T> {\n const methodWrappers = new Map<PropertyKey, unknown>();\n const nestedControllers = new Map<PropertyKey, unknown>();\n\n return new Proxy(target, {\n get(targetController, propKey, receiver) {\n const value = Reflect.get(targetController, propKey, receiver);\n if (typeof propKey === 'symbol') {\n return value;\n }\n\n if (typeof value === 'function') {\n if (methodWrappers.has(propKey)) {\n return methodWrappers.get(propKey);\n }\n\n const methodPath = `${basePath}.${String(propKey)}`;\n const controllerName = basePath.split('.')[0] || basePath;\n const methodName = String(propKey);\n\n const wrappedMethod = ((...args: unknown[]) => {\n const invokeEvent: MethodInvokeEvent = {\n phase: 'invoke',\n path: methodPath,\n controller: controllerName,\n method: methodName,\n args: [...args],\n };\n notifyListeners(methodPath, invokeEvent, listenerRegistry, sdkEvents, logger);\n\n try {\n const result = value.apply(targetController, args);\n\n if (isThenable(result)) {\n return result\n .then((resolvedValue) => {\n const completeEvent: MethodCompleteEvent = {\n phase: 'complete',\n path: methodPath,\n controller: controllerName,\n method: methodName,\n args: [...args],\n success: true,\n result: resolvedValue,\n };\n notifyListeners(methodPath, completeEvent, listenerRegistry, sdkEvents, logger);\n return resolvedValue;\n })\n .catch((error) => {\n const completeEvent: MethodCompleteEvent = {\n phase: 'complete',\n path: methodPath,\n controller: controllerName,\n method: methodName,\n args: [...args],\n success: false,\n error,\n };\n notifyListeners(methodPath, completeEvent, listenerRegistry, sdkEvents, logger);\n throw error;\n });\n }\n\n const completeEvent: MethodCompleteEvent = {\n phase: 'complete',\n path: methodPath,\n controller: controllerName,\n method: methodName,\n args: [...args],\n success: true,\n result,\n };\n notifyListeners(methodPath, completeEvent, listenerRegistry, sdkEvents, logger);\n\n return result;\n } catch (error) {\n const completeEvent: MethodCompleteEvent = {\n phase: 'complete',\n path: methodPath,\n controller: controllerName,\n method: methodName,\n args: [...args],\n success: false,\n error,\n };\n notifyListeners(methodPath, completeEvent, listenerRegistry, sdkEvents, logger);\n throw error;\n }\n }) as MethodListenable<(...args: unknown[]) => unknown>;\n\n wrappedMethod.addEventListener = (listener: MethodInvocationListener) => {\n return listenerRegistry.add(methodPath, listener);\n };\n wrappedMethod.removeEventListener = (listener: MethodInvocationListener) => {\n listenerRegistry.remove(methodPath, listener);\n };\n\n methodWrappers.set(propKey, wrappedMethod);\n return wrappedMethod;\n }\n\n if (isInstrumentableObject(value)) {\n if (nestedControllers.has(propKey)) {\n return nestedControllers.get(propKey);\n }\n\n const nestedPath = `${basePath}.${String(propKey)}`;\n const wrappedNestedController = wrapWithInvocationObserver(\n value,\n nestedPath,\n listenerRegistry,\n sdkEvents,\n logger,\n );\n nestedControllers.set(propKey, wrappedNestedController);\n\n return wrappedNestedController;\n }\n\n return value;\n },\n }) as Instrumented<T>;\n}\n"],"names":["LogLevel","LogCategory","completeEvent"],"mappings":";;;AAYA,MAAM,oBAAkC,MAAM;AAEvC,MAAM,uBAAuB;AAAA,EAA7B,cAAA;AACH,SAAQ,gCAAgB,IAAA;AAAA,EAA2C;AAAA,EAEnE,IAAI,MAAc,UAAkD;AAChE,QAAI,OAAO,aAAa,YAAY;AAChC,aAAO;AAAA,IACX;AAEA,UAAM,gBAAgB,KAAK,UAAU,IAAI,IAAI,yBAAS,IAAA;AACtD,kBAAc,IAAI,QAAQ;AAC1B,SAAK,UAAU,IAAI,MAAM,aAAa;AAEtC,WAAO,MAAM;AACT,WAAK,OAAO,MAAM,QAAQ;AAAA,IAC9B;AAAA,EACJ;AAAA,EAEA,OAAO,MAAc,UAA0C;AAC3D,UAAM,gBAAgB,KAAK,UAAU,IAAI,IAAI;AAC7C,QAAI,CAAC,eAAe;AAChB;AAAA,IACJ;AAEA,kBAAc,OAAO,QAAQ;AAE7B,QAAI,cAAc,SAAS,GAAG;AAC1B,WAAK,UAAU,OAAO,IAAI;AAAA,IAC9B;AAAA,EACJ;AAAA,EAEA,aAAa,MAA0C;AACnD,WAAO,CAAC,GAAI,KAAK,UAAU,IAAI,IAAI,KAAK,EAAG;AAAA,EAC/C;AACJ;AAEA,MAAM,aAAa,CAAC,UAA8C;AAC9D,MAAI,CAAC,SAAS,OAAO,UAAU,UAAU;AACrC,WAAO;AAAA,EACX;AAEA,SAAO,OAAQ,MAA2B,SAAS;AACvD;AAEA,MAAM,yBAAyB,CAAC,UAAqD;AACjF,MAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAAG;AAC7D,WAAO;AAAA,EACX;AAEA,SAAO;AACX;AAEA,MAAM,sBAAsB,CAAC,MAAc,OAAgB,WAA4B;AACnF,mCAASA,YAAAA,SAAS,OAAOC,YAAAA,YAAY,KAAK,gCAAgC,IAA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I,YAAY,QAAQ;AAAA,QACpD;AACA,sBAAc,sBAAsB,CAAC,aAAuC;AACxE,2BAAiB,OAAO,YAAY,QAAQ;AAAA,QAChD;AAEA,uBAAe,IAAI,SAAS,aAAa;AACzC,eAAO;AAAA,MACX;AAEA,UAAI,uBAAuB,KAAK,GAAG;AAC/B,YAAI,kBAAkB,IAAI,OAAO,GAAG;AAChC,iBAAO,kBAAkB,IAAI,OAAO;AAAA,QACxC;AAEA,cAAM,aAAa,GAAG,QAAQ,IAAI,OAAO,OAAO,CAAC;AACjD,cAAM,0BAA0B;AAAA,UAC5B;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAEJ,0BAAkB,IAAI,SAAS,uBAAuB;AAEtD,eAAO;AAAA,MACX;AAEA,aAAO;AAAA,IACX;AAAA,EAAA,CACH;AACL;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LoggerFunction } from '../types/CommonTypes';
|
|
2
|
+
import { Instrumented, MethodInvocationListener, Unsubscriber } from '../types/MethodInvocationTypes';
|
|
3
|
+
import { SdkEvents } from './SdkEvents';
|
|
4
|
+
export declare class MethodListenerRegistry {
|
|
5
|
+
private listeners;
|
|
6
|
+
add(path: string, listener: MethodInvocationListener): Unsubscriber;
|
|
7
|
+
remove(path: string, listener: MethodInvocationListener): void;
|
|
8
|
+
getListeners(path: string): MethodInvocationListener[];
|
|
9
|
+
}
|
|
10
|
+
export declare function wrapWithInvocationObserver<T extends object>(target: T, basePath: string, listenerRegistry: MethodListenerRegistry, sdkEvents: SdkEvents, logger?: LoggerFunction): Instrumented<T>;
|