feat(docs): add vscode docs support (#19309)

This commit is contained in:
Manu MA
2019-09-10 01:50:51 +02:00
committed by GitHub
parent e27962dcaf
commit a3f345c06d
3 changed files with 10 additions and 5 deletions

View File

@@ -34,7 +34,7 @@
"tslib": "^1.10.0"
},
"devDependencies": {
"@stencil/core": "1.3.2",
"@stencil/core": "1.4.0",
"@stencil/sass": "1.0.1",
"@types/jest": "24.0.17",
"@types/node": "12.7.1",

View File

@@ -9,22 +9,22 @@ export const watchForOptions = <T extends HTMLElement>(containerEl: HTMLElement,
return mutation;
};
const getSelectedOption = <T extends HTMLElement>(mutationList: MutationRecord[], tagName: string) => {
let newOption: T | undefined;
const getSelectedOption = <T extends HTMLElement>(mutationList: MutationRecord[], tagName: string): T | undefined => {
let newOption: HTMLElement | undefined;
mutationList.forEach(mut => {
// tslint:disable-next-line: prefer-for-of
for (let i = 0; i < mut.addedNodes.length; i++) {
newOption = findCheckedOption(mut.addedNodes[i], tagName) || newOption;
}
});
return newOption;
return newOption as any;
};
export const findCheckedOption = (el: any, tagName: string) => {
if (el.nodeType !== 1) {
return undefined;
}
const options = (el.tagName === tagName.toUpperCase())
const options: HTMLElement[] = (el.tagName === tagName.toUpperCase())
? [el]
: Array.from(el.querySelectorAll(tagName));

View File

@@ -69,6 +69,11 @@ export const config: Config = {
})
],
outputTargets: [
{
type: 'docs-vscode',
file: 'dist/html.html-data.json',
sourceCodeBaseUrl: 'https://github.com/ionic-team/ionic/tree/master/core/',
},
{
type: 'dist',
esmLoaderPath: '../loader',