@shopgate/webpack 7.23.5-beta.4 → 7.23.5-beta.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopgate/webpack",
3
- "version": "7.23.5-beta.4",
3
+ "version": "7.23.5-beta.6",
4
4
  "description": "The webpack configuration for Shopgate's Engage.",
5
5
  "main": "webpack.config.js",
6
6
  "license": "Apache-2.0",
@@ -0,0 +1,335 @@
1
+ import { a as getWindow, g as getDocument } from 'swiper/shared/ssr-window.esm.mjs';
2
+
3
+ function classesToTokens(classes) {
4
+ if (classes === void 0) {
5
+ classes = '';
6
+ }
7
+ return classes.trim().split(' ').filter(c => !!c.trim());
8
+ }
9
+
10
+ function deleteProps(obj) {
11
+ const object = obj;
12
+ Object.keys(object).forEach((key) => {
13
+ try {
14
+ object[key] = null;
15
+ } catch (e) {
16
+ // no getter for object
17
+ }
18
+ try {
19
+ delete object[key];
20
+ } catch (e) {
21
+ // something got wrong
22
+ }
23
+ });
24
+ }
25
+ function nextTick(callback, delay) {
26
+ if (delay === void 0) {
27
+ delay = 0;
28
+ }
29
+ return setTimeout(callback, delay);
30
+ }
31
+ function now() {
32
+ return Date.now();
33
+ }
34
+ function getComputedStyle(el) {
35
+ const window = getWindow();
36
+ let style;
37
+ if (window.getComputedStyle) {
38
+ style = window.getComputedStyle(el, null);
39
+ }
40
+ if (!style && el.currentStyle) {
41
+ style = el.currentStyle;
42
+ }
43
+ if (!style) {
44
+ style = el.style;
45
+ }
46
+ return style;
47
+ }
48
+ function getTranslate(el, axis) {
49
+ if (axis === void 0) {
50
+ axis = 'x';
51
+ }
52
+ const window = getWindow();
53
+ let matrix;
54
+ let curTransform;
55
+ let transformMatrix;
56
+ const curStyle = getComputedStyle(el);
57
+ if (window.WebKitCSSMatrix) {
58
+ curTransform = curStyle.transform || curStyle.webkitTransform;
59
+ if (curTransform.split(',').length > 6) {
60
+ curTransform = curTransform.split(', ').map(a => a.replace(',', '.')).join(', ');
61
+ }
62
+ // Some old versions of Webkit choke when 'none' is passed; pass
63
+ // empty string instead in this case
64
+ transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);
65
+ } else {
66
+ transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
67
+ matrix = transformMatrix.toString().split(',');
68
+ }
69
+ if (axis === 'x') {
70
+ // Latest Chrome and webkits Fix
71
+ if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41;
72
+ // Crazy IE10 Matrix
73
+ else if (matrix.length === 16) curTransform = parseFloat(matrix[12]);
74
+ // Normal Browsers
75
+ else curTransform = parseFloat(matrix[4]);
76
+ }
77
+ if (axis === 'y') {
78
+ // Latest Chrome and webkits Fix
79
+ if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42;
80
+ // Crazy IE10 Matrix
81
+ else if (matrix.length === 16) curTransform = parseFloat(matrix[13]);
82
+ // Normal Browsers
83
+ else curTransform = parseFloat(matrix[5]);
84
+ }
85
+ return curTransform || 0;
86
+ }
87
+ function isObject(o) {
88
+ return typeof o === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object';
89
+ }
90
+ function isNode(node) {
91
+ if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') {
92
+ return node instanceof HTMLElement;
93
+ }
94
+ return node && (node.nodeType === 1 || node.nodeType === 11);
95
+ }
96
+ function extend() {
97
+ const to = Object(arguments.length <= 0 ? undefined : arguments[0]);
98
+ const noExtend = ['__proto__', 'constructor', 'prototype'];
99
+ for (let i = 1; i < arguments.length; i += 1) {
100
+ const nextSource = i < 0 || arguments.length <= i ? undefined : arguments[i];
101
+ if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) {
102
+ const keysArray = Object.keys(Object(nextSource)).filter(key => noExtend.indexOf(key) < 0);
103
+ for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) {
104
+ const nextKey = keysArray[nextIndex];
105
+ const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
106
+ if (desc !== undefined && desc.enumerable) {
107
+ if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
108
+ if (nextSource[nextKey].__swiper__) {
109
+ to[nextKey] = nextSource[nextKey];
110
+ } else {
111
+ extend(to[nextKey], nextSource[nextKey]);
112
+ }
113
+ } else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
114
+ to[nextKey] = {};
115
+ if (nextSource[nextKey].__swiper__) {
116
+ to[nextKey] = nextSource[nextKey];
117
+ } else {
118
+ extend(to[nextKey], nextSource[nextKey]);
119
+ }
120
+ } else {
121
+ to[nextKey] = nextSource[nextKey];
122
+ }
123
+ }
124
+ }
125
+ }
126
+ }
127
+ return to;
128
+ }
129
+ function setCSSProperty(el, varName, varValue) {
130
+ el.style.setProperty(varName, varValue);
131
+ }
132
+ function animateCSSModeScroll(_ref) {
133
+ const {
134
+ swiper,
135
+ targetPosition,
136
+ side,
137
+ } = _ref;
138
+ const window = getWindow();
139
+ const startPosition = -swiper.translate;
140
+ let startTime = null;
141
+ let time;
142
+ const duration = swiper.params.speed;
143
+ swiper.wrapperEl.style.scrollSnapType = 'none';
144
+ window.cancelAnimationFrame(swiper.cssModeFrameID);
145
+ const dir = targetPosition > startPosition ? 'next' : 'prev';
146
+ const isOutOfBound = (current, target) => dir === 'next' && current >= target || dir === 'prev' && current <= target;
147
+ const animate = () => {
148
+ time = new Date().getTime();
149
+ if (startTime === null) {
150
+ startTime = time;
151
+ }
152
+ const progress = Math.max(Math.min((time - startTime) / duration, 1), 0);
153
+ const easeProgress = 0.5 - Math.cos(progress * Math.PI) / 2;
154
+ let currentPosition = startPosition + easeProgress * (targetPosition - startPosition);
155
+ if (isOutOfBound(currentPosition, targetPosition)) {
156
+ currentPosition = targetPosition;
157
+ }
158
+ swiper.wrapperEl.scrollTo({
159
+ [side]: currentPosition,
160
+ });
161
+ if (isOutOfBound(currentPosition, targetPosition)) {
162
+ swiper.wrapperEl.style.overflow = 'hidden';
163
+ swiper.wrapperEl.style.scrollSnapType = '';
164
+ setTimeout(() => {
165
+ swiper.wrapperEl.style.overflow = '';
166
+ swiper.wrapperEl.scrollTo({
167
+ [side]: currentPosition,
168
+ });
169
+ });
170
+ window.cancelAnimationFrame(swiper.cssModeFrameID);
171
+ return;
172
+ }
173
+ swiper.cssModeFrameID = window.requestAnimationFrame(animate);
174
+ };
175
+ animate();
176
+ }
177
+ function getSlideTransformEl(slideEl) {
178
+ return slideEl.querySelector('.swiper-slide-transform') || slideEl.shadowRoot && slideEl.shadowRoot.querySelector('.swiper-slide-transform') || slideEl;
179
+ }
180
+ function elementChildren(element, selector) {
181
+ if (selector === void 0) {
182
+ selector = '';
183
+ }
184
+ const window = getWindow();
185
+ const children = [...element.children];
186
+ if (window.HTMLSlotElement && element instanceof HTMLSlotElement) {
187
+ children.push(...element.assignedElements());
188
+ }
189
+ if (!selector) {
190
+ return children;
191
+ }
192
+ return children.filter(el => el.matches(selector));
193
+ }
194
+ function elementIsChildOfSlot(el, slot) {
195
+ // Breadth-first search through all parent's children and assigned elements
196
+ const elementsQueue = [slot];
197
+ while (elementsQueue.length > 0) {
198
+ const elementToCheck = elementsQueue.shift();
199
+ if (el === elementToCheck) {
200
+ return true;
201
+ }
202
+ elementsQueue.push(
203
+ ...elementToCheck.children,
204
+ ...(elementToCheck.shadowRoot && elementToCheck.shadowRoot.children ? elementToCheck.shadowRoot.children : []),
205
+ ...(elementToCheck.assignedElements ? elementToCheck.assignedElements() : [])
206
+ );
207
+ }
208
+ }
209
+ function elementIsChildOf(el, parent) {
210
+ const window = getWindow();
211
+ let isChild = parent.contains(el);
212
+ if (!isChild && window.HTMLSlotElement && parent instanceof HTMLSlotElement) {
213
+ const children = [...parent.assignedElements()];
214
+ isChild = children.includes(el);
215
+ if (!isChild) {
216
+ isChild = elementIsChildOfSlot(el, parent);
217
+ }
218
+ }
219
+ return isChild;
220
+ }
221
+ function showWarning(text) {
222
+ try {
223
+ console.warn(text);
224
+ } catch (err) {
225
+ // err
226
+ }
227
+ }
228
+ function createElement(tag, classes) {
229
+ if (classes === void 0) {
230
+ classes = [];
231
+ }
232
+ const el = document.createElement(tag);
233
+ el.classList.add(...(Array.isArray(classes) ? classes : classesToTokens(classes)));
234
+ return el;
235
+ }
236
+ function elementOffset(el) {
237
+ const window = getWindow();
238
+ const document = getDocument();
239
+ const box = el.getBoundingClientRect();
240
+ const body = document.body;
241
+ const clientTop = el.clientTop || body.clientTop || 0;
242
+ const clientLeft = el.clientLeft || body.clientLeft || 0;
243
+ const scrollTop = el === window ? window.scrollY : el.scrollTop;
244
+ const scrollLeft = el === window ? window.scrollX : el.scrollLeft;
245
+ return {
246
+ top: box.top + scrollTop - clientTop,
247
+ left: box.left + scrollLeft - clientLeft,
248
+ };
249
+ }
250
+ function elementPrevAll(el, selector) {
251
+ const prevEls = [];
252
+ while (el.previousElementSibling) {
253
+ const prev = el.previousElementSibling; // eslint-disable-line
254
+ if (selector) {
255
+ if (prev.matches(selector)) prevEls.push(prev);
256
+ } else prevEls.push(prev);
257
+ el = prev;
258
+ }
259
+ return prevEls;
260
+ }
261
+ function elementNextAll(el, selector) {
262
+ const nextEls = [];
263
+ while (el.nextElementSibling) {
264
+ const next = el.nextElementSibling; // eslint-disable-line
265
+ if (selector) {
266
+ if (next.matches(selector)) nextEls.push(next);
267
+ } else nextEls.push(next);
268
+ el = next;
269
+ }
270
+ return nextEls;
271
+ }
272
+ function elementStyle(el, prop) {
273
+ const window = getWindow();
274
+ return window.getComputedStyle(el, null).getPropertyValue(prop);
275
+ }
276
+ function elementIndex(el) {
277
+ let child = el;
278
+ let i;
279
+ if (child) {
280
+ i = 0;
281
+ // eslint-disable-next-line
282
+ while ((child = child.previousSibling) !== null) {
283
+ if (child.nodeType === 1) i += 1;
284
+ }
285
+ return i;
286
+ }
287
+ return undefined;
288
+ }
289
+ function elementParents(el, selector) {
290
+ const parents = []; // eslint-disable-line
291
+ let parent = el.parentElement; // eslint-disable-line
292
+ while (parent) {
293
+ if (selector) {
294
+ if (parent.matches(selector)) parents.push(parent);
295
+ } else {
296
+ parents.push(parent);
297
+ }
298
+ parent = parent.parentElement;
299
+ }
300
+ return parents;
301
+ }
302
+ function elementTransitionEnd(el, callback) {
303
+ function fireCallBack(e) {
304
+ if (e.target !== el) return;
305
+ callback.call(el, e);
306
+ el.removeEventListener('transitionend', fireCallBack);
307
+ }
308
+ if (callback) {
309
+ el.addEventListener('transitionend', fireCallBack);
310
+ }
311
+ }
312
+ function elementOuterSize(el, size, includeMargins) {
313
+ const window = getWindow();
314
+ if (includeMargins) {
315
+ return el[size === 'width' ? 'offsetWidth' : 'offsetHeight'] + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-right' : 'margin-top')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-left' : 'margin-bottom'));
316
+ }
317
+ return el.offsetWidth;
318
+ }
319
+ function makeElementsArray(el) {
320
+ return (Array.isArray(el) ? el : [el]).filter(e => !!e);
321
+ }
322
+ function getRotateFix(swiper) {
323
+ return (v) => {
324
+ if (Math.abs(v) > 0 && swiper.browser && swiper.browser.need3dFix && Math.abs(v) % 90 === 0) {
325
+ return v + 0.001;
326
+ }
327
+ return v;
328
+ };
329
+ }
330
+
331
+ export {
332
+ elementParents as a, elementOffset as b, createElement as c, now as d, elementChildren as e, elementOuterSize as f, getSlideTransformEl as g, elementIndex as h, classesToTokens as i, getTranslate as j, elementTransitionEnd as k, isObject as l, makeElementsArray as m, nextTick as n, getRotateFix as o, elementStyle as p, elementNextAll as q, elementPrevAll as r, setCSSProperty as s, animateCSSModeScroll as t, showWarning as u, elementIsChildOf as v, extend as w, deleteProps as x,
333
+ };
334
+
335
+ /* eslint-enable */
package/webpack.config.js CHANGED
@@ -74,6 +74,10 @@ const config = {
74
74
  plugins: [
75
75
  new ShopgateThemeConfigValidatorPlugin(),
76
76
  new ShopgateIndexerPlugin(),
77
+ new webpack.NormalModuleReplacementPlugin(
78
+ /swiper\/shared\/utils\.mjs$/,
79
+ path.resolve(__dirname, 'patches', 'swiper', 'shared', 'utils.mjs')
80
+ ),
77
81
  new webpack.DefinePlugin({
78
82
  'process.env': {
79
83
  NODE_ENV: JSON.stringify(ENV),