@plasmicapp/react-web 0.2.320 → 0.2.321
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 +8 -0
- package/dist/index.cjs.js +5 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/react-web.esm.js +5 -2
- package/dist/react-web.esm.js.map +1 -1
- package/package.json +4 -4
- package/skinny/dist/render/PlasmicImg/index.js +5 -2
- package/skinny/dist/render/PlasmicImg/index.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicapp/react-web",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.321",
|
|
4
4
|
"description": "plasmic library for rendering in the presentational style",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -87,9 +87,9 @@
|
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"@plasmicapp/auth-react": "0.0.20",
|
|
90
|
-
"@plasmicapp/data-sources": "0.1.
|
|
90
|
+
"@plasmicapp/data-sources": "0.1.149",
|
|
91
91
|
"@plasmicapp/data-sources-context": "0.1.21",
|
|
92
|
-
"@plasmicapp/host": "1.0.
|
|
92
|
+
"@plasmicapp/host": "1.0.191",
|
|
93
93
|
"@plasmicapp/loader-splits": "1.0.56",
|
|
94
94
|
"@plasmicapp/prepass": "1.0.14",
|
|
95
95
|
"@plasmicapp/query": "0.1.78",
|
|
@@ -157,5 +157,5 @@
|
|
|
157
157
|
"react": ">=16.8.0",
|
|
158
158
|
"react-dom": ">=16.8.0"
|
|
159
159
|
},
|
|
160
|
-
"gitHead": "
|
|
160
|
+
"gitHead": "df264a9098a27ee0323639e37204ec0dc58ba9f2"
|
|
161
161
|
}
|
|
@@ -299,14 +299,17 @@ function getImageLoader(loader) {
|
|
|
299
299
|
return loader;
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
|
+
function isInternalKey(src) {
|
|
303
|
+
return /^([a-f0-9]{32})\..{1,16}$/i.test(src);
|
|
304
|
+
}
|
|
302
305
|
var PLASMIC_IMAGE_LOADER = {
|
|
303
306
|
supportsUrl: function (src) {
|
|
304
|
-
return src.startsWith("http") && !isSvg(src);
|
|
307
|
+
return (src.startsWith("http") || isInternalKey(src)) && !isSvg(src);
|
|
305
308
|
},
|
|
306
309
|
transformUrl: function (opts) {
|
|
307
310
|
var _a;
|
|
308
311
|
var params = [
|
|
309
|
-
"src=".concat(opts.src),
|
|
312
|
+
"src=".concat(encodeURIComponent(opts.src)),
|
|
310
313
|
opts.width ? "w=".concat(opts.width) : undefined,
|
|
311
314
|
"q=".concat((_a = opts.quality) !== null && _a !== void 0 ? _a : 75),
|
|
312
315
|
opts.format ? "f=".concat(opts.format) : undefined,
|
|
@@ -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, { 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\nconst IMG_OPTIMIZER_HOST = \"https://img.plasmic.app\";\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:\n | string\n | {\n src: string;\n height: number;\n width: number;\n blurDataURL?: string;\n };\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 } = !src\n ? { fullWidth: undefined, fullHeight: undefined, aspectRatio: undefined }\n : typeof src === \"string\"\n ? getImageSizeData(\n getPixelLength(props.width),\n getPixelLength(props.height)\n )\n : src;\n const srcStr = src\n ? typeof src === \"string\"\n ? src\n : typeof src.src === \"string\"\n ? src.src\n : src.src.src\n : \"\";\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 let computedDisplayWidth = displayWidth;\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 computedDisplayWidth =\n (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(computedDisplayWidth, 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 // if btoa exists, use btoa, as it works in browser and in\n // cloudflare edge workers. For node, use Buffer.from().\n typeof globalThis.btoa === \"function\"\n ? globalThis.btoa(spacerSvg)\n : Buffer.from(spacerSvg).toString(\"base64\");\n\n let wrapperStyle: CSSProperties = { ...(style || {}) };\n let spacerStyle: CSSProperties = {\n ...pick(style || {}, \"objectFit\", \"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 // Rely on the styles set by `classname` on the wrapper:\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 // Rely on min-width set by `classname` on the wrapper:\n // wrapperStyle.minWidth = displayMinWidth;\n }\n if (displayMaxWidth != null && displayMaxWidth !== \"none\") {\n spacerStyle.maxWidth = \"100%\";\n // Rely on max-width set by `classname` on the wrapper:\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 getImageSizeData(\n width: number | undefined,\n height: number | undefined\n) {\n const aspectRatio = width && height ? width / height : undefined;\n return {\n fullWidth: width,\n fullHeight: height,\n aspectRatio: aspectRatio && isFinite(aspectRatio) ? aspectRatio : undefined,\n };\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(\"http\") && !isSvg(src);\n },\n transformUrl: (opts) => {\n const params = [\n `src=${opts.src}`,\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 `${IMG_OPTIMIZER_HOST}/img-optimizer/v1/img?${params.join(\"&\")}`;\n },\n};\n"],"names":["React"],"mappings":";;;;;AAAA;;AAEG;AAsBH,IAAM,kBAAkB,GAAG,yBAAyB,CAAC;AAErD;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,GAAO,aAAA,CAAA,aAAA,CAAA,EAAA,EAAA,MAAA,CAAA,SAAS,CAAK,EAAA,KAAA,CAAA,EAAA,MAAA,CAAA,YAAY,SAAC,CAAC;AAsF3C,IAAM,UAAU,GAAGA,cAAK,CAAC,UAAU,CAAC,SAAS,UAAU,CAC5D,KAAsB,EACtB,QAAgC,EAAA;AAG9B,IAAA,IAAA,GAAG,GAcD,KAAK,CAAA,GAdJ,EACH,SAAS,GAaP,KAAK,CAAA,SAbE,EACT,YAAY,GAYV,KAAK,aAZK,EACZ,aAAa,GAWX,KAAK,CAXM,aAAA,EACb,eAAe,GAUb,KAAK,CAVQ,eAAA,EACf,gBAAgB,GASd,KAAK,CATS,gBAAA,EAChB,eAAe,GAQb,KAAK,CARQ,eAAA,EACf,gBAAgB,GAOd,KAAK,CAAA,gBAPS,EAChB,OAAO,GAML,KAAK,CAAA,OANA,EACP,MAAM,GAKJ,KAAK,CAAA,MALD,EACN,MAAM,GAIJ,KAAK,CAAA,MAJD,EACN,KAAK,GAGH,KAAK,CAHF,KAAA,EACL,OA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C,GAAG,CAAE;AACjB,YAAA,IAAI,CAAC,KAAK,GAAG,IAAA,CAAA,MAAA,CAAK,IAAI,CAAC,KAAK,CAAE,GAAG,SAAS;AAC1C,YAAA,IAAA,CAAA,MAAA,CAAK,MAAA,IAAI,CAAC,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,EAAE,CAAE;AACzB,YAAA,IAAI,CAAC,MAAM,GAAG,IAAA,CAAA,MAAA,CAAK,IAAI,CAAC,MAAM,CAAE,GAAG,SAAS;AAC7C,SAAA,CAAC,MAAM,CAAC,UAAC,CAAC,EAAK,EAAA,OAAA,CAAC,CAAC,CAAC,CAAA,EAAA,CAAC,CAAC;QACrB,OAAO,EAAA,CAAA,MAAA,CAAG,kBAAkB,EAAA,wBAAA,CAAA,CAAA,MAAA,CAAyB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAE,CAAC;KACzE;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\nconst IMG_OPTIMIZER_HOST = \"https://img.plasmic.app\";\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:\n | string\n | {\n src: string;\n height: number;\n width: number;\n blurDataURL?: string;\n };\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 } = !src\n ? { fullWidth: undefined, fullHeight: undefined, aspectRatio: undefined }\n : typeof src === \"string\"\n ? getImageSizeData(\n getPixelLength(props.width),\n getPixelLength(props.height)\n )\n : src;\n const srcStr = src\n ? typeof src === \"string\"\n ? src\n : typeof src.src === \"string\"\n ? src.src\n : src.src.src\n : \"\";\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 let computedDisplayWidth = displayWidth;\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 computedDisplayWidth =\n (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(computedDisplayWidth, 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 // if btoa exists, use btoa, as it works in browser and in\n // cloudflare edge workers. For node, use Buffer.from().\n typeof globalThis.btoa === \"function\"\n ? globalThis.btoa(spacerSvg)\n : Buffer.from(spacerSvg).toString(\"base64\");\n\n let wrapperStyle: CSSProperties = { ...(style || {}) };\n let spacerStyle: CSSProperties = {\n ...pick(style || {}, \"objectFit\", \"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 // Rely on the styles set by `classname` on the wrapper:\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 // Rely on min-width set by `classname` on the wrapper:\n // wrapperStyle.minWidth = displayMinWidth;\n }\n if (displayMaxWidth != null && displayMaxWidth !== \"none\") {\n spacerStyle.maxWidth = \"100%\";\n // Rely on max-width set by `classname` on the wrapper:\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 getImageSizeData(\n width: number | undefined,\n height: number | undefined\n) {\n const aspectRatio = width && height ? width / height : undefined;\n return {\n fullWidth: width,\n fullHeight: height,\n aspectRatio: aspectRatio && isFinite(aspectRatio) ? aspectRatio : undefined,\n };\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\nfunction isInternalKey(src: string) {\n return /^([a-f0-9]{32})\\..{1,16}$/i.test(src);\n}\n\nconst PLASMIC_IMAGE_LOADER: ImageLoader = {\n supportsUrl: (src) => {\n return (src.startsWith(\"http\") || isInternalKey(src)) && !isSvg(src);\n },\n transformUrl: (opts) => {\n const params = [\n `src=${encodeURIComponent(opts.src)}`,\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 `${IMG_OPTIMIZER_HOST}/img-optimizer/v1/img?${params.join(\"&\")}`;\n },\n};\n"],"names":["React"],"mappings":";;;;;AAAA;;AAEG;AAsBH,IAAM,kBAAkB,GAAG,yBAAyB,CAAC;AAErD;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,GAAO,aAAA,CAAA,aAAA,CAAA,EAAA,EAAA,MAAA,CAAA,SAAS,CAAK,EAAA,KAAA,CAAA,EAAA,MAAA,CAAA,YAAY,SAAC,CAAC;AAsF3C,IAAM,UAAU,GAAGA,cAAK,CAAC,UAAU,CAAC,SAAS,UAAU,CAC5D,KAAsB,EACtB,QAAgC,EAAA;AAG9B,IAAA,IAAA,GAAG,GAcD,KAAK,CAAA,GAdJ,EACH,SAAS,GAaP,KAAK,CAAA,SAbE,EACT,YAAY,GAYV,KAAK,aAZK,EACZ,aAAa,GAWX,KAAK,CAXM,aAAA,EACb,eAAe,GAUb,KAAK,CAVQ,eAAA,EACf,gBAAgB,GASd,KAAK,CATS,gBAAA,EAChB,eAAe,GAQb,KAAK,CARQ,eAAA,EACf,gBAAgB,GAOd,KAAK,CAAA,gBAPS,EAChB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