PluginProbe
Elementor Website Builder – more than just a page builder / 4.0.8
Elementor Website Builder – more than just a page builder v4.0.8
4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
← All changes | assets/js/interactions-shared-utils.js +240 -414 4.3.0-beta34.0.8 View file →
@@ -1,432 +1,258 @@
1 -'use strict';
1 +/******/ (() => { // webpackBootstrap
2 +/******/ var __webpack_modules__ = ({
2 3
3 -(function() {
4 +/***/ "../modules/interactions/assets/js/interactions-breakpoints.js":
5 +/*!*********************************************************************!*\
6 + !*** ../modules/interactions/assets/js/interactions-breakpoints.js ***!
7 + \*********************************************************************/
8 +/***/ ((__unused_webpack_module, exports) => {
4 9
5 -//#region \0rolldown/runtime.js
6 - var __defProp = Object.defineProperty;
7 - var __name = (target, value) => __defProp(target, "name", {
8 - value,
9 - configurable: true
10 - });
10 +"use strict";
11 11
12 -//#endregion
13 12
14 -//#region node_modules/@babel/runtime/helpers/esm/typeof.js
15 - function _typeof(o) {
16 - "@babel/helpers - typeof";
17 - return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
18 - return typeof o;
19 - } : function(o) {
20 - return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
21 - }, _typeof(o);
22 - }
13 +Object.defineProperty(exports, "__esModule", ({
14 + value: true
15 +}));
16 +exports.getActiveBreakpoint = getActiveBreakpoint;
17 +exports.initBreakpoints = initBreakpoints;
18 +var RESIZE_DEBOUNCE_TIMEOUT = 100;
19 +var breakpoints = {
20 + list: {},
21 + active: {},
22 + onChange: function onChange() {}
23 +};
24 +function getActiveBreakpoint() {
25 + return breakpoints.active;
26 +}
27 +function matchBreakpoint(width) {
28 + for (var label in breakpoints.list) {
29 + var breakpoint = breakpoints.list[label];
30 + if ('min' === breakpoint.direction && width >= breakpoint.value) {
31 + return label;
32 + }
33 + if ('max' === breakpoint.direction && breakpoint.value >= width) {
34 + return label;
35 + }
36 + }
37 + return 'desktop';
38 +}
39 +function attachEventListeners() {
40 + var timeout = null;
41 + var onResize = function onResize() {
42 + if (timeout) {
43 + window.clearTimeout(timeout);
44 + timeout = null;
45 + }
46 + timeout = window.setTimeout(function () {
47 + var currentBreakpoint = matchBreakpoint(window.innerWidth);
48 + if (currentBreakpoint === breakpoints.active) {
49 + return;
50 + }
51 + breakpoints.active = currentBreakpoint;
52 + if ('function' === typeof breakpoints.onChange) {
53 + breakpoints.onChange(breakpoints.active);
54 + }
55 + }, RESIZE_DEBOUNCE_TIMEOUT);
56 + };
57 + window.addEventListener('resize', onResize);
58 +}
59 +function getBreakpointsList() {
60 + var _ElementorInteraction;
61 + return ((_ElementorInteraction = ElementorInteractionsConfig) === null || _ElementorInteraction === void 0 ? void 0 : _ElementorInteraction.breakpoints) || {};
62 +}
63 +function initBreakpoints() {
64 + var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
65 + onChange = _ref.onChange;
66 + breakpoints.list = getBreakpointsList();
67 + breakpoints.active = matchBreakpoint(window.innerWidth);
68 + if ('function' === typeof onChange) {
69 + breakpoints.onChange = onChange;
70 + }
71 + attachEventListeners();
72 +}
23 73
24 -//#endregion
25 -//#region node_modules/@babel/runtime/helpers/esm/toPrimitive.js
26 - function toPrimitive(t, r) {
27 - if ("object" != _typeof(t) || !t) return t;
28 - var e = t[Symbol.toPrimitive];
29 - if (void 0 !== e) {
30 - var i = e.call(t, r || "default");
31 - if ("object" != _typeof(i)) return i;
32 - throw new TypeError("@@toPrimitive must return a primitive value.");
33 - }
34 - return ("string" === r ? String : Number)(t);
35 - }
74 +/***/ }),
36 75
37 -//#endregion
38 -//#region node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
39 - function toPropertyKey(t) {
40 - var i = toPrimitive(t, "string");
41 - return "symbol" == _typeof(i) ? i : i + "";
42 - }
76 +/***/ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js":
77 +/*!***********************************************************************!*\
78 + !*** ../node_modules/@babel/runtime/helpers/interopRequireDefault.js ***!
79 + \***********************************************************************/
80 +/***/ ((module) => {
43 81
44 -//#endregion
45 -//#region node_modules/@babel/runtime/helpers/esm/defineProperty.js
46 - function _defineProperty(e, r, t) {
47 - return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
48 - value: t,
49 - enumerable: !0,
50 - configurable: !0,
51 - writable: !0
52 - }) : e[r] = t, e;
53 - }
82 +function _interopRequireDefault(e) {
83 + return e && e.__esModule ? e : {
84 + "default": e
85 + };
86 +}
87 +module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
54 88
55 -//#endregion
56 -//#region node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
57 - function _arrayWithHoles(r) {
58 - if (Array.isArray(r)) return r;
59 - }
89 +/***/ }),
60 90
61 -//#endregion
62 -//#region node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
63 - function _iterableToArrayLimit(r, l) {
64 - var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
65 - if (null != t) {
66 - var e;
67 - var n;
68 - var i;
69 - var u;
70 - var a = [];
71 - var f = !0;
72 - var o = !1;
73 - try {
74 - if (i = (t = t.call(r)).next, 0 === l) {
75 - if (Object(t) !== t) return;
76 - f = !1;
77 - } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
78 - } catch (r) {
79 - o = !0, n = r;
80 - } finally {
81 - try {
82 - if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
83 - } finally {
84 - if (o) throw n;
85 - }
86 - }
87 - return a;
88 - }
89 - }
91 +/***/ "../node_modules/@babel/runtime/helpers/typeof.js":
92 +/*!********************************************************!*\
93 + !*** ../node_modules/@babel/runtime/helpers/typeof.js ***!
94 + \********************************************************/
95 +/***/ ((module) => {
90 96
91 -//#endregion
92 -//#region node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
93 - function _arrayLikeToArray$1(r, a) {
94 - (null == a || a > r.length) && (a = r.length);
95 - for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
96 - return n;
97 - }
98 - __name(_arrayLikeToArray$1, "_arrayLikeToArray");
97 +function _typeof(o) {
98 + "@babel/helpers - typeof";
99 99
100 -//#endregion
101 -//#region node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
102 - function _unsupportedIterableToArray$1(r, a) {
103 - if (r) {
104 - if ("string" == typeof r) return _arrayLikeToArray$1(r, a);
105 - var t = {}.toString.call(r).slice(8, -1);
106 - return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0;
107 - }
108 - }
109 - __name(_unsupportedIterableToArray$1, "_unsupportedIterableToArray");
100 + return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
101 + return typeof o;
102 + } : function (o) {
103 + return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
104 + }, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o);
105 +}
106 +module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
110 107
111 -//#endregion
112 -//#region node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
113 - function _nonIterableRest() {
114 - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
115 - }
108 +/***/ })
116 109
117 -//#endregion
118 -//#region node_modules/@babel/runtime/helpers/esm/slicedToArray.js
119 - function _slicedToArray(r, e) {
120 - return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray$1(r, e) || _nonIterableRest();
121 - }
110 +/******/ });
111 +/************************************************************************/
112 +/******/ // The module cache
113 +/******/ var __webpack_module_cache__ = {};
114 +/******/
115 +/******/ // The require function
116 +/******/ function __webpack_require__(moduleId) {
117 +/******/ // Check if module is in cache
118 +/******/ var cachedModule = __webpack_module_cache__[moduleId];
119 +/******/ if (cachedModule !== undefined) {
120 +/******/ return cachedModule.exports;
121 +/******/ }
122 +/******/ // Create a new module (and put it into the cache)
123 +/******/ var module = __webpack_module_cache__[moduleId] = {
124 +/******/ // no module.id needed
125 +/******/ // no module.loaded needed
126 +/******/ exports: {}
127 +/******/ };
128 +/******/
129 +/******/ // Execute the module function
130 +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
131 +/******/
132 +/******/ // Return the exports of the module
133 +/******/ return module.exports;
134 +/******/ }
135 +/******/
136 +/************************************************************************/
137 +var __webpack_exports__ = {};
138 +// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
139 +(() => {
140 +"use strict";
141 +var exports = __webpack_exports__;
142 +/*!**********************************************************************!*\
143 + !*** ../modules/interactions/assets/js/interactions-shared-utils.js ***!
144 + \**********************************************************************/
122 145
123 -//#endregion
124 -//#region modules/interactions/assets/js/interactions-breakpoints.js
125 - var breakpoints = {
126 - list: {},
127 - active: {},
128 - onChange: function onChange() {}
129 - };
130 - function getActiveBreakpoint() {
131 - return breakpoints.active;
132 - }
133 146
134 -//#endregion
135 -//#region modules/interactions/assets/js/interactions-shared-utils.js
136 - function ownKeys(e, r) {
137 - var t = Object.keys(e);
138 - if (Object.getOwnPropertySymbols) {
139 - var o = Object.getOwnPropertySymbols(e);
140 - r && (o = o.filter(function(r) {
141 - return Object.getOwnPropertyDescriptor(e, r).enumerable;
142 - })), t.push.apply(t, o);
143 - }
144 - return t;
145 - }
146 - function _objectSpread(e) {
147 - for (var r = 1; r < arguments.length; r++) {
148 - var t = null != arguments[r] ? arguments[r] : {};
149 - r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
150 - _defineProperty(e, r, t[r]);
151 - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
152 - Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
153 - });
154 - }
155 - return e;
156 - }
157 - function _createForOfIteratorHelper(r, e) {
158 - var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
159 - if (!t) {
160 - if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
161 - t && (r = t);
162 - var _n = 0;
163 - var F = function F() {};
164 - return {
165 - s: F,
166 - n: function n() {
167 - return _n >= r.length ? { done: !0 } : {
168 - done: !1,
169 - value: r[_n++]
170 - };
171 - },
172 - e: function e(r) {
173 - throw r;
174 - },
175 - f: F
176 - };
177 - }
178 - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
179 - }
180 - var o;
181 - var a = !0;
182 - var u = !1;
183 - return {
184 - s: function s() {
185 - t = t.call(r);
186 - },
187 - n: function n() {
188 - var r = t.next();
189 - return a = r.done, r;
190 - },
191 - e: function e(r) {
192 - u = !0, o = r;
193 - },
194 - f: function f() {
195 - try {
196 - a || null == t.return || t.return();
197 - } finally {
198 - if (u) throw o;
199 - }
200 - }
201 - };
202 - }
203 - function _unsupportedIterableToArray(r, a) {
204 - if (r) {
205 - if ("string" == typeof r) return _arrayLikeToArray(r, a);
206 - var t = {}.toString.call(r).slice(8, -1);
207 - return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
208 - }
209 - }
210 - function _arrayLikeToArray(r, a) {
211 - (null == a || a > r.length) && (a = r.length);
212 - for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
213 - return n;
214 - }
215 - function config() {
216 - var _window$ElementorInte;
217 - var _window$ElementorInte2;
218 - return (_window$ElementorInte = (_window$ElementorInte2 = window.ElementorInteractionsConfig) === null || _window$ElementorInte2 === void 0 ? void 0 : _window$ElementorInte2.constants) !== null && _window$ElementorInte !== void 0 ? _window$ElementorInte : {};
219 - }
220 - function skipInteraction(interaction) {
221 - var _interaction$breakpoi;
222 - var breakpoint = getActiveBreakpoint();
223 - return interaction === null || interaction === void 0 || (_interaction$breakpoi = interaction.breakpoints) === null || _interaction$breakpoi === void 0 || (_interaction$breakpoi = _interaction$breakpoi.excluded) === null || _interaction$breakpoi === void 0 ? void 0 : _interaction$breakpoi.includes(breakpoint);
224 - }
225 - function extractInteractionId(interaction) {
226 - if ("interaction-item" === (interaction === null || interaction === void 0 ? void 0 : interaction.$$type) && interaction !== null && interaction !== void 0 && interaction.value) {
227 - var _interaction$value$in;
228 - return ((_interaction$value$in = interaction.value.interaction_id) === null || _interaction$value$in === void 0 ? void 0 : _interaction$value$in.value) || null;
229 - }
230 - return null;
231 - }
232 - function motionFunc(name) {
233 - var _window;
234 - var _window2;
235 - if ("function" !== typeof ((_window = window) === null || _window === void 0 || (_window = _window.Motion) === null || _window === void 0 ? void 0 : _window[name])) return;
236 - return (_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.Motion) === null || _window2 === void 0 ? void 0 : _window2[name];
237 - }
238 - function getAnimateFunction() {
239 - return motionFunc("animate");
240 - }
241 - function getInViewFunction() {
242 - return motionFunc("inView");
243 - }
244 - function waitForAnimateFunction(callback) {
245 - var maxAttempts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 10;
246 - if (getAnimateFunction()) {
247 - callback();
248 - return;
249 - }
250 - if (maxAttempts > 0) setTimeout(function() {
251 - return waitForAnimateFunction(callback, maxAttempts - 1);
252 - }, 100);
253 - }
254 - function parseInteractionsData(data) {
255 - if ("string" === typeof data) try {
256 - return JSON.parse(data);
257 - } catch (_unused) {
258 - return null;
259 - }
260 - return data;
261 - }
262 - function unwrapInteractionValue(propValue) {
263 - var fallback = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
264 - if (propValue && "object" === _typeof(propValue) && "$$type" in propValue) return propValue.value;
265 - return propValue !== null && propValue !== void 0 ? propValue : fallback;
266 - }
267 - function timingValueToMs(timingValue, fallbackMs) {
268 - if (null === timingValue || void 0 === timingValue) return fallbackMs;
269 - var unwrapped = unwrapInteractionValue(timingValue);
270 - if ("number" === typeof unwrapped) return unwrapped;
271 - var sizeObj = unwrapInteractionValue(unwrapped);
272 - var size = sizeObj === null || sizeObj === void 0 ? void 0 : sizeObj.size;
273 - var unit = (sizeObj === null || sizeObj === void 0 ? void 0 : sizeObj.unit) || "ms";
274 - if ("number" !== typeof size) return fallbackMs;
275 - if ("s" === unit) return size * 1e3;
276 - return size;
277 - }
278 - function resetElementStyles(element) {
279 - if (!element) return;
280 - element.style.transition = "";
281 - element.style.transform = "";
282 - element.style.opacity = "";
283 - }
284 - var TRANSFORM_EPSILON = .001;
285 - var radiansToDegrees = function radiansToDegrees(radians) {
286 - return radians * (180 / Math.PI);
287 - };
288 - var isNear = function isNear(value, expected) {
289 - return Math.abs(value - expected) <= TRANSFORM_EPSILON;
290 - };
291 - var isNearZero = function isNearZero(value) {
292 - return isNear(value, 0);
293 - };
294 - var isNearOne = function isNearOne(value) {
295 - return isNear(value, 1);
296 - };
297 - function parseMatrixValues(transformValue) {
298 - var match = transformValue.match(/^matrix(3d)?\((.+)\)$/);
299 - if (!match) return null;
300 - return match[2].split(",").map(function(token) {
301 - return Number.parseFloat(token.trim());
302 - }).filter(function(value) {
303 - return Number.isFinite(value);
304 - });
305 - }
306 - function createMatrixFromTransform(transformValue) {
307 - if (!transformValue || "none" === transformValue) return null;
308 - var _iterator = _createForOfIteratorHelper([window.DOMMatrixReadOnly, window.DOMMatrix].filter(function(Factory) {
309 - return "function" === typeof Factory;
310 - }));
311 - var _step;
312 - try {
313 - for (_iterator.s(); !(_step = _iterator.n()).done;) {
314 - var MatrixFactory = _step.value;
315 - try {
316 - var _ref;
317 - var _matrix$a;
318 - var _ref2;
319 - var _matrix$b;
320 - var _ref3;
321 - var _matrix$c;
322 - var _ref4;
323 - var _matrix$d;
324 - var _ref5;
325 - var _matrix$e;
326 - var _ref6;
327 - var _matrix$f;
328 - var matrix = new MatrixFactory(transformValue);
329 - var compactMatrix = {
330 - matrixXfromX: (_ref = (_matrix$a = matrix.a) !== null && _matrix$a !== void 0 ? _matrix$a : matrix.m11) !== null && _ref !== void 0 ? _ref : 1,
331 - matrixYfromX: (_ref2 = (_matrix$b = matrix.b) !== null && _matrix$b !== void 0 ? _matrix$b : matrix.m12) !== null && _ref2 !== void 0 ? _ref2 : 0,
332 - matrixXfromY: (_ref3 = (_matrix$c = matrix.c) !== null && _matrix$c !== void 0 ? _matrix$c : matrix.m21) !== null && _ref3 !== void 0 ? _ref3 : 0,
333 - matrixYfromY: (_ref4 = (_matrix$d = matrix.d) !== null && _matrix$d !== void 0 ? _matrix$d : matrix.m22) !== null && _ref4 !== void 0 ? _ref4 : 1,
334 - matrixTranslateX: (_ref5 = (_matrix$e = matrix.e) !== null && _matrix$e !== void 0 ? _matrix$e : matrix.m41) !== null && _ref5 !== void 0 ? _ref5 : 0,
335 - matrixTranslateY: (_ref6 = (_matrix$f = matrix.f) !== null && _matrix$f !== void 0 ? _matrix$f : matrix.m42) !== null && _ref6 !== void 0 ? _ref6 : 0
336 - };
337 - if (Object.values(compactMatrix).every(Number.isFinite)) return compactMatrix;
338 - } catch (_unused2) {}
339 - }
340 - } catch (err) {
341 - _iterator.e(err);
342 - } finally {
343 - _iterator.f();
344 - }
345 - var parsedValues = parseMatrixValues(transformValue);
346 - if (!parsedValues) return null;
347 - if (6 === parsedValues.length) {
348 - var _parsedValues = _slicedToArray(parsedValues, 6);
349 - return {
350 - matrixXfromX: _parsedValues[0],
351 - matrixYfromX: _parsedValues[1],
352 - matrixXfromY: _parsedValues[2],
353 - matrixYfromY: _parsedValues[3],
354 - matrixTranslateX: _parsedValues[4],
355 - matrixTranslateY: _parsedValues[5]
356 - };
357 - }
358 - if (16 === parsedValues.length) {
359 - var _parsedValues2 = _slicedToArray(parsedValues, 14);
360 - return {
361 - matrixXfromX: _parsedValues2[0],
362 - matrixYfromX: _parsedValues2[1],
363 - matrixXfromY: _parsedValues2[4],
364 - matrixYfromY: _parsedValues2[5],
365 - matrixTranslateX: _parsedValues2[12],
366 - matrixTranslateY: _parsedValues2[13]
367 - };
368 - }
369 - return null;
370 - }
371 - function getTransformBaselineFromComputedStyle(element) {
372 - if (!element) return null;
373 - var computedStyle = window.getComputedStyle(element);
374 - var matrix = createMatrixFromTransform((computedStyle === null || computedStyle === void 0 ? void 0 : computedStyle.transform) || "");
375 - if (!matrix) return null;
376 - var matrixXfromX = matrix.matrixXfromX;
377 - var matrixYfromX = matrix.matrixYfromX;
378 - var matrixXfromY = matrix.matrixXfromY;
379 - var matrixYfromY = matrix.matrixYfromY;
380 - var matrixTranslateX = matrix.matrixTranslateX;
381 - var matrixTranslateY = matrix.matrixTranslateY;
382 - var scaleX = Math.hypot(matrixXfromX, matrixYfromX);
383 - var determinant = matrixXfromX * matrixYfromY - matrixYfromX * matrixXfromY;
384 - var scaleY = scaleX ? determinant / scaleX : Math.hypot(matrixXfromY, matrixYfromY);
385 - var rotate = radiansToDegrees(Math.atan2(matrixYfromX, matrixXfromX));
386 - var shear = scaleX ? (matrixXfromX * matrixXfromY + matrixYfromX * matrixYfromY) / (scaleX * scaleX) : 0;
387 - var skewX = radiansToDegrees(Math.atan(shear));
388 - return {
389 - x: matrixTranslateX,
390 - y: matrixTranslateY,
391 - scaleX: Number.isFinite(scaleX) ? scaleX : 1,
392 - scaleY: Number.isFinite(scaleY) ? scaleY : 1,
393 - rotate: Number.isFinite(rotate) ? rotate : 0,
394 - skewX: Number.isFinite(skewX) ? skewX : 0
395 - };
396 - }
397 - function preserveTransformKeyframes(keyframes, baseline) {
398 - if (!baseline) return keyframes;
399 - var mergedKeyframes = _objectSpread({}, keyframes);
400 - var hasScaleShorthand = mergedKeyframes.scale !== void 0;
401 - var canSetScaleX = mergedKeyframes.scaleX === void 0 && !isNearOne(baseline.scaleX);
402 - var canSetScaleY = mergedKeyframes.scaleY === void 0 && !isNearOne(baseline.scaleY);
403 - if (mergedKeyframes.x === void 0 && !isNearZero(baseline.x)) mergedKeyframes.x = [baseline.x, baseline.x];
404 - if (mergedKeyframes.y === void 0 && !isNearZero(baseline.y)) mergedKeyframes.y = [baseline.y, baseline.y];
405 - if (!hasScaleShorthand) if (canSetScaleX && canSetScaleY && isNear(baseline.scaleX, baseline.scaleY)) mergedKeyframes.scale = [baseline.scaleX, baseline.scaleX];
406 - else {
407 - if (canSetScaleX) mergedKeyframes.scaleX = [baseline.scaleX, baseline.scaleX];
408 - if (canSetScaleY) mergedKeyframes.scaleY = [baseline.scaleY, baseline.scaleY];
409 - }
410 - if (mergedKeyframes.rotate === void 0 && mergedKeyframes.rotateZ === void 0 && !isNearZero(baseline.rotate)) mergedKeyframes.rotate = [baseline.rotate, baseline.rotate];
411 - if (mergedKeyframes.skew === void 0 && mergedKeyframes.skewX === void 0 && !isNearZero(baseline.skewX)) mergedKeyframes.skewX = [baseline.skewX, baseline.skewX];
412 - return mergedKeyframes;
413 - }
414 - window.elementorModules = window.elementorModules || {};
415 - window.elementorModules.interactions = {
416 - config,
417 - skipInteraction,
418 - extractInteractionId,
419 - getAnimateFunction,
420 - getInViewFunction,
421 - waitForAnimateFunction,
422 - parseInteractionsData,
423 - unwrapInteractionValue,
424 - timingValueToMs,
425 - resetElementStyles,
426 - getTransformBaselineFromComputedStyle,
427 - preserveTransformKeyframes
428 - };
147 +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
148 +Object.defineProperty(exports, "__esModule", ({
149 + value: true
150 +}));
151 +exports.config = config;
152 +exports.extractInteractionId = extractInteractionId;
153 +exports.getAnimateFunction = getAnimateFunction;
154 +exports.getInViewFunction = getInViewFunction;
155 +exports.parseInteractionsData = parseInteractionsData;
156 +exports.skipInteraction = skipInteraction;
157 +exports.timingValueToMs = timingValueToMs;
158 +exports.unwrapInteractionValue = unwrapInteractionValue;
159 +exports.waitForAnimateFunction = waitForAnimateFunction;
160 +var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ "../node_modules/@babel/runtime/helpers/typeof.js"));
161 +var _interactionsBreakpoints = __webpack_require__(/*! ./interactions-breakpoints.js */ "../modules/interactions/assets/js/interactions-breakpoints.js");
162 +function config() {
163 + var _window$ElementorInte, _window$ElementorInte2;
164 + return (_window$ElementorInte = (_window$ElementorInte2 = window.ElementorInteractionsConfig) === null || _window$ElementorInte2 === void 0 ? void 0 : _window$ElementorInte2.constants) !== null && _window$ElementorInte !== void 0 ? _window$ElementorInte : {};
165 +}
166 +function skipInteraction(interaction) {
167 + var _interaction$breakpoi;
168 + var breakpoint = (0, _interactionsBreakpoints.getActiveBreakpoint)();
169 + return interaction === null || interaction === void 0 || (_interaction$breakpoi = interaction.breakpoints) === null || _interaction$breakpoi === void 0 || (_interaction$breakpoi = _interaction$breakpoi.excluded) === null || _interaction$breakpoi === void 0 ? void 0 : _interaction$breakpoi.includes(breakpoint);
170 +}
171 +function extractInteractionId(interaction) {
172 + if ('interaction-item' === (interaction === null || interaction === void 0 ? void 0 : interaction.$$type) && interaction !== null && interaction !== void 0 && interaction.value) {
173 + var _interaction$value$in;
174 + return ((_interaction$value$in = interaction.value.interaction_id) === null || _interaction$value$in === void 0 ? void 0 : _interaction$value$in.value) || null;
175 + }
176 + return null;
177 +}
178 +function motionFunc(name) {
179 + var _window, _window2;
180 + if ('function' !== typeof ((_window = window) === null || _window === void 0 || (_window = _window.Motion) === null || _window === void 0 ? void 0 : _window[name])) {
181 + return undefined;
182 + }
183 + return (_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.Motion) === null || _window2 === void 0 ? void 0 : _window2[name];
184 +}
185 +function getAnimateFunction() {
186 + return motionFunc('animate');
187 +}
188 +function getInViewFunction() {
189 + return motionFunc('inView');
190 +}
191 +function waitForAnimateFunction(callback) {
192 + var maxAttempts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
193 + if (getAnimateFunction()) {
194 + callback();
195 + return;
196 + }
197 + if (maxAttempts > 0) {
198 + setTimeout(function () {
199 + return waitForAnimateFunction(callback, maxAttempts - 1);
200 + }, 100);
201 + }
202 +}
203 +function parseInteractionsData(data) {
204 + if ('string' === typeof data) {
205 + try {
206 + return JSON.parse(data);
207 + } catch (_unused) {
208 + return null;
209 + }
210 + }
211 + return data;
212 +}
213 +function unwrapInteractionValue(propValue) {
214 + var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
215 + // Supports Elementor's typed wrapper shape: { $$type: '...', value: ... }.
216 + if (propValue && 'object' === (0, _typeof2.default)(propValue) && '$$type' in propValue) {
217 + return propValue.value;
218 + }
219 + return propValue !== null && propValue !== void 0 ? propValue : fallback;
220 +}
221 +function timingValueToMs(timingValue, fallbackMs) {
222 + if (null === timingValue || undefined === timingValue) {
223 + return fallbackMs;
224 + }
225 + var unwrapped = unwrapInteractionValue(timingValue);
226 + if ('number' === typeof unwrapped) {
227 + return unwrapped;
228 + }
229 + var sizeObj = unwrapInteractionValue(unwrapped);
230 + var size = sizeObj === null || sizeObj === void 0 ? void 0 : sizeObj.size;
231 + var unit = (sizeObj === null || sizeObj === void 0 ? void 0 : sizeObj.unit) || 'ms';
232 + if ('number' !== typeof size) {
233 + return fallbackMs;
234 + }
235 + if ('s' === unit) {
236 + return size * 1000;
237 + }
238 + return size;
239 +}
429 240
430 -//#endregion
241 +// Expose on elementorModules for Pro and other consumers.
242 +window.elementorModules = window.elementorModules || {};
243 +window.elementorModules.interactions = {
244 + config: config,
245 + skipInteraction: skipInteraction,
246 + extractInteractionId: extractInteractionId,
247 + getAnimateFunction: getAnimateFunction,
248 + getInViewFunction: getInViewFunction,
249 + waitForAnimateFunction: waitForAnimateFunction,
250 + parseInteractionsData: parseInteractionsData,
251 + unwrapInteractionValue: unwrapInteractionValue,
252 + timingValueToMs: timingValueToMs
253 +};
431 254 })();
255 +
256 +/******/ })()
257 +;
432 258 //# sourceMappingURL=interactions-shared-utils.js.map