PluginProbe
Elementor Website Builder – more than just a page builder / 4.0.0-beta1
Elementor Website Builder – more than just a page builder v4.0.0-beta1
4.3.2 4.3.1 4.3.0 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 All 455 releases
← All changes | assets/js/editor-interactions.js +811 -658 4.3.2 → 4.0.0-beta1 View file →
@@ -1,678 +1,831 @@
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 +/***/ "../modules/interactions/assets/js/interactions-shared-utils.js":
77 +/*!**********************************************************************!*\
78 + !*** ../modules/interactions/assets/js/interactions-shared-utils.js ***!
79 + \**********************************************************************/
80 +/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
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 +"use strict";
54 83
55 -//#endregion
56 -//#region node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
57 - function _arrayWithHoles(r) {
58 - if (Array.isArray(r)) return r;
59 - }
60 84
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 - }
85 +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
86 +Object.defineProperty(exports, "__esModule", ({
87 + value: true
88 +}));
89 +exports.config = config;
90 +exports.extractInteractionId = extractInteractionId;
91 +exports.getAnimateFunction = getAnimateFunction;
92 +exports.getInViewFunction = getInViewFunction;
93 +exports.parseInteractionsData = parseInteractionsData;
94 +exports.skipInteraction = skipInteraction;
95 +exports.timingValueToMs = timingValueToMs;
96 +exports.unwrapInteractionValue = unwrapInteractionValue;
97 +exports.waitForAnimateFunction = waitForAnimateFunction;
98 +var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ "../node_modules/@babel/runtime/helpers/typeof.js"));
99 +var _interactionsBreakpoints = __webpack_require__(/*! ./interactions-breakpoints.js */ "../modules/interactions/assets/js/interactions-breakpoints.js");
100 +function config() {
101 + var _window$ElementorInte, _window$ElementorInte2;
102 + return (_window$ElementorInte = (_window$ElementorInte2 = window.ElementorInteractionsConfig) === null || _window$ElementorInte2 === void 0 ? void 0 : _window$ElementorInte2.constants) !== null && _window$ElementorInte !== void 0 ? _window$ElementorInte : {};
103 +}
104 +function skipInteraction(interaction) {
105 + var _interaction$breakpoi;
106 + var breakpoint = (0, _interactionsBreakpoints.getActiveBreakpoint)();
107 + 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);
108 +}
109 +function extractInteractionId(interaction) {
110 + if ('interaction-item' === (interaction === null || interaction === void 0 ? void 0 : interaction.$$type) && interaction !== null && interaction !== void 0 && interaction.value) {
111 + var _interaction$value$in;
112 + return ((_interaction$value$in = interaction.value.interaction_id) === null || _interaction$value$in === void 0 ? void 0 : _interaction$value$in.value) || null;
113 + }
114 + return null;
115 +}
116 +function motionFunc(name) {
117 + var _window, _window2;
118 + if ('function' !== typeof ((_window = window) === null || _window === void 0 || (_window = _window.Motion) === null || _window === void 0 ? void 0 : _window[name])) {
119 + return undefined;
120 + }
121 + return (_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.Motion) === null || _window2 === void 0 ? void 0 : _window2[name];
122 +}
123 +function getAnimateFunction() {
124 + return motionFunc('animate');
125 +}
126 +function getInViewFunction() {
127 + return motionFunc('inView');
128 +}
129 +function waitForAnimateFunction(callback) {
130 + var maxAttempts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
131 + if (getAnimateFunction()) {
132 + callback();
133 + return;
134 + }
135 + if (maxAttempts > 0) {
136 + setTimeout(function () {
137 + return waitForAnimateFunction(callback, maxAttempts - 1);
138 + }, 100);
139 + }
140 +}
141 +function parseInteractionsData(data) {
142 + if ('string' === typeof data) {
143 + try {
144 + return JSON.parse(data);
145 + } catch (_unused) {
146 + return null;
147 + }
148 + }
149 + return data;
150 +}
151 +function unwrapInteractionValue(propValue) {
152 + var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
153 + // Supports Elementor's typed wrapper shape: { $$type: '...', value: ... }.
154 + if (propValue && 'object' === (0, _typeof2.default)(propValue) && '$$type' in propValue) {
155 + return propValue.value;
156 + }
157 + return propValue !== null && propValue !== void 0 ? propValue : fallback;
158 +}
159 +function timingValueToMs(timingValue, fallbackMs) {
160 + if (null === timingValue || undefined === timingValue) {
161 + return fallbackMs;
162 + }
163 + var unwrapped = unwrapInteractionValue(timingValue);
164 + if ('number' === typeof unwrapped) {
165 + return unwrapped;
166 + }
167 + var sizeObj = unwrapInteractionValue(unwrapped);
168 + var size = sizeObj === null || sizeObj === void 0 ? void 0 : sizeObj.size;
169 + var unit = (sizeObj === null || sizeObj === void 0 ? void 0 : sizeObj.unit) || 'ms';
170 + if ('number' !== typeof size) {
171 + return fallbackMs;
172 + }
173 + if ('s' === unit) {
174 + return size * 1000;
175 + }
176 + return size;
177 +}
90 178
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");
179 +// Expose on elementorModules for Pro and other consumers.
180 +window.elementorModules = window.elementorModules || {};
181 +window.elementorModules.interactions = {
182 + config: config,
183 + skipInteraction: skipInteraction,
184 + extractInteractionId: extractInteractionId,
185 + getAnimateFunction: getAnimateFunction,
186 + getInViewFunction: getInViewFunction,
187 + waitForAnimateFunction: waitForAnimateFunction,
188 + parseInteractionsData: parseInteractionsData,
189 + unwrapInteractionValue: unwrapInteractionValue,
190 + timingValueToMs: timingValueToMs
191 +};
99 192
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");
193 +/***/ }),
110 194
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 - }
195 +/***/ "../modules/interactions/assets/js/interactions-utils.js":
196 +/*!***************************************************************!*\
197 + !*** ../modules/interactions/assets/js/interactions-utils.js ***!
198 + \***************************************************************/
199 +/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
116 200
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 - }
201 +"use strict";
122 202
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 203
134 -//#endregion
135 -//#region modules/interactions/assets/js/interactions-shared-utils.js
136 - function ownKeys$1(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 - __name(ownKeys$1, "ownKeys");
147 - function _objectSpread$1(e) {
148 - for (var r = 1; r < arguments.length; r++) {
149 - var t = null != arguments[r] ? arguments[r] : {};
150 - r % 2 ? ownKeys$1(Object(t), !0).forEach(function(r) {
151 - _defineProperty(e, r, t[r]);
152 - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function(r) {
153 - Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
154 - });
155 - }
156 - return e;
157 - }
158 - __name(_objectSpread$1, "_objectSpread");
159 - function _createForOfIteratorHelper(r, e) {
160 - var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
161 - if (!t) {
162 - if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
163 - t && (r = t);
164 - var _n = 0;
165 - var F = function F() {};
166 - return {
167 - s: F,
168 - n: function n() {
169 - return _n >= r.length ? { done: !0 } : {
170 - done: !1,
171 - value: r[_n++]
172 - };
173 - },
174 - e: function e(r) {
175 - throw r;
176 - },
177 - f: F
178 - };
179 - }
180 - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
181 - }
182 - var o;
183 - var a = !0;
184 - var u = !1;
185 - return {
186 - s: function s() {
187 - t = t.call(r);
188 - },
189 - n: function n() {
190 - var r = t.next();
191 - return a = r.done, r;
192 - },
193 - e: function e(r) {
194 - u = !0, o = r;
195 - },
196 - f: function f() {
197 - try {
198 - a || null == t.return || t.return();
199 - } finally {
200 - if (u) throw o;
201 - }
202 - }
203 - };
204 - }
205 - function _unsupportedIterableToArray(r, a) {
206 - if (r) {
207 - if ("string" == typeof r) return _arrayLikeToArray(r, a);
208 - var t = {}.toString.call(r).slice(8, -1);
209 - 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;
210 - }
211 - }
212 - function _arrayLikeToArray(r, a) {
213 - (null == a || a > r.length) && (a = r.length);
214 - for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
215 - return n;
216 - }
217 - function config() {
218 - var _window$ElementorInte;
219 - var _window$ElementorInte2;
220 - return (_window$ElementorInte = (_window$ElementorInte2 = window.ElementorInteractionsConfig) === null || _window$ElementorInte2 === void 0 ? void 0 : _window$ElementorInte2.constants) !== null && _window$ElementorInte !== void 0 ? _window$ElementorInte : {};
221 - }
222 - function skipInteraction(interaction) {
223 - var _interaction$breakpoi;
224 - var breakpoint = getActiveBreakpoint();
225 - 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);
226 - }
227 - function extractInteractionId(interaction) {
228 - if ("interaction-item" === (interaction === null || interaction === void 0 ? void 0 : interaction.$$type) && interaction !== null && interaction !== void 0 && interaction.value) {
229 - var _interaction$value$in;
230 - return ((_interaction$value$in = interaction.value.interaction_id) === null || _interaction$value$in === void 0 ? void 0 : _interaction$value$in.value) || null;
231 - }
232 - return null;
233 - }
234 - function motionFunc(name) {
235 - var _window;
236 - var _window2;
237 - if ("function" !== typeof ((_window = window) === null || _window === void 0 || (_window = _window.Motion) === null || _window === void 0 ? void 0 : _window[name])) return;
238 - return (_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.Motion) === null || _window2 === void 0 ? void 0 : _window2[name];
239 - }
240 - function getAnimateFunction() {
241 - return motionFunc("animate");
242 - }
243 - function getInViewFunction() {
244 - return motionFunc("inView");
245 - }
246 - function waitForAnimateFunction(callback) {
247 - var maxAttempts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 10;
248 - if (getAnimateFunction()) {
249 - callback();
250 - return;
251 - }
252 - if (maxAttempts > 0) setTimeout(function() {
253 - return waitForAnimateFunction(callback, maxAttempts - 1);
254 - }, 100);
255 - }
256 - function parseInteractionsData(data) {
257 - if ("string" === typeof data) try {
258 - return JSON.parse(data);
259 - } catch (_unused) {
260 - return null;
261 - }
262 - return data;
263 - }
264 - function unwrapInteractionValue(propValue) {
265 - var fallback = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
266 - if (propValue && "object" === _typeof(propValue) && "$$type" in propValue) return propValue.value;
267 - return propValue !== null && propValue !== void 0 ? propValue : fallback;
268 - }
269 - function timingValueToMs(timingValue, fallbackMs) {
270 - if (null === timingValue || void 0 === timingValue) return fallbackMs;
271 - var unwrapped = unwrapInteractionValue(timingValue);
272 - if ("number" === typeof unwrapped) return unwrapped;
273 - var sizeObj = unwrapInteractionValue(unwrapped);
274 - var size = sizeObj === null || sizeObj === void 0 ? void 0 : sizeObj.size;
275 - var unit = (sizeObj === null || sizeObj === void 0 ? void 0 : sizeObj.unit) || "ms";
276 - if ("number" !== typeof size) return fallbackMs;
277 - if ("s" === unit) return size * 1e3;
278 - return size;
279 - }
280 - function resetElementStyles(element) {
281 - if (!element) return;
282 - element.style.transition = "";
283 - element.style.transform = "";
284 - element.style.opacity = "";
285 - }
286 - var TRANSFORM_EPSILON = .001;
287 - var radiansToDegrees = function radiansToDegrees(radians) {
288 - return radians * (180 / Math.PI);
289 - };
290 - var isNear = function isNear(value, expected) {
291 - return Math.abs(value - expected) <= TRANSFORM_EPSILON;
292 - };
293 - var isNearZero = function isNearZero(value) {
294 - return isNear(value, 0);
295 - };
296 - var isNearOne = function isNearOne(value) {
297 - return isNear(value, 1);
298 - };
299 - function parseMatrixValues(transformValue) {
300 - var match = transformValue.match(/^matrix(3d)?\((.+)\)$/);
301 - if (!match) return null;
302 - return match[2].split(",").map(function(token) {
303 - return Number.parseFloat(token.trim());
304 - }).filter(function(value) {
305 - return Number.isFinite(value);
306 - });
307 - }
308 - function createMatrixFromTransform(transformValue) {
309 - if (!transformValue || "none" === transformValue) return null;
310 - var _iterator = _createForOfIteratorHelper([window.DOMMatrixReadOnly, window.DOMMatrix].filter(function(Factory) {
311 - return "function" === typeof Factory;
312 - }));
313 - var _step;
314 - try {
315 - for (_iterator.s(); !(_step = _iterator.n()).done;) {
316 - var MatrixFactory = _step.value;
317 - try {
318 - var _ref;
319 - var _matrix$a;
320 - var _ref2;
321 - var _matrix$b;
322 - var _ref3;
323 - var _matrix$c;
324 - var _ref4;
325 - var _matrix$d;
326 - var _ref5;
327 - var _matrix$e;
328 - var _ref6;
329 - var _matrix$f;
330 - var matrix = new MatrixFactory(transformValue);
331 - var compactMatrix = {
332 - matrixXfromX: (_ref = (_matrix$a = matrix.a) !== null && _matrix$a !== void 0 ? _matrix$a : matrix.m11) !== null && _ref !== void 0 ? _ref : 1,
333 - matrixYfromX: (_ref2 = (_matrix$b = matrix.b) !== null && _matrix$b !== void 0 ? _matrix$b : matrix.m12) !== null && _ref2 !== void 0 ? _ref2 : 0,
334 - matrixXfromY: (_ref3 = (_matrix$c = matrix.c) !== null && _matrix$c !== void 0 ? _matrix$c : matrix.m21) !== null && _ref3 !== void 0 ? _ref3 : 0,
335 - matrixYfromY: (_ref4 = (_matrix$d = matrix.d) !== null && _matrix$d !== void 0 ? _matrix$d : matrix.m22) !== null && _ref4 !== void 0 ? _ref4 : 1,
336 - matrixTranslateX: (_ref5 = (_matrix$e = matrix.e) !== null && _matrix$e !== void 0 ? _matrix$e : matrix.m41) !== null && _ref5 !== void 0 ? _ref5 : 0,
337 - matrixTranslateY: (_ref6 = (_matrix$f = matrix.f) !== null && _matrix$f !== void 0 ? _matrix$f : matrix.m42) !== null && _ref6 !== void 0 ? _ref6 : 0
338 - };
339 - if (Object.values(compactMatrix).every(Number.isFinite)) return compactMatrix;
340 - } catch (_unused2) {}
341 - }
342 - } catch (err) {
343 - _iterator.e(err);
344 - } finally {
345 - _iterator.f();
346 - }
347 - var parsedValues = parseMatrixValues(transformValue);
348 - if (!parsedValues) return null;
349 - if (6 === parsedValues.length) {
350 - var _parsedValues = _slicedToArray(parsedValues, 6);
351 - return {
352 - matrixXfromX: _parsedValues[0],
353 - matrixYfromX: _parsedValues[1],
354 - matrixXfromY: _parsedValues[2],
355 - matrixYfromY: _parsedValues[3],
356 - matrixTranslateX: _parsedValues[4],
357 - matrixTranslateY: _parsedValues[5]
358 - };
359 - }
360 - if (16 === parsedValues.length) {
361 - var _parsedValues2 = _slicedToArray(parsedValues, 14);
362 - return {
363 - matrixXfromX: _parsedValues2[0],
364 - matrixYfromX: _parsedValues2[1],
365 - matrixXfromY: _parsedValues2[4],
366 - matrixYfromY: _parsedValues2[5],
367 - matrixTranslateX: _parsedValues2[12],
368 - matrixTranslateY: _parsedValues2[13]
369 - };
370 - }
371 - return null;
372 - }
373 - function getTransformBaselineFromComputedStyle(element) {
374 - if (!element) return null;
375 - var computedStyle = window.getComputedStyle(element);
376 - var matrix = createMatrixFromTransform((computedStyle === null || computedStyle === void 0 ? void 0 : computedStyle.transform) || "");
377 - if (!matrix) return null;
378 - var matrixXfromX = matrix.matrixXfromX;
379 - var matrixYfromX = matrix.matrixYfromX;
380 - var matrixXfromY = matrix.matrixXfromY;
381 - var matrixYfromY = matrix.matrixYfromY;
382 - var matrixTranslateX = matrix.matrixTranslateX;
383 - var matrixTranslateY = matrix.matrixTranslateY;
384 - var scaleX = Math.hypot(matrixXfromX, matrixYfromX);
385 - var determinant = matrixXfromX * matrixYfromY - matrixYfromX * matrixXfromY;
386 - var scaleY = scaleX ? determinant / scaleX : Math.hypot(matrixXfromY, matrixYfromY);
387 - var rotate = radiansToDegrees(Math.atan2(matrixYfromX, matrixXfromX));
388 - var shear = scaleX ? (matrixXfromX * matrixXfromY + matrixYfromX * matrixYfromY) / (scaleX * scaleX) : 0;
389 - var skewX = radiansToDegrees(Math.atan(shear));
390 - return {
391 - x: matrixTranslateX,
392 - y: matrixTranslateY,
393 - scaleX: Number.isFinite(scaleX) ? scaleX : 1,
394 - scaleY: Number.isFinite(scaleY) ? scaleY : 1,
395 - rotate: Number.isFinite(rotate) ? rotate : 0,
396 - skewX: Number.isFinite(skewX) ? skewX : 0
397 - };
398 - }
399 - function preserveTransformKeyframes(keyframes, baseline) {
400 - if (!baseline) return keyframes;
401 - var mergedKeyframes = _objectSpread$1({}, keyframes);
402 - var hasScaleShorthand = mergedKeyframes.scale !== void 0;
403 - var canSetScaleX = mergedKeyframes.scaleX === void 0 && !isNearOne(baseline.scaleX);
404 - var canSetScaleY = mergedKeyframes.scaleY === void 0 && !isNearOne(baseline.scaleY);
405 - if (mergedKeyframes.x === void 0 && !isNearZero(baseline.x)) mergedKeyframes.x = [baseline.x, baseline.x];
406 - if (mergedKeyframes.y === void 0 && !isNearZero(baseline.y)) mergedKeyframes.y = [baseline.y, baseline.y];
407 - if (!hasScaleShorthand) if (canSetScaleX && canSetScaleY && isNear(baseline.scaleX, baseline.scaleY)) mergedKeyframes.scale = [baseline.scaleX, baseline.scaleX];
408 - else {
409 - if (canSetScaleX) mergedKeyframes.scaleX = [baseline.scaleX, baseline.scaleX];
410 - if (canSetScaleY) mergedKeyframes.scaleY = [baseline.scaleY, baseline.scaleY];
411 - }
412 - if (mergedKeyframes.rotate === void 0 && mergedKeyframes.rotateZ === void 0 && !isNearZero(baseline.rotate)) mergedKeyframes.rotate = [baseline.rotate, baseline.rotate];
413 - if (mergedKeyframes.skew === void 0 && mergedKeyframes.skewX === void 0 && !isNearZero(baseline.skewX)) mergedKeyframes.skewX = [baseline.skewX, baseline.skewX];
414 - return mergedKeyframes;
415 - }
416 - window.elementorModules = window.elementorModules || {};
417 - window.elementorModules.interactions = {
418 - config,
419 - skipInteraction,
420 - extractInteractionId,
421 - getAnimateFunction,
422 - getInViewFunction,
423 - waitForAnimateFunction,
424 - parseInteractionsData,
425 - unwrapInteractionValue,
426 - timingValueToMs,
427 - resetElementStyles,
428 - getTransformBaselineFromComputedStyle,
429 - preserveTransformKeyframes
430 - };
204 +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
205 +Object.defineProperty(exports, "__esModule", ({
206 + value: true
207 +}));
208 +Object.defineProperty(exports, "config", ({
209 + enumerable: true,
210 + get: function get() {
211 + return _interactionsSharedUtils.config;
212 + }
213 +}));
214 +exports.extractAnimationConfig = extractAnimationConfig;
215 +Object.defineProperty(exports, "extractInteractionId", ({
216 + enumerable: true,
217 + get: function get() {
218 + return _interactionsSharedUtils.extractInteractionId;
219 + }
220 +}));
221 +exports.findElementByDataId = findElementByDataId;
222 +Object.defineProperty(exports, "getAnimateFunction", ({
223 + enumerable: true,
224 + get: function get() {
225 + return _interactionsSharedUtils.getAnimateFunction;
226 + }
227 +}));
228 +Object.defineProperty(exports, "getInViewFunction", ({
229 + enumerable: true,
230 + get: function get() {
231 + return _interactionsSharedUtils.getInViewFunction;
232 + }
233 +}));
234 +exports.getInteractionsData = getInteractionsData;
235 +exports.getKeyframes = getKeyframes;
236 +exports.parseAnimationName = parseAnimationName;
237 +Object.defineProperty(exports, "parseInteractionsData", ({
238 + enumerable: true,
239 + get: function get() {
240 + return _interactionsSharedUtils.parseInteractionsData;
241 + }
242 +}));
243 +Object.defineProperty(exports, "skipInteraction", ({
244 + enumerable: true,
245 + get: function get() {
246 + return _interactionsSharedUtils.skipInteraction;
247 + }
248 +}));
249 +Object.defineProperty(exports, "timingValueToMs", ({
250 + enumerable: true,
251 + get: function get() {
252 + return _interactionsSharedUtils.timingValueToMs;
253 + }
254 +}));
255 +Object.defineProperty(exports, "unwrapInteractionValue", ({
256 + enumerable: true,
257 + get: function get() {
258 + return _interactionsSharedUtils.unwrapInteractionValue;
259 + }
260 +}));
261 +Object.defineProperty(exports, "waitForAnimateFunction", ({
262 + enumerable: true,
263 + get: function get() {
264 + return _interactionsSharedUtils.waitForAnimateFunction;
265 + }
266 +}));
267 +var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "../node_modules/@babel/runtime/helpers/slicedToArray.js"));
268 +var _interactionsSharedUtils = __webpack_require__(/*! ./interactions-shared-utils.js */ "../modules/interactions/assets/js/interactions-shared-utils.js");
269 +function getKeyframes(effect, type, direction) {
270 + var isIn = 'in' === type;
271 + var keyframes = {};
272 + if ('fade' === effect) {
273 + keyframes.opacity = isIn ? [0, 1] : [1, 0];
274 + }
275 + var config = (0, _interactionsSharedUtils.config)();
276 + if ('scale' === effect) {
277 + keyframes.scale = isIn ? [config.scaleStart, 1] : [1, config.scaleStart];
278 + }
279 + if (direction) {
280 + var distance = config.slideDistance;
281 + var movement = {
282 + left: {
283 + x: isIn ? [-distance, 0] : [0, -distance]
284 + },
285 + right: {
286 + x: isIn ? [distance, 0] : [0, distance]
287 + },
288 + top: {
289 + y: isIn ? [-distance, 0] : [0, -distance]
290 + },
291 + bottom: {
292 + y: isIn ? [distance, 0] : [0, distance]
293 + }
294 + };
295 + Object.assign(keyframes, movement[direction]);
296 + }
297 + return keyframes;
298 +}
299 +function parseAnimationName(name) {
300 + var _name$split = name.split('-'),
301 + _name$split2 = (0, _slicedToArray2.default)(_name$split, 8),
302 + trigger = _name$split2[0],
303 + effect = _name$split2[1],
304 + type = _name$split2[2],
305 + direction = _name$split2[3],
306 + duration = _name$split2[4],
307 + delay = _name$split2[5];
308 + var config = (0, _interactionsSharedUtils.config)();
309 + return {
310 + trigger: trigger,
311 + effect: effect,
312 + type: type,
313 + direction: direction || null,
314 + duration: duration ? parseInt(duration, 10) : config.defaultDuration,
315 + delay: delay ? parseInt(delay, 10) : config.defaultDelay,
316 + replay: false,
317 + easing: config.defaultEasing
318 + };
319 +}
431 320
432 -//#endregion
433 -//#region modules/interactions/assets/js/interactions-utils.js
434 - function getKeyframes(effect, type, direction) {
435 - var isIn = "in" === type;
436 - var keyframes = {};
437 - if ("fade" === effect) keyframes.opacity = isIn ? [0, 1] : [1, 0];
438 - var config$1 = config();
439 - if ("scale" === effect) keyframes.scale = isIn ? [config$1.scaleStart, 1] : [1, config$1.scaleStart];
440 - if (direction && "string" === typeof direction) {
441 - var distance = config$1.slideDistance;
442 - var movement = {
443 - left: { x: isIn ? [-distance, 0] : [0, -distance] },
444 - right: { x: isIn ? [distance, 0] : [0, distance] },
445 - top: { y: isIn ? [-distance, 0] : [0, -distance] },
446 - bottom: { y: isIn ? [distance, 0] : [0, distance] }
447 - };
448 - direction.split("-").forEach(function(part) {
449 - if (movement[part]) Object.assign(keyframes, movement[part]);
450 - });
451 - }
452 - return keyframes;
453 - }
454 - function parseAnimationName(name) {
455 - var _name$split2 = _slicedToArray(name.split("-"), 8);
456 - var trigger = _name$split2[0];
457 - var effect = _name$split2[1];
458 - var type = _name$split2[2];
459 - var direction = _name$split2[3];
460 - var duration = _name$split2[4];
461 - var delay = _name$split2[5];
462 - var config$2 = config();
463 - return {
464 - trigger,
465 - effect,
466 - type,
467 - direction: direction || null,
468 - duration: duration ? parseInt(duration, 10) : config$2.defaultDuration,
469 - delay: delay ? parseInt(delay, 10) : config$2.defaultDelay,
470 - replay: false,
471 - easing: config$2.defaultEasing
472 - };
473 - }
474 - function unwrapInteractionBreakpoints(propValue) {
475 - var breakpointsConfig = unwrapInteractionValue(propValue, {});
476 - var excluded = unwrapInteractionValue(breakpointsConfig === null || breakpointsConfig === void 0 ? void 0 : breakpointsConfig.excluded, []);
477 - if (1 > excluded.length) return {};
478 - return { excluded: excluded.map(function(breakpoint) {
479 - return unwrapInteractionValue(breakpoint, "");
480 - }) };
481 - }
482 - function extractAnimationConfig(interaction) {
483 - var _payload$animation;
484 - if ("string" === typeof interaction) return parseAnimationName(interaction);
485 - var payload = "interaction-item" === (interaction === null || interaction === void 0 ? void 0 : interaction.$$type) && interaction !== null && interaction !== void 0 && interaction.value ? interaction.value : interaction;
486 - if (!payload) return null;
487 - if (payload !== null && payload !== void 0 && (_payload$animation = payload.animation) !== null && _payload$animation !== void 0 && _payload$animation.animation_id) return parseAnimationName(payload.animation.animation_id);
488 - var trigger = unwrapInteractionValue(payload.trigger) || payload.trigger || "load";
489 - var animation = payload.animation;
490 - animation = unwrapInteractionValue(animation);
491 - if (!animation) return null;
492 - var breakpoints = unwrapInteractionBreakpoints(payload.breakpoints);
493 - var config$3 = config();
494 - var effect = unwrapInteractionValue(animation.effect) || animation.effect || "fade";
495 - var type = unwrapInteractionValue(animation.type) || animation.type || "in";
496 - var directionUnwrapped = unwrapInteractionValue(animation.direction);
497 - var direction = "string" === typeof directionUnwrapped ? directionUnwrapped : "";
498 - var easing = config$3.defaultEasing;
499 - var replay = false;
500 - var timingConfig = unwrapInteractionValue(animation.timing_config) || animation.timing_config || {};
501 - return {
502 - trigger,
503 - breakpoints,
504 - effect,
505 - type,
506 - direction,
507 - duration: timingValueToMs(timingConfig === null || timingConfig === void 0 ? void 0 : timingConfig.duration, config$3.defaultDuration),
508 - delay: timingValueToMs(timingConfig === null || timingConfig === void 0 ? void 0 : timingConfig.delay, config$3.defaultDelay),
509 - easing,
510 - replay
511 - };
512 - }
321 +/**
322 + * Get interactions data from the script tag injected by PHP.
323 + * Returns array of { elementId, dataId, interactions: [...] }
324 + */
325 +function getInteractionsData() {
326 + var scriptTag = document.getElementById('elementor-interactions-data');
327 + if (!scriptTag) {
328 + return null;
329 + }
330 + try {
331 + return JSON.parse(scriptTag.textContent);
332 + } catch (_unused) {
333 + return null;
334 + }
335 +}
336 +function findElementByDataId(dataId) {
337 + return document.querySelector("[data-interaction-id=\"".concat(dataId, "\"]"));
338 +}
339 +function unwrapInteractionBreakpoints(propValue) {
340 + var breakpointsConfig = (0, _interactionsSharedUtils.unwrapInteractionValue)(propValue, {});
341 + var excluded = (0, _interactionsSharedUtils.unwrapInteractionValue)(breakpointsConfig === null || breakpointsConfig === void 0 ? void 0 : breakpointsConfig.excluded, []);
342 + if (1 > excluded.length) {
343 + return {};
344 + }
345 + var breakpoints = {
346 + excluded: excluded.map(function (breakpoint) {
347 + return (0, _interactionsSharedUtils.unwrapInteractionValue)(breakpoint, '');
348 + })
349 + };
350 + return breakpoints;
351 +}
352 +function extractAnimationConfig(interaction) {
353 + var _payload$animation;
354 + if ('string' === typeof interaction) {
355 + return parseAnimationName(interaction);
356 + }
357 + var payload = 'interaction-item' === (interaction === null || interaction === void 0 ? void 0 : interaction.$$type) && interaction !== null && interaction !== void 0 && interaction.value ? interaction.value : interaction;
358 + if (!payload) {
359 + return null;
360 + }
361 + if (payload !== null && payload !== void 0 && (_payload$animation = payload.animation) !== null && _payload$animation !== void 0 && _payload$animation.animation_id) {
362 + return parseAnimationName(payload.animation.animation_id);
363 + }
364 + var trigger = (0, _interactionsSharedUtils.unwrapInteractionValue)(payload.trigger) || payload.trigger || 'load';
365 + var animation = payload.animation;
366 + animation = (0, _interactionsSharedUtils.unwrapInteractionValue)(animation);
367 + if (!animation) {
368 + return null;
369 + }
370 + var breakpoints = unwrapInteractionBreakpoints(payload.breakpoints);
371 + var config = (0, _interactionsSharedUtils.config)();
372 + var effect = (0, _interactionsSharedUtils.unwrapInteractionValue)(animation.effect) || animation.effect || 'fade';
373 + var type = (0, _interactionsSharedUtils.unwrapInteractionValue)(animation.type) || animation.type || 'in';
374 + var direction = (0, _interactionsSharedUtils.unwrapInteractionValue)(animation.direction) || animation.direction || '';
375 + var easing = config.defaultEasing;
376 + var replay = false;
377 + var timingConfig = (0, _interactionsSharedUtils.unwrapInteractionValue)(animation.timing_config) || animation.timing_config || {};
378 + var duration = (0, _interactionsSharedUtils.timingValueToMs)(timingConfig === null || timingConfig === void 0 ? void 0 : timingConfig.duration, config.defaultDuration);
379 + var delay = (0, _interactionsSharedUtils.timingValueToMs)(timingConfig === null || timingConfig === void 0 ? void 0 : timingConfig.delay, config.defaultDelay);
380 + return {
381 + trigger: trigger,
382 + breakpoints: breakpoints,
383 + effect: effect,
384 + type: type,
385 + direction: direction,
386 + duration: duration,
387 + delay: delay,
388 + easing: easing,
389 + replay: replay
390 + };
391 +}
513 392
514 -//#endregion
515 -//#region modules/interactions/assets/js/editor-interactions.js
516 - function ownKeys(e, r) {
517 - var t = Object.keys(e);
518 - if (Object.getOwnPropertySymbols) {
519 - var o = Object.getOwnPropertySymbols(e);
520 - r && (o = o.filter(function(r) {
521 - return Object.getOwnPropertyDescriptor(e, r).enumerable;
522 - })), t.push.apply(t, o);
523 - }
524 - return t;
525 - }
526 - function _objectSpread(e) {
527 - for (var r = 1; r < arguments.length; r++) {
528 - var t = null != arguments[r] ? arguments[r] : {};
529 - r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
530 - _defineProperty(e, r, t[r]);
531 - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
532 - Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
533 - });
534 - }
535 - return e;
536 - }
537 - /**
538 - * @type {Record<string, Promise<void> & { cancel: () => void }>}
539 - */
540 - var playingInteractionsToStop = {};
541 - function applyAnimation(element, animConfig, animateFunc) {
542 - var id = element.id;
543 - if (playingInteractionsToStop[id]) {
544 - playingInteractionsToStop[id].cancel();
545 - delete playingInteractionsToStop[id];
546 - }
547 - var baseline = getTransformBaselineFromComputedStyle(element);
548 - var keyframes = preserveTransformKeyframes(getKeyframes(animConfig.effect, animConfig.type, animConfig.direction), baseline);
549 - var options = {
550 - duration: animConfig.duration / 1e3,
551 - delay: animConfig.delay / 1e3,
552 - ease: config().defaultEasing
553 - };
554 - var initialKeyframes = {};
555 - Object.keys(keyframes).forEach(function(key) {
556 - initialKeyframes[key] = keyframes[key][0];
557 - });
558 - animateFunc(element, initialKeyframes, { duration: 0 }).then(function() {
559 - var animation = animateFunc(element, keyframes, options);
560 - playingInteractionsToStop[id] = animation;
561 - animation.then(function() {
562 - requestAnimationFrame(function() {
563 - resetElementStyles(element);
564 - });
565 - delete playingInteractionsToStop[id];
566 - });
567 - });
568 - }
569 - function getInteractionsData() {
570 - var scriptTag = document.querySelector("script[data-e-interactions=\"true\"]");
571 - if (!scriptTag) return [];
572 - try {
573 - return JSON.parse(scriptTag.textContent || "[]");
574 - } catch (_unused) {
575 - return [];
576 - }
577 - }
578 - function findElementByInteractionId(interactionId) {
579 - return document.querySelector("[data-interaction-id=\"" + interactionId + "\"]");
580 - }
581 - function applyInteractionsToElement(element, interactionsData) {
582 - var animateFunc = getAnimateFunction();
583 - if (!animateFunc) return;
584 - var parsedData = parseInteractionsData(interactionsData);
585 - if (!parsedData) return;
586 - Object.values((parsedData === null || parsedData === void 0 ? void 0 : parsedData.items) || []).forEach(function(interaction) {
587 - var animConfig = extractAnimationConfig(interaction);
588 - if (animConfig) applyAnimation(element, animConfig, animateFunc);
589 - });
590 - }
591 - var previousInteractionsData = [];
592 - function handleInteractionsUpdate() {
593 - var currentInteractionsData = getInteractionsData();
594 - currentInteractionsData.filter(function(currentItem) {
595 - var _currentItem$interact;
596 - var _previousItem$interac;
597 - var previousItem = previousInteractionsData.find(function(prev) {
598 - return prev.dataId === currentItem.dataId;
599 - });
600 - if (!previousItem) return true;
601 - return (((_currentItem$interact = currentItem.interactions) === null || _currentItem$interact === void 0 ? void 0 : _currentItem$interact.items) || []).map(extractInteractionId).filter(Boolean).sort().join(",") !== (((_previousItem$interac = previousItem.interactions) === null || _previousItem$interac === void 0 ? void 0 : _previousItem$interac.items) || []).map(extractInteractionId).filter(Boolean).sort().join(",");
602 - }).forEach(function(item) {
603 - var _previousInteractions;
604 - var _item$interactions;
605 - var element = findElementByInteractionId(item.dataId);
606 - var prevInteractions = (_previousInteractions = previousInteractionsData.find(function(prev) {
607 - return prev.dataId === item.dataId;
608 - })) === null || _previousInteractions === void 0 ? void 0 : _previousInteractions.interactions;
609 - if (!element || !((_item$interactions = item.interactions) !== null && _item$interactions !== void 0 && (_item$interactions = _item$interactions.items) !== null && _item$interactions !== void 0 && _item$interactions.length)) return;
610 - var prevIds = new Set(((prevInteractions === null || prevInteractions === void 0 ? void 0 : prevInteractions.items) || []).map(extractInteractionId).filter(Boolean));
611 - var changedInteractions = item.interactions.items.filter(function(interaction) {
612 - var id = extractInteractionId(interaction);
613 - return !id || !prevIds.has(id);
614 - });
615 - if (changedInteractions.length > 0) applyInteractionsToElement(element, _objectSpread(_objectSpread({}, item.interactions), {}, { items: changedInteractions }));
616 - });
617 - previousInteractionsData = currentInteractionsData;
618 - }
619 - function initEditorInteractionsHandler() {
620 - waitForAnimateFunction(function() {
621 - var head = document.head;
622 - var scriptTag = null;
623 - var observer = null;
624 - function setupObserver(tag) {
625 - if (observer) observer.disconnect();
626 - observer = new MutationObserver(function() {
627 - handleInteractionsUpdate();
628 - });
629 - observer.observe(tag, {
630 - childList: true,
631 - characterData: true,
632 - subtree: true
633 - });
634 - handleInteractionsUpdate();
635 - registerWindowEvents();
636 - }
637 - var headObserver = new MutationObserver(function() {
638 - var foundScriptTag = document.querySelector("script[data-e-interactions=\"true\"]");
639 - if (foundScriptTag && foundScriptTag !== scriptTag) {
640 - scriptTag = foundScriptTag;
641 - setupObserver(scriptTag);
642 - headObserver.disconnect();
643 - }
644 - });
645 - headObserver.observe(head, {
646 - childList: true,
647 - subtree: true
648 - });
649 - scriptTag = document.querySelector("script[data-e-interactions=\"true\"]");
650 - if (scriptTag) {
651 - setupObserver(scriptTag);
652 - headObserver.disconnect();
653 - }
654 - });
655 - }
656 - function registerWindowEvents() {
657 - window.top.addEventListener("atomic/play_interactions", handlePlayInteractions);
658 - }
659 - function handlePlayInteractions(event) {
660 - var _event$detail = event.detail;
661 - var elementId = _event$detail.elementId;
662 - var interactionId = _event$detail.interactionId;
663 - var item = getInteractionsData().find(function(elementItemData) {
664 - return elementItemData.dataId === elementId;
665 - });
666 - if (!item) return;
667 - var element = findElementByInteractionId(elementId);
668 - if (!element) return;
669 - applyInteractionsToElement(element, _objectSpread(_objectSpread({}, item.interactions), {}, { items: item.interactions.items.filter(function(interactionItem) {
670 - return extractInteractionId(interactionItem) === interactionId;
671 - }) }));
672 - }
673 - if ("loading" === document.readyState) document.addEventListener("DOMContentLoaded", initEditorInteractionsHandler);
674 - else initEditorInteractionsHandler();
393 +/***/ }),
675 394
676 -//#endregion
395 +/***/ "../node_modules/@babel/runtime/helpers/arrayLikeToArray.js":
396 +/*!******************************************************************!*\
397 + !*** ../node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
398 + \******************************************************************/
399 +/***/ ((module) => {
400 +
401 +function _arrayLikeToArray(r, a) {
402 + (null == a || a > r.length) && (a = r.length);
403 + for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
404 + return n;
405 +}
406 +module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
407 +
408 +/***/ }),
409 +
410 +/***/ "../node_modules/@babel/runtime/helpers/arrayWithHoles.js":
411 +/*!****************************************************************!*\
412 + !*** ../node_modules/@babel/runtime/helpers/arrayWithHoles.js ***!
413 + \****************************************************************/
414 +/***/ ((module) => {
415 +
416 +function _arrayWithHoles(r) {
417 + if (Array.isArray(r)) return r;
418 +}
419 +module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
420 +
421 +/***/ }),
422 +
423 +/***/ "../node_modules/@babel/runtime/helpers/defineProperty.js":
424 +/*!****************************************************************!*\
425 + !*** ../node_modules/@babel/runtime/helpers/defineProperty.js ***!
426 + \****************************************************************/
427 +/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
428 +
429 +var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ "../node_modules/@babel/runtime/helpers/toPropertyKey.js");
430 +function _defineProperty(e, r, t) {
431 + return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
432 + value: t,
433 + enumerable: !0,
434 + configurable: !0,
435 + writable: !0
436 + }) : e[r] = t, e;
437 +}
438 +module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
439 +
440 +/***/ }),
441 +
442 +/***/ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js":
443 +/*!***********************************************************************!*\
444 + !*** ../node_modules/@babel/runtime/helpers/interopRequireDefault.js ***!
445 + \***********************************************************************/
446 +/***/ ((module) => {
447 +
448 +function _interopRequireDefault(e) {
449 + return e && e.__esModule ? e : {
450 + "default": e
451 + };
452 +}
453 +module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
454 +
455 +/***/ }),
456 +
457 +/***/ "../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js":
458 +/*!**********************************************************************!*\
459 + !*** ../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
460 + \**********************************************************************/
461 +/***/ ((module) => {
462 +
463 +function _iterableToArrayLimit(r, l) {
464 + var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
465 + if (null != t) {
466 + var e,
467 + n,
468 + i,
469 + u,
470 + a = [],
471 + f = !0,
472 + o = !1;
473 + try {
474 + if (i = (t = t.call(r)).next, 0 === l) {
475 + if (Object(t) !== t) return;
476 + f = !1;
477 + } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
478 + } catch (r) {
479 + o = !0, n = r;
480 + } finally {
481 + try {
482 + if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
483 + } finally {
484 + if (o) throw n;
485 + }
486 + }
487 + return a;
488 + }
489 +}
490 +module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
491 +
492 +/***/ }),
493 +
494 +/***/ "../node_modules/@babel/runtime/helpers/nonIterableRest.js":
495 +/*!*****************************************************************!*\
496 + !*** ../node_modules/@babel/runtime/helpers/nonIterableRest.js ***!
497 + \*****************************************************************/
498 +/***/ ((module) => {
499 +
500 +function _nonIterableRest() {
501 + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
502 +}
503 +module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
504 +
505 +/***/ }),
506 +
507 +/***/ "../node_modules/@babel/runtime/helpers/slicedToArray.js":
508 +/*!***************************************************************!*\
509 + !*** ../node_modules/@babel/runtime/helpers/slicedToArray.js ***!
510 + \***************************************************************/
511 +/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
512 +
513 +var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles.js */ "../node_modules/@babel/runtime/helpers/arrayWithHoles.js");
514 +var iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit.js */ "../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js");
515 +var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "../node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js");
516 +var nonIterableRest = __webpack_require__(/*! ./nonIterableRest.js */ "../node_modules/@babel/runtime/helpers/nonIterableRest.js");
517 +function _slicedToArray(r, e) {
518 + return arrayWithHoles(r) || iterableToArrayLimit(r, e) || unsupportedIterableToArray(r, e) || nonIterableRest();
519 +}
520 +module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
521 +
522 +/***/ }),
523 +
524 +/***/ "../node_modules/@babel/runtime/helpers/toPrimitive.js":
525 +/*!*************************************************************!*\
526 + !*** ../node_modules/@babel/runtime/helpers/toPrimitive.js ***!
527 + \*************************************************************/
528 +/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
529 +
530 +var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]);
531 +function toPrimitive(t, r) {
532 + if ("object" != _typeof(t) || !t) return t;
533 + var e = t[Symbol.toPrimitive];
534 + if (void 0 !== e) {
535 + var i = e.call(t, r || "default");
536 + if ("object" != _typeof(i)) return i;
537 + throw new TypeError("@@toPrimitive must return a primitive value.");
538 + }
539 + return ("string" === r ? String : Number)(t);
540 +}
541 +module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
542 +
543 +/***/ }),
544 +
545 +/***/ "../node_modules/@babel/runtime/helpers/toPropertyKey.js":
546 +/*!***************************************************************!*\
547 + !*** ../node_modules/@babel/runtime/helpers/toPropertyKey.js ***!
548 + \***************************************************************/
549 +/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
550 +
551 +var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]);
552 +var toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ "../node_modules/@babel/runtime/helpers/toPrimitive.js");
553 +function toPropertyKey(t) {
554 + var i = toPrimitive(t, "string");
555 + return "symbol" == _typeof(i) ? i : i + "";
556 +}
557 +module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
558 +
559 +/***/ }),
560 +
561 +/***/ "../node_modules/@babel/runtime/helpers/typeof.js":
562 +/*!********************************************************!*\
563 + !*** ../node_modules/@babel/runtime/helpers/typeof.js ***!
564 + \********************************************************/
565 +/***/ ((module) => {
566 +
567 +function _typeof(o) {
568 + "@babel/helpers - typeof";
569 +
570 + return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
571 + return typeof o;
572 + } : function (o) {
573 + return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
574 + }, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o);
575 +}
576 +module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
577 +
578 +/***/ }),
579 +
580 +/***/ "../node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js":
581 +/*!****************************************************************************!*\
582 + !*** ../node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
583 + \****************************************************************************/
584 +/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
585 +
586 +var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ "../node_modules/@babel/runtime/helpers/arrayLikeToArray.js");
587 +function _unsupportedIterableToArray(r, a) {
588 + if (r) {
589 + if ("string" == typeof r) return arrayLikeToArray(r, a);
590 + var t = {}.toString.call(r).slice(8, -1);
591 + 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;
592 + }
593 +}
594 +module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
595 +
596 +/***/ })
597 +
598 +/******/ });
599 +/************************************************************************/
600 +/******/ // The module cache
601 +/******/ var __webpack_module_cache__ = {};
602 +/******/
603 +/******/ // The require function
604 +/******/ function __webpack_require__(moduleId) {
605 +/******/ // Check if module is in cache
606 +/******/ var cachedModule = __webpack_module_cache__[moduleId];
607 +/******/ if (cachedModule !== undefined) {
608 +/******/ return cachedModule.exports;
609 +/******/ }
610 +/******/ // Create a new module (and put it into the cache)
611 +/******/ var module = __webpack_module_cache__[moduleId] = {
612 +/******/ // no module.id needed
613 +/******/ // no module.loaded needed
614 +/******/ exports: {}
615 +/******/ };
616 +/******/
617 +/******/ // Execute the module function
618 +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
619 +/******/
620 +/******/ // Return the exports of the module
621 +/******/ return module.exports;
622 +/******/ }
623 +/******/
624 +/************************************************************************/
625 +var __webpack_exports__ = {};
626 +// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
627 +(() => {
628 +"use strict";
629 +/*!****************************************************************!*\
630 + !*** ../modules/interactions/assets/js/editor-interactions.js ***!
631 + \****************************************************************/
632 +
633 +
634 +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
635 +var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js"));
636 +var _interactionsUtils = __webpack_require__(/*! ./interactions-utils.js */ "../modules/interactions/assets/js/interactions-utils.js");
637 +function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
638 +function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
639 +/**
640 + * @type {Record<string, Promise<void> & { cancel: () => void }>}
641 + */
642 +var playingInteractionsToStop = {};
643 +function applyAnimation(element, animConfig, animateFunc) {
644 + var id = element.id;
645 + if (playingInteractionsToStop[id]) {
646 + playingInteractionsToStop[id].cancel();
647 + delete playingInteractionsToStop[id];
648 + }
649 + var keyframes = (0, _interactionsUtils.getKeyframes)(animConfig.effect, animConfig.type, animConfig.direction);
650 + var options = {
651 + duration: animConfig.duration / 1000,
652 + delay: animConfig.delay / 1000,
653 + ease: (0, _interactionsUtils.config)().defaultEasing
654 + };
655 + var initialKeyframes = {};
656 + Object.keys(keyframes).forEach(function (key) {
657 + initialKeyframes[key] = keyframes[key][0];
658 + });
659 +
660 + // WHY - Transition can be set on elements but once it sets it destroys all animations, so we basically put it aside.
661 + var transition = element.style.transition;
662 + element.style.transition = 'none';
663 + animateFunc(element, initialKeyframes, {
664 + duration: 0
665 + }).then(function () {
666 + var animations = animateFunc(element, keyframes, options);
667 + playingInteractionsToStop[id] = animations;
668 + animations.then(function () {
669 + if ('out' === animConfig.type) {
670 + var resetValues = {
671 + opacity: 1,
672 + scale: 1,
673 + x: 0,
674 + y: 0
675 + };
676 + var resetKeyframes = {};
677 + Object.keys(keyframes).forEach(function (key) {
678 + resetKeyframes[key] = resetValues[key];
679 + });
680 + element.style.transition = transition;
681 + animateFunc(element, resetKeyframes, {
682 + duration: 0
683 + });
684 + }
685 + delete playingInteractionsToStop[id];
686 + });
687 + });
688 +}
689 +function getInteractionsData() {
690 + var scriptTag = document.querySelector('script[data-e-interactions="true"]');
691 + if (!scriptTag) {
692 + return [];
693 + }
694 + try {
695 + return JSON.parse(scriptTag.textContent || '[]');
696 + } catch (_unused) {
697 + return [];
698 + }
699 +}
700 +function findElementByInteractionId(interactionId) {
701 + return document.querySelector('[data-interaction-id="' + interactionId + '"]');
702 +}
703 +function applyInteractionsToElement(element, interactionsData) {
704 + var animateFunc = (0, _interactionsUtils.getAnimateFunction)();
705 + if (!animateFunc) {
706 + return;
707 + }
708 + var parsedData = (0, _interactionsUtils.parseInteractionsData)(interactionsData);
709 + if (!parsedData) {
710 + return;
711 + }
712 + var interactions = Object.values((parsedData === null || parsedData === void 0 ? void 0 : parsedData.items) || []);
713 + interactions.forEach(function (interaction) {
714 + var animConfig = (0, _interactionsUtils.extractAnimationConfig)(interaction);
715 + if (animConfig) {
716 + applyAnimation(element, animConfig, animateFunc);
717 + }
718 + });
719 +}
720 +var previousInteractionsData = [];
721 +function handleInteractionsUpdate() {
722 + var currentInteractionsData = getInteractionsData();
723 + var changedItems = currentInteractionsData.filter(function (currentItem) {
724 + var _currentItem$interact, _previousItem$interac;
725 + var previousItem = previousInteractionsData.find(function (prev) {
726 + return prev.dataId === currentItem.dataId;
727 + });
728 + if (!previousItem) {
729 + return true;
730 + }
731 + var currentIds = (((_currentItem$interact = currentItem.interactions) === null || _currentItem$interact === void 0 ? void 0 : _currentItem$interact.items) || []).map(_interactionsUtils.extractInteractionId).filter(Boolean).sort().join(',');
732 + var prevIds = (((_previousItem$interac = previousItem.interactions) === null || _previousItem$interac === void 0 ? void 0 : _previousItem$interac.items) || []).map(_interactionsUtils.extractInteractionId).filter(Boolean).sort().join(',');
733 + return currentIds !== prevIds;
734 + });
735 + changedItems.forEach(function (item) {
736 + var _previousInteractions, _item$interactions;
737 + var element = findElementByInteractionId(item.dataId);
738 + var prevInteractions = (_previousInteractions = previousInteractionsData.find(function (prev) {
739 + return prev.dataId === item.dataId;
740 + })) === null || _previousInteractions === void 0 ? void 0 : _previousInteractions.interactions;
741 + if (!element || !((_item$interactions = item.interactions) !== null && _item$interactions !== void 0 && (_item$interactions = _item$interactions.items) !== null && _item$interactions !== void 0 && _item$interactions.length)) {
742 + return;
743 + }
744 + var prevIds = new Set(((prevInteractions === null || prevInteractions === void 0 ? void 0 : prevInteractions.items) || []).map(_interactionsUtils.extractInteractionId).filter(Boolean));
745 + var changedInteractions = item.interactions.items.filter(function (interaction) {
746 + var id = (0, _interactionsUtils.extractInteractionId)(interaction);
747 + return !id || !prevIds.has(id);
748 + });
749 + if (changedInteractions.length > 0) {
750 + applyInteractionsToElement(element, _objectSpread(_objectSpread({}, item.interactions), {}, {
751 + items: changedInteractions
752 + }));
753 + }
754 + });
755 + previousInteractionsData = currentInteractionsData;
756 +}
757 +function initEditorInteractionsHandler() {
758 + (0, _interactionsUtils.waitForAnimateFunction)(function () {
759 + var head = document.head;
760 + var scriptTag = null;
761 + var observer = null;
762 + function setupObserver(tag) {
763 + if (observer) {
764 + observer.disconnect();
765 + }
766 + observer = new MutationObserver(function () {
767 + handleInteractionsUpdate();
768 + });
769 + observer.observe(tag, {
770 + childList: true,
771 + characterData: true,
772 + subtree: true
773 + });
774 + handleInteractionsUpdate();
775 + registerWindowEvents();
776 + }
777 + var headObserver = new MutationObserver(function () {
778 + var foundScriptTag = document.querySelector('script[data-e-interactions="true"]');
779 + if (foundScriptTag && foundScriptTag !== scriptTag) {
780 + scriptTag = foundScriptTag;
781 + setupObserver(scriptTag);
782 + headObserver.disconnect();
783 + }
784 + });
785 + headObserver.observe(head, {
786 + childList: true,
787 + subtree: true
788 + });
789 + scriptTag = document.querySelector('script[data-e-interactions="true"]');
790 + if (scriptTag) {
791 + setupObserver(scriptTag);
792 + headObserver.disconnect();
793 + }
794 + });
795 +}
796 +function registerWindowEvents() {
797 + window.top.addEventListener('atomic/play_interactions', handlePlayInteractions);
798 +}
799 +function handlePlayInteractions(event) {
800 + var _event$detail = event.detail,
801 + elementId = _event$detail.elementId,
802 + interactionId = _event$detail.interactionId;
803 + var interactionsData = getInteractionsData();
804 + var item = interactionsData.find(function (elementItemData) {
805 + return elementItemData.dataId === elementId;
806 + });
807 + if (!item) {
808 + return;
809 + }
810 + var element = findElementByInteractionId(elementId);
811 + if (!element) {
812 + return;
813 + }
814 + var interactionsCopy = _objectSpread(_objectSpread({}, item.interactions), {}, {
815 + items: item.interactions.items.filter(function (interactionItem) {
816 + var itemId = (0, _interactionsUtils.extractInteractionId)(interactionItem);
817 + return itemId === interactionId;
818 + })
819 + });
820 + applyInteractionsToElement(element, interactionsCopy);
821 +}
822 +if ('loading' === document.readyState) {
823 + document.addEventListener('DOMContentLoaded', initEditorInteractionsHandler);
824 +} else {
825 + initEditorInteractionsHandler();
826 +}
677 827 })();
828 +
829 +/******/ })()
830 +;
678 831 //# sourceMappingURL=editor-interactions.js.map