@plasmicapp/react-web 0.2.73 → 0.2.78

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.
Files changed (65) hide show
  1. package/dist/all.d.ts +9 -6
  2. package/dist/react-web.cjs.development.js +37 -15
  3. package/dist/react-web.cjs.development.js.map +1 -1
  4. package/dist/react-web.cjs.production.min.js +1 -1
  5. package/dist/react-web.cjs.production.min.js.map +1 -1
  6. package/dist/react-web.esm.js +37 -15
  7. package/dist/react-web.esm.js.map +1 -1
  8. package/dist/render/PlasmicImg/index.d.ts +9 -6
  9. package/lib/plasmic.css +9 -1
  10. package/package.json +2 -2
  11. package/skinny/dist/{collection-utils-4dae6efa.js → collection-utils-21ad9cae.js} +4 -3
  12. package/skinny/dist/{collection-utils-4dae6efa.js.map → collection-utils-21ad9cae.js.map} +1 -1
  13. package/skinny/dist/{collection-utils-57ec40f9.js → collection-utils-87ffc0ed.js} +4 -3
  14. package/skinny/dist/{collection-utils-57ec40f9.js.map → collection-utils-87ffc0ed.js.map} +1 -1
  15. package/skinny/dist/collection-utils-96cde83c.js +238 -0
  16. package/skinny/dist/collection-utils-96cde83c.js.map +1 -0
  17. package/skinny/dist/collection-utils-976df07d.js +238 -0
  18. package/skinny/dist/collection-utils-976df07d.js.map +1 -0
  19. package/skinny/dist/collection-utils-aadc3a43.js +238 -0
  20. package/skinny/dist/collection-utils-aadc3a43.js.map +1 -0
  21. package/skinny/dist/collection-utils-b8a2fd59.js +238 -0
  22. package/skinny/dist/collection-utils-b8a2fd59.js.map +1 -0
  23. package/skinny/dist/index.js +3 -3
  24. package/skinny/dist/plume/checkbox/index.js +3 -3
  25. package/skinny/dist/plume/menu/index.js +4 -4
  26. package/skinny/dist/plume/menu-button/index.js +3 -3
  27. package/skinny/dist/plume/select/index.js +4 -4
  28. package/skinny/dist/plume/switch/index.js +3 -3
  29. package/skinny/dist/plume/triggered-overlay/index.js +3 -3
  30. package/skinny/dist/props-utils-1f98cfd3.js +40 -0
  31. package/skinny/dist/props-utils-1f98cfd3.js.map +1 -0
  32. package/skinny/dist/{props-utils-5c0ad25a.js → props-utils-40224c71.js} +3 -2
  33. package/skinny/dist/props-utils-40224c71.js.map +1 -0
  34. package/skinny/dist/props-utils-69f9ba8b.js +40 -0
  35. package/skinny/dist/props-utils-69f9ba8b.js.map +1 -0
  36. package/skinny/dist/{props-utils-fd5f444e.js → props-utils-6cf101b2.js} +2 -2
  37. package/skinny/dist/{props-utils-5c0ad25a.js.map → props-utils-6cf101b2.js.map} +1 -1
  38. package/skinny/dist/props-utils-754f655a.js +39 -0
  39. package/skinny/dist/{props-utils-fd5f444e.js.map → props-utils-754f655a.js.map} +1 -1
  40. package/skinny/dist/props-utils-85691c9c.js +40 -0
  41. package/skinny/dist/props-utils-85691c9c.js.map +1 -0
  42. package/skinny/dist/{react-utils-2a2fd6c9.js → react-utils-06bae09a.js} +14 -61
  43. package/skinny/dist/react-utils-06bae09a.js.map +1 -0
  44. package/skinny/dist/react-utils-14af9d28.js +172 -0
  45. package/skinny/dist/react-utils-14af9d28.js.map +1 -0
  46. package/skinny/dist/react-utils-7c01e440.js +172 -0
  47. package/skinny/dist/react-utils-7c01e440.js.map +1 -0
  48. package/skinny/dist/react-utils-834a65c3.js +254 -0
  49. package/skinny/dist/react-utils-834a65c3.js.map +1 -0
  50. package/skinny/dist/{react-utils-675565b4.js → react-utils-ae69f4e0.js} +3 -46
  51. package/skinny/dist/react-utils-ae69f4e0.js.map +1 -0
  52. package/skinny/dist/react-utils-cca81efc.js +245 -0
  53. package/skinny/dist/react-utils-cca81efc.js.map +1 -0
  54. package/skinny/dist/render/PlasmicImg/index.d.ts +9 -6
  55. package/skinny/dist/render/PlasmicImg/index.js +43 -17
  56. package/skinny/dist/render/PlasmicImg/index.js.map +1 -1
  57. package/skinny/dist/stories/Button.d.ts +29 -0
  58. package/skinny/dist/stories/Header.d.ts +10 -0
  59. package/skinny/dist/stories/Page.d.ts +10 -0
  60. package/skinny/dist/tslib.es6-10d3f595.js +132 -0
  61. package/skinny/dist/tslib.es6-10d3f595.js.map +1 -0
  62. package/skinny/dist/tslib.es6-d26ffe68.js +132 -0
  63. package/skinny/dist/tslib.es6-d26ffe68.js.map +1 -0
  64. package/skinny/dist/react-utils-2a2fd6c9.js.map +0 -1
  65. package/skinny/dist/react-utils-675565b4.js.map +0 -1
@@ -882,10 +882,10 @@ function makePicture(opts) {
882
882
  ref = opts.ref;
883
883
  return React__default.createElement("picture", {
884
884
  className: "__wab_picture"
885
- }, imageLoader && React__default.createElement("source", {
885
+ }, imageLoader && imageLoader.supportsUrl(src) && React__default.createElement("source", {
886
886
  type: "image/webp",
887
887
  srcSet: widthDescs.map(function (wd) {
888
- return imageLoader({
888
+ return imageLoader.transformUrl({
889
889
  src: src,
890
890
  quality: quality,
891
891
  width: wd.width,
@@ -896,13 +896,13 @@ function makePicture(opts) {
896
896
  ref: ref,
897
897
  className: className,
898
898
  decoding: "async",
899
- src: imageLoader ? imageLoader({
899
+ src: imageLoader && imageLoader.supportsUrl(src) ? imageLoader.transformUrl({
900
900
  src: src,
901
901
  quality: quality,
902
902
  width: widthDescs[widthDescs.length - 1].width
903
903
  }) : src,
904
- srcSet: imageLoader ? widthDescs.map(function (wd) {
905
- return imageLoader({
904
+ srcSet: imageLoader && imageLoader.supportsUrl(src) ? widthDescs.map(function (wd) {
905
+ return imageLoader.transformUrl({
906
906
  src: src,
907
907
  quality: quality,
908
908
  width: wd.width
@@ -913,12 +913,20 @@ function makePicture(opts) {
913
913
  })));
914
914
  }
915
915
 
916
- function getClosestPresetSize(width) {
916
+ function getClosestPresetSize(width, fullWidth) {
917
917
  var _ALL_SIZES$find;
918
918
 
919
- return (_ALL_SIZES$find = ALL_SIZES.find(function (w) {
919
+ var nextBigger = (_ALL_SIZES$find = ALL_SIZES.find(function (w) {
920
920
  return w >= width;
921
921
  })) != null ? _ALL_SIZES$find : ALL_SIZES[ALL_SIZES.length - 1];
922
+
923
+ if (nextBigger >= fullWidth / 2) {
924
+ // If the requested width is larger than half the fullWidth,
925
+ // we just use the original width instead
926
+ return undefined;
927
+ }
928
+
929
+ return nextBigger;
922
930
  }
923
931
  /**
924
932
  * Computes the appropriate srcSet and sizes to use
@@ -932,10 +940,10 @@ function getWidths(width, fullWidth) {
932
940
  // If there's an exact width, then we just need to display it at 1x and 2x density
933
941
  return {
934
942
  widthDescs: [{
935
- width: getClosestPresetSize(pixelWidth),
943
+ width: getClosestPresetSize(pixelWidth, fullWidth),
936
944
  desc: "1x"
937
945
  }, {
938
- width: getClosestPresetSize(pixelWidth * 2),
946
+ width: getClosestPresetSize(pixelWidth * 2, fullWidth),
939
947
  desc: "2x"
940
948
  }],
941
949
  sizes: undefined
@@ -953,7 +961,7 @@ function getWidths(width, fullWidth) {
953
961
  // is offer 1x
954
962
  return {
955
963
  widthDescs: [{
956
- width: getClosestPresetSize(fullWidth),
964
+ width: getClosestPresetSize(fullWidth, fullWidth),
957
965
  desc: "1x"
958
966
  }],
959
967
  sizes: undefined
@@ -961,9 +969,15 @@ function getWidths(width, fullWidth) {
961
969
  }
962
970
 
963
971
  return {
964
- widthDescs: usefulSizes.map(function (size) {
972
+ widthDescs: usefulSizes.map(function (size, i) {
965
973
  return {
966
- width: size,
974
+ width: // If this is the last (buggest) useful width, but it is
975
+ // still within the bounds set by DEVICE_SIZES, then just
976
+ // use the original, unresized image. This means if we match
977
+ // the largest size, we use unresized and best quality image.
978
+ // We only do this, though, if fullWidth is "reasonable" --
979
+ // smaller than the largest size we would consider.
980
+ i === usefulSizes.length - 1 && fullWidth < DEVICE_SIZES[DEVICE_SIZES.length - 1] ? undefined : size,
967
981
  desc: size + "w"
968
982
  };
969
983
  }),
@@ -1025,10 +1039,18 @@ function getImageLoader(loader) {
1025
1039
  }
1026
1040
  }
1027
1041
 
1028
- var PLASMIC_IMAGE_LOADER = function PLASMIC_IMAGE_LOADER(opts) {
1029
- var _opts$quality;
1042
+ var PLASMIC_IMAGE_LOADER = {
1043
+ supportsUrl: function supportsUrl(src) {
1044
+ return src.startsWith("https://img.plasmic.app");
1045
+ },
1046
+ transformUrl: function transformUrl(opts) {
1047
+ var _opts$quality;
1030
1048
 
1031
- return opts.src + "?w=" + opts.width + "&q=" + ((_opts$quality = opts.quality) != null ? _opts$quality : 75) + (opts.format ? "&f=" + opts.format : "");
1049
+ var params = [opts.width ? "w=" + opts.width : undefined, "q=" + ((_opts$quality = opts.quality) != null ? _opts$quality : 75), opts.format ? "f=" + opts.format : undefined].filter(function (x) {
1050
+ return !!x;
1051
+ });
1052
+ return opts.src + "?" + params.join("&");
1053
+ }
1032
1054
  };
1033
1055
 
1034
1056
  function PlasmicLink(props) {