@@ -3,13 +3,24 @@ import { isAllowedType, isValidDefaultType } from "./attrDefValidators.js";
33// Import polyfills: includes
44import "./polyfills--pfelement.js" ;
55
6+ // /**
7+ // * Global prefix used for all components in the project.
8+ // * @constant {String}
9+ // * */
610const prefix = "pfe" ;
711
12+ /**
13+ * @class PFElement
14+ * @extends HTMLElement
15+ * @version {{version}}
16+ * @classdesc Serves as the baseline for all PatternFly Element components.
17+ */
818class PFElement extends HTMLElement {
919 /**
1020 * A boolean value that indicates if the logging should be printed to the console; used for debugging.
11- *
12- * @example In a JS file or script tag: `PFElement._debugLog = true;`
21+ * For use in a JS file or script tag; can also be added in the constructor of a component during development.
22+ * @example PFElement._debugLog = true;
23+ * @tags debug
1324 */
1425 static debugLog ( preference = null ) {
1526 if ( preference !== null ) {
@@ -20,8 +31,8 @@ class PFElement extends HTMLElement {
2031
2132 /**
2233 * A boolean value that indicates if the performance should be tracked.
23- *
24- * @example In a JS file or script tag: ` PFElement._trackPerformance = true;`
34+ * For use in a JS file or script tag; can also be added in the constructor of a component during development.
35+ * @example PFElement._trackPerformance = true;
2536 */
2637 static trackPerformance ( preference = null ) {
2738 if ( preference !== null ) {
@@ -33,7 +44,7 @@ class PFElement extends HTMLElement {
3344 /**
3445 * A logging wrapper which checks the debugLog boolean and prints to the console if true.
3546 *
36- * @example ` PFElement.log("Hello")`
47+ * @example PFElement.log("Hello");
3748 */
3849 static log ( ...msgs ) {
3950 if ( PFElement . debugLog ( ) ) {
@@ -44,7 +55,7 @@ class PFElement extends HTMLElement {
4455 /**
4556 * Local logging that outputs the tag name as a prefix automatically
4657 *
47- * @example In a component's function: ` this.log("Hello")`
58+ * @example this.log("Hello");
4859 */
4960 log ( ...msgs ) {
5061 PFElement . log ( `[${ this . tag } ${ this . id ? `#${ this . id } ` : "" } ]: ${ msgs . join ( ", " ) } ` ) ;
@@ -53,34 +64,34 @@ class PFElement extends HTMLElement {
5364 /**
5465 * A console warning wrapper which formats your output with useful debugging information.
5566 *
56- * @example ` PFElement.warn("Hello")`
67+ * @example PFElement.warn("Hello");
5768 */
5869 static warn ( ...msgs ) {
5970 console . warn ( ...msgs ) ;
6071 }
6172
6273 /**
6374 * Local warning wrapper that outputs the tag name as a prefix automatically.
64- *
65- * @example In a component's function: ` this.warn("Hello")`
75+ * For use inside a component's function.
76+ * @example this.warn("Hello");
6677 */
6778 warn ( ...msgs ) {
6879 PFElement . warn ( `[${ this . tag } ${ this . id ? `#${ this . id } ` : `` } ]: ${ msgs . join ( ", " ) } ` ) ;
6980 }
7081
7182 /**
7283 * A console error wrapper which formats your output with useful debugging information.
73- *
74- * @example ` PFElement.error("Hello")`
84+ * For use inside a component's function.
85+ * @example PFElement.error("Hello");
7586 */
7687 static error ( ...msgs ) {
7788 throw new Error ( [ ...msgs ] . join ( " " ) ) ;
7889 }
7990
8091 /**
8192 * Local error wrapper that outputs the tag name as a prefix automatically.
82- *
83- * @example In a component's function: ` this.error("Hello")`
93+ * For use inside a component's function.
94+ * @example this.error("Hello");
8495 */
8596 error ( ...msgs ) {
8697 PFElement . error ( `[${ this . tag } ${ this . id ? `#${ this . id } ` : `` } ]:` , ...msgs ) ;
@@ -107,8 +118,8 @@ class PFElement extends HTMLElement {
107118
108119 /**
109120 * A local alias to the static version.
110- *
111- * @example : In the console: ` PfeAccordion.version`
121+ * For use in the console to validate version being loaded.
122+ * @example PfeAccordion.version
112123 */
113124 get version ( ) {
114125 return this . _pfeClass . version ;
@@ -175,7 +186,7 @@ class PFElement extends HTMLElement {
175186 * A quick way to fetch a random ID value.
176187 * _Note:_ All values are prefixes with `pfe` automatically to ensure an ID-safe value is returned.
177188 *
178- * @example : In a component's JS: ` this.id = this.randomID;`
189+ * @example this.id = this.randomID;
179190 */
180191 get randomId ( ) {
181192 return (
@@ -205,7 +216,7 @@ class PFElement extends HTMLElement {
205216 /**
206217 * Returns a boolean statement of whether or not this component contains any light DOM.
207218 * @returns {boolean }
208- * @examples ` if(this.hasLightDOM()) this._init();`
219+ * @example if(this.hasLightDOM()) this._init();
209220 */
210221 hasLightDOM ( ) {
211222 return this . children . length || this . textContent . trim ( ) . length ;
@@ -214,7 +225,7 @@ class PFElement extends HTMLElement {
214225 /**
215226 * Returns a boolean statement of whether or not that slot exists in the light DOM.
216227 *
217- * @example : ` this.hasSlot("header")`
228+ * @example this.hasSlot("header");
218229 */
219230 hasSlot ( name ) {
220231 if ( ! name ) {
@@ -1016,4 +1027,5 @@ class PFElement extends HTMLElement {
10161027
10171028autoReveal ( PFElement . log ) ;
10181029
1030+ /** @module PFElement */
10191031export default PFElement ;
0 commit comments