Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cpelements/cp-documentation

Package Overview
Dependencies
Maintainers
4
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cpelements/cp-documentation - npm Package Compare versions

Comparing version 0.1.38 to 0.1.39

240

dist/cp-documentation.js
import PFElement from '../../../@patternfly/pfelement/dist/pfelement.js';
/*!
* PatternFly Elements: PfeDocumentation 0.1.38
* PatternFly Elements: PfeDocumentation 0.1.39
* @license

@@ -58,3 +58,3 @@ * Copyright 2020 Red Hat, Inc.

static get version() {
return "0.1.38";
return "0.1.39";
}

@@ -87,18 +87,2 @@

static get events() {
return {
// change: `${this.tag}:change`,
// loaded: `${this.tag}:loaded`
};
}
// Declare the type of this component
static get PfeType() {
return PFElement.PfeTypes.Container;
}
static get observedAttributes() {
return ["pfe-loaded", "pfe-endpoint", "pfe-css"];
}
constructor() {

@@ -109,2 +93,3 @@ super(PfeDocumentation, { type: PfeDocumentation.PfeType });

this._processLightDom = this._processLightDom.bind(this);
this._isDevelopment = this._isDevelopment.bind(this);
this._addStyleSheet = this._addStyleSheet.bind(this);

@@ -140,3 +125,3 @@ this._loadCss = this._loadCss.bind(this);

const styleSheet = document.styleSheets[index];
if (styleSheet.href && styleSheet.href.includes("rhdocs.")) {
if (styleSheet.href && styleSheet.href.includes("/rhdocs.")) {
// Get the exact same href so we get the cached file instead of hitting the network

@@ -163,5 +148,5 @@ rhdocsUrl = styleSheet.ownerNode.getAttribute("href");

this._contentType = this._contentData.content_type;
if (this._contentData.content_type === "assembly") {
this._loadChildModules();
}
// if (this._contentData.content_type === "assembly") {
// this._loadChildModules();
// }
} else if (

@@ -175,47 +160,47 @@ window.location.host.includes("access.") &&

: "module";
const pathArray = window.location.pathname.split("/");
const canonicalId = pathArray[pathArray.length - 1];
// const pathArray = window.location.pathname.split("/");
// const canonicalId = pathArray[pathArray.length - 1];
// Get domain for API Call
let portalDomain = null;
if (this._isDevelopment()) {
portalDomain = "pantheon.corp.qa.redhat.com";
} else if (typeof window.portal === "object") {
switch (window.portal.host) {
case "https://access.dev.redhat.com":
portalDomain = "pantheon.corp.dev.redhat.com";
break;
case "https://access.qa.redhat.com":
portalDomain = "pantheon.corp.qa.redhat.com";
break;
case "https://access.stage.redhat.com":
portalDomain = "pantheon.corp.stage.redhat.com";
break;
default:
portalDomain = "api.docs.redhat.com";
}
}
if (portalDomain && this._contentType && canonicalId) {
let fetchUrl = `https://${portalDomain}/api/${this._contentType}/variant.json/${canonicalId}`;
// let portalDomain = null;
// if (this._isDevelopment()) {
// portalDomain = "pantheon.corp.qa.redhat.com";
// } else if (typeof window.portal === "object") {
// switch (window.portal.host) {
// case "https://access.dev.redhat.com":
// portalDomain = "pantheon.corp.dev.redhat.com";
// break;
// case "https://access.qa.redhat.com":
// portalDomain = "pantheon.corp.qa.redhat.com";
// break;
// case "https://access.stage.redhat.com":
// portalDomain = "pantheon.corp.stage.redhat.com";
// break;
// default:
// portalDomain = "api.docs.redhat.com";
// }
// }
// if (typeof fetch === 'function' && portalDomain && this._contentType && canonicalId) {
// let fetchUrl = `https://${portalDomain}/api/${this._contentType}/variant.json/${canonicalId}`;
// @todo Remove this when not in dev
// if (window.location.host.includes('wruvalca')) {
// fetchUrl = `/api/${ this._contentType }/variant.json/${ canonicalId }`;
// }
// // @todo Remove this when not in dev
// // if (window.location.host.includes('wruvalca')) {
// // fetchUrl = `/api/${ this._contentType }/variant.json/${ canonicalId }`;
// // }
fetch(fetchUrl)
.then(response => response.json())
.then(data => {
if (
data.status === 200 &&
typeof data[this._contentType] === "object"
) {
this._contentData = data[this._contentType];
if (this._contentType === "assembly") {
this._loadChildModules();
}
}
})
.catch(error => console.error(error));
}
// fetch(fetchUrl)
// .then(response => response.json())
// .then(data => {
// if (
// data.status === 200 &&
// typeof data[this._contentType] === "object"
// ) {
// this._contentData = data[this._contentType];
// if (this._contentType === "assembly") {
// this._loadChildModules();
// }
// }
// })
// .catch(error => console.error(error));
// }
}

@@ -276,2 +261,10 @@

/**
* Feature test for important web component tech
* @returns {boolean} Returns true if the browser doesn't support shadow DOM
*/
_isCrustyBrowser() {
return window.ShadyCSS && !window.ShadyCSS.nativeShadow;
}
/**
* Takes URL's from the Pantheon API and makes sure they aren't pointing to origin, but instead an akamai enabled environment

@@ -317,7 +310,3 @@ * @param {string} urlToFix URL

_isDevelopment() {
return (
window.location.host.includes("local") ||
window.location.host.includes("docksal") ||
window.location.host.includes(".foo.")
);
return this.hasAttribute("debug");
}

@@ -398,3 +387,3 @@

// Preventing issues in IE11 & Edge
if (window.ShadyCSS) {
if (this._isCrustyBrowser()) {
this._observer.disconnect();

@@ -511,3 +500,3 @@ }

// Reconnecting mutationObserver for IE11 & Edge
if (window.ShadyCSS) {
if (this._isCrustyBrowser()) {
this._observer.observe(this, lightDomObserverConfig);

@@ -683,66 +672,51 @@ }

_loadChildModules() {
for (
let index = 0;
index < this._contentData.modules_included.length;
index++
) {
const moduleData = this._contentData.modules_included[index];
// Create reference maps to get module or variant uuid if we only have one
if (typeof this._contentData.moduleToVariantMap === "undefined") {
this._contentData.moduleToVariantMap = {};
this._contentData.variantToModuleMap = {};
}
if (
typeof this._contentData.moduleToVariantMap[moduleData.module_uuid] ===
"undefined"
) {
this._contentData.moduleToVariantMap[moduleData.module_uuid] = [];
}
this._contentData.variantToModuleMap[moduleData.canonical_uuid] =
moduleData.module_uuid;
this._contentData.moduleToVariantMap[moduleData.module_uuid].push(
moduleData
);
if (moduleData.url) {
// Load module data from api
let fetchUrl = this._portalEnvironmentFix(moduleData.url);
// @todo Remove when not in dev
// if (window.location.host.includes('wruvalca')) {
// fetchUrl = `/api/module/variant.json/${ moduleData.canonical_uuid }`;
// }
fetch(fetchUrl)
.then(response => response.json())
.then(data => {
if (typeof this._contentData.loadedModules === "undefined") {
this._contentData.loadedModules = {};
}
this._contentData.loadedModules[data.module.variant_uuid] =
data.module;
if (
typeof data.module.included_in_guides !== "undefined" &&
data.module.included_in_guides.length > 1
) {
this._addIncludedInGuides(data.module);
}
})
.catch(error => console.error(error));
}
}
// @todo Add back once API is fixed
// for (
// let index = 0;
// index < this._contentData.modules_included.length;
// index++
// ) {
// const moduleData = this._contentData.modules_included[index];
// // Create reference maps to get module or variant uuid if we only have one
// if (typeof this._contentData.moduleToVariantMap === "undefined") {
// this._contentData.moduleToVariantMap = {};
// this._contentData.variantToModuleMap = {};
// }
// if (
// typeof this._contentData.moduleToVariantMap[moduleData.module_uuid] ===
// "undefined"
// ) {
// this._contentData.moduleToVariantMap[moduleData.module_uuid] = [];
// }
// this._contentData.variantToModuleMap[moduleData.canonical_uuid] =
// moduleData.module_uuid;
// this._contentData.moduleToVariantMap[moduleData.module_uuid].push(
// moduleData
// );
// if (typeof fetch === 'function' && moduleData.url) {
// // Load module data from api
// let fetchUrl = this._portalEnvironmentFix(moduleData.url);
// // @todo Remove when not in dev
// // if (window.location.host.includes('wruvalca')) {
// // fetchUrl = `/api/module/variant.json/${ moduleData.canonical_uuid }`;
// // }
// fetch(fetchUrl)
// .then(response => response.json())
// .then(data => {
// if (typeof this._contentData.loadedModules === "undefined") {
// this._contentData.loadedModules = {};
// }
// this._contentData.loadedModules[data.module.variant_uuid] =
// data.module;
// if (
// typeof data.module.included_in_guides !== "undefined" &&
// data.module.included_in_guides.length > 1
// ) {
// this._addIncludedInGuides(data.module);
// }
// })
// .catch(error => console.error(error));
// }
// }
}
_changeHandler(event) {
this.emitEvent(PfeDocumentation.events.change, {
detail: {}
});
}
_loadedHandler(event) {
this.emitEvent(PfeDocumentation.events.loaded, {
detail: {}
});
}
}

@@ -749,0 +723,0 @@

import e from"../../../@patternfly/pfelement/dist/pfelement.min.js";
/*!
* PatternFly Elements: PfeDocumentation 0.1.38
* PatternFly Elements: PfeDocumentation 0.1.39
* @license

@@ -26,3 +26,3 @@ * Copyright 2020 Red Hat, Inc.

*/
Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;do{if(Element.prototype.matches.call(t,e))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType);return null});const t={characterData:!0,subtree:!0,childList:!0};class o extends e{static get version(){return"0.1.38"}get html(){return'<style>:host{display:block}:host([hidden]){display:none}:host([pfe-c-non-prod]) abbr[style],:host([pfe-c-non-prod]) address[style],:host([pfe-c-non-prod]) article[style],:host([pfe-c-non-prod]) aside[style],:host([pfe-c-non-prod]) b[style],:host([pfe-c-non-prod]) blockquote[style],:host([pfe-c-non-prod]) body[style],:host([pfe-c-non-prod]) canvas[style],:host([pfe-c-non-prod]) caption[style],:host([pfe-c-non-prod]) cite[style],:host([pfe-c-non-prod]) code[style],:host([pfe-c-non-prod]) dd[style],:host([pfe-c-non-prod]) del[style],:host([pfe-c-non-prod]) details[style],:host([pfe-c-non-prod]) dfn[style],:host([pfe-c-non-prod]) div[style],:host([pfe-c-non-prod]) dl[style],:host([pfe-c-non-prod]) dt[style],:host([pfe-c-non-prod]) em[style],:host([pfe-c-non-prod]) fieldset[style],:host([pfe-c-non-prod]) figcaption[style],:host([pfe-c-non-prod]) figure[style],:host([pfe-c-non-prod]) footer[style],:host([pfe-c-non-prod]) form[style],:host([pfe-c-non-prod]) h1[style],:host([pfe-c-non-prod]) h2[style],:host([pfe-c-non-prod]) h3[style],:host([pfe-c-non-prod]) h4[style],:host([pfe-c-non-prod]) h5[style],:host([pfe-c-non-prod]) h6[style],:host([pfe-c-non-prod]) header[style],:host([pfe-c-non-prod]) hgroup[style],:host([pfe-c-non-prod]) html[style],:host([pfe-c-non-prod]) i[style],:host([pfe-c-non-prod]) iframe[style],:host([pfe-c-non-prod]) ins[style],:host([pfe-c-non-prod]) kbd[style],:host([pfe-c-non-prod]) label[style],:host([pfe-c-non-prod]) legend[style],:host([pfe-c-non-prod]) li[style],:host([pfe-c-non-prod]) mark[style],:host([pfe-c-non-prod]) menu[style],:host([pfe-c-non-prod]) nav[style],:host([pfe-c-non-prod]) object[style],:host([pfe-c-non-prod]) ol[style],:host([pfe-c-non-prod]) p[style],:host([pfe-c-non-prod]) pre[style],:host([pfe-c-non-prod]) q[style],:host([pfe-c-non-prod]) samp[style],:host([pfe-c-non-prod]) section[style],:host([pfe-c-non-prod]) small[style],:host([pfe-c-non-prod]) span[style],:host([pfe-c-non-prod]) strong[style],:host([pfe-c-non-prod]) sub[style],:host([pfe-c-non-prod]) summary[style],:host([pfe-c-non-prod]) sup[style],:host([pfe-c-non-prod]) table[style],:host([pfe-c-non-prod]) tbody[style],:host([pfe-c-non-prod]) td[style],:host([pfe-c-non-prod]) tfoot[style],:host([pfe-c-non-prod]) th[style],:host([pfe-c-non-prod]) thead[style],:host([pfe-c-non-prod]) time[style],:host([pfe-c-non-prod]) tr[style],:host([pfe-c-non-prod]) ul[style],:host([pfe-c-non-prod]) var[style]{border:2px solid #c9190b}:host([pfe-c-non-prod]) abbr[style]:before,:host([pfe-c-non-prod]) address[style]:before,:host([pfe-c-non-prod]) article[style]:before,:host([pfe-c-non-prod]) aside[style]:before,:host([pfe-c-non-prod]) b[style]:before,:host([pfe-c-non-prod]) blockquote[style]:before,:host([pfe-c-non-prod]) body[style]:before,:host([pfe-c-non-prod]) canvas[style]:before,:host([pfe-c-non-prod]) caption[style]:before,:host([pfe-c-non-prod]) cite[style]:before,:host([pfe-c-non-prod]) code[style]:before,:host([pfe-c-non-prod]) dd[style]:before,:host([pfe-c-non-prod]) del[style]:before,:host([pfe-c-non-prod]) details[style]:before,:host([pfe-c-non-prod]) dfn[style]:before,:host([pfe-c-non-prod]) div[style]:before,:host([pfe-c-non-prod]) dl[style]:before,:host([pfe-c-non-prod]) dt[style]:before,:host([pfe-c-non-prod]) em[style]:before,:host([pfe-c-non-prod]) fieldset[style]:before,:host([pfe-c-non-prod]) figcaption[style]:before,:host([pfe-c-non-prod]) figure[style]:before,:host([pfe-c-non-prod]) footer[style]:before,:host([pfe-c-non-prod]) form[style]:before,:host([pfe-c-non-prod]) h1[style]:before,:host([pfe-c-non-prod]) h2[style]:before,:host([pfe-c-non-prod]) h3[style]:before,:host([pfe-c-non-prod]) h4[style]:before,:host([pfe-c-non-prod]) h5[style]:before,:host([pfe-c-non-prod]) h6[style]:before,:host([pfe-c-non-prod]) header[style]:before,:host([pfe-c-non-prod]) hgroup[style]:before,:host([pfe-c-non-prod]) html[style]:before,:host([pfe-c-non-prod]) i[style]:before,:host([pfe-c-non-prod]) iframe[style]:before,:host([pfe-c-non-prod]) ins[style]:before,:host([pfe-c-non-prod]) kbd[style]:before,:host([pfe-c-non-prod]) label[style]:before,:host([pfe-c-non-prod]) legend[style]:before,:host([pfe-c-non-prod]) li[style]:before,:host([pfe-c-non-prod]) mark[style]:before,:host([pfe-c-non-prod]) menu[style]:before,:host([pfe-c-non-prod]) nav[style]:before,:host([pfe-c-non-prod]) object[style]:before,:host([pfe-c-non-prod]) ol[style]:before,:host([pfe-c-non-prod]) p[style]:before,:host([pfe-c-non-prod]) pre[style]:before,:host([pfe-c-non-prod]) q[style]:before,:host([pfe-c-non-prod]) samp[style]:before,:host([pfe-c-non-prod]) section[style]:before,:host([pfe-c-non-prod]) small[style]:before,:host([pfe-c-non-prod]) span[style]:before,:host([pfe-c-non-prod]) strong[style]:before,:host([pfe-c-non-prod]) sub[style]:before,:host([pfe-c-non-prod]) summary[style]:before,:host([pfe-c-non-prod]) sup[style]:before,:host([pfe-c-non-prod]) table[style]:before,:host([pfe-c-non-prod]) tbody[style]:before,:host([pfe-c-non-prod]) td[style]:before,:host([pfe-c-non-prod]) tfoot[style]:before,:host([pfe-c-non-prod]) th[style]:before,:host([pfe-c-non-prod]) thead[style]:before,:host([pfe-c-non-prod]) time[style]:before,:host([pfe-c-non-prod]) tr[style]:before,:host([pfe-c-non-prod]) ul[style]:before,:host([pfe-c-non-prod]) var[style]:before{display:block;min-width:320px;max-width:100vw;padding:.5em 1em;background:#fee;content:"WARNING: This -moz-element has inline styles which can easily break layout on mobile or other contexts. The inline style is " attr(style);content:"WARNING: This element has inline styles which can easily break layout on mobile or other contexts. The inline style is " attr(style)}.warning-message{display:block;min-width:320px;max-width:100vw;padding:.5em 1em;background:#fee}\n/*# sourceMappingURL=cp-documentation.min.css.map */\n</style><div id="wrapper" class="rhdocs"></div>'}static get tag(){return"cp-documentation"}static get properties(){return{}}static get slots(){return{}}get templateUrl(){return"cp-documentation.html"}get styleUrl(){return"cp-documentation.scss"}static get events(){return{}}static get PfeType(){return e.PfeTypes.Container}static get observedAttributes(){return["pfe-loaded","pfe-endpoint","pfe-css"]}constructor(){super(o,{type:o.PfeType}),this._processLightDom=this._processLightDom.bind(this),this._addStyleSheet=this._addStyleSheet.bind(this),this._loadCss=this._loadCss.bind(this),this.loadData=this.loadData.bind(this),this.getData=this.getData.bind(this),this._navigationHandler=this._navigationHandler.bind(this),this._loadChildModules=this._loadChildModules.bind(this),this._addIncludedInGuides=this._addIncludedInGuides.bind(this),this._observer=new MutationObserver(this._processLightDom),this._contentData={},this._contentType=null}connectedCallback(){if(super.connectedCallback(),this.hasAttribute("pfe-css"))this._loadCss();else{let e="/webassets/avalon/j/public_modules/node_modules/@cpelements/cp-documentation/dist/rhdocs.min.css";for(let t=0;t<document.styleSheets.length;t++){const o=document.styleSheets[t];if(o.href&&o.href.includes("rhdocs.")){e=o.ownerNode.getAttribute("href");break}}this._addStyleSheet(e)}if("object"==typeof drupalSettings&&drupalSettings.red_hat_fcc)"string"==typeof drupalSettings.red_hat_fcc.content_metadata?this._contentData=JSON.parse(drupalSettings.red_hat_fcc.content_metadata):"object"==typeof drupalSettings.red_hat_fcc.content_metadata&&(this._contentData=drupalSettings.red_hat_fcc.content_metadata),this._contentType=this._contentData.content_type,"assembly"===this._contentData.content_type&&this._loadChildModules();else if(window.location.host.includes("access.")&&".redhat.com"===window.location.host.substring(-11)){this._contentType=document.querySelector(".rhdocs__header--assembly")?"assembly":"module";const e=window.location.pathname.split("/"),t=e[e.length-1];let o=null;if(this._isDevelopment())o="pantheon.corp.qa.redhat.com";else if("object"==typeof window.portal)switch(window.portal.host){case"https://access.dev.redhat.com":o="pantheon.corp.dev.redhat.com";break;case"https://access.qa.redhat.com":o="pantheon.corp.qa.redhat.com";break;case"https://access.stage.redhat.com":o="pantheon.corp.stage.redhat.com";break;default:o="api.docs.redhat.com"}if(o&&this._contentType&&t){let e=`https://${o}/api/${this._contentType}/variant.json/${t}`;fetch(e).then(e=>e.json()).then(e=>{200===e.status&&"object"==typeof e[this._contentType]&&(this._contentData=e[this._contentType],"assembly"===this._contentType&&this._loadChildModules())}).catch(e=>console.error(e))}}document.querySelector(".rh-docs__sidebar")&&this.classList.add("pfe-documentation--next-to-sidebar"),this._processLightDom(),this._observer.observe(this,t),this.addEventListener(o.events.change,this._changeHandler),this.addEventListener(o.events.loaded,this._loadedHandler);const e=this.querySelector("#rhdocs-preamble");e&&!e.textContent.trim()&&e.remove(),window.location.hash&&window.addEventListener("load",this._navigationHandler),this.parentElement.classList.contains("rh-docs__content-wrapper")&&document.getElementById("rhdocs-header-external")&&this.classList.add("cp-documentation--has-external-header"),window.addEventListener("hashchange",this._navigationHandler)}disconnectedCallback(){this.removeEventListener(o.events.change,this._changeHandler),this.removeEventListener(o.events.loaded,this._loadedHandler)}attributeChangedCallback(e,t,o){switch(super.attributeChangedCallback(e,t,o),e){case"pfe-endpoint":this.loadData()}}_portalEnvironmentFix(e){return e=(e=(e=(e=(e=e.replace("http://","https://")).replace("pantheon2-dev.int.us-east.aws.preprod.paas.redhat.com","pantheon.corp.dev.redhat.com")).replace("pantheon2-qa.int.us-east.aws.preprod.paas.redhat.com","pantheon.corp.qa.redhat.com")).replace("pantheon2-stage.int.us-east.aws.preprod.paas.redhat.com","pantheon.corp.stage.redhat.com")).replace("pantheon2-proxy.ext.us-west.aws.prod.paas.redhat.com","api.docs.redhat.com"),(window.location.host.includes("wruvalca")||window.location.host.includes(".foo."))&&(e=e.substring(e.indexOf("/api"))),e}_isDevelopment(){return window.location.host.includes("local")||window.location.host.includes("docksal")||window.location.host.includes(".foo.")}_navigationHandler(){let e=this.shadowRoot.getElementById(window.location.hash.substring(1));e&&window.scrollTo(window.scrollX,e.offsetTop)}_createRelatedContentWrapper(e){"string"!=typeof e&&(e="topic");const t=document.createElement("details"),o=document.createElement("summary"),n=document.createElement("div");return t.classList.add("related-topic-content__wrapper"),"guide"===e&&(t.classList.add("related-topic-content__wrapper--for-guide"),t.setAttribute("open","")),o.classList.add("related-topic-content__title"),n.classList.add("related-topic-content__inner-wrapper"),o.innerText=`Content related to this ${e}`,t.append(o),t.append(n),[t,n]}_createPrintButton(){const e=document.createElement("button");e.innerText="Print",e.classList.add("rhdocs__print-button");const t=document.createElement("pfe-icon");return t.setAttribute("icon","web-print"),t.setAttribute("pfe-size","sm"),e.prepend(t),e.addEventListener("click",()=>{window.print()}),e}_processLightDom(e){window.ShadyCSS&&this._observer.disconnect(),this._isDevelopment()&&console.log(`${this.tag}: Processing Light Dom`,e);const o=this.shadowRoot.getElementById("wrapper"),n=this.shadowRoot.getElementById("content"),s=document.createElement("div");this.childNodes.forEach(e=>{const t=e.cloneNode(!0);s.append(t)});const r=s.querySelectorAll("._additional-resources");for(let e=0;e<r.length;e++){let t=r[e];const o=document.createElement("aside");if(o.setAttribute("class",t.getAttribute("class")),o.innerHTML=t.innerHTML,t.parentElement.replaceChild(o,t),t=o,"assembly"===this._contentType){const o=t.closest("section, article");if(o){const n=t.querySelector("h2"),s=e===r.length-1&&n?"guide":"topic",d=this._createRelatedContentWrapper(s);"guide"===s?(d[1].append(t),o.append(d[0])):(t.replaceWith(d[0]),d[1].append(t))}}}let d=s.querySelector(".rhdocs__header__secondary-wrapper");if(!s.querySelector("#rhdocs-header-external")&&document.getElementById("rhdocs-header-external")&&(d=document.querySelector("#rhdocs-header-external .rhdocs__header__secondary-wrapper")),d&&!d.querySelector(".rhdocs-print-button")){const e=document.createElement("li");e.classList.add("rh-docs-details-item"),e.classList.add("rhdocs-print-button"),e.append(this._createPrintButton()),d.append(e)}n?o.replaceChild(s,n):o.append(s),s.setAttribute("id","content"),window.ShadyCSS&&this._observer.observe(this,t)}_addStyleSheet(e){if(!this.shadowRoot.querySelector(`link[href='${e}']`)){const t=document.createElement("link");t.setAttribute("id","pfe-css"),t.setAttribute("href",e),t.setAttribute("rel","stylesheet"),this.shadowRoot.prepend(t)}}_loadCss(){this.hasAttribute("pfe-css")&&this._addStyleSheet(this.getAttribute("pfe-css"))}loadData(){const e=this.getAttribute("pfe-endpoint");e&&fetch(this._portalEnvironmentFix(e)).then(e=>e.json()).then(e=>{"object"==typeof e.module&&(this.setAttribute("pfe-loaded",""),this._contentData=e.module,this._contentData.body&&(this.innerHTML=this._contentData.body))}).catch(e=>console.error(`${this.tag}: ${e}`))}getData(){return Object.keys(this._contentData).length?this._contentData:null}_addIncludedInGuides(e){let t=this._contentData.variantToModuleMap[e.variant_uuid];if(this._contentData.moduleToVariantMap[t].length>1)console.error(`${this.tag}: The same module is used twice in this assembly, included in guides could not be added.`);else if(t){const o=this.shadowRoot.querySelector(`[pantheon-module-id="${t}"]`);if(o){const t=window.location.pathname.split("/"),n=[];for(let o=0;o<e.included_in_guides.length;o++){const s=e.included_in_guides[o];if(s.uuid!==this._contentData.uuid){const e=document.createElement("a");t[t.length-1]=s.uuid,e.setAttribute("href",`/${t.join("/")}`),e.innerText=s.title,n.push(e)}}let s=null;if(n.length>1){s=document.createElement("ul");for(let e=0;e<s.length;e++){const t=s[e],o=document.createElement("li");o.append(t),s.append(o)}}else s=n[0];const r=parseInt(o.querySelector("h1, h2, h3, h4, h5, h6").tagName.substring(1));let d=r>5?6:r+1;const a=document.createElement("aside");a.classList.add("included-in-guides");const c=document.createElement(`h${d}`);c.classList.add("included-in-guides__title"),c.innerText="Guides Including this topic",a.append(c),a.append(s);let l=o.querySelector(".related-topic-content__wrapper");if(l)l.querySelector(".related-topic-content__inner-wrapper").append(a);else{const e=this._createRelatedContentWrapper();l=e[0],e[1].append(a),o.append(l)}}}}_loadChildModules(){for(let e=0;e<this._contentData.modules_included.length;e++){const t=this._contentData.modules_included[e];if(void 0===this._contentData.moduleToVariantMap&&(this._contentData.moduleToVariantMap={},this._contentData.variantToModuleMap={}),void 0===this._contentData.moduleToVariantMap[t.module_uuid]&&(this._contentData.moduleToVariantMap[t.module_uuid]=[]),this._contentData.variantToModuleMap[t.canonical_uuid]=t.module_uuid,this._contentData.moduleToVariantMap[t.module_uuid].push(t),t.url){let e=this._portalEnvironmentFix(t.url);fetch(e).then(e=>e.json()).then(e=>{void 0===this._contentData.loadedModules&&(this._contentData.loadedModules={}),this._contentData.loadedModules[e.module.variant_uuid]=e.module,void 0!==e.module.included_in_guides&&e.module.included_in_guides.length>1&&this._addIncludedInGuides(e.module)}).catch(e=>console.error(e))}}}_changeHandler(e){this.emitEvent(o.events.change,{detail:{}})}_loadedHandler(e){this.emitEvent(o.events.loaded,{detail:{}})}}e.create(o);export default o;
Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;do{if(Element.prototype.matches.call(t,e))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType);return null});const t={characterData:!0,subtree:!0,childList:!0};class o extends e{static get version(){return"0.1.39"}get html(){return'<style>:host{display:block}:host([hidden]){display:none}:host([pfe-c-non-prod]) abbr[style],:host([pfe-c-non-prod]) address[style],:host([pfe-c-non-prod]) article[style],:host([pfe-c-non-prod]) aside[style],:host([pfe-c-non-prod]) b[style],:host([pfe-c-non-prod]) blockquote[style],:host([pfe-c-non-prod]) body[style],:host([pfe-c-non-prod]) canvas[style],:host([pfe-c-non-prod]) caption[style],:host([pfe-c-non-prod]) cite[style],:host([pfe-c-non-prod]) code[style],:host([pfe-c-non-prod]) dd[style],:host([pfe-c-non-prod]) del[style],:host([pfe-c-non-prod]) details[style],:host([pfe-c-non-prod]) dfn[style],:host([pfe-c-non-prod]) div[style],:host([pfe-c-non-prod]) dl[style],:host([pfe-c-non-prod]) dt[style],:host([pfe-c-non-prod]) em[style],:host([pfe-c-non-prod]) fieldset[style],:host([pfe-c-non-prod]) figcaption[style],:host([pfe-c-non-prod]) figure[style],:host([pfe-c-non-prod]) footer[style],:host([pfe-c-non-prod]) form[style],:host([pfe-c-non-prod]) h1[style],:host([pfe-c-non-prod]) h2[style],:host([pfe-c-non-prod]) h3[style],:host([pfe-c-non-prod]) h4[style],:host([pfe-c-non-prod]) h5[style],:host([pfe-c-non-prod]) h6[style],:host([pfe-c-non-prod]) header[style],:host([pfe-c-non-prod]) hgroup[style],:host([pfe-c-non-prod]) html[style],:host([pfe-c-non-prod]) i[style],:host([pfe-c-non-prod]) iframe[style],:host([pfe-c-non-prod]) ins[style],:host([pfe-c-non-prod]) kbd[style],:host([pfe-c-non-prod]) label[style],:host([pfe-c-non-prod]) legend[style],:host([pfe-c-non-prod]) li[style],:host([pfe-c-non-prod]) mark[style],:host([pfe-c-non-prod]) menu[style],:host([pfe-c-non-prod]) nav[style],:host([pfe-c-non-prod]) object[style],:host([pfe-c-non-prod]) ol[style],:host([pfe-c-non-prod]) p[style],:host([pfe-c-non-prod]) pre[style],:host([pfe-c-non-prod]) q[style],:host([pfe-c-non-prod]) samp[style],:host([pfe-c-non-prod]) section[style],:host([pfe-c-non-prod]) small[style],:host([pfe-c-non-prod]) span[style],:host([pfe-c-non-prod]) strong[style],:host([pfe-c-non-prod]) sub[style],:host([pfe-c-non-prod]) summary[style],:host([pfe-c-non-prod]) sup[style],:host([pfe-c-non-prod]) table[style],:host([pfe-c-non-prod]) tbody[style],:host([pfe-c-non-prod]) td[style],:host([pfe-c-non-prod]) tfoot[style],:host([pfe-c-non-prod]) th[style],:host([pfe-c-non-prod]) thead[style],:host([pfe-c-non-prod]) time[style],:host([pfe-c-non-prod]) tr[style],:host([pfe-c-non-prod]) ul[style],:host([pfe-c-non-prod]) var[style]{border:2px solid #c9190b}:host([pfe-c-non-prod]) abbr[style]:before,:host([pfe-c-non-prod]) address[style]:before,:host([pfe-c-non-prod]) article[style]:before,:host([pfe-c-non-prod]) aside[style]:before,:host([pfe-c-non-prod]) b[style]:before,:host([pfe-c-non-prod]) blockquote[style]:before,:host([pfe-c-non-prod]) body[style]:before,:host([pfe-c-non-prod]) canvas[style]:before,:host([pfe-c-non-prod]) caption[style]:before,:host([pfe-c-non-prod]) cite[style]:before,:host([pfe-c-non-prod]) code[style]:before,:host([pfe-c-non-prod]) dd[style]:before,:host([pfe-c-non-prod]) del[style]:before,:host([pfe-c-non-prod]) details[style]:before,:host([pfe-c-non-prod]) dfn[style]:before,:host([pfe-c-non-prod]) div[style]:before,:host([pfe-c-non-prod]) dl[style]:before,:host([pfe-c-non-prod]) dt[style]:before,:host([pfe-c-non-prod]) em[style]:before,:host([pfe-c-non-prod]) fieldset[style]:before,:host([pfe-c-non-prod]) figcaption[style]:before,:host([pfe-c-non-prod]) figure[style]:before,:host([pfe-c-non-prod]) footer[style]:before,:host([pfe-c-non-prod]) form[style]:before,:host([pfe-c-non-prod]) h1[style]:before,:host([pfe-c-non-prod]) h2[style]:before,:host([pfe-c-non-prod]) h3[style]:before,:host([pfe-c-non-prod]) h4[style]:before,:host([pfe-c-non-prod]) h5[style]:before,:host([pfe-c-non-prod]) h6[style]:before,:host([pfe-c-non-prod]) header[style]:before,:host([pfe-c-non-prod]) hgroup[style]:before,:host([pfe-c-non-prod]) html[style]:before,:host([pfe-c-non-prod]) i[style]:before,:host([pfe-c-non-prod]) iframe[style]:before,:host([pfe-c-non-prod]) ins[style]:before,:host([pfe-c-non-prod]) kbd[style]:before,:host([pfe-c-non-prod]) label[style]:before,:host([pfe-c-non-prod]) legend[style]:before,:host([pfe-c-non-prod]) li[style]:before,:host([pfe-c-non-prod]) mark[style]:before,:host([pfe-c-non-prod]) menu[style]:before,:host([pfe-c-non-prod]) nav[style]:before,:host([pfe-c-non-prod]) object[style]:before,:host([pfe-c-non-prod]) ol[style]:before,:host([pfe-c-non-prod]) p[style]:before,:host([pfe-c-non-prod]) pre[style]:before,:host([pfe-c-non-prod]) q[style]:before,:host([pfe-c-non-prod]) samp[style]:before,:host([pfe-c-non-prod]) section[style]:before,:host([pfe-c-non-prod]) small[style]:before,:host([pfe-c-non-prod]) span[style]:before,:host([pfe-c-non-prod]) strong[style]:before,:host([pfe-c-non-prod]) sub[style]:before,:host([pfe-c-non-prod]) summary[style]:before,:host([pfe-c-non-prod]) sup[style]:before,:host([pfe-c-non-prod]) table[style]:before,:host([pfe-c-non-prod]) tbody[style]:before,:host([pfe-c-non-prod]) td[style]:before,:host([pfe-c-non-prod]) tfoot[style]:before,:host([pfe-c-non-prod]) th[style]:before,:host([pfe-c-non-prod]) thead[style]:before,:host([pfe-c-non-prod]) time[style]:before,:host([pfe-c-non-prod]) tr[style]:before,:host([pfe-c-non-prod]) ul[style]:before,:host([pfe-c-non-prod]) var[style]:before{display:block;min-width:320px;max-width:100vw;padding:.5em 1em;background:#fee;content:"WARNING: This -moz-element has inline styles which can easily break layout on mobile or other contexts. The inline style is " attr(style);content:"WARNING: This element has inline styles which can easily break layout on mobile or other contexts. The inline style is " attr(style)}.warning-message{display:block;min-width:320px;max-width:100vw;padding:.5em 1em;background:#fee}\n/*# sourceMappingURL=cp-documentation.min.css.map */\n</style><div id="wrapper" class="rhdocs"></div>'}static get tag(){return"cp-documentation"}static get properties(){return{}}static get slots(){return{}}get templateUrl(){return"cp-documentation.html"}get styleUrl(){return"cp-documentation.scss"}constructor(){super(o,{type:o.PfeType}),this._processLightDom=this._processLightDom.bind(this),this._isDevelopment=this._isDevelopment.bind(this),this._addStyleSheet=this._addStyleSheet.bind(this),this._loadCss=this._loadCss.bind(this),this.loadData=this.loadData.bind(this),this.getData=this.getData.bind(this),this._navigationHandler=this._navigationHandler.bind(this),this._loadChildModules=this._loadChildModules.bind(this),this._addIncludedInGuides=this._addIncludedInGuides.bind(this),this._observer=new MutationObserver(this._processLightDom),this._contentData={},this._contentType=null}connectedCallback(){if(super.connectedCallback(),this.hasAttribute("pfe-css"))this._loadCss();else{let e="/webassets/avalon/j/public_modules/node_modules/@cpelements/cp-documentation/dist/rhdocs.min.css";for(let t=0;t<document.styleSheets.length;t++){const o=document.styleSheets[t];if(o.href&&o.href.includes("/rhdocs.")){e=o.ownerNode.getAttribute("href");break}}this._addStyleSheet(e)}"object"==typeof drupalSettings&&drupalSettings.red_hat_fcc?("string"==typeof drupalSettings.red_hat_fcc.content_metadata?this._contentData=JSON.parse(drupalSettings.red_hat_fcc.content_metadata):"object"==typeof drupalSettings.red_hat_fcc.content_metadata&&(this._contentData=drupalSettings.red_hat_fcc.content_metadata),this._contentType=this._contentData.content_type):window.location.host.includes("access.")&&".redhat.com"===window.location.host.substring(-11)&&(this._contentType=document.querySelector(".rhdocs__header--assembly")?"assembly":"module"),document.querySelector(".rh-docs__sidebar")&&this.classList.add("pfe-documentation--next-to-sidebar"),this._processLightDom(),this._observer.observe(this,t),this.addEventListener(o.events.change,this._changeHandler),this.addEventListener(o.events.loaded,this._loadedHandler);const e=this.querySelector("#rhdocs-preamble");e&&!e.textContent.trim()&&e.remove(),window.location.hash&&window.addEventListener("load",this._navigationHandler),this.parentElement.classList.contains("rh-docs__content-wrapper")&&document.getElementById("rhdocs-header-external")&&this.classList.add("cp-documentation--has-external-header"),window.addEventListener("hashchange",this._navigationHandler)}disconnectedCallback(){this.removeEventListener(o.events.change,this._changeHandler),this.removeEventListener(o.events.loaded,this._loadedHandler)}attributeChangedCallback(e,t,o){switch(super.attributeChangedCallback(e,t,o),e){case"pfe-endpoint":this.loadData()}}_isCrustyBrowser(){return window.ShadyCSS&&!window.ShadyCSS.nativeShadow}_portalEnvironmentFix(e){return e=(e=(e=(e=(e=e.replace("http://","https://")).replace("pantheon2-dev.int.us-east.aws.preprod.paas.redhat.com","pantheon.corp.dev.redhat.com")).replace("pantheon2-qa.int.us-east.aws.preprod.paas.redhat.com","pantheon.corp.qa.redhat.com")).replace("pantheon2-stage.int.us-east.aws.preprod.paas.redhat.com","pantheon.corp.stage.redhat.com")).replace("pantheon2-proxy.ext.us-west.aws.prod.paas.redhat.com","api.docs.redhat.com"),(window.location.host.includes("wruvalca")||window.location.host.includes(".foo."))&&(e=e.substring(e.indexOf("/api"))),e}_isDevelopment(){return this.hasAttribute("debug")}_navigationHandler(){let e=this.shadowRoot.getElementById(window.location.hash.substring(1));e&&window.scrollTo(window.scrollX,e.offsetTop)}_createRelatedContentWrapper(e){"string"!=typeof e&&(e="topic");const t=document.createElement("details"),o=document.createElement("summary"),n=document.createElement("div");return t.classList.add("related-topic-content__wrapper"),"guide"===e&&(t.classList.add("related-topic-content__wrapper--for-guide"),t.setAttribute("open","")),o.classList.add("related-topic-content__title"),n.classList.add("related-topic-content__inner-wrapper"),o.innerText=`Content related to this ${e}`,t.append(o),t.append(n),[t,n]}_createPrintButton(){const e=document.createElement("button");e.innerText="Print",e.classList.add("rhdocs__print-button");const t=document.createElement("pfe-icon");return t.setAttribute("icon","web-print"),t.setAttribute("pfe-size","sm"),e.prepend(t),e.addEventListener("click",()=>{window.print()}),e}_processLightDom(e){this._isCrustyBrowser()&&this._observer.disconnect(),this._isDevelopment()&&console.log(`${this.tag}: Processing Light Dom`,e);const o=this.shadowRoot.getElementById("wrapper"),n=this.shadowRoot.getElementById("content"),s=document.createElement("div");this.childNodes.forEach(e=>{const t=e.cloneNode(!0);s.append(t)});const r=s.querySelectorAll("._additional-resources");for(let e=0;e<r.length;e++){let t=r[e];const o=document.createElement("aside");if(o.setAttribute("class",t.getAttribute("class")),o.innerHTML=t.innerHTML,t.parentElement.replaceChild(o,t),t=o,"assembly"===this._contentType){const o=t.closest("section, article");if(o){const n=t.querySelector("h2"),s=e===r.length-1&&n?"guide":"topic",d=this._createRelatedContentWrapper(s);"guide"===s?(d[1].append(t),o.append(d[0])):(t.replaceWith(d[0]),d[1].append(t))}}}let d=s.querySelector(".rhdocs__header__secondary-wrapper");if(!s.querySelector("#rhdocs-header-external")&&document.getElementById("rhdocs-header-external")&&(d=document.querySelector("#rhdocs-header-external .rhdocs__header__secondary-wrapper")),d&&!d.querySelector(".rhdocs-print-button")){const e=document.createElement("li");e.classList.add("rh-docs-details-item"),e.classList.add("rhdocs-print-button"),e.append(this._createPrintButton()),d.append(e)}n?o.replaceChild(s,n):o.append(s),s.setAttribute("id","content"),this._isCrustyBrowser()&&this._observer.observe(this,t)}_addStyleSheet(e){if(!this.shadowRoot.querySelector(`link[href='${e}']`)){const t=document.createElement("link");t.setAttribute("id","pfe-css"),t.setAttribute("href",e),t.setAttribute("rel","stylesheet"),this.shadowRoot.prepend(t)}}_loadCss(){this.hasAttribute("pfe-css")&&this._addStyleSheet(this.getAttribute("pfe-css"))}loadData(){const e=this.getAttribute("pfe-endpoint");e&&fetch(this._portalEnvironmentFix(e)).then(e=>e.json()).then(e=>{"object"==typeof e.module&&(this.setAttribute("pfe-loaded",""),this._contentData=e.module,this._contentData.body&&(this.innerHTML=this._contentData.body))}).catch(e=>console.error(`${this.tag}: ${e}`))}getData(){return Object.keys(this._contentData).length?this._contentData:null}_addIncludedInGuides(e){let t=this._contentData.variantToModuleMap[e.variant_uuid];if(this._contentData.moduleToVariantMap[t].length>1)console.error(`${this.tag}: The same module is used twice in this assembly, included in guides could not be added.`);else if(t){const o=this.shadowRoot.querySelector(`[pantheon-module-id="${t}"]`);if(o){const t=window.location.pathname.split("/"),n=[];for(let o=0;o<e.included_in_guides.length;o++){const s=e.included_in_guides[o];if(s.uuid!==this._contentData.uuid){const e=document.createElement("a");t[t.length-1]=s.uuid,e.setAttribute("href",`/${t.join("/")}`),e.innerText=s.title,n.push(e)}}let s=null;if(n.length>1){s=document.createElement("ul");for(let e=0;e<s.length;e++){const t=s[e],o=document.createElement("li");o.append(t),s.append(o)}}else s=n[0];const r=parseInt(o.querySelector("h1, h2, h3, h4, h5, h6").tagName.substring(1));let d=r>5?6:r+1;const p=document.createElement("aside");p.classList.add("included-in-guides");const c=document.createElement(`h${d}`);c.classList.add("included-in-guides__title"),c.innerText="Guides Including this topic",p.append(c),p.append(s);let l=o.querySelector(".related-topic-content__wrapper");if(l)l.querySelector(".related-topic-content__inner-wrapper").append(p);else{const e=this._createRelatedContentWrapper();l=e[0],e[1].append(p),o.append(l)}}}}_loadChildModules(){}}e.create(o);export default o;
//# sourceMappingURL=cp-documentation.min.js.map

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

/*!
* PatternFly Elements: PfeDocumentation 0.1.38
* PatternFly Elements: PfeDocumentation 0.1.39
* @license

@@ -160,3 +160,3 @@ * Copyright 2020 Red Hat, Inc.

get: function get$$1() {
return "0.1.38";
return "0.1.39";
}

@@ -178,23 +178,2 @@ }, {

}
}, {
key: "events",
get: function get$$1() {
return {
// change: `${this.tag}:change`,
// loaded: `${this.tag}:loaded`
};
}
// Declare the type of this component
}, {
key: "PfeType",
get: function get$$1() {
return PFElement.PfeTypes.Container;
}
}, {
key: "observedAttributes",
get: function get$$1() {
return ["pfe-loaded", "pfe-endpoint", "pfe-css"];
}
}]);

@@ -209,2 +188,3 @@

_this._processLightDom = _this._processLightDom.bind(_this);
_this._isDevelopment = _this._isDevelopment.bind(_this);
_this._addStyleSheet = _this._addStyleSheet.bind(_this);

@@ -230,4 +210,2 @@ _this._loadCss = _this._loadCss.bind(_this);

value: function connectedCallback() {
var _this2 = this;
get(PfeDocumentation.prototype.__proto__ || Object.getPrototypeOf(PfeDocumentation.prototype), "connectedCallback", this).call(this);

@@ -245,3 +223,3 @@

var styleSheet = document.styleSheets[index];
if (styleSheet.href && styleSheet.href.includes("rhdocs.")) {
if (styleSheet.href && styleSheet.href.includes("/rhdocs.")) {
// Get the exact same href so we get the cached file instead of hitting the network

@@ -264,51 +242,53 @@ rhdocsUrl = styleSheet.ownerNode.getAttribute("href");

this._contentType = this._contentData.content_type;
if (this._contentData.content_type === "assembly") {
this._loadChildModules();
}
// if (this._contentData.content_type === "assembly") {
// this._loadChildModules();
// }
} else if (window.location.host.includes("access.") && window.location.host.substring(-11) === ".redhat.com") {
// Get content data by getting the current content's ID and fetching from the API
this._contentType = document.querySelector(".rhdocs__header--assembly") ? "assembly" : "module";
var pathArray = window.location.pathname.split("/");
var canonicalId = pathArray[pathArray.length - 1];
// const pathArray = window.location.pathname.split("/");
// const canonicalId = pathArray[pathArray.length - 1];
// Get domain for API Call
var portalDomain = null;
if (this._isDevelopment()) {
portalDomain = "pantheon.corp.qa.redhat.com";
} else if (_typeof(window.portal) === "object") {
switch (window.portal.host) {
case "https://access.dev.redhat.com":
portalDomain = "pantheon.corp.dev.redhat.com";
break;
case "https://access.qa.redhat.com":
portalDomain = "pantheon.corp.qa.redhat.com";
break;
case "https://access.stage.redhat.com":
portalDomain = "pantheon.corp.stage.redhat.com";
break;
default:
portalDomain = "api.docs.redhat.com";
}
}
if (portalDomain && this._contentType && canonicalId) {
var fetchUrl = "https://" + portalDomain + "/api/" + this._contentType + "/variant.json/" + canonicalId;
// let portalDomain = null;
// if (this._isDevelopment()) {
// portalDomain = "pantheon.corp.qa.redhat.com";
// } else if (typeof window.portal === "object") {
// switch (window.portal.host) {
// case "https://access.dev.redhat.com":
// portalDomain = "pantheon.corp.dev.redhat.com";
// break;
// case "https://access.qa.redhat.com":
// portalDomain = "pantheon.corp.qa.redhat.com";
// break;
// case "https://access.stage.redhat.com":
// portalDomain = "pantheon.corp.stage.redhat.com";
// break;
// default:
// portalDomain = "api.docs.redhat.com";
// }
// }
// if (typeof fetch === 'function' && portalDomain && this._contentType && canonicalId) {
// let fetchUrl = `https://${portalDomain}/api/${this._contentType}/variant.json/${canonicalId}`;
// @todo Remove this when not in dev
// if (window.location.host.includes('wruvalca')) {
// fetchUrl = `/api/${ this._contentType }/variant.json/${ canonicalId }`;
// }
// // @todo Remove this when not in dev
// // if (window.location.host.includes('wruvalca')) {
// // fetchUrl = `/api/${ this._contentType }/variant.json/${ canonicalId }`;
// // }
fetch(fetchUrl).then(function (response) {
return response.json();
}).then(function (data) {
if (data.status === 200 && _typeof(data[_this2._contentType]) === "object") {
_this2._contentData = data[_this2._contentType];
if (_this2._contentType === "assembly") {
_this2._loadChildModules();
}
}
}).catch(function (error) {
return console.error(error);
});
}
// fetch(fetchUrl)
// .then(response => response.json())
// .then(data => {
// if (
// data.status === 200 &&
// typeof data[this._contentType] === "object"
// ) {
// this._contentData = data[this._contentType];
// if (this._contentType === "assembly") {
// this._loadChildModules();
// }
// }
// })
// .catch(error => console.error(error));
// }
}

@@ -362,2 +342,13 @@

/**
* Feature test for important web component tech
* @returns {boolean} Returns true if the browser doesn't support shadow DOM
*/
}, {
key: "_isCrustyBrowser",
value: function _isCrustyBrowser() {
return window.ShadyCSS && !window.ShadyCSS.nativeShadow;
}
/**
* Takes URL's from the Pantheon API and makes sure they aren't pointing to origin, but instead an akamai enabled environment

@@ -392,3 +383,3 @@ * @param {string} urlToFix URL

value: function _isDevelopment() {
return window.location.host.includes("local") || window.location.host.includes("docksal") || window.location.host.includes(".foo.");
return this.hasAttribute("debug");
}

@@ -479,3 +470,3 @@

// Preventing issues in IE11 & Edge
if (window.ShadyCSS) {
if (this._isCrustyBrowser()) {
this._observer.disconnect();

@@ -566,3 +557,3 @@ }

// Reconnecting mutationObserver for IE11 & Edge
if (window.ShadyCSS) {
if (this._isCrustyBrowser()) {
this._observer.observe(this, lightDomObserverConfig);

@@ -611,3 +602,3 @@ }

value: function loadData() {
var _this3 = this;
var _this2 = this;

@@ -620,6 +611,6 @@ var endpointUrl = this.getAttribute("pfe-endpoint");

if (_typeof(data.module) === "object") {
_this3.setAttribute("pfe-loaded", "");
_this3._contentData = data.module;
if (_this3._contentData.body) {
_this3.innerHTML = _this3._contentData.body;
_this2.setAttribute("pfe-loaded", "");
_this2._contentData = data.module;
if (_this2._contentData.body) {
_this2.innerHTML = _this2._contentData.body;
}

@@ -630,3 +621,3 @@ }

.catch(function (error) {
return console.error(_this3.tag + ": " + error);
return console.error(_this2.tag + ": " + error);
});

@@ -739,57 +730,51 @@ }

value: function _loadChildModules() {
var _this4 = this;
for (var index = 0; index < this._contentData.modules_included.length; index++) {
var moduleData = this._contentData.modules_included[index];
// Create reference maps to get module or variant uuid if we only have one
if (typeof this._contentData.moduleToVariantMap === "undefined") {
this._contentData.moduleToVariantMap = {};
this._contentData.variantToModuleMap = {};
}
if (typeof this._contentData.moduleToVariantMap[moduleData.module_uuid] === "undefined") {
this._contentData.moduleToVariantMap[moduleData.module_uuid] = [];
}
this._contentData.variantToModuleMap[moduleData.canonical_uuid] = moduleData.module_uuid;
this._contentData.moduleToVariantMap[moduleData.module_uuid].push(moduleData);
if (moduleData.url) {
// Load module data from api
var fetchUrl = this._portalEnvironmentFix(moduleData.url);
// @todo Remove when not in dev
// if (window.location.host.includes('wruvalca')) {
// fetchUrl = `/api/module/variant.json/${ moduleData.canonical_uuid }`;
// }
fetch(fetchUrl).then(function (response) {
return response.json();
}).then(function (data) {
if (typeof _this4._contentData.loadedModules === "undefined") {
_this4._contentData.loadedModules = {};
}
_this4._contentData.loadedModules[data.module.variant_uuid] = data.module;
if (typeof data.module.included_in_guides !== "undefined" && data.module.included_in_guides.length > 1) {
_this4._addIncludedInGuides(data.module);
}
}).catch(function (error) {
return console.error(error);
});
}
}
// @todo Add back once API is fixed
// for (
// let index = 0;
// index < this._contentData.modules_included.length;
// index++
// ) {
// const moduleData = this._contentData.modules_included[index];
// // Create reference maps to get module or variant uuid if we only have one
// if (typeof this._contentData.moduleToVariantMap === "undefined") {
// this._contentData.moduleToVariantMap = {};
// this._contentData.variantToModuleMap = {};
// }
// if (
// typeof this._contentData.moduleToVariantMap[moduleData.module_uuid] ===
// "undefined"
// ) {
// this._contentData.moduleToVariantMap[moduleData.module_uuid] = [];
// }
// this._contentData.variantToModuleMap[moduleData.canonical_uuid] =
// moduleData.module_uuid;
// this._contentData.moduleToVariantMap[moduleData.module_uuid].push(
// moduleData
// );
// if (typeof fetch === 'function' && moduleData.url) {
// // Load module data from api
// let fetchUrl = this._portalEnvironmentFix(moduleData.url);
// // @todo Remove when not in dev
// // if (window.location.host.includes('wruvalca')) {
// // fetchUrl = `/api/module/variant.json/${ moduleData.canonical_uuid }`;
// // }
// fetch(fetchUrl)
// .then(response => response.json())
// .then(data => {
// if (typeof this._contentData.loadedModules === "undefined") {
// this._contentData.loadedModules = {};
// }
// this._contentData.loadedModules[data.module.variant_uuid] =
// data.module;
// if (
// typeof data.module.included_in_guides !== "undefined" &&
// data.module.included_in_guides.length > 1
// ) {
// this._addIncludedInGuides(data.module);
// }
// })
// .catch(error => console.error(error));
// }
// }
}
}, {
key: "_changeHandler",
value: function _changeHandler(event) {
this.emitEvent(PfeDocumentation.events.change, {
detail: {}
});
}
}, {
key: "_loadedHandler",
value: function _loadedHandler(event) {
this.emitEvent(PfeDocumentation.events.loaded, {
detail: {}
});
}
}]);

@@ -796,0 +781,0 @@ return PfeDocumentation;

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("../../../@patternfly/pfelement/dist/pfelement.umd.min")):"function"==typeof define&&define.amd?define(["../../../@patternfly/pfelement/dist/pfelement.umd.min"],t):e.PfeDocumentation=t(e.PFElement)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var d="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},t=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},o=function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e};function n(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,t,o){null===e&&(e=Function.prototype);var n=Object.getOwnPropertyDescriptor(e,t);if(void 0!==n){if("value"in n)return n.value;n=n.get;return void 0!==n?n.call(o):void 0}if(null!==(e=Object.getPrototypeOf(e)))return c(e,t,o)}var s=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};Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;do{if(Element.prototype.matches.call(t,e))return t}while(null!==(t=t.parentElement||t.parentNode)&&1===t.nodeType);return null});var i={characterData:!0,subtree:!0,childList:!0},o=(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)}(l,e),o(l,[{key:"html",get:function(){return'<style>:host{display:block}:host([hidden]){display:none}:host([pfe-c-non-prod]) abbr[style],:host([pfe-c-non-prod]) address[style],:host([pfe-c-non-prod]) article[style],:host([pfe-c-non-prod]) aside[style],:host([pfe-c-non-prod]) b[style],:host([pfe-c-non-prod]) blockquote[style],:host([pfe-c-non-prod]) body[style],:host([pfe-c-non-prod]) canvas[style],:host([pfe-c-non-prod]) caption[style],:host([pfe-c-non-prod]) cite[style],:host([pfe-c-non-prod]) code[style],:host([pfe-c-non-prod]) dd[style],:host([pfe-c-non-prod]) del[style],:host([pfe-c-non-prod]) details[style],:host([pfe-c-non-prod]) dfn[style],:host([pfe-c-non-prod]) div[style],:host([pfe-c-non-prod]) dl[style],:host([pfe-c-non-prod]) dt[style],:host([pfe-c-non-prod]) em[style],:host([pfe-c-non-prod]) fieldset[style],:host([pfe-c-non-prod]) figcaption[style],:host([pfe-c-non-prod]) figure[style],:host([pfe-c-non-prod]) footer[style],:host([pfe-c-non-prod]) form[style],:host([pfe-c-non-prod]) h1[style],:host([pfe-c-non-prod]) h2[style],:host([pfe-c-non-prod]) h3[style],:host([pfe-c-non-prod]) h4[style],:host([pfe-c-non-prod]) h5[style],:host([pfe-c-non-prod]) h6[style],:host([pfe-c-non-prod]) header[style],:host([pfe-c-non-prod]) hgroup[style],:host([pfe-c-non-prod]) html[style],:host([pfe-c-non-prod]) i[style],:host([pfe-c-non-prod]) iframe[style],:host([pfe-c-non-prod]) ins[style],:host([pfe-c-non-prod]) kbd[style],:host([pfe-c-non-prod]) label[style],:host([pfe-c-non-prod]) legend[style],:host([pfe-c-non-prod]) li[style],:host([pfe-c-non-prod]) mark[style],:host([pfe-c-non-prod]) menu[style],:host([pfe-c-non-prod]) nav[style],:host([pfe-c-non-prod]) object[style],:host([pfe-c-non-prod]) ol[style],:host([pfe-c-non-prod]) p[style],:host([pfe-c-non-prod]) pre[style],:host([pfe-c-non-prod]) q[style],:host([pfe-c-non-prod]) samp[style],:host([pfe-c-non-prod]) section[style],:host([pfe-c-non-prod]) small[style],:host([pfe-c-non-prod]) span[style],:host([pfe-c-non-prod]) strong[style],:host([pfe-c-non-prod]) sub[style],:host([pfe-c-non-prod]) summary[style],:host([pfe-c-non-prod]) sup[style],:host([pfe-c-non-prod]) table[style],:host([pfe-c-non-prod]) tbody[style],:host([pfe-c-non-prod]) td[style],:host([pfe-c-non-prod]) tfoot[style],:host([pfe-c-non-prod]) th[style],:host([pfe-c-non-prod]) thead[style],:host([pfe-c-non-prod]) time[style],:host([pfe-c-non-prod]) tr[style],:host([pfe-c-non-prod]) ul[style],:host([pfe-c-non-prod]) var[style]{border:2px solid #c9190b}:host([pfe-c-non-prod]) abbr[style]:before,:host([pfe-c-non-prod]) address[style]:before,:host([pfe-c-non-prod]) article[style]:before,:host([pfe-c-non-prod]) aside[style]:before,:host([pfe-c-non-prod]) b[style]:before,:host([pfe-c-non-prod]) blockquote[style]:before,:host([pfe-c-non-prod]) body[style]:before,:host([pfe-c-non-prod]) canvas[style]:before,:host([pfe-c-non-prod]) caption[style]:before,:host([pfe-c-non-prod]) cite[style]:before,:host([pfe-c-non-prod]) code[style]:before,:host([pfe-c-non-prod]) dd[style]:before,:host([pfe-c-non-prod]) del[style]:before,:host([pfe-c-non-prod]) details[style]:before,:host([pfe-c-non-prod]) dfn[style]:before,:host([pfe-c-non-prod]) div[style]:before,:host([pfe-c-non-prod]) dl[style]:before,:host([pfe-c-non-prod]) dt[style]:before,:host([pfe-c-non-prod]) em[style]:before,:host([pfe-c-non-prod]) fieldset[style]:before,:host([pfe-c-non-prod]) figcaption[style]:before,:host([pfe-c-non-prod]) figure[style]:before,:host([pfe-c-non-prod]) footer[style]:before,:host([pfe-c-non-prod]) form[style]:before,:host([pfe-c-non-prod]) h1[style]:before,:host([pfe-c-non-prod]) h2[style]:before,:host([pfe-c-non-prod]) h3[style]:before,:host([pfe-c-non-prod]) h4[style]:before,:host([pfe-c-non-prod]) h5[style]:before,:host([pfe-c-non-prod]) h6[style]:before,:host([pfe-c-non-prod]) header[style]:before,:host([pfe-c-non-prod]) hgroup[style]:before,:host([pfe-c-non-prod]) html[style]:before,:host([pfe-c-non-prod]) i[style]:before,:host([pfe-c-non-prod]) iframe[style]:before,:host([pfe-c-non-prod]) ins[style]:before,:host([pfe-c-non-prod]) kbd[style]:before,:host([pfe-c-non-prod]) label[style]:before,:host([pfe-c-non-prod]) legend[style]:before,:host([pfe-c-non-prod]) li[style]:before,:host([pfe-c-non-prod]) mark[style]:before,:host([pfe-c-non-prod]) menu[style]:before,:host([pfe-c-non-prod]) nav[style]:before,:host([pfe-c-non-prod]) object[style]:before,:host([pfe-c-non-prod]) ol[style]:before,:host([pfe-c-non-prod]) p[style]:before,:host([pfe-c-non-prod]) pre[style]:before,:host([pfe-c-non-prod]) q[style]:before,:host([pfe-c-non-prod]) samp[style]:before,:host([pfe-c-non-prod]) section[style]:before,:host([pfe-c-non-prod]) small[style]:before,:host([pfe-c-non-prod]) span[style]:before,:host([pfe-c-non-prod]) strong[style]:before,:host([pfe-c-non-prod]) sub[style]:before,:host([pfe-c-non-prod]) summary[style]:before,:host([pfe-c-non-prod]) sup[style]:before,:host([pfe-c-non-prod]) table[style]:before,:host([pfe-c-non-prod]) tbody[style]:before,:host([pfe-c-non-prod]) td[style]:before,:host([pfe-c-non-prod]) tfoot[style]:before,:host([pfe-c-non-prod]) th[style]:before,:host([pfe-c-non-prod]) thead[style]:before,:host([pfe-c-non-prod]) time[style]:before,:host([pfe-c-non-prod]) tr[style]:before,:host([pfe-c-non-prod]) ul[style]:before,:host([pfe-c-non-prod]) var[style]:before{display:block;min-width:320px;max-width:100vw;padding:.5em 1em;background:#fee;content:"WARNING: This -moz-element has inline styles which can easily break layout on mobile or other contexts. The inline style is " attr(style);content:"WARNING: This element has inline styles which can easily break layout on mobile or other contexts. The inline style is " attr(style)}.warning-message{display:block;min-width:320px;max-width:100vw;padding:.5em 1em;background:#fee}\n/*# sourceMappingURL=cp-documentation.min.css.map */\n</style><div id="wrapper" class="rhdocs"></div>'}},{key:"templateUrl",get:function(){return"cp-documentation.html"}},{key:"styleUrl",get:function(){return"cp-documentation.scss"}}],[{key:"version",get:function(){return"0.1.38"}},{key:"tag",get:function(){return"cp-documentation"}},{key:"properties",get:function(){return{}}},{key:"slots",get:function(){return{}}},{key:"events",get:function(){return{}}},{key:"PfeType",get:function(){return e.PfeTypes.Container}},{key:"observedAttributes",get:function(){return["pfe-loaded","pfe-endpoint","pfe-css"]}}]),o(l,[{key:"connectedCallback",value:function(){var t=this;if(c(l.prototype.__proto__||Object.getPrototypeOf(l.prototype),"connectedCallback",this).call(this),this.hasAttribute("pfe-css"))this._loadCss();else{for(var e="/webassets/avalon/j/public_modules/node_modules/@cpelements/cp-documentation/dist/rhdocs.min.css",o=0;o<document.styleSheets.length;o++){var n=document.styleSheets[o];if(n.href&&n.href.includes("rhdocs.")){e=n.ownerNode.getAttribute("href");break}}this._addStyleSheet(e)}if("object"===("undefined"==typeof drupalSettings?"undefined":d(drupalSettings))&&drupalSettings.red_hat_fcc)"string"==typeof drupalSettings.red_hat_fcc.content_metadata?this._contentData=JSON.parse(drupalSettings.red_hat_fcc.content_metadata):"object"===d(drupalSettings.red_hat_fcc.content_metadata)&&(this._contentData=drupalSettings.red_hat_fcc.content_metadata),this._contentType=this._contentData.content_type,"assembly"===this._contentData.content_type&&this._loadChildModules();else if(window.location.host.includes("access.")&&".redhat.com"===window.location.host.substring(-11)){this._contentType=document.querySelector(".rhdocs__header--assembly")?"assembly":"module";var s=window.location.pathname.split("/"),s=s[s.length-1],r=null;if(this._isDevelopment())r="pantheon.corp.qa.redhat.com";else if("object"===d(window.portal))switch(window.portal.host){case"https://access.dev.redhat.com":r="pantheon.corp.dev.redhat.com";break;case"https://access.qa.redhat.com":r="pantheon.corp.qa.redhat.com";break;case"https://access.stage.redhat.com":r="pantheon.corp.stage.redhat.com";break;default:r="api.docs.redhat.com"}r&&this._contentType&&s&&(a="https://"+r+"/api/"+this._contentType+"/variant.json/"+s,fetch(a).then(function(e){return e.json()}).then(function(e){200===e.status&&"object"===d(e[t._contentType])&&(t._contentData=e[t._contentType],"assembly"===t._contentType&&t._loadChildModules())}).catch(function(e){return console.error(e)}))}document.querySelector(".rh-docs__sidebar")&&this.classList.add("pfe-documentation--next-to-sidebar"),this._processLightDom(),this._observer.observe(this,i),this.addEventListener(l.events.change,this._changeHandler),this.addEventListener(l.events.loaded,this._loadedHandler);var a=this.querySelector("#rhdocs-preamble");a&&!a.textContent.trim()&&a.remove(),window.location.hash&&window.addEventListener("load",this._navigationHandler),this.parentElement.classList.contains("rh-docs__content-wrapper")&&document.getElementById("rhdocs-header-external")&&this.classList.add("cp-documentation--has-external-header"),window.addEventListener("hashchange",this._navigationHandler)}},{key:"disconnectedCallback",value:function(){this.removeEventListener(l.events.change,this._changeHandler),this.removeEventListener(l.events.loaded,this._loadedHandler)}},{key:"attributeChangedCallback",value:function(e,t,o){c(l.prototype.__proto__||Object.getPrototypeOf(l.prototype),"attributeChangedCallback",this).call(this,e,t,o),"pfe-endpoint"===e&&this.loadData()}},{key:"_portalEnvironmentFix",value:function(e){return e=(e=(e=(e=(e=e.replace("http://","https://")).replace("pantheon2-dev.int.us-east.aws.preprod.paas.redhat.com","pantheon.corp.dev.redhat.com")).replace("pantheon2-qa.int.us-east.aws.preprod.paas.redhat.com","pantheon.corp.qa.redhat.com")).replace("pantheon2-stage.int.us-east.aws.preprod.paas.redhat.com","pantheon.corp.stage.redhat.com")).replace("pantheon2-proxy.ext.us-west.aws.prod.paas.redhat.com","api.docs.redhat.com"),e=window.location.host.includes("wruvalca")||window.location.host.includes(".foo.")?e.substring(e.indexOf("/api")):e}},{key:"_isDevelopment",value:function(){return window.location.host.includes("local")||window.location.host.includes("docksal")||window.location.host.includes(".foo.")}},{key:"_navigationHandler",value:function(){var e=this.shadowRoot.getElementById(window.location.hash.substring(1));e&&window.scrollTo(window.scrollX,e.offsetTop)}},{key:"_createRelatedContentWrapper",value:function(e){"string"!=typeof e&&(e="topic");var t=document.createElement("details"),o=document.createElement("summary"),n=document.createElement("div");return t.classList.add("related-topic-content__wrapper"),"guide"===e&&(t.classList.add("related-topic-content__wrapper--for-guide"),t.setAttribute("open","")),o.classList.add("related-topic-content__title"),n.classList.add("related-topic-content__inner-wrapper"),o.innerText="Content related to this "+e,t.append(o),t.append(n),[t,n]}},{key:"_createPrintButton",value:function(){var e=document.createElement("button");e.innerText="Print",e.classList.add("rhdocs__print-button");var t=document.createElement("pfe-icon");return t.setAttribute("icon","web-print"),t.setAttribute("pfe-size","sm"),e.prepend(t),e.addEventListener("click",function(){window.print()}),e}},{key:"_processLightDom",value:function(e){window.ShadyCSS&&this._observer.disconnect(),this._isDevelopment()&&console.log(this.tag+": Processing Light Dom",e);var t=this.shadowRoot.getElementById("wrapper"),o=this.shadowRoot.getElementById("content"),n=document.createElement("div");this.childNodes.forEach(function(e){e=e.cloneNode(!0);n.append(e)});for(var s=n.querySelectorAll("._additional-resources"),r=0;r<s.length;r++){var a,d,c=s[r],l=document.createElement("aside");l.setAttribute("class",c.getAttribute("class")),l.innerHTML=c.innerHTML,c.parentElement.replaceChild(l,c),c=l,"assembly"!==this._contentType||(a=c.closest("section, article"))&&(d=c.querySelector("h2"),l=r===s.length-1&&d?"guide":"topic",d=this._createRelatedContentWrapper(l),"guide"==l?(d[1].append(c),a.append(d[0])):(c.replaceWith(d[0]),d[1].append(c)))}var p=n.querySelector(".rhdocs__header__secondary-wrapper");(p=!n.querySelector("#rhdocs-header-external")&&document.getElementById("rhdocs-header-external")?document.querySelector("#rhdocs-header-external .rhdocs__header__secondary-wrapper"):p)&&!p.querySelector(".rhdocs-print-button")&&((e=document.createElement("li")).classList.add("rh-docs-details-item"),e.classList.add("rhdocs-print-button"),e.append(this._createPrintButton()),p.append(e)),o?t.replaceChild(n,o):t.append(n),n.setAttribute("id","content"),window.ShadyCSS&&this._observer.observe(this,i)}},{key:"_addStyleSheet",value:function(e){var t;this.shadowRoot.querySelector("link[href='"+e+"']")||((t=document.createElement("link")).setAttribute("id","pfe-css"),t.setAttribute("href",e),t.setAttribute("rel","stylesheet"),this.shadowRoot.prepend(t))}},{key:"_loadCss",value:function(){this.hasAttribute("pfe-css")&&this._addStyleSheet(this.getAttribute("pfe-css"))}},{key:"loadData",value:function(){var t=this,e=this.getAttribute("pfe-endpoint");e&&fetch(this._portalEnvironmentFix(e)).then(function(e){return e.json()}).then(function(e){"object"===d(e.module)&&(t.setAttribute("pfe-loaded",""),t._contentData=e.module,t._contentData.body&&(t.innerHTML=t._contentData.body))}).catch(function(e){return console.error(t.tag+": "+e)})}},{key:"getData",value:function(){return Object.keys(this._contentData).length?this._contentData:null}},{key:"_addIncludedInGuides",value:function(e){var t=this._contentData.variantToModuleMap[e.variant_uuid];if(1<this._contentData.moduleToVariantMap[t].length)console.error(this.tag+": The same module is used twice in this assembly, included in guides could not be added.");else if(t){var o=this.shadowRoot.querySelector('[pantheon-module-id="'+t+'"]');if(o){for(var n=window.location.pathname.split("/"),s=[],r=0;r<e.included_in_guides.length;r++){var a,d=e.included_in_guides[r];d.uuid!==this._contentData.uuid&&(a=document.createElement("a"),n[n.length-1]=d.uuid,a.setAttribute("href","/"+n.join("/")),a.innerText=d.title,s.push(a))}var c=null;if(1<s.length)for(var c=document.createElement("ul"),l=0;l<c.length;l++){var p=c[l],i=document.createElement("li");i.append(p),c.append(i)}else c=s[0];var h=parseInt(o.querySelector("h1, h2, h3, h4, h5, h6").tagName.substring(1)),f=5<h?6:h+1,t=document.createElement("aside");t.classList.add("included-in-guides");h=document.createElement("h"+f);h.classList.add("included-in-guides__title"),h.innerText="Guides Including this topic",t.append(h),t.append(c);f=o.querySelector(".related-topic-content__wrapper");f?f.querySelector(".related-topic-content__inner-wrapper").append(t):(f=(h=this._createRelatedContentWrapper())[0],h[1].append(t),o.append(f))}}}},{key:"_loadChildModules",value:function(){for(var t=this,e=0;e<this._contentData.modules_included.length;e++){var o=this._contentData.modules_included[e];void 0===this._contentData.moduleToVariantMap&&(this._contentData.moduleToVariantMap={},this._contentData.variantToModuleMap={}),void 0===this._contentData.moduleToVariantMap[o.module_uuid]&&(this._contentData.moduleToVariantMap[o.module_uuid]=[]),this._contentData.variantToModuleMap[o.canonical_uuid]=o.module_uuid,this._contentData.moduleToVariantMap[o.module_uuid].push(o),o.url&&(o=this._portalEnvironmentFix(o.url),fetch(o).then(function(e){return e.json()}).then(function(e){void 0===t._contentData.loadedModules&&(t._contentData.loadedModules={}),t._contentData.loadedModules[e.module.variant_uuid]=e.module,void 0!==e.module.included_in_guides&&1<e.module.included_in_guides.length&&t._addIncludedInGuides(e.module)}).catch(function(e){return console.error(e)}))}}},{key:"_changeHandler",value:function(e){this.emitEvent(l.events.change,{detail:{}})}},{key:"_loadedHandler",value:function(e){this.emitEvent(l.events.loaded,{detail:{}})}}]),l);function l(){t(this,l);var e=s(this,(l.__proto__||Object.getPrototypeOf(l)).call(this,l,{type:l.PfeType}));return e._processLightDom=e._processLightDom.bind(e),e._addStyleSheet=e._addStyleSheet.bind(e),e._loadCss=e._loadCss.bind(e),e.loadData=e.loadData.bind(e),e.getData=e.getData.bind(e),e._navigationHandler=e._navigationHandler.bind(e),e._loadChildModules=e._loadChildModules.bind(e),e._addIncludedInGuides=e._addIncludedInGuides.bind(e),e._observer=new MutationObserver(e._processLightDom),e._contentData={},e._contentType=null,e}return e.create(o),o});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("../../../@patternfly/pfelement/dist/pfelement.umd.min")):"function"==typeof define&&define.amd?define(["../../../@patternfly/pfelement/dist/pfelement.umd.min"],t):e.PfeDocumentation=t(e.PFElement)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default: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},t=function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e};function n(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function d(e,t,o){null===e&&(e=Function.prototype);var n=Object.getOwnPropertyDescriptor(e,t);if(void 0===n){var s=Object.getPrototypeOf(e);return null===s?void 0:d(s,t,o)}if("value"in n)return n.value;var r=n.get;return void 0!==r?r.call(o):void 0}Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;do{if(Element.prototype.matches.call(t,e))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType);return null});var u={characterData:!0,subtree:!0,childList:!0},o=(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)}(r,e),t(r,[{key:"html",get:function(){return'<style>:host{display:block}:host([hidden]){display:none}:host([pfe-c-non-prod]) abbr[style],:host([pfe-c-non-prod]) address[style],:host([pfe-c-non-prod]) article[style],:host([pfe-c-non-prod]) aside[style],:host([pfe-c-non-prod]) b[style],:host([pfe-c-non-prod]) blockquote[style],:host([pfe-c-non-prod]) body[style],:host([pfe-c-non-prod]) canvas[style],:host([pfe-c-non-prod]) caption[style],:host([pfe-c-non-prod]) cite[style],:host([pfe-c-non-prod]) code[style],:host([pfe-c-non-prod]) dd[style],:host([pfe-c-non-prod]) del[style],:host([pfe-c-non-prod]) details[style],:host([pfe-c-non-prod]) dfn[style],:host([pfe-c-non-prod]) div[style],:host([pfe-c-non-prod]) dl[style],:host([pfe-c-non-prod]) dt[style],:host([pfe-c-non-prod]) em[style],:host([pfe-c-non-prod]) fieldset[style],:host([pfe-c-non-prod]) figcaption[style],:host([pfe-c-non-prod]) figure[style],:host([pfe-c-non-prod]) footer[style],:host([pfe-c-non-prod]) form[style],:host([pfe-c-non-prod]) h1[style],:host([pfe-c-non-prod]) h2[style],:host([pfe-c-non-prod]) h3[style],:host([pfe-c-non-prod]) h4[style],:host([pfe-c-non-prod]) h5[style],:host([pfe-c-non-prod]) h6[style],:host([pfe-c-non-prod]) header[style],:host([pfe-c-non-prod]) hgroup[style],:host([pfe-c-non-prod]) html[style],:host([pfe-c-non-prod]) i[style],:host([pfe-c-non-prod]) iframe[style],:host([pfe-c-non-prod]) ins[style],:host([pfe-c-non-prod]) kbd[style],:host([pfe-c-non-prod]) label[style],:host([pfe-c-non-prod]) legend[style],:host([pfe-c-non-prod]) li[style],:host([pfe-c-non-prod]) mark[style],:host([pfe-c-non-prod]) menu[style],:host([pfe-c-non-prod]) nav[style],:host([pfe-c-non-prod]) object[style],:host([pfe-c-non-prod]) ol[style],:host([pfe-c-non-prod]) p[style],:host([pfe-c-non-prod]) pre[style],:host([pfe-c-non-prod]) q[style],:host([pfe-c-non-prod]) samp[style],:host([pfe-c-non-prod]) section[style],:host([pfe-c-non-prod]) small[style],:host([pfe-c-non-prod]) span[style],:host([pfe-c-non-prod]) strong[style],:host([pfe-c-non-prod]) sub[style],:host([pfe-c-non-prod]) summary[style],:host([pfe-c-non-prod]) sup[style],:host([pfe-c-non-prod]) table[style],:host([pfe-c-non-prod]) tbody[style],:host([pfe-c-non-prod]) td[style],:host([pfe-c-non-prod]) tfoot[style],:host([pfe-c-non-prod]) th[style],:host([pfe-c-non-prod]) thead[style],:host([pfe-c-non-prod]) time[style],:host([pfe-c-non-prod]) tr[style],:host([pfe-c-non-prod]) ul[style],:host([pfe-c-non-prod]) var[style]{border:2px solid #c9190b}:host([pfe-c-non-prod]) abbr[style]:before,:host([pfe-c-non-prod]) address[style]:before,:host([pfe-c-non-prod]) article[style]:before,:host([pfe-c-non-prod]) aside[style]:before,:host([pfe-c-non-prod]) b[style]:before,:host([pfe-c-non-prod]) blockquote[style]:before,:host([pfe-c-non-prod]) body[style]:before,:host([pfe-c-non-prod]) canvas[style]:before,:host([pfe-c-non-prod]) caption[style]:before,:host([pfe-c-non-prod]) cite[style]:before,:host([pfe-c-non-prod]) code[style]:before,:host([pfe-c-non-prod]) dd[style]:before,:host([pfe-c-non-prod]) del[style]:before,:host([pfe-c-non-prod]) details[style]:before,:host([pfe-c-non-prod]) dfn[style]:before,:host([pfe-c-non-prod]) div[style]:before,:host([pfe-c-non-prod]) dl[style]:before,:host([pfe-c-non-prod]) dt[style]:before,:host([pfe-c-non-prod]) em[style]:before,:host([pfe-c-non-prod]) fieldset[style]:before,:host([pfe-c-non-prod]) figcaption[style]:before,:host([pfe-c-non-prod]) figure[style]:before,:host([pfe-c-non-prod]) footer[style]:before,:host([pfe-c-non-prod]) form[style]:before,:host([pfe-c-non-prod]) h1[style]:before,:host([pfe-c-non-prod]) h2[style]:before,:host([pfe-c-non-prod]) h3[style]:before,:host([pfe-c-non-prod]) h4[style]:before,:host([pfe-c-non-prod]) h5[style]:before,:host([pfe-c-non-prod]) h6[style]:before,:host([pfe-c-non-prod]) header[style]:before,:host([pfe-c-non-prod]) hgroup[style]:before,:host([pfe-c-non-prod]) html[style]:before,:host([pfe-c-non-prod]) i[style]:before,:host([pfe-c-non-prod]) iframe[style]:before,:host([pfe-c-non-prod]) ins[style]:before,:host([pfe-c-non-prod]) kbd[style]:before,:host([pfe-c-non-prod]) label[style]:before,:host([pfe-c-non-prod]) legend[style]:before,:host([pfe-c-non-prod]) li[style]:before,:host([pfe-c-non-prod]) mark[style]:before,:host([pfe-c-non-prod]) menu[style]:before,:host([pfe-c-non-prod]) nav[style]:before,:host([pfe-c-non-prod]) object[style]:before,:host([pfe-c-non-prod]) ol[style]:before,:host([pfe-c-non-prod]) p[style]:before,:host([pfe-c-non-prod]) pre[style]:before,:host([pfe-c-non-prod]) q[style]:before,:host([pfe-c-non-prod]) samp[style]:before,:host([pfe-c-non-prod]) section[style]:before,:host([pfe-c-non-prod]) small[style]:before,:host([pfe-c-non-prod]) span[style]:before,:host([pfe-c-non-prod]) strong[style]:before,:host([pfe-c-non-prod]) sub[style]:before,:host([pfe-c-non-prod]) summary[style]:before,:host([pfe-c-non-prod]) sup[style]:before,:host([pfe-c-non-prod]) table[style]:before,:host([pfe-c-non-prod]) tbody[style]:before,:host([pfe-c-non-prod]) td[style]:before,:host([pfe-c-non-prod]) tfoot[style]:before,:host([pfe-c-non-prod]) th[style]:before,:host([pfe-c-non-prod]) thead[style]:before,:host([pfe-c-non-prod]) time[style]:before,:host([pfe-c-non-prod]) tr[style]:before,:host([pfe-c-non-prod]) ul[style]:before,:host([pfe-c-non-prod]) var[style]:before{display:block;min-width:320px;max-width:100vw;padding:.5em 1em;background:#fee;content:"WARNING: This -moz-element has inline styles which can easily break layout on mobile or other contexts. The inline style is " attr(style);content:"WARNING: This element has inline styles which can easily break layout on mobile or other contexts. The inline style is " attr(style)}.warning-message{display:block;min-width:320px;max-width:100vw;padding:.5em 1em;background:#fee}\n/*# sourceMappingURL=cp-documentation.min.css.map */\n</style><div id="wrapper" class="rhdocs"></div>'}},{key:"templateUrl",get:function(){return"cp-documentation.html"}},{key:"styleUrl",get:function(){return"cp-documentation.scss"}}],[{key:"version",get:function(){return"0.1.39"}},{key:"tag",get:function(){return"cp-documentation"}},{key:"properties",get:function(){return{}}},{key:"slots",get:function(){return{}}}]),t(r,[{key:"connectedCallback",value:function(){if(d(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"connectedCallback",this).call(this),this.hasAttribute("pfe-css"))this._loadCss();else{for(var e="/webassets/avalon/j/public_modules/node_modules/@cpelements/cp-documentation/dist/rhdocs.min.css",t=0;t<document.styleSheets.length;t++){var o=document.styleSheets[t];if(o.href&&o.href.includes("/rhdocs.")){e=o.ownerNode.getAttribute("href");break}}this._addStyleSheet(e)}"object"===("undefined"==typeof drupalSettings?"undefined":s(drupalSettings))&&drupalSettings.red_hat_fcc?("string"==typeof drupalSettings.red_hat_fcc.content_metadata?this._contentData=JSON.parse(drupalSettings.red_hat_fcc.content_metadata):"object"===s(drupalSettings.red_hat_fcc.content_metadata)&&(this._contentData=drupalSettings.red_hat_fcc.content_metadata),this._contentType=this._contentData.content_type):window.location.host.includes("access.")&&".redhat.com"===window.location.host.substring(-11)&&(this._contentType=document.querySelector(".rhdocs__header--assembly")?"assembly":"module"),document.querySelector(".rh-docs__sidebar")&&this.classList.add("pfe-documentation--next-to-sidebar"),this._processLightDom(),this._observer.observe(this,u),this.addEventListener(r.events.change,this._changeHandler),this.addEventListener(r.events.loaded,this._loadedHandler);var n=this.querySelector("#rhdocs-preamble");n&&!n.textContent.trim()&&n.remove(),window.location.hash&&window.addEventListener("load",this._navigationHandler),this.parentElement.classList.contains("rh-docs__content-wrapper")&&document.getElementById("rhdocs-header-external")&&this.classList.add("cp-documentation--has-external-header"),window.addEventListener("hashchange",this._navigationHandler)}},{key:"disconnectedCallback",value:function(){this.removeEventListener(r.events.change,this._changeHandler),this.removeEventListener(r.events.loaded,this._loadedHandler)}},{key:"attributeChangedCallback",value:function(e,t,o){switch(d(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"attributeChangedCallback",this).call(this,e,t,o),e){case"pfe-endpoint":this.loadData()}}},{key:"_isCrustyBrowser",value:function(){return window.ShadyCSS&&!window.ShadyCSS.nativeShadow}},{key:"_portalEnvironmentFix",value:function(e){return e=(e=(e=(e=(e=e.replace("http://","https://")).replace("pantheon2-dev.int.us-east.aws.preprod.paas.redhat.com","pantheon.corp.dev.redhat.com")).replace("pantheon2-qa.int.us-east.aws.preprod.paas.redhat.com","pantheon.corp.qa.redhat.com")).replace("pantheon2-stage.int.us-east.aws.preprod.paas.redhat.com","pantheon.corp.stage.redhat.com")).replace("pantheon2-proxy.ext.us-west.aws.prod.paas.redhat.com","api.docs.redhat.com"),(window.location.host.includes("wruvalca")||window.location.host.includes(".foo."))&&(e=e.substring(e.indexOf("/api"))),e}},{key:"_isDevelopment",value:function(){return this.hasAttribute("debug")}},{key:"_navigationHandler",value:function(){var e=this.shadowRoot.getElementById(window.location.hash.substring(1));e&&window.scrollTo(window.scrollX,e.offsetTop)}},{key:"_createRelatedContentWrapper",value:function(e){"string"!=typeof e&&(e="topic");var t=document.createElement("details"),o=document.createElement("summary"),n=document.createElement("div");return t.classList.add("related-topic-content__wrapper"),"guide"===e&&(t.classList.add("related-topic-content__wrapper--for-guide"),t.setAttribute("open","")),o.classList.add("related-topic-content__title"),n.classList.add("related-topic-content__inner-wrapper"),o.innerText="Content related to this "+e,t.append(o),t.append(n),[t,n]}},{key:"_createPrintButton",value:function(){var e=document.createElement("button");e.innerText="Print",e.classList.add("rhdocs__print-button");var t=document.createElement("pfe-icon");return t.setAttribute("icon","web-print"),t.setAttribute("pfe-size","sm"),e.prepend(t),e.addEventListener("click",function(){window.print()}),e}},{key:"_processLightDom",value:function(e){this._isCrustyBrowser()&&this._observer.disconnect(),this._isDevelopment()&&console.log(this.tag+": Processing Light Dom",e);var t=this.shadowRoot.getElementById("wrapper"),o=this.shadowRoot.getElementById("content"),n=document.createElement("div");this.childNodes.forEach(function(e){var t=e.cloneNode(!0);n.append(t)});for(var s=n.querySelectorAll("._additional-resources"),r=0;r<s.length;r++){var d=s[r],p=document.createElement("aside");if(p.setAttribute("class",d.getAttribute("class")),p.innerHTML=d.innerHTML,d.parentElement.replaceChild(p,d),d=p,"assembly"===this._contentType){var a=d.closest("section, article");if(a){var c=d.querySelector("h2"),l=r===s.length-1&&c?"guide":"topic",i=this._createRelatedContentWrapper(l);"guide"==l?(i[1].append(d),a.append(i[0])):(d.replaceWith(i[0]),i[1].append(d))}}}var h=n.querySelector(".rhdocs__header__secondary-wrapper");if(!n.querySelector("#rhdocs-header-external")&&document.getElementById("rhdocs-header-external")&&(h=document.querySelector("#rhdocs-header-external .rhdocs__header__secondary-wrapper")),h&&!h.querySelector(".rhdocs-print-button")){var f=document.createElement("li");f.classList.add("rh-docs-details-item"),f.classList.add("rhdocs-print-button"),f.append(this._createPrintButton()),h.append(f)}o?t.replaceChild(n,o):t.append(n),n.setAttribute("id","content"),this._isCrustyBrowser()&&this._observer.observe(this,u)}},{key:"_addStyleSheet",value:function(e){if(!this.shadowRoot.querySelector("link[href='"+e+"']")){var t=document.createElement("link");t.setAttribute("id","pfe-css"),t.setAttribute("href",e),t.setAttribute("rel","stylesheet"),this.shadowRoot.prepend(t)}}},{key:"_loadCss",value:function(){this.hasAttribute("pfe-css")&&this._addStyleSheet(this.getAttribute("pfe-css"))}},{key:"loadData",value:function(){var t=this,e=this.getAttribute("pfe-endpoint");e&&fetch(this._portalEnvironmentFix(e)).then(function(e){return e.json()}).then(function(e){"object"===s(e.module)&&(t.setAttribute("pfe-loaded",""),t._contentData=e.module,t._contentData.body&&(t.innerHTML=t._contentData.body))}).catch(function(e){return console.error(t.tag+": "+e)})}},{key:"getData",value:function(){return Object.keys(this._contentData).length?this._contentData:null}},{key:"_addIncludedInGuides",value:function(e){var t=this._contentData.variantToModuleMap[e.variant_uuid];if(1<this._contentData.moduleToVariantMap[t].length)console.error(this.tag+": The same module is used twice in this assembly, included in guides could not be added.");else if(t){var o=this.shadowRoot.querySelector('[pantheon-module-id="'+t+'"]');if(o){for(var n=window.location.pathname.split("/"),s=[],r=0;r<e.included_in_guides.length;r++){var d=e.included_in_guides[r];if(d.uuid!==this._contentData.uuid){var p=document.createElement("a");n[n.length-1]=d.uuid,p.setAttribute("href","/"+n.join("/")),p.innerText=d.title,s.push(p)}}var a=null;if(1<s.length){a=document.createElement("ul");for(var c=0;c<a.length;c++){var l=a[c],i=document.createElement("li");i.append(l),a.append(i)}}else a=s[0];var h=parseInt(o.querySelector("h1, h2, h3, h4, h5, h6").tagName.substring(1)),f=5<h?6:h+1,u=document.createElement("aside");u.classList.add("included-in-guides");var y=document.createElement("h"+f);y.classList.add("included-in-guides__title"),y.innerText="Guides Including this topic",u.append(y),u.append(a);var b=o.querySelector(".related-topic-content__wrapper");if(b)b.querySelector(".related-topic-content__inner-wrapper").append(u);else{var m=this._createRelatedContentWrapper();b=m[0],m[1].append(u),o.append(b)}}}}},{key:"_loadChildModules",value:function(){}}]),r);function r(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r);var e=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}(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,r,{type:r.PfeType}));return e._processLightDom=e._processLightDom.bind(e),e._isDevelopment=e._isDevelopment.bind(e),e._addStyleSheet=e._addStyleSheet.bind(e),e._loadCss=e._loadCss.bind(e),e.loadData=e.loadData.bind(e),e.getData=e.getData.bind(e),e._navigationHandler=e._navigationHandler.bind(e),e._loadChildModules=e._loadChildModules.bind(e),e._addIncludedInGuides=e._addIncludedInGuides.bind(e),e._observer=new MutationObserver(e._processLightDom),e._contentData={},e._contentType=null,e}return e.create(o),o});
//# sourceMappingURL=cp-documentation.umd.min.js.map
{
"name": "@cpelements/cp-documentation",
"description": "Documentation element for PatternFly Elements",
"version": "0.1.38",
"version": "0.1.39",
"pfelement": {

@@ -6,0 +6,0 @@ "className": "PfeDocumentation",

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

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