@plasmicapp/react-web 0.2.201 → 0.2.203
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 +1926 -1925
- package/dist/auth/PlasmicPageGuard.d.ts +11 -11
- package/dist/common.d.ts +10 -10
- package/dist/data-sources/index.d.ts +1 -1
- package/dist/host/index.d.ts +1 -1
- package/dist/index-common.d.ts +18 -18
- package/dist/index-skinny.d.ts +1 -1
- package/dist/index.cjs.js +3495 -3495
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/plume/button/index.d.ts +36 -36
- package/dist/plume/checkbox/index.d.ts +47 -47
- package/dist/plume/collection-utils.d.ts +191 -191
- package/dist/plume/collection-utils.spec.d.ts +1 -1
- package/dist/plume/menu/context.d.ts +8 -8
- package/dist/plume/menu/index.d.ts +3 -3
- package/dist/plume/menu/menu-group.d.ts +23 -23
- package/dist/plume/menu/menu-item.d.ts +23 -23
- package/dist/plume/menu/menu.d.ts +39 -39
- package/dist/plume/menu-button/DropdownMenu.d.ts +34 -34
- package/dist/plume/menu-button/index.d.ts +2 -2
- package/dist/plume/menu-button/menu-button.d.ts +72 -72
- package/dist/plume/menu-button/menu-trigger.d.ts +21 -21
- package/dist/plume/plume-utils.d.ts +41 -41
- package/dist/plume/props-utils.d.ts +15 -15
- package/dist/plume/select/context.d.ts +3 -3
- package/dist/plume/select/index.d.ts +4 -4
- package/dist/plume/select/select-option-group.d.ts +23 -23
- package/dist/plume/select/select-option.d.ts +23 -23
- package/dist/plume/select/select.d.ts +111 -111
- package/dist/plume/switch/index.d.ts +39 -39
- package/dist/plume/text-input/index.d.ts +36 -36
- package/dist/plume/triggered-overlay/context.d.ts +14 -14
- package/dist/plume/triggered-overlay/index.d.ts +2 -2
- package/dist/plume/triggered-overlay/triggered-overlay.d.ts +24 -24
- package/dist/query/index.d.ts +1 -1
- package/dist/react-utils.d.ts +21 -21
- package/dist/react-utils.spec.d.ts +1 -1
- package/dist/react-web.esm.js +3496 -3496
- package/dist/react-web.esm.js.map +1 -1
- package/dist/render/PlasmicHead/index.d.ts +37 -37
- package/dist/render/PlasmicIcon.d.ts +4 -4
- package/dist/render/PlasmicImg/index.d.ts +81 -81
- package/dist/render/PlasmicLink.d.ts +2 -2
- package/dist/render/PlasmicSlot.d.ts +11 -11
- package/dist/render/Stack.d.ts +51 -51
- package/dist/render/elements.d.ts +74 -74
- package/dist/render/global-variants.d.ts +1 -1
- package/dist/render/screen-variants.d.ts +5 -5
- package/dist/render/ssr.d.ts +21 -21
- package/dist/render/translation.d.ts +19 -19
- package/dist/render/triggers.d.ts +39 -39
- package/dist/states/errors.d.ts +13 -13
- package/dist/states/graph.d.ts +25 -25
- package/dist/states/helpers.d.ts +43 -43
- package/dist/states/index.d.ts +4 -4
- package/dist/states/types.d.ts +66 -66
- package/dist/states/valtio.d.ts +10 -10
- package/dist/states/vanilla.d.ts +3 -3
- package/dist/stories/PlasmicImg.stories.d.ts +6 -6
- package/dist/stories/UseDollarState.stories.d.ts +78 -78
- package/lib/data-sources/index.d.ts +1 -1
- package/lib/host/index.d.ts +1 -1
- package/lib/query/index.d.ts +1 -1
- package/package.json +8 -9
- package/skinny/dist/auth/PlasmicPageGuard.d.ts +11 -11
- package/skinny/dist/{collection-utils-0967eaf0.js → collection-utils-2f28e4eb.js} +297 -297
- package/skinny/dist/{collection-utils-0967eaf0.js.map → collection-utils-2f28e4eb.js.map} +1 -1
- package/skinny/dist/{common-9d6d348d.js → common-ed411407.js} +130 -130
- package/skinny/dist/{common-9d6d348d.js.map → common-ed411407.js.map} +1 -1
- package/skinny/dist/common.d.ts +10 -10
- package/skinny/dist/data-sources/index.d.ts +1 -1
- package/skinny/dist/host/index.d.ts +1 -1
- package/skinny/dist/index-common.d.ts +18 -18
- package/skinny/dist/index-skinny.d.ts +1 -1
- package/skinny/dist/index.d.ts +11 -11
- package/skinny/dist/index.js +1559 -1559
- package/skinny/dist/index.js.map +1 -1
- package/skinny/dist/plume/button/index.d.ts +36 -36
- package/skinny/dist/plume/button/index.js +21 -21
- package/skinny/dist/plume/checkbox/index.d.ts +47 -47
- package/skinny/dist/plume/checkbox/index.js +64 -64
- package/skinny/dist/plume/collection-utils.d.ts +191 -191
- package/skinny/dist/plume/collection-utils.spec.d.ts +1 -1
- package/skinny/dist/plume/menu/context.d.ts +8 -8
- package/skinny/dist/plume/menu/index.d.ts +3 -3
- package/skinny/dist/plume/menu/index.js +165 -165
- package/skinny/dist/plume/menu/menu-group.d.ts +23 -23
- package/skinny/dist/plume/menu/menu-item.d.ts +23 -23
- package/skinny/dist/plume/menu/menu.d.ts +39 -39
- package/skinny/dist/plume/menu-button/DropdownMenu.d.ts +34 -34
- package/skinny/dist/plume/menu-button/index.d.ts +2 -2
- package/skinny/dist/plume/menu-button/index.js +125 -125
- package/skinny/dist/plume/menu-button/index.js.map +1 -1
- package/skinny/dist/plume/menu-button/menu-button.d.ts +72 -72
- package/skinny/dist/plume/menu-button/menu-trigger.d.ts +21 -21
- package/skinny/dist/plume/plume-utils.d.ts +41 -41
- package/skinny/dist/plume/props-utils.d.ts +15 -15
- package/skinny/dist/plume/select/context.d.ts +3 -3
- package/skinny/dist/plume/select/index.d.ts +4 -4
- package/skinny/dist/plume/select/index.js +250 -250
- package/skinny/dist/plume/select/index.js.map +1 -1
- package/skinny/dist/plume/select/select-option-group.d.ts +23 -23
- package/skinny/dist/plume/select/select-option.d.ts +23 -23
- package/skinny/dist/plume/select/select.d.ts +111 -111
- package/skinny/dist/plume/switch/index.d.ts +39 -39
- package/skinny/dist/plume/switch/index.js +61 -61
- package/skinny/dist/plume/text-input/index.d.ts +36 -36
- package/skinny/dist/plume/text-input/index.js +45 -45
- package/skinny/dist/plume/triggered-overlay/context.d.ts +14 -14
- package/skinny/dist/plume/triggered-overlay/index.d.ts +2 -2
- package/skinny/dist/plume/triggered-overlay/index.js +100 -100
- package/skinny/dist/plume/triggered-overlay/index.js.map +1 -1
- package/skinny/dist/plume/triggered-overlay/triggered-overlay.d.ts +24 -24
- package/skinny/dist/{plume-utils-7d68bcc0.js → plume-utils-e699cd08.js} +30 -30
- package/skinny/dist/{plume-utils-7d68bcc0.js.map → plume-utils-e699cd08.js.map} +1 -1
- package/skinny/dist/{props-utils-9f9c761a.js → props-utils-9d74371f.js} +4 -4
- package/skinny/dist/{props-utils-9f9c761a.js.map → props-utils-9d74371f.js.map} +1 -1
- package/skinny/dist/query/index.d.ts +1 -1
- package/skinny/dist/{react-utils-ee4e03ba.js → react-utils-5ff031c2.js} +195 -195
- package/skinny/dist/{react-utils-ee4e03ba.js.map → react-utils-5ff031c2.js.map} +1 -1
- package/skinny/dist/react-utils.d.ts +21 -21
- package/skinny/dist/react-utils.spec.d.ts +1 -1
- package/skinny/dist/render/PlasmicHead/index.d.ts +37 -37
- package/skinny/dist/render/PlasmicHead/index.js +54 -54
- package/skinny/dist/render/PlasmicIcon.d.ts +4 -4
- package/skinny/dist/render/PlasmicImg/index.d.ts +81 -81
- package/skinny/dist/render/PlasmicImg/index.js +297 -297
- package/skinny/dist/render/PlasmicLink.d.ts +2 -2
- package/skinny/dist/render/PlasmicSlot.d.ts +11 -11
- package/skinny/dist/render/Stack.d.ts +51 -51
- package/skinny/dist/render/elements.d.ts +74 -74
- package/skinny/dist/render/global-variants.d.ts +1 -1
- package/skinny/dist/render/screen-variants.d.ts +5 -5
- package/skinny/dist/render/ssr.d.ts +21 -21
- package/skinny/dist/render/translation.d.ts +19 -19
- package/skinny/dist/render/triggers.d.ts +39 -39
- package/skinny/dist/{ssr-c9834f50.js → ssr-8625df04.js} +107 -107
- package/skinny/dist/{ssr-c9834f50.js.map → ssr-8625df04.js.map} +1 -1
- package/skinny/dist/states/errors.d.ts +13 -13
- package/skinny/dist/states/graph.d.ts +25 -25
- package/skinny/dist/states/helpers.d.ts +43 -43
- package/skinny/dist/states/index.d.ts +4 -4
- package/skinny/dist/states/types.d.ts +66 -66
- package/skinny/dist/states/valtio.d.ts +10 -10
- package/skinny/dist/states/vanilla.d.ts +3 -3
- package/skinny/dist/stories/PlasmicImg.stories.d.ts +6 -6
- package/skinny/dist/stories/UseDollarState.stories.d.ts +78 -78
|
@@ -1,303 +1,303 @@
|
|
|
1
|
-
import { d as __spreadArray, e as __read, c as __rest, b as __assign, p as pick } from '../../common-
|
|
1
|
+
import { d as __spreadArray, e as __read, c as __rest, b as __assign, p as pick } from '../../common-ed411407.js';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import React__default from 'react';
|
|
4
|
-
import { d as mergeRefs } from '../../react-utils-
|
|
4
|
+
import { d as mergeRefs } from '../../react-utils-5ff031c2.js';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* Responsive `<img/>` replacement, based on `next/image`
|
|
8
|
-
*/
|
|
9
|
-
// Default image sizes to snap to
|
|
10
|
-
// TODO: make this configurable?
|
|
11
|
-
var IMG_SIZES = [16, 32, 48, 64, 96, 128, 256, 384];
|
|
12
|
-
var DEVICE_SIZES = [640, 750, 828, 1080, 1200, 1920, 2048, 3840];
|
|
13
|
-
var ALL_SIZES = __spreadArray(__spreadArray([], __read(IMG_SIZES), false), __read(DEVICE_SIZES), false);
|
|
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
|
-
});
|
|
21
|
-
var _a = typeof src === "string" || !src
|
|
22
|
-
? { fullWidth: undefined, fullHeight: undefined, aspectRatio: undefined }
|
|
23
|
-
: src, fullWidth = _a.fullWidth, fullHeight = _a.fullHeight, aspectRatio = _a.aspectRatio;
|
|
24
|
-
var srcStr = src
|
|
25
|
-
? typeof src === "string"
|
|
26
|
-
? src
|
|
27
|
-
: typeof src.src === "string"
|
|
28
|
-
? src.src
|
|
29
|
-
: src.src.src
|
|
30
|
-
: "";
|
|
31
|
-
// Assume external image if either dimension is null and use usual <img>
|
|
32
|
-
if (fullHeight == null || fullWidth == null) {
|
|
33
|
-
return (React__default.createElement("img", __assign({ src: srcStr, className: className, style: style }, imgProps, { loading: loading, ref: mergeRefs(imgRef, outerRef) })));
|
|
34
|
-
}
|
|
35
|
-
if (isSvg(srcStr) &&
|
|
36
|
-
(displayHeight == null || displayHeight === "auto") &&
|
|
37
|
-
(displayWidth == null || displayWidth === "auto")) {
|
|
38
|
-
displayWidth = "100%";
|
|
39
|
-
}
|
|
40
|
-
var computedDisplayWidth = displayWidth;
|
|
41
|
-
if (fullWidth &&
|
|
42
|
-
fullHeight &&
|
|
43
|
-
(!displayWidth || displayWidth === "auto") &&
|
|
44
|
-
!!getPixelLength(displayHeight)) {
|
|
45
|
-
// If there's a pixel length specified for displayHeight but not displayWidth,
|
|
46
|
-
// then we can derive the pixel length for displayWidth. Having an explicit
|
|
47
|
-
// displayWidth makes this a fixed-size image, which makes it possible for us to
|
|
48
|
-
// generate better markup!
|
|
49
|
-
if (!isSvg(srcStr)) {
|
|
50
|
-
// We shouldn't do it for SVGs though, because `fullWidth` and
|
|
51
|
-
// `fullHeight` might have rounded values so the final
|
|
52
|
-
// `displayWidth` could differ by 1px or so.
|
|
53
|
-
computedDisplayWidth =
|
|
54
|
-
(getPixelLength(displayHeight) * fullWidth) / fullHeight;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
var spacerWidth = fullWidth;
|
|
58
|
-
var spacerHeight = fullHeight;
|
|
59
|
-
if (aspectRatio && isFinite(aspectRatio) && isSvg(srcStr)) {
|
|
60
|
-
// For SVGs, fullWidth and fullHeight can be rounded values, which would
|
|
61
|
-
// cause some discrepancy between the actual aspect ratio and the aspect
|
|
62
|
-
// ratio from those values. So, for those cases, we set large width / height
|
|
63
|
-
// values to get a more precise ratio from the spacer.
|
|
64
|
-
spacerWidth = DEFAULT_SVG_WIDTH;
|
|
65
|
-
spacerHeight = Math.round(spacerWidth / aspectRatio);
|
|
66
|
-
}
|
|
67
|
-
var _b = getWidths(computedDisplayWidth, fullWidth, {
|
|
68
|
-
minWidth: displayMinWidth
|
|
69
|
-
}), sizes = _b.sizes, widthDescs = _b.widthDescs;
|
|
70
|
-
var imageLoader = getImageLoader(loader);
|
|
71
|
-
var spacerSvg = "<svg width=\"".concat(spacerWidth, "\" height=\"").concat(spacerHeight, "\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"/>");
|
|
72
|
-
var spacerSvgBase64 = typeof window === "undefined"
|
|
73
|
-
? Buffer.from(spacerSvg).toString("base64")
|
|
74
|
-
: window.btoa(spacerSvg);
|
|
75
|
-
var wrapperStyle = __assign({}, (style || {}));
|
|
76
|
-
var spacerStyle = __assign({}, pick(style || {}, "objectFit", "objectPosition"));
|
|
77
|
-
if (displayWidth != null && displayWidth !== "auto") {
|
|
78
|
-
// If width is set, set it on the wrapper along with min/max width
|
|
79
|
-
// and just use `width: 100%` on the spacer
|
|
80
|
-
spacerStyle.width = "100%";
|
|
81
|
-
// Rely on the styles set by `classname` on the wrapper:
|
|
82
|
-
// wrapperStyle.width = displayWidth;
|
|
83
|
-
// wrapperStyle.minWidth = displayMinWidth;
|
|
84
|
-
// wrapperStyle.maxWidth = displayMaxWidth;
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
// Otherwise, we want auto sizing from the spacer, so set width there.
|
|
88
|
-
//
|
|
89
|
-
// But if we have min/max width, it should be set in the wrapper and it
|
|
90
|
-
// can be percentage values (and we add corresponding min/max width to
|
|
91
|
-
// 100% in the spacer). In general it ends up with the correct effect,
|
|
92
|
-
// but some edge cases might make `min-width: 100%` shrink the image more
|
|
93
|
-
// than it should.
|
|
94
|
-
spacerStyle.width = displayWidth;
|
|
95
|
-
wrapperStyle.width = "auto";
|
|
96
|
-
if (displayMinWidth) {
|
|
97
|
-
spacerStyle.minWidth = "100%";
|
|
98
|
-
// Rely on min-width set by `classname` on the wrapper:
|
|
99
|
-
// wrapperStyle.minWidth = displayMinWidth;
|
|
100
|
-
}
|
|
101
|
-
if (displayMaxWidth != null && displayMaxWidth !== "none") {
|
|
102
|
-
spacerStyle.maxWidth = "100%";
|
|
103
|
-
// Rely on max-width set by `classname` on the wrapper:
|
|
104
|
-
// wrapperStyle.maxWidth = displayMaxWidth;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
if (displayHeight != null && displayHeight !== "auto") {
|
|
108
|
-
spacerStyle.height = "100%";
|
|
109
|
-
// wrapperStyle.height = displayHeight;
|
|
110
|
-
// wrapperStyle.minHeight = displayMinHeight;
|
|
111
|
-
// wrapperStyle.maxHeight = displayMaxHeight;
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
spacerStyle.height = displayHeight;
|
|
115
|
-
wrapperStyle.height = "auto";
|
|
116
|
-
if (displayMinHeight) {
|
|
117
|
-
spacerStyle.minHeight = "100%";
|
|
118
|
-
// wrapperStyle.minHeight = displayMinHeight;
|
|
119
|
-
}
|
|
120
|
-
if (displayMaxHeight != null && displayMaxHeight !== "none") {
|
|
121
|
-
spacerStyle.maxHeight = "100%";
|
|
122
|
-
// wrapperStyle.maxHeight = displayMaxHeight;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return (React__default.createElement("div", { className: classNames(className, "__wab_img-wrapper"), ref: outerRef, style: wrapperStyle },
|
|
126
|
-
React__default.createElement("img", { alt: "", "aria-hidden": true, className: "__wab_img-spacer-svg", src: "data:image/svg+xml;base64,".concat(spacerSvgBase64), style: spacerStyle }),
|
|
127
|
-
makePicture({
|
|
128
|
-
imageLoader: imageLoader,
|
|
129
|
-
widthDescs: widthDescs,
|
|
130
|
-
sizes: sizes,
|
|
131
|
-
src: srcStr,
|
|
132
|
-
quality: quality,
|
|
133
|
-
ref: imgRef,
|
|
134
|
-
style: style ? pick(style, "objectFit", "objectPosition") : undefined,
|
|
135
|
-
imgProps: imgProps,
|
|
136
|
-
className: "__wab_img"
|
|
137
|
-
})));
|
|
138
|
-
});
|
|
139
|
-
function makePicture(opts) {
|
|
140
|
-
// If imageLoader is undefined, then this renders to just a normal
|
|
141
|
-
// <img />. Else it will render to a <picture> with a <source> for
|
|
142
|
-
// webp, and srcSet/sizes set according to width requirements.
|
|
143
|
-
var imageLoader = opts.imageLoader, widthDescs = opts.widthDescs, src = opts.src, quality = opts.quality, style = opts.style, className = opts.className, sizes = opts.sizes, imgProps = opts.imgProps, ref = opts.ref;
|
|
144
|
-
return (React__default.createElement("picture", { className: "__wab_picture" },
|
|
145
|
-
imageLoader && imageLoader.supportsUrl(src) && (React__default.createElement("source", { type: "image/webp", srcSet: widthDescs
|
|
146
|
-
.map(function (wd) {
|
|
147
|
-
return "".concat(imageLoader.transformUrl({
|
|
148
|
-
src: src,
|
|
149
|
-
quality: quality,
|
|
150
|
-
width: wd.width,
|
|
151
|
-
format: "webp"
|
|
152
|
-
}), " ").concat(wd.desc);
|
|
153
|
-
})
|
|
154
|
-
.join(", ") })),
|
|
155
|
-
React__default.createElement("img", __assign({}, imgProps, { ref: ref, className: className, decoding: "async", src: imageLoader && imageLoader.supportsUrl(src)
|
|
156
|
-
? imageLoader.transformUrl({
|
|
157
|
-
src: src,
|
|
158
|
-
quality: quality,
|
|
159
|
-
width: widthDescs[widthDescs.length - 1].width
|
|
160
|
-
})
|
|
161
|
-
: src, srcSet: imageLoader && imageLoader.supportsUrl(src)
|
|
162
|
-
? widthDescs
|
|
163
|
-
.map(function (wd) {
|
|
164
|
-
return "".concat(imageLoader.transformUrl({
|
|
165
|
-
src: src,
|
|
166
|
-
quality: quality,
|
|
167
|
-
width: wd.width
|
|
168
|
-
}), " ").concat(wd.desc);
|
|
169
|
-
})
|
|
170
|
-
.join(", ")
|
|
171
|
-
: undefined, sizes: imageLoader && imageLoader.supportsUrl(src) ? sizes : undefined, style: __assign(__assign({}, (style ? pick(style, "objectFit", "objectPosition") : {})), { width: 0, height: 0 }) }))));
|
|
172
|
-
}
|
|
173
|
-
var DEFAULT_SVG_WIDTH = 10000;
|
|
174
|
-
function isSvg(src) {
|
|
175
|
-
return src.endsWith(".svg") || src.startsWith("data:image/svg");
|
|
176
|
-
}
|
|
177
|
-
function getClosestPresetSize(width, fullWidth) {
|
|
178
|
-
var _a;
|
|
179
|
-
var nextBiggerIndex = (_a = ALL_SIZES.findIndex(function (w) { return w >= width; })) !== null && _a !== void 0 ? _a : ALL_SIZES.length - 1;
|
|
180
|
-
var nextBigger = ALL_SIZES[nextBiggerIndex];
|
|
181
|
-
if (nextBigger >= fullWidth) {
|
|
182
|
-
// If the requested width is larger than the fullWidth,
|
|
183
|
-
// we just use the original width instead. It's impossible
|
|
184
|
-
// to make an image bigger than fullWidth!
|
|
185
|
-
return undefined;
|
|
186
|
-
}
|
|
187
|
-
else if (nextBiggerIndex + 1 < ALL_SIZES.length &&
|
|
188
|
-
fullWidth <= ALL_SIZES[nextBiggerIndex + 1]) {
|
|
189
|
-
// If the fullWidth is just between nextBigger and the one after that,
|
|
190
|
-
// then also might as well just use the original size (so, width is 30,
|
|
191
|
-
// nextBigger is 32, then we just use the original as long as fullWidth is
|
|
192
|
-
// less than 48)
|
|
193
|
-
return undefined;
|
|
194
|
-
}
|
|
195
|
-
return nextBigger;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Computes the appropriate srcSet and sizes to use
|
|
199
|
-
*/
|
|
200
|
-
function getWidths(width, fullWidth, extra) {
|
|
201
|
-
var minWidth = extra === null || extra === void 0 ? void 0 : extra.minWidth;
|
|
202
|
-
var pixelWidth = getPixelLength(width);
|
|
203
|
-
var pixelMinWidth = getPixelLength(minWidth);
|
|
204
|
-
if (pixelWidth != null && (!minWidth || pixelMinWidth != null)) {
|
|
205
|
-
// If there's an exact width, then we just need to display it at 1x and 2x density
|
|
206
|
-
return {
|
|
207
|
-
widthDescs: [
|
|
208
|
-
{
|
|
209
|
-
width: getClosestPresetSize(Math.max(pixelWidth, pixelMinWidth !== null && pixelMinWidth !== void 0 ? pixelMinWidth : 0), fullWidth),
|
|
210
|
-
desc: "1x"
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
width: getClosestPresetSize(Math.max(pixelWidth, pixelMinWidth !== null && pixelMinWidth !== void 0 ? pixelMinWidth : 0) * 2, fullWidth),
|
|
214
|
-
desc: "2x"
|
|
215
|
-
},
|
|
216
|
-
],
|
|
217
|
-
sizes: undefined
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
// Otherwise we don't know what sizes we'll end up, so we just cap it at
|
|
221
|
-
// device width. TODO: do better!
|
|
222
|
-
var usefulSizes = DEVICE_SIZES.filter(function (size) { return !fullWidth || size < fullWidth; });
|
|
223
|
-
if (!!fullWidth && usefulSizes.length === 0) {
|
|
224
|
-
// image fullWidth is smaller than all device sizes. So all we can do
|
|
225
|
-
// is offer 1x
|
|
226
|
-
return {
|
|
227
|
-
widthDescs: [
|
|
228
|
-
{
|
|
229
|
-
width: getClosestPresetSize(fullWidth, fullWidth),
|
|
230
|
-
desc: "1x"
|
|
231
|
-
},
|
|
232
|
-
],
|
|
233
|
-
sizes: undefined
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
return {
|
|
237
|
-
widthDescs: usefulSizes.map(function (size) { return ({
|
|
238
|
-
width: getClosestPresetSize(size, fullWidth),
|
|
239
|
-
// If this is the last (buggest) useful width, but it is
|
|
240
|
-
// still within the bounds set by DEVICE_SIZES, then just
|
|
241
|
-
// use the original, unresized image. This means if we match
|
|
242
|
-
// the largest size, we use unresized and best quality image.
|
|
243
|
-
// We only do this, though, if fullWidth is "reasonable" --
|
|
244
|
-
// smaller than the largest size we would consider.
|
|
245
|
-
// i === usefulSizes.length - 1 &&
|
|
246
|
-
// fullWidth < DEVICE_SIZES[DEVICE_SIZES.length - 1]
|
|
247
|
-
// ? undefined
|
|
248
|
-
// : size,
|
|
249
|
-
desc: "".concat(size, "w")
|
|
250
|
-
}); }),
|
|
251
|
-
sizes: "100vw"
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
function getPixelLength(length) {
|
|
255
|
-
if (length == null || length == "") {
|
|
256
|
-
return undefined;
|
|
257
|
-
}
|
|
258
|
-
if (typeof length === "number") {
|
|
259
|
-
return length;
|
|
260
|
-
}
|
|
261
|
-
var parsed = parseNumeric(length);
|
|
262
|
-
if (parsed && (!parsed.units || parsed.units === "px")) {
|
|
263
|
-
return parsed.num;
|
|
264
|
-
}
|
|
265
|
-
return undefined;
|
|
266
|
-
}
|
|
267
|
-
function parseNumeric(val) {
|
|
268
|
-
// Parse strings like "30", "30px", "30%", "30px /* blah blah */"
|
|
269
|
-
var res = val.match(/^\s*(-?(?:\d+\.\d*|\d*\.\d+|\d+))\s*([a-z]*|%)\s*(?:\/\*.*)?$/i);
|
|
270
|
-
if (res == null) {
|
|
271
|
-
return undefined;
|
|
272
|
-
}
|
|
273
|
-
var num = res[1];
|
|
274
|
-
var units = res[2];
|
|
275
|
-
return { num: +num, units: units };
|
|
276
|
-
}
|
|
277
|
-
function getImageLoader(loader) {
|
|
278
|
-
if (loader == null) {
|
|
279
|
-
return undefined;
|
|
280
|
-
}
|
|
281
|
-
else if (loader === "plasmic") {
|
|
282
|
-
return PLASMIC_IMAGE_LOADER;
|
|
283
|
-
}
|
|
284
|
-
else {
|
|
285
|
-
return loader;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
var PLASMIC_IMAGE_LOADER = {
|
|
289
|
-
supportsUrl: function (src) {
|
|
290
|
-
return src.startsWith("https://img.plasmic.app") && !isSvg(src);
|
|
291
|
-
},
|
|
292
|
-
transformUrl: function (opts) {
|
|
293
|
-
var _a;
|
|
294
|
-
var params = [
|
|
295
|
-
opts.width ? "w=".concat(opts.width) : undefined,
|
|
296
|
-
"q=".concat((_a = opts.quality) !== null && _a !== void 0 ? _a : 75),
|
|
297
|
-
opts.format ? "f=".concat(opts.format) : undefined,
|
|
298
|
-
].filter(function (x) { return !!x; });
|
|
299
|
-
return "".concat(opts.src, "?").concat(params.join("&"));
|
|
300
|
-
}
|
|
6
|
+
/**
|
|
7
|
+
* Responsive `<img/>` replacement, based on `next/image`
|
|
8
|
+
*/
|
|
9
|
+
// Default image sizes to snap to
|
|
10
|
+
// TODO: make this configurable?
|
|
11
|
+
var IMG_SIZES = [16, 32, 48, 64, 96, 128, 256, 384];
|
|
12
|
+
var DEVICE_SIZES = [640, 750, 828, 1080, 1200, 1920, 2048, 3840];
|
|
13
|
+
var ALL_SIZES = __spreadArray(__spreadArray([], __read(IMG_SIZES), false), __read(DEVICE_SIZES), false);
|
|
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
|
+
});
|
|
21
|
+
var _a = typeof src === "string" || !src
|
|
22
|
+
? { fullWidth: undefined, fullHeight: undefined, aspectRatio: undefined }
|
|
23
|
+
: src, fullWidth = _a.fullWidth, fullHeight = _a.fullHeight, aspectRatio = _a.aspectRatio;
|
|
24
|
+
var srcStr = src
|
|
25
|
+
? typeof src === "string"
|
|
26
|
+
? src
|
|
27
|
+
: typeof src.src === "string"
|
|
28
|
+
? src.src
|
|
29
|
+
: src.src.src
|
|
30
|
+
: "";
|
|
31
|
+
// Assume external image if either dimension is null and use usual <img>
|
|
32
|
+
if (fullHeight == null || fullWidth == null) {
|
|
33
|
+
return (React__default.createElement("img", __assign({ src: srcStr, className: className, style: style }, imgProps, { loading: loading, ref: mergeRefs(imgRef, outerRef) })));
|
|
34
|
+
}
|
|
35
|
+
if (isSvg(srcStr) &&
|
|
36
|
+
(displayHeight == null || displayHeight === "auto") &&
|
|
37
|
+
(displayWidth == null || displayWidth === "auto")) {
|
|
38
|
+
displayWidth = "100%";
|
|
39
|
+
}
|
|
40
|
+
var computedDisplayWidth = displayWidth;
|
|
41
|
+
if (fullWidth &&
|
|
42
|
+
fullHeight &&
|
|
43
|
+
(!displayWidth || displayWidth === "auto") &&
|
|
44
|
+
!!getPixelLength(displayHeight)) {
|
|
45
|
+
// If there's a pixel length specified for displayHeight but not displayWidth,
|
|
46
|
+
// then we can derive the pixel length for displayWidth. Having an explicit
|
|
47
|
+
// displayWidth makes this a fixed-size image, which makes it possible for us to
|
|
48
|
+
// generate better markup!
|
|
49
|
+
if (!isSvg(srcStr)) {
|
|
50
|
+
// We shouldn't do it for SVGs though, because `fullWidth` and
|
|
51
|
+
// `fullHeight` might have rounded values so the final
|
|
52
|
+
// `displayWidth` could differ by 1px or so.
|
|
53
|
+
computedDisplayWidth =
|
|
54
|
+
(getPixelLength(displayHeight) * fullWidth) / fullHeight;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
var spacerWidth = fullWidth;
|
|
58
|
+
var spacerHeight = fullHeight;
|
|
59
|
+
if (aspectRatio && isFinite(aspectRatio) && isSvg(srcStr)) {
|
|
60
|
+
// For SVGs, fullWidth and fullHeight can be rounded values, which would
|
|
61
|
+
// cause some discrepancy between the actual aspect ratio and the aspect
|
|
62
|
+
// ratio from those values. So, for those cases, we set large width / height
|
|
63
|
+
// values to get a more precise ratio from the spacer.
|
|
64
|
+
spacerWidth = DEFAULT_SVG_WIDTH;
|
|
65
|
+
spacerHeight = Math.round(spacerWidth / aspectRatio);
|
|
66
|
+
}
|
|
67
|
+
var _b = getWidths(computedDisplayWidth, fullWidth, {
|
|
68
|
+
minWidth: displayMinWidth,
|
|
69
|
+
}), sizes = _b.sizes, widthDescs = _b.widthDescs;
|
|
70
|
+
var imageLoader = getImageLoader(loader);
|
|
71
|
+
var spacerSvg = "<svg width=\"".concat(spacerWidth, "\" height=\"").concat(spacerHeight, "\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"/>");
|
|
72
|
+
var spacerSvgBase64 = typeof window === "undefined"
|
|
73
|
+
? Buffer.from(spacerSvg).toString("base64")
|
|
74
|
+
: window.btoa(spacerSvg);
|
|
75
|
+
var wrapperStyle = __assign({}, (style || {}));
|
|
76
|
+
var spacerStyle = __assign({}, pick(style || {}, "objectFit", "objectPosition"));
|
|
77
|
+
if (displayWidth != null && displayWidth !== "auto") {
|
|
78
|
+
// If width is set, set it on the wrapper along with min/max width
|
|
79
|
+
// and just use `width: 100%` on the spacer
|
|
80
|
+
spacerStyle.width = "100%";
|
|
81
|
+
// Rely on the styles set by `classname` on the wrapper:
|
|
82
|
+
// wrapperStyle.width = displayWidth;
|
|
83
|
+
// wrapperStyle.minWidth = displayMinWidth;
|
|
84
|
+
// wrapperStyle.maxWidth = displayMaxWidth;
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
// Otherwise, we want auto sizing from the spacer, so set width there.
|
|
88
|
+
//
|
|
89
|
+
// But if we have min/max width, it should be set in the wrapper and it
|
|
90
|
+
// can be percentage values (and we add corresponding min/max width to
|
|
91
|
+
// 100% in the spacer). In general it ends up with the correct effect,
|
|
92
|
+
// but some edge cases might make `min-width: 100%` shrink the image more
|
|
93
|
+
// than it should.
|
|
94
|
+
spacerStyle.width = displayWidth;
|
|
95
|
+
wrapperStyle.width = "auto";
|
|
96
|
+
if (displayMinWidth) {
|
|
97
|
+
spacerStyle.minWidth = "100%";
|
|
98
|
+
// Rely on min-width set by `classname` on the wrapper:
|
|
99
|
+
// wrapperStyle.minWidth = displayMinWidth;
|
|
100
|
+
}
|
|
101
|
+
if (displayMaxWidth != null && displayMaxWidth !== "none") {
|
|
102
|
+
spacerStyle.maxWidth = "100%";
|
|
103
|
+
// Rely on max-width set by `classname` on the wrapper:
|
|
104
|
+
// wrapperStyle.maxWidth = displayMaxWidth;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (displayHeight != null && displayHeight !== "auto") {
|
|
108
|
+
spacerStyle.height = "100%";
|
|
109
|
+
// wrapperStyle.height = displayHeight;
|
|
110
|
+
// wrapperStyle.minHeight = displayMinHeight;
|
|
111
|
+
// wrapperStyle.maxHeight = displayMaxHeight;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
spacerStyle.height = displayHeight;
|
|
115
|
+
wrapperStyle.height = "auto";
|
|
116
|
+
if (displayMinHeight) {
|
|
117
|
+
spacerStyle.minHeight = "100%";
|
|
118
|
+
// wrapperStyle.minHeight = displayMinHeight;
|
|
119
|
+
}
|
|
120
|
+
if (displayMaxHeight != null && displayMaxHeight !== "none") {
|
|
121
|
+
spacerStyle.maxHeight = "100%";
|
|
122
|
+
// wrapperStyle.maxHeight = displayMaxHeight;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return (React__default.createElement("div", { className: classNames(className, "__wab_img-wrapper"), ref: outerRef, style: wrapperStyle },
|
|
126
|
+
React__default.createElement("img", { alt: "", "aria-hidden": true, className: "__wab_img-spacer-svg", src: "data:image/svg+xml;base64,".concat(spacerSvgBase64), style: spacerStyle }),
|
|
127
|
+
makePicture({
|
|
128
|
+
imageLoader: imageLoader,
|
|
129
|
+
widthDescs: widthDescs,
|
|
130
|
+
sizes: sizes,
|
|
131
|
+
src: srcStr,
|
|
132
|
+
quality: quality,
|
|
133
|
+
ref: imgRef,
|
|
134
|
+
style: style ? pick(style, "objectFit", "objectPosition") : undefined,
|
|
135
|
+
imgProps: imgProps,
|
|
136
|
+
className: "__wab_img",
|
|
137
|
+
})));
|
|
138
|
+
});
|
|
139
|
+
function makePicture(opts) {
|
|
140
|
+
// If imageLoader is undefined, then this renders to just a normal
|
|
141
|
+
// <img />. Else it will render to a <picture> with a <source> for
|
|
142
|
+
// webp, and srcSet/sizes set according to width requirements.
|
|
143
|
+
var imageLoader = opts.imageLoader, widthDescs = opts.widthDescs, src = opts.src, quality = opts.quality, style = opts.style, className = opts.className, sizes = opts.sizes, imgProps = opts.imgProps, ref = opts.ref;
|
|
144
|
+
return (React__default.createElement("picture", { className: "__wab_picture" },
|
|
145
|
+
imageLoader && imageLoader.supportsUrl(src) && (React__default.createElement("source", { type: "image/webp", srcSet: widthDescs
|
|
146
|
+
.map(function (wd) {
|
|
147
|
+
return "".concat(imageLoader.transformUrl({
|
|
148
|
+
src: src,
|
|
149
|
+
quality: quality,
|
|
150
|
+
width: wd.width,
|
|
151
|
+
format: "webp",
|
|
152
|
+
}), " ").concat(wd.desc);
|
|
153
|
+
})
|
|
154
|
+
.join(", ") })),
|
|
155
|
+
React__default.createElement("img", __assign({}, imgProps, { ref: ref, className: className, decoding: "async", src: imageLoader && imageLoader.supportsUrl(src)
|
|
156
|
+
? imageLoader.transformUrl({
|
|
157
|
+
src: src,
|
|
158
|
+
quality: quality,
|
|
159
|
+
width: widthDescs[widthDescs.length - 1].width,
|
|
160
|
+
})
|
|
161
|
+
: src, srcSet: imageLoader && imageLoader.supportsUrl(src)
|
|
162
|
+
? widthDescs
|
|
163
|
+
.map(function (wd) {
|
|
164
|
+
return "".concat(imageLoader.transformUrl({
|
|
165
|
+
src: src,
|
|
166
|
+
quality: quality,
|
|
167
|
+
width: wd.width,
|
|
168
|
+
}), " ").concat(wd.desc);
|
|
169
|
+
})
|
|
170
|
+
.join(", ")
|
|
171
|
+
: undefined, sizes: imageLoader && imageLoader.supportsUrl(src) ? sizes : undefined, style: __assign(__assign({}, (style ? pick(style, "objectFit", "objectPosition") : {})), { width: 0, height: 0 }) }))));
|
|
172
|
+
}
|
|
173
|
+
var DEFAULT_SVG_WIDTH = 10000;
|
|
174
|
+
function isSvg(src) {
|
|
175
|
+
return src.endsWith(".svg") || src.startsWith("data:image/svg");
|
|
176
|
+
}
|
|
177
|
+
function getClosestPresetSize(width, fullWidth) {
|
|
178
|
+
var _a;
|
|
179
|
+
var nextBiggerIndex = (_a = ALL_SIZES.findIndex(function (w) { return w >= width; })) !== null && _a !== void 0 ? _a : ALL_SIZES.length - 1;
|
|
180
|
+
var nextBigger = ALL_SIZES[nextBiggerIndex];
|
|
181
|
+
if (nextBigger >= fullWidth) {
|
|
182
|
+
// If the requested width is larger than the fullWidth,
|
|
183
|
+
// we just use the original width instead. It's impossible
|
|
184
|
+
// to make an image bigger than fullWidth!
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
else if (nextBiggerIndex + 1 < ALL_SIZES.length &&
|
|
188
|
+
fullWidth <= ALL_SIZES[nextBiggerIndex + 1]) {
|
|
189
|
+
// If the fullWidth is just between nextBigger and the one after that,
|
|
190
|
+
// then also might as well just use the original size (so, width is 30,
|
|
191
|
+
// nextBigger is 32, then we just use the original as long as fullWidth is
|
|
192
|
+
// less than 48)
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
return nextBigger;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Computes the appropriate srcSet and sizes to use
|
|
199
|
+
*/
|
|
200
|
+
function getWidths(width, fullWidth, extra) {
|
|
201
|
+
var minWidth = extra === null || extra === void 0 ? void 0 : extra.minWidth;
|
|
202
|
+
var pixelWidth = getPixelLength(width);
|
|
203
|
+
var pixelMinWidth = getPixelLength(minWidth);
|
|
204
|
+
if (pixelWidth != null && (!minWidth || pixelMinWidth != null)) {
|
|
205
|
+
// If there's an exact width, then we just need to display it at 1x and 2x density
|
|
206
|
+
return {
|
|
207
|
+
widthDescs: [
|
|
208
|
+
{
|
|
209
|
+
width: getClosestPresetSize(Math.max(pixelWidth, pixelMinWidth !== null && pixelMinWidth !== void 0 ? pixelMinWidth : 0), fullWidth),
|
|
210
|
+
desc: "1x",
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
width: getClosestPresetSize(Math.max(pixelWidth, pixelMinWidth !== null && pixelMinWidth !== void 0 ? pixelMinWidth : 0) * 2, fullWidth),
|
|
214
|
+
desc: "2x",
|
|
215
|
+
},
|
|
216
|
+
],
|
|
217
|
+
sizes: undefined,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
// Otherwise we don't know what sizes we'll end up, so we just cap it at
|
|
221
|
+
// device width. TODO: do better!
|
|
222
|
+
var usefulSizes = DEVICE_SIZES.filter(function (size) { return !fullWidth || size < fullWidth; });
|
|
223
|
+
if (!!fullWidth && usefulSizes.length === 0) {
|
|
224
|
+
// image fullWidth is smaller than all device sizes. So all we can do
|
|
225
|
+
// is offer 1x
|
|
226
|
+
return {
|
|
227
|
+
widthDescs: [
|
|
228
|
+
{
|
|
229
|
+
width: getClosestPresetSize(fullWidth, fullWidth),
|
|
230
|
+
desc: "1x",
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
sizes: undefined,
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
return {
|
|
237
|
+
widthDescs: usefulSizes.map(function (size) { return ({
|
|
238
|
+
width: getClosestPresetSize(size, fullWidth),
|
|
239
|
+
// If this is the last (buggest) useful width, but it is
|
|
240
|
+
// still within the bounds set by DEVICE_SIZES, then just
|
|
241
|
+
// use the original, unresized image. This means if we match
|
|
242
|
+
// the largest size, we use unresized and best quality image.
|
|
243
|
+
// We only do this, though, if fullWidth is "reasonable" --
|
|
244
|
+
// smaller than the largest size we would consider.
|
|
245
|
+
// i === usefulSizes.length - 1 &&
|
|
246
|
+
// fullWidth < DEVICE_SIZES[DEVICE_SIZES.length - 1]
|
|
247
|
+
// ? undefined
|
|
248
|
+
// : size,
|
|
249
|
+
desc: "".concat(size, "w"),
|
|
250
|
+
}); }),
|
|
251
|
+
sizes: "100vw",
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
function getPixelLength(length) {
|
|
255
|
+
if (length == null || length == "") {
|
|
256
|
+
return undefined;
|
|
257
|
+
}
|
|
258
|
+
if (typeof length === "number") {
|
|
259
|
+
return length;
|
|
260
|
+
}
|
|
261
|
+
var parsed = parseNumeric(length);
|
|
262
|
+
if (parsed && (!parsed.units || parsed.units === "px")) {
|
|
263
|
+
return parsed.num;
|
|
264
|
+
}
|
|
265
|
+
return undefined;
|
|
266
|
+
}
|
|
267
|
+
function parseNumeric(val) {
|
|
268
|
+
// Parse strings like "30", "30px", "30%", "30px /* blah blah */"
|
|
269
|
+
var res = val.match(/^\s*(-?(?:\d+\.\d*|\d*\.\d+|\d+))\s*([a-z]*|%)\s*(?:\/\*.*)?$/i);
|
|
270
|
+
if (res == null) {
|
|
271
|
+
return undefined;
|
|
272
|
+
}
|
|
273
|
+
var num = res[1];
|
|
274
|
+
var units = res[2];
|
|
275
|
+
return { num: +num, units: units };
|
|
276
|
+
}
|
|
277
|
+
function getImageLoader(loader) {
|
|
278
|
+
if (loader == null) {
|
|
279
|
+
return undefined;
|
|
280
|
+
}
|
|
281
|
+
else if (loader === "plasmic") {
|
|
282
|
+
return PLASMIC_IMAGE_LOADER;
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
return loader;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
var PLASMIC_IMAGE_LOADER = {
|
|
289
|
+
supportsUrl: function (src) {
|
|
290
|
+
return src.startsWith("https://img.plasmic.app") && !isSvg(src);
|
|
291
|
+
},
|
|
292
|
+
transformUrl: function (opts) {
|
|
293
|
+
var _a;
|
|
294
|
+
var params = [
|
|
295
|
+
opts.width ? "w=".concat(opts.width) : undefined,
|
|
296
|
+
"q=".concat((_a = opts.quality) !== null && _a !== void 0 ? _a : 75),
|
|
297
|
+
opts.format ? "f=".concat(opts.format) : undefined,
|
|
298
|
+
].filter(function (x) { return !!x; });
|
|
299
|
+
return "".concat(opts.src, "?").concat(params.join("&"));
|
|
300
|
+
},
|
|
301
301
|
};
|
|
302
302
|
|
|
303
303
|
export { PlasmicImg };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export declare const PlasmicLink: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<any>>;
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare const PlasmicLink: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<any>>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
export declare function PlasmicSlot<T extends keyof JSX.IntrinsicElements = "div">(props: React.ComponentProps<T> & {
|
|
3
|
-
as?: T;
|
|
4
|
-
defaultContents?: React.ReactNode;
|
|
5
|
-
value?: React.ReactNode;
|
|
6
|
-
}): JSX.Element | null;
|
|
7
|
-
export declare function renderPlasmicSlot<T extends keyof JSX.IntrinsicElements = "div">(opts: {
|
|
8
|
-
as?: T;
|
|
9
|
-
defaultContents?: React.ReactNode;
|
|
10
|
-
value?: React.ReactNode;
|
|
11
|
-
}): JSX.Element | null;
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export declare function PlasmicSlot<T extends keyof JSX.IntrinsicElements = "div">(props: React.ComponentProps<T> & {
|
|
3
|
+
as?: T;
|
|
4
|
+
defaultContents?: React.ReactNode;
|
|
5
|
+
value?: React.ReactNode;
|
|
6
|
+
}): JSX.Element | null;
|
|
7
|
+
export declare function renderPlasmicSlot<T extends keyof JSX.IntrinsicElements = "div">(opts: {
|
|
8
|
+
as?: T;
|
|
9
|
+
defaultContents?: React.ReactNode;
|
|
10
|
+
value?: React.ReactNode;
|
|
11
|
+
}): JSX.Element | null;
|