@wix/editor-react-components 1.2496.0 → 1.2498.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.
@@ -0,0 +1,166 @@
1
+ import { g as getDefaultExportFromCjs } from "./_commonjsHelpers.js";
2
+ var fastdom$2 = { exports: {} };
3
+ var fastdom$1 = fastdom$2.exports;
4
+ var hasRequiredFastdom;
5
+ function requireFastdom() {
6
+ if (hasRequiredFastdom) return fastdom$2.exports;
7
+ hasRequiredFastdom = 1;
8
+ (function(module) {
9
+ !(function(win) {
10
+ var debug = function() {
11
+ };
12
+ var raf = win.requestAnimationFrame || win.webkitRequestAnimationFrame || win.mozRequestAnimationFrame || win.msRequestAnimationFrame || function(cb) {
13
+ return setTimeout(cb, 16);
14
+ };
15
+ function FastDom() {
16
+ var self = this;
17
+ self.reads = [];
18
+ self.writes = [];
19
+ self.raf = raf.bind(win);
20
+ }
21
+ FastDom.prototype = {
22
+ constructor: FastDom,
23
+ /**
24
+ * We run this inside a try catch
25
+ * so that if any jobs error, we
26
+ * are able to recover and continue
27
+ * to flush the batch until it's empty.
28
+ *
29
+ * @param {Array} tasks
30
+ */
31
+ runTasks: function(tasks) {
32
+ var task;
33
+ while (task = tasks.shift()) task();
34
+ },
35
+ /**
36
+ * Adds a job to the read batch and
37
+ * schedules a new frame if need be.
38
+ *
39
+ * @param {Function} fn
40
+ * @param {Object} ctx the context to be bound to `fn` (optional).
41
+ * @public
42
+ */
43
+ measure: function(fn, ctx) {
44
+ var task = !ctx ? fn : fn.bind(ctx);
45
+ this.reads.push(task);
46
+ scheduleFlush(this);
47
+ return task;
48
+ },
49
+ /**
50
+ * Adds a job to the
51
+ * write batch and schedules
52
+ * a new frame if need be.
53
+ *
54
+ * @param {Function} fn
55
+ * @param {Object} ctx the context to be bound to `fn` (optional).
56
+ * @public
57
+ */
58
+ mutate: function(fn, ctx) {
59
+ var task = !ctx ? fn : fn.bind(ctx);
60
+ this.writes.push(task);
61
+ scheduleFlush(this);
62
+ return task;
63
+ },
64
+ /**
65
+ * Clears a scheduled 'read' or 'write' task.
66
+ *
67
+ * @param {Object} task
68
+ * @return {Boolean} success
69
+ * @public
70
+ */
71
+ clear: function(task) {
72
+ return remove(this.reads, task) || remove(this.writes, task);
73
+ },
74
+ /**
75
+ * Extend this FastDom with some
76
+ * custom functionality.
77
+ *
78
+ * Because fastdom must *always* be a
79
+ * singleton, we're actually extending
80
+ * the fastdom instance. This means tasks
81
+ * scheduled by an extension still enter
82
+ * fastdom's global task queue.
83
+ *
84
+ * The 'super' instance can be accessed
85
+ * from `this.fastdom`.
86
+ *
87
+ * @example
88
+ *
89
+ * var myFastdom = fastdom.extend({
90
+ * initialize: function() {
91
+ * // runs on creation
92
+ * },
93
+ *
94
+ * // override a method
95
+ * measure: function(fn) {
96
+ * // do extra stuff ...
97
+ *
98
+ * // then call the original
99
+ * return this.fastdom.measure(fn);
100
+ * },
101
+ *
102
+ * ...
103
+ * });
104
+ *
105
+ * @param {Object} props properties to mixin
106
+ * @return {FastDom}
107
+ */
108
+ extend: function(props) {
109
+ if (typeof props != "object") throw new Error("expected object");
110
+ var child = Object.create(this);
111
+ mixin(child, props);
112
+ child.fastdom = this;
113
+ if (child.initialize) child.initialize();
114
+ return child;
115
+ },
116
+ // override this with a function
117
+ // to prevent Errors in console
118
+ // when tasks throw
119
+ catch: null
120
+ };
121
+ function scheduleFlush(fastdom2) {
122
+ if (!fastdom2.scheduled) {
123
+ fastdom2.scheduled = true;
124
+ fastdom2.raf(flush.bind(null, fastdom2));
125
+ }
126
+ }
127
+ function flush(fastdom2) {
128
+ var writes = fastdom2.writes;
129
+ var reads = fastdom2.reads;
130
+ var error;
131
+ try {
132
+ debug("flushing reads", reads.length);
133
+ fastdom2.runTasks(reads);
134
+ debug("flushing writes", writes.length);
135
+ fastdom2.runTasks(writes);
136
+ } catch (e) {
137
+ error = e;
138
+ }
139
+ fastdom2.scheduled = false;
140
+ if (reads.length || writes.length) scheduleFlush(fastdom2);
141
+ if (error) {
142
+ debug("task errored", error.message);
143
+ if (fastdom2.catch) fastdom2.catch(error);
144
+ else throw error;
145
+ }
146
+ }
147
+ function remove(array, item) {
148
+ var index = array.indexOf(item);
149
+ return !!~index && !!array.splice(index, 1);
150
+ }
151
+ function mixin(target, source) {
152
+ for (var key in source) {
153
+ if (source.hasOwnProperty(key)) target[key] = source[key];
154
+ }
155
+ }
156
+ var exports$1 = win.fastdom = win.fastdom || new FastDom();
157
+ module.exports = exports$1;
158
+ })(typeof window !== "undefined" ? window : typeof fastdom$1 != "undefined" ? fastdom$1 : globalThis);
159
+ })(fastdom$2);
160
+ return fastdom$2.exports;
161
+ }
162
+ var fastdomExports = requireFastdom();
163
+ const fastdom = /* @__PURE__ */ getDefaultExportFromCjs(fastdomExports);
164
+ export {
165
+ fastdom as f
166
+ };
@@ -1435,12 +1435,15 @@ function getData(fittingType, src, target, options) {
1435
1435
  }
1436
1436
  return data;
1437
1437
  }
1438
+ const wixStatic = "https://static.wixstatic.com/";
1438
1439
  const wixStaticWithMedia = "https://static.wixstatic.com/media/";
1439
1440
  populateGlobalFeatureSupport();
1440
1441
  populateGlobalFeatureSupport();
1441
1442
  const STATIC_MEDIA_URL = wixStaticWithMedia;
1443
+ const MEDIA_ROOT_URL = wixStatic;
1442
1444
  const imageKit = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1443
1445
  __proto__: null,
1446
+ MEDIA_ROOT_URL,
1444
1447
  STATIC_MEDIA_URL,
1445
1448
  alignTypes,
1446
1449
  fileType,
@@ -1454,12 +1457,13 @@ const imageKit = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProp
1454
1457
  upscaleMethods
1455
1458
  }, Symbol.toStringTag, { value: "Module" }));
1456
1459
  export {
1460
+ MEDIA_ROOT_URL as M,
1457
1461
  STATIC_MEDIA_URL as S,
1458
1462
  getData as a,
1459
- getFileExtension as b,
1460
- alignTypes as c,
1461
- fittingTypes as d,
1462
- fileType as f,
1463
+ alignTypes as b,
1464
+ getFileExtension as c,
1465
+ fileType as d,
1466
+ fittingTypes as f,
1463
1467
  getPlaceholder as g,
1464
1468
  imageKit as i
1465
1469
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/editor-react-components",
3
- "version": "1.2496.0",
3
+ "version": "1.2498.0",
4
4
  "description": "React components for the Wix Editor",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -82,8 +82,8 @@
82
82
  "@wix/sdk": "^1.21.14",
83
83
  "@wix/services-manager-react": "^0.1.27",
84
84
  "@wix/site-service-rendering-context": "^1.0.1",
85
- "@wix/site-ui": "1.219.0",
86
- "@wix/video": "^1.85.0",
85
+ "@wix/site-ui": "1.220.0",
86
+ "@wix/video": "^1.106.0",
87
87
  "@wix/viewer-service-consent-policy": "^1.0.101",
88
88
  "@wix/web-bi-logger": "^2.1.29",
89
89
  "@wix/wix-ui-icons-common": "^3.173.0",
@@ -197,5 +197,5 @@
197
197
  "registry": "https://registry.npmjs.org/",
198
198
  "access": "public"
199
199
  },
200
- "falconPackageHash": "b46583c2d938fe6ecb25ad3098859da70bf72fde6a58d7aea0a791e9"
200
+ "falconPackageHash": "d5e8c4b8333b55ffe75c808fdfc261b9a390d37b0dd578aeed1b8d59"
201
201
  }
@@ -1,159 +0,0 @@
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 } = 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
- };
38
- ssrImageData.current = (getPlaceholder2 || fetchLQIP)({
39
- fittingType: displayMode,
40
- src: {
41
- id: uri,
42
- width,
43
- height,
44
- crop,
45
- name,
46
- focalPoint
47
- },
48
- target: {
49
- width: containerWidth,
50
- height: containerHeight,
51
- alignment: alignType,
52
- htmlTag: "img"
53
- },
54
- options
55
- });
56
- hasSsrSrc = !ssrImageData.current.transformed || isInFirstFold || isSEOBot ? "" : "true";
57
- } else {
58
- ssrImageData.current = {
59
- uri: void 0,
60
- css: { img: {} },
61
- attr: { img: {}, container: {} },
62
- transformed: false
63
- };
64
- }
65
- }
66
- const isLQIP = !isSEOBot && (getPlaceholder2 || shouldUseLQIP) && !isInFirstFold && ssrImageData.current.transformed;
67
- const imageInfo = React.useMemo(() => JSON.stringify({
68
- containerId,
69
- ...containerId && { containerId },
70
- ...alignType && { alignType },
71
- ...skipMeasure && { skipMeasure: true },
72
- displayMode,
73
- ...containerWidth && { targetWidth: containerWidth },
74
- ...containerHeight && { targetHeight: containerHeight },
75
- ...targetWidth && { targetWidth },
76
- ...targetHeight && { targetHeight },
77
- ...targetScale && { targetScale },
78
- isLQIP,
79
- isSEOBot,
80
- lqipTransition: placeholderTransition,
81
- encoding,
82
- imageData: {
83
- width,
84
- height,
85
- uri,
86
- name,
87
- displayMode,
88
- hasAnimation,
89
- ...quality && { quality },
90
- ...devicePixelRatio && { devicePixelRatio },
91
- ...focalPoint && { focalPoint },
92
- ...crop && { crop },
93
- ...upscaleMethod && { upscaleMethod }
94
- }
95
- }), [
96
- containerId,
97
- alignType,
98
- skipMeasure,
99
- displayMode,
100
- containerWidth,
101
- containerHeight,
102
- targetWidth,
103
- targetHeight,
104
- targetScale,
105
- isLQIP,
106
- isSEOBot,
107
- placeholderTransition,
108
- encoding,
109
- width,
110
- height,
111
- uri,
112
- name,
113
- hasAnimation,
114
- quality,
115
- devicePixelRatio,
116
- focalPoint,
117
- crop,
118
- upscaleMethod
119
- ]);
120
- const ssrResult = ssrImageData.current;
121
- const src = ssrResult == null ? void 0 : ssrResult.uri;
122
- const srcset = ssrResult == null ? void 0 : ssrResult.srcset;
123
- const placeholderStyle = (_a = ssrResult.css) == null ? void 0 : _a.img;
124
- const classNames = `${styles.image} ${className}`;
125
- React.useEffect(() => {
126
- const imgElement = imageRef.current;
127
- if (onLoad && (imgElement == null ? void 0 : imgElement.currentSrc) && (imgElement == null ? void 0 : imgElement.complete)) {
128
- onLoad({
129
- target: imgElement
130
- });
131
- }
132
- }, []);
133
- const maxWidth = ssrResult && !(ssrResult == null ? void 0 : ssrResult.transformed) ? `max(${width}px, 100%)` : targetWidth ? `${targetWidth}px` : null;
134
- return React.createElement(
135
- "wow-image",
136
- { 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 } : {} },
137
- React.createElement("img", {
138
- src,
139
- ref: imageRef,
140
- alt: alt || "",
141
- role,
142
- style: { ...placeholderStyle, ...imageStyles },
143
- onLoad,
144
- onError,
145
- width: containerWidth ? containerWidth : void 0,
146
- height: containerHeight ? containerHeight : void 0,
147
- ...socialAttrs,
148
- 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,
149
- // @ts-expect-error fetchpriority type should work in react > 18.3 https://github.com/facebook/react/pull/25927
150
- fetchpriority: isInFirstFold ? "high" : void 0,
151
- loading: isInFirstFold === false ? "lazy" : void 0,
152
- // 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
153
- suppressHydrationWarning: true
154
- })
155
- );
156
- };
157
- export {
158
- Image as I
159
- };