@zywave/customelement-manifest-element 1.2.0 → 1.3.0

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.
package/README.md CHANGED
@@ -1,6 +1,19 @@
1
1
  @zywave/customelement-manifest-element
2
2
 
3
- The `<customelement-manifest-element>` custom element is built to render a standards-compliant [custom element manifest](https://github.com/webcomponents/custom-elements-manifest/) in a user friendly way. This element is used in https://zui.zywave.com to render our own web component documentation.
3
+ The `<customelement-manifest-element>` custom element is built to render a standards-compliant [custom element manifest](https://github.com/webcomponents/custom-elements-manifest/) in a user friendly way. This element is used in [https://booster.zywave.dev](https://booster.zywave.dev) to render our own web component documentation.
4
+
5
+ ## Setup
6
+ Three different ways to consume customelement-manifest-element:
7
+ 1. **Package dependency**
8
+ - Typical package.json dependency `yarn add @zywave/customelement-manifest-element` or `npm i @zywave/customelement-manifest-element`
9
+
10
+ 1. **Complete bundled javascript module**
11
+ - `<script type="module" src="https://cdn.zywave.com/@zywave/customelement-manifest-element@latest/index.bundle.js"></script>`
12
+ - This bundled module is plug and play ready, customelement-manifest-element and all dependencies are included.
13
+
14
+ 1. **Lean javascript module**
15
+ - `<script type="module" src="https://cdn.zywave.com/@zywave/customelement-manifest-element@latest/index.js"></script>`
16
+ - This lean module version, similar to #2 but with some assembly required, not all customelement-manifest-element dependencies are included. Consider bundling the dependencies yourself (e.g. webpack, rollup), or using importmaps (note: bleeding edge, not supported in all modern browsers) to resolve bare module dependencies.
4
17
 
5
18
  ## Example
6
19
 
@@ -8,6 +21,7 @@ The `<customelement-manifest-element>` custom element is built to render a stand
8
21
  <customelement-manifest-element src="./custom-elements.json"></customelement-manifest-element>
9
22
  ```
10
23
 
24
+
11
25
  ## API
12
26
  Read the [api docs](./docs/api.md) for more information.
13
27
 
@@ -0,0 +1,109 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation.
3
+
4
+ Permission to use, copy, modify, and/or distribute this software for any
5
+ purpose with or without fee is hereby granted.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
+ PERFORMANCE OF THIS SOFTWARE.
14
+ ***************************************************************************** */
15
+ function e(e,t,i,n){var s,r=arguments.length,o=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,i,o):s(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o
16
+ /**
17
+ * @license
18
+ * Copyright 2019 Google LLC
19
+ * SPDX-License-Identifier: BSD-3-Clause
20
+ */}const t=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),n=new Map;class s{constructor(e,t){if(this._$cssResult$=!0,t!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){let e=n.get(this.cssText);return t&&void 0===e&&(n.set(this.cssText,e=new CSSStyleSheet),e.replaceSync(this.cssText)),e}toString(){return this.cssText}}const r=t?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new s("string"==typeof e?e:e+"",i))(t)})(e):e
21
+ /**
22
+ * @license
23
+ * Copyright 2017 Google LLC
24
+ * SPDX-License-Identifier: BSD-3-Clause
25
+ */;var o;const a=window.trustedTypes,l=a?a.emptyScript:"",c=window.reactiveElementPolyfillSupport,h={toAttribute(e,t){switch(t){case Boolean:e=e?l:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},d=(e,t)=>t!==e&&(t==t||e==e),p={attribute:!0,type:String,converter:h,reflect:!1,hasChanged:d};class u extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(e){var t;null!==(t=this.l)&&void 0!==t||(this.l=[]),this.l.push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,i)=>{const n=this._$Eh(i,t);void 0!==n&&(this._$Eu.set(n,i),e.push(n))})),e}static createProperty(e,t=p){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const i="symbol"==typeof e?Symbol():"__"+e,n=this.getPropertyDescriptor(e,i,t);void 0!==n&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(n){const s=this[e];this[t]=n,this.requestUpdate(e,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||p}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),this.elementProperties=new Map(e.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const i of t)this.createProperty(i,e[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(r(e))}else void 0!==e&&t.push(r(e));return t}static _$Eh(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}o(){var e;this._$Ep=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Em(),this.requestUpdate(),null===(e=this.constructor.l)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,i;(null!==(t=this._$Eg)&&void 0!==t?t:this._$Eg=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(i=e.hostConnected)||void 0===i||i.call(e))}removeController(e){var t;null===(t=this._$Eg)||void 0===t||t.splice(this._$Eg.indexOf(e)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Et.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const i=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,i)=>{t?e.adoptedStyleSheets=i.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):i.forEach((t=>{const i=document.createElement("style"),n=window.litNonce;void 0!==n&&i.setAttribute("nonce",n),i.textContent=t.cssText,e.appendChild(i)}))})(i,this.constructor.elementStyles),i}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$Eg)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$Eg)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ES(e,t,i=p){var n,s;const r=this.constructor._$Eh(e,i);if(void 0!==r&&!0===i.reflect){const o=(null!==(s=null===(n=i.converter)||void 0===n?void 0:n.toAttribute)&&void 0!==s?s:h.toAttribute)(t,i.type);this._$Ei=e,null==o?this.removeAttribute(r):this.setAttribute(r,o),this._$Ei=null}}_$AK(e,t){var i,n,s;const r=this.constructor,o=r._$Eu.get(e);if(void 0!==o&&this._$Ei!==o){const e=r.getPropertyOptions(o),a=e.converter,l=null!==(s=null!==(n=null===(i=a)||void 0===i?void 0:i.fromAttribute)&&void 0!==n?n:"function"==typeof a?a:null)&&void 0!==s?s:h.fromAttribute;this._$Ei=o,this[o]=l(t,e.type),this._$Ei=null}}requestUpdate(e,t,i){let n=!0;void 0!==e&&(((i=i||this.constructor.getPropertyOptions(e)).hasChanged||d)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===i.reflect&&this._$Ei!==e&&(void 0===this._$E_&&(this._$E_=new Map),this._$E_.set(e,i))):n=!1),!this.isUpdatePending&&n&&(this._$Ep=this._$EC())}async _$EC(){this.isUpdatePending=!0;try{await this._$Ep}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Et&&(this._$Et.forEach(((e,t)=>this[t]=e)),this._$Et=void 0);let t=!1;const i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),null===(e=this._$Eg)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(i)):this._$EU()}catch(e){throw t=!1,this._$EU(),e}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;null===(t=this._$Eg)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Ep}shouldUpdate(e){return!0}update(e){void 0!==this._$E_&&(this._$E_.forEach(((e,t)=>this._$ES(t,this[t],e))),this._$E_=void 0),this._$EU()}updated(e){}firstUpdated(e){}}
26
+ /**
27
+ * @license
28
+ * Copyright 2017 Google LLC
29
+ * SPDX-License-Identifier: BSD-3-Clause
30
+ */
31
+ var m;u.finalized=!0,u.elementProperties=new Map,u.elementStyles=[],u.shadowRootOptions={mode:"open"},null==c||c({ReactiveElement:u}),(null!==(o=globalThis.reactiveElementVersions)&&void 0!==o?o:globalThis.reactiveElementVersions=[]).push("1.1.0");const v=globalThis.trustedTypes,$=v?v.createPolicy("lit-html",{createHTML:e=>e}):void 0,y=`lit$${(Math.random()+"").slice(9)}$`,f="?"+y,g=`<${f}>`,_=document,b=(e="")=>_.createComment(e),A=e=>null===e||"object"!=typeof e&&"function"!=typeof e,E=Array.isArray,S=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,w=/-->/g,C=/>/g,x=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,P=/'/g,H=/"/g,N=/^(?:script|style|textarea)$/i,L=(e=>(t,...i)=>({_$litType$:e,strings:t,values:i}))(1),U=Symbol.for("lit-noChange"),k=Symbol.for("lit-nothing"),T=new WeakMap,M=_.createTreeWalker(_,129,null,!1),O=(e,t)=>{const i=e.length-1,n=[];let s,r=2===t?"<svg>":"",o=S;for(let t=0;t<i;t++){const i=e[t];let a,l,c=-1,h=0;for(;h<i.length&&(o.lastIndex=h,l=o.exec(i),null!==l);)h=o.lastIndex,o===S?"!--"===l[1]?o=w:void 0!==l[1]?o=C:void 0!==l[2]?(N.test(l[2])&&(s=RegExp("</"+l[2],"g")),o=x):void 0!==l[3]&&(o=x):o===x?">"===l[0]?(o=null!=s?s:S,c=-1):void 0===l[1]?c=-2:(c=o.lastIndex-l[2].length,a=l[1],o=void 0===l[3]?x:'"'===l[3]?H:P):o===H||o===P?o=x:o===w||o===C?o=S:(o=x,s=void 0);const d=o===x&&e[t+1].startsWith("/>")?" ":"";r+=o===S?i+g:c>=0?(n.push(a),i.slice(0,c)+"$lit$"+i.slice(c)+y+d):i+y+(-2===c?(n.push(void 0),t):d)}const a=r+(e[i]||"<?>")+(2===t?"</svg>":"");if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==$?$.createHTML(a):a,n]};class R{constructor({strings:e,_$litType$:t},i){let n;this.parts=[];let s=0,r=0;const o=e.length-1,a=this.parts,[l,c]=O(e,t);if(this.el=R.createElement(l,i),M.currentNode=this.el.content,2===t){const e=this.el.content,t=e.firstChild;t.remove(),e.append(...t.childNodes)}for(;null!==(n=M.nextNode())&&a.length<o;){if(1===n.nodeType){if(n.hasAttributes()){const e=[];for(const t of n.getAttributeNames())if(t.endsWith("$lit$")||t.startsWith(y)){const i=c[r++];if(e.push(t),void 0!==i){const e=n.getAttribute(i.toLowerCase()+"$lit$").split(y),t=/([.?@])?(.*)/.exec(i);a.push({type:1,index:s,name:t[2],strings:e,ctor:"."===t[1]?B:"?"===t[1]?W:"@"===t[1]?q:I})}else a.push({type:6,index:s})}for(const t of e)n.removeAttribute(t)}if(N.test(n.tagName)){const e=n.textContent.split(y),t=e.length-1;if(t>0){n.textContent=v?v.emptyScript:"";for(let i=0;i<t;i++)n.append(e[i],b()),M.nextNode(),a.push({type:2,index:++s});n.append(e[t],b())}}}else if(8===n.nodeType)if(n.data===f)a.push({type:2,index:s});else{let e=-1;for(;-1!==(e=n.data.indexOf(y,e+1));)a.push({type:7,index:s}),e+=y.length-1}s++}}static createElement(e,t){const i=_.createElement("template");return i.innerHTML=e,i}}function D(e,t,i=e,n){var s,r,o,a;if(t===U)return t;let l=void 0!==n?null===(s=i._$Cl)||void 0===s?void 0:s[n]:i._$Cu;const c=A(t)?void 0:t._$litDirective$;return(null==l?void 0:l.constructor)!==c&&(null===(r=null==l?void 0:l._$AO)||void 0===r||r.call(l,!1),void 0===c?l=void 0:(l=new c(e),l._$AT(e,i,n)),void 0!==n?(null!==(o=(a=i)._$Cl)&&void 0!==o?o:a._$Cl=[])[n]=l:i._$Cu=l),void 0!==l&&(t=D(e,l._$AS(e,t.values),l,n)),t}class z{constructor(e,t){this.v=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(e){var t;const{el:{content:i},parts:n}=this._$AD,s=(null!==(t=null==e?void 0:e.creationScope)&&void 0!==t?t:_).importNode(i,!0);M.currentNode=s;let r=M.nextNode(),o=0,a=0,l=n[0];for(;void 0!==l;){if(o===l.index){let t;2===l.type?t=new j(r,r.nextSibling,this,e):1===l.type?t=new l.ctor(r,l.name,l.strings,this,e):6===l.type&&(t=new K(r,this,e)),this.v.push(t),l=n[++a]}o!==(null==l?void 0:l.index)&&(r=M.nextNode(),o++)}return s}m(e){let t=0;for(const i of this.v)void 0!==i&&(void 0!==i.strings?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class j{constructor(e,t,i,n){var s;this.type=2,this._$AH=k,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=n,this._$Cg=null===(s=null==n?void 0:n.isConnected)||void 0===s||s}get _$AU(){var e,t;return null!==(t=null===(e=this._$AM)||void 0===e?void 0:e._$AU)&&void 0!==t?t:this._$Cg}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=D(this,e,t),A(e)?e===k||null==e||""===e?(this._$AH!==k&&this._$AR(),this._$AH=k):e!==this._$AH&&e!==U&&this.$(e):void 0!==e._$litType$?this.T(e):void 0!==e.nodeType?this.S(e):(e=>{var t;return E(e)||"function"==typeof(null===(t=e)||void 0===t?void 0:t[Symbol.iterator])})(e)?this.A(e):this.$(e)}M(e,t=this._$AB){return this._$AA.parentNode.insertBefore(e,t)}S(e){this._$AH!==e&&(this._$AR(),this._$AH=this.M(e))}$(e){this._$AH!==k&&A(this._$AH)?this._$AA.nextSibling.data=e:this.S(_.createTextNode(e)),this._$AH=e}T(e){var t;const{values:i,_$litType$:n}=e,s="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=R.createElement(n.h,this.options)),n);if((null===(t=this._$AH)||void 0===t?void 0:t._$AD)===s)this._$AH.m(i);else{const e=new z(s,this),t=e.p(this.options);e.m(i),this.S(t),this._$AH=e}}_$AC(e){let t=T.get(e.strings);return void 0===t&&T.set(e.strings,t=new R(e)),t}A(e){E(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,n=0;for(const s of e)n===t.length?t.push(i=new j(this.M(b()),this.M(b()),this,this.options)):i=t[n],i._$AI(s),n++;n<t.length&&(this._$AR(i&&i._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,t);e&&e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){var t;void 0===this._$AM&&(this._$Cg=e,null===(t=this._$AP)||void 0===t||t.call(this,e))}}class I{constructor(e,t,i,n,s){this.type=1,this._$AH=k,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=s,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=k}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,i,n){const s=this.strings;let r=!1;if(void 0===s)e=D(this,e,t,0),r=!A(e)||e!==this._$AH&&e!==U,r&&(this._$AH=e);else{const n=e;let o,a;for(e=s[0],o=0;o<s.length-1;o++)a=D(this,n[i+o],t,o),a===U&&(a=this._$AH[o]),r||(r=!A(a)||a!==this._$AH[o]),a===k?e=k:e!==k&&(e+=(null!=a?a:"")+s[o+1]),this._$AH[o]=a}r&&!n&&this.k(e)}k(e){e===k?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=e?e:"")}}class B extends I{constructor(){super(...arguments),this.type=3}k(e){this.element[this.name]=e===k?void 0:e}}const V=v?v.emptyScript:"";class W extends I{constructor(){super(...arguments),this.type=4}k(e){e&&e!==k?this.element.setAttribute(this.name,V):this.element.removeAttribute(this.name)}}class q extends I{constructor(e,t,i,n,s){super(e,t,i,n,s),this.type=5}_$AI(e,t=this){var i;if((e=null!==(i=D(this,e,t,0))&&void 0!==i?i:k)===U)return;const n=this._$AH,s=e===k&&n!==k||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,r=e!==k&&(n===k||s);s&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(t=this.options)||void 0===t?void 0:t.host)&&void 0!==i?i:this.element,e):this._$AH.handleEvent(e)}}class K{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){D(this,e)}}const J=window.litHtmlPolyfillSupport;
32
+ /**
33
+ * @license
34
+ * Copyright 2017 Google LLC
35
+ * SPDX-License-Identifier: BSD-3-Clause
36
+ */
37
+ var Z,F;null==J||J(R,j),(null!==(m=globalThis.litHtmlVersions)&&void 0!==m?m:globalThis.litHtmlVersions=[]).push("2.1.0");class G extends u{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var e,t;const i=super.createRenderRoot();return null!==(e=(t=this.renderOptions).renderBefore)&&void 0!==e||(t.renderBefore=i.firstChild),i}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Dt=((e,t,i)=>{var n,s;const r=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:t;let o=r._$litPart$;if(void 0===o){const e=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:null;r._$litPart$=o=new j(t.insertBefore(b(),e),e,void 0,null!=i?i:{})}return o._$AI(e),o})(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),null===(e=this._$Dt)||void 0===e||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._$Dt)||void 0===e||e.setConnected(!1)}render(){return U}}G.finalized=!0,G._$litElement$=!0,null===(Z=globalThis.litElementHydrateSupport)||void 0===Z||Z.call(globalThis,{LitElement:G});const Q=globalThis.litElementPolyfillSupport;null==Q||Q({LitElement:G}),(null!==(F=globalThis.litElementVersions)&&void 0!==F?F:globalThis.litElementVersions=[]).push("3.1.0");
38
+ /**
39
+ * @license
40
+ * Copyright 2017 Google LLC
41
+ * SPDX-License-Identifier: BSD-3-Clause
42
+ */
43
+ const X=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(i){i.createProperty(t.key,e)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(i){i.createProperty(t.key,e)}};
44
+ /**
45
+ * @license
46
+ * Copyright 2017 Google LLC
47
+ * SPDX-License-Identifier: BSD-3-Clause
48
+ */function Y(e){return(t,i)=>void 0!==i?((e,t,i)=>{t.constructor.createProperty(i,e)})(e,t,i):X(e,t)}const ee=new CSSStyleSheet;ee.replaceSync("/**\n* https://una.im/css-color-theming/\n* A day may come when we can do this with built-in adjust color CSS functions...\n* but it is not this day!\n**/\n:host {\n --schema-shade-percentage: 10%;\n --schema-primary-color-h: 204;\n --schema-primary-color-s: 28%;\n --schema-primary-color-l: 27%;\n --schema-primary-color: hsl(var(--schema-primary-color-h), var(--schema-primary-color-s), var(--schema-primary-color-l));\n --schema-primary-color-light: hsl(var(--schema-primary-color-h), var(--schema-primary-color-s), calc(var(--schema-primary-color-l) + var(--schema-shade-percentage)));\n --schema-primary-color-dark: hsl(var(--schema-primary-color-h), var(--schema-primary-color-s), calc(var(--schema-primary-color-l) - var(--schema-shade-percentage)));\n --schema-accent-color-h: 167;\n --schema-accent-color-s: 74%;\n --schema-accent-color-l: 34%;\n --schema-accent-color: hsl(var(--schema-accent-color-h), var(--schema-accent-color-s), var(--schema-accent-color-l));\n --schema-accent-color-light: hsl(var(--schema-accent-color-h), var(--schema-accent-color-s), calc(var(--schema-accent-color-l) + var(--schema-shade-percentage)));\n --schema-accent-color-dark: hsl(var(--schema-accent-color-h), var(--schema-accent-color-s), calc(var(--schema-accent-color-l) - var(--schema-shade-percentage)));\n color: var(--schema-primary-color);\n}\n\nsection + section {\n margin-top: 2.5rem;\n}\n\nh1 {\n font-size: 2em;\n}\n\nh2 {\n margin-bottom: 0;\n}\n\n.header-row {\n display: flex;\n}\n.header-row select {\n margin-left: auto;\n align-self: center;\n}\n\ntable {\n width: 100%;\n}\ntable span {\n display: inline-block;\n}\ntable thead th,\ntable tbody td {\n padding: 0.9375rem;\n}\ntable thead th:first-child,\ntable tbody td:first-child {\n padding-left: 0;\n}\ntable thead th:last-child,\ntable tbody td:last-child {\n padding-right: 0;\n}\ntable thead th {\n font-weight: normal;\n text-align: left;\n border-bottom: 1px solid var(--schema-primary-color);\n}\ntable tbody tr:only-child > td,\ntable tbody tr:last-child > td {\n border-bottom: 0;\n}\ntable tbody td {\n vertical-align: top;\n padding: 0.9375rem;\n border-bottom: 1px solid hsla(var(--schema-primary-color-h), var(--schema-primary-color-s), var(--schema-primary-color-l), 0.1);\n}\ntable tbody td:first-child {\n padding-left: 0;\n}\ntable tbody td:last-child {\n padding-right: 0;\n}\ntable tbody td.name, table tbody td.type, table tbody td.default {\n width: 16.667%;\n}\ntable tbody td.name span, table tbody td.type span, table tbody td.default span {\n padding: 0.3125rem 0.625rem;\n}\ntable tbody td.name span, table tbody td.type span, table tbody td.signature span {\n font-family: monospace;\n background-color: hsla(var(--schema-primary-color-h), var(--schema-primary-color-s), var(--schema-primary-color-l), 0.1);\n color: var(--schema-primary-color);\n}\ntable tbody td.signature span {\n padding: 0.3125rem 0.625rem;\n}\ntable tbody td.signature .expanded-details {\n margin-left: 1.5625rem;\n}\ntable tbody td.signature .param-container {\n margin-top: 0.3125rem;\n}\ntable tbody td.signature .param-description {\n margin-left: 0.9375rem;\n}\ntable tbody td.summary {\n width: 50%;\n}\ntable tbody td.default span {\n font-family: monospace;\n background-color: hsla(var(--schema-accent-color-h), var(--schema-accent-color-s), var(--schema-accent-color-l), 0.1);\n color: var(--schema-accent-color);\n}\n\na {\n vertical-align: baseline;\n margin: 0;\n padding: 0;\n font-weight: 400;\n cursor: pointer;\n color: var(--schema-accent-color);\n text-decoration: underline;\n}\na:hover {\n color: var(--schema-accent-color-light);\n}\na:focus {\n outline: 1px solid var(--schema-accent-color);\n outline-offset: 0.25rem;\n text-decoration: none;\n}\na:active {\n outline: none;\n color: var(---schema-accent-color-dark);\n text-decoration: underline;\n}\n\ncode {\n font-family: monospace;\n}\n\nselect {\n display: inline-block;\n height: 2.25rem;\n padding: 0 1em;\n padding-right: 2.1875rem;\n border: 1px solid #cbcbd2;\n border-radius: 0.25rem;\n outline: none;\n font: inherit;\n cursor: pointer;\n color: inherit;\n transition: border 100ms ease-in-out, box-shadow 100ms ease-in-out;\n}\nselect option {\n padding: 0.5em 0;\n color: #31313a;\n}\nselect:hover {\n border-color: #afafbb;\n}\nselect:focus {\n border-color: var(--schema-accent-color);\n box-shadow: 0 0 0 1px var(--schema-accent-color);\n}\n\n/*# sourceMappingURL=customelement-manifest-element.css.map */\n");
49
+ /**
50
+ * @license
51
+ * Copyright 2020 Google LLC
52
+ * SPDX-License-Identifier: BSD-3-Clause
53
+ */
54
+ const te=new Map,ie=(e=>(t,...i)=>{var n;const s=i.length;let r,o;const a=[],l=[];let c,h=0,d=!1;for(;h<s;){for(c=t[h];h<s&&void 0!==(o=i[h],r=null===(n=o)||void 0===n?void 0:n._$litStatic$);)c+=r+t[++h],d=!0;l.push(o),a.push(c),h++}if(h===s&&a.push(t[s]),d){const e=a.join("$$lit$$");void 0===(t=te.get(e))&&(a.raw=a,te.set(e,t=a)),i=l}return e(t,...i)})(L);function ne(e){return e.modules.flatMap((e=>e.exports)).filter((e=>"custom-element-definition"===e?.kind))}function se(e){return!(e.privacy&&"public"!==e.privacy||e.name.startsWith("_")||e.name.startsWith("#"))}function re(e){return(e=>({_$litStatic$:e}))(`h${e}`)}function oe(e,t){const i=e.map((e=>{let i=ie``;for(const n of t){const t=`${n.type}`,s=n.valueAccessor(e);i=ie`${i}${ie`<td class="${t}">${s?ie`<span>${s}</span>`:k}</td>`}`}return ie`<tr>${i}</tr>`})),n=t.map((e=>ie`<th class="${e.type}">${e.header}</th>`));return ie`<table cellpadding="0" cellspacing="0">
55
+ <thead>
56
+ <tr> ${n} </tr>
57
+ </thead>
58
+ <tbody> ${i} </tbody>
59
+ </table>`}function ae(e){if(!e)return e;e.startsWith("-")&&(e=e.substring(1));const t=e.split(" ");let i=ie``;for(const e of t)i=ie`${i} ${le(e)}`;return i}function le(e){let t;if(t=e.match(/^https?:\/\//))return ie`<a href="${e}">${e}</a>`;if(t=e.match(/`(?<contents>.*)`/)){const i=t.groups?.contents,n=e.split(`\`${i}\``);return i?ie`${n[0]??""}<code>${i}</code>${n[1]??""}`:e}return e}let ce=class extends G{src=null;elementNames=null;initialElementName=null;get initialHeaderLevel(){return this.#e}set initialHeaderLevel(e){e>3&&(e=3);const t=this.#e;this.#e=e,this.requestUpdate("initialHeaderLevel",t)}static get styles(){return[ee]}#e=1;#t=!1;#i;#n;#s;#r;get#o(){if(!this.#i)return[];let e=ne(this.#i).map((e=>e?.name)).filter((e=>e));return this.elementNames&&(e=e.filter((e=>this.elementNames.includes(e)))),e.sort(((e,t)=>e.localeCompare(t)))}get#a(){if(this.#i&&(this.#n??=this.#o[0],this.#n))return function(e,t){const i=ne(e).find((e=>e?.name===t));if(!i)return;const n=e.modules.find((e=>e.path===i.declaration.module));if(!n)return;const s=n.declarations?.find((e=>"class"===e.kind&&e.name===i.declaration.name));return s}(this.#i,this.#n)}constructor(){super(),this.attachInternals&&(this.#r=this.attachInternals())}firstUpdated(e){super.firstUpdated(e),this.#t||this.#i||!this.src||this.#l()}update(e){super.update(e),e.has("src")&&this.#l()}render(){return this.#t?ie`Loading...`:this.#s?ie`An error was encountered trying to load schema from ${this.src}`:this.#a?ie`<article>
60
+ <div class="header-row"><${re(this.initialHeaderLevel)}>${this.#n}</${re(this.initialHeaderLevel)}>${this.#c()}</div>
61
+ <div>${ae(this.#a.description)}</div>
62
+ ${this.#h()} ${this.#d()} ${this.#p()}
63
+ ${this.#u()} ${this.#m()} ${this.#v()} ${this.#$()} </article
64
+ >`:k}#c(){if(this.#o.length>1){let e=this.#o.find((e=>e===this.#n));e||(e=this.#o[0]);const t=this.#o.map((t=>ie`<option ?selected="${t===e}" value="${t}">${t}</option>`));return ie`<select part="chooser" @change="${this.#y}"
65
+ >${t}</select
66
+ >`}return k}#h(){const e=this.#a?.attributes;if(e?.length){const t=oe(e,[{header:"Attribute",valueAccessor:e=>e.name,type:"name"},{header:"Description",type:"summary",valueAccessor:e=>ae(e.description)},{header:"Type",valueAccessor:e=>e.type?.text,type:"type"},{header:"Default",valueAccessor:e=>e.default,type:"default"}]);return ie`
67
+ <section part="attributes">
68
+ <${re(this.initialHeaderLevel+1)}>Attributes</${re(this.initialHeaderLevel+1)}>
69
+ ${t}
70
+ </section>
71
+ `}return k}#d(){const e=this.#a?.members?.filter((e=>"field"===e.kind&&se(e)));if(e?.length){const t=oe(e,[{header:"Property",valueAccessor:e=>e.name,type:"name"},{header:"Description",valueAccessor:e=>ae(e.description),type:"summary"},{header:"Type",valueAccessor:e=>e.type?.text,type:"type"},{header:"Default",valueAccessor:e=>e.default,type:"default"}]);return ie`
72
+ <section part="properties">
73
+ <${re(this.initialHeaderLevel+1)}>Properties</${re(this.initialHeaderLevel+1)}>
74
+ ${t}
75
+ </section>
76
+ `}return k}#p(){const e=this.#a?.cssProperties;if(e?.length){const t=oe(e,[{header:"CSS Property",valueAccessor:e=>e.name,type:"name"},{header:"Description",valueAccessor:e=>ae(e.description),type:"summary"},{header:"Default",valueAccessor:e=>e.default,type:"default"}]);return ie`
77
+ <section part="cssprops">
78
+ <${re(this.initialHeaderLevel+1)}>CSS Custom Properties</${re(this.initialHeaderLevel+1)}>
79
+ ${t}
80
+ </section>
81
+ `}return k}#u(){const e=this.#a?.cssParts;if(e?.length){const t=oe(e,[{header:"CSS Part",valueAccessor:e=>e.name,type:"name"},{header:"Description",valueAccessor:e=>ae(e.description),type:"summary"}]);return ie`
82
+ <section part="cssparts">
83
+ <${re(this.initialHeaderLevel+1)}>CSS Shadow Parts</${re(this.initialHeaderLevel+1)}>
84
+ ${t}
85
+ </section>
86
+ `}return k}#m(){const e=this.#a?.events;if(e?.length){const t=oe(e,[{header:"Event",valueAccessor:e=>e.name,type:"name"},{header:"Description",valueAccessor:e=>ae(e.description),type:"summary"},{header:"Type",valueAccessor:e=>e.type?.text,type:"type"}]);return ie`
87
+ <section part="events">
88
+ <${re(this.initialHeaderLevel+1)}>Events</${re(this.initialHeaderLevel+1)}>
89
+ ${t}
90
+ </section>
91
+ `}return k}#v(){const e=this.#a?.members?.filter((e=>"method"===e.kind&&se(e)));if(e?.length){const t=oe(e,[{header:"Method",valueAccessor:e=>e.name,type:"name"},{header:"Description",valueAccessor:e=>ae(e.description),type:"summary"},{header:"Signature",valueAccessor:e=>function(e){const t=()=>{const t=e.return?.type?.text;return 0===t?.length?"void":t??"unknown"};if(e.parameters){const i=e.parameters?.map((e=>e.name+(e.optional?"?":""))).join(", "),n=e.parameters?.map((e=>{const t=`: ${e?.type?.text}${e.default?` = ${e.default}`:""}`,i=e.name+(e.optional?"?":"")+t;return ie`
92
+ <div class="param-container">
93
+ <div class="param">${i}</div>
94
+ ${e.description?ie`<div class="param-description">${ae(e.description)}</div>`:k}
95
+ </div>
96
+ `}));return ie`<details>
97
+ <summary>${e.name}(${i}): ${t()}</summary>
98
+ <div class="expanded-details">${n}</div>
99
+ </details>`}return ie`${e.name}(): ${t()}`}(e),type:"signature"}]);return ie`
100
+ <section part="methods">
101
+ <${re(this.initialHeaderLevel+1)}>Methods</${re(this.initialHeaderLevel+1)}>
102
+ ${t}
103
+ </section>
104
+ `}return k}#$(){const e=this.#a?.slots;if(e?.length){const t=oe(e,[{header:"Slot",valueAccessor(e){let t=e.name;return t.startsWith("-")&&(t=t.substring(1)),t},type:"name"},{header:"Description",valueAccessor:e=>ae(e.description),type:"summary"}]);return ie`
105
+ <section part="slots">
106
+ <${re(this.initialHeaderLevel+1)}>Slots</${re(this.initialHeaderLevel+1)}>
107
+ ${t}
108
+ </section>
109
+ `}return k}#y(e){this.#n=e.target.value||void 0,this.requestUpdate()}async#l(){if(this.src){this.#t=!0,this.#r?.states?.add("--loading");const e=await fetch(this.src);if(e.ok){const t=await e.json();this.#i=t,this.initialElementName&&this.#o.includes(this.initialElementName)?this.#n=this.initialElementName:this.#n=this.#o[0],this.requestUpdate()}else this.#s=!0;this.#t=!1,this.#r?.states?.delete("--loading"),this.dispatchEvent(new CustomEvent("load",{detail:{success:!this.#s}}))}}};e([Y({type:String})],ce.prototype,"src",void 0),e([Y({type:Array})],ce.prototype,"elementNames",void 0),e([Y({type:String})],ce.prototype,"initialElementName",void 0),e([Y({type:Number})],ce.prototype,"initialHeaderLevel",null),ce=e([(e=>t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t))(e,t):((e,t)=>{const{kind:i,elements:n}=t;return{kind:i,elements:n,finisher(t){window.customElements.define(e,t)}}})(e,t))("customelement-manifest-element")],ce),window.CSS.registerProperty?.({name:"--schema-primary-color",initialValue:"black",inherits:!0,syntax:"<color>"}),window.CSS.registerProperty?.({name:"--schema-accent-color",initialValue:"black",inherits:!0,syntax:"<color>"}),window.CSS.registerProperty?.({name:"--schema-accent-color-h",initialValue:"167",inherits:!0,syntax:"*"}),window.CSS.registerProperty?.({name:"--schema-accent-color-s",initialValue:"74%",inherits:!0,syntax:"*"}),window.CSS.registerProperty?.({name:"--schema-accent-color-l",initialValue:"34%",inherits:!0,syntax:"*"});export{ce as CustomElementManifestElement};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zywave/customelement-manifest-element",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "main": "index.js",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -24,6 +24,7 @@
24
24
  "@custom-elements-manifest/analyzer": "^0.5.5",
25
25
  "@custom-elements-manifest/to-markdown": "^0.0.13",
26
26
  "@esm-bundle/chai": "^4.3.4",
27
+ "@rollup/plugin-node-resolve": "^13.1.3",
27
28
  "@semantic-release/gitlab": "^6.2.1",
28
29
  "@semantic-release/gitlab-config": "^8.0.0",
29
30
  "@typescript-eslint/eslint-plugin": "^4.33.0",
@@ -32,6 +33,7 @@
32
33
  "@web/test-runner-junit-reporter": "^0.4.7",
33
34
  "@web/test-runner-playwright": "^0.8.6",
34
35
  "@zywave/zui-sass-scripts": "^4.0.14",
36
+ "acorn-import-assertions": "^1.8.0",
35
37
  "custom-elements-manifest": "^1.0.0",
36
38
  "es-dev-server": "^2.1.0",
37
39
  "eslint": "^7.30.0",
@@ -41,6 +43,10 @@
41
43
  "mocha": "^9.1.2",
42
44
  "playwright": "^1.15.2",
43
45
  "prettier": "^2.4.1",
46
+ "rollup": "^2.63.0",
47
+ "rollup-plugin-import-assert": "^2.1.0",
48
+ "rollup-plugin-summary": "^1.3.0",
49
+ "rollup-plugin-terser": "^7.0.2",
44
50
  "sass": "^1.42.1",
45
51
  "semantic-release": "^18.0.0",
46
52
  "sinon": "^11.1.1",
@@ -48,7 +54,7 @@
48
54
  },
49
55
  "scripts": {
50
56
  "analyze": "cem analyze --globs \"src/customelement-manifest-element.ts\" --litelement",
51
- "build": "yarn run build:scss && yarn run build:ts",
57
+ "build": "yarn run build:scss && yarn run build:ts && rollup --config",
52
58
  "build:ts": "tsc -p tsconfig.json",
53
59
  "build:scss": "sass src/customelement-manifest-element.scss customelement-manifest-element.css",
54
60
  "clean": "git clean -dfX",
@@ -0,0 +1,25 @@
1
+ import resolve from "@rollup/plugin-node-resolve";
2
+ import { terser } from "rollup-plugin-terser";
3
+ import summary from "rollup-plugin-summary";
4
+ import { importAssertionsPlugin } from "rollup-plugin-import-assert";
5
+ import { importAssertions } from "acorn-import-assertions";
6
+
7
+ export default {
8
+ plugins: [
9
+ importAssertionsPlugin(),
10
+ resolve(),
11
+ terser({
12
+ ecma: 2020,
13
+ module: true,
14
+ warnings: true,
15
+ }),
16
+ summary(),
17
+ ],
18
+ acornInjectPlugins: [importAssertions],
19
+ input: "index.js",
20
+ output: {
21
+ format: "esm",
22
+ file: "index.bundle.js",
23
+ },
24
+ preserveEntrySignatures: "strict",
25
+ };