| 1 |
(function(_wordpress_i18n) { |
| 2 |
|
| 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 __esmMin = (fn, res, err) => () => { |
| 15 |
if (err) throw err[0]; |
| 16 |
try { |
| 17 |
return fn && (res = fn(fn = 0)), res; |
| 18 |
} catch (e) { |
| 19 |
throw err = [e], e; |
| 20 |
} |
| 21 |
}; |
| 22 |
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports); |
| 23 |
var __exportAll = (all, no_symbols) => { |
| 24 |
let target = {}; |
| 25 |
for (var name in all) { |
| 26 |
__defProp(target, name, { |
| 27 |
get: all[name], |
| 28 |
enumerable: true |
| 29 |
}); |
| 30 |
} |
| 31 |
if (!no_symbols) { |
| 32 |
__defProp(target, Symbol.toStringTag, { value: "Module" }); |
| 33 |
} |
| 34 |
return target; |
| 35 |
}; |
| 36 |
var __copyProps = (to, from, except, desc) => { |
| 37 |
if (from && typeof from === "object" || typeof from === "function") { |
| 38 |
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) { |
| 39 |
key = keys[i]; |
| 40 |
if (!__hasOwnProp.call(to, key) && key !== except) { |
| 41 |
__defProp(to, key, { |
| 42 |
get: ((k) => from[k]).bind(null, key), |
| 43 |
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable |
| 44 |
}); |
| 45 |
} |
| 46 |
} |
| 47 |
} |
| 48 |
return to; |
| 49 |
}; |
| 50 |
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { |
| 51 |
value: mod, |
| 52 |
enumerable: true |
| 53 |
}) : target, mod)); |
| 54 |
|
| 55 |
//#endregion |
| 56 |
|
| 57 |
//#region node_modules/@babel/runtime/helpers/esm/classCallCheck.js |
| 58 |
function _classCallCheck(a, n) { |
| 59 |
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); |
| 60 |
} |
| 61 |
var init_classCallCheck = __esmMin((() => {})); |
| 62 |
|
| 63 |
//#endregion |
| 64 |
//#region node_modules/@babel/runtime/helpers/esm/typeof.js |
| 65 |
function _typeof(o) { |
| 66 |
"@babel/helpers - typeof"; |
| 67 |
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) { |
| 68 |
return typeof o; |
| 69 |
} : function(o) { |
| 70 |
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; |
| 71 |
}, _typeof(o); |
| 72 |
} |
| 73 |
var init_typeof = __esmMin((() => {})); |
| 74 |
|
| 75 |
//#endregion |
| 76 |
//#region node_modules/@babel/runtime/helpers/esm/toPrimitive.js |
| 77 |
function toPrimitive(t, r) { |
| 78 |
if ("object" != _typeof(t) || !t) return t; |
| 79 |
var e = t[Symbol.toPrimitive]; |
| 80 |
if (void 0 !== e) { |
| 81 |
var i = e.call(t, r || "default"); |
| 82 |
if ("object" != _typeof(i)) return i; |
| 83 |
throw new TypeError("@@toPrimitive must return a primitive value."); |
| 84 |
} |
| 85 |
return ("string" === r ? String : Number)(t); |
| 86 |
} |
| 87 |
var init_toPrimitive = __esmMin((() => { |
| 88 |
init_typeof(); |
| 89 |
})); |
| 90 |
|
| 91 |
//#endregion |
| 92 |
//#region node_modules/@babel/runtime/helpers/esm/toPropertyKey.js |
| 93 |
function toPropertyKey(t) { |
| 94 |
var i = toPrimitive(t, "string"); |
| 95 |
return "symbol" == _typeof(i) ? i : i + ""; |
| 96 |
} |
| 97 |
var init_toPropertyKey = __esmMin((() => { |
| 98 |
init_typeof(); |
| 99 |
init_toPrimitive(); |
| 100 |
})); |
| 101 |
|
| 102 |
//#endregion |
| 103 |
//#region node_modules/@babel/runtime/helpers/esm/createClass.js |
| 104 |
function _defineProperties(e, r) { |
| 105 |
for (var t = 0; t < r.length; t++) { |
| 106 |
var o = r[t]; |
| 107 |
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o); |
| 108 |
} |
| 109 |
} |
| 110 |
function _createClass(e, r, t) { |
| 111 |
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; |
| 112 |
} |
| 113 |
var init_createClass = __esmMin((() => { |
| 114 |
init_toPropertyKey(); |
| 115 |
})); |
| 116 |
|
| 117 |
//#endregion |
| 118 |
//#region node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js |
| 119 |
function _assertThisInitialized(e) { |
| 120 |
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); |
| 121 |
return e; |
| 122 |
} |
| 123 |
var init_assertThisInitialized = __esmMin((() => {})); |
| 124 |
|
| 125 |
//#endregion |
| 126 |
//#region node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js |
| 127 |
function _possibleConstructorReturn(t, e) { |
| 128 |
if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; |
| 129 |
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); |
| 130 |
return _assertThisInitialized(t); |
| 131 |
} |
| 132 |
var init_possibleConstructorReturn = __esmMin((() => { |
| 133 |
init_typeof(); |
| 134 |
init_assertThisInitialized(); |
| 135 |
})); |
| 136 |
|
| 137 |
//#endregion |
| 138 |
//#region node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js |
| 139 |
function _getPrototypeOf(t) { |
| 140 |
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) { |
| 141 |
return t.__proto__ || Object.getPrototypeOf(t); |
| 142 |
}, _getPrototypeOf(t); |
| 143 |
} |
| 144 |
var init_getPrototypeOf = __esmMin((() => {})); |
| 145 |
|
| 146 |
//#endregion |
| 147 |
//#region node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js |
| 148 |
function _setPrototypeOf(t, e) { |
| 149 |
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) { |
| 150 |
return t.__proto__ = e, t; |
| 151 |
}, _setPrototypeOf(t, e); |
| 152 |
} |
| 153 |
var init_setPrototypeOf = __esmMin((() => {})); |
| 154 |
|
| 155 |
//#endregion |
| 156 |
//#region node_modules/@babel/runtime/helpers/esm/inherits.js |
| 157 |
function _inherits(t, e) { |
| 158 |
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); |
| 159 |
t.prototype = Object.create(e && e.prototype, { constructor: { |
| 160 |
value: t, |
| 161 |
writable: !0, |
| 162 |
configurable: !0 |
| 163 |
} }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); |
| 164 |
} |
| 165 |
var init_inherits = __esmMin((() => { |
| 166 |
init_setPrototypeOf(); |
| 167 |
})); |
| 168 |
|
| 169 |
//#endregion |
| 170 |
//#region modules/styleguide/assets/js/commands/enable.js |
| 171 |
init_classCallCheck(); |
| 172 |
init_createClass(); |
| 173 |
init_possibleConstructorReturn(); |
| 174 |
init_getPrototypeOf(); |
| 175 |
init_inherits(); |
| 176 |
function _callSuper$8(t, o, e) { |
| 177 |
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$8() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); |
| 178 |
} |
| 179 |
__name(_callSuper$8, "_callSuper"); |
| 180 |
function _isNativeReflectConstruct$8() { |
| 181 |
try { |
| 182 |
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); |
| 183 |
} catch (t) {} |
| 184 |
return (_isNativeReflectConstruct$8 = function _isNativeReflectConstruct() { |
| 185 |
return !!t; |
| 186 |
})(); |
| 187 |
} |
| 188 |
__name(_isNativeReflectConstruct$8, "_isNativeReflectConstruct"); |
| 189 |
var Enable = /*#__PURE__*/ function(_$e$modules$CommandBa) { |
| 190 |
function Enable() { |
| 191 |
_classCallCheck(this, Enable); |
| 192 |
return _callSuper$8(this, Enable, arguments); |
| 193 |
} |
| 194 |
_inherits(Enable, _$e$modules$CommandBa); |
| 195 |
return _createClass(Enable, [{ |
| 196 |
key: "apply", |
| 197 |
value: function apply(args) { |
| 198 |
$e.components.get("preview/styleguide").enableStyleguidePreview(args); |
| 199 |
} |
| 200 |
}]); |
| 201 |
}($e.modules.CommandBase); |
| 202 |
|
| 203 |
//#endregion |
| 204 |
//#region modules/styleguide/assets/js/commands/global-colors.js |
| 205 |
init_classCallCheck(); |
| 206 |
init_createClass(); |
| 207 |
init_possibleConstructorReturn(); |
| 208 |
init_getPrototypeOf(); |
| 209 |
init_inherits(); |
| 210 |
function _callSuper$7(t, o, e) { |
| 211 |
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$7() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); |
| 212 |
} |
| 213 |
__name(_callSuper$7, "_callSuper"); |
| 214 |
function _isNativeReflectConstruct$7() { |
| 215 |
try { |
| 216 |
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); |
| 217 |
} catch (t) {} |
| 218 |
return (_isNativeReflectConstruct$7 = function _isNativeReflectConstruct() { |
| 219 |
return !!t; |
| 220 |
})(); |
| 221 |
} |
| 222 |
__name(_isNativeReflectConstruct$7, "_isNativeReflectConstruct"); |
| 223 |
var GlobalColors = /*#__PURE__*/ function(_$e$modules$CommandBa) { |
| 224 |
function GlobalColors() { |
| 225 |
_classCallCheck(this, GlobalColors); |
| 226 |
return _callSuper$7(this, GlobalColors, arguments); |
| 227 |
} |
| 228 |
_inherits(GlobalColors, _$e$modules$CommandBa); |
| 229 |
return _createClass(GlobalColors, [{ |
| 230 |
key: "apply", |
| 231 |
value: function apply() { |
| 232 |
$e.components.get("preview/styleguide").showStyleguidePreview(); |
| 233 |
} |
| 234 |
}]); |
| 235 |
}($e.modules.CommandBase); |
| 236 |
|
| 237 |
//#endregion |
| 238 |
//#region modules/styleguide/assets/js/commands/global-typography.js |
| 239 |
init_classCallCheck(); |
| 240 |
init_createClass(); |
| 241 |
init_possibleConstructorReturn(); |
| 242 |
init_getPrototypeOf(); |
| 243 |
init_inherits(); |
| 244 |
function _callSuper$6(t, o, e) { |
| 245 |
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$6() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); |
| 246 |
} |
| 247 |
__name(_callSuper$6, "_callSuper"); |
| 248 |
function _isNativeReflectConstruct$6() { |
| 249 |
try { |
| 250 |
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); |
| 251 |
} catch (t) {} |
| 252 |
return (_isNativeReflectConstruct$6 = function _isNativeReflectConstruct() { |
| 253 |
return !!t; |
| 254 |
})(); |
| 255 |
} |
| 256 |
__name(_isNativeReflectConstruct$6, "_isNativeReflectConstruct"); |
| 257 |
var GlobalTypography = /*#__PURE__*/ function(_$e$modules$CommandBa) { |
| 258 |
function GlobalTypography() { |
| 259 |
_classCallCheck(this, GlobalTypography); |
| 260 |
return _callSuper$6(this, GlobalTypography, arguments); |
| 261 |
} |
| 262 |
_inherits(GlobalTypography, _$e$modules$CommandBa); |
| 263 |
return _createClass(GlobalTypography, [{ |
| 264 |
key: "apply", |
| 265 |
value: function apply() { |
| 266 |
$e.components.get("preview/styleguide").showStyleguidePreview(); |
| 267 |
} |
| 268 |
}]); |
| 269 |
}($e.modules.CommandBase); |
| 270 |
|
| 271 |
//#endregion |
| 272 |
//#region modules/styleguide/assets/js/commands/hide.js |
| 273 |
init_classCallCheck(); |
| 274 |
init_createClass(); |
| 275 |
init_possibleConstructorReturn(); |
| 276 |
init_getPrototypeOf(); |
| 277 |
init_inherits(); |
| 278 |
function _callSuper$5(t, o, e) { |
| 279 |
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$5() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); |
| 280 |
} |
| 281 |
__name(_callSuper$5, "_callSuper"); |
| 282 |
function _isNativeReflectConstruct$5() { |
| 283 |
try { |
| 284 |
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); |
| 285 |
} catch (t) {} |
| 286 |
return (_isNativeReflectConstruct$5 = function _isNativeReflectConstruct() { |
| 287 |
return !!t; |
| 288 |
})(); |
| 289 |
} |
| 290 |
__name(_isNativeReflectConstruct$5, "_isNativeReflectConstruct"); |
| 291 |
var Hide = /*#__PURE__*/ function(_$e$modules$CommandBa) { |
| 292 |
function Hide() { |
| 293 |
_classCallCheck(this, Hide); |
| 294 |
return _callSuper$5(this, Hide, arguments); |
| 295 |
} |
| 296 |
_inherits(Hide, _$e$modules$CommandBa); |
| 297 |
return _createClass(Hide, [{ |
| 298 |
key: "apply", |
| 299 |
value: function apply() { |
| 300 |
$e.components.get("preview/styleguide").hideStyleguidePreview(); |
| 301 |
} |
| 302 |
}]); |
| 303 |
}($e.modules.CommandBase); |
| 304 |
|
| 305 |
//#endregion |
| 306 |
//#region modules/styleguide/assets/js/commands/switcher-change.js |
| 307 |
init_classCallCheck(); |
| 308 |
init_createClass(); |
| 309 |
init_possibleConstructorReturn(); |
| 310 |
init_getPrototypeOf(); |
| 311 |
init_inherits(); |
| 312 |
function _callSuper$4(t, o, e) { |
| 313 |
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$4() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); |
| 314 |
} |
| 315 |
__name(_callSuper$4, "_callSuper"); |
| 316 |
function _isNativeReflectConstruct$4() { |
| 317 |
try { |
| 318 |
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); |
| 319 |
} catch (t) {} |
| 320 |
return (_isNativeReflectConstruct$4 = function _isNativeReflectConstruct() { |
| 321 |
return !!t; |
| 322 |
})(); |
| 323 |
} |
| 324 |
__name(_isNativeReflectConstruct$4, "_isNativeReflectConstruct"); |
| 325 |
var SwitcherChange = /*#__PURE__*/ function(_$e$modules$CommandBa) { |
| 326 |
function SwitcherChange() { |
| 327 |
_classCallCheck(this, SwitcherChange); |
| 328 |
return _callSuper$4(this, SwitcherChange, arguments); |
| 329 |
} |
| 330 |
_inherits(SwitcherChange, _$e$modules$CommandBa); |
| 331 |
return _createClass(SwitcherChange, [{ |
| 332 |
key: "validateArgs", |
| 333 |
value: function validateArgs() { |
| 334 |
var args = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; |
| 335 |
this.requireArgumentType("name", "string", args); |
| 336 |
this.requireArgumentType("value", "string", args); |
| 337 |
} |
| 338 |
}, { |
| 339 |
key: "apply", |
| 340 |
value: function apply(args) { |
| 341 |
if (args.name.includes("enable_styleguide_preview")) $e.components.get("preview/styleguide").enableStyleguidePreview({ value: args.value }); |
| 342 |
} |
| 343 |
}]); |
| 344 |
}($e.modules.CommandBase); |
| 345 |
|
| 346 |
//#endregion |
| 347 |
//#region modules/styleguide/assets/js/commands/index.js |
| 348 |
var commands_exports = /* @__PURE__ */ __exportAll({ |
| 349 |
Enable: () => Enable, |
| 350 |
GlobalColors: () => GlobalColors, |
| 351 |
GlobalTypography: () => GlobalTypography, |
| 352 |
Hide: () => Hide, |
| 353 |
SwitcherChange: () => SwitcherChange |
| 354 |
}); |
| 355 |
|
| 356 |
//#endregion |
| 357 |
//#region node_modules/@babel/runtime/helpers/esm/superPropBase.js |
| 358 |
init_getPrototypeOf(); |
| 359 |
function _superPropBase(t, o) { |
| 360 |
for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); |
| 361 |
return t; |
| 362 |
} |
| 363 |
|
| 364 |
//#endregion |
| 365 |
//#region node_modules/@babel/runtime/helpers/esm/get.js |
| 366 |
function _get() { |
| 367 |
return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function(e, t, r) { |
| 368 |
var p = _superPropBase(e, t); |
| 369 |
if (p) { |
| 370 |
var n = Object.getOwnPropertyDescriptor(p, t); |
| 371 |
return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; |
| 372 |
} |
| 373 |
}, _get.apply(null, arguments); |
| 374 |
} |
| 375 |
|
| 376 |
//#endregion |
| 377 |
//#region node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js |
| 378 |
function _arrayWithHoles(r) { |
| 379 |
if (Array.isArray(r)) return r; |
| 380 |
} |
| 381 |
var init_arrayWithHoles = __esmMin((() => {})); |
| 382 |
|
| 383 |
//#endregion |
| 384 |
//#region node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js |
| 385 |
function _iterableToArrayLimit(r, l) { |
| 386 |
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; |
| 387 |
if (null != t) { |
| 388 |
var e; |
| 389 |
var n; |
| 390 |
var i; |
| 391 |
var u; |
| 392 |
var a = []; |
| 393 |
var f = !0; |
| 394 |
var o = !1; |
| 395 |
try { |
| 396 |
if (i = (t = t.call(r)).next, 0 === l) { |
| 397 |
if (Object(t) !== t) return; |
| 398 |
f = !1; |
| 399 |
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); |
| 400 |
} catch (r) { |
| 401 |
o = !0, n = r; |
| 402 |
} finally { |
| 403 |
try { |
| 404 |
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; |
| 405 |
} finally { |
| 406 |
if (o) throw n; |
| 407 |
} |
| 408 |
} |
| 409 |
return a; |
| 410 |
} |
| 411 |
} |
| 412 |
var init_iterableToArrayLimit = __esmMin((() => {})); |
| 413 |
|
| 414 |
//#endregion |
| 415 |
//#region node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js |
| 416 |
function _arrayLikeToArray(r, a) { |
| 417 |
(null == a || a > r.length) && (a = r.length); |
| 418 |
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; |
| 419 |
return n; |
| 420 |
} |
| 421 |
var init_arrayLikeToArray = __esmMin((() => {})); |
| 422 |
|
| 423 |
//#endregion |
| 424 |
//#region node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js |
| 425 |
function _unsupportedIterableToArray(r, a) { |
| 426 |
if (r) { |
| 427 |
if ("string" == typeof r) return _arrayLikeToArray(r, a); |
| 428 |
var t = {}.toString.call(r).slice(8, -1); |
| 429 |
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; |
| 430 |
} |
| 431 |
} |
| 432 |
var init_unsupportedIterableToArray = __esmMin((() => { |
| 433 |
init_arrayLikeToArray(); |
| 434 |
})); |
| 435 |
|
| 436 |
//#endregion |
| 437 |
//#region node_modules/@babel/runtime/helpers/esm/nonIterableRest.js |
| 438 |
function _nonIterableRest() { |
| 439 |
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
| 440 |
} |
| 441 |
var init_nonIterableRest = __esmMin((() => {})); |
| 442 |
|
| 443 |
//#endregion |
| 444 |
//#region node_modules/@babel/runtime/helpers/esm/slicedToArray.js |
| 445 |
function _slicedToArray(r, e) { |
| 446 |
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); |
| 447 |
} |
| 448 |
var init_slicedToArray = __esmMin((() => { |
| 449 |
init_arrayWithHoles(); |
| 450 |
init_iterableToArrayLimit(); |
| 451 |
init_unsupportedIterableToArray(); |
| 452 |
init_nonIterableRest(); |
| 453 |
})); |
| 454 |
|
| 455 |
//#endregion |
| 456 |
//#region node_modules/@babel/runtime/helpers/esm/defineProperty.js |
| 457 |
function _defineProperty(e, r, t) { |
| 458 |
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, { |
| 459 |
value: t, |
| 460 |
enumerable: !0, |
| 461 |
configurable: !0, |
| 462 |
writable: !0 |
| 463 |
}) : e[r] = t, e; |
| 464 |
} |
| 465 |
var init_defineProperty = __esmMin((() => { |
| 466 |
init_toPropertyKey(); |
| 467 |
})); |
| 468 |
|
| 469 |
//#endregion |
| 470 |
//#region assets/dev/js/editor/components/validator/base.js |
| 471 |
var require_base$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 472 |
module.exports = elementorModules.Module.extend({ |
| 473 |
errors: [], |
| 474 |
__construct: function __construct(settings) { |
| 475 |
var customValidationMethod = settings.customValidationMethod; |
| 476 |
if (customValidationMethod) this.validationMethod = customValidationMethod; |
| 477 |
}, |
| 478 |
getDefaultSettings: function getDefaultSettings() { |
| 479 |
return { validationTerms: {} }; |
| 480 |
}, |
| 481 |
isValid: function isValid() { |
| 482 |
var validationErrors = this.validationMethod.apply(this, arguments); |
| 483 |
if (validationErrors.length) { |
| 484 |
this.errors = validationErrors; |
| 485 |
return false; |
| 486 |
} |
| 487 |
return true; |
| 488 |
}, |
| 489 |
validationMethod: function validationMethod(newValue) { |
| 490 |
var validationTerms = this.getSettings("validationTerms"); |
| 491 |
var errors = []; |
| 492 |
if (validationTerms.required) { |
| 493 |
if (!("" + newValue).length) errors.push("Required value is empty"); |
| 494 |
} |
| 495 |
return errors; |
| 496 |
} |
| 497 |
}); |
| 498 |
})); |
| 499 |
|
| 500 |
//#endregion |
| 501 |
//#region assets/dev/js/editor/components/validator/number.js |
| 502 |
var require_number = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 503 |
var Validator = require_base$1(); |
| 504 |
module.exports = Validator.extend({ validationMethod: function validationMethod(newValue) { |
| 505 |
var validationTerms = this.getSettings("validationTerms"); |
| 506 |
var errors = []; |
| 507 |
if (_.isFinite(newValue)) { |
| 508 |
if (void 0 !== validationTerms.min && newValue < validationTerms.min) errors.push("Value is less than minimum"); |
| 509 |
if (void 0 !== validationTerms.max && newValue > validationTerms.max) errors.push("Value is greater than maximum"); |
| 510 |
} |
| 511 |
return errors; |
| 512 |
} }); |
| 513 |
})); |
| 514 |
|
| 515 |
//#endregion |
| 516 |
//#region assets/dev/js/editor/components/validator/breakpoint.js |
| 517 |
function _callSuper$3(t, o, e) { |
| 518 |
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$3() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); |
| 519 |
} |
| 520 |
function _isNativeReflectConstruct$3() { |
| 521 |
try { |
| 522 |
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); |
| 523 |
} catch (t) {} |
| 524 |
return (_isNativeReflectConstruct$3 = function _isNativeReflectConstruct() { |
| 525 |
return !!t; |
| 526 |
})(); |
| 527 |
} |
| 528 |
var NumberValidator, BreakpointValidator; |
| 529 |
var init_breakpoint = __esmMin((() => { |
| 530 |
init_classCallCheck(); |
| 531 |
init_createClass(); |
| 532 |
init_possibleConstructorReturn(); |
| 533 |
init_getPrototypeOf(); |
| 534 |
init_inherits(); |
| 535 |
__name(_callSuper$3, "_callSuper"); |
| 536 |
__name(_isNativeReflectConstruct$3, "_isNativeReflectConstruct"); |
| 537 |
NumberValidator = require_number(); |
| 538 |
BreakpointValidator = /*#__PURE__*/ function(_NumberValidator) { |
| 539 |
function BreakpointValidator() { |
| 540 |
_classCallCheck(this, BreakpointValidator); |
| 541 |
return _callSuper$3(this, BreakpointValidator, arguments); |
| 542 |
} |
| 543 |
_inherits(BreakpointValidator, _NumberValidator); |
| 544 |
return _createClass(BreakpointValidator, [ |
| 545 |
{ |
| 546 |
key: "getDefaultSettings", |
| 547 |
value: function getDefaultSettings() { |
| 548 |
return { validationTerms: { max: 5120 } }; |
| 549 |
} |
| 550 |
}, |
| 551 |
{ |
| 552 |
key: "getPanelActiveBreakpoints", |
| 553 |
value: function getPanelActiveBreakpoints() { |
| 554 |
var panelBreakpoints = elementor.documents.currentDocument.config.settings.settings.active_breakpoints.map(function(breakpointName) { |
| 555 |
return breakpointName.replace("viewport_", ""); |
| 556 |
}); |
| 557 |
var panelActiveBreakpoints = {}; |
| 558 |
panelBreakpoints.forEach(function(breakpointName) { |
| 559 |
panelActiveBreakpoints[breakpointName] = elementorFrontend.config.responsive.breakpoints[breakpointName]; |
| 560 |
}); |
| 561 |
return panelActiveBreakpoints; |
| 562 |
} |
| 563 |
}, |
| 564 |
{ |
| 565 |
key: "initBreakpointProperties", |
| 566 |
value: function initBreakpointProperties() { |
| 567 |
var _activeBreakpoints$br; |
| 568 |
var _activeBreakpoints$br2; |
| 569 |
var validationTerms = this.getSettings("validationTerms"); |
| 570 |
var activeBreakpoints = this.getPanelActiveBreakpoints(); |
| 571 |
var breakpointKeys = Object.keys(activeBreakpoints); |
| 572 |
this.breakpointIndex = breakpointKeys.indexOf(validationTerms.breakpointName); |
| 573 |
this.topBreakpoint = (_activeBreakpoints$br = activeBreakpoints[breakpointKeys[this.breakpointIndex + 1]]) === null || _activeBreakpoints$br === void 0 ? void 0 : _activeBreakpoints$br.value; |
| 574 |
this.bottomBreakpoint = (_activeBreakpoints$br2 = activeBreakpoints[breakpointKeys[this.breakpointIndex - 1]]) === null || _activeBreakpoints$br2 === void 0 ? void 0 : _activeBreakpoints$br2.value; |
| 575 |
} |
| 576 |
}, |
| 577 |
{ |
| 578 |
key: "validationMethod", |
| 579 |
value: function validationMethod(newValue) { |
| 580 |
var validationTerms = this.getSettings("validationTerms"); |
| 581 |
var errors = NumberValidator.prototype.validationMethod.call(this, newValue); |
| 582 |
if (_.isFinite(newValue) || "" === newValue) { |
| 583 |
if (!this.validateMinMaxForBreakpoint(newValue, validationTerms)) errors.push("Value is not between the breakpoints above or under the edited breakpoint"); |
| 584 |
} |
| 585 |
return errors; |
| 586 |
} |
| 587 |
}, |
| 588 |
{ |
| 589 |
key: "validateMinMaxForBreakpoint", |
| 590 |
value: function validateMinMaxForBreakpoint(newValue, validationTerms) { |
| 591 |
var breakpointDefaultValue = elementorFrontend.config.responsive.breakpoints[validationTerms.breakpointName].default_value; |
| 592 |
var isValid = true; |
| 593 |
this.initBreakpointProperties(); |
| 594 |
if ("mobile" === validationTerms.breakpointName && 320 === this.bottomBreakpoint) this.bottomBreakpoint -= 1; |
| 595 |
if (this.bottomBreakpoint) { |
| 596 |
if ("" !== newValue && newValue <= this.bottomBreakpoint) isValid = false; |
| 597 |
if ("" === newValue && breakpointDefaultValue <= this.bottomBreakpoint) isValid = false; |
| 598 |
} |
| 599 |
if (this.topBreakpoint) { |
| 600 |
if ("" !== newValue && newValue >= this.topBreakpoint) isValid = false; |
| 601 |
if ("" === newValue && breakpointDefaultValue >= this.topBreakpoint) isValid = false; |
| 602 |
} |
| 603 |
return isValid; |
| 604 |
} |
| 605 |
} |
| 606 |
]); |
| 607 |
}(NumberValidator); |
| 608 |
})); |
| 609 |
|
| 610 |
//#endregion |
| 611 |
//#region assets/dev/js/editor/controls/base.js |
| 612 |
var require_base = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 613 |
init_defineProperty(); |
| 614 |
function ownKeys(e, r) { |
| 615 |
var t = Object.keys(e); |
| 616 |
if (Object.getOwnPropertySymbols) { |
| 617 |
var o = Object.getOwnPropertySymbols(e); |
| 618 |
r && (o = o.filter(function(r) { |
| 619 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 620 |
})), t.push.apply(t, o); |
| 621 |
} |
| 622 |
return t; |
| 623 |
} |
| 624 |
function _objectSpread(e) { |
| 625 |
for (var r = 1; r < arguments.length; r++) { |
| 626 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 627 |
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) { |
| 628 |
_defineProperty(e, r, t[r]); |
| 629 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) { |
| 630 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 631 |
}); |
| 632 |
} |
| 633 |
return e; |
| 634 |
} |
| 635 |
var ControlBaseView = Marionette.CompositeView.extend({ |
| 636 |
ui: function ui() { |
| 637 |
return { controlTitle: ".elementor-control-title" }; |
| 638 |
}, |
| 639 |
behaviors: function behaviors() { |
| 640 |
return elementor.hooks.applyFilters("controls/base/behaviors", {}, this); |
| 641 |
}, |
| 642 |
getBehavior: function getBehavior(name) { |
| 643 |
return this._behaviors[Object.keys(this.behaviors()).indexOf(name)]; |
| 644 |
}, |
| 645 |
className: function className() { |
| 646 |
var classes = "elementor-control elementor-control-" + this.model.get("name") + " elementor-control-type-" + this.model.get("type"); |
| 647 |
var modelClasses = this.model.get("classes"); |
| 648 |
var responsive = this.model.get("responsive"); |
| 649 |
if (!_.isEmpty(modelClasses)) classes += " " + modelClasses; |
| 650 |
if (!_.isEmpty(responsive)) { |
| 651 |
var responsiveControlName = responsive.max || responsive.min; |
| 652 |
classes += " elementor-control-responsive-" + responsiveControlName; |
| 653 |
} |
| 654 |
return classes; |
| 655 |
}, |
| 656 |
templateHelpers: function templateHelpers() { |
| 657 |
var controlData = { _cid: this.model.cid }; |
| 658 |
return { |
| 659 |
view: this, |
| 660 |
data: _.extend({}, this.model.toJSON(), controlData) |
| 661 |
}; |
| 662 |
}, |
| 663 |
getTemplate: function getTemplate() { |
| 664 |
return Marionette.TemplateCache.get("#tmpl-elementor-control-" + this.model.get("type") + "-content"); |
| 665 |
}, |
| 666 |
initialize: function initialize(options) { |
| 667 |
var label = this.model.get("label"); |
| 668 |
Object.defineProperty(this, "container", { get: function get() { |
| 669 |
if (!options.container) { |
| 670 |
var settingsModel = options.elementSettingsModel; |
| 671 |
var view = $e.components.get("document").utils.findViewById(settingsModel.id); |
| 672 |
if (view && view.getContainer) options.container = view.getContainer(); |
| 673 |
else { |
| 674 |
if (!settingsModel.id) settingsModel.id = "bc-" + elementorCommon.helpers.getUniqueId(); |
| 675 |
options.container = new elementorModules.editor.Container({ |
| 676 |
type: "bc-container", |
| 677 |
id: settingsModel.id, |
| 678 |
model: settingsModel, |
| 679 |
settings: settingsModel, |
| 680 |
label, |
| 681 |
view: false, |
| 682 |
parent: false, |
| 683 |
renderer: false, |
| 684 |
controls: settingsModel.options.controls |
| 685 |
}); |
| 686 |
} |
| 687 |
} |
| 688 |
return options.container; |
| 689 |
} }); |
| 690 |
Object.defineProperty(this, "elementSettingsModel", { get: function get() { |
| 691 |
elementorDevTools.deprecation.deprecated("elementSettingsModel", "2.8.0", "container.settings"); |
| 692 |
return options.container ? options.container.settings : options.elementSettingsModel; |
| 693 |
} }); |
| 694 |
var controlType = this.model.get("type"); |
| 695 |
var controlSettings = jQuery.extend(true, {}, elementor.config.controls[controlType], this.model.attributes); |
| 696 |
this.model.set(controlSettings); |
| 697 |
var settings = this.container ? this.container.settings : this.elementSettingsModel; |
| 698 |
this.listenTo(settings, "change", this.onAfterChange); |
| 699 |
if (this.model.attributes.responsive) { |
| 700 |
this.onDeviceModeChange = this.onDeviceModeChange.bind(this); |
| 701 |
elementor.listenTo(elementor.channels.deviceMode, "change", this.onDeviceModeChange); |
| 702 |
} |
| 703 |
}, |
| 704 |
onDestroy: function onDestroy() { |
| 705 |
elementor.stopListening(elementor.channels.deviceMode, "change", this.onDeviceModeChange); |
| 706 |
}, |
| 707 |
onDeviceModeChange: function onDeviceModeChange() { |
| 708 |
this.toggleControlVisibility(); |
| 709 |
}, |
| 710 |
onAfterChange: function onAfterChange() { |
| 711 |
this.toggleControlVisibility(); |
| 712 |
}, |
| 713 |
toggleControlVisibility: function toggleControlVisibility() { |
| 714 |
var settings = this.container ? this.container.settings : this.elementSettingsModel; |
| 715 |
var isVisible = elementor.helpers.isActiveControl(this.model, settings.attributes, settings.controls); |
| 716 |
this.$el.toggleClass("elementor-hidden-control", !isVisible); |
| 717 |
elementor.getPanelView().updateScrollbar(); |
| 718 |
}, |
| 719 |
onRender: function onRender() { |
| 720 |
var layoutType = this.model.get("label_block") ? "block" : "inline"; |
| 721 |
var showLabel = this.model.get("show_label"); |
| 722 |
var elClasses = "elementor-label-" + layoutType; |
| 723 |
elClasses += " elementor-control-separator-" + this.model.get("separator"); |
| 724 |
if (!showLabel) elClasses += " elementor-control-hidden-label"; |
| 725 |
this.$el.addClass(elClasses); |
| 726 |
this.toggleControlVisibility(); |
| 727 |
}, |
| 728 |
reRoute: function reRoute(controlActive) { |
| 729 |
$e.route($e.routes.getCurrent("panel"), this.getControlInRouteArgs(controlActive ? this.getControlPath() : ""), { history: false }); |
| 730 |
}, |
| 731 |
getControlInRouteArgs: function getControlInRouteArgs(path) { |
| 732 |
return _objectSpread(_objectSpread({}, $e.routes.getCurrentArgs("panel")), {}, { activeControl: path }); |
| 733 |
}, |
| 734 |
getControlPath: function getControlPath() { |
| 735 |
var controlPath = this.model.get("name"); |
| 736 |
var parent = this._parent; |
| 737 |
while (!parent.$el.hasClass("elementor-controls-stack")) { |
| 738 |
controlPath = (parent.model.get("name") || parent.model.get("_id")) + "/" + controlPath; |
| 739 |
parent = parent._parent; |
| 740 |
} |
| 741 |
return controlPath; |
| 742 |
} |
| 743 |
}); |
| 744 |
module.exports = ControlBaseView; |
| 745 |
})); |
| 746 |
|
| 747 |
//#endregion |
| 748 |
//#region assets/dev/js/editor/components/dynamic-tags/tag-controls-stack-empty.js |
| 749 |
var require_tag_controls_stack_empty = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 750 |
module.exports = Marionette.ItemView.extend({ |
| 751 |
className: "elementor-tag-controls-stack-empty", |
| 752 |
template: "#tmpl-elementor-tag-controls-stack-empty" |
| 753 |
}); |
| 754 |
})); |
| 755 |
|
| 756 |
//#endregion |
| 757 |
//#region assets/dev/js/editor/components/dynamic-tags/tag-controls-stack.js |
| 758 |
var require_tag_controls_stack = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 759 |
var EmptyView = require_tag_controls_stack_empty(); |
| 760 |
module.exports = elementorModules.editor.views.ControlsStack.extend({ |
| 761 |
activeTab: "content", |
| 762 |
template: _.noop, |
| 763 |
emptyView: EmptyView, |
| 764 |
isEmpty: function isEmpty() { |
| 765 |
return this.collection.length < 2; |
| 766 |
}, |
| 767 |
childViewOptions: function childViewOptions() { |
| 768 |
return { container: this.options.container }; |
| 769 |
}, |
| 770 |
getNamespaceArray: function getNamespaceArray() { |
| 771 |
var currentPageView = elementor.getPanelView().getCurrentPageView(); |
| 772 |
var eventNamespace = currentPageView.getNamespaceArray(); |
| 773 |
eventNamespace.push(currentPageView.activeSection); |
| 774 |
eventNamespace.push(this.getOption("controlName")); |
| 775 |
eventNamespace.push(this.getOption("name")); |
| 776 |
return eventNamespace; |
| 777 |
}, |
| 778 |
onRenderTemplate: function onRenderTemplate() { |
| 779 |
this.activateFirstSection(); |
| 780 |
} |
| 781 |
}); |
| 782 |
})); |
| 783 |
|
| 784 |
//#endregion |
| 785 |
//#region assets/dev/js/editor/components/dynamic-tags/tag-panel-view.js |
| 786 |
var require_tag_panel_view = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 787 |
var TagControlsStack = require_tag_controls_stack(); |
| 788 |
module.exports = Marionette.ItemView.extend({ |
| 789 |
className: "elementor-dynamic-cover e-input-style", |
| 790 |
tagControlsStack: null, |
| 791 |
templateHelpers: function templateHelpers() { |
| 792 |
var helpers = {}; |
| 793 |
if (this.model) helpers.controls = this.model.options.controls; |
| 794 |
return helpers; |
| 795 |
}, |
| 796 |
ui: { remove: ".elementor-dynamic-cover__remove" }, |
| 797 |
events: function events() { |
| 798 |
var events = { "click @ui.remove": "onRemoveClick" }; |
| 799 |
if (this.hasSettings()) events.click = "onClick"; |
| 800 |
return events; |
| 801 |
}, |
| 802 |
getTemplate: function getTemplate() { |
| 803 |
var config = this.getTagConfig(); |
| 804 |
var templateFunction = Marionette.TemplateCache.get("#tmpl-elementor-control-dynamic-cover"); |
| 805 |
var renderedTemplate = Marionette.Renderer.render(templateFunction, { |
| 806 |
hasSettings: this.hasSettings(), |
| 807 |
isRemovable: !this.getOption("dynamicSettings").default, |
| 808 |
title: config.title, |
| 809 |
content: config.panel_template |
| 810 |
}); |
| 811 |
return Marionette.TemplateCache.prototype.compileTemplate(renderedTemplate.trim()); |
| 812 |
}, |
| 813 |
getTagConfig: function getTagConfig() { |
| 814 |
return elementor.dynamicTags.getConfig("tags." + this.getOption("name")); |
| 815 |
}, |
| 816 |
initSettingsPopup: function initSettingsPopup() { |
| 817 |
var settingsPopupOptions = { |
| 818 |
className: "elementor-tag-settings-popup", |
| 819 |
position: { |
| 820 |
my: "left top+5", |
| 821 |
at: "left bottom", |
| 822 |
of: this.$el, |
| 823 |
autoRefresh: true |
| 824 |
}, |
| 825 |
hide: { ignore: ".select2-container" } |
| 826 |
}; |
| 827 |
var settingsPopup = elementorCommon.dialogsManager.createWidget("buttons", settingsPopupOptions); |
| 828 |
this.getSettingsPopup = function() { |
| 829 |
return settingsPopup; |
| 830 |
}; |
| 831 |
}, |
| 832 |
hasSettings: function hasSettings() { |
| 833 |
return !!Object.values(this.getTagConfig().controls).length; |
| 834 |
}, |
| 835 |
showSettingsPopup: function showSettingsPopup() { |
| 836 |
if (!this.tagControlsStack) this.initTagControlsStack(); |
| 837 |
var settingsPopup = this.getSettingsPopup(); |
| 838 |
if (settingsPopup.isVisible()) return; |
| 839 |
settingsPopup.show(); |
| 840 |
}, |
| 841 |
initTagControlsStack: function initTagControlsStack() { |
| 842 |
this.tagControlsStack = new TagControlsStack({ |
| 843 |
model: this.model, |
| 844 |
controls: this.model.controls, |
| 845 |
name: this.options.name, |
| 846 |
controlName: this.options.controlName, |
| 847 |
container: this.options.container, |
| 848 |
el: this.getSettingsPopup().getElements("message")[0] |
| 849 |
}); |
| 850 |
this.tagControlsStack.render(); |
| 851 |
}, |
| 852 |
initModel: function initModel() { |
| 853 |
this.model = new elementorModules.editor.elements.models.BaseSettings(this.getOption("settings"), { controls: this.getTagConfig().controls }); |
| 854 |
}, |
| 855 |
initialize: function initialize() { |
| 856 |
this.initModel(); |
| 857 |
if (!this.hasSettings()) return; |
| 858 |
this.initSettingsPopup(); |
| 859 |
this.listenTo(this.model, "change", this.render); |
| 860 |
}, |
| 861 |
onClick: function onClick() { |
| 862 |
this.showSettingsPopup(); |
| 863 |
}, |
| 864 |
onRemoveClick: function onRemoveClick(event) { |
| 865 |
event.stopPropagation(); |
| 866 |
this.destroy(); |
| 867 |
this.trigger("remove"); |
| 868 |
}, |
| 869 |
onDestroy: function onDestroy() { |
| 870 |
if (this.hasSettings()) this.getSettingsPopup().destroy(); |
| 871 |
if (this.tagControlsStack) this.tagControlsStack.destroy(); |
| 872 |
} |
| 873 |
}); |
| 874 |
})); |
| 875 |
|
| 876 |
//#endregion |
| 877 |
//#region assets/dev/js/editor/components/dynamic-tags/control-behavior.js |
| 878 |
var require_control_behavior = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 879 |
init_defineProperty(); |
| 880 |
var TagPanelView = require_tag_panel_view(); |
| 881 |
module.exports = Marionette.Behavior.extend({ |
| 882 |
tagView: null, |
| 883 |
listenerAttached: false, |
| 884 |
initialize: function initialize() { |
| 885 |
if (!this.listenerAttached) { |
| 886 |
this.listenTo(this.view.options.container.settings, "change:external:__dynamic__", this.onAfterExternalChange); |
| 887 |
this.listenerAttached = true; |
| 888 |
} |
| 889 |
}, |
| 890 |
shouldRenderTools: function shouldRenderTools() { |
| 891 |
if (this.getOption("dynamicSettings").default) return false; |
| 892 |
var isFeatureAvailableToUser = elementor.helpers.hasPro() && !elementor.helpers.hasProAndNotConnected(); |
| 893 |
var hasTags = this.getOption("tags").length > 0; |
| 894 |
return !isFeatureAvailableToUser || hasTags; |
| 895 |
}, |
| 896 |
renderTools: function renderTools() { |
| 897 |
var _this = this; |
| 898 |
if (!this.shouldRenderTools()) return; |
| 899 |
var $dynamicSwitcher = jQuery(Marionette.Renderer.render("#tmpl-elementor-control-dynamic-switcher")); |
| 900 |
$dynamicSwitcher.on("click", function(event) { |
| 901 |
return _this.onDynamicSwitcherClick(event); |
| 902 |
}); |
| 903 |
this.$el.find(".elementor-control-dynamic-switcher-wrapper").append($dynamicSwitcher); |
| 904 |
this.ui.dynamicSwitcher = $dynamicSwitcher; |
| 905 |
if ("color" === this.view.model.get("type")) if (this.view.colorPicker) this.moveDynamicSwitcherToColorPicker(); |
| 906 |
else setTimeout(function() { |
| 907 |
return _this.moveDynamicSwitcherToColorPicker(); |
| 908 |
}); |
| 909 |
this.ui.dynamicSwitcher.tipsy({ |
| 910 |
title: function title() { |
| 911 |
return this.getAttribute("data-tooltip"); |
| 912 |
}, |
| 913 |
gravity: "s" |
| 914 |
}); |
| 915 |
}, |
| 916 |
moveDynamicSwitcherToColorPicker: function moveDynamicSwitcherToColorPicker() { |
| 917 |
var $colorPickerToolsContainer = this.view.colorPicker.$pickerToolsContainer; |
| 918 |
this.ui.dynamicSwitcher.removeClass("elementor-control-unit-1").addClass("e-control-tool"); |
| 919 |
var $eyedropper = $colorPickerToolsContainer.find(".elementor-control-element-color-picker"); |
| 920 |
if ($eyedropper.length) this.ui.dynamicSwitcher.insertBefore($eyedropper); |
| 921 |
else $colorPickerToolsContainer.append(this.ui.dynamicSwitcher); |
| 922 |
}, |
| 923 |
toggleDynamicClass: function toggleDynamicClass() { |
| 924 |
this.$el.toggleClass("elementor-control-dynamic-value", this.isDynamicMode()); |
| 925 |
}, |
| 926 |
isDynamicMode: function isDynamicMode() { |
| 927 |
var dynamicSettings = this.view.container.settings.get("__dynamic__"); |
| 928 |
return !!(dynamicSettings && dynamicSettings[this.view.model.get("name")]); |
| 929 |
}, |
| 930 |
createTagsList: function createTagsList() { |
| 931 |
var tags = _.groupBy(this.getOption("tags"), "group"); |
| 932 |
var groups = elementor.dynamicTags.getConfig("groups"); |
| 933 |
var $tagsList = this.ui.tagsList = jQuery("<div>", { class: "elementor-tags-list" }); |
| 934 |
var $tagsListInner = jQuery("<div>", { class: "elementor-tags-list__inner" }); |
| 935 |
$tagsList.append($tagsListInner); |
| 936 |
jQuery.each(groups, function(groupName) { |
| 937 |
var groupTags = tags[groupName]; |
| 938 |
if (!groupTags) return; |
| 939 |
var group = this; |
| 940 |
var $groupTitle = jQuery("<div>", { class: "elementor-tags-list__group-title" }).text(group.title); |
| 941 |
$tagsListInner.append($groupTitle); |
| 942 |
groupTags.forEach(function(tag) { |
| 943 |
var $tag = jQuery("<div>", { class: "elementor-tags-list__item" }); |
| 944 |
$tag.text(tag.title).attr("data-tag-name", tag.name); |
| 945 |
$tagsListInner.append($tag); |
| 946 |
}); |
| 947 |
}); |
| 948 |
if (!elementor.helpers.hasPro() && Object.keys(tags).length) { |
| 949 |
var proTeaser = Marionette.Renderer.render("#tmpl-elementor-dynamic-tags-promo", { promotionUrl: elementor.config.dynamicPromotionURL.replace("%s", this.view.model.get("name")) }); |
| 950 |
$tagsListInner.append(proTeaser); |
| 951 |
} |
| 952 |
$tagsListInner.on("click", ".elementor-tags-list__item", this.onTagsListItemClick.bind(this)); |
| 953 |
elementorCommon.elements.$body.append($tagsList); |
| 954 |
}, |
| 955 |
getTagsList: function getTagsList() { |
| 956 |
if (!this.ui.tagsList) this.createTagsList(); |
| 957 |
return this.ui.tagsList; |
| 958 |
}, |
| 959 |
toggleTagsList: function toggleTagsList() { |
| 960 |
var $tagsList = this.getTagsList(); |
| 961 |
if ($tagsList.is(":visible")) { |
| 962 |
$tagsList.hide(); |
| 963 |
return; |
| 964 |
} |
| 965 |
var direction = elementorCommon.config.isRTL ? "left" : "right"; |
| 966 |
$tagsList.show().position({ |
| 967 |
my: "".concat(direction, " top"), |
| 968 |
at: "".concat(direction, " bottom+5"), |
| 969 |
of: this.ui.dynamicSwitcher |
| 970 |
}); |
| 971 |
}, |
| 972 |
setTagView: function setTagView(id, name, settings) { |
| 973 |
if (this.tagView) this.tagView.destroy(); |
| 974 |
var tagView = this.tagView = new TagPanelView({ |
| 975 |
id, |
| 976 |
name, |
| 977 |
settings, |
| 978 |
controlName: this.view.model.get("name"), |
| 979 |
dynamicSettings: this.getOption("dynamicSettings") |
| 980 |
}); |
| 981 |
var elementContainer = this.view.options.container; |
| 982 |
var tagViewLabel = elementContainer.controls[tagView.options.controlName].label; |
| 983 |
tagView.options.container = new elementorModules.editor.Container({ |
| 984 |
type: "dynamic", |
| 985 |
id, |
| 986 |
model: tagView.model, |
| 987 |
settings: tagView.model, |
| 988 |
view: tagView, |
| 989 |
parent: elementContainer, |
| 990 |
label: elementContainer.label + " " + tagViewLabel, |
| 991 |
controls: tagView.model.options.controls, |
| 992 |
renderer: elementContainer |
| 993 |
}); |
| 994 |
tagView.render(); |
| 995 |
this.$el.find(".elementor-control-tag-area").after(tagView.el); |
| 996 |
this.listenTo(tagView, "remove", this.onTagViewRemove.bind(this)); |
| 997 |
}, |
| 998 |
setDefaultTagView: function setDefaultTagView() { |
| 999 |
var tagData = elementor.dynamicTags.tagTextToTagData(this.getDynamicValue()); |
| 1000 |
this.setTagView(tagData.id, tagData.name, tagData.settings); |
| 1001 |
}, |
| 1002 |
tagViewToTagText: function tagViewToTagText() { |
| 1003 |
var tagView = this.tagView; |
| 1004 |
return elementor.dynamicTags.tagDataToTagText(tagView.getOption("id"), tagView.getOption("name"), tagView.model); |
| 1005 |
}, |
| 1006 |
getDynamicValue: function getDynamicValue() { |
| 1007 |
return this.view.container.dynamic.get(this.view.model.get("name")); |
| 1008 |
}, |
| 1009 |
destroyTagView: function destroyTagView() { |
| 1010 |
if (this.tagView) { |
| 1011 |
this.tagView.destroy(); |
| 1012 |
this.tagView = null; |
| 1013 |
} |
| 1014 |
}, |
| 1015 |
showPromotion: function showPromotion() { |
| 1016 |
var hasProAndNotConnected = elementor.helpers.hasProAndNotConnected(); |
| 1017 |
var dialogOptions = { |
| 1018 |
title: (0, _wordpress_i18n.__)("Dynamic Content", "elementor"), |
| 1019 |
content: (0, _wordpress_i18n.__)("Create more personalized and dynamic sites by populating data from various sources with dozens of dynamic tags to choose from.", "elementor"), |
| 1020 |
targetElement: this.ui.dynamicSwitcher, |
| 1021 |
position: { blockStart: "-10" }, |
| 1022 |
actionButton: { |
| 1023 |
url: hasProAndNotConnected ? elementorProEditorConfig.urls.connect : elementor.config.dynamicPromotionURL.replace("%s", this.view.model.get("name")), |
| 1024 |
text: hasProAndNotConnected ? (0, _wordpress_i18n.__)("Connect & Activate", "elementor") : (0, _wordpress_i18n.__)("Upgrade", "elementor") |
| 1025 |
} |
| 1026 |
}; |
| 1027 |
elementor.promotion.showDialog(dialogOptions); |
| 1028 |
}, |
| 1029 |
onRender: function onRender() { |
| 1030 |
this.$el.addClass("elementor-control-dynamic"); |
| 1031 |
this.renderTools(); |
| 1032 |
this.toggleDynamicClass(); |
| 1033 |
if (this.isDynamicMode()) this.setDefaultTagView(); |
| 1034 |
}, |
| 1035 |
onDynamicSwitcherClick: function onDynamicSwitcherClick(event) { |
| 1036 |
event.stopPropagation(); |
| 1037 |
if (this.getOption("tags").length) this.toggleTagsList(); |
| 1038 |
else this.showPromotion(); |
| 1039 |
}, |
| 1040 |
onTagsListItemClick: function onTagsListItemClick(event) { |
| 1041 |
var $tag = jQuery(event.currentTarget); |
| 1042 |
this.setTagView(elementorCommon.helpers.getUniqueId(), $tag.data("tagName"), {}); |
| 1043 |
if (this.view.getGlobalKey()) this.view.triggerMethod("unset:global:value"); |
| 1044 |
if (this.isDynamicMode()) $e.run("document/dynamic/settings", { |
| 1045 |
container: this.view.options.container, |
| 1046 |
settings: _defineProperty({}, this.view.model.get("name"), this.tagViewToTagText()) |
| 1047 |
}); |
| 1048 |
else $e.run("document/dynamic/enable", { |
| 1049 |
container: this.view.options.container, |
| 1050 |
settings: _defineProperty({}, this.view.model.get("name"), this.tagViewToTagText()) |
| 1051 |
}); |
| 1052 |
this.toggleDynamicClass(); |
| 1053 |
this.toggleTagsList(); |
| 1054 |
if (this.tagView.getTagConfig().settings_required) this.tagView.showSettingsPopup(); |
| 1055 |
}, |
| 1056 |
onTagViewRemove: function onTagViewRemove() { |
| 1057 |
$e.run("document/dynamic/disable", { |
| 1058 |
container: this.view.options.container, |
| 1059 |
settings: _defineProperty({}, this.view.model.get("name"), this.tagViewToTagText()) |
| 1060 |
}); |
| 1061 |
this.toggleDynamicClass(); |
| 1062 |
}, |
| 1063 |
onAfterExternalChange: function onAfterExternalChange() { |
| 1064 |
this.destroyTagView(); |
| 1065 |
if (this.isDynamicMode()) this.setDefaultTagView(); |
| 1066 |
this.toggleDynamicClass(); |
| 1067 |
}, |
| 1068 |
onDestroy: function onDestroy() { |
| 1069 |
this.destroyTagView(); |
| 1070 |
if (this.ui.tagsList) this.ui.tagsList.remove(); |
| 1071 |
} |
| 1072 |
}); |
| 1073 |
})); |
| 1074 |
|
| 1075 |
//#endregion |
| 1076 |
//#region assets/dev/js/editor/controls/base-data.js |
| 1077 |
var require_base_data = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 1078 |
init_slicedToArray(); |
| 1079 |
init_defineProperty(); |
| 1080 |
init_breakpoint(); |
| 1081 |
function _createForOfIteratorHelper(r, e) { |
| 1082 |
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; |
| 1083 |
if (!t) { |
| 1084 |
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { |
| 1085 |
t && (r = t); |
| 1086 |
var _n = 0; |
| 1087 |
var F = function F() {}; |
| 1088 |
return { |
| 1089 |
s: F, |
| 1090 |
n: function n() { |
| 1091 |
return _n >= r.length ? { done: !0 } : { |
| 1092 |
done: !1, |
| 1093 |
value: r[_n++] |
| 1094 |
}; |
| 1095 |
}, |
| 1096 |
e: function e(r) { |
| 1097 |
throw r; |
| 1098 |
}, |
| 1099 |
f: F |
| 1100 |
}; |
| 1101 |
} |
| 1102 |
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
| 1103 |
} |
| 1104 |
var o; |
| 1105 |
var a = !0; |
| 1106 |
var u = !1; |
| 1107 |
return { |
| 1108 |
s: function s() { |
| 1109 |
t = t.call(r); |
| 1110 |
}, |
| 1111 |
n: function n() { |
| 1112 |
var r = t.next(); |
| 1113 |
return a = r.done, r; |
| 1114 |
}, |
| 1115 |
e: function e(r) { |
| 1116 |
u = !0, o = r; |
| 1117 |
}, |
| 1118 |
f: function f() { |
| 1119 |
try { |
| 1120 |
a || null == t.return || t.return(); |
| 1121 |
} finally { |
| 1122 |
if (u) throw o; |
| 1123 |
} |
| 1124 |
} |
| 1125 |
}; |
| 1126 |
} |
| 1127 |
function _unsupportedIterableToArray(r, a) { |
| 1128 |
if (r) { |
| 1129 |
if ("string" == typeof r) return _arrayLikeToArray(r, a); |
| 1130 |
var t = {}.toString.call(r).slice(8, -1); |
| 1131 |
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; |
| 1132 |
} |
| 1133 |
} |
| 1134 |
function _arrayLikeToArray(r, a) { |
| 1135 |
(null == a || a > r.length) && (a = r.length); |
| 1136 |
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; |
| 1137 |
return n; |
| 1138 |
} |
| 1139 |
var ControlBaseView = require_base(); |
| 1140 |
var TagsBehavior = require_control_behavior(); |
| 1141 |
var Validator = require_base$1(); |
| 1142 |
var NumberValidator = require_number(); |
| 1143 |
var ControlBaseDataView = ControlBaseView.extend({ |
| 1144 |
validatorTypes: { |
| 1145 |
Base: Validator, |
| 1146 |
Number: NumberValidator, |
| 1147 |
Breakpoint: BreakpointValidator |
| 1148 |
}, |
| 1149 |
ui: function ui() { |
| 1150 |
var ui = ControlBaseView.prototype.ui.apply(this, arguments); |
| 1151 |
_.extend(ui, { |
| 1152 |
input: "input[data-setting][type!=\"checkbox\"][type!=\"radio\"]", |
| 1153 |
checkbox: "input[data-setting][type=\"checkbox\"]", |
| 1154 |
radio: "input[data-setting][type=\"radio\"]", |
| 1155 |
select: "select[data-setting]", |
| 1156 |
textarea: "textarea[data-setting]", |
| 1157 |
responsiveSwitchersSibling: "".concat(ui.controlTitle, "[data-e-responsive-switcher-sibling!=\"false\"]"), |
| 1158 |
responsiveSwitchers: ".elementor-responsive-switcher", |
| 1159 |
contentEditable: "[contenteditable=\"true\"]" |
| 1160 |
}); |
| 1161 |
return ui; |
| 1162 |
}, |
| 1163 |
templateHelpers: function templateHelpers() { |
| 1164 |
var controlData = ControlBaseView.prototype.templateHelpers.apply(this, arguments); |
| 1165 |
controlData.data.controlValue = this.getControlValue(); |
| 1166 |
return controlData; |
| 1167 |
}, |
| 1168 |
events: function events() { |
| 1169 |
return { |
| 1170 |
"input @ui.input": "onBaseInputTextChange", |
| 1171 |
"change @ui.checkbox": "onBaseInputChange", |
| 1172 |
"change @ui.radio": "onBaseInputChange", |
| 1173 |
"input @ui.textarea": "onBaseInputTextChange", |
| 1174 |
"change @ui.select": "onBaseInputChange", |
| 1175 |
"input @ui.contentEditable": "onBaseInputTextChange", |
| 1176 |
"click @ui.responsiveSwitchers": "onResponsiveSwitchersClick" |
| 1177 |
}; |
| 1178 |
}, |
| 1179 |
behaviors: function behaviors() { |
| 1180 |
var behaviors = ControlBaseView.prototype.behaviors.apply(this, arguments); |
| 1181 |
var dynamicSettings = this.options.model.get("dynamic"); |
| 1182 |
if (dynamicSettings && dynamicSettings.active) { |
| 1183 |
var tags = _.filter(elementor.dynamicTags.getConfig("tags"), function(tag) { |
| 1184 |
return tag.editable && _.intersection(tag.categories, dynamicSettings.categories).length; |
| 1185 |
}); |
| 1186 |
if (tags.length || elementor.config.user.is_administrator) behaviors.tags = { |
| 1187 |
behaviorClass: TagsBehavior, |
| 1188 |
tags, |
| 1189 |
dynamicSettings |
| 1190 |
}; |
| 1191 |
} |
| 1192 |
return behaviors; |
| 1193 |
}, |
| 1194 |
initialize: function initialize() { |
| 1195 |
ControlBaseView.prototype.initialize.apply(this, arguments); |
| 1196 |
this.registerValidators(); |
| 1197 |
if (this.model.get("responsive")) this.setPlaceholderFromParent(); |
| 1198 |
if (void 0 === this.model.get("inherit_placeholders")) this.model.set("inherit_placeholders", true); |
| 1199 |
var settings = this.container ? this.container.settings : this.elementSettingsModel; |
| 1200 |
this.listenTo(settings, "change:external:" + this.model.get("name"), this.onAfterExternalChange); |
| 1201 |
}, |
| 1202 |
getControlValue: function getControlValue() { |
| 1203 |
return this.container.settings.get(this.model.get("name")); |
| 1204 |
}, |
| 1205 |
getGlobalKey: function getGlobalKey() { |
| 1206 |
return this.container.globals.get(this.model.get("name")); |
| 1207 |
}, |
| 1208 |
getGlobalValue: function getGlobalValue() { |
| 1209 |
return this.globalValue; |
| 1210 |
}, |
| 1211 |
getGlobalDefault: function getGlobalDefault() { |
| 1212 |
var controlGlobalArgs = this.model.get("global"); |
| 1213 |
if (controlGlobalArgs !== null && controlGlobalArgs !== void 0 && controlGlobalArgs.default) { |
| 1214 |
if (!elementor.config.globals.defaults_enabled[this.getGlobalMeta().controlType]) return ""; |
| 1215 |
var _$e$data$commandExtra = $e.data.commandExtractArgs(controlGlobalArgs.default); |
| 1216 |
var command = _$e$data$commandExtra.command; |
| 1217 |
var args = _$e$data$commandExtra.args; |
| 1218 |
var result = $e.data.getCache($e.components.get("globals"), command, args.query); |
| 1219 |
return result === null || result === void 0 ? void 0 : result.value; |
| 1220 |
} |
| 1221 |
return ""; |
| 1222 |
}, |
| 1223 |
getCurrentValue: function getCurrentValue() { |
| 1224 |
if (this.getGlobalKey() && !this.globalValue) return ""; |
| 1225 |
if (this.globalValue) return this.globalValue; |
| 1226 |
var controlValue = this.getControlValue(); |
| 1227 |
if (controlValue) return controlValue; |
| 1228 |
return this.getGlobalDefault(); |
| 1229 |
}, |
| 1230 |
isGlobalActive: function isGlobalActive() { |
| 1231 |
var _this$options$model$g; |
| 1232 |
return (_this$options$model$g = this.options.model.get("global")) === null || _this$options$model$g === void 0 ? void 0 : _this$options$model$g.active; |
| 1233 |
}, |
| 1234 |
setValue: function setValue(value) { |
| 1235 |
this.setSettingsModel(value); |
| 1236 |
}, |
| 1237 |
setSettingsModel: function setSettingsModel(value) { |
| 1238 |
var key = this.model.get("name"); |
| 1239 |
$e.run("document/elements/settings", { |
| 1240 |
container: this.options.container, |
| 1241 |
settings: _defineProperty({}, key, value) |
| 1242 |
}); |
| 1243 |
this.triggerMethod("settings:change"); |
| 1244 |
}, |
| 1245 |
applySavedValue: function applySavedValue() { |
| 1246 |
this.setInputValue("[data-setting=\"" + this.model.get("name") + "\"]", this.getControlValue()); |
| 1247 |
}, |
| 1248 |
getEditSettings: function getEditSettings(setting) { |
| 1249 |
var settings = this.getOption("elementEditSettings").toJSON(); |
| 1250 |
if (setting) return settings[setting]; |
| 1251 |
return settings; |
| 1252 |
}, |
| 1253 |
setEditSetting: function setEditSetting(settingKey, settingValue) { |
| 1254 |
(this.getOption("elementEditSettings") || this.getOption("container").settings).set(settingKey, settingValue); |
| 1255 |
}, |
| 1256 |
/** |
| 1257 |
* Get the placeholder for the current control. |
| 1258 |
* |
| 1259 |
* @return {*} placeholder |
| 1260 |
*/ |
| 1261 |
getControlPlaceholder: function getControlPlaceholder() { |
| 1262 |
var placeholder = this.model.get("placeholder"); |
| 1263 |
if (this.model.get("responsive") && this.model.get("inherit_placeholders")) placeholder = placeholder || this.container.placeholders[this.model.get("name")]; |
| 1264 |
return placeholder; |
| 1265 |
}, |
| 1266 |
/** |
| 1267 |
* Get the responsive parent view if exists. |
| 1268 |
* |
| 1269 |
* @return {ControlBaseDataView|undefined} responsive parent view if exists |
| 1270 |
*/ |
| 1271 |
getResponsiveParentView: function getResponsiveParentView() { |
| 1272 |
var parent = this.model.get("parent"); |
| 1273 |
try { |
| 1274 |
return parent && this.container.panel.getControlView(parent); |
| 1275 |
} catch (e) {} |
| 1276 |
}, |
| 1277 |
/** |
| 1278 |
* Get the responsive children views if exists. |
| 1279 |
* |
| 1280 |
* @return {ControlBaseDataView|null} responsive children views if exists |
| 1281 |
*/ |
| 1282 |
getResponsiveChildrenViews: function getResponsiveChildrenViews() { |
| 1283 |
var children = this.model.get("inheritors"); |
| 1284 |
var views = []; |
| 1285 |
try { |
| 1286 |
var _iterator = _createForOfIteratorHelper(children); |
| 1287 |
var _step; |
| 1288 |
try { |
| 1289 |
for (_iterator.s(); !(_step = _iterator.n()).done;) { |
| 1290 |
var child = _step.value; |
| 1291 |
views.push(this.container.panel.getControlView(child)); |
| 1292 |
} |
| 1293 |
} catch (err) { |
| 1294 |
_iterator.e(err); |
| 1295 |
} finally { |
| 1296 |
_iterator.f(); |
| 1297 |
} |
| 1298 |
} catch (e) {} |
| 1299 |
return views; |
| 1300 |
}, |
| 1301 |
/** |
| 1302 |
* Get prepared placeholder from the responsive parent, and put it into current |
| 1303 |
* control model as placeholder. |
| 1304 |
*/ |
| 1305 |
setPlaceholderFromParent: function setPlaceholderFromParent() { |
| 1306 |
var parent = this.getResponsiveParentView(); |
| 1307 |
if (parent) this.container.placeholders[this.model.get("name")] = parent.preparePlaceholderForChildren(); |
| 1308 |
}, |
| 1309 |
/** |
| 1310 |
* Returns the value of the current control if exists, or the parent value if not, |
| 1311 |
* so responsive children can set it as their placeholder. When there are multiple |
| 1312 |
* inputs, the inputs which are empty on this control will inherit their values |
| 1313 |
* from the responsive parent. |
| 1314 |
* For example, if on desktop the padding of all edges is 10, and on tablet only |
| 1315 |
* padding right and left is set to 15, the mobile control placeholder will |
| 1316 |
* eventually be: { top: 10, right: 15, left: 15, bottom: 10 }, because of the |
| 1317 |
* inheritance of multiple values. |
| 1318 |
* |
| 1319 |
* @return {*} value of the current control if exists, or the parent value if not |
| 1320 |
*/ |
| 1321 |
preparePlaceholderForChildren: function preparePlaceholderForChildren() { |
| 1322 |
var _this$getResponsivePa; |
| 1323 |
var cleanValue = this.getCleanControlValue(); |
| 1324 |
var parentValue = (_this$getResponsivePa = this.getResponsiveParentView()) === null || _this$getResponsivePa === void 0 ? void 0 : _this$getResponsivePa.preparePlaceholderForChildren(); |
| 1325 |
if (cleanValue instanceof Object) return Object.assign({}, parentValue, cleanValue); |
| 1326 |
return cleanValue || parentValue; |
| 1327 |
}, |
| 1328 |
/** |
| 1329 |
* Start the re-rendering recursive chain from the responsive child of this |
| 1330 |
* control. It's useful when the current control value is changed and we want |
| 1331 |
* to update all responsive children. In this case, the re-rendering is supposed |
| 1332 |
* to be applied only from the responsive child of this control and on. |
| 1333 |
*/ |
| 1334 |
propagatePlaceholder: function propagatePlaceholder() { |
| 1335 |
var _iterator2 = _createForOfIteratorHelper(this.getResponsiveChildrenViews()); |
| 1336 |
var _step2; |
| 1337 |
try { |
| 1338 |
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) _step2.value.renderWithChildren(); |
| 1339 |
} catch (err) { |
| 1340 |
_iterator2.e(err); |
| 1341 |
} finally { |
| 1342 |
_iterator2.f(); |
| 1343 |
} |
| 1344 |
}, |
| 1345 |
/** |
| 1346 |
* Re-render current control and trigger this method on the responsive child. |
| 1347 |
* The purpose of those actions is to recursively re-render all responsive |
| 1348 |
* children. |
| 1349 |
*/ |
| 1350 |
renderWithChildren: function renderWithChildren() { |
| 1351 |
this.render(); |
| 1352 |
this.propagatePlaceholder(); |
| 1353 |
}, |
| 1354 |
/** |
| 1355 |
* Get control value without empty properties, and without default values. |
| 1356 |
* |
| 1357 |
* @return {{}} control value without empty properties, and without default values |
| 1358 |
*/ |
| 1359 |
getCleanControlValue: function getCleanControlValue() { |
| 1360 |
var value = this.getControlValue(); |
| 1361 |
return value && value !== this.model.get("default") ? value : void 0; |
| 1362 |
}, |
| 1363 |
onAfterChange: function onAfterChange(control) { |
| 1364 |
if (Object.keys(control.changed).includes(this.model.get("name"))) this.propagatePlaceholder(); |
| 1365 |
ControlBaseView.prototype.onAfterChange.apply(this, arguments); |
| 1366 |
}, |
| 1367 |
getInputValue: function getInputValue(input) { |
| 1368 |
var $input = this.$(input); |
| 1369 |
if ($input.is("[contenteditable=\"true\"]")) return $input.html(); |
| 1370 |
var inputValue = $input.val(); |
| 1371 |
var inputType = $input.attr("type"); |
| 1372 |
if (-1 !== ["radio", "checkbox"].indexOf(inputType)) return $input.prop("checked") ? inputValue : ""; |
| 1373 |
if ("number" === inputType && _.isFinite(inputValue)) return +inputValue; |
| 1374 |
if ("SELECT" === input.tagName && $input.prop("multiple") && null === inputValue) inputValue = []; |
| 1375 |
return inputValue; |
| 1376 |
}, |
| 1377 |
setInputValue: function setInputValue(input, value) { |
| 1378 |
var $input = this.$(input); |
| 1379 |
var inputType = $input.attr("type"); |
| 1380 |
if ("checkbox" === inputType) $input.prop("checked", !!value); |
| 1381 |
else if ("radio" === inputType) $input.filter("[value=\"" + value + "\"]").prop("checked", true); |
| 1382 |
else $input.val(value); |
| 1383 |
}, |
| 1384 |
addValidator: function addValidator(validator) { |
| 1385 |
this.validators.push(validator); |
| 1386 |
}, |
| 1387 |
registerValidators: function registerValidators() { |
| 1388 |
var _this = this; |
| 1389 |
this.validators = []; |
| 1390 |
var validationTerms = {}; |
| 1391 |
if (this.model.get("required")) validationTerms.required = true; |
| 1392 |
if (!jQuery.isEmptyObject(validationTerms)) this.addValidator(new this.validatorTypes.Base({ validationTerms })); |
| 1393 |
var validators = this.model.get("validators"); |
| 1394 |
if (validators) Object.entries(validators).forEach(function(_ref) { |
| 1395 |
var _ref2 = _slicedToArray(_ref, 2); |
| 1396 |
var key = _ref2[0]; |
| 1397 |
var args = _ref2[1]; |
| 1398 |
_this.addValidator(new _this.validatorTypes[key]({ validationTerms: args })); |
| 1399 |
}); |
| 1400 |
}, |
| 1401 |
onBeforeRender: function onBeforeRender() { |
| 1402 |
this.setPlaceholderFromParent(); |
| 1403 |
}, |
| 1404 |
onRender: function onRender() { |
| 1405 |
ControlBaseView.prototype.onRender.apply(this, arguments); |
| 1406 |
if (this.model.get("responsive")) this.renderResponsiveSwitchers(); |
| 1407 |
this.applySavedValue(); |
| 1408 |
this.triggerMethod("ready"); |
| 1409 |
this.toggleControlVisibility(); |
| 1410 |
this.addTooltip(); |
| 1411 |
}, |
| 1412 |
onBaseInputTextChange: function onBaseInputTextChange(event) { |
| 1413 |
this.onBaseInputChange(event); |
| 1414 |
}, |
| 1415 |
onBaseInputChange: function onBaseInputChange(event) { |
| 1416 |
clearTimeout(this.correctionTimeout); |
| 1417 |
var input = event.currentTarget; |
| 1418 |
var value = this.getInputValue(input); |
| 1419 |
var validators = this.validators.slice(0); |
| 1420 |
var settingsValidators = this.container.settings.validators[this.model.get("name")]; |
| 1421 |
if (settingsValidators) validators = validators.concat(settingsValidators); |
| 1422 |
if (validators) { |
| 1423 |
var oldValue = this.getControlValue(input.dataset.setting); |
| 1424 |
if (!validators.every(function(validator) { |
| 1425 |
return validator.isValid(value, oldValue); |
| 1426 |
})) { |
| 1427 |
this.correctionTimeout = setTimeout(this.setInputValue.bind(this, input, oldValue), 1200); |
| 1428 |
return; |
| 1429 |
} |
| 1430 |
} |
| 1431 |
this.updateElementModel(value, input); |
| 1432 |
this.triggerMethod("input:change", event); |
| 1433 |
}, |
| 1434 |
onResponsiveSwitchersClick: function onResponsiveSwitchersClick(event) { |
| 1435 |
var $switcher = jQuery(event.currentTarget); |
| 1436 |
var device = $switcher.data("device"); |
| 1437 |
var $switchersWrapper = this.ui.responsiveSwitchersWrapper; |
| 1438 |
var selectedOption = $switcher.index(); |
| 1439 |
$switchersWrapper.toggleClass("elementor-responsive-switchers-open"); |
| 1440 |
$switchersWrapper[0].style.setProperty("--selected-option", selectedOption); |
| 1441 |
this.triggerMethod("responsive:switcher:click", device); |
| 1442 |
elementor.changeDeviceMode(device); |
| 1443 |
}, |
| 1444 |
renderResponsiveSwitchers: function renderResponsiveSwitchers() { |
| 1445 |
var templateHtml = Marionette.Renderer.render("#tmpl-elementor-control-responsive-switchers", this.model.attributes); |
| 1446 |
this.ui.responsiveSwitchersSibling.after(templateHtml); |
| 1447 |
this.ui.responsiveSwitchersWrapper = this.$el.find(".elementor-control-responsive-switchers"); |
| 1448 |
}, |
| 1449 |
onAfterExternalChange: function onAfterExternalChange() { |
| 1450 |
this.hideTooltip(); |
| 1451 |
this.applySavedValue(); |
| 1452 |
}, |
| 1453 |
addTooltip: function addTooltip() { |
| 1454 |
this.ui.tooltipTargets = this.$el.find(".tooltip-target"); |
| 1455 |
if (!this.ui.tooltipTargets.length) return; |
| 1456 |
this.ui.tooltipTargets.tipsy({ |
| 1457 |
gravity: function gravity() { |
| 1458 |
var gravity = jQuery(this).data("tooltip-pos"); |
| 1459 |
if (void 0 !== gravity) return gravity; |
| 1460 |
return "s"; |
| 1461 |
}, |
| 1462 |
title: function title() { |
| 1463 |
return this.getAttribute("data-tooltip"); |
| 1464 |
} |
| 1465 |
}); |
| 1466 |
}, |
| 1467 |
hideTooltip: function hideTooltip() { |
| 1468 |
if (this.ui.tooltipTargets.length) this.ui.tooltipTargets.tipsy("hide"); |
| 1469 |
}, |
| 1470 |
updateElementModel: function updateElementModel(value) { |
| 1471 |
this.setValue(value); |
| 1472 |
} |
| 1473 |
}, { |
| 1474 |
getStyleValue: function getStyleValue(placeholder, controlValue, controlData) { |
| 1475 |
if ("DEFAULT" === placeholder) return controlData.default; |
| 1476 |
return controlValue; |
| 1477 |
}, |
| 1478 |
onPasteStyle: function onPasteStyle() { |
| 1479 |
return true; |
| 1480 |
} |
| 1481 |
}); |
| 1482 |
module.exports = ControlBaseDataView; |
| 1483 |
})); |
| 1484 |
|
| 1485 |
//#endregion |
| 1486 |
//#region assets/dev/js/editor/controls/switcher.js |
| 1487 |
var require_switcher = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 1488 |
var ControlBaseDataView = require_base_data(); |
| 1489 |
module.exports = ControlBaseDataView.extend({ setInputValue: function setInputValue(input, value) { |
| 1490 |
this.$(input).prop("checked", this.model.get("return_value") === value); |
| 1491 |
} }, { onPasteStyle: function onPasteStyle(control, clipboardValue) { |
| 1492 |
return !clipboardValue || clipboardValue === control.return_value; |
| 1493 |
} }); |
| 1494 |
})); |
| 1495 |
|
| 1496 |
//#endregion |
| 1497 |
//#region modules/styleguide/assets/js/controls/switcher.js |
| 1498 |
init_classCallCheck(); |
| 1499 |
init_createClass(); |
| 1500 |
init_possibleConstructorReturn(); |
| 1501 |
init_getPrototypeOf(); |
| 1502 |
init_inherits(); |
| 1503 |
var import_switcher = /* @__PURE__ */ __toESM(require_switcher()); |
| 1504 |
var import_base_data = /* @__PURE__ */ __toESM(require_base_data()); |
| 1505 |
function _callSuper$2(t, o, e) { |
| 1506 |
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$2() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); |
| 1507 |
} |
| 1508 |
__name(_callSuper$2, "_callSuper"); |
| 1509 |
function _isNativeReflectConstruct$2() { |
| 1510 |
try { |
| 1511 |
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); |
| 1512 |
} catch (t) {} |
| 1513 |
return (_isNativeReflectConstruct$2 = function _isNativeReflectConstruct() { |
| 1514 |
return !!t; |
| 1515 |
})(); |
| 1516 |
} |
| 1517 |
__name(_isNativeReflectConstruct$2, "_isNativeReflectConstruct"); |
| 1518 |
function _superPropGet(t, o, e, r) { |
| 1519 |
var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); |
| 1520 |
return 2 & r && "function" == typeof p ? function(t) { |
| 1521 |
return p.apply(e, t); |
| 1522 |
} : p; |
| 1523 |
} |
| 1524 |
var _default$1 = /*#__PURE__*/ function(_Switcher) { |
| 1525 |
function _default() { |
| 1526 |
_classCallCheck(this, _default); |
| 1527 |
return _callSuper$2(this, _default, arguments); |
| 1528 |
} |
| 1529 |
_inherits(_default, _Switcher); |
| 1530 |
return _createClass(_default, [ |
| 1531 |
{ |
| 1532 |
key: "initialize", |
| 1533 |
value: function initialize() { |
| 1534 |
import_base_data.default.prototype.initialize.apply(this, arguments); |
| 1535 |
this.$el.addClass("elementor-control-type-switcher"); |
| 1536 |
} |
| 1537 |
}, |
| 1538 |
{ |
| 1539 |
key: "onBeforeRender", |
| 1540 |
value: function onBeforeRender() { |
| 1541 |
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key]; |
| 1542 |
_superPropGet(_default, "onBeforeRender", this, 3)(args); |
| 1543 |
var actualValue = elementor.getPreferences("enable_styleguide_preview"); |
| 1544 |
if (actualValue !== this.getCurrentValue()) this.setValue(actualValue); |
| 1545 |
} |
| 1546 |
}, |
| 1547 |
{ |
| 1548 |
key: "onBaseInputChange", |
| 1549 |
value: function onBaseInputChange(event) { |
| 1550 |
import_base_data.default.prototype.onBaseInputChange.apply(this, arguments); |
| 1551 |
var input = event.currentTarget; |
| 1552 |
var value = this.getInputValue(input); |
| 1553 |
if (this.model.get("on_change_command")) this.runCommand(value); |
| 1554 |
this.model.set("return_value", null); |
| 1555 |
} |
| 1556 |
}, |
| 1557 |
{ |
| 1558 |
key: "runCommand", |
| 1559 |
value: function runCommand(value) { |
| 1560 |
$e.run("preview/styleguide/switcher-change", { |
| 1561 |
name: this.model.get("name"), |
| 1562 |
value |
| 1563 |
}); |
| 1564 |
} |
| 1565 |
} |
| 1566 |
]); |
| 1567 |
}(import_switcher.default); |
| 1568 |
|
| 1569 |
//#endregion |
| 1570 |
//#region modules/styleguide/assets/js/e-component.js |
| 1571 |
init_classCallCheck(); |
| 1572 |
init_createClass(); |
| 1573 |
init_possibleConstructorReturn(); |
| 1574 |
init_getPrototypeOf(); |
| 1575 |
init_inherits(); |
| 1576 |
function _callSuper$1(t, o, e) { |
| 1577 |
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$1() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); |
| 1578 |
} |
| 1579 |
__name(_callSuper$1, "_callSuper"); |
| 1580 |
function _isNativeReflectConstruct$1() { |
| 1581 |
try { |
| 1582 |
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); |
| 1583 |
} catch (t) {} |
| 1584 |
return (_isNativeReflectConstruct$1 = function _isNativeReflectConstruct() { |
| 1585 |
return !!t; |
| 1586 |
})(); |
| 1587 |
} |
| 1588 |
__name(_isNativeReflectConstruct$1, "_isNativeReflectConstruct"); |
| 1589 |
var _default = /*#__PURE__*/ function(_$e$modules$Component) { |
| 1590 |
function _default(args) { |
| 1591 |
var _this; |
| 1592 |
_classCallCheck(this, _default); |
| 1593 |
_this = _callSuper$1(this, _default, [args]); |
| 1594 |
elementor.addControlView("global-style-switcher", _default$1); |
| 1595 |
_this.registerStyleguideDialogType(); |
| 1596 |
elementor.once("preview:loaded", function() { |
| 1597 |
_this.initModal(); |
| 1598 |
}); |
| 1599 |
return _this; |
| 1600 |
} |
| 1601 |
_inherits(_default, _$e$modules$Component); |
| 1602 |
return _createClass(_default, [ |
| 1603 |
{ |
| 1604 |
key: "getNamespace", |
| 1605 |
value: function getNamespace() { |
| 1606 |
return "preview/styleguide"; |
| 1607 |
} |
| 1608 |
}, |
| 1609 |
{ |
| 1610 |
key: "defaultCommands", |
| 1611 |
value: function defaultCommands() { |
| 1612 |
return this.importCommands(commands_exports); |
| 1613 |
} |
| 1614 |
}, |
| 1615 |
{ |
| 1616 |
key: "registerStyleguideDialogType", |
| 1617 |
value: function registerStyleguideDialogType() { |
| 1618 |
DialogsManager.addWidgetType("styleguide", DialogsManager.getWidgetType("lightbox").extend("alert", { buildWidget: function buildWidget() { |
| 1619 |
DialogsManager.getWidgetType("lightbox").prototype.buildWidget.apply(this, arguments); |
| 1620 |
var $widgetContent = this.addElement("widgetContent"); |
| 1621 |
var elements = this.getElements(); |
| 1622 |
$widgetContent.append(elements.message); |
| 1623 |
elements.widget.html($widgetContent); |
| 1624 |
} })); |
| 1625 |
} |
| 1626 |
}, |
| 1627 |
{ |
| 1628 |
key: "initModal", |
| 1629 |
value: function initModal() { |
| 1630 |
var modal; |
| 1631 |
this.getModal = function() { |
| 1632 |
if (modal) return modal; |
| 1633 |
modal = elementorCommon.dialogsManager.createWidget("styleguide", { |
| 1634 |
id: "e-styleguide-preview-dialog", |
| 1635 |
message: "<div class=\"e-styleguide-preview-root\"></div>", |
| 1636 |
position: { |
| 1637 |
my: "center center", |
| 1638 |
at: "center center" |
| 1639 |
}, |
| 1640 |
hide: { |
| 1641 |
onOutsideClick: false, |
| 1642 |
onEscKeyPress: false, |
| 1643 |
onClick: false, |
| 1644 |
onBackgroundClick: false |
| 1645 |
}, |
| 1646 |
container: elementor.$previewContents.find("body") |
| 1647 |
}); |
| 1648 |
return modal; |
| 1649 |
}; |
| 1650 |
} |
| 1651 |
}, |
| 1652 |
{ |
| 1653 |
key: "showStyleguidePreview", |
| 1654 |
value: function showStyleguidePreview() { |
| 1655 |
var skipPreferencesCheck = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false; |
| 1656 |
if (this.getModal().isVisible() || !skipPreferencesCheck && !elementor.getPreferences("enable_styleguide_preview")) return; |
| 1657 |
this.getPreviewFrame().postMessage({ name: "elementor/styleguide/preview/show" }, "*"); |
| 1658 |
this.getModal().show(); |
| 1659 |
} |
| 1660 |
}, |
| 1661 |
{ |
| 1662 |
key: "hideStyleguidePreview", |
| 1663 |
value: function hideStyleguidePreview() { |
| 1664 |
this.getPreviewFrame().postMessage({ name: "elementor/styleguide/preview/hide" }, "*"); |
| 1665 |
this.getModal().hide(); |
| 1666 |
} |
| 1667 |
}, |
| 1668 |
{ |
| 1669 |
key: "enableStyleguidePreview", |
| 1670 |
value: function enableStyleguidePreview(options) { |
| 1671 |
if (options.value) this.showStyleguidePreview(true); |
| 1672 |
else this.hideStyleguidePreview(); |
| 1673 |
$e.run("document/elements/settings", { |
| 1674 |
container: elementor.settings.editorPreferences.getEditedView().getContainer(), |
| 1675 |
settings: { enable_styleguide_preview: options.value }, |
| 1676 |
options: { external: true } |
| 1677 |
}); |
| 1678 |
} |
| 1679 |
}, |
| 1680 |
{ |
| 1681 |
key: "isInEditor", |
| 1682 |
value: function isInEditor() { |
| 1683 |
return !!window.elementor; |
| 1684 |
} |
| 1685 |
}, |
| 1686 |
{ |
| 1687 |
key: "getPreviewFrame", |
| 1688 |
value: function getPreviewFrame() { |
| 1689 |
return this.isInEditor() ? elementor.$preview[0].contentWindow : window; |
| 1690 |
} |
| 1691 |
} |
| 1692 |
]); |
| 1693 |
}($e.modules.ComponentBase); |
| 1694 |
|
| 1695 |
//#endregion |
| 1696 |
//#region modules/styleguide/assets/js/styleguide.js |
| 1697 |
init_classCallCheck(); |
| 1698 |
init_createClass(); |
| 1699 |
init_possibleConstructorReturn(); |
| 1700 |
init_getPrototypeOf(); |
| 1701 |
init_inherits(); |
| 1702 |
function _callSuper(t, o, e) { |
| 1703 |
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); |
| 1704 |
} |
| 1705 |
function _isNativeReflectConstruct() { |
| 1706 |
try { |
| 1707 |
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); |
| 1708 |
} catch (t) {} |
| 1709 |
return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { |
| 1710 |
return !!t; |
| 1711 |
})(); |
| 1712 |
} |
| 1713 |
new (/* @__PURE__ */ function(_elementorModules$edi) { |
| 1714 |
function Styleguide() { |
| 1715 |
_classCallCheck(this, Styleguide); |
| 1716 |
return _callSuper(this, Styleguide, arguments); |
| 1717 |
} |
| 1718 |
_inherits(Styleguide, _elementorModules$edi); |
| 1719 |
return _createClass(Styleguide, [ |
| 1720 |
{ |
| 1721 |
key: "onInit", |
| 1722 |
value: function onInit() { |
| 1723 |
$e.components.register(new _default()); |
| 1724 |
this.addHooks(); |
| 1725 |
} |
| 1726 |
}, |
| 1727 |
{ |
| 1728 |
key: "getGlobalRoutes", |
| 1729 |
value: function getGlobalRoutes() { |
| 1730 |
return { |
| 1731 |
"global-colors": "panel/global/global-colors", |
| 1732 |
"global-typography": "panel/global/global-typography" |
| 1733 |
}; |
| 1734 |
} |
| 1735 |
}, |
| 1736 |
{ |
| 1737 |
key: "addHooks", |
| 1738 |
value: function addHooks() { |
| 1739 |
elementor.hooks.addAction("panel/global/tab/before-show", this.show.bind(this)); |
| 1740 |
elementor.hooks.addAction("panel/global/tab/before-destroy", this.hide.bind(this)); |
| 1741 |
} |
| 1742 |
}, |
| 1743 |
{ |
| 1744 |
key: "show", |
| 1745 |
value: function show(args) { |
| 1746 |
if (!args.id || !(args.id in this.getGlobalRoutes())) return; |
| 1747 |
$e.run("preview/styleguide/".concat(args.id)); |
| 1748 |
} |
| 1749 |
}, |
| 1750 |
{ |
| 1751 |
key: "hide", |
| 1752 |
value: function hide(args) { |
| 1753 |
if (!args.id || !(args.id in this.getGlobalRoutes())) return; |
| 1754 |
if (Object.values(this.getGlobalRoutes()).some(function(route) { |
| 1755 |
return $e.routes.current.panel === route; |
| 1756 |
})) return; |
| 1757 |
$e.run("preview/styleguide/hide"); |
| 1758 |
} |
| 1759 |
} |
| 1760 |
]); |
| 1761 |
}(elementorModules.editor.utils.Module))(); |
| 1762 |
|
| 1763 |
//#endregion |
| 1764 |
})(wp.i18n); |
| 1765 |
//# sourceMappingURL=styleguide.js.map |