[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/vendor/joomla-custom-elements/js/ -> joomla-alert-es5.min.js (source)

   1  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
   2  
   3  function t(e) {
   4    return (t = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (t) {
   5      return _typeof(t);
   6    } : function (t) {
   7      return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : _typeof(t);
   8    })(e);
   9  }
  10  
  11  function e(t, e) {
  12    var o = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
  13  
  14    if (!o) {
  15      if (Array.isArray(t) || (o = function (t, e) {
  16        if (!t) return;
  17        if ("string" == typeof t) return n(t, e);
  18        var o = Object.prototype.toString.call(t).slice(8, -1);
  19        "Object" === o && t.constructor && (o = t.constructor.name);
  20        if ("Map" === o || "Set" === o) return Array.from(t);
  21        if ("Arguments" === o || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)) return n(t, e);
  22      }(t)) || e && t && "number" == typeof t.length) {
  23        o && (t = o);
  24  
  25        var i = 0,
  26            r = function r() {};
  27  
  28        return {
  29          s: r,
  30          n: function n() {
  31            return i >= t.length ? {
  32              done: !0
  33            } : {
  34              done: !1,
  35              value: t[i++]
  36            };
  37          },
  38          e: function e(t) {
  39            throw t;
  40          },
  41          f: r
  42        };
  43      }
  44  
  45      throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  46    }
  47  
  48    var s,
  49        u = !0,
  50        a = !1;
  51    return {
  52      s: function s() {
  53        o = o.call(t);
  54      },
  55      n: function n() {
  56        var t = o.next();
  57        return u = t.done, t;
  58      },
  59      e: function e(t) {
  60        a = !0, s = t;
  61      },
  62      f: function f() {
  63        try {
  64          u || null == o["return"] || o["return"]();
  65        } finally {
  66          if (a) throw s;
  67        }
  68      }
  69    };
  70  }
  71  
  72  function n(t, e) {
  73    (null == e || e > t.length) && (e = t.length);
  74  
  75    for (var n = 0, o = new Array(e); n < e; n++) {
  76      o[n] = t[n];
  77    }
  78  
  79    return o;
  80  }
  81  
  82  function o(t, e) {
  83    for (var n = 0; n < e.length; n++) {
  84      var o = e[n];
  85      o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(t, o.key, o);
  86    }
  87  }
  88  
  89  function i(e, n) {
  90    return !n || "object" !== t(n) && "function" != typeof n ? r(e) : n;
  91  }
  92  
  93  function r(t) {
  94    if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  95    return t;
  96  }
  97  
  98  function s(t) {
  99    var e = "function" == typeof Map ? new Map() : void 0;
 100    return (s = function s(t) {
 101      if (null === t || (n = t, -1 === Function.toString.call(n).indexOf("[native code]"))) return t;
 102      var n;
 103      if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
 104  
 105      if (void 0 !== e) {
 106        if (e.has(t)) return e.get(t);
 107        e.set(t, o);
 108      }
 109  
 110      function o() {
 111        return u(t, arguments, c(this).constructor);
 112      }
 113  
 114      return o.prototype = Object.create(t.prototype, {
 115        constructor: {
 116          value: o,
 117          enumerable: !1,
 118          writable: !0,
 119          configurable: !0
 120        }
 121      }), l(o, t);
 122    })(t);
 123  }
 124  
 125  function u(t, e, n) {
 126    return (u = a() ? Reflect.construct : function (t, e, n) {
 127      var o = [null];
 128      o.push.apply(o, e);
 129      var i = new (Function.bind.apply(t, o))();
 130      return n && l(i, n.prototype), i;
 131    }).apply(null, arguments);
 132  }
 133  
 134  function a() {
 135    if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
 136    if (Reflect.construct.sham) return !1;
 137    if ("function" == typeof Proxy) return !0;
 138  
 139    try {
 140      return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})), !0;
 141    } catch (t) {
 142      return !1;
 143    }
 144  }
 145  
 146  function l(t, e) {
 147    return (l = Object.setPrototypeOf || function (t, e) {
 148      return t.__proto__ = e, t;
 149    })(t, e);
 150  }
 151  
 152  function c(t) {
 153    return (c = Object.setPrototypeOf ? Object.getPrototypeOf : function (t) {
 154      return t.__proto__ || Object.getPrototypeOf(t);
 155    })(t);
 156  }
 157  
 158  var f = function (t) {
 159    !function (t, e) {
 160      if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
 161      t.prototype = Object.create(e && e.prototype, {
 162        constructor: {
 163          value: t,
 164          writable: !0,
 165          configurable: !0
 166        }
 167      }), e && l(t, e);
 168    }(y, s(HTMLElement));
 169    var n,
 170        u,
 171        f,
 172        h,
 173        b,
 174        d = (n = y, u = a(), function () {
 175      var t,
 176          e = c(n);
 177  
 178      if (u) {
 179        var o = c(this).constructor;
 180        t = Reflect.construct(e, arguments, o);
 181      } else t = e.apply(this, arguments);
 182  
 183      return i(this, t);
 184    });
 185  
 186    function y() {
 187      var t;
 188      return function (t, e) {
 189        if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
 190      }(this, y), (t = d.call(this)).close = t.close.bind(r(t)), t.destroyCloseButton = t.destroyCloseButton.bind(r(t)), t.createCloseButton = t.createCloseButton.bind(r(t)), t.onMutation = t.onMutation.bind(r(t)), t.observer = new MutationObserver(t.onMutation), t.observer.observe(r(t), {
 191        attributes: !1,
 192        childList: !0,
 193        subtree: !0
 194      }), t.addEventListener("animationend", function (e) {
 195        "joomla-alert-fade-in" === e.animationName && e.target === r(t) && (t.dispatchEvent(new CustomEvent("joomla.alert.shown")), t.style.removeProperty("animationName"));
 196      }), t.addEventListener("animationend", function (e) {
 197        "joomla-alert-fade-out" === e.animationName && e.target === r(t) && (t.dispatchEvent(new CustomEvent("joomla.alert.closed")), t.remove());
 198      }), t;
 199    }
 200  
 201    return f = y, b = [{
 202      key: "observedAttributes",
 203      get: function get() {
 204        return ["type", "role", "dismiss", "auto-dismiss", "close-text"];
 205      }
 206    }], (h = [{
 207      key: "type",
 208      get: function get() {
 209        return this.getAttribute("type");
 210      },
 211      set: function set(t) {
 212        this.setAttribute("type", t);
 213      }
 214    }, {
 215      key: "role",
 216      get: function get() {
 217        return this.getAttribute("role");
 218      },
 219      set: function set(t) {
 220        this.setAttribute("role", t);
 221      }
 222    }, {
 223      key: "closeText",
 224      get: function get() {
 225        return this.getAttribute("close-text");
 226      },
 227      set: function set(t) {
 228        this.setAttribute("close-text", t);
 229      }
 230    }, {
 231      key: "dismiss",
 232      get: function get() {
 233        return this.getAttribute("dismiss");
 234      },
 235      set: function set(t) {
 236        this.setAttribute("dismiss", t);
 237      }
 238    }, {
 239      key: "autodismiss",
 240      get: function get() {
 241        return this.getAttribute("auto-dismiss");
 242      },
 243      set: function set(t) {
 244        this.setAttribute("auto-dismiss", t);
 245      }
 246    }, {
 247      key: "connectedCallback",
 248      value: function value() {
 249        this.dispatchEvent(new CustomEvent("joomla.alert.show")), this.style.animationName = "joomla-alert-fade-in", this.type && ["info", "warning", "danger", "success"].includes(this.type) || this.setAttribute("type", "info"), this.role && ["alert", "alertdialog"].includes(this.role) || this.setAttribute("role", "alert"), this.firstElementChild && "BUTTON" === this.firstElementChild.tagName && (this.button = this.firstElementChild, this.button.classList.contains("joomla-alert--close") && this.button.classList.add("joomla-alert--close"), "" === this.button.innerHTML && (this.button.innerHTML = '<span aria-hidden="true">&times;</span>'), this.button.hasAttribute("aria-label") || this.button.setAttribute("aria-label", this.closeText)), this.hasAttribute("dismiss") && !this.button && this.createCloseButton(), this.hasAttribute("auto-dismiss") && this.autoDismiss();
 250      }
 251    }, {
 252      key: "disconnectedCallback",
 253      value: function value() {
 254        this.button && this.button.removeEventListener("click", this.close), this.observer.disconnect();
 255      }
 256    }, {
 257      key: "attributeChangedCallback",
 258      value: function value(t, e, n) {
 259        switch (t) {
 260          case "type":
 261            (!n || n && -1 === ["info", "warning", "danger", "success"].indexOf(n)) && (this.type = "info");
 262            break;
 263  
 264          case "role":
 265            (!n || n && -1 === ["alert", "alertdialog"].indexOf(n)) && (this.role = "alert");
 266            break;
 267  
 268          case "dismiss":
 269            n && "" !== n || e && "" !== e ? this.button && "false" === n ? this.destroyCloseButton() : this.button || "false" === n || this.createCloseButton() : this.button && !this.hasAttribute("dismiss") ? this.destroyCloseButton() : !this.button && this.hasAttribute("dismiss") && this.createCloseButton();
 270            break;
 271  
 272          case "close-text":
 273            n && n === e || this.button && this.button.setAttribute("aria-label", n);
 274            break;
 275  
 276          case "auto-dismiss":
 277            this.autoDismiss();
 278        }
 279      }
 280    }, {
 281      key: "onMutation",
 282      value: function value(t) {
 283        var n,
 284            o = e(t);
 285  
 286        try {
 287          for (o.s(); !(n = o.n()).done;) {
 288            var i = n.value;
 289            "childList" === i.type && i.addedNodes.length && this.button && this.firstElementChild !== this.button && this.prepend(this.button);
 290          }
 291        } catch (t) {
 292          o.e(t);
 293        } finally {
 294          o.f();
 295        }
 296      }
 297    }, {
 298      key: "close",
 299      value: function value() {
 300        this.dispatchEvent(new CustomEvent("joomla.alert.close")), this.style.animationName = "joomla-alert-fade-out";
 301      }
 302    }, {
 303      key: "createCloseButton",
 304      value: function value() {
 305        this.button = document.createElement("button"), this.button.setAttribute("type", "button"), this.button.classList.add("joomla-alert--close"), this.button.innerHTML = '<span aria-hidden="true">&times;</span>', this.button.setAttribute("aria-label", this.closeText), this.insertAdjacentElement("afterbegin", this.button), this.button.addEventListener("click", this.close);
 306      }
 307    }, {
 308      key: "destroyCloseButton",
 309      value: function value() {
 310        this.button && (this.button.removeEventListener("click", this.close), this.button.parentNode.removeChild(this.button), this.button = null);
 311      }
 312    }, {
 313      key: "autoDismiss",
 314      value: function value() {
 315        var t = parseInt(this.getAttribute("auto-dismiss"), 10);
 316        setTimeout(this.close, t >= 10 ? t : 3e3);
 317      }
 318    }]) && o(f.prototype, h), b && o(f, b), y;
 319  }();
 320  
 321  customElements.get("joomla-alert") || customElements.define("joomla-alert", f);


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer