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.7.0 to 1.8.0

35

dist/pfelement.js

@@ -145,4 +145,23 @@ let logger = () => null;

// @POLYFILL Element.closest
// https://developer.mozilla.org/en-US/docs/Web/API/Element/closest
if (!Element.prototype.closest) {
Element.prototype.closest = function(s) {
var el = this;
do {
if (el.matches(s)) return el;
el = el.parentElement || el.parentNode;
} while (el !== null && el.nodeType === 1);
return null;
};
}
// @POLYFILL Element.matches
// https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
if (!Element.prototype.matches) {
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
}
/*!
* PatternFly Elements: PFElement 1.7.0
* PatternFly Elements: PFElement 1.8.0
* @license

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

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

@@ -211,2 +230,12 @@ */

/**
* A object that contains configuration set outside of pfe.
*
* @example const config = PFElement.config;
*/
static get config() {
// @TODO: Add config validation in the future.
return window.PfeConfig || {};
}
/**
* A logging wrapper which checks the debugLog boolean and prints to the console if true.

@@ -283,3 +312,3 @@ *

static get version() {
return "1.7.0";
return "1.8.0";
}

@@ -286,0 +315,0 @@

27

dist/pfelement.min.js

@@ -1,27 +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,a,o=0|e,n=Math.max(o>=0?o:r-Math.abs(o),0);for(;n<r;){if((i=s[n])===(a=t)||"number"==typeof i&&"number"==typeof a&&isNaN(i)&&isNaN(a))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}});
/*!
* PatternFly Elements: PFElement 1.7.0
* @license
* Copyright 2021 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
const r="pfe";class i extends HTMLElement{static debugLog(t=null){return null!==t&&(i._debugLog=!!t),i._debugLog}static trackPerformance(t=null){return null!==t&&(i._trackPerformance=!!t),i._trackPerformance}static log(...t){i.debugLog()&&console.log(...t)}log(...t){i.log(`[${this.tag}${this.id?`#${this.id}`:""}]`,...t)}static warn(...t){console.warn(...t)}warn(...t){i.warn(`[${this.tag}${this.id?`#${this.id}`:""}]`,...t)}static error(...t){throw new Error([...t].join(" "))}error(...t){i.error(`[${this.tag}${this.id?`#${this.id}`:""}]`,...t)}static get PfeTypes(){return{Container:"container",Content:"content",Combo:"combo"}}static get version(){return"1.7.0"}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`${r}-`+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=>t.tagName.toLowerCase().slice(0,4)===`${r}-`).filter(t=>t.parentElement?t.parentElement.closest(`[${this._pfeClass._getCache("prop2attr").pfelement}]`)===this:void 0);let e=[...this.shadowRoot.querySelectorAll("*")].filter(t=>t.tagName.toLowerCase().slice(0,4)===`${r}-`).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(),i.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=>t.slice(0,r.length+1)===`${r}-`).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}`)).length>0&&(r.nodes=i,e=!0),(i=this.getSlot(`${s}`)).length>0&&(r.nodes=i,e=!0)):(i=[...this.children].filter(t=>!t.hasAttribute("slot"))).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),i.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,...i.properties};t._setCache("componentProperties",t.properties),t._setCache("globalProperties",i.properties),t._setCache("properties",e);const s={},r={};for(let t in e){const e=this._convertPropNameToAttrName(t);s[t]=e,r[e]=t}t._setCache("attr2prop",r),t._setCache("prop2attr",s);const a=this._parsePropertiesForCascade(e);Object.keys(a)&&t._setCache("cascadingProperties",a)}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)}(i.log);export default i;
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,a,o=0|e,n=Math.max(o>=0?o:r-Math.abs(o),0);for(;n<r;){if((i=s[n])===(a=t)||"number"==typeof i&&"number"==typeof a&&isNaN(i)&&isNaN(a))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){return null!==t&&(r._debugLog=!!t),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.8.0"}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 a=this._parsePropertiesForCascade(e);Object.keys(a)&&t._setCache("cascadingProperties",a)}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

@@ -153,2 +153,21 @@ (function (global, factory) {

// @POLYFILL Element.closest
// https://developer.mozilla.org/en-US/docs/Web/API/Element/closest
if (!Element.prototype.closest) {
Element.prototype.closest = function (s) {
var el = this;
do {
if (el.matches(s)) return el;
el = el.parentElement || el.parentNode;
} while (el !== null && el.nodeType === 1);
return null;
};
}
// @POLYFILL Element.matches
// https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
if (!Element.prototype.matches) {
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
}
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {

@@ -286,3 +305,3 @@ return typeof obj;

/*!
* PatternFly Elements: PFElement 1.7.0
* PatternFly Elements: PFElement 1.8.0
* @license

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

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

@@ -631,5 +650,5 @@ */

/**
* A logging wrapper which checks the debugLog boolean and prints to the console if true.
* A object that contains configuration set outside of pfe.
*
* @example PFElement.log("Hello");
* @example const config = PFElement.config;
*/

@@ -639,2 +658,9 @@

key: "log",
/**
* A logging wrapper which checks the debugLog boolean and prints to the console if true.
*
* @example PFElement.log("Hello");
*/
value: function log() {

@@ -664,2 +690,8 @@ if (PFElement.debugLog()) {

}, {
key: "config",
get: function get() {
// @TODO: Add config validation in the future.
return window.PfeConfig || {};
}
}, {
key: "PfeTypes",

@@ -681,3 +713,3 @@ get: function get() {

get: function get() {
return "1.7.0";
return "1.8.0";
}

@@ -684,0 +716,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,i,t=0|t,a=Math.max(0<=t?t:n-Math.abs(t),0);for(;a<n;){if((o=r[a])===(i=e)||"number"==typeof o&&"number"==typeof i&&isNaN(o)&&isNaN(i))return!0;a++}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}});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&&i(e.prototype,t),r&&i(e,r),e};function i(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 a(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,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}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 e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null;return null!==e&&(f._debugLog=!!e),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:"PfeTypes",get:function(){return{Container:"container",Content:"content",Combo:"combo"}}},{key:"version",get:function(){return"1.7.0"}},{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,i;this._pfeClass.allProperties&&(i=this._pfeClass._attr2prop(e),(n=this._pfeClass.allProperties[i])&&(n.alias&&(o=this._pfeClass.allProperties[n.alias],i=this._pfeClass._prop2attr(n.alias),this.getAttribute(i)!==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,i=e[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var a=o.value;"childList"===a.type&&a.addedNodes.length&&this.cascadeProperties(a.addedNodes)}}catch(e){r=!0,n=e}finally{try{!t&&i.return&&i.return()}finally{if(r)throw n}}}},{key:"_castPropertyValue",value:function(e,t){var r;switch(e.type){case Number:return a(r={},t,Number(t)),a(r,"null",null),a(r,"NaN",NaN),a(r,"undefined",void 0),r[t];case Boolean:return null!==t;case String:return a(r={},t,t),a(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,i){var a=this;this.log("Validate slots..."),this._slotsObserver&&this._slotsObserver.disconnect(),Object.keys(i).forEach(function(e){var t,r,n=i[e];"object"===(void 0===n?"undefined":s(n))&&(t=!1,r=[],n.namedSlot?(0<(r=a.getSlot(o+"--"+e)).length&&(n.nodes=r,t=!0),0<(r=a.getSlot(""+e)).length&&(n.nodes=r,t=!0)):0<(r=[].concat(c(a.children)).filter(function(e){return!e.hasAttribute("slot")})).length&&(n.nodes=r,t=!0),t?a.setAttribute("has_"+e,""):a.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,i=!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&&(i=!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);i&&(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",i=!0,a=!1,t=void 0;try{for(var s,l=r[Symbol.iterator]();!(i=(s=l.next()).done);i=!0)s.value[o](e,n)}catch(e){a=!0,t=e}finally{try{!i&&l.return&&l.return()}finally{if(a)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,i=void 0;try{for(var a,s=Object.entries(e)[Symbol.iterator]();!(t=(a=s.next()).done);t=!0){var l=a.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,i=e}finally{try{!t&&s.return&&s.return()}finally{if(r)throw i}}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 i=this._convertPropNameToAttrName(r);o[n[r]=i]=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,i,t=0|t,a=Math.max(0<=t?t:n-Math.abs(t),0);for(;a<n;){if((o=r[a])===(i=e)||"number"==typeof o&&"number"==typeof i&&isNaN(o)&&isNaN(i))return!0;a++}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&&i(e.prototype,t),r&&i(e,r),e};function i(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 a(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,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}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 e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null;return null!==e&&(f._debugLog=!!e),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.8.0"}},{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,i;this._pfeClass.allProperties&&(i=this._pfeClass._attr2prop(e),(n=this._pfeClass.allProperties[i])&&(n.alias&&(o=this._pfeClass.allProperties[n.alias],i=this._pfeClass._prop2attr(n.alias),this.getAttribute(i)!==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,i=e[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var a=o.value;"childList"===a.type&&a.addedNodes.length&&this.cascadeProperties(a.addedNodes)}}catch(e){r=!0,n=e}finally{try{!t&&i.return&&i.return()}finally{if(r)throw n}}}},{key:"_castPropertyValue",value:function(e,t){var r;switch(e.type){case Number:return a(r={},t,Number(t)),a(r,"null",null),a(r,"NaN",NaN),a(r,"undefined",void 0),r[t];case Boolean:return null!==t;case String:return a(r={},t,t),a(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,i){var a=this;this.log("Validate slots..."),this._slotsObserver&&this._slotsObserver.disconnect(),Object.keys(i).forEach(function(e){var t,r,n=i[e];"object"===(void 0===n?"undefined":s(n))&&(t=!1,r=[],n.namedSlot?(0<(r=a.getSlot(o+"--"+e)).length&&(n.nodes=r,t=!0),0<(r=a.getSlot(""+e)).length&&(n.nodes=r,t=!0)):0<(r=[].concat(c(a.children)).filter(function(e){return!e.hasAttribute("slot")})).length&&(n.nodes=r,t=!0),t?a.setAttribute("has_"+e,""):a.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,i=!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&&(i=!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);i&&(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",i=!0,a=!1,t=void 0;try{for(var s,l=r[Symbol.iterator]();!(i=(s=l.next()).done);i=!0)s.value[o](e,n)}catch(e){a=!0,t=e}finally{try{!i&&l.return&&l.return()}finally{if(a)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,i=void 0;try{for(var a,s=Object.entries(e)[Symbol.iterator]();!(t=(a=s.next()).done);t=!0){var l=a.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,i=e}finally{try{!t&&s.return&&s.return()}finally{if(r)throw i}}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 i=this._convertPropNameToAttrName(r);o[n[r]=i]=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.7.0",
"version": "1.8.0",
"publishConfig": {

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

"devDependencies": {
"@patternfly/pfe-sass": "^1.7.0"
"@patternfly/pfe-sass": "^1.8.0"
},

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

},
"gitHead": "86daa0ea7dc0b8995da8a0af7fed0f8f83356f65"
"gitHead": "ba6b21c6a3456db10e9d32a21825c313a5d3c5bb"
}

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