@plasmicapp/react-web 0.2.82 → 0.2.89

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 (46) hide show
  1. package/dist/all.d.ts +92 -6
  2. package/dist/index.d.ts +2 -0
  3. package/dist/plume/button/index.d.ts +36 -0
  4. package/dist/plume/text-input/index.d.ts +36 -0
  5. package/dist/react-utils.d.ts +1 -1
  6. package/dist/react-web.cjs.development.js +248 -42
  7. package/dist/react-web.cjs.development.js.map +1 -1
  8. package/dist/react-web.cjs.production.min.js +1 -1
  9. package/dist/react-web.cjs.production.min.js.map +1 -1
  10. package/dist/react-web.esm.js +247 -43
  11. package/dist/react-web.esm.js.map +1 -1
  12. package/dist/render/PlasmicImg/index.d.ts +22 -4
  13. package/dist/stories/PlasmicImg.stories.d.ts +2 -2
  14. package/lib/plasmic.css +0 -3
  15. package/package.json +1 -1
  16. package/skinny/dist/collection-utils-3487dd27.js +238 -0
  17. package/skinny/dist/collection-utils-3487dd27.js.map +1 -0
  18. package/skinny/dist/index.d.ts +2 -0
  19. package/skinny/dist/plume/button/index.d.ts +36 -0
  20. package/skinny/dist/plume/button/index.js +27 -0
  21. package/skinny/dist/plume/button/index.js.map +1 -0
  22. package/skinny/dist/plume/checkbox/index.js +2 -1
  23. package/skinny/dist/plume/checkbox/index.js.map +1 -1
  24. package/skinny/dist/plume/menu/index.js +3 -2
  25. package/skinny/dist/plume/menu/index.js.map +1 -1
  26. package/skinny/dist/plume/menu-button/index.js +2 -1
  27. package/skinny/dist/plume/menu-button/index.js.map +1 -1
  28. package/skinny/dist/plume/select/index.js +3 -2
  29. package/skinny/dist/plume/select/index.js.map +1 -1
  30. package/skinny/dist/plume/switch/index.js +2 -1
  31. package/skinny/dist/plume/switch/index.js.map +1 -1
  32. package/skinny/dist/plume/text-input/index.d.ts +36 -0
  33. package/skinny/dist/plume/text-input/index.js +51 -0
  34. package/skinny/dist/plume/text-input/index.js.map +1 -0
  35. package/skinny/dist/plume/triggered-overlay/index.js +3 -3
  36. package/skinny/dist/plume/triggered-overlay/index.js.map +1 -1
  37. package/skinny/dist/plume-utils-27cd384f.js +35 -0
  38. package/skinny/dist/plume-utils-27cd384f.js.map +1 -0
  39. package/skinny/dist/props-utils-7c02c0a8.js +8 -0
  40. package/skinny/dist/props-utils-7c02c0a8.js.map +1 -0
  41. package/skinny/dist/react-utils-7c01e440.js.map +1 -1
  42. package/skinny/dist/react-utils.d.ts +1 -1
  43. package/skinny/dist/render/PlasmicImg/index.d.ts +22 -4
  44. package/skinny/dist/render/PlasmicImg/index.js +100 -27
  45. package/skinny/dist/render/PlasmicImg/index.js.map +1 -1
  46. package/skinny/dist/stories/PlasmicImg.stories.d.ts +2 -2
@@ -21,6 +21,7 @@ export interface PlasmicImgProps extends ImgTagProps {
21
21
  src: string;
22
22
  fullHeight: number;
23
23
  fullWidth: number;
24
+ aspectRatio?: number;
24
25
  };
25
26
  /**
26
27
  * className applied to the wrapper element if one is used.
@@ -34,6 +35,22 @@ export interface PlasmicImgProps extends ImgTagProps {
34
35
  * css height
35
36
  */
36
37
  displayHeight?: number | string;
38
+ /**
39
+ * css min-width
40
+ */
41
+ displayMinWidth?: number | string;
42
+ /**
43
+ * css min-height
44
+ */
45
+ displayMinHeight?: number | string;
46
+ /**
47
+ * css max-width
48
+ */
49
+ displayMaxWidth?: number | string;
50
+ /**
51
+ * css max-height
52
+ */
53
+ displayMaxHeight?: number | string;
37
54
  /**
38
55
  * For variable quality formats like jpg, the quality from 0 to 100
39
56
  */
@@ -49,10 +66,11 @@ export interface PlasmicImgProps extends ImgTagProps {
49
66
  */
50
67
  style?: React.CSSProperties;
51
68
  /**
52
- * Ref for the wrapper element. The normal <PlasmicImg ref={...} />
53
- * prop gives you the wrap to the img element.
69
+ * Ref for the img element. The normal <PlasmicImg ref={...} />
70
+ * prop gives the root element instead, which may be the img element
71
+ * or a wrapper element
54
72
  */
55
- containerRef?: React.Ref<HTMLDivElement>;
73
+ imgRef?: React.Ref<HTMLImageElement>;
56
74
  }
57
- export declare const PlasmicImg: React.ForwardRefExoticComponent<PlasmicImgProps & React.RefAttributes<HTMLImageElement>>;
75
+ export declare const PlasmicImg: React.ForwardRefExoticComponent<PlasmicImgProps & React.RefAttributes<HTMLElement>>;
58
76
  export {};
@@ -1,6 +1,7 @@
1
1
  import { b as __spreadArray, _ as __rest, a as __assign, p as pick } from '../../tslib.es6-d26ffe68.js';
2
2
  import classNames from 'classnames';
3
3
  import React__default from 'react';
4
+ import { d as mergeRefs } from '../../react-utils-7c01e440.js';
4
5
 
5
6
  /**
6
7
  * Responsive `<img/>` replacement, based on `next/image`
@@ -10,16 +11,25 @@ import React__default from 'react';
10
11
  var IMG_SIZES = [16, 32, 48, 64, 96, 128, 256, 384];
11
12
  var DEVICE_SIZES = [640, 750, 828, 1080, 1200, 1920, 2048, 3840];
12
13
  var ALL_SIZES = __spreadArray(__spreadArray([], IMG_SIZES), DEVICE_SIZES);
13
- var PlasmicImg = React__default.forwardRef(function PlasmicImg(props, ref) {
14
- var src = props.src, className = props.className, displayWidth = props.displayWidth, displayHeight = props.displayHeight, quality = props.quality, loader = props.loader, containerRef = props.containerRef, style = props.style, rest = __rest(props, ["src", "className", "displayWidth", "displayHeight", "quality", "loader", "containerRef", "style"]);
14
+ var PlasmicImg = React__default.forwardRef(function PlasmicImg(props, outerRef) {
15
+ var src = props.src, className = props.className, displayWidth = props.displayWidth, displayHeight = props.displayHeight, displayMinWidth = props.displayMinWidth, displayMinHeight = props.displayMinHeight, displayMaxWidth = props.displayMaxWidth, displayMaxHeight = props.displayMaxHeight, quality = props.quality, loader = props.loader, imgRef = props.imgRef, style = props.style, loading = props.loading, rest = __rest(props, ["src", "className", "displayWidth", "displayHeight", "displayMinWidth", "displayMinHeight", "displayMaxWidth", "displayMaxHeight", "quality", "loader", "imgRef", "style", "loading"]);
16
+ var imgProps = Object.assign({}, rest, {
17
+ // Default loading to "lazy" if not specified (which is different from the
18
+ // html img, which defaults to eager!)
19
+ loading: loading !== null && loading !== void 0 ? loading : "lazy",
20
+ });
15
21
  var _a = typeof src === "string" || !src
16
- ? { fullWidth: undefined, fullHeight: undefined }
17
- : src, fullWidth = _a.fullWidth, fullHeight = _a.fullHeight;
22
+ ? { fullWidth: undefined, fullHeight: undefined, aspectRatio: undefined }
23
+ : src, fullWidth = _a.fullWidth, fullHeight = _a.fullHeight, aspectRatio = _a.aspectRatio;
18
24
  var srcStr = src ? (typeof src === "string" ? src : src.src) : "";
19
25
  // Assume external image if either dimension is null and use usual <img>
20
- // (or if the image is an SVG)
21
- if (fullHeight == null || fullWidth == null || srcStr.endsWith(".svg")) {
22
- return (React__default.createElement("img", __assign({ src: srcStr, className: className, style: style }, rest, { ref: ref })));
26
+ if (fullHeight == null || fullWidth == null) {
27
+ return (React__default.createElement("img", __assign({ src: srcStr, className: className, style: style }, imgProps, { loading: loading, ref: mergeRefs(imgRef, outerRef) })));
28
+ }
29
+ if (isSvg(srcStr) &&
30
+ (displayHeight == null || displayHeight === "auto") &&
31
+ (displayWidth == null || displayWidth === "auto")) {
32
+ displayWidth = "100%";
23
33
  }
24
34
  if (fullWidth &&
25
35
  fullHeight &&
@@ -29,25 +39,89 @@ var PlasmicImg = React__default.forwardRef(function PlasmicImg(props, ref) {
29
39
  // then we can derive the pixel length for displayWidth. Having an explicit
30
40
  // displayWidth makes this a fixed-size image, which makes it possible for us to
31
41
  // generate better markup!
32
- displayWidth = (getPixelLength(displayHeight) * fullWidth) / fullHeight;
42
+ if (!isSvg(srcStr)) {
43
+ // We shouldn't do it for SVGs though, because `fullWidth` and
44
+ // `fullHeight` might have rounded values so the final
45
+ // `displayWidth` could differ by 1px or so.
46
+ displayWidth = (getPixelLength(displayHeight) * fullWidth) / fullHeight;
47
+ }
48
+ }
49
+ var spacerWidth = fullWidth;
50
+ var spacerHeight = fullHeight;
51
+ if (aspectRatio && isFinite(aspectRatio) && isSvg(srcStr)) {
52
+ // For SVGs, fullWidth and fullHeight can be rounded values, which would
53
+ // cause some discrepancy between the actual aspect ratio and the aspect
54
+ // ratio from those values. So, for those cases, we set large width / height
55
+ // values to get a more precise ratio from the spacer.
56
+ spacerWidth = DEFAULT_SVG_WIDTH;
57
+ spacerHeight = Math.round(spacerWidth / aspectRatio);
33
58
  }
34
- var _b = getWidths(displayWidth, fullWidth), sizes = _b.sizes, widthDescs = _b.widthDescs;
59
+ var _b = getWidths(displayWidth, fullWidth, {
60
+ minWidth: displayMinWidth,
61
+ }), sizes = _b.sizes, widthDescs = _b.widthDescs;
35
62
  var imageLoader = getImageLoader(loader);
36
- var spacerSvg = "<svg width=\"" + fullWidth + "\" height=\"" + fullHeight + "\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"/>";
63
+ var spacerSvg = "<svg width=\"" + spacerWidth + "\" height=\"" + spacerHeight + "\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"/>";
37
64
  var spacerSvgBase64 = typeof window === "undefined"
38
65
  ? Buffer.from(spacerSvg).toString("base64")
39
66
  : window.btoa(spacerSvg);
40
- return (React__default.createElement("div", { className: classNames(className, "__wab_img-wrapper"), ref: containerRef, style: __assign(__assign({}, style), { width: isPercentage(displayWidth) ? displayWidth : undefined, height: isPercentage(displayHeight) ? displayHeight : undefined }) },
41
- React__default.createElement("img", { alt: "", "aria-hidden": true, className: "__wab_img-spacer-svg", src: "data:image/svg+xml;base64," + spacerSvgBase64, style: __assign({ width: isPercentage(displayWidth) ? "100%" : displayWidth, height: isPercentage(displayHeight) ? "100%" : displayHeight }, (style ? pick(style, "objectFit", "objectPosition") : {})) }),
67
+ var wrapperStyle = __assign({}, (style || {}));
68
+ var spacerStyle = pick(style || {}, "objectFit", "objectPosition");
69
+ if (displayWidth != null && displayWidth !== "auto") {
70
+ // If width is set, set it on the wrapper along with min/max width
71
+ // and just use `width: 100%` on the spacer
72
+ spacerStyle.width = "100%";
73
+ wrapperStyle.width = displayWidth;
74
+ wrapperStyle.minWidth = displayMinWidth;
75
+ wrapperStyle.maxWidth = displayMaxWidth;
76
+ }
77
+ else {
78
+ // Otherwise, we want auto sizing from the spacer, so set width there.
79
+ //
80
+ // But if we have min/max width, it should be set in the wrapper and it
81
+ // can be percentage values (and we add corresponding min/max width to
82
+ // 100% in the spacer). In general it ends up with the correct effect,
83
+ // but some edge cases might make `min-width: 100%` shrink the image more
84
+ // than it should.
85
+ spacerStyle.width = displayWidth;
86
+ wrapperStyle.width = "auto";
87
+ if (displayMinWidth) {
88
+ spacerStyle.minWidth = "100%";
89
+ wrapperStyle.minWidth = displayMinWidth;
90
+ }
91
+ if (displayMaxWidth != null && displayMaxWidth !== "none") {
92
+ spacerStyle.maxWidth = "100%";
93
+ wrapperStyle.maxWidth = displayMaxWidth;
94
+ }
95
+ }
96
+ if (displayHeight != null && displayHeight !== "auto") {
97
+ spacerStyle.height = "100%";
98
+ wrapperStyle.height = displayHeight;
99
+ wrapperStyle.minHeight = displayMinHeight;
100
+ wrapperStyle.maxHeight = displayMaxHeight;
101
+ }
102
+ else {
103
+ spacerStyle.height = displayHeight;
104
+ wrapperStyle.height = "auto";
105
+ if (displayMinHeight) {
106
+ spacerStyle.minHeight = "100%";
107
+ wrapperStyle.minHeight = displayMinHeight;
108
+ }
109
+ if (displayMaxHeight != null && displayMaxHeight !== "none") {
110
+ spacerStyle.maxHeight = "100%";
111
+ wrapperStyle.maxHeight = displayMaxHeight;
112
+ }
113
+ }
114
+ return (React__default.createElement("div", { className: classNames(className, "__wab_img-wrapper"), ref: outerRef, style: wrapperStyle },
115
+ React__default.createElement("img", { alt: "", "aria-hidden": true, className: "__wab_img-spacer-svg", src: "data:image/svg+xml;base64," + spacerSvgBase64, style: spacerStyle }),
42
116
  makePicture({
43
117
  imageLoader: imageLoader,
44
118
  widthDescs: widthDescs,
45
119
  sizes: sizes,
46
120
  src: srcStr,
47
121
  quality: quality,
48
- ref: ref,
122
+ ref: imgRef,
49
123
  style: style ? pick(style, "objectFit", "objectPosition") : undefined,
50
- imgProps: rest,
124
+ imgProps: imgProps,
51
125
  className: "__wab_img",
52
126
  })));
53
127
  });
@@ -83,7 +157,11 @@ function makePicture(opts) {
83
157
  }) + " " + wd.desc;
84
158
  })
85
159
  .join(", ")
86
- : undefined, sizes: imageLoader ? sizes : undefined, style: __assign(__assign({}, (style ? pick(style, "objectFit", "objectPosition") : {})), { width: 0, height: 0 }) }))));
160
+ : undefined, sizes: imageLoader && imageLoader.supportsUrl(src) ? sizes : undefined, style: __assign(__assign({}, (style ? pick(style, "objectFit", "objectPosition") : {})), { width: 0, height: 0 }) }))));
161
+ }
162
+ var DEFAULT_SVG_WIDTH = 10000;
163
+ function isSvg(src) {
164
+ return src.endsWith(".svg") || src.startsWith("data:image/svg");
87
165
  }
88
166
  function getClosestPresetSize(width, fullWidth) {
89
167
  var _a;
@@ -108,18 +186,20 @@ function getClosestPresetSize(width, fullWidth) {
108
186
  /**
109
187
  * Computes the appropriate srcSet and sizes to use
110
188
  */
111
- function getWidths(width, fullWidth) {
189
+ function getWidths(width, fullWidth, extra) {
190
+ var minWidth = extra === null || extra === void 0 ? void 0 : extra.minWidth;
112
191
  var pixelWidth = getPixelLength(width);
113
- if (pixelWidth != null) {
192
+ var pixelMinWidth = getPixelLength(minWidth);
193
+ if (pixelWidth != null && (!minWidth || pixelMinWidth != null)) {
114
194
  // If there's an exact width, then we just need to display it at 1x and 2x density
115
195
  return {
116
196
  widthDescs: [
117
197
  {
118
- width: getClosestPresetSize(pixelWidth, fullWidth),
198
+ width: getClosestPresetSize(Math.max(pixelWidth, pixelMinWidth !== null && pixelMinWidth !== void 0 ? pixelMinWidth : 0), fullWidth),
119
199
  desc: "1x",
120
200
  },
121
201
  {
122
- width: getClosestPresetSize(pixelWidth * 2, fullWidth),
202
+ width: getClosestPresetSize(Math.max(pixelWidth, pixelMinWidth !== null && pixelMinWidth !== void 0 ? pixelMinWidth : 0) * 2, fullWidth),
123
203
  desc: "2x",
124
204
  },
125
205
  ],
@@ -160,13 +240,6 @@ function getWidths(width, fullWidth) {
160
240
  sizes: "100vw",
161
241
  };
162
242
  }
163
- function isPercentage(width) {
164
- var _a;
165
- if (typeof width !== "string") {
166
- return false;
167
- }
168
- return ((_a = parseNumeric(width)) === null || _a === void 0 ? void 0 : _a.units) === "%";
169
- }
170
243
  function getPixelLength(length) {
171
244
  if (length == null || length == "") {
172
245
  return undefined;
@@ -203,7 +276,7 @@ function getImageLoader(loader) {
203
276
  }
204
277
  var PLASMIC_IMAGE_LOADER = {
205
278
  supportsUrl: function (src) {
206
- return src.startsWith("https://img.plasmic.app");
279
+ return src.startsWith("https://img.plasmic.app") && !isSvg(src);
207
280
  },
208
281
  transformUrl: function (opts) {
209
282
  var _a;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/render/PlasmicImg/index.tsx"],"sourcesContent":["/**\n * Responsive `<img/>` replacement, based on `next/image`\n */\n\nimport classNames from \"classnames\";\nimport React from \"react\";\nimport { pick } from \"../../common\";\n\nexport interface ImageLoader {\n supportsUrl: (url: string) => boolean;\n transformUrl: (opts: {\n src: string;\n width?: number;\n quality?: number;\n format?: \"webp\";\n }) => string;\n}\n\ntype ImgTagProps = Omit<\n React.ComponentProps<\"img\">,\n \"src\" | \"srcSet\" | \"ref\" | \"style\"\n>;\n\n// Default image sizes to snap to\n// TODO: make this configurable?\nconst IMG_SIZES = [16, 32, 48, 64, 96, 128, 256, 384];\nconst DEVICE_SIZES = [640, 750, 828, 1080, 1200, 1920, 2048, 3840];\nconst ALL_SIZES = [...IMG_SIZES, ...DEVICE_SIZES];\n\nexport interface PlasmicImgProps extends ImgTagProps {\n /**\n * Either an object with the src string, and its full width and height,\n * or just a src string with unknown intrinsic dimensions.\n */\n src?: string | { src: string; fullHeight: number; fullWidth: number };\n\n /**\n * className applied to the wrapper element if one is used.\n */\n className?: string;\n\n /**\n * css width\n */\n displayWidth?: number | string;\n\n /**\n * css height\n */\n displayHeight?: number | string;\n\n /**\n * For variable quality formats like jpg, the quality from 0 to 100\n */\n quality?: number;\n\n /**\n * ImageLoader to use for loading different dimensions of the image.\n * If none specified, will not attempt to load different dimensions.\n */\n loader?: \"plasmic\" | ImageLoader;\n\n /**\n * Style applied to the wrapper element. objectFit and objectPosition\n * rules are applied to the img element.\n */\n style?: React.CSSProperties;\n\n /**\n * Ref for the wrapper element. The normal <PlasmicImg ref={...} />\n * prop gives you the wrap to the img element.\n */\n containerRef?: React.Ref<HTMLDivElement>;\n}\n\nexport const PlasmicImg = React.forwardRef(function PlasmicImg(\n props: PlasmicImgProps,\n ref: React.Ref<HTMLImageElement>\n) {\n let {\n src,\n className,\n displayWidth,\n displayHeight,\n quality,\n loader,\n containerRef,\n style,\n ...rest\n } = props;\n\n const { fullWidth, fullHeight } =\n typeof src === \"string\" || !src\n ? { fullWidth: undefined, fullHeight: undefined }\n : src;\n const srcStr = src ? (typeof src === \"string\" ? src : src.src) : \"\";\n\n // Assume external image if either dimension is null and use usual <img>\n // (or if the image is an SVG)\n if (fullHeight == null || fullWidth == null || srcStr.endsWith(\".svg\")) {\n return (\n <img\n src={srcStr}\n className={className}\n style={style}\n {...rest}\n ref={ref}\n />\n );\n }\n\n if (\n fullWidth &&\n fullHeight &&\n (!displayWidth || displayWidth === \"auto\") &&\n !!getPixelLength(displayHeight)\n ) {\n // If there's a pixel length specified for displayHeight but not displayWidth,\n // then we can derive the pixel length for displayWidth. Having an explicit\n // displayWidth makes this a fixed-size image, which makes it possible for us to\n // generate better markup!\n displayWidth = (getPixelLength(displayHeight)! * fullWidth) / fullHeight;\n }\n\n const { sizes, widthDescs } = getWidths(displayWidth, fullWidth);\n const imageLoader = getImageLoader(loader);\n const spacerSvg = `<svg width=\"${fullWidth}\" height=\"${fullHeight}\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"/>`;\n const spacerSvgBase64 =\n typeof window === \"undefined\"\n ? Buffer.from(spacerSvg).toString(\"base64\")\n : window.btoa(spacerSvg);\n\n return (\n <div\n className={classNames(className, \"__wab_img-wrapper\")}\n ref={containerRef}\n style={{\n ...style,\n width: isPercentage(displayWidth) ? displayWidth : undefined,\n height: isPercentage(displayHeight) ? displayHeight : undefined,\n }}\n >\n <img\n alt=\"\"\n aria-hidden\n className=\"__wab_img-spacer-svg\"\n src={`data:image/svg+xml;base64,${spacerSvgBase64}`}\n style={{\n width: isPercentage(displayWidth) ? \"100%\" : displayWidth,\n height: isPercentage(displayHeight) ? \"100%\" : displayHeight,\n ...(style ? pick(style, \"objectFit\", \"objectPosition\") : {}),\n }}\n />\n {makePicture({\n imageLoader,\n widthDescs,\n sizes,\n src: srcStr,\n quality,\n ref,\n style: style ? pick(style, \"objectFit\", \"objectPosition\") : undefined,\n imgProps: rest,\n className: \"__wab_img\",\n })}\n </div>\n );\n});\n\nfunction makePicture(opts: {\n imageLoader?: ImageLoader;\n widthDescs: WidthDesc[];\n sizes?: string;\n src: string;\n quality?: number;\n style?: React.CSSProperties;\n className?: string;\n imgProps: ImgTagProps;\n ref?: React.Ref<HTMLImageElement>;\n}) {\n // If imageLoader is undefined, then this renders to just a normal\n // <img />. Else it will render to a <picture> with a <source> for\n // webp, and srcSet/sizes set according to width requirements.\n const {\n imageLoader,\n widthDescs,\n src,\n quality,\n style,\n className,\n sizes,\n imgProps,\n ref,\n } = opts;\n return (\n <picture className=\"__wab_picture\">\n {imageLoader && imageLoader.supportsUrl(src) && (\n <source\n type=\"image/webp\"\n srcSet={widthDescs\n .map(\n (wd) =>\n `${imageLoader.transformUrl({\n src,\n quality,\n width: wd.width,\n format: \"webp\",\n })} ${wd.desc}`\n )\n .join(\", \")}\n />\n )}\n <img\n {...imgProps}\n ref={ref}\n className={className}\n decoding=\"async\"\n src={\n imageLoader && imageLoader.supportsUrl(src)\n ? imageLoader.transformUrl({\n src,\n quality,\n width: widthDescs[widthDescs.length - 1].width,\n })\n : src\n }\n srcSet={\n imageLoader && imageLoader.supportsUrl(src)\n ? widthDescs\n .map(\n (wd) =>\n `${imageLoader.transformUrl({\n src,\n quality,\n width: wd.width,\n })} ${wd.desc}`\n )\n .join(\", \")\n : undefined\n }\n sizes={imageLoader ? sizes : undefined}\n style={{\n ...(style ? pick(style, \"objectFit\", \"objectPosition\") : {}),\n width: 0,\n height: 0,\n }}\n />\n </picture>\n );\n}\n\ninterface WidthDesc {\n width?: number;\n desc: string;\n}\n\nfunction getClosestPresetSize(width: number, fullWidth: number) {\n const nextBiggerIndex =\n ALL_SIZES.findIndex((w) => w >= width) ?? ALL_SIZES.length - 1;\n const nextBigger = ALL_SIZES[nextBiggerIndex];\n if (nextBigger >= fullWidth) {\n // If the requested width is larger than the fullWidth,\n // we just use the original width instead. It's impossible\n // to make an image bigger than fullWidth!\n return undefined;\n } else if (\n nextBiggerIndex + 1 < ALL_SIZES.length &&\n fullWidth <= ALL_SIZES[nextBiggerIndex + 1]\n ) {\n // If the fullWidth is just between nextBigger and the one after that,\n // then also might as well just use the original size (so, width is 30,\n // nextBigger is 32, then we just use the original as long as fullWidth is\n // less than 48)\n return undefined;\n }\n\n return nextBigger;\n}\n\n/**\n * Computes the appropriate srcSet and sizes to use\n */\nfunction getWidths(\n width: number | string | undefined,\n fullWidth: number\n): { sizes: string | undefined; widthDescs: WidthDesc[] } {\n const pixelWidth = getPixelLength(width);\n if (pixelWidth != null) {\n // If there's an exact width, then we just need to display it at 1x and 2x density\n return {\n widthDescs: [\n {\n width: getClosestPresetSize(pixelWidth, fullWidth),\n desc: \"1x\",\n },\n {\n width: getClosestPresetSize(pixelWidth * 2, fullWidth),\n desc: \"2x\",\n },\n ],\n sizes: undefined,\n };\n }\n // Otherwise we don't know what sizes we'll end up, so we just cap it at\n // device width. TODO: do better!\n const usefulSizes = DEVICE_SIZES.filter(\n (size) => !fullWidth || size < fullWidth\n );\n if (!!fullWidth && usefulSizes.length === 0) {\n // image fullWidth is smaller than all device sizes. So all we can do\n // is offer 1x\n return {\n widthDescs: [\n {\n width: getClosestPresetSize(fullWidth, fullWidth),\n desc: \"1x\",\n },\n ],\n sizes: undefined,\n };\n }\n return {\n widthDescs: usefulSizes.map((size) => ({\n width: getClosestPresetSize(size, fullWidth),\n // If this is the last (buggest) useful width, but it is\n // still within the bounds set by DEVICE_SIZES, then just\n // use the original, unresized image. This means if we match\n // the largest size, we use unresized and best quality image.\n // We only do this, though, if fullWidth is \"reasonable\" --\n // smaller than the largest size we would consider.\n // i === usefulSizes.length - 1 &&\n // fullWidth < DEVICE_SIZES[DEVICE_SIZES.length - 1]\n // ? undefined\n // : size,\n desc: `${size}w`,\n })),\n sizes: \"100vw\",\n };\n}\n\nfunction isPercentage(width: number | string | undefined) {\n if (typeof width !== \"string\") {\n return false;\n }\n return parseNumeric(width)?.units === \"%\";\n}\n\nfunction getPixelLength(length: number | string | undefined) {\n if (length == null || length == \"\") {\n return undefined;\n }\n\n if (typeof length === \"number\") {\n return length;\n }\n\n const parsed = parseNumeric(length);\n if (parsed && (!parsed.units || parsed.units === \"px\")) {\n return parsed.num;\n }\n\n return undefined;\n}\n\nfunction parseNumeric(val: string) {\n // Parse strings like \"30\", \"30px\", \"30%\", \"30px /* blah blah */\"\n const res = val.match(\n /^\\s*(-?(?:\\d+\\.\\d*|\\d*\\.\\d+|\\d+))\\s*([a-z]*|%)\\s*(?:\\/\\*.*)?$/i\n );\n if (res == null) {\n return undefined;\n }\n const num = res[1];\n const units = res[2];\n return { num: +num, units };\n}\n\nfunction getImageLoader(loader: \"plasmic\" | ImageLoader | undefined) {\n if (loader == null) {\n return undefined;\n } else if (loader === \"plasmic\") {\n return PLASMIC_IMAGE_LOADER;\n } else {\n return loader;\n }\n}\n\nconst PLASMIC_IMAGE_LOADER: ImageLoader = {\n supportsUrl: (src) => {\n return src.startsWith(\"https://img.plasmic.app\");\n },\n transformUrl: (opts) => {\n const params = [\n opts.width ? `w=${opts.width}` : undefined,\n `q=${opts.quality ?? 75}`,\n opts.format ? `f=${opts.format}` : undefined,\n ].filter((x) => !!x);\n return `${opts.src}?${params.join(\"&\")}`;\n },\n};\n"],"names":["React"],"mappings":";;;;AAAA;;;AAuBA;AAC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AA,CAAC,CAAC,CAAC,GAAA,CAAC,CAAC;QACrB,OAAU,IAAI,CAAC,GAAG,SAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAG,CAAC;KAC1C;CACF;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/render/PlasmicImg/index.tsx"],"sourcesContent":["/**\n * Responsive `<img/>` replacement, based on `next/image`\n */\n\nimport classNames from \"classnames\";\nimport React, { CSSProperties } from \"react\";\nimport { pick } from \"../../common\";\nimport { mergeRefs } from \"../../react-utils\";\n\nexport interface ImageLoader {\n supportsUrl: (url: string) => boolean;\n transformUrl: (opts: {\n src: string;\n width?: number;\n quality?: number;\n format?: \"webp\";\n }) => string;\n}\n\ntype ImgTagProps = Omit<\n React.ComponentProps<\"img\">,\n \"src\" | \"srcSet\" | \"ref\" | \"style\"\n>;\n\n// Default image sizes to snap to\n// TODO: make this configurable?\nconst IMG_SIZES = [16, 32, 48, 64, 96, 128, 256, 384];\nconst DEVICE_SIZES = [640, 750, 828, 1080, 1200, 1920, 2048, 3840];\nconst ALL_SIZES = [...IMG_SIZES, ...DEVICE_SIZES];\n\nexport interface PlasmicImgProps extends ImgTagProps {\n /**\n * Either an object with the src string, and its full width and height,\n * or just a src string with unknown intrinsic dimensions.\n */\n src?:\n | string\n | {\n src: string;\n fullHeight: number;\n fullWidth: number;\n // We might also get a more precise aspectRatio for SVGs\n // instead of relyiing on fullWidth / fullHeight, because\n // those values might be rounded and not so accurate.\n aspectRatio?: number;\n };\n\n /**\n * className applied to the wrapper element if one is used.\n */\n className?: string;\n\n /**\n * css width\n */\n displayWidth?: number | string;\n\n /**\n * css height\n */\n displayHeight?: number | string;\n\n /**\n * css min-width\n */\n displayMinWidth?: number | string;\n\n /**\n * css min-height\n */\n displayMinHeight?: number | string;\n\n /**\n * css max-width\n */\n displayMaxWidth?: number | string;\n\n /**\n * css max-height\n */\n displayMaxHeight?: number | string;\n\n /**\n * For variable quality formats like jpg, the quality from 0 to 100\n */\n quality?: number;\n\n /**\n * ImageLoader to use for loading different dimensions of the image.\n * If none specified, will not attempt to load different dimensions.\n */\n loader?: \"plasmic\" | ImageLoader;\n\n /**\n * Style applied to the wrapper element. objectFit and objectPosition\n * rules are applied to the img element.\n */\n style?: React.CSSProperties;\n\n /**\n * Ref for the img element. The normal <PlasmicImg ref={...} />\n * prop gives the root element instead, which may be the img element\n * or a wrapper element\n */\n imgRef?: React.Ref<HTMLImageElement>;\n}\n\nexport const PlasmicImg = React.forwardRef(function PlasmicImg(\n props: PlasmicImgProps,\n outerRef: React.Ref<HTMLElement>\n) {\n let {\n src,\n className,\n displayWidth,\n displayHeight,\n displayMinWidth,\n displayMinHeight,\n displayMaxWidth,\n displayMaxHeight,\n quality,\n loader,\n imgRef,\n style,\n loading,\n ...rest\n } = props;\n\n const imgProps = Object.assign({}, rest, {\n // Default loading to \"lazy\" if not specified (which is different from the\n // html img, which defaults to eager!)\n loading: loading ?? \"lazy\",\n });\n\n const { fullWidth, fullHeight, aspectRatio } =\n typeof src === \"string\" || !src\n ? { fullWidth: undefined, fullHeight: undefined, aspectRatio: undefined }\n : src;\n const srcStr = src ? (typeof src === \"string\" ? src : src.src) : \"\";\n\n // Assume external image if either dimension is null and use usual <img>\n if (fullHeight == null || fullWidth == null) {\n return (\n <img\n src={srcStr}\n className={className}\n style={style}\n {...imgProps}\n loading={loading}\n ref={mergeRefs(imgRef, outerRef) as any}\n />\n );\n }\n\n if (\n isSvg(srcStr) &&\n (displayHeight == null || displayHeight === \"auto\") &&\n (displayWidth == null || displayWidth === \"auto\")\n ) {\n displayWidth = \"100%\";\n }\n\n if (\n fullWidth &&\n fullHeight &&\n (!displayWidth || displayWidth === \"auto\") &&\n !!getPixelLength(displayHeight)\n ) {\n // If there's a pixel length specified for displayHeight but not displayWidth,\n // then we can derive the pixel length for displayWidth. Having an explicit\n // displayWidth makes this a fixed-size image, which makes it possible for us to\n // generate better markup!\n if (!isSvg(srcStr)) {\n // We shouldn't do it for SVGs though, because `fullWidth` and\n // `fullHeight` might have rounded values so the final\n // `displayWidth` could differ by 1px or so.\n displayWidth = (getPixelLength(displayHeight)! * fullWidth) / fullHeight;\n }\n }\n\n let spacerWidth = fullWidth;\n let spacerHeight = fullHeight;\n if (aspectRatio && isFinite(aspectRatio) && isSvg(srcStr)) {\n // For SVGs, fullWidth and fullHeight can be rounded values, which would\n // cause some discrepancy between the actual aspect ratio and the aspect\n // ratio from those values. So, for those cases, we set large width / height\n // values to get a more precise ratio from the spacer.\n spacerWidth = DEFAULT_SVG_WIDTH;\n spacerHeight = Math.round(spacerWidth / aspectRatio);\n }\n\n const { sizes, widthDescs } = getWidths(displayWidth, fullWidth, {\n minWidth: displayMinWidth,\n });\n const imageLoader = getImageLoader(loader);\n const spacerSvg = `<svg width=\"${spacerWidth}\" height=\"${spacerHeight}\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"/>`;\n const spacerSvgBase64 =\n typeof window === \"undefined\"\n ? Buffer.from(spacerSvg).toString(\"base64\")\n : window.btoa(spacerSvg);\n\n let wrapperStyle: CSSProperties = { ...(style || {}) };\n let spacerStyle: CSSProperties = pick(\n style || {},\n \"objectFit\",\n \"objectPosition\"\n );\n\n if (displayWidth != null && displayWidth !== \"auto\") {\n // If width is set, set it on the wrapper along with min/max width\n // and just use `width: 100%` on the spacer\n spacerStyle.width = \"100%\";\n wrapperStyle.width = displayWidth;\n wrapperStyle.minWidth = displayMinWidth;\n wrapperStyle.maxWidth = displayMaxWidth;\n } else {\n // Otherwise, we want auto sizing from the spacer, so set width there.\n //\n // But if we have min/max width, it should be set in the wrapper and it\n // can be percentage values (and we add corresponding min/max width to\n // 100% in the spacer). In general it ends up with the correct effect,\n // but some edge cases might make `min-width: 100%` shrink the image more\n // than it should.\n spacerStyle.width = displayWidth;\n wrapperStyle.width = \"auto\";\n if (displayMinWidth) {\n spacerStyle.minWidth = \"100%\";\n wrapperStyle.minWidth = displayMinWidth;\n }\n if (displayMaxWidth != null && displayMaxWidth !== \"none\") {\n spacerStyle.maxWidth = \"100%\";\n wrapperStyle.maxWidth = displayMaxWidth;\n }\n }\n\n if (displayHeight != null && displayHeight !== \"auto\") {\n spacerStyle.height = \"100%\";\n wrapperStyle.height = displayHeight;\n wrapperStyle.minHeight = displayMinHeight;\n wrapperStyle.maxHeight = displayMaxHeight;\n } else {\n spacerStyle.height = displayHeight;\n wrapperStyle.height = \"auto\";\n if (displayMinHeight) {\n spacerStyle.minHeight = \"100%\";\n wrapperStyle.minHeight = displayMinHeight;\n }\n if (displayMaxHeight != null && displayMaxHeight !== \"none\") {\n spacerStyle.maxHeight = \"100%\";\n wrapperStyle.maxHeight = displayMaxHeight;\n }\n }\n\n return (\n <div\n className={classNames(className, \"__wab_img-wrapper\")}\n ref={outerRef as any}\n style={wrapperStyle}\n >\n <img\n alt=\"\"\n aria-hidden\n className=\"__wab_img-spacer-svg\"\n src={`data:image/svg+xml;base64,${spacerSvgBase64}`}\n style={spacerStyle}\n />\n {makePicture({\n imageLoader,\n widthDescs,\n sizes,\n src: srcStr,\n quality,\n ref: imgRef,\n style: style ? pick(style, \"objectFit\", \"objectPosition\") : undefined,\n imgProps,\n className: \"__wab_img\",\n })}\n </div>\n );\n});\n\nfunction makePicture(opts: {\n imageLoader?: ImageLoader;\n widthDescs: WidthDesc[];\n sizes?: string;\n src: string;\n quality?: number;\n style?: React.CSSProperties;\n className?: string;\n imgProps: ImgTagProps;\n ref?: React.Ref<HTMLImageElement>;\n}) {\n // If imageLoader is undefined, then this renders to just a normal\n // <img />. Else it will render to a <picture> with a <source> for\n // webp, and srcSet/sizes set according to width requirements.\n const {\n imageLoader,\n widthDescs,\n src,\n quality,\n style,\n className,\n sizes,\n imgProps,\n ref,\n } = opts;\n return (\n <picture className=\"__wab_picture\">\n {imageLoader && imageLoader.supportsUrl(src) && (\n <source\n type=\"image/webp\"\n srcSet={widthDescs\n .map(\n (wd) =>\n `${imageLoader.transformUrl({\n src,\n quality,\n width: wd.width,\n format: \"webp\",\n })} ${wd.desc}`\n )\n .join(\", \")}\n />\n )}\n <img\n {...imgProps}\n ref={ref}\n className={className}\n decoding=\"async\"\n src={\n imageLoader && imageLoader.supportsUrl(src)\n ? imageLoader.transformUrl({\n src,\n quality,\n width: widthDescs[widthDescs.length - 1].width,\n })\n : src\n }\n srcSet={\n imageLoader && imageLoader.supportsUrl(src)\n ? widthDescs\n .map(\n (wd) =>\n `${imageLoader.transformUrl({\n src,\n quality,\n width: wd.width,\n })} ${wd.desc}`\n )\n .join(\", \")\n : undefined\n }\n sizes={imageLoader && imageLoader.supportsUrl(src) ? sizes : undefined}\n style={{\n ...(style ? pick(style, \"objectFit\", \"objectPosition\") : {}),\n width: 0,\n height: 0,\n }}\n />\n </picture>\n );\n}\n\nconst DEFAULT_SVG_WIDTH = 10000;\n\nfunction isSvg(src: string) {\n return src.endsWith(\".svg\") || src.startsWith(\"data:image/svg\");\n}\n\ninterface WidthDesc {\n width?: number;\n desc: string;\n}\n\nfunction getClosestPresetSize(width: number, fullWidth: number) {\n const nextBiggerIndex =\n ALL_SIZES.findIndex((w) => w >= width) ?? ALL_SIZES.length - 1;\n const nextBigger = ALL_SIZES[nextBiggerIndex];\n if (nextBigger >= fullWidth) {\n // If the requested width is larger than the fullWidth,\n // we just use the original width instead. It's impossible\n // to make an image bigger than fullWidth!\n return undefined;\n } else if (\n nextBiggerIndex + 1 < ALL_SIZES.length &&\n fullWidth <= ALL_SIZES[nextBiggerIndex + 1]\n ) {\n // If the fullWidth is just between nextBigger and the one after that,\n // then also might as well just use the original size (so, width is 30,\n // nextBigger is 32, then we just use the original as long as fullWidth is\n // less than 48)\n return undefined;\n }\n\n return nextBigger;\n}\n\n/**\n * Computes the appropriate srcSet and sizes to use\n */\nfunction getWidths(\n width: number | string | undefined,\n fullWidth: number,\n extra?: { minWidth: string | number | undefined }\n): { sizes: string | undefined; widthDescs: WidthDesc[] } {\n const minWidth = extra?.minWidth;\n const pixelWidth = getPixelLength(width);\n const pixelMinWidth = getPixelLength(minWidth);\n if (pixelWidth != null && (!minWidth || pixelMinWidth != null)) {\n // If there's an exact width, then we just need to display it at 1x and 2x density\n return {\n widthDescs: [\n {\n width: getClosestPresetSize(\n Math.max(pixelWidth, pixelMinWidth ?? 0),\n fullWidth\n ),\n desc: \"1x\",\n },\n {\n width: getClosestPresetSize(\n Math.max(pixelWidth, pixelMinWidth ?? 0) * 2,\n fullWidth\n ),\n desc: \"2x\",\n },\n ],\n sizes: undefined,\n };\n }\n // Otherwise we don't know what sizes we'll end up, so we just cap it at\n // device width. TODO: do better!\n const usefulSizes = DEVICE_SIZES.filter(\n (size) => !fullWidth || size < fullWidth\n );\n if (!!fullWidth && usefulSizes.length === 0) {\n // image fullWidth is smaller than all device sizes. So all we can do\n // is offer 1x\n return {\n widthDescs: [\n {\n width: getClosestPresetSize(fullWidth, fullWidth),\n desc: \"1x\",\n },\n ],\n sizes: undefined,\n };\n }\n return {\n widthDescs: usefulSizes.map((size) => ({\n width: getClosestPresetSize(size, fullWidth),\n // If this is the last (buggest) useful width, but it is\n // still within the bounds set by DEVICE_SIZES, then just\n // use the original, unresized image. This means if we match\n // the largest size, we use unresized and best quality image.\n // We only do this, though, if fullWidth is \"reasonable\" --\n // smaller than the largest size we would consider.\n // i === usefulSizes.length - 1 &&\n // fullWidth < DEVICE_SIZES[DEVICE_SIZES.length - 1]\n // ? undefined\n // : size,\n desc: `${size}w`,\n })),\n sizes: \"100vw\",\n };\n}\n\nfunction getPixelLength(length: number | string | undefined) {\n if (length == null || length == \"\") {\n return undefined;\n }\n\n if (typeof length === \"number\") {\n return length;\n }\n\n const parsed = parseNumeric(length);\n if (parsed && (!parsed.units || parsed.units === \"px\")) {\n return parsed.num;\n }\n\n return undefined;\n}\n\nfunction parseNumeric(val: string) {\n // Parse strings like \"30\", \"30px\", \"30%\", \"30px /* blah blah */\"\n const res = val.match(\n /^\\s*(-?(?:\\d+\\.\\d*|\\d*\\.\\d+|\\d+))\\s*([a-z]*|%)\\s*(?:\\/\\*.*)?$/i\n );\n if (res == null) {\n return undefined;\n }\n const num = res[1];\n const units = res[2];\n return { num: +num, units };\n}\n\nfunction getImageLoader(loader: \"plasmic\" | ImageLoader | undefined) {\n if (loader == null) {\n return undefined;\n } else if (loader === \"plasmic\") {\n return PLASMIC_IMAGE_LOADER;\n } else {\n return loader;\n }\n}\n\nconst PLASMIC_IMAGE_LOADER: ImageLoader = {\n supportsUrl: (src) => {\n return src.startsWith(\"https://img.plasmic.app\") && !isSvg(src);\n },\n transformUrl: (opts) => {\n const params = [\n opts.width ? `w=${opts.width}` : undefined,\n `q=${opts.quality ?? 75}`,\n opts.format ? `f=${opts.format}` : undefined,\n ].filter((x) => !!x);\n return `${opts.src}?${params.join(\"&\")}`;\n },\n};\n"],"names":["React"],"mappings":";;;;;AAAA;;;AAwBA;AACA;AACA,IAAM,SAAS,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACtD,IAAM,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACnE,IAAM,SAAS,mCAAO,SAAS,GAAK,YAAY,CAAC,CAAC;IA+ErC,UAAU,GAAGA,cAAK,CAAC,UAAU,CAAC,SAAS,UAAU,CAC5D,KAAsB,EACtB,QAAgC;IAG9B,IAAA,GAAG,GAcD,KAAK,IAdJ,EACH,SAAS,GAaP,KAAK,UAbE,EACT,YAAY,GAYV,KAAK,aAZK,EACZ,aAAa,GAWX,KAAK,cAXM,EACb,eAAe,GAUb,KAAK,gBAVQ,EACf,gBAAgB,GASd,KAAK,iBATS,EAChB,eAAe,GAQb,KAAK,gBARQ,EACf,gBAAgB,GAOd,KAAK,iBAPS,EAChB,OAAO,GAML,KAAK,QANA,EACP,MAAM,GAKJ,KAAK,OALD,EACN,MAAM,GAIJ,KAAK,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IACxC,WAAW,EAAE,UAAC,GAAG;QACf,OAAO,GAAG,CAAC,UAAU,CAAC,yBAAyB,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;KACjE;IACD,YAAY,EAAE,UAAC,IAAI;;QACjB,IAAM,MAAM,GAAG;YACb,IAAI,CAAC,KAAK,GAAG,OAAK,IAAI,CAAC,KAAO,GAAG,SAAS;YAC1C,QAAK,MAAA,IAAI,CAAC,OAAO,mCAAI,EAAE,CAAE;YACzB,IAAI,CAAC,MAAM,GAAG,OAAK,IAAI,CAAC,MAAQ,GAAG,SAAS;SAC7C,CAAC,MAAM,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,CAAC,GAAA,CAAC,CAAC;QACrB,OAAU,IAAI,CAAC,GAAG,SAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAG,CAAC;KAC1C;CACF;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { ComponentMeta, ComponentStory } from "@storybook/react";
2
2
  import React from "react";
3
3
  import "../styles/plasmic.css";
4
- export declare const Base: ComponentStory<React.ForwardRefExoticComponent<import("../render/PlasmicImg").PlasmicImgProps & React.RefAttributes<HTMLImageElement>>>;
5
- declare const _default: ComponentMeta<React.ForwardRefExoticComponent<import("../render/PlasmicImg").PlasmicImgProps & React.RefAttributes<HTMLImageElement>>>;
4
+ export declare const Base: ComponentStory<React.ForwardRefExoticComponent<import("../render/PlasmicImg").PlasmicImgProps & React.RefAttributes<HTMLElement>>>;
5
+ declare const _default: ComponentMeta<React.ForwardRefExoticComponent<import("../render/PlasmicImg").PlasmicImgProps & React.RefAttributes<HTMLElement>>>;
6
6
  export default _default;