@plasmicapp/react-web 1.0.39 → 1.0.41

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/all.d.ts CHANGED
@@ -13446,9 +13446,11 @@ interface PlasmicImgProps extends ImgTagProps {
13446
13446
  format?: PlasmicImgFormat;
13447
13447
  /**
13448
13448
  * ImageLoader to use for loading different dimensions of the image.
13449
+ * "plasmic" uses Plasmic's image optimizer, and a URL string uses the image
13450
+ * optimizer hosted at that base URL.
13449
13451
  * If none specified, will not attempt to load different dimensions.
13450
13452
  */
13451
- loader?: "plasmic" | ImageLoader;
13453
+ loader?: "plasmic" | string | ImageLoader;
13452
13454
  /**
13453
13455
  * Style applied to the wrapper element. objectFit and objectPosition
13454
13456
  * rules are applied to the img element.
package/dist/index.cjs.js CHANGED
@@ -1031,7 +1031,10 @@ function getImageLoader(loader) {
1031
1031
  return undefined;
1032
1032
  }
1033
1033
  else if (loader === "plasmic") {
1034
- return PLASMIC_IMAGE_LOADER;
1034
+ return makePlasmicImageLoader(IMG_OPTIMIZER_HOST);
1035
+ }
1036
+ else if (typeof loader === "string") {
1037
+ return makePlasmicImageLoader(loader);
1035
1038
  }
1036
1039
  else {
1037
1040
  return loader;
@@ -1040,7 +1043,7 @@ function getImageLoader(loader) {
1040
1043
  function isInternalKey(src) {
1041
1044
  return /^([a-f0-9]{32})\..{1,16}$/i.test(src);
1042
1045
  }
1043
- var PLASMIC_IMAGE_LOADER = {
1046
+ var makePlasmicImageLoader = function (host) { return ({
1044
1047
  supportsUrl: function (src) {
1045
1048
  return (src.startsWith("http") || isInternalKey(src)) && !isSvg(src);
1046
1049
  },
@@ -1052,9 +1055,9 @@ var PLASMIC_IMAGE_LOADER = {
1052
1055
  "q=".concat((_a = opts.quality) !== null && _a !== void 0 ? _a : 75),
1053
1056
  opts.format ? "f=".concat(opts.format) : undefined,
1054
1057
  ].filter(function (x) { return !!x; });
1055
- return "".concat(IMG_OPTIMIZER_HOST, "/img-optimizer/v1/img?").concat(params.join("&"));
1058
+ return "".concat(host, "/img-optimizer/v1/img?").concat(params.join("&"));
1056
1059
  },
1057
- };
1060
+ }); };
1058
1061
 
1059
1062
  // These props are used internally by PlasmicLink to determine how to render the link
1060
1063
  var INTERNAL_PROPS = ["component", "platform", "legacyBehavior"];