| @@ -1,198 +1,7 @@ | ||
| 1 | 1 | /******/ (() => { // webpackBootstrap |
| 2 | 2 | /******/ var __webpack_modules__ = ({ |
| 3 | 3 | |
| 4 | -/***/ "../modules/interactions/assets/js/interactions-breakpoints.js": | |
| 5 | -/*!*********************************************************************!*\ | |
| 6 | - !*** ../modules/interactions/assets/js/interactions-breakpoints.js ***! | |
| 7 | - \*********************************************************************/ | |
| 8 | -/***/ ((__unused_webpack_module, exports) => { | |
| 9 | - | |
| 10 | -"use strict"; | |
| 11 | - | |
| 12 | - | |
| 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 | -} | |
| 73 | - | |
| 74 | -/***/ }), | |
| 75 | - | |
| 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__) => { | |
| 81 | - | |
| 82 | -"use strict"; | |
| 83 | - | |
| 84 | - | |
| 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 | -} | |
| 178 | - | |
| 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 | -}; | |
| 192 | - | |
| 193 | -/***/ }), | |
| 194 | - | |
| 195 | 4 | /***/ "../modules/interactions/assets/js/interactions-utils.js": |
| 196 | 5 | /*!***************************************************************!*\ |
| 197 | 6 | !*** ../modules/interactions/assets/js/interactions-utils.js ***! |
| 198 | 7 | \***************************************************************/ |
| @@ -204,78 +13,20 @@ | ||
| 204 | 13 | var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js"); |
| 205 | 14 | Object.defineProperty(exports, "__esModule", ({ |
| 206 | 15 | value: true |
| 207 | 16 | })); |
| 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; | |
| 17 | +exports.config = void 0; | |
| 235 | 18 | exports.getKeyframes = getKeyframes; |
| 236 | -exports.isFreeFrontendSupportedTrigger = isFreeFrontendSupportedTrigger; | |
| 237 | 19 | exports.parseAnimationName = parseAnimationName; |
| 238 | -Object.defineProperty(exports, "parseInteractionsData", ({ | |
| 239 | - enumerable: true, | |
| 240 | - get: function get() { | |
| 241 | - return _interactionsSharedUtils.parseInteractionsData; | |
| 242 | - } | |
| 243 | -})); | |
| 244 | -Object.defineProperty(exports, "skipInteraction", ({ | |
| 245 | - enumerable: true, | |
| 246 | - get: function get() { | |
| 247 | - return _interactionsSharedUtils.skipInteraction; | |
| 248 | - } | |
| 249 | -})); | |
| 250 | -Object.defineProperty(exports, "timingValueToMs", ({ | |
| 251 | - enumerable: true, | |
| 252 | - get: function get() { | |
| 253 | - return _interactionsSharedUtils.timingValueToMs; | |
| 254 | - } | |
| 255 | -})); | |
| 256 | -Object.defineProperty(exports, "unwrapInteractionValue", ({ | |
| 257 | - enumerable: true, | |
| 258 | - get: function get() { | |
| 259 | - return _interactionsSharedUtils.unwrapInteractionValue; | |
| 260 | - } | |
| 261 | -})); | |
| 262 | -Object.defineProperty(exports, "waitForAnimateFunction", ({ | |
| 263 | - enumerable: true, | |
| 264 | - get: function get() { | |
| 265 | - return _interactionsSharedUtils.waitForAnimateFunction; | |
| 266 | - } | |
| 267 | -})); | |
| 268 | 20 | var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "../node_modules/@babel/runtime/helpers/slicedToArray.js")); |
| 269 | -var _interactionsSharedUtils = __webpack_require__(/*! ./interactions-shared-utils.js */ "../modules/interactions/assets/js/interactions-shared-utils.js"); | |
| 270 | -/** | |
| 271 | - * Triggers the Core `interactions.js` / `editor-interactions.js` bundles run. Pro-only triggers | |
| 272 | - * (e.g. hover, click) must not fall through to the load-time default path. | |
| 273 | - */ | |
| 274 | -var FREE_FRONTEND_SUPPORTED_TRIGGERS = ['load', 'scrollIn', 'scrollOut']; | |
| 275 | -function isFreeFrontendSupportedTrigger(trigger) { | |
| 276 | - return FREE_FRONTEND_SUPPORTED_TRIGGERS.includes(trigger); | |
| 277 | -} | |
| 21 | +var _window$ElementorInte; | |
| 22 | +var config = exports.config = ((_window$ElementorInte = window.ElementorInteractionsConfig) === null || _window$ElementorInte === void 0 ? void 0 : _window$ElementorInte.constants) || { | |
| 23 | + defaultDuration: 300, | |
| 24 | + defaultDelay: 0, | |
| 25 | + slideDistance: 100, | |
| 26 | + scaleStart: 0, | |
| 27 | + easing: 'linear' | |
| 28 | +}; | |
| 278 | 29 | function getKeyframes(effect, type, direction) { |
| 279 | 30 | var isIn = 'in' === type; |
| 280 | 31 | var keyframes = {}; |
| 281 | 32 | if ('fade' === effect) { |
| @@ -280,9 +31,8 @@ | ||
| 280 | 31 | var keyframes = {}; |
| 281 | 32 | if ('fade' === effect) { |
| 282 | 33 | keyframes.opacity = isIn ? [0, 1] : [1, 0]; |
| 283 | 34 | } |
| 284 | - var config = (0, _interactionsSharedUtils.config)(); | |
| 285 | 35 | if ('scale' === effect) { |
| 286 | 36 | keyframes.scale = isIn ? [config.scaleStart, 1] : [1, config.scaleStart]; |
| 287 | 37 | } |
| 288 | 38 | if (direction) { |
| @@ -306,9 +56,9 @@ | ||
| 306 | 56 | return keyframes; |
| 307 | 57 | } |
| 308 | 58 | function parseAnimationName(name) { |
| 309 | 59 | var _name$split = name.split('-'), |
| 310 | - _name$split2 = (0, _slicedToArray2.default)(_name$split, 8), | |
| 60 | + _name$split2 = (0, _slicedToArray2.default)(_name$split, 6), | |
| 311 | 61 | trigger = _name$split2[0], |
| 312 | 62 | effect = _name$split2[1], |
| 313 | 63 | type = _name$split2[2], |
| 314 | 64 | direction = _name$split2[3], |
| @@ -313,9 +63,8 @@ | ||
| 313 | 63 | type = _name$split2[2], |
| 314 | 64 | direction = _name$split2[3], |
| 315 | 65 | duration = _name$split2[4], |
| 316 | 66 | delay = _name$split2[5]; |
| 317 | - var config = (0, _interactionsSharedUtils.config)(); | |
| 318 | 67 | return { |
| 319 | 68 | trigger: trigger, |
| 320 | 69 | effect: effect, |
| 321 | 70 | type: type, |
| @@ -320,86 +69,12 @@ | ||
| 320 | 69 | effect: effect, |
| 321 | 70 | type: type, |
| 322 | 71 | direction: direction || null, |
| 323 | 72 | duration: duration ? parseInt(duration, 10) : config.defaultDuration, |
| 324 | - delay: delay ? parseInt(delay, 10) : config.defaultDelay, | |
| 325 | - replay: false, | |
| 326 | - easing: config.defaultEasing | |
| 73 | + delay: delay ? parseInt(delay, 10) : config.defaultDelay | |
| 327 | 74 | }; |
| 328 | 75 | } |
| 329 | 76 | |
| 330 | -/** | |
| 331 | - * Get interactions data from the script tag injected by PHP. | |
| 332 | - * Returns array of { elementId, dataId, interactions: [...] } | |
| 333 | - */ | |
| 334 | -function getInteractionsData() { | |
| 335 | - var scriptTag = document.getElementById('elementor-interactions-data'); | |
| 336 | - if (!scriptTag) { | |
| 337 | - return null; | |
| 338 | - } | |
| 339 | - try { | |
| 340 | - return JSON.parse(scriptTag.textContent); | |
| 341 | - } catch (_unused) { | |
| 342 | - return null; | |
| 343 | - } | |
| 344 | -} | |
| 345 | -function findElementByDataId(dataId) { | |
| 346 | - return document.querySelector("[data-interaction-id=\"".concat(dataId, "\"]")); | |
| 347 | -} | |
| 348 | -function unwrapInteractionBreakpoints(propValue) { | |
| 349 | - var breakpointsConfig = (0, _interactionsSharedUtils.unwrapInteractionValue)(propValue, {}); | |
| 350 | - var excluded = (0, _interactionsSharedUtils.unwrapInteractionValue)(breakpointsConfig === null || breakpointsConfig === void 0 ? void 0 : breakpointsConfig.excluded, []); | |
| 351 | - if (1 > excluded.length) { | |
| 352 | - return {}; | |
| 353 | - } | |
| 354 | - var breakpoints = { | |
| 355 | - excluded: excluded.map(function (breakpoint) { | |
| 356 | - return (0, _interactionsSharedUtils.unwrapInteractionValue)(breakpoint, ''); | |
| 357 | - }) | |
| 358 | - }; | |
| 359 | - return breakpoints; | |
| 360 | -} | |
| 361 | -function extractAnimationConfig(interaction) { | |
| 362 | - var _payload$animation; | |
| 363 | - if ('string' === typeof interaction) { | |
| 364 | - return parseAnimationName(interaction); | |
| 365 | - } | |
| 366 | - var payload = 'interaction-item' === (interaction === null || interaction === void 0 ? void 0 : interaction.$$type) && interaction !== null && interaction !== void 0 && interaction.value ? interaction.value : interaction; | |
| 367 | - if (!payload) { | |
| 368 | - return null; | |
| 369 | - } | |
| 370 | - if (payload !== null && payload !== void 0 && (_payload$animation = payload.animation) !== null && _payload$animation !== void 0 && _payload$animation.animation_id) { | |
| 371 | - return parseAnimationName(payload.animation.animation_id); | |
| 372 | - } | |
| 373 | - var trigger = (0, _interactionsSharedUtils.unwrapInteractionValue)(payload.trigger) || payload.trigger || 'load'; | |
| 374 | - var animation = payload.animation; | |
| 375 | - animation = (0, _interactionsSharedUtils.unwrapInteractionValue)(animation); | |
| 376 | - if (!animation) { | |
| 377 | - return null; | |
| 378 | - } | |
| 379 | - var breakpoints = unwrapInteractionBreakpoints(payload.breakpoints); | |
| 380 | - var config = (0, _interactionsSharedUtils.config)(); | |
| 381 | - var effect = (0, _interactionsSharedUtils.unwrapInteractionValue)(animation.effect) || animation.effect || 'fade'; | |
| 382 | - var type = (0, _interactionsSharedUtils.unwrapInteractionValue)(animation.type) || animation.type || 'in'; | |
| 383 | - var direction = (0, _interactionsSharedUtils.unwrapInteractionValue)(animation.direction) || animation.direction || ''; | |
| 384 | - var easing = config.defaultEasing; | |
| 385 | - var replay = false; | |
| 386 | - var timingConfig = (0, _interactionsSharedUtils.unwrapInteractionValue)(animation.timing_config) || animation.timing_config || {}; | |
| 387 | - var duration = (0, _interactionsSharedUtils.timingValueToMs)(timingConfig === null || timingConfig === void 0 ? void 0 : timingConfig.duration, config.defaultDuration); | |
| 388 | - var delay = (0, _interactionsSharedUtils.timingValueToMs)(timingConfig === null || timingConfig === void 0 ? void 0 : timingConfig.delay, config.defaultDelay); | |
| 389 | - return { | |
| 390 | - trigger: trigger, | |
| 391 | - breakpoints: breakpoints, | |
| 392 | - effect: effect, | |
| 393 | - type: type, | |
| 394 | - direction: direction, | |
| 395 | - duration: duration, | |
| 396 | - delay: delay, | |
| 397 | - easing: easing, | |
| 398 | - replay: replay | |
| 399 | - }; | |
| 400 | -} | |
| 401 | - | |
| 402 | 77 | /***/ }), |
| 403 | 78 | |
| 404 | 79 | /***/ "../node_modules/@babel/runtime/helpers/arrayLikeToArray.js": |
| 405 | 80 | /*!******************************************************************!*\ |
| @@ -428,8 +103,22 @@ | ||
| 428 | 103 | module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 429 | 104 | |
| 430 | 105 | /***/ }), |
| 431 | 106 | |
| 107 | +/***/ "../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js": | |
| 108 | +/*!*******************************************************************!*\ | |
| 109 | + !*** ../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***! | |
| 110 | + \*******************************************************************/ | |
| 111 | +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { | |
| 112 | + | |
| 113 | +var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ "../node_modules/@babel/runtime/helpers/arrayLikeToArray.js"); | |
| 114 | +function _arrayWithoutHoles(r) { | |
| 115 | + if (Array.isArray(r)) return arrayLikeToArray(r); | |
| 116 | +} | |
| 117 | +module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
| 118 | + | |
| 119 | +/***/ }), | |
| 120 | + | |
| 432 | 121 | /***/ "../node_modules/@babel/runtime/helpers/defineProperty.js": |
| 433 | 122 | /*!****************************************************************!*\ |
| 434 | 123 | !*** ../node_modules/@babel/runtime/helpers/defineProperty.js ***! |
| 435 | 124 | \****************************************************************/ |
| @@ -462,8 +151,21 @@ | ||
| 462 | 151 | module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 463 | 152 | |
| 464 | 153 | /***/ }), |
| 465 | 154 | |
| 155 | +/***/ "../node_modules/@babel/runtime/helpers/iterableToArray.js": | |
| 156 | +/*!*****************************************************************!*\ | |
| 157 | + !*** ../node_modules/@babel/runtime/helpers/iterableToArray.js ***! | |
| 158 | + \*****************************************************************/ | |
| 159 | +/***/ ((module) => { | |
| 160 | + | |
| 161 | +function _iterableToArray(r) { | |
| 162 | + if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); | |
| 163 | +} | |
| 164 | +module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
| 165 | + | |
| 166 | +/***/ }), | |
| 167 | + | |
| 466 | 168 | /***/ "../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js": |
| 467 | 169 | /*!**********************************************************************!*\ |
| 468 | 170 | !*** ../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***! |
| 469 | 171 | \**********************************************************************/ |
| @@ -512,8 +214,21 @@ | ||
| 512 | 214 | module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 513 | 215 | |
| 514 | 216 | /***/ }), |
| 515 | 217 | |
| 218 | +/***/ "../node_modules/@babel/runtime/helpers/nonIterableSpread.js": | |
| 219 | +/*!*******************************************************************!*\ | |
| 220 | + !*** ../node_modules/@babel/runtime/helpers/nonIterableSpread.js ***! | |
| 221 | + \*******************************************************************/ | |
| 222 | +/***/ ((module) => { | |
| 223 | + | |
| 224 | +function _nonIterableSpread() { | |
| 225 | + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | |
| 226 | +} | |
| 227 | +module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
| 228 | + | |
| 229 | +/***/ }), | |
| 230 | + | |
| 516 | 231 | /***/ "../node_modules/@babel/runtime/helpers/slicedToArray.js": |
| 517 | 232 | /*!***************************************************************!*\ |
| 518 | 233 | !*** ../node_modules/@babel/runtime/helpers/slicedToArray.js ***! |
| 519 | 234 | \***************************************************************/ |
| @@ -529,8 +244,25 @@ | ||
| 529 | 244 | module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 530 | 245 | |
| 531 | 246 | /***/ }), |
| 532 | 247 | |
| 248 | +/***/ "../node_modules/@babel/runtime/helpers/toConsumableArray.js": | |
| 249 | +/*!*******************************************************************!*\ | |
| 250 | + !*** ../node_modules/@babel/runtime/helpers/toConsumableArray.js ***! | |
| 251 | + \*******************************************************************/ | |
| 252 | +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { | |
| 253 | + | |
| 254 | +var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles.js */ "../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js"); | |
| 255 | +var iterableToArray = __webpack_require__(/*! ./iterableToArray.js */ "../node_modules/@babel/runtime/helpers/iterableToArray.js"); | |
| 256 | +var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "../node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js"); | |
| 257 | +var nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread.js */ "../node_modules/@babel/runtime/helpers/nonIterableSpread.js"); | |
| 258 | +function _toConsumableArray(r) { | |
| 259 | + return arrayWithoutHoles(r) || iterableToArray(r) || unsupportedIterableToArray(r) || nonIterableSpread(); | |
| 260 | +} | |
| 261 | +module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
| 262 | + | |
| 263 | +/***/ }), | |
| 264 | + | |
| 533 | 265 | /***/ "../node_modules/@babel/runtime/helpers/toPrimitive.js": |
| 534 | 266 | /*!*************************************************************!*\ |
| 535 | 267 | !*** ../node_modules/@babel/runtime/helpers/toPrimitive.js ***! |
| 536 | 268 | \*************************************************************/ |
| @@ -640,33 +372,24 @@ | ||
| 640 | 372 | \****************************************************************/ |
| 641 | 373 | |
| 642 | 374 | |
| 643 | 375 | var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js"); |
| 376 | +var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "../node_modules/@babel/runtime/helpers/toConsumableArray.js")); | |
| 644 | 377 | var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js")); |
| 645 | 378 | var _interactionsUtils = __webpack_require__(/*! ./interactions-utils.js */ "../modules/interactions/assets/js/interactions-utils.js"); |
| 646 | 379 | 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; } |
| 647 | 380 | 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; } |
| 648 | -/** | |
| 649 | - * @type {Record<string, Promise<void> & { cancel: () => void }>} | |
| 650 | - */ | |
| 651 | -var playingInteractionsToStop = {}; | |
| 652 | 381 | function applyAnimation(element, animConfig, animateFunc) { |
| 653 | - var id = element.id; | |
| 654 | - if (playingInteractionsToStop[id]) { | |
| 655 | - playingInteractionsToStop[id].cancel(); | |
| 656 | - delete playingInteractionsToStop[id]; | |
| 657 | - } | |
| 658 | 382 | var keyframes = (0, _interactionsUtils.getKeyframes)(animConfig.effect, animConfig.type, animConfig.direction); |
| 659 | 383 | var options = { |
| 660 | 384 | duration: animConfig.duration / 1000, |
| 661 | 385 | delay: animConfig.delay / 1000, |
| 662 | - ease: (0, _interactionsUtils.config)().defaultEasing | |
| 386 | + easing: _interactionsUtils.config.easing | |
| 663 | 387 | }; |
| 664 | 388 | var initialKeyframes = {}; |
| 665 | 389 | Object.keys(keyframes).forEach(function (key) { |
| 666 | 390 | initialKeyframes[key] = keyframes[key][0]; |
| 667 | 391 | }); |
| 668 | - | |
| 669 | 392 | // WHY - Transition can be set on elements but once it sets it destroys all animations, so we basically put it aside. |
| 670 | 393 | var transition = element.style.transition; |
| 671 | 394 | element.style.transition = 'none'; |
| 672 | 395 | animateFunc(element, initialKeyframes, { |
| @@ -671,11 +394,9 @@ | ||
| 671 | 394 | element.style.transition = 'none'; |
| 672 | 395 | animateFunc(element, initialKeyframes, { |
| 673 | 396 | duration: 0 |
| 674 | 397 | }).then(function () { |
| 675 | - var animations = animateFunc(element, keyframes, options); | |
| 676 | - playingInteractionsToStop[id] = animations; | |
| 677 | - animations.then(function () { | |
| 398 | + animateFunc(element, keyframes, options).then(function () { | |
| 678 | 399 | if ('out' === animConfig.type) { |
| 679 | 400 | var resetValues = { |
| 680 | 401 | opacity: 1, |
| 681 | 402 | scale: 1, |
| @@ -690,9 +411,8 @@ | ||
| 690 | 411 | animateFunc(element, resetKeyframes, { |
| 691 | 412 | duration: 0 |
| 692 | 413 | }); |
| 693 | 414 | } |
| 694 | - delete playingInteractionsToStop[id]; | |
| 695 | 415 | }); |
| 696 | 416 | }); |
| 697 | 417 | } |
| 698 | 418 | function getInteractionsData() { |
| @@ -709,19 +429,28 @@ | ||
| 709 | 429 | function findElementByInteractionId(interactionId) { |
| 710 | 430 | return document.querySelector('[data-interaction-id="' + interactionId + '"]'); |
| 711 | 431 | } |
| 712 | 432 | function applyInteractionsToElement(element, interactionsData) { |
| 713 | - var animateFunc = (0, _interactionsUtils.getAnimateFunction)(); | |
| 433 | + var _window$Motion, _parsedData; | |
| 434 | + var animateFunc = 'undefined' !== typeof animate ? animate : (_window$Motion = window.Motion) === null || _window$Motion === void 0 ? void 0 : _window$Motion.animate; | |
| 714 | 435 | if (!animateFunc) { |
| 715 | 436 | return; |
| 716 | 437 | } |
| 717 | - var parsedData = (0, _interactionsUtils.parseInteractionsData)(interactionsData); | |
| 718 | - if (!parsedData) { | |
| 719 | - return; | |
| 438 | + var parsedData; | |
| 439 | + if ('string' === typeof interactionsData) { | |
| 440 | + try { | |
| 441 | + parsedData = JSON.parse(interactionsData); | |
| 442 | + } catch (error) { | |
| 443 | + return; | |
| 444 | + } | |
| 445 | + } else { | |
| 446 | + parsedData = interactionsData; | |
| 720 | 447 | } |
| 721 | - var interactions = Object.values((parsedData === null || parsedData === void 0 ? void 0 : parsedData.items) || []); | |
| 448 | + var interactions = Object.values((_parsedData = parsedData) === null || _parsedData === void 0 ? void 0 : _parsedData.items); | |
| 722 | 449 | interactions.forEach(function (interaction) { |
| 723 | - var animConfig = (0, _interactionsUtils.extractAnimationConfig)(interaction); | |
| 450 | + var _interaction$animatio; | |
| 451 | + var animationName = 'string' === typeof interaction ? interaction : interaction === null || interaction === void 0 || (_interaction$animatio = interaction.animation) === null || _interaction$animatio === void 0 ? void 0 : _interaction$animatio.animation_id; | |
| 452 | + var animConfig = animationName && (0, _interactionsUtils.parseAnimationName)(animationName); | |
| 724 | 453 | if (animConfig) { |
| 725 | 454 | applyAnimation(element, animConfig, animateFunc); |
| 726 | 455 | } |
| 727 | 456 | }); |
| @@ -729,79 +458,72 @@ | ||
| 729 | 458 | var previousInteractionsData = []; |
| 730 | 459 | function handleInteractionsUpdate() { |
| 731 | 460 | var currentInteractionsData = getInteractionsData(); |
| 732 | 461 | var changedItems = currentInteractionsData.filter(function (currentItem) { |
| 733 | - var _currentItem$interact, _previousItem$interac; | |
| 734 | 462 | var previousItem = previousInteractionsData.find(function (prev) { |
| 735 | 463 | return prev.dataId === currentItem.dataId; |
| 736 | 464 | }); |
| 737 | - if (!previousItem) { | |
| 738 | - return true; | |
| 739 | - } | |
| 740 | - var currentIds = (((_currentItem$interact = currentItem.interactions) === null || _currentItem$interact === void 0 ? void 0 : _currentItem$interact.items) || []).map(_interactionsUtils.extractInteractionId).filter(Boolean).sort().join(','); | |
| 741 | - var prevIds = (((_previousItem$interac = previousItem.interactions) === null || _previousItem$interac === void 0 ? void 0 : _previousItem$interac.items) || []).map(_interactionsUtils.extractInteractionId).filter(Boolean).sort().join(','); | |
| 742 | - return currentIds !== prevIds; | |
| 465 | + return !previousItem || previousItem.interactions !== currentItem.interactions; | |
| 743 | 466 | }); |
| 744 | 467 | changedItems.forEach(function (item) { |
| 745 | - var _previousInteractions, _item$interactions; | |
| 468 | + var _previousInteractions, _item$interactions, _item$interactions2, _prevInteractions$ite; | |
| 746 | 469 | var element = findElementByInteractionId(item.dataId); |
| 747 | 470 | var prevInteractions = (_previousInteractions = previousInteractionsData.find(function (prev) { |
| 748 | 471 | return prev.dataId === item.dataId; |
| 749 | 472 | })) === null || _previousInteractions === void 0 ? void 0 : _previousInteractions.interactions; |
| 750 | - if (!element || !((_item$interactions = item.interactions) !== null && _item$interactions !== void 0 && (_item$interactions = _item$interactions.items) !== null && _item$interactions !== void 0 && _item$interactions.length)) { | |
| 751 | - return; | |
| 473 | + if (element && ((_item$interactions = item.interactions) === null || _item$interactions === void 0 || (_item$interactions = _item$interactions.items) === null || _item$interactions === void 0 ? void 0 : _item$interactions.length) > 0 && ((_item$interactions2 = item.interactions) === null || _item$interactions2 === void 0 || (_item$interactions2 = _item$interactions2.items) === null || _item$interactions2 === void 0 ? void 0 : _item$interactions2.length) === (prevInteractions === null || prevInteractions === void 0 || (_prevInteractions$ite = prevInteractions.items) === null || _prevInteractions$ite === void 0 ? void 0 : _prevInteractions$ite.length)) { | |
| 474 | + var interactionsToApply = _objectSpread(_objectSpread({}, item.interactions), {}, { | |
| 475 | + items: (0, _toConsumableArray2.default)(item.interactions.items).filter(function (interaction, index) { | |
| 476 | + var _prevInteractions$ite2; | |
| 477 | + return (prevInteractions === null || prevInteractions === void 0 || (_prevInteractions$ite2 = prevInteractions.items[index]) === null || _prevInteractions$ite2 === void 0 || (_prevInteractions$ite2 = _prevInteractions$ite2.animation) === null || _prevInteractions$ite2 === void 0 ? void 0 : _prevInteractions$ite2.animation_id) !== interaction.animation.animation_id; | |
| 478 | + }) | |
| 479 | + }); | |
| 480 | + applyInteractionsToElement(element, interactionsToApply); | |
| 752 | 481 | } |
| 753 | - var prevIds = new Set(((prevInteractions === null || prevInteractions === void 0 ? void 0 : prevInteractions.items) || []).map(_interactionsUtils.extractInteractionId).filter(Boolean)); | |
| 754 | - var changedInteractions = item.interactions.items.filter(function (interaction) { | |
| 755 | - var id = (0, _interactionsUtils.extractInteractionId)(interaction); | |
| 756 | - return !id || !prevIds.has(id); | |
| 757 | - }); | |
| 758 | - if (changedInteractions.length > 0) { | |
| 759 | - applyInteractionsToElement(element, _objectSpread(_objectSpread({}, item.interactions), {}, { | |
| 760 | - items: changedInteractions | |
| 761 | - })); | |
| 762 | - } | |
| 763 | 482 | }); |
| 764 | 483 | previousInteractionsData = currentInteractionsData; |
| 765 | 484 | } |
| 766 | 485 | function initEditorInteractionsHandler() { |
| 767 | - (0, _interactionsUtils.waitForAnimateFunction)(function () { | |
| 768 | - var head = document.head; | |
| 769 | - var scriptTag = null; | |
| 770 | - var observer = null; | |
| 771 | - function setupObserver(tag) { | |
| 772 | - if (observer) { | |
| 773 | - observer.disconnect(); | |
| 774 | - } | |
| 775 | - observer = new MutationObserver(function () { | |
| 776 | - handleInteractionsUpdate(); | |
| 777 | - }); | |
| 778 | - observer.observe(tag, { | |
| 779 | - childList: true, | |
| 780 | - characterData: true, | |
| 781 | - subtree: true | |
| 782 | - }); | |
| 486 | + var _window$Motion2; | |
| 487 | + if ('undefined' === typeof animate && !((_window$Motion2 = window.Motion) !== null && _window$Motion2 !== void 0 && _window$Motion2.animate)) { | |
| 488 | + setTimeout(initEditorInteractionsHandler, 100); | |
| 489 | + return; | |
| 490 | + } | |
| 491 | + var head = document.head; | |
| 492 | + var scriptTag = null; | |
| 493 | + var observer = null; | |
| 494 | + function setupObserver(tag) { | |
| 495 | + if (observer) { | |
| 496 | + observer.disconnect(); | |
| 497 | + } | |
| 498 | + observer = new MutationObserver(function () { | |
| 783 | 499 | handleInteractionsUpdate(); |
| 784 | - registerWindowEvents(); | |
| 785 | - } | |
| 786 | - var headObserver = new MutationObserver(function () { | |
| 787 | - var foundScriptTag = document.querySelector('script[data-e-interactions="true"]'); | |
| 788 | - if (foundScriptTag && foundScriptTag !== scriptTag) { | |
| 789 | - scriptTag = foundScriptTag; | |
| 790 | - setupObserver(scriptTag); | |
| 791 | - headObserver.disconnect(); | |
| 792 | - } | |
| 793 | 500 | }); |
| 794 | - headObserver.observe(head, { | |
| 501 | + observer.observe(tag, { | |
| 795 | 502 | childList: true, |
| 503 | + characterData: true, | |
| 796 | 504 | subtree: true |
| 797 | 505 | }); |
| 798 | - scriptTag = document.querySelector('script[data-e-interactions="true"]'); | |
| 799 | - if (scriptTag) { | |
| 506 | + handleInteractionsUpdate(); | |
| 507 | + registerWindowEvents(); | |
| 508 | + } | |
| 509 | + var headObserver = new MutationObserver(function () { | |
| 510 | + var foundScriptTag = document.querySelector('script[data-e-interactions="true"]'); | |
| 511 | + if (foundScriptTag && foundScriptTag !== scriptTag) { | |
| 512 | + scriptTag = foundScriptTag; | |
| 800 | 513 | setupObserver(scriptTag); |
| 801 | 514 | headObserver.disconnect(); |
| 802 | 515 | } |
| 803 | 516 | }); |
| 517 | + headObserver.observe(head, { | |
| 518 | + childList: true, | |
| 519 | + subtree: true | |
| 520 | + }); | |
| 521 | + scriptTag = document.querySelector('script[data-e-interactions="true"]'); | |
| 522 | + if (scriptTag) { | |
| 523 | + setupObserver(scriptTag); | |
| 524 | + headObserver.disconnect(); | |
| 525 | + } | |
| 804 | 526 | } |
| 805 | 527 | function registerWindowEvents() { |
| 806 | 528 | window.top.addEventListener('atomic/play_interactions', handlePlayInteractions); |
| 807 | 529 | } |
| @@ -807,9 +529,9 @@ | ||
| 807 | 529 | } |
| 808 | 530 | function handlePlayInteractions(event) { |
| 809 | 531 | var _event$detail = event.detail, |
| 810 | 532 | elementId = _event$detail.elementId, |
| 811 | - interactionId = _event$detail.interactionId; | |
| 533 | + animationId = _event$detail.animationId; | |
| 812 | 534 | var interactionsData = getInteractionsData(); |
| 813 | 535 | var item = interactionsData.find(function (elementItemData) { |
| 814 | 536 | return elementItemData.dataId === elementId; |
| 815 | 537 | }); |
| @@ -816,18 +538,17 @@ | ||
| 816 | 538 | if (!item) { |
| 817 | 539 | return; |
| 818 | 540 | } |
| 819 | 541 | var element = findElementByInteractionId(elementId); |
| 820 | - if (!element) { | |
| 821 | - return; | |
| 542 | + if (element) { | |
| 543 | + var interactionsCopy = _objectSpread(_objectSpread({}, item.interactions), {}, { | |
| 544 | + items: (0, _toConsumableArray2.default)(item.interactions.items) | |
| 545 | + }); | |
| 546 | + interactionsCopy.items = interactionsCopy.items.filter(function (interactionItem) { | |
| 547 | + return interactionItem.animation.animation_id === animationId; | |
| 548 | + }); | |
| 549 | + applyInteractionsToElement(element, JSON.stringify(interactionsCopy)); | |
| 822 | 550 | } |
| 823 | - var interactionsCopy = _objectSpread(_objectSpread({}, item.interactions), {}, { | |
| 824 | - items: item.interactions.items.filter(function (interactionItem) { | |
| 825 | - var itemId = (0, _interactionsUtils.extractInteractionId)(interactionItem); | |
| 826 | - return itemId === interactionId; | |
| 827 | - }) | |
| 828 | - }); | |
| 829 | - applyInteractionsToElement(element, interactionsCopy); | |
| 830 | 551 | } |
| 831 | 552 | if ('loading' === document.readyState) { |
| 832 | 553 | document.addEventListener('DOMContentLoaded', initEditorInteractionsHandler); |
| 833 | 554 | } else { |