@rocketium/auto-adapt 2.0.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -577,6 +577,29 @@ declare const resolveObjectsForSize: (objects: Record<string, CanvasElementWithO
577
577
  * For each layer, the adapted result is stored as overrides[newSizeId].
578
578
  */
579
579
  declare const applyAdaptedAsOverrides: (originalObjects: Record<string, CanvasElementWithOverrides<CanvasElementJSON>>, adaptedObjects: Record<string, CanvasElementJSON>, newSizeId: string) => Record<string, CanvasElementWithOverrides<CanvasElementJSON>>;
580
+ /**
581
+ * Merge only layout/positioning properties from a reference object onto a base object.
582
+ *
583
+ * Used in the vector similarity flow: the base object comes from base-layout-adapt
584
+ * of the INPUT capsule (preserving all styling, branding, content), while the
585
+ * reference provides the spatial arrangement from the OUTPUT capsule.
586
+ *
587
+ * Properties transferred per type:
588
+ * - All: left, top, width, height, angle, visible
589
+ * - Text: + fontSize, autoFitSizes, padding, wordSpacing
590
+ * - Image/Video: + imageScale, imageLeft, imageTop
591
+ * - SVG: + imageScale, imageLeft, imageTop, scaleX, scaleY
592
+ * - Path: left, top, scaleX, scaleY, angle, visible (no width/height)
593
+ * - Group: left, top, width, height, angle, visible (children handled separately)
594
+ * - CreativeBox/Audio: no merge (pass-through)
595
+ */
596
+ declare const mergeLayoutFromReference: (base: CanvasElementJSON, layoutReference: CanvasElementJSON) => CanvasElementJSON;
597
+ /**
598
+ * Batch version: merges layout from reference objects onto base objects.
599
+ * For each layer, if a matching reference exists, layout properties are taken from it;
600
+ * otherwise the base-adapted object is kept as-is.
601
+ */
602
+ declare const mergeLayoutFromReferenceObjects: (baseObjects: Record<string, CanvasElementJSON>, referenceObjects: Record<string, CanvasElementJSON>) => Record<string, CanvasElementJSON>;
580
603
  /**
581
604
  * Builds a new ServerCapsule with an added size. Handles canvasData.variant.sizes,
582
605
  * savedCustomDimensions, newAddedSizes, and creativesOrder.
@@ -691,6 +714,7 @@ declare const isSVGContainerJSON: (object: CanvasElementJSON) => object is SvgJS
691
714
  declare const isRoundedRectJSON: (object: CanvasElementJSON) => object is RoundedRectJSON;
692
715
  declare const isGroupJSON: (object: CanvasElementJSON | undefined) => object is GroupContainerJSON;
693
716
  declare const isCreativeBoxJSON: (object: CanvasElementJSON) => boolean;
717
+ declare const isVideoJSON: (object: CanvasElementJSON) => object is VideoContainerJSON;
694
718
  declare const isAudioJSON: (object: CanvasElementJSON) => boolean;
695
719
 
696
- export { type AnimationReference, AnimationSpecialCase, type AnimationTrack, type AudioContainerJSON, type AutoFitSizes, type BaseElementJSON, type Border, type BorderPosition, CANVAS_EDITOR_ELEMENT, type CANVAS_EDITOR_ELEMENT_TYPE, type CanvasElementJSON, type CanvasElementWithOverrides, type ColorMap, type CreativeBoxJSON, CreativeElementCategory, type DatabaseSize, type DatabaseVariant, type FillOptions, type FontMetaData, type FontStyle, type GridOption, type GroupContainerJSON, type GroupPath, type ImageContainerJSON, type LayerRules, type ORIGIN_X, type ORIGIN_Y, type ObjectFit, type ObjectPosition, type OpacityKeyframes, type OutputFormat, type Padding, type PathJSON, type Point, type Prettify, RULER_AXIS, type RULER_AXIS_TYPE, type Radius, type RotateKeyframes, type RoundedRectJSON, type RulerLine, type SavedCustomDimensions, type Scale, type ScaleKeyframes, type SerializedFabricBaseObject, type SerializedFabricShadow, type SerializedFillType, type SerializedImageFilter, type SerializedRoundedRect, type ServerCapsule, type SvgJSON, type TextAnimation, type TextAnimationKeyframe, TextAnimationType, type TextCase, type TextContainerJSON, type TranslateKeyframes, type VideoContainerJSON, WORD_STYLE_TYPE, type WordStyle, type WordStyleStyles, type WordStyles, adaptWordStyleFontSizes, applyAdaptedAsOverrides, buildNewCapsule, checkIfElementShouldBeSkewed, findBestReferenceSize, findClosestSizeObjectsWithMatches, findClosestSizeWithMatches, generateBaseLayoutForSize, getAdaptedObjectsJSON, getAreaPercentageOfElementOnCanvasJSON, getEuclideanDistanceBetweenSizes, getNormalizedSizeValue, getScaledBorderJSON, getValuesWithoutSkewingJSON, isAudioJSON, isCreativeBoxJSON, isGroupJSON, isImageJSON, isRoundedRectJSON, isSVGContainerJSON, isShapeJSON, isTextJSON, resolveObjectsForSize, scaleAutoFitSizes, scaleCornerRadius, scalePadding };
720
+ export { type AnimationReference, AnimationSpecialCase, type AnimationTrack, type AudioContainerJSON, type AutoFitSizes, type BaseElementJSON, type Border, type BorderPosition, CANVAS_EDITOR_ELEMENT, type CANVAS_EDITOR_ELEMENT_TYPE, type CanvasElementJSON, type CanvasElementWithOverrides, type ColorMap, type CreativeBoxJSON, CreativeElementCategory, type DatabaseSize, type DatabaseVariant, type FillOptions, type FontMetaData, type FontStyle, type GridOption, type GroupContainerJSON, type GroupPath, type ImageContainerJSON, type LayerRules, type ORIGIN_X, type ORIGIN_Y, type ObjectFit, type ObjectPosition, type OpacityKeyframes, type OutputFormat, type Padding, type PathJSON, type Point, type Prettify, RULER_AXIS, type RULER_AXIS_TYPE, type Radius, type RotateKeyframes, type RoundedRectJSON, type RulerLine, type SavedCustomDimensions, type Scale, type ScaleKeyframes, type SerializedFabricBaseObject, type SerializedFabricShadow, type SerializedFillType, type SerializedImageFilter, type SerializedRoundedRect, type ServerCapsule, type SvgJSON, type TextAnimation, type TextAnimationKeyframe, TextAnimationType, type TextCase, type TextContainerJSON, type TranslateKeyframes, type VideoContainerJSON, WORD_STYLE_TYPE, type WordStyle, type WordStyleStyles, type WordStyles, adaptWordStyleFontSizes, applyAdaptedAsOverrides, buildNewCapsule, checkIfElementShouldBeSkewed, findBestReferenceSize, findClosestSizeObjectsWithMatches, findClosestSizeWithMatches, generateBaseLayoutForSize, getAdaptedObjectsJSON, getAreaPercentageOfElementOnCanvasJSON, getEuclideanDistanceBetweenSizes, getNormalizedSizeValue, getScaledBorderJSON, getValuesWithoutSkewingJSON, isAudioJSON, isCreativeBoxJSON, isGroupJSON, isImageJSON, isRoundedRectJSON, isSVGContainerJSON, isShapeJSON, isTextJSON, isVideoJSON, mergeLayoutFromReference, mergeLayoutFromReferenceObjects, resolveObjectsForSize, scaleAutoFitSizes, scaleCornerRadius, scalePadding };