From d361a1bbee35a1d76e9a39617eff14c079f6ab75 Mon Sep 17 00:00:00 2001 From: chris Date: Mon, 12 May 2025 11:25:34 +0200 Subject: [PATCH] FEAT,REFA: externalized extension base class For reusability in the setup of jpclw extensions --- package-lock.json | 3 ++ package.json | 3 ++ src/extensions/extension.js | 78 ------------------------------------- 3 files changed, 6 insertions(+), 78 deletions(-) delete mode 100644 src/extensions/extension.js diff --git a/package-lock.json b/package-lock.json index b334323..d332837 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,9 @@ "name": "jpc-like-websites", "version": "1.0.0", "license": "ISC", + "dependencies": { + "jpclw-extension": "git+https://git.labos.goip.de/chris/jpclw-extension.git" + }, "devDependencies": { } diff --git a/package.json b/package.json index 82b49c2..7b93e97 100644 --- a/package.json +++ b/package.json @@ -18,4 +18,7 @@ }, "author": "cm", "license": "ISC" + "dependencies": { + "jpclw-extension": "git+https://git.labos.goip.de/chris/jpclw-extension.git" + } } \ No newline at end of file diff --git a/src/extensions/extension.js b/src/extensions/extension.js deleted file mode 100644 index daaa6f1..0000000 --- a/src/extensions/extension.js +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Defines an extension that can be added to the jpclw-framework - */ -class CompelExtension { - /** - * @type {string} - */ - name; - /** - * @type {string} - */ - diplayTitle; - /** - * @type {Array} - */ - stylings; - /** - * @type {Array} - */ - functions; - /** - * Predefined components. Usually of a higher (constructed) kind. - * @type {Object} - */ - components; - /** - * Extensions for/to the Page or the framework in general. - * @type {Object} - */ - frameworkControls; - /** - * Additional elements for the builder (likely referencing components) - * @type {Object} - */ - builderElements; - - /** - * Additional helper functions - * @type {{*:Function}} - */ - helperFun; - - /** - * functions that are supposed to be executed after install, - * to extend it that way. - * @type {Array} - */ - funAfterInstall - - /** - * defines how jpc-like-websites is to be extended and executes that extension - */ - install() { - if (this.helperFun) { - helperFun.extensions = Object.assign(helperFun.extensions, this.helperFun); - } - - if (this.builderElements) { - builder.extensions = Object.assign(builder.extensions, this.builderElements); - } - - if (this.frameworkControls) { - Page.extensions = Object.assign(Page.extensions, this.frameworkControls); - } - - if (this.stylings) { - for (const key of Object.keys(this.stylings)) { - Page.registerStyling(key, this.stylings[key]); - } - } - - if (this.funAfterInstall) { - for (const fun of this.funAfterInstall) { - fun(); - } - } - } -}