@alkimia/framework 0.1.3 → 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/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/.grok/settings.json +0 -3
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
|
`;
|
package/.grok/settings.json
DELETED