diff --git a/datamodels/2.x/itop-portal-base/portal/templates/layout.html.twig b/datamodels/2.x/itop-portal-base/portal/templates/layout.html.twig index dcb60b903..6fa5351c3 100644 --- a/datamodels/2.x/itop-portal-base/portal/templates/layout.html.twig +++ b/datamodels/2.x/itop-portal-base/portal/templates/layout.html.twig @@ -162,6 +162,8 @@ {# User Preferences #} + {# Polyfill for custom elements #} + {# custom elements #} diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index cee073f7f..78077502a 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -22,6 +22,12 @@ "url": "https://opencollective.com/popperjs" } }, + "node_modules/@ungap/custom-elements": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@ungap/custom-elements/-/custom-elements-1.3.0.tgz", + "integrity": "sha512-f4q/s76+8nOy+fhrNHyetuoPDR01lmlZB5czfCG+OOnBw/Wf+x48DcCDPmMQY7oL8xYFL8qfenMoiS8DUkKBUw==", + "license": "ISC" + }, "node_modules/ace-builds": { "version": "1.32.7", "resolved": "https://registry.npmjs.org/ace-builds/-/ace-builds-1.32.7.tgz", diff --git a/node_modules/@ungap/custom-elements/LICENSE b/node_modules/@ungap/custom-elements/LICENSE new file mode 100644 index 000000000..fbb493110 --- /dev/null +++ b/node_modules/@ungap/custom-elements/LICENSE @@ -0,0 +1,15 @@ +ISC License + +Copyright (c) 2020, Andrea Giammarchi, @WebReflection + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@ungap/custom-elements/README.md b/node_modules/@ungap/custom-elements/README.md new file mode 100644 index 000000000..122705aa6 --- /dev/null +++ b/node_modules/@ungap/custom-elements/README.md @@ -0,0 +1,50 @@ +# Custom Elements Polyfill + +This module provides the [Custom Elements V1 API](https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-api) as defined by standards, including the ability to [extend builtin elements](https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-customized-builtin-example), all in ~2K _minified_ and _gzipped_ / _brotlied_. + + +## Compatibility + +The polyfill gracefully enhances the following minimum versions of at least these browsers, up to their latest version: + + * Chrome 38 + * Firefox 14 + * Opera 25 + * Internet Explorer 11 and Edge 12 + * Safari 8 and WebKit based + * Samsung Internet 3 + + +## How To + +Either install this module via `npm i @ungap/custom-elements`, and include it in your project, or use a CDN such as [unpkg.com](https://unpkg.com/@ungap/custom-elements) to obtain the _minified_ version of this module. + +```html + + +``` + +If targeted browsers are ES2015 compatible, the `es.js` file would provide the same polyfill, just lighter, as no transpilation is used. + +```html + +``` + + + +If installed as module, please remember to include it on top of your main JS file. + +```js +// ESM +import '@ungap/custom-elements'; + +// CJS +require('@ungap/custom-elements'); +``` + +The module will incrementally patch the global `window`/`self` reference, adding a `customElements` object that is compatible with the API. + + +## Source Code + +This module simply provides [@webreflection/custom-elements](https://github.com/WebReflection/custom-elements#readme) module under the [ungap](https://ungap.github.io/) umbrella. diff --git a/node_modules/@ungap/custom-elements/es.js b/node_modules/@ungap/custom-elements/es.js new file mode 100644 index 000000000..df2faeab0 --- /dev/null +++ b/node_modules/@ungap/custom-elements/es.js @@ -0,0 +1,2 @@ +!function(){"use strict";var e=(e,t)=>{const n=e=>{for(let t=0,{length:n}=e;t{e.attributeChangedCallback(t,n,e.getAttribute(t))};return(r,s)=>{const{observedAttributes:l}=r.constructor;return l&&e(s).then((()=>{new t(n).observe(r,{attributes:!0,attributeOldValue:!0,attributeFilter:l});for(let e=0,{length:t}=l;er in e,{filter:f}=[];var h=e=>{const h=new i,d=(t,n)=>{let o;if(n)for(let r,s=(e=>e.matches||e.webkitMatchesSelector||e.msMatchesSelector)(t),l=0,{length:c}=g;l{e.handle(t,n,o)})))},p=(e,t=!0)=>{for(let n=0,{length:o}=e;n{const c=(n,r,s,l,a,i)=>{for(const u of n)(i||o in u)&&(a?s.has(u)||(s.add(u),l.delete(u),e(u,a)):l.has(u)||(l.add(u),s.delete(u),e(u,a)),i||c(u[o](r),r,s,l,a,t))},a=new s((e=>{if(l.length){const o=l.join(","),r=new Set,s=new Set;for(const{addedNodes:l,removedNodes:a}of e)c(a,o,r,s,n,n),c(l,o,r,s,t,n)}})),{observe:i}=a;return(a.observe=e=>i.call(a,e,{subtree:t,childList:t}))(r),a})(d,m,c,g),{attachShadow:w}=l.prototype;return w&&(l.prototype.attachShadow=function(e){const t=w.call(this,e);return y.observe(t),t}),g.length&&p(m[r](g)),{drop:e=>{for(let t=0,{length:n}=e;t{const e=y.takeRecords();for(let t=0,{length:n}=e;t{const t=N(e),n=[],o=new y,{length:r}=t;for(let s=0;s{for(let s=0;s{const o=L.get(n);if(t&&!o.isPrototypeOf(e)){const t=D(e);R=C(e,o);try{new o.constructor}finally{R=null,t()}}const r=(t?"":"dis")+"connectedCallback";r in o&&e[r]()},{parse:_}=h({query:H,handle:I});let R=null;const V=e=>{if(!k.has(e)){let t,n=new Promise((e=>{t=e}));k.set(e,{$:n,_:t})}return k.get(e).$},j=e(V,g);function W(){const{constructor:e}=this;if(!$.has(e))throw new M("Illegal constructor");const t=$.get(e);if(R)return j(R,t);const n=P.call(d,t);return j(C(n,e.prototype),t)}self.customElements={define:(e,t)=>{if(x.has(e))throw new v(`the name "${e}" has already been used with this registry`);$.set(t,e),L.set(e,t.prototype),x.set(e,t),H.push(e),V(e).then((()=>{_(d.querySelectorAll(e))})),k.get(e)._(t)},get:e=>x.get(e),whenDefined:V},A(W.prototype=E.prototype,"constructor",{value:W}),self.HTMLElement=W,d.createElement=function(e,t){const n=t&&t.is,o=n?x.get(n):x.get(e);return o?new o:P.call(d,e)},"isConnected"in S.prototype||A(S.prototype,"isConnected",{configurable:!0,get(){return!(this.ownerDocument.compareDocumentPosition(this)&this.DOCUMENT_POSITION_DISCONNECTED)}})}else if(T=!self.customElements.get("extends-br"),T)try{function B(){return self.Reflect.construct(HTMLBRElement,[],B)}B.prototype=HTMLLIElement.prototype;const F="extends-br";self.customElements.define("extends-br",B,{extends:"br"}),T=d.createElement("br",{is:F}).outerHTML.indexOf(F)<0;const{get:U,whenDefined:z}=self.customElements;self.customElements.whenDefined=function(e){return z.call(this,e).then((t=>t||U.call(this,e)))}}catch(G){}if(T){const J=self.customElements,{createElement:K}=d,{define:Q,get:X,upgrade:Y}=J,{construct:Z}=O||{construct(e){return e.call(this)}},ee=new w,te=new y,ne=new p,oe=new p,re=new p,se=new p,le=[],ce=[],ae=e=>se.get(e)||X.call(J,e),ie=(e,t,n)=>{const o=re.get(n);if(t&&!o.isPrototypeOf(e)){const t=D(e);ge=C(e,o);try{new o.constructor}finally{ge=null,t()}}const r=(t?"":"dis")+"connectedCallback";r in o&&e[r]()},{parse:ue}=h({query:ce,handle:ie}),{parse:fe}=h({query:le,handle(e,t){ee.has(e)&&(t?te.add(e):te.delete(e),ce.length&&me.call(ce,e))}}),{attachShadow:he}=b.prototype;he&&(b.prototype.attachShadow=function(e){const t=he.call(this,e);return ee.set(this,t),t});const de=e=>{if(!oe.has(e)){let t,n=new Promise((e=>{t=e}));oe.set(e,{$:n,_:t})}return oe.get(e).$},pe=e(de,g);let ge=null;function me(e){const t=ee.get(e);ue(t.querySelectorAll(this),e.isConnected)}q(self).filter((e=>/^HTML.*Element$/.test(e))).forEach((e=>{const t=self[e];function n(){const{constructor:e}=this;if(!ne.has(e))throw new M("Illegal constructor");const{is:n,tag:o}=ne.get(e);if(n){if(ge)return pe(ge,n);const t=K.call(d,o);return t.setAttribute("is",n),pe(C(t,e.prototype),n)}return Z.call(this,t,[],e)}C(n,t),A(n.prototype=t.prototype,"constructor",{value:n}),A(self,e,{value:n})})),d.createElement=function(e,t){const n=t&&t.is;if(n){const t=se.get(n);if(t&&ne.get(t).tag===e)return new t}const o=K.call(d,e);return n&&o.setAttribute("is",n),o},J.get=ae,J.whenDefined=de,J.upgrade=function(e){const t=e.getAttribute("is");if(t){const n=se.get(t);if(n)return void pe(C(e,n.prototype),t)}Y.call(J,e)},J.define=function(e,t,n){if(ae(e))throw new v(`'${e}' has already been defined as a custom element`);let o;const r=n&&n.extends;ne.set(t,r?{is:e,tag:r}:{is:"",tag:e}),r?(o=`${r}[is="${e}"]`,re.set(o,t.prototype),se.set(e,t),ce.push(o)):(Q.apply(J,arguments),le.push(o=e)),de(e).then((()=>{r?(ue(d.querySelectorAll(o)),te.forEach(me,[o])):fe(d.querySelectorAll(o))})),oe.get(e)._(t)}}}(); diff --git a/node_modules/@ungap/custom-elements/index.js b/node_modules/@ungap/custom-elements/index.js new file mode 100644 index 000000000..6c11f49ce --- /dev/null +++ b/node_modules/@ungap/custom-elements/index.js @@ -0,0 +1,554 @@ +/*! (c) Andrea Giammarchi @webreflection ISC */ +(function () { + 'use strict'; + + var attributesObserver = (function (whenDefined, MutationObserver) { + var attributeChanged = function attributeChanged(records) { + for (var i = 0, length = records.length; i < length; i++) dispatch(records[i]); + }; + var dispatch = function dispatch(_ref) { + var target = _ref.target, + attributeName = _ref.attributeName, + oldValue = _ref.oldValue; + target.attributeChangedCallback(attributeName, oldValue, target.getAttribute(attributeName)); + }; + return function (target, is) { + var attributeFilter = target.constructor.observedAttributes; + if (attributeFilter) { + whenDefined(is).then(function () { + new MutationObserver(attributeChanged).observe(target, { + attributes: true, + attributeOldValue: true, + attributeFilter: attributeFilter + }); + for (var i = 0, length = attributeFilter.length; i < length; i++) { + if (target.hasAttribute(attributeFilter[i])) dispatch({ + target: target, + attributeName: attributeFilter[i], + oldValue: null + }); + } + }); + } + return target; + }; + }); + + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + return arr2; + } + function _createForOfIteratorHelper(o, allowArrayLike) { + var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; + if (!it) { + if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + var i = 0; + var F = function () {}; + return { + s: F, + n: function () { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[i++] + }; + }, + e: function (e) { + throw e; + }, + f: F + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + var normalCompletion = true, + didErr = false, + err; + return { + s: function () { + it = it.call(o); + }, + n: function () { + var step = it.next(); + normalCompletion = step.done; + return step; + }, + e: function (e) { + didErr = true; + err = e; + }, + f: function () { + try { + if (!normalCompletion && it.return != null) it.return(); + } finally { + if (didErr) throw err; + } + } + }; + } + + /*! (c) Andrea Giammarchi - ISC */ + var TRUE = true, + FALSE = false, + QSA$1 = 'querySelectorAll'; + + /** + * Start observing a generic document or root element. + * @param {(node:Element, connected:boolean) => void} callback triggered per each dis/connected element + * @param {Document|Element} [root=document] by default, the global document to observe + * @param {Function} [MO=MutationObserver] by default, the global MutationObserver + * @param {string[]} [query=['*']] the selectors to use within nodes + * @returns {MutationObserver} + */ + var notify = function notify(callback) { + var root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document; + var MO = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : MutationObserver; + var query = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ['*']; + var loop = function loop(nodes, selectors, added, removed, connected, pass) { + var _iterator = _createForOfIteratorHelper(nodes), + _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var node = _step.value; + if (pass || QSA$1 in node) { + if (connected) { + if (!added.has(node)) { + added.add(node); + removed["delete"](node); + callback(node, connected); + } + } else if (!removed.has(node)) { + removed.add(node); + added["delete"](node); + callback(node, connected); + } + if (!pass) loop(node[QSA$1](selectors), selectors, added, removed, connected, TRUE); + } + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + }; + var mo = new MO(function (records) { + if (query.length) { + var selectors = query.join(','); + var added = new Set(), + removed = new Set(); + var _iterator2 = _createForOfIteratorHelper(records), + _step2; + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { + var _step2$value = _step2.value, + addedNodes = _step2$value.addedNodes, + removedNodes = _step2$value.removedNodes; + loop(removedNodes, selectors, added, removed, FALSE, FALSE); + loop(addedNodes, selectors, added, removed, TRUE, FALSE); + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + } + }); + var observe = mo.observe; + (mo.observe = function (node) { + return observe.call(mo, node, { + subtree: TRUE, + childList: TRUE + }); + })(root); + return mo; + }; + + var QSA = 'querySelectorAll'; + var _self$1 = self, + document$2 = _self$1.document, + Element$1 = _self$1.Element, + MutationObserver$2 = _self$1.MutationObserver, + Set$2 = _self$1.Set, + WeakMap$1 = _self$1.WeakMap; + var elements = function elements(element) { + return QSA in element; + }; + var filter = [].filter; + var qsaObserver = (function (options) { + var live = new WeakMap$1(); + var drop = function drop(elements) { + for (var i = 0, length = elements.length; i < length; i++) live["delete"](elements[i]); + }; + var flush = function flush() { + var records = observer.takeRecords(); + for (var i = 0, length = records.length; i < length; i++) { + parse(filter.call(records[i].removedNodes, elements), false); + parse(filter.call(records[i].addedNodes, elements), true); + } + }; + var matches = function matches(element) { + return element.matches || element.webkitMatchesSelector || element.msMatchesSelector; + }; + var notifier = function notifier(element, connected) { + var selectors; + if (connected) { + for (var q, m = matches(element), i = 0, length = query.length; i < length; i++) { + if (m.call(element, q = query[i])) { + if (!live.has(element)) live.set(element, new Set$2()); + selectors = live.get(element); + if (!selectors.has(q)) { + selectors.add(q); + options.handle(element, connected, q); + } + } + } + } else if (live.has(element)) { + selectors = live.get(element); + live["delete"](element); + selectors.forEach(function (q) { + options.handle(element, connected, q); + }); + } + }; + var parse = function parse(elements) { + var connected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + for (var i = 0, length = elements.length; i < length; i++) notifier(elements[i], connected); + }; + var query = options.query; + var root = options.root || document$2; + var observer = notify(notifier, root, MutationObserver$2, query); + var attachShadow = Element$1.prototype.attachShadow; + if (attachShadow) Element$1.prototype.attachShadow = function (init) { + var shadowRoot = attachShadow.call(this, init); + observer.observe(shadowRoot); + return shadowRoot; + }; + if (query.length) parse(root[QSA](query)); + return { + drop: drop, + flush: flush, + observer: observer, + parse: parse + }; + }); + + var _self = self, + document$1 = _self.document, + Map = _self.Map, + MutationObserver$1 = _self.MutationObserver, + Object$1 = _self.Object, + Set$1 = _self.Set, + WeakMap = _self.WeakMap, + Element = _self.Element, + HTMLElement = _self.HTMLElement, + Node = _self.Node, + Error = _self.Error, + TypeError$1 = _self.TypeError, + Reflect = _self.Reflect; + var defineProperty = Object$1.defineProperty, + keys = Object$1.keys, + getOwnPropertyNames = Object$1.getOwnPropertyNames, + setPrototypeOf = Object$1.setPrototypeOf; + var legacy = !self.customElements; + var expando = function expando(element) { + var key = keys(element); + var value = []; + var ignore = new Set$1(); + var length = key.length; + for (var i = 0; i < length; i++) { + value[i] = element[key[i]]; + try { + delete element[key[i]]; + } catch (SafariTP) { + ignore.add(i); + } + } + return function () { + for (var _i = 0; _i < length; _i++) ignore.has(_i) || (element[key[_i]] = value[_i]); + }; + }; + if (legacy) { + var HTMLBuiltIn = function HTMLBuiltIn() { + var constructor = this.constructor; + if (!classes.has(constructor)) throw new TypeError$1('Illegal constructor'); + var is = classes.get(constructor); + if (override) return augment(override, is); + var element = createElement.call(document$1, is); + return augment(setPrototypeOf(element, constructor.prototype), is); + }; + var createElement = document$1.createElement; + var classes = new Map(); + var defined = new Map(); + var prototypes = new Map(); + var registry = new Map(); + var query = []; + var handle = function handle(element, connected, selector) { + var proto = prototypes.get(selector); + if (connected && !proto.isPrototypeOf(element)) { + var redefine = expando(element); + override = setPrototypeOf(element, proto); + try { + new proto.constructor(); + } finally { + override = null; + redefine(); + } + } + var method = "".concat(connected ? '' : 'dis', "connectedCallback"); + if (method in proto) element[method](); + }; + var _qsaObserver = qsaObserver({ + query: query, + handle: handle + }), + parse = _qsaObserver.parse; + var override = null; + var whenDefined = function whenDefined(name) { + if (!defined.has(name)) { + var _, + $ = new Promise(function ($) { + _ = $; + }); + defined.set(name, { + $: $, + _: _ + }); + } + return defined.get(name).$; + }; + var augment = attributesObserver(whenDefined, MutationObserver$1); + self.customElements = { + define: function define(is, Class) { + if (registry.has(is)) throw new Error("the name \"".concat(is, "\" has already been used with this registry")); + classes.set(Class, is); + prototypes.set(is, Class.prototype); + registry.set(is, Class); + query.push(is); + whenDefined(is).then(function () { + parse(document$1.querySelectorAll(is)); + }); + defined.get(is)._(Class); + }, + get: function get(is) { + return registry.get(is); + }, + whenDefined: whenDefined + }; + defineProperty(HTMLBuiltIn.prototype = HTMLElement.prototype, 'constructor', { + value: HTMLBuiltIn + }); + self.HTMLElement = HTMLBuiltIn; + document$1.createElement = function (name, options) { + var is = options && options.is; + var Class = is ? registry.get(is) : registry.get(name); + return Class ? new Class() : createElement.call(document$1, name); + }; + // in case ShadowDOM is used through a polyfill, to avoid issues + // with builtin extends within shadow roots + if (!('isConnected' in Node.prototype)) defineProperty(Node.prototype, 'isConnected', { + configurable: true, + get: function get() { + return !(this.ownerDocument.compareDocumentPosition(this) & this.DOCUMENT_POSITION_DISCONNECTED); + } + }); + } else { + legacy = !self.customElements.get('extends-br'); + if (legacy) { + try { + var BR = function BR() { + return self.Reflect.construct(HTMLBRElement, [], BR); + }; + BR.prototype = HTMLLIElement.prototype; + var is = 'extends-br'; + self.customElements.define('extends-br', BR, { + 'extends': 'br' + }); + legacy = document$1.createElement('br', { + is: is + }).outerHTML.indexOf(is) < 0; + var _self$customElements = self.customElements, + get = _self$customElements.get, + _whenDefined = _self$customElements.whenDefined; + self.customElements.whenDefined = function (is) { + var _this = this; + return _whenDefined.call(this, is).then(function (Class) { + return Class || get.call(_this, is); + }); + }; + } catch (o_O) {} + } + } + if (legacy) { + var _parseShadow = function _parseShadow(element) { + var root = shadowRoots.get(element); + _parse(root.querySelectorAll(this), element.isConnected); + }; + var customElements = self.customElements; + var _createElement = document$1.createElement; + var define = customElements.define, + _get = customElements.get, + upgrade = customElements.upgrade; + var _ref = Reflect || { + construct: function construct(HTMLElement) { + return HTMLElement.call(this); + } + }, + construct = _ref.construct; + var shadowRoots = new WeakMap(); + var shadows = new Set$1(); + var _classes = new Map(); + var _defined = new Map(); + var _prototypes = new Map(); + var _registry = new Map(); + var shadowed = []; + var _query = []; + var getCE = function getCE(is) { + return _registry.get(is) || _get.call(customElements, is); + }; + var _handle = function _handle(element, connected, selector) { + var proto = _prototypes.get(selector); + if (connected && !proto.isPrototypeOf(element)) { + var redefine = expando(element); + _override = setPrototypeOf(element, proto); + try { + new proto.constructor(); + } finally { + _override = null; + redefine(); + } + } + var method = "".concat(connected ? '' : 'dis', "connectedCallback"); + if (method in proto) element[method](); + }; + var _qsaObserver2 = qsaObserver({ + query: _query, + handle: _handle + }), + _parse = _qsaObserver2.parse; + var _qsaObserver3 = qsaObserver({ + query: shadowed, + handle: function handle(element, connected) { + if (shadowRoots.has(element)) { + if (connected) shadows.add(element);else shadows["delete"](element); + if (_query.length) _parseShadow.call(_query, element); + } + } + }), + parseShadowed = _qsaObserver3.parse; + // qsaObserver also patches attachShadow + // be sure this runs *after* that + var attachShadow = Element.prototype.attachShadow; + if (attachShadow) Element.prototype.attachShadow = function (init) { + var root = attachShadow.call(this, init); + shadowRoots.set(this, root); + return root; + }; + var _whenDefined2 = function _whenDefined2(name) { + if (!_defined.has(name)) { + var _, + $ = new Promise(function ($) { + _ = $; + }); + _defined.set(name, { + $: $, + _: _ + }); + } + return _defined.get(name).$; + }; + var _augment = attributesObserver(_whenDefined2, MutationObserver$1); + var _override = null; + getOwnPropertyNames(self).filter(function (k) { + return /^HTML.*Element$/.test(k); + }).forEach(function (k) { + var HTMLElement = self[k]; + function HTMLBuiltIn() { + var constructor = this.constructor; + if (!_classes.has(constructor)) throw new TypeError$1('Illegal constructor'); + var _classes$get = _classes.get(constructor), + is = _classes$get.is, + tag = _classes$get.tag; + if (is) { + if (_override) return _augment(_override, is); + var element = _createElement.call(document$1, tag); + element.setAttribute('is', is); + return _augment(setPrototypeOf(element, constructor.prototype), is); + } else return construct.call(this, HTMLElement, [], constructor); + } + + defineProperty(HTMLBuiltIn.prototype = HTMLElement.prototype, 'constructor', { + value: HTMLBuiltIn + }); + defineProperty(self, k, { + value: HTMLBuiltIn + }); + }); + document$1.createElement = function (name, options) { + var is = options && options.is; + if (is) { + var Class = _registry.get(is); + if (Class && _classes.get(Class).tag === name) return new Class(); + } + var element = _createElement.call(document$1, name); + if (is) element.setAttribute('is', is); + return element; + }; + customElements.get = getCE; + customElements.whenDefined = _whenDefined2; + customElements.upgrade = function (element) { + var is = element.getAttribute('is'); + if (is) { + var _constructor = _registry.get(is); + if (_constructor) { + _augment(setPrototypeOf(element, _constructor.prototype), is); + // apparently unnecessary because this is handled by qsa observer + // if (element.isConnected && element.connectedCallback) + // element.connectedCallback(); + return; + } + } + upgrade.call(customElements, element); + }; + customElements.define = function (is, Class, options) { + if (getCE(is)) throw new Error("'".concat(is, "' has already been defined as a custom element")); + var selector; + var tag = options && options["extends"]; + _classes.set(Class, tag ? { + is: is, + tag: tag + } : { + is: '', + tag: is + }); + if (tag) { + selector = "".concat(tag, "[is=\"").concat(is, "\"]"); + _prototypes.set(selector, Class.prototype); + _registry.set(is, Class); + _query.push(selector); + } else { + define.apply(customElements, arguments); + shadowed.push(selector = is); + } + _whenDefined2(is).then(function () { + if (tag) { + _parse(document$1.querySelectorAll(selector)); + shadows.forEach(_parseShadow, [selector]); + } else parseShadowed(document$1.querySelectorAll(selector)); + }); + _defined.get(is)._(Class); + }; + } + +})(); diff --git a/node_modules/@ungap/custom-elements/min.js b/node_modules/@ungap/custom-elements/min.js new file mode 100644 index 000000000..945bb7cb6 --- /dev/null +++ b/node_modules/@ungap/custom-elements/min.js @@ -0,0 +1,3 @@ +/*! (c) Andrea Giammarchi @webreflection ISC */ +!function(){"use strict";var e=function(e,t){var n=function(e){for(var t=0,n=e.length;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,i=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){c=!0,l=e},f:function(){try{i||null==r.return||r.return()}finally{if(c)throw l}}}} +/*! (c) Andrea Giammarchi - ISC */var r=!0,o=!1,a="querySelectorAll",l="querySelectorAll",i=self,c=i.document,u=i.Element,s=i.MutationObserver,f=i.Set,d=i.WeakMap,h=function(e){return l in e},v=[].filter,p=function(e){var t=new d,i=function(n,r){var o;if(r)for(var a,l=function(e){return e.matches||e.webkitMatchesSelector||e.msMatchesSelector}(n),i=0,c=y.length;i1&&void 0!==arguments[1])||arguments[1],n=0,r=e.length;n1&&void 0!==arguments[1]?arguments[1]:document,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:MutationObserver,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:["*"],c=function t(o,l,i,c,u,s){var f,d=n(o);try{for(d.s();!(f=d.n()).done;){var h=f.value;(s||a in h)&&(u?i.has(h)||(i.add(h),c.delete(h),e(h,u)):c.has(h)||(c.add(h),i.delete(h),e(h,u)),s||t(h[a](l),l,i,c,u,r))}}catch(e){d.e(e)}finally{d.f()}},u=new l((function(e){if(i.length){var t,a=i.join(","),l=new Set,u=new Set,s=n(e);try{for(s.s();!(t=s.n()).done;){var f=t.value,d=f.addedNodes,h=f.removedNodes;c(h,a,l,u,o,o),c(d,a,l,u,r,o)}}catch(e){s.e(e)}finally{s.f()}}})),s=u.observe;return(u.observe=function(e){return s.call(u,e,{subtree:r,childList:r})})(t),u}(i,g,s,y),w=u.prototype.attachShadow;return w&&(u.prototype.attachShadow=function(e){var t=w.call(this,e);return m.observe(t),t}),y.length&&p(g[l](y)),{drop:function(e){for(var n=0,r=e.length;n