@fluid-topics/ft-wc-utils 1.1.70 → 1.1.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,8 @@
1
- !function(){
2
- /**
1
+ "use strict";(()=>{if(!ShadowRoot.prototype.createElement){let m=window.HTMLElement,g=window.customElements.define,w=window.customElements.get,p=window.customElements,l=new WeakMap,h=new WeakMap,C=new WeakMap,k=new WeakMap;window.CustomElementRegistry=class{constructor(){this._definitionsByTag=new Map,this._definitionsByClass=new Map,this._whenDefinedPromises=new Map,this._awaitingUpgrade=new Map}define(e,t){if(e=e.toLowerCase(),this._getDefinition(e)!==void 0)throw new DOMException(`Failed to execute 'define' on 'CustomElementRegistry': the name "${e}" has already been used with this registry`);if(this._definitionsByClass.get(t)!==void 0)throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry");let o=t.prototype.attributeChangedCallback,i=new Set(t.observedAttributes||[]);O(t,i,o);let r={elementClass:t,connectedCallback:t.prototype.connectedCallback,disconnectedCallback:t.prototype.disconnectedCallback,adoptedCallback:t.prototype.adoptedCallback,attributeChangedCallback:o,formAssociated:t.formAssociated,formAssociatedCallback:t.prototype.formAssociatedCallback,formDisabledCallback:t.prototype.formDisabledCallback,formResetCallback:t.prototype.formResetCallback,formStateRestoreCallback:t.prototype.formStateRestoreCallback,observedAttributes:i};this._definitionsByTag.set(e,r),this._definitionsByClass.set(t,r);let d=w.call(p,e);d||(d=L(e),g.call(p,e,d)),this===window.customElements&&(C.set(t,r),r.standInClass=d);let c=this._awaitingUpgrade.get(e);if(c){this._awaitingUpgrade.delete(e);for(let s of c)h.delete(s),R(s,r,!0)}let n=this._whenDefinedPromises.get(e);return n!==void 0&&(n.resolve(t),this._whenDefinedPromises.delete(e)),t}upgrade(){f.push(this),p.upgrade.apply(p,arguments),f.pop()}get(e){return this._definitionsByTag.get(e)?.elementClass}_getDefinition(e){return this._definitionsByTag.get(e)}whenDefined(e){let t=this._getDefinition(e);if(t!==void 0)return Promise.resolve(t.elementClass);let o=this._whenDefinedPromises.get(e);return o===void 0&&(o={},o.promise=new Promise(i=>o.resolve=i),this._whenDefinedPromises.set(e,o)),o.promise}_upgradeWhenDefined(e,t,o){let i=this._awaitingUpgrade.get(t);i||this._awaitingUpgrade.set(t,i=new Set),o?i.add(e):i.delete(e)}};let y;window.HTMLElement=function(){let t=y;if(t)return y=void 0,t;let o=C.get(this.constructor);if(!o)throw new TypeError("Illegal constructor (custom element class must be registered with global customElements registry to be newable)");return t=Reflect.construct(m,[],o.standInClass),Object.setPrototypeOf(t,this.constructor.prototype),l.set(t,o),t},window.HTMLElement.prototype=m.prototype;let A=e=>e===document||e instanceof ShadowRoot,T=e=>{let t=e.getRootNode();if(!A(t)){let o=f[f.length-1];if(o instanceof CustomElementRegistry)return o;t=o.getRootNode(),A(t)||(t=k.get(t)?.getRootNode()||document)}return t.customElements},L=e=>class{static get formAssociated(){return!0}constructor(){let o=Reflect.construct(m,[],this.constructor);Object.setPrototypeOf(o,HTMLElement.prototype);let i=T(o)||window.customElements,r=i._getDefinition(e);return r?R(o,r):h.set(o,i),o}connectedCallback(){let o=l.get(this);o?o.connectedCallback&&o.connectedCallback.apply(this,arguments):h.get(this)._upgradeWhenDefined(this,e,!0)}disconnectedCallback(){let o=l.get(this);o?o.disconnectedCallback&&o.disconnectedCallback.apply(this,arguments):h.get(this)._upgradeWhenDefined(this,e,!1)}adoptedCallback(){l.get(this)?.adoptedCallback?.apply(this,arguments)}formAssociatedCallback(){let o=l.get(this);o&&o.formAssociated&&o?.formAssociatedCallback?.apply(this,arguments)}formDisabledCallback(){let o=l.get(this);o?.formAssociated&&o?.formDisabledCallback?.apply(this,arguments)}formResetCallback(){let o=l.get(this);o?.formAssociated&&o?.formResetCallback?.apply(this,arguments)}formStateRestoreCallback(){let o=l.get(this);o?.formAssociated&&o?.formStateRestoreCallback?.apply(this,arguments)}},O=(e,t,o)=>{if(t.size===0||o===void 0)return;let i=e.prototype.setAttribute;i&&(e.prototype.setAttribute=function(c,n){let s=c.toLowerCase();if(t.has(s)){let a=this.getAttribute(s);i.call(this,s,n),o.call(this,s,a,n)}else i.call(this,s,n)});let r=e.prototype.removeAttribute;r&&(e.prototype.removeAttribute=function(c){let n=c.toLowerCase();if(t.has(n)){let s=this.getAttribute(n);r.call(this,n),o.call(this,n,s,null)}else r.call(this,n)});let d=e.prototype.toggleAttribute;d&&(e.prototype.toggleAttribute=function(c,n){let s=c.toLowerCase();if(t.has(s)){let a=this.getAttribute(s);d.call(this,s,n);let u=this.getAttribute(s);o.call(this,s,a,u)}else d.call(this,s,n)})},M=e=>{let t=Object.getPrototypeOf(e);if(t!==window.HTMLElement)return t===m?Object.setPrototypeOf(e,window.HTMLElement):M(t)},R=(e,t,o=!1)=>{Object.setPrototypeOf(e,t.elementClass.prototype),l.set(e,t),y=e;try{new t.elementClass}catch{M(t.elementClass),new t.elementClass}t.attributeChangedCallback&&t.observedAttributes.forEach(i=>{e.hasAttribute(i)&&t.attributeChangedCallback.call(e,i,null,e.getAttribute(i))}),o&&t.connectedCallback&&e.isConnected&&t.connectedCallback.call(e)},S=Element.prototype.attachShadow;Element.prototype.attachShadow=function(e){let t=S.apply(this,arguments);return e.customElements&&(t.customElements=e.customElements),t};let f=[document],b=(e,t,o=void 0)=>{let i=(o?Object.getPrototypeOf(o):e.prototype)[t];e.prototype[t]=function(){f.push(this);let r=i.apply(o||this,arguments);return r!==void 0&&k.set(r,this),f.pop(),r}};b(ShadowRoot,"createElement",document),b(ShadowRoot,"importNode",document),b(Element,"insertAdjacentHTML");let _=(e,t)=>{let o=Object.getOwnPropertyDescriptor(e.prototype,t);Object.defineProperty(e.prototype,t,{...o,set(i){f.push(this),o.set.call(this,i),f.pop()}})};if(_(Element,"innerHTML"),_(ShadowRoot,"innerHTML"),Object.defineProperty(window,"customElements",{value:new CustomElementRegistry,configurable:!0,writable:!0}),window.ElementInternals&&window.ElementInternals.prototype.setFormValue){let e=new WeakMap,t=HTMLElement.prototype.attachInternals,o=["setFormValue","setValidity","checkValidity","reportValidity"];HTMLElement.prototype.attachInternals=function(...c){let n=t.call(this,...c);return e.set(n,this),n},o.forEach(c=>{let n=window.ElementInternals.prototype,s=n[c];n[c]=function(...a){let u=e.get(this);if(l.get(u).formAssociated===!0)return s?.call(this,...a);throw new DOMException(`Failed to execute ${s} on 'ElementInternals': The target element is not a form-associated custom element.`)}});class i extends Array{constructor(n){super(...n),this._elements=n}get value(){return this._elements.find(n=>n.checked===!0)?.value||""}}class r{constructor(n){let s=new Map;n.forEach((a,u)=>{let E=a.getAttribute("name"),D=s.get(E)||[];this[+u]=a,D.push(a),s.set(E,D)}),this.length=n.length,s.forEach((a,u)=>{a&&(a.length===1?this[u]=a[0]:this[u]=new i(a))})}namedItem(n){return this[n]}}let d=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");Object.defineProperty(HTMLFormElement.prototype,"elements",{get:function(){let c=d.get.call(this,[]),n=[];for(let s of c){let a=l.get(s);(!a||a.formAssociated===!0)&&n.push(s)}return new r(n)}})}}try{window.customElements.define("custom-element",null)}catch{let g=window.customElements.define;window.customElements.define=(w,p,l)=>{if(p!==null)try{g.bind(window.customElements)(w,p,l)}catch(h){console.info(w,p,l,h)}}}})();
2
+ /*! Bundled license information:
3
+
4
+ @webcomponents/scoped-custom-element-registry/src/scoped-custom-element-registry.js:
5
+ (**
3
6
  * @license
4
7
  * Copyright (c) 2020 The Polymer Project Authors. All rights reserved.
5
8
  * This code may only be used under the BSD style license found at
@@ -11,5 +14,5 @@
11
14
  * Code distributed by Google as part of the polymer project is also
12
15
  * subject to an additional IP rights grant found at
13
16
  * http://polymer.github.io/PATENTS.txt
14
- */
15
- if(!ShadowRoot.prototype.createElement){const t=window.HTMLElement,e=window.customElements.define,n=window.customElements.get,s=window.customElements,o=new WeakMap,i=new WeakMap,c=new WeakMap,r=new WeakMap;let a;window.CustomElementRegistry=class{constructor(){this._definitionsByTag=new Map,this._definitionsByClass=new Map,this._whenDefinedPromises=new Map,this._awaitingUpgrade=new Map}define(t,o){if(t=t.toLowerCase(),void 0!==this._getDefinition(t))throw new DOMException(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);if(void 0!==this._definitionsByClass.get(o))throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry");const r=o.prototype.attributeChangedCallback,a=new Set(o.observedAttributes||[]);w(o,a,r);const l={elementClass:o,connectedCallback:o.prototype.connectedCallback,disconnectedCallback:o.prototype.disconnectedCallback,adoptedCallback:o.prototype.adoptedCallback,attributeChangedCallback:r,formAssociated:o.formAssociated,formAssociatedCallback:o.prototype.formAssociatedCallback,formDisabledCallback:o.prototype.formDisabledCallback,formResetCallback:o.prototype.formResetCallback,formStateRestoreCallback:o.prototype.formStateRestoreCallback,observedAttributes:a};this._definitionsByTag.set(t,l),this._definitionsByClass.set(o,l);let h=n.call(s,t);h||(h=d(t),e.call(s,t,h)),this===window.customElements&&(c.set(o,l),l.standInClass=h);const u=this._awaitingUpgrade.get(t);if(u){this._awaitingUpgrade.delete(t);for(const t of u)i.delete(t),m(t,l,!0)}const f=this._whenDefinedPromises.get(t);return void 0!==f&&(f.resolve(o),this._whenDefinedPromises.delete(t)),o}upgrade(){b.push(this),s.upgrade.apply(s,arguments),b.pop()}get(t){const e=this._definitionsByTag.get(t);return e?.elementClass}_getDefinition(t){return this._definitionsByTag.get(t)}whenDefined(t){const e=this._getDefinition(t);if(void 0!==e)return Promise.resolve(e.elementClass);let n=this._whenDefinedPromises.get(t);return void 0===n&&(n={},n.promise=new Promise((t=>n.resolve=t)),this._whenDefinedPromises.set(t,n)),n.promise}_upgradeWhenDefined(t,e,n){let s=this._awaitingUpgrade.get(e);s||this._awaitingUpgrade.set(e,s=new Set),n?s.add(t):s.delete(t)}},window.HTMLElement=function(){let e=a;if(e)return a=void 0,e;const n=c.get(this.constructor);if(!n)throw new TypeError("Illegal constructor (custom element class must be registered with global customElements registry to be newable)");return e=Reflect.construct(t,[],n.standInClass),Object.setPrototypeOf(e,this.constructor.prototype),o.set(e,n),e},window.HTMLElement.prototype=t.prototype;const l=t=>t===document||t instanceof ShadowRoot,h=t=>{let e=t.getRootNode();if(!l(e)){const t=b[b.length-1];if(t instanceof CustomElementRegistry)return t;e=t.getRootNode(),l(e)||(e=r.get(e)?.getRootNode()||document)}return e.customElements},d=e=>class{static get formAssociated(){return!0}constructor(){const n=Reflect.construct(t,[],this.constructor);Object.setPrototypeOf(n,HTMLElement.prototype);const s=h(n)||window.customElements,o=s._getDefinition(e);return o?m(n,o):i.set(n,s),n}connectedCallback(){const t=o.get(this);t?t.connectedCallback&&t.connectedCallback.apply(this,arguments):i.get(this)._upgradeWhenDefined(this,e,!0)}disconnectedCallback(){const t=o.get(this);t?t.disconnectedCallback&&t.disconnectedCallback.apply(this,arguments):i.get(this)._upgradeWhenDefined(this,e,!1)}adoptedCallback(){const t=o.get(this);t?.adoptedCallback?.apply(this,arguments)}formAssociatedCallback(){const t=o.get(this);t&&t.formAssociated&&t?.formAssociatedCallback?.apply(this,arguments)}formDisabledCallback(){const t=o.get(this);t?.formAssociated&&t?.formDisabledCallback?.apply(this,arguments)}formResetCallback(){const t=o.get(this);t?.formAssociated&&t?.formResetCallback?.apply(this,arguments)}formStateRestoreCallback(){const t=o.get(this);t?.formAssociated&&t?.formStateRestoreCallback?.apply(this,arguments)}},w=(t,e,n)=>{if(0===e.size||void 0===n)return;const s=t.prototype.setAttribute;s&&(t.prototype.setAttribute=function(t,o){const i=t.toLowerCase();if(e.has(i)){const t=this.getAttribute(i);s.call(this,i,o),n.call(this,i,t,o)}else s.call(this,i,o)});const o=t.prototype.removeAttribute;o&&(t.prototype.removeAttribute=function(t){const s=t.toLowerCase();if(e.has(s)){const t=this.getAttribute(s);o.call(this,s),n.call(this,s,t,null)}else o.call(this,s)});const i=t.prototype.toggleAttribute;i&&(t.prototype.toggleAttribute=function(t,s){const o=t.toLowerCase();if(e.has(o)){const t=this.getAttribute(o);i.call(this,o,s);const e=this.getAttribute(o);n.call(this,o,t,e)}else i.call(this,o,s)})},u=e=>{const n=Object.getPrototypeOf(e);if(n!==window.HTMLElement)return n===t?Object.setPrototypeOf(e,window.HTMLElement):u(n)},m=(t,e,n=!1)=>{Object.setPrototypeOf(t,e.elementClass.prototype),o.set(t,e),a=t;try{new e.elementClass}catch(t){u(e.elementClass),new e.elementClass}e.attributeChangedCallback&&e.observedAttributes.forEach((n=>{t.hasAttribute(n)&&e.attributeChangedCallback.call(t,n,null,t.getAttribute(n))})),n&&e.connectedCallback&&t.isConnected&&e.connectedCallback.call(t)},f=Element.prototype.attachShadow;Element.prototype.attachShadow=function(t){const e=f.apply(this,arguments);return t.customElements&&(e.customElements=t.customElements),e};let b=[document];const k=(t,e,n=void 0)=>{const s=(n?Object.getPrototypeOf(n):t.prototype)[e];t.prototype[e]=function(){b.push(this);const t=s.apply(n||this,arguments);return void 0!==t&&r.set(t,this),b.pop(),t}};k(ShadowRoot,"createElement",document),k(ShadowRoot,"importNode",document),k(Element,"insertAdjacentHTML");const p=(t,e)=>{const n=Object.getOwnPropertyDescriptor(t.prototype,e);Object.defineProperty(t.prototype,e,{...n,set(t){b.push(this),n.set.call(this,t),b.pop()}})};if(p(Element,"innerHTML"),p(ShadowRoot,"innerHTML"),Object.defineProperty(window,"customElements",{value:new CustomElementRegistry,configurable:!0,writable:!0}),window.ElementInternals&&window.ElementInternals.prototype.setFormValue){const t=new WeakMap,e=HTMLElement.prototype.attachInternals,n=["setFormValue","setValidity","checkValidity","reportValidity"];HTMLElement.prototype.attachInternals=function(...n){const s=e.call(this,...n);return t.set(s,this),s},n.forEach((e=>{const n=window.ElementInternals.prototype,s=n[e];n[e]=function(...e){const n=t.get(this);if(!0===o.get(n).formAssociated)return s?.call(this,...e);throw new DOMException(`Failed to execute ${s} on 'ElementInternals': The target element is not a form-associated custom element.`)}}));class s extends Array{constructor(t){super(...t),this._elements=t}get value(){return this._elements.find((t=>!0===t.checked))?.value||""}}class i{constructor(t){const e=new Map;t.forEach(((t,n)=>{const s=t.getAttribute("name"),o=e.get(s)||[];this[+n]=t,o.push(t),e.set(s,o)})),this.length=t.length,e.forEach(((t,e)=>{t&&(1===t.length?this[e]=t[0]:this[e]=new s(t))}))}namedItem(t){return this[t]}}const c=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");Object.defineProperty(HTMLFormElement.prototype,"elements",{get:function(){const t=c.get.call(this,[]),e=[];for(const n of t){const t=o.get(n);t&&!0!==t.formAssociated||e.push(n)}return new i(e)}})}}try{window.customElements.define("custom-element",null)}catch(t){const e=window.customElements.define;window.customElements.define=(t,n,s)=>{if(null!==n)try{e.bind(window.customElements)(t,n,s)}catch(e){console.info(t,n,s,e)}}}}();
17
+ *)
18
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-wc-utils",
3
- "version": "1.1.70",
3
+ "version": "1.1.72",
4
4
  "description": "Internal web components tools",
5
5
  "author": "Fluid Topics <devtopics@antidot.net>",
6
6
  "license": "ISC",
@@ -23,5 +23,5 @@
23
23
  "lit": "3.1.0",
24
24
  "mark.js": "8.11.1"
25
25
  },
26
- "gitHead": "491d226f1e94018f6daf64b3831693326b1bd44e"
26
+ "gitHead": "ff0fbf52585dcdc0f2e96b82d1e8c289420d925e"
27
27
  }