Socket
Socket
Sign inDemoInstall

@patternfly/pfelement

Package Overview
Dependencies
Maintainers
13
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@patternfly/pfelement - npm Package Compare versions

Comparing version 1.9.2 to 1.9.3

118

dist/pfelement.js

@@ -73,3 +73,3 @@ let logger = () => null;

Object.defineProperty(Array.prototype, "includes", {
value: function(valueToFind, fromIndex) {
value: function (valueToFind, fromIndex) {
if (this == null) {

@@ -118,3 +118,3 @@ throw new TypeError('"this" is null or not defined');

return false;
}
},
});

@@ -126,3 +126,3 @@ }

if (!Object.entries) {
Object.entries = function(obj) {
Object.entries = function (obj) {
var ownProps = Object.keys(obj),

@@ -141,6 +141,6 @@ i = ownProps.length,

Object.defineProperty(String.prototype, "startsWith", {
value: function(search, rawPos) {
value: function (search, rawPos) {
var pos = rawPos > 0 ? rawPos | 0 : 0;
return this.substring(pos, pos + search.length) === search;
}
},
});

@@ -152,3 +152,3 @@ }

if (!Element.prototype.closest) {
Element.prototype.closest = function(s) {
Element.prototype.closest = function (s) {
var el = this;

@@ -170,3 +170,3 @@ do {

/*!
* PatternFly Elements: PFElement 1.9.2
* PatternFly Elements: PFElement 1.9.3
* @license

@@ -204,3 +204,3 @@ * Copyright 2021 Red Hat, Inc.

* @extends HTMLElement
* @version 1.9.2
* @version 1.9.3
* @classdesc Serves as the baseline for all PatternFly Element components.

@@ -317,3 +317,3 @@ */

Content: "content",
Combo: "combo"
Combo: "combo",
};

@@ -326,3 +326,3 @@ }

static get version() {
return "1.9.2";
return "1.9.3";
}

@@ -348,3 +348,3 @@

default: true,
observer: "_upgradeObserver"
observer: "_upgradeObserver",
},

@@ -356,4 +356,4 @@ on: {

values: ["light", "dark", "saturated"],
default: el => el.contextVariable,
observer: "_onObserver"
default: (el) => el.contextVariable,
observer: "_onObserver",
},

@@ -365,3 +365,3 @@ context: {

values: ["light", "dark", "saturated"],
observer: "_contextObserver"
observer: "_contextObserver",
},

@@ -373,3 +373,3 @@ // @TODO: Deprecated with 1.0

alias: "context",
attr: "pfe-theme"
attr: "pfe-theme",
},

@@ -380,3 +380,3 @@ _style: {

attr: "style",
observer: "_inlineStyleObserver"
observer: "_inlineStyleObserver",
},

@@ -386,4 +386,4 @@ type: {

type: String,
values: ["container", "content", "combo"]
}
values: ["container", "content", "combo"],
},
};

@@ -396,4 +396,4 @@ }

const oa = Object.keys(properties)
.filter(prop => properties[prop].observer || properties[prop].cascade || properties[prop].alias)
.map(p => this._convertPropNameToAttrName(p));
.filter((prop) => properties[prop].observer || properties[prop].cascade || properties[prop].alias)
.map((p) => this._convertPropNameToAttrName(p));
return [...oa];

@@ -410,8 +410,3 @@ }

get randomId() {
return (
`${prefix}-` +
Math.random()
.toString(36)
.substr(2, 9)
);
return `${prefix}-` + Math.random().toString(36).substr(2, 9);
}

@@ -458,10 +453,10 @@

return (
[...this.children].filter(child => child.hasAttribute("slot") && child.getAttribute("slot") === name).length >
0
[...this.children].filter((child) => child.hasAttribute("slot") && child.getAttribute("slot") === name)
.length > 0
);
case "array":
return name.reduce(
n =>
[...this.children].filter(child => child.hasAttribute("slot") && child.getAttribute("slot") === n).length >
0
(n) =>
[...this.children].filter((child) => child.hasAttribute("slot") && child.getAttribute("slot") === n)
.length > 0
);

@@ -484,5 +479,5 @@ default:

if (name !== "unassigned") {
return [...this.children].filter(child => child.hasAttribute("slot") && child.getAttribute("slot") === name);
return [...this.children].filter((child) => child.hasAttribute("slot") && child.getAttribute("slot") === name);
} else {
return [...this.children].filter(child => !child.hasAttribute("slot"));
return [...this.children].filter((child) => !child.hasAttribute("slot"));
}

@@ -497,8 +492,3 @@ }

}
return (
window
.getComputedStyle(element)
.getPropertyValue(name)
.trim() || null
);
return window.getComputedStyle(element).getPropertyValue(name).trim() || null;
}

@@ -512,5 +502,5 @@

const lightEls = [...this.querySelectorAll("*")]
.filter(item => item.tagName.toLowerCase().slice(0, 4) === `${prefix}-`)
.filter((item) => item.tagName.toLowerCase().slice(0, 4) === `${prefix}-`)
// Closest will return itself or it's ancestor matching that selector
.filter(item => {
.filter((item) => {
// If there is no parent element, return null

@@ -524,5 +514,5 @@ if (!item.parentElement) return;

let shadowEls = [...this.shadowRoot.querySelectorAll("*")]
.filter(item => item.tagName.toLowerCase().slice(0, 4) === `${prefix}-`)
.filter((item) => item.tagName.toLowerCase().slice(0, 4) === `${prefix}-`)
// Closest will return itself or it's ancestor matching that selector
.filter(item => {
.filter((item) => {
// If there is a parent element and we can find another web component in the ancestor tree

@@ -545,3 +535,3 @@ if (item.parentElement && item.parentElement.closest(`[${this._pfeClass._getCache("prop2attr").pfelement}]`)) {

// Loop over the nested elements and reset their context
nestedEls.map(child => {
nestedEls.map((child) => {
this.log(`Update context of ${child.tagName.toLowerCase()}`);

@@ -727,3 +717,3 @@ Promise.all([customElements.whenDefined(child.tagName.toLowerCase())]).then(() => {

childList: true,
subtree: true
subtree: true,
});

@@ -747,3 +737,3 @@ }

composed,
detail
detail,
})

@@ -767,4 +757,4 @@ );

selectors = [];
[...nodeList].forEach(nodeItem => {
Object.keys(cascade).map(selector => {
[...nodeList].forEach((nodeItem) => {
Object.keys(cascade).map((selector) => {
// if this node has a match function (i.e., it's an HTMLElement, not

@@ -782,4 +772,4 @@ // a text node), see if it matches the selector, otherwise drop it (like it's hot).

const components = selectors
.filter(item => item.slice(0, prefix.length + 1) === `${prefix}-`)
.map(name => customElements.whenDefined(name));
.filter((item) => item.slice(0, prefix.length + 1) === `${prefix}-`)
.map((name) => customElements.whenDefined(name));

@@ -798,3 +788,3 @@ if (components)

childList: true,
subtree: true
subtree: true,
});

@@ -918,3 +908,3 @@ }

NaN: NaN,
undefined: undefined
undefined: undefined,
}[attrValue];

@@ -928,3 +918,3 @@

[attrValue]: attrValue,
undefined: undefined
undefined: undefined,
}[attrValue];

@@ -974,3 +964,3 @@

// Loop over the properties provided by the schema
Object.keys(slots).forEach(slot => {
Object.keys(slots).forEach((slot) => {
let slotObj = slots[slot];

@@ -999,3 +989,3 @@

} else {
result = [...this.children].filter(child => !child.hasAttribute("slot"));
result = [...this.children].filter((child) => !child.hasAttribute("slot"));

@@ -1051,3 +1041,3 @@ if (result.length > 0) {

},
set: rawNewVal => {
set: (rawNewVal) => {
// Assign the value to the attribute

@@ -1060,3 +1050,3 @@ this._assignValueToAttribute(propDef, attrName, rawNewVal);

enumerable: true,
configurable: false
configurable: false,
});

@@ -1148,4 +1138,4 @@ }

.replace(/^_/, "")
.replace(/^[A-Z]/, l => l.toLowerCase())
.replace(/[A-Z]/g, l => `-${l.toLowerCase()}`);
.replace(/^[A-Z]/, (l) => l.toLowerCase())
.replace(/[A-Z]/g, (l) => `-${l.toLowerCase()}`);
}

@@ -1164,3 +1154,3 @@

// Convert the property name to kebab case
const propName = attrName.replace(/-([A-Za-z])/g, l => l[1].toUpperCase());
const propName = attrName.replace(/-([A-Za-z])/g, (l) => l[1].toUpperCase());
return propName;

@@ -1170,4 +1160,4 @@ }

_copyAttributes(selectors, set) {
selectors.forEach(selector => {
set[selector].forEach(attr => {
selectors.forEach((selector) => {
set[selector].forEach((attr) => {
this._copyAttribute(attr, selector);

@@ -1207,3 +1197,3 @@ });

if (cascadeTo)
cascadeTo.map(nodeItem => {
cascadeTo.map((nodeItem) => {
let attr = this._prop2attr(propName);

@@ -1245,3 +1235,3 @@ // Create an object with the node as the key and an array of attributes

attr2prop: {},
prop2attr: {}
prop2attr: {},
};

@@ -1248,0 +1238,0 @@ }

@@ -1,2 +0,2 @@

let t=()=>null;function e(){t("[reveal] web components ready"),t("[reveal] elements ready, revealing the body"),window.document.body.removeAttribute("unresolved")}function s(t){return t.hasOwnProperty("default")&&t.default.constructor===t.type}Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(t,e){if(null==this)throw new TypeError('"this" is null or not defined');var s=Object(this),r=s.length>>>0;if(0===r)return!1;var i,o,a=0|e,n=Math.max(a>=0?a:r-Math.abs(a),0);for(;n<r;){if((i=s[n])===(o=t)||"number"==typeof i&&"number"==typeof o&&isNaN(i)&&isNaN(o))return!0;n++}return!1}}),Object.entries||(Object.entries=function(t){for(var e=Object.keys(t),s=e.length,r=new Array(s);s--;)r[s]=[e[s],t[e[s]]];return r}),String.prototype.startsWith||Object.defineProperty(String.prototype,"startsWith",{value:function(t,e){var s=e>0?0|e:0;return this.substring(s,s+t.length)===t}}),Element.prototype.closest||(Element.prototype.closest=function(t){var e=this;do{if(e.matches(t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null}),Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);class r extends HTMLElement{static debugLog(t=null){if(null!==t)try{localStorage.pfeLog=!!t}catch(e){return r._debugLog=!!t,r._debugLog}return"true"===localStorage.pfeLog||r._debugLog}static trackPerformance(t=null){return null!==t&&(r._trackPerformance=!!t),r._trackPerformance}static get config(){return window.PfeConfig||{}}static log(...t){r.debugLog()&&console.log(...t)}log(...t){r.log(`[${this.tag}${this.id?"#"+this.id:""}]`,...t)}static warn(...t){console.warn(...t)}warn(...t){r.warn(`[${this.tag}${this.id?"#"+this.id:""}]`,...t)}static error(...t){throw new Error([...t].join(" "))}error(...t){r.error(`[${this.tag}${this.id?"#"+this.id:""}]`,...t)}static get PfeTypes(){return{Container:"container",Content:"content",Combo:"combo"}}static get version(){return"1.9.2"}get version(){return this._pfeClass.version}static get properties(){return{pfelement:{title:"Upgraded flag",type:Boolean,default:!0,observer:"_upgradeObserver"},on:{title:"Context",description:"Describes the visual context (backgrounds).",type:String,values:["light","dark","saturated"],default:t=>t.contextVariable,observer:"_onObserver"},context:{title:"Context hook",description:"Lets you override the system-set context.",type:String,values:["light","dark","saturated"],observer:"_contextObserver"},oldTheme:{type:String,values:["light","dark","saturated"],alias:"context",attr:"pfe-theme"},_style:{title:"Custom styles",type:String,attr:"style",observer:"_inlineStyleObserver"},type:{title:"Component type",type:String,values:["container","content","combo"]}}}static get observedAttributes(){const t=this.allProperties;if(t){return[...Object.keys(t).filter(e=>t[e].observer||t[e].cascade||t[e].alias).map(t=>this._convertPropNameToAttrName(t))]}}get randomId(){return"pfe-"+Math.random().toString(36).substr(2,9)}set contextVariable(t){this.cssVariable("context",t)}get contextVariable(){return this.cssVariable("context")||this.cssVariable("theme")}hasLightDOM(){return this.children.length||this.textContent.trim().length}hasSlot(t){if(t)switch(typeof t){case"string":return[...this.children].filter(e=>e.hasAttribute("slot")&&e.getAttribute("slot")===t).length>0;case"array":return t.reduce(t=>[...this.children].filter(e=>e.hasAttribute("slot")&&e.getAttribute("slot")===t).length>0);default:return void this.warn("Did not recognize the type of the name provided to hasSlot; this funciton can accept a string or an array.")}else this.warn("Please provide at least one slot name for which to search.")}getSlot(t="unassigned"){return"unassigned"!==t?[...this.children].filter(e=>e.hasAttribute("slot")&&e.getAttribute("slot")===t):[...this.children].filter(t=>!t.hasAttribute("slot"))}cssVariable(t,e,s=this){return t="--"!==t.substr(0,2)?"--"+t:t,e?(s.style.setProperty(t,e),e):window.getComputedStyle(s).getPropertyValue(t).trim()||null}contextUpdate(){const t=[...this.querySelectorAll("*")].filter(t=>"pfe-"===t.tagName.toLowerCase().slice(0,4)).filter(t=>t.parentElement?t.parentElement.closest(`[${this._pfeClass._getCache("prop2attr").pfelement}]`)===this:void 0);let e=[...this.shadowRoot.querySelectorAll("*")].filter(t=>"pfe-"===t.tagName.toLowerCase().slice(0,4)).filter(t=>t.parentElement&&t.parentElement.closest(`[${this._pfeClass._getCache("prop2attr").pfelement}]`)?t.parentElement.closest(`[${this._pfeClass._getCache("prop2attr").pfelement}]`)===this:t.getRootNode().host===this);const s=t.concat(e);0!==s.length&&s.map(t=>{this.log("Update context of "+t.tagName.toLowerCase()),Promise.all([customElements.whenDefined(t.tagName.toLowerCase())]).then(()=>{t.resetContext(this.on)})})}resetContext(t){if(this.isIE11)return;let e=this.context||this.contextVariable||t;this.on!==e&&(this.on||e)&&(this.log(`Resetting context from ${this.on} to ${e||"null"}`),this.on=e)}constructor(t,{type:e=null,delayRender:s=!1}={}){super(),this._pfeClass=t,this.tag=t.tag,this._parseObserver=this._parseObserver.bind(this),this.isIE11=/MSIE|Trident|Edge\//.test(window.navigator.userAgent),this.id?this.id.startsWith("pfe-")&&!this.id.startsWith(this.tag)?this._markId=this.id.replace("pfe",this.tag):this._markId=`${this.tag}-${this.id}`:this._markId=this.randomId.replace("pfe",this.tag),this._markCount=0,this.schemaProps=t.schemaProperties,this.slots=t.slots,this.template=document.createElement("template"),e&&this._pfeClass.allProperties.type&&(this._pfeClass.allProperties.type.default=e),this._initializeProperties(),this.attachShadow({mode:"open"}),this._rendered=!1,s||this.render()}connectedCallback(){this._initializeAttributeDefaults(),window.ShadyCSS&&window.ShadyCSS.styleElement(this),"object"==typeof this.slots&&(this._slotsObserver=new MutationObserver(()=>this._initializeSlots(this.tag,this.slots)),this._initializeSlots(this.tag,this.slots))}disconnectedCallback(){this._cascadeObserver&&this._cascadeObserver.disconnect(),this._slotsObserver&&this._slotsObserver.disconnect()}attributeChangedCallback(t,e,s){if(!this._pfeClass.allProperties)return;let r=this._pfeClass._attr2prop(t);const i=this._pfeClass.allProperties[r];if(i){if(i.alias){const t=this._pfeClass.allProperties[i.alias],e=this._pfeClass._prop2attr(i.alias);this.getAttribute(e)!==s&&(this[i.alias]=this._castPropertyValue(t,s))}i.observer&&this[i.observer](this._castPropertyValue(i,e),this._castPropertyValue(i,s)),i.cascade&&this._copyAttribute(t,this._pfeClass._convertSelectorsToArray(i.cascade))}}render(){if(this.shadowRoot.innerHTML="",this.template.innerHTML=this.html,window.ShadyCSS&&window.ShadyCSS.prepareTemplate(this.template,this.tag),this.shadowRoot.appendChild(this.template.content.cloneNode(!0)),this.log("render"),this.cascadeProperties(),this.contextUpdate(),r.trackPerformance())try{performance.mark(this._markId+"-rendered"),this._markCount<1&&(this._markCount=this._markCount+1,performance.measure(this._markId+"-from-navigation-to-first-render",void 0,this._markId+"-rendered"),performance.measure(this._markId+"-from-defined-to-first-render",this._markId+"-defined",this._markId+"-rendered"))}catch(t){this.log("Performance marks are not supported by this browser.")}"object"==typeof this.slots&&this._slotsObserver&&this._slotsObserver.observe(this,{childList:!0}),this._cascadeObserver&&this._cascadeObserver.observe(this,{attributes:!0,childList:!0,subtree:!0}),this._rendered=!0}emitEvent(t,{bubbles:e=!0,cancelable:s=!1,composed:r=!0,detail:i={}}={}){i?this.log("Custom event: "+t,i):this.log("Custom event: "+t),this.dispatchEvent(new CustomEvent(t,{bubbles:e,cancelable:s,composed:r,detail:i}))}cascadeProperties(t){const e=this._pfeClass._getCache("cascadingProperties");if(e){this._cascadeObserver&&this._cascadeObserver.disconnect();let s=Object.keys(e);if(t&&(s=[],[...t].forEach(t=>{Object.keys(e).map(e=>{t.matches&&t.matches(e)&&s.push(e)})})),s){const t=s.filter(t=>"pfe-"===t.slice(0,"pfe".length+1)).map(t=>customElements.whenDefined(t));t?Promise.all(t).then(()=>{this._copyAttributes(s,e)}):this._copyAttributes(s,e)}this._rendered&&this._cascadeObserver&&this._cascadeObserver.observe(this,{attributes:!0,childList:!0,subtree:!0})}}_upgradeObserver(){this.classList.add("PFElement")}_contextObserver(t,e){e&&(t&&t!==e||!t)&&(this.log("Running the context observer"),this.on=e,this.cssVariable("context",e))}_onObserver(t,e){(t&&t!==e||e&&!t)&&(this.log("Context update"),this.contextUpdate())}_inlineStyleObserver(t,e){if(t!==e)if(e){this.log("Style observer activated on "+this.tag,""+(e||"null"));let t=/--[\w|-]*(?:context|theme):\s*(?:\"*(light|dark|saturated)\"*)/gi.exec(e);if(!t)return;const s=t[1];s===this.on||this.context||(this.on=s)}else this.resetContext()}_parseObserver(t){for(let e of t)"childList"===e.type&&e.addedNodes.length&&this.cascadeProperties(e.addedNodes)}static _validateProperties(){for(let t in this.allProperties){const e=this.allProperties[t];[String,Number,Boolean].includes(e.type||String)||this.error(`Property "${t}" on ${this.name} must have type String, Number, or Boolean.`),/^[a-z_]/.test(t)||this.error(`Property ${this.name}.${t} defined, but prop names must begin with a lower-case letter or an underscore`);const r="function"==typeof e.default;!e.default||s(e)||r||this.error(`[${this.name}] The default value \`${e.default}\` does not match the assigned type ${e.type.name} for the '${t}' property`)}}_castPropertyValue(t,e){switch(t.type){case Number:return{[e]:Number(e),null:null,NaN:NaN,undefined:void 0}[e];case Boolean:return null!==e;case String:return{[e]:e,undefined:void 0}[e];default:return e}}_assignValueToAttribute(t,e,s){t.type===Boolean&&!s||null===s||void 0===s?this.removeAttribute(e):t.type===Boolean&&"boolean"==typeof s?this.setAttribute(e,""):(t.values&&this._validateAttributeValue(t,e,s),this.setAttribute(e,s))}_initializeSlots(t,e){this.log("Validate slots..."),this._slotsObserver&&this._slotsObserver.disconnect(),Object.keys(e).forEach(s=>{let r=e[s];if("object"==typeof r){let e=!1,i=[];r.namedSlot?(i=this.getSlot(`${t}--${s}`),i.length>0&&(r.nodes=i,e=!0),i=this.getSlot(""+s),i.length>0&&(r.nodes=i,e=!0)):(i=[...this.children].filter(t=>!t.hasAttribute("slot")),i.length>0&&(r.nodes=i,e=!0)),e?this.setAttribute("has_"+s,""):this.removeAttribute("has_"+s)}}),this.log("Slots validated."),this._slotsObserver&&this._slotsObserver.observe(this,{childList:!0})}_initializeProperties(){const t=this._pfeClass.allProperties;let e=!1;Object.keys(t).length>0&&this.log("Initialize properties");for(let s in t){const r=t[s];if(void 0!==this[s])this.log(`Property "${s}" on ${this.constructor.name} cannot be defined because the property name is reserved`);else{const t=this._pfeClass._prop2attr(s);r.cascade&&(e=!0),Object.defineProperty(this,s,{get:()=>{const e=this.getAttribute(t);return this._castPropertyValue(r,e)},set:e=>(this._assignValueToAttribute(r,t,e),e),writeable:!0,enumerable:!0,configurable:!1})}}e&&(this._cascadeObserver=new MutationObserver(this._parseObserver))}_initializeAttributeDefaults(){const t=this._pfeClass.allProperties;for(let e in t){const s=t[e],r=this._pfeClass._prop2attr(e);if(s.hasOwnProperty("default")){let t=s.default;"function"==typeof s.default&&(t=s.default(this)),this.hasAttribute(r)||this._assignValueToAttribute(s,r,t)}}}_validateAttributeValue(t,e,s){return Array.isArray(t.values)&&t.values.length>0&&!t.values.includes(s)&&this.warn(`${s} is not a valid value for ${e}. Please provide one of the following values: ${t.values.join(", ")}`),s}static _prop2attr(t){return this._getCache("prop2attr")[t]}static _attr2prop(t){return this._getCache("attr2prop")[t]}static _convertPropNameToAttrName(t){const e=this.allProperties[t];return e.attr?e.attr:t.replace(/^_/,"").replace(/^[A-Z]/,t=>t.toLowerCase()).replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}static _convertAttrNameToPropName(t){for(let e in this.allProperties)if(this.allProperties[e].attr===t)return e;return t.replace(/-([A-Za-z])/g,t=>t[1].toUpperCase())}_copyAttributes(t,e){t.forEach(t=>{e[t].forEach(e=>{this._copyAttribute(e,t)})})}_copyAttribute(t,e){const s=[...this.querySelectorAll(e),...this.shadowRoot.querySelectorAll(e)],r=this.getAttribute(t),i=null==r?"removeAttribute":"setAttribute";for(const e of s)e[i](t,r)}static _convertSelectorsToArray(t){if(t){if("string"==typeof t)return t.split(",");if("object"==typeof t)return t;this.warn(`selectors should be provided as a string, array, or object; received: ${typeof t}.`)}}static _parsePropertiesForCascade(t){let e={};for(const[s,r]of Object.entries(t)){let t=this._convertSelectorsToArray(r.cascade);t&&t.map(t=>{let r=this._prop2attr(s);e[t]?e[t].push(r):e[t]=[r]})}return e}static create(t){if(t._createCache(),t._populateCache(t),t._validateProperties(),window.customElements.define(t.tag,t),r.trackPerformance())try{performance.mark(this._markId+"-defined")}catch(t){this.log("Performance marks are not supported by this browser.")}}static _createCache(){this._cache={properties:{},globalProperties:{},componentProperties:{},cascadingProperties:{},attr2prop:{},prop2attr:{}}}static _setCache(t,e){this._cache[t]=e}static _getCache(t){return t?this._cache[t]:this._cache}static _populateCache(t){const e={...t.properties,...r.properties};t._setCache("componentProperties",t.properties),t._setCache("globalProperties",r.properties),t._setCache("properties",e);const s={},i={};for(let t in e){const e=this._convertPropNameToAttrName(t);s[t]=e,i[e]=t}t._setCache("attr2prop",i),t._setCache("prop2attr",s);const o=this._parsePropertiesForCascade(e);Object.keys(o)&&t._setCache("cascadingProperties",o)}static get allProperties(){return this._getCache("properties")}static get cascadingProperties(){return this._getCache("cascadingProperties")}}!function(s){t=s;const r=window.WebComponents,i=r&&window.WebComponents.ready;!r||i?e():window.addEventListener("WebComponentsReady",e)}(r.log);export default r;
let t=()=>null;function e(){t("[reveal] web components ready"),t("[reveal] elements ready, revealing the body"),window.document.body.removeAttribute("unresolved")}function s(t){return t.hasOwnProperty("default")&&t.default.constructor===t.type}Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(t,e){if(null==this)throw new TypeError('"this" is null or not defined');var s=Object(this),r=s.length>>>0;if(0===r)return!1;var i,o,a=0|e,n=Math.max(a>=0?a:r-Math.abs(a),0);for(;n<r;){if((i=s[n])===(o=t)||"number"==typeof i&&"number"==typeof o&&isNaN(i)&&isNaN(o))return!0;n++}return!1}}),Object.entries||(Object.entries=function(t){for(var e=Object.keys(t),s=e.length,r=new Array(s);s--;)r[s]=[e[s],t[e[s]]];return r}),String.prototype.startsWith||Object.defineProperty(String.prototype,"startsWith",{value:function(t,e){var s=e>0?0|e:0;return this.substring(s,s+t.length)===t}}),Element.prototype.closest||(Element.prototype.closest=function(t){var e=this;do{if(e.matches(t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null}),Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);class r extends HTMLElement{static debugLog(t=null){if(null!==t)try{localStorage.pfeLog=!!t}catch(e){return r._debugLog=!!t,r._debugLog}return"true"===localStorage.pfeLog||r._debugLog}static trackPerformance(t=null){return null!==t&&(r._trackPerformance=!!t),r._trackPerformance}static get config(){return window.PfeConfig||{}}static log(...t){r.debugLog()&&console.log(...t)}log(...t){r.log(`[${this.tag}${this.id?"#"+this.id:""}]`,...t)}static warn(...t){console.warn(...t)}warn(...t){r.warn(`[${this.tag}${this.id?"#"+this.id:""}]`,...t)}static error(...t){throw new Error([...t].join(" "))}error(...t){r.error(`[${this.tag}${this.id?"#"+this.id:""}]`,...t)}static get PfeTypes(){return{Container:"container",Content:"content",Combo:"combo"}}static get version(){return"1.9.3"}get version(){return this._pfeClass.version}static get properties(){return{pfelement:{title:"Upgraded flag",type:Boolean,default:!0,observer:"_upgradeObserver"},on:{title:"Context",description:"Describes the visual context (backgrounds).",type:String,values:["light","dark","saturated"],default:t=>t.contextVariable,observer:"_onObserver"},context:{title:"Context hook",description:"Lets you override the system-set context.",type:String,values:["light","dark","saturated"],observer:"_contextObserver"},oldTheme:{type:String,values:["light","dark","saturated"],alias:"context",attr:"pfe-theme"},_style:{title:"Custom styles",type:String,attr:"style",observer:"_inlineStyleObserver"},type:{title:"Component type",type:String,values:["container","content","combo"]}}}static get observedAttributes(){const t=this.allProperties;if(t){return[...Object.keys(t).filter(e=>t[e].observer||t[e].cascade||t[e].alias).map(t=>this._convertPropNameToAttrName(t))]}}get randomId(){return"pfe-"+Math.random().toString(36).substr(2,9)}set contextVariable(t){this.cssVariable("context",t)}get contextVariable(){return this.cssVariable("context")||this.cssVariable("theme")}hasLightDOM(){return this.children.length||this.textContent.trim().length}hasSlot(t){if(t)switch(typeof t){case"string":return[...this.children].filter(e=>e.hasAttribute("slot")&&e.getAttribute("slot")===t).length>0;case"array":return t.reduce(t=>[...this.children].filter(e=>e.hasAttribute("slot")&&e.getAttribute("slot")===t).length>0);default:return void this.warn("Did not recognize the type of the name provided to hasSlot; this funciton can accept a string or an array.")}else this.warn("Please provide at least one slot name for which to search.")}getSlot(t="unassigned"){return"unassigned"!==t?[...this.children].filter(e=>e.hasAttribute("slot")&&e.getAttribute("slot")===t):[...this.children].filter(t=>!t.hasAttribute("slot"))}cssVariable(t,e,s=this){return t="--"!==t.substr(0,2)?"--"+t:t,e?(s.style.setProperty(t,e),e):window.getComputedStyle(s).getPropertyValue(t).trim()||null}contextUpdate(){const t=[...this.querySelectorAll("*")].filter(t=>"pfe-"===t.tagName.toLowerCase().slice(0,4)).filter(t=>t.parentElement?t.parentElement.closest(`[${this._pfeClass._getCache("prop2attr").pfelement}]`)===this:void 0);let e=[...this.shadowRoot.querySelectorAll("*")].filter(t=>"pfe-"===t.tagName.toLowerCase().slice(0,4)).filter(t=>t.parentElement&&t.parentElement.closest(`[${this._pfeClass._getCache("prop2attr").pfelement}]`)?t.parentElement.closest(`[${this._pfeClass._getCache("prop2attr").pfelement}]`)===this:t.getRootNode().host===this);const s=t.concat(e);0!==s.length&&s.map(t=>{this.log("Update context of "+t.tagName.toLowerCase()),Promise.all([customElements.whenDefined(t.tagName.toLowerCase())]).then(()=>{t.resetContext(this.on)})})}resetContext(t){if(this.isIE11)return;let e=this.context||this.contextVariable||t;this.on!==e&&(this.on||e)&&(this.log(`Resetting context from ${this.on} to ${e||"null"}`),this.on=e)}constructor(t,{type:e=null,delayRender:s=!1}={}){super(),this._pfeClass=t,this.tag=t.tag,this._parseObserver=this._parseObserver.bind(this),this.isIE11=/MSIE|Trident|Edge\//.test(window.navigator.userAgent),this.id?this.id.startsWith("pfe-")&&!this.id.startsWith(this.tag)?this._markId=this.id.replace("pfe",this.tag):this._markId=`${this.tag}-${this.id}`:this._markId=this.randomId.replace("pfe",this.tag),this._markCount=0,this.schemaProps=t.schemaProperties,this.slots=t.slots,this.template=document.createElement("template"),e&&this._pfeClass.allProperties.type&&(this._pfeClass.allProperties.type.default=e),this._initializeProperties(),this.attachShadow({mode:"open"}),this._rendered=!1,s||this.render()}connectedCallback(){this._initializeAttributeDefaults(),window.ShadyCSS&&window.ShadyCSS.styleElement(this),"object"==typeof this.slots&&(this._slotsObserver=new MutationObserver(()=>this._initializeSlots(this.tag,this.slots)),this._initializeSlots(this.tag,this.slots))}disconnectedCallback(){this._cascadeObserver&&this._cascadeObserver.disconnect(),this._slotsObserver&&this._slotsObserver.disconnect()}attributeChangedCallback(t,e,s){if(!this._pfeClass.allProperties)return;let r=this._pfeClass._attr2prop(t);const i=this._pfeClass.allProperties[r];if(i){if(i.alias){const t=this._pfeClass.allProperties[i.alias],e=this._pfeClass._prop2attr(i.alias);this.getAttribute(e)!==s&&(this[i.alias]=this._castPropertyValue(t,s))}i.observer&&this[i.observer](this._castPropertyValue(i,e),this._castPropertyValue(i,s)),i.cascade&&this._copyAttribute(t,this._pfeClass._convertSelectorsToArray(i.cascade))}}render(){if(this.shadowRoot.innerHTML="",this.template.innerHTML=this.html,window.ShadyCSS&&window.ShadyCSS.prepareTemplate(this.template,this.tag),this.shadowRoot.appendChild(this.template.content.cloneNode(!0)),this.log("render"),this.cascadeProperties(),this.contextUpdate(),r.trackPerformance())try{performance.mark(this._markId+"-rendered"),this._markCount<1&&(this._markCount=this._markCount+1,performance.measure(this._markId+"-from-navigation-to-first-render",void 0,this._markId+"-rendered"),performance.measure(this._markId+"-from-defined-to-first-render",this._markId+"-defined",this._markId+"-rendered"))}catch(t){this.log("Performance marks are not supported by this browser.")}"object"==typeof this.slots&&this._slotsObserver&&this._slotsObserver.observe(this,{childList:!0}),this._cascadeObserver&&this._cascadeObserver.observe(this,{attributes:!0,childList:!0,subtree:!0}),this._rendered=!0}emitEvent(t,{bubbles:e=!0,cancelable:s=!1,composed:r=!0,detail:i={}}={}){i?this.log("Custom event: "+t,i):this.log("Custom event: "+t),this.dispatchEvent(new CustomEvent(t,{bubbles:e,cancelable:s,composed:r,detail:i}))}cascadeProperties(t){const e=this._pfeClass._getCache("cascadingProperties");if(e){this._cascadeObserver&&this._cascadeObserver.disconnect();let s=Object.keys(e);if(t&&(s=[],[...t].forEach(t=>{Object.keys(e).map(e=>{t.matches&&t.matches(e)&&s.push(e)})})),s){const t=s.filter(t=>"pfe-"===t.slice(0,"pfe".length+1)).map(t=>customElements.whenDefined(t));t?Promise.all(t).then(()=>{this._copyAttributes(s,e)}):this._copyAttributes(s,e)}this._rendered&&this._cascadeObserver&&this._cascadeObserver.observe(this,{attributes:!0,childList:!0,subtree:!0})}}_upgradeObserver(){this.classList.add("PFElement")}_contextObserver(t,e){e&&(t&&t!==e||!t)&&(this.log("Running the context observer"),this.on=e,this.cssVariable("context",e))}_onObserver(t,e){(t&&t!==e||e&&!t)&&(this.log("Context update"),this.contextUpdate())}_inlineStyleObserver(t,e){if(t!==e)if(e){this.log("Style observer activated on "+this.tag,""+(e||"null"));let t=/--[\w|-]*(?:context|theme):\s*(?:\"*(light|dark|saturated)\"*)/gi.exec(e);if(!t)return;const s=t[1];s===this.on||this.context||(this.on=s)}else this.resetContext()}_parseObserver(t){for(let e of t)"childList"===e.type&&e.addedNodes.length&&this.cascadeProperties(e.addedNodes)}static _validateProperties(){for(let t in this.allProperties){const e=this.allProperties[t];[String,Number,Boolean].includes(e.type||String)||this.error(`Property "${t}" on ${this.name} must have type String, Number, or Boolean.`),/^[a-z_]/.test(t)||this.error(`Property ${this.name}.${t} defined, but prop names must begin with a lower-case letter or an underscore`);const r="function"==typeof e.default;!e.default||s(e)||r||this.error(`[${this.name}] The default value \`${e.default}\` does not match the assigned type ${e.type.name} for the '${t}' property`)}}_castPropertyValue(t,e){switch(t.type){case Number:return{[e]:Number(e),null:null,NaN:NaN,undefined:void 0}[e];case Boolean:return null!==e;case String:return{[e]:e,undefined:void 0}[e];default:return e}}_assignValueToAttribute(t,e,s){t.type===Boolean&&!s||null===s||void 0===s?this.removeAttribute(e):t.type===Boolean&&"boolean"==typeof s?this.setAttribute(e,""):(t.values&&this._validateAttributeValue(t,e,s),this.setAttribute(e,s))}_initializeSlots(t,e){this.log("Validate slots..."),this._slotsObserver&&this._slotsObserver.disconnect(),Object.keys(e).forEach(s=>{let r=e[s];if("object"==typeof r){let e=!1,i=[];r.namedSlot?(i=this.getSlot(`${t}--${s}`),i.length>0&&(r.nodes=i,e=!0),i=this.getSlot(""+s),i.length>0&&(r.nodes=i,e=!0)):(i=[...this.children].filter(t=>!t.hasAttribute("slot")),i.length>0&&(r.nodes=i,e=!0)),e?this.setAttribute("has_"+s,""):this.removeAttribute("has_"+s)}}),this.log("Slots validated."),this._slotsObserver&&this._slotsObserver.observe(this,{childList:!0})}_initializeProperties(){const t=this._pfeClass.allProperties;let e=!1;Object.keys(t).length>0&&this.log("Initialize properties");for(let s in t){const r=t[s];if(void 0!==this[s])this.log(`Property "${s}" on ${this.constructor.name} cannot be defined because the property name is reserved`);else{const t=this._pfeClass._prop2attr(s);r.cascade&&(e=!0),Object.defineProperty(this,s,{get:()=>{const e=this.getAttribute(t);return this._castPropertyValue(r,e)},set:e=>(this._assignValueToAttribute(r,t,e),e),writeable:!0,enumerable:!0,configurable:!1})}}e&&(this._cascadeObserver=new MutationObserver(this._parseObserver))}_initializeAttributeDefaults(){const t=this._pfeClass.allProperties;for(let e in t){const s=t[e],r=this._pfeClass._prop2attr(e);if(s.hasOwnProperty("default")){let t=s.default;"function"==typeof s.default&&(t=s.default(this)),this.hasAttribute(r)||this._assignValueToAttribute(s,r,t)}}}_validateAttributeValue(t,e,s){return Array.isArray(t.values)&&t.values.length>0&&!t.values.includes(s)&&this.warn(`${s} is not a valid value for ${e}. Please provide one of the following values: ${t.values.join(", ")}`),s}static _prop2attr(t){return this._getCache("prop2attr")[t]}static _attr2prop(t){return this._getCache("attr2prop")[t]}static _convertPropNameToAttrName(t){const e=this.allProperties[t];return e.attr?e.attr:t.replace(/^_/,"").replace(/^[A-Z]/,t=>t.toLowerCase()).replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}static _convertAttrNameToPropName(t){for(let e in this.allProperties)if(this.allProperties[e].attr===t)return e;return t.replace(/-([A-Za-z])/g,t=>t[1].toUpperCase())}_copyAttributes(t,e){t.forEach(t=>{e[t].forEach(e=>{this._copyAttribute(e,t)})})}_copyAttribute(t,e){const s=[...this.querySelectorAll(e),...this.shadowRoot.querySelectorAll(e)],r=this.getAttribute(t),i=null==r?"removeAttribute":"setAttribute";for(const e of s)e[i](t,r)}static _convertSelectorsToArray(t){if(t){if("string"==typeof t)return t.split(",");if("object"==typeof t)return t;this.warn(`selectors should be provided as a string, array, or object; received: ${typeof t}.`)}}static _parsePropertiesForCascade(t){let e={};for(const[s,r]of Object.entries(t)){let t=this._convertSelectorsToArray(r.cascade);t&&t.map(t=>{let r=this._prop2attr(s);e[t]?e[t].push(r):e[t]=[r]})}return e}static create(t){if(t._createCache(),t._populateCache(t),t._validateProperties(),window.customElements.define(t.tag,t),r.trackPerformance())try{performance.mark(this._markId+"-defined")}catch(t){this.log("Performance marks are not supported by this browser.")}}static _createCache(){this._cache={properties:{},globalProperties:{},componentProperties:{},cascadingProperties:{},attr2prop:{},prop2attr:{}}}static _setCache(t,e){this._cache[t]=e}static _getCache(t){return t?this._cache[t]:this._cache}static _populateCache(t){const e={...t.properties,...r.properties};t._setCache("componentProperties",t.properties),t._setCache("globalProperties",r.properties),t._setCache("properties",e);const s={},i={};for(let t in e){const e=this._convertPropNameToAttrName(t);s[t]=e,i[e]=t}t._setCache("attr2prop",i),t._setCache("prop2attr",s);const o=this._parsePropertiesForCascade(e);Object.keys(o)&&t._setCache("cascadingProperties",o)}static get allProperties(){return this._getCache("properties")}static get cascadingProperties(){return this._getCache("cascadingProperties")}}!function(s){t=s;const r=window.WebComponents,i=r&&window.WebComponents.ready;!r||i?e():window.addEventListener("WebComponentsReady",e)}(r.log);export default r;
//# sourceMappingURL=pfelement.min.js.map

@@ -304,3 +304,3 @@ (function (global, factory) {

/*!
* PatternFly Elements: PFElement 1.9.2
* PatternFly Elements: PFElement 1.9.3
* @license

@@ -338,3 +338,3 @@ * Copyright 2021 Red Hat, Inc.

* @extends HTMLElement
* @version 1.9.2
* @version 1.9.3
* @classdesc Serves as the baseline for all PatternFly Element components.

@@ -718,3 +718,3 @@ */

get: function get() {
return "1.9.2";
return "1.9.3";
}

@@ -721,0 +721,0 @@ }, {

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).PFElement=t()}(this,function(){"use strict";var r=function(){return null};function n(){r("[reveal] web components ready"),r("[reveal] elements ready, revealing the body"),window.document.body.removeAttribute("unresolved")}Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(e,t){if(null==this)throw new TypeError('"this" is null or not defined');var r=Object(this),n=r.length>>>0;if(0==n)return!1;var o,a,t=0|t,i=Math.max(0<=t?t:n-Math.abs(t),0);for(;i<n;){if((o=r[i])===(a=e)||"number"==typeof o&&"number"==typeof a&&isNaN(o)&&isNaN(a))return!0;i++}return!1}}),Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),r=t.length,n=new Array(r);r--;)n[r]=[t[r],e[t[r]]];return n}),String.prototype.startsWith||Object.defineProperty(String.prototype,"startsWith",{value:function(e,t){t=0<t?0|t:0;return this.substring(t,t+e.length)===e}}),Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;do{if(t.matches(e))return t}while(null!==(t=t.parentElement||t.parentNode)&&1===t.nodeType);return null}),Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e=function(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e};function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},h=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},p="pfe",e=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(f,HTMLElement),e(f,[{key:"log",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];f.log.apply(f,["["+this.tag+(this.id?"#"+this.id:"")+"]"].concat(t))}},{key:"warn",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];f.warn.apply(f,["["+this.tag+(this.id?"#"+this.id:"")+"]"].concat(t))}},{key:"error",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];f.error.apply(f,["["+this.tag+(this.id?"#"+this.id:"")+"]"].concat(t))}},{key:"hasLightDOM",value:function(){return this.children.length||this.textContent.trim().length}},{key:"hasSlot",value:function(t){var e=this;if(t)switch(void 0===t?"undefined":s(t)){case"string":return 0<[].concat(c(this.children)).filter(function(e){return e.hasAttribute("slot")&&e.getAttribute("slot")===t}).length;case"array":return t.reduce(function(t){return 0<[].concat(c(e.children)).filter(function(e){return e.hasAttribute("slot")&&e.getAttribute("slot")===t}).length});default:return void this.warn("Did not recognize the type of the name provided to hasSlot; this funciton can accept a string or an array.")}else this.warn("Please provide at least one slot name for which to search.")}},{key:"getSlot",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"unassigned";return"unassigned"!==t?[].concat(c(this.children)).filter(function(e){return e.hasAttribute("slot")&&e.getAttribute("slot")===t}):[].concat(c(this.children)).filter(function(e){return!e.hasAttribute("slot")})}},{key:"cssVariable",value:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:this;return e="--"!==e.substr(0,2)?"--"+e:e,t?(r.style.setProperty(e,t),t):window.getComputedStyle(r).getPropertyValue(e).trim()||null}},{key:"contextUpdate",value:function(){var t=this,e=[].concat(c(this.querySelectorAll("*"))).filter(function(e){return e.tagName.toLowerCase().slice(0,4)===p+"-"}).filter(function(e){return e.parentElement?e.parentElement.closest("["+t._pfeClass._getCache("prop2attr").pfelement+"]")===t:void 0}),r=[].concat(c(this.shadowRoot.querySelectorAll("*"))).filter(function(e){return e.tagName.toLowerCase().slice(0,4)===p+"-"}).filter(function(e){return e.parentElement&&e.parentElement.closest("["+t._pfeClass._getCache("prop2attr").pfelement+"]")?e.parentElement.closest("["+t._pfeClass._getCache("prop2attr").pfelement+"]")===t:e.getRootNode().host===t}),r=e.concat(r);0!==r.length&&r.map(function(e){t.log("Update context of "+e.tagName.toLowerCase()),Promise.all([customElements.whenDefined(e.tagName.toLowerCase())]).then(function(){e.resetContext(t.on)})})}},{key:"resetContext",value:function(e){this.isIE11||(e=this.context||this.contextVariable||e,this.on!==e&&(this.on||e)&&(this.log("Resetting context from "+this.on+" to "+(e||"null")),this.on=e))}},{key:"version",get:function(){return this._pfeClass.version}},{key:"randomId",get:function(){return p+"-"+Math.random().toString(36).substr(2,9)}},{key:"contextVariable",set:function(e){this.cssVariable("context",e)},get:function(){return this.cssVariable("context")||this.cssVariable("theme")}}],[{key:"debugLog",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null;if(null!==t)try{localStorage.pfeLog=!!t}catch(e){return f._debugLog=!!t,f._debugLog}return"true"===localStorage.pfeLog||f._debugLog}},{key:"trackPerformance",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null;return null!==e&&(f._trackPerformance=!!e),f._trackPerformance}},{key:"log",value:function(){var e;f.debugLog()&&(e=console).log.apply(e,arguments)}},{key:"warn",value:function(){var e;(e=console).warn.apply(e,arguments)}},{key:"error",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];throw new Error([].concat(t).join(" "))}},{key:"config",get:function(){return window.PfeConfig||{}}},{key:"PfeTypes",get:function(){return{Container:"container",Content:"content",Combo:"combo"}}},{key:"version",get:function(){return"1.9.2"}},{key:"properties",get:function(){return{pfelement:{title:"Upgraded flag",type:Boolean,default:!0,observer:"_upgradeObserver"},on:{title:"Context",description:"Describes the visual context (backgrounds).",type:String,values:["light","dark","saturated"],default:function(e){return e.contextVariable},observer:"_onObserver"},context:{title:"Context hook",description:"Lets you override the system-set context.",type:String,values:["light","dark","saturated"],observer:"_contextObserver"},oldTheme:{type:String,values:["light","dark","saturated"],alias:"context",attr:"pfe-theme"},_style:{title:"Custom styles",type:String,attr:"style",observer:"_inlineStyleObserver"},type:{title:"Component type",type:String,values:["container","content","combo"]}}}},{key:"observedAttributes",get:function(){var t=this,r=this.allProperties;if(r){var e=Object.keys(r).filter(function(e){return r[e].observer||r[e].cascade||r[e].alias}).map(function(e){return t._convertPropNameToAttrName(e)});return[].concat(c(e))}}}]),e(f,[{key:"connectedCallback",value:function(){var e=this;this._initializeAttributeDefaults(),window.ShadyCSS&&window.ShadyCSS.styleElement(this),"object"===s(this.slots)&&(this._slotsObserver=new MutationObserver(function(){return e._initializeSlots(e.tag,e.slots)}),this._initializeSlots(this.tag,this.slots))}},{key:"disconnectedCallback",value:function(){this._cascadeObserver&&this._cascadeObserver.disconnect(),this._slotsObserver&&this._slotsObserver.disconnect()}},{key:"attributeChangedCallback",value:function(e,t,r){var n,o,a;this._pfeClass.allProperties&&(a=this._pfeClass._attr2prop(e),(n=this._pfeClass.allProperties[a])&&(n.alias&&(o=this._pfeClass.allProperties[n.alias],a=this._pfeClass._prop2attr(n.alias),this.getAttribute(a)!==r&&(this[n.alias]=this._castPropertyValue(o,r))),n.observer&&this[n.observer](this._castPropertyValue(n,t),this._castPropertyValue(n,r)),n.cascade&&this._copyAttribute(e,this._pfeClass._convertSelectorsToArray(n.cascade))))}},{key:"render",value:function(){if(this.shadowRoot.innerHTML="",this.template.innerHTML=this.html,window.ShadyCSS&&window.ShadyCSS.prepareTemplate(this.template,this.tag),this.shadowRoot.appendChild(this.template.content.cloneNode(!0)),this.log("render"),this.cascadeProperties(),this.contextUpdate(),f.trackPerformance())try{performance.mark(this._markId+"-rendered"),this._markCount<1&&(this._markCount=this._markCount+1,performance.measure(this._markId+"-from-navigation-to-first-render",void 0,this._markId+"-rendered"),performance.measure(this._markId+"-from-defined-to-first-render",this._markId+"-defined",this._markId+"-rendered"))}catch(e){this.log("Performance marks are not supported by this browser.")}"object"===s(this.slots)&&this._slotsObserver&&this._slotsObserver.observe(this,{childList:!0}),this._cascadeObserver&&this._cascadeObserver.observe(this,{attributes:!0,childList:!0,subtree:!0}),this._rendered=!0}},{key:"emitEvent",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=t.bubbles,n=void 0===r||r,o=t.cancelable,r=void 0!==o&&o,o=t.composed,o=void 0===o||o,t=t.detail,t=void 0===t?{}:t;t?this.log("Custom event: "+e,t):this.log("Custom event: "+e),this.dispatchEvent(new CustomEvent(e,{bubbles:n,cancelable:r,composed:o,detail:t}))}},{key:"cascadeProperties",value:function(e){var r,t=this,n=this._pfeClass._getCache("cascadingProperties");n&&(this._cascadeObserver&&this._cascadeObserver.disconnect(),r=Object.keys(n),e&&(r=[],[].concat(c(e)).forEach(function(t){Object.keys(n).map(function(e){t.matches&&t.matches(e)&&r.push(e)})})),r&&((e=r.filter(function(e){return e.slice(0,p.length+1)===p+"-"}).map(function(e){return customElements.whenDefined(e)}))?Promise.all(e).then(function(){t._copyAttributes(r,n)}):this._copyAttributes(r,n)),this._rendered&&this._cascadeObserver&&this._cascadeObserver.observe(this,{attributes:!0,childList:!0,subtree:!0}))}},{key:"_upgradeObserver",value:function(){this.classList.add("PFElement")}},{key:"_contextObserver",value:function(e,t){t&&(e&&e!==t||!e)&&(this.log("Running the context observer"),this.on=t,this.cssVariable("context",t))}},{key:"_onObserver",value:function(e,t){(e&&e!==t||t&&!e)&&(this.log("Context update"),this.contextUpdate())}},{key:"_inlineStyleObserver",value:function(e,t){e!==t&&(t?(this.log("Style observer activated on "+this.tag,""+(t||"null")),(t=/--[\w|-]*(?:context|theme):\s*(?:\"*(light|dark|saturated)\"*)/gi.exec(t))&&((t=t[1])===this.on||this.context||(this.on=t))):this.resetContext())}},{key:"_parseObserver",value:function(e){var t=!0,r=!1,n=void 0;try{for(var o,a=e[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var i=o.value;"childList"===i.type&&i.addedNodes.length&&this.cascadeProperties(i.addedNodes)}}catch(e){r=!0,n=e}finally{try{!t&&a.return&&a.return()}finally{if(r)throw n}}}},{key:"_castPropertyValue",value:function(e,t){var r;switch(e.type){case Number:return i(r={},t,Number(t)),i(r,"null",null),i(r,"NaN",NaN),i(r,"undefined",void 0),r[t];case Boolean:return null!==t;case String:return i(r={},t,t),i(r,"undefined",void 0),r[t];default:return t}}},{key:"_assignValueToAttribute",value:function(e,t,r){e.type===Boolean&&!r||null===r||void 0===r?this.removeAttribute(t):e.type===Boolean&&"boolean"==typeof r?this.setAttribute(t,""):(e.values&&this._validateAttributeValue(e,t,r),this.setAttribute(t,r))}},{key:"_initializeSlots",value:function(o,a){var i=this;this.log("Validate slots..."),this._slotsObserver&&this._slotsObserver.disconnect(),Object.keys(a).forEach(function(e){var t,r,n=a[e];"object"===(void 0===n?"undefined":s(n))&&(t=!1,r=[],n.namedSlot?(0<(r=i.getSlot(o+"--"+e)).length&&(n.nodes=r,t=!0),0<(r=i.getSlot(""+e)).length&&(n.nodes=r,t=!0)):0<(r=[].concat(c(i.children)).filter(function(e){return!e.hasAttribute("slot")})).length&&(n.nodes=r,t=!0),t?i.setAttribute("has_"+e,""):i.removeAttribute("has_"+e))}),this.log("Slots validated."),this._slotsObserver&&this._slotsObserver.observe(this,{childList:!0})}},{key:"_initializeProperties",value:function(){var n=this,o=this._pfeClass.allProperties,a=!1;0<Object.keys(o).length&&this.log("Initialize properties");for(var e in o)!function(e){var t,r=o[e];void 0!==n[e]?n.log('Property "'+e+'" on '+n.constructor.name+" cannot be defined because the property name is reserved"):(t=n._pfeClass._prop2attr(e),r.cascade&&(a=!0),Object.defineProperty(n,e,{get:function(){var e=n.getAttribute(t);return n._castPropertyValue(r,e)},set:function(e){return n._assignValueToAttribute(r,t,e),e},writeable:!0,enumerable:!0,configurable:!1}))}(e);a&&(this._cascadeObserver=new MutationObserver(this._parseObserver))}},{key:"_initializeAttributeDefaults",value:function(){var e,t=this._pfeClass.allProperties;for(e in t){var r,n=t[e],o=this._pfeClass._prop2attr(e);n.hasOwnProperty("default")&&(r=n.default,"function"==typeof n.default&&(r=n.default(this)),this.hasAttribute(o)||this._assignValueToAttribute(n,o,r))}}},{key:"_validateAttributeValue",value:function(e,t,r){return Array.isArray(e.values)&&0<e.values.length&&!e.values.includes(r)&&this.warn(r+" is not a valid value for "+t+". Please provide one of the following values: "+e.values.join(", ")),r}},{key:"_copyAttributes",value:function(e,r){var n=this;e.forEach(function(t){r[t].forEach(function(e){n._copyAttribute(e,t)})})}},{key:"_copyAttribute",value:function(e,t){var r=[].concat(c(this.querySelectorAll(t)),c(this.shadowRoot.querySelectorAll(t))),n=this.getAttribute(e),o=null==n?"removeAttribute":"setAttribute",a=!0,i=!1,t=void 0;try{for(var s,l=r[Symbol.iterator]();!(a=(s=l.next()).done);a=!0)s.value[o](e,n)}catch(e){i=!0,t=e}finally{try{!a&&l.return&&l.return()}finally{if(i)throw t}}}}],[{key:"_validateProperties",value:function(){for(var e in this.allProperties){var t=this.allProperties[e];[String,Number,Boolean].includes(t.type||String)||this.error('Property "'+e+'" on '+this.name+" must have type String, Number, or Boolean."),/^[a-z_]/.test(e)||this.error("Property "+this.name+"."+e+" defined, but prop names must begin with a lower-case letter or an underscore");var r="function"==typeof t.default;!t.default||(n=t).hasOwnProperty("default")&&n.default.constructor===n.type||r||this.error("["+this.name+"] The default value `"+t.default+"` does not match the assigned type "+t.type.name+" for the '"+e+"' property")}var n}},{key:"_prop2attr",value:function(e){return this._getCache("prop2attr")[e]}},{key:"_attr2prop",value:function(e){return this._getCache("attr2prop")[e]}},{key:"_convertPropNameToAttrName",value:function(e){var t=this.allProperties[e];return t.attr||e.replace(/^_/,"").replace(/^[A-Z]/,function(e){return e.toLowerCase()}).replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}},{key:"_convertAttrNameToPropName",value:function(e){for(var t in this.allProperties)if(this.allProperties[t].attr===e)return t;return e.replace(/-([A-Za-z])/g,function(e){return e[1].toUpperCase()})}},{key:"_convertSelectorsToArray",value:function(e){if(e){if("string"==typeof e)return e.split(",");if("object"===(void 0===e?"undefined":s(e)))return e;this.warn("selectors should be provided as a string, array, or object; received: "+(void 0===e?"undefined":s(e))+".")}}},{key:"_parsePropertiesForCascade",value:function(e){var n=this,o={},t=!0,r=!1,a=void 0;try{for(var i,s=Object.entries(e)[Symbol.iterator]();!(t=(i=s.next()).done);t=!0){var l=i.value,c=h(l,2);!function(r,e){e=n._convertSelectorsToArray(e.cascade);e&&e.map(function(e){var t=n._prop2attr(r);o[e]?o[e].push(t):o[e]=[t]})}(c[0],c[1])}}catch(e){r=!0,a=e}finally{try{!t&&s.return&&s.return()}finally{if(r)throw a}}return o}},{key:"create",value:function(e){if(e._createCache(),e._populateCache(e),e._validateProperties(),window.customElements.define(e.tag,e),f.trackPerformance())try{performance.mark(this._markId+"-defined")}catch(e){this.log("Performance marks are not supported by this browser.")}}},{key:"_createCache",value:function(){this._cache={properties:{},globalProperties:{},componentProperties:{},cascadingProperties:{},attr2prop:{},prop2attr:{}}}},{key:"_setCache",value:function(e,t){this._cache[e]=t}},{key:"_getCache",value:function(e){return e?this._cache[e]:this._cache}},{key:"_populateCache",value:function(e){var t=l({},e.properties,f.properties);e._setCache("componentProperties",e.properties),e._setCache("globalProperties",f.properties),e._setCache("properties",t);var r,n={},o={};for(r in t){var a=this._convertPropNameToAttrName(r);o[n[r]=a]=r}e._setCache("attr2prop",o),e._setCache("prop2attr",n);t=this._parsePropertiesForCascade(t);Object.keys(t)&&e._setCache("cascadingProperties",t)}},{key:"allProperties",get:function(){return this._getCache("properties")}},{key:"cascadingProperties",get:function(){return this._getCache("cascadingProperties")}}]),f);function f(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=t.type,n=void 0===r?null:r,r=t.delayRender,t=void 0!==r&&r;o(this,f);r=u(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));return r._pfeClass=e,r.tag=e.tag,r._parseObserver=r._parseObserver.bind(r),r.isIE11=/MSIE|Trident|Edge\//.test(window.navigator.userAgent),r.id?r.id.startsWith("pfe-")&&!r.id.startsWith(r.tag)?r._markId=r.id.replace("pfe",r.tag):r._markId=r.tag+"-"+r.id:r._markId=r.randomId.replace("pfe",r.tag),r._markCount=0,r.schemaProps=e.schemaProperties,r.slots=e.slots,r.template=document.createElement("template"),n&&r._pfeClass.allProperties.type&&(r._pfeClass.allProperties.type.default=n),r._initializeProperties(),r.attachShadow({mode:"open"}),r._rendered=!1,t||r.render(),r}return function(e){r=e;var t=window.WebComponents,e=t&&window.WebComponents.ready;!t||e?n():window.addEventListener("WebComponentsReady",n)}(e.log),e});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).PFElement=t()}(this,function(){"use strict";var r=function(){return null};function n(){r("[reveal] web components ready"),r("[reveal] elements ready, revealing the body"),window.document.body.removeAttribute("unresolved")}Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(e,t){if(null==this)throw new TypeError('"this" is null or not defined');var r=Object(this),n=r.length>>>0;if(0==n)return!1;var o,a,t=0|t,i=Math.max(0<=t?t:n-Math.abs(t),0);for(;i<n;){if((o=r[i])===(a=e)||"number"==typeof o&&"number"==typeof a&&isNaN(o)&&isNaN(a))return!0;i++}return!1}}),Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),r=t.length,n=new Array(r);r--;)n[r]=[t[r],e[t[r]]];return n}),String.prototype.startsWith||Object.defineProperty(String.prototype,"startsWith",{value:function(e,t){t=0<t?0|t:0;return this.substring(t,t+e.length)===e}}),Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;do{if(t.matches(e))return t}while(null!==(t=t.parentElement||t.parentNode)&&1===t.nodeType);return null}),Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e=function(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e};function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},h=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},p="pfe",e=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(f,HTMLElement),e(f,[{key:"log",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];f.log.apply(f,["["+this.tag+(this.id?"#"+this.id:"")+"]"].concat(t))}},{key:"warn",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];f.warn.apply(f,["["+this.tag+(this.id?"#"+this.id:"")+"]"].concat(t))}},{key:"error",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];f.error.apply(f,["["+this.tag+(this.id?"#"+this.id:"")+"]"].concat(t))}},{key:"hasLightDOM",value:function(){return this.children.length||this.textContent.trim().length}},{key:"hasSlot",value:function(t){var e=this;if(t)switch(void 0===t?"undefined":s(t)){case"string":return 0<[].concat(c(this.children)).filter(function(e){return e.hasAttribute("slot")&&e.getAttribute("slot")===t}).length;case"array":return t.reduce(function(t){return 0<[].concat(c(e.children)).filter(function(e){return e.hasAttribute("slot")&&e.getAttribute("slot")===t}).length});default:return void this.warn("Did not recognize the type of the name provided to hasSlot; this funciton can accept a string or an array.")}else this.warn("Please provide at least one slot name for which to search.")}},{key:"getSlot",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"unassigned";return"unassigned"!==t?[].concat(c(this.children)).filter(function(e){return e.hasAttribute("slot")&&e.getAttribute("slot")===t}):[].concat(c(this.children)).filter(function(e){return!e.hasAttribute("slot")})}},{key:"cssVariable",value:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:this;return e="--"!==e.substr(0,2)?"--"+e:e,t?(r.style.setProperty(e,t),t):window.getComputedStyle(r).getPropertyValue(e).trim()||null}},{key:"contextUpdate",value:function(){var t=this,e=[].concat(c(this.querySelectorAll("*"))).filter(function(e){return e.tagName.toLowerCase().slice(0,4)===p+"-"}).filter(function(e){return e.parentElement?e.parentElement.closest("["+t._pfeClass._getCache("prop2attr").pfelement+"]")===t:void 0}),r=[].concat(c(this.shadowRoot.querySelectorAll("*"))).filter(function(e){return e.tagName.toLowerCase().slice(0,4)===p+"-"}).filter(function(e){return e.parentElement&&e.parentElement.closest("["+t._pfeClass._getCache("prop2attr").pfelement+"]")?e.parentElement.closest("["+t._pfeClass._getCache("prop2attr").pfelement+"]")===t:e.getRootNode().host===t}),r=e.concat(r);0!==r.length&&r.map(function(e){t.log("Update context of "+e.tagName.toLowerCase()),Promise.all([customElements.whenDefined(e.tagName.toLowerCase())]).then(function(){e.resetContext(t.on)})})}},{key:"resetContext",value:function(e){this.isIE11||(e=this.context||this.contextVariable||e,this.on!==e&&(this.on||e)&&(this.log("Resetting context from "+this.on+" to "+(e||"null")),this.on=e))}},{key:"version",get:function(){return this._pfeClass.version}},{key:"randomId",get:function(){return p+"-"+Math.random().toString(36).substr(2,9)}},{key:"contextVariable",set:function(e){this.cssVariable("context",e)},get:function(){return this.cssVariable("context")||this.cssVariable("theme")}}],[{key:"debugLog",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null;if(null!==t)try{localStorage.pfeLog=!!t}catch(e){return f._debugLog=!!t,f._debugLog}return"true"===localStorage.pfeLog||f._debugLog}},{key:"trackPerformance",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null;return null!==e&&(f._trackPerformance=!!e),f._trackPerformance}},{key:"log",value:function(){var e;f.debugLog()&&(e=console).log.apply(e,arguments)}},{key:"warn",value:function(){var e;(e=console).warn.apply(e,arguments)}},{key:"error",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];throw new Error([].concat(t).join(" "))}},{key:"config",get:function(){return window.PfeConfig||{}}},{key:"PfeTypes",get:function(){return{Container:"container",Content:"content",Combo:"combo"}}},{key:"version",get:function(){return"1.9.3"}},{key:"properties",get:function(){return{pfelement:{title:"Upgraded flag",type:Boolean,default:!0,observer:"_upgradeObserver"},on:{title:"Context",description:"Describes the visual context (backgrounds).",type:String,values:["light","dark","saturated"],default:function(e){return e.contextVariable},observer:"_onObserver"},context:{title:"Context hook",description:"Lets you override the system-set context.",type:String,values:["light","dark","saturated"],observer:"_contextObserver"},oldTheme:{type:String,values:["light","dark","saturated"],alias:"context",attr:"pfe-theme"},_style:{title:"Custom styles",type:String,attr:"style",observer:"_inlineStyleObserver"},type:{title:"Component type",type:String,values:["container","content","combo"]}}}},{key:"observedAttributes",get:function(){var t=this,r=this.allProperties;if(r){var e=Object.keys(r).filter(function(e){return r[e].observer||r[e].cascade||r[e].alias}).map(function(e){return t._convertPropNameToAttrName(e)});return[].concat(c(e))}}}]),e(f,[{key:"connectedCallback",value:function(){var e=this;this._initializeAttributeDefaults(),window.ShadyCSS&&window.ShadyCSS.styleElement(this),"object"===s(this.slots)&&(this._slotsObserver=new MutationObserver(function(){return e._initializeSlots(e.tag,e.slots)}),this._initializeSlots(this.tag,this.slots))}},{key:"disconnectedCallback",value:function(){this._cascadeObserver&&this._cascadeObserver.disconnect(),this._slotsObserver&&this._slotsObserver.disconnect()}},{key:"attributeChangedCallback",value:function(e,t,r){var n,o,a;this._pfeClass.allProperties&&(a=this._pfeClass._attr2prop(e),(n=this._pfeClass.allProperties[a])&&(n.alias&&(o=this._pfeClass.allProperties[n.alias],a=this._pfeClass._prop2attr(n.alias),this.getAttribute(a)!==r&&(this[n.alias]=this._castPropertyValue(o,r))),n.observer&&this[n.observer](this._castPropertyValue(n,t),this._castPropertyValue(n,r)),n.cascade&&this._copyAttribute(e,this._pfeClass._convertSelectorsToArray(n.cascade))))}},{key:"render",value:function(){if(this.shadowRoot.innerHTML="",this.template.innerHTML=this.html,window.ShadyCSS&&window.ShadyCSS.prepareTemplate(this.template,this.tag),this.shadowRoot.appendChild(this.template.content.cloneNode(!0)),this.log("render"),this.cascadeProperties(),this.contextUpdate(),f.trackPerformance())try{performance.mark(this._markId+"-rendered"),this._markCount<1&&(this._markCount=this._markCount+1,performance.measure(this._markId+"-from-navigation-to-first-render",void 0,this._markId+"-rendered"),performance.measure(this._markId+"-from-defined-to-first-render",this._markId+"-defined",this._markId+"-rendered"))}catch(e){this.log("Performance marks are not supported by this browser.")}"object"===s(this.slots)&&this._slotsObserver&&this._slotsObserver.observe(this,{childList:!0}),this._cascadeObserver&&this._cascadeObserver.observe(this,{attributes:!0,childList:!0,subtree:!0}),this._rendered=!0}},{key:"emitEvent",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=t.bubbles,n=void 0===r||r,o=t.cancelable,r=void 0!==o&&o,o=t.composed,o=void 0===o||o,t=t.detail,t=void 0===t?{}:t;t?this.log("Custom event: "+e,t):this.log("Custom event: "+e),this.dispatchEvent(new CustomEvent(e,{bubbles:n,cancelable:r,composed:o,detail:t}))}},{key:"cascadeProperties",value:function(e){var r,t=this,n=this._pfeClass._getCache("cascadingProperties");n&&(this._cascadeObserver&&this._cascadeObserver.disconnect(),r=Object.keys(n),e&&(r=[],[].concat(c(e)).forEach(function(t){Object.keys(n).map(function(e){t.matches&&t.matches(e)&&r.push(e)})})),r&&((e=r.filter(function(e){return e.slice(0,p.length+1)===p+"-"}).map(function(e){return customElements.whenDefined(e)}))?Promise.all(e).then(function(){t._copyAttributes(r,n)}):this._copyAttributes(r,n)),this._rendered&&this._cascadeObserver&&this._cascadeObserver.observe(this,{attributes:!0,childList:!0,subtree:!0}))}},{key:"_upgradeObserver",value:function(){this.classList.add("PFElement")}},{key:"_contextObserver",value:function(e,t){t&&(e&&e!==t||!e)&&(this.log("Running the context observer"),this.on=t,this.cssVariable("context",t))}},{key:"_onObserver",value:function(e,t){(e&&e!==t||t&&!e)&&(this.log("Context update"),this.contextUpdate())}},{key:"_inlineStyleObserver",value:function(e,t){e!==t&&(t?(this.log("Style observer activated on "+this.tag,""+(t||"null")),(t=/--[\w|-]*(?:context|theme):\s*(?:\"*(light|dark|saturated)\"*)/gi.exec(t))&&((t=t[1])===this.on||this.context||(this.on=t))):this.resetContext())}},{key:"_parseObserver",value:function(e){var t=!0,r=!1,n=void 0;try{for(var o,a=e[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var i=o.value;"childList"===i.type&&i.addedNodes.length&&this.cascadeProperties(i.addedNodes)}}catch(e){r=!0,n=e}finally{try{!t&&a.return&&a.return()}finally{if(r)throw n}}}},{key:"_castPropertyValue",value:function(e,t){var r;switch(e.type){case Number:return i(r={},t,Number(t)),i(r,"null",null),i(r,"NaN",NaN),i(r,"undefined",void 0),r[t];case Boolean:return null!==t;case String:return i(r={},t,t),i(r,"undefined",void 0),r[t];default:return t}}},{key:"_assignValueToAttribute",value:function(e,t,r){e.type===Boolean&&!r||null===r||void 0===r?this.removeAttribute(t):e.type===Boolean&&"boolean"==typeof r?this.setAttribute(t,""):(e.values&&this._validateAttributeValue(e,t,r),this.setAttribute(t,r))}},{key:"_initializeSlots",value:function(o,a){var i=this;this.log("Validate slots..."),this._slotsObserver&&this._slotsObserver.disconnect(),Object.keys(a).forEach(function(e){var t,r,n=a[e];"object"===(void 0===n?"undefined":s(n))&&(t=!1,r=[],n.namedSlot?(0<(r=i.getSlot(o+"--"+e)).length&&(n.nodes=r,t=!0),0<(r=i.getSlot(""+e)).length&&(n.nodes=r,t=!0)):0<(r=[].concat(c(i.children)).filter(function(e){return!e.hasAttribute("slot")})).length&&(n.nodes=r,t=!0),t?i.setAttribute("has_"+e,""):i.removeAttribute("has_"+e))}),this.log("Slots validated."),this._slotsObserver&&this._slotsObserver.observe(this,{childList:!0})}},{key:"_initializeProperties",value:function(){var n=this,o=this._pfeClass.allProperties,a=!1;0<Object.keys(o).length&&this.log("Initialize properties");for(var e in o)!function(e){var t,r=o[e];void 0!==n[e]?n.log('Property "'+e+'" on '+n.constructor.name+" cannot be defined because the property name is reserved"):(t=n._pfeClass._prop2attr(e),r.cascade&&(a=!0),Object.defineProperty(n,e,{get:function(){var e=n.getAttribute(t);return n._castPropertyValue(r,e)},set:function(e){return n._assignValueToAttribute(r,t,e),e},writeable:!0,enumerable:!0,configurable:!1}))}(e);a&&(this._cascadeObserver=new MutationObserver(this._parseObserver))}},{key:"_initializeAttributeDefaults",value:function(){var e,t=this._pfeClass.allProperties;for(e in t){var r,n=t[e],o=this._pfeClass._prop2attr(e);n.hasOwnProperty("default")&&(r=n.default,"function"==typeof n.default&&(r=n.default(this)),this.hasAttribute(o)||this._assignValueToAttribute(n,o,r))}}},{key:"_validateAttributeValue",value:function(e,t,r){return Array.isArray(e.values)&&0<e.values.length&&!e.values.includes(r)&&this.warn(r+" is not a valid value for "+t+". Please provide one of the following values: "+e.values.join(", ")),r}},{key:"_copyAttributes",value:function(e,r){var n=this;e.forEach(function(t){r[t].forEach(function(e){n._copyAttribute(e,t)})})}},{key:"_copyAttribute",value:function(e,t){var r=[].concat(c(this.querySelectorAll(t)),c(this.shadowRoot.querySelectorAll(t))),n=this.getAttribute(e),o=null==n?"removeAttribute":"setAttribute",a=!0,i=!1,t=void 0;try{for(var s,l=r[Symbol.iterator]();!(a=(s=l.next()).done);a=!0)s.value[o](e,n)}catch(e){i=!0,t=e}finally{try{!a&&l.return&&l.return()}finally{if(i)throw t}}}}],[{key:"_validateProperties",value:function(){for(var e in this.allProperties){var t=this.allProperties[e];[String,Number,Boolean].includes(t.type||String)||this.error('Property "'+e+'" on '+this.name+" must have type String, Number, or Boolean."),/^[a-z_]/.test(e)||this.error("Property "+this.name+"."+e+" defined, but prop names must begin with a lower-case letter or an underscore");var r="function"==typeof t.default;!t.default||(n=t).hasOwnProperty("default")&&n.default.constructor===n.type||r||this.error("["+this.name+"] The default value `"+t.default+"` does not match the assigned type "+t.type.name+" for the '"+e+"' property")}var n}},{key:"_prop2attr",value:function(e){return this._getCache("prop2attr")[e]}},{key:"_attr2prop",value:function(e){return this._getCache("attr2prop")[e]}},{key:"_convertPropNameToAttrName",value:function(e){var t=this.allProperties[e];return t.attr||e.replace(/^_/,"").replace(/^[A-Z]/,function(e){return e.toLowerCase()}).replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}},{key:"_convertAttrNameToPropName",value:function(e){for(var t in this.allProperties)if(this.allProperties[t].attr===e)return t;return e.replace(/-([A-Za-z])/g,function(e){return e[1].toUpperCase()})}},{key:"_convertSelectorsToArray",value:function(e){if(e){if("string"==typeof e)return e.split(",");if("object"===(void 0===e?"undefined":s(e)))return e;this.warn("selectors should be provided as a string, array, or object; received: "+(void 0===e?"undefined":s(e))+".")}}},{key:"_parsePropertiesForCascade",value:function(e){var n=this,o={},t=!0,r=!1,a=void 0;try{for(var i,s=Object.entries(e)[Symbol.iterator]();!(t=(i=s.next()).done);t=!0){var l=i.value,c=h(l,2);!function(r,e){e=n._convertSelectorsToArray(e.cascade);e&&e.map(function(e){var t=n._prop2attr(r);o[e]?o[e].push(t):o[e]=[t]})}(c[0],c[1])}}catch(e){r=!0,a=e}finally{try{!t&&s.return&&s.return()}finally{if(r)throw a}}return o}},{key:"create",value:function(e){if(e._createCache(),e._populateCache(e),e._validateProperties(),window.customElements.define(e.tag,e),f.trackPerformance())try{performance.mark(this._markId+"-defined")}catch(e){this.log("Performance marks are not supported by this browser.")}}},{key:"_createCache",value:function(){this._cache={properties:{},globalProperties:{},componentProperties:{},cascadingProperties:{},attr2prop:{},prop2attr:{}}}},{key:"_setCache",value:function(e,t){this._cache[e]=t}},{key:"_getCache",value:function(e){return e?this._cache[e]:this._cache}},{key:"_populateCache",value:function(e){var t=l({},e.properties,f.properties);e._setCache("componentProperties",e.properties),e._setCache("globalProperties",f.properties),e._setCache("properties",t);var r,n={},o={};for(r in t){var a=this._convertPropNameToAttrName(r);o[n[r]=a]=r}e._setCache("attr2prop",o),e._setCache("prop2attr",n);t=this._parsePropertiesForCascade(t);Object.keys(t)&&e._setCache("cascadingProperties",t)}},{key:"allProperties",get:function(){return this._getCache("properties")}},{key:"cascadingProperties",get:function(){return this._getCache("cascadingProperties")}}]),f);function f(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=t.type,n=void 0===r?null:r,r=t.delayRender,t=void 0!==r&&r;o(this,f);r=u(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));return r._pfeClass=e,r.tag=e.tag,r._parseObserver=r._parseObserver.bind(r),r.isIE11=/MSIE|Trident|Edge\//.test(window.navigator.userAgent),r.id?r.id.startsWith("pfe-")&&!r.id.startsWith(r.tag)?r._markId=r.id.replace("pfe",r.tag):r._markId=r.tag+"-"+r.id:r._markId=r.randomId.replace("pfe",r.tag),r._markCount=0,r.schemaProps=e.schemaProperties,r.slots=e.slots,r.template=document.createElement("template"),n&&r._pfeClass.allProperties.type&&(r._pfeClass.allProperties.type.default=n),r._initializeProperties(),r.attachShadow({mode:"open"}),r._rendered=!1,t||r.render(),r}return function(e){r=e;var t=window.WebComponents,e=t&&window.WebComponents.ready;!t||e?n():window.addEventListener("WebComponentsReady",n)}(e.log),e});
//# sourceMappingURL=pfelement.umd.min.js.map

@@ -13,3 +13,3 @@ {

},
"version": "1.9.2",
"version": "1.9.3",
"publishConfig": {

@@ -65,3 +65,3 @@ "access": "public"

"devDependencies": {
"@patternfly/pfe-sass": "^1.9.2"
"@patternfly/pfe-sass": "^1.9.3"
},

@@ -72,3 +72,3 @@ "generator-pfelement-version": "0.3.4",

},
"gitHead": "04c85f5a53eeec1ea4ff49f74ca07c0ca5e531b8"
"gitHead": "5874775b25c8e83940a60ef63b4795b17d4389ff"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc