@wix/editor-react-components 1.2496.0 → 1.2497.0
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/site/components/Image3/component.js +479 -6
- package/dist/site/components/Logo/component.js +156 -1
- package/dist/site/components/Logo/css.css +15 -16
- package/dist/site/components/TransparentVideo/TransparentVideo.types.d.ts +2 -2
- package/dist/site/components/TransparentVideo/component.js +8 -7
- package/dist/site/components/TransparentVideo/css.css +5 -21
- package/dist/site/components/TransparentVideo/useTransparentVideo.d.ts +1 -1
- package/dist/site/components/VideoUpload/css.css +5 -13
- package/dist/site/components/chunks/Video.js +651 -12
- package/dist/site/components/chunks/fastdom.js +166 -0
- package/dist/site/components/chunks/index5.js +8 -4
- package/package.json +4 -4
- package/dist/site/components/chunks/Image.js +0 -159
- package/dist/site/components/chunks/customElementInit.js +0 -644
|
@@ -4,16 +4,101 @@ import { a as getDataAttributes, n as normalizeWixUri } from "../chunks/dataUtil
|
|
|
4
4
|
import { e as getTabIndexAttribute } from "../chunks/a11y.js";
|
|
5
5
|
import { L as Link } from "../chunks/Link.js";
|
|
6
6
|
import * as React from "react";
|
|
7
|
-
import { a as getData, g as getPlaceholder, S as STATIC_MEDIA_URL$
|
|
8
|
-
import {
|
|
7
|
+
import { a as getData, c as getFileExtension, d as fileType, b as alignTypes, f as fittingTypes, g as getPlaceholder, S as STATIC_MEDIA_URL$2 } from "../chunks/index5.js";
|
|
8
|
+
import { f as fastdom } from "../chunks/fastdom.js";
|
|
9
9
|
import { useService } from "@wix/services-manager-react";
|
|
10
10
|
import { R as RenderingContextDefinition } from "../chunks/index3.js";
|
|
11
|
+
const camelToKebab = (str) => str.replace(/[A-Z]+(?![^A-Z])|[A-Z]/g, (a, b) => (b ? "-" : "") + a.toLowerCase());
|
|
12
|
+
const CSS_NUMERIC_VALUES = {
|
|
13
|
+
columnCount: 1,
|
|
14
|
+
columns: 1,
|
|
15
|
+
fontWeight: 1,
|
|
16
|
+
lineHeight: 1,
|
|
17
|
+
opacity: 1,
|
|
18
|
+
zIndex: 1,
|
|
19
|
+
zoom: 1
|
|
20
|
+
};
|
|
21
|
+
const pick = (obj, props) => {
|
|
22
|
+
const propsArr = Array.isArray(props) ? props : [props];
|
|
23
|
+
return propsArr.reduce((subObj, prop) => {
|
|
24
|
+
const val = obj[prop];
|
|
25
|
+
return val !== void 0 ? Object.assign(subObj, { [prop]: val }) : subObj;
|
|
26
|
+
}, {});
|
|
27
|
+
};
|
|
28
|
+
const addDefaultUnitIfNeeded = (prop, value) => typeof value === "number" && !CSS_NUMERIC_VALUES[prop] ? `${value}px` : value.toString();
|
|
29
|
+
const setStyle = (node, styleProperties) => node && styleProperties && Object.keys(styleProperties).forEach((prop) => {
|
|
30
|
+
const styleProp = prop;
|
|
31
|
+
const propValue = styleProperties[styleProp];
|
|
32
|
+
if (propValue !== void 0) {
|
|
33
|
+
node.style[styleProp] = addDefaultUnitIfNeeded(styleProp, propValue);
|
|
34
|
+
} else {
|
|
35
|
+
node.style.removeProperty(styleProp);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
const getScreenHeight = (heightOverride) => heightOverride || document.documentElement.clientHeight || window.innerHeight || 0;
|
|
39
|
+
const getImageComputedProperties = (extendedImageInfo, envConsts, htmlTag) => {
|
|
40
|
+
if (!extendedImageInfo.targetWidth || !extendedImageInfo.targetHeight || !extendedImageInfo.imageData.uri) {
|
|
41
|
+
return { uri: "", css: {}, transformed: false };
|
|
42
|
+
}
|
|
43
|
+
const { imageData } = extendedImageInfo;
|
|
44
|
+
const fittingType = extendedImageInfo.displayMode || fittingTypes.SCALE_TO_FILL;
|
|
45
|
+
const imageOptions = Object.assign(pick(imageData, ["upscaleMethod"]), pick(extendedImageInfo, [
|
|
46
|
+
"filters",
|
|
47
|
+
"encoding",
|
|
48
|
+
"allowFullGIFTransformation"
|
|
49
|
+
]), extendedImageInfo.quality || imageData.quality, {
|
|
50
|
+
hasAnimation: (extendedImageInfo == null ? void 0 : extendedImageInfo.hasAnimation) || (imageData == null ? void 0 : imageData.hasAnimation)
|
|
51
|
+
});
|
|
52
|
+
const devicePixelRatioFromData = extendedImageInfo.imageData.devicePixelRatio || envConsts.devicePixelRatio;
|
|
53
|
+
const devicePixelRatio = getDevicePixelRatio$1(devicePixelRatioFromData);
|
|
54
|
+
const src = Object.assign(pick(imageData, ["width", "height", "crop", "name", "focalPoint"]), { id: imageData.uri });
|
|
55
|
+
const target = {
|
|
56
|
+
width: extendedImageInfo.targetWidth,
|
|
57
|
+
height: extendedImageInfo.targetHeight,
|
|
58
|
+
htmlTag,
|
|
59
|
+
pixelAspectRatio: devicePixelRatio,
|
|
60
|
+
alignment: extendedImageInfo.alignType || alignTypes.CENTER
|
|
61
|
+
};
|
|
62
|
+
const imageComputedProperties = getData(fittingType, src, target, imageOptions);
|
|
63
|
+
imageComputedProperties.uri = getMediaUrlByContext(imageComputedProperties.uri, envConsts.staticMediaUrl, envConsts.mediaRootUrl);
|
|
64
|
+
return imageComputedProperties;
|
|
65
|
+
};
|
|
66
|
+
const getMediaUrlByContext = (imageUri, staticMediaUrl, mediaRootUrl) => {
|
|
67
|
+
var _a;
|
|
68
|
+
const isExternalUrl = /(^https?)|(^data)|(^blob)|(^\/\/)/.test(imageUri);
|
|
69
|
+
if (isExternalUrl) {
|
|
70
|
+
return imageUri;
|
|
71
|
+
}
|
|
72
|
+
let path = `${staticMediaUrl}/`;
|
|
73
|
+
if (imageUri) {
|
|
74
|
+
if (/^micons\//.test(imageUri)) {
|
|
75
|
+
path = mediaRootUrl;
|
|
76
|
+
} else if (((_a = /[^.]+$/.exec(imageUri)) == null ? void 0 : _a[0]) === "ico") {
|
|
77
|
+
path = path.replace("media", "ficons");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return path + imageUri;
|
|
81
|
+
};
|
|
82
|
+
const getDevicePixelRatio$1 = (devicePixelRatio) => {
|
|
83
|
+
const queryParams = window.location.search.split("&").map((query) => query.split("="));
|
|
84
|
+
const devicePixelRatioQueryParam = queryParams.find((query) => {
|
|
85
|
+
var _a;
|
|
86
|
+
return (_a = query[0]) == null ? void 0 : _a.toLowerCase().includes("devicepixelratio");
|
|
87
|
+
});
|
|
88
|
+
const devicePixelRatioValueForceFromUrl = (devicePixelRatioQueryParam == null ? void 0 : devicePixelRatioQueryParam[1]) ? Number(devicePixelRatioQueryParam[1]) : null;
|
|
89
|
+
return devicePixelRatioValueForceFromUrl || devicePixelRatio || 1;
|
|
90
|
+
};
|
|
91
|
+
const getImageSrc = (imageNode) => imageNode.getAttribute("src");
|
|
92
|
+
const imageIsAnimated = (uri, hasAnimation) => getFileExtension(uri) === fileType.GIF || getFileExtension(uri) === fileType.WEBP && hasAnimation;
|
|
93
|
+
const getMediaSizeQueryString = (media) => {
|
|
94
|
+
return Object.entries(media).filter(([_, value]) => value || value === 0).map(([key, value]) => `(${camelToKebab(key)}: ${value}px)`).join(" and ");
|
|
95
|
+
};
|
|
11
96
|
const image = "image__iWj48";
|
|
12
97
|
const styles = {
|
|
13
98
|
image
|
|
14
99
|
};
|
|
15
|
-
const STATIC_MEDIA_URL = "https://static.wixstatic.com/media/";
|
|
16
|
-
const MEDIA_ROOT_URL = "https://static.wixstatic.com/";
|
|
100
|
+
const STATIC_MEDIA_URL$1 = "https://static.wixstatic.com/media/";
|
|
101
|
+
const MEDIA_ROOT_URL$1 = "https://static.wixstatic.com/";
|
|
17
102
|
function getURL(image2, targetSize) {
|
|
18
103
|
if (!image2.height || !image2.width) {
|
|
19
104
|
return "";
|
|
@@ -52,7 +137,7 @@ function getURL(image2, targetSize) {
|
|
|
52
137
|
devicePixelRatio
|
|
53
138
|
};
|
|
54
139
|
const { uri } = getData("fill", src, target, options);
|
|
55
|
-
return uri && getMediaUrlByContext(uri, STATIC_MEDIA_URL, MEDIA_ROOT_URL);
|
|
140
|
+
return uri && getMediaUrlByContext(uri, STATIC_MEDIA_URL$1, MEDIA_ROOT_URL$1);
|
|
56
141
|
}
|
|
57
142
|
const ImageNG = (props) => {
|
|
58
143
|
const { id, alt, sources, priority, decorative, role, dataset } = props;
|
|
@@ -84,6 +169,394 @@ const ImageNG = (props) => {
|
|
|
84
169
|
React.createElement("img", { ...priority === "high" ? { fetchpriority: "high" } : { loading: "lazy" }, ...decorative && { "aria-hidden": true }, src: fullSizeSrc, alt: decorative ? "" : alt, role, width: image2.width, height: image2.height })
|
|
85
170
|
);
|
|
86
171
|
};
|
|
172
|
+
const MOBILE_SAFE_ADDRESSBAR_HEIGHT = 80;
|
|
173
|
+
function getHeightOverride(height, mediaHeightOverrideType) {
|
|
174
|
+
return mediaHeightOverrideType === "fixed" || mediaHeightOverrideType === "viewport" ? document.documentElement.clientHeight + MOBILE_SAFE_ADDRESSBAR_HEIGHT : height;
|
|
175
|
+
}
|
|
176
|
+
function computeScaleOverrides(imageStyle, targetScale = 1) {
|
|
177
|
+
return targetScale !== 1 ? {
|
|
178
|
+
...imageStyle,
|
|
179
|
+
width: "100%",
|
|
180
|
+
height: "100%"
|
|
181
|
+
} : imageStyle;
|
|
182
|
+
}
|
|
183
|
+
function computeStyleOverrides(mediaHeightOverrideType, imageStyle, displayMode, targetScale, isResponsive) {
|
|
184
|
+
const styleWithScale = computeScaleOverrides(imageStyle, targetScale);
|
|
185
|
+
if (isResponsive) {
|
|
186
|
+
delete styleWithScale.height;
|
|
187
|
+
styleWithScale.width = "100%";
|
|
188
|
+
}
|
|
189
|
+
if (!mediaHeightOverrideType) {
|
|
190
|
+
return styleWithScale;
|
|
191
|
+
}
|
|
192
|
+
const style2 = { ...styleWithScale };
|
|
193
|
+
if (displayMode === "fill") {
|
|
194
|
+
style2.position = "absolute";
|
|
195
|
+
style2.top = "0";
|
|
196
|
+
} else if (displayMode === "fit") {
|
|
197
|
+
style2.height = "100%";
|
|
198
|
+
}
|
|
199
|
+
if (mediaHeightOverrideType === "fixed") {
|
|
200
|
+
style2["will-change"] = "transform";
|
|
201
|
+
}
|
|
202
|
+
if (style2.objectPosition) {
|
|
203
|
+
style2.objectPosition = imageStyle.objectPosition.replace(/(center|bottom)$/, "top");
|
|
204
|
+
}
|
|
205
|
+
return style2;
|
|
206
|
+
}
|
|
207
|
+
function getSourceSetsTargetHeightByEffect(sourceSets, offsetWidth, offsetHeight, screenHeight, services) {
|
|
208
|
+
const sourceSetsTargetHeights = {};
|
|
209
|
+
sourceSets.forEach(({ mediaQuery, scrollEffect }) => {
|
|
210
|
+
var _a;
|
|
211
|
+
sourceSetsTargetHeights[mediaQuery] = ((_a = services.getMediaDimensionsByEffect) == null ? void 0 : _a.call(services, scrollEffect, offsetWidth, offsetHeight, screenHeight).height) || offsetHeight;
|
|
212
|
+
});
|
|
213
|
+
return sourceSetsTargetHeights;
|
|
214
|
+
}
|
|
215
|
+
function computeSrcSets(measures, imageInfo, envConsts) {
|
|
216
|
+
const { sourceSets } = imageInfo;
|
|
217
|
+
if (!sourceSets || !sourceSets.length) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
const mediaToUri = {};
|
|
221
|
+
sourceSets.forEach(({ mediaQuery, crop, focalPoint }) => {
|
|
222
|
+
const imageInfoClone = {
|
|
223
|
+
...imageInfo,
|
|
224
|
+
targetHeight: (measures.sourceSetsTargetHeights || {})[mediaQuery] || 0,
|
|
225
|
+
imageData: {
|
|
226
|
+
...imageInfo.imageData,
|
|
227
|
+
crop,
|
|
228
|
+
focalPoint
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
const imageComputedProperties = getImageComputedProperties(imageInfoClone, envConsts, "img");
|
|
232
|
+
mediaToUri[mediaQuery] = imageComputedProperties.uri || "";
|
|
233
|
+
});
|
|
234
|
+
return mediaToUri;
|
|
235
|
+
}
|
|
236
|
+
function measure(id, measures, domNodes, { containerElm, bgEffect = "none", sourceSets }, services) {
|
|
237
|
+
var _a, _b;
|
|
238
|
+
const innerImage = domNodes.image;
|
|
239
|
+
const wixImage = domNodes[id];
|
|
240
|
+
const screenHeight = getScreenHeight((_a = services.getScreenHeightOverride) == null ? void 0 : _a.call(services));
|
|
241
|
+
const mediaHeightOverrideType = containerElm == null ? void 0 : containerElm.dataset.mediaHeightOverrideType;
|
|
242
|
+
const hasBgEffect = bgEffect && bgEffect !== "none" || sourceSets && sourceSets.some((srcset) => srcset.scrollEffect);
|
|
243
|
+
const sourceOfDimensions = containerElm && hasBgEffect ? containerElm : wixImage;
|
|
244
|
+
const cssBgEffect = window.getComputedStyle(wixImage).getPropertyValue("--bg-scrub-effect");
|
|
245
|
+
const { width, height } = ((_b = services.getMediaDimensionsByEffect) == null ? void 0 : _b.call(services, cssBgEffect || bgEffect, sourceOfDimensions.offsetWidth, sourceOfDimensions.offsetHeight, screenHeight)) || {
|
|
246
|
+
width: wixImage.offsetWidth,
|
|
247
|
+
height: wixImage.offsetHeight
|
|
248
|
+
};
|
|
249
|
+
if (sourceSets) {
|
|
250
|
+
measures.sourceSetsTargetHeights = getSourceSetsTargetHeightByEffect(sourceSets, sourceOfDimensions.offsetWidth, sourceOfDimensions.offsetHeight, screenHeight, services);
|
|
251
|
+
}
|
|
252
|
+
if (!innerImage) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
const imgSrc = getImageSrc(innerImage);
|
|
256
|
+
if (cssBgEffect) {
|
|
257
|
+
measures.top = 0.5 * (wixImage.offsetHeight - height);
|
|
258
|
+
measures.left = 0.5 * (wixImage.offsetWidth - width);
|
|
259
|
+
}
|
|
260
|
+
measures.width = width;
|
|
261
|
+
measures.height = getHeightOverride(height, mediaHeightOverrideType);
|
|
262
|
+
measures.screenHeight = screenHeight;
|
|
263
|
+
measures.imgSrc = imgSrc;
|
|
264
|
+
measures.boundingRect = wixImage.getBoundingClientRect();
|
|
265
|
+
measures.mediaHeightOverrideType = mediaHeightOverrideType;
|
|
266
|
+
measures.srcset = innerImage.srcset;
|
|
267
|
+
}
|
|
268
|
+
function patch(id, measures, domNodes, imageInfo, services, envConsts, loadImage, isResponsive, bgEffect, loadImageImmediately) {
|
|
269
|
+
var _a, _b;
|
|
270
|
+
if (!Object.keys(measures).length) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
const { imageData } = imageInfo;
|
|
274
|
+
const wixImageNode = domNodes[id];
|
|
275
|
+
const image2 = domNodes.image;
|
|
276
|
+
if (bgEffect) {
|
|
277
|
+
imageData.devicePixelRatio = 1;
|
|
278
|
+
}
|
|
279
|
+
const targetScale = imageInfo.targetScale || 1;
|
|
280
|
+
const allowFullGIFTransformation = (_a = services.isExperimentOpen) == null ? void 0 : _a.call(services, "specs.thunderbolt.allowFullGIFTransformation");
|
|
281
|
+
const extendedImageInfo = {
|
|
282
|
+
...imageInfo,
|
|
283
|
+
...!imageInfo.skipMeasure && {
|
|
284
|
+
targetWidth: (measures.width || 0) * targetScale,
|
|
285
|
+
targetHeight: (measures.height || 0) * targetScale
|
|
286
|
+
},
|
|
287
|
+
displayMode: imageData.displayMode,
|
|
288
|
+
allowFullGIFTransformation
|
|
289
|
+
};
|
|
290
|
+
const imageComputedProperties = getImageComputedProperties(extendedImageInfo, envConsts, "img");
|
|
291
|
+
const computedStyle = ((_b = imageComputedProperties == null ? void 0 : imageComputedProperties.css) == null ? void 0 : _b.img) || {};
|
|
292
|
+
const imageStyle = computeStyleOverrides(measures.mediaHeightOverrideType, computedStyle, imageData.displayMode, targetScale, isResponsive);
|
|
293
|
+
setStyle(image2, imageStyle);
|
|
294
|
+
if (measures.top || measures.left) {
|
|
295
|
+
setStyle(wixImageNode, {
|
|
296
|
+
top: `${measures.top}px`,
|
|
297
|
+
left: `${measures.left}px`
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
const src = (imageComputedProperties == null ? void 0 : imageComputedProperties.uri) || "";
|
|
301
|
+
const hasAnimation = (imageData == null ? void 0 : imageData.hasAnimation) || (imageInfo == null ? void 0 : imageInfo.hasAnimation);
|
|
302
|
+
const mediaToUri = computeSrcSets(measures, extendedImageInfo, envConsts);
|
|
303
|
+
if (loadImageImmediately) {
|
|
304
|
+
image2.dataset.ssrSrcDone = "true";
|
|
305
|
+
}
|
|
306
|
+
if (imageInfo.isLQIP && imageInfo.lqipTransition && !("transitioned" in wixImageNode.dataset)) {
|
|
307
|
+
wixImageNode.dataset.transitioned = "";
|
|
308
|
+
if (image2.complete) {
|
|
309
|
+
image2.onload = function() {
|
|
310
|
+
image2.dataset.loadDone = "";
|
|
311
|
+
};
|
|
312
|
+
} else {
|
|
313
|
+
image2.onload = function() {
|
|
314
|
+
if (image2.complete) {
|
|
315
|
+
image2.dataset.loadDone = "";
|
|
316
|
+
} else {
|
|
317
|
+
image2.onload = function() {
|
|
318
|
+
image2.dataset.loadDone = "";
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
if (loadImage) {
|
|
325
|
+
if (imageIsAnimated(imageData.uri, hasAnimation)) {
|
|
326
|
+
image2.setAttribute("fetchpriority", "low");
|
|
327
|
+
image2.setAttribute("loading", "lazy");
|
|
328
|
+
image2.setAttribute("decoding", "async");
|
|
329
|
+
} else {
|
|
330
|
+
image2.setAttribute("fetchpriority", "high");
|
|
331
|
+
}
|
|
332
|
+
image2.currentSrc !== src && image2.setAttribute("src", src);
|
|
333
|
+
const srcIsMissingFromSrcset = measures.srcset && !measures.srcset.split(", ").some((source) => source.split(" ")[0] === src);
|
|
334
|
+
if (srcIsMissingFromSrcset) {
|
|
335
|
+
image2.setAttribute("srcset", src);
|
|
336
|
+
}
|
|
337
|
+
if (domNodes.picture && extendedImageInfo.sourceSets) {
|
|
338
|
+
Array.from(domNodes.picture.querySelectorAll("source")).forEach((sourceNode) => {
|
|
339
|
+
const mediaQuery = sourceNode.media || "";
|
|
340
|
+
const uri = mediaToUri == null ? void 0 : mediaToUri[mediaQuery];
|
|
341
|
+
if (sourceNode.srcset !== uri) {
|
|
342
|
+
sourceNode.setAttribute("srcset", uri || "");
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
const imageLayout = {
|
|
349
|
+
measure,
|
|
350
|
+
patch
|
|
351
|
+
};
|
|
352
|
+
const TIMEOUT = 250;
|
|
353
|
+
const imageEffectMap = {
|
|
354
|
+
parallax: "ImageParallax",
|
|
355
|
+
fixed: "ImageReveal"
|
|
356
|
+
};
|
|
357
|
+
function wowImageFactory(services, environmentConsts, contextWindow) {
|
|
358
|
+
return class WowImage extends contextWindow.HTMLElement {
|
|
359
|
+
constructor() {
|
|
360
|
+
super();
|
|
361
|
+
this.childListObserver = null;
|
|
362
|
+
this.timeoutId = null;
|
|
363
|
+
}
|
|
364
|
+
attributeChangedCallback(_, oldValue) {
|
|
365
|
+
if (oldValue) {
|
|
366
|
+
this.reLayout();
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
connectedCallback() {
|
|
370
|
+
if (environmentConsts.disableImagesLazyLoading) {
|
|
371
|
+
this.reLayout();
|
|
372
|
+
} else {
|
|
373
|
+
this.observeIntersect();
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
disconnectedCallback() {
|
|
377
|
+
this.unobserveResize();
|
|
378
|
+
this.unobserveIntersect();
|
|
379
|
+
this.unobserveChildren();
|
|
380
|
+
}
|
|
381
|
+
static get observedAttributes() {
|
|
382
|
+
return ["data-image-info"];
|
|
383
|
+
}
|
|
384
|
+
reLayout() {
|
|
385
|
+
const domNodes = {};
|
|
386
|
+
const measures = {};
|
|
387
|
+
const imageId = this.getAttribute("id");
|
|
388
|
+
const imageInfo = JSON.parse(this.dataset.imageInfo || "");
|
|
389
|
+
const isResponsive = this.dataset.isResponsive === "true";
|
|
390
|
+
const { bgEffectName } = this.dataset;
|
|
391
|
+
const { scrollEffect } = imageInfo.imageData;
|
|
392
|
+
const { sourceSets } = imageInfo;
|
|
393
|
+
const bgEffect = bgEffectName || scrollEffect && imageEffectMap[scrollEffect];
|
|
394
|
+
if (sourceSets && sourceSets.length) {
|
|
395
|
+
sourceSets.forEach((sourceSet) => {
|
|
396
|
+
if (sourceSet.scrollEffect) {
|
|
397
|
+
sourceSet.scrollEffect = imageEffectMap[sourceSet.scrollEffect];
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
domNodes[imageId] = this;
|
|
402
|
+
if (imageInfo.containerId) {
|
|
403
|
+
domNodes[imageInfo.containerId] = contextWindow.document.getElementById(`${imageInfo.containerId}`);
|
|
404
|
+
}
|
|
405
|
+
const containerElm = imageInfo.containerId ? domNodes[imageInfo.containerId] : void 0;
|
|
406
|
+
domNodes.image = this.querySelector("img");
|
|
407
|
+
domNodes.picture = this.querySelector("picture");
|
|
408
|
+
if (!domNodes.image) {
|
|
409
|
+
const target = this;
|
|
410
|
+
this.observeChildren(target);
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
this.unobserveChildren();
|
|
414
|
+
this.observeChildren(this);
|
|
415
|
+
services.mutationService.measure(() => {
|
|
416
|
+
imageLayout.measure(imageId, measures, domNodes, {
|
|
417
|
+
containerElm,
|
|
418
|
+
bgEffect,
|
|
419
|
+
sourceSets
|
|
420
|
+
}, services);
|
|
421
|
+
});
|
|
422
|
+
const patchImage = (shouldLoadImage, loadImageImmediately2) => {
|
|
423
|
+
services.mutationService.mutate(() => {
|
|
424
|
+
imageLayout.patch(imageId, measures, domNodes, imageInfo, services, environmentConsts, shouldLoadImage, isResponsive, bgEffect, loadImageImmediately2);
|
|
425
|
+
});
|
|
426
|
+
};
|
|
427
|
+
const imageElement = domNodes.image;
|
|
428
|
+
const ssrSrcNeedProcessing = this.dataset.hasSsrSrc && !imageElement.dataset.ssrSrcDone;
|
|
429
|
+
const loadImageImmediately = !getImageSrc(imageElement) || ssrSrcNeedProcessing;
|
|
430
|
+
if (loadImageImmediately) {
|
|
431
|
+
patchImage(true, true);
|
|
432
|
+
} else {
|
|
433
|
+
this.debounceImageLoad(patchImage);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Debounce consecutive image loads
|
|
438
|
+
*
|
|
439
|
+
* @param {function} patchImage closure for patching the image
|
|
440
|
+
*/
|
|
441
|
+
debounceImageLoad(patchImage) {
|
|
442
|
+
clearTimeout(this.timeoutId);
|
|
443
|
+
this.timeoutId = contextWindow.setTimeout(() => {
|
|
444
|
+
patchImage(true);
|
|
445
|
+
}, TIMEOUT);
|
|
446
|
+
patchImage(false);
|
|
447
|
+
}
|
|
448
|
+
observeResize() {
|
|
449
|
+
var _a;
|
|
450
|
+
(_a = services.resizeService) == null ? void 0 : _a.observe(this);
|
|
451
|
+
}
|
|
452
|
+
unobserveResize() {
|
|
453
|
+
var _a;
|
|
454
|
+
(_a = services.resizeService) == null ? void 0 : _a.unobserve(this);
|
|
455
|
+
}
|
|
456
|
+
observeIntersect() {
|
|
457
|
+
var _a;
|
|
458
|
+
(_a = services.intersectionService) == null ? void 0 : _a.observe(this);
|
|
459
|
+
}
|
|
460
|
+
unobserveIntersect() {
|
|
461
|
+
var _a;
|
|
462
|
+
(_a = services.intersectionService) == null ? void 0 : _a.unobserve(this);
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Observe DOM mutations to wait for addition of missing children
|
|
466
|
+
*
|
|
467
|
+
* @param {HTMLElement} parent
|
|
468
|
+
*/
|
|
469
|
+
observeChildren(parent) {
|
|
470
|
+
if (!this.childListObserver) {
|
|
471
|
+
this.childListObserver = new contextWindow.MutationObserver(() => {
|
|
472
|
+
this.reLayout();
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
this.childListObserver.observe(parent, { childList: true });
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Remove DOM MutationObserver if one was created
|
|
479
|
+
*/
|
|
480
|
+
unobserveChildren() {
|
|
481
|
+
if (this.childListObserver) {
|
|
482
|
+
this.childListObserver.disconnect();
|
|
483
|
+
this.childListObserver = null;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
function init(contextWindow, services) {
|
|
489
|
+
const elementName = "wow-image";
|
|
490
|
+
contextWindow = contextWindow || window;
|
|
491
|
+
if (contextWindow.customElements.get(elementName) === void 0) {
|
|
492
|
+
let resizeObserver;
|
|
493
|
+
if (contextWindow.ResizeObserver) {
|
|
494
|
+
resizeObserver = new contextWindow.ResizeObserver((entries) => entries.map((entry) => entry.target.reLayout()));
|
|
495
|
+
}
|
|
496
|
+
let intersectionObserver;
|
|
497
|
+
if (contextWindow.IntersectionObserver) {
|
|
498
|
+
intersectionObserver = new IntersectionObserver((entries) => entries.map((entry) => {
|
|
499
|
+
if (entry.isIntersecting) {
|
|
500
|
+
const wowImage2 = entry.target;
|
|
501
|
+
wowImage2.unobserveIntersect();
|
|
502
|
+
wowImage2.observeResize();
|
|
503
|
+
}
|
|
504
|
+
return entry;
|
|
505
|
+
}), {
|
|
506
|
+
/**
|
|
507
|
+
* old: 50% from 1080 (desktop) is 540px, 800 (mobile) 400px
|
|
508
|
+
* new: 150% from 1080 (desktop) is 1620, 800 (mobile) 1200
|
|
509
|
+
* chrome [loading=lazy]: 4g - 1250px, lower then 3g - 2500px
|
|
510
|
+
* @see https://web.dev/articles/browser-level-image-lazy-loading#improved-thresholds
|
|
511
|
+
*/
|
|
512
|
+
rootMargin: "150% 100%"
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
return function(env) {
|
|
516
|
+
const WowImage = wowImageFactory({
|
|
517
|
+
resizeService: resizeObserver,
|
|
518
|
+
intersectionService: intersectionObserver,
|
|
519
|
+
mutationService: fastdom,
|
|
520
|
+
...services
|
|
521
|
+
}, env, contextWindow);
|
|
522
|
+
contextWindow.customElements.define(elementName, WowImage);
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
const getDevicePixelRatio = () => {
|
|
528
|
+
const isMSMobileDevice = /iemobile/i.test(navigator.userAgent);
|
|
529
|
+
if (isMSMobileDevice) {
|
|
530
|
+
return Math.round(window.screen.availWidth / (window.screen.width || window.document.documentElement.clientWidth));
|
|
531
|
+
}
|
|
532
|
+
return window.devicePixelRatio;
|
|
533
|
+
};
|
|
534
|
+
const getIsImagesLazyLoadingDisabled = () => {
|
|
535
|
+
try {
|
|
536
|
+
return new URL(window.location.href).searchParams.get("disableLazyLoading") === "true";
|
|
537
|
+
} catch {
|
|
538
|
+
return false;
|
|
539
|
+
}
|
|
540
|
+
};
|
|
541
|
+
const STATIC_MEDIA_URL = "https://static.wixstatic.com/media";
|
|
542
|
+
const MEDIA_ROOT_URL = "https://static.wixstatic.com";
|
|
543
|
+
function initCustomElement(services = {}, contextWindow = null, envConsts = {}) {
|
|
544
|
+
if (typeof window === "undefined") {
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
const env = {
|
|
548
|
+
staticMediaUrl: STATIC_MEDIA_URL,
|
|
549
|
+
mediaRootUrl: MEDIA_ROOT_URL,
|
|
550
|
+
experiments: {},
|
|
551
|
+
devicePixelRatio: getDevicePixelRatio(),
|
|
552
|
+
disableImagesLazyLoading: getIsImagesLazyLoadingDisabled(),
|
|
553
|
+
...envConsts
|
|
554
|
+
};
|
|
555
|
+
const define = init(contextWindow, services);
|
|
556
|
+
if (define) {
|
|
557
|
+
define(env);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
87
560
|
const root = "root__FuiJG";
|
|
88
561
|
const image3 = "image3__6ufCe";
|
|
89
562
|
const fitWidth = "fitWidth__0L5O4";
|
|
@@ -171,7 +644,7 @@ const Image3 = (props) => {
|
|
|
171
644
|
loading: priority === "low" ? "lazy" : void 0,
|
|
172
645
|
fetchpriority: priority === "high" ? "high" : void 0,
|
|
173
646
|
alt: image2.alt ?? "",
|
|
174
|
-
src: renderingContext.SEO ? `${STATIC_MEDIA_URL$
|
|
647
|
+
src: renderingContext.SEO ? `${STATIC_MEDIA_URL$2}${seoImageUrl}` : void 0,
|
|
175
648
|
...role && { role }
|
|
176
649
|
}
|
|
177
650
|
) })
|
|
@@ -2,8 +2,163 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { c as clsx } from "../chunks/clsx.js";
|
|
3
3
|
import { a as getDataAttributes } from "../chunks/dataUtils.js";
|
|
4
4
|
import { d as defaultLogoUrl, D as DEFAULT_LOGO_SIZE } from "../chunks/constants29.js";
|
|
5
|
-
import
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { i as imageKit, g as getPlaceholder } from "../chunks/index5.js";
|
|
6
7
|
import { L as Link } from "../chunks/Link.js";
|
|
8
|
+
const image$1 = "image__WopE9";
|
|
9
|
+
const styles$2 = {
|
|
10
|
+
image: image$1
|
|
11
|
+
};
|
|
12
|
+
const { STATIC_MEDIA_URL } = imageKit;
|
|
13
|
+
const fetchLQIP = ({ fittingType, src, target, options }) => {
|
|
14
|
+
const placeholder = getPlaceholder(fittingType, src, target, {
|
|
15
|
+
...options,
|
|
16
|
+
autoEncode: true
|
|
17
|
+
});
|
|
18
|
+
if ((placeholder == null ? void 0 : placeholder.uri) && !/^[a-z]+:/.test(placeholder.uri)) {
|
|
19
|
+
placeholder.uri = `${STATIC_MEDIA_URL}${placeholder.uri}`;
|
|
20
|
+
}
|
|
21
|
+
return placeholder;
|
|
22
|
+
};
|
|
23
|
+
const SCHEME_RE = /^[a-z]+:/;
|
|
24
|
+
const Image$1 = (props) => {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
const { id, containerId, uri, alt, name = "", role, width, height, displayMode, devicePixelRatio, quality, alignType, bgEffectName = "", focalPoint, upscaleMethod, className = "", crop, imageStyles = {}, targetWidth, targetHeight, targetScale, onLoad = () => {
|
|
27
|
+
}, onError = () => {
|
|
28
|
+
}, shouldUseLQIP, containerWidth, containerHeight, getPlaceholder: getPlaceholder2, isInFirstFold, placeholderTransition, socialAttrs, isSEOBot, skipMeasure, hasAnimation, encoding, isFluidLayout } = props;
|
|
29
|
+
const imageRef = React.useRef(null);
|
|
30
|
+
let hasSsrSrc = "";
|
|
31
|
+
const hasBlurTransition = placeholderTransition === "blur";
|
|
32
|
+
const ssrImageData = React.useRef(null);
|
|
33
|
+
if (!ssrImageData.current) {
|
|
34
|
+
if (getPlaceholder2 || shouldUseLQIP || isInFirstFold || isSEOBot) {
|
|
35
|
+
const options = {
|
|
36
|
+
upscaleMethod,
|
|
37
|
+
...quality ? quality : {},
|
|
38
|
+
shouldLoadHQImage: isInFirstFold,
|
|
39
|
+
isSEOBot,
|
|
40
|
+
hasAnimation,
|
|
41
|
+
encoding
|
|
42
|
+
};
|
|
43
|
+
ssrImageData.current = (getPlaceholder2 || fetchLQIP)({
|
|
44
|
+
fittingType: displayMode,
|
|
45
|
+
src: {
|
|
46
|
+
id: uri,
|
|
47
|
+
width,
|
|
48
|
+
height,
|
|
49
|
+
crop,
|
|
50
|
+
name,
|
|
51
|
+
focalPoint
|
|
52
|
+
},
|
|
53
|
+
target: {
|
|
54
|
+
width: containerWidth,
|
|
55
|
+
height: containerHeight,
|
|
56
|
+
alignment: alignType,
|
|
57
|
+
htmlTag: "img"
|
|
58
|
+
},
|
|
59
|
+
options
|
|
60
|
+
});
|
|
61
|
+
hasSsrSrc = !ssrImageData.current.transformed || isInFirstFold || isSEOBot ? "" : "true";
|
|
62
|
+
} else {
|
|
63
|
+
ssrImageData.current = {
|
|
64
|
+
uri: void 0,
|
|
65
|
+
css: { img: {} },
|
|
66
|
+
attr: { img: {}, container: {} },
|
|
67
|
+
transformed: false
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const isLQIP = !isSEOBot && (getPlaceholder2 || shouldUseLQIP) && !isInFirstFold && ssrImageData.current.transformed;
|
|
72
|
+
const imageInfo = React.useMemo(() => JSON.stringify({
|
|
73
|
+
containerId,
|
|
74
|
+
...containerId && { containerId },
|
|
75
|
+
...alignType && { alignType },
|
|
76
|
+
...skipMeasure && { skipMeasure: true },
|
|
77
|
+
displayMode,
|
|
78
|
+
...containerWidth && { targetWidth: containerWidth },
|
|
79
|
+
...containerHeight && { targetHeight: containerHeight },
|
|
80
|
+
...targetWidth && { targetWidth },
|
|
81
|
+
...targetHeight && { targetHeight },
|
|
82
|
+
...targetScale && { targetScale },
|
|
83
|
+
isLQIP,
|
|
84
|
+
isSEOBot,
|
|
85
|
+
lqipTransition: placeholderTransition,
|
|
86
|
+
encoding,
|
|
87
|
+
imageData: {
|
|
88
|
+
width,
|
|
89
|
+
height,
|
|
90
|
+
uri,
|
|
91
|
+
name,
|
|
92
|
+
displayMode,
|
|
93
|
+
hasAnimation,
|
|
94
|
+
...quality && { quality },
|
|
95
|
+
...devicePixelRatio && { devicePixelRatio },
|
|
96
|
+
...focalPoint && { focalPoint },
|
|
97
|
+
...crop && { crop },
|
|
98
|
+
...upscaleMethod && { upscaleMethod }
|
|
99
|
+
}
|
|
100
|
+
}), [
|
|
101
|
+
containerId,
|
|
102
|
+
alignType,
|
|
103
|
+
skipMeasure,
|
|
104
|
+
displayMode,
|
|
105
|
+
containerWidth,
|
|
106
|
+
containerHeight,
|
|
107
|
+
targetWidth,
|
|
108
|
+
targetHeight,
|
|
109
|
+
targetScale,
|
|
110
|
+
isLQIP,
|
|
111
|
+
isSEOBot,
|
|
112
|
+
placeholderTransition,
|
|
113
|
+
encoding,
|
|
114
|
+
width,
|
|
115
|
+
height,
|
|
116
|
+
uri,
|
|
117
|
+
name,
|
|
118
|
+
hasAnimation,
|
|
119
|
+
quality,
|
|
120
|
+
devicePixelRatio,
|
|
121
|
+
focalPoint,
|
|
122
|
+
crop,
|
|
123
|
+
upscaleMethod
|
|
124
|
+
]);
|
|
125
|
+
const ssrResult = ssrImageData.current;
|
|
126
|
+
const src = ssrResult == null ? void 0 : ssrResult.uri;
|
|
127
|
+
const srcset = ssrResult == null ? void 0 : ssrResult.srcset;
|
|
128
|
+
const placeholderStyle = (_a = ssrResult.css) == null ? void 0 : _a.img;
|
|
129
|
+
const classNames = `${styles$2.image} ${className}`;
|
|
130
|
+
React.useEffect(() => {
|
|
131
|
+
const imgElement = imageRef.current;
|
|
132
|
+
if (onLoad && (imgElement == null ? void 0 : imgElement.currentSrc) && (imgElement == null ? void 0 : imgElement.complete)) {
|
|
133
|
+
onLoad({
|
|
134
|
+
target: imgElement
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}, []);
|
|
138
|
+
const maxWidth = ssrResult && !(ssrResult == null ? void 0 : ssrResult.transformed) ? `max(${width}px, 100%)` : targetWidth ? `${targetWidth}px` : null;
|
|
139
|
+
return React.createElement(
|
|
140
|
+
"wow-image",
|
|
141
|
+
{ id, class: classNames, "data-image-info": imageInfo, "data-motion-part": `BG_IMG ${containerId}`, "data-bg-effect-name": bgEffectName, "data-has-ssr-src": hasSsrSrc, "data-animate-blur": !isSEOBot && isLQIP && hasBlurTransition ? "" : void 0, "data-is-responsive": isFluidLayout ? "true" : void 0, style: maxWidth ? { "--wix-img-max-width": maxWidth } : {} },
|
|
142
|
+
React.createElement("img", {
|
|
143
|
+
src,
|
|
144
|
+
ref: imageRef,
|
|
145
|
+
alt: alt || "",
|
|
146
|
+
role,
|
|
147
|
+
style: { ...placeholderStyle, ...imageStyles },
|
|
148
|
+
onLoad,
|
|
149
|
+
onError,
|
|
150
|
+
width: containerWidth ? containerWidth : void 0,
|
|
151
|
+
height: containerHeight ? containerHeight : void 0,
|
|
152
|
+
...socialAttrs,
|
|
153
|
+
srcSet: isInFirstFold ? (_b = srcset == null ? void 0 : srcset.dpr) == null ? void 0 : _b.map((s) => SCHEME_RE.test(s) ? s : `${STATIC_MEDIA_URL}${s}`).join(", ") : void 0,
|
|
154
|
+
// @ts-expect-error fetchpriority type should work in react > 18.3 https://github.com/facebook/react/pull/25927
|
|
155
|
+
fetchpriority: isInFirstFold ? "high" : void 0,
|
|
156
|
+
loading: isInFirstFold === false ? "lazy" : void 0,
|
|
157
|
+
// The src attribute triggers a mismatch warning because wow-image updates its src outside of the React lifecycle. This causes React to retain the old value in the virtual DOM, which could potentially lead to a bug where the old value is re-rendered during updates. However, we’re confident that this issue is not reproducing in current (16-18) React versions
|
|
158
|
+
suppressHydrationWarning: true
|
|
159
|
+
})
|
|
160
|
+
);
|
|
161
|
+
};
|
|
7
162
|
const logo = "logo__Y9w6a";
|
|
8
163
|
const linkLayer = "linkLayer__KtYh-";
|
|
9
164
|
const styles$1 = {
|