Compare commits
63 Commits
Author | SHA1 | Date |
---|---|---|
|
c0171aa8d8 | 1 month ago |
|
6933a89111 | 1 month ago |
|
7a40c27712 | 1 month ago |
|
6de0aca195 | 1 month ago |
|
02203a5dd0 | 2 months ago |
|
a36190bde9 | 2 months ago |
|
41d71f1523 | 2 months ago |
|
1a51451e82 | 2 months ago |
|
9fb347421d | 2 months ago |
|
362d9f870c | 2 months ago |
|
cf6438d623 | 2 months ago |
|
c0b43e38d1 | 2 months ago |
|
d361a1bbee | 2 months ago |
|
c25f9bb93e | 2 months ago |
|
aa65dc1e54 | 2 months ago |
|
5dab23dc14 | 2 months ago |
|
46f12f517d | 2 months ago |
|
ab4d39d55d | 2 months ago |
|
0496bb0295 | 2 months ago |
|
d578a56269 | 2 months ago |
|
61a32a7bfe | 2 months ago |
|
27cc2d930d | 2 months ago |
|
73c85f4d2e | 2 months ago |
|
025573a16c | 2 months ago |
|
467fca6adf | 2 months ago |
|
819ad6bee0 | 2 months ago |
|
e65c2f96cd | 2 months ago |
|
3608ae5cf0 | 2 months ago |
|
2b50ed88d1 | 2 months ago |
|
60776d6fc3 | 2 months ago |
|
b9a92a4df2 | 2 months ago |
|
74974f6c80 | 2 months ago |
|
92a86aa880 | 2 months ago |
|
fc1dfd7e21 | 2 months ago |
|
9f374eeaa4 | 2 months ago |
|
20710fc461 | 2 months ago |
|
db5750ca16 | 2 months ago |
|
0110253876 | 2 months ago |
|
e495aa72ad | 2 months ago |
|
439a98eb33 | 2 months ago |
|
70e5d0d66f | 2 months ago |
|
60faa1a062 | 2 months ago |
|
e539ace5a0 | 2 months ago |
|
23e30b8ffb | 2 months ago |
|
8d6eb00ae4 | 2 months ago |
|
c2a34dd540 | 2 months ago |
|
12f52feca8 | 2 months ago |
|
89bc8106c9 | 2 months ago |
|
c34114c176 | 2 months ago |
|
6ff45892cb | 2 months ago |
|
6f186b64d8 | 2 months ago |
|
dd3d986485 | 2 months ago |
|
d9cef5210d | 2 months ago |
|
26becc9431 | 2 months ago |
|
3afeb8a5e6 | 2 months ago |
|
0209c1012f | 2 months ago |
|
1b81c4df0e | 2 months ago |
|
e4e4c60f27 | 2 months ago |
|
b53ffc3571 | 2 months ago |
|
eca487c2fe | 2 months ago |
|
e0fbe8bd96 | 2 months ago |
|
c228b251b2 | 2 months ago |
|
208481a867 | 2 months ago |
48 changed files with 4325 additions and 1502 deletions
@ -1,4 +1,5 @@ |
|||||
node_modules/ |
node_modules/ |
||||
samples/*/ |
samples/*/ |
||||
jpc-like-websites.js |
jpc-like-websites.js |
||||
|
jpc-like-websites.mjs |
||||
extensions/ |
extensions/ |
||||
|
@ -1,5 +1,21 @@ |
|||||
Copyright (C) Christian Martin - All Rights Reserved |
Copyright (c) 2024-2025 Christian Martin |
||||
Unauthorized copying of this file, |
|
||||
via any medium is strictly prohibited |
All rights reserved. |
||||
Proprietary and confidential |
|
||||
Written by Christian Martin, September 2024 |
This software |
||||
|
and associated documentation files (the "Software") |
||||
|
are the exclusive property of Christian Martin. |
||||
|
You may not use, copy, modify, merge, publish, |
||||
|
distribute, sublicense, or sell copies of the Software, |
||||
|
in whole or in part, |
||||
|
without the express prior written permission of the copyright holder. |
||||
|
|
||||
|
For inquiries regarding licensing, please contact: |
||||
|
christian.martin3(at)gmx.net. |
||||
|
|
||||
|
THE SOFTWARE IS PROVIDED "AS IS", |
||||
|
WITHOUT WARRANTY OF ANY KIND, |
||||
|
EXPRESS OR IMPLIED, |
||||
|
INCLUDING BUT NOT LIMITED TO |
||||
|
THE WARRANTIES OF MERCHANTABILITY, |
||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
||||
|
@ -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"] }, |
||||
|
]); |
@ -1,194 +0,0 @@ |
|||||
{ |
|
||||
"orderedGroups": { |
|
||||
"pure_stylings": [ |
|
||||
"color.js", |
|
||||
"alignment.js", |
|
||||
"arrangement.js" |
|
||||
], |
|
||||
"size_sidings": [ |
|
||||
"modificationSubChainMixins.js", |
|
||||
"siding.js", |
|
||||
"padding.js", |
|
||||
"margin.js", |
|
||||
"shapes.js", |
|
||||
"border.js", |
|
||||
"twoDimPoint.js", |
|
||||
"dimensions.js" |
|
||||
], |
|
||||
"behaviour_modifications": [ |
|
||||
"commonEvents.js", |
|
||||
"contextMenu.js", |
|
||||
"dragAndDrop.js" |
|
||||
], |
|
||||
"pre_context": [ |
|
||||
"webTrinity.js", |
|
||||
"extStore.js", |
|
||||
"generalHelpers.js" |
|
||||
], |
|
||||
"modifier": [ |
|
||||
"modifier.js" |
|
||||
], |
|
||||
"component": [ |
|
||||
"wrapperComponent.js", |
|
||||
"modifiableComponent.js", |
|
||||
"addStyleAndFunctions.js", |
|
||||
"component.js" |
|
||||
], |
|
||||
"builder": [ |
|
||||
"baseComponents.js", |
|
||||
"builder.js" |
|
||||
], |
|
||||
"extensions": [ |
|
||||
"extension.js" |
|
||||
], |
|
||||
"app_context": [ |
|
||||
"scriptAndStyleContext.js", |
|
||||
"framework-controls.js", |
|
||||
"context.js" |
|
||||
] |
|
||||
}, |
|
||||
"keys": [ |
|
||||
"color.js", |
|
||||
"alignment.js", |
|
||||
"arrangement.js", |
|
||||
"siding.js", |
|
||||
"shapes.js", |
|
||||
"border.js", |
|
||||
"dimensions.js", |
|
||||
"commonEvents.js", |
|
||||
"contextMenu.js", |
|
||||
"dragAndDrop.js", |
|
||||
"webTrinity.js", |
|
||||
"extStore.js", |
|
||||
"generalHelpers.js", |
|
||||
"modifier.js", |
|
||||
"wrapperComponent.js", |
|
||||
"modifiableComponent.js", |
|
||||
"addStyleAndFunctions.js", |
|
||||
"component.js", |
|
||||
"baseComponents.js", |
|
||||
"builder.js", |
|
||||
"extension.js", |
|
||||
"scriptAndStyleContext.js", |
|
||||
"framework-controls.js", |
|
||||
"context.js", |
|
||||
"modificationSubChainMixins.js", |
|
||||
"padding.js", |
|
||||
"margin.js", |
|
||||
"twoDimPoint.js" |
|
||||
], |
|
||||
"objects": { |
|
||||
"color.js": { |
|
||||
"name": "color.js", |
|
||||
"folder": "src" |
|
||||
}, |
|
||||
"alignment.js": { |
|
||||
"name": "alignment.js", |
|
||||
"folder": "src" |
|
||||
}, |
|
||||
"arrangement.js": { |
|
||||
"name": "arrangement.js", |
|
||||
"folder": "src" |
|
||||
}, |
|
||||
"siding.js": { |
|
||||
"name": "siding.js", |
|
||||
"folder": "src/sizeSide" |
|
||||
}, |
|
||||
"shapes.js": { |
|
||||
"name": "shapes.js", |
|
||||
"folder": "src/sizeSide" |
|
||||
}, |
|
||||
"border.js": { |
|
||||
"name": "border.js", |
|
||||
"folder": "src/sizeSide" |
|
||||
}, |
|
||||
"dimensions.js": { |
|
||||
"name": "dimensions.js", |
|
||||
"folder": "src/sizeSide" |
|
||||
}, |
|
||||
"commonEvents.js": { |
|
||||
"name": "commonEvents.js", |
|
||||
"folder": "src" |
|
||||
}, |
|
||||
"contextMenu.js": { |
|
||||
"name": "contextMenu.js", |
|
||||
"folder": "src/modifications" |
|
||||
}, |
|
||||
"dragAndDrop.js": { |
|
||||
"name": "dragAndDrop.js", |
|
||||
"folder": "src/modifications" |
|
||||
}, |
|
||||
"webTrinity.js": { |
|
||||
"name": "webTrinity.js", |
|
||||
"folder": "src/context" |
|
||||
}, |
|
||||
"extStore.js": { |
|
||||
"name": "extStore.js", |
|
||||
"folder": "src/context" |
|
||||
}, |
|
||||
"generalHelpers.js": { |
|
||||
"name": "generalHelpers.js", |
|
||||
"folder": "src/context" |
|
||||
}, |
|
||||
"modifier.js": { |
|
||||
"name": "modifier.js", |
|
||||
"folder": "src" |
|
||||
}, |
|
||||
"wrapperComponent.js": { |
|
||||
"name": "wrapperComponent.js", |
|
||||
"folder": "src/componentAncestry" |
|
||||
}, |
|
||||
"modifiableComponent.js": { |
|
||||
"name": "modifiableComponent.js", |
|
||||
"folder": "src/componentAncestry" |
|
||||
}, |
|
||||
"addStyleAndFunctions.js": { |
|
||||
"name": "addStyleAndFunctions.js", |
|
||||
"folder": "src/componentAncestry" |
|
||||
}, |
|
||||
"component.js": { |
|
||||
"name": "component.js", |
|
||||
"folder": "src" |
|
||||
}, |
|
||||
"baseComponents.js": { |
|
||||
"name": "baseComponents.js", |
|
||||
"folder": "src" |
|
||||
}, |
|
||||
"builder.js": { |
|
||||
"name": "builder.js", |
|
||||
"folder": "src" |
|
||||
}, |
|
||||
"extension.js": { |
|
||||
"name": "extension.js", |
|
||||
"folder": "src/extensions" |
|
||||
}, |
|
||||
"scriptAndStyleContext.js": { |
|
||||
"name": "scriptAndStyleContext.js", |
|
||||
"folder": "src/context" |
|
||||
}, |
|
||||
"framework-controls.js": { |
|
||||
"name": "framework-controls.js", |
|
||||
"folder": "src/context" |
|
||||
}, |
|
||||
"context.js": { |
|
||||
"name": "context.js", |
|
||||
"folder": "src" |
|
||||
}, |
|
||||
"modificationSubChainMixins.js":{ |
|
||||
"name": "modificationSubChainMixins.js", |
|
||||
"folder": "src/modifiers" |
|
||||
}, |
|
||||
"padding.js":{ |
|
||||
"name": "padding.js", |
|
||||
"folder": "src/modifiers" |
|
||||
}, |
|
||||
"margin.js":{ |
|
||||
"name": "margin.js", |
|
||||
"folder": "src/modifiers" |
|
||||
}, |
|
||||
"twoDimPoint.js":{ |
|
||||
"name": "twoDimPoint.js", |
|
||||
"folder": "src/modifiers" |
|
||||
} |
|
||||
} |
|
||||
} |
|
@ -0,0 +1,695 @@ |
|||||
|
{ |
||||
|
"orderedGroups": { |
||||
|
"base": [ |
||||
|
"webTrinity.js", |
||||
|
"extStore.js" |
||||
|
], |
||||
|
"helper": [ |
||||
|
"ObjectAccessObject.js", |
||||
|
"TwoDimPoint.js", |
||||
|
"general.js", |
||||
|
"indices.js" |
||||
|
], |
||||
|
"chain_mixins": [ |
||||
|
"mixinModSubChain.js", |
||||
|
"ModificationSubChain.js" |
||||
|
], |
||||
|
"decorators": [ |
||||
|
"color.js", |
||||
|
"alignment.js", |
||||
|
"arrangement.js", |
||||
|
"siding.js", |
||||
|
"padding.js", |
||||
|
"margin.js", |
||||
|
"shapes.js", |
||||
|
"border.js", |
||||
|
"dimensions.js" |
||||
|
], |
||||
|
"handlers": [ |
||||
|
"commonEvents.js", |
||||
|
"contextMenu.js", |
||||
|
"dragAndDrop.js" |
||||
|
], |
||||
|
"modifier": [ |
||||
|
"Modifier.js", |
||||
|
"ChainableModifier.js" |
||||
|
], |
||||
|
"generators":[ |
||||
|
"generator.js", |
||||
|
"defaultGenerators.js" |
||||
|
], |
||||
|
"component": [ |
||||
|
"ChildbearerComponent.js", |
||||
|
"ModifiableComponent.js", |
||||
|
"StyleAndScriptStoringComponent.js", |
||||
|
"Component.js", |
||||
|
"FlexContainerComponent.js", |
||||
|
"Column.js", |
||||
|
"Row.js", |
||||
|
"InputComponent.js" |
||||
|
], |
||||
|
"extensions": [ |
||||
|
"extension.js" |
||||
|
], |
||||
|
"context": [ |
||||
|
"scriptAndStyleContext.js", |
||||
|
"framework-controls.js", |
||||
|
"context.js" |
||||
|
], |
||||
|
"builder": [ |
||||
|
"builder.js" |
||||
|
] |
||||
|
}, |
||||
|
"keys": [ |
||||
|
"extStore.js", |
||||
|
"webTrinity.js", |
||||
|
"builder.js", |
||||
|
"ChildbearerComponent.js", |
||||
|
"Column.js", |
||||
|
"Component.js", |
||||
|
"FlexContainerComponent.js", |
||||
|
"InputComponent.js", |
||||
|
"ModifiableComponent.js", |
||||
|
"Row.js", |
||||
|
"StyleAndScriptStoringComponent.js", |
||||
|
"context.js", |
||||
|
"framework-controls.js", |
||||
|
"scriptAndStyleContext.js", |
||||
|
"alignment.js", |
||||
|
"arrangement.js", |
||||
|
"border.js", |
||||
|
"color.js", |
||||
|
"dimensions.js", |
||||
|
"margin.js", |
||||
|
"padding.js", |
||||
|
"shapes.js", |
||||
|
"siding.js", |
||||
|
"extension.js", |
||||
|
"simplePagingAndNavigation.js", |
||||
|
"defaultGenerators.js", |
||||
|
"generator.js", |
||||
|
"commonEvents.js", |
||||
|
"contextMenu.js", |
||||
|
"dragAndDrop.js", |
||||
|
"general.js", |
||||
|
"indices.js", |
||||
|
"ObjectAccessObject.js", |
||||
|
"TwoDimPoint.js", |
||||
|
"ChainableModifier.js", |
||||
|
"mixinModSubChain.js", |
||||
|
"ModificationSubChain.js", |
||||
|
"Modifier.js" |
||||
|
], |
||||
|
"objects": { |
||||
|
"extStore.js": { |
||||
|
"folder": "src/base", |
||||
|
"name": "extStore.js", |
||||
|
"exports": [ |
||||
|
"ESAggregation", |
||||
|
"ExtStorePosition", |
||||
|
"OverwriteBehaviour", |
||||
|
"clearFunctionDeclarationText", |
||||
|
"getScriptTagInjectionText", |
||||
|
"FunctionStoreBuffer", |
||||
|
"ExtStorage", |
||||
|
"ExtStoreType", |
||||
|
"SStoreDefinition", |
||||
|
"resolveOverwrite", |
||||
|
"identifyAndResolveOverwrite", |
||||
|
"generateAndFillScriptTag", |
||||
|
"getStylingInjectionText", |
||||
|
"generateAndFillStyleTag", |
||||
|
"executeOnExtStoreTypeCollectedTriple" |
||||
|
], |
||||
|
"imports": { |
||||
|
"../Component": [ |
||||
|
"Component" |
||||
|
], |
||||
|
"../context": [ |
||||
|
"Page" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"webTrinity.js": { |
||||
|
"folder": "src/base", |
||||
|
"name": "webTrinity.js", |
||||
|
"exports": [ |
||||
|
"WebTrinity" |
||||
|
] |
||||
|
}, |
||||
|
"builder.js": { |
||||
|
"folder": "src", |
||||
|
"name": "builder.js", |
||||
|
"exports": [ |
||||
|
"builder" |
||||
|
], |
||||
|
"imports": { |
||||
|
"./Component": [ |
||||
|
"Component", |
||||
|
"FlexContainerComponent", |
||||
|
"Row", |
||||
|
"Column", |
||||
|
"InputComponent" |
||||
|
], |
||||
|
"./modifier": [ |
||||
|
"Modifier" |
||||
|
], |
||||
|
"./context": [ |
||||
|
"Page" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"ChildbearerComponent.js": { |
||||
|
"folder": "src/component", |
||||
|
"name": "ChildbearerComponent.js", |
||||
|
"exports": [ |
||||
|
"ChildbearerComponent" |
||||
|
], |
||||
|
"imports": { |
||||
|
"../decorators": [ |
||||
|
"Alignment", |
||||
|
"Arrangement" |
||||
|
], |
||||
|
"../helper": [ |
||||
|
"helperFun" |
||||
|
], |
||||
|
"./Component": [ |
||||
|
"Component" |
||||
|
], |
||||
|
"../builder": [ |
||||
|
"builder" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"Column.js": { |
||||
|
"folder": "src/component", |
||||
|
"name": "Column.js", |
||||
|
"exports": [ |
||||
|
"Column" |
||||
|
], |
||||
|
"imports": { |
||||
|
"./FlexContainerComponent": [ |
||||
|
"FlexContainerComponent" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"Component.js": { |
||||
|
"folder": "src/component", |
||||
|
"name": "Component.js", |
||||
|
"exports": [ |
||||
|
"Component" |
||||
|
], |
||||
|
"imports": { |
||||
|
"../base": [ |
||||
|
"ExtStorage" |
||||
|
], |
||||
|
"../modifier": [ |
||||
|
"Modifier" |
||||
|
], |
||||
|
"../context": [ |
||||
|
"Page", |
||||
|
"CommonCompelGroups" |
||||
|
], |
||||
|
"../handlers": [ |
||||
|
"DefaultContextMenu", |
||||
|
"DragAndDropImplementation" |
||||
|
], |
||||
|
"../generators": [ |
||||
|
"CompelGenerator" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"FlexContainerComponent.js": { |
||||
|
"folder": "src/component", |
||||
|
"name": "FlexContainerComponent.js", |
||||
|
"exports": [ |
||||
|
"FlexContainerComponent" |
||||
|
], |
||||
|
"imports": { |
||||
|
"./Component": [ |
||||
|
"Component" |
||||
|
], |
||||
|
"../modifier": [ |
||||
|
"Modifier" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"InputComponent.js": { |
||||
|
"folder": "src/component", |
||||
|
"name": "InputComponent.js", |
||||
|
"exports": [ |
||||
|
"InputComponent" |
||||
|
], |
||||
|
"imports": { |
||||
|
"./Component": [ |
||||
|
"Component" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"ModifiableComponent.js": { |
||||
|
"folder": "src/component", |
||||
|
"name": "ModifiableComponent.js", |
||||
|
"exports": [ |
||||
|
"ModifiableComponent" |
||||
|
], |
||||
|
"imports": { |
||||
|
"./ChildbearerComponent": [ |
||||
|
"ChildbearerComponent" |
||||
|
], |
||||
|
"../base": [ |
||||
|
"SStoreDefinition" |
||||
|
], |
||||
|
"../modifier": [ |
||||
|
"ChainableModifier" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"Row.js": { |
||||
|
"folder": "src/component", |
||||
|
"name": "Row.js", |
||||
|
"exports": [ |
||||
|
"Row" |
||||
|
], |
||||
|
"imports": { |
||||
|
"./FlexContainerComponent": [ |
||||
|
"FlexContainerComponent" |
||||
|
], |
||||
|
"../helper": [ |
||||
|
"onSingleOrArray" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"StyleAndScriptStoringComponent.js": { |
||||
|
"folder": "src/component", |
||||
|
"name": "StyleAndScriptStoringComponent.js", |
||||
|
"exports": [ |
||||
|
"StyleAndScriptStoringComponent" |
||||
|
], |
||||
|
"imports": { |
||||
|
"./ModifiableComponent": [ |
||||
|
"ModifiableComponent" |
||||
|
], |
||||
|
"../decorators": [ |
||||
|
"Alignment", |
||||
|
"Arrangement" |
||||
|
], |
||||
|
"../base": [ |
||||
|
"ExtStorage", |
||||
|
"ExtStoreType", |
||||
|
"SStoreDefinition" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"context.js": { |
||||
|
"folder": "src/context", |
||||
|
"name": "context.js", |
||||
|
"exports": [ |
||||
|
"PageBuilder", |
||||
|
"CommonCompelGroups", |
||||
|
"Page" |
||||
|
], |
||||
|
"imports": { |
||||
|
"./scriptAndStyleContext": [ |
||||
|
"ScriptAndStyleContext" |
||||
|
], |
||||
|
"../extensions": [ |
||||
|
"CompelExtension" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"framework-controls.js": { |
||||
|
"folder": "src/context", |
||||
|
"name": "framework-controls.js", |
||||
|
"exports": [ |
||||
|
"frameworkControlPanel" |
||||
|
], |
||||
|
"imports": { |
||||
|
"../builder": [ |
||||
|
"builder" |
||||
|
], |
||||
|
"../modifier": [ |
||||
|
"Modifier" |
||||
|
], |
||||
|
"../decorators": [ |
||||
|
"Alignment", |
||||
|
"Arrangement", |
||||
|
"Colors", |
||||
|
"Border", |
||||
|
"MaterialFiveHundredlColors" |
||||
|
], |
||||
|
"../base": [ |
||||
|
"ExtStoreType" |
||||
|
], |
||||
|
"../Component": [ |
||||
|
"Component" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"scriptAndStyleContext.js": { |
||||
|
"folder": "src/context", |
||||
|
"name": "scriptAndStyleContext.js", |
||||
|
"exports": [ |
||||
|
"ScriptAndStyleContext" |
||||
|
], |
||||
|
"imports": { |
||||
|
"../base": [ |
||||
|
"OverwriteBehaviour", |
||||
|
"FunctionStoreBuffer" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"alignment.js": { |
||||
|
"folder": "src/decorators", |
||||
|
"name": "alignment.js", |
||||
|
"exports": [ |
||||
|
"Alignment" |
||||
|
] |
||||
|
}, |
||||
|
"arrangement.js": { |
||||
|
"folder": "src/decorators", |
||||
|
"name": "arrangement.js", |
||||
|
"exports": [ |
||||
|
"Arrangement" |
||||
|
] |
||||
|
}, |
||||
|
"border.js": { |
||||
|
"folder": "src/decorators", |
||||
|
"name": "border.js", |
||||
|
"exports": [ |
||||
|
"LineStyles", |
||||
|
"BorderDefinition", |
||||
|
"Define", |
||||
|
"Border", |
||||
|
"BorderChain", |
||||
|
"BorderChainedModifier" |
||||
|
], |
||||
|
"imports": { |
||||
|
"./siding": [ |
||||
|
"SizeUnits", |
||||
|
"Sides" |
||||
|
], |
||||
|
"./color": [ |
||||
|
"Color", |
||||
|
"Colors" |
||||
|
], |
||||
|
"./shapes": [ |
||||
|
"Shapes" |
||||
|
], |
||||
|
"../modifier": [ |
||||
|
"mixinModSubChainEndings", |
||||
|
"mixinModSubChainComponentMethods" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"color.js": { |
||||
|
"folder": "src/decorators", |
||||
|
"name": "color.js", |
||||
|
"exports": [ |
||||
|
"Color", |
||||
|
"Colors", |
||||
|
"MaterialFiveHundredlColors" |
||||
|
] |
||||
|
}, |
||||
|
"dimensions.js": { |
||||
|
"folder": "src/decorators", |
||||
|
"name": "dimensions.js", |
||||
|
"exports": [ |
||||
|
"Dimensions", |
||||
|
"DimensionsChain", |
||||
|
"DimensionsChainedModifier" |
||||
|
], |
||||
|
"imports": { |
||||
|
"./siding": [ |
||||
|
"DirectionUnitDependentAttribute", |
||||
|
"SizeUnits" |
||||
|
], |
||||
|
"../helper": [ |
||||
|
"TwoDimPoint" |
||||
|
], |
||||
|
"../modifier": [ |
||||
|
"mixinModSubChainEndings", |
||||
|
"mixinModSubChainComponentMethods" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"margin.js": { |
||||
|
"folder": "src/decorators", |
||||
|
"name": "margin.js", |
||||
|
"exports": [ |
||||
|
"Margin", |
||||
|
"MarginChain", |
||||
|
"MarginChainedModifier" |
||||
|
], |
||||
|
"imports": { |
||||
|
"./siding": [ |
||||
|
"Sides", |
||||
|
"SizeUnits" |
||||
|
], |
||||
|
"../modifier": [ |
||||
|
"mixinModSubChainEndings", |
||||
|
"mixinModSubChainComponentMethods" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"padding.js": { |
||||
|
"folder": "src/decorators", |
||||
|
"name": "padding.js", |
||||
|
"exports": [ |
||||
|
"Padding", |
||||
|
"PaddingChain", |
||||
|
"PaddingChainedModifier" |
||||
|
], |
||||
|
"imports": { |
||||
|
"./siding": [ |
||||
|
"Sides", |
||||
|
"SizeUnits" |
||||
|
], |
||||
|
"../modifier": [ |
||||
|
"mixinModSubChainEndings", |
||||
|
"mixinModSubChainComponentMethods" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"shapes.js": { |
||||
|
"folder": "src/decorators", |
||||
|
"name": "shapes.js", |
||||
|
"exports": [ |
||||
|
"Shape", |
||||
|
"ShapeChain", |
||||
|
"ShapeChainedModifier", |
||||
|
"Shapes" |
||||
|
], |
||||
|
"imports": { |
||||
|
"./siding": [ |
||||
|
"DirectionUnitDependentAttribute", |
||||
|
"SizeUnits", |
||||
|
"SidingRefCorners" |
||||
|
], |
||||
|
"../modifier": [ |
||||
|
"mixinModSubChainEndings", |
||||
|
"mixinModSubChainComponentMethods" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"siding.js": { |
||||
|
"folder": "src/decorators", |
||||
|
"name": "siding.js", |
||||
|
"exports": [ |
||||
|
"SizeUnits", |
||||
|
"DirectionUnitDependentAttribute", |
||||
|
"SideDirections", |
||||
|
"SideTransitionDirection", |
||||
|
"Corners", |
||||
|
"CornerTransitionDirection", |
||||
|
"Sides" |
||||
|
] |
||||
|
}, |
||||
|
"extension.js": { |
||||
|
"folder": "src/extensions", |
||||
|
"name": "extension.js" |
||||
|
}, |
||||
|
"simplePagingAndNavigation.js": { |
||||
|
"folder": "src/extensions", |
||||
|
"name": "simplePagingAndNavigation.js" |
||||
|
}, |
||||
|
"defaultGenerators.js": { |
||||
|
"folder": "src/generators", |
||||
|
"name": "defaultGenerators.js", |
||||
|
"exports": [ |
||||
|
"singlepage" |
||||
|
], |
||||
|
"imports": { |
||||
|
"./generator": [ |
||||
|
"CompelGenerator" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"generator.js": { |
||||
|
"folder": "src/generators", |
||||
|
"name": "generator.js", |
||||
|
"exports": [ |
||||
|
"CompelGenerator" |
||||
|
], |
||||
|
"imports": { |
||||
|
"../base": [ |
||||
|
"WebTrinity", |
||||
|
"ExtStoreType" |
||||
|
], |
||||
|
"../Component": [ |
||||
|
"Component" |
||||
|
], |
||||
|
"../modifier": [ |
||||
|
"Modifier" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"commonEvents.js": { |
||||
|
"folder": "src/handlers", |
||||
|
"name": "commonEvents.js", |
||||
|
"exports": [ |
||||
|
"CommonEvents" |
||||
|
] |
||||
|
}, |
||||
|
"contextMenu.js": { |
||||
|
"folder": "src/handlers", |
||||
|
"name": "contextMenu.js", |
||||
|
"exports": [ |
||||
|
"DefaultContextMenu" |
||||
|
], |
||||
|
"imports": { |
||||
|
"../decorators": [ |
||||
|
"Sides" |
||||
|
], |
||||
|
"../helper": [ |
||||
|
"helperFun", |
||||
|
"getEnclosingBounds" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"dragAndDrop.js": { |
||||
|
"folder": "src/handlers", |
||||
|
"name": "dragAndDrop.js", |
||||
|
"exports": [ |
||||
|
"EventDrag", |
||||
|
"DragAndDropImplementation", |
||||
|
"DADInPlace" |
||||
|
], |
||||
|
"imports": { |
||||
|
"../helper": [ |
||||
|
"TwoDimPoint" |
||||
|
], |
||||
|
"../decorators": [ |
||||
|
"Dimensions" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"general.js": { |
||||
|
"folder": "src/helper", |
||||
|
"name": "general.js", |
||||
|
"exports": [ |
||||
|
"onSingleOrArray", |
||||
|
"helperFun" |
||||
|
] |
||||
|
}, |
||||
|
"indices.js": { |
||||
|
"folder": "src/helper", |
||||
|
"name": "indices.js", |
||||
|
"exports": [ |
||||
|
"isValueInBounds", |
||||
|
"areXYInArea", |
||||
|
"isPointInArea", |
||||
|
"getEnclosingBounds" |
||||
|
], |
||||
|
"imports": { |
||||
|
"../decorators": [ |
||||
|
"SideDirections" |
||||
|
], |
||||
|
"./TwoDimPoint": [ |
||||
|
"TwoDimPoint" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"ObjectAccessObject.js": { |
||||
|
"folder": "src/helper", |
||||
|
"name": "ObjectAccessObject.js", |
||||
|
"exports": [ |
||||
|
"ObjectAccessObject" |
||||
|
] |
||||
|
}, |
||||
|
"TwoDimPoint.js": { |
||||
|
"folder": "src/helper", |
||||
|
"name": "TwoDimPoint.js", |
||||
|
"exports": [ |
||||
|
"TwoDimPoint" |
||||
|
] |
||||
|
}, |
||||
|
"ChainableModifier.js": { |
||||
|
"folder": "src/modifier", |
||||
|
"name": "ChainableModifier.js", |
||||
|
"exports": [ |
||||
|
"ChainableModifier" |
||||
|
], |
||||
|
"imports": { |
||||
|
"./modifier": [ |
||||
|
"Modifier" |
||||
|
], |
||||
|
"../Component": [ |
||||
|
"Component" |
||||
|
], |
||||
|
"../decorators": [ |
||||
|
"PaddingChainedModifier", |
||||
|
"MarginChainedModifier", |
||||
|
"ShapeChainedModifier", |
||||
|
"BorderChainedModifier" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"mixinModSubChain.js": { |
||||
|
"folder": "src/modifier", |
||||
|
"name": "mixinModSubChain.js", |
||||
|
"exports": [ |
||||
|
"mixinModSubChainEndings", |
||||
|
"mixinModSubChainComponentMethods" |
||||
|
], |
||||
|
"imports": { |
||||
|
"./modifier": [ |
||||
|
"Modifier" |
||||
|
], |
||||
|
"./ChainableModifier": [ |
||||
|
"ChainableModifier" |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
"ModificationSubChain.js": { |
||||
|
"folder": "src/modifier", |
||||
|
"name": "ModificationSubChain.js", |
||||
|
"exports": [ |
||||
|
"ModificationSubChain", |
||||
|
"ModificationSubChainReComp" |
||||
|
] |
||||
|
}, |
||||
|
"Modifier.js": { |
||||
|
"folder": "src/modifier", |
||||
|
"name": "Modifier.js", |
||||
|
"exports": [ |
||||
|
"Modifier" |
||||
|
], |
||||
|
"imports": { |
||||
|
"../decorators": [ |
||||
|
"Sides", |
||||
|
"Border", |
||||
|
"BorderChain", |
||||
|
"Color", |
||||
|
"Dimensions", |
||||
|
"DimensionsChain", |
||||
|
"Margin", |
||||
|
"MarginChain", |
||||
|
"Padding", |
||||
|
"PaddingChain", |
||||
|
"Shape", |
||||
|
"ShapeChain" |
||||
|
] |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
File diff suppressed because it is too large
@ -1,17 +1,31 @@ |
|||||
{ |
{ |
||||
"name": "jpc-like-websites", |
"name": "jpc-like-websites", |
||||
"version": "1.0.0", |
"version": "1.9.13.34", |
||||
"description": "Framework to build websites in a Jetpack Compose like manner, as well as an extensive use of method-chaingin.", |
"description": "Framework to build websites in a Jetpack Compose like manner, as well as an extensive use of method-chaingin.", |
||||
"main": "jpc-like-websites.js", |
"main": "jpc-like-websites.js", |
||||
|
"exports": { |
||||
|
"vanilla": "./jpc-like-websites.js", |
||||
|
"module": "./jpc-like-websites.mjs" |
||||
|
}, |
||||
"files": [ |
"files": [ |
||||
"/src" |
"/src" |
||||
], |
], |
||||
"scripts": { |
"scripts": { |
||||
"prepare": "npm run build", |
"prepare": "npm run build", |
||||
"generate": "node generate_single_file.js", |
"generate": "node generate_single_file.js true", |
||||
"build": "npm run generate", |
"build": "npm run generate", |
||||
"test": "echo \"Error: no test specified\" && exit 1" |
"test": "echo \"Error: no test specified\" && exit 1" |
||||
}, |
}, |
||||
"author": "cm", |
"author": "cm", |
||||
"license": "ISC" |
"license": "SEE LICENCE.md", |
||||
|
"dependencies": { |
||||
|
"jpclw-extension": "git+https://git.labos.goip.de/chris/jpclw-extension.git" |
||||
|
}, |
||||
|
"devDependencies": { |
||||
|
"@eslint/css": "^0.7.0", |
||||
|
"@eslint/js": "^9.26.0", |
||||
|
"@eslint/json": "^0.12.0", |
||||
|
"eslint": "^9.26.0", |
||||
|
"globals": "^16.1.0" |
||||
|
} |
||||
} |
} |
@ -0,0 +1,49 @@ |
|||||
|
/** |
||||
|
* 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<ExtStorageType, Array<SStoreDefinition>} = scripts, for a migration period |
||||
|
*/ |
||||
|
js; |
||||
|
|
||||
|
/** |
||||
|
* @deprecated renamed - use stylings instead |
||||
|
* @type {HTMLScriptElement|Array<SStoreDefinition>} = stylings, for a migration period |
||||
|
*/ |
||||
|
css; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @param {HTMLElement|Component|string} compext := Component Text |
||||
|
* @param {HTMLStyleElement|Map<ExtStorageType, Array<SStoreDefinition>} scripts |
||||
|
* @param {HTMLScriptElement|Array<SStoreDefinition>} stylings |
||||
|
*/ |
||||
|
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; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @returns {boolean} |
||||
|
*/ |
||||
|
isSSEmpty() { |
||||
|
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); |
||||
|
} |
||||
|
} |
@ -1,236 +0,0 @@ |
|||||
/** |
|
||||
* This file is part of the jps-like-websites lib |
|
||||
* URL: https://git.labos.goip.de/chris/jpc-like-websites
|
|
||||
* @copyright by its creator Christian Martin |
|
||||
*/ |
|
||||
|
|
||||
/** |
|
||||
* Represents a Component (of an HTMLElement) that is capable of receiving input. |
|
||||
* @extends Component |
|
||||
* @inheritdoc |
|
||||
*/ |
|
||||
class InputComponent extends Component { |
|
||||
/** |
|
||||
* |
|
||||
* @param {string} element |
|
||||
* @param {Attr} attr |
|
||||
* @param {Modifier} modifier |
|
||||
*/ |
|
||||
constructor(element, attr = {}, modifier = null) { |
|
||||
super(element, attr); |
|
||||
this.addStyleClass("el-input-comp"); |
|
||||
if (modifier) { |
|
||||
this.modifier(modifier); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* The parameter makes it optional to trigger the state by a variable |
|
||||
* @param {boolean} readonly |
|
||||
* @returns {Component} |
|
||||
*/ |
|
||||
readonly(readonly = true) { |
|
||||
if (readonly) { |
|
||||
this._element.setAttribute("readonly", readonly); |
|
||||
} |
|
||||
return this; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Sets the value of the InputComponent |
|
||||
* @param {string} Value |
|
||||
* @returns {InputComponent|Component} |
|
||||
*/ |
|
||||
value(value) { |
|
||||
this._element.value = value; |
|
||||
return this; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* |
|
||||
* @param {string} name |
|
||||
* @returns {InputComponent|Component} |
|
||||
*/ |
|
||||
name(name) { |
|
||||
return this.setAttribute("name", name); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* Represents container Components. |
|
||||
* Some predefined modifications are applied on the child components. |
|
||||
* @extends Component |
|
||||
* @inheritdoc |
|
||||
*/ |
|
||||
class FlexContainerComponent extends Component { |
|
||||
/** |
|
||||
* @type {boolean} |
|
||||
*/ |
|
||||
_distributeEvenglyAfterGenerate; |
|
||||
/** |
|
||||
* @type {string} |
|
||||
*/ |
|
||||
_flexDirection; |
|
||||
/** |
|
||||
* |
|
||||
* @param {Attr} attr |
|
||||
* @param {Modifier} modifier |
|
||||
*/ |
|
||||
constructor(attr = {}, modifier = null, baseElement = "div") { |
|
||||
super(document.createElement(baseElement), attr); |
|
||||
this._flexDirection = ""; |
|
||||
this._distributeEvenglyAfterGenerate = false; |
|
||||
this.addStyleClass("flex-container-component"); |
|
||||
if (modifier) { |
|
||||
this.modifier(modifier); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* |
|
||||
* @param {boolean} [vertical=true] |
|
||||
* @returns {FlexContainerComponent} |
|
||||
*/ |
|
||||
setFlexDirection(vertical = true) { |
|
||||
return this.modifier( |
|
||||
new Modifier() |
|
||||
.setStyleRule( |
|
||||
"flex-direction", |
|
||||
(vertical ? "column" : "row") |
|
||||
) |
|
||||
) |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* |
|
||||
* @param {Component|Array<Component>} innerComponent |
|
||||
* @returns {FlexContainerComponent} this component object |
|
||||
*/ |
|
||||
childContext(innerComponent) { |
|
||||
if (innerComponent instanceof Array) { |
|
||||
innerComponent |
|
||||
.map(cl => { |
|
||||
if (cl instanceof Component) { |
|
||||
return cl |
|
||||
} else { |
|
||||
return cl.ensureModifier().toComponent() |
|
||||
} |
|
||||
}) |
|
||||
.forEach(icomp => { |
|
||||
icomp._modifier = new Modifier() |
|
||||
.setStyleRule("flex", "none") |
|
||||
.join(icomp._modifier) |
|
||||
|
|
||||
}) |
|
||||
} |
|
||||
return super.childContext(innerComponent); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* |
|
||||
* @returns {FlexContainerComponent} |
|
||||
*/ |
|
||||
distibuteSpacingEvenly() { |
|
||||
this._distributeEvenglyAfterGenerate = true; |
|
||||
return this; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* @override |
|
||||
* @inheritdoc |
|
||||
* @extends Component.generate() |
|
||||
*/ |
|
||||
generate(modifier = null, styleStore = null, functionStore = null) { |
|
||||
if (this._children && this._children.length > 0) { |
|
||||
|
|
||||
if (this._distributeEvenglyAfterGenerate) { |
|
||||
let childDistributionFraction = Math.floor( |
|
||||
((100 - this._children.length) / this._children.length) * 100 |
|
||||
) / 100; |
|
||||
|
|
||||
let direction = (this._flexDirection === 'column' ? 'height' : "width"); |
|
||||
|
|
||||
for (const icomp of this._children) { |
|
||||
/* sets the width for all elements, |
|
||||
to avoid overlapping or line break because of lacking width, |
|
||||
a percent is subtracted for every child element */ |
|
||||
/* To enable "override" a new Modifier is generated and joined |
|
||||
with the modifier of the component */ |
|
||||
icomp._modifier._modifications[direction] = childDistributionFraction + "%"; |
|
||||
icomp._modifier._modifications["max-"+direction] = childDistributionFraction + "%"; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
return super.generate(modifier, styleStore, functionStore); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* A FlexContainerComponent, which organizes the children in a column like manner. |
|
||||
* @extends FlexContainerComponent |
|
||||
* @inheritdoc |
|
||||
*/ |
|
||||
class Column extends FlexContainerComponent { |
|
||||
/** |
|
||||
* |
|
||||
* @param {Attr} attr |
|
||||
* @param {Modifier} modifier |
|
||||
*/ |
|
||||
constructor(attr = {}, modifier = null) { |
|
||||
super(attr, modifier); |
|
||||
this.addStyleClass("column-component"); |
|
||||
this._flexDirection = "column"; |
|
||||
this.setFlexDirection(); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* A FlexContainerComponent, which organizes the children in a row like manner. |
|
||||
* |
|
||||
* @extends FlexContainerComponent |
|
||||
* @inheritdoc |
|
||||
*/ |
|
||||
class Row extends FlexContainerComponent { |
|
||||
/** |
|
||||
* |
|
||||
* @param {Attr} attr |
|
||||
* @param {Modifier} modifier |
|
||||
*/ |
|
||||
constructor(attr = {}, modifier = null) { |
|
||||
super(attr, modifier); |
|
||||
this.addStyleClass("row-component") |
|
||||
this._flexDirection = "row"; |
|
||||
//this.modifier(new Modifier().fillMaxWidth());
|
|
||||
this.setFlexDirection(false); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* |
|
||||
* @param {Component|Array<Component>} innerComponent |
|
||||
* @returns {Row} |
|
||||
*/ |
|
||||
childContext(innerComponent) { |
|
||||
function setFloat(comp, side = "right") { |
|
||||
comp._modifier = new Modifier() |
|
||||
.setStyleRule("float", side) |
|
||||
.join(comp._modifier); |
|
||||
} |
|
||||
|
|
||||
super.childContext(innerComponent); |
|
||||
|
|
||||
for (const child of this._children) { |
|
||||
onSingleOrArray( |
|
||||
child, |
|
||||
(e, i) => setFloat(e, (i === 0 ? "left" : "right")) |
|
||||
); |
|
||||
} |
|
||||
|
|
||||
return this; |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
@ -0,0 +1,19 @@ |
|||||
|
/** |
||||
|
* A FlexContainerComponent, which organizes the children in a column like manner. |
||||
|
* @extends FlexContainerComponent |
||||
|
* @inheritdoc |
||||
|
*/ |
||||
|
class Column extends FlexContainerComponent { |
||||
|
/** |
||||
|
* |
||||
|
* @param {Attr} attr |
||||
|
* @param {Modifier} modifier |
||||
|
*/ |
||||
|
constructor(attr = {}, modifier = null) { |
||||
|
super(attr, modifier); |
||||
|
this.addStyleClass("column-component"); |
||||
|
this._flexDirection = "column"; |
||||
|
this.setFlexDirection(); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,173 @@ |
|||||
|
/** |
||||
|
* Represents container Components. |
||||
|
* Some predefined modifications are applied on the child components. |
||||
|
* @extends Component |
||||
|
* @inheritdoc |
||||
|
*/ |
||||
|
class FlexContainerComponent extends Component { |
||||
|
/** |
||||
|
* @type {boolean} |
||||
|
*/ |
||||
|
_distributeEvenglyAfterGenerate; |
||||
|
/** |
||||
|
* @type {number} the amount that should be left out of the total space before the children |
||||
|
* space is set. |
||||
|
*/ |
||||
|
#distributionRecess; |
||||
|
/** |
||||
|
* @type {number} the additional gap that should be left for children before their space is set |
||||
|
*/ |
||||
|
#distributionGapPerChild; |
||||
|
/** |
||||
|
* @type {string} |
||||
|
*/ |
||||
|
_flexDirection; |
||||
|
/** |
||||
|
* |
||||
|
* @param {Attr} attr |
||||
|
* @param {Modifier} modifier |
||||
|
*/ |
||||
|
constructor(attr = {}, modifier = null, baseElement = "div") { |
||||
|
super(document.createElement(baseElement), attr); |
||||
|
this._flexDirection = ""; |
||||
|
this._distributeEvenglyAfterGenerate = false; |
||||
|
this.addStyleClass("flex-container-component"); |
||||
|
if (modifier) { |
||||
|
this.modifier(modifier); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @param {boolean} [vertical=true] |
||||
|
* @returns {FlexContainerComponent} |
||||
|
*/ |
||||
|
setFlexDirection(vertical = true) { |
||||
|
return this.modifier( |
||||
|
new Modifier() |
||||
|
.setStyleRule( |
||||
|
"flex-direction", |
||||
|
(vertical ? "column" : "row") |
||||
|
) |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @param {Component|Array<Component>} innerComponent |
||||
|
* @returns {FlexContainerComponent} this component object |
||||
|
*/ |
||||
|
childContext(innerComponent) { |
||||
|
if (innerComponent instanceof Array) { |
||||
|
innerComponent |
||||
|
.map(cl => { |
||||
|
if (cl instanceof Component) { |
||||
|
return cl; |
||||
|
} else { |
||||
|
return cl.ensureModifier().toComponent(); |
||||
|
} |
||||
|
}) |
||||
|
.forEach(icomp => { |
||||
|
icomp._modifier = new Modifier() |
||||
|
.removeStyleRule("flex") |
||||
|
.join(icomp._modifier); |
||||
|
}); |
||||
|
} |
||||
|
return super.childContext(innerComponent); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @param {number} [recessFraction=0.0] recessFraction a fraction/percentage of the recess |
||||
|
* that should be left out before distributing the remaining space. |
||||
|
* @param {number} [gapPerChild=1] gapPerChild the gap per child, therefore inbetween children |
||||
|
* that shouldn't be distributed to the children |
||||
|
*/ |
||||
|
_distributingSpacing(recessFraction = 0.0, gapPerChild = 1) { |
||||
|
if (this._children && this._children.length > 1) { |
||||
|
|
||||
|
let distributableSpace = 100 - 100 * recessFraction - (this._children.length - 1) * gapPerChild; |
||||
|
|
||||
|
let childDistributionFraction = Math.floor( |
||||
|
(distributableSpace / this._children.length) * 100 |
||||
|
) / 100; |
||||
|
|
||||
|
let direction = (this._flexDirection === 'column' ? 'height' : "width"); |
||||
|
|
||||
|
for (const icomp of this._children) { |
||||
|
/* sets the width for all elements, |
||||
|
to avoid overlapping or line break because of lacking width, |
||||
|
a percent is subtracted for every child element */ |
||||
|
/* To enable "override" a new Modifier is generated and joined |
||||
|
with the modifier of the component */ |
||||
|
icomp._modifier._modifications[direction] = childDistributionFraction + "%"; |
||||
|
icomp._modifier._modifications["max-" + direction] = childDistributionFraction + "%"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Distributes the spacing of the childrens evengly, |
||||
|
* according to the flexdirection of this component. |
||||
|
* By default this will be executed imediately when called. |
||||
|
* |
||||
|
* @param {boolean} [rightNow=true] if set to false it will set properties accordingly |
||||
|
* so that the distribution will be executed on generate |
||||
|
* @param {number} [recessFraction=0.0] recessFraction a fraction/percentage of the recess |
||||
|
* that should be left out before distributing the remaining space. |
||||
|
* @param {number} [gapPerChild=1] gapPerChild the gap per child, therefore inbetween children |
||||
|
* that shouldn't be distributed to the children |
||||
|
* @returns {FlexContainerComponent} |
||||
|
*/ |
||||
|
distibuteSpacingEvenly(rightNow = true, recessFraction = 0.0, gapPerChild = 1) { |
||||
|
if (rightNow) { |
||||
|
this._distributingSpacing(recessFraction, gapPerChild); |
||||
|
} else { |
||||
|
this.#distributionRecess = recessFraction; |
||||
|
this.#distributionGapPerChild = gapPerChild; |
||||
|
this._distributeEvenglyAfterGenerate = true; |
||||
|
} |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Adds, sets, updates or overwrites the Modification of/for the children of this component. |
||||
|
* Just calls .modifier(modifier) on each child. |
||||
|
* |
||||
|
* @param {Modifier} modifier |
||||
|
* @param {boolean|ExtStorage|ExtStoreType|OverwriteBehaviour} [extStore=null] |
||||
|
* @returns {FlexContainerComponent} this component object |
||||
|
*/ |
||||
|
modifyChildren(modifier, underTheName = "", extStore = false) { |
||||
|
if (underTheName === "") { |
||||
|
underTheName = `.${this._compName}-style-children`; |
||||
|
} |
||||
|
if (!extStore) { |
||||
|
for (const child of this._children) { |
||||
|
child.modifier(modifier) |
||||
|
} |
||||
|
} else { |
||||
|
this.addStyleClass(underTheName); |
||||
|
this._styles.push( |
||||
|
new SStoreDefinition( |
||||
|
underTheName, |
||||
|
modifier.ensureModifier() |
||||
|
) |
||||
|
); |
||||
|
} |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @override |
||||
|
* @inheritdoc |
||||
|
* @extends Component.generate() |
||||
|
*/ |
||||
|
generate(generator = singlepage, styleStore = null, functionStore = null) { |
||||
|
if (this._distributeEvenglyAfterGenerate) { |
||||
|
this._distributingSpacing(this.#distributionRecess, this.#distributionGapPerChild); |
||||
|
} |
||||
|
|
||||
|
return super.generate(generator, styleStore, functionStore); |
||||
|
} |
||||
|
} |
@ -0,0 +1,69 @@ |
|||||
|
/** |
||||
|
* Represents a Component (of an HTMLElement) that is capable of receiving input. |
||||
|
* @extends Component |
||||
|
* @inheritdoc |
||||
|
*/ |
||||
|
class InputComponent extends Component { |
||||
|
/** |
||||
|
* |
||||
|
* @param {string} element |
||||
|
* @param {Attr} attr |
||||
|
* @param {Modifier} modifier |
||||
|
*/ |
||||
|
constructor(element, attr = {}, modifier = null) { |
||||
|
super(element, attr); |
||||
|
this.addStyleClass("el-input-comp"); |
||||
|
if (modifier) { |
||||
|
this.modifier(modifier); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* This overrides the text() method in such a way, |
||||
|
* that it sets the value attribute for input elements instead. |
||||
|
* |
||||
|
* @override |
||||
|
* @inheritdoc |
||||
|
* @param {string} text |
||||
|
* @returns {InputComponent} |
||||
|
*/ |
||||
|
text(text){ |
||||
|
if (this._element instanceof HTMLInputElement) { |
||||
|
this._element.value = text; |
||||
|
} else { |
||||
|
super.text(text); |
||||
|
} |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* The parameter makes it optional to trigger the state by a variable |
||||
|
* @param {boolean} readonly |
||||
|
* @returns {Component} |
||||
|
*/ |
||||
|
readonly(readonly = true) { |
||||
|
if (readonly) { |
||||
|
this._element.setAttribute("readonly", readonly); |
||||
|
} |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Sets the value of the InputComponent |
||||
|
* @param {string} Value |
||||
|
* @returns {InputComponent|Component} |
||||
|
*/ |
||||
|
value(value) { |
||||
|
this._element.value = value; |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @param {string} name |
||||
|
* @returns {InputComponent|Component} |
||||
|
*/ |
||||
|
name(name) { |
||||
|
return this.setAttribute("name", name); |
||||
|
} |
||||
|
} |
@ -0,0 +1,46 @@ |
|||||
|
/** |
||||
|
* A FlexContainerComponent, which organizes the children in a row like manner. |
||||
|
* |
||||
|
* @extends FlexContainerComponent |
||||
|
* @inheritdoc |
||||
|
*/ |
||||
|
class Row extends FlexContainerComponent { |
||||
|
/** |
||||
|
* |
||||
|
* @param {Attr} attr |
||||
|
* @param {Modifier} modifier |
||||
|
*/ |
||||
|
constructor(attr = {}, modifier = null) { |
||||
|
super(attr, modifier); |
||||
|
this.addStyleClass("row-component") |
||||
|
this._flexDirection = "row"; |
||||
|
//this.modifier(new Modifier().fillMaxWidth());
|
||||
|
this.setFlexDirection(false); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @param {Component|Array<Component>} innerComponent |
||||
|
* @returns {Row} |
||||
|
*/ |
||||
|
childContext(innerComponent) { |
||||
|
function setFloat(comp, side = "right") { |
||||
|
comp._modifier = new Modifier() |
||||
|
.setStyleRule("float", side) |
||||
|
.join(comp._modifier); |
||||
|
} |
||||
|
|
||||
|
super.childContext(innerComponent); |
||||
|
|
||||
|
for (const child of this._children) { |
||||
|
onSingleOrArray( |
||||
|
child, |
||||
|
(e, i) => setFloat(e, (i === 0 ? "left" : "right")) |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -1,10 +1,3 @@ |
|||||
/** |
|
||||
* This file is part of the jps-like-websites lib |
|
||||
* URL: https://git.labos.goip.de/chris/jpc-like-websites
|
|
||||
* @copyright by its creator Christian Martin |
|
||||
*/ |
|
||||
|
|
||||
|
|
||||
/** |
/** |
||||
* @inheritdoc |
* @inheritdoc |
||||
* @extends ChildbearerComponent |
* @extends ChildbearerComponent |
@ -1,31 +0,0 @@ |
|||||
/** |
|
||||
* This file is part of the jps-like-websites lib |
|
||||
* URL: https://git.labos.goip.de/chris/jpc-like-websites
|
|
||||
* @copyright by its creator Christian Martin |
|
||||
*/ |
|
||||
|
|
||||
/** |
|
||||
* Wenity := Web Trinity |
|
||||
*/ |
|
||||
class WebTrinity { |
|
||||
/** |
|
||||
* |
|
||||
* @param {HTMLElement|Component} html |
|
||||
* @param {HTMLStyleElement|Map<ExtStorageType, Array<SStoreDefinition>} js |
|
||||
* @param {HTMLScriptElement|Array<SStoreDefinition>} css |
|
||||
*/ |
|
||||
constructor(html = null, js = null, css = null) { |
|
||||
this.html = html; |
|
||||
this.js = js; |
|
||||
this.css = css; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* |
|
||||
* @returns {boolean} |
|
||||
*/ |
|
||||
isSSEmpty() { |
|
||||
return (this.js === null || this.js.length === 0) |
|
||||
&& (this.css === null || this.css.size === 0); |
|
||||
} |
|
||||
} |
|
@ -1,9 +1,3 @@ |
|||||
/** |
|
||||
* This file is part of the jps-like-websites lib |
|
||||
* URL: https://git.labos.goip.de/chris/jpc-like-websites
|
|
||||
* @copyright by its creator Christian Martin |
|
||||
*/ |
|
||||
|
|
||||
/** |
/** |
||||
* Enum providing common alignment rules |
* Enum providing common alignment rules |
||||
*/ |
*/ |
@ -1,9 +1,3 @@ |
|||||
/** |
|
||||
* This file is part of the jps-like-websites lib |
|
||||
* URL: https://git.labos.goip.de/chris/jpc-like-websites
|
|
||||
* @copyright by its creator Christian Martin |
|
||||
*/ |
|
||||
|
|
||||
/** |
/** |
||||
* Enum providing common alignment rules |
* Enum providing common alignment rules |
||||
*/ |
*/ |
@ -1,84 +0,0 @@ |
|||||
/** |
|
||||
* This file is part of the jps-like-websites lib |
|
||||
* URL: https://git.labos.goip.de/chris/jpc-like-websites
|
|
||||
* @copyright by its creator Christian Martin |
|
||||
*/ |
|
||||
|
|
||||
/** |
|
||||
* Defines an extension that can be added to the jpclw-framework |
|
||||
*/ |
|
||||
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 |
|
||||
|
|
||||
/** |
|
||||
* 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(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
@ -0,0 +1 @@ |
|||||
|
const singlepage = new CompelGenerator(); |
@ -0,0 +1,313 @@ |
|||||
|
/** |
||||
|
* This class defines the Component generator. |
||||
|
* It externalizes all decision making about script or style storage from the component. |
||||
|
* The component stores the generator (if set, if not =default or passed down from parent component). |
||||
|
* The CompelGenerator class enables the setup/definition of storage, generation and distribution. |
||||
|
* |
||||
|
* Further if other frameworks are targeted: |
||||
|
* if the components should be generated in a manner |
||||
|
* that they fullfill the setup/look of other framework-components. |
||||
|
* Only the generator has to be modified, implemented, extended ... |
||||
|
* not the component, modifier or any other of the classes. |
||||
|
* |
||||
|
* Therefore the usages of CompelGenerator-feature-logic resets all style and script storages to local. |
||||
|
* Only towards the end (when "generate()" is called) any of that will be resolved. |
||||
|
*/ |
||||
|
class CompelGenerator { |
||||
|
/** |
||||
|
* @param {ExtStorage} styleStore default ExtStoreType.INTERNALIZED_WITHIN |
||||
|
* @param {ExtStorage} functionStore default ExtStoreType.CENTRALIZED_DOC_HEAD |
||||
|
*/ |
||||
|
constructor( |
||||
|
styleStore = ExtStoreType.INTERNALIZED_WITHIN |
||||
|
.setOverwriteBehaviour(OverwriteBehaviour.REPLACE), |
||||
|
functionStore = ExtStoreType.CENTRALIZED_DOC_HEAD |
||||
|
.setOverwriteBehaviour(OverwriteBehaviour.REPLACE) |
||||
|
) { |
||||
|
this._styleStore = styleStore; |
||||
|
this._functionStore = functionStore; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* Deals with the direct component stylings |
||||
|
* @param {Component} component |
||||
|
* @param {Array<WebTrinity>} childrenWenity |
||||
|
* @param {ExtStorage} extStore |
||||
|
* @returns {Array<SStoreDefinition>} |
||||
|
*/ |
||||
|
processStyles(component, extStore = null) { |
||||
|
extStore = (extStore |
||||
|
? extStore |
||||
|
: component._stylesExtStore |
||||
|
) |
||||
|
.setupForGeneralStyling(); |
||||
|
|
||||
|
let forCollection = []; |
||||
|
|
||||
|
let counter = 0; |
||||
|
for (const ssd of component._styles) { |
||||
|
/* Make sure that the type is unified for later processing */ |
||||
|
if (ssd._definition instanceof Modifier) { |
||||
|
ssd._definition = ssd._definition._modifications; |
||||
|
} |
||||
|
|
||||
|
/* Check/Ensure proper ExtStorageType for following comparison */ |
||||
|
/** |
||||
|
* @type {ExtStorage} |
||||
|
*/ |
||||
|
let curExtStore = extStore; |
||||
|
|
||||
|
if (ssd.hasOwnProperty("_extStore") && ssd._extStore) { |
||||
|
curExtStore = ssd._extStore.setupForGeneralStyling(); |
||||
|
} |
||||
|
|
||||
|
if (curExtStore.getStylingDistribution()(ssd, component._element, counter)) { |
||||
|
forCollection.push(ssd); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return forCollection; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* First deals with the scripts/functions. |
||||
|
* |
||||
|
* @param {Component} component |
||||
|
* @param {Array<WebTrinity>} childrenWenity |
||||
|
* @param {ExtStorage} extStore |
||||
|
* @returns {Array<SStoreDefinition>} |
||||
|
*/ |
||||
|
processFunctions(component, extStore = null) { |
||||
|
extStore = (extStore |
||||
|
? extStore |
||||
|
: component._functionsExtStore |
||||
|
) |
||||
|
.setupForFunctions(); |
||||
|
|
||||
|
const forCollection = new Map(); |
||||
|
const collectForBefore = []; |
||||
|
|
||||
|
let counter = 0; |
||||
|
for (const ssd of component._functions) { |
||||
|
/* Make sure that the type is unified for later processing */ |
||||
|
|
||||
|
let curExtStore = extStore; |
||||
|
if (Object.hasOwn(ssd, "_extStore") && ssd._extStore) { |
||||
|
curExtStore = ssd._extStore.setupForFunctions(); |
||||
|
} |
||||
|
|
||||
|
if (curExtStore.getFunctionDistribution()(ssd, counter)) { |
||||
|
if (curExtStore._position.BEFORE) { |
||||
|
collectForBefore.push(ssd); |
||||
|
} else { |
||||
|
if (!forCollection.has(curExtStore)) { |
||||
|
forCollection.set(curExtStore, []); |
||||
|
} |
||||
|
forCollection.get(curExtStore).push(ssd); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return forCollection; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* checks if the source has the extStoreType |
||||
|
* fills the target extStoreType-array with the corr. elements of source. |
||||
|
* @param {Map<ExtStoreType, Array<SStoreDefinition>>} source |
||||
|
* @param {Map<ExtStoreType, Array<SStoreDefinition>>} target |
||||
|
* @param {ExtStoreType} extStoreType |
||||
|
* @returns |
||||
|
*/ |
||||
|
transferCollectedFunctions(source, target, extStoreType) { |
||||
|
if (source) { |
||||
|
if (source.has(extStoreType)) { |
||||
|
if (funcCollections.has(extStoreType)) { |
||||
|
target.get(extStoreType) |
||||
|
.push(source.get(extStoreType)) |
||||
|
} else { |
||||
|
target.set( |
||||
|
extStoreType, |
||||
|
source.get(extStoreType) |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return target; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @param {Map<ExtStoreType, *>} extFuncMap |
||||
|
* @param {ExtStorageType} extStoreType |
||||
|
*/ |
||||
|
dealCollectedFuncs(extFuncMap, extStoreType) { |
||||
|
if (extFuncMap.has(extStoreType)) { |
||||
|
let collectionScriptTag = generateAndFillScriptTag(extFuncMap.get(extStoreType)); |
||||
|
if (extStoreType === ExtStoreType.COLLECTED_SEGMENT_BEGIN) { |
||||
|
this._element.insertAdjacentElement( |
||||
|
"afterbegin", |
||||
|
generateAndFillScriptTag(segment) |
||||
|
); |
||||
|
} else { |
||||
|
Page.addElementToPage( |
||||
|
collectionScriptTag, |
||||
|
extStoreType |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* Generates and appends a child Component. |
||||
|
* @param {Component} parent component the child component to add it. |
||||
|
* @param {Component|WebTrinity|string} child |
||||
|
* @returns {WebTrinity} |
||||
|
*/ |
||||
|
appendChildComponent(parent, child) { |
||||
|
let childWT = new WebTrinity(); |
||||
|
if (child instanceof Component) { |
||||
|
childWT = child.generate(this); |
||||
|
} |
||||
|
|
||||
|
if (child instanceof WebTrinity) { |
||||
|
childWT = child; |
||||
|
} |
||||
|
|
||||
|
if (child instanceof HTMLElement) { |
||||
|
console.log("No wenity set - htmlEl was given"); |
||||
|
childWT.compext = child; |
||||
|
} |
||||
|
|
||||
|
parent._element.append(childWT.compext); |
||||
|
|
||||
|
return childWT; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* Iterates over the children of the component |
||||
|
* and calls generate on each child. |
||||
|
* The resulting compext (the text of the component) is added/appended accordingly. |
||||
|
* If the generation returns with delegatable scripts or styles |
||||
|
* the WebTrinity object is collected in an array, |
||||
|
* which will be returned. |
||||
|
* |
||||
|
* @param {Component} component |
||||
|
* @returns {Array<WebTrinity>} |
||||
|
*/ |
||||
|
resolveChildren(component, styleStore, functionStore) { |
||||
|
/** |
||||
|
* @type {Array<WebTrinity>} |
||||
|
*/ |
||||
|
let wenities = []; |
||||
|
|
||||
|
for (let child of component._children) { |
||||
|
child = child.generate(this, styleStore, functionStore); |
||||
|
|
||||
|
let wenity = this.appendChildComponent(component, child); |
||||
|
|
||||
|
if (!wenity.isSSEmpty()) { |
||||
|
wenities.push(wenity); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return wenities; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @param {Component} component |
||||
|
* @param {ExtStorage} [styleStore=null] |
||||
|
* @param {ExtStorage} [functionStore=null] |
||||
|
* @returns {WebTrinity} |
||||
|
*/ |
||||
|
generate(component, styleStore = null, functionStore = null) { |
||||
|
|
||||
|
if (!styleStore) { |
||||
|
styleStore = component._stylesExtStore; |
||||
|
} |
||||
|
if (!functionStore) { |
||||
|
functionStore = component._functionsExtStore; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* DEAL WITH COMPONENT MODIFICATION FIRST |
||||
|
* |
||||
|
* @todo pay attention to the "overwrite" behaviour |
||||
|
* the local modifier styles are the "closest" |
||||
|
* it might be appropriate to use this._styles.unshift(...) instead. |
||||
|
*/ |
||||
|
component._styles.push(new SStoreDefinition( |
||||
|
(styleStore._aggregation !== ESAggregation.INTERNALIZED |
||||
|
? "." |
||||
|
: "") |
||||
|
+ component._compName, |
||||
|
component._modifier, |
||||
|
component._stylesExtStore |
||||
|
)); |
||||
|
|
||||
|
/** |
||||
|
* DEAL WITH CHILDREN |
||||
|
* |
||||
|
* Depending on the setup of the generator/-tion |
||||
|
* The children might return scripts or styles |
||||
|
* that are supposed to be collected |
||||
|
* and dealt with as a collection. |
||||
|
*/ |
||||
|
let childrenWenities = this.resolveChildren(component, styleStore, functionStore); |
||||
|
|
||||
|
/** |
||||
|
* DEAL WITH STYLES AND SCRIPTS |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
* @type {Array<SStoreDefinition>} |
||||
|
*/ |
||||
|
let styleCollection = this.processStyles(component, styleStore); |
||||
|
/** |
||||
|
* @type {Map<ExtStoreType, Array<SStoreDefinition>>} |
||||
|
*/ |
||||
|
let funcCollections = this.processFunctions(component, functionStore); |
||||
|
|
||||
|
/** |
||||
|
* DEAL WITH CHILDREN WENITY SCRIPTS |
||||
|
*/ |
||||
|
for (const child of childrenWenities) { |
||||
|
if (child.scripts) { |
||||
|
executeOnExtStoreTypeCollectedTriple( |
||||
|
(extstoretype) => this.transferCollectedFunctions(child.scripts, funcCollections, extstoretype) |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
let wenity = new WebTrinity(); |
||||
|
/** |
||||
|
* DEAL WITH CHILDREN WENITY STYLE |
||||
|
*/ |
||||
|
if (component._isCompel) { |
||||
|
executeOnExtStoreTypeCollectedTriple((est) => this.dealCollectedFuncs(funcCollections, est)); |
||||
|
} else { |
||||
|
wenity.scripts = funcCollections; |
||||
|
wenity.stylings = styleCollection; |
||||
|
} |
||||
|
|
||||
|
wenity.compext = component._element |
||||
|
|
||||
|
for (const group of component._toRegister) { |
||||
|
Page.subscribeComponentToGroup(group, component._compName); |
||||
|
} |
||||
|
|
||||
|
return wenity; |
||||
|
} |
||||
|
|
||||
|
} |
@ -1,9 +1,3 @@ |
|||||
/** |
|
||||
* This file is part of the jps-like-websites lib |
|
||||
* URL: https://git.labos.goip.de/chris/jpc-like-websites
|
|
||||
* @copyright by its creator Christian Martin |
|
||||
*/ |
|
||||
|
|
||||
/** |
/** |
||||
* Enum to access common events |
* Enum to access common events |
||||
*/ |
*/ |
@ -1,9 +1,3 @@ |
|||||
/** |
|
||||
* This file is part of the jps-like-websites lib |
|
||||
* URL: https://git.labos.goip.de/chris/jpc-like-websites
|
|
||||
* @copyright by its creator Christian Martin |
|
||||
*/ |
|
||||
|
|
||||
const EventDrag = Object.freeze({ |
const EventDrag = Object.freeze({ |
||||
OVER: "over", |
OVER: "over", |
||||
START: "start", |
START: "start", |
@ -0,0 +1,55 @@ |
|||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
class ObjectAccessObject { |
||||
|
/** |
||||
|
* |
||||
|
* @param {Object} object |
||||
|
*/ |
||||
|
constructor(object = null) { |
||||
|
/** |
||||
|
* @type {Array<string>} |
||||
|
*/ |
||||
|
this.keys = (object ? Object.keys(object) : []); |
||||
|
/** |
||||
|
* @type {Object} |
||||
|
*/ |
||||
|
this.objects = (object ? object : {}); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @param {Array<string>} keyArr |
||||
|
* @param {Object} refObject |
||||
|
* @returns |
||||
|
*/ |
||||
|
fillByArrayReference(keyArr, refObject) { |
||||
|
this.keys = keyArr; |
||||
|
refObject = keyArr.reduce((a, c) => Object.assign(a, { [c]: refObject[c] }), {}); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @param {string} key |
||||
|
* @param {*} value |
||||
|
* @returns {ObjectAccessObject} |
||||
|
*/ |
||||
|
add(key, value) { |
||||
|
this.objects[key, value]; |
||||
|
this.keys.push(key); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @param {string} key |
||||
|
* @returns {*} |
||||
|
*/ |
||||
|
remove(key) { |
||||
|
let tmp = this.objects[key]; |
||||
|
delete this.objects[key]; |
||||
|
return tmp; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,84 @@ |
|||||
|
/** |
||||
|
* |
||||
|
* @param {number} start |
||||
|
* @param {number} end |
||||
|
* @param {number} value |
||||
|
* @param {number} tolerance |
||||
|
* @param {boolean} usePercentage |
||||
|
* @returns {boolean} |
||||
|
*/ |
||||
|
function isValueInBounds(start, end, value, tolerance = 0, usePercentage = false) { |
||||
|
if (tolerance !== 0) { |
||||
|
if (usePercentage) { |
||||
|
start = start * (1 - tolerance / 100); |
||||
|
end = end * (1 + tolerance / 100); |
||||
|
} else { |
||||
|
start = start - tolerance; |
||||
|
end = end + tolerance; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return value >= start && value <= end; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @param {number} x |
||||
|
* @param {number} y |
||||
|
* @param {Map<SideDirections,number>} area |
||||
|
* @param {number} tolerance |
||||
|
* @param {boolean} usePercentage if tolerance is given and this is set to true, |
||||
|
* the tolerance will be calculated by percentage, |
||||
|
* otherwise it will be subtracted/added |
||||
|
* @returns {boolean} |
||||
|
*/ |
||||
|
function areXYInArea(x, y, area, tolerance = 0, usePercentage = false) { |
||||
|
return isValueInBounds( |
||||
|
area.get(SideDirections.LEFT), |
||||
|
area.get(SideDirections.RIGHT), |
||||
|
x, |
||||
|
tolerance, |
||||
|
usePercentage |
||||
|
) && isValueInBounds( |
||||
|
area.get(SideDirections.TOP), |
||||
|
area.get(SideDirections.BOTTOM), |
||||
|
y, |
||||
|
tolerance, |
||||
|
usePercentage |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @param {TwoDimPoint} point |
||||
|
* @param {Map<SideDirections,number>} area |
||||
|
* @param {number} tolerance |
||||
|
* @param {boolean} usePercentage if tolerance is given and this is set to true, |
||||
|
* the tolerance will be calculated by percentage, |
||||
|
* otherwise it will be subtracted/added |
||||
|
*/ |
||||
|
function isPointInArea(point, area, tolerance = 0, usePercentage = false) { |
||||
|
return areXYInArea( |
||||
|
point.x, |
||||
|
point.y, |
||||
|
area, |
||||
|
tolerance, |
||||
|
usePercentage |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @param {HTMLElement} element |
||||
|
* @returns {Object<SideDirections, number} |
||||
|
*/ |
||||
|
function getEnclosingBounds(element) { |
||||
|
let area = element.getBoundingClientRect(); |
||||
|
let parentArea = element.parentElement.getBoundingClientRect(); |
||||
|
return { |
||||
|
[SideDirections.LEFT]: Math.min(area.left, parentArea.left), |
||||
|
[SideDirections.RIGHT]: Math.max(area.right, parentArea.right), |
||||
|
[SideDirections.TOP]: Math.min(area.top, parentArea.top), |
||||
|
[SideDirections.BOTTOM]: Math.max(area.bottom, parentArea.bottom) |
||||
|
} |
||||
|
} |
@ -0,0 +1,187 @@ |
|||||
|
/** |
||||
|
* @extends Modifier |
||||
|
* @inheritdoc |
||||
|
*/ |
||||
|
class ChainableModifier extends Modifier { |
||||
|
/** |
||||
|
* @type {Component} |
||||
|
*/ |
||||
|
_component; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @param {Component} component |
||||
|
*/ |
||||
|
constructor(component) { |
||||
|
super(); |
||||
|
this._component = component; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @inheritdoc |
||||
|
* @override |
||||
|
* @returns {ChainableModifier} |
||||
|
*/ |
||||
|
fillMaxSize(widthFraction = 1, heightFraction = 1) { |
||||
|
return super.fillMaxSize(widthFraction, heightFraction); |
||||
|
} |
||||
|
/** |
||||
|
* @inheritdoc |
||||
|
* @override |
||||
|
* @returns {ChainableModifier} |
||||
|
*/ |
||||
|
fillMaxWidth(fraction = 1) { |
||||
|
return super.fillMaxWidth(fraction); |
||||
|
} |
||||
|
/** |
||||
|
* @inheritdoc |
||||
|
* @override |
||||
|
* @returns {ChainableModifier} |
||||
|
*/ |
||||
|
fillMaxHeight(fraction = 1) { |
||||
|
return super.fillMaxHeight(fraction); |
||||
|
} |
||||
|
/** |
||||
|
* @inheritdoc |
||||
|
* @override |
||||
|
* @returns {ChainableModifier} |
||||
|
*/ |
||||
|
background(color) { |
||||
|
return super.background(color); |
||||
|
} |
||||
|
/** |
||||
|
* @inheritdoc |
||||
|
* @override |
||||
|
* @returns {ChainableModifier} |
||||
|
*/ |
||||
|
color(color) { |
||||
|
return super.color(color); |
||||
|
} |
||||
|
/** |
||||
|
* @inheritdoc |
||||
|
* @override |
||||
|
* @returns {ChainableModifier} |
||||
|
*/ |
||||
|
setStyleRule(key, value) { |
||||
|
return super.setStyleRule(key, value); |
||||
|
} |
||||
|
/** |
||||
|
* @inheritdoc |
||||
|
* @override |
||||
|
* @returns {ChainableModifier} |
||||
|
*/ |
||||
|
addStyleRuleMap(rulemap) { |
||||
|
return super.addStyleRuleMap(rulemap); |
||||
|
} |
||||
|
/** |
||||
|
* @inheritdoc |
||||
|
* @override |
||||
|
* @returns {ChainableModifier} |
||||
|
*/ |
||||
|
removeStyleRule(key) { |
||||
|
return super.removeStyleRule(key); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @inheritdoc |
||||
|
* |
||||
|
* In Case it is called from a ChainableModifier chain, |
||||
|
* the Return type would be DimensionsChainedModifier instead of DimensionsChain. |
||||
|
* @override |
||||
|
* @param {Dimensions | number | undefined} [modify=null] dimensions |
||||
|
* @returns {ChainableModifier | DimensionsChainedModifier} |
||||
|
*/ |
||||
|
dimensions(modify = null) { |
||||
|
if (modify instanceof Dimensions || Number.isInteger(modify)) { |
||||
|
return super.dimensions(modify); |
||||
|
} |
||||
|
return new DimensionsChainedModifier(this); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @inheritdoc |
||||
|
* @override |
||||
|
* @param {Padding | number | undefined} [modify=null] modify as in modifiers |
||||
|
* @returns {ChainableModifier | PaddingChainedModifier} |
||||
|
*/ |
||||
|
padding(modify = null) { |
||||
|
if (modify instanceof Padding || Number.isInteger(modify)) { |
||||
|
return super.padding(modify); |
||||
|
} |
||||
|
return new PaddingChainedModifier(this); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @inheritdoc |
||||
|
* @override |
||||
|
* @param {Margin | number | undefined} [modify=null] modify as in modifiers |
||||
|
* @returns {ChainableModifier | MarginChainedModifier} |
||||
|
*/ |
||||
|
margin(modify = null) { |
||||
|
if (modify instanceof Margin || Number.isInteger(modify)) { |
||||
|
return super.margin(modify); |
||||
|
} |
||||
|
return new MarginChainedModifier(this); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @inheritdoc |
||||
|
* |
||||
|
* @override |
||||
|
* @param {Shape | number | undefined} [modify=null] modify |
||||
|
* @returns {ChainableModifier | ShapeChainedModifier} |
||||
|
*/ |
||||
|
clip(modify = null) { |
||||
|
if (modify instanceof Shape || Number.isInteger(modify)) { |
||||
|
return super.clip(modify); |
||||
|
} |
||||
|
return new ShapeChainedModifier(this); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @inheritdoc |
||||
|
* |
||||
|
* @override |
||||
|
* @param {Border | number | undefined} [modify=null] modify |
||||
|
* @returns {ChainableModifier | BorderChainedModifier} |
||||
|
*/ |
||||
|
border(modify = null) { |
||||
|
if (modify instanceof Border || Number.isInteger(modify)) { |
||||
|
return super.border(modify); |
||||
|
} |
||||
|
return new BorderChainedModifier(this); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @returns {Component} |
||||
|
*/ |
||||
|
toComponent() { |
||||
|
return this._component.modifier(this); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @param {Component|Array<Component>} innerComponent |
||||
|
* @returns {Component} the parent Component |
||||
|
*/ |
||||
|
childContext(innerComponent) { |
||||
|
return this._component |
||||
|
.modifier(this) |
||||
|
.childContext(innerComponent); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Calls chainChild() from Component (ChildbearerComponent) |
||||
|
* @see {ChildbearerComponent.chainChild} |
||||
|
* @returns {builder} |
||||
|
*/ |
||||
|
chainChild() { |
||||
|
return this._component |
||||
|
.modifier(this) |
||||
|
.chainChild(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,87 @@ |
|||||
|
/** |
||||
|
* @abstract |
||||
|
*/ |
||||
|
class ModificationSubChain { |
||||
|
/** |
||||
|
* @type {Modifier} |
||||
|
*/ |
||||
|
_modifier; |
||||
|
/** |
||||
|
* @type {string} |
||||
|
*/ |
||||
|
_modMethod; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @param {Modifier} modifier |
||||
|
* @param {string} modMethod |
||||
|
*/ |
||||
|
constructor(modifier, modMethod) { |
||||
|
this._modifier = modifier; |
||||
|
this._modMethod = modMethod; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Returns the Modifier SubChain to the Modifier |
||||
|
* @returns {Modifier|ChainableModifier} |
||||
|
*/ |
||||
|
toModifier() { |
||||
|
return this._modifier[this._modMethod](this); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Returns chain to the Modifier |
||||
|
* @returns {Modifier|ChainableModifier} |
||||
|
*/ |
||||
|
ensureModifier() { |
||||
|
return this.toModifier(); |
||||
|
} |
||||
|
} |
||||
|
/** |
||||
|
* @inheritdoc |
||||
|
* @extends ModificationSubChain |
||||
|
* @abstract |
||||
|
*/ |
||||
|
class ModificationSubChainReComp extends ModificationSubChain { |
||||
|
/** |
||||
|
* |
||||
|
* @param {ChainableModifier} modifier |
||||
|
* @param {string} modMethod |
||||
|
*/ |
||||
|
constructor(modifier) { |
||||
|
super(); |
||||
|
this._modifier = modifier; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Returns chain to the component that is under modification |
||||
|
* @returns {Component} the Component that was (supposed to be) modified by this obj. |
||||
|
*/ |
||||
|
toComponent() { |
||||
|
return this._modifier[this._modMethod](this) |
||||
|
.toComponent(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Returns chain to the component that is under modification |
||||
|
* and adds the given innerComponent as children to the component. |
||||
|
* @param {Component|Array<Component>} innerComponent |
||||
|
* @returns {Component} |
||||
|
*/ |
||||
|
childContext(innerComponent) { |
||||
|
return this._modifier[this._modMethod](this) |
||||
|
.toComponent() |
||||
|
.childContext(innerComponent); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Closes modifier chain and returns builder to define the next child of the component |
||||
|
* @returns {Component} |
||||
|
*/ |
||||
|
chainChild() { |
||||
|
return this._modifier[this._modMethod](this) |
||||
|
.toComponent() |
||||
|
.chainChild(); |
||||
|
} |
||||
|
} |
||||
|
|
Loading…
Reference in new issue