@wix/editor-react-components 1.2500.0 → 1.2501.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.
@@ -2,163 +2,8 @@ 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 * as React from "react";
6
- import { i as imageKit, g as getPlaceholder } from "../chunks/index5.js";
5
+ import { I as Image$1 } from "../chunks/Image.js";
7
6
  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
- };
162
7
  const logo = "logo__Y9w6a";
163
8
  const linkLayer = "linkLayer__KtYh-";
164
9
  const styles$1 = {
@@ -1,18 +1,4 @@
1
- .image__WopE9 {
2
- display: block;
3
- width: 100%;
4
- height: 100%;
5
- }
6
- .image__WopE9 img {
7
- max-width: var(--wix-img-max-width, 100%);
8
- }
9
- .image__WopE9[data-animate-blur] img {
10
- filter: blur(9px);
11
- transition: filter 0.8s ease-in;
12
- }
13
- .image__WopE9[data-animate-blur] img[data-load-done] {
14
- filter: none;
15
- }.logo__Y9w6a {
1
+ .logo__Y9w6a {
16
2
  display: flex;
17
3
  align-items: center;
18
4
  justify-content: center;
@@ -42,4 +28,19 @@
42
28
  width: 100%;
43
29
  height: 100%;
44
30
  display: block;
31
+ }
32
+ .image__WopE9 {
33
+ display: block;
34
+ width: 100%;
35
+ height: 100%;
36
+ }
37
+ .image__WopE9 img {
38
+ max-width: var(--wix-img-max-width, 100%);
39
+ }
40
+ .image__WopE9[data-animate-blur] img {
41
+ filter: blur(9px);
42
+ transition: filter 0.8s ease-in;
43
+ }
44
+ .image__WopE9[data-animate-blur] img[data-load-done] {
45
+ filter: none;
45
46
  }
@@ -88,18 +88,19 @@
88
88
  --position-left: calc(50cqw - 1cqh * var(--focal-x, 50) * var(--aspect-ratio, 1));
89
89
  --position-top: calc(50cqh - 1cqw * var(--focal-y, 50) / var(--aspect-ratio, 1));
90
90
  object-position: var(--video-position, clamp(100%, var(--position-left), 0%) clamp(100%, var(--position-top), 0%));
91
- }.image__OIbFL {
91
+ }
92
+ .image__WopE9 {
92
93
  display: block;
93
94
  width: 100%;
94
95
  height: 100%;
95
96
  }
96
- .image__OIbFL img {
97
+ .image__WopE9 img {
97
98
  max-width: var(--wix-img-max-width, 100%);
98
99
  }
99
- .image__OIbFL[data-animate-blur] img {
100
+ .image__WopE9[data-animate-blur] img {
100
101
  filter: blur(9px);
101
102
  transition: filter 0.8s ease-in;
102
103
  }
103
- .image__OIbFL[data-animate-blur] img[data-load-done] {
104
+ .image__WopE9[data-animate-blur] img[data-load-done] {
104
105
  filter: none;
105
106
  }
@@ -467,18 +467,19 @@
467
467
  --position-left: calc(50cqw - 1cqh * var(--focal-x, 50) * var(--aspect-ratio, 1));
468
468
  --position-top: calc(50cqh - 1cqw * var(--focal-y, 50) / var(--aspect-ratio, 1));
469
469
  object-position: var(--video-position, clamp(100%, var(--position-left), 0%) clamp(100%, var(--position-top), 0%));
470
- }.image__OIbFL {
470
+ }
471
+ .image__WopE9 {
471
472
  display: block;
472
473
  width: 100%;
473
474
  height: 100%;
474
475
  }
475
- .image__OIbFL img {
476
+ .image__WopE9 img {
476
477
  max-width: var(--wix-img-max-width, 100%);
477
478
  }
478
- .image__OIbFL[data-animate-blur] img {
479
+ .image__WopE9[data-animate-blur] img {
479
480
  filter: blur(9px);
480
481
  transition: filter 0.8s ease-in;
481
482
  }
482
- .image__OIbFL[data-animate-blur] img[data-load-done] {
483
+ .image__WopE9[data-animate-blur] img[data-load-done] {
483
484
  filter: none;
484
485
  }
@@ -0,0 +1,160 @@
1
+ import * as React from "react";
2
+ import { i as imageKit, g as getPlaceholder } from "./index5.js";
3
+ const image = "image__WopE9";
4
+ const styles = {
5
+ image
6
+ };
7
+ const { STATIC_MEDIA_URL } = imageKit;
8
+ const fetchLQIP = ({ fittingType, src, target, options }) => {
9
+ const placeholder = getPlaceholder(fittingType, src, target, {
10
+ ...options,
11
+ autoEncode: true
12
+ });
13
+ if ((placeholder == null ? void 0 : placeholder.uri) && !/^[a-z]+:/.test(placeholder.uri)) {
14
+ placeholder.uri = `${STATIC_MEDIA_URL}${placeholder.uri}`;
15
+ }
16
+ return placeholder;
17
+ };
18
+ const SCHEME_RE = /^[a-z]+:/;
19
+ const Image = (props) => {
20
+ var _a, _b;
21
+ const { id, containerId, uri, alt, name = "", role, width, height, displayMode, devicePixelRatio, quality, alignType, bgEffectName = "", focalPoint, upscaleMethod, className = "", crop, imageStyles = {}, targetWidth, targetHeight, targetScale, onLoad = () => {
22
+ }, onError = () => {
23
+ }, shouldUseLQIP, containerWidth, containerHeight, getPlaceholder: getPlaceholder2, isInFirstFold, placeholderTransition, socialAttrs, isSEOBot, skipMeasure, hasAnimation, encoding, isFluidLayout, baseHostURL } = props;
24
+ const imageRef = React.useRef(null);
25
+ let hasSsrSrc = "";
26
+ const hasBlurTransition = placeholderTransition === "blur";
27
+ const ssrImageData = React.useRef(null);
28
+ if (!ssrImageData.current) {
29
+ if (getPlaceholder2 || shouldUseLQIP || isInFirstFold || isSEOBot) {
30
+ const options = {
31
+ upscaleMethod,
32
+ ...quality ? quality : {},
33
+ shouldLoadHQImage: isInFirstFold,
34
+ isSEOBot,
35
+ hasAnimation,
36
+ encoding,
37
+ baseHostURL
38
+ };
39
+ ssrImageData.current = (getPlaceholder2 || fetchLQIP)({
40
+ fittingType: displayMode,
41
+ src: {
42
+ id: uri,
43
+ width,
44
+ height,
45
+ crop,
46
+ name,
47
+ focalPoint
48
+ },
49
+ target: {
50
+ width: containerWidth,
51
+ height: containerHeight,
52
+ alignment: alignType,
53
+ htmlTag: "img"
54
+ },
55
+ options
56
+ });
57
+ hasSsrSrc = !ssrImageData.current.transformed || isInFirstFold || isSEOBot ? "" : "true";
58
+ } else {
59
+ ssrImageData.current = {
60
+ uri: void 0,
61
+ css: { img: {} },
62
+ attr: { img: {}, container: {} },
63
+ transformed: false
64
+ };
65
+ }
66
+ }
67
+ const isLQIP = !isSEOBot && (getPlaceholder2 || shouldUseLQIP) && !isInFirstFold && ssrImageData.current.transformed;
68
+ const imageInfo = React.useMemo(() => JSON.stringify({
69
+ containerId,
70
+ ...containerId && { containerId },
71
+ ...alignType && { alignType },
72
+ ...skipMeasure && { skipMeasure: true },
73
+ displayMode,
74
+ ...containerWidth && { targetWidth: containerWidth },
75
+ ...containerHeight && { targetHeight: containerHeight },
76
+ ...targetWidth && { targetWidth },
77
+ ...targetHeight && { targetHeight },
78
+ ...targetScale && { targetScale },
79
+ isLQIP,
80
+ isSEOBot,
81
+ lqipTransition: placeholderTransition,
82
+ encoding,
83
+ imageData: {
84
+ width,
85
+ height,
86
+ uri,
87
+ name,
88
+ displayMode,
89
+ hasAnimation,
90
+ ...quality && { quality },
91
+ ...devicePixelRatio && { devicePixelRatio },
92
+ ...focalPoint && { focalPoint },
93
+ ...crop && { crop },
94
+ ...upscaleMethod && { upscaleMethod }
95
+ }
96
+ }), [
97
+ containerId,
98
+ alignType,
99
+ skipMeasure,
100
+ displayMode,
101
+ containerWidth,
102
+ containerHeight,
103
+ targetWidth,
104
+ targetHeight,
105
+ targetScale,
106
+ isLQIP,
107
+ isSEOBot,
108
+ placeholderTransition,
109
+ encoding,
110
+ width,
111
+ height,
112
+ uri,
113
+ name,
114
+ hasAnimation,
115
+ quality,
116
+ devicePixelRatio,
117
+ focalPoint,
118
+ crop,
119
+ upscaleMethod
120
+ ]);
121
+ const ssrResult = ssrImageData.current;
122
+ const src = ssrResult == null ? void 0 : ssrResult.uri;
123
+ const srcset = ssrResult == null ? void 0 : ssrResult.srcset;
124
+ const placeholderStyle = (_a = ssrResult.css) == null ? void 0 : _a.img;
125
+ const classNames = `${styles.image} ${className}`;
126
+ React.useEffect(() => {
127
+ const imgElement = imageRef.current;
128
+ if (onLoad && (imgElement == null ? void 0 : imgElement.currentSrc) && (imgElement == null ? void 0 : imgElement.complete)) {
129
+ onLoad({
130
+ target: imgElement
131
+ });
132
+ }
133
+ }, []);
134
+ const maxWidth = ssrResult && !(ssrResult == null ? void 0 : ssrResult.transformed) ? `max(${width}px, 100%)` : targetWidth ? `${targetWidth}px` : null;
135
+ return React.createElement(
136
+ "wow-image",
137
+ { 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 } : {} },
138
+ React.createElement("img", {
139
+ src,
140
+ ref: imageRef,
141
+ alt: alt || "",
142
+ role,
143
+ style: { ...placeholderStyle, ...imageStyles },
144
+ onLoad,
145
+ onError,
146
+ width: containerWidth ? containerWidth : void 0,
147
+ height: containerHeight ? containerHeight : void 0,
148
+ ...socialAttrs,
149
+ 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,
150
+ // @ts-expect-error fetchpriority type should work in react > 18.3 https://github.com/facebook/react/pull/25927
151
+ fetchpriority: isInFirstFold ? "high" : void 0,
152
+ loading: isInFirstFold === false ? "lazy" : void 0,
153
+ // 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
154
+ suppressHydrationWarning: true
155
+ })
156
+ );
157
+ };
158
+ export {
159
+ Image as I
160
+ };