4 changed files with 2294 additions and 0 deletions
@ -0,0 +1,15 @@ |
|||||
|
import js from "@eslint/js"; |
||||
|
import globals from "globals"; |
||||
|
import json from "@eslint/json"; |
||||
|
import css from "@eslint/css"; |
||||
|
import { defineConfig } from "eslint/config"; |
||||
|
|
||||
|
|
||||
|
export default defineConfig([ |
||||
|
{ files: ["**/*.{js,mjs,cjs}"], plugins: { js }, extends: ["js/recommended"] }, |
||||
|
{ files: ["**/*.js"], languageOptions: { sourceType: "script" } }, |
||||
|
{ files: ["**/*.{js,mjs,cjs}"], languageOptions: { globals: globals.browser } }, |
||||
|
{ files: ["**/*.json"], plugins: { json }, language: "json/json", extends: ["json/recommended"] }, |
||||
|
{ files: ["**/*.jsonc"], plugins: { json }, language: "json/jsonc", extends: ["json/recommended"] }, |
||||
|
{ files: ["**/*.css"], plugins: { css }, language: "css/css", extends: ["css/recommended"] }, |
||||
|
]); |
@ -0,0 +1,99 @@ |
|||||
|
|
||||
|
/** |
||||
|
* This module defines a CompelExtension class. |
||||
|
*/ |
||||
|
import { |
||||
|
helperFun, |
||||
|
builder, |
||||
|
Page |
||||
|
} from "jpc-like-websites"; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* Defines an extension that can be added to the jpclw-framework |
||||
|
*/ |
||||
|
export class CompelExtension { |
||||
|
/** |
||||
|
* @type {string} |
||||
|
*/ |
||||
|
name; |
||||
|
/** |
||||
|
* @type {string} |
||||
|
*/ |
||||
|
diplayTitle; |
||||
|
/** |
||||
|
* @type {Array<SStoreDefinition>} |
||||
|
*/ |
||||
|
stylings; |
||||
|
/** |
||||
|
* @type {Array<SStoreDefinition>} |
||||
|
*/ |
||||
|
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<Function>} |
||||
|
*/ |
||||
|
funAfterInstall |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @param {string} name the working name of the extension |
||||
|
* @param {string} displayTitle the name under wich it will be displayed in the framework panel |
||||
|
*/ |
||||
|
constructor(name = "", displayTitle = "") { |
||||
|
this.name = name; |
||||
|
this.displayTitle = displayTitle; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 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(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
File diff suppressed because it is too large
@ -0,0 +1,30 @@ |
|||||
|
{ |
||||
|
"name": "jpclw-extension", |
||||
|
"version": "1.0.0", |
||||
|
"description": "Base class and system for jpclw extensions", |
||||
|
"keywords": [ |
||||
|
"jpc", |
||||
|
"jpclw", |
||||
|
"extension", |
||||
|
"jpclwe" |
||||
|
], |
||||
|
"repository": { |
||||
|
"type": "git", |
||||
|
"url": "https://git.labos.goip.de/chris/jpclw-extension.git" |
||||
|
}, |
||||
|
"license": "", |
||||
|
"author": "cm", |
||||
|
"type": "module", |
||||
|
"main": "extension.mjs", |
||||
|
"scripts": { |
||||
|
"test": "echo \"Error: no test specified\" && exit 1" |
||||
|
}, |
||||
|
"devDependencies": { |
||||
|
"jpc-like-websites": "git+https://git.labos.goip.de/chris/jpc-like-websites.git", |
||||
|
"@eslint/css": "^0.7.0", |
||||
|
"@eslint/js": "^9.26.0", |
||||
|
"@eslint/json": "^0.12.0", |
||||
|
"eslint": "^9.26.0", |
||||
|
"globals": "^16.1.0" |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue