Socket
Socket
Sign inDemoInstall

@patternfly/pfelement

Package Overview
Dependencies
Maintainers
15
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.10.0 to 1.10.1

100

dist/pfelement.js

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

/*!
* PatternFly Elements: PFElement 1.10.0
* PatternFly Elements: PFElement 1.10.1
* @license

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

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

@@ -368,3 +368,3 @@ */

static get version() {
return "1.10.0";
return "1.10.1";
}

@@ -476,2 +476,3 @@

*
* @param {String|Array} name The slot name.
* @example this.hasSlot("header");

@@ -498,3 +499,3 @@ */

this.warn(
`Did not recognize the type of the name provided to hasSlot; this function can accept a string or an array.`
`Expected hasSlot argument to be a string or an array, but it was given: ${typeof name}.`
);

@@ -566,7 +567,8 @@ return;

nestedEls.map((child) => {
this.log(`Update context of ${child.tagName.toLowerCase()}`);
Promise.all([customElements.whenDefined(child.tagName.toLowerCase())]).then(() => {
if (child.resetContext) {
this.log(`Update context of ${child.tagName.toLowerCase()}`);
// Ask the component to recheck it's context in case it changed
child.resetContext(this.on);
});
}
});

@@ -704,3 +706,3 @@ }

if (propDef.cascade) {
this._copyAttribute(attr, this._pfeClass._convertSelectorsToArray(propDef.cascade));
this._cascadeAttribute(attr, this._pfeClass._convertSelectorsToArray(propDef.cascade));
}

@@ -799,29 +801,30 @@ }

// Find out if anything in the nodeList matches any of the observed selectors for cacading properties
if (nodeList) {
selectors = [];
[...nodeList].forEach((nodeItem) => {
Object.keys(cascade).map((selector) => {
// if this node has a match function (i.e., it's an HTMLElement, not
// a text node), see if it matches the selector, otherwise drop it (like it's hot).
if (nodeItem.matches && nodeItem.matches(selector)) {
selectors.push(selector);
}
if (selectors) {
if (nodeList) {
[...nodeList].forEach(nodeItem => {
selectors.forEach(selector => {
// if this node has a match function (i.e., it's an HTMLElement, not
// a text node), see if it matches the selector, otherwise drop it (like it's hot).
if (nodeItem.matches && nodeItem.matches(selector)) {
let attrNames = cascade[selector];
// each selector can match multiple properties/attributes, so
// copy each of them
attrNames.forEach(attrName => this._copyAttribute(attrName, nodeItem));
}
});
});
});
}
} else {
// If a match was found, cascade each attribute to the element
const components = selectors
.filter(item => item.slice(0, prefix.length + 1) === `${prefix}-`)
.map(name => customElements.whenDefined(name));
// If a match was found, cascade each attribute to the element
if (selectors) {
const components = selectors
.filter((item) => item.slice(0, prefix.length + 1) === `${prefix}-`)
.map((name) => customElements.whenDefined(name));
if (components)
Promise.all(components).then(() => {
this._copyAttributes(selectors, cascade);
});
else this._copyAttributes(selectors, cascade);
if (components)
Promise.all(components).then(() => {
this._cascadeAttributes(selectors, cascade);
});
else this._cascadeAttributes(selectors, cascade);
}
}
// @TODO This is here for IE11 processing; can move this after deprecation
if (this._rendered && this._cascadeObserver)

@@ -901,3 +904,4 @@ this._cascadeObserver.observe(this, {

if (mutation.type === "childList" && mutation.addedNodes.length) {
this.cascadeProperties(mutation.addedNodes);
const nonTextNodes = [...mutation.addedNodes].filter(n => n.nodeType !== HTMLElement.TEXT_NODE);
this.cascadeProperties(nonTextNodes);
}

@@ -1194,6 +1198,6 @@ }

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

@@ -1203,11 +1207,27 @@ });

_copyAttribute(name, to) {
/**
* Trigger a cascade of the named attribute to any child elements that match
* the `to` selector. The selector can match elements in the light DOM and
* shadow DOM.
* @param {String} name The name of the attribute to cascade (not necessarily the same as the property name).
* @param {String} to A CSS selector that matches the elements that should received the cascaded attribute. The selector will be applied within `this` element's light and shadow DOM trees.
*/
_cascadeAttribute(name, to) {
const recipients = [...this.querySelectorAll(to), ...this.shadowRoot.querySelectorAll(to)];
const value = this.getAttribute(name);
const fname = value == null ? "removeAttribute" : "setAttribute";
for (const node of recipients) {
node[fname](name, value);
this._copyAttribute(name, node);
}
}
/**
* Copy the named attribute to a target element.
*/
_copyAttribute(name, el) {
this.log(`copying ${name} to ${el}`);
const value = this.getAttribute(name);
const fname = value == null ? "removeAttribute" : "setAttribute";
el[fname](name, value);
}
static _convertSelectorsToArray(selectors) {

@@ -1214,0 +1234,0 @@ if (selectors) {

2

dist/pfelement.min.js

@@ -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,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),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),s=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var r=arguments[1],i=0;i<s;){var a=e[i];if(t.call(r,a,i,e))return a;i++}},configurable:!0,writable:!0});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.10.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)return"string"==typeof t?[...this.children].filter(e=>e.hasAttribute("slot")&&e.getAttribute("slot")===t).length>0:Array.isArray(t)?t.reduce(t=>[...this.children].filter(e=>e.hasAttribute("slot")&&e.getAttribute("slot")===t).length>0):void this.warn("Did not recognize the type of the name provided to hasSlot; this function can accept a string or an array.");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._pfeClass.instances&&this._pfeClass.instances.length>=0||(this._pfeClass.instances=[]),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),this._pfeClass.instances.push(this),r.allInstances.push(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();const t=this._pfeClass.instances.find(t=>t!==this);delete this._pfeClass.instances[t];const e=r.allInstances.find(t=>t!==this);delete r.allInstances[e]}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")}static get breakpoint(){return{xs:"0px",sm:"576px",md:"768px",lg:"992px",xl:"1200px","2xl":"1450px"}}}r.allInstances=[],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,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),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),s=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var r=arguments[1],i=0;i<s;){var a=e[i];if(t.call(r,a,i,e))return a;i++}},configurable:!0,writable:!0});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.10.1"}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)return"string"==typeof t?[...this.children].filter(e=>e.hasAttribute("slot")&&e.getAttribute("slot")===t).length>0:Array.isArray(t)?t.reduce(t=>[...this.children].filter(e=>e.hasAttribute("slot")&&e.getAttribute("slot")===t).length>0):void this.warn(`Expected hasSlot argument to be a string or an array, but it was given: ${typeof t}.`);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=>{t.resetContext&&(this.log("Update context of "+t.tagName.toLowerCase()),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._pfeClass.instances&&this._pfeClass.instances.length>=0||(this._pfeClass.instances=[]),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),this._pfeClass.instances.push(this),r.allInstances.push(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();const t=this._pfeClass.instances.find(t=>t!==this);delete this._pfeClass.instances[t];const e=r.allInstances.find(t=>t!==this);delete r.allInstances[e]}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._cascadeAttribute(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(s)if(t)[...t].forEach(t=>{s.forEach(s=>{if(t.matches&&t.matches(s)){e[s].forEach(e=>this._copyAttribute(e,t))}})});else{const t=s.filter(t=>"pfe-"===t.slice(0,"pfe".length+1)).map(t=>customElements.whenDefined(t));t?Promise.all(t).then(()=>{this._cascadeAttributes(s,e)}):this._cascadeAttributes(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)if("childList"===e.type&&e.addedNodes.length){const t=[...e.addedNodes].filter(t=>t.nodeType!==HTMLElement.TEXT_NODE);this.cascadeProperties(t)}}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())}_cascadeAttributes(t,e){t.forEach(t=>{e[t].forEach(e=>{this._cascadeAttribute(e,t)})})}_cascadeAttribute(t,e){const s=[...this.querySelectorAll(e),...this.shadowRoot.querySelectorAll(e)];for(const e of s)this._copyAttribute(t,e)}_copyAttribute(t,e){this.log(`copying ${t} to ${e}`);const s=this.getAttribute(t);e[null==s?"removeAttribute":"setAttribute"](t,s)}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")}static get breakpoint(){return{xs:"0px",sm:"576px",md:"768px",lg:"992px",xl:"1200px","2xl":"1450px"}}}r.allInstances=[],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

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

/*!
* PatternFly Elements: PFElement 1.10.0
* PatternFly Elements: PFElement 1.10.1
* @license

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

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

@@ -477,2 +477,3 @@ */

*
* @param {String|Array} name The slot name.
* @example this.hasSlot("header");

@@ -502,3 +503,3 @@ */

} else {
this.warn("Did not recognize the type of the name provided to hasSlot; this function can accept a string or an array.");
this.warn("Expected hasSlot argument to be a string or an array, but it was given: " + (typeof name === "undefined" ? "undefined" : _typeof(name)) + ".");
return;

@@ -588,7 +589,8 @@ }

nestedEls.map(function (child) {
_this3.log("Update context of " + child.tagName.toLowerCase());
Promise.all([customElements.whenDefined(child.tagName.toLowerCase())]).then(function () {
if (child.resetContext) {
_this3.log("Update context of " + child.tagName.toLowerCase());
// Ask the component to recheck it's context in case it changed
child.resetContext(_this3.on);
});
}
});

@@ -768,3 +770,3 @@ }

get: function get() {
return "1.10.0";
return "1.10.1";
}

@@ -977,3 +979,3 @@ }, {

if (propDef.cascade) {
this._copyAttribute(attr, this._pfeClass._convertSelectorsToArray(propDef.cascade));
this._cascadeAttribute(attr, this._pfeClass._convertSelectorsToArray(propDef.cascade));
}

@@ -1086,29 +1088,32 @@ }

// Find out if anything in the nodeList matches any of the observed selectors for cacading properties
if (nodeList) {
selectors = [];
[].concat(toConsumableArray(nodeList)).forEach(function (nodeItem) {
Object.keys(cascade).map(function (selector) {
// if this node has a match function (i.e., it's an HTMLElement, not
// a text node), see if it matches the selector, otherwise drop it (like it's hot).
if (nodeItem.matches && nodeItem.matches(selector)) {
selectors.push(selector);
}
if (selectors) {
if (nodeList) {
[].concat(toConsumableArray(nodeList)).forEach(function (nodeItem) {
selectors.forEach(function (selector) {
// if this node has a match function (i.e., it's an HTMLElement, not
// a text node), see if it matches the selector, otherwise drop it (like it's hot).
if (nodeItem.matches && nodeItem.matches(selector)) {
var attrNames = cascade[selector];
// each selector can match multiple properties/attributes, so
// copy each of them
attrNames.forEach(function (attrName) {
return _this7._copyAttribute(attrName, nodeItem);
});
}
});
});
});
}
} else {
// If a match was found, cascade each attribute to the element
var components = selectors.filter(function (item) {
return item.slice(0, prefix.length + 1) === prefix + "-";
}).map(function (name) {
return customElements.whenDefined(name);
});
// If a match was found, cascade each attribute to the element
if (selectors) {
var components = selectors.filter(function (item) {
return item.slice(0, prefix.length + 1) === prefix + "-";
}).map(function (name) {
return customElements.whenDefined(name);
});
if (components) Promise.all(components).then(function () {
_this7._copyAttributes(selectors, cascade);
});else this._copyAttributes(selectors, cascade);
if (components) Promise.all(components).then(function () {
_this7._cascadeAttributes(selectors, cascade);
});else this._cascadeAttributes(selectors, cascade);
}
}
// @TODO This is here for IE11 processing; can move this after deprecation
if (this._rendered && this._cascadeObserver) this._cascadeObserver.observe(this, {

@@ -1208,3 +1213,6 @@ attributes: true,

if (mutation.type === "childList" && mutation.addedNodes.length) {
this.cascadeProperties(mutation.addedNodes);
var nonTextNodes = [].concat(toConsumableArray(mutation.addedNodes)).filter(function (n) {
return n.nodeType !== HTMLElement.TEXT_NODE;
});
this.cascadeProperties(nonTextNodes);
}

@@ -1462,4 +1470,4 @@ }

}, {
key: "_copyAttributes",
value: function _copyAttributes(selectors, set) {
key: "_cascadeAttributes",
value: function _cascadeAttributes(selectors, set) {
var _this10 = this;

@@ -1469,12 +1477,20 @@

set[selector].forEach(function (attr) {
_this10._copyAttribute(attr, selector);
_this10._cascadeAttribute(attr, selector);
});
});
}
/**
* Trigger a cascade of the named attribute to any child elements that match
* the `to` selector. The selector can match elements in the light DOM and
* shadow DOM.
* @param {String} name The name of the attribute to cascade (not necessarily the same as the property name).
* @param {String} to A CSS selector that matches the elements that should received the cascaded attribute. The selector will be applied within `this` element's light and shadow DOM trees.
*/
}, {
key: "_copyAttribute",
value: function _copyAttribute(name, to) {
key: "_cascadeAttribute",
value: function _cascadeAttribute(name, to) {
var recipients = [].concat(toConsumableArray(this.querySelectorAll(to)), toConsumableArray(this.shadowRoot.querySelectorAll(to)));
var value = this.getAttribute(name);
var fname = value == null ? "removeAttribute" : "setAttribute";
var _iteratorNormalCompletion2 = true;

@@ -1488,3 +1504,3 @@ var _didIteratorError2 = false;

node[fname](name, value);
this._copyAttribute(name, node);
}

@@ -1506,2 +1522,15 @@ } catch (err) {

}
/**
* Copy the named attribute to a target element.
*/
}, {
key: "_copyAttribute",
value: function _copyAttribute(name, el) {
this.log("copying " + name + " to " + el);
var value = this.getAttribute(name);
var fname = value == null ? "removeAttribute" : "setAttribute";
el[fname](name, value);
}
}], [{

@@ -1508,0 +1537,0 @@ key: "_validateProperties",

@@ -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),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null==this)throw new TypeError('"this" is null or not defined');var t=Object(this),r=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var n=arguments[1],o=0;o<r;){var a=t[o];if(e.call(n,a,o,t))return a;o++}},configurable:!0,writable:!0});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)return"string"==typeof t?0<[].concat(c(this.children)).filter(function(e){return e.hasAttribute("slot")&&e.getAttribute("slot")===t}).length:Array.isArray(t)?t.reduce(function(t){return 0<[].concat(c(e.children)).filter(function(e){return e.hasAttribute("slot")&&e.getAttribute("slot")===t}).length}):void this.warn("Did not recognize the type of the name provided to hasSlot; this function can accept a string or an array.");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.10.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),this._pfeClass.instances.push(this),f.allInstances.push(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(){var t=this;this._cascadeObserver&&this._cascadeObserver.disconnect(),this._slotsObserver&&this._slotsObserver.disconnect();var e=this._pfeClass.instances.find(function(e){return e!==t});delete this._pfeClass.instances[e];e=f.allInstances.find(function(e){return e!==t});delete f.allInstances[e]}},{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")}},{key:"breakpoint",get:function(){return{xs:"0px",sm:"576px",md:"768px",lg:"992px",xl:"1200px","2xl":"1450px"}}}]),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._pfeClass.instances&&0<=r._pfeClass.instances.length||(r._pfeClass.instances=[]),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 e.allInstances=[],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),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null==this)throw new TypeError('"this" is null or not defined');var t=Object(this),r=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var n=arguments[1],o=0;o<r;){var a=t[o];if(e.call(n,a,o,t))return a;o++}},configurable:!0,writable:!0});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 l(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 c=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)return"string"==typeof t?0<[].concat(l(this.children)).filter(function(e){return e.hasAttribute("slot")&&e.getAttribute("slot")===t}).length:Array.isArray(t)?t.reduce(function(t){return 0<[].concat(l(e.children)).filter(function(e){return e.hasAttribute("slot")&&e.getAttribute("slot")===t}).length}):void this.warn("Expected hasSlot argument to be a string or an array, but it was given: "+(void 0===t?"undefined":s(t))+".");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(l(this.children)).filter(function(e){return e.hasAttribute("slot")&&e.getAttribute("slot")===t}):[].concat(l(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(l(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(l(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){e.resetContext&&(t.log("Update context of "+e.tagName.toLowerCase()),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.10.1"}},{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(l(e))}}}]),e(f,[{key:"connectedCallback",value:function(){var e=this;this._initializeAttributeDefaults(),window.ShadyCSS&&window.ShadyCSS.styleElement(this),this._pfeClass.instances.push(this),f.allInstances.push(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(){var t=this;this._cascadeObserver&&this._cascadeObserver.disconnect(),this._slotsObserver&&this._slotsObserver.disconnect();var e=this._pfeClass.instances.find(function(e){return e!==t});delete this._pfeClass.instances[e];e=f.allInstances.find(function(e){return e!==t});delete f.allInstances[e]}},{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._cascadeAttribute(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,n=this,o=this._pfeClass._getCache("cascadingProperties");o&&(this._cascadeObserver&&this._cascadeObserver.disconnect(),(r=Object.keys(o))&&(e?[].concat(l(e)).forEach(function(t){r.forEach(function(e){t.matches&&t.matches(e)&&o[e].forEach(function(e){return n._copyAttribute(e,t)})})}):(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(){n._cascadeAttributes(r,o)}):this._cascadeAttributes(r,o)),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,s=o.value;"childList"===s.type&&s.addedNodes.length&&(i=[].concat(l(s.addedNodes)).filter(function(e){return e.nodeType!==HTMLElement.TEXT_NODE}),this.cascadeProperties(i))}}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(l(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:"_cascadeAttributes",value:function(e,r){var n=this;e.forEach(function(t){r[t].forEach(function(e){n._cascadeAttribute(e,t)})})}},{key:"_cascadeAttribute",value:function(e,t){var r=[].concat(l(this.querySelectorAll(t)),l(this.shadowRoot.querySelectorAll(t))),n=!0,o=!1,t=void 0;try{for(var a,i=r[Symbol.iterator]();!(n=(a=i.next()).done);n=!0){var s=a.value;this._copyAttribute(e,s)}}catch(e){o=!0,t=e}finally{try{!n&&i.return&&i.return()}finally{if(o)throw t}}}},{key:"_copyAttribute",value:function(e,t){this.log("copying "+e+" to "+t);var r=this.getAttribute(e);t[null==r?"removeAttribute":"setAttribute"](e,r)}}],[{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=c({},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")}},{key:"breakpoint",get:function(){return{xs:"0px",sm:"576px",md:"768px",lg:"992px",xl:"1200px","2xl":"1450px"}}}]),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._pfeClass.instances&&0<=r._pfeClass.instances.length||(r._pfeClass.instances=[]),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 e.allInstances=[],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.10.0",
"version": "1.10.1",
"publishConfig": {

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

"devDependencies": {
"@patternfly/pfe-sass": "^1.10.0"
"@patternfly/pfe-sass": "^1.10.1"
},

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

},
"gitHead": "ae94453e1f3f1c828c60ed73df1a6a4e9f2bd00d"
"gitHead": "179e4a0bc3f5f9ab439cf1c3963836651d0fcd37"
}

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