@salesforcedevs/docs-components
Advanced tools
Comparing version 1.3.345-refactor-tab-alpha3 to 1.3.345-refactor-tab-alpha4
{ | ||
"name": "@salesforcedevs/docs-components", | ||
"version": "1.3.345-refactor-tab-alpha3", | ||
"version": "1.3.345-refactor-tab-alpha4", | ||
"description": "Docs Lightning web components for DSC", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -155,3 +155,3 @@ /* eslint-disable @lwc/lwc/no-document-query */ | ||
// Placeholder for childs renderedCallback | ||
protected renderedCallbackForLwcContentLayout?(): void; | ||
protected postRenderedCallback?(): void; | ||
@@ -178,3 +178,3 @@ renderedCallback(): void { | ||
// Dynamically call `renderedCallbackForLwcContentLayout` if it exists | ||
this.renderedCallbackForLwcContentLayout?.(); | ||
this.postRenderedCallback?.(); | ||
} | ||
@@ -365,2 +365,28 @@ } | ||
// eslint-disable-next-line no-undef | ||
updateTocItems(headingElements: any): void { | ||
const tocOptions = []; | ||
for (const headingElement of headingElements as any) { | ||
headingElement.id = headingElement.hash; | ||
// Update tocOptions from anchorTags only for H2, consider default as 2 as per component | ||
const headingAriaLevel = | ||
headingElement.attributes["aria-level"]?.nodeValue || "2"; | ||
const isH2 = headingAriaLevel === "2"; | ||
if (isH2) { | ||
const tocItem = { | ||
anchor: `#${headingElement.hash}`, | ||
id: headingElement.id, | ||
label: headingElement.header | ||
}; | ||
tocOptions.push(tocItem); | ||
this.tocOptionIdsSet.add(headingElement.id); | ||
} | ||
} | ||
this._tocOptions = tocOptions; | ||
} | ||
onSlotChange(event: Event): void { | ||
@@ -386,23 +412,3 @@ const slotElements = ( | ||
const tocOptions = []; | ||
for (const headingElement of headingElements as any) { | ||
headingElement.id = headingElement.hash; | ||
// Update tocOptions from anchorTags only for H2, consider default as 2 as per component | ||
const headingAriaLevel = | ||
headingElement.attributes["aria-level"]?.nodeValue || "2"; | ||
const isH2 = headingAriaLevel === "2"; | ||
if (isH2) { | ||
const tocItem = { | ||
anchor: `#${headingElement.hash}`, | ||
id: headingElement.id, | ||
label: headingElement.header | ||
}; | ||
tocOptions.push(tocItem); | ||
this.tocOptionIdsSet.add(headingElement.id); | ||
} | ||
} | ||
this._tocOptions = tocOptions; | ||
this.updateTocItems(headingElements); | ||
} | ||
@@ -409,0 +415,0 @@ } |
@@ -145,3 +145,3 @@ import ContentLayout from "doc/contentLayout"; | ||
renderedCallbackForLwcContentLayout(): void { | ||
postRenderedCallback(): void { | ||
this.setRNBByTab(); | ||
@@ -191,28 +191,2 @@ if (this.showTabBasedRNB) { | ||
} | ||
// eslint-disable-next-line no-undef | ||
private updateTocItems(headingElements: NodeListOf<Element>): void { | ||
const tocOptions = []; | ||
for (const headingElement of headingElements as any) { | ||
headingElement.id = headingElement.hash; | ||
// Update tocOptions from anchorTags only for H2, consider default as 2 as per component | ||
const headingAriaLevel = | ||
headingElement.attributes["aria-level"]?.nodeValue || "2"; | ||
const isH2 = headingAriaLevel === "2"; | ||
if (isH2) { | ||
const tocItem = { | ||
anchor: `#${headingElement.hash}`, | ||
id: headingElement.id, | ||
label: headingElement.header | ||
}; | ||
tocOptions.push(tocItem); | ||
this.tocOptionIdsSet.add(headingElement.id); | ||
} | ||
} | ||
this._tocOptions = tocOptions; | ||
} | ||
} |
276289
6883