@rocketium/auto-adapt 2.0.0 → 2.1.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.mts 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 };
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 };
package/dist/index.js CHANGED
@@ -184,6 +184,9 @@ var isGroupJSON = (object) => {
184
184
  var isCreativeBoxJSON = (object) => {
185
185
  return object?.dataType === "CREATIVE_BOX";
186
186
  };
187
+ var isVideoJSON = (object) => {
188
+ return object?.dataType === "VIDEO";
189
+ };
187
190
  var isAudioJSON = (object) => {
188
191
  return object?.dataType === "AUDIO";
189
192
  };
@@ -455,6 +458,7 @@ var adaptTextSkew = (object, widthRatio, heightRatio, scalingRatio, closestHeigh
455
458
  height: object.height * heightRatio,
456
459
  autoFitSizes: scaleAutoFitSizes(object.autoFitSizes, scalingRatio, closestHeight),
457
460
  cornerRadius: scaleCornerRadius(object.cornerRadius, scalingRatio),
461
+ ...getScaledBorderJSON({ object, scalingRatio }),
458
462
  fontSize: object.fontSize * scalingRatio,
459
463
  wordStyle: adaptWordStyleFontSizes({ wordStyle: object.wordStyle || [], scalingRatio })
460
464
  };
@@ -469,7 +473,8 @@ var adaptImageSkew = (object, widthRatio, heightRatio, scalingRatio) => {
469
473
  imageScale: (object.imageScale ?? 1) * scalingRatio,
470
474
  imageLeft: (object.imageLeft ?? 0) * widthRatio,
471
475
  imageTop: (object.imageTop ?? 0) * heightRatio,
472
- cornerRadius: scaleCornerRadius(object.cornerRadius, scalingRatio)
476
+ cornerRadius: scaleCornerRadius(object.cornerRadius, scalingRatio),
477
+ ...getScaledBorderJSON({ object, scalingRatio })
473
478
  };
474
479
  };
475
480
  var adaptSvgSkew = (object, widthRatio, heightRatio, scalingRatio) => {
@@ -506,7 +511,7 @@ var adaptShapeSkew = (object, widthRatio, heightRatio, scalingRatio) => {
506
511
  ...getScaledBorderJSON({ object, scalingRatio })
507
512
  };
508
513
  };
509
- var adaptGroupChildText = (groupObject, scalingRatio, closestHeight, parentObject) => {
514
+ var adaptGroupChildText = (groupObject, scalingRatio, closestHeight) => {
510
515
  return {
511
516
  ...groupObject,
512
517
  left: groupObject.left * scalingRatio,
@@ -516,13 +521,13 @@ var adaptGroupChildText = (groupObject, scalingRatio, closestHeight, parentObjec
516
521
  wordSpacing: groupObject.wordSpacing ? groupObject.wordSpacing * scalingRatio : 0,
517
522
  padding: scalePadding(groupObject.padding, scalingRatio),
518
523
  cornerRadius: scaleCornerRadius(groupObject.cornerRadius, scalingRatio),
519
- ...getScaledBorderJSON({ object: parentObject, scalingRatio }),
524
+ ...getScaledBorderJSON({ object: groupObject, scalingRatio }),
520
525
  autoFitSizes: scaleAutoFitSizes(groupObject.autoFitSizes, scalingRatio, closestHeight),
521
526
  fontSize: groupObject.fontSize * scalingRatio,
522
527
  wordStyle: adaptWordStyleFontSizes({ wordStyle: groupObject.wordStyle || [], scalingRatio })
523
528
  };
524
529
  };
525
- var adaptGroupChildImage = (groupObject, scalingRatio, parentObject) => {
530
+ var adaptGroupChildImage = (groupObject, scalingRatio) => {
526
531
  return {
527
532
  ...groupObject,
528
533
  left: groupObject.left * scalingRatio,
@@ -533,10 +538,10 @@ var adaptGroupChildImage = (groupObject, scalingRatio, parentObject) => {
533
538
  imageLeft: (groupObject.imageLeft ?? 0) * scalingRatio,
534
539
  imageTop: (groupObject.imageTop ?? 0) * scalingRatio,
535
540
  cornerRadius: scaleCornerRadius(groupObject.cornerRadius, scalingRatio),
536
- ...getScaledBorderJSON({ object: parentObject, scalingRatio })
541
+ ...getScaledBorderJSON({ object: groupObject, scalingRatio })
537
542
  };
538
543
  };
539
- var adaptGroupChildSvg = (svgContainer, scalingRatio, parentObject) => {
544
+ var adaptGroupChildSvg = (svgContainer, scalingRatio) => {
540
545
  return {
541
546
  ...svgContainer,
542
547
  left: svgContainer.left * scalingRatio,
@@ -546,10 +551,10 @@ var adaptGroupChildSvg = (svgContainer, scalingRatio, parentObject) => {
546
551
  imageScale: (svgContainer.imageScale ?? 1) * scalingRatio,
547
552
  imageLeft: (svgContainer.imageLeft ?? 0) * scalingRatio,
548
553
  imageTop: (svgContainer.imageTop ?? 0) * scalingRatio,
549
- ...getScaledBorderJSON({ object: parentObject, scalingRatio })
554
+ ...getScaledBorderJSON({ object: svgContainer, scalingRatio })
550
555
  };
551
556
  };
552
- var adaptGroupChildRoundedRect = (roundedRectObject, scalingRatio, parentObject) => {
557
+ var adaptGroupChildRoundedRect = (roundedRectObject, scalingRatio) => {
553
558
  return {
554
559
  ...roundedRectObject,
555
560
  left: roundedRectObject.left * scalingRatio,
@@ -557,17 +562,17 @@ var adaptGroupChildRoundedRect = (roundedRectObject, scalingRatio, parentObject)
557
562
  width: roundedRectObject.width * scalingRatio,
558
563
  height: roundedRectObject.height * scalingRatio,
559
564
  cornerRadius: scaleCornerRadius(roundedRectObject.cornerRadius, scalingRatio),
560
- ...getScaledBorderJSON({ object: parentObject, scalingRatio })
565
+ ...getScaledBorderJSON({ object: roundedRectObject, scalingRatio })
561
566
  };
562
567
  };
563
- var adaptGroupChildShape = (groupObject, scalingRatio, parentObject) => {
568
+ var adaptGroupChildShape = (groupObject, scalingRatio) => {
564
569
  return {
565
570
  ...groupObject,
566
571
  left: num(groupObject, "left") * scalingRatio,
567
572
  top: num(groupObject, "top") * scalingRatio,
568
573
  scaleX: num(groupObject, "scaleX", 1) * scalingRatio,
569
574
  scaleY: num(groupObject, "scaleY", 1) * scalingRatio,
570
- ...getScaledBorderJSON({ object: parentObject, scalingRatio })
575
+ ...getScaledBorderJSON({ object: groupObject, scalingRatio })
571
576
  };
572
577
  };
573
578
 
@@ -660,29 +665,27 @@ var getAdaptedObjectsJSON = ({
660
665
  newObjects[groupObjectId] = adaptGroupChildText(
661
666
  groupObject,
662
667
  scalingRatio,
663
- closestHeight,
664
- object
668
+ closestHeight
665
669
  );
666
670
  continue;
667
671
  }
668
672
  if (isImageJSON(groupObject)) {
669
- newObjects[groupObjectId] = adaptGroupChildImage(groupObject, scalingRatio, object);
673
+ newObjects[groupObjectId] = adaptGroupChildImage(groupObject, scalingRatio);
670
674
  continue;
671
675
  }
672
676
  if (isShapeJSON(groupObject)) {
673
677
  if (isSVGContainerJSON(groupObject)) {
674
- newObjects[groupObjectId] = adaptGroupChildSvg(groupObject, scalingRatio, object);
678
+ newObjects[groupObjectId] = adaptGroupChildSvg(groupObject, scalingRatio);
675
679
  continue;
676
680
  }
677
681
  if (isRoundedRectJSON(groupObject)) {
678
682
  newObjects[groupObjectId] = adaptGroupChildRoundedRect(
679
683
  groupObject,
680
- scalingRatio,
681
- object
684
+ scalingRatio
682
685
  );
683
686
  continue;
684
687
  }
685
- newObjects[groupObjectId] = adaptGroupChildShape(groupObject, scalingRatio, object);
688
+ newObjects[groupObjectId] = adaptGroupChildShape(groupObject, scalingRatio);
686
689
  continue;
687
690
  }
688
691
  }
@@ -744,6 +747,60 @@ var applyAdaptedAsOverrides = (originalObjects, adaptedObjects, newSizeId) => {
744
747
  }
745
748
  return result;
746
749
  };
750
+ var LAYOUT_KEYS_COMMON = ["left", "top", "width", "height", "angle", "visible"];
751
+ var LAYOUT_KEYS_TEXT_EXTRA = ["fontSize", "autoFitSizes", "padding", "wordSpacing"];
752
+ var LAYOUT_KEYS_IMAGE_VIDEO_EXTRA = ["imageScale", "imageLeft", "imageTop", "objectFit", "imageOriginX", "imageOriginY"];
753
+ var LAYOUT_KEYS_SVG_EXTRA = ["imageScale", "imageLeft", "imageTop", "scaleX", "scaleY", "objectFit", "imageOriginX", "imageOriginY"];
754
+ var LAYOUT_KEYS_PATH = ["left", "top", "angle", "visible", "scaleX", "scaleY"];
755
+ var getLayoutKeysForElement = (element) => {
756
+ if (isCreativeBoxJSON(element) || isAudioJSON(element)) {
757
+ return [];
758
+ }
759
+ if (isTextJSON(element)) {
760
+ return [...LAYOUT_KEYS_COMMON, ...LAYOUT_KEYS_TEXT_EXTRA];
761
+ }
762
+ if (isImageJSON(element) || isVideoJSON(element)) {
763
+ return [...LAYOUT_KEYS_COMMON, ...LAYOUT_KEYS_IMAGE_VIDEO_EXTRA];
764
+ }
765
+ if (isShapeJSON(element)) {
766
+ if (isSVGContainerJSON(element)) {
767
+ return [...LAYOUT_KEYS_COMMON, ...LAYOUT_KEYS_SVG_EXTRA];
768
+ }
769
+ if (isRoundedRectJSON(element)) {
770
+ return LAYOUT_KEYS_COMMON;
771
+ }
772
+ return LAYOUT_KEYS_PATH;
773
+ }
774
+ if (isGroupJSON(element)) {
775
+ return LAYOUT_KEYS_COMMON;
776
+ }
777
+ return LAYOUT_KEYS_COMMON;
778
+ };
779
+ var mergeLayoutFromReference = (base, layoutReference) => {
780
+ if (isCreativeBoxJSON(base) || isAudioJSON(base)) {
781
+ return base;
782
+ }
783
+ const layoutKeys = getLayoutKeysForElement(base);
784
+ const merged = { ...base };
785
+ const ref = layoutReference;
786
+ for (const key of layoutKeys) {
787
+ if (ref[key] !== void 0) {
788
+ merged[key] = ref[key];
789
+ }
790
+ }
791
+ return merged;
792
+ };
793
+ var mergeLayoutFromReferenceObjects = (baseObjects, referenceObjects) => {
794
+ const merged = {};
795
+ for (const [layerId, baseObj] of Object.entries(baseObjects)) {
796
+ if (referenceObjects[layerId]) {
797
+ merged[layerId] = mergeLayoutFromReference(baseObj, referenceObjects[layerId]);
798
+ } else {
799
+ merged[layerId] = baseObj;
800
+ }
801
+ }
802
+ return merged;
803
+ };
747
804
  var buildNewCapsule = ({
748
805
  originalCapsule,
749
806
  updatedObjects,
@@ -922,6 +979,9 @@ exports.isRoundedRectJSON = isRoundedRectJSON;
922
979
  exports.isSVGContainerJSON = isSVGContainerJSON;
923
980
  exports.isShapeJSON = isShapeJSON;
924
981
  exports.isTextJSON = isTextJSON;
982
+ exports.isVideoJSON = isVideoJSON;
983
+ exports.mergeLayoutFromReference = mergeLayoutFromReference;
984
+ exports.mergeLayoutFromReferenceObjects = mergeLayoutFromReferenceObjects;
925
985
  exports.resolveObjectsForSize = resolveObjectsForSize;
926
986
  exports.scaleAutoFitSizes = scaleAutoFitSizes;
927
987
  exports.scaleCornerRadius = scaleCornerRadius;