@zywave/customelement-manifest-element 1.4.2 → 1.5.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/customelement-manifest-element.d.ts +3 -0
- package/customelement-manifest-element.js +33 -1
- package/index.bundle.js +24 -18
- package/package.json +13 -9
- package/rollup.config.js +2 -1
|
@@ -11,6 +11,9 @@ import type { PropertyValues, TemplateResult } from "lit";
|
|
|
11
11
|
* @csspart events - Select the section that pertains to the Events documentation
|
|
12
12
|
* @csspart cssprops - Select the section that pertains to the CSS Custom Properties documentation
|
|
13
13
|
* @csspart methods - Select the section that pertains to the Methods documentation
|
|
14
|
+
* @csspart cssstates - Select the section that pertains to the CSS Custom States documentation
|
|
15
|
+
*
|
|
16
|
+
* @cssState loading - Applied when the element is in the process of loading the schema resource
|
|
14
17
|
*
|
|
15
18
|
* @fires load An event that signifies the component has resolved its attempt to fetch the schema resource
|
|
16
19
|
*/
|
|
@@ -108,6 +108,9 @@ function getBasePath() {
|
|
|
108
108
|
* @csspart events - Select the section that pertains to the Events documentation
|
|
109
109
|
* @csspart cssprops - Select the section that pertains to the CSS Custom Properties documentation
|
|
110
110
|
* @csspart methods - Select the section that pertains to the Methods documentation
|
|
111
|
+
* @csspart cssstates - Select the section that pertains to the CSS Custom States documentation
|
|
112
|
+
*
|
|
113
|
+
* @cssState loading - Applied when the element is in the process of loading the schema resource
|
|
111
114
|
*
|
|
112
115
|
* @fires load An event that signifies the component has resolved its attempt to fetch the schema resource
|
|
113
116
|
*/
|
|
@@ -208,7 +211,7 @@ let CustomElementManifestElement = class CustomElementManifestElement extends Li
|
|
|
208
211
|
<div class="header-row"><${getHeaderTag(this.initialHeaderLevel)}>${this.#activeElementName}</${getHeaderTag(this.initialHeaderLevel)}>${this.#renderElementChooser()}</div>
|
|
209
212
|
<div>${renderDescription(this.#activeElement.description)}</div>
|
|
210
213
|
${this.#renderAttributes()} ${this.#renderProperties()} ${this.#renderCssProperties()}
|
|
211
|
-
${this.#renderCssShadowParts()} ${this.#renderEvents()} ${this.#renderMethods()} ${this.#renderSlots()} </article
|
|
214
|
+
${this.#renderCssShadowParts()} ${this.#renderEvents()} ${this.#renderMethods()} ${this.#renderSlots()} ${this.#renderCssCustomStates()} </article
|
|
212
215
|
>`
|
|
213
216
|
: nothing;
|
|
214
217
|
}
|
|
@@ -481,6 +484,35 @@ let CustomElementManifestElement = class CustomElementManifestElement extends Li
|
|
|
481
484
|
}
|
|
482
485
|
return nothing;
|
|
483
486
|
}
|
|
487
|
+
#renderCssCustomStates() {
|
|
488
|
+
const cssStates = this.#activeElement?.cssStates;
|
|
489
|
+
if (cssStates?.length) {
|
|
490
|
+
const table = buildTable(cssStates, [
|
|
491
|
+
{
|
|
492
|
+
header: "State",
|
|
493
|
+
valueAccessor(item) {
|
|
494
|
+
return item.name;
|
|
495
|
+
},
|
|
496
|
+
type: "name",
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
header: "Description",
|
|
500
|
+
valueAccessor(item) {
|
|
501
|
+
return renderDescription(item.description);
|
|
502
|
+
},
|
|
503
|
+
type: "summary",
|
|
504
|
+
},
|
|
505
|
+
]);
|
|
506
|
+
return html `
|
|
507
|
+
<section part="cssstates">
|
|
508
|
+
<a class="header-link" id="${this.#buildId("states")}" href="${this.#basePath}#${this.#buildId("states")}">
|
|
509
|
+
<${getHeaderTag(this.initialHeaderLevel + 1)}>CSS Custom States</${getHeaderTag(this.initialHeaderLevel + 1)}></a>
|
|
510
|
+
${table}
|
|
511
|
+
</section>
|
|
512
|
+
`;
|
|
513
|
+
}
|
|
514
|
+
return nothing;
|
|
515
|
+
}
|
|
484
516
|
#onElementChange(e) {
|
|
485
517
|
this.#activeElementName = e.target.value || undefined;
|
|
486
518
|
this.requestUpdate();
|
package/index.bundle.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import t from"./customelement-manifest-element.css"
|
|
1
|
+
import t from"./customelement-manifest-element.css"with{type:"css"};function e(t,e,s,i){var r,n=arguments.length,a=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,s,i);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(n<3?r(a):n>3?r(e,s,a):r(e,s))||a);return n>3&&a&&Object.defineProperty(e,s,a),a}"function"==typeof SuppressedError&&SuppressedError;
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2019 Google LLC
|
|
5
5
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
6
|
*/
|
|
7
|
-
const s=globalThis,i=s.ShadowRoot&&(void 0===s.ShadyCSS||s.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),n=new WeakMap;let
|
|
7
|
+
const s=globalThis,i=s.ShadowRoot&&(void 0===s.ShadyCSS||s.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),n=new WeakMap;let a=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(i&&void 0===t){const s=void 0!==e&&1===e.length;s&&(t=n.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&n.set(e,t))}return t}toString(){return this.cssText}};const o=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new a("string"==typeof t?t:t+"",void 0,r))(e)})(t):t
|
|
8
8
|
/**
|
|
9
9
|
* @license
|
|
10
10
|
* Copyright 2017 Google LLC
|
|
11
11
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
12
|
-
*/,{is:h,defineProperty:l,getOwnPropertyDescriptor:c,getOwnPropertyNames:d,getOwnPropertySymbols:p,getPrototypeOf:u}=Object,$=globalThis,m=$.trustedTypes,f=m?m.emptyScript:"",v=$.reactiveElementPolyfillSupport,y=(t,e)=>t,_={toAttribute(t,e){switch(e){case Boolean:t=t?f:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},g=(t,e)=>!h(t,e),A={attribute:!0,type:String,converter:_,reflect:!1,hasChanged:g};Symbol.metadata??=Symbol("metadata"),$.litPropertyMetadata??=new WeakMap;class
|
|
12
|
+
*/,{is:h,defineProperty:l,getOwnPropertyDescriptor:c,getOwnPropertyNames:d,getOwnPropertySymbols:p,getPrototypeOf:u}=Object,$=globalThis,m=$.trustedTypes,f=m?m.emptyScript:"",v=$.reactiveElementPolyfillSupport,y=(t,e)=>t,_={toAttribute(t,e){switch(e){case Boolean:t=t?f:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},g=(t,e)=>!h(t,e),A={attribute:!0,type:String,converter:_,reflect:!1,hasChanged:g};Symbol.metadata??=Symbol("metadata"),$.litPropertyMetadata??=new WeakMap;class b extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=A){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);void 0!==i&&l(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:r}=c(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return i?.call(this)},set(e){const n=i?.call(this);r.call(this,e),this.requestUpdate(t,n,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??A}static _$Ei(){if(this.hasOwnProperty(y("elementProperties")))return;const t=u(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(y("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(y("properties"))){const t=this.properties,e=[...d(t),...p(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const s=this._$Eu(t,e);void 0!==s&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(o(t))}else void 0!==t&&e.push(o(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(i)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const i of e){const e=document.createElement("style"),r=s.litNonce;void 0!==r&&e.setAttribute("nonce",r),e.textContent=i.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EC(t,e){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(void 0!==i&&!0===s.reflect){const r=(void 0!==s.converter?.toAttribute?s.converter:_).toAttribute(e,s.type);this._$Em=t,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(t,e){const s=this.constructor,i=s._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=s.getPropertyOptions(i),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:_;this._$Em=i,this[i]=r.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,s){if(void 0!==t){if(s??=this.constructor.getPropertyOptions(t),!(s.hasChanged??g)(this[t],e))return;this.P(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(t,e,s){this._$AL.has(t)||this._$AL.set(t,e),!0===s.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,s]of t)!0!==s.wrapped||this._$AL.has(e)||void 0===this[e]||this.P(e,this[e],s)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EU()}catch(e){throw t=!1,this._$EU(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU()}updated(t){}firstUpdated(t){}}b.elementStyles=[],b.shadowRootOptions={mode:"open"},b[y("elementProperties")]=new Map,b[y("finalized")]=new Map,v?.({ReactiveElement:b}),($.reactiveElementVersions??=[]).push("2.0.4");
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
15
15
|
* Copyright 2017 Google LLC
|
|
16
16
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
17
|
*/
|
|
18
|
-
const
|
|
18
|
+
const E=globalThis,S=E.trustedTypes,P=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,w="$lit$",C=`lit$${Math.random().toFixed(9).slice(2)}$`,H="?"+C,N=`<${H}>`,x=document,L=()=>x.createComment(""),U=t=>null===t||"object"!=typeof t&&"function"!=typeof t,O=Array.isArray,I="[ \t\n\f\r]",T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,M=/-->/g,k=/>/g,R=RegExp(`>|${I}(?:([^\\s"'>=/]+)(${I}*=${I}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),D=/'/g,j=/"/g,z=/^(?:script|style|textarea|title)$/i,B=(t=>(e,...s)=>({_$litType$:t,strings:e,values:s}))(1),W=Symbol.for("lit-noChange"),q=Symbol.for("lit-nothing"),V=new WeakMap,J=x.createTreeWalker(x,129);function K(t,e){if(!O(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==P?P.createHTML(e):e}const Z=(t,e)=>{const s=t.length-1,i=[];let r,n=2===e?"<svg>":3===e?"<math>":"",a=T;for(let e=0;e<s;e++){const s=t[e];let o,h,l=-1,c=0;for(;c<s.length&&(a.lastIndex=c,h=a.exec(s),null!==h);)c=a.lastIndex,a===T?"!--"===h[1]?a=M:void 0!==h[1]?a=k:void 0!==h[2]?(z.test(h[2])&&(r=RegExp("</"+h[2],"g")),a=R):void 0!==h[3]&&(a=R):a===R?">"===h[0]?(a=r??T,l=-1):void 0===h[1]?l=-2:(l=a.lastIndex-h[2].length,o=h[1],a=void 0===h[3]?R:'"'===h[3]?j:D):a===j||a===D?a=R:a===M||a===k?a=T:(a=R,r=void 0);const d=a===R&&t[e+1].startsWith("/>")?" ":"";n+=a===T?s+N:l>=0?(i.push(o),s.slice(0,l)+w+s.slice(l)+C+d):s+C+(-2===l?e:d)}return[K(t,n+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),i]};class F{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let r=0,n=0;const a=t.length-1,o=this.parts,[h,l]=Z(t,e);if(this.el=F.createElement(h,s),J.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=J.nextNode())&&o.length<a;){if(1===i.nodeType){if(i.hasAttributes())for(const t of i.getAttributeNames())if(t.endsWith(w)){const e=l[n++],s=i.getAttribute(t).split(C),a=/([.?@])?(.*)/.exec(e);o.push({type:1,index:r,name:a[2],strings:s,ctor:"."===a[1]?tt:"?"===a[1]?et:"@"===a[1]?st:Y}),i.removeAttribute(t)}else t.startsWith(C)&&(o.push({type:6,index:r}),i.removeAttribute(t));if(z.test(i.tagName)){const t=i.textContent.split(C),e=t.length-1;if(e>0){i.textContent=S?S.emptyScript:"";for(let s=0;s<e;s++)i.append(t[s],L()),J.nextNode(),o.push({type:2,index:++r});i.append(t[e],L())}}}else if(8===i.nodeType)if(i.data===H)o.push({type:2,index:r});else{let t=-1;for(;-1!==(t=i.data.indexOf(C,t+1));)o.push({type:7,index:r}),t+=C.length-1}r++}}static createElement(t,e){const s=x.createElement("template");return s.innerHTML=t,s}}function G(t,e,s=t,i){if(e===W)return e;let r=void 0!==i?s._$Co?.[i]:s._$Cl;const n=U(e)?void 0:e._$litDirective$;return r?.constructor!==n&&(r?._$AO?.(!1),void 0===n?r=void 0:(r=new n(t),r._$AT(t,s,i)),void 0!==i?(s._$Co??=[])[i]=r:s._$Cl=r),void 0!==r&&(e=G(t,r._$AS(t,e.values),r,i)),e}class Q{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,i=(t?.creationScope??x).importNode(e,!0);J.currentNode=i;let r=J.nextNode(),n=0,a=0,o=s[0];for(;void 0!==o;){if(n===o.index){let e;2===o.type?e=new X(r,r.nextSibling,this,t):1===o.type?e=new o.ctor(r,o.name,o.strings,this,t):6===o.type&&(e=new it(r,this,t)),this._$AV.push(e),o=s[++a]}n!==o?.index&&(r=J.nextNode(),n++)}return J.currentNode=x,i}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class X{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=q,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=G(this,t,e),U(t)?t===q||null==t||""===t?(this._$AH!==q&&this._$AR(),this._$AH=q):t!==this._$AH&&t!==W&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>O(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==q&&U(this._$AH)?this._$AA.nextSibling.data=t:this.T(x.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,i="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=F.createElement(K(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(e);else{const t=new Q(i,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=V.get(t.strings);return void 0===e&&V.set(t.strings,e=new F(t)),e}k(t){O(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const r of t)i===e.length?e.push(s=new X(this.O(L()),this.O(L()),this,this.options)):s=e[i],s._$AI(r),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class Y{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,r){this.type=1,this._$AH=q,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=r,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=q}_$AI(t,e=this,s,i){const r=this.strings;let n=!1;if(void 0===r)t=G(this,t,e,0),n=!U(t)||t!==this._$AH&&t!==W,n&&(this._$AH=t);else{const i=t;let a,o;for(t=r[0],a=0;a<r.length-1;a++)o=G(this,i[s+a],e,a),o===W&&(o=this._$AH[a]),n||=!U(o)||o!==this._$AH[a],o===q?t=q:t!==q&&(t+=(o??"")+r[a+1]),this._$AH[a]=o}n&&!i&&this.j(t)}j(t){t===q?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class tt extends Y{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===q?void 0:t}}class et extends Y{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==q)}}class st extends Y{constructor(t,e,s,i,r){super(t,e,s,i,r),this.type=5}_$AI(t,e=this){if((t=G(this,t,e,0)??q)===W)return;const s=this._$AH,i=t===q&&s!==q||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==q&&(s===q||i);i&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class it{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){G(this,t)}}const rt=E.litHtmlPolyfillSupport;rt?.(F,X),(E.litHtmlVersions??=[]).push("3.2.1");
|
|
19
19
|
/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
let nt=class extends b{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,s)=>{const i=s?.renderBefore??e;let r=i._$litPart$;if(void 0===r){const t=s?.renderBefore??null;i._$litPart$=r=new X(e.insertBefore(L(),t),t,void 0,s??{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return W}};nt._$litElement$=!0,nt.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:nt});const at=globalThis.litElementPolyfillSupport;at?.({LitElement:nt}),(globalThis.litElementVersions??=[]).push("4.1.1");
|
|
25
25
|
/**
|
|
26
26
|
* @license
|
|
27
27
|
* Copyright 2017 Google LLC
|
|
28
28
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
29
29
|
*/
|
|
30
|
-
const
|
|
30
|
+
const ot={attribute:!0,type:String,converter:_,reflect:!1,hasChanged:g},ht=(t=ot,e,s)=>{const{kind:i,metadata:r}=s;let n=globalThis.litPropertyMetadata.get(r);if(void 0===n&&globalThis.litPropertyMetadata.set(r,n=new Map),n.set(s.name,t),"accessor"===i){const{name:i}=s;return{set(s){const r=e.get.call(this);e.set.call(this,s),this.requestUpdate(i,r,t)},init(e){return void 0!==e&&this.P(i,void 0,t),e}}}if("setter"===i){const{name:i}=s;return function(s){const r=this[i];e.call(this,s),this.requestUpdate(i,r,t)}}throw Error("Unsupported decorator location: "+i)};
|
|
31
31
|
/**
|
|
32
32
|
* @license
|
|
33
33
|
* Copyright 2017 Google LLC
|
|
@@ -37,43 +37,43 @@ const at={attribute:!0,type:String,converter:_,reflect:!1,hasChanged:g},ht=(t=at
|
|
|
37
37
|
* @license
|
|
38
38
|
* Copyright 2020 Google LLC
|
|
39
39
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
40
|
-
*/}const ct=Symbol.for(""),dt=t=>{if(t?.r===ct)return t?._$litStatic$},pt=new Map,ut=(t=>(e,...s)=>{const i=s.length;let r,n;const
|
|
40
|
+
*/}const ct=Symbol.for(""),dt=t=>{if(t?.r===ct)return t?._$litStatic$},pt=new Map,ut=(t=>(e,...s)=>{const i=s.length;let r,n;const a=[],o=[];let h,l=0,c=!1;for(;l<i;){for(h=e[l];l<i&&void 0!==(n=s[l],r=dt(n));)h+=r+e[++l],c=!0;l!==i&&o.push(n),a.push(h),l++}if(l===i&&a.push(e[i]),c){const t=a.join("$$lit$$");void 0===(e=pt.get(t))&&(a.raw=a,pt.set(t,e=a)),s=o}return t(e,...s)})(B);function $t(t){return t.modules.flatMap((t=>t.exports)).filter((t=>"custom-element-definition"===t?.kind))}function mt(t){return!(t.privacy&&"public"!==t.privacy||t.name.startsWith("_")||t.name.startsWith("#"))}function ft(t){return(t=>({_$litStatic$:t,r:ct}))(`h${t}`)}function vt(t,e){const s=t.map((t=>{let s=ut``;for(const i of e){const e=`${i.type}`,r=i.valueAccessor(t);s=ut`${s}${ut`<td class="${e}">${r?ut`<span>${r}</span>`:q}</td>`}`}return ut`<tr>${s}</tr>`})),i=e.map((t=>ut`<th class="${t.type}">${t.header}</th>`));return ut`<table cellpadding="0" cellspacing="0">
|
|
41
41
|
<thead>
|
|
42
42
|
<tr> ${i} </tr>
|
|
43
43
|
</thead>
|
|
44
44
|
<tbody> ${s} </tbody>
|
|
45
|
-
</table>`}function yt(t){if(!t)return t;t.startsWith("-")&&(t=t.substring(1));const e=t.split(" ");let s=ut``;for(const t of e)s=ut`${s} ${_t(t)}`;return s}function _t(t){let e;if(e=t.match(/^https?:\/\//))return ut`<a href="${t}">${t}</a>`;if(e=t.match(/`(?<contents>.*)`/)){const s=e.groups?.contents,i=t.split(`\`${s}\``);return s?ut`${i[0]??""}<code>${s}</code>${i[1]??""}`:t}return t}let gt=class extends nt{get initialHeaderLevel(){return this.#t}set initialHeaderLevel(t){t>3&&(t=3);const e=this.#t;this.#t=t,this.requestUpdate("initialHeaderLevel",e)}static{this.styles=[t]}#t;#e;#s;#i;#r;#n;#
|
|
45
|
+
</table>`}function yt(t){if(!t)return t;t.startsWith("-")&&(t=t.substring(1));const e=t.split(" ");let s=ut``;for(const t of e)s=ut`${s} ${_t(t)}`;return s}function _t(t){let e;if(e=t.match(/^https?:\/\//))return ut`<a href="${t}">${t}</a>`;if(e=t.match(/`(?<contents>.*)`/)){const s=e.groups?.contents,i=t.split(`\`${s}\``);return s?ut`${i[0]??""}<code>${s}</code>${i[1]??""}`:t}return t}let gt=class extends nt{get initialHeaderLevel(){return this.#t}set initialHeaderLevel(t){t>3&&(t=3);const e=this.#t;this.#t=t,this.requestUpdate("initialHeaderLevel",e)}static{this.styles=[t]}#t;#e;#s;#i;#r;#n;#a;get#o(){if(!this.#s)return[];let t=$t(this.#s).map((t=>t?.name)).filter((t=>t));return this.elementNames&&(t=t.filter((t=>this.elementNames.includes(t)))),t.sort(((t,e)=>t.localeCompare(e)))}get#h(){if(this.#s&&(this.#i??=this.#o[0],this.#i))return function(t,e){const s=$t(t).find((t=>t?.name===e));if(!s)return;const i=t.modules.find((t=>t.path===s.declaration.module));if(!i)return;const r=i.declarations?.find((t=>"class"===t.kind&&t.name===s.declaration.name));return r}(this.#s,this.#i)}constructor(){super(),this.src=null,this.elementNames=null,this.initialElementName=null,this.headerIdPrefix=null,this.#t=1,this.#e=!1,this.#a=window.location.href.replace(window.location.hash,""),this.attachInternals&&(this.#n=this.attachInternals())}firstUpdated(t){super.firstUpdated(t),this.#e||this.#s||!this.src||this.#l(),this.#c(),window.addEventListener("hashchange",(()=>this.#c),{capture:!0})}update(t){super.update(t),t.has("src")&&this.#l()}render(){return this.#e?ut`Loading...`:this.#r?ut`An error was encountered trying to load schema from ${this.src}`:this.#h?ut`<article>
|
|
46
46
|
<div class="header-row"><${ft(this.initialHeaderLevel)}>${this.#i}</${ft(this.initialHeaderLevel)}>${this.#d()}</div>
|
|
47
47
|
<div>${yt(this.#h.description)}</div>
|
|
48
48
|
${this.#p()} ${this.#u()} ${this.#$()}
|
|
49
|
-
${this.#m()} ${this.#f()} ${this.#v()} ${this.#y()} </article
|
|
50
|
-
>`:q}#d(){if(this.#
|
|
49
|
+
${this.#m()} ${this.#f()} ${this.#v()} ${this.#y()} ${this.#_()} </article
|
|
50
|
+
>`:q}#d(){if(this.#o.length>1){let t=this.#o.find((t=>t===this.#i));t||(t=this.#o[0]);const e=this.#o.map((e=>ut`<option ?selected="${e===t}" value="${e}">${e}</option>`));return ut`<select part="chooser" @change="${this.#g}"
|
|
51
51
|
>${e}</select
|
|
52
52
|
>`}return q}#p(){const t=this.#h?.attributes;if(t?.length){const e=vt(t,[{header:"Attribute",valueAccessor:t=>t.name,type:"name"},{header:"Description",type:"summary",valueAccessor:t=>yt(t.description)},{header:"Type",valueAccessor:t=>t.type?.text,type:"type"},{header:"Default",valueAccessor:t=>t.default,type:"default"}]);return ut`
|
|
53
53
|
<section part="attributes">
|
|
54
|
-
<a class="header-link" id="${this.#
|
|
54
|
+
<a class="header-link" id="${this.#A("attributes")}" href="${this.#a}#${this.#A("attributes")}">
|
|
55
55
|
<${ft(this.initialHeaderLevel+1)}>Attributes</${ft(this.initialHeaderLevel+1)}></a>
|
|
56
56
|
${e}
|
|
57
57
|
</section>
|
|
58
58
|
`}return q}#u(){const t=this.#h?.members?.filter((t=>"field"===t.kind&&mt(t)));if(t?.length){const e=vt(t,[{header:"Property",valueAccessor:t=>t.name,type:"name"},{header:"Description",valueAccessor:t=>yt(t.description),type:"summary"},{header:"Type",valueAccessor:t=>t.type?.text,type:"type"},{header:"Default",valueAccessor:t=>t.default,type:"default"}]);return ut`
|
|
59
59
|
<section part="properties">
|
|
60
|
-
<a class="header-link" id="${this.#
|
|
60
|
+
<a class="header-link" id="${this.#A("properties")}" href="${this.#a}#${this.#A("properties")}">
|
|
61
61
|
<${ft(this.initialHeaderLevel+1)}>Properties</${ft(this.initialHeaderLevel+1)}></a>
|
|
62
62
|
${e}
|
|
63
63
|
</section>
|
|
64
64
|
`}return q}#$(){const t=this.#h?.cssProperties;if(t?.length){const e=vt(t,[{header:"CSS Property",valueAccessor:t=>t.name,type:"name"},{header:"Description",valueAccessor:t=>yt(t.description),type:"summary"},{header:"Default",valueAccessor:t=>t.default,type:"default"}]);return ut`
|
|
65
65
|
<section part="cssprops">
|
|
66
|
-
<a class="header-link" id="${this.#
|
|
66
|
+
<a class="header-link" id="${this.#A("cssprops")}" href="${this.#a}#${this.#A("cssprops")}"> <${ft(this.initialHeaderLevel+1)} )}">CSS Custom Properties</${ft(this.initialHeaderLevel+1)}></a>
|
|
67
67
|
${e}
|
|
68
68
|
</section>
|
|
69
69
|
`}return q}#m(){const t=this.#h?.cssParts;if(t?.length){const e=vt(t,[{header:"CSS Part",valueAccessor:t=>t.name,type:"name"},{header:"Description",valueAccessor:t=>yt(t.description),type:"summary"}]);return ut`
|
|
70
70
|
<section part="cssparts">
|
|
71
|
-
<a class="header-link" id="${this.#
|
|
71
|
+
<a class="header-link" id="${this.#A("parts")}" href="${this.#a}#${this.#A("parts")}"> <${ft(this.initialHeaderLevel+1)}>CSS Shadow Parts</${ft(this.initialHeaderLevel+1)}></a>
|
|
72
72
|
${e}
|
|
73
73
|
</section>
|
|
74
74
|
`}return q}#f(){const t=this.#h?.events;if(t?.length){const e=vt(t,[{header:"Event",valueAccessor:t=>t.name,type:"name"},{header:"Description",valueAccessor:t=>yt(t.description),type:"summary"},{header:"Type",valueAccessor:t=>t.type?.text,type:"type"}]);return ut`
|
|
75
75
|
<section part="events">
|
|
76
|
-
<a class="header-link" id="${this.#
|
|
76
|
+
<a class="header-link" id="${this.#A("events")}" href="${this.#a}#${this.#A("events")}">
|
|
77
77
|
<${ft(this.initialHeaderLevel+1)}>Events</${ft(this.initialHeaderLevel+1)}></a>
|
|
78
78
|
${e}
|
|
79
79
|
</section>
|
|
@@ -87,14 +87,20 @@ const at={attribute:!0,type:String,converter:_,reflect:!1,hasChanged:g},ht=(t=at
|
|
|
87
87
|
<div class="expanded-details">${i}</div>
|
|
88
88
|
</details>`}return ut`${t.name}(): ${e()}`}(t),type:"signature"}]);return ut`
|
|
89
89
|
<section part="methods">
|
|
90
|
-
<a class="header-link" id="${this.#
|
|
90
|
+
<a class="header-link" id="${this.#A("methods")}" href="${this.#a}#${this.#A("methods")}">
|
|
91
91
|
<${ft(this.initialHeaderLevel+1)}>Methods</${ft(this.initialHeaderLevel+1)}></a>
|
|
92
92
|
${e}
|
|
93
93
|
</section>
|
|
94
94
|
`}return q}#y(){const t=this.#h?.slots;if(t?.length){const e=vt(t,[{header:"Slot",valueAccessor(t){let e=t.name;return e.startsWith("-")&&(e=e.substring(1)),e},type:"name"},{header:"Description",valueAccessor:t=>yt(t.description),type:"summary"}]);return ut`
|
|
95
95
|
<section part="slots">
|
|
96
|
-
<a class="header-link" id="${this.#
|
|
96
|
+
<a class="header-link" id="${this.#A("slots")}" href="${this.#a}#${this.#A("slots")}">
|
|
97
97
|
<${ft(this.initialHeaderLevel+1)}>Slots</${ft(this.initialHeaderLevel+1)}></a>
|
|
98
98
|
${e}
|
|
99
99
|
</section>
|
|
100
|
-
`}return q}#_(
|
|
100
|
+
`}return q}#_(){const t=this.#h?.cssStates;if(t?.length){const e=vt(t,[{header:"State",valueAccessor:t=>t.name,type:"name"},{header:"Description",valueAccessor:t=>yt(t.description),type:"summary"}]);return ut`
|
|
101
|
+
<section part="cssstates">
|
|
102
|
+
<a class="header-link" id="${this.#A("states")}" href="${this.#a}#${this.#A("states")}">
|
|
103
|
+
<${ft(this.initialHeaderLevel+1)}>CSS Custom States</${ft(this.initialHeaderLevel+1)}></a>
|
|
104
|
+
${e}
|
|
105
|
+
</section>
|
|
106
|
+
`}return q}#g(t){this.#i=t.target.value||void 0,this.requestUpdate()}async#l(){if(this.src){this.#e=!0,this.#n?.states?.add("loading");const t=await fetch(this.src);if(t.ok){const e=await t.json();this.#s=e,this.initialElementName&&this.#o.includes(this.initialElementName)?this.#i=this.initialElementName:this.#i=this.#o[0],this.requestUpdate()}else this.#r=!0;this.#e=!1,this.#n?.states?.delete("loading"),this.#c(),this.dispatchEvent(new CustomEvent("load",{detail:{success:!this.#r}}))}}#A(t,e=!1){let s=t;return this.#i&&(s=`${this.#i}${e?"\\":""}~${s}`),this.headerIdPrefix&&(s=`${this.headerIdPrefix}_${s}`),s}async#c(){if(!window.location.hash)return;const t=window.location.hash.substring(1),e=new RegExp((this.headerIdPrefix?`(?<prefix>${this.headerIdPrefix})_`:"")+"(?<element>.*)~(?<id>.*)").exec(t);e&&this.#o?.includes(e.groups?.element)&&(this.#i=e.groups?.element,this.requestUpdate(),await this.updateComplete,this.renderRoot.querySelector(`#${this.#A(e.groups.id,!0)}`)?.scrollIntoView({behavior:"smooth",block:"start"}))}};e([lt({type:String})],gt.prototype,"src",void 0),e([lt({type:Array})],gt.prototype,"elementNames",void 0),e([lt({type:String})],gt.prototype,"initialElementName",void 0),e([lt({type:Number})],gt.prototype,"initialHeaderLevel",null),e([lt({type:String})],gt.prototype,"headerIdPrefix",void 0),gt=e([(t=>(e,s)=>{void 0!==s?s.addInitializer((()=>{customElements.define(t,e)})):customElements.define(t,e)})("customelement-manifest-element")],gt);export{gt as CustomElementManifestElement};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zywave/customelement-manifest-element",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -18,20 +18,23 @@
|
|
|
18
18
|
"custom-elements.json"
|
|
19
19
|
],
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@custom-elements-manifest/analyzer": "^0.
|
|
21
|
+
"@custom-elements-manifest/analyzer": "^0.10.0",
|
|
22
22
|
"@custom-elements-manifest/to-markdown": "^0.1.0",
|
|
23
23
|
"@esm-bundle/chai": "^4.3.4",
|
|
24
24
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
25
25
|
"@rollup/plugin-terser": "^0.4.4",
|
|
26
|
-
"@semantic-release/gitlab": "^
|
|
27
|
-
"@semantic-release/gitlab-config": "^
|
|
26
|
+
"@semantic-release/gitlab": "^13.2.3",
|
|
27
|
+
"@semantic-release/gitlab-config": "^14.0.1",
|
|
28
28
|
"@types/mocha": "^10.0.6",
|
|
29
|
+
"@types/node": "^22.10.2",
|
|
29
30
|
"@typescript-eslint/eslint-plugin": "^6.12.0",
|
|
30
31
|
"@typescript-eslint/parser": "^6.12.0",
|
|
31
|
-
"@web/test-runner": "^0.
|
|
32
|
+
"@web/test-runner": "^0.19.0",
|
|
32
33
|
"@web/test-runner-junit-reporter": "^0.7.0",
|
|
33
34
|
"@web/test-runner-playwright": "^0.11.0",
|
|
34
35
|
"@zywave/zui-sass-scripts": "^4.0.15",
|
|
36
|
+
"chai": "^5.1.2",
|
|
37
|
+
"chokidar": "^4.0.3",
|
|
35
38
|
"custom-elements-manifest": "^2.0.0",
|
|
36
39
|
"es-dev-server": "^2.1.0",
|
|
37
40
|
"es-module-shims": "^1.8.2",
|
|
@@ -42,12 +45,13 @@
|
|
|
42
45
|
"mocha": "^10.2.0",
|
|
43
46
|
"playwright": "^1.45.3",
|
|
44
47
|
"prettier": "^3.1.0",
|
|
45
|
-
"rollup": "^4.
|
|
48
|
+
"rollup": "^4.29.1",
|
|
46
49
|
"sass": "^1.69.5",
|
|
47
|
-
"semantic-release": "^
|
|
50
|
+
"semantic-release": "^24.2.0",
|
|
48
51
|
"sinon": "^17.0.1",
|
|
49
|
-
"
|
|
50
|
-
"
|
|
52
|
+
"terser": "^5.37.0",
|
|
53
|
+
"tslib": "^2.8.1",
|
|
54
|
+
"typescript": "^5.7.2"
|
|
51
55
|
},
|
|
52
56
|
"scripts": {
|
|
53
57
|
"analyze": "cem analyze --globs \"src/customelement-manifest-element.ts\" --litelement",
|
package/rollup.config.js
CHANGED
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
plugins: [
|
|
6
6
|
resolve(),
|
|
7
7
|
terser({
|
|
8
|
-
ecma:
|
|
8
|
+
ecma: 2024,
|
|
9
9
|
module: true,
|
|
10
10
|
warnings: true,
|
|
11
11
|
}),
|
|
@@ -15,6 +15,7 @@ export default {
|
|
|
15
15
|
format: "esm",
|
|
16
16
|
file: "index.bundle.js",
|
|
17
17
|
externalImportAttributes: true,
|
|
18
|
+
importAttributesKey: "with",
|
|
18
19
|
},
|
|
19
20
|
external: [/\.css$/],
|
|
20
21
|
preserveEntrySignatures: "strict",
|