@makeswift/runtime 0.10.14 → 0.10.15

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.
@@ -807,14 +807,19 @@ const ImageControlValueFormat = {
807
807
  WithDimensions: "makeswift::controls::image::format::with-dimensions"
808
808
  };
809
809
  function Image(config = {}) {
810
- return { type: ImageControlType, config };
810
+ return { type: ImageControlType, config, version: 1 };
811
811
  }
812
812
  Image.Format = ImageControlValueFormat;
813
813
  function copyImageData(value, context) {
814
- var _a;
815
814
  if (value == null)
816
815
  return value;
817
- return (_a = context.replacementContext.fileIds.get(value)) != null ? _a : value;
816
+ return match(value).with(P.string, (id) => {
817
+ var _a;
818
+ return (_a = context.replacementContext.fileIds.get(id)) != null ? _a : id;
819
+ }).with({ type: "makeswift-file" }, ({ id }) => {
820
+ var _a;
821
+ return (_a = context.replacementContext.fileIds.get(id)) != null ? _a : id;
822
+ }).otherwise((val) => val);
818
823
  }
819
824
  if (import_meta.vitest) {
820
825
  const { describe, test, expect } = import_meta.vitest;
@@ -4374,7 +4379,7 @@ function getFileIds(descriptor, prop) {
4374
4379
  }
4375
4380
  case ImageControlType: {
4376
4381
  const value = prop;
4377
- return value == null ? [] : [value];
4382
+ return match(value).with(P.string, (f) => [f]).with({ type: "makeswift-file" }, (f) => [f.id]).with({ type: "external-file" }, () => []).otherwise(() => []);
4378
4383
  }
4379
4384
  case ShapeControlType: {
4380
4385
  return getShapeFileIds(descriptor, prop);