| @@ -89,15 +89,25 @@ | ||
| 89 | 89 | exports.config = config; |
| 90 | 90 | exports.extractInteractionId = extractInteractionId; |
| 91 | 91 | exports.getAnimateFunction = getAnimateFunction; |
| 92 | 92 | exports.getInViewFunction = getInViewFunction; |
| 93 | +exports.getTransformBaselineFromComputedStyle = getTransformBaselineFromComputedStyle; | |
| 93 | 94 | exports.parseInteractionsData = parseInteractionsData; |
| 95 | +exports.preserveTransformKeyframes = preserveTransformKeyframes; | |
| 96 | +exports.resetElementStyles = resetElementStyles; | |
| 94 | 97 | exports.skipInteraction = skipInteraction; |
| 95 | 98 | exports.timingValueToMs = timingValueToMs; |
| 96 | 99 | exports.unwrapInteractionValue = unwrapInteractionValue; |
| 97 | 100 | exports.waitForAnimateFunction = waitForAnimateFunction; |
| 101 | +var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js")); | |
| 102 | +var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "../node_modules/@babel/runtime/helpers/slicedToArray.js")); | |
| 98 | 103 | var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ "../node_modules/@babel/runtime/helpers/typeof.js")); |
| 99 | 104 | var _interactionsBreakpoints = __webpack_require__(/*! ./interactions-breakpoints.js */ "../modules/interactions/assets/js/interactions-breakpoints.js"); |
| 105 | +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; } | |
| 106 | +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; } | |
| 107 | +function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; } | |
| 108 | +function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); 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; } } | |
| 109 | +function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } | |
| 100 | 110 | function config() { |
| 101 | 111 | var _window$ElementorInte, _window$ElementorInte2; |
| 102 | 112 | 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 | 113 | } |
| @@ -174,8 +184,179 @@ | ||
| 174 | 184 | return size * 1000; |
| 175 | 185 | } |
| 176 | 186 | return size; |
| 177 | 187 | } |
| 188 | +function resetElementStyles(element) { | |
| 189 | + if (!element) { | |
| 190 | + return; | |
| 191 | + } | |
| 192 | + element.style.transition = ''; | |
| 193 | + element.style.transform = ''; | |
| 194 | + element.style.opacity = ''; | |
| 195 | +} | |
| 196 | +var TRANSFORM_EPSILON = 0.001; | |
| 197 | +var radiansToDegrees = function radiansToDegrees(radians) { | |
| 198 | + return radians * (180 / Math.PI); | |
| 199 | +}; | |
| 200 | +var isNear = function isNear(value, expected) { | |
| 201 | + return Math.abs(value - expected) <= TRANSFORM_EPSILON; | |
| 202 | +}; | |
| 203 | +var isNearZero = function isNearZero(value) { | |
| 204 | + return isNear(value, 0); | |
| 205 | +}; | |
| 206 | +var isNearOne = function isNearOne(value) { | |
| 207 | + return isNear(value, 1); | |
| 208 | +}; | |
| 209 | +function parseMatrixValues(transformValue) { | |
| 210 | + var match = transformValue.match(/^matrix(3d)?\((.+)\)$/); | |
| 211 | + if (!match) { | |
| 212 | + return null; | |
| 213 | + } | |
| 214 | + return match[2].split(',').map(function (token) { | |
| 215 | + return Number.parseFloat(token.trim()); | |
| 216 | + }).filter(function (value) { | |
| 217 | + return Number.isFinite(value); | |
| 218 | + }); | |
| 219 | +} | |
| 220 | +function createMatrixFromTransform(transformValue) { | |
| 221 | + if (!transformValue || 'none' === transformValue) { | |
| 222 | + return null; | |
| 223 | + } | |
| 224 | + var matrixFactories = [window.DOMMatrixReadOnly, window.DOMMatrix].filter(function (Factory) { | |
| 225 | + return 'function' === typeof Factory; | |
| 226 | + }); | |
| 227 | + var _iterator = _createForOfIteratorHelper(matrixFactories), | |
| 228 | + _step; | |
| 229 | + try { | |
| 230 | + for (_iterator.s(); !(_step = _iterator.n()).done;) { | |
| 231 | + var MatrixFactory = _step.value; | |
| 232 | + try { | |
| 233 | + var _ref, _matrix$a, _ref2, _matrix$b, _ref3, _matrix$c, _ref4, _matrix$d, _ref5, _matrix$e, _ref6, _matrix$f; | |
| 234 | + var matrix = new MatrixFactory(transformValue); | |
| 235 | + // CSS matrix(a,b,c,d,e,f): x' = ax + cy + e, y' = bx + dy + f | |
| 236 | + // matrixXfromY = how much input Y contributes to output X (etc.) | |
| 237 | + var compactMatrix = { | |
| 238 | + matrixXfromX: (_ref = (_matrix$a = matrix.a) !== null && _matrix$a !== void 0 ? _matrix$a : matrix.m11) !== null && _ref !== void 0 ? _ref : 1, | |
| 239 | + matrixYfromX: (_ref2 = (_matrix$b = matrix.b) !== null && _matrix$b !== void 0 ? _matrix$b : matrix.m12) !== null && _ref2 !== void 0 ? _ref2 : 0, | |
| 240 | + matrixXfromY: (_ref3 = (_matrix$c = matrix.c) !== null && _matrix$c !== void 0 ? _matrix$c : matrix.m21) !== null && _ref3 !== void 0 ? _ref3 : 0, | |
| 241 | + matrixYfromY: (_ref4 = (_matrix$d = matrix.d) !== null && _matrix$d !== void 0 ? _matrix$d : matrix.m22) !== null && _ref4 !== void 0 ? _ref4 : 1, | |
| 242 | + matrixTranslateX: (_ref5 = (_matrix$e = matrix.e) !== null && _matrix$e !== void 0 ? _matrix$e : matrix.m41) !== null && _ref5 !== void 0 ? _ref5 : 0, | |
| 243 | + matrixTranslateY: (_ref6 = (_matrix$f = matrix.f) !== null && _matrix$f !== void 0 ? _matrix$f : matrix.m42) !== null && _ref6 !== void 0 ? _ref6 : 0 | |
| 244 | + }; | |
| 245 | + if (Object.values(compactMatrix).every(Number.isFinite)) { | |
| 246 | + return compactMatrix; | |
| 247 | + } | |
| 248 | + } catch (_unused2) {} | |
| 249 | + } | |
| 250 | + } catch (err) { | |
| 251 | + _iterator.e(err); | |
| 252 | + } finally { | |
| 253 | + _iterator.f(); | |
| 254 | + } | |
| 255 | + var parsedValues = parseMatrixValues(transformValue); | |
| 256 | + if (!parsedValues) { | |
| 257 | + return null; | |
| 258 | + } | |
| 259 | + if (6 === parsedValues.length) { | |
| 260 | + var _parsedValues = (0, _slicedToArray2.default)(parsedValues, 6), | |
| 261 | + matrixXfromX = _parsedValues[0], | |
| 262 | + matrixYfromX = _parsedValues[1], | |
| 263 | + matrixXfromY = _parsedValues[2], | |
| 264 | + matrixYfromY = _parsedValues[3], | |
| 265 | + matrixTranslateX = _parsedValues[4], | |
| 266 | + matrixTranslateY = _parsedValues[5]; | |
| 267 | + return { | |
| 268 | + matrixXfromX: matrixXfromX, | |
| 269 | + matrixYfromX: matrixYfromX, | |
| 270 | + matrixXfromY: matrixXfromY, | |
| 271 | + matrixYfromY: matrixYfromY, | |
| 272 | + matrixTranslateX: matrixTranslateX, | |
| 273 | + matrixTranslateY: matrixTranslateY | |
| 274 | + }; | |
| 275 | + } | |
| 276 | + if (16 === parsedValues.length) { | |
| 277 | + var _parsedValues2 = (0, _slicedToArray2.default)(parsedValues, 14), | |
| 278 | + _matrixXfromX = _parsedValues2[0], | |
| 279 | + _matrixYfromX = _parsedValues2[1], | |
| 280 | + _matrixXfromY = _parsedValues2[4], | |
| 281 | + _matrixYfromY = _parsedValues2[5], | |
| 282 | + _matrixTranslateX = _parsedValues2[12], | |
| 283 | + _matrixTranslateY = _parsedValues2[13]; | |
| 284 | + return { | |
| 285 | + matrixXfromX: _matrixXfromX, | |
| 286 | + matrixYfromX: _matrixYfromX, | |
| 287 | + matrixXfromY: _matrixXfromY, | |
| 288 | + matrixYfromY: _matrixYfromY, | |
| 289 | + matrixTranslateX: _matrixTranslateX, | |
| 290 | + matrixTranslateY: _matrixTranslateY | |
| 291 | + }; | |
| 292 | + } | |
| 293 | + return null; | |
| 294 | +} | |
| 295 | +function getTransformBaselineFromComputedStyle(element) { | |
| 296 | + if (!element) { | |
| 297 | + return null; | |
| 298 | + } | |
| 299 | + var computedStyle = window.getComputedStyle(element); | |
| 300 | + var matrix = createMatrixFromTransform((computedStyle === null || computedStyle === void 0 ? void 0 : computedStyle.transform) || ''); | |
| 301 | + if (!matrix) { | |
| 302 | + return null; | |
| 303 | + } | |
| 304 | + var matrixXfromX = matrix.matrixXfromX, | |
| 305 | + matrixYfromX = matrix.matrixYfromX, | |
| 306 | + matrixXfromY = matrix.matrixXfromY, | |
| 307 | + matrixYfromY = matrix.matrixYfromY, | |
| 308 | + matrixTranslateX = matrix.matrixTranslateX, | |
| 309 | + matrixTranslateY = matrix.matrixTranslateY; | |
| 310 | + var scaleX = Math.hypot(matrixXfromX, matrixYfromX); | |
| 311 | + var determinant = matrixXfromX * matrixYfromY - matrixYfromX * matrixXfromY; | |
| 312 | + var scaleY = scaleX ? determinant / scaleX : Math.hypot(matrixXfromY, matrixYfromY); | |
| 313 | + var rotate = radiansToDegrees(Math.atan2(matrixYfromX, matrixXfromX)); | |
| 314 | + var shear = scaleX ? (matrixXfromX * matrixXfromY + matrixYfromX * matrixYfromY) / (scaleX * scaleX) : 0; | |
| 315 | + var skewX = radiansToDegrees(Math.atan(shear)); | |
| 316 | + return { | |
| 317 | + x: matrixTranslateX, | |
| 318 | + y: matrixTranslateY, | |
| 319 | + scaleX: Number.isFinite(scaleX) ? scaleX : 1, | |
| 320 | + scaleY: Number.isFinite(scaleY) ? scaleY : 1, | |
| 321 | + rotate: Number.isFinite(rotate) ? rotate : 0, | |
| 322 | + skewX: Number.isFinite(skewX) ? skewX : 0 | |
| 323 | + }; | |
| 324 | +} | |
| 325 | +function preserveTransformKeyframes(keyframes, baseline) { | |
| 326 | + if (!baseline) { | |
| 327 | + return keyframes; | |
| 328 | + } | |
| 329 | + var mergedKeyframes = _objectSpread({}, keyframes); | |
| 330 | + var hasScaleShorthand = mergedKeyframes.scale !== undefined; | |
| 331 | + var canSetScaleX = mergedKeyframes.scaleX === undefined && !isNearOne(baseline.scaleX); | |
| 332 | + var canSetScaleY = mergedKeyframes.scaleY === undefined && !isNearOne(baseline.scaleY); | |
| 333 | + if (mergedKeyframes.x === undefined && !isNearZero(baseline.x)) { | |
| 334 | + mergedKeyframes.x = [baseline.x, baseline.x]; | |
| 335 | + } | |
| 336 | + if (mergedKeyframes.y === undefined && !isNearZero(baseline.y)) { | |
| 337 | + mergedKeyframes.y = [baseline.y, baseline.y]; | |
| 338 | + } | |
| 339 | + if (!hasScaleShorthand) { | |
| 340 | + if (canSetScaleX && canSetScaleY && isNear(baseline.scaleX, baseline.scaleY)) { | |
| 341 | + mergedKeyframes.scale = [baseline.scaleX, baseline.scaleX]; | |
| 342 | + } else { | |
| 343 | + if (canSetScaleX) { | |
| 344 | + mergedKeyframes.scaleX = [baseline.scaleX, baseline.scaleX]; | |
| 345 | + } | |
| 346 | + if (canSetScaleY) { | |
| 347 | + mergedKeyframes.scaleY = [baseline.scaleY, baseline.scaleY]; | |
| 348 | + } | |
| 349 | + } | |
| 350 | + } | |
| 351 | + if (mergedKeyframes.rotate === undefined && mergedKeyframes.rotateZ === undefined && !isNearZero(baseline.rotate)) { | |
| 352 | + mergedKeyframes.rotate = [baseline.rotate, baseline.rotate]; | |
| 353 | + } | |
| 354 | + if (mergedKeyframes.skew === undefined && mergedKeyframes.skewX === undefined && !isNearZero(baseline.skewX)) { | |
| 355 | + mergedKeyframes.skewX = [baseline.skewX, baseline.skewX]; | |
| 356 | + } | |
| 357 | + return mergedKeyframes; | |
| 358 | +} | |
| 178 | 359 | |
| 179 | 360 | // Expose on elementorModules for Pro and other consumers. |
| 180 | 361 | window.elementorModules = window.elementorModules || {}; |
| 181 | 362 | window.elementorModules.interactions = { |
| @@ -186,9 +367,12 @@ | ||
| 186 | 367 | getInViewFunction: getInViewFunction, |
| 187 | 368 | waitForAnimateFunction: waitForAnimateFunction, |
| 188 | 369 | parseInteractionsData: parseInteractionsData, |
| 189 | 370 | unwrapInteractionValue: unwrapInteractionValue, |
| 190 | - timingValueToMs: timingValueToMs | |
| 371 | + timingValueToMs: timingValueToMs, | |
| 372 | + resetElementStyles: resetElementStyles, | |
| 373 | + getTransformBaselineFromComputedStyle: getTransformBaselineFromComputedStyle, | |
| 374 | + preserveTransformKeyframes: preserveTransformKeyframes | |
| 191 | 375 | }; |
| 192 | 376 | |
| 193 | 377 | /***/ }), |
| 194 | 378 | |
| @@ -232,9 +416,14 @@ | ||
| 232 | 416 | } |
| 233 | 417 | })); |
| 234 | 418 | exports.getInteractionsData = getInteractionsData; |
| 235 | 419 | exports.getKeyframes = getKeyframes; |
| 236 | -exports.isFreeFrontendSupportedTrigger = isFreeFrontendSupportedTrigger; | |
| 420 | +Object.defineProperty(exports, "getTransformBaselineFromComputedStyle", ({ | |
| 421 | + enumerable: true, | |
| 422 | + get: function get() { | |
| 423 | + return _interactionsSharedUtils.getTransformBaselineFromComputedStyle; | |
| 424 | + } | |
| 425 | +})); | |
| 237 | 426 | exports.parseAnimationName = parseAnimationName; |
| 238 | 427 | Object.defineProperty(exports, "parseInteractionsData", ({ |
| 239 | 428 | enumerable: true, |
| 240 | 429 | get: function get() { |
| @@ -240,14 +429,21 @@ | ||
| 240 | 429 | get: function get() { |
| 241 | 430 | return _interactionsSharedUtils.parseInteractionsData; |
| 242 | 431 | } |
| 243 | 432 | })); |
| 244 | -Object.defineProperty(exports, "skipInteraction", ({ | |
| 433 | +Object.defineProperty(exports, "preserveTransformKeyframes", ({ | |
| 245 | 434 | enumerable: true, |
| 246 | 435 | get: function get() { |
| 247 | - return _interactionsSharedUtils.skipInteraction; | |
| 436 | + return _interactionsSharedUtils.preserveTransformKeyframes; | |
| 248 | 437 | } |
| 249 | 438 | })); |
| 439 | +Object.defineProperty(exports, "resetElementStyles", ({ | |
| 440 | + enumerable: true, | |
| 441 | + get: function get() { | |
| 442 | + return _interactionsSharedUtils.resetElementStyles; | |
| 443 | + } | |
| 444 | +})); | |
| 445 | +exports.skipInteraction = skipInteraction; | |
| 250 | 446 | Object.defineProperty(exports, "timingValueToMs", ({ |
| 251 | 447 | enumerable: true, |
| 252 | 448 | get: function get() { |
| 253 | 449 | return _interactionsSharedUtils.timingValueToMs; |
| @@ -266,16 +462,23 @@ | ||
| 266 | 462 | } |
| 267 | 463 | })); |
| 268 | 464 | var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "../node_modules/@babel/runtime/helpers/slicedToArray.js")); |
| 269 | 465 | 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); | |
| 466 | +function isSupportedInteraction(animationConfig) { | |
| 467 | + if (!['load', 'scrollIn', 'scrollOut'].includes(animationConfig.trigger)) { | |
| 468 | + return false; | |
| 469 | + } | |
| 470 | + if ('custom' === animationConfig.effect) { | |
| 471 | + return false; | |
| 472 | + } | |
| 473 | + return true; | |
| 277 | 474 | } |
| 475 | +function skipInteraction(animationConfig) { | |
| 476 | + if (!isSupportedInteraction(animationConfig)) { | |
| 477 | + return true; | |
| 478 | + } | |
| 479 | + return (0, _interactionsSharedUtils.skipInteraction)(animationConfig); | |
| 480 | +} | |
| 278 | 481 | function getKeyframes(effect, type, direction) { |
| 279 | 482 | var isIn = 'in' === type; |
| 280 | 483 | var keyframes = {}; |
| 281 | 484 | if ('fade' === effect) { |
| @@ -284,9 +487,9 @@ | ||
| 284 | 487 | var config = (0, _interactionsSharedUtils.config)(); |
| 285 | 488 | if ('scale' === effect) { |
| 286 | 489 | keyframes.scale = isIn ? [config.scaleStart, 1] : [1, config.scaleStart]; |
| 287 | 490 | } |
| 288 | - if (direction) { | |
| 491 | + if (direction && 'string' === typeof direction) { | |
| 289 | 492 | var distance = config.slideDistance; |
| 290 | 493 | var movement = { |
| 291 | 494 | left: { |
| 292 | 495 | x: isIn ? [-distance, 0] : [0, -distance] |
| @@ -300,9 +503,13 @@ | ||
| 300 | 503 | bottom: { |
| 301 | 504 | y: isIn ? [distance, 0] : [0, distance] |
| 302 | 505 | } |
| 303 | 506 | }; |
| 304 | - Object.assign(keyframes, movement[direction]); | |
| 507 | + direction.split('-').forEach(function (part) { | |
| 508 | + if (movement[part]) { | |
| 509 | + Object.assign(keyframes, movement[part]); | |
| 510 | + } | |
| 511 | + }); | |
| 305 | 512 | } |
| 306 | 513 | return keyframes; |
| 307 | 514 | } |
| 308 | 515 | function parseAnimationName(name) { |
| @@ -379,9 +586,10 @@ | ||
| 379 | 586 | var breakpoints = unwrapInteractionBreakpoints(payload.breakpoints); |
| 380 | 587 | var config = (0, _interactionsSharedUtils.config)(); |
| 381 | 588 | var effect = (0, _interactionsSharedUtils.unwrapInteractionValue)(animation.effect) || animation.effect || 'fade'; |
| 382 | 589 | var type = (0, _interactionsSharedUtils.unwrapInteractionValue)(animation.type) || animation.type || 'in'; |
| 383 | - var direction = (0, _interactionsSharedUtils.unwrapInteractionValue)(animation.direction) || animation.direction || ''; | |
| 590 | + var directionUnwrapped = (0, _interactionsSharedUtils.unwrapInteractionValue)(animation.direction); | |
| 591 | + var direction = 'string' === typeof directionUnwrapped ? directionUnwrapped : ''; | |
| 384 | 592 | var easing = config.defaultEasing; |
| 385 | 593 | var replay = false; |
| 386 | 594 | var timingConfig = (0, _interactionsSharedUtils.unwrapInteractionValue)(animation.timing_config) || animation.timing_config || {}; |
| 387 | 595 | var duration = (0, _interactionsSharedUtils.timingValueToMs)(timingConfig === null || timingConfig === void 0 ? void 0 : timingConfig.duration, config.defaultDuration); |
| @@ -428,8 +636,27 @@ | ||
| 428 | 636 | module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 429 | 637 | |
| 430 | 638 | /***/ }), |
| 431 | 639 | |
| 640 | +/***/ "../node_modules/@babel/runtime/helpers/defineProperty.js": | |
| 641 | +/*!****************************************************************!*\ | |
| 642 | + !*** ../node_modules/@babel/runtime/helpers/defineProperty.js ***! | |
| 643 | + \****************************************************************/ | |
| 644 | +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { | |
| 645 | + | |
| 646 | +var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ "../node_modules/@babel/runtime/helpers/toPropertyKey.js"); | |
| 647 | +function _defineProperty(e, r, t) { | |
| 648 | + return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, { | |
| 649 | + value: t, | |
| 650 | + enumerable: !0, | |
| 651 | + configurable: !0, | |
| 652 | + writable: !0 | |
| 653 | + }) : e[r] = t, e; | |
| 654 | +} | |
| 655 | +module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
| 656 | + | |
| 657 | +/***/ }), | |
| 658 | + | |
| 432 | 659 | /***/ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js": |
| 433 | 660 | /*!***********************************************************************!*\ |
| 434 | 661 | !*** ../node_modules/@babel/runtime/helpers/interopRequireDefault.js ***! |
| 435 | 662 | \***********************************************************************/ |
| @@ -510,8 +737,45 @@ | ||
| 510 | 737 | module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 511 | 738 | |
| 512 | 739 | /***/ }), |
| 513 | 740 | |
| 741 | +/***/ "../node_modules/@babel/runtime/helpers/toPrimitive.js": | |
| 742 | +/*!*************************************************************!*\ | |
| 743 | + !*** ../node_modules/@babel/runtime/helpers/toPrimitive.js ***! | |
| 744 | + \*************************************************************/ | |
| 745 | +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { | |
| 746 | + | |
| 747 | +var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]); | |
| 748 | +function toPrimitive(t, r) { | |
| 749 | + if ("object" != _typeof(t) || !t) return t; | |
| 750 | + var e = t[Symbol.toPrimitive]; | |
| 751 | + if (void 0 !== e) { | |
| 752 | + var i = e.call(t, r || "default"); | |
| 753 | + if ("object" != _typeof(i)) return i; | |
| 754 | + throw new TypeError("@@toPrimitive must return a primitive value."); | |
| 755 | + } | |
| 756 | + return ("string" === r ? String : Number)(t); | |
| 757 | +} | |
| 758 | +module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
| 759 | + | |
| 760 | +/***/ }), | |
| 761 | + | |
| 762 | +/***/ "../node_modules/@babel/runtime/helpers/toPropertyKey.js": | |
| 763 | +/*!***************************************************************!*\ | |
| 764 | + !*** ../node_modules/@babel/runtime/helpers/toPropertyKey.js ***! | |
| 765 | + \***************************************************************/ | |
| 766 | +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { | |
| 767 | + | |
| 768 | +var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]); | |
| 769 | +var toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ "../node_modules/@babel/runtime/helpers/toPrimitive.js"); | |
| 770 | +function toPropertyKey(t) { | |
| 771 | + var i = toPrimitive(t, "string"); | |
| 772 | + return "symbol" == _typeof(i) ? i : i + ""; | |
| 773 | +} | |
| 774 | +module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports; | |
| 775 | + | |
| 776 | +/***/ }), | |
| 777 | + | |
| 514 | 778 | /***/ "../node_modules/@babel/runtime/helpers/typeof.js": |
| 515 | 779 | /*!********************************************************!*\ |
| 516 | 780 | !*** ../node_modules/@babel/runtime/helpers/typeof.js ***! |
| 517 | 781 | \********************************************************/ |
| @@ -585,14 +849,13 @@ | ||
| 585 | 849 | |
| 586 | 850 | |
| 587 | 851 | var _interactionsUtils = __webpack_require__(/*! ./interactions-utils.js */ "../modules/interactions/assets/js/interactions-utils.js"); |
| 588 | 852 | var _interactionsBreakpoints = __webpack_require__(/*! ./interactions-breakpoints.js */ "../modules/interactions/assets/js/interactions-breakpoints.js"); |
| 589 | -function scrollOutAnimation(element, transition, animConfig, keyframes, options, animateFunc, inViewFunc) { | |
| 853 | +function scrollOutAnimation(element, transition, keyframes, resetKeyframes, options, animateFunc, inViewFunc) { | |
| 590 | 854 | var viewOptions = { |
| 591 | 855 | amount: 0.85, |
| 592 | 856 | root: null |
| 593 | 857 | }; |
| 594 | - var resetKeyframes = (0, _interactionsUtils.getKeyframes)(animConfig.effect, 'in', animConfig.direction); | |
| 595 | 858 | animateFunc(element, resetKeyframes, { |
| 596 | 859 | duration: 0 |
| 597 | 860 | }); |
| 598 | 861 | var stop = inViewFunc(element, function () { |
| @@ -625,9 +888,11 @@ | ||
| 625 | 888 | element.style.transition = transition; |
| 626 | 889 | }); |
| 627 | 890 | } |
| 628 | 891 | function applyAnimation(element, animConfig, animateFunc, inViewFunc) { |
| 629 | - var keyframes = (0, _interactionsUtils.getKeyframes)(animConfig.effect, animConfig.type, animConfig.direction); | |
| 892 | + var baseline = (0, _interactionsUtils.getTransformBaselineFromComputedStyle)(element); | |
| 893 | + var keyframes = (0, _interactionsUtils.preserveTransformKeyframes)((0, _interactionsUtils.getKeyframes)(animConfig.effect, animConfig.type, animConfig.direction), baseline); | |
| 894 | + var resetKeyframes = (0, _interactionsUtils.preserveTransformKeyframes)((0, _interactionsUtils.getKeyframes)(animConfig.effect, 'in', animConfig.direction), baseline); | |
| 630 | 895 | var options = { |
| 631 | 896 | duration: animConfig.duration / 1000, |
| 632 | 897 | delay: animConfig.delay / 1000, |
| 633 | 898 | ease: (0, _interactionsUtils.config)().defaultEasing |
| @@ -636,9 +901,9 @@ | ||
| 636 | 901 | // WHY - Transition can be set on elements but once it sets it destroys all animations, so we basically put it aside. |
| 637 | 902 | var transition = element.style.transition; |
| 638 | 903 | element.style.transition = 'none'; |
| 639 | 904 | if ('scrollOut' === animConfig.trigger) { |
| 640 | - scrollOutAnimation(element, transition, animConfig, keyframes, options, animateFunc, inViewFunc); | |
| 905 | + scrollOutAnimation(element, transition, keyframes, resetKeyframes, options, animateFunc, inViewFunc); | |
| 641 | 906 | } else if ('scrollIn' === animConfig.trigger) { |
| 642 | 907 | scrollInAnimation(element, transition, animConfig, keyframes, options, animateFunc, inViewFunc); |
| 643 | 908 | } else { |
| 644 | 909 | defaultAnimation(element, transition, keyframes, options, animateFunc); |
| @@ -649,9 +914,9 @@ | ||
| 649 | 914 | return; |
| 650 | 915 | } |
| 651 | 916 | interactions.forEach(function (interaction) { |
| 652 | 917 | var animConfig = (0, _interactionsUtils.extractAnimationConfig)(interaction); |
| 653 | - if (animConfig && !(0, _interactionsUtils.skipInteraction)(animConfig) && (0, _interactionsUtils.isFreeFrontendSupportedTrigger)(animConfig.trigger)) { | |
| 918 | + if (animConfig && !(0, _interactionsUtils.skipInteraction)(animConfig)) { | |
| 654 | 919 | applyAnimation(element, animConfig, animateFunc, inViewFunc); |
| 655 | 920 | } |
| 656 | 921 | }); |
| 657 | 922 | } |