@alkimia/framework 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -36
- package/package.json +1 -1
- package/services/IconService/IconService.html +0 -0
- package/services/IconService/IconService.js +76 -0
- package/services/IconService/IconService.scss +4 -0
- package/services/IconService/playground/index.html +11 -0
- package/services/IconService/playground/index.js +6 -0
- package/services/IconService/playground/package.json +7 -0
- package/src/modulesMaker.js +6 -4
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
# Alkimia Framework
|
|
2
|
+
# Alkimia Framework
|
|
3
3
|
|
|
4
4
|
## Overview
|
|
5
5
|
|
|
6
|
-
The
|
|
6
|
+
The Alkimia Framework (version 0.1.2) is a JavaScript framework that strives to minimize abstraction, encouraging developers to work directly with JavaScript and the HTML DOM. Unlike frameworks such as React, Alkimia emphasizes simplicity and direct manipulation of the DOM, making it easier to build dynamic web applications without the overhead of heavy abstractions. It includes a CLI tool to scaffold components interactively.
|
|
7
7
|
|
|
8
8
|
### Key Principles
|
|
9
9
|
|
|
@@ -13,11 +13,6 @@ The **Alkimia Framework CLI** is a command-line tool designed to enhance the dev
|
|
|
13
13
|
- **Encouraged Verbosity**: To further reduce abstractions, the framework encourages verbosity. This ensures that the code remains clear and understandable, even for complex applications.
|
|
14
14
|
- **View Module Creation**: The CLI offers the option to create modules that require a view. In such cases, HTML and SCSS placeholder files are added automatically. Additionally, a playground folder is included in each module, providing an introduction to the component's usage, including data binding.
|
|
15
15
|
|
|
16
|
-
### Features
|
|
17
|
-
|
|
18
|
-
- **Component Creation**: Effortlessly generate new components with predefined structures tailored to your project.
|
|
19
|
-
- **State Management**: Seamlessly integrate state management using Alkimia's built-in utilities.
|
|
20
|
-
- **Resource Management**: Efficiently import and manage various resources with ease.
|
|
21
16
|
## Features
|
|
22
17
|
|
|
23
18
|
- **Component Creation**: Easily generate new components with predefined structures.
|
|
@@ -28,52 +23,46 @@ The **Alkimia Framework CLI** is a command-line tool designed to enhance the dev
|
|
|
28
23
|
## Directory Structure
|
|
29
24
|
|
|
30
25
|
```
|
|
31
|
-
alkimia
|
|
32
|
-
├──
|
|
33
|
-
|
|
34
|
-
│ ├── InputElement.js
|
|
35
|
-
│ ├── InputElement.html
|
|
36
|
-
│ ├── InputElement.scss
|
|
37
|
-
│ └── playground/
|
|
38
|
-
│ ├── index.mjs
|
|
39
|
-
│ └── package.json
|
|
26
|
+
@alkimia/framework/
|
|
27
|
+
├── cli.js # CLI entry point
|
|
28
|
+
├── index.js # Main exports
|
|
40
29
|
├── src/
|
|
41
|
-
│ ├── createComponent.js
|
|
42
|
-
│ ├──
|
|
43
|
-
│
|
|
44
|
-
│ └──
|
|
45
|
-
├──
|
|
46
|
-
|
|
30
|
+
│ ├── createComponent.js # Component generator logic
|
|
31
|
+
│ ├── modulesMaker.js # Module templates
|
|
32
|
+
│ ├── makeResourcesImportable.js # Resource bundling
|
|
33
|
+
│ └── vite.config.js # Build config
|
|
34
|
+
├── components/ # Example generated components
|
|
35
|
+
│ └── LoginWith2fa/
|
|
36
|
+
├── sample/ # Sample projects
|
|
37
|
+
├── package.json
|
|
38
|
+
├── eslint.config.mjs
|
|
47
39
|
└── README.md
|
|
48
40
|
```
|
|
49
41
|
|
|
50
42
|
## Installation
|
|
51
43
|
|
|
52
|
-
To install the Alkimia Framework
|
|
44
|
+
To install the Alkimia Framework, you need to have Node.js and npm installed on your machine. Then, run the following command:
|
|
53
45
|
|
|
54
46
|
```bash
|
|
55
|
-
npm install -g alkimia
|
|
47
|
+
npm install -g @alkimia/framework
|
|
56
48
|
```
|
|
57
49
|
|
|
58
50
|
## Usage
|
|
59
51
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
### Creating a New Component
|
|
63
|
-
|
|
64
|
-
To create a new component, run:
|
|
52
|
+
The Alkimia Framework includes a CLI tool for scaffolding components. After installation, run the CLI interactively:
|
|
65
53
|
|
|
66
54
|
```bash
|
|
67
|
-
alkimia
|
|
55
|
+
alkimia
|
|
68
56
|
```
|
|
69
57
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
58
|
+
You'll be prompted for:
|
|
59
|
+
- Directory (e.g., `src`)
|
|
60
|
+
- Component name
|
|
61
|
+
- Options (e.g., include DOM, playground, states sample)
|
|
73
62
|
|
|
74
|
-
|
|
63
|
+
This generates a new component module in the specified directory with optional HTML, SCSS, and playground files.
|
|
75
64
|
|
|
76
|
-
|
|
65
|
+
For more details on state management or resource importing, see the generated component examples in the `components/` directory or the @alkimia/lib documentation.
|
|
77
66
|
|
|
78
67
|
## Contributing
|
|
79
68
|
|
|
@@ -91,5 +80,5 @@ If you wish to contribute to the Alkimia Framework CLI, please follow the guidel
|
|
|
91
80
|
|
|
92
81
|
## License
|
|
93
82
|
|
|
94
|
-
This project is licensed under the
|
|
83
|
+
This project is licensed under the ISC License - see the [LICENSE](LICENSE) file for details.
|
|
95
84
|
|
package/package.json
CHANGED
|
File without changes
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { utilities, ElementState } from "@alkimia/lib";
|
|
2
|
+
|
|
3
|
+
import style from "./IconService.scss?inline";
|
|
4
|
+
import htmlTemplate from "./IconService.html?raw";
|
|
5
|
+
|
|
6
|
+
export default function IconService(args){
|
|
7
|
+
|
|
8
|
+
const _params = utilities.transfer(args, {});
|
|
9
|
+
|
|
10
|
+
const instance = Object.create(IconService.prototype);
|
|
11
|
+
|
|
12
|
+
const _customElement = utilities.createAndRegisterWidgetElement("IconService");
|
|
13
|
+
instance.element = new _customElement(style, htmlTemplate);
|
|
14
|
+
|
|
15
|
+
function _onAppended() {
|
|
16
|
+
console.log("_onAppended should be delegated");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let _vParent = null;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @return {IconService}
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
const _initialize = ()=>{
|
|
27
|
+
_initView();
|
|
28
|
+
_registerEvents();
|
|
29
|
+
|
|
30
|
+
return instance;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
function _initView(){
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
instance.isAttached = function(){
|
|
38
|
+
return instance.element.parentNode !== null;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @param {HTMLElement} _parent
|
|
43
|
+
*/
|
|
44
|
+
instance.appendTo = (_parent)=>{
|
|
45
|
+
_parent.appendChild(instance.element);
|
|
46
|
+
_vParent = _parent;
|
|
47
|
+
_onAppended();
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
function _registerEvents(){
|
|
51
|
+
_onAppended = () => {
|
|
52
|
+
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return _initialize();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
* @type {IconService}
|
|
63
|
+
* @private
|
|
64
|
+
*/
|
|
65
|
+
let _instance = null;
|
|
66
|
+
|
|
67
|
+
IconService.getSingleton = function(_args=null) {
|
|
68
|
+
if(!_instance){
|
|
69
|
+
_instance = IconService(_args);
|
|
70
|
+
}
|
|
71
|
+
return _instance;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
IconService.getInstance = function(_args) {
|
|
75
|
+
return IconService(_args);
|
|
76
|
+
};
|
package/src/modulesMaker.js
CHANGED
|
@@ -145,17 +145,19 @@ ${_moduleName}.getInstance = function(_args) {
|
|
|
145
145
|
`;
|
|
146
146
|
},
|
|
147
147
|
playgroundJS: function(moduleName, withDom = false) {
|
|
148
|
+
const lowerCaseModuleName = moduleName[0].toLowerCase() + moduleName.slice(1);
|
|
149
|
+
|
|
148
150
|
return `import ${moduleName} from "../${moduleName}.js";
|
|
149
151
|
${
|
|
150
152
|
withDom
|
|
151
153
|
? /*generate the module with a basic app container to attach to it*/
|
|
152
154
|
`const _vApp = document.createElement("app");
|
|
153
155
|
document.body.appendChild(_vApp);\n
|
|
154
|
-
let ${
|
|
155
|
-
${
|
|
156
|
+
let ${lowerCaseModuleName} = ${moduleName}.getInstance();
|
|
157
|
+
${lowerCaseModuleName}.appendTo(_vApp);`
|
|
156
158
|
: /*without HTML view*/ `
|
|
157
|
-
const ${
|
|
158
|
-
console.debug("${
|
|
159
|
+
const ${lowerCaseModuleName} = ${moduleName}.getInstance();
|
|
160
|
+
console.debug("${lowerCaseModuleName} :", ${lowerCaseModuleName});
|
|
159
161
|
`
|
|
160
162
|
}
|
|
161
163
|
`;
|