← All changes
|
assets/js/packages/editor-interactions/editor-interactions.js
+1961
-3517
4.2.2
→
4.3.1
View file →
| @@ -1,1964 +1,1758 @@ | ||
| 1 | -/******/ (function() { // webpackBootstrap | |
| 2 | -/******/ "use strict"; | |
| 3 | -/******/ var __webpack_modules__ = ({ | |
| 1 | +(function(react, _elementor_icons, _elementor_ui, _wordpress_i18n, _elementor_session, _elementor_editor_elements, _elementor_editor_v1_adapters, _elementor_editor_props, _elementor_editor_controls, _elementor_events, _elementor_editor_responsive, _elementor_editor_mcp, _elementor_editor_ui, _elementor_utils, _elementor_schema) { | |
| 4 | 2 | |
| 5 | -/***/ "./packages/packages/core/editor-interactions/src/commands/get-clipboard-elements.ts": | |
| 6 | -/*!*******************************************************************************************!*\ | |
| 7 | - !*** ./packages/packages/core/editor-interactions/src/commands/get-clipboard-elements.ts ***! | |
| 8 | - \*******************************************************************************************/ | |
| 9 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 3 | +//#region \0rolldown/runtime.js | |
| 4 | + var __create = Object.create; | |
| 5 | + var __defProp = Object.defineProperty; | |
| 6 | + var __name = (target, value) => __defProp(target, "name", { | |
| 7 | + value, | |
| 8 | + configurable: true | |
| 9 | + }); | |
| 10 | + var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | |
| 11 | + var __getOwnPropNames = Object.getOwnPropertyNames; | |
| 12 | + var __getProtoOf = Object.getPrototypeOf; | |
| 13 | + var __hasOwnProp = Object.prototype.hasOwnProperty; | |
| 14 | + var __exportAll = (all, no_symbols) => { | |
| 15 | + let target = {}; | |
| 16 | + for (var name in all) { | |
| 17 | + __defProp(target, name, { | |
| 18 | + get: all[name], | |
| 19 | + enumerable: true | |
| 20 | + }); | |
| 21 | + } | |
| 22 | + if (!no_symbols) { | |
| 23 | + __defProp(target, Symbol.toStringTag, { value: "Module" }); | |
| 24 | + } | |
| 25 | + return target; | |
| 26 | + }; | |
| 27 | + var __copyProps = (to, from, except, desc) => { | |
| 28 | + if (from && typeof from === "object" || typeof from === "function") { | |
| 29 | + for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) { | |
| 30 | + key = keys[i]; | |
| 31 | + if (!__hasOwnProp.call(to, key) && key !== except) { | |
| 32 | + __defProp(to, key, { | |
| 33 | + get: ((k) => from[k]).bind(null, key), | |
| 34 | + enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable | |
| 35 | + }); | |
| 36 | + } | |
| 37 | + } | |
| 38 | + } | |
| 39 | + return to; | |
| 40 | + }; | |
| 41 | + var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { | |
| 42 | + value: mod, | |
| 43 | + enumerable: true | |
| 44 | + }) : target, mod)); | |
| 10 | 45 | |
| 11 | -__webpack_require__.r(__webpack_exports__); | |
| 12 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 13 | -/* harmony export */ getClipboardElements: function() { return /* binding */ getClipboardElements; } | |
| 14 | -/* harmony export */ }); | |
| 15 | -function getClipboardElements(storageKey = 'clipboard') { | |
| 16 | - try { | |
| 17 | - const storedData = JSON.parse(localStorage.getItem('elementor') ?? '{}'); | |
| 18 | - return storedData[storageKey]?.elements; | |
| 19 | - } catch { | |
| 20 | - return undefined; | |
| 21 | - } | |
| 22 | -} | |
| 46 | +//#endregion | |
| 47 | +react = __toESM(react); | |
| 23 | 48 | |
| 24 | -/***/ }), | |
| 49 | +//#region packages/packages/core/editor-interactions/src/components/empty-state.tsx | |
| 50 | + var EmptyState = ({ onCreateInteraction }) => { | |
| 51 | + return /* @__PURE__ */ react.createElement(_elementor_ui.Stack, { | |
| 52 | + alignItems: "center", | |
| 53 | + justifyContent: "center", | |
| 54 | + height: "100%", | |
| 55 | + color: "text.secondary", | |
| 56 | + sx: { | |
| 57 | + p: 2.5, | |
| 58 | + pt: 8, | |
| 59 | + pb: 5.5 | |
| 60 | + }, | |
| 61 | + gap: 1.5 | |
| 62 | + }, /* @__PURE__ */ react.createElement(_elementor_icons.SwipeIcon, { fontSize: "large" }), /* @__PURE__ */ react.createElement(_elementor_ui.Typography, { | |
| 63 | + align: "center", | |
| 64 | + variant: "subtitle2" | |
| 65 | + }, (0, _wordpress_i18n.__)("Animate elements with Interactions", "elementor")), /* @__PURE__ */ react.createElement(_elementor_ui.Typography, { | |
| 66 | + align: "center", | |
| 67 | + variant: "caption", | |
| 68 | + maxWidth: "170px" | |
| 69 | + }, (0, _wordpress_i18n.__)("Add entrance animations and effects triggered by user interactions such as page load or scroll.", "elementor")), /* @__PURE__ */ react.createElement(_elementor_ui.Button, { | |
| 70 | + variant: "outlined", | |
| 71 | + color: "secondary", | |
| 72 | + size: "small", | |
| 73 | + sx: { mt: 1 }, | |
| 74 | + onClick: onCreateInteraction | |
| 75 | + }, (0, _wordpress_i18n.__)("Create an interaction", "elementor"))); | |
| 76 | + }; | |
| 25 | 77 | |
| 26 | -/***/ "./packages/packages/core/editor-interactions/src/commands/paste-interactions.ts": | |
| 27 | -/*!***************************************************************************************!*\ | |
| 28 | - !*** ./packages/packages/core/editor-interactions/src/commands/paste-interactions.ts ***! | |
| 29 | - \***************************************************************************************/ | |
| 30 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 78 | +//#endregion | |
| 79 | +//#region packages/packages/core/editor-interactions/src/interactions-controls-registry.ts | |
| 80 | + var controlsRegistry = /* @__PURE__ */ new Map(); | |
| 81 | + function registerInteractionsControl({ type, component, options }) { | |
| 82 | + controlsRegistry.set(type, { | |
| 83 | + type, | |
| 84 | + component, | |
| 85 | + options | |
| 86 | + }); | |
| 87 | + } | |
| 88 | + function getInteractionsControl(type) { | |
| 89 | + return controlsRegistry.get(type); | |
| 90 | + } | |
| 91 | + function getInteractionsControlOptions(type) { | |
| 92 | + return controlsRegistry.get(type)?.options ?? []; | |
| 93 | + } | |
| 31 | 94 | |
| 32 | -__webpack_require__.r(__webpack_exports__); | |
| 33 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 34 | -/* harmony export */ initPasteInteractionsCommand: function() { return /* binding */ initPasteInteractionsCommand; } | |
| 35 | -/* harmony export */ }); | |
| 36 | -/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/editor-elements */ "@elementor/editor-elements"); | |
| 37 | -/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__); | |
| 38 | -/* harmony import */ var _elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-v1-adapters */ "@elementor/editor-v1-adapters"); | |
| 39 | -/* harmony import */ var _elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1__); | |
| 40 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 41 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__); | |
| 42 | -/* harmony import */ var _utils_is_supported_interaction_item__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/is-supported-interaction-item */ "./packages/packages/core/editor-interactions/src/utils/is-supported-interaction-item.ts"); | |
| 43 | -/* harmony import */ var _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/prop-value-utils */ "./packages/packages/core/editor-interactions/src/utils/prop-value-utils.ts"); | |
| 44 | -/* harmony import */ var _utils_temp_id_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/temp-id-utils */ "./packages/packages/core/editor-interactions/src/utils/temp-id-utils.ts"); | |
| 45 | -/* harmony import */ var _get_clipboard_elements__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./get-clipboard-elements */ "./packages/packages/core/editor-interactions/src/commands/get-clipboard-elements.ts"); | |
| 95 | +//#endregion | |
| 96 | +//#region packages/packages/core/editor-interactions/src/configs/time-constants.ts | |
| 97 | + var TIME_UNITS = ["s", "ms"]; | |
| 46 | 98 | |
| 99 | +//#endregion | |
| 100 | +//#region packages/packages/core/editor-interactions/src/utils/size-transform-utils.ts | |
| 101 | + var SIZE_REGEX = /^(?:(-?\d*\.?\d+)([a-z%]+)|([a-z%]+))$/i; | |
| 102 | + var parseSizeValue = (value, allowedUnits, defaultValue, defaultUnit) => { | |
| 103 | + if (typeof value === "number") return { | |
| 104 | + size: value, | |
| 105 | + unit: defaultUnit | |
| 106 | + }; | |
| 107 | + const sizeValue = tryParse(value, allowedUnits, defaultUnit); | |
| 108 | + if (sizeValue) return sizeValue; | |
| 109 | + if (defaultValue) { | |
| 110 | + const fallbackSize = tryParse(defaultValue, allowedUnits, defaultUnit); | |
| 111 | + if (fallbackSize) return fallbackSize; | |
| 112 | + } | |
| 113 | + return createSizeValue(null, defaultUnit); | |
| 114 | + }; | |
| 115 | + var tryParse = (value, allowedUnits, defaultUnit) => { | |
| 116 | + if (typeof value === "number") return createSizeValue(value, defaultUnit); | |
| 117 | + const match = value && value.match(SIZE_REGEX); | |
| 118 | + if (!match) { | |
| 119 | + if (value) return { | |
| 120 | + size: Number(value), | |
| 121 | + unit: defaultUnit | |
| 122 | + }; | |
| 123 | + return null; | |
| 124 | + } | |
| 125 | + const size = match[1] ? parseFloat(match[1]) : null; | |
| 126 | + const unit = match[2] || match[3]; | |
| 127 | + if (!allowedUnits.includes(unit)) return null; | |
| 128 | + return createSizeValue(size, unit); | |
| 129 | + }; | |
| 130 | + var formatSizeValue = ({ size, unit }) => { | |
| 131 | + return `${size ?? ""}${unit}`; | |
| 132 | + }; | |
| 133 | + var createSizeValue = (size, unit) => { | |
| 134 | + return { | |
| 135 | + size, | |
| 136 | + unit | |
| 137 | + }; | |
| 138 | + }; | |
| 47 | 139 | |
| 140 | +//#endregion | |
| 141 | +//#region packages/packages/core/editor-interactions/src/utils/custom-effect-to-prop-value.ts | |
| 142 | + var CUSTOM_EFFECT_TYPE = "custom-effect"; | |
| 143 | + var KEYFRAMES_TYPE = "keyframes"; | |
| 144 | + var KEYFRAME_STOP_TYPE = "keyframe-stop"; | |
| 145 | + var KEYFRAME_STOP_SETTINGS_TYPE = "keyframe-stop-settings"; | |
| 146 | + var SIZE_TYPE = "size"; | |
| 147 | + var NUMBER_TYPE = "number"; | |
| 148 | + var TRANSFORM_SCALE_TYPE = "transform-scale"; | |
| 149 | + var TRANSFORM_ROTATE_TYPE = "transform-rotate"; | |
| 150 | + var TRANSFORM_MOVE_TYPE = "transform-move"; | |
| 151 | + var TRANSFORM_SKEW_TYPE = "transform-skew"; | |
| 152 | + var UNIT_PERCENT = "%"; | |
| 153 | + var UNIT_DEG = "deg"; | |
| 154 | + var UNIT_PX = "px"; | |
| 155 | + var isPlainCustomEffect = (v) => typeof v === "object" && v !== null && "keyframes" in v && Array.isArray(v.keyframes) && !("$$type" in v); | |
| 156 | + var toSizePropValue = (size, unit = UNIT_PERCENT) => ({ | |
| 157 | + $$type: SIZE_TYPE, | |
| 158 | + value: { | |
| 159 | + size, | |
| 160 | + unit | |
| 161 | + } | |
| 162 | + }); | |
| 163 | + var toNumberPropValue = (n) => ({ | |
| 164 | + $$type: NUMBER_TYPE, | |
| 165 | + value: n | |
| 166 | + }); | |
| 167 | + var toDimensionalNumberPropValue = (type, plain, defaults) => ({ | |
| 168 | + $$type: type, | |
| 169 | + value: { | |
| 170 | + x: toNumberPropValue(plain.x ?? defaults.x), | |
| 171 | + y: toNumberPropValue(plain.y ?? defaults.y), | |
| 172 | + z: toNumberPropValue(plain.z ?? defaults.z) | |
| 173 | + } | |
| 174 | + }); | |
| 175 | + var toDimensionalSizePropValue = (type, plain, defaults, unit) => ({ | |
| 176 | + $$type: type, | |
| 177 | + value: { | |
| 178 | + x: toSizePropValue(plain.x ?? defaults.x, unit), | |
| 179 | + y: toSizePropValue(plain.y ?? defaults.y, unit), | |
| 180 | + z: toSizePropValue(plain.z ?? defaults.z, unit) | |
| 181 | + } | |
| 182 | + }); | |
| 183 | + var toSkewPropValue = (plain) => ({ | |
| 184 | + $$type: TRANSFORM_SKEW_TYPE, | |
| 185 | + value: { | |
| 186 | + x: toSizePropValue(plain.x ?? 0, UNIT_DEG), | |
| 187 | + y: toSizePropValue(plain.y ?? 0, UNIT_DEG) | |
| 188 | + } | |
| 189 | + }); | |
| 190 | + var toKeyframeStopSettingsPropValue = (plain) => { | |
| 191 | + const value = {}; | |
| 192 | + if (plain.opacity !== void 0) { | |
| 193 | + const percent = plain.opacity <= 1 ? Math.round(plain.opacity * 100) : plain.opacity; | |
| 194 | + value.opacity = toSizePropValue(percent); | |
| 195 | + } | |
| 196 | + if (plain.scale !== void 0) value.scale = toDimensionalNumberPropValue(TRANSFORM_SCALE_TYPE, plain.scale, { | |
| 197 | + x: 1, | |
| 198 | + y: 1, | |
| 199 | + z: 1 | |
| 200 | + }); | |
| 201 | + if (plain.rotate !== void 0) value.rotate = toDimensionalSizePropValue(TRANSFORM_ROTATE_TYPE, plain.rotate, { | |
| 202 | + x: 0, | |
| 203 | + y: 0, | |
| 204 | + z: 0 | |
| 205 | + }, UNIT_DEG); | |
| 206 | + if (plain.move !== void 0) value.move = toDimensionalSizePropValue(TRANSFORM_MOVE_TYPE, plain.move, { | |
| 207 | + x: 0, | |
| 208 | + y: 0, | |
| 209 | + z: 0 | |
| 210 | + }, UNIT_PX); | |
| 211 | + if (plain.skew !== void 0) value.skew = toSkewPropValue(plain.skew); | |
| 212 | + return { | |
| 213 | + $$type: KEYFRAME_STOP_SETTINGS_TYPE, | |
| 214 | + value | |
| 215 | + }; | |
| 216 | + }; | |
| 217 | + var isPlainKeyframe = (v) => typeof v === "object" && v !== null && "stop" in v && "value" in v && !("$$type" in v); | |
| 218 | + var toKeyframeStopPropValue = (item) => { | |
| 219 | + if (!isPlainKeyframe(item)) return item; | |
| 220 | + return { | |
| 221 | + $$type: KEYFRAME_STOP_TYPE, | |
| 222 | + value: { | |
| 223 | + stop: toSizePropValue(item.stop), | |
| 224 | + settings: toKeyframeStopSettingsPropValue(item.value) | |
| 225 | + } | |
| 226 | + }; | |
| 227 | + }; | |
| 228 | + var toKeyframesPropValue = (keyframes) => ({ | |
| 229 | + $$type: KEYFRAMES_TYPE, | |
| 230 | + value: keyframes.map(toKeyframeStopPropValue) | |
| 231 | + }); | |
| 232 | + var plainCustomEffectToPropValue = (plain) => ({ | |
| 233 | + $$type: CUSTOM_EFFECT_TYPE, | |
| 234 | + value: { keyframes: toKeyframesPropValue(plain.keyframes) } | |
| 235 | + }); | |
| 236 | + var toCustomEffectPropValue = (customEffects) => { | |
| 237 | + if (customEffects === void 0) return; | |
| 238 | + if (isPlainCustomEffect(customEffects)) return plainCustomEffectToPropValue(customEffects); | |
| 239 | + return customEffects; | |
| 240 | + }; | |
| 48 | 241 | |
| 242 | +//#endregion | |
| 243 | +//#region packages/packages/core/editor-interactions/src/utils/get-interactions-config.ts | |
| 244 | + function getInteractionsConfig() { | |
| 245 | + return window.ElementorInteractionsConfig ?? {}; | |
| 246 | + } | |
| 49 | 247 | |
| 248 | +//#endregion | |
| 249 | +//#region packages/packages/core/editor-interactions/src/utils/temp-id-utils.ts | |
| 250 | + var TEMP_ID_PREFIX = "temp-"; | |
| 251 | + var TEMP_ID_REGEX = /^temp-[a-z0-9]+$/i; | |
| 252 | + function generateTempInteractionId() { | |
| 253 | + return `${TEMP_ID_PREFIX}${Math.random().toString(36).substring(2, 11)}`; | |
| 254 | + } | |
| 255 | + function isTempId(id) { | |
| 256 | + return !!id && TEMP_ID_REGEX.test(id); | |
| 257 | + } | |
| 50 | 258 | |
| 259 | +//#endregion | |
| 260 | +//#region packages/packages/core/editor-interactions/src/utils/prop-value-utils.ts | |
| 261 | + var createString = (value) => ({ | |
| 262 | + $$type: "string", | |
| 263 | + value | |
| 264 | + }); | |
| 265 | + var createNumber = (value) => ({ | |
| 266 | + $$type: "number", | |
| 267 | + value | |
| 268 | + }); | |
| 269 | + var createTimingConfig = (duration, delay) => ({ | |
| 270 | + $$type: "timing-config", | |
| 271 | + value: { | |
| 272 | + duration: _elementor_editor_props.sizePropTypeUtil.create(parseSizeValue(duration, TIME_UNITS, void 0, "ms")), | |
| 273 | + delay: _elementor_editor_props.sizePropTypeUtil.create(parseSizeValue(delay, TIME_UNITS, void 0, "ms")) | |
| 274 | + } | |
| 275 | + }); | |
| 276 | + var createBoolean = (value) => ({ | |
| 277 | + $$type: "boolean", | |
| 278 | + value | |
| 279 | + }); | |
| 280 | + var createConfig = ({ replay, easing = "easeIn", relativeTo = "viewport", repeat = "", times = 1, start = 85, end = 15 }) => ({ | |
| 281 | + $$type: "config", | |
| 282 | + value: { | |
| 283 | + replay: createBoolean(replay), | |
| 284 | + easing: createString(easing), | |
| 285 | + relativeTo: createString(relativeTo), | |
| 286 | + repeat: createString(repeat), | |
| 287 | + times: createNumber(times), | |
| 288 | + start: createSize(start, "%"), | |
| 289 | + end: createSize(end, "%") | |
| 290 | + } | |
| 291 | + }); | |
| 292 | + var createSize = (value, defaultUnit, defaultValue) => { | |
| 293 | + if (!value) return; | |
| 294 | + return _elementor_editor_props.sizePropTypeUtil.create(parseSizeValue(value, ["%"], defaultValue, defaultUnit)); | |
| 295 | + }; | |
| 296 | + var extractBoolean = (prop, fallback = false) => { | |
| 297 | + return prop?.value ?? fallback; | |
| 298 | + }; | |
| 299 | + var createExcludedBreakpoints = (breakpoints) => ({ | |
| 300 | + $$type: "excluded-breakpoints", | |
| 301 | + value: breakpoints.map(createString) | |
| 302 | + }); | |
| 303 | + var createInteractionBreakpoints = (excluded) => ({ | |
| 304 | + $$type: "interaction-breakpoints", | |
| 305 | + value: { excluded: createExcludedBreakpoints(excluded) } | |
| 306 | + }); | |
| 307 | + var extractExcludedBreakpoints = (breakpoints) => { | |
| 308 | + return breakpoints?.value.excluded.value.map((bp) => bp.value) ?? []; | |
| 309 | + }; | |
| 310 | + var createAnimationPreset = ({ effect, type, direction, duration, delay, replay = false, easing = "easeIn", relativeTo, repeat, times, start, end, customEffects }) => { | |
| 311 | + const customEffectProp = toCustomEffectPropValue(customEffects); | |
| 312 | + return { | |
| 313 | + $$type: "animation-preset-props", | |
| 314 | + value: { | |
| 315 | + effect: createString(effect), | |
| 316 | + ...customEffectProp !== void 0 && { custom_effect: customEffectProp }, | |
| 317 | + type: createString(type), | |
| 318 | + direction: createString(direction ?? ""), | |
| 319 | + timing_config: createTimingConfig(duration, delay), | |
| 320 | + config: createConfig({ | |
| 321 | + replay, | |
| 322 | + easing, | |
| 323 | + relativeTo, | |
| 324 | + repeat, | |
| 325 | + times, | |
| 326 | + start, | |
| 327 | + end | |
| 328 | + }) | |
| 329 | + } | |
| 330 | + }; | |
| 331 | + }; | |
| 332 | + var createInteractionItem = ({ trigger, effect, type, direction, duration, delay, interactionId, replay = false, easing = "easeIn", relativeTo, repeat, times, start, end, excludedBreakpoints, customEffects }) => ({ | |
| 333 | + $$type: "interaction-item", | |
| 334 | + value: { | |
| 335 | + ...interactionId && { interaction_id: createString(interactionId) }, | |
| 336 | + trigger: createString(trigger ?? ""), | |
| 337 | + animation: createAnimationPreset({ | |
| 338 | + effect: effect ?? "", | |
| 339 | + type: type ?? "", | |
| 340 | + direction, | |
| 341 | + duration: duration ?? 0, | |
| 342 | + delay: delay ?? 0, | |
| 343 | + replay, | |
| 344 | + easing, | |
| 345 | + relativeTo, | |
| 346 | + repeat, | |
| 347 | + times, | |
| 348 | + start, | |
| 349 | + end, | |
| 350 | + customEffects | |
| 351 | + }), | |
| 352 | + ...excludedBreakpoints && excludedBreakpoints.length > 0 && { breakpoints: createInteractionBreakpoints(excludedBreakpoints) } | |
| 353 | + } | |
| 354 | + }); | |
| 355 | + var createDefaultInteractionItem = () => { | |
| 356 | + const { constants } = getInteractionsConfig(); | |
| 357 | + return createInteractionItem({ | |
| 358 | + trigger: "load", | |
| 359 | + effect: "fade", | |
| 360 | + type: "in", | |
| 361 | + duration: constants.defaultDuration, | |
| 362 | + delay: constants.defaultDelay, | |
| 363 | + replay: false, | |
| 364 | + easing: constants.defaultEasing, | |
| 365 | + interactionId: generateTempInteractionId() | |
| 366 | + }); | |
| 367 | + }; | |
| 368 | + var createDefaultInteractions = () => ({ | |
| 369 | + version: 1, | |
| 370 | + items: [createDefaultInteractionItem()] | |
| 371 | + }); | |
| 372 | + var extractString = (prop, fallback = "") => { | |
| 373 | + return prop?.value ?? fallback; | |
| 374 | + }; | |
| 375 | + var extractSize = (prop, defaultValue) => { | |
| 376 | + if (!prop?.value) return defaultValue; | |
| 377 | + return formatSizeValue(prop.value); | |
| 378 | + }; | |
| 379 | + var TRIGGER_LABELS$1 = { | |
| 380 | + load: "On page load", | |
| 381 | + scrollIn: "Scroll into view", | |
| 382 | + scrollOut: "Scroll out of view", | |
| 383 | + scrollOn: "While scrolling" | |
| 384 | + }; | |
| 385 | + var capitalize$1 = /* @__PURE__ */ __name((str) => { | |
| 386 | + return str.charAt(0).toUpperCase() + str.slice(1); | |
| 387 | + }, "capitalize"); | |
| 388 | + var buildDisplayLabel = (item) => { | |
| 389 | + const trigger = extractString(item.trigger); | |
| 390 | + const effect = extractString(item.animation.value.effect); | |
| 391 | + const type = extractString(item.animation.value.type); | |
| 392 | + return `${TRIGGER_LABELS$1[trigger] || capitalize$1(trigger)}: ${capitalize$1(effect)} ${"custom" === effect ? "" : capitalize$1(type)}`; | |
| 393 | + }; | |
| 51 | 394 | |
| 395 | +//#endregion | |
| 396 | +//#region packages/packages/core/editor-interactions/src/utils/is-supported-interaction-item.ts | |
| 397 | + function isSupportedInteractionItem(interaction) { | |
| 398 | + const value = interaction.value; | |
| 399 | + if (true === extractBoolean(value.animation.value.config?.value.replay)) return hasSupport("replay", "yes"); | |
| 400 | + const trigger = extractString(value.trigger); | |
| 401 | + const easing = extractString(value.animation.value.config?.value.easing); | |
| 402 | + const effect = extractString(value.animation.value.effect); | |
| 403 | + return [ | |
| 404 | + ["trigger", trigger], | |
| 405 | + ["easing", easing], | |
| 406 | + ["effect", effect] | |
| 407 | + ].every(([controlType, controlValue]) => { | |
| 408 | + if (controlValue === "" || controlValue === null) return true; | |
| 409 | + return hasSupport(controlType, controlValue); | |
| 410 | + }); | |
| 411 | + } | |
| 412 | + function hasSupport(controlType, controlValue) { | |
| 413 | + const supportedOptions = getInteractionsControlOptions(controlType); | |
| 414 | + if (1 > supportedOptions.length) return true; | |
| 415 | + return supportedOptions.includes(controlValue); | |
| 416 | + } | |
| 52 | 417 | |
| 53 | -function isAtomicContainer(container) { | |
| 54 | - const type = container?.model.get('widgetType') || container?.model.get('elType'); | |
| 55 | - const widgetsCache = (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__.getWidgetsCache)(); | |
| 56 | - const elementConfig = widgetsCache?.[type]; | |
| 57 | - return Boolean(elementConfig?.atomic_props_schema); | |
| 58 | -} | |
| 59 | -function getTitleForContainers(containers) { | |
| 60 | - return containers.length > 1 ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Elements', 'elementor') : (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__.getElementLabel)(containers[0].id); | |
| 61 | -} | |
| 62 | -function normalizeClipboardInteractions(raw) { | |
| 63 | - if (!raw) { | |
| 64 | - return null; | |
| 65 | - } | |
| 66 | - const parsed = typeof raw === 'string' ? JSON.parse(raw) : raw; | |
| 67 | - const payload = { | |
| 68 | - version: parsed?.version ?? 1, | |
| 69 | - items: parsed?.items?.filter(item => (0,_utils_is_supported_interaction_item__WEBPACK_IMPORTED_MODULE_3__.isSupportedInteractionItem)(item)) ?? [] | |
| 70 | - }; | |
| 71 | - if (!payload.items.length) { | |
| 72 | - return null; | |
| 73 | - } | |
| 74 | - return payload; | |
| 75 | -} | |
| 76 | -function regenerateInteractionIds(interactions) { | |
| 77 | - const cloned = structuredClone(interactions); | |
| 78 | - cloned.items?.forEach(item => { | |
| 79 | - if (item.$$type === 'interaction-item' && item.value) { | |
| 80 | - item.value.interaction_id = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_4__.createString)((0,_utils_temp_id_utils__WEBPACK_IMPORTED_MODULE_5__.generateTempInteractionId)()); | |
| 81 | - } | |
| 82 | - }); | |
| 83 | - return cloned; | |
| 84 | -} | |
| 85 | -function initPasteInteractionsCommand() { | |
| 86 | - const undoablePasteInteractions = (0,_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1__.undoable)({ | |
| 87 | - do: ({ | |
| 88 | - containers, | |
| 89 | - newInteractions | |
| 90 | - }) => { | |
| 91 | - const pasted = regenerateInteractionIds(newInteractions); | |
| 92 | - return containers.map(container => { | |
| 93 | - const elementId = container.id; | |
| 94 | - const previous = (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__.getElementInteractions)(elementId); | |
| 95 | - (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__.updateElementInteractions)({ | |
| 96 | - elementId, | |
| 97 | - interactions: pasted | |
| 98 | - }); | |
| 99 | - return { | |
| 100 | - elementId, | |
| 101 | - previous: previous ?? { | |
| 102 | - version: 1, | |
| 103 | - items: [] | |
| 104 | - } | |
| 105 | - }; | |
| 106 | - }); | |
| 107 | - }, | |
| 108 | - undo: (_, revertData) => { | |
| 109 | - revertData.forEach(({ | |
| 110 | - elementId, | |
| 111 | - previous | |
| 112 | - }) => { | |
| 113 | - (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__.updateElementInteractions)({ | |
| 114 | - elementId, | |
| 115 | - interactions: previous.items?.length ? previous : undefined | |
| 116 | - }); | |
| 117 | - }); | |
| 118 | - } | |
| 119 | - }, { | |
| 120 | - title: ({ | |
| 121 | - containers | |
| 122 | - }) => getTitleForContainers(containers), | |
| 123 | - subtitle: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Interactions Pasted', 'elementor') | |
| 124 | - }); | |
| 125 | - (0,_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1__.__privateListenTo)((0,_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1__.commandStartEvent)('document/elements/paste-interactions'), e => { | |
| 126 | - const args = e.args; | |
| 127 | - const containers = args.containers ?? (args.container ? [args.container] : []); | |
| 128 | - const storageKey = args.storageKey ?? 'clipboard'; | |
| 129 | - if (!containers.length) { | |
| 130 | - return; | |
| 131 | - } | |
| 132 | - const clipboardElements = (0,_get_clipboard_elements__WEBPACK_IMPORTED_MODULE_6__.getClipboardElements)(storageKey); | |
| 133 | - const [clipboardElement] = clipboardElements ?? []; | |
| 134 | - if (!clipboardElement) { | |
| 135 | - return; | |
| 136 | - } | |
| 137 | - const newInteractions = normalizeClipboardInteractions(clipboardElement.interactions); | |
| 138 | - if (!newInteractions) { | |
| 139 | - return; | |
| 140 | - } | |
| 141 | - const existingContainers = containers.filter(c => (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__.getContainer)(c.id)); | |
| 142 | - const validContainers = existingContainers.filter(isAtomicContainer); | |
| 143 | - if (!validContainers.length) { | |
| 144 | - return; | |
| 145 | - } | |
| 146 | - undoablePasteInteractions({ | |
| 147 | - containers: validContainers, | |
| 148 | - newInteractions | |
| 149 | - }); | |
| 150 | - }); | |
| 151 | -} | |
| 418 | +//#endregion | |
| 419 | +//#region packages/packages/core/editor-interactions/src/utils/filter-interactions.ts | |
| 420 | + var filterInteractions = (interactions) => { | |
| 421 | + return interactions.filter((interaction) => { | |
| 422 | + return isSupportedInteractionItem(interaction); | |
| 423 | + }); | |
| 424 | + }; | |
| 152 | 425 | |
| 153 | -/***/ }), | |
| 426 | +//#endregion | |
| 427 | +//#region packages/packages/core/editor-interactions/src/hooks/use-element-interactions.ts | |
| 428 | + var useElementInteractions = (elementId) => { | |
| 429 | + const [interactions, setInteractions] = (0, react.useState)(() => { | |
| 430 | + const initial = (0, _elementor_editor_elements.getElementInteractions)(elementId); | |
| 431 | + const filteredInteractions = filterInteractions(initial?.items ?? []); | |
| 432 | + return { | |
| 433 | + version: initial?.version ?? 1, | |
| 434 | + items: filteredInteractions | |
| 435 | + }; | |
| 436 | + }); | |
| 437 | + (0, _elementor_editor_v1_adapters.__privateUseListenTo)((0, _elementor_editor_v1_adapters.windowEvent)("elementor/element/update_interactions"), () => { | |
| 438 | + const newInteractions = (0, _elementor_editor_elements.getElementInteractions)(elementId); | |
| 439 | + const filteredInteractions = filterInteractions(newInteractions?.items ?? []); | |
| 440 | + setInteractions({ | |
| 441 | + version: newInteractions?.version ?? 1, | |
| 442 | + items: filteredInteractions | |
| 443 | + }); | |
| 444 | + }, [elementId]); | |
| 445 | + return interactions; | |
| 446 | + }; | |
| 154 | 447 | |
| 155 | -/***/ "./packages/packages/core/editor-interactions/src/components/controls/direction.tsx": | |
| 156 | -/*!******************************************************************************************!*\ | |
| 157 | - !*** ./packages/packages/core/editor-interactions/src/components/controls/direction.tsx ***! | |
| 158 | - \******************************************************************************************/ | |
| 159 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 448 | +//#endregion | |
| 449 | +//#region packages/packages/core/editor-interactions/src/contexts/interactions-context.tsx | |
| 450 | + var InteractionsContext = (0, react.createContext)(null); | |
| 451 | + var DEFAULT_INTERACTIONS = { | |
| 452 | + version: 1, | |
| 453 | + items: [] | |
| 454 | + }; | |
| 455 | + var InteractionsProvider = ({ children, elementId }) => { | |
| 456 | + const rawInteractions = useElementInteractions(elementId); | |
| 457 | + (0, react.useEffect)(() => { | |
| 458 | + window.dispatchEvent(new CustomEvent("elementor/element/update_interactions")); | |
| 459 | + }, []); | |
| 460 | + const interactions = rawInteractions ?? DEFAULT_INTERACTIONS; | |
| 461 | + const undoableSetInteractions = (0, react.useMemo)(() => (0, _elementor_editor_v1_adapters.undoable)({ | |
| 462 | + do: ({ interactions: newInteractions }) => { | |
| 463 | + const previous = (0, _elementor_editor_elements.getElementInteractions)(elementId); | |
| 464 | + (0, _elementor_editor_elements.updateElementInteractions)({ | |
| 465 | + elementId, | |
| 466 | + interactions: newInteractions | |
| 467 | + }); | |
| 468 | + return previous; | |
| 469 | + }, | |
| 470 | + undo: (_, previous) => { | |
| 471 | + (0, _elementor_editor_elements.updateElementInteractions)({ | |
| 472 | + elementId, | |
| 473 | + interactions: previous?.items?.length ? previous : void 0 | |
| 474 | + }); | |
| 475 | + } | |
| 476 | + }, { | |
| 477 | + title: (0, _elementor_editor_elements.getElementLabel)(elementId), | |
| 478 | + subtitle: ({ operationType }) => operationType === "apply" ? (0, _wordpress_i18n.__)("Interaction Applied", "elementor") : (0, _wordpress_i18n.__)("Interaction Deleted", "elementor") | |
| 479 | + }), [elementId]); | |
| 480 | + const setInteractions = (value) => { | |
| 481 | + const normalizedValue = value && value.items?.length === 0 ? void 0 : value; | |
| 482 | + const prevItemCount = interactions.items?.length ?? 0; | |
| 483 | + const newItemCount = normalizedValue?.items?.length ?? 0; | |
| 484 | + if (newItemCount > prevItemCount) undoableSetInteractions({ | |
| 485 | + interactions: normalizedValue, | |
| 486 | + operationType: "apply" | |
| 487 | + }); | |
| 488 | + else if (newItemCount < prevItemCount) undoableSetInteractions({ | |
| 489 | + interactions: normalizedValue, | |
| 490 | + operationType: "delete" | |
| 491 | + }); | |
| 492 | + else (0, _elementor_editor_elements.updateElementInteractions)({ | |
| 493 | + elementId, | |
| 494 | + interactions: normalizedValue | |
| 495 | + }); | |
| 496 | + }; | |
| 497 | + const playInteractions = (interactionId) => { | |
| 498 | + (0, _elementor_editor_elements.playElementInteractions)(elementId, interactionId); | |
| 499 | + }; | |
| 500 | + const contextValue = { | |
| 501 | + elementId, | |
| 502 | + interactions, | |
| 503 | + setInteractions, | |
| 504 | + playInteractions | |
| 505 | + }; | |
| 506 | + return /* @__PURE__ */ react.createElement(InteractionsContext.Provider, { value: contextValue }, children); | |
| 507 | + }; | |
| 508 | + var useInteractionsContext = () => { | |
| 509 | + const context = (0, react.useContext)(InteractionsContext); | |
| 510 | + if (!context) throw new Error("useInteractionsContext must be used within InteractionsProvider"); | |
| 511 | + return context; | |
| 512 | + }; | |
| 160 | 513 | |
| 161 | -__webpack_require__.r(__webpack_exports__); | |
| 162 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 163 | -/* harmony export */ Direction: function() { return /* binding */ Direction; } | |
| 164 | -/* harmony export */ }); | |
| 165 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 166 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 167 | -/* harmony import */ var _elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-controls */ "@elementor/editor-controls"); | |
| 168 | -/* harmony import */ var _elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__); | |
| 169 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons"); | |
| 170 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__); | |
| 171 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 172 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__); | |
| 173 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 174 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__); | |
| 514 | +//#endregion | |
| 515 | +//#region packages/packages/core/editor-interactions/src/contexts/popup-state-context.tsx | |
| 516 | + var PopupStateContext = (0, react.createContext)(void 0); | |
| 517 | + var PopupStateProvider = ({ children }) => { | |
| 518 | + const [openByDefault, setOpenByDefault] = (0, react.useState)(false); | |
| 519 | + const triggerDefaultOpen = (0, react.useCallback)(() => { | |
| 520 | + setOpenByDefault(true); | |
| 521 | + }, []); | |
| 522 | + const resetDefaultOpen = (0, react.useCallback)(() => { | |
| 523 | + setOpenByDefault(false); | |
| 524 | + }, []); | |
| 525 | + return /* @__PURE__ */ react.createElement(PopupStateContext.Provider, { value: { | |
| 526 | + openByDefault, | |
| 527 | + triggerDefaultOpen, | |
| 528 | + resetDefaultOpen | |
| 529 | + } }, children); | |
| 530 | + }; | |
| 175 | 531 | |
| 532 | +//#endregion | |
| 533 | +//#region packages/packages/core/editor-interactions/src/contexts/interactions-item-context.tsx | |
| 534 | + var InteractionItemContext = (0, react.createContext)(null); | |
| 535 | + function InteractionItemContextProvider({ value, children }) { | |
| 536 | + return /* @__PURE__ */ react.createElement(InteractionItemContext.Provider, { value }, children); | |
| 537 | + } | |
| 538 | + function useInteractionItemContext() { | |
| 539 | + const context = (0, react.useContext)(InteractionItemContext); | |
| 540 | + if (!context) throw new Error("useInteractionItemContext must be used within InteractionItemContextProvider"); | |
| 541 | + return context; | |
| 542 | + } | |
| 176 | 543 | |
| 544 | +//#endregion | |
| 545 | +//#region packages/packages/core/editor-interactions/src/utils/scroll-interaction-event.ts | |
| 546 | + var SCROLL_INTERACTION_EVENT = "elementor/interactions/scroll-change"; | |
| 547 | + function dispatchScrollInteraction(data) { | |
| 548 | + window.dispatchEvent(new CustomEvent(SCROLL_INTERACTION_EVENT, { detail: data })); | |
| 549 | + } | |
| 550 | + function extractScrollOverlayParams(interaction, defaults) { | |
| 551 | + return { | |
| 552 | + trigger: extractString(interaction.trigger, defaults.trigger), | |
| 553 | + start: extractSize(interaction.animation.value.config?.value.start, defaults.start), | |
| 554 | + end: extractSize(interaction.animation.value.config?.value.end, defaults.end), | |
| 555 | + relativeTo: extractString(interaction.animation.value.config?.value.relativeTo, defaults.relativeTo) | |
| 556 | + }; | |
| 557 | + } | |
| 558 | + function syncGridOverlay(trigger, start, end, relativeTo) { | |
| 559 | + if (trigger === "scrollOn") dispatchScrollInteraction({ | |
| 560 | + start, | |
| 561 | + end, | |
| 562 | + relativeTo | |
| 563 | + }); | |
| 564 | + else dispatchScrollInteraction(null); | |
| 565 | + } | |
| 177 | 566 | |
| 567 | +//#endregion | |
| 568 | +//#region packages/packages/core/editor-interactions/src/utils/tracking.ts | |
| 569 | + var TRIGGER_LABELS = { | |
| 570 | + load: "On page load", | |
| 571 | + scrollIn: "Scroll into view", | |
| 572 | + scrollOut: "Scroll out of view", | |
| 573 | + scrollOn: "While scrolling", | |
| 574 | + hover: "Hover", | |
| 575 | + click: "Click" | |
| 576 | + }; | |
| 577 | + var capitalize = (s) => s.charAt(0).toUpperCase() + s.slice(1); | |
| 578 | + var trackInteractionCreated = (elementId, item) => { | |
| 579 | + const { dispatchEvent, config } = (0, _elementor_events.getMixpanel)(); | |
| 580 | + if (!config?.names?.interactions?.created) return; | |
| 581 | + const trigger = extractString(item.value.trigger); | |
| 582 | + const effect = extractString(item.value.animation.value.effect); | |
| 583 | + const type = extractString(item.value.animation.value.type); | |
| 584 | + dispatchEvent?.(config.names.interactions.created, { | |
| 585 | + window_name: config?.appTypes?.editor, | |
| 586 | + interaction_type: config?.triggers?.click, | |
| 587 | + target_name: (0, _elementor_editor_elements.getElementLabel)(elementId), | |
| 588 | + interaction_result: "interaction_created", | |
| 589 | + target_location: config?.locations?.widgetPanel, | |
| 590 | + location_l1: (0, _elementor_editor_elements.getElementLabel)(elementId), | |
| 591 | + location_l2: "interactions", | |
| 592 | + interaction_description: "interaction_created", | |
| 593 | + interaction_trigger: TRIGGER_LABELS[trigger] ?? capitalize(trigger), | |
| 594 | + interaction_effect: effect === "custom" ? capitalize(effect) : `${capitalize(effect)} ${capitalize(type)}` | |
| 595 | + }); | |
| 596 | + }; | |
| 178 | 597 | |
| 598 | +//#endregion | |
| 599 | +//#region packages/packages/core/editor-interactions/src/utils/resolve-direction.ts | |
| 600 | + var resolveDirection = (hasDirection, newEffect, newDirection, currentDirection, currentEffect) => { | |
| 601 | + if (newEffect === "slide" && !newDirection) return "top"; | |
| 602 | + if (currentEffect === "slide" && hasDirection) return newDirection || "top"; | |
| 603 | + if (hasDirection) return newDirection; | |
| 604 | + return currentDirection; | |
| 605 | + }; | |
| 179 | 606 | |
| 607 | +//#endregion | |
| 608 | +//#region packages/packages/core/editor-interactions/src/components/controls/time-frame-indicator.tsx | |
| 609 | + function TimeFrameIndicator({ value, onChange, defaultValue }) { | |
| 610 | + const sizeValue = parseSizeValue(value, TIME_UNITS, defaultValue, "ms"); | |
| 611 | + const handleChange = (0, react.useCallback)((size) => { | |
| 612 | + onChange(formatSizeValue(size)); | |
| 613 | + }, [onChange]); | |
| 614 | + const handleBlur = (event) => { | |
| 615 | + if (!event.target.value) handleChange(parseSizeValue(defaultValue, TIME_UNITS, void 0, "ms")); | |
| 616 | + }; | |
| 617 | + return /* @__PURE__ */ react.createElement(_elementor_editor_controls.SizeComponent, { | |
| 618 | + units: TIME_UNITS, | |
| 619 | + value: sizeValue, | |
| 620 | + setValue: handleChange, | |
| 621 | + onBlur: handleBlur, | |
| 622 | + InputProps: { inputProps: { min: 0 } } | |
| 623 | + }); | |
| 624 | + } | |
| 180 | 625 | |
| 181 | -const AXIS = { | |
| 182 | - top: 'vertical', | |
| 183 | - bottom: 'vertical', | |
| 184 | - left: 'horizontal', | |
| 185 | - right: 'horizontal' | |
| 186 | -}; | |
| 187 | -function parseValue(value) { | |
| 188 | - return value.split('-').filter(Boolean); | |
| 189 | -} | |
| 190 | -function serializeValue(directions) { | |
| 191 | - const vertical = directions.find(d => d === 'top' || d === 'bottom'); | |
| 192 | - const horizontal = directions.find(d => d === 'left' || d === 'right'); | |
| 193 | - if (vertical && horizontal) { | |
| 194 | - return `${vertical}-${horizontal}`; | |
| 195 | - } | |
| 196 | - return directions[0] ?? ''; | |
| 197 | -} | |
| 198 | -function toggleDirection(current, clicked) { | |
| 199 | - if (current.includes(clicked)) { | |
| 200 | - return current.filter(d => d !== clicked); | |
| 201 | - } | |
| 202 | - const filtered = current.filter(d => AXIS[d] !== AXIS[clicked]); | |
| 203 | - return [...filtered, clicked]; | |
| 204 | -} | |
| 205 | -function Direction({ | |
| 206 | - value, | |
| 207 | - onChange, | |
| 208 | - interactionType | |
| 209 | -}) { | |
| 210 | - const isIn = interactionType === 'in'; | |
| 211 | - const options = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => [{ | |
| 212 | - dir: 'top', | |
| 213 | - label: isIn ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('From top', 'elementor') : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('To top', 'elementor'), | |
| 214 | - Icon: isIn ? _elementor_icons__WEBPACK_IMPORTED_MODULE_2__.ArrowDownSmallIcon : _elementor_icons__WEBPACK_IMPORTED_MODULE_2__.ArrowUpSmallIcon | |
| 215 | - }, { | |
| 216 | - dir: 'bottom', | |
| 217 | - label: isIn ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('From bottom', 'elementor') : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('To bottom', 'elementor'), | |
| 218 | - Icon: isIn ? _elementor_icons__WEBPACK_IMPORTED_MODULE_2__.ArrowUpSmallIcon : _elementor_icons__WEBPACK_IMPORTED_MODULE_2__.ArrowDownSmallIcon | |
| 219 | - }, { | |
| 220 | - dir: 'left', | |
| 221 | - label: isIn ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('From left', 'elementor') : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('To left', 'elementor'), | |
| 222 | - Icon: isIn ? _elementor_icons__WEBPACK_IMPORTED_MODULE_2__.ArrowRightIcon : _elementor_icons__WEBPACK_IMPORTED_MODULE_2__.ArrowLeftIcon | |
| 223 | - }, { | |
| 224 | - dir: 'right', | |
| 225 | - label: isIn ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('From right', 'elementor') : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('To right', 'elementor'), | |
| 226 | - Icon: isIn ? _elementor_icons__WEBPACK_IMPORTED_MODULE_2__.ArrowLeftIcon : _elementor_icons__WEBPACK_IMPORTED_MODULE_2__.ArrowRightIcon | |
| 227 | - }], [isIn]); | |
| 228 | - const selectedDirections = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => parseValue(value), [value]); | |
| 229 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__.StyledToggleButtonGroup, { | |
| 230 | - size: "tiny", | |
| 231 | - justify: "end", | |
| 232 | - sx: { | |
| 233 | - display: 'grid', | |
| 234 | - gridTemplateColumns: 'repeat(4, minmax(0, 25%))', | |
| 235 | - width: '100%' | |
| 236 | - } | |
| 237 | - }, options.map(({ | |
| 238 | - dir, | |
| 239 | - label, | |
| 240 | - Icon | |
| 241 | - }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Tooltip, { | |
| 242 | - key: dir, | |
| 243 | - title: label, | |
| 244 | - disableFocusListener: true, | |
| 245 | - placement: "top" | |
| 246 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__.StyledToggleButton, { | |
| 247 | - value: dir, | |
| 248 | - selected: selectedDirections.includes(dir), | |
| 249 | - "aria-label": label, | |
| 250 | - size: "tiny", | |
| 251 | - isPlaceholder: false, | |
| 252 | - onChange: () => { | |
| 253 | - const next = toggleDirection(selectedDirections, dir); | |
| 254 | - onChange(serializeValue(next)); | |
| 255 | - } | |
| 256 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Icon, { | |
| 257 | - fontSize: "tiny" | |
| 258 | - }))))); | |
| 259 | -} | |
| 626 | +//#endregion | |
| 627 | +//#region packages/packages/core/editor-interactions/src/components/field.tsx | |
| 628 | + var Field = ({ label, children }) => { | |
| 629 | + return /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { | |
| 630 | + item: true, | |
| 631 | + xs: 12, | |
| 632 | + "aria-label": `${label} control` | |
| 633 | + }, /* @__PURE__ */ react.createElement(_elementor_editor_controls.PopoverGridContainer, null, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { | |
| 634 | + item: true, | |
| 635 | + xs: 6 | |
| 636 | + }, /* @__PURE__ */ react.createElement(_elementor_editor_controls.ControlFormLabel, null, label)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { | |
| 637 | + item: true, | |
| 638 | + xs: 6 | |
| 639 | + }, children))); | |
| 640 | + }; | |
| 260 | 641 | |
| 261 | -/***/ }), | |
| 642 | +//#endregion | |
| 643 | +//#region packages/packages/core/editor-interactions/src/components/interaction-details.tsx | |
| 644 | + var DEFAULT_VALUES = { | |
| 645 | + trigger: "load", | |
| 646 | + effect: "fade", | |
| 647 | + type: "in", | |
| 648 | + direction: "", | |
| 649 | + duration: 600, | |
| 650 | + delay: 0, | |
| 651 | + replay: false, | |
| 652 | + easing: "easeIn", | |
| 653 | + relativeTo: "viewport", | |
| 654 | + repeat: "", | |
| 655 | + times: 1, | |
| 656 | + start: 85, | |
| 657 | + end: 15 | |
| 658 | + }; | |
| 659 | + var TRIGGERS_WITHOUT_REPLAY = [ | |
| 660 | + "load", | |
| 661 | + "scrollOn", | |
| 662 | + "hover", | |
| 663 | + "click" | |
| 664 | + ]; | |
| 665 | + var controlVisibilityConfig = { | |
| 666 | + replay: (values) => !TRIGGERS_WITHOUT_REPLAY.includes(values.trigger), | |
| 667 | + custom: (values) => values.effect === "custom", | |
| 668 | + effectType: (values) => values.effect !== "custom", | |
| 669 | + direction: (values) => values.effect !== "custom", | |
| 670 | + relativeTo: (values) => values.trigger === "scrollOn", | |
| 671 | + start: (values) => values.trigger === "scrollOn", | |
| 672 | + end: (values) => values.trigger === "scrollOn", | |
| 673 | + repeat: (values) => values.trigger !== "scrollOn", | |
| 674 | + times: (values) => values.trigger !== "scrollOn" && values.repeat === "times", | |
| 675 | + duration: (values) => { | |
| 676 | + return !(values.trigger === "scrollOn"); | |
| 677 | + }, | |
| 678 | + delay: (values) => { | |
| 679 | + return !(values.trigger === "scrollOn"); | |
| 680 | + } | |
| 681 | + }; | |
| 682 | + function normalizeTimesValue(value, fallback) { | |
| 683 | + const numericValue = Number(value); | |
| 684 | + if (!Number.isFinite(numericValue)) return fallback; | |
| 685 | + return Math.max(1, Math.floor(numericValue)); | |
| 686 | + } | |
| 687 | + function useControlComponent(controlName, isVisible = true) { | |
| 688 | + return (0, react.useMemo)(() => { | |
| 689 | + if (!isVisible) return null; | |
| 690 | + return getInteractionsControl(controlName)?.component ?? null; | |
| 691 | + }, [controlName, isVisible]); | |
| 692 | + } | |
| 693 | + var InteractionDetails = ({ interaction, onChange, onPlayInteraction }) => { | |
| 694 | + const trigger = extractString(interaction.trigger, DEFAULT_VALUES.trigger); | |
| 695 | + const effect = extractString(interaction.animation.value.effect, DEFAULT_VALUES.effect); | |
| 696 | + const customEffects = interaction.animation.value.custom_effect; | |
| 697 | + const type = extractString(interaction.animation.value.type, DEFAULT_VALUES.type); | |
| 698 | + const direction = extractString(interaction.animation.value.direction, DEFAULT_VALUES.direction); | |
| 699 | + const duration = extractSize(interaction.animation.value.timing_config.value.duration); | |
| 700 | + const delay = extractSize(interaction.animation.value.timing_config.value.delay); | |
| 701 | + const replay = extractBoolean(interaction.animation.value.config?.value.replay, DEFAULT_VALUES.replay); | |
| 702 | + const easing = extractString(interaction.animation.value.config?.value.easing, DEFAULT_VALUES.easing); | |
| 703 | + const relativeTo = extractString(interaction.animation.value.config?.value.relativeTo, DEFAULT_VALUES.relativeTo); | |
| 704 | + const configValue = interaction.animation.value.config?.value; | |
| 705 | + const repeat = extractString(configValue?.repeat, DEFAULT_VALUES.repeat); | |
| 706 | + const times = normalizeTimesValue(configValue?.times?.value, DEFAULT_VALUES.times); | |
| 707 | + const start = extractSize(interaction.animation.value.config?.value.start, DEFAULT_VALUES.start); | |
| 708 | + const end = extractSize(interaction.animation.value.config?.value.end, DEFAULT_VALUES.end); | |
| 709 | + const interactionValues = { | |
| 710 | + trigger, | |
| 711 | + effect, | |
| 712 | + type, | |
| 713 | + direction, | |
| 714 | + duration, | |
| 715 | + delay, | |
| 716 | + easing, | |
| 717 | + replay, | |
| 718 | + relativeTo, | |
| 719 | + repeat, | |
| 720 | + times, | |
| 721 | + start, | |
| 722 | + end, | |
| 723 | + customEffects | |
| 724 | + }; | |
| 725 | + const TriggerControl = useControlComponent("trigger", true); | |
| 726 | + const EffectControl = useControlComponent("effect"); | |
| 727 | + const ReplayControl = useControlComponent("replay", controlVisibilityConfig.replay(interactionValues)); | |
| 728 | + const RelativeToControl = useControlComponent("relativeTo", controlVisibilityConfig.relativeTo(interactionValues)); | |
| 729 | + const StartControl = useControlComponent("start", controlVisibilityConfig.start(interactionValues)); | |
| 730 | + const EndControl = useControlComponent("end", controlVisibilityConfig.end(interactionValues)); | |
| 731 | + const CustomEffectControl = useControlComponent("customEffects", controlVisibilityConfig.custom(interactionValues)); | |
| 732 | + const EffectTypeControl = useControlComponent("effectType", controlVisibilityConfig.effectType(interactionValues)); | |
| 733 | + const DirectionControl = useControlComponent("direction", controlVisibilityConfig.direction(interactionValues)); | |
| 734 | + const RepeatControl = useControlComponent("repeat", controlVisibilityConfig.repeat(interactionValues)); | |
| 735 | + const TimesControl = useControlComponent("times", controlVisibilityConfig.times(interactionValues)); | |
| 736 | + const EasingControl = useControlComponent("easing"); | |
| 737 | + const updateInteraction = (updates) => { | |
| 738 | + const resolvedDirectionValue = resolveDirection("direction" in updates, updates.effect, updates.direction, direction, effect); | |
| 739 | + const updatedInteraction = { | |
| 740 | + ...interaction, | |
| 741 | + interaction_id: interaction.interaction_id, | |
| 742 | + trigger: createString(updates.trigger ?? trigger), | |
| 743 | + animation: createAnimationPreset({ | |
| 744 | + effect: updates.effect ?? effect, | |
| 745 | + type: updates.type ?? type, | |
| 746 | + direction: resolvedDirectionValue, | |
| 747 | + duration: updates.duration ?? duration, | |
| 748 | + delay: updates.delay ?? delay, | |
| 749 | + replay: updates.replay ?? replay, | |
| 750 | + easing: updates.easing ?? easing, | |
| 751 | + relativeTo: updates.relativeTo ?? relativeTo, | |
| 752 | + repeat: updates.repeat ?? repeat, | |
| 753 | + times: updates.times ?? times, | |
| 754 | + start: updates.start ?? start, | |
| 755 | + end: updates.end ?? end, | |
| 756 | + customEffects: updates.customEffects ?? customEffects | |
| 757 | + }) | |
| 758 | + }; | |
| 759 | + onChange(updatedInteraction); | |
| 760 | + syncGridOverlay(updates.trigger ?? trigger, updates.start ?? start, updates.end ?? end, updates.relativeTo ?? relativeTo); | |
| 761 | + const interactionId = extractString(updatedInteraction.interaction_id); | |
| 762 | + setTimeout(() => { | |
| 763 | + onPlayInteraction(interactionId); | |
| 764 | + }, 0); | |
| 765 | + }; | |
| 766 | + return /* @__PURE__ */ react.createElement(_elementor_editor_controls.PopoverContent, { p: 1.5 }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { | |
| 767 | + container: true, | |
| 768 | + spacing: 1.5 | |
| 769 | + }, TriggerControl && /* @__PURE__ */ react.createElement(Field, { label: (0, _wordpress_i18n.__)("Trigger", "elementor") }, /* @__PURE__ */ react.createElement(TriggerControl, { | |
| 770 | + value: trigger, | |
| 771 | + onChange: (v) => updateInteraction({ trigger: v }) | |
| 772 | + })), ReplayControl && /* @__PURE__ */ react.createElement(Field, { label: (0, _wordpress_i18n.__)("Replay", "elementor") }, /* @__PURE__ */ react.createElement(ReplayControl, { | |
| 773 | + value: replay, | |
| 774 | + onChange: (v) => updateInteraction({ replay: v }), | |
| 775 | + disabled: true | |
| 776 | + }))), /* @__PURE__ */ react.createElement(_elementor_ui.Divider, null), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { | |
| 777 | + container: true, | |
| 778 | + spacing: 1.5 | |
| 779 | + }, EffectControl && /* @__PURE__ */ react.createElement(Field, { label: (0, _wordpress_i18n.__)("Effect", "elementor") }, /* @__PURE__ */ react.createElement(EffectControl, { | |
| 780 | + value: effect, | |
| 781 | + onChange: (v) => updateInteraction({ effect: v }) | |
| 782 | + })), CustomEffectControl && /* @__PURE__ */ react.createElement(Field, { label: (0, _wordpress_i18n.__)("Custom Effect", "elementor") }, /* @__PURE__ */ react.createElement(CustomEffectControl, { | |
| 783 | + value: customEffects, | |
| 784 | + onChange: (v) => updateInteraction({ customEffects: v }) | |
| 785 | + })), EffectTypeControl && /* @__PURE__ */ react.createElement(Field, { label: (0, _wordpress_i18n.__)("Type", "elementor") }, /* @__PURE__ */ react.createElement(EffectTypeControl, { | |
| 786 | + value: type, | |
| 787 | + onChange: (v) => updateInteraction({ type: v }) | |
| 788 | + })), DirectionControl && /* @__PURE__ */ react.createElement(Field, { label: (0, _wordpress_i18n.__)("Direction", "elementor") }, /* @__PURE__ */ react.createElement(DirectionControl, { | |
| 789 | + value: direction, | |
| 790 | + onChange: (v) => updateInteraction({ direction: v }), | |
| 791 | + interactionType: type | |
| 792 | + })), RepeatControl && /* @__PURE__ */ react.createElement(Field, { label: (0, _wordpress_i18n.__)("Repeat", "elementor") }, /* @__PURE__ */ react.createElement(RepeatControl, { | |
| 793 | + value: repeat, | |
| 794 | + onChange: (v) => updateInteraction({ repeat: v }) | |
| 795 | + })), TimesControl && /* @__PURE__ */ react.createElement(Field, { label: (0, _wordpress_i18n.__)("Times", "elementor") }, /* @__PURE__ */ react.createElement(TimesControl, { | |
| 796 | + value: times, | |
| 797 | + onChange: (v) => updateInteraction({ times: normalizeTimesValue(v, DEFAULT_VALUES.times) }) | |
| 798 | + })), controlVisibilityConfig.duration(interactionValues) && /* @__PURE__ */ react.createElement(Field, { label: (0, _wordpress_i18n.__)("Duration", "elementor") }, /* @__PURE__ */ react.createElement(TimeFrameIndicator, { | |
| 799 | + value: String(duration), | |
| 800 | + onChange: (v) => updateInteraction({ duration: v }), | |
| 801 | + defaultValue: DEFAULT_VALUES.duration | |
| 802 | + })), controlVisibilityConfig.delay(interactionValues) && /* @__PURE__ */ react.createElement(Field, { label: (0, _wordpress_i18n.__)("Delay", "elementor") }, /* @__PURE__ */ react.createElement(TimeFrameIndicator, { | |
| 803 | + value: String(delay), | |
| 804 | + onChange: (v) => updateInteraction({ delay: v }), | |
| 805 | + defaultValue: DEFAULT_VALUES.delay | |
| 806 | + }))), controlVisibilityConfig.relativeTo(interactionValues) && RelativeToControl && /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(_elementor_ui.Divider, null), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { | |
| 807 | + container: true, | |
| 808 | + spacing: 1.5 | |
| 809 | + }, StartControl && /* @__PURE__ */ react.createElement(Field, { label: (0, _wordpress_i18n.__)("Start", "elementor") }, /* @__PURE__ */ react.createElement(StartControl, { | |
| 810 | + value: parseSizeValue(start, ["%"]).size?.toString() ?? "", | |
| 811 | + onChange: (v) => updateInteraction({ start: v }) | |
| 812 | + })), EndControl && /* @__PURE__ */ react.createElement(Field, { label: (0, _wordpress_i18n.__)("End", "elementor") }, /* @__PURE__ */ react.createElement(EndControl, { | |
| 813 | + value: parseSizeValue(end, ["%"]).size?.toString() ?? "", | |
| 814 | + onChange: (v) => updateInteraction({ end: v }) | |
| 815 | + })), /* @__PURE__ */ react.createElement(Field, { label: (0, _wordpress_i18n.__)("Relative To", "elementor") }, /* @__PURE__ */ react.createElement(RelativeToControl, { | |
| 816 | + value: relativeTo, | |
| 817 | + onChange: (v) => updateInteraction({ relativeTo: v }) | |
| 818 | + }))), /* @__PURE__ */ react.createElement(_elementor_ui.Divider, null)), EasingControl && /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { | |
| 819 | + container: true, | |
| 820 | + spacing: 1.5 | |
| 821 | + }, /* @__PURE__ */ react.createElement(Field, { label: (0, _wordpress_i18n.__)("Easing", "elementor") }, /* @__PURE__ */ react.createElement(EasingControl, { | |
| 822 | + value: easing, | |
| 823 | + onChange: (v) => { | |
| 824 | + updateInteraction({ easing: v }); | |
| 825 | + } | |
| 826 | + })))); | |
| 827 | + }; | |
| 262 | 828 | |
| 263 | -/***/ "./packages/packages/core/editor-interactions/src/components/controls/easing.tsx": | |
| 264 | -/*!***************************************************************************************!*\ | |
| 265 | - !*** ./packages/packages/core/editor-interactions/src/components/controls/easing.tsx ***! | |
| 266 | - \***************************************************************************************/ | |
| 267 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 829 | +//#endregion | |
| 830 | +//#region packages/packages/core/editor-interactions/src/components/interaction-settings.tsx | |
| 831 | + var SIZE = "tiny"; | |
| 832 | + var InteractionSettings = ({ interaction, onChange }) => { | |
| 833 | + const breakpoints = (0, _elementor_editor_responsive.useBreakpoints)(); | |
| 834 | + const availableBreakpoints = (0, react.useMemo)(() => breakpoints.map((breakpoint) => ({ | |
| 835 | + label: breakpoint.label, | |
| 836 | + value: String(breakpoint.id) | |
| 837 | + })), [breakpoints]); | |
| 838 | + const [selectedBreakpoints, setSelectedBreakpoints] = (0, react.useState)(() => { | |
| 839 | + const excluded = extractExcludedBreakpoints(interaction.breakpoints).filter((excludedBreakpoint) => { | |
| 840 | + return availableBreakpoints.some(({ value }) => value === excludedBreakpoint); | |
| 841 | + }); | |
| 842 | + return availableBreakpoints.filter(({ value }) => { | |
| 843 | + return !excluded.includes(value); | |
| 844 | + }); | |
| 845 | + }); | |
| 846 | + const handleBreakpointChange = (0, react.useCallback)((_, newValue) => { | |
| 847 | + setSelectedBreakpoints(newValue); | |
| 848 | + const selectedValues = newValue.map((option) => option.value); | |
| 849 | + const newExcluded = availableBreakpoints.filter((breakpoint) => !selectedValues.includes(breakpoint.value)).map((breakpoint) => breakpoint.value); | |
| 850 | + const updatedInteraction = { | |
| 851 | + ...interaction, | |
| 852 | + ...newExcluded.length > 0 && { breakpoints: createInteractionBreakpoints(newExcluded) } | |
| 853 | + }; | |
| 854 | + if (newExcluded.length === 0) delete updatedInteraction.breakpoints; | |
| 855 | + onChange(updatedInteraction); | |
| 856 | + }, [ | |
| 857 | + interaction, | |
| 858 | + availableBreakpoints, | |
| 859 | + onChange | |
| 860 | + ]); | |
| 861 | + return /* @__PURE__ */ react.createElement(_elementor_editor_controls.PopoverContent, { p: 1.5 }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { | |
| 862 | + container: true, | |
| 863 | + spacing: 1.5 | |
| 864 | + }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { | |
| 865 | + item: true, | |
| 866 | + xs: 12 | |
| 867 | + }, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, { | |
| 868 | + direction: "column", | |
| 869 | + gap: 1 | |
| 870 | + }, /* @__PURE__ */ react.createElement(_elementor_editor_controls.ControlFormLabel, { sx: { width: "100%" } }, (0, _wordpress_i18n.__)("Trigger on", "elementor")), /* @__PURE__ */ react.createElement(_elementor_ui.Autocomplete, { | |
| 871 | + fullWidth: true, | |
| 872 | + multiple: true, | |
| 873 | + value: selectedBreakpoints, | |
| 874 | + onChange: handleBreakpointChange, | |
| 875 | + size: SIZE, | |
| 876 | + options: availableBreakpoints, | |
| 877 | + isOptionEqualToValue: (option, value) => option.value === value.value, | |
| 878 | + renderInput: (params) => /* @__PURE__ */ react.createElement(_elementor_ui.TextField, { ...params }), | |
| 879 | + renderTags: (values, getTagProps) => values.map((option, index) => { | |
| 880 | + const { key, ...chipProps } = getTagProps({ index }); | |
| 881 | + return /* @__PURE__ */ react.createElement(_elementor_ui.Chip, { | |
| 882 | + key, | |
| 883 | + size: SIZE, | |
| 884 | + label: option.label, | |
| 885 | + ...chipProps | |
| 886 | + }); | |
| 887 | + }) | |
| 888 | + }))))); | |
| 889 | + }; | |
| 268 | 890 | |
| 269 | -__webpack_require__.r(__webpack_exports__); | |
| 270 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 271 | -/* harmony export */ BASE_EASINGS: function() { return /* binding */ BASE_EASINGS; }, | |
| 272 | -/* harmony export */ EASING_OPTIONS: function() { return /* binding */ EASING_OPTIONS; }, | |
| 273 | -/* harmony export */ Easing: function() { return /* binding */ Easing; } | |
| 274 | -/* harmony export */ }); | |
| 275 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 276 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 277 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 278 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); | |
| 279 | -/* harmony import */ var _ui_promotion_select__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../ui/promotion-select */ "./packages/packages/core/editor-interactions/src/ui/promotion-select.tsx"); | |
| 280 | -/* harmony import */ var _interaction_details__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../interaction-details */ "./packages/packages/core/editor-interactions/src/components/interaction-details.tsx"); | |
| 891 | +//#endregion | |
| 892 | +//#region packages/packages/core/editor-interactions/src/components/interactions-list-item.tsx | |
| 893 | + var InteractionsListItem = ({ index, value: interaction }) => { | |
| 894 | + const { getTabsProps, getTabProps, getTabPanelProps } = (0, _elementor_ui.useTabs)("details"); | |
| 895 | + const context = useInteractionItemContext(); | |
| 896 | + const handleChange = (0, react.useCallback)((newInteractionValue) => { | |
| 897 | + context?.onInteractionChange(index, newInteractionValue); | |
| 898 | + }, [context, index]); | |
| 899 | + const handlePlayInteraction = (0, react.useCallback)((interactionId2) => { | |
| 900 | + context?.onPlayInteraction(interactionId2); | |
| 901 | + }, [context]); | |
| 902 | + const interactionId = extractString(interaction.value.interaction_id); | |
| 903 | + return /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(_elementor_ui.Tabs, { | |
| 904 | + size: "small", | |
| 905 | + variant: "fullWidth", | |
| 906 | + "aria-label": (0, _wordpress_i18n.__)("Interaction", "elementor"), | |
| 907 | + ...getTabsProps() | |
| 908 | + }, /* @__PURE__ */ react.createElement(_elementor_ui.Tab, { | |
| 909 | + label: (0, _wordpress_i18n.__)("Details", "elementor"), | |
| 910 | + ...getTabProps("details") | |
| 911 | + }), /* @__PURE__ */ react.createElement(_elementor_ui.Tab, { | |
| 912 | + label: (0, _wordpress_i18n.__)("Settings", "elementor"), | |
| 913 | + ...getTabProps("settings") | |
| 914 | + })), /* @__PURE__ */ react.createElement(_elementor_ui.Divider, null), /* @__PURE__ */ react.createElement(_elementor_ui.TabPanel, { | |
| 915 | + sx: { p: 0 }, | |
| 916 | + ...getTabPanelProps("details") | |
| 917 | + }, /* @__PURE__ */ react.createElement(InteractionDetails, { | |
| 918 | + key: interactionId, | |
| 919 | + interaction: interaction.value, | |
| 920 | + onChange: handleChange, | |
| 921 | + onPlayInteraction: handlePlayInteraction | |
| 922 | + })), /* @__PURE__ */ react.createElement(_elementor_ui.TabPanel, { | |
| 923 | + sx: { p: 0 }, | |
| 924 | + ...getTabPanelProps("settings") | |
| 925 | + }, /* @__PURE__ */ react.createElement(InteractionSettings, { | |
| 926 | + key: interactionId, | |
| 927 | + interaction: interaction.value, | |
| 928 | + onChange: handleChange | |
| 929 | + }))); | |
| 930 | + }; | |
| 281 | 931 | |
| 932 | +//#endregion | |
| 933 | +//#region packages/packages/core/editor-interactions/src/components/interactions-list.tsx | |
| 934 | + var MAX_NUMBER_OF_INTERACTIONS = 5; | |
| 935 | + function InteractionsList(props) { | |
| 936 | + const { interactions, onSelectInteractions, onPlayInteraction, triggerCreateOnShowEmpty } = props; | |
| 937 | + const { elementId } = useInteractionsContext(); | |
| 938 | + const hasInitializedRef = (0, react.useRef)(false); | |
| 939 | + const newlyCreatedIdsRef = (0, react.useRef)(/* @__PURE__ */ new Set()); | |
| 940 | + const handleUpdateInteractions = (0, react.useCallback)((newInteractions) => { | |
| 941 | + onSelectInteractions(newInteractions); | |
| 942 | + }, [onSelectInteractions]); | |
| 943 | + (0, react.useEffect)(() => { | |
| 944 | + if (triggerCreateOnShowEmpty && !hasInitializedRef.current && (!interactions.items || interactions.items?.length === 0)) { | |
| 945 | + hasInitializedRef.current = true; | |
| 946 | + const newItem = createDefaultInteractionItem(); | |
| 947 | + newlyCreatedIdsRef.current.add(extractString(newItem.value.interaction_id)); | |
| 948 | + handleUpdateInteractions({ | |
| 949 | + version: 1, | |
| 950 | + items: [newItem] | |
| 951 | + }); | |
| 952 | + } | |
| 953 | + }, [ | |
| 954 | + triggerCreateOnShowEmpty, | |
| 955 | + interactions.items, | |
| 956 | + handleUpdateInteractions | |
| 957 | + ]); | |
| 958 | + const isMaxNumberOfInteractionsReached = (0, react.useMemo)(() => { | |
| 959 | + return interactions.items?.length >= 5; | |
| 960 | + }, [interactions.items?.length]); | |
| 961 | + const infotipContent = isMaxNumberOfInteractionsReached ? /* @__PURE__ */ react.createElement(_elementor_ui.Alert, { | |
| 962 | + color: "secondary", | |
| 963 | + icon: /* @__PURE__ */ react.createElement(_elementor_icons.InfoCircleFilledIcon, null), | |
| 964 | + size: "small" | |
| 965 | + }, /* @__PURE__ */ react.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("Interactions", "elementor")), /* @__PURE__ */ react.createElement(_elementor_ui.Box, { component: "span" }, (0, _wordpress_i18n.__)("You've reached the limit of 5 interactions for this element. Please remove an interaction before creating a new one.", "elementor"))) : void 0; | |
| 966 | + const handleRepeaterChange = (0, react.useCallback)((newItems, _, meta) => { | |
| 967 | + handleUpdateInteractions({ | |
| 968 | + ...interactions, | |
| 969 | + items: newItems | |
| 970 | + }); | |
| 971 | + if (meta?.action?.type === "add") { | |
| 972 | + const addedItem = meta.action.payload[0]?.item; | |
| 973 | + if (addedItem) newlyCreatedIdsRef.current.add(extractString(addedItem.value.interaction_id)); | |
| 974 | + } | |
| 975 | + }, [interactions, handleUpdateInteractions]); | |
| 976 | + const handleInteractionChange = (0, react.useCallback)((index, newInteractionValue) => { | |
| 977 | + const newItems = structuredClone(interactions.items); | |
| 978 | + newItems[index] = { | |
| 979 | + $$type: "interaction-item", | |
| 980 | + value: newInteractionValue | |
| 981 | + }; | |
| 982 | + handleUpdateInteractions({ | |
| 983 | + ...interactions, | |
| 984 | + items: newItems | |
| 985 | + }); | |
| 986 | + }, [interactions, handleUpdateInteractions]); | |
| 987 | + const contextValue = (0, react.useMemo)(() => ({ | |
| 988 | + onInteractionChange: handleInteractionChange, | |
| 989 | + onPlayInteraction | |
| 990 | + }), [handleInteractionChange, onPlayInteraction]); | |
| 991 | + return /* @__PURE__ */ react.createElement(InteractionItemContextProvider, { value: contextValue }, /* @__PURE__ */ react.createElement(_elementor_editor_controls.Repeater, { | |
| 992 | + openOnAdd: true, | |
| 993 | + openItem: triggerCreateOnShowEmpty ? 0 : void 0, | |
| 994 | + label: (0, _wordpress_i18n.__)("Interactions", "elementor"), | |
| 995 | + values: interactions.items, | |
| 996 | + setValues: handleRepeaterChange, | |
| 997 | + showDuplicate: false, | |
| 998 | + showToggle: false, | |
| 999 | + isSortable: false, | |
| 1000 | + disableAddItemButton: isMaxNumberOfInteractionsReached, | |
| 1001 | + addButtonInfotipContent: infotipContent, | |
| 1002 | + itemSettings: { | |
| 1003 | + initialValues: createDefaultInteractionItem(), | |
| 1004 | + Label: ({ value }) => buildDisplayLabel(value.value), | |
| 1005 | + Icon: () => null, | |
| 1006 | + Content: InteractionsListItem, | |
| 1007 | + onPopoverOpen: (value) => { | |
| 1008 | + const { trigger, start, end, relativeTo } = extractScrollOverlayParams(value.value, DEFAULT_VALUES); | |
| 1009 | + syncGridOverlay(trigger, start, end, relativeTo); | |
| 1010 | + }, | |
| 1011 | + onPopoverClose: (value) => { | |
| 1012 | + dispatchScrollInteraction(null); | |
| 1013 | + const id = extractString(value.value.interaction_id); | |
| 1014 | + if (newlyCreatedIdsRef.current.has(id)) { | |
| 1015 | + newlyCreatedIdsRef.current.delete(id); | |
| 1016 | + trackInteractionCreated(elementId, value); | |
| 1017 | + } | |
| 1018 | + }, | |
| 1019 | + actions: (value) => /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, { | |
| 1020 | + key: "preview", | |
| 1021 | + placement: "top", | |
| 1022 | + title: (0, _wordpress_i18n.__)("Preview", "elementor") | |
| 1023 | + }, /* @__PURE__ */ react.createElement(_elementor_ui.IconButton, { | |
| 1024 | + "aria-label": (0, _wordpress_i18n.__)("Play interaction", "elementor"), | |
| 1025 | + size: "tiny", | |
| 1026 | + onClick: () => onPlayInteraction(extractString(value.value.interaction_id)) | |
| 1027 | + }, /* @__PURE__ */ react.createElement(_elementor_icons.PlayerPlayIcon, { fontSize: "tiny" }))) | |
| 1028 | + } | |
| 1029 | + })); | |
| 1030 | + } | |
| 282 | 1031 | |
| 1032 | +//#endregion | |
| 1033 | +//#region packages/packages/core/editor-interactions/src/components/interactions-tab.tsx | |
| 1034 | + var InteractionsTab = ({ elementId }) => { | |
| 1035 | + return /* @__PURE__ */ react.createElement(PopupStateProvider, null, /* @__PURE__ */ react.createElement(InteractionsTabContent, { elementId })); | |
| 1036 | + }; | |
| 1037 | + function InteractionsTabContent({ elementId }) { | |
| 1038 | + const existingInteractions = useElementInteractions(elementId); | |
| 1039 | + const firstInteractionState = (0, react.useState)(false); | |
| 1040 | + const hasInteractions = existingInteractions?.items?.length || firstInteractionState[0]; | |
| 1041 | + return /* @__PURE__ */ react.createElement(_elementor_session.SessionStorageProvider, { prefix: elementId }, hasInteractions ? /* @__PURE__ */ react.createElement(InteractionsProvider, { elementId }, /* @__PURE__ */ react.createElement(InteractionsContent, { firstInteractionState })) : /* @__PURE__ */ react.createElement(EmptyState, { onCreateInteraction: () => { | |
| 1042 | + firstInteractionState[1](true); | |
| 1043 | + } })); | |
| 1044 | + } | |
| 1045 | + function InteractionsContent({ firstInteractionState }) { | |
| 1046 | + const { interactions, setInteractions, playInteractions } = useInteractionsContext(); | |
| 1047 | + const applyInteraction = (0, react.useCallback)((newInteractions) => { | |
| 1048 | + firstInteractionState[1](false); | |
| 1049 | + if (!newInteractions) { | |
| 1050 | + setInteractions(void 0); | |
| 1051 | + return; | |
| 1052 | + } | |
| 1053 | + setInteractions(newInteractions); | |
| 1054 | + }, [setInteractions, firstInteractionState]); | |
| 1055 | + return /* @__PURE__ */ react.createElement(_elementor_ui.Stack, { | |
| 1056 | + sx: { | |
| 1057 | + m: 1, | |
| 1058 | + p: 1.5 | |
| 1059 | + }, | |
| 1060 | + gap: 2 | |
| 1061 | + }, /* @__PURE__ */ react.createElement(InteractionsList, { | |
| 1062 | + triggerCreateOnShowEmpty: firstInteractionState[0], | |
| 1063 | + interactions, | |
| 1064 | + onSelectInteractions: applyInteraction, | |
| 1065 | + onPlayInteraction: playInteractions | |
| 1066 | + })); | |
| 1067 | + } | |
| 283 | 1068 | |
| 1069 | +//#endregion | |
| 1070 | +//#region packages/packages/core/editor-interactions/src/utils/create-interactions-repository.ts | |
| 1071 | + var createInteractionsRepository = () => { | |
| 1072 | + const providers = []; | |
| 1073 | + const getProviders = () => { | |
| 1074 | + return providers.slice(0).sort((a, b) => a.priority > b.priority ? -1 : 1); | |
| 1075 | + }; | |
| 1076 | + const register = (provider) => { | |
| 1077 | + providers.push(provider); | |
| 1078 | + }; | |
| 1079 | + const all = () => { | |
| 1080 | + return getProviders().flatMap((provider) => provider.actions.all()); | |
| 1081 | + }; | |
| 1082 | + const subscribe = (cb) => { | |
| 1083 | + const unsubscribes = providers.map((provider) => provider.subscribe(cb)); | |
| 1084 | + return () => { | |
| 1085 | + unsubscribes.forEach((unsubscribe) => unsubscribe()); | |
| 1086 | + }; | |
| 1087 | + }; | |
| 1088 | + const getProviderByKey = (key) => { | |
| 1089 | + return providers.find((provider) => { | |
| 1090 | + try { | |
| 1091 | + return provider.getKey() === key; | |
| 1092 | + } catch { | |
| 1093 | + return false; | |
| 1094 | + } | |
| 1095 | + }); | |
| 1096 | + }; | |
| 1097 | + return { | |
| 1098 | + all, | |
| 1099 | + register, | |
| 1100 | + subscribe, | |
| 1101 | + getProviders, | |
| 1102 | + getProviderByKey | |
| 1103 | + }; | |
| 1104 | + }; | |
| 284 | 1105 | |
| 285 | -const TRACKING_DATA = { | |
| 286 | - target_name: 'interactions_easing', | |
| 287 | - location_l2: 'interactions' | |
| 288 | -}; | |
| 289 | -const EASING_OPTIONS = { | |
| 290 | - easeIn: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Ease In', 'elementor'), | |
| 291 | - easeInOut: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Ease In Out', 'elementor'), | |
| 292 | - easeOut: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Ease Out', 'elementor'), | |
| 293 | - backIn: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Back In', 'elementor'), | |
| 294 | - backInOut: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Back In Out', 'elementor'), | |
| 295 | - backOut: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Back Out', 'elementor'), | |
| 296 | - linear: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Linear', 'elementor') | |
| 297 | -}; | |
| 298 | -const BASE_EASINGS = ['easeIn']; | |
| 299 | -function Easing({}) { | |
| 300 | - const baseOptions = Object.fromEntries(Object.entries(EASING_OPTIONS).filter(([key]) => BASE_EASINGS.includes(key))); | |
| 301 | - const disabledOptions = Object.fromEntries(Object.entries(EASING_OPTIONS).filter(([key]) => !BASE_EASINGS.includes(key))); | |
| 302 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_ui_promotion_select__WEBPACK_IMPORTED_MODULE_2__.PromotionSelect, { | |
| 303 | - value: _interaction_details__WEBPACK_IMPORTED_MODULE_3__.DEFAULT_VALUES.easing, | |
| 304 | - baseOptions: baseOptions, | |
| 305 | - disabledOptions: disabledOptions, | |
| 306 | - promotionContent: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Upgrade to control the smoothness of the interaction.', 'elementor'), | |
| 307 | - upgradeUrl: "https://go.elementor.com/go-pro-interactions-easing-modal/", | |
| 308 | - trackingData: TRACKING_DATA | |
| 309 | - }); | |
| 310 | -} | |
| 1106 | +//#endregion | |
| 1107 | +//#region packages/packages/core/editor-interactions/src/interactions-repository.ts | |
| 1108 | + var interactionsRepository = createInteractionsRepository(); | |
| 311 | 1109 | |
| 312 | -/***/ }), | |
| 1110 | +//#endregion | |
| 1111 | +//#region packages/packages/core/editor-interactions/src/utils/create-interactions-provider.ts | |
| 1112 | + var DEFAULT_PRIORITY = 10; | |
| 1113 | + function createInteractionsProvider({ key, priority = DEFAULT_PRIORITY, subscribe = () => () => {}, actions }) { | |
| 1114 | + return { | |
| 1115 | + getKey: typeof key === "string" ? () => key : key, | |
| 1116 | + priority, | |
| 1117 | + subscribe, | |
| 1118 | + actions: { all: actions.all } | |
| 1119 | + }; | |
| 1120 | + } | |
| 313 | 1121 | |
| 314 | -/***/ "./packages/packages/core/editor-interactions/src/components/controls/effect-type.tsx": | |
| 315 | -/*!********************************************************************************************!*\ | |
| 316 | - !*** ./packages/packages/core/editor-interactions/src/components/controls/effect-type.tsx ***! | |
| 317 | - \********************************************************************************************/ | |
| 318 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1122 | +//#endregion | |
| 1123 | +//#region packages/packages/core/editor-interactions/src/providers/document-elements-interactions-provider.ts | |
| 1124 | + var ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX = "document-elements-interactions-"; | |
| 1125 | + var documentElementsInteractionsProvider = createInteractionsProvider({ | |
| 1126 | + key: () => { | |
| 1127 | + const documentId = (0, _elementor_editor_elements.getCurrentDocumentId)(); | |
| 1128 | + if (!documentId) return `${ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX}pending`; | |
| 1129 | + return `${ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX}${documentId}`; | |
| 1130 | + }, | |
| 1131 | + priority: 50, | |
| 1132 | + subscribe: (cb) => { | |
| 1133 | + return (0, _elementor_editor_v1_adapters.__privateListenTo)([(0, _elementor_editor_v1_adapters.windowEvent)("elementor/element/update_interactions")], () => cb()); | |
| 1134 | + }, | |
| 1135 | + actions: { all: () => { | |
| 1136 | + return (0, _elementor_editor_elements.getElements)().filter((element) => { | |
| 1137 | + const interactions = (0, _elementor_editor_elements.getElementInteractions)(element.id); | |
| 1138 | + if (!interactions) return false; | |
| 1139 | + return interactions?.items?.length > 0; | |
| 1140 | + }).map((element) => { | |
| 1141 | + const interactions = (0, _elementor_editor_elements.getElementInteractions)(element.id); | |
| 1142 | + return { | |
| 1143 | + elementId: element.id, | |
| 1144 | + dataId: element.id, | |
| 1145 | + interactions: interactions || { | |
| 1146 | + version: 1, | |
| 1147 | + items: [] | |
| 1148 | + } | |
| 1149 | + }; | |
| 1150 | + }); | |
| 1151 | + } } | |
| 1152 | + }); | |
| 319 | 1153 | |
| 320 | -__webpack_require__.r(__webpack_exports__); | |
| 321 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 322 | -/* harmony export */ EffectType: function() { return /* binding */ EffectType; } | |
| 323 | -/* harmony export */ }); | |
| 324 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 325 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 326 | -/* harmony import */ var _elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-controls */ "@elementor/editor-controls"); | |
| 327 | -/* harmony import */ var _elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__); | |
| 328 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 329 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__); | |
| 1154 | +//#endregion | |
| 1155 | +//#region packages/packages/core/editor-interactions/src/commands/get-clipboard-elements.ts | |
| 1156 | + function getClipboardElements(storageKey = "clipboard") { | |
| 1157 | + try { | |
| 1158 | + return JSON.parse(localStorage.getItem("elementor") ?? "{}")[storageKey]?.elements; | |
| 1159 | + } catch { | |
| 1160 | + return; | |
| 1161 | + } | |
| 1162 | + } | |
| 330 | 1163 | |
| 1164 | +//#endregion | |
| 1165 | +//#region packages/packages/core/editor-interactions/src/commands/paste-interactions.ts | |
| 1166 | + function isAtomicContainer(container) { | |
| 1167 | + const type = container?.model.get("widgetType") || container?.model.get("elType"); | |
| 1168 | + const elementConfig = (0, _elementor_editor_elements.getWidgetsCache)()?.[type]; | |
| 1169 | + return Boolean(elementConfig?.atomic_props_schema); | |
| 1170 | + } | |
| 1171 | + function getTitleForContainers(containers) { | |
| 1172 | + return containers.length > 1 ? (0, _wordpress_i18n.__)("Elements", "elementor") : (0, _elementor_editor_elements.getElementLabel)(containers[0].id); | |
| 1173 | + } | |
| 1174 | + function normalizeClipboardInteractions(raw) { | |
| 1175 | + if (!raw) return null; | |
| 1176 | + const parsed = typeof raw === "string" ? JSON.parse(raw) : raw; | |
| 1177 | + const payload = { | |
| 1178 | + version: parsed?.version ?? 1, | |
| 1179 | + items: parsed?.items?.filter((item) => isSupportedInteractionItem(item)) ?? [] | |
| 1180 | + }; | |
| 1181 | + if (!payload.items.length) return null; | |
| 1182 | + return payload; | |
| 1183 | + } | |
| 1184 | + function regenerateInteractionIds(interactions) { | |
| 1185 | + const cloned = structuredClone(interactions); | |
| 1186 | + cloned.items?.forEach((item) => { | |
| 1187 | + if (item.$$type === "interaction-item" && item.value) item.value.interaction_id = createString(generateTempInteractionId()); | |
| 1188 | + }); | |
| 1189 | + return cloned; | |
| 1190 | + } | |
| 1191 | + function initPasteInteractionsCommand() { | |
| 1192 | + const undoablePasteInteractions = (0, _elementor_editor_v1_adapters.undoable)({ | |
| 1193 | + do: ({ containers, newInteractions }) => { | |
| 1194 | + const pasted = regenerateInteractionIds(newInteractions); | |
| 1195 | + return containers.map((container) => { | |
| 1196 | + const elementId = container.id; | |
| 1197 | + const previous = (0, _elementor_editor_elements.getElementInteractions)(elementId); | |
| 1198 | + (0, _elementor_editor_elements.updateElementInteractions)({ | |
| 1199 | + elementId, | |
| 1200 | + interactions: pasted | |
| 1201 | + }); | |
| 1202 | + return { | |
| 1203 | + elementId, | |
| 1204 | + previous: previous ?? { | |
| 1205 | + version: 1, | |
| 1206 | + items: [] | |
| 1207 | + } | |
| 1208 | + }; | |
| 1209 | + }); | |
| 1210 | + }, | |
| 1211 | + undo: (_, revertData) => { | |
| 1212 | + revertData.forEach(({ elementId, previous }) => { | |
| 1213 | + (0, _elementor_editor_elements.updateElementInteractions)({ | |
| 1214 | + elementId, | |
| 1215 | + interactions: previous.items?.length ? previous : void 0 | |
| 1216 | + }); | |
| 1217 | + }); | |
| 1218 | + } | |
| 1219 | + }, { | |
| 1220 | + title: ({ containers }) => getTitleForContainers(containers), | |
| 1221 | + subtitle: (0, _wordpress_i18n.__)("Interactions Pasted", "elementor") | |
| 1222 | + }); | |
| 1223 | + (0, _elementor_editor_v1_adapters.__privateListenTo)((0, _elementor_editor_v1_adapters.commandStartEvent)("document/elements/paste-interactions"), (e) => { | |
| 1224 | + const args = e.args; | |
| 1225 | + const containers = args.containers ?? (args.container ? [args.container] : []); | |
| 1226 | + const storageKey = args.storageKey ?? "clipboard"; | |
| 1227 | + if (!containers.length) return; | |
| 1228 | + const [clipboardElement] = getClipboardElements(storageKey) ?? []; | |
| 1229 | + if (!clipboardElement) return; | |
| 1230 | + const newInteractions = normalizeClipboardInteractions(clipboardElement.interactions); | |
| 1231 | + if (!newInteractions) return; | |
| 1232 | + const validContainers = containers.filter((c) => (0, _elementor_editor_elements.getContainer)(c.id)).filter(isAtomicContainer); | |
| 1233 | + if (!validContainers.length) return; | |
| 1234 | + undoablePasteInteractions({ | |
| 1235 | + containers: validContainers, | |
| 1236 | + newInteractions | |
| 1237 | + }); | |
| 1238 | + }); | |
| 1239 | + } | |
| 331 | 1240 | |
| 1241 | +//#endregion | |
| 1242 | +//#region packages/packages/core/editor-interactions/src/components/controls/direction.tsx | |
| 1243 | + var AXIS = { | |
| 1244 | + top: "vertical", | |
| 1245 | + bottom: "vertical", | |
| 1246 | + left: "horizontal", | |
| 1247 | + right: "horizontal" | |
| 1248 | + }; | |
| 1249 | + function parseValue(value) { | |
| 1250 | + return value.split("-").filter(Boolean); | |
| 1251 | + } | |
| 1252 | + function serializeValue(directions) { | |
| 1253 | + const vertical = directions.find((d) => d === "top" || d === "bottom"); | |
| 1254 | + const horizontal = directions.find((d) => d === "left" || d === "right"); | |
| 1255 | + if (vertical && horizontal) return `${vertical}-${horizontal}`; | |
| 1256 | + return directions[0] ?? ""; | |
| 1257 | + } | |
| 1258 | + function toggleDirection(current, clicked) { | |
| 1259 | + if (current.includes(clicked)) return current.filter((d) => d !== clicked); | |
| 1260 | + return [...current.filter((d) => AXIS[d] !== AXIS[clicked]), clicked]; | |
| 1261 | + } | |
| 1262 | + function Direction({ value, onChange, interactionType }) { | |
| 1263 | + const isIn = interactionType === "in"; | |
| 1264 | + const options = (0, react.useMemo)(() => [ | |
| 1265 | + { | |
| 1266 | + dir: "top", | |
| 1267 | + label: isIn ? (0, _wordpress_i18n.__)("From top", "elementor") : (0, _wordpress_i18n.__)("To top", "elementor"), | |
| 1268 | + Icon: isIn ? _elementor_icons.ArrowDownSmallIcon : _elementor_icons.ArrowUpSmallIcon | |
| 1269 | + }, | |
| 1270 | + { | |
| 1271 | + dir: "bottom", | |
| 1272 | + label: isIn ? (0, _wordpress_i18n.__)("From bottom", "elementor") : (0, _wordpress_i18n.__)("To bottom", "elementor"), | |
| 1273 | + Icon: isIn ? _elementor_icons.ArrowUpSmallIcon : _elementor_icons.ArrowDownSmallIcon | |
| 1274 | + }, | |
| 1275 | + { | |
| 1276 | + dir: "left", | |
| 1277 | + label: isIn ? (0, _wordpress_i18n.__)("From left", "elementor") : (0, _wordpress_i18n.__)("To left", "elementor"), | |
| 1278 | + Icon: isIn ? _elementor_icons.ArrowRightIcon : _elementor_icons.ArrowLeftIcon | |
| 1279 | + }, | |
| 1280 | + { | |
| 1281 | + dir: "right", | |
| 1282 | + label: isIn ? (0, _wordpress_i18n.__)("From right", "elementor") : (0, _wordpress_i18n.__)("To right", "elementor"), | |
| 1283 | + Icon: isIn ? _elementor_icons.ArrowLeftIcon : _elementor_icons.ArrowRightIcon | |
| 1284 | + } | |
| 1285 | + ], [isIn]); | |
| 1286 | + const selectedDirections = (0, react.useMemo)(() => parseValue(value), [value]); | |
| 1287 | + return /* @__PURE__ */ react.createElement(_elementor_editor_controls.StyledToggleButtonGroup, { | |
| 1288 | + size: "tiny", | |
| 1289 | + justify: "end", | |
| 1290 | + sx: { | |
| 1291 | + display: "grid", | |
| 1292 | + gridTemplateColumns: "repeat(4, minmax(0, 25%))", | |
| 1293 | + width: "100%" | |
| 1294 | + } | |
| 1295 | + }, options.map(({ dir, label, Icon }) => /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, { | |
| 1296 | + key: dir, | |
| 1297 | + title: label, | |
| 1298 | + disableFocusListener: true, | |
| 1299 | + placement: "top" | |
| 1300 | + }, /* @__PURE__ */ react.createElement(_elementor_editor_controls.StyledToggleButton, { | |
| 1301 | + value: dir, | |
| 1302 | + selected: selectedDirections.includes(dir), | |
| 1303 | + "aria-label": label, | |
| 1304 | + size: "tiny", | |
| 1305 | + isPlaceholder: false, | |
| 1306 | + onChange: () => { | |
| 1307 | + onChange(serializeValue(toggleDirection(selectedDirections, dir))); | |
| 1308 | + } | |
| 1309 | + }, /* @__PURE__ */ react.createElement(Icon, { fontSize: "tiny" }))))); | |
| 1310 | + } | |
| 332 | 1311 | |
| 333 | -function EffectType({ | |
| 334 | - value, | |
| 335 | - onChange | |
| 336 | -}) { | |
| 337 | - const options = [{ | |
| 338 | - value: 'in', | |
| 339 | - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('In', 'elementor'), | |
| 340 | - renderContent: () => (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('In', 'elementor'), | |
| 341 | - showTooltip: true | |
| 342 | - }, { | |
| 343 | - value: 'out', | |
| 344 | - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Out', 'elementor'), | |
| 345 | - renderContent: () => (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Out', 'elementor'), | |
| 346 | - showTooltip: true | |
| 347 | - }]; | |
| 348 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__.ToggleButtonGroupUi, { | |
| 349 | - items: options, | |
| 350 | - exclusive: true, | |
| 351 | - onChange: onChange, | |
| 352 | - value: value | |
| 353 | - }); | |
| 354 | -} | |
| 1312 | +//#endregion | |
| 1313 | +//#region packages/packages/core/editor-interactions/src/ui/interactions-promotion-chip.tsx | |
| 1314 | + var InteractionsPromotionChip = (0, react.forwardRef)(({ content, upgradeUrl, anchorRef, trackingData }, ref) => { | |
| 1315 | + const [isOpen, setIsOpen] = (0, react.useState)(false); | |
| 1316 | + (0, _elementor_editor_ui.useCanvasClickHandler)(isOpen, () => setIsOpen(false)); | |
| 1317 | + const toggle = (0, react.useCallback)(() => { | |
| 1318 | + setIsOpen((prev) => { | |
| 1319 | + if (!prev) (0, _elementor_editor_controls.trackViewPromotion)(trackingData); | |
| 1320 | + return !prev; | |
| 1321 | + }); | |
| 1322 | + }, [trackingData]); | |
| 1323 | + (0, react.useImperativeHandle)(ref, () => ({ toggle }), [toggle]); | |
| 1324 | + const handleToggle = (e) => { | |
| 1325 | + e.stopPropagation(); | |
| 1326 | + toggle(); | |
| 1327 | + }; | |
| 1328 | + return /* @__PURE__ */ react.createElement(_elementor_editor_ui.PromotionPopover, { | |
| 1329 | + open: isOpen, | |
| 1330 | + title: (0, _wordpress_i18n.__)("Interactions", "elementor"), | |
| 1331 | + content, | |
| 1332 | + ctaText: (0, _wordpress_i18n.__)("Upgrade now", "elementor"), | |
| 1333 | + ctaUrl: upgradeUrl, | |
| 1334 | + anchorRef, | |
| 1335 | + placement: anchorRef ? "right-start" : void 0, | |
| 1336 | + onClose: (e) => { | |
| 1337 | + e.stopPropagation(); | |
| 1338 | + setIsOpen(false); | |
| 1339 | + }, | |
| 1340 | + onCtaClick: () => (0, _elementor_editor_controls.trackUpgradePromotionClick)(trackingData) | |
| 1341 | + }, /* @__PURE__ */ react.createElement(_elementor_ui.Box, { | |
| 1342 | + onMouseDown: (e) => e.stopPropagation(), | |
| 1343 | + onClick: handleToggle, | |
| 1344 | + sx: { | |
| 1345 | + cursor: "pointer", | |
| 1346 | + display: "inline-flex", | |
| 1347 | + mr: 1 | |
| 1348 | + } | |
| 1349 | + }, /* @__PURE__ */ react.createElement(_elementor_editor_ui.PromotionChip, null))); | |
| 1350 | + }); | |
| 355 | 1351 | |
| 356 | -/***/ }), | |
| 1352 | +//#endregion | |
| 1353 | +//#region packages/packages/core/editor-interactions/src/ui/promotion-select.tsx | |
| 1354 | + function PromotionSelect({ value, onChange, baseOptions, disabledOptions, promotionLabel, promotionContent, upgradeUrl, trackingData }) { | |
| 1355 | + const promotionRef = (0, react.useRef)(null); | |
| 1356 | + const anchorRef = (0, react.useRef)(null); | |
| 1357 | + return /* @__PURE__ */ react.createElement(_elementor_ui.Select, { | |
| 1358 | + value, | |
| 1359 | + onChange: (e) => onChange?.(e.target.value), | |
| 1360 | + fullWidth: true, | |
| 1361 | + displayEmpty: true, | |
| 1362 | + size: "tiny", | |
| 1363 | + MenuProps: { disablePortal: true } | |
| 1364 | + }, Object.entries(baseOptions).map(([key, label]) => /* @__PURE__ */ react.createElement(_elementor_editor_ui.MenuListItem, { | |
| 1365 | + key, | |
| 1366 | + value: key | |
| 1367 | + }, label)), /* @__PURE__ */ react.createElement(_elementor_ui.MenuSubheader, { | |
| 1368 | + ref: anchorRef, | |
| 1369 | + sx: { | |
| 1370 | + cursor: "pointer", | |
| 1371 | + color: "text.tertiary", | |
| 1372 | + fontWeight: "400", | |
| 1373 | + display: "flex", | |
| 1374 | + alignItems: "center" | |
| 1375 | + }, | |
| 1376 | + onMouseDown: (e) => { | |
| 1377 | + e.stopPropagation(); | |
| 1378 | + promotionRef.current?.toggle(); | |
| 1379 | + } | |
| 1380 | + }, promotionLabel ?? (0, _wordpress_i18n.__)("PRO features", "elementor"), /* @__PURE__ */ react.createElement(InteractionsPromotionChip, { | |
| 1381 | + content: promotionContent, | |
| 1382 | + upgradeUrl, | |
| 1383 | + ref: promotionRef, | |
| 1384 | + anchorRef, | |
| 1385 | + trackingData | |
| 1386 | + })), Object.entries(disabledOptions).map(([key, label]) => /* @__PURE__ */ react.createElement(_elementor_editor_ui.MenuListItem, { | |
| 1387 | + key, | |
| 1388 | + value: key, | |
| 1389 | + disabled: true, | |
| 1390 | + sx: { pl: 3 } | |
| 1391 | + }, label))); | |
| 1392 | + } | |
| 357 | 1393 | |
| 358 | -/***/ "./packages/packages/core/editor-interactions/src/components/controls/effect.tsx": | |
| 359 | -/*!***************************************************************************************!*\ | |
| 360 | - !*** ./packages/packages/core/editor-interactions/src/components/controls/effect.tsx ***! | |
| 361 | - \***************************************************************************************/ | |
| 362 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1394 | +//#endregion | |
| 1395 | +//#region packages/packages/core/editor-interactions/src/components/controls/easing.tsx | |
| 1396 | + var TRACKING_DATA$4 = { | |
| 1397 | + target_name: "interactions_easing", | |
| 1398 | + location_l2: "interactions" | |
| 1399 | + }; | |
| 1400 | + var EASING_OPTIONS = { | |
| 1401 | + easeIn: (0, _wordpress_i18n.__)("Ease In", "elementor"), | |
| 1402 | + easeInOut: (0, _wordpress_i18n.__)("Ease In Out", "elementor"), | |
| 1403 | + easeOut: (0, _wordpress_i18n.__)("Ease Out", "elementor"), | |
| 1404 | + backIn: (0, _wordpress_i18n.__)("Back In", "elementor"), | |
| 1405 | + backInOut: (0, _wordpress_i18n.__)("Back In Out", "elementor"), | |
| 1406 | + backOut: (0, _wordpress_i18n.__)("Back Out", "elementor"), | |
| 1407 | + linear: (0, _wordpress_i18n.__)("Linear", "elementor") | |
| 1408 | + }; | |
| 1409 | + var BASE_EASINGS = ["easeIn"]; | |
| 1410 | + function Easing({}) { | |
| 1411 | + const baseOptions = Object.fromEntries(Object.entries(EASING_OPTIONS).filter(([key]) => BASE_EASINGS.includes(key))); | |
| 1412 | + const disabledOptions = Object.fromEntries(Object.entries(EASING_OPTIONS).filter(([key]) => !BASE_EASINGS.includes(key))); | |
| 1413 | + return /* @__PURE__ */ react.createElement(PromotionSelect, { | |
| 1414 | + value: DEFAULT_VALUES.easing, | |
| 1415 | + baseOptions, | |
| 1416 | + disabledOptions, | |
| 1417 | + promotionContent: (0, _wordpress_i18n.__)("Upgrade to control the smoothness of the interaction.", "elementor"), | |
| 1418 | + upgradeUrl: "https://go.elementor.com/go-pro-interactions-easing-modal/", | |
| 1419 | + trackingData: TRACKING_DATA$4 | |
| 1420 | + }); | |
| 1421 | + } | |
| 363 | 1422 | |
| 364 | -__webpack_require__.r(__webpack_exports__); | |
| 365 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 366 | -/* harmony export */ BASE_EFFECTS: function() { return /* binding */ BASE_EFFECTS; }, | |
| 367 | -/* harmony export */ EFFECT_OPTIONS: function() { return /* binding */ EFFECT_OPTIONS; }, | |
| 368 | -/* harmony export */ Effect: function() { return /* binding */ Effect; } | |
| 369 | -/* harmony export */ }); | |
| 370 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 371 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 372 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 373 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); | |
| 374 | -/* harmony import */ var _ui_promotion_select__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../ui/promotion-select */ "./packages/packages/core/editor-interactions/src/ui/promotion-select.tsx"); | |
| 375 | -/* harmony import */ var _interaction_details__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../interaction-details */ "./packages/packages/core/editor-interactions/src/components/interaction-details.tsx"); | |
| 1423 | +//#endregion | |
| 1424 | +//#region packages/packages/core/editor-interactions/src/components/controls/effect.tsx | |
| 1425 | + var TRACKING_DATA$3 = { | |
| 1426 | + target_name: "interactions_effect", | |
| 1427 | + location_l2: "interactions" | |
| 1428 | + }; | |
| 1429 | + var EFFECT_OPTIONS = { | |
| 1430 | + fade: (0, _wordpress_i18n.__)("Fade", "elementor"), | |
| 1431 | + slide: (0, _wordpress_i18n.__)("Slide", "elementor"), | |
| 1432 | + scale: (0, _wordpress_i18n.__)("Scale", "elementor"), | |
| 1433 | + custom: (0, _wordpress_i18n.__)("Custom", "elementor") | |
| 1434 | + }; | |
| 1435 | + var BASE_EFFECTS = [ | |
| 1436 | + "fade", | |
| 1437 | + "slide", | |
| 1438 | + "scale" | |
| 1439 | + ]; | |
| 1440 | + function Effect({ value, onChange }) { | |
| 1441 | + const baseOptions = Object.fromEntries(Object.entries(EFFECT_OPTIONS).filter(([key]) => BASE_EFFECTS.includes(key))); | |
| 1442 | + const disabledOptions = Object.fromEntries(Object.entries(EFFECT_OPTIONS).filter(([key]) => !BASE_EFFECTS.includes(key))); | |
| 1443 | + return /* @__PURE__ */ react.createElement(PromotionSelect, { | |
| 1444 | + value: value in baseOptions ? value : DEFAULT_VALUES.effect, | |
| 1445 | + onChange, | |
| 1446 | + baseOptions, | |
| 1447 | + disabledOptions, | |
| 1448 | + promotionLabel: (0, _wordpress_i18n.__)("PRO effects", "elementor"), | |
| 1449 | + promotionContent: (0, _wordpress_i18n.__)("Upgrade to further customize your animation with opacity, scale, move, rotate and more.", "elementor"), | |
| 1450 | + upgradeUrl: "https://go.elementor.com/go-pro-interactions-custom-effect-modal/", | |
| 1451 | + trackingData: TRACKING_DATA$3 | |
| 1452 | + }); | |
| 1453 | + } | |
| 376 | 1454 | |
| 1455 | +//#endregion | |
| 1456 | +//#region packages/packages/core/editor-interactions/src/components/controls/effect-type.tsx | |
| 1457 | + function EffectType({ value, onChange }) { | |
| 1458 | + const options = [{ | |
| 1459 | + value: "in", | |
| 1460 | + label: (0, _wordpress_i18n.__)("In", "elementor"), | |
| 1461 | + renderContent: () => (0, _wordpress_i18n.__)("In", "elementor"), | |
| 1462 | + showTooltip: true | |
| 1463 | + }, { | |
| 1464 | + value: "out", | |
| 1465 | + label: (0, _wordpress_i18n.__)("Out", "elementor"), | |
| 1466 | + renderContent: () => (0, _wordpress_i18n.__)("Out", "elementor"), | |
| 1467 | + showTooltip: true | |
| 1468 | + }]; | |
| 1469 | + return /* @__PURE__ */ react.createElement(_elementor_editor_controls.ToggleButtonGroupUi, { | |
| 1470 | + items: options, | |
| 1471 | + exclusive: true, | |
| 1472 | + onChange, | |
| 1473 | + value | |
| 1474 | + }); | |
| 1475 | + } | |
| 377 | 1476 | |
| 1477 | +//#endregion | |
| 1478 | +//#region packages/packages/core/editor-interactions/src/ui/promotion-overlay-layout.tsx | |
| 1479 | + var OVERLAY_GRID = "1 / 1"; | |
| 1480 | + var CHIP_OFFSET = "50%"; | |
| 1481 | + var PromotionOverlayLayout = (0, react.forwardRef)(({ children, promotionChip }, ref) => /* @__PURE__ */ react.createElement(_elementor_ui.Box, { | |
| 1482 | + ref, | |
| 1483 | + sx: { | |
| 1484 | + display: "grid", | |
| 1485 | + alignItems: "center" | |
| 1486 | + } | |
| 1487 | + }, /* @__PURE__ */ react.createElement(_elementor_ui.Box, { sx: { gridArea: OVERLAY_GRID } }, children), /* @__PURE__ */ react.createElement(_elementor_ui.Box, { sx: { | |
| 1488 | + gridArea: OVERLAY_GRID, | |
| 1489 | + marginInlineEnd: CHIP_OFFSET, | |
| 1490 | + justifySelf: "end" | |
| 1491 | + } }, promotionChip))); | |
| 378 | 1492 | |
| 1493 | +//#endregion | |
| 1494 | +//#region packages/packages/core/editor-interactions/src/components/controls/repeat.tsx | |
| 1495 | + var TRACKING_DATA$2 = { | |
| 1496 | + target_name: "interactions_repeat", | |
| 1497 | + location_l2: "interactions" | |
| 1498 | + }; | |
| 1499 | + var REPEAT_OPTIONS = { | |
| 1500 | + times: (0, _wordpress_i18n.__)("times", "elementor"), | |
| 1501 | + loop: (0, _wordpress_i18n.__)("loop", "elementor") | |
| 1502 | + }; | |
| 1503 | + var REPEAT_TOOLTIPS = { | |
| 1504 | + times: (0, _wordpress_i18n.__)("Enable number", "elementor"), | |
| 1505 | + loop: (0, _wordpress_i18n.__)("Infinite repeat", "elementor") | |
| 1506 | + }; | |
| 1507 | + function Repeat() { | |
| 1508 | + const repeatContainerRef = (0, react.useRef)(null); | |
| 1509 | + const options = [{ | |
| 1510 | + value: REPEAT_OPTIONS.times, | |
| 1511 | + disabled: true, | |
| 1512 | + label: REPEAT_TOOLTIPS.times, | |
| 1513 | + renderContent: ({ size }) => /* @__PURE__ */ react.createElement(_elementor_icons.Number123Icon, { fontSize: size }), | |
| 1514 | + showTooltip: true | |
| 1515 | + }, { | |
| 1516 | + value: REPEAT_OPTIONS.loop, | |
| 1517 | + disabled: true, | |
| 1518 | + label: REPEAT_TOOLTIPS.loop, | |
| 1519 | + renderContent: ({ size }) => /* @__PURE__ */ react.createElement(_elementor_icons.RepeatIcon, { fontSize: size }), | |
| 1520 | + showTooltip: true | |
| 1521 | + }]; | |
| 1522 | + return /* @__PURE__ */ react.createElement(PromotionOverlayLayout, { | |
| 1523 | + ref: repeatContainerRef, | |
| 1524 | + promotionChip: /* @__PURE__ */ react.createElement(InteractionsPromotionChip, { | |
| 1525 | + content: (0, _wordpress_i18n.__)("Upgrade to control how many times the animation repeats.", "elementor"), | |
| 1526 | + upgradeUrl: "https://go.elementor.com/go-pro-interactions-repeat-modal/", | |
| 1527 | + anchorRef: repeatContainerRef, | |
| 1528 | + trackingData: TRACKING_DATA$2 | |
| 1529 | + }) | |
| 1530 | + }, /* @__PURE__ */ react.createElement(_elementor_editor_controls.ToggleButtonGroupUi, { | |
| 1531 | + items: options, | |
| 1532 | + exclusive: true, | |
| 1533 | + onChange: () => {}, | |
| 1534 | + value: "" | |
| 1535 | + })); | |
| 1536 | + } | |
| 379 | 1537 | |
| 380 | -const TRACKING_DATA = { | |
| 381 | - target_name: 'interactions_effect', | |
| 382 | - location_l2: 'interactions' | |
| 383 | -}; | |
| 384 | -const EFFECT_OPTIONS = { | |
| 385 | - fade: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Fade', 'elementor'), | |
| 386 | - slide: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Slide', 'elementor'), | |
| 387 | - scale: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Scale', 'elementor'), | |
| 388 | - custom: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Custom', 'elementor') | |
| 389 | -}; | |
| 390 | -const BASE_EFFECTS = ['fade', 'slide', 'scale']; | |
| 391 | -function Effect({ | |
| 392 | - value, | |
| 393 | - onChange | |
| 394 | -}) { | |
| 395 | - const baseOptions = Object.fromEntries(Object.entries(EFFECT_OPTIONS).filter(([key]) => BASE_EFFECTS.includes(key))); | |
| 396 | - const disabledOptions = Object.fromEntries(Object.entries(EFFECT_OPTIONS).filter(([key]) => !BASE_EFFECTS.includes(key))); | |
| 397 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_ui_promotion_select__WEBPACK_IMPORTED_MODULE_2__.PromotionSelect, { | |
| 398 | - value: value in baseOptions ? value : _interaction_details__WEBPACK_IMPORTED_MODULE_3__.DEFAULT_VALUES.effect, | |
| 399 | - onChange: onChange, | |
| 400 | - baseOptions: baseOptions, | |
| 401 | - disabledOptions: disabledOptions, | |
| 402 | - promotionLabel: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('PRO effects', 'elementor'), | |
| 403 | - promotionContent: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Upgrade to further customize your animation with opacity, scale, move, rotate and more.', 'elementor'), | |
| 404 | - upgradeUrl: "https://go.elementor.com/go-pro-interactions-custom-effect-modal/", | |
| 405 | - trackingData: TRACKING_DATA | |
| 406 | - }); | |
| 407 | -} | |
| 1538 | +//#endregion | |
| 1539 | +//#region packages/packages/core/editor-interactions/src/components/controls/replay.tsx | |
| 1540 | + var TRACKING_DATA$1 = { | |
| 1541 | + target_name: "interactions_replay", | |
| 1542 | + location_l2: "interactions" | |
| 1543 | + }; | |
| 1544 | + var REPLAY_OPTIONS = { | |
| 1545 | + no: (0, _wordpress_i18n.__)("No", "elementor"), | |
| 1546 | + yes: (0, _wordpress_i18n.__)("Yes", "elementor") | |
| 1547 | + }; | |
| 1548 | + var BASE_REPLAY = ["no"]; | |
| 1549 | + function Replay({ onChange }) { | |
| 1550 | + const replayContainerRef = (0, react.useRef)(null); | |
| 1551 | + const options = [{ | |
| 1552 | + value: false, | |
| 1553 | + disabled: false, | |
| 1554 | + label: REPLAY_OPTIONS.no, | |
| 1555 | + renderContent: ({ size }) => /* @__PURE__ */ react.createElement(_elementor_icons.MinusIcon, { fontSize: size }), | |
| 1556 | + showTooltip: true | |
| 1557 | + }, { | |
| 1558 | + value: true, | |
| 1559 | + disabled: true, | |
| 1560 | + label: REPLAY_OPTIONS.yes, | |
| 1561 | + renderContent: ({ size }) => /* @__PURE__ */ react.createElement(_elementor_icons.CheckIcon, { fontSize: size }), | |
| 1562 | + showTooltip: true | |
| 1563 | + }]; | |
| 1564 | + return /* @__PURE__ */ react.createElement(PromotionOverlayLayout, { | |
| 1565 | + ref: replayContainerRef, | |
| 1566 | + promotionChip: /* @__PURE__ */ react.createElement(InteractionsPromotionChip, { | |
| 1567 | + content: (0, _wordpress_i18n.__)("Upgrade to run the animation every time its trigger occurs.", "elementor"), | |
| 1568 | + upgradeUrl: "https://go.elementor.com/go-pro-interactions-replay-modal/", | |
| 1569 | + anchorRef: replayContainerRef, | |
| 1570 | + trackingData: TRACKING_DATA$1 | |
| 1571 | + }) | |
| 1572 | + }, /* @__PURE__ */ react.createElement(_elementor_editor_controls.ToggleButtonGroupUi, { | |
| 1573 | + items: options, | |
| 1574 | + exclusive: true, | |
| 1575 | + onChange, | |
| 1576 | + value: false | |
| 1577 | + })); | |
| 1578 | + } | |
| 408 | 1579 | |
| 409 | -/***/ }), | |
| 1580 | +//#endregion | |
| 1581 | +//#region packages/packages/core/editor-interactions/src/components/controls/trigger.tsx | |
| 1582 | + var TRACKING_DATA = { | |
| 1583 | + target_name: "interactions_trigger", | |
| 1584 | + location_l2: "interactions" | |
| 1585 | + }; | |
| 1586 | + var TRIGGER_OPTIONS = { | |
| 1587 | + load: (0, _wordpress_i18n.__)("Page load", "elementor"), | |
| 1588 | + scrollIn: (0, _wordpress_i18n.__)("Scroll into view", "elementor"), | |
| 1589 | + scrollOn: (0, _wordpress_i18n.__)("While scrolling", "elementor"), | |
| 1590 | + hover: (0, _wordpress_i18n.__)("On hover", "elementor"), | |
| 1591 | + click: (0, _wordpress_i18n.__)("On click", "elementor") | |
| 1592 | + }; | |
| 1593 | + var BASE_TRIGGERS = ["load", "scrollIn"]; | |
| 1594 | + function Trigger({ value, onChange }) { | |
| 1595 | + const baseOptions = Object.fromEntries(Object.entries(TRIGGER_OPTIONS).filter(([key]) => BASE_TRIGGERS.includes(key))); | |
| 1596 | + const disabledOptions = Object.fromEntries(Object.entries(TRIGGER_OPTIONS).filter(([key]) => !BASE_TRIGGERS.includes(key))); | |
| 1597 | + return /* @__PURE__ */ react.createElement(PromotionSelect, { | |
| 1598 | + value: value in baseOptions ? value : DEFAULT_VALUES.trigger, | |
| 1599 | + onChange, | |
| 1600 | + baseOptions, | |
| 1601 | + disabledOptions, | |
| 1602 | + promotionLabel: (0, _wordpress_i18n.__)("PRO triggers", "elementor"), | |
| 1603 | + promotionContent: (0, _wordpress_i18n.__)("Upgrade to unlock more interactions triggers.", "elementor"), | |
| 1604 | + upgradeUrl: "https://go.elementor.com/go-pro-interactions-triggers-modal/", | |
| 1605 | + trackingData: TRACKING_DATA | |
| 1606 | + }); | |
| 1607 | + } | |
| 410 | 1608 | |
| 411 | -/***/ "./packages/packages/core/editor-interactions/src/components/controls/repeat.tsx": | |
| 412 | -/*!***************************************************************************************!*\ | |
| 413 | - !*** ./packages/packages/core/editor-interactions/src/components/controls/repeat.tsx ***! | |
| 414 | - \***************************************************************************************/ | |
| 415 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1609 | +//#endregion | |
| 1610 | +//#region packages/packages/core/editor-interactions/src/hooks/on-duplicate.ts | |
| 1611 | + function initCleanInteractionIdsOnDuplicate() { | |
| 1612 | + (0, _elementor_editor_v1_adapters.registerDataHook)("after", "document/elements/duplicate", (_args, result) => { | |
| 1613 | + if (!result || typeof result === "boolean" && result === false) return; | |
| 1614 | + (Array.isArray(result) ? result : [result]).forEach((container) => { | |
| 1615 | + cleanInteractionIdsRecursive(container.id); | |
| 1616 | + }); | |
| 1617 | + window.dispatchEvent(new CustomEvent("elementor/element/update_interactions")); | |
| 1618 | + }); | |
| 1619 | + } | |
| 1620 | + function cleanInteractionIdsRecursive(elementId) { | |
| 1621 | + const container = (0, _elementor_editor_elements.getContainer)(elementId); | |
| 1622 | + if (!container) return; | |
| 1623 | + (0, _elementor_editor_elements.getAllDescendants)(container).forEach((element) => { | |
| 1624 | + cleanInteractionIds(element.id); | |
| 1625 | + }); | |
| 1626 | + } | |
| 1627 | + function cleanInteractionIds(elementId) { | |
| 1628 | + const container = (0, _elementor_editor_elements.getContainer)(elementId); | |
| 1629 | + if (!container) return; | |
| 1630 | + const interactions = container.model.get("interactions"); | |
| 1631 | + if (!interactions || !interactions.items) return; | |
| 1632 | + const updatedInteractions = structuredClone(interactions); | |
| 1633 | + updatedInteractions?.items?.forEach((interaction) => { | |
| 1634 | + if (interaction.$$type === "interaction-item" && interaction.value) interaction.value.interaction_id = createString(generateTempInteractionId()); | |
| 1635 | + }); | |
| 1636 | + container.model.set("interactions", updatedInteractions); | |
| 1637 | + } | |
| 416 | 1638 | |
| 417 | -__webpack_require__.r(__webpack_exports__); | |
| 418 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 419 | -/* harmony export */ REPEAT_OPTIONS: function() { return /* binding */ REPEAT_OPTIONS; }, | |
| 420 | -/* harmony export */ REPEAT_TOOLTIPS: function() { return /* binding */ REPEAT_TOOLTIPS; }, | |
| 421 | -/* harmony export */ Repeat: function() { return /* binding */ Repeat; } | |
| 422 | -/* harmony export */ }); | |
| 423 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 424 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 425 | -/* harmony import */ var _elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-controls */ "@elementor/editor-controls"); | |
| 426 | -/* harmony import */ var _elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__); | |
| 427 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons"); | |
| 428 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__); | |
| 429 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 430 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); | |
| 431 | -/* harmony import */ var _ui_interactions_promotion_chip__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../ui/interactions-promotion-chip */ "./packages/packages/core/editor-interactions/src/ui/interactions-promotion-chip.tsx"); | |
| 432 | -/* harmony import */ var _ui_promotion_overlay_layout__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../ui/promotion-overlay-layout */ "./packages/packages/core/editor-interactions/src/ui/promotion-overlay-layout.tsx"); | |
| 1639 | +//#endregion | |
| 1640 | +//#region packages/packages/core/editor-interactions/src/mcp/tools/schema.ts | |
| 1641 | + var baseSchema = { | |
| 1642 | + trigger: _elementor_schema.z.enum(["load", "scrollIn"]).optional().describe("Event that triggers the animation"), | |
| 1643 | + effect: _elementor_schema.z.enum([ | |
| 1644 | + "fade", | |
| 1645 | + "slide", | |
| 1646 | + "scale" | |
| 1647 | + ]).optional().describe("Animation effect type"), | |
| 1648 | + effectType: _elementor_schema.z.enum(["in", "out"]).optional().describe("Whether the animation plays in or out"), | |
| 1649 | + direction: _elementor_schema.z.enum([ | |
| 1650 | + "top", | |
| 1651 | + "bottom", | |
| 1652 | + "left", | |
| 1653 | + "right", | |
| 1654 | + "top-left", | |
| 1655 | + "top-right", | |
| 1656 | + "bottom-left", | |
| 1657 | + "bottom-right" | |
| 1658 | + ]).optional().describe("Direction of the Animation. Can be one of the following or empty if not needed. At slide effect, this is required field."), | |
| 1659 | + duration: _elementor_schema.z.number().min(0).max(1e4).optional().describe("Animation duration in milliseconds"), | |
| 1660 | + delay: _elementor_schema.z.number().min(0).max(1e4).optional().describe("Animation delay in milliseconds"), | |
| 1661 | + easing: _elementor_schema.z.enum(["easeIn"]).optional().describe("Easing function for the animation. Use \"easeIn\" for free tier."), | |
| 1662 | + excludedBreakpoints: _elementor_schema.z.array(_elementor_schema.z.enum([ | |
| 1663 | + "widescreen", | |
| 1664 | + "desktop", | |
| 1665 | + "laptop", | |
| 1666 | + "tablet_extra", | |
| 1667 | + "tablet", | |
| 1668 | + "mobile_extra", | |
| 1669 | + "mobile" | |
| 1670 | + ])).optional().describe("Breakpoint IDs on which this interaction is disabled (e.g. [\"mobile\", \"tablet\"]). Fetch the \"elementor://breakpoints/list\" resource to get the valid IDs for the current site. Omit to enable on all breakpoints.") | |
| 1671 | + }; | |
| 1672 | + var proSchema = { | |
| 1673 | + trigger: _elementor_schema.z.enum([ | |
| 1674 | + "load", | |
| 1675 | + "scrollIn", | |
| 1676 | + "scrollOut", | |
| 1677 | + "scrollOn", | |
| 1678 | + "hover", | |
| 1679 | + "click" | |
| 1680 | + ]).optional().describe("Event that triggers the animation"), | |
| 1681 | + effect: _elementor_schema.z.enum([ | |
| 1682 | + "fade", | |
| 1683 | + "slide", | |
| 1684 | + "scale", | |
| 1685 | + "custom" | |
| 1686 | + ]).optional().describe("Animation effect type"), | |
| 1687 | + easing: _elementor_schema.z.enum([ | |
| 1688 | + "easeIn", | |
| 1689 | + "easeInOut", | |
| 1690 | + "easeOut", | |
| 1691 | + "backIn", | |
| 1692 | + "backInOut", | |
| 1693 | + "backOut", | |
| 1694 | + "linear" | |
| 1695 | + ]).optional().describe("Easing function for the animation."), | |
| 1696 | + customEffects: _elementor_schema.z.object({ keyframes: _elementor_schema.z.array(_elementor_schema.z.object({ | |
| 1697 | + stop: _elementor_schema.z.number().describe("The stop of the keyframe in percent, can be either 0 or 100"), | |
| 1698 | + value: _elementor_schema.z.object({ | |
| 1699 | + opacity: _elementor_schema.z.number().min(0).max(1).describe("The opacity of the keyframe"), | |
| 1700 | + scale: _elementor_schema.z.object({ | |
| 1701 | + x: _elementor_schema.z.number().min(0).max(1).describe("The x scale of the keyframe"), | |
| 1702 | + y: _elementor_schema.z.number().min(0).max(1).describe("The y scale of the keyframe") | |
| 1703 | + }).optional().describe("The scale of the keyframe"), | |
| 1704 | + rotate: _elementor_schema.z.object({ | |
| 1705 | + x: _elementor_schema.z.number().min(0).max(360).describe("The x rotate of the keyframe"), | |
| 1706 | + y: _elementor_schema.z.number().min(0).max(360).describe("The y rotate of the keyframe"), | |
| 1707 | + z: _elementor_schema.z.number().min(0).max(360).describe("The z rotate of the keyframe") | |
| 1708 | + }).optional().describe("The rotate of the keyframe"), | |
| 1709 | + move: _elementor_schema.z.object({ | |
| 1710 | + x: _elementor_schema.z.number().min(0).max(1).describe("The x move of the keyframe"), | |
| 1711 | + y: _elementor_schema.z.number().min(0).max(1).describe("The y move of the keyframe"), | |
| 1712 | + z: _elementor_schema.z.number().min(0).max(1).describe("The z move of the keyframe") | |
| 1713 | + }).optional().describe("The move of the keyframe"), | |
| 1714 | + skew: _elementor_schema.z.object({ | |
| 1715 | + x: _elementor_schema.z.number().min(0).max(360).describe("The x skew of the keyframe"), | |
| 1716 | + y: _elementor_schema.z.number().min(0).max(360).describe("The y skew of the keyframe") | |
| 1717 | + }).optional().describe("The skew of the keyframe") | |
| 1718 | + }) | |
| 1719 | + })).describe("The keyframes of the custom effect") }).optional().describe("The custom effect to use for the animation") | |
| 1720 | + }; | |
| 433 | 1721 | |
| 1722 | +//#endregion | |
| 1723 | +//#region packages/packages/core/editor-interactions/src/mcp/resources/interactions-schema-resource.ts | |
| 1724 | + var INTERACTIONS_SCHEMA_URI = "elementor://interactions/schema"; | |
| 1725 | + var initInteractionsSchemaResource = (reg) => { | |
| 1726 | + const { resource } = reg; | |
| 1727 | + const schema = (0, _elementor_utils.isProActive)() ? { | |
| 1728 | + ...baseSchema, | |
| 1729 | + ...proSchema | |
| 1730 | + } : baseSchema; | |
| 1731 | + resource("interactions-schema", INTERACTIONS_SCHEMA_URI, { description: "Schema describing all available options for element interactions." }, async () => { | |
| 1732 | + return { contents: [{ | |
| 1733 | + uri: INTERACTIONS_SCHEMA_URI, | |
| 1734 | + mimeType: "application/json", | |
| 1735 | + text: JSON.stringify(schema) | |
| 1736 | + }] }; | |
| 1737 | + }); | |
| 1738 | + }; | |
| 434 | 1739 | |
| 435 | - | |
| 436 | - | |
| 437 | - | |
| 438 | - | |
| 439 | - | |
| 440 | -const TRACKING_DATA = { | |
| 441 | - target_name: 'interactions_repeat', | |
| 442 | - location_l2: 'interactions' | |
| 443 | -}; | |
| 444 | -const REPEAT_OPTIONS = { | |
| 445 | - times: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('times', 'elementor'), | |
| 446 | - loop: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('loop', 'elementor') | |
| 447 | -}; | |
| 448 | -const REPEAT_TOOLTIPS = { | |
| 449 | - times: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Enable number', 'elementor'), | |
| 450 | - loop: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Infinite repeat', 'elementor') | |
| 451 | -}; | |
| 452 | -function Repeat() { | |
| 453 | - const repeatContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); | |
| 454 | - const options = [{ | |
| 455 | - value: REPEAT_OPTIONS.times, | |
| 456 | - disabled: true, | |
| 457 | - label: REPEAT_TOOLTIPS.times, | |
| 458 | - renderContent: ({ | |
| 459 | - size | |
| 460 | - }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.Number123Icon, { | |
| 461 | - fontSize: size | |
| 462 | - }), | |
| 463 | - showTooltip: true | |
| 464 | - }, { | |
| 465 | - value: REPEAT_OPTIONS.loop, | |
| 466 | - disabled: true, | |
| 467 | - label: REPEAT_TOOLTIPS.loop, | |
| 468 | - renderContent: ({ | |
| 469 | - size | |
| 470 | - }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.RepeatIcon, { | |
| 471 | - fontSize: size | |
| 472 | - }), | |
| 473 | - showTooltip: true | |
| 474 | - }]; | |
| 475 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_ui_promotion_overlay_layout__WEBPACK_IMPORTED_MODULE_5__.PromotionOverlayLayout, { | |
| 476 | - ref: repeatContainerRef, | |
| 477 | - promotionChip: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_ui_interactions_promotion_chip__WEBPACK_IMPORTED_MODULE_4__.InteractionsPromotionChip, { | |
| 478 | - content: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Upgrade to control how many times the animation repeats.', 'elementor'), | |
| 479 | - upgradeUrl: 'https://go.elementor.com/go-pro-interactions-repeat-modal/', | |
| 480 | - anchorRef: repeatContainerRef, | |
| 481 | - trackingData: TRACKING_DATA | |
| 482 | - }) | |
| 483 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__.ToggleButtonGroupUi, { | |
| 484 | - items: options, | |
| 485 | - exclusive: true, | |
| 486 | - onChange: () => {}, | |
| 487 | - value: '' | |
| 488 | - })); | |
| 489 | -} | |
| 490 | - | |
| 491 | -/***/ }), | |
| 492 | - | |
| 493 | -/***/ "./packages/packages/core/editor-interactions/src/components/controls/replay.tsx": | |
| 494 | -/*!***************************************************************************************!*\ | |
| 495 | - !*** ./packages/packages/core/editor-interactions/src/components/controls/replay.tsx ***! | |
| 496 | - \***************************************************************************************/ | |
| 497 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 498 | - | |
| 499 | -__webpack_require__.r(__webpack_exports__); | |
| 500 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 501 | -/* harmony export */ BASE_REPLAY: function() { return /* binding */ BASE_REPLAY; }, | |
| 502 | -/* harmony export */ REPLAY_OPTIONS: function() { return /* binding */ REPLAY_OPTIONS; }, | |
| 503 | -/* harmony export */ Replay: function() { return /* binding */ Replay; } | |
| 504 | -/* harmony export */ }); | |
| 505 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 506 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 507 | -/* harmony import */ var _elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-controls */ "@elementor/editor-controls"); | |
| 508 | -/* harmony import */ var _elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__); | |
| 509 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons"); | |
| 510 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__); | |
| 511 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 512 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); | |
| 513 | -/* harmony import */ var _ui_interactions_promotion_chip__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../ui/interactions-promotion-chip */ "./packages/packages/core/editor-interactions/src/ui/interactions-promotion-chip.tsx"); | |
| 514 | -/* harmony import */ var _ui_promotion_overlay_layout__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../ui/promotion-overlay-layout */ "./packages/packages/core/editor-interactions/src/ui/promotion-overlay-layout.tsx"); | |
| 515 | - | |
| 516 | - | |
| 517 | - | |
| 518 | - | |
| 519 | - | |
| 520 | - | |
| 521 | - | |
| 522 | -const TRACKING_DATA = { | |
| 523 | - target_name: 'interactions_replay', | |
| 524 | - location_l2: 'interactions' | |
| 525 | -}; | |
| 526 | -const REPLAY_OPTIONS = { | |
| 527 | - no: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('No', 'elementor'), | |
| 528 | - yes: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Yes', 'elementor') | |
| 529 | -}; | |
| 530 | -const BASE_REPLAY = ['no']; | |
| 531 | -function Replay({ | |
| 532 | - onChange | |
| 533 | -}) { | |
| 534 | - const replayContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); | |
| 535 | - const options = [{ | |
| 536 | - value: false, | |
| 537 | - disabled: false, | |
| 538 | - label: REPLAY_OPTIONS.no, | |
| 539 | - renderContent: ({ | |
| 540 | - size | |
| 541 | - }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.MinusIcon, { | |
| 542 | - fontSize: size | |
| 543 | - }), | |
| 544 | - showTooltip: true | |
| 545 | - }, { | |
| 546 | - value: true, | |
| 547 | - disabled: true, | |
| 548 | - label: REPLAY_OPTIONS.yes, | |
| 549 | - renderContent: ({ | |
| 550 | - size | |
| 551 | - }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.CheckIcon, { | |
| 552 | - fontSize: size | |
| 553 | - }), | |
| 554 | - showTooltip: true | |
| 555 | - }]; | |
| 556 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_ui_promotion_overlay_layout__WEBPACK_IMPORTED_MODULE_5__.PromotionOverlayLayout, { | |
| 557 | - ref: replayContainerRef, | |
| 558 | - promotionChip: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_ui_interactions_promotion_chip__WEBPACK_IMPORTED_MODULE_4__.InteractionsPromotionChip, { | |
| 559 | - content: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Upgrade to run the animation every time its trigger occurs.', 'elementor'), | |
| 560 | - upgradeUrl: 'https://go.elementor.com/go-pro-interactions-replay-modal/', | |
| 561 | - anchorRef: replayContainerRef, | |
| 562 | - trackingData: TRACKING_DATA | |
| 563 | - }) | |
| 564 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__.ToggleButtonGroupUi, { | |
| 565 | - items: options, | |
| 566 | - exclusive: true, | |
| 567 | - onChange: onChange, | |
| 568 | - value: false | |
| 569 | - })); | |
| 570 | -} | |
| 571 | - | |
| 572 | -/***/ }), | |
| 573 | - | |
| 574 | -/***/ "./packages/packages/core/editor-interactions/src/components/controls/time-frame-indicator.tsx": | |
| 575 | -/*!*****************************************************************************************************!*\ | |
| 576 | - !*** ./packages/packages/core/editor-interactions/src/components/controls/time-frame-indicator.tsx ***! | |
| 577 | - \*****************************************************************************************************/ | |
| 578 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 579 | - | |
| 580 | -__webpack_require__.r(__webpack_exports__); | |
| 581 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 582 | -/* harmony export */ TimeFrameIndicator: function() { return /* binding */ TimeFrameIndicator; } | |
| 583 | -/* harmony export */ }); | |
| 584 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 585 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 586 | -/* harmony import */ var _elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-controls */ "@elementor/editor-controls"); | |
| 587 | -/* harmony import */ var _elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__); | |
| 588 | -/* harmony import */ var _configs_time_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../configs/time-constants */ "./packages/packages/core/editor-interactions/src/configs/time-constants.ts"); | |
| 589 | -/* harmony import */ var _utils_size_transform_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils/size-transform-utils */ "./packages/packages/core/editor-interactions/src/utils/size-transform-utils.ts"); | |
| 590 | - | |
| 591 | - | |
| 592 | - | |
| 593 | - | |
| 594 | - | |
| 595 | -function TimeFrameIndicator({ | |
| 596 | - value, | |
| 597 | - onChange, | |
| 598 | - defaultValue | |
| 599 | -}) { | |
| 600 | - const sizeValue = (0,_utils_size_transform_utils__WEBPACK_IMPORTED_MODULE_3__.parseSizeValue)(value, _configs_time_constants__WEBPACK_IMPORTED_MODULE_2__.TIME_UNITS, defaultValue, _configs_time_constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_TIME_UNIT); | |
| 601 | - const handleChange = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(size => { | |
| 602 | - onChange((0,_utils_size_transform_utils__WEBPACK_IMPORTED_MODULE_3__.formatSizeValue)(size)); | |
| 603 | - }, [onChange]); | |
| 604 | - const handleBlur = event => { | |
| 605 | - if (!event.target.value) { | |
| 606 | - handleChange((0,_utils_size_transform_utils__WEBPACK_IMPORTED_MODULE_3__.parseSizeValue)(defaultValue, _configs_time_constants__WEBPACK_IMPORTED_MODULE_2__.TIME_UNITS, undefined, _configs_time_constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_TIME_UNIT)); | |
| 607 | - } | |
| 608 | - }; | |
| 609 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__.SizeComponent, { | |
| 610 | - units: _configs_time_constants__WEBPACK_IMPORTED_MODULE_2__.TIME_UNITS, | |
| 611 | - value: sizeValue, | |
| 612 | - setValue: handleChange, | |
| 613 | - onBlur: handleBlur, | |
| 614 | - InputProps: { | |
| 615 | - inputProps: { | |
| 616 | - min: 0 | |
| 617 | - } | |
| 618 | - } | |
| 619 | - }); | |
| 620 | -} | |
| 621 | - | |
| 622 | -/***/ }), | |
| 623 | - | |
| 624 | -/***/ "./packages/packages/core/editor-interactions/src/components/controls/trigger.tsx": | |
| 625 | -/*!****************************************************************************************!*\ | |
| 626 | - !*** ./packages/packages/core/editor-interactions/src/components/controls/trigger.tsx ***! | |
| 627 | - \****************************************************************************************/ | |
| 628 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 629 | - | |
| 630 | -__webpack_require__.r(__webpack_exports__); | |
| 631 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 632 | -/* harmony export */ BASE_TRIGGERS: function() { return /* binding */ BASE_TRIGGERS; }, | |
| 633 | -/* harmony export */ TRIGGER_OPTIONS: function() { return /* binding */ TRIGGER_OPTIONS; }, | |
| 634 | -/* harmony export */ Trigger: function() { return /* binding */ Trigger; } | |
| 635 | -/* harmony export */ }); | |
| 636 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 637 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 638 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 639 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); | |
| 640 | -/* harmony import */ var _ui_promotion_select__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../ui/promotion-select */ "./packages/packages/core/editor-interactions/src/ui/promotion-select.tsx"); | |
| 641 | -/* harmony import */ var _interaction_details__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../interaction-details */ "./packages/packages/core/editor-interactions/src/components/interaction-details.tsx"); | |
| 642 | - | |
| 643 | - | |
| 644 | - | |
| 645 | - | |
| 646 | -const TRACKING_DATA = { | |
| 647 | - target_name: 'interactions_trigger', | |
| 648 | - location_l2: 'interactions' | |
| 649 | -}; | |
| 650 | -const TRIGGER_OPTIONS = { | |
| 651 | - load: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Page load', 'elementor'), | |
| 652 | - scrollIn: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Scroll into view', 'elementor'), | |
| 653 | - scrollOn: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('While scrolling', 'elementor'), | |
| 654 | - hover: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('On hover', 'elementor'), | |
| 655 | - click: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('On click', 'elementor') | |
| 656 | -}; | |
| 657 | -const BASE_TRIGGERS = ['load', 'scrollIn']; | |
| 658 | -function Trigger({ | |
| 659 | - value, | |
| 660 | - onChange | |
| 661 | -}) { | |
| 662 | - const baseOptions = Object.fromEntries(Object.entries(TRIGGER_OPTIONS).filter(([key]) => BASE_TRIGGERS.includes(key))); | |
| 663 | - const disabledOptions = Object.fromEntries(Object.entries(TRIGGER_OPTIONS).filter(([key]) => !BASE_TRIGGERS.includes(key))); | |
| 664 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_ui_promotion_select__WEBPACK_IMPORTED_MODULE_2__.PromotionSelect, { | |
| 665 | - value: value in baseOptions ? value : _interaction_details__WEBPACK_IMPORTED_MODULE_3__.DEFAULT_VALUES.trigger, | |
| 666 | - onChange: onChange, | |
| 667 | - baseOptions: baseOptions, | |
| 668 | - disabledOptions: disabledOptions, | |
| 669 | - promotionLabel: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('PRO triggers', 'elementor'), | |
| 670 | - promotionContent: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Upgrade to unlock more interactions triggers.', 'elementor'), | |
| 671 | - upgradeUrl: "https://go.elementor.com/go-pro-interactions-triggers-modal/", | |
| 672 | - trackingData: TRACKING_DATA | |
| 673 | - }); | |
| 674 | -} | |
| 675 | - | |
| 676 | -/***/ }), | |
| 677 | - | |
| 678 | -/***/ "./packages/packages/core/editor-interactions/src/components/empty-state.tsx": | |
| 679 | -/*!***********************************************************************************!*\ | |
| 680 | - !*** ./packages/packages/core/editor-interactions/src/components/empty-state.tsx ***! | |
| 681 | - \***********************************************************************************/ | |
| 682 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 683 | - | |
| 684 | -__webpack_require__.r(__webpack_exports__); | |
| 685 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 686 | -/* harmony export */ EmptyState: function() { return /* binding */ EmptyState; } | |
| 687 | -/* harmony export */ }); | |
| 688 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 689 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 690 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons"); | |
| 691 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__); | |
| 692 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 693 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__); | |
| 694 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 695 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); | |
| 696 | - | |
| 697 | - | |
| 698 | - | |
| 699 | - | |
| 700 | -const EmptyState = ({ | |
| 701 | - onCreateInteraction | |
| 702 | -}) => { | |
| 703 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Stack, { | |
| 704 | - alignItems: "center", | |
| 705 | - justifyContent: "center", | |
| 706 | - height: "100%", | |
| 707 | - color: "text.secondary", | |
| 708 | - sx: { | |
| 709 | - p: 2.5, | |
| 710 | - pt: 8, | |
| 711 | - pb: 5.5 | |
| 712 | - }, | |
| 713 | - gap: 1.5 | |
| 714 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.SwipeIcon, { | |
| 715 | - fontSize: "large" | |
| 716 | - }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Typography, { | |
| 717 | - align: "center", | |
| 718 | - variant: "subtitle2" | |
| 719 | - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Animate elements with Interactions', 'elementor')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Typography, { | |
| 720 | - align: "center", | |
| 721 | - variant: "caption", | |
| 722 | - maxWidth: "170px" | |
| 723 | - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Add entrance animations and effects triggered by user interactions such as page load or scroll.', 'elementor')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Button, { | |
| 724 | - variant: "outlined", | |
| 725 | - color: "secondary", | |
| 726 | - size: "small", | |
| 727 | - sx: { | |
| 728 | - mt: 1 | |
| 729 | - }, | |
| 730 | - onClick: onCreateInteraction | |
| 731 | - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Create an interaction', 'elementor'))); | |
| 732 | -}; | |
| 733 | - | |
| 734 | -/***/ }), | |
| 735 | - | |
| 736 | -/***/ "./packages/packages/core/editor-interactions/src/components/field.tsx": | |
| 737 | -/*!*****************************************************************************!*\ | |
| 738 | - !*** ./packages/packages/core/editor-interactions/src/components/field.tsx ***! | |
| 739 | - \*****************************************************************************/ | |
| 740 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 741 | - | |
| 742 | -__webpack_require__.r(__webpack_exports__); | |
| 743 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 744 | -/* harmony export */ Field: function() { return /* binding */ Field; } | |
| 745 | -/* harmony export */ }); | |
| 746 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 747 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 748 | -/* harmony import */ var _elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-controls */ "@elementor/editor-controls"); | |
| 749 | -/* harmony import */ var _elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__); | |
| 750 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 751 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__); | |
| 752 | - | |
| 753 | - | |
| 754 | - | |
| 755 | -const Field = ({ | |
| 756 | - label, | |
| 757 | - children | |
| 758 | -}) => { | |
| 759 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, { | |
| 760 | - item: true, | |
| 761 | - xs: 12, | |
| 762 | - "aria-label": `${label} control` | |
| 763 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__.PopoverGridContainer, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, { | |
| 764 | - item: true, | |
| 765 | - xs: 6 | |
| 766 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__.ControlFormLabel, null, label)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, { | |
| 767 | - item: true, | |
| 768 | - xs: 6 | |
| 769 | - }, children))); | |
| 770 | -}; | |
| 771 | - | |
| 772 | -/***/ }), | |
| 773 | - | |
| 774 | -/***/ "./packages/packages/core/editor-interactions/src/components/interaction-details.tsx": | |
| 775 | -/*!*******************************************************************************************!*\ | |
| 776 | - !*** ./packages/packages/core/editor-interactions/src/components/interaction-details.tsx ***! | |
| 777 | - \*******************************************************************************************/ | |
| 778 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 779 | - | |
| 780 | -__webpack_require__.r(__webpack_exports__); | |
| 781 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 782 | -/* harmony export */ DEFAULT_VALUES: function() { return /* binding */ DEFAULT_VALUES; }, | |
| 783 | -/* harmony export */ InteractionDetails: function() { return /* binding */ InteractionDetails; } | |
| 784 | -/* harmony export */ }); | |
| 785 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 786 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 787 | -/* harmony import */ var _elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-controls */ "@elementor/editor-controls"); | |
| 788 | -/* harmony import */ var _elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__); | |
| 789 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 790 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__); | |
| 791 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 792 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); | |
| 793 | -/* harmony import */ var _interactions_controls_registry__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../interactions-controls-registry */ "./packages/packages/core/editor-interactions/src/interactions-controls-registry.ts"); | |
| 794 | -/* harmony import */ var _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/prop-value-utils */ "./packages/packages/core/editor-interactions/src/utils/prop-value-utils.ts"); | |
| 795 | -/* harmony import */ var _utils_resolve_direction__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/resolve-direction */ "./packages/packages/core/editor-interactions/src/utils/resolve-direction.ts"); | |
| 796 | -/* harmony import */ var _utils_scroll_interaction_event__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/scroll-interaction-event */ "./packages/packages/core/editor-interactions/src/utils/scroll-interaction-event.ts"); | |
| 797 | -/* harmony import */ var _utils_size_transform_utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/size-transform-utils */ "./packages/packages/core/editor-interactions/src/utils/size-transform-utils.ts"); | |
| 798 | -/* harmony import */ var _controls_time_frame_indicator__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./controls/time-frame-indicator */ "./packages/packages/core/editor-interactions/src/components/controls/time-frame-indicator.tsx"); | |
| 799 | -/* harmony import */ var _field__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./field */ "./packages/packages/core/editor-interactions/src/components/field.tsx"); | |
| 800 | - | |
| 801 | - | |
| 802 | - | |
| 803 | - | |
| 804 | - | |
| 805 | - | |
| 806 | - | |
| 807 | - | |
| 808 | - | |
| 809 | - | |
| 810 | - | |
| 811 | - | |
| 812 | -const DEFAULT_VALUES = { | |
| 813 | - trigger: 'load', | |
| 814 | - effect: 'fade', | |
| 815 | - type: 'in', | |
| 816 | - direction: '', | |
| 817 | - duration: 600, | |
| 818 | - delay: 0, | |
| 819 | - replay: false, | |
| 820 | - easing: 'easeIn', | |
| 821 | - relativeTo: 'viewport', | |
| 822 | - repeat: '', | |
| 823 | - times: 1, | |
| 824 | - start: 85, | |
| 825 | - end: 15 | |
| 826 | -}; | |
| 827 | -const TRIGGERS_WITHOUT_REPLAY = ['load', 'scrollOn', 'hover', 'click']; | |
| 828 | -const controlVisibilityConfig = { | |
| 829 | - replay: values => !TRIGGERS_WITHOUT_REPLAY.includes(values.trigger), | |
| 830 | - custom: values => values.effect === 'custom', | |
| 831 | - effectType: values => values.effect !== 'custom', | |
| 832 | - direction: values => values.effect !== 'custom', | |
| 833 | - relativeTo: values => values.trigger === 'scrollOn', | |
| 834 | - start: values => values.trigger === 'scrollOn', | |
| 835 | - end: values => values.trigger === 'scrollOn', | |
| 836 | - repeat: values => values.trigger !== 'scrollOn', | |
| 837 | - times: values => values.trigger !== 'scrollOn' && values.repeat === 'times', | |
| 838 | - duration: values => { | |
| 839 | - const isRelativeToVisible = values.trigger === 'scrollOn'; | |
| 840 | - return !isRelativeToVisible; | |
| 841 | - }, | |
| 842 | - delay: values => { | |
| 843 | - const isRelativeToVisible = values.trigger === 'scrollOn'; | |
| 844 | - return !isRelativeToVisible; | |
| 845 | - } | |
| 846 | -}; | |
| 847 | -function normalizeTimesValue(value, fallback) { | |
| 848 | - const numericValue = Number(value); | |
| 849 | - if (!Number.isFinite(numericValue)) { | |
| 850 | - return fallback; | |
| 851 | - } | |
| 852 | - return Math.max(1, Math.floor(numericValue)); | |
| 853 | -} | |
| 854 | -function useControlComponent(controlName, isVisible = true) { | |
| 855 | - return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { | |
| 856 | - if (!isVisible) { | |
| 857 | - return null; | |
| 858 | - } | |
| 859 | - return (0,_interactions_controls_registry__WEBPACK_IMPORTED_MODULE_4__.getInteractionsControl)(controlName)?.component ?? null; | |
| 860 | - }, [controlName, isVisible]); | |
| 861 | -} | |
| 862 | -const InteractionDetails = ({ | |
| 863 | - interaction, | |
| 864 | - onChange, | |
| 865 | - onPlayInteraction | |
| 866 | -}) => { | |
| 867 | - const trigger = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_5__.extractString)(interaction.trigger, DEFAULT_VALUES.trigger); | |
| 868 | - const effect = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_5__.extractString)(interaction.animation.value.effect, DEFAULT_VALUES.effect); | |
| 869 | - const customEffects = interaction.animation.value.custom_effect; | |
| 870 | - const type = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_5__.extractString)(interaction.animation.value.type, DEFAULT_VALUES.type); | |
| 871 | - const direction = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_5__.extractString)(interaction.animation.value.direction, DEFAULT_VALUES.direction); | |
| 872 | - const duration = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_5__.extractSize)(interaction.animation.value.timing_config.value.duration); | |
| 873 | - const delay = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_5__.extractSize)(interaction.animation.value.timing_config.value.delay); | |
| 874 | - const replay = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_5__.extractBoolean)(interaction.animation.value.config?.value.replay, DEFAULT_VALUES.replay); | |
| 875 | - const easing = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_5__.extractString)(interaction.animation.value.config?.value.easing, DEFAULT_VALUES.easing); | |
| 876 | - const relativeTo = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_5__.extractString)(interaction.animation.value.config?.value.relativeTo, DEFAULT_VALUES.relativeTo); | |
| 877 | - const configValue = interaction.animation.value.config?.value; | |
| 878 | - const repeat = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_5__.extractString)(configValue?.repeat, DEFAULT_VALUES.repeat); | |
| 879 | - const times = normalizeTimesValue(configValue?.times?.value, DEFAULT_VALUES.times); | |
| 880 | - const start = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_5__.extractSize)(interaction.animation.value.config?.value.start, DEFAULT_VALUES.start); | |
| 881 | - const end = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_5__.extractSize)(interaction.animation.value.config?.value.end, DEFAULT_VALUES.end); | |
| 882 | - const interactionValues = { | |
| 883 | - trigger, | |
| 884 | - effect, | |
| 885 | - type, | |
| 886 | - direction, | |
| 887 | - duration, | |
| 888 | - delay, | |
| 889 | - easing, | |
| 890 | - replay, | |
| 891 | - relativeTo, | |
| 892 | - repeat, | |
| 893 | - times, | |
| 894 | - start, | |
| 895 | - end, | |
| 896 | - customEffects | |
| 897 | - }; | |
| 898 | - const TriggerControl = useControlComponent('trigger', true); | |
| 899 | - const EffectControl = useControlComponent('effect'); | |
| 900 | - const ReplayControl = useControlComponent('replay', controlVisibilityConfig.replay(interactionValues)); | |
| 901 | - const RelativeToControl = useControlComponent('relativeTo', controlVisibilityConfig.relativeTo(interactionValues)); | |
| 902 | - const StartControl = useControlComponent('start', controlVisibilityConfig.start(interactionValues)); | |
| 903 | - const EndControl = useControlComponent('end', controlVisibilityConfig.end(interactionValues)); | |
| 904 | - const CustomEffectControl = useControlComponent('customEffects', controlVisibilityConfig.custom(interactionValues)); | |
| 905 | - const EffectTypeControl = useControlComponent('effectType', controlVisibilityConfig.effectType(interactionValues)); | |
| 906 | - const DirectionControl = useControlComponent('direction', controlVisibilityConfig.direction(interactionValues)); | |
| 907 | - const RepeatControl = useControlComponent('repeat', controlVisibilityConfig.repeat(interactionValues)); | |
| 908 | - const TimesControl = useControlComponent('times', controlVisibilityConfig.times(interactionValues)); | |
| 909 | - const EasingControl = useControlComponent('easing'); | |
| 910 | - const updateInteraction = updates => { | |
| 911 | - const resolvedDirectionValue = (0,_utils_resolve_direction__WEBPACK_IMPORTED_MODULE_6__.resolveDirection)('direction' in updates, updates.effect, updates.direction, direction, effect); | |
| 912 | - const updatedInteraction = { | |
| 913 | - ...interaction, | |
| 914 | - interaction_id: interaction.interaction_id, | |
| 915 | - trigger: (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_5__.createString)(updates.trigger ?? trigger), | |
| 916 | - animation: (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_5__.createAnimationPreset)({ | |
| 917 | - effect: updates.effect ?? effect, | |
| 918 | - type: updates.type ?? type, | |
| 919 | - direction: resolvedDirectionValue, | |
| 920 | - duration: updates.duration ?? duration, | |
| 921 | - delay: updates.delay ?? delay, | |
| 922 | - replay: updates.replay ?? replay, | |
| 923 | - easing: updates.easing ?? easing, | |
| 924 | - relativeTo: updates.relativeTo ?? relativeTo, | |
| 925 | - repeat: updates.repeat ?? repeat, | |
| 926 | - times: updates.times ?? times, | |
| 927 | - start: updates.start ?? start, | |
| 928 | - end: updates.end ?? end, | |
| 929 | - customEffects: updates.customEffects ?? customEffects | |
| 930 | - }) | |
| 931 | - }; | |
| 932 | - onChange(updatedInteraction); | |
| 933 | - (0,_utils_scroll_interaction_event__WEBPACK_IMPORTED_MODULE_7__.syncGridOverlay)(updates.trigger ?? trigger, updates.start ?? start, updates.end ?? end, updates.relativeTo ?? relativeTo); | |
| 934 | - const interactionId = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_5__.extractString)(updatedInteraction.interaction_id); | |
| 935 | - setTimeout(() => { | |
| 936 | - onPlayInteraction(interactionId); | |
| 937 | - }, 0); | |
| 938 | - }; | |
| 939 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__.PopoverContent, { | |
| 940 | - p: 1.5 | |
| 941 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, { | |
| 942 | - container: true, | |
| 943 | - spacing: 1.5 | |
| 944 | - }, TriggerControl && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_field__WEBPACK_IMPORTED_MODULE_10__.Field, { | |
| 945 | - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Trigger', 'elementor') | |
| 946 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(TriggerControl, { | |
| 947 | - value: trigger, | |
| 948 | - onChange: v => updateInteraction({ | |
| 949 | - trigger: v | |
| 950 | - }) | |
| 951 | - })), ReplayControl && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_field__WEBPACK_IMPORTED_MODULE_10__.Field, { | |
| 952 | - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Replay', 'elementor') | |
| 953 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ReplayControl, { | |
| 954 | - value: replay, | |
| 955 | - onChange: v => updateInteraction({ | |
| 956 | - replay: v | |
| 957 | - }), | |
| 958 | - disabled: true | |
| 959 | - }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Divider, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, { | |
| 960 | - container: true, | |
| 961 | - spacing: 1.5 | |
| 962 | - }, EffectControl && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_field__WEBPACK_IMPORTED_MODULE_10__.Field, { | |
| 963 | - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Effect', 'elementor') | |
| 964 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(EffectControl, { | |
| 965 | - value: effect, | |
| 966 | - onChange: v => updateInteraction({ | |
| 967 | - effect: v | |
| 968 | - }) | |
| 969 | - })), CustomEffectControl && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_field__WEBPACK_IMPORTED_MODULE_10__.Field, { | |
| 970 | - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Custom Effect', 'elementor') | |
| 971 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(CustomEffectControl, { | |
| 972 | - value: customEffects, | |
| 973 | - onChange: v => updateInteraction({ | |
| 974 | - customEffects: v | |
| 975 | - }) | |
| 976 | - })), EffectTypeControl && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_field__WEBPACK_IMPORTED_MODULE_10__.Field, { | |
| 977 | - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Type', 'elementor') | |
| 978 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(EffectTypeControl, { | |
| 979 | - value: type, | |
| 980 | - onChange: v => updateInteraction({ | |
| 981 | - type: v | |
| 982 | - }) | |
| 983 | - })), DirectionControl && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_field__WEBPACK_IMPORTED_MODULE_10__.Field, { | |
| 984 | - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Direction', 'elementor') | |
| 985 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(DirectionControl, { | |
| 986 | - value: direction, | |
| 987 | - onChange: v => updateInteraction({ | |
| 988 | - direction: v | |
| 989 | - }), | |
| 990 | - interactionType: type | |
| 991 | - })), RepeatControl && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_field__WEBPACK_IMPORTED_MODULE_10__.Field, { | |
| 992 | - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Repeat', 'elementor') | |
| 993 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(RepeatControl, { | |
| 994 | - value: repeat, | |
| 995 | - onChange: v => updateInteraction({ | |
| 996 | - repeat: v | |
| 997 | - }) | |
| 998 | - })), TimesControl && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_field__WEBPACK_IMPORTED_MODULE_10__.Field, { | |
| 999 | - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Times', 'elementor') | |
| 1000 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(TimesControl, { | |
| 1001 | - value: times, | |
| 1002 | - onChange: v => updateInteraction({ | |
| 1003 | - times: normalizeTimesValue(v, DEFAULT_VALUES.times) | |
| 1004 | - }) | |
| 1005 | - })), controlVisibilityConfig.duration(interactionValues) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_field__WEBPACK_IMPORTED_MODULE_10__.Field, { | |
| 1006 | - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Duration', 'elementor') | |
| 1007 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_controls_time_frame_indicator__WEBPACK_IMPORTED_MODULE_9__.TimeFrameIndicator, { | |
| 1008 | - value: String(duration), | |
| 1009 | - onChange: v => updateInteraction({ | |
| 1010 | - duration: v | |
| 1011 | - }), | |
| 1012 | - defaultValue: DEFAULT_VALUES.duration | |
| 1013 | - })), controlVisibilityConfig.delay(interactionValues) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_field__WEBPACK_IMPORTED_MODULE_10__.Field, { | |
| 1014 | - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Delay', 'elementor') | |
| 1015 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_controls_time_frame_indicator__WEBPACK_IMPORTED_MODULE_9__.TimeFrameIndicator, { | |
| 1016 | - value: String(delay), | |
| 1017 | - onChange: v => updateInteraction({ | |
| 1018 | - delay: v | |
| 1019 | - }), | |
| 1020 | - defaultValue: DEFAULT_VALUES.delay | |
| 1021 | - }))), controlVisibilityConfig.relativeTo(interactionValues) && RelativeToControl && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Divider, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, { | |
| 1022 | - container: true, | |
| 1023 | - spacing: 1.5 | |
| 1024 | - }, StartControl && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_field__WEBPACK_IMPORTED_MODULE_10__.Field, { | |
| 1025 | - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Start', 'elementor') | |
| 1026 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(StartControl, { | |
| 1027 | - value: (0,_utils_size_transform_utils__WEBPACK_IMPORTED_MODULE_8__.parseSizeValue)(start, ['%']).size?.toString() ?? '', | |
| 1028 | - onChange: v => updateInteraction({ | |
| 1029 | - start: v | |
| 1030 | - }) | |
| 1031 | - })), EndControl && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_field__WEBPACK_IMPORTED_MODULE_10__.Field, { | |
| 1032 | - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('End', 'elementor') | |
| 1033 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(EndControl, { | |
| 1034 | - value: (0,_utils_size_transform_utils__WEBPACK_IMPORTED_MODULE_8__.parseSizeValue)(end, ['%']).size?.toString() ?? '', | |
| 1035 | - onChange: v => updateInteraction({ | |
| 1036 | - end: v | |
| 1037 | - }) | |
| 1038 | - })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_field__WEBPACK_IMPORTED_MODULE_10__.Field, { | |
| 1039 | - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Relative To', 'elementor') | |
| 1040 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(RelativeToControl, { | |
| 1041 | - value: relativeTo, | |
| 1042 | - onChange: v => updateInteraction({ | |
| 1043 | - relativeTo: v | |
| 1044 | - }) | |
| 1045 | - }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Divider, null)), EasingControl && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, { | |
| 1046 | - container: true, | |
| 1047 | - spacing: 1.5 | |
| 1048 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_field__WEBPACK_IMPORTED_MODULE_10__.Field, { | |
| 1049 | - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Easing', 'elementor') | |
| 1050 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(EasingControl, { | |
| 1051 | - value: easing, | |
| 1052 | - onChange: v => { | |
| 1053 | - updateInteraction({ | |
| 1054 | - easing: v | |
| 1055 | - }); | |
| 1056 | - } | |
| 1057 | - })))); | |
| 1058 | -}; | |
| 1059 | - | |
| 1060 | -/***/ }), | |
| 1061 | - | |
| 1062 | -/***/ "./packages/packages/core/editor-interactions/src/components/interaction-settings.tsx": | |
| 1063 | -/*!********************************************************************************************!*\ | |
| 1064 | - !*** ./packages/packages/core/editor-interactions/src/components/interaction-settings.tsx ***! | |
| 1065 | - \********************************************************************************************/ | |
| 1066 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1067 | - | |
| 1068 | -__webpack_require__.r(__webpack_exports__); | |
| 1069 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1070 | -/* harmony export */ InteractionSettings: function() { return /* binding */ InteractionSettings; } | |
| 1071 | -/* harmony export */ }); | |
| 1072 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 1073 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 1074 | -/* harmony import */ var _elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-controls */ "@elementor/editor-controls"); | |
| 1075 | -/* harmony import */ var _elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__); | |
| 1076 | -/* harmony import */ var _elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/editor-responsive */ "@elementor/editor-responsive"); | |
| 1077 | -/* harmony import */ var _elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_2__); | |
| 1078 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 1079 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__); | |
| 1080 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 1081 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__); | |
| 1082 | -/* harmony import */ var _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/prop-value-utils */ "./packages/packages/core/editor-interactions/src/utils/prop-value-utils.ts"); | |
| 1083 | -function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } | |
| 1084 | - | |
| 1085 | - | |
| 1086 | - | |
| 1087 | - | |
| 1088 | - | |
| 1089 | - | |
| 1090 | - | |
| 1091 | -const SIZE = 'tiny'; | |
| 1092 | -const InteractionSettings = ({ | |
| 1093 | - interaction, | |
| 1094 | - onChange | |
| 1095 | -}) => { | |
| 1096 | - const breakpoints = (0,_elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_2__.useBreakpoints)(); | |
| 1097 | - const availableBreakpoints = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => breakpoints.map(breakpoint => ({ | |
| 1098 | - label: breakpoint.label, | |
| 1099 | - value: String(breakpoint.id) | |
| 1100 | - })), [breakpoints]); | |
| 1101 | - const [selectedBreakpoints, setSelectedBreakpoints] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(() => { | |
| 1102 | - const excluded = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_5__.extractExcludedBreakpoints)(interaction.breakpoints).filter(excludedBreakpoint => { | |
| 1103 | - return availableBreakpoints.some(({ | |
| 1104 | - value | |
| 1105 | - }) => value === excludedBreakpoint); | |
| 1106 | - }); | |
| 1107 | - return availableBreakpoints.filter(({ | |
| 1108 | - value | |
| 1109 | - }) => { | |
| 1110 | - return !excluded.includes(value); | |
| 1111 | - }); | |
| 1112 | - }); | |
| 1113 | - const handleBreakpointChange = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((_, newValue) => { | |
| 1114 | - setSelectedBreakpoints(newValue); | |
| 1115 | - const selectedValues = newValue.map(option => option.value); | |
| 1116 | - const newExcluded = availableBreakpoints.filter(breakpoint => !selectedValues.includes(breakpoint.value)).map(breakpoint => breakpoint.value); | |
| 1117 | - const updatedInteraction = { | |
| 1118 | - ...interaction, | |
| 1119 | - ...(newExcluded.length > 0 && { | |
| 1120 | - breakpoints: (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_5__.createInteractionBreakpoints)(newExcluded) | |
| 1121 | - }) | |
| 1122 | - }; | |
| 1123 | - if (newExcluded.length === 0) { | |
| 1124 | - delete updatedInteraction.breakpoints; | |
| 1125 | - } | |
| 1126 | - onChange(updatedInteraction); | |
| 1127 | - }, [interaction, availableBreakpoints, onChange]); | |
| 1128 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__.PopoverContent, { | |
| 1129 | - p: 1.5 | |
| 1130 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Grid, { | |
| 1131 | - container: true, | |
| 1132 | - spacing: 1.5 | |
| 1133 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Grid, { | |
| 1134 | - item: true, | |
| 1135 | - xs: 12 | |
| 1136 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Stack, { | |
| 1137 | - direction: "column", | |
| 1138 | - gap: 1 | |
| 1139 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__.ControlFormLabel, { | |
| 1140 | - sx: { | |
| 1141 | - width: '100%' | |
| 1142 | - } | |
| 1143 | - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Trigger on', 'elementor')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Autocomplete, { | |
| 1144 | - fullWidth: true, | |
| 1145 | - multiple: true, | |
| 1146 | - value: selectedBreakpoints, | |
| 1147 | - onChange: handleBreakpointChange, | |
| 1148 | - size: SIZE, | |
| 1149 | - options: availableBreakpoints, | |
| 1150 | - isOptionEqualToValue: (option, value) => option.value === value.value, | |
| 1151 | - renderInput: params => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.TextField, params), | |
| 1152 | - renderTags: (values, getTagProps) => values.map((option, index) => { | |
| 1153 | - const { | |
| 1154 | - key, | |
| 1155 | - ...chipProps | |
| 1156 | - } = getTagProps({ | |
| 1157 | - index | |
| 1158 | - }); | |
| 1159 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Chip, _extends({ | |
| 1160 | - key: key, | |
| 1161 | - size: SIZE, | |
| 1162 | - label: option.label | |
| 1163 | - }, chipProps)); | |
| 1164 | - }) | |
| 1165 | - }))))); | |
| 1166 | -}; | |
| 1167 | - | |
| 1168 | -/***/ }), | |
| 1169 | - | |
| 1170 | -/***/ "./packages/packages/core/editor-interactions/src/components/interactions-list-item.tsx": | |
| 1171 | -/*!**********************************************************************************************!*\ | |
| 1172 | - !*** ./packages/packages/core/editor-interactions/src/components/interactions-list-item.tsx ***! | |
| 1173 | - \**********************************************************************************************/ | |
| 1174 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1175 | - | |
| 1176 | -__webpack_require__.r(__webpack_exports__); | |
| 1177 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1178 | -/* harmony export */ InteractionsListItem: function() { return /* binding */ InteractionsListItem; } | |
| 1179 | -/* harmony export */ }); | |
| 1180 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 1181 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 1182 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 1183 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__); | |
| 1184 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 1185 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__); | |
| 1186 | -/* harmony import */ var _contexts_interactions_item_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../contexts/interactions-item-context */ "./packages/packages/core/editor-interactions/src/contexts/interactions-item-context.tsx"); | |
| 1187 | -/* harmony import */ var _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/prop-value-utils */ "./packages/packages/core/editor-interactions/src/utils/prop-value-utils.ts"); | |
| 1188 | -/* harmony import */ var _interaction_details__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./interaction-details */ "./packages/packages/core/editor-interactions/src/components/interaction-details.tsx"); | |
| 1189 | -/* harmony import */ var _interaction_settings__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./interaction-settings */ "./packages/packages/core/editor-interactions/src/components/interaction-settings.tsx"); | |
| 1190 | -function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } | |
| 1191 | - | |
| 1192 | - | |
| 1193 | - | |
| 1194 | - | |
| 1195 | - | |
| 1196 | - | |
| 1197 | - | |
| 1198 | - | |
| 1199 | -const InteractionsListItem = ({ | |
| 1200 | - index, | |
| 1201 | - value: interaction | |
| 1202 | -}) => { | |
| 1203 | - const { | |
| 1204 | - getTabsProps, | |
| 1205 | - getTabProps, | |
| 1206 | - getTabPanelProps | |
| 1207 | - } = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.useTabs)('details'); | |
| 1208 | - const context = (0,_contexts_interactions_item_context__WEBPACK_IMPORTED_MODULE_3__.useInteractionItemContext)(); | |
| 1209 | - const handleChange = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(newInteractionValue => { | |
| 1210 | - context?.onInteractionChange(index, newInteractionValue); | |
| 1211 | - }, [context, index]); | |
| 1212 | - const handlePlayInteraction = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(interactionId => { | |
| 1213 | - context?.onPlayInteraction(interactionId); | |
| 1214 | - }, [context]); | |
| 1215 | - const interactionId = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_4__.extractString)(interaction.value.interaction_id); | |
| 1216 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Tabs, _extends({ | |
| 1217 | - size: "small", | |
| 1218 | - variant: "fullWidth", | |
| 1219 | - "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Interaction', 'elementor') | |
| 1220 | - }, getTabsProps()), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Tab, _extends({ | |
| 1221 | - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Details', 'elementor') | |
| 1222 | - }, getTabProps('details'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Tab, _extends({ | |
| 1223 | - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Settings', 'elementor') | |
| 1224 | - }, getTabProps('settings')))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Divider, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.TabPanel, _extends({ | |
| 1225 | - sx: { | |
| 1226 | - p: 0 | |
| 1227 | - } | |
| 1228 | - }, getTabPanelProps('details')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_interaction_details__WEBPACK_IMPORTED_MODULE_5__.InteractionDetails, { | |
| 1229 | - key: interactionId, | |
| 1230 | - interaction: interaction.value, | |
| 1231 | - onChange: handleChange, | |
| 1232 | - onPlayInteraction: handlePlayInteraction | |
| 1233 | - })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.TabPanel, _extends({ | |
| 1234 | - sx: { | |
| 1235 | - p: 0 | |
| 1236 | - } | |
| 1237 | - }, getTabPanelProps('settings')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_interaction_settings__WEBPACK_IMPORTED_MODULE_6__.InteractionSettings, { | |
| 1238 | - key: interactionId, | |
| 1239 | - interaction: interaction.value, | |
| 1240 | - onChange: handleChange | |
| 1241 | - }))); | |
| 1242 | -}; | |
| 1243 | - | |
| 1244 | -/***/ }), | |
| 1245 | - | |
| 1246 | -/***/ "./packages/packages/core/editor-interactions/src/components/interactions-list.tsx": | |
| 1247 | -/*!*****************************************************************************************!*\ | |
| 1248 | - !*** ./packages/packages/core/editor-interactions/src/components/interactions-list.tsx ***! | |
| 1249 | - \*****************************************************************************************/ | |
| 1250 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1251 | - | |
| 1252 | -__webpack_require__.r(__webpack_exports__); | |
| 1253 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1254 | -/* harmony export */ InteractionsList: function() { return /* binding */ InteractionsList; }, | |
| 1255 | -/* harmony export */ MAX_NUMBER_OF_INTERACTIONS: function() { return /* binding */ MAX_NUMBER_OF_INTERACTIONS; } | |
| 1256 | -/* harmony export */ }); | |
| 1257 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 1258 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 1259 | -/* harmony import */ var _elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-controls */ "@elementor/editor-controls"); | |
| 1260 | -/* harmony import */ var _elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__); | |
| 1261 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons"); | |
| 1262 | -/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__); | |
| 1263 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 1264 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__); | |
| 1265 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 1266 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__); | |
| 1267 | -/* harmony import */ var _contexts_interactions_context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../contexts/interactions-context */ "./packages/packages/core/editor-interactions/src/contexts/interactions-context.tsx"); | |
| 1268 | -/* harmony import */ var _contexts_interactions_item_context__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../contexts/interactions-item-context */ "./packages/packages/core/editor-interactions/src/contexts/interactions-item-context.tsx"); | |
| 1269 | -/* harmony import */ var _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/prop-value-utils */ "./packages/packages/core/editor-interactions/src/utils/prop-value-utils.ts"); | |
| 1270 | -/* harmony import */ var _utils_scroll_interaction_event__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/scroll-interaction-event */ "./packages/packages/core/editor-interactions/src/utils/scroll-interaction-event.ts"); | |
| 1271 | -/* harmony import */ var _utils_tracking__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utils/tracking */ "./packages/packages/core/editor-interactions/src/utils/tracking.ts"); | |
| 1272 | -/* harmony import */ var _interaction_details__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./interaction-details */ "./packages/packages/core/editor-interactions/src/components/interaction-details.tsx"); | |
| 1273 | -/* harmony import */ var _interactions_list_item__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./interactions-list-item */ "./packages/packages/core/editor-interactions/src/components/interactions-list-item.tsx"); | |
| 1274 | - | |
| 1275 | - | |
| 1276 | - | |
| 1277 | - | |
| 1278 | - | |
| 1279 | - | |
| 1280 | - | |
| 1281 | - | |
| 1282 | - | |
| 1283 | - | |
| 1284 | - | |
| 1285 | - | |
| 1286 | - | |
| 1287 | -const MAX_NUMBER_OF_INTERACTIONS = 5; | |
| 1288 | -function InteractionsList(props) { | |
| 1289 | - const { | |
| 1290 | - interactions, | |
| 1291 | - onSelectInteractions, | |
| 1292 | - onPlayInteraction, | |
| 1293 | - triggerCreateOnShowEmpty | |
| 1294 | - } = props; | |
| 1295 | - const { | |
| 1296 | - elementId | |
| 1297 | - } = (0,_contexts_interactions_context__WEBPACK_IMPORTED_MODULE_5__.useInteractionsContext)(); | |
| 1298 | - const hasInitializedRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false); | |
| 1299 | - const newlyCreatedIdsRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(new Set()); | |
| 1300 | - const handleUpdateInteractions = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(newInteractions => { | |
| 1301 | - onSelectInteractions(newInteractions); | |
| 1302 | - }, [onSelectInteractions]); | |
| 1303 | - (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { | |
| 1304 | - if (triggerCreateOnShowEmpty && !hasInitializedRef.current && (!interactions.items || interactions.items?.length === 0)) { | |
| 1305 | - hasInitializedRef.current = true; | |
| 1306 | - const newItem = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_7__.createDefaultInteractionItem)(); | |
| 1307 | - newlyCreatedIdsRef.current.add((0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_7__.extractString)(newItem.value.interaction_id)); | |
| 1308 | - const newState = { | |
| 1309 | - version: 1, | |
| 1310 | - items: [newItem] | |
| 1311 | - }; | |
| 1312 | - handleUpdateInteractions(newState); | |
| 1313 | - } | |
| 1314 | - }, [triggerCreateOnShowEmpty, interactions.items, handleUpdateInteractions]); | |
| 1315 | - const isMaxNumberOfInteractionsReached = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { | |
| 1316 | - return interactions.items?.length >= MAX_NUMBER_OF_INTERACTIONS; | |
| 1317 | - }, [interactions.items?.length]); | |
| 1318 | - const infotipContent = isMaxNumberOfInteractionsReached ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Alert, { | |
| 1319 | - color: "secondary", | |
| 1320 | - icon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.InfoCircleFilledIcon, null), | |
| 1321 | - size: "small" | |
| 1322 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.AlertTitle, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Interactions', 'elementor')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Box, { | |
| 1323 | - component: "span" | |
| 1324 | - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)("You've reached the limit of 5 interactions for this element. Please remove an interaction before creating a new one.", 'elementor'))) : undefined; | |
| 1325 | - const handleRepeaterChange = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((newItems, _, meta) => { | |
| 1326 | - handleUpdateInteractions({ | |
| 1327 | - ...interactions, | |
| 1328 | - items: newItems | |
| 1329 | - }); | |
| 1330 | - if (meta?.action?.type === 'add') { | |
| 1331 | - const addedItem = meta.action.payload[0]?.item; | |
| 1332 | - if (addedItem) { | |
| 1333 | - newlyCreatedIdsRef.current.add((0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_7__.extractString)(addedItem.value.interaction_id)); | |
| 1334 | - } | |
| 1335 | - } | |
| 1336 | - }, [interactions, handleUpdateInteractions]); | |
| 1337 | - const handleInteractionChange = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((index, newInteractionValue) => { | |
| 1338 | - const newItems = structuredClone(interactions.items); | |
| 1339 | - newItems[index] = { | |
| 1340 | - $$type: 'interaction-item', | |
| 1341 | - value: newInteractionValue | |
| 1342 | - }; | |
| 1343 | - handleUpdateInteractions({ | |
| 1344 | - ...interactions, | |
| 1345 | - items: newItems | |
| 1346 | - }); | |
| 1347 | - }, [interactions, handleUpdateInteractions]); | |
| 1348 | - const contextValue = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({ | |
| 1349 | - onInteractionChange: handleInteractionChange, | |
| 1350 | - onPlayInteraction | |
| 1351 | - }), [handleInteractionChange, onPlayInteraction]); | |
| 1352 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_contexts_interactions_item_context__WEBPACK_IMPORTED_MODULE_6__.InteractionItemContextProvider, { | |
| 1353 | - value: contextValue | |
| 1354 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__.Repeater, { | |
| 1355 | - openOnAdd: true, | |
| 1356 | - openItem: triggerCreateOnShowEmpty ? 0 : undefined, | |
| 1357 | - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Interactions', 'elementor'), | |
| 1358 | - values: interactions.items, | |
| 1359 | - setValues: handleRepeaterChange, | |
| 1360 | - showDuplicate: false, | |
| 1361 | - showToggle: false, | |
| 1362 | - isSortable: false, | |
| 1363 | - disableAddItemButton: isMaxNumberOfInteractionsReached, | |
| 1364 | - addButtonInfotipContent: infotipContent, | |
| 1365 | - itemSettings: { | |
| 1366 | - initialValues: (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_7__.createDefaultInteractionItem)(), | |
| 1367 | - Label: ({ | |
| 1368 | - value | |
| 1369 | - }) => (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_7__.buildDisplayLabel)(value.value), | |
| 1370 | - Icon: () => null, | |
| 1371 | - Content: _interactions_list_item__WEBPACK_IMPORTED_MODULE_11__.InteractionsListItem, | |
| 1372 | - onPopoverOpen: value => { | |
| 1373 | - const { | |
| 1374 | - trigger, | |
| 1375 | - start, | |
| 1376 | - end, | |
| 1377 | - relativeTo | |
| 1378 | - } = (0,_utils_scroll_interaction_event__WEBPACK_IMPORTED_MODULE_8__.extractScrollOverlayParams)(value.value, _interaction_details__WEBPACK_IMPORTED_MODULE_10__.DEFAULT_VALUES); | |
| 1379 | - (0,_utils_scroll_interaction_event__WEBPACK_IMPORTED_MODULE_8__.syncGridOverlay)(trigger, start, end, relativeTo); | |
| 1380 | - }, | |
| 1381 | - onPopoverClose: value => { | |
| 1382 | - (0,_utils_scroll_interaction_event__WEBPACK_IMPORTED_MODULE_8__.dispatchScrollInteraction)(null); | |
| 1383 | - const id = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_7__.extractString)(value.value.interaction_id); | |
| 1384 | - if (newlyCreatedIdsRef.current.has(id)) { | |
| 1385 | - newlyCreatedIdsRef.current.delete(id); | |
| 1386 | - (0,_utils_tracking__WEBPACK_IMPORTED_MODULE_9__.trackInteractionCreated)(elementId, value); | |
| 1387 | - } | |
| 1388 | - }, | |
| 1389 | - actions: value => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Tooltip, { | |
| 1390 | - key: "preview", | |
| 1391 | - placement: "top", | |
| 1392 | - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Preview', 'elementor') | |
| 1393 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.IconButton, { | |
| 1394 | - "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Play interaction', 'elementor'), | |
| 1395 | - size: "tiny", | |
| 1396 | - onClick: () => onPlayInteraction((0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_7__.extractString)(value.value.interaction_id)) | |
| 1397 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.PlayerPlayIcon, { | |
| 1398 | - fontSize: "tiny" | |
| 1399 | - }))) | |
| 1400 | - } | |
| 1401 | - })); | |
| 1402 | -} | |
| 1403 | - | |
| 1404 | -/***/ }), | |
| 1405 | - | |
| 1406 | -/***/ "./packages/packages/core/editor-interactions/src/components/interactions-tab.tsx": | |
| 1407 | -/*!****************************************************************************************!*\ | |
| 1408 | - !*** ./packages/packages/core/editor-interactions/src/components/interactions-tab.tsx ***! | |
| 1409 | - \****************************************************************************************/ | |
| 1410 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1411 | - | |
| 1412 | -__webpack_require__.r(__webpack_exports__); | |
| 1413 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1414 | -/* harmony export */ InteractionsTab: function() { return /* binding */ InteractionsTab; } | |
| 1415 | -/* harmony export */ }); | |
| 1416 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 1417 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 1418 | -/* harmony import */ var _elementor_session__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/session */ "@elementor/session"); | |
| 1419 | -/* harmony import */ var _elementor_session__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_session__WEBPACK_IMPORTED_MODULE_1__); | |
| 1420 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 1421 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__); | |
| 1422 | -/* harmony import */ var _contexts_interactions_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../contexts/interactions-context */ "./packages/packages/core/editor-interactions/src/contexts/interactions-context.tsx"); | |
| 1423 | -/* harmony import */ var _contexts_popup_state_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../contexts/popup-state-context */ "./packages/packages/core/editor-interactions/src/contexts/popup-state-context.tsx"); | |
| 1424 | -/* harmony import */ var _hooks_use_element_interactions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../hooks/use-element-interactions */ "./packages/packages/core/editor-interactions/src/hooks/use-element-interactions.ts"); | |
| 1425 | -/* harmony import */ var _empty_state__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./empty-state */ "./packages/packages/core/editor-interactions/src/components/empty-state.tsx"); | |
| 1426 | -/* harmony import */ var _interactions_list__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./interactions-list */ "./packages/packages/core/editor-interactions/src/components/interactions-list.tsx"); | |
| 1427 | - | |
| 1428 | - | |
| 1429 | - | |
| 1430 | - | |
| 1431 | - | |
| 1432 | - | |
| 1433 | - | |
| 1434 | - | |
| 1435 | - | |
| 1436 | -const InteractionsTab = ({ | |
| 1437 | - elementId | |
| 1438 | -}) => { | |
| 1439 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_contexts_popup_state_context__WEBPACK_IMPORTED_MODULE_4__.PopupStateProvider, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(InteractionsTabContent, { | |
| 1440 | - elementId: elementId | |
| 1441 | - })); | |
| 1442 | -}; | |
| 1443 | -function InteractionsTabContent({ | |
| 1444 | - elementId | |
| 1445 | -}) { | |
| 1446 | - const existingInteractions = (0,_hooks_use_element_interactions__WEBPACK_IMPORTED_MODULE_5__.useElementInteractions)(elementId); | |
| 1447 | - const firstInteractionState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false); | |
| 1448 | - const hasInteractions = existingInteractions?.items?.length || firstInteractionState[0]; | |
| 1449 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_session__WEBPACK_IMPORTED_MODULE_1__.SessionStorageProvider, { | |
| 1450 | - prefix: elementId | |
| 1451 | - }, hasInteractions ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_contexts_interactions_context__WEBPACK_IMPORTED_MODULE_3__.InteractionsProvider, { | |
| 1452 | - elementId: elementId | |
| 1453 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(InteractionsContent, { | |
| 1454 | - firstInteractionState: firstInteractionState | |
| 1455 | - })) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_empty_state__WEBPACK_IMPORTED_MODULE_6__.EmptyState, { | |
| 1456 | - onCreateInteraction: () => { | |
| 1457 | - firstInteractionState[1](true); | |
| 1458 | - } | |
| 1459 | - })); | |
| 1460 | -} | |
| 1461 | -function InteractionsContent({ | |
| 1462 | - firstInteractionState | |
| 1463 | -}) { | |
| 1464 | - const { | |
| 1465 | - interactions, | |
| 1466 | - setInteractions, | |
| 1467 | - playInteractions | |
| 1468 | - } = (0,_contexts_interactions_context__WEBPACK_IMPORTED_MODULE_3__.useInteractionsContext)(); | |
| 1469 | - const applyInteraction = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(newInteractions => { | |
| 1470 | - firstInteractionState[1](false); | |
| 1471 | - if (!newInteractions) { | |
| 1472 | - setInteractions(undefined); | |
| 1473 | - return; | |
| 1474 | - } | |
| 1475 | - setInteractions(newInteractions); | |
| 1476 | - }, [setInteractions, firstInteractionState]); | |
| 1477 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Stack, { | |
| 1478 | - sx: { | |
| 1479 | - m: 1, | |
| 1480 | - p: 1.5 | |
| 1481 | - }, | |
| 1482 | - gap: 2 | |
| 1483 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_interactions_list__WEBPACK_IMPORTED_MODULE_7__.InteractionsList, { | |
| 1484 | - triggerCreateOnShowEmpty: firstInteractionState[0], | |
| 1485 | - interactions: interactions, | |
| 1486 | - onSelectInteractions: applyInteraction, | |
| 1487 | - onPlayInteraction: playInteractions | |
| 1488 | - })); | |
| 1489 | -} | |
| 1490 | - | |
| 1491 | -/***/ }), | |
| 1492 | - | |
| 1493 | -/***/ "./packages/packages/core/editor-interactions/src/configs/time-constants.ts": | |
| 1494 | -/*!**********************************************************************************!*\ | |
| 1495 | - !*** ./packages/packages/core/editor-interactions/src/configs/time-constants.ts ***! | |
| 1496 | - \**********************************************************************************/ | |
| 1497 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1498 | - | |
| 1499 | -__webpack_require__.r(__webpack_exports__); | |
| 1500 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1501 | -/* harmony export */ DEFAULT_TIME_UNIT: function() { return /* binding */ DEFAULT_TIME_UNIT; }, | |
| 1502 | -/* harmony export */ TIME_UNITS: function() { return /* binding */ TIME_UNITS; } | |
| 1503 | -/* harmony export */ }); | |
| 1504 | -const TIME_UNITS = ['s', 'ms']; | |
| 1505 | -const DEFAULT_TIME_UNIT = 'ms'; | |
| 1506 | - | |
| 1507 | -/***/ }), | |
| 1508 | - | |
| 1509 | -/***/ "./packages/packages/core/editor-interactions/src/contexts/interactions-context.tsx": | |
| 1510 | -/*!******************************************************************************************!*\ | |
| 1511 | - !*** ./packages/packages/core/editor-interactions/src/contexts/interactions-context.tsx ***! | |
| 1512 | - \******************************************************************************************/ | |
| 1513 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1514 | - | |
| 1515 | -__webpack_require__.r(__webpack_exports__); | |
| 1516 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1517 | -/* harmony export */ InteractionsProvider: function() { return /* binding */ InteractionsProvider; }, | |
| 1518 | -/* harmony export */ useInteractionsContext: function() { return /* binding */ useInteractionsContext; } | |
| 1519 | -/* harmony export */ }); | |
| 1520 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 1521 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 1522 | -/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-elements */ "@elementor/editor-elements"); | |
| 1523 | -/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__); | |
| 1524 | -/* harmony import */ var _elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/editor-v1-adapters */ "@elementor/editor-v1-adapters"); | |
| 1525 | -/* harmony import */ var _elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_2__); | |
| 1526 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 1527 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); | |
| 1528 | -/* harmony import */ var _hooks_use_element_interactions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../hooks/use-element-interactions */ "./packages/packages/core/editor-interactions/src/hooks/use-element-interactions.ts"); | |
| 1529 | - | |
| 1530 | - | |
| 1531 | - | |
| 1532 | - | |
| 1533 | - | |
| 1534 | - | |
| 1535 | -const InteractionsContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(null); | |
| 1536 | -const DEFAULT_INTERACTIONS = { | |
| 1537 | - version: 1, | |
| 1538 | - items: [] | |
| 1539 | -}; | |
| 1540 | -const InteractionsProvider = ({ | |
| 1541 | - children, | |
| 1542 | - elementId | |
| 1543 | -}) => { | |
| 1544 | - const rawInteractions = (0,_hooks_use_element_interactions__WEBPACK_IMPORTED_MODULE_4__.useElementInteractions)(elementId); | |
| 1545 | - (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { | |
| 1546 | - window.dispatchEvent(new CustomEvent('elementor/element/update_interactions')); | |
| 1547 | - }, []); | |
| 1548 | - const interactions = rawInteractions ?? DEFAULT_INTERACTIONS; | |
| 1549 | - const undoableSetInteractions = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => (0,_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_2__.undoable)({ | |
| 1550 | - do: ({ | |
| 1551 | - interactions: newInteractions | |
| 1552 | - }) => { | |
| 1553 | - const previous = (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__.getElementInteractions)(elementId); | |
| 1554 | - (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__.updateElementInteractions)({ | |
| 1555 | - elementId, | |
| 1556 | - interactions: newInteractions | |
| 1557 | - }); | |
| 1558 | - return previous; | |
| 1559 | - }, | |
| 1560 | - undo: (_, previous) => { | |
| 1561 | - (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__.updateElementInteractions)({ | |
| 1562 | - elementId, | |
| 1563 | - interactions: previous?.items?.length ? previous : undefined | |
| 1564 | - }); | |
| 1565 | - } | |
| 1566 | - }, { | |
| 1567 | - title: (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__.getElementLabel)(elementId), | |
| 1568 | - subtitle: ({ | |
| 1569 | - operationType | |
| 1570 | - }) => operationType === 'apply' ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Interaction Applied', 'elementor') : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Interaction Deleted', 'elementor') | |
| 1571 | - }), [elementId]); | |
| 1572 | - const setInteractions = value => { | |
| 1573 | - const normalizedValue = value && value.items?.length === 0 ? undefined : value; | |
| 1574 | - const prevItemCount = interactions.items?.length ?? 0; | |
| 1575 | - const newItemCount = normalizedValue?.items?.length ?? 0; | |
| 1576 | - if (newItemCount > prevItemCount) { | |
| 1577 | - undoableSetInteractions({ | |
| 1578 | - interactions: normalizedValue, | |
| 1579 | - operationType: 'apply' | |
| 1580 | - }); | |
| 1581 | - } else if (newItemCount < prevItemCount) { | |
| 1582 | - undoableSetInteractions({ | |
| 1583 | - interactions: normalizedValue, | |
| 1584 | - operationType: 'delete' | |
| 1585 | - }); | |
| 1586 | - } else { | |
| 1587 | - (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__.updateElementInteractions)({ | |
| 1588 | - elementId, | |
| 1589 | - interactions: normalizedValue | |
| 1590 | - }); | |
| 1591 | - } | |
| 1592 | - }; | |
| 1593 | - const playInteractions = interactionId => { | |
| 1594 | - (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__.playElementInteractions)(elementId, interactionId); | |
| 1595 | - }; | |
| 1596 | - const contextValue = { | |
| 1597 | - elementId, | |
| 1598 | - interactions, | |
| 1599 | - setInteractions, | |
| 1600 | - playInteractions | |
| 1601 | - }; | |
| 1602 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(InteractionsContext.Provider, { | |
| 1603 | - value: contextValue | |
| 1604 | - }, children); | |
| 1605 | -}; | |
| 1606 | -const useInteractionsContext = () => { | |
| 1607 | - const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(InteractionsContext); | |
| 1608 | - if (!context) { | |
| 1609 | - throw new Error('useInteractionsContext must be used within InteractionsProvider'); | |
| 1610 | - } | |
| 1611 | - return context; | |
| 1612 | -}; | |
| 1613 | - | |
| 1614 | -/***/ }), | |
| 1615 | - | |
| 1616 | -/***/ "./packages/packages/core/editor-interactions/src/contexts/interactions-item-context.tsx": | |
| 1617 | -/*!***********************************************************************************************!*\ | |
| 1618 | - !*** ./packages/packages/core/editor-interactions/src/contexts/interactions-item-context.tsx ***! | |
| 1619 | - \***********************************************************************************************/ | |
| 1620 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1621 | - | |
| 1622 | -__webpack_require__.r(__webpack_exports__); | |
| 1623 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1624 | -/* harmony export */ InteractionItemContextProvider: function() { return /* binding */ InteractionItemContextProvider; }, | |
| 1625 | -/* harmony export */ useInteractionItemContext: function() { return /* binding */ useInteractionItemContext; } | |
| 1626 | -/* harmony export */ }); | |
| 1627 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 1628 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 1629 | - | |
| 1630 | - | |
| 1631 | -const InteractionItemContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(null); | |
| 1632 | -function InteractionItemContextProvider({ | |
| 1633 | - value, | |
| 1634 | - children | |
| 1635 | -}) { | |
| 1636 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(InteractionItemContext.Provider, { | |
| 1637 | - value: value | |
| 1638 | - }, children); | |
| 1639 | -} | |
| 1640 | -function useInteractionItemContext() { | |
| 1641 | - const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(InteractionItemContext); | |
| 1642 | - if (!context) { | |
| 1643 | - throw new Error('useInteractionItemContext must be used within InteractionItemContextProvider'); | |
| 1644 | - } | |
| 1645 | - return context; | |
| 1646 | -} | |
| 1647 | - | |
| 1648 | -/***/ }), | |
| 1649 | - | |
| 1650 | -/***/ "./packages/packages/core/editor-interactions/src/contexts/popup-state-context.tsx": | |
| 1651 | -/*!*****************************************************************************************!*\ | |
| 1652 | - !*** ./packages/packages/core/editor-interactions/src/contexts/popup-state-context.tsx ***! | |
| 1653 | - \*****************************************************************************************/ | |
| 1654 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1655 | - | |
| 1656 | -__webpack_require__.r(__webpack_exports__); | |
| 1657 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1658 | -/* harmony export */ PopupStateProvider: function() { return /* binding */ PopupStateProvider; }, | |
| 1659 | -/* harmony export */ usePopupStateContext: function() { return /* binding */ usePopupStateContext; } | |
| 1660 | -/* harmony export */ }); | |
| 1661 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 1662 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 1663 | - | |
| 1664 | - | |
| 1665 | -const PopupStateContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(undefined); | |
| 1666 | -const PopupStateProvider = ({ | |
| 1667 | - children | |
| 1668 | -}) => { | |
| 1669 | - const [openByDefault, setOpenByDefault] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false); | |
| 1670 | - const triggerDefaultOpen = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => { | |
| 1671 | - setOpenByDefault(true); | |
| 1672 | - }, []); | |
| 1673 | - const resetDefaultOpen = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => { | |
| 1674 | - setOpenByDefault(false); | |
| 1675 | - }, []); | |
| 1676 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(PopupStateContext.Provider, { | |
| 1677 | - value: { | |
| 1678 | - openByDefault, | |
| 1679 | - triggerDefaultOpen, | |
| 1680 | - resetDefaultOpen | |
| 1681 | - } | |
| 1682 | - }, children); | |
| 1683 | -}; | |
| 1684 | -const usePopupStateContext = () => { | |
| 1685 | - const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(PopupStateContext); | |
| 1686 | - if (!context) { | |
| 1687 | - throw new Error('usePopupStateContext must be used within PopupStateProvider'); | |
| 1688 | - } | |
| 1689 | - return context; | |
| 1690 | -}; | |
| 1691 | - | |
| 1692 | -/***/ }), | |
| 1693 | - | |
| 1694 | -/***/ "./packages/packages/core/editor-interactions/src/hooks/on-duplicate.ts": | |
| 1695 | -/*!******************************************************************************!*\ | |
| 1696 | - !*** ./packages/packages/core/editor-interactions/src/hooks/on-duplicate.ts ***! | |
| 1697 | - \******************************************************************************/ | |
| 1698 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1699 | - | |
| 1700 | -__webpack_require__.r(__webpack_exports__); | |
| 1701 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1702 | -/* harmony export */ initCleanInteractionIdsOnDuplicate: function() { return /* binding */ initCleanInteractionIdsOnDuplicate; } | |
| 1703 | -/* harmony export */ }); | |
| 1704 | -/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/editor-elements */ "@elementor/editor-elements"); | |
| 1705 | -/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__); | |
| 1706 | -/* harmony import */ var _elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-v1-adapters */ "@elementor/editor-v1-adapters"); | |
| 1707 | -/* harmony import */ var _elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1__); | |
| 1708 | -/* harmony import */ var _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/prop-value-utils */ "./packages/packages/core/editor-interactions/src/utils/prop-value-utils.ts"); | |
| 1709 | -/* harmony import */ var _utils_temp_id_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/temp-id-utils */ "./packages/packages/core/editor-interactions/src/utils/temp-id-utils.ts"); | |
| 1710 | - | |
| 1711 | - | |
| 1712 | - | |
| 1713 | - | |
| 1714 | -function initCleanInteractionIdsOnDuplicate() { | |
| 1715 | - (0,_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1__.registerDataHook)('after', 'document/elements/duplicate', (_args, result) => { | |
| 1716 | - if (!result || typeof result === 'boolean' && result === false) { | |
| 1717 | - return; | |
| 1718 | - } | |
| 1719 | - const containers = Array.isArray(result) ? result : [result]; | |
| 1720 | - containers.forEach(container => { | |
| 1721 | - cleanInteractionIdsRecursive(container.id); | |
| 1722 | - }); | |
| 1723 | - window.dispatchEvent(new CustomEvent('elementor/element/update_interactions')); | |
| 1724 | - }); | |
| 1725 | -} | |
| 1726 | -function cleanInteractionIdsRecursive(elementId) { | |
| 1727 | - const container = (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__.getContainer)(elementId); | |
| 1728 | - if (!container) { | |
| 1729 | - return; | |
| 1730 | - } | |
| 1731 | - (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__.getAllDescendants)(container).forEach(element => { | |
| 1732 | - cleanInteractionIds(element.id); | |
| 1733 | - }); | |
| 1734 | -} | |
| 1735 | -function cleanInteractionIds(elementId) { | |
| 1736 | - const container = (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__.getContainer)(elementId); | |
| 1737 | - if (!container) { | |
| 1738 | - return; | |
| 1739 | - } | |
| 1740 | - const interactions = container.model.get('interactions'); | |
| 1741 | - if (!interactions || !interactions.items) { | |
| 1742 | - return; | |
| 1743 | - } | |
| 1744 | - const updatedInteractions = structuredClone(interactions); | |
| 1745 | - updatedInteractions?.items?.forEach(interaction => { | |
| 1746 | - if (interaction.$$type === 'interaction-item' && interaction.value) { | |
| 1747 | - interaction.value.interaction_id = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_2__.createString)((0,_utils_temp_id_utils__WEBPACK_IMPORTED_MODULE_3__.generateTempInteractionId)()); | |
| 1748 | - } | |
| 1749 | - }); | |
| 1750 | - container.model.set('interactions', updatedInteractions); | |
| 1751 | -} | |
| 1752 | - | |
| 1753 | -/***/ }), | |
| 1754 | - | |
| 1755 | -/***/ "./packages/packages/core/editor-interactions/src/hooks/use-element-interactions.ts": | |
| 1756 | -/*!******************************************************************************************!*\ | |
| 1757 | - !*** ./packages/packages/core/editor-interactions/src/hooks/use-element-interactions.ts ***! | |
| 1758 | - \******************************************************************************************/ | |
| 1759 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1760 | - | |
| 1761 | -__webpack_require__.r(__webpack_exports__); | |
| 1762 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1763 | -/* harmony export */ useElementInteractions: function() { return /* binding */ useElementInteractions; } | |
| 1764 | -/* harmony export */ }); | |
| 1765 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 1766 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 1767 | -/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-elements */ "@elementor/editor-elements"); | |
| 1768 | -/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__); | |
| 1769 | -/* harmony import */ var _elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/editor-v1-adapters */ "@elementor/editor-v1-adapters"); | |
| 1770 | -/* harmony import */ var _elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_2__); | |
| 1771 | -/* harmony import */ var _utils_filter_interactions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/filter-interactions */ "./packages/packages/core/editor-interactions/src/utils/filter-interactions.ts"); | |
| 1772 | - | |
| 1773 | - | |
| 1774 | - | |
| 1775 | - | |
| 1776 | -const useElementInteractions = elementId => { | |
| 1777 | - const [interactions, setInteractions] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(() => { | |
| 1778 | - const initial = (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__.getElementInteractions)(elementId); | |
| 1779 | - const filteredInteractions = (0,_utils_filter_interactions__WEBPACK_IMPORTED_MODULE_3__.filterInteractions)(initial?.items ?? []); | |
| 1780 | - return { | |
| 1781 | - version: initial?.version ?? 1, | |
| 1782 | - items: filteredInteractions | |
| 1783 | - }; | |
| 1784 | - }); | |
| 1785 | - (0,_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_2__.__privateUseListenTo)((0,_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_2__.windowEvent)('elementor/element/update_interactions'), () => { | |
| 1786 | - const newInteractions = (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__.getElementInteractions)(elementId); | |
| 1787 | - const filteredInteractions = (0,_utils_filter_interactions__WEBPACK_IMPORTED_MODULE_3__.filterInteractions)(newInteractions?.items ?? []); | |
| 1788 | - setInteractions({ | |
| 1789 | - version: newInteractions?.version ?? 1, | |
| 1790 | - items: filteredInteractions | |
| 1791 | - }); | |
| 1792 | - }, [elementId]); | |
| 1793 | - return interactions; | |
| 1794 | -}; | |
| 1795 | - | |
| 1796 | -/***/ }), | |
| 1797 | - | |
| 1798 | -/***/ "./packages/packages/core/editor-interactions/src/init.ts": | |
| 1799 | -/*!****************************************************************!*\ | |
| 1800 | - !*** ./packages/packages/core/editor-interactions/src/init.ts ***! | |
| 1801 | - \****************************************************************/ | |
| 1802 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1803 | - | |
| 1804 | -__webpack_require__.r(__webpack_exports__); | |
| 1805 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1806 | -/* harmony export */ init: function() { return /* binding */ init; } | |
| 1807 | -/* harmony export */ }); | |
| 1808 | -/* harmony import */ var _elementor_editor_mcp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/editor-mcp */ "@elementor/editor-mcp"); | |
| 1809 | -/* harmony import */ var _elementor_editor_mcp__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_mcp__WEBPACK_IMPORTED_MODULE_0__); | |
| 1810 | -/* harmony import */ var _commands_paste_interactions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./commands/paste-interactions */ "./packages/packages/core/editor-interactions/src/commands/paste-interactions.ts"); | |
| 1811 | -/* harmony import */ var _components_controls_direction__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/controls/direction */ "./packages/packages/core/editor-interactions/src/components/controls/direction.tsx"); | |
| 1812 | -/* harmony import */ var _components_controls_easing__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/controls/easing */ "./packages/packages/core/editor-interactions/src/components/controls/easing.tsx"); | |
| 1813 | -/* harmony import */ var _components_controls_effect__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/controls/effect */ "./packages/packages/core/editor-interactions/src/components/controls/effect.tsx"); | |
| 1814 | -/* harmony import */ var _components_controls_effect_type__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/controls/effect-type */ "./packages/packages/core/editor-interactions/src/components/controls/effect-type.tsx"); | |
| 1815 | -/* harmony import */ var _components_controls_repeat__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/controls/repeat */ "./packages/packages/core/editor-interactions/src/components/controls/repeat.tsx"); | |
| 1816 | -/* harmony import */ var _components_controls_replay__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./components/controls/replay */ "./packages/packages/core/editor-interactions/src/components/controls/replay.tsx"); | |
| 1817 | -/* harmony import */ var _components_controls_trigger__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./components/controls/trigger */ "./packages/packages/core/editor-interactions/src/components/controls/trigger.tsx"); | |
| 1818 | -/* harmony import */ var _hooks_on_duplicate__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./hooks/on-duplicate */ "./packages/packages/core/editor-interactions/src/hooks/on-duplicate.ts"); | |
| 1819 | -/* harmony import */ var _interactions_controls_registry__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./interactions-controls-registry */ "./packages/packages/core/editor-interactions/src/interactions-controls-registry.ts"); | |
| 1820 | -/* harmony import */ var _interactions_repository__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./interactions-repository */ "./packages/packages/core/editor-interactions/src/interactions-repository.ts"); | |
| 1821 | -/* harmony import */ var _mcp__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./mcp */ "./packages/packages/core/editor-interactions/src/mcp/index.ts"); | |
| 1822 | -/* harmony import */ var _providers_document_elements_interactions_provider__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./providers/document-elements-interactions-provider */ "./packages/packages/core/editor-interactions/src/providers/document-elements-interactions-provider.ts"); | |
| 1823 | - | |
| 1824 | - | |
| 1825 | - | |
| 1826 | - | |
| 1827 | - | |
| 1828 | - | |
| 1829 | - | |
| 1830 | - | |
| 1831 | - | |
| 1832 | - | |
| 1833 | - | |
| 1834 | - | |
| 1835 | - | |
| 1836 | - | |
| 1837 | -function init() { | |
| 1838 | - try { | |
| 1839 | - _interactions_repository__WEBPACK_IMPORTED_MODULE_11__.interactionsRepository.register(_providers_document_elements_interactions_provider__WEBPACK_IMPORTED_MODULE_13__.documentElementsInteractionsProvider); | |
| 1840 | - (0,_hooks_on_duplicate__WEBPACK_IMPORTED_MODULE_9__.initCleanInteractionIdsOnDuplicate)(); | |
| 1841 | - (0,_commands_paste_interactions__WEBPACK_IMPORTED_MODULE_1__.initPasteInteractionsCommand)(); | |
| 1842 | - (0,_interactions_controls_registry__WEBPACK_IMPORTED_MODULE_10__.registerInteractionsControl)({ | |
| 1843 | - type: 'trigger', | |
| 1844 | - component: _components_controls_trigger__WEBPACK_IMPORTED_MODULE_8__.Trigger, | |
| 1845 | - options: ['load', 'scrollIn'] | |
| 1846 | - }); | |
| 1847 | - (0,_interactions_controls_registry__WEBPACK_IMPORTED_MODULE_10__.registerInteractionsControl)({ | |
| 1848 | - type: 'easing', | |
| 1849 | - component: _components_controls_easing__WEBPACK_IMPORTED_MODULE_3__.Easing, | |
| 1850 | - options: ['easeIn'] | |
| 1851 | - }); | |
| 1852 | - (0,_interactions_controls_registry__WEBPACK_IMPORTED_MODULE_10__.registerInteractionsControl)({ | |
| 1853 | - type: 'replay', | |
| 1854 | - component: _components_controls_replay__WEBPACK_IMPORTED_MODULE_7__.Replay, | |
| 1855 | - options: ['no'] | |
| 1856 | - }); | |
| 1857 | - (0,_interactions_controls_registry__WEBPACK_IMPORTED_MODULE_10__.registerInteractionsControl)({ | |
| 1858 | - type: 'effectType', | |
| 1859 | - component: _components_controls_effect_type__WEBPACK_IMPORTED_MODULE_5__.EffectType, | |
| 1860 | - options: ['in', 'out'] | |
| 1861 | - }); | |
| 1862 | - (0,_interactions_controls_registry__WEBPACK_IMPORTED_MODULE_10__.registerInteractionsControl)({ | |
| 1863 | - type: 'direction', | |
| 1864 | - component: _components_controls_direction__WEBPACK_IMPORTED_MODULE_2__.Direction, | |
| 1865 | - options: ['top', 'bottom', 'left', 'right'] | |
| 1866 | - }); | |
| 1867 | - (0,_interactions_controls_registry__WEBPACK_IMPORTED_MODULE_10__.registerInteractionsControl)({ | |
| 1868 | - type: 'effect', | |
| 1869 | - component: _components_controls_effect__WEBPACK_IMPORTED_MODULE_4__.Effect, | |
| 1870 | - options: ['fade', 'slide', 'scale'] | |
| 1871 | - }); | |
| 1872 | - (0,_interactions_controls_registry__WEBPACK_IMPORTED_MODULE_10__.registerInteractionsControl)({ | |
| 1873 | - type: 'repeat', | |
| 1874 | - component: _components_controls_repeat__WEBPACK_IMPORTED_MODULE_6__.Repeat | |
| 1875 | - }); | |
| 1876 | - (0,_mcp__WEBPACK_IMPORTED_MODULE_12__.initMcpInteractions)((0,_elementor_editor_mcp__WEBPACK_IMPORTED_MODULE_0__.getMCPByDomain)('interactions', { | |
| 1877 | - docs: _mcp__WEBPACK_IMPORTED_MODULE_12__.EDITOR_INTERACTIONS_MCP_DESCRIPTION, | |
| 1878 | - instructions: _mcp__WEBPACK_IMPORTED_MODULE_12__.EDITOR_INTERACTIONS_MCP_SHORT_DESCRIPTION | |
| 1879 | - })); | |
| 1880 | - } catch (error) { | |
| 1881 | - throw error; | |
| 1882 | - } | |
| 1883 | -} | |
| 1884 | - | |
| 1885 | -/***/ }), | |
| 1886 | - | |
| 1887 | -/***/ "./packages/packages/core/editor-interactions/src/interactions-controls-registry.ts": | |
| 1888 | -/*!******************************************************************************************!*\ | |
| 1889 | - !*** ./packages/packages/core/editor-interactions/src/interactions-controls-registry.ts ***! | |
| 1890 | - \******************************************************************************************/ | |
| 1891 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1892 | - | |
| 1893 | -__webpack_require__.r(__webpack_exports__); | |
| 1894 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1895 | -/* harmony export */ getInteractionsControl: function() { return /* binding */ getInteractionsControl; }, | |
| 1896 | -/* harmony export */ getInteractionsControlOptions: function() { return /* binding */ getInteractionsControlOptions; }, | |
| 1897 | -/* harmony export */ registerInteractionsControl: function() { return /* binding */ registerInteractionsControl; } | |
| 1898 | -/* harmony export */ }); | |
| 1899 | -const controlsRegistry = new Map(); | |
| 1900 | -function registerInteractionsControl({ | |
| 1901 | - type, | |
| 1902 | - component, | |
| 1903 | - options | |
| 1904 | -}) { | |
| 1905 | - controlsRegistry.set(type, { | |
| 1906 | - type, | |
| 1907 | - component: component, | |
| 1908 | - options | |
| 1909 | - }); | |
| 1910 | -} | |
| 1911 | -function getInteractionsControl(type) { | |
| 1912 | - return controlsRegistry.get(type); | |
| 1913 | -} | |
| 1914 | -function getInteractionsControlOptions(type) { | |
| 1915 | - return controlsRegistry.get(type)?.options ?? []; | |
| 1916 | -} | |
| 1917 | - | |
| 1918 | -/***/ }), | |
| 1919 | - | |
| 1920 | -/***/ "./packages/packages/core/editor-interactions/src/interactions-repository.ts": | |
| 1921 | -/*!***********************************************************************************!*\ | |
| 1922 | - !*** ./packages/packages/core/editor-interactions/src/interactions-repository.ts ***! | |
| 1923 | - \***********************************************************************************/ | |
| 1924 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1925 | - | |
| 1926 | -__webpack_require__.r(__webpack_exports__); | |
| 1927 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1928 | -/* harmony export */ interactionsRepository: function() { return /* binding */ interactionsRepository; } | |
| 1929 | -/* harmony export */ }); | |
| 1930 | -/* harmony import */ var _utils_create_interactions_repository__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/create-interactions-repository */ "./packages/packages/core/editor-interactions/src/utils/create-interactions-repository.ts"); | |
| 1931 | - | |
| 1932 | -const interactionsRepository = (0,_utils_create_interactions_repository__WEBPACK_IMPORTED_MODULE_0__.createInteractionsRepository)(); | |
| 1933 | - | |
| 1934 | -/***/ }), | |
| 1935 | - | |
| 1936 | -/***/ "./packages/packages/core/editor-interactions/src/mcp/constants.ts": | |
| 1937 | -/*!*************************************************************************!*\ | |
| 1938 | - !*** ./packages/packages/core/editor-interactions/src/mcp/constants.ts ***! | |
| 1939 | - \*************************************************************************/ | |
| 1940 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1941 | - | |
| 1942 | -__webpack_require__.r(__webpack_exports__); | |
| 1943 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1944 | -/* harmony export */ EDITOR_INTERACTIONS_MCP_DESCRIPTION: function() { return /* binding */ EDITOR_INTERACTIONS_MCP_DESCRIPTION; }, | |
| 1945 | -/* harmony export */ EDITOR_INTERACTIONS_MCP_SHORT_DESCRIPTION: function() { return /* binding */ EDITOR_INTERACTIONS_MCP_SHORT_DESCRIPTION; }, | |
| 1946 | -/* harmony export */ MAX_INTERACTIONS_PER_ELEMENT: function() { return /* binding */ MAX_INTERACTIONS_PER_ELEMENT; } | |
| 1947 | -/* harmony export */ }); | |
| 1948 | -const MAX_INTERACTIONS_PER_ELEMENT = 5; | |
| 1949 | -const EDITOR_INTERACTIONS_MCP_SHORT_DESCRIPTION = `Everything related to V4 ( Atomic ) interactions. | |
| 1740 | +//#endregion | |
| 1741 | +//#region packages/packages/core/editor-interactions/src/mcp/constants.ts | |
| 1742 | + var MAX_INTERACTIONS_PER_ELEMENT = 5; | |
| 1743 | + var EDITOR_INTERACTIONS_MCP_SHORT_DESCRIPTION = `Everything related to V4 ( Atomic ) interactions. | |
| 1950 | 1744 | # Interactions |
| 1951 | 1745 | - Create/update/delete interactions |
| 1952 | 1746 | - Get list of interactions |
| 1953 | 1747 | - Get details of an interaction |
| 1954 | 1748 | `; |
| 1955 | -const EDITOR_INTERACTIONS_MCP_DESCRIPTION = `MCP server for managing element interactions and animations. Use this to add, modify, or remove animations and motion effects triggered by user events such as page load or scroll-into-view. | |
| 1749 | + var EDITOR_INTERACTIONS_MCP_DESCRIPTION = `MCP server for managing element interactions and animations. Use this to add, modify, or remove animations and motion effects triggered by user events such as page load or scroll-into-view. | |
| 1956 | 1750 | ** IMPORTANT ** |
| 1957 | 1751 | Use the "interactions-schema" resource to get the schema of the interactions. |
| 1958 | 1752 | Actions: |
| 1959 | 1753 | - get: Read the current interactions on the element. |
| 1960 | - - add: Add a new interaction (max ${MAX_INTERACTIONS_PER_ELEMENT} per element). | |
| 1754 | + - add: Add a new interaction (max ${5} per element). | |
| 1961 | 1755 | - update: Update an existing interaction by its interactionId. |
| 1962 | 1756 | - delete: Remove a specific interaction by its interactionId. |
| 1963 | 1757 | - clear: Remove all interactions from the element. |
| 1964 | 1758 | |
| @@ -2010,1628 +1804,278 @@ | ||
| 2010 | 1804 | "elementId": "123", |
| 2011 | 1805 | "action": "clear", |
| 2012 | 1806 | }`; |
| 2013 | 1807 | |
| 2014 | -/***/ }), | |
| 1808 | +//#endregion | |
| 1809 | +//#region packages/packages/core/editor-interactions/src/mcp/tools/manage-element-interaction-tool.ts | |
| 1810 | + var EMPTY_INTERACTIONS = { | |
| 1811 | + version: 1, | |
| 1812 | + items: [] | |
| 1813 | + }; | |
| 1814 | + var EFFECTS_WITHOUT_TYPE = ["custom"]; | |
| 1815 | + var BREAKPOINTS_SCHEMA_URI = "elementor://breakpoints/list"; | |
| 1816 | + var initManageElementInteractionTool = (reg) => { | |
| 1817 | + const { addTool } = reg; | |
| 1818 | + const extendedSchema = (0, _elementor_utils.isProActive)() ? { | |
| 1819 | + ...baseSchema, | |
| 1820 | + ...proSchema | |
| 1821 | + } : baseSchema; | |
| 1822 | + addTool({ | |
| 1823 | + name: "manage-element-interaction", | |
| 1824 | + description: `Manage the element interaction.`, | |
| 1825 | + schema: { | |
| 1826 | + elementId: _elementor_schema.z.string().describe("The ID of the element to read or modify interactions on"), | |
| 1827 | + action: _elementor_schema.z.enum([ | |
| 1828 | + "get", | |
| 1829 | + "add", | |
| 1830 | + "update", | |
| 1831 | + "delete", | |
| 1832 | + "clear" | |
| 1833 | + ]).describe("Operation to perform. Use \"get\" first to inspect existing interactions."), | |
| 1834 | + interactionId: _elementor_schema.z.string().optional().describe("Interaction ID — required for update and delete. Obtain from a prior \"get\" call."), | |
| 1835 | + ...extendedSchema | |
| 1836 | + }, | |
| 1837 | + requiredResources: [{ | |
| 1838 | + uri: INTERACTIONS_SCHEMA_URI, | |
| 1839 | + description: "Interactions schema with all available options" | |
| 1840 | + }, { | |
| 1841 | + uri: BREAKPOINTS_SCHEMA_URI, | |
| 1842 | + description: "Available breakpoint IDs for excludedBreakpoints" | |
| 1843 | + }], | |
| 1844 | + isDestructive: true, | |
| 1845 | + outputSchema: { | |
| 1846 | + success: _elementor_schema.z.boolean().describe("Whether the action was successful"), | |
| 1847 | + action: _elementor_schema.z.enum([ | |
| 1848 | + "get", | |
| 1849 | + "add", | |
| 1850 | + "update", | |
| 1851 | + "delete", | |
| 1852 | + "clear" | |
| 1853 | + ]).describe("Operation to perform. Use \"get\" first to inspect existing interactions."), | |
| 1854 | + elementId: _elementor_schema.z.string().optional().describe("The ID of the element to read or modify interactions on"), | |
| 1855 | + interactions: _elementor_schema.z.array(_elementor_schema.z.any()).optional().describe("The interactions on the element"), | |
| 1856 | + count: _elementor_schema.z.number().optional().describe("The number of interactions on the element") | |
| 1857 | + }, | |
| 1858 | + handler: (input) => { | |
| 1859 | + const { elementId, action, interactionId, ...animationData } = input; | |
| 1860 | + const { effectType, ...restAnimationData } = animationData; | |
| 1861 | + const effect = restAnimationData.effect; | |
| 1862 | + const resolvedType = effectType ?? (effect && !EFFECTS_WITHOUT_TYPE.includes(effect) ? "in" : void 0); | |
| 1863 | + const currentInteractions = interactionsRepository.all().find((data) => data.elementId === elementId)?.interactions ?? EMPTY_INTERACTIONS; | |
| 1864 | + if (action === "get") { | |
| 1865 | + const summary = currentInteractions.items.map((item) => { | |
| 1866 | + const { value } = item; | |
| 1867 | + const animValue = value.animation.value; | |
| 1868 | + const timingValue = animValue.timing_config.value; | |
| 1869 | + const configValue = animValue.config.value; | |
| 1870 | + return { | |
| 1871 | + id: extractString(value.interaction_id), | |
| 1872 | + trigger: extractString(value.trigger), | |
| 1873 | + effect: extractString(animValue.effect), | |
| 1874 | + effectType: extractString(animValue.type), | |
| 1875 | + direction: extractString(animValue.direction), | |
| 1876 | + duration: extractSize(timingValue.duration), | |
| 1877 | + delay: extractSize(timingValue.delay), | |
| 1878 | + easing: extractString(configValue.easing), | |
| 1879 | + excludedBreakpoints: extractExcludedBreakpoints(value.breakpoints) | |
| 1880 | + }; | |
| 1881 | + }); | |
| 1882 | + return { | |
| 1883 | + success: true, | |
| 1884 | + elementId, | |
| 1885 | + action, | |
| 1886 | + interactions: summary, | |
| 1887 | + count: summary.length | |
| 1888 | + }; | |
| 1889 | + } | |
| 1890 | + let updatedItems = [...currentInteractions.items]; | |
| 1891 | + switch (action) { | |
| 1892 | + case "add": { | |
| 1893 | + if (updatedItems.length >= 5) throw new Error(`Cannot add more than ${5} interactions per element. Current count: ${updatedItems.length}. Delete an existing interaction first.`); | |
| 1894 | + const newItem = createInteractionItem({ | |
| 1895 | + interactionId: generateTempInteractionId(), | |
| 1896 | + ...restAnimationData, | |
| 1897 | + type: resolvedType | |
| 1898 | + }); | |
| 1899 | + updatedItems = [...updatedItems, newItem]; | |
| 1900 | + break; | |
| 1901 | + } | |
| 1902 | + case "update": { | |
| 1903 | + if (!interactionId) throw new Error("interactionId is required for the update action."); | |
| 1904 | + const itemIndex = updatedItems.findIndex((item) => extractString(item.value.interaction_id) === interactionId); | |
| 1905 | + if (itemIndex === -1) throw new Error(`Interaction with ID "${interactionId}" not found on element "${elementId}".`); | |
| 1906 | + const updatedItem = createInteractionItem({ | |
| 1907 | + interactionId, | |
| 1908 | + ...restAnimationData, | |
| 1909 | + type: resolvedType | |
| 1910 | + }); | |
| 1911 | + updatedItems = [ | |
| 1912 | + ...updatedItems.slice(0, itemIndex), | |
| 1913 | + updatedItem, | |
| 1914 | + ...updatedItems.slice(itemIndex + 1) | |
| 1915 | + ]; | |
| 1916 | + break; | |
| 1917 | + } | |
| 1918 | + case "delete": { | |
| 1919 | + if (!interactionId) throw new Error("interactionId is required for the delete action."); | |
| 1920 | + const beforeCount = updatedItems.length; | |
| 1921 | + updatedItems = updatedItems.filter((item) => extractString(item.value.interaction_id) !== interactionId); | |
| 1922 | + if (updatedItems.length === beforeCount) throw new Error(`Interaction with ID "${interactionId}" not found on element "${elementId}".`); | |
| 1923 | + break; | |
| 1924 | + } | |
| 1925 | + case "clear": | |
| 1926 | + updatedItems = []; | |
| 1927 | + break; | |
| 1928 | + } | |
| 1929 | + const updatedInteractions = { | |
| 1930 | + ...currentInteractions, | |
| 1931 | + items: updatedItems | |
| 1932 | + }; | |
| 1933 | + try { | |
| 1934 | + (0, _elementor_editor_elements.updateElementInteractions)({ | |
| 1935 | + elementId, | |
| 1936 | + interactions: updatedInteractions | |
| 1937 | + }); | |
| 1938 | + } catch (error) { | |
| 1939 | + throw new Error(`Failed to update interactions for element "${elementId}": ${error instanceof Error ? error.message : "Unknown error"}`); | |
| 1940 | + } | |
| 1941 | + return { | |
| 1942 | + success: true, | |
| 1943 | + action, | |
| 1944 | + elementId, | |
| 1945 | + count: updatedItems.length | |
| 1946 | + }; | |
| 1947 | + } | |
| 1948 | + }); | |
| 1949 | + }; | |
| 2015 | 1950 | |
| 2016 | -/***/ "./packages/packages/core/editor-interactions/src/mcp/index.ts": | |
| 2017 | -/*!*********************************************************************!*\ | |
| 2018 | - !*** ./packages/packages/core/editor-interactions/src/mcp/index.ts ***! | |
| 2019 | - \*********************************************************************/ | |
| 2020 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2021 | - | |
| 2022 | -__webpack_require__.r(__webpack_exports__); | |
| 2023 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2024 | -/* harmony export */ EDITOR_INTERACTIONS_MCP_DESCRIPTION: function() { return /* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.EDITOR_INTERACTIONS_MCP_DESCRIPTION; }, | |
| 2025 | -/* harmony export */ EDITOR_INTERACTIONS_MCP_SHORT_DESCRIPTION: function() { return /* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.EDITOR_INTERACTIONS_MCP_SHORT_DESCRIPTION; }, | |
| 2026 | -/* harmony export */ MAX_INTERACTIONS_PER_ELEMENT: function() { return /* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.MAX_INTERACTIONS_PER_ELEMENT; }, | |
| 2027 | -/* harmony export */ initMcpInteractions: function() { return /* binding */ initMcpInteractions; } | |
| 2028 | -/* harmony export */ }); | |
| 2029 | -/* harmony import */ var _resources_interactions_schema_resource__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./resources/interactions-schema-resource */ "./packages/packages/core/editor-interactions/src/mcp/resources/interactions-schema-resource.ts"); | |
| 2030 | -/* harmony import */ var _tools_manage_element_interaction_tool__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./tools/manage-element-interaction-tool */ "./packages/packages/core/editor-interactions/src/mcp/tools/manage-element-interaction-tool.ts"); | |
| 2031 | -/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants */ "./packages/packages/core/editor-interactions/src/mcp/constants.ts"); | |
| 2032 | - | |
| 2033 | - | |
| 2034 | - | |
| 2035 | -const initMcpInteractions = reg => { | |
| 2036 | - const { | |
| 2037 | - setMCPDescription | |
| 2038 | - } = reg; | |
| 2039 | - setMCPDescription(`Everything related to V4 ( Atomic ) interactions. | |
| 1951 | +//#endregion | |
| 1952 | +//#region packages/packages/core/editor-interactions/src/mcp/index.ts | |
| 1953 | + var initMcpInteractions = (reg) => { | |
| 1954 | + const { setMCPDescription } = reg; | |
| 1955 | + setMCPDescription(`Everything related to V4 ( Atomic ) interactions. | |
| 2040 | 1956 | # Interactions |
| 2041 | 1957 | - Create/update/delete interactions |
| 2042 | 1958 | - Get list of interactions |
| 2043 | 1959 | - Get details of an interaction |
| 2044 | 1960 | `); |
| 2045 | - (0,_resources_interactions_schema_resource__WEBPACK_IMPORTED_MODULE_0__.initInteractionsSchemaResource)(reg); | |
| 2046 | - (0,_tools_manage_element_interaction_tool__WEBPACK_IMPORTED_MODULE_1__.initManageElementInteractionTool)(reg); | |
| 2047 | -}; | |
| 1961 | + initInteractionsSchemaResource(reg); | |
| 1962 | + initManageElementInteractionTool(reg); | |
| 1963 | + }; | |
| 2048 | 1964 | |
| 2049 | -/***/ }), | |
| 1965 | +//#endregion | |
| 1966 | +//#region packages/packages/core/editor-interactions/src/init.ts | |
| 1967 | + function init() { | |
| 1968 | + try { | |
| 1969 | + interactionsRepository.register(documentElementsInteractionsProvider); | |
| 1970 | + initCleanInteractionIdsOnDuplicate(); | |
| 1971 | + initPasteInteractionsCommand(); | |
| 1972 | + registerInteractionsControl({ | |
| 1973 | + type: "trigger", | |
| 1974 | + component: Trigger, | |
| 1975 | + options: ["load", "scrollIn"] | |
| 1976 | + }); | |
| 1977 | + registerInteractionsControl({ | |
| 1978 | + type: "easing", | |
| 1979 | + component: Easing, | |
| 1980 | + options: ["easeIn"] | |
| 1981 | + }); | |
| 1982 | + registerInteractionsControl({ | |
| 1983 | + type: "replay", | |
| 1984 | + component: Replay, | |
| 1985 | + options: ["no"] | |
| 1986 | + }); | |
| 1987 | + registerInteractionsControl({ | |
| 1988 | + type: "effectType", | |
| 1989 | + component: EffectType, | |
| 1990 | + options: ["in", "out"] | |
| 1991 | + }); | |
| 1992 | + registerInteractionsControl({ | |
| 1993 | + type: "direction", | |
| 1994 | + component: Direction, | |
| 1995 | + options: [ | |
| 1996 | + "top", | |
| 1997 | + "bottom", | |
| 1998 | + "left", | |
| 1999 | + "right" | |
| 2000 | + ] | |
| 2001 | + }); | |
| 2002 | + registerInteractionsControl({ | |
| 2003 | + type: "effect", | |
| 2004 | + component: Effect, | |
| 2005 | + options: [ | |
| 2006 | + "fade", | |
| 2007 | + "slide", | |
| 2008 | + "scale" | |
| 2009 | + ] | |
| 2010 | + }); | |
| 2011 | + registerInteractionsControl({ | |
| 2012 | + type: "repeat", | |
| 2013 | + component: Repeat | |
| 2014 | + }); | |
| 2015 | + initMcpInteractions((0, _elementor_editor_mcp.getMCPByDomain)("interactions", { | |
| 2016 | + docs: EDITOR_INTERACTIONS_MCP_DESCRIPTION, | |
| 2017 | + instructions: EDITOR_INTERACTIONS_MCP_SHORT_DESCRIPTION | |
| 2018 | + })); | |
| 2019 | + } catch (error) { | |
| 2020 | + throw error; | |
| 2021 | + } | |
| 2022 | + } | |
| 2050 | 2023 | |
| 2051 | -/***/ "./packages/packages/core/editor-interactions/src/mcp/resources/interactions-schema-resource.ts": | |
| 2052 | -/*!******************************************************************************************************!*\ | |
| 2053 | - !*** ./packages/packages/core/editor-interactions/src/mcp/resources/interactions-schema-resource.ts ***! | |
| 2054 | - \******************************************************************************************************/ | |
| 2055 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2024 | +//#endregion | |
| 2025 | +//#region packages/packages/core/editor-interactions/src/index.ts | |
| 2026 | + var src_exports = /* @__PURE__ */ __exportAll({ | |
| 2027 | + BASE_EASINGS: () => BASE_EASINGS, | |
| 2028 | + BASE_EFFECTS: () => BASE_EFFECTS, | |
| 2029 | + BASE_REPLAY: () => BASE_REPLAY, | |
| 2030 | + BASE_TRIGGERS: () => BASE_TRIGGERS, | |
| 2031 | + DEFAULT_VALUES: () => DEFAULT_VALUES, | |
| 2032 | + EASING_OPTIONS: () => EASING_OPTIONS, | |
| 2033 | + EFFECT_OPTIONS: () => EFFECT_OPTIONS, | |
| 2034 | + ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX: () => ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX, | |
| 2035 | + EmptyState: () => EmptyState, | |
| 2036 | + InteractionsTab: () => InteractionsTab, | |
| 2037 | + REPEAT_OPTIONS: () => REPEAT_OPTIONS, | |
| 2038 | + REPEAT_TOOLTIPS: () => REPEAT_TOOLTIPS, | |
| 2039 | + REPLAY_OPTIONS: () => REPLAY_OPTIONS, | |
| 2040 | + SCROLL_INTERACTION_EVENT: () => SCROLL_INTERACTION_EVENT, | |
| 2041 | + TRIGGER_OPTIONS: () => TRIGGER_OPTIONS, | |
| 2042 | + buildDisplayLabel: () => buildDisplayLabel, | |
| 2043 | + createAnimationPreset: () => createAnimationPreset, | |
| 2044 | + createBoolean: () => createBoolean, | |
| 2045 | + createConfig: () => createConfig, | |
| 2046 | + createDefaultInteractionItem: () => createDefaultInteractionItem, | |
| 2047 | + createDefaultInteractions: () => createDefaultInteractions, | |
| 2048 | + createExcludedBreakpoints: () => createExcludedBreakpoints, | |
| 2049 | + createInteractionBreakpoints: () => createInteractionBreakpoints, | |
| 2050 | + createInteractionItem: () => createInteractionItem, | |
| 2051 | + createInteractionsProvider: () => createInteractionsProvider, | |
| 2052 | + createNumber: () => createNumber, | |
| 2053 | + createString: () => createString, | |
| 2054 | + createTimingConfig: () => createTimingConfig, | |
| 2055 | + dispatchScrollInteraction: () => dispatchScrollInteraction, | |
| 2056 | + extractBoolean: () => extractBoolean, | |
| 2057 | + extractExcludedBreakpoints: () => extractExcludedBreakpoints, | |
| 2058 | + extractScrollOverlayParams: () => extractScrollOverlayParams, | |
| 2059 | + extractSize: () => extractSize, | |
| 2060 | + extractString: () => extractString, | |
| 2061 | + formatSizeValue: () => formatSizeValue, | |
| 2062 | + generateTempInteractionId: () => generateTempInteractionId, | |
| 2063 | + getInteractionsConfig: () => getInteractionsConfig, | |
| 2064 | + init: () => init, | |
| 2065 | + interactionsRepository: () => interactionsRepository, | |
| 2066 | + isTempId: () => isTempId, | |
| 2067 | + parseSizeValue: () => parseSizeValue, | |
| 2068 | + registerInteractionsControl: () => registerInteractionsControl, | |
| 2069 | + resolveDirection: () => resolveDirection, | |
| 2070 | + syncGridOverlay: () => syncGridOverlay, | |
| 2071 | + useElementInteractions: () => useElementInteractions | |
| 2072 | + }); | |
| 2056 | 2073 | |
| 2057 | -__webpack_require__.r(__webpack_exports__); | |
| 2058 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2059 | -/* harmony export */ INTERACTIONS_SCHEMA_URI: function() { return /* binding */ INTERACTIONS_SCHEMA_URI; }, | |
| 2060 | -/* harmony export */ initInteractionsSchemaResource: function() { return /* binding */ initInteractionsSchemaResource; } | |
| 2061 | -/* harmony export */ }); | |
| 2062 | -/* harmony import */ var _elementor_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/utils */ "@elementor/utils"); | |
| 2063 | -/* harmony import */ var _elementor_utils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_utils__WEBPACK_IMPORTED_MODULE_0__); | |
| 2064 | -/* harmony import */ var _tools_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../tools/schema */ "./packages/packages/core/editor-interactions/src/mcp/tools/schema.ts"); | |
| 2074 | +//#endregion | |
| 2075 | +//#region \0elementor-package-library-entry | |
| 2076 | + (window.elementorV2 = window.elementorV2 || {}).editorInteractions = src_exports; | |
| 2065 | 2077 | |
| 2066 | - | |
| 2067 | -const INTERACTIONS_SCHEMA_URI = 'elementor://interactions/schema'; | |
| 2068 | -const initInteractionsSchemaResource = reg => { | |
| 2069 | - const { | |
| 2070 | - resource | |
| 2071 | - } = reg; | |
| 2072 | - const schema = (0,_elementor_utils__WEBPACK_IMPORTED_MODULE_0__.isProActive)() ? { | |
| 2073 | - ..._tools_schema__WEBPACK_IMPORTED_MODULE_1__.baseSchema, | |
| 2074 | - ..._tools_schema__WEBPACK_IMPORTED_MODULE_1__.proSchema | |
| 2075 | - } : _tools_schema__WEBPACK_IMPORTED_MODULE_1__.baseSchema; | |
| 2076 | - resource('interactions-schema', INTERACTIONS_SCHEMA_URI, { | |
| 2077 | - description: 'Schema describing all available options for element interactions.' | |
| 2078 | - }, async () => { | |
| 2079 | - return { | |
| 2080 | - contents: [{ | |
| 2081 | - uri: INTERACTIONS_SCHEMA_URI, | |
| 2082 | - mimeType: 'application/json', | |
| 2083 | - text: JSON.stringify(schema) | |
| 2084 | - }] | |
| 2085 | - }; | |
| 2086 | - }); | |
| 2087 | -}; | |
| 2088 | - | |
| 2089 | -/***/ }), | |
| 2090 | - | |
| 2091 | -/***/ "./packages/packages/core/editor-interactions/src/mcp/tools/manage-element-interaction-tool.ts": | |
| 2092 | -/*!*****************************************************************************************************!*\ | |
| 2093 | - !*** ./packages/packages/core/editor-interactions/src/mcp/tools/manage-element-interaction-tool.ts ***! | |
| 2094 | - \*****************************************************************************************************/ | |
| 2095 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2096 | - | |
| 2097 | -__webpack_require__.r(__webpack_exports__); | |
| 2098 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2099 | -/* harmony export */ initManageElementInteractionTool: function() { return /* binding */ initManageElementInteractionTool; } | |
| 2100 | -/* harmony export */ }); | |
| 2101 | -/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/editor-elements */ "@elementor/editor-elements"); | |
| 2102 | -/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__); | |
| 2103 | -/* harmony import */ var _elementor_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/schema */ "@elementor/schema"); | |
| 2104 | -/* harmony import */ var _elementor_schema__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_schema__WEBPACK_IMPORTED_MODULE_1__); | |
| 2105 | -/* harmony import */ var _elementor_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/utils */ "@elementor/utils"); | |
| 2106 | -/* harmony import */ var _elementor_utils__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_utils__WEBPACK_IMPORTED_MODULE_2__); | |
| 2107 | -/* harmony import */ var _interactions_repository__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../interactions-repository */ "./packages/packages/core/editor-interactions/src/interactions-repository.ts"); | |
| 2108 | -/* harmony import */ var _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils/prop-value-utils */ "./packages/packages/core/editor-interactions/src/utils/prop-value-utils.ts"); | |
| 2109 | -/* harmony import */ var _utils_temp_id_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils/temp-id-utils */ "./packages/packages/core/editor-interactions/src/utils/temp-id-utils.ts"); | |
| 2110 | -/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../constants */ "./packages/packages/core/editor-interactions/src/mcp/constants.ts"); | |
| 2111 | -/* harmony import */ var _resources_interactions_schema_resource__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../resources/interactions-schema-resource */ "./packages/packages/core/editor-interactions/src/mcp/resources/interactions-schema-resource.ts"); | |
| 2112 | -/* harmony import */ var _schema__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./schema */ "./packages/packages/core/editor-interactions/src/mcp/tools/schema.ts"); | |
| 2113 | - | |
| 2114 | - | |
| 2115 | - | |
| 2116 | - | |
| 2117 | - | |
| 2118 | - | |
| 2119 | - | |
| 2120 | - | |
| 2121 | - | |
| 2122 | -const EMPTY_INTERACTIONS = { | |
| 2123 | - version: 1, | |
| 2124 | - items: [] | |
| 2125 | -}; | |
| 2126 | -const EFFECTS_WITHOUT_TYPE = ['custom']; | |
| 2127 | -const BREAKPOINTS_SCHEMA_URI = 'elementor://breakpoints/list'; | |
| 2128 | -const initManageElementInteractionTool = reg => { | |
| 2129 | - const { | |
| 2130 | - addTool | |
| 2131 | - } = reg; | |
| 2132 | - const extendedSchema = (0,_elementor_utils__WEBPACK_IMPORTED_MODULE_2__.isProActive)() ? { | |
| 2133 | - ..._schema__WEBPACK_IMPORTED_MODULE_8__.baseSchema, | |
| 2134 | - ..._schema__WEBPACK_IMPORTED_MODULE_8__.proSchema | |
| 2135 | - } : _schema__WEBPACK_IMPORTED_MODULE_8__.baseSchema; | |
| 2136 | - const schema = { | |
| 2137 | - elementId: _elementor_schema__WEBPACK_IMPORTED_MODULE_1__.z.string().describe('The ID of the element to read or modify interactions on'), | |
| 2138 | - action: _elementor_schema__WEBPACK_IMPORTED_MODULE_1__.z.enum(['get', 'add', 'update', 'delete', 'clear']).describe('Operation to perform. Use "get" first to inspect existing interactions.'), | |
| 2139 | - interactionId: _elementor_schema__WEBPACK_IMPORTED_MODULE_1__.z.string().optional().describe('Interaction ID — required for update and delete. Obtain from a prior "get" call.'), | |
| 2140 | - ...extendedSchema | |
| 2141 | - }; | |
| 2142 | - addTool({ | |
| 2143 | - name: 'manage-element-interaction', | |
| 2144 | - description: `Manage the element interaction.`, | |
| 2145 | - schema, | |
| 2146 | - requiredResources: [{ | |
| 2147 | - uri: _resources_interactions_schema_resource__WEBPACK_IMPORTED_MODULE_7__.INTERACTIONS_SCHEMA_URI, | |
| 2148 | - description: 'Interactions schema with all available options' | |
| 2149 | - }, { | |
| 2150 | - uri: BREAKPOINTS_SCHEMA_URI, | |
| 2151 | - description: 'Available breakpoint IDs for excludedBreakpoints' | |
| 2152 | - }], | |
| 2153 | - isDestructive: true, | |
| 2154 | - outputSchema: { | |
| 2155 | - success: _elementor_schema__WEBPACK_IMPORTED_MODULE_1__.z.boolean().describe('Whether the action was successful'), | |
| 2156 | - action: _elementor_schema__WEBPACK_IMPORTED_MODULE_1__.z.enum(['get', 'add', 'update', 'delete', 'clear']).describe('Operation to perform. Use "get" first to inspect existing interactions.'), | |
| 2157 | - elementId: _elementor_schema__WEBPACK_IMPORTED_MODULE_1__.z.string().optional().describe('The ID of the element to read or modify interactions on'), | |
| 2158 | - interactions: _elementor_schema__WEBPACK_IMPORTED_MODULE_1__.z.array(_elementor_schema__WEBPACK_IMPORTED_MODULE_1__.z.any()).optional().describe('The interactions on the element'), | |
| 2159 | - count: _elementor_schema__WEBPACK_IMPORTED_MODULE_1__.z.number().optional().describe('The number of interactions on the element') | |
| 2160 | - }, | |
| 2161 | - handler: input => { | |
| 2162 | - const { | |
| 2163 | - elementId, | |
| 2164 | - action, | |
| 2165 | - interactionId, | |
| 2166 | - ...animationData | |
| 2167 | - } = input; | |
| 2168 | - const { | |
| 2169 | - effectType, | |
| 2170 | - ...restAnimationData | |
| 2171 | - } = animationData; | |
| 2172 | - const effect = restAnimationData.effect; | |
| 2173 | - const resolvedType = effectType ?? (effect && !EFFECTS_WITHOUT_TYPE.includes(effect) ? 'in' : undefined); | |
| 2174 | - const allInteractions = _interactions_repository__WEBPACK_IMPORTED_MODULE_3__.interactionsRepository.all(); | |
| 2175 | - const elementData = allInteractions.find(data => data.elementId === elementId); | |
| 2176 | - const currentInteractions = elementData?.interactions ?? EMPTY_INTERACTIONS; | |
| 2177 | - if (action === 'get') { | |
| 2178 | - const summary = currentInteractions.items.map(item => { | |
| 2179 | - const { | |
| 2180 | - value | |
| 2181 | - } = item; | |
| 2182 | - const animValue = value.animation.value; | |
| 2183 | - const timingValue = animValue.timing_config.value; | |
| 2184 | - const configValue = animValue.config.value; | |
| 2185 | - return { | |
| 2186 | - id: (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_4__.extractString)(value.interaction_id), | |
| 2187 | - trigger: (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_4__.extractString)(value.trigger), | |
| 2188 | - effect: (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_4__.extractString)(animValue.effect), | |
| 2189 | - effectType: (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_4__.extractString)(animValue.type), | |
| 2190 | - direction: (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_4__.extractString)(animValue.direction), | |
| 2191 | - duration: (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_4__.extractSize)(timingValue.duration), | |
| 2192 | - delay: (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_4__.extractSize)(timingValue.delay), | |
| 2193 | - easing: (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_4__.extractString)(configValue.easing), | |
| 2194 | - excludedBreakpoints: (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_4__.extractExcludedBreakpoints)(value.breakpoints) | |
| 2195 | - }; | |
| 2196 | - }); | |
| 2197 | - return { | |
| 2198 | - success: true, | |
| 2199 | - elementId, | |
| 2200 | - action, | |
| 2201 | - interactions: summary, | |
| 2202 | - count: summary.length | |
| 2203 | - }; | |
| 2204 | - } | |
| 2205 | - let updatedItems = [...currentInteractions.items]; | |
| 2206 | - switch (action) { | |
| 2207 | - case 'add': | |
| 2208 | - { | |
| 2209 | - if (updatedItems.length >= _constants__WEBPACK_IMPORTED_MODULE_6__.MAX_INTERACTIONS_PER_ELEMENT) { | |
| 2210 | - throw new Error(`Cannot add more than ${_constants__WEBPACK_IMPORTED_MODULE_6__.MAX_INTERACTIONS_PER_ELEMENT} interactions per element. Current count: ${updatedItems.length}. Delete an existing interaction first.`); | |
| 2211 | - } | |
| 2212 | - const newItem = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_4__.createInteractionItem)({ | |
| 2213 | - interactionId: (0,_utils_temp_id_utils__WEBPACK_IMPORTED_MODULE_5__.generateTempInteractionId)(), | |
| 2214 | - ...restAnimationData, | |
| 2215 | - type: resolvedType | |
| 2216 | - }); | |
| 2217 | - updatedItems = [...updatedItems, newItem]; | |
| 2218 | - break; | |
| 2219 | - } | |
| 2220 | - case 'update': | |
| 2221 | - { | |
| 2222 | - if (!interactionId) { | |
| 2223 | - throw new Error('interactionId is required for the update action.'); | |
| 2224 | - } | |
| 2225 | - const itemIndex = updatedItems.findIndex(item => (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_4__.extractString)(item.value.interaction_id) === interactionId); | |
| 2226 | - if (itemIndex === -1) { | |
| 2227 | - throw new Error(`Interaction with ID "${interactionId}" not found on element "${elementId}".`); | |
| 2228 | - } | |
| 2229 | - const updatedItem = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_4__.createInteractionItem)({ | |
| 2230 | - interactionId, | |
| 2231 | - ...restAnimationData, | |
| 2232 | - type: resolvedType | |
| 2233 | - }); | |
| 2234 | - updatedItems = [...updatedItems.slice(0, itemIndex), updatedItem, ...updatedItems.slice(itemIndex + 1)]; | |
| 2235 | - break; | |
| 2236 | - } | |
| 2237 | - case 'delete': | |
| 2238 | - { | |
| 2239 | - if (!interactionId) { | |
| 2240 | - throw new Error('interactionId is required for the delete action.'); | |
| 2241 | - } | |
| 2242 | - const beforeCount = updatedItems.length; | |
| 2243 | - updatedItems = updatedItems.filter(item => (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_4__.extractString)(item.value.interaction_id) !== interactionId); | |
| 2244 | - if (updatedItems.length === beforeCount) { | |
| 2245 | - throw new Error(`Interaction with ID "${interactionId}" not found on element "${elementId}".`); | |
| 2246 | - } | |
| 2247 | - break; | |
| 2248 | - } | |
| 2249 | - case 'clear': | |
| 2250 | - { | |
| 2251 | - updatedItems = []; | |
| 2252 | - break; | |
| 2253 | - } | |
| 2254 | - } | |
| 2255 | - const updatedInteractions = { | |
| 2256 | - ...currentInteractions, | |
| 2257 | - items: updatedItems | |
| 2258 | - }; | |
| 2259 | - try { | |
| 2260 | - (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__.updateElementInteractions)({ | |
| 2261 | - elementId, | |
| 2262 | - interactions: updatedInteractions | |
| 2263 | - }); | |
| 2264 | - } catch (error) { | |
| 2265 | - throw new Error(`Failed to update interactions for element "${elementId}": ${error instanceof Error ? error.message : 'Unknown error'}`); | |
| 2266 | - } | |
| 2267 | - return { | |
| 2268 | - success: true, | |
| 2269 | - action, | |
| 2270 | - elementId, | |
| 2271 | - count: updatedItems.length | |
| 2272 | - }; | |
| 2273 | - } | |
| 2274 | - }); | |
| 2275 | -}; | |
| 2276 | - | |
| 2277 | -/***/ }), | |
| 2278 | - | |
| 2279 | -/***/ "./packages/packages/core/editor-interactions/src/mcp/tools/schema.ts": | |
| 2280 | -/*!****************************************************************************!*\ | |
| 2281 | - !*** ./packages/packages/core/editor-interactions/src/mcp/tools/schema.ts ***! | |
| 2282 | - \****************************************************************************/ | |
| 2283 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2284 | - | |
| 2285 | -__webpack_require__.r(__webpack_exports__); | |
| 2286 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2287 | -/* harmony export */ baseSchema: function() { return /* binding */ baseSchema; }, | |
| 2288 | -/* harmony export */ proSchema: function() { return /* binding */ proSchema; } | |
| 2289 | -/* harmony export */ }); | |
| 2290 | -/* harmony import */ var _elementor_schema__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/schema */ "@elementor/schema"); | |
| 2291 | -/* harmony import */ var _elementor_schema__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_schema__WEBPACK_IMPORTED_MODULE_0__); | |
| 2292 | - | |
| 2293 | -const baseSchema = { | |
| 2294 | - trigger: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.enum(['load', 'scrollIn']).optional().describe('Event that triggers the animation'), | |
| 2295 | - effect: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.enum(['fade', 'slide', 'scale']).optional().describe('Animation effect type'), | |
| 2296 | - effectType: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.enum(['in', 'out']).optional().describe('Whether the animation plays in or out'), | |
| 2297 | - direction: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.enum(['top', 'bottom', 'left', 'right', 'top-left', 'top-right', 'bottom-left', 'bottom-right']).optional().describe('Direction of the Animation. Can be one of the following or empty if not needed. At slide effect, this is required field.'), | |
| 2298 | - duration: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.number().min(0).max(10000).optional().describe('Animation duration in milliseconds'), | |
| 2299 | - delay: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.number().min(0).max(10000).optional().describe('Animation delay in milliseconds'), | |
| 2300 | - easing: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.enum(['easeIn']).optional().describe('Easing function for the animation. Use "easeIn" for free tier.'), | |
| 2301 | - excludedBreakpoints: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.array(_elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.enum(['widescreen', 'desktop', 'laptop', 'tablet_extra', 'tablet', 'mobile_extra', 'mobile'])).optional().describe('Breakpoint IDs on which this interaction is disabled (e.g. ["mobile", "tablet"]). Fetch the "elementor://breakpoints/list" resource to get the valid IDs for the current site. Omit to enable on all breakpoints.') | |
| 2302 | -}; | |
| 2303 | -const proSchema = { | |
| 2304 | - trigger: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.enum(['load', 'scrollIn', 'scrollOut', 'scrollOn', 'hover', 'click']).optional().describe('Event that triggers the animation'), | |
| 2305 | - effect: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.enum(['fade', 'slide', 'scale', 'custom']).optional().describe('Animation effect type'), | |
| 2306 | - easing: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.enum(['easeIn', 'easeInOut', 'easeOut', 'backIn', 'backInOut', 'backOut', 'linear']).optional().describe('Easing function for the animation.'), | |
| 2307 | - customEffects: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.object({ | |
| 2308 | - keyframes: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.array(_elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.object({ | |
| 2309 | - stop: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.number().describe('The stop of the keyframe in percent, can be either 0 or 100'), | |
| 2310 | - value: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.object({ | |
| 2311 | - opacity: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.number().min(0).max(1).describe('The opacity of the keyframe'), | |
| 2312 | - scale: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.object({ | |
| 2313 | - x: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.number().min(0).max(1).describe('The x scale of the keyframe'), | |
| 2314 | - y: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.number().min(0).max(1).describe('The y scale of the keyframe') | |
| 2315 | - }).optional().describe('The scale of the keyframe'), | |
| 2316 | - rotate: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.object({ | |
| 2317 | - x: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.number().min(0).max(360).describe('The x rotate of the keyframe'), | |
| 2318 | - y: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.number().min(0).max(360).describe('The y rotate of the keyframe'), | |
| 2319 | - z: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.number().min(0).max(360).describe('The z rotate of the keyframe') | |
| 2320 | - }).optional().describe('The rotate of the keyframe'), | |
| 2321 | - move: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.object({ | |
| 2322 | - x: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.number().min(0).max(1).describe('The x move of the keyframe'), | |
| 2323 | - y: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.number().min(0).max(1).describe('The y move of the keyframe'), | |
| 2324 | - z: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.number().min(0).max(1).describe('The z move of the keyframe') | |
| 2325 | - }).optional().describe('The move of the keyframe'), | |
| 2326 | - skew: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.object({ | |
| 2327 | - x: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.number().min(0).max(360).describe('The x skew of the keyframe'), | |
| 2328 | - y: _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.number().min(0).max(360).describe('The y skew of the keyframe') | |
| 2329 | - }).optional().describe('The skew of the keyframe') | |
| 2330 | - }) | |
| 2331 | - })).describe('The keyframes of the custom effect') | |
| 2332 | - }).optional().describe('The custom effect to use for the animation') | |
| 2333 | -}; | |
| 2334 | - | |
| 2335 | -/***/ }), | |
| 2336 | - | |
| 2337 | -/***/ "./packages/packages/core/editor-interactions/src/providers/document-elements-interactions-provider.ts": | |
| 2338 | -/*!*************************************************************************************************************!*\ | |
| 2339 | - !*** ./packages/packages/core/editor-interactions/src/providers/document-elements-interactions-provider.ts ***! | |
| 2340 | - \*************************************************************************************************************/ | |
| 2341 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2342 | - | |
| 2343 | -__webpack_require__.r(__webpack_exports__); | |
| 2344 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2345 | -/* harmony export */ ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX: function() { return /* binding */ ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX; }, | |
| 2346 | -/* harmony export */ documentElementsInteractionsProvider: function() { return /* binding */ documentElementsInteractionsProvider; } | |
| 2347 | -/* harmony export */ }); | |
| 2348 | -/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/editor-elements */ "@elementor/editor-elements"); | |
| 2349 | -/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__); | |
| 2350 | -/* harmony import */ var _elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-v1-adapters */ "@elementor/editor-v1-adapters"); | |
| 2351 | -/* harmony import */ var _elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1__); | |
| 2352 | -/* harmony import */ var _utils_create_interactions_provider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/create-interactions-provider */ "./packages/packages/core/editor-interactions/src/utils/create-interactions-provider.ts"); | |
| 2353 | - | |
| 2354 | - | |
| 2355 | - | |
| 2356 | -const ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX = 'document-elements-interactions-'; | |
| 2357 | -const documentElementsInteractionsProvider = (0,_utils_create_interactions_provider__WEBPACK_IMPORTED_MODULE_2__.createInteractionsProvider)({ | |
| 2358 | - key: () => { | |
| 2359 | - const documentId = (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__.getCurrentDocumentId)(); | |
| 2360 | - if (!documentId) { | |
| 2361 | - const pendingKey = `${ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX}pending`; | |
| 2362 | - return pendingKey; | |
| 2363 | - } | |
| 2364 | - const key = `${ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX}${documentId}`; | |
| 2365 | - return key; | |
| 2366 | - }, | |
| 2367 | - priority: 50, | |
| 2368 | - subscribe: cb => { | |
| 2369 | - return (0,_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1__.__privateListenTo)([(0,_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1__.windowEvent)('elementor/element/update_interactions')], () => cb()); | |
| 2370 | - }, | |
| 2371 | - actions: { | |
| 2372 | - all: () => { | |
| 2373 | - const elements = (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__.getElements)(); | |
| 2374 | - const filtered = elements.filter(element => { | |
| 2375 | - const interactions = (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__.getElementInteractions)(element.id); | |
| 2376 | - if (!interactions) { | |
| 2377 | - return false; | |
| 2378 | - } | |
| 2379 | - return interactions?.items?.length > 0; | |
| 2380 | - }); | |
| 2381 | - return filtered.map(element => { | |
| 2382 | - const interactions = (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__.getElementInteractions)(element.id); | |
| 2383 | - return { | |
| 2384 | - elementId: element.id, | |
| 2385 | - dataId: element.id, | |
| 2386 | - interactions: interactions || { | |
| 2387 | - version: 1, | |
| 2388 | - items: [] | |
| 2389 | - } | |
| 2390 | - }; | |
| 2391 | - }); | |
| 2392 | - } | |
| 2393 | - } | |
| 2394 | -}); | |
| 2395 | - | |
| 2396 | -/***/ }), | |
| 2397 | - | |
| 2398 | -/***/ "./packages/packages/core/editor-interactions/src/ui/interactions-promotion-chip.tsx": | |
| 2399 | -/*!*******************************************************************************************!*\ | |
| 2400 | - !*** ./packages/packages/core/editor-interactions/src/ui/interactions-promotion-chip.tsx ***! | |
| 2401 | - \*******************************************************************************************/ | |
| 2402 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2403 | - | |
| 2404 | -__webpack_require__.r(__webpack_exports__); | |
| 2405 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2406 | -/* harmony export */ InteractionsPromotionChip: function() { return /* binding */ InteractionsPromotionChip; } | |
| 2407 | -/* harmony export */ }); | |
| 2408 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 2409 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 2410 | -/* harmony import */ var _elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-controls */ "@elementor/editor-controls"); | |
| 2411 | -/* harmony import */ var _elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__); | |
| 2412 | -/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/editor-ui */ "@elementor/editor-ui"); | |
| 2413 | -/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__); | |
| 2414 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 2415 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__); | |
| 2416 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 2417 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__); | |
| 2418 | - | |
| 2419 | - | |
| 2420 | - | |
| 2421 | - | |
| 2422 | - | |
| 2423 | - | |
| 2424 | -const InteractionsPromotionChip = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(({ | |
| 2425 | - content, | |
| 2426 | - upgradeUrl, | |
| 2427 | - anchorRef, | |
| 2428 | - trackingData | |
| 2429 | -}, ref) => { | |
| 2430 | - const [isOpen, setIsOpen] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false); | |
| 2431 | - (0,_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__.useCanvasClickHandler)(isOpen, () => setIsOpen(false)); | |
| 2432 | - const toggle = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => { | |
| 2433 | - setIsOpen(prev => { | |
| 2434 | - if (!prev) { | |
| 2435 | - (0,_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__.trackViewPromotion)(trackingData); | |
| 2436 | - } | |
| 2437 | - return !prev; | |
| 2438 | - }); | |
| 2439 | - }, [trackingData]); | |
| 2440 | - (0,react__WEBPACK_IMPORTED_MODULE_0__.useImperativeHandle)(ref, () => ({ | |
| 2441 | - toggle | |
| 2442 | - }), [toggle]); | |
| 2443 | - const handleToggle = e => { | |
| 2444 | - e.stopPropagation(); | |
| 2445 | - toggle(); | |
| 2446 | - }; | |
| 2447 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__.PromotionPopover, { | |
| 2448 | - open: isOpen, | |
| 2449 | - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Interactions', 'elementor'), | |
| 2450 | - content: content, | |
| 2451 | - ctaText: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Upgrade now', 'elementor'), | |
| 2452 | - ctaUrl: upgradeUrl, | |
| 2453 | - anchorRef: anchorRef, | |
| 2454 | - placement: anchorRef ? 'right-start' : undefined, | |
| 2455 | - onClose: e => { | |
| 2456 | - e.stopPropagation(); | |
| 2457 | - setIsOpen(false); | |
| 2458 | - }, | |
| 2459 | - onCtaClick: () => (0,_elementor_editor_controls__WEBPACK_IMPORTED_MODULE_1__.trackUpgradePromotionClick)(trackingData) | |
| 2460 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Box, { | |
| 2461 | - onMouseDown: e => e.stopPropagation(), | |
| 2462 | - onClick: handleToggle, | |
| 2463 | - sx: { | |
| 2464 | - cursor: 'pointer', | |
| 2465 | - display: 'inline-flex', | |
| 2466 | - mr: 1 | |
| 2467 | - } | |
| 2468 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__.PromotionChip, null))); | |
| 2469 | -}); | |
| 2470 | - | |
| 2471 | -/***/ }), | |
| 2472 | - | |
| 2473 | -/***/ "./packages/packages/core/editor-interactions/src/ui/promotion-overlay-layout.tsx": | |
| 2474 | -/*!****************************************************************************************!*\ | |
| 2475 | - !*** ./packages/packages/core/editor-interactions/src/ui/promotion-overlay-layout.tsx ***! | |
| 2476 | - \****************************************************************************************/ | |
| 2477 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2478 | - | |
| 2479 | -__webpack_require__.r(__webpack_exports__); | |
| 2480 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2481 | -/* harmony export */ PromotionOverlayLayout: function() { return /* binding */ PromotionOverlayLayout; } | |
| 2482 | -/* harmony export */ }); | |
| 2483 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 2484 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 2485 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 2486 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__); | |
| 2487 | - | |
| 2488 | - | |
| 2489 | - | |
| 2490 | -const OVERLAY_GRID = '1 / 1'; | |
| 2491 | -const CHIP_OFFSET = '50%'; | |
| 2492 | -const PromotionOverlayLayout = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(({ | |
| 2493 | - children, | |
| 2494 | - promotionChip | |
| 2495 | -}, ref) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Box, { | |
| 2496 | - ref: ref, | |
| 2497 | - sx: { | |
| 2498 | - display: 'grid', | |
| 2499 | - alignItems: 'center' | |
| 2500 | - } | |
| 2501 | -}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Box, { | |
| 2502 | - sx: { | |
| 2503 | - gridArea: OVERLAY_GRID | |
| 2504 | - } | |
| 2505 | -}, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Box, { | |
| 2506 | - sx: { | |
| 2507 | - gridArea: OVERLAY_GRID, | |
| 2508 | - marginInlineEnd: CHIP_OFFSET, | |
| 2509 | - justifySelf: 'end' | |
| 2510 | - } | |
| 2511 | -}, promotionChip))); | |
| 2512 | - | |
| 2513 | -/***/ }), | |
| 2514 | - | |
| 2515 | -/***/ "./packages/packages/core/editor-interactions/src/ui/promotion-select.tsx": | |
| 2516 | -/*!********************************************************************************!*\ | |
| 2517 | - !*** ./packages/packages/core/editor-interactions/src/ui/promotion-select.tsx ***! | |
| 2518 | - \********************************************************************************/ | |
| 2519 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2520 | - | |
| 2521 | -__webpack_require__.r(__webpack_exports__); | |
| 2522 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2523 | -/* harmony export */ PromotionSelect: function() { return /* binding */ PromotionSelect; } | |
| 2524 | -/* harmony export */ }); | |
| 2525 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 2526 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 2527 | -/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-ui */ "@elementor/editor-ui"); | |
| 2528 | -/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__); | |
| 2529 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); | |
| 2530 | -/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__); | |
| 2531 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); | |
| 2532 | -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); | |
| 2533 | -/* harmony import */ var _interactions_promotion_chip__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./interactions-promotion-chip */ "./packages/packages/core/editor-interactions/src/ui/interactions-promotion-chip.tsx"); | |
| 2534 | - | |
| 2535 | - | |
| 2536 | - | |
| 2537 | - | |
| 2538 | - | |
| 2539 | - | |
| 2540 | -function PromotionSelect({ | |
| 2541 | - value, | |
| 2542 | - onChange, | |
| 2543 | - baseOptions, | |
| 2544 | - disabledOptions, | |
| 2545 | - promotionLabel, | |
| 2546 | - promotionContent, | |
| 2547 | - upgradeUrl, | |
| 2548 | - trackingData | |
| 2549 | -}) { | |
| 2550 | - const promotionRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); | |
| 2551 | - const anchorRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); | |
| 2552 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Select, { | |
| 2553 | - value: value, | |
| 2554 | - onChange: e => onChange?.(e.target.value), | |
| 2555 | - fullWidth: true, | |
| 2556 | - displayEmpty: true, | |
| 2557 | - size: "tiny", | |
| 2558 | - MenuProps: { | |
| 2559 | - disablePortal: true | |
| 2560 | - } | |
| 2561 | - }, Object.entries(baseOptions).map(([key, label]) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__.MenuListItem, { | |
| 2562 | - key: key, | |
| 2563 | - value: key | |
| 2564 | - }, label)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.MenuSubheader, { | |
| 2565 | - ref: anchorRef, | |
| 2566 | - sx: { | |
| 2567 | - cursor: 'pointer', | |
| 2568 | - color: 'text.tertiary', | |
| 2569 | - fontWeight: '400', | |
| 2570 | - display: 'flex', | |
| 2571 | - alignItems: 'center' | |
| 2572 | - }, | |
| 2573 | - onMouseDown: e => { | |
| 2574 | - e.stopPropagation(); | |
| 2575 | - promotionRef.current?.toggle(); | |
| 2576 | - } | |
| 2577 | - }, promotionLabel ?? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('PRO features', 'elementor'), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_interactions_promotion_chip__WEBPACK_IMPORTED_MODULE_4__.InteractionsPromotionChip, { | |
| 2578 | - content: promotionContent, | |
| 2579 | - upgradeUrl: upgradeUrl, | |
| 2580 | - ref: promotionRef, | |
| 2581 | - anchorRef: anchorRef, | |
| 2582 | - trackingData: trackingData | |
| 2583 | - })), Object.entries(disabledOptions).map(([key, label]) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__.MenuListItem, { | |
| 2584 | - key: key, | |
| 2585 | - value: key, | |
| 2586 | - disabled: true, | |
| 2587 | - sx: { | |
| 2588 | - pl: 3 | |
| 2589 | - } | |
| 2590 | - }, label))); | |
| 2591 | -} | |
| 2592 | - | |
| 2593 | -/***/ }), | |
| 2594 | - | |
| 2595 | -/***/ "./packages/packages/core/editor-interactions/src/utils/create-interactions-provider.ts": | |
| 2596 | -/*!**********************************************************************************************!*\ | |
| 2597 | - !*** ./packages/packages/core/editor-interactions/src/utils/create-interactions-provider.ts ***! | |
| 2598 | - \**********************************************************************************************/ | |
| 2599 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2600 | - | |
| 2601 | -__webpack_require__.r(__webpack_exports__); | |
| 2602 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2603 | -/* harmony export */ createInteractionsProvider: function() { return /* binding */ createInteractionsProvider; } | |
| 2604 | -/* harmony export */ }); | |
| 2605 | -const DEFAULT_PRIORITY = 10; | |
| 2606 | -function createInteractionsProvider({ | |
| 2607 | - key, | |
| 2608 | - priority = DEFAULT_PRIORITY, | |
| 2609 | - subscribe = () => () => {}, | |
| 2610 | - actions | |
| 2611 | -}) { | |
| 2612 | - return { | |
| 2613 | - getKey: typeof key === 'string' ? () => key : key, | |
| 2614 | - priority, | |
| 2615 | - subscribe, | |
| 2616 | - actions: { | |
| 2617 | - all: actions.all | |
| 2618 | - } | |
| 2619 | - }; | |
| 2620 | -} | |
| 2621 | - | |
| 2622 | -/***/ }), | |
| 2623 | - | |
| 2624 | -/***/ "./packages/packages/core/editor-interactions/src/utils/create-interactions-repository.ts": | |
| 2625 | -/*!************************************************************************************************!*\ | |
| 2626 | - !*** ./packages/packages/core/editor-interactions/src/utils/create-interactions-repository.ts ***! | |
| 2627 | - \************************************************************************************************/ | |
| 2628 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2629 | - | |
| 2630 | -__webpack_require__.r(__webpack_exports__); | |
| 2631 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2632 | -/* harmony export */ createInteractionsRepository: function() { return /* binding */ createInteractionsRepository; } | |
| 2633 | -/* harmony export */ }); | |
| 2634 | -const createInteractionsRepository = () => { | |
| 2635 | - const providers = []; | |
| 2636 | - const getProviders = () => { | |
| 2637 | - const sorted = providers.slice(0).sort((a, b) => a.priority > b.priority ? -1 : 1); | |
| 2638 | - return sorted; | |
| 2639 | - }; | |
| 2640 | - const register = provider => { | |
| 2641 | - providers.push(provider); | |
| 2642 | - }; | |
| 2643 | - const all = () => { | |
| 2644 | - return getProviders().flatMap(provider => provider.actions.all()); | |
| 2645 | - }; | |
| 2646 | - const subscribe = cb => { | |
| 2647 | - const unsubscribes = providers.map(provider => provider.subscribe(cb)); | |
| 2648 | - return () => { | |
| 2649 | - unsubscribes.forEach(unsubscribe => unsubscribe()); | |
| 2650 | - }; | |
| 2651 | - }; | |
| 2652 | - const getProviderByKey = key => { | |
| 2653 | - return providers.find(provider => { | |
| 2654 | - try { | |
| 2655 | - return provider.getKey() === key; | |
| 2656 | - } catch { | |
| 2657 | - // Provider might not be ready yet (e.g., no document loaded) | |
| 2658 | - return false; | |
| 2659 | - } | |
| 2660 | - }); | |
| 2661 | - }; | |
| 2662 | - return { | |
| 2663 | - all, | |
| 2664 | - register, | |
| 2665 | - subscribe, | |
| 2666 | - getProviders, | |
| 2667 | - getProviderByKey | |
| 2668 | - }; | |
| 2669 | -}; | |
| 2670 | - | |
| 2671 | -/***/ }), | |
| 2672 | - | |
| 2673 | -/***/ "./packages/packages/core/editor-interactions/src/utils/custom-effect-to-prop-value.ts": | |
| 2674 | -/*!*********************************************************************************************!*\ | |
| 2675 | - !*** ./packages/packages/core/editor-interactions/src/utils/custom-effect-to-prop-value.ts ***! | |
| 2676 | - \*********************************************************************************************/ | |
| 2677 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2678 | - | |
| 2679 | -__webpack_require__.r(__webpack_exports__); | |
| 2680 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2681 | -/* harmony export */ toCustomEffectPropValue: function() { return /* binding */ toCustomEffectPropValue; } | |
| 2682 | -/* harmony export */ }); | |
| 2683 | -const CUSTOM_EFFECT_TYPE = 'custom-effect'; | |
| 2684 | -const KEYFRAMES_TYPE = 'keyframes'; | |
| 2685 | -const KEYFRAME_STOP_TYPE = 'keyframe-stop'; | |
| 2686 | -const KEYFRAME_STOP_SETTINGS_TYPE = 'keyframe-stop-settings'; | |
| 2687 | -const SIZE_TYPE = 'size'; | |
| 2688 | -const NUMBER_TYPE = 'number'; | |
| 2689 | -const TRANSFORM_SCALE_TYPE = 'transform-scale'; | |
| 2690 | -const TRANSFORM_ROTATE_TYPE = 'transform-rotate'; | |
| 2691 | -const TRANSFORM_MOVE_TYPE = 'transform-move'; | |
| 2692 | -const TRANSFORM_SKEW_TYPE = 'transform-skew'; | |
| 2693 | -const UNIT_PERCENT = '%'; | |
| 2694 | -const UNIT_DEG = 'deg'; | |
| 2695 | -const UNIT_PX = 'px'; | |
| 2696 | -const isPlainCustomEffect = v => typeof v === 'object' && v !== null && 'keyframes' in v && Array.isArray(v.keyframes) && !('$$type' in v); | |
| 2697 | -const toSizePropValue = (size, unit = UNIT_PERCENT) => ({ | |
| 2698 | - $$type: SIZE_TYPE, | |
| 2699 | - value: { | |
| 2700 | - size, | |
| 2701 | - unit | |
| 2702 | - } | |
| 2703 | -}); | |
| 2704 | -const toNumberPropValue = n => ({ | |
| 2705 | - $$type: NUMBER_TYPE, | |
| 2706 | - value: n | |
| 2707 | -}); | |
| 2708 | -const toDimensionalNumberPropValue = (type, plain, defaults) => ({ | |
| 2709 | - $$type: type, | |
| 2710 | - value: { | |
| 2711 | - x: toNumberPropValue(plain.x ?? defaults.x), | |
| 2712 | - y: toNumberPropValue(plain.y ?? defaults.y), | |
| 2713 | - z: toNumberPropValue(plain.z ?? defaults.z) | |
| 2714 | - } | |
| 2715 | -}); | |
| 2716 | -const toDimensionalSizePropValue = (type, plain, defaults, unit) => ({ | |
| 2717 | - $$type: type, | |
| 2718 | - value: { | |
| 2719 | - x: toSizePropValue(plain.x ?? defaults.x, unit), | |
| 2720 | - y: toSizePropValue(plain.y ?? defaults.y, unit), | |
| 2721 | - z: toSizePropValue(plain.z ?? defaults.z, unit) | |
| 2722 | - } | |
| 2723 | -}); | |
| 2724 | -const toSkewPropValue = plain => ({ | |
| 2725 | - $$type: TRANSFORM_SKEW_TYPE, | |
| 2726 | - value: { | |
| 2727 | - x: toSizePropValue(plain.x ?? 0, UNIT_DEG), | |
| 2728 | - y: toSizePropValue(plain.y ?? 0, UNIT_DEG) | |
| 2729 | - } | |
| 2730 | -}); | |
| 2731 | -const toKeyframeStopSettingsPropValue = plain => { | |
| 2732 | - const value = {}; | |
| 2733 | - if (plain.opacity !== undefined) { | |
| 2734 | - const percent = plain.opacity <= 1 ? Math.round(plain.opacity * 100) : plain.opacity; | |
| 2735 | - value.opacity = toSizePropValue(percent); | |
| 2736 | - } | |
| 2737 | - if (plain.scale !== undefined) { | |
| 2738 | - value.scale = toDimensionalNumberPropValue(TRANSFORM_SCALE_TYPE, plain.scale, { | |
| 2739 | - x: 1, | |
| 2740 | - y: 1, | |
| 2741 | - z: 1 | |
| 2742 | - }); | |
| 2743 | - } | |
| 2744 | - if (plain.rotate !== undefined) { | |
| 2745 | - value.rotate = toDimensionalSizePropValue(TRANSFORM_ROTATE_TYPE, plain.rotate, { | |
| 2746 | - x: 0, | |
| 2747 | - y: 0, | |
| 2748 | - z: 0 | |
| 2749 | - }, UNIT_DEG); | |
| 2750 | - } | |
| 2751 | - if (plain.move !== undefined) { | |
| 2752 | - value.move = toDimensionalSizePropValue(TRANSFORM_MOVE_TYPE, plain.move, { | |
| 2753 | - x: 0, | |
| 2754 | - y: 0, | |
| 2755 | - z: 0 | |
| 2756 | - }, UNIT_PX); | |
| 2757 | - } | |
| 2758 | - if (plain.skew !== undefined) { | |
| 2759 | - value.skew = toSkewPropValue(plain.skew); | |
| 2760 | - } | |
| 2761 | - return { | |
| 2762 | - $$type: KEYFRAME_STOP_SETTINGS_TYPE, | |
| 2763 | - value | |
| 2764 | - }; | |
| 2765 | -}; | |
| 2766 | -const isPlainKeyframe = v => typeof v === 'object' && v !== null && 'stop' in v && 'value' in v && !('$$type' in v); | |
| 2767 | -const toKeyframeStopPropValue = item => { | |
| 2768 | - if (!isPlainKeyframe(item)) { | |
| 2769 | - return item; | |
| 2770 | - } | |
| 2771 | - return { | |
| 2772 | - $$type: KEYFRAME_STOP_TYPE, | |
| 2773 | - value: { | |
| 2774 | - stop: toSizePropValue(item.stop), | |
| 2775 | - settings: toKeyframeStopSettingsPropValue(item.value) | |
| 2776 | - } | |
| 2777 | - }; | |
| 2778 | -}; | |
| 2779 | -const toKeyframesPropValue = keyframes => ({ | |
| 2780 | - $$type: KEYFRAMES_TYPE, | |
| 2781 | - value: keyframes.map(toKeyframeStopPropValue) | |
| 2782 | -}); | |
| 2783 | -const plainCustomEffectToPropValue = plain => ({ | |
| 2784 | - $$type: CUSTOM_EFFECT_TYPE, | |
| 2785 | - value: { | |
| 2786 | - keyframes: toKeyframesPropValue(plain.keyframes) | |
| 2787 | - } | |
| 2788 | -}); | |
| 2789 | -const toCustomEffectPropValue = customEffects => { | |
| 2790 | - if (customEffects === undefined) { | |
| 2791 | - return undefined; | |
| 2792 | - } | |
| 2793 | - if (isPlainCustomEffect(customEffects)) { | |
| 2794 | - return plainCustomEffectToPropValue(customEffects); | |
| 2795 | - } | |
| 2796 | - return customEffects; | |
| 2797 | -}; | |
| 2798 | - | |
| 2799 | -/***/ }), | |
| 2800 | - | |
| 2801 | -/***/ "./packages/packages/core/editor-interactions/src/utils/filter-interactions.ts": | |
| 2802 | -/*!*************************************************************************************!*\ | |
| 2803 | - !*** ./packages/packages/core/editor-interactions/src/utils/filter-interactions.ts ***! | |
| 2804 | - \*************************************************************************************/ | |
| 2805 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2806 | - | |
| 2807 | -__webpack_require__.r(__webpack_exports__); | |
| 2808 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2809 | -/* harmony export */ filterInteractions: function() { return /* binding */ filterInteractions; } | |
| 2810 | -/* harmony export */ }); | |
| 2811 | -/* harmony import */ var _is_supported_interaction_item__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-supported-interaction-item */ "./packages/packages/core/editor-interactions/src/utils/is-supported-interaction-item.ts"); | |
| 2812 | - | |
| 2813 | -const filterInteractions = interactions => { | |
| 2814 | - return interactions.filter(interaction => { | |
| 2815 | - return (0,_is_supported_interaction_item__WEBPACK_IMPORTED_MODULE_0__.isSupportedInteractionItem)(interaction); | |
| 2816 | - }); | |
| 2817 | -}; | |
| 2818 | - | |
| 2819 | -/***/ }), | |
| 2820 | - | |
| 2821 | -/***/ "./packages/packages/core/editor-interactions/src/utils/get-interactions-config.ts": | |
| 2822 | -/*!*****************************************************************************************!*\ | |
| 2823 | - !*** ./packages/packages/core/editor-interactions/src/utils/get-interactions-config.ts ***! | |
| 2824 | - \*****************************************************************************************/ | |
| 2825 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2826 | - | |
| 2827 | -__webpack_require__.r(__webpack_exports__); | |
| 2828 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2829 | -/* harmony export */ getInteractionsConfig: function() { return /* binding */ getInteractionsConfig; } | |
| 2830 | -/* harmony export */ }); | |
| 2831 | -function getInteractionsConfig() { | |
| 2832 | - return window.ElementorInteractionsConfig ?? {}; | |
| 2833 | -} | |
| 2834 | - | |
| 2835 | -/***/ }), | |
| 2836 | - | |
| 2837 | -/***/ "./packages/packages/core/editor-interactions/src/utils/is-supported-interaction-item.ts": | |
| 2838 | -/*!***********************************************************************************************!*\ | |
| 2839 | - !*** ./packages/packages/core/editor-interactions/src/utils/is-supported-interaction-item.ts ***! | |
| 2840 | - \***********************************************************************************************/ | |
| 2841 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2842 | - | |
| 2843 | -__webpack_require__.r(__webpack_exports__); | |
| 2844 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2845 | -/* harmony export */ isSupportedInteractionItem: function() { return /* binding */ isSupportedInteractionItem; } | |
| 2846 | -/* harmony export */ }); | |
| 2847 | -/* harmony import */ var _interactions_controls_registry__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../interactions-controls-registry */ "./packages/packages/core/editor-interactions/src/interactions-controls-registry.ts"); | |
| 2848 | -/* harmony import */ var _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/prop-value-utils */ "./packages/packages/core/editor-interactions/src/utils/prop-value-utils.ts"); | |
| 2849 | - | |
| 2850 | - | |
| 2851 | -function isSupportedInteractionItem(interaction) { | |
| 2852 | - const value = interaction.value; | |
| 2853 | - const replay = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_1__.extractBoolean)(value.animation.value.config?.value.replay); | |
| 2854 | - if (true === replay) { | |
| 2855 | - return hasSupport('replay', 'yes'); | |
| 2856 | - } | |
| 2857 | - const trigger = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_1__.extractString)(value.trigger); | |
| 2858 | - const easing = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_1__.extractString)(value.animation.value.config?.value.easing); | |
| 2859 | - const effect = (0,_utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_1__.extractString)(value.animation.value.effect); | |
| 2860 | - const checks = [['trigger', trigger], ['easing', easing], ['effect', effect]]; | |
| 2861 | - return checks.every(([controlType, controlValue]) => { | |
| 2862 | - if (controlValue === '' || controlValue === null) { | |
| 2863 | - return true; | |
| 2864 | - } | |
| 2865 | - return hasSupport(controlType, controlValue); | |
| 2866 | - }); | |
| 2867 | -} | |
| 2868 | -function hasSupport(controlType, controlValue) { | |
| 2869 | - const supportedOptions = (0,_interactions_controls_registry__WEBPACK_IMPORTED_MODULE_0__.getInteractionsControlOptions)(controlType); | |
| 2870 | - if (1 > supportedOptions.length) { | |
| 2871 | - return true; | |
| 2872 | - } | |
| 2873 | - return supportedOptions.includes(controlValue); | |
| 2874 | -} | |
| 2875 | - | |
| 2876 | -/***/ }), | |
| 2877 | - | |
| 2878 | -/***/ "./packages/packages/core/editor-interactions/src/utils/prop-value-utils.ts": | |
| 2879 | -/*!**********************************************************************************!*\ | |
| 2880 | - !*** ./packages/packages/core/editor-interactions/src/utils/prop-value-utils.ts ***! | |
| 2881 | - \**********************************************************************************/ | |
| 2882 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 2883 | - | |
| 2884 | -__webpack_require__.r(__webpack_exports__); | |
| 2885 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 2886 | -/* harmony export */ buildDisplayLabel: function() { return /* binding */ buildDisplayLabel; }, | |
| 2887 | -/* harmony export */ createAnimationPreset: function() { return /* binding */ createAnimationPreset; }, | |
| 2888 | -/* harmony export */ createBoolean: function() { return /* binding */ createBoolean; }, | |
| 2889 | -/* harmony export */ createConfig: function() { return /* binding */ createConfig; }, | |
| 2890 | -/* harmony export */ createDefaultInteractionItem: function() { return /* binding */ createDefaultInteractionItem; }, | |
| 2891 | -/* harmony export */ createDefaultInteractions: function() { return /* binding */ createDefaultInteractions; }, | |
| 2892 | -/* harmony export */ createExcludedBreakpoints: function() { return /* binding */ createExcludedBreakpoints; }, | |
| 2893 | -/* harmony export */ createInteractionBreakpoints: function() { return /* binding */ createInteractionBreakpoints; }, | |
| 2894 | -/* harmony export */ createInteractionItem: function() { return /* binding */ createInteractionItem; }, | |
| 2895 | -/* harmony export */ createNumber: function() { return /* binding */ createNumber; }, | |
| 2896 | -/* harmony export */ createString: function() { return /* binding */ createString; }, | |
| 2897 | -/* harmony export */ createTimingConfig: function() { return /* binding */ createTimingConfig; }, | |
| 2898 | -/* harmony export */ extractBoolean: function() { return /* binding */ extractBoolean; }, | |
| 2899 | -/* harmony export */ extractExcludedBreakpoints: function() { return /* binding */ extractExcludedBreakpoints; }, | |
| 2900 | -/* harmony export */ extractSize: function() { return /* binding */ extractSize; }, | |
| 2901 | -/* harmony export */ extractString: function() { return /* binding */ extractString; } | |
| 2902 | -/* harmony export */ }); | |
| 2903 | -/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props"); | |
| 2904 | -/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_0__); | |
| 2905 | -/* harmony import */ var _configs_time_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../configs/time-constants */ "./packages/packages/core/editor-interactions/src/configs/time-constants.ts"); | |
| 2906 | -/* harmony import */ var _utils_size_transform_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/size-transform-utils */ "./packages/packages/core/editor-interactions/src/utils/size-transform-utils.ts"); | |
| 2907 | -/* harmony import */ var _custom_effect_to_prop_value__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./custom-effect-to-prop-value */ "./packages/packages/core/editor-interactions/src/utils/custom-effect-to-prop-value.ts"); | |
| 2908 | -/* harmony import */ var _get_interactions_config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./get-interactions-config */ "./packages/packages/core/editor-interactions/src/utils/get-interactions-config.ts"); | |
| 2909 | -/* harmony import */ var _temp_id_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./temp-id-utils */ "./packages/packages/core/editor-interactions/src/utils/temp-id-utils.ts"); | |
| 2910 | - | |
| 2911 | - | |
| 2912 | - | |
| 2913 | - | |
| 2914 | - | |
| 2915 | - | |
| 2916 | -const createString = value => ({ | |
| 2917 | - $$type: 'string', | |
| 2918 | - value | |
| 2919 | -}); | |
| 2920 | -const createNumber = value => ({ | |
| 2921 | - $$type: 'number', | |
| 2922 | - value | |
| 2923 | -}); | |
| 2924 | -const createTimingConfig = (duration, delay) => ({ | |
| 2925 | - $$type: 'timing-config', | |
| 2926 | - value: { | |
| 2927 | - duration: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_0__.sizePropTypeUtil.create((0,_utils_size_transform_utils__WEBPACK_IMPORTED_MODULE_2__.parseSizeValue)(duration, _configs_time_constants__WEBPACK_IMPORTED_MODULE_1__.TIME_UNITS, undefined, _configs_time_constants__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_TIME_UNIT)), | |
| 2928 | - delay: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_0__.sizePropTypeUtil.create((0,_utils_size_transform_utils__WEBPACK_IMPORTED_MODULE_2__.parseSizeValue)(delay, _configs_time_constants__WEBPACK_IMPORTED_MODULE_1__.TIME_UNITS, undefined, _configs_time_constants__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_TIME_UNIT)) | |
| 2929 | - } | |
| 2930 | -}); | |
| 2931 | -const createBoolean = value => ({ | |
| 2932 | - $$type: 'boolean', | |
| 2933 | - value | |
| 2934 | -}); | |
| 2935 | -const createConfig = ({ | |
| 2936 | - replay, | |
| 2937 | - easing = 'easeIn', | |
| 2938 | - relativeTo = 'viewport', | |
| 2939 | - repeat = '', | |
| 2940 | - times = 1, | |
| 2941 | - start = 85, | |
| 2942 | - end = 15 | |
| 2943 | -}) => ({ | |
| 2944 | - $$type: 'config', | |
| 2945 | - value: { | |
| 2946 | - replay: createBoolean(replay), | |
| 2947 | - easing: createString(easing), | |
| 2948 | - relativeTo: createString(relativeTo), | |
| 2949 | - repeat: createString(repeat), | |
| 2950 | - times: createNumber(times), | |
| 2951 | - start: createSize(start, '%'), | |
| 2952 | - end: createSize(end, '%') | |
| 2953 | - } | |
| 2954 | -}); | |
| 2955 | -const createSize = (value, defaultUnit, defaultValue) => { | |
| 2956 | - if (!value) { | |
| 2957 | - return; | |
| 2958 | - } | |
| 2959 | - return _elementor_editor_props__WEBPACK_IMPORTED_MODULE_0__.sizePropTypeUtil.create((0,_utils_size_transform_utils__WEBPACK_IMPORTED_MODULE_2__.parseSizeValue)(value, ['%'], defaultValue, defaultUnit)); | |
| 2960 | -}; | |
| 2961 | -const extractBoolean = (prop, fallback = false) => { | |
| 2962 | - return prop?.value ?? fallback; | |
| 2963 | -}; | |
| 2964 | -const createExcludedBreakpoints = breakpoints => ({ | |
| 2965 | - $$type: 'excluded-breakpoints', | |
| 2966 | - value: breakpoints.map(createString) | |
| 2967 | -}); | |
| 2968 | -const createInteractionBreakpoints = excluded => ({ | |
| 2969 | - $$type: 'interaction-breakpoints', | |
| 2970 | - value: { | |
| 2971 | - excluded: createExcludedBreakpoints(excluded) | |
| 2972 | - } | |
| 2973 | -}); | |
| 2974 | -const extractExcludedBreakpoints = breakpoints => { | |
| 2975 | - return breakpoints?.value.excluded.value.map(bp => bp.value) ?? []; | |
| 2976 | -}; | |
| 2977 | -const createAnimationPreset = ({ | |
| 2978 | - effect, | |
| 2979 | - type, | |
| 2980 | - direction, | |
| 2981 | - duration, | |
| 2982 | - delay, | |
| 2983 | - replay = false, | |
| 2984 | - easing = 'easeIn', | |
| 2985 | - relativeTo, | |
| 2986 | - repeat, | |
| 2987 | - times, | |
| 2988 | - start, | |
| 2989 | - end, | |
| 2990 | - customEffects | |
| 2991 | -}) => { | |
| 2992 | - const customEffectProp = (0,_custom_effect_to_prop_value__WEBPACK_IMPORTED_MODULE_3__.toCustomEffectPropValue)(customEffects); | |
| 2993 | - return { | |
| 2994 | - $$type: 'animation-preset-props', | |
| 2995 | - value: { | |
| 2996 | - effect: createString(effect), | |
| 2997 | - ...(customEffectProp !== undefined && { | |
| 2998 | - custom_effect: customEffectProp | |
| 2999 | - }), | |
| 3000 | - type: createString(type), | |
| 3001 | - direction: createString(direction ?? ''), | |
| 3002 | - timing_config: createTimingConfig(duration, delay), | |
| 3003 | - config: createConfig({ | |
| 3004 | - replay, | |
| 3005 | - easing, | |
| 3006 | - relativeTo, | |
| 3007 | - repeat, | |
| 3008 | - times, | |
| 3009 | - start, | |
| 3010 | - end | |
| 3011 | - }) | |
| 3012 | - } | |
| 3013 | - }; | |
| 3014 | -}; | |
| 3015 | -const createInteractionItem = ({ | |
| 3016 | - trigger, | |
| 3017 | - effect, | |
| 3018 | - type, | |
| 3019 | - direction, | |
| 3020 | - duration, | |
| 3021 | - delay, | |
| 3022 | - interactionId, | |
| 3023 | - replay = false, | |
| 3024 | - easing = 'easeIn', | |
| 3025 | - relativeTo, | |
| 3026 | - repeat, | |
| 3027 | - times, | |
| 3028 | - start, | |
| 3029 | - end, | |
| 3030 | - excludedBreakpoints, | |
| 3031 | - customEffects | |
| 3032 | -}) => ({ | |
| 3033 | - $$type: 'interaction-item', | |
| 3034 | - value: { | |
| 3035 | - ...(interactionId && { | |
| 3036 | - interaction_id: createString(interactionId) | |
| 3037 | - }), | |
| 3038 | - trigger: createString(trigger ?? ''), | |
| 3039 | - animation: createAnimationPreset({ | |
| 3040 | - effect: effect ?? '', | |
| 3041 | - type: type ?? '', | |
| 3042 | - direction, | |
| 3043 | - duration: duration ?? 0, | |
| 3044 | - delay: delay ?? 0, | |
| 3045 | - replay, | |
| 3046 | - easing, | |
| 3047 | - relativeTo, | |
| 3048 | - repeat, | |
| 3049 | - times, | |
| 3050 | - start, | |
| 3051 | - end, | |
| 3052 | - customEffects | |
| 3053 | - }), | |
| 3054 | - ...(excludedBreakpoints && excludedBreakpoints.length > 0 && { | |
| 3055 | - breakpoints: createInteractionBreakpoints(excludedBreakpoints) | |
| 3056 | - }) | |
| 3057 | - } | |
| 3058 | -}); | |
| 3059 | -const createDefaultInteractionItem = () => { | |
| 3060 | - const { | |
| 3061 | - constants | |
| 3062 | - } = (0,_get_interactions_config__WEBPACK_IMPORTED_MODULE_4__.getInteractionsConfig)(); | |
| 3063 | - return createInteractionItem({ | |
| 3064 | - trigger: 'load', | |
| 3065 | - effect: 'fade', | |
| 3066 | - type: 'in', | |
| 3067 | - duration: constants.defaultDuration, | |
| 3068 | - delay: constants.defaultDelay, | |
| 3069 | - replay: false, | |
| 3070 | - easing: constants.defaultEasing, | |
| 3071 | - interactionId: (0,_temp_id_utils__WEBPACK_IMPORTED_MODULE_5__.generateTempInteractionId)() | |
| 3072 | - }); | |
| 3073 | -}; | |
| 3074 | -const createDefaultInteractions = () => ({ | |
| 3075 | - version: 1, | |
| 3076 | - items: [createDefaultInteractionItem()] | |
| 3077 | -}); | |
| 3078 | -const extractString = (prop, fallback = '') => { | |
| 3079 | - return prop?.value ?? fallback; | |
| 3080 | -}; | |
| 3081 | -const extractSize = (prop, defaultValue) => { | |
| 3082 | - if (!prop?.value) { | |
| 3083 | - return defaultValue; | |
| 3084 | - } | |
| 3085 | - return (0,_utils_size_transform_utils__WEBPACK_IMPORTED_MODULE_2__.formatSizeValue)(prop.value); | |
| 3086 | -}; | |
| 3087 | -const TRIGGER_LABELS = { | |
| 3088 | - load: 'On page load', | |
| 3089 | - scrollIn: 'Scroll into view', | |
| 3090 | - scrollOut: 'Scroll out of view', | |
| 3091 | - scrollOn: 'While scrolling' | |
| 3092 | -}; | |
| 3093 | -const capitalize = str => { | |
| 3094 | - return str.charAt(0).toUpperCase() + str.slice(1); | |
| 3095 | -}; | |
| 3096 | -const buildDisplayLabel = item => { | |
| 3097 | - const trigger = extractString(item.trigger); | |
| 3098 | - const effect = extractString(item.animation.value.effect); | |
| 3099 | - const type = extractString(item.animation.value.type); | |
| 3100 | - const triggerLabel = TRIGGER_LABELS[trigger] || capitalize(trigger); | |
| 3101 | - const effectLabel = capitalize(effect); | |
| 3102 | - const typeLabel = 'custom' === effect ? '' : capitalize(type); | |
| 3103 | - return `${triggerLabel}: ${effectLabel} ${typeLabel}`; | |
| 3104 | -}; | |
| 3105 | - | |
| 3106 | -/***/ }), | |
| 3107 | - | |
| 3108 | -/***/ "./packages/packages/core/editor-interactions/src/utils/resolve-direction.ts": | |
| 3109 | -/*!***********************************************************************************!*\ | |
| 3110 | - !*** ./packages/packages/core/editor-interactions/src/utils/resolve-direction.ts ***! | |
| 3111 | - \***********************************************************************************/ | |
| 3112 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 3113 | - | |
| 3114 | -__webpack_require__.r(__webpack_exports__); | |
| 3115 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 3116 | -/* harmony export */ resolveDirection: function() { return /* binding */ resolveDirection; } | |
| 3117 | -/* harmony export */ }); | |
| 3118 | -const resolveDirection = (hasDirection, newEffect, newDirection, currentDirection, currentEffect) => { | |
| 3119 | - if (newEffect === 'slide' && !newDirection) { | |
| 3120 | - return 'top'; | |
| 3121 | - } | |
| 3122 | - if (currentEffect === 'slide' && hasDirection) { | |
| 3123 | - return newDirection || 'top'; | |
| 3124 | - } | |
| 3125 | - if (hasDirection) { | |
| 3126 | - return newDirection; | |
| 3127 | - } | |
| 3128 | - return currentDirection; | |
| 3129 | -}; | |
| 3130 | - | |
| 3131 | -/***/ }), | |
| 3132 | - | |
| 3133 | -/***/ "./packages/packages/core/editor-interactions/src/utils/scroll-interaction-event.ts": | |
| 3134 | -/*!******************************************************************************************!*\ | |
| 3135 | - !*** ./packages/packages/core/editor-interactions/src/utils/scroll-interaction-event.ts ***! | |
| 3136 | - \******************************************************************************************/ | |
| 3137 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 3138 | - | |
| 3139 | -__webpack_require__.r(__webpack_exports__); | |
| 3140 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 3141 | -/* harmony export */ SCROLL_INTERACTION_EVENT: function() { return /* binding */ SCROLL_INTERACTION_EVENT; }, | |
| 3142 | -/* harmony export */ dispatchScrollInteraction: function() { return /* binding */ dispatchScrollInteraction; }, | |
| 3143 | -/* harmony export */ extractScrollOverlayParams: function() { return /* binding */ extractScrollOverlayParams; }, | |
| 3144 | -/* harmony export */ syncGridOverlay: function() { return /* binding */ syncGridOverlay; } | |
| 3145 | -/* harmony export */ }); | |
| 3146 | -/* harmony import */ var _prop_value_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./prop-value-utils */ "./packages/packages/core/editor-interactions/src/utils/prop-value-utils.ts"); | |
| 3147 | - | |
| 3148 | -const SCROLL_INTERACTION_EVENT = 'elementor/interactions/scroll-change'; | |
| 3149 | -function dispatchScrollInteraction(data) { | |
| 3150 | - window.dispatchEvent(new CustomEvent(SCROLL_INTERACTION_EVENT, { | |
| 3151 | - detail: data | |
| 3152 | - })); | |
| 3153 | -} | |
| 3154 | -function extractScrollOverlayParams(interaction, defaults) { | |
| 3155 | - return { | |
| 3156 | - trigger: (0,_prop_value_utils__WEBPACK_IMPORTED_MODULE_0__.extractString)(interaction.trigger, defaults.trigger), | |
| 3157 | - start: (0,_prop_value_utils__WEBPACK_IMPORTED_MODULE_0__.extractSize)(interaction.animation.value.config?.value.start, defaults.start), | |
| 3158 | - end: (0,_prop_value_utils__WEBPACK_IMPORTED_MODULE_0__.extractSize)(interaction.animation.value.config?.value.end, defaults.end), | |
| 3159 | - relativeTo: (0,_prop_value_utils__WEBPACK_IMPORTED_MODULE_0__.extractString)(interaction.animation.value.config?.value.relativeTo, defaults.relativeTo) | |
| 3160 | - }; | |
| 3161 | -} | |
| 3162 | -function syncGridOverlay(trigger, start, end, relativeTo) { | |
| 3163 | - if (trigger === 'scrollOn') { | |
| 3164 | - dispatchScrollInteraction({ | |
| 3165 | - start, | |
| 3166 | - end, | |
| 3167 | - relativeTo | |
| 3168 | - }); | |
| 3169 | - } else { | |
| 3170 | - dispatchScrollInteraction(null); | |
| 3171 | - } | |
| 3172 | -} | |
| 3173 | - | |
| 3174 | -/***/ }), | |
| 3175 | - | |
| 3176 | -/***/ "./packages/packages/core/editor-interactions/src/utils/size-transform-utils.ts": | |
| 3177 | -/*!**************************************************************************************!*\ | |
| 3178 | - !*** ./packages/packages/core/editor-interactions/src/utils/size-transform-utils.ts ***! | |
| 3179 | - \**************************************************************************************/ | |
| 3180 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 3181 | - | |
| 3182 | -__webpack_require__.r(__webpack_exports__); | |
| 3183 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 3184 | -/* harmony export */ formatSizeValue: function() { return /* binding */ formatSizeValue; }, | |
| 3185 | -/* harmony export */ parseSizeValue: function() { return /* binding */ parseSizeValue; } | |
| 3186 | -/* harmony export */ }); | |
| 3187 | -const SIZE_REGEX = /^(?:(-?\d*\.?\d+)([a-z%]+)|([a-z%]+))$/i; | |
| 3188 | -const parseSizeValue = (value, allowedUnits, defaultValue, defaultUnit) => { | |
| 3189 | - if (typeof value === 'number') { | |
| 3190 | - return { | |
| 3191 | - size: value, | |
| 3192 | - unit: defaultUnit | |
| 3193 | - }; | |
| 3194 | - } | |
| 3195 | - const sizeValue = tryParse(value, allowedUnits, defaultUnit); | |
| 3196 | - if (sizeValue) { | |
| 3197 | - return sizeValue; | |
| 3198 | - } | |
| 3199 | - if (defaultValue) { | |
| 3200 | - const fallbackSize = tryParse(defaultValue, allowedUnits, defaultUnit); | |
| 3201 | - if (fallbackSize) { | |
| 3202 | - return fallbackSize; | |
| 3203 | - } | |
| 3204 | - } | |
| 3205 | - return createSizeValue(null, defaultUnit); | |
| 3206 | -}; | |
| 3207 | -const tryParse = (value, allowedUnits, defaultUnit) => { | |
| 3208 | - if (typeof value === 'number') { | |
| 3209 | - return createSizeValue(value, defaultUnit); | |
| 3210 | - } | |
| 3211 | - const match = value && value.match(SIZE_REGEX); | |
| 3212 | - if (!match) { | |
| 3213 | - if (value) { | |
| 3214 | - return { | |
| 3215 | - size: Number(value), | |
| 3216 | - unit: defaultUnit | |
| 3217 | - }; | |
| 3218 | - } | |
| 3219 | - return null; | |
| 3220 | - } | |
| 3221 | - const size = match[1] ? parseFloat(match[1]) : null; | |
| 3222 | - const unit = match[2] || match[3]; | |
| 3223 | - if (!allowedUnits.includes(unit)) { | |
| 3224 | - return null; | |
| 3225 | - } | |
| 3226 | - return createSizeValue(size, unit); | |
| 3227 | -}; | |
| 3228 | -const formatSizeValue = ({ | |
| 3229 | - size, | |
| 3230 | - unit | |
| 3231 | -}) => { | |
| 3232 | - return `${size ?? ''}${unit}`; | |
| 3233 | -}; | |
| 3234 | -const createSizeValue = (size, unit) => { | |
| 3235 | - return { | |
| 3236 | - size, | |
| 3237 | - unit | |
| 3238 | - }; | |
| 3239 | -}; | |
| 3240 | - | |
| 3241 | -/***/ }), | |
| 3242 | - | |
| 3243 | -/***/ "./packages/packages/core/editor-interactions/src/utils/temp-id-utils.ts": | |
| 3244 | -/*!*******************************************************************************!*\ | |
| 3245 | - !*** ./packages/packages/core/editor-interactions/src/utils/temp-id-utils.ts ***! | |
| 3246 | - \*******************************************************************************/ | |
| 3247 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 3248 | - | |
| 3249 | -__webpack_require__.r(__webpack_exports__); | |
| 3250 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 3251 | -/* harmony export */ generateTempInteractionId: function() { return /* binding */ generateTempInteractionId; }, | |
| 3252 | -/* harmony export */ isTempId: function() { return /* binding */ isTempId; } | |
| 3253 | -/* harmony export */ }); | |
| 3254 | -const TEMP_ID_PREFIX = 'temp-'; | |
| 3255 | -const TEMP_ID_REGEX = /^temp-[a-z0-9]+$/i; | |
| 3256 | -function generateTempInteractionId() { | |
| 3257 | - return `${TEMP_ID_PREFIX}${Math.random().toString(36).substring(2, 11)}`; | |
| 3258 | -} | |
| 3259 | -function isTempId(id) { | |
| 3260 | - return !!id && TEMP_ID_REGEX.test(id); | |
| 3261 | -} | |
| 3262 | - | |
| 3263 | -/***/ }), | |
| 3264 | - | |
| 3265 | -/***/ "./packages/packages/core/editor-interactions/src/utils/tracking.ts": | |
| 3266 | -/*!**************************************************************************!*\ | |
| 3267 | - !*** ./packages/packages/core/editor-interactions/src/utils/tracking.ts ***! | |
| 3268 | - \**************************************************************************/ | |
| 3269 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 3270 | - | |
| 3271 | -__webpack_require__.r(__webpack_exports__); | |
| 3272 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 3273 | -/* harmony export */ trackInteractionCreated: function() { return /* binding */ trackInteractionCreated; } | |
| 3274 | -/* harmony export */ }); | |
| 3275 | -/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/editor-elements */ "@elementor/editor-elements"); | |
| 3276 | -/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__); | |
| 3277 | -/* harmony import */ var _elementor_events__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/events */ "@elementor/events"); | |
| 3278 | -/* harmony import */ var _elementor_events__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_events__WEBPACK_IMPORTED_MODULE_1__); | |
| 3279 | -/* harmony import */ var _prop_value_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./prop-value-utils */ "./packages/packages/core/editor-interactions/src/utils/prop-value-utils.ts"); | |
| 3280 | - | |
| 3281 | - | |
| 3282 | - | |
| 3283 | -const TRIGGER_LABELS = { | |
| 3284 | - load: 'On page load', | |
| 3285 | - scrollIn: 'Scroll into view', | |
| 3286 | - scrollOut: 'Scroll out of view', | |
| 3287 | - scrollOn: 'While scrolling', | |
| 3288 | - hover: 'Hover', | |
| 3289 | - click: 'Click' | |
| 3290 | -}; | |
| 3291 | -const capitalize = s => s.charAt(0).toUpperCase() + s.slice(1); | |
| 3292 | -const trackInteractionCreated = (elementId, item) => { | |
| 3293 | - const { | |
| 3294 | - dispatchEvent, | |
| 3295 | - config | |
| 3296 | - } = (0,_elementor_events__WEBPACK_IMPORTED_MODULE_1__.getMixpanel)(); | |
| 3297 | - if (!config?.names?.interactions?.created) { | |
| 3298 | - return; | |
| 3299 | - } | |
| 3300 | - const trigger = (0,_prop_value_utils__WEBPACK_IMPORTED_MODULE_2__.extractString)(item.value.trigger); | |
| 3301 | - const effect = (0,_prop_value_utils__WEBPACK_IMPORTED_MODULE_2__.extractString)(item.value.animation.value.effect); | |
| 3302 | - const type = (0,_prop_value_utils__WEBPACK_IMPORTED_MODULE_2__.extractString)(item.value.animation.value.type); | |
| 3303 | - dispatchEvent?.(config.names.interactions.created, { | |
| 3304 | - app_type: config?.appTypes?.editor, | |
| 3305 | - window_name: config?.appTypes?.editor, | |
| 3306 | - interaction_type: config?.triggers?.click, | |
| 3307 | - target_name: (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__.getElementLabel)(elementId), | |
| 3308 | - interaction_result: 'interaction_created', | |
| 3309 | - target_location: config?.locations?.widgetPanel, | |
| 3310 | - location_l1: (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__.getElementLabel)(elementId), | |
| 3311 | - location_l2: 'interactions', | |
| 3312 | - interaction_description: 'interaction_created', | |
| 3313 | - interaction_trigger: TRIGGER_LABELS[trigger] ?? capitalize(trigger), | |
| 3314 | - interaction_effect: effect === 'custom' ? capitalize(effect) : `${capitalize(effect)} ${capitalize(type)}` | |
| 3315 | - }); | |
| 3316 | -}; | |
| 3317 | - | |
| 3318 | -/***/ }), | |
| 3319 | - | |
| 3320 | -/***/ "@elementor/editor-controls": | |
| 3321 | -/*!*************************************************!*\ | |
| 3322 | - !*** external ["elementorV2","editorControls"] ***! | |
| 3323 | - \*************************************************/ | |
| 3324 | -/***/ (function(module) { | |
| 3325 | - | |
| 3326 | -module.exports = window["elementorV2"]["editorControls"]; | |
| 3327 | - | |
| 3328 | -/***/ }), | |
| 3329 | - | |
| 3330 | -/***/ "@elementor/editor-elements": | |
| 3331 | -/*!*************************************************!*\ | |
| 3332 | - !*** external ["elementorV2","editorElements"] ***! | |
| 3333 | - \*************************************************/ | |
| 3334 | -/***/ (function(module) { | |
| 3335 | - | |
| 3336 | -module.exports = window["elementorV2"]["editorElements"]; | |
| 3337 | - | |
| 3338 | -/***/ }), | |
| 3339 | - | |
| 3340 | -/***/ "@elementor/editor-mcp": | |
| 3341 | -/*!********************************************!*\ | |
| 3342 | - !*** external ["elementorV2","editorMcp"] ***! | |
| 3343 | - \********************************************/ | |
| 3344 | -/***/ (function(module) { | |
| 3345 | - | |
| 3346 | -module.exports = window["elementorV2"]["editorMcp"]; | |
| 3347 | - | |
| 3348 | -/***/ }), | |
| 3349 | - | |
| 3350 | -/***/ "@elementor/editor-props": | |
| 3351 | -/*!**********************************************!*\ | |
| 3352 | - !*** external ["elementorV2","editorProps"] ***! | |
| 3353 | - \**********************************************/ | |
| 3354 | -/***/ (function(module) { | |
| 3355 | - | |
| 3356 | -module.exports = window["elementorV2"]["editorProps"]; | |
| 3357 | - | |
| 3358 | -/***/ }), | |
| 3359 | - | |
| 3360 | -/***/ "@elementor/editor-responsive": | |
| 3361 | -/*!***************************************************!*\ | |
| 3362 | - !*** external ["elementorV2","editorResponsive"] ***! | |
| 3363 | - \***************************************************/ | |
| 3364 | -/***/ (function(module) { | |
| 3365 | - | |
| 3366 | -module.exports = window["elementorV2"]["editorResponsive"]; | |
| 3367 | - | |
| 3368 | -/***/ }), | |
| 3369 | - | |
| 3370 | -/***/ "@elementor/editor-ui": | |
| 3371 | -/*!*******************************************!*\ | |
| 3372 | - !*** external ["elementorV2","editorUi"] ***! | |
| 3373 | - \*******************************************/ | |
| 3374 | -/***/ (function(module) { | |
| 3375 | - | |
| 3376 | -module.exports = window["elementorV2"]["editorUi"]; | |
| 3377 | - | |
| 3378 | -/***/ }), | |
| 3379 | - | |
| 3380 | -/***/ "@elementor/editor-v1-adapters": | |
| 3381 | -/*!***************************************************!*\ | |
| 3382 | - !*** external ["elementorV2","editorV1Adapters"] ***! | |
| 3383 | - \***************************************************/ | |
| 3384 | -/***/ (function(module) { | |
| 3385 | - | |
| 3386 | -module.exports = window["elementorV2"]["editorV1Adapters"]; | |
| 3387 | - | |
| 3388 | -/***/ }), | |
| 3389 | - | |
| 3390 | -/***/ "@elementor/events": | |
| 3391 | -/*!*****************************************!*\ | |
| 3392 | - !*** external ["elementorV2","events"] ***! | |
| 3393 | - \*****************************************/ | |
| 3394 | -/***/ (function(module) { | |
| 3395 | - | |
| 3396 | -module.exports = window["elementorV2"]["events"]; | |
| 3397 | - | |
| 3398 | -/***/ }), | |
| 3399 | - | |
| 3400 | -/***/ "@elementor/icons": | |
| 3401 | -/*!****************************************!*\ | |
| 3402 | - !*** external ["elementorV2","icons"] ***! | |
| 3403 | - \****************************************/ | |
| 3404 | -/***/ (function(module) { | |
| 3405 | - | |
| 3406 | -module.exports = window["elementorV2"]["icons"]; | |
| 3407 | - | |
| 3408 | -/***/ }), | |
| 3409 | - | |
| 3410 | -/***/ "@elementor/schema": | |
| 3411 | -/*!*****************************************!*\ | |
| 3412 | - !*** external ["elementorV2","schema"] ***! | |
| 3413 | - \*****************************************/ | |
| 3414 | -/***/ (function(module) { | |
| 3415 | - | |
| 3416 | -module.exports = window["elementorV2"]["schema"]; | |
| 3417 | - | |
| 3418 | -/***/ }), | |
| 3419 | - | |
| 3420 | -/***/ "@elementor/session": | |
| 3421 | -/*!******************************************!*\ | |
| 3422 | - !*** external ["elementorV2","session"] ***! | |
| 3423 | - \******************************************/ | |
| 3424 | -/***/ (function(module) { | |
| 3425 | - | |
| 3426 | -module.exports = window["elementorV2"]["session"]; | |
| 3427 | - | |
| 3428 | -/***/ }), | |
| 3429 | - | |
| 3430 | -/***/ "@elementor/ui": | |
| 3431 | -/*!*************************************!*\ | |
| 3432 | - !*** external ["elementorV2","ui"] ***! | |
| 3433 | - \*************************************/ | |
| 3434 | -/***/ (function(module) { | |
| 3435 | - | |
| 3436 | -module.exports = window["elementorV2"]["ui"]; | |
| 3437 | - | |
| 3438 | -/***/ }), | |
| 3439 | - | |
| 3440 | -/***/ "@elementor/utils": | |
| 3441 | -/*!****************************************!*\ | |
| 3442 | - !*** external ["elementorV2","utils"] ***! | |
| 3443 | - \****************************************/ | |
| 3444 | -/***/ (function(module) { | |
| 3445 | - | |
| 3446 | -module.exports = window["elementorV2"]["utils"]; | |
| 3447 | - | |
| 3448 | -/***/ }), | |
| 3449 | - | |
| 3450 | -/***/ "@wordpress/i18n": | |
| 3451 | -/*!******************************!*\ | |
| 3452 | - !*** external ["wp","i18n"] ***! | |
| 3453 | - \******************************/ | |
| 3454 | -/***/ (function(module) { | |
| 3455 | - | |
| 3456 | -module.exports = window["wp"]["i18n"]; | |
| 3457 | - | |
| 3458 | -/***/ }), | |
| 3459 | - | |
| 3460 | -/***/ "react": | |
| 3461 | -/*!**************************!*\ | |
| 3462 | - !*** external ["React"] ***! | |
| 3463 | - \**************************/ | |
| 3464 | -/***/ (function(module) { | |
| 3465 | - | |
| 3466 | -module.exports = window["React"]; | |
| 3467 | - | |
| 3468 | -/***/ }) | |
| 3469 | - | |
| 3470 | -/******/ }); | |
| 3471 | -/************************************************************************/ | |
| 3472 | -/******/ // The module cache | |
| 3473 | -/******/ var __webpack_module_cache__ = {}; | |
| 3474 | -/******/ | |
| 3475 | -/******/ // The require function | |
| 3476 | -/******/ function __webpack_require__(moduleId) { | |
| 3477 | -/******/ // Check if module is in cache | |
| 3478 | -/******/ var cachedModule = __webpack_module_cache__[moduleId]; | |
| 3479 | -/******/ if (cachedModule !== undefined) { | |
| 3480 | -/******/ return cachedModule.exports; | |
| 3481 | -/******/ } | |
| 3482 | -/******/ // Create a new module (and put it into the cache) | |
| 3483 | -/******/ var module = __webpack_module_cache__[moduleId] = { | |
| 3484 | -/******/ // no module.id needed | |
| 3485 | -/******/ // no module.loaded needed | |
| 3486 | -/******/ exports: {} | |
| 3487 | -/******/ }; | |
| 3488 | -/******/ | |
| 3489 | -/******/ // Execute the module function | |
| 3490 | -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); | |
| 3491 | -/******/ | |
| 3492 | -/******/ // Return the exports of the module | |
| 3493 | -/******/ return module.exports; | |
| 3494 | -/******/ } | |
| 3495 | -/******/ | |
| 3496 | -/************************************************************************/ | |
| 3497 | -/******/ /* webpack/runtime/compat get default export */ | |
| 3498 | -/******/ !function() { | |
| 3499 | -/******/ // getDefaultExport function for compatibility with non-harmony modules | |
| 3500 | -/******/ __webpack_require__.n = function(module) { | |
| 3501 | -/******/ var getter = module && module.__esModule ? | |
| 3502 | -/******/ function() { return module['default']; } : | |
| 3503 | -/******/ function() { return module; }; | |
| 3504 | -/******/ __webpack_require__.d(getter, { a: getter }); | |
| 3505 | -/******/ return getter; | |
| 3506 | -/******/ }; | |
| 3507 | -/******/ }(); | |
| 3508 | -/******/ | |
| 3509 | -/******/ /* webpack/runtime/define property getters */ | |
| 3510 | -/******/ !function() { | |
| 3511 | -/******/ // define getter functions for harmony exports | |
| 3512 | -/******/ __webpack_require__.d = function(exports, definition) { | |
| 3513 | -/******/ for(var key in definition) { | |
| 3514 | -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 3515 | -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 3516 | -/******/ } | |
| 3517 | -/******/ } | |
| 3518 | -/******/ }; | |
| 3519 | -/******/ }(); | |
| 3520 | -/******/ | |
| 3521 | -/******/ /* webpack/runtime/hasOwnProperty shorthand */ | |
| 3522 | -/******/ !function() { | |
| 3523 | -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } | |
| 3524 | -/******/ }(); | |
| 3525 | -/******/ | |
| 3526 | -/******/ /* webpack/runtime/make namespace object */ | |
| 3527 | -/******/ !function() { | |
| 3528 | -/******/ // define __esModule on exports | |
| 3529 | -/******/ __webpack_require__.r = function(exports) { | |
| 3530 | -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | |
| 3531 | -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | |
| 3532 | -/******/ } | |
| 3533 | -/******/ Object.defineProperty(exports, '__esModule', { value: true }); | |
| 3534 | -/******/ }; | |
| 3535 | -/******/ }(); | |
| 3536 | -/******/ | |
| 3537 | -/************************************************************************/ | |
| 3538 | -var __webpack_exports__ = {}; | |
| 3539 | -// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. | |
| 3540 | -!function() { | |
| 3541 | -/*!*****************************************************************!*\ | |
| 3542 | - !*** ./packages/packages/core/editor-interactions/src/index.ts ***! | |
| 3543 | - \*****************************************************************/ | |
| 3544 | -__webpack_require__.r(__webpack_exports__); | |
| 3545 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 3546 | -/* harmony export */ BASE_EASINGS: function() { return /* reexport safe */ _components_controls_easing__WEBPACK_IMPORTED_MODULE_9__.BASE_EASINGS; }, | |
| 3547 | -/* harmony export */ BASE_EFFECTS: function() { return /* reexport safe */ _components_controls_effect__WEBPACK_IMPORTED_MODULE_11__.BASE_EFFECTS; }, | |
| 3548 | -/* harmony export */ BASE_REPLAY: function() { return /* reexport safe */ _components_controls_replay__WEBPACK_IMPORTED_MODULE_10__.BASE_REPLAY; }, | |
| 3549 | -/* harmony export */ BASE_TRIGGERS: function() { return /* reexport safe */ _components_controls_trigger__WEBPACK_IMPORTED_MODULE_8__.BASE_TRIGGERS; }, | |
| 3550 | -/* harmony export */ DEFAULT_VALUES: function() { return /* reexport safe */ _components_interaction_details__WEBPACK_IMPORTED_MODULE_13__.DEFAULT_VALUES; }, | |
| 3551 | -/* harmony export */ EASING_OPTIONS: function() { return /* reexport safe */ _components_controls_easing__WEBPACK_IMPORTED_MODULE_9__.EASING_OPTIONS; }, | |
| 3552 | -/* harmony export */ EFFECT_OPTIONS: function() { return /* reexport safe */ _components_controls_effect__WEBPACK_IMPORTED_MODULE_11__.EFFECT_OPTIONS; }, | |
| 3553 | -/* harmony export */ ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX: function() { return /* reexport safe */ _providers_document_elements_interactions_provider__WEBPACK_IMPORTED_MODULE_5__.ELEMENTS_INTERACTIONS_PROVIDER_KEY_PREFIX; }, | |
| 3554 | -/* harmony export */ EmptyState: function() { return /* reexport safe */ _components_empty_state__WEBPACK_IMPORTED_MODULE_0__.EmptyState; }, | |
| 3555 | -/* harmony export */ InteractionsTab: function() { return /* reexport safe */ _components_interactions_tab__WEBPACK_IMPORTED_MODULE_1__.InteractionsTab; }, | |
| 3556 | -/* harmony export */ REPEAT_OPTIONS: function() { return /* reexport safe */ _components_controls_repeat__WEBPACK_IMPORTED_MODULE_12__.REPEAT_OPTIONS; }, | |
| 3557 | -/* harmony export */ REPEAT_TOOLTIPS: function() { return /* reexport safe */ _components_controls_repeat__WEBPACK_IMPORTED_MODULE_12__.REPEAT_TOOLTIPS; }, | |
| 3558 | -/* harmony export */ REPLAY_OPTIONS: function() { return /* reexport safe */ _components_controls_replay__WEBPACK_IMPORTED_MODULE_10__.REPLAY_OPTIONS; }, | |
| 3559 | -/* harmony export */ SCROLL_INTERACTION_EVENT: function() { return /* reexport safe */ _utils_scroll_interaction_event__WEBPACK_IMPORTED_MODULE_19__.SCROLL_INTERACTION_EVENT; }, | |
| 3560 | -/* harmony export */ TRIGGER_OPTIONS: function() { return /* reexport safe */ _components_controls_trigger__WEBPACK_IMPORTED_MODULE_8__.TRIGGER_OPTIONS; }, | |
| 3561 | -/* harmony export */ buildDisplayLabel: function() { return /* reexport safe */ _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_14__.buildDisplayLabel; }, | |
| 3562 | -/* harmony export */ createAnimationPreset: function() { return /* reexport safe */ _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_14__.createAnimationPreset; }, | |
| 3563 | -/* harmony export */ createBoolean: function() { return /* reexport safe */ _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_14__.createBoolean; }, | |
| 3564 | -/* harmony export */ createConfig: function() { return /* reexport safe */ _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_14__.createConfig; }, | |
| 3565 | -/* harmony export */ createDefaultInteractionItem: function() { return /* reexport safe */ _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_14__.createDefaultInteractionItem; }, | |
| 3566 | -/* harmony export */ createDefaultInteractions: function() { return /* reexport safe */ _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_14__.createDefaultInteractions; }, | |
| 3567 | -/* harmony export */ createExcludedBreakpoints: function() { return /* reexport safe */ _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_14__.createExcludedBreakpoints; }, | |
| 3568 | -/* harmony export */ createInteractionBreakpoints: function() { return /* reexport safe */ _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_14__.createInteractionBreakpoints; }, | |
| 3569 | -/* harmony export */ createInteractionItem: function() { return /* reexport safe */ _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_14__.createInteractionItem; }, | |
| 3570 | -/* harmony export */ createInteractionsProvider: function() { return /* reexport safe */ _utils_create_interactions_provider__WEBPACK_IMPORTED_MODULE_4__.createInteractionsProvider; }, | |
| 3571 | -/* harmony export */ createNumber: function() { return /* reexport safe */ _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_14__.createNumber; }, | |
| 3572 | -/* harmony export */ createString: function() { return /* reexport safe */ _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_14__.createString; }, | |
| 3573 | -/* harmony export */ createTimingConfig: function() { return /* reexport safe */ _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_14__.createTimingConfig; }, | |
| 3574 | -/* harmony export */ dispatchScrollInteraction: function() { return /* reexport safe */ _utils_scroll_interaction_event__WEBPACK_IMPORTED_MODULE_19__.dispatchScrollInteraction; }, | |
| 3575 | -/* harmony export */ extractBoolean: function() { return /* reexport safe */ _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_14__.extractBoolean; }, | |
| 3576 | -/* harmony export */ extractExcludedBreakpoints: function() { return /* reexport safe */ _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_14__.extractExcludedBreakpoints; }, | |
| 3577 | -/* harmony export */ extractScrollOverlayParams: function() { return /* reexport safe */ _utils_scroll_interaction_event__WEBPACK_IMPORTED_MODULE_19__.extractScrollOverlayParams; }, | |
| 3578 | -/* harmony export */ extractSize: function() { return /* reexport safe */ _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_14__.extractSize; }, | |
| 3579 | -/* harmony export */ extractString: function() { return /* reexport safe */ _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_14__.extractString; }, | |
| 3580 | -/* harmony export */ formatSizeValue: function() { return /* reexport safe */ _utils_size_transform_utils__WEBPACK_IMPORTED_MODULE_17__.formatSizeValue; }, | |
| 3581 | -/* harmony export */ generateTempInteractionId: function() { return /* reexport safe */ _utils_temp_id_utils__WEBPACK_IMPORTED_MODULE_15__.generateTempInteractionId; }, | |
| 3582 | -/* harmony export */ getInteractionsConfig: function() { return /* reexport safe */ _utils_get_interactions_config__WEBPACK_IMPORTED_MODULE_2__.getInteractionsConfig; }, | |
| 3583 | -/* harmony export */ init: function() { return /* reexport safe */ _init__WEBPACK_IMPORTED_MODULE_6__.init; }, | |
| 3584 | -/* harmony export */ interactionsRepository: function() { return /* reexport safe */ _interactions_repository__WEBPACK_IMPORTED_MODULE_3__.interactionsRepository; }, | |
| 3585 | -/* harmony export */ isTempId: function() { return /* reexport safe */ _utils_temp_id_utils__WEBPACK_IMPORTED_MODULE_15__.isTempId; }, | |
| 3586 | -/* harmony export */ parseSizeValue: function() { return /* reexport safe */ _utils_size_transform_utils__WEBPACK_IMPORTED_MODULE_17__.parseSizeValue; }, | |
| 3587 | -/* harmony export */ registerInteractionsControl: function() { return /* reexport safe */ _interactions_controls_registry__WEBPACK_IMPORTED_MODULE_7__.registerInteractionsControl; }, | |
| 3588 | -/* harmony export */ resolveDirection: function() { return /* reexport safe */ _utils_resolve_direction__WEBPACK_IMPORTED_MODULE_16__.resolveDirection; }, | |
| 3589 | -/* harmony export */ syncGridOverlay: function() { return /* reexport safe */ _utils_scroll_interaction_event__WEBPACK_IMPORTED_MODULE_19__.syncGridOverlay; }, | |
| 3590 | -/* harmony export */ useElementInteractions: function() { return /* reexport safe */ _hooks_use_element_interactions__WEBPACK_IMPORTED_MODULE_18__.useElementInteractions; } | |
| 3591 | -/* harmony export */ }); | |
| 3592 | -/* harmony import */ var _components_empty_state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./components/empty-state */ "./packages/packages/core/editor-interactions/src/components/empty-state.tsx"); | |
| 3593 | -/* harmony import */ var _components_interactions_tab__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/interactions-tab */ "./packages/packages/core/editor-interactions/src/components/interactions-tab.tsx"); | |
| 3594 | -/* harmony import */ var _utils_get_interactions_config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils/get-interactions-config */ "./packages/packages/core/editor-interactions/src/utils/get-interactions-config.ts"); | |
| 3595 | -/* harmony import */ var _interactions_repository__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./interactions-repository */ "./packages/packages/core/editor-interactions/src/interactions-repository.ts"); | |
| 3596 | -/* harmony import */ var _utils_create_interactions_provider__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/create-interactions-provider */ "./packages/packages/core/editor-interactions/src/utils/create-interactions-provider.ts"); | |
| 3597 | -/* harmony import */ var _providers_document_elements_interactions_provider__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./providers/document-elements-interactions-provider */ "./packages/packages/core/editor-interactions/src/providers/document-elements-interactions-provider.ts"); | |
| 3598 | -/* harmony import */ var _init__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./init */ "./packages/packages/core/editor-interactions/src/init.ts"); | |
| 3599 | -/* harmony import */ var _interactions_controls_registry__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./interactions-controls-registry */ "./packages/packages/core/editor-interactions/src/interactions-controls-registry.ts"); | |
| 3600 | -/* harmony import */ var _components_controls_trigger__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./components/controls/trigger */ "./packages/packages/core/editor-interactions/src/components/controls/trigger.tsx"); | |
| 3601 | -/* harmony import */ var _components_controls_easing__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./components/controls/easing */ "./packages/packages/core/editor-interactions/src/components/controls/easing.tsx"); | |
| 3602 | -/* harmony import */ var _components_controls_replay__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./components/controls/replay */ "./packages/packages/core/editor-interactions/src/components/controls/replay.tsx"); | |
| 3603 | -/* harmony import */ var _components_controls_effect__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./components/controls/effect */ "./packages/packages/core/editor-interactions/src/components/controls/effect.tsx"); | |
| 3604 | -/* harmony import */ var _components_controls_repeat__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./components/controls/repeat */ "./packages/packages/core/editor-interactions/src/components/controls/repeat.tsx"); | |
| 3605 | -/* harmony import */ var _components_interaction_details__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./components/interaction-details */ "./packages/packages/core/editor-interactions/src/components/interaction-details.tsx"); | |
| 3606 | -/* harmony import */ var _utils_prop_value_utils__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./utils/prop-value-utils */ "./packages/packages/core/editor-interactions/src/utils/prop-value-utils.ts"); | |
| 3607 | -/* harmony import */ var _utils_temp_id_utils__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./utils/temp-id-utils */ "./packages/packages/core/editor-interactions/src/utils/temp-id-utils.ts"); | |
| 3608 | -/* harmony import */ var _utils_resolve_direction__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./utils/resolve-direction */ "./packages/packages/core/editor-interactions/src/utils/resolve-direction.ts"); | |
| 3609 | -/* harmony import */ var _utils_size_transform_utils__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./utils/size-transform-utils */ "./packages/packages/core/editor-interactions/src/utils/size-transform-utils.ts"); | |
| 3610 | -/* harmony import */ var _hooks_use_element_interactions__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./hooks/use-element-interactions */ "./packages/packages/core/editor-interactions/src/hooks/use-element-interactions.ts"); | |
| 3611 | -/* harmony import */ var _utils_scroll_interaction_event__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./utils/scroll-interaction-event */ "./packages/packages/core/editor-interactions/src/utils/scroll-interaction-event.ts"); | |
| 3612 | - | |
| 3613 | - | |
| 3614 | - | |
| 3615 | - | |
| 3616 | - | |
| 3617 | - | |
| 3618 | - | |
| 3619 | - | |
| 3620 | - | |
| 3621 | - | |
| 3622 | - | |
| 3623 | - | |
| 3624 | - | |
| 3625 | - | |
| 3626 | - | |
| 3627 | - | |
| 3628 | - | |
| 3629 | - | |
| 3630 | - | |
| 3631 | - | |
| 3632 | -}(); | |
| 3633 | -(window.elementorV2 = window.elementorV2 || {}).editorInteractions = __webpack_exports__; | |
| 3634 | -/******/ })() | |
| 3635 | -; | |
| 2078 | +//#endregion | |
| 2079 | +})(React, elementorV2.icons, elementorV2.ui, wp.i18n, elementorV2.session, elementorV2.editorElements, elementorV2.editorV1Adapters, elementorV2.editorProps, elementorV2.editorControls, elementorV2.events, elementorV2.editorResponsive, elementorV2.editorMcp, elementorV2.editorUi, elementorV2.utils, elementorV2.schema); | |
| 3636 | 2080 | window.elementorV2.editorInteractions?.init?.(); |
| 3637 | 2081 | //# sourceMappingURL=editor-interactions.js.map |