@swisspost/design-system-components 1.3.7 → 1.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/{index-2e693855.js → index-272283b3.js} +1 -1
- package/dist/cjs/{index-2e693855.js.map → index-272283b3.js.map} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/cjs/{package-7fd2c844.js → package-c661bf2f.js} +2 -2
- package/dist/cjs/{package-7fd2c844.js.map → package-c661bf2f.js.map} +1 -1
- package/dist/cjs/post-collapsible.cjs.entry.js +3 -3
- package/dist/cjs/post-collapsible.cjs.entry.js.map +1 -1
- package/dist/cjs/post-components.cjs.js +2 -2
- package/dist/cjs/post-components.cjs.js.map +1 -1
- package/dist/cjs/post-icon.cjs.entry.js +2 -2
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/post-collapsible/post-collapsible.css +16 -16
- package/dist/components/package.js +1 -1
- package/dist/components/post-collapsible.js +1 -1
- package/dist/components/post-collapsible.js.map +1 -1
- package/dist/docs.d.ts +174 -0
- package/dist/docs.json +2 -2
- package/dist/esm/{index-cfac2b9c.js → index-60a84798.js} +1 -1
- package/dist/esm/{index-cfac2b9c.js.map → index-60a84798.js.map} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/{package-bd73aa5f.js → package-adf815bd.js} +2 -2
- package/dist/esm/{package-bd73aa5f.js.map → package-adf815bd.js.map} +1 -1
- package/dist/esm/post-collapsible.entry.js +3 -3
- package/dist/esm/post-collapsible.entry.js.map +1 -1
- package/dist/esm/post-components.js +3 -3
- package/dist/esm/post-components.js.map +1 -1
- package/dist/esm/post-icon.entry.js +2 -2
- package/dist/post-components/{p-5550fb3f.js → p-0096c140.js} +1 -1
- package/dist/post-components/{p-5550fb3f.js.map → p-0096c140.js.map} +1 -1
- package/dist/post-components/{p-2a5781d1.js → p-05d38c8e.js} +2 -2
- package/dist/post-components/p-4eaaf8eb.entry.js +2 -0
- package/dist/post-components/{p-6bc7135d.entry.js.map → p-4eaaf8eb.entry.js.map} +1 -1
- package/dist/post-components/{p-d38f726e.entry.js → p-5cd6cb3a.entry.js} +2 -2
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/post-components/post-components.esm.js.map +1 -1
- package/package.json +19 -17
- package/dist/post-components/p-6bc7135d.entry.js +0 -2
- /package/dist/post-components/{p-2a5781d1.js.map → p-05d38c8e.js.map} +0 -0
- /package/dist/post-components/{p-d38f726e.entry.js.map → p-5cd6cb3a.entry.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"post-collapsible.js","mappings":";;;SAGgB,gBAAgB,CAAC,EAAe,EAAE,mBAAsC,EAAE;EACxF,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC;IAAE,gBAAgB,GAAG,CAAC,gBAAgB,CAAC,CAAC;EAE5E,MAAM,YAAY,GAAG,gBAAgB,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;EACrF,IAAI,YAAY,CAAC,MAAM;IAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,CAAC;EAE3D,MAAM,YAAY,GAAG,EAAE,CAAC,YAAY,CAAC;EAErC,IAAI,YAAY,CAAC,MAAM;IAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC,CAAC;EAE9D,OAAO,YAAY,CAAC;AACtB;;SCdgB,kBAAkB;EAChC,OAAO,MAAM,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAC,OAAO,CAAC;AACvE;;ACAO,eAAe,eAAe,CAAC,EAAe;EACnD,OAAO,IAAI,OAAO,CAAC,OAAO;IACxB,IAAI,kBAAkB,EAAE,EAAE;MACxB,OAAO,EAAE,CAAC;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E,CAAC,CAAC;GACR;EAEO,kBAAkB;IACxB,OAAO,IAAI,CAAC,MAAM,GAAG,eAAe,GAAG,UAAU,CAAC;GACnD;EAED,MAAM;IACJ,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;MACnB,QACE,WACE,EAAE,EAAE,GAAG,IAAI,CAAC,aAAa,YAAY,EACrC,KAAK,EAAE,IAAI,CAAC,eAAe,EAC3B,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,IAEtC,eAAQ,CACJ,EACN;KACH;IAED,QACE,EAAC,IAAI,oBAAe,OAAO,IACzB,WAAK,KAAK,EAAC,gBAAgB,IACzB,EAAC,IAAI,CAAC,UAAU,IAAC,KAAK,EAAC,kBAAkB,EAAC,EAAE,EAAE,GAAG,IAAI,CAAC,aAAa,UAAU,IAC3E,cACE,KAAK,EAAE,oBAAoB,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,WAAW,EAAE,EAC3D,IAAI,EAAC,QAAQ,mBACE,GAAG,IAAI,CAAC,MAAM,EAAE,mBAChB,GAAG,IAAI,CAAC,aAAa,YAAY,EAChD,OAAO,EAAE,IAAI,CAAC,sBAAsB,IAEpC,YAAM,IAAI,EAAC,QAAQ,GAAG,CACf,CACO,EAClB,WACE,EAAE,EAAE,GAAG,IAAI,CAAC,aAAa,YAAY,EACrC,KAAK,EAAE,sBAAsB,IAAI,CAAC,eAAe,EAAE,EACnD,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,qBACrB,GAAG,IAAI,CAAC,aAAa,UAAU,IAEhD,WAAK,KAAK,EAAC,gBAAgB,IACzB,eAAQ,CACJ,CACF,CACF,CACD,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["PostCollapsible"],"sources":["./src/utils/get-element-height.ts","./src/utils/should-reduce-motion.ts","./src/utils/on-transition-end.ts","./src/components/post-collapsible/post-collapsible.scss?tag=post-collapsible&encapsulation=shadow","./src/components/post-collapsible/post-collapsible.tsx"],"sourcesContent":["export function getElementHeight(el: HTMLElement): number;\nexport function getElementHeight(el: HTMLElement, classWhenShown: string): number;\nexport function getElementHeight(el: HTMLElement, classesWhenShown: string[]): number;\nexport function getElementHeight(el: HTMLElement, classesWhenShown: string | string[] = []): number {\n if (!Array.isArray(classesWhenShown)) classesWhenShown = [classesWhenShown];\n\n const classesToAdd = classesWhenShown.filter(klass => !el.classList.contains(klass));\n if (classesToAdd.length) el.classList.add(...classesToAdd);\n\n const scrollHeight = el.scrollHeight;\n\n if (classesToAdd.length) el.classList.remove(...classesToAdd);\n\n return scrollHeight;\n}\n","export function shouldReduceMotion(): boolean {\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n","import { shouldReduceMotion } from './should-reduce-motion';\n\nexport async function onTransitionEnd(el: HTMLElement): Promise<void> {\n return new Promise(resolve => {\n if (shouldReduceMotion()) {\n resolve();\n } else {\n el.ontransitionend = () => {\n resolve();\n el.ontransitionend = null;\n };\n }\n });\n}\n","@use '@swisspost/design-system-styles/basics';\n@use '@swisspost/design-system-styles/components/accordion';\n@use '@swisspost/design-system-styles/components/transitions';\n\n:host {\n display: block;\n}\n","import { Component, Element, h, Host, Method, Prop, State, Watch } from '@stencil/core';\nimport { checkOneOf, checkType, getElementHeight, onTransitionEnd } from '../../utils';\nimport { version } from '../../../package.json';\n\nlet nextId = 0;\n\n@Component({\n tag: 'post-collapsible',\n styleUrl: 'post-collapsible.scss',\n shadow: true,\n})\nexport class PostCollapsible {\n private collapsibleElement: HTMLElement;\n private isLoaded = false;\n\n @Element() host: HTMLPostCollapsibleElement;\n\n @State() collapseClasses: string;\n @State() collapseHeight: string | null = null;\n @State() collapsibleId: string;\n @State() hasHeader: boolean;\n @State() headingTag: string | undefined;\n @State() isOpen = true;\n @State() onAccordionButtonClick = () => this.toggle();\n\n /**\n * If `true`, the element is initially collapsed otherwise it is displayed.\n */\n @Prop() readonly collapsed?: boolean = false;\n\n @Watch('collapsed')\n validateCollapsed(newValue = this.collapsed) {\n checkType(newValue, 'boolean', 'The post-collapsible \"collapsed\" prop should be a boolean.');\n\n if (!this.isLoaded) {\n this.isOpen = !newValue;\n this.collapseClasses = this.getCollapseClasses();\n } else {\n setTimeout(() => {\n this.toggle(!newValue);\n });\n }\n }\n\n /**\n * Defines the hierarchical level of the collapsible header within the headings structure.\n */\n @Prop() readonly headingLevel?: number = 2;\n\n @Watch('headingLevel')\n validateHeadingLevel(newValue = this.headingLevel) {\n checkOneOf(\n newValue,\n [1, 2, 3, 4, 5, 6],\n 'The post-collapsible element requires a heading level between 1 and 6.',\n );\n\n this.headingTag = `h${newValue}`;\n }\n\n componentWillLoad() {\n this.validateCollapsed();\n this.validateHeadingLevel();\n\n this.hasHeader = this.host.querySelectorAll('[slot=\"header\"]').length > 0;\n if (!this.hasHeader) {\n console.warn(\n 'Be sure to bind the post-collapsible to its control using aria-controls and aria-expanded attributes. More information here: https://getbootstrap.com/docs/5.2/components/collapse/#accessibility',\n );\n }\n\n this.collapsibleId = this.host.id || `post-collapsible-${nextId++}`;\n this.collapseClasses = this.getCollapseClasses();\n }\n\n componentDidLoad() {\n this.isLoaded = true;\n this.collapsibleElement = this.host.shadowRoot.querySelector(\n `#${this.collapsibleId}--collapse`,\n );\n }\n\n /**\n * Triggers the collapse programmatically.\n */\n @Method()\n async toggle(open = !this.isOpen): Promise<boolean> {\n if (open !== this.isOpen) {\n this.isOpen = !this.isOpen;\n\n this.startTransition();\n\n await onTransitionEnd(this.collapsibleElement).then(() => {\n this.collapseHeight = null;\n this.collapseClasses = this.getCollapseClasses();\n });\n\n return this.isOpen;\n }\n }\n\n private startTransition() {\n const expandedHeight = getElementHeight(this.collapsibleElement, 'show');\n\n this.collapseHeight = `${this.isOpen ? 0 : expandedHeight}px`;\n this.collapseClasses = 'collapsing';\n\n setTimeout(() => {\n this.collapseHeight = `${this.isOpen ? expandedHeight : 0}px`;\n }, 50);\n }\n\n private getCollapseClasses() {\n return this.isOpen ? 'collapse show' : 'collapse';\n }\n\n render() {\n if (!this.hasHeader) {\n return (\n <div\n id={`${this.collapsibleId}--collapse`}\n class={this.collapseClasses}\n style={{ height: this.collapseHeight }}\n >\n <slot />\n </div>\n );\n }\n\n return (\n <Host data-version={version}>\n <div class=\"accordion-item\">\n <this.headingTag class=\"accordion-header\" id={`${this.collapsibleId}--header`}>\n <button\n class={`accordion-button ${this.isOpen ? '' : 'collapsed'}`}\n type=\"button\"\n aria-expanded={`${this.isOpen}`}\n aria-controls={`${this.collapsibleId}--collapse`}\n onClick={this.onAccordionButtonClick}\n >\n <slot name=\"header\" />\n </button>\n </this.headingTag>\n <div\n id={`${this.collapsibleId}--collapse`}\n class={`accordion-collapse ${this.collapseClasses}`}\n style={{ height: this.collapseHeight }}\n aria-labelledby={`${this.collapsibleId}--header`}\n >\n <div class=\"accordion-body\">\n <slot />\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"post-collapsible.js","mappings":";;;SAGgB,gBAAgB,CAAC,EAAe,EAAE,mBAAsC,EAAE;EACxF,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC;IAAE,gBAAgB,GAAG,CAAC,gBAAgB,CAAC,CAAC;EAE5E,MAAM,YAAY,GAAG,gBAAgB,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;EACrF,IAAI,YAAY,CAAC,MAAM;IAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,CAAC;EAE3D,MAAM,YAAY,GAAG,EAAE,CAAC,YAAY,CAAC;EAErC,IAAI,YAAY,CAAC,MAAM;IAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC,CAAC;EAE9D,OAAO,YAAY,CAAC;AACtB;;SCdgB,kBAAkB;EAChC,OAAO,MAAM,CAAC,UAAU,CAAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["PostCollapsible"],"sources":["./src/utils/get-element-height.ts","./src/utils/should-reduce-motion.ts","./src/utils/on-transition-end.ts","./src/components/post-collapsible/post-collapsible.scss?tag=post-collapsible&encapsulation=shadow","./src/components/post-collapsible/post-collapsible.tsx"],"sourcesContent":["export function getElementHeight(el: HTMLElement): number;\nexport function getElementHeight(el: HTMLElement, classWhenShown: string): number;\nexport function getElementHeight(el: HTMLElement, classesWhenShown: string[]): number;\nexport function getElementHeight(el: HTMLElement, classesWhenShown: string | string[] = []): number {\n if (!Array.isArray(classesWhenShown)) classesWhenShown = [classesWhenShown];\n\n const classesToAdd = classesWhenShown.filter(klass => !el.classList.contains(klass));\n if (classesToAdd.length) el.classList.add(...classesToAdd);\n\n const scrollHeight = el.scrollHeight;\n\n if (classesToAdd.length) el.classList.remove(...classesToAdd);\n\n return scrollHeight;\n}\n","export function shouldReduceMotion(): boolean {\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n","import { shouldReduceMotion } from './should-reduce-motion';\n\nexport async function onTransitionEnd(el: HTMLElement): Promise<void> {\n return new Promise(resolve => {\n if (shouldReduceMotion()) {\n resolve();\n } else {\n el.ontransitionend = () => {\n resolve();\n el.ontransitionend = null;\n };\n }\n });\n}\n","@use '@swisspost/design-system-styles/basics';\n@use '@swisspost/design-system-styles/components/accordion';\n@use '@swisspost/design-system-styles/components/transitions';\n\n:host {\n display: block;\n}\n","import { Component, Element, h, Host, Method, Prop, State, Watch } from '@stencil/core';\nimport { checkOneOf, checkType, getElementHeight, onTransitionEnd } from '../../utils';\nimport { version } from '../../../package.json';\n\nlet nextId = 0;\n\n@Component({\n tag: 'post-collapsible',\n styleUrl: 'post-collapsible.scss',\n shadow: true,\n})\nexport class PostCollapsible {\n private collapsibleElement: HTMLElement;\n private isLoaded = false;\n\n @Element() host: HTMLPostCollapsibleElement;\n\n @State() collapseClasses: string;\n @State() collapseHeight: string | null = null;\n @State() collapsibleId: string;\n @State() hasHeader: boolean;\n @State() headingTag: string | undefined;\n @State() isOpen = true;\n @State() onAccordionButtonClick = () => this.toggle();\n\n /**\n * If `true`, the element is initially collapsed otherwise it is displayed.\n */\n @Prop() readonly collapsed?: boolean = false;\n\n @Watch('collapsed')\n validateCollapsed(newValue = this.collapsed) {\n checkType(newValue, 'boolean', 'The post-collapsible \"collapsed\" prop should be a boolean.');\n\n if (!this.isLoaded) {\n this.isOpen = !newValue;\n this.collapseClasses = this.getCollapseClasses();\n } else {\n setTimeout(() => {\n this.toggle(!newValue);\n });\n }\n }\n\n /**\n * Defines the hierarchical level of the collapsible header within the headings structure.\n */\n @Prop() readonly headingLevel?: number = 2;\n\n @Watch('headingLevel')\n validateHeadingLevel(newValue = this.headingLevel) {\n checkOneOf(\n newValue,\n [1, 2, 3, 4, 5, 6],\n 'The post-collapsible element requires a heading level between 1 and 6.',\n );\n\n this.headingTag = `h${newValue}`;\n }\n\n componentWillLoad() {\n this.validateCollapsed();\n this.validateHeadingLevel();\n\n this.hasHeader = this.host.querySelectorAll('[slot=\"header\"]').length > 0;\n if (!this.hasHeader) {\n console.warn(\n 'Be sure to bind the post-collapsible to its control using aria-controls and aria-expanded attributes. More information here: https://getbootstrap.com/docs/5.2/components/collapse/#accessibility',\n );\n }\n\n this.collapsibleId = this.host.id || `post-collapsible-${nextId++}`;\n this.collapseClasses = this.getCollapseClasses();\n }\n\n componentDidLoad() {\n this.isLoaded = true;\n this.collapsibleElement = this.host.shadowRoot.querySelector(\n `#${this.collapsibleId}--collapse`,\n );\n }\n\n /**\n * Triggers the collapse programmatically.\n */\n @Method()\n async toggle(open = !this.isOpen): Promise<boolean> {\n if (open !== this.isOpen) {\n this.isOpen = !this.isOpen;\n\n this.startTransition();\n\n await onTransitionEnd(this.collapsibleElement).then(() => {\n this.collapseHeight = null;\n this.collapseClasses = this.getCollapseClasses();\n });\n\n return this.isOpen;\n }\n }\n\n private startTransition() {\n const expandedHeight = getElementHeight(this.collapsibleElement, 'show');\n\n this.collapseHeight = `${this.isOpen ? 0 : expandedHeight}px`;\n this.collapseClasses = 'collapsing';\n\n setTimeout(() => {\n this.collapseHeight = `${this.isOpen ? expandedHeight : 0}px`;\n }, 50);\n }\n\n private getCollapseClasses() {\n return this.isOpen ? 'collapse show' : 'collapse';\n }\n\n render() {\n if (!this.hasHeader) {\n return (\n <div\n id={`${this.collapsibleId}--collapse`}\n class={this.collapseClasses}\n style={{ height: this.collapseHeight }}\n >\n <slot />\n </div>\n );\n }\n\n return (\n <Host data-version={version}>\n <div class=\"accordion-item\">\n <this.headingTag class=\"accordion-header\" id={`${this.collapsibleId}--header`}>\n <button\n class={`accordion-button ${this.isOpen ? '' : 'collapsed'}`}\n type=\"button\"\n aria-expanded={`${this.isOpen}`}\n aria-controls={`${this.collapsibleId}--collapse`}\n onClick={this.onAccordionButtonClick}\n >\n <slot name=\"header\" />\n </button>\n </this.headingTag>\n <div\n id={`${this.collapsibleId}--collapse`}\n class={`accordion-collapse ${this.collapseClasses}`}\n style={{ height: this.collapseHeight }}\n aria-labelledby={`${this.collapsibleId}--header`}\n >\n <div class=\"accordion-body\">\n <slot />\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
package/dist/docs.d.ts
CHANGED
|
@@ -3,48 +3,156 @@
|
|
|
3
3
|
* This is an autogenerated file created by the Stencil compiler.
|
|
4
4
|
* DO NOT MODIFY IT MANUALLY
|
|
5
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* A container for JSDoc metadata for a project
|
|
8
|
+
*/
|
|
6
9
|
export interface JsonDocs {
|
|
10
|
+
/**
|
|
11
|
+
* The metadata for the JSDocs for each component in a Stencil project
|
|
12
|
+
*/
|
|
7
13
|
components: JsonDocsComponent[];
|
|
14
|
+
/**
|
|
15
|
+
* The timestamp at which the metadata was generated, in the format YYYY-MM-DDThh:mm:ss
|
|
16
|
+
*/
|
|
8
17
|
timestamp: string;
|
|
9
18
|
compiler: {
|
|
19
|
+
/**
|
|
20
|
+
* The name of the compiler that generated the metadata
|
|
21
|
+
*/
|
|
10
22
|
name: string;
|
|
23
|
+
/**
|
|
24
|
+
* The version of the Stencil compiler that generated the metadata
|
|
25
|
+
*/
|
|
11
26
|
version: string;
|
|
27
|
+
/**
|
|
28
|
+
* The version of TypeScript that was used to generate the metadata
|
|
29
|
+
*/
|
|
12
30
|
typescriptVersion: string;
|
|
13
31
|
};
|
|
14
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Container for JSDoc metadata for a single Stencil component
|
|
35
|
+
*/
|
|
15
36
|
export interface JsonDocsComponent {
|
|
37
|
+
/**
|
|
38
|
+
* The directory containing the Stencil component, minus the file name.
|
|
39
|
+
*
|
|
40
|
+
* @example /workspaces/stencil-project/src/components/my-component
|
|
41
|
+
*/
|
|
16
42
|
dirPath?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The name of the file containing the Stencil component, with no path
|
|
45
|
+
*
|
|
46
|
+
* @example my-component.tsx
|
|
47
|
+
*/
|
|
17
48
|
fileName?: string;
|
|
49
|
+
/**
|
|
50
|
+
* The full path of the file containing the Stencil component
|
|
51
|
+
*
|
|
52
|
+
* @example /workspaces/stencil-project/src/components/my-component/my-component.tsx
|
|
53
|
+
*/
|
|
18
54
|
filePath?: string;
|
|
55
|
+
/**
|
|
56
|
+
* The path to the component's `readme.md` file, including the filename
|
|
57
|
+
*
|
|
58
|
+
* @example /workspaces/stencil-project/src/components/my-component/readme.md
|
|
59
|
+
*/
|
|
19
60
|
readmePath?: string;
|
|
61
|
+
/**
|
|
62
|
+
* The path to the component's `usage` directory
|
|
63
|
+
*
|
|
64
|
+
* @example /workspaces/stencil-project/src/components/my-component/usage/
|
|
65
|
+
*/
|
|
20
66
|
usagesDir?: string;
|
|
67
|
+
/**
|
|
68
|
+
* The encapsulation strategy for a component
|
|
69
|
+
*/
|
|
21
70
|
encapsulation: 'shadow' | 'scoped' | 'none';
|
|
71
|
+
/**
|
|
72
|
+
* The tag name for the component, for use in HTML
|
|
73
|
+
*/
|
|
22
74
|
tag: string;
|
|
75
|
+
/**
|
|
76
|
+
* The contents of a component's `readme.md` that are user generated.
|
|
77
|
+
*
|
|
78
|
+
* Auto-generated contents are not stored in this reference.
|
|
79
|
+
*/
|
|
23
80
|
readme: string;
|
|
81
|
+
/**
|
|
82
|
+
* The description of a Stencil component, found in the JSDoc that sits above the component's declaration
|
|
83
|
+
*/
|
|
24
84
|
docs: string;
|
|
85
|
+
/**
|
|
86
|
+
* JSDoc tags found in the JSDoc comment written atop a component's declaration
|
|
87
|
+
*/
|
|
25
88
|
docsTags: JsonDocsTag[];
|
|
26
89
|
/**
|
|
27
90
|
* The text from the class-level JSDoc for a Stencil component, if present.
|
|
28
91
|
*/
|
|
29
92
|
overview?: string;
|
|
93
|
+
/**
|
|
94
|
+
* A mapping of usage example file names to their contents for the component.
|
|
95
|
+
*/
|
|
30
96
|
usage: JsonDocsUsage;
|
|
97
|
+
/**
|
|
98
|
+
* Array of metadata for a component's `@Prop`s
|
|
99
|
+
*/
|
|
31
100
|
props: JsonDocsProp[];
|
|
101
|
+
/**
|
|
102
|
+
* Array of metadata for a component's `@Method`s
|
|
103
|
+
*/
|
|
32
104
|
methods: JsonDocsMethod[];
|
|
105
|
+
/**
|
|
106
|
+
* Array of metadata for a component's `@Event`s
|
|
107
|
+
*/
|
|
33
108
|
events: JsonDocsEvent[];
|
|
109
|
+
/**
|
|
110
|
+
* Array of metadata for a component's `@Listen` handlers
|
|
111
|
+
*/
|
|
34
112
|
listeners: JsonDocsListener[];
|
|
113
|
+
/**
|
|
114
|
+
* Array of metadata for a component's CSS styling information
|
|
115
|
+
*/
|
|
35
116
|
styles: JsonDocsStyle[];
|
|
117
|
+
/**
|
|
118
|
+
* Array of component Slot information, generated from `@slot` tags
|
|
119
|
+
*/
|
|
36
120
|
slots: JsonDocsSlot[];
|
|
121
|
+
/**
|
|
122
|
+
* Array of component Parts information, generate from `@part` tags
|
|
123
|
+
*/
|
|
37
124
|
parts: JsonDocsPart[];
|
|
125
|
+
/**
|
|
126
|
+
* Array of metadata describing where the current component is used
|
|
127
|
+
*/
|
|
38
128
|
dependents: string[];
|
|
129
|
+
/**
|
|
130
|
+
* Array of metadata listing the components which are used in current component
|
|
131
|
+
*/
|
|
39
132
|
dependencies: string[];
|
|
133
|
+
/**
|
|
134
|
+
* Describes a tree of components coupling
|
|
135
|
+
*/
|
|
40
136
|
dependencyGraph: JsonDocsDependencyGraph;
|
|
137
|
+
/**
|
|
138
|
+
* A deprecation reason/description found following a `@deprecated` tag
|
|
139
|
+
*/
|
|
41
140
|
deprecation?: string;
|
|
42
141
|
}
|
|
43
142
|
export interface JsonDocsDependencyGraph {
|
|
44
143
|
[tagName: string]: string[];
|
|
45
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* A descriptor for a single JSDoc tag found in a block comment
|
|
147
|
+
*/
|
|
46
148
|
export interface JsonDocsTag {
|
|
149
|
+
/**
|
|
150
|
+
* The tag name (immediately following the '@')
|
|
151
|
+
*/
|
|
47
152
|
name: string;
|
|
153
|
+
/**
|
|
154
|
+
* The description that immediately follows the tag name
|
|
155
|
+
*/
|
|
48
156
|
text?: string;
|
|
49
157
|
}
|
|
50
158
|
export interface JsonDocsValue {
|
|
@@ -74,21 +182,64 @@ export interface JsonDocsValue {
|
|
|
74
182
|
export interface JsonDocsUsage {
|
|
75
183
|
[key: string]: string;
|
|
76
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* An intermediate representation of a `@Prop` decorated member's JSDoc
|
|
187
|
+
*/
|
|
77
188
|
export interface JsonDocsProp {
|
|
189
|
+
/**
|
|
190
|
+
* the name of the prop
|
|
191
|
+
*/
|
|
78
192
|
name: string;
|
|
193
|
+
/**
|
|
194
|
+
* the type of the prop, in terms of the TypeScript type system (as opposed to JavaScript's or HTML's)
|
|
195
|
+
*/
|
|
79
196
|
type: string;
|
|
197
|
+
/**
|
|
198
|
+
* `true` if the prop was configured as "mutable" where it was declared, `false` otherwise
|
|
199
|
+
*/
|
|
80
200
|
mutable: boolean;
|
|
81
201
|
/**
|
|
82
202
|
* The name of the attribute that is exposed to configure a compiled web component
|
|
83
203
|
*/
|
|
84
204
|
attr?: string;
|
|
205
|
+
/**
|
|
206
|
+
* `true` if the prop was configured to "reflect" back to HTML where it (the prop) was declared, `false` otherwise
|
|
207
|
+
*/
|
|
85
208
|
reflectToAttr: boolean;
|
|
209
|
+
/**
|
|
210
|
+
* the JSDoc description text associated with the prop
|
|
211
|
+
*/
|
|
86
212
|
docs: string;
|
|
213
|
+
/**
|
|
214
|
+
* JSDoc tags associated with the prop
|
|
215
|
+
*/
|
|
87
216
|
docsTags: JsonDocsTag[];
|
|
217
|
+
/**
|
|
218
|
+
* The default value of the prop
|
|
219
|
+
*/
|
|
88
220
|
default: string;
|
|
221
|
+
/**
|
|
222
|
+
* Deprecation text associated with the prop. This is the text that immediately follows a `@deprecated` tag
|
|
223
|
+
*/
|
|
89
224
|
deprecation?: string;
|
|
90
225
|
values: JsonDocsValue[];
|
|
226
|
+
/**
|
|
227
|
+
* `true` if a component is declared with a '?', `false` otherwise
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```tsx
|
|
231
|
+
* @Prop() componentProps?: any;
|
|
232
|
+
* ```
|
|
233
|
+
*/
|
|
91
234
|
optional: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* `true` if a component is declared with a '!', `false` otherwise
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* ```tsx
|
|
240
|
+
* @Prop() componentProps!: any;
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
92
243
|
required: boolean;
|
|
93
244
|
}
|
|
94
245
|
export interface JsonDocsMethod {
|
|
@@ -130,12 +281,35 @@ export interface JsonDocsListener {
|
|
|
130
281
|
capture: boolean;
|
|
131
282
|
passive: boolean;
|
|
132
283
|
}
|
|
284
|
+
/**
|
|
285
|
+
* A descriptor for a slot
|
|
286
|
+
*
|
|
287
|
+
* Objects of this type are translated from the JSDoc tag, `@slot`
|
|
288
|
+
*/
|
|
133
289
|
export interface JsonDocsSlot {
|
|
290
|
+
/**
|
|
291
|
+
* The name of the slot. Defaults to an empty string for an unnamed slot.
|
|
292
|
+
*/
|
|
134
293
|
name: string;
|
|
294
|
+
/**
|
|
295
|
+
* A textual description of the slot.
|
|
296
|
+
*/
|
|
135
297
|
docs: string;
|
|
136
298
|
}
|
|
299
|
+
/**
|
|
300
|
+
* A descriptor of a CSS Shadow Part
|
|
301
|
+
*
|
|
302
|
+
* Objects of this type are translated from the JSDoc tag, `@part`, or the 'part'
|
|
303
|
+
* attribute on a component in TSX
|
|
304
|
+
*/
|
|
137
305
|
export interface JsonDocsPart {
|
|
306
|
+
/**
|
|
307
|
+
* The name of the Shadow part
|
|
308
|
+
*/
|
|
138
309
|
name: string;
|
|
310
|
+
/**
|
|
311
|
+
* A textual description of the Shadow part.
|
|
312
|
+
*/
|
|
139
313
|
docs: string;
|
|
140
314
|
}
|
|
141
315
|
export interface StyleDoc {
|
package/dist/docs.json
CHANGED
|
@@ -1587,4 +1587,4 @@ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
|
1587
1587
|
|
|
1588
1588
|
export { Host as H, bootstrapLazy as b, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
|
|
1589
1589
|
|
|
1590
|
-
//# sourceMappingURL=index-
|
|
1590
|
+
//# sourceMappingURL=index-60a84798.js.map
|