From 70e5d0d66fea133c72bff01b7d743398b51b558e Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 29 Apr 2025 10:59:38 +0200 Subject: [PATCH] REFA: renamed properties of WebTrinity --- src/base/extStore.js | 2 +- src/base/webTrinity.js | 40 +++++++++++++++++++++++++++++-------- src/builder.js | 2 +- src/generators/generator.js | 10 +++++----- 4 files changed, 39 insertions(+), 15 deletions(-) diff --git a/src/base/extStore.js b/src/base/extStore.js index a64fd88..eed0d2e 100644 --- a/src/base/extStore.js +++ b/src/base/extStore.js @@ -359,7 +359,7 @@ class ExtStorage { } if (element instanceof Component) { - ensuredElement = element.generate().html; + ensuredElement = element.generate().compext; } switch (this._position) { diff --git a/src/base/webTrinity.js b/src/base/webTrinity.js index fbb5c1c..9e2f93c 100644 --- a/src/base/webTrinity.js +++ b/src/base/webTrinity.js @@ -2,16 +2,37 @@ * Wenity := Web Trinity */ class WebTrinity { + /** + * @deprecated renamed - use copext instead + * @type {HTMLElement|Component|string} = compext, for a migration period + */ + html; + + /** + * @deprecated renamed - use scripts instead + * @type {HTMLStyleElement|Map} = scripts, for a migration period + */ + js; + + /** + * @deprecated renamed - use stylings instead + * @type {HTMLScriptElement|Array} = stylings, for a migration period + */ + css; + /** * - * @param {HTMLElement|Component} html - * @param {HTMLStyleElement|Map} js - * @param {HTMLScriptElement|Array} css + * @param {HTMLElement|Component|string} compext := Component Text + * @param {HTMLStyleElement|Map} scripts + * @param {HTMLScriptElement|Array} stylings */ - constructor(html = null, js = null, css = null) { - this.html = html; - this.js = js; - this.css = css; + constructor(compext = null, scripts = null, stylings = null) { + this.compext = compext; + this.html = compext; + this.scripts = scripts; + this.js = scripts; + this.stylings = stylings; + this.css = stylings; } /** @@ -19,7 +40,10 @@ class WebTrinity { * @returns {boolean} */ isSSEmpty() { - return (this.js === null || this.js.length === 0) + return (this.scripts === null || this.scripts.length === 0) + && (this.stylings === null || this.stylings.size === 0) + /* LEGACY CHECK */ + && (this.js === null || this.js.length === 0) && (this.css === null || this.css.size === 0); } } diff --git a/src/builder.js b/src/builder.js index b49e69d..0114b18 100644 --- a/src/builder.js +++ b/src/builder.js @@ -500,7 +500,7 @@ const builder = { .arrangement(Arrangement.CENTER) .childContext(innerComponents) .generate() - .html + .compext ); Page.generate(); main.remove(); diff --git a/src/generators/generator.js b/src/generators/generator.js index 4f71e3b..e1e43b7 100644 --- a/src/generators/generator.js +++ b/src/generators/generator.js @@ -32,7 +32,7 @@ class CompelGenerator { processStyles(component, extStore = null) { extStore = (extStore ? extStore - : this._stylesExtStore + : component._stylesExtStore ) .setupForGeneralStyling(); @@ -119,10 +119,10 @@ class CompelGenerator { if (child instanceof HTMLElement) { console.log("No wenity set - htmlEl was given"); - childWT.html = component; + childWT.compext = component; } - parent.append(childWT.html); + parent.append(childWT.compext); return childWT; } @@ -222,9 +222,9 @@ class CompelGenerator { let funcCollections = this.processFunctions(functionStore); for (const child of childrenWenities) { - if (child.js) { + if (child.scripts) { executeOnExtStoreTypeCollectedTriple( - (extstoretype) => transferCollectedFunctions(child.js, funcCollections, extstoretype) + (extstoretype) => transferCollectedFunctions(child.scripts, funcCollections, extstoretype) ); } }