slicejs-cli 1.0.54 → 1.0.56

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.
Files changed (85) hide show
  1. package/commands/listComponents/listComponents.js +69 -30
  2. package/package.json +1 -1
  3. package/PROJECT_TEMPLATES/Basic/Slice/Components/Provider/TestProvider/TestProvider.js +0 -0
  4. package/PROJECT_TEMPLATES/Basic/Slice/Components/Service/FetchManager/FetchManager.js +0 -134
  5. package/PROJECT_TEMPLATES/Basic/Slice/Components/Service/IndexedDbManager/IndexedDbManager.js +0 -138
  6. package/PROJECT_TEMPLATES/Basic/Slice/Components/Service/LocalStorageManager/LocalStorageManager.js +0 -45
  7. package/PROJECT_TEMPLATES/Basic/Slice/Components/Service/Translator/Translator.js +0 -59
  8. package/PROJECT_TEMPLATES/Basic/Slice/Components/Service/Translator/messages.json +0 -50
  9. package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Controller/Controller.js +0 -106
  10. package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Debugger/Debugger.css +0 -95
  11. package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Debugger/Debugger.html +0 -10
  12. package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Debugger/Debugger.js +0 -250
  13. package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Logger/Log.js +0 -10
  14. package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Logger/Logger.js +0 -112
  15. package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/StylesManager/CustomStylesManager/CustomStylesManager.js +0 -52
  16. package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/StylesManager/StylesManager.js +0 -42
  17. package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/StylesManager/ThemeManager/ThemeManager.js +0 -25
  18. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Button/Button.css +0 -44
  19. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Button/Button.html +0 -5
  20. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Button/Button.js +0 -39
  21. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Card/Card.css +0 -63
  22. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Card/Card.html +0 -7
  23. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Card/Card.js +0 -110
  24. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Checkbox/Checkbox.css +0 -87
  25. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Checkbox/Checkbox.html +0 -8
  26. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Checkbox/Checkbox.js +0 -87
  27. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/CodeValidator/CodeValidator.css +0 -97
  28. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/CodeValidator/CodeValidator.html +0 -18
  29. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/CodeValidator/CodeValidator.js +0 -86
  30. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/Icon.css +0 -505
  31. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/Icon.html +0 -1
  32. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/Icon.js +0 -95
  33. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.eot +0 -0
  34. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.json +0 -550
  35. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.styl +0 -502
  36. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.svg +0 -1470
  37. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.symbol.svg +0 -1035
  38. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.ttf +0 -0
  39. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.woff +0 -0
  40. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.woff2 +0 -0
  41. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Input/Input.css +0 -87
  42. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Input/Input.html +0 -4
  43. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Input/Input.js +0 -210
  44. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Loading/Loading.css +0 -56
  45. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Loading/Loading.html +0 -83
  46. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Loading/Loading.js +0 -39
  47. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Navbar/Navbar.css +0 -30
  48. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Navbar/Navbar.html +0 -6
  49. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Navbar/Navbar.js +0 -39
  50. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Select/Select.css +0 -91
  51. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Select/Select.html +0 -8
  52. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Select/Select.js +0 -210
  53. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Switch/Switch.css +0 -76
  54. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Switch/Switch.html +0 -8
  55. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Switch/Switch.js +0 -109
  56. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/TestComponent/TestComponent.css +0 -0
  57. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/TestComponent/TestComponent.html +0 -0
  58. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/TestComponent/TestComponent.js +0 -0
  59. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester/Tester.css +0 -34
  60. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester/Tester.html +0 -7
  61. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester/Tester.js +0 -33
  62. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester2/Tester2.css +0 -34
  63. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester2/Tester2.html +0 -43
  64. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester2/Tester2.js +0 -39
  65. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/ToastAlert/ToastAlert.css +0 -110
  66. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/ToastAlert/ToastAlert.html +0 -12
  67. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/ToastAlert/ToastAlert.js +0 -65
  68. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/complexNavbar/complexNavbar.css +0 -163
  69. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/complexNavbar/complexNavbar.html +0 -15
  70. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/complexNavbar/complexNavbar.js +0 -48
  71. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/imageCarousel/img-carousel.css +0 -56
  72. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/imageCarousel/img-carousel.html +0 -6
  73. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/imageCarousel/img-carousel.js +0 -119
  74. package/PROJECT_TEMPLATES/Basic/Slice/Components/components.js +0 -23
  75. package/PROJECT_TEMPLATES/Basic/Slice/Slice.js +0 -194
  76. package/PROJECT_TEMPLATES/Basic/Slice/Styles/Custom/custom.css +0 -23
  77. package/PROJECT_TEMPLATES/Basic/Slice/Styles/sliceStyles.css +0 -10
  78. package/PROJECT_TEMPLATES/Basic/Slice/Themes/Dark.css +0 -38
  79. package/PROJECT_TEMPLATES/Basic/Slice/Themes/Light.css +0 -31
  80. package/PROJECT_TEMPLATES/Basic/Slice/Themes/Slice.css +0 -30
  81. package/PROJECT_TEMPLATES/Basic/Slice/package.json +0 -12
  82. package/PROJECT_TEMPLATES/Basic/Slice/sliceConfig.json +0 -32
  83. package/PROJECT_TEMPLATES/Basic/src/Views/LandingPage/index.html +0 -14
  84. package/PROJECT_TEMPLATES/Basic/src/Views/LandingPage/index.js +0 -395
  85. package/PROJECT_TEMPLATES/Basic/src/Views/LandingPage/style.css +0 -0
@@ -1,194 +0,0 @@
1
- import Logger from "./Components/Structural/Logger/Logger.js";
2
- import Controller from "./Components/Structural/Controller/Controller.js";
3
- import StylesManager from "./Components/Structural/StylesManager/StylesManager.js";
4
- import sliceConfig from "./sliceConfig.json" assert { type: "json" };
5
-
6
- export default class Slice {
7
- constructor() {
8
- this.logger = new Logger();
9
- this.controller = new Controller();
10
- this.stylesManager = new StylesManager();
11
- this.paths = sliceConfig.paths;
12
- }
13
-
14
- async getClass(module) {
15
- try {
16
- const { default: myClass } = await import(module);
17
- return await myClass;
18
- } catch (error) {
19
- this.logger.logError("Slice", `Error loading class ${module}`, error);
20
- }
21
- }
22
-
23
- async build(componentName, props = {}) {
24
- if (!componentName) {
25
- this.logger.logError(
26
- "Slice",
27
- null,
28
- `Component name is required to build a component`
29
- );
30
- return null;
31
- }
32
-
33
- if (!this.controller.componentCategories.has(componentName)) {
34
- this.logger.logError(
35
- "Slice",
36
- null,
37
- `Component ${componentName} not found in components.js file`
38
- );
39
- return null;
40
- }
41
-
42
- let compontentCategory =
43
- this.controller.componentCategories.get(componentName);
44
-
45
- //Pregunta para la posteridad: ¿Deberíamos dejar que el usuario pueda crear componentes de categoría Structural?
46
- //Por ahora no lo permitimos, pero si en el futuro se decide que sí, se debe cambiar el código de abajo para que funcione
47
- //con componentes de categoría Structural
48
-
49
- if (compontentCategory === "Structural") {
50
- this.logger.logError(
51
- "Slice",
52
- null,
53
- `Component ${componentName} is a Structural component and cannot be built`
54
- );
55
- return null;
56
- }
57
-
58
- const isVisual = compontentCategory === "Visual";
59
-
60
- let modulePath = `${this.paths.components}/${compontentCategory}/${componentName}/${componentName}.js`;
61
-
62
- // Load template if not loaded previously and component category is Visual
63
- if (!this.controller.templates.has(componentName) && isVisual) {
64
- try {
65
- const html = await this.controller.fetchText(componentName, "html");
66
- const template = document.createElement("template");
67
- template.innerHTML = html;
68
- this.controller.templates.set(componentName, template);
69
- this.logger.logInfo("Slice", `Template ${componentName} loaded`);
70
- } catch (error) {
71
- console.log(error);
72
- this.logger.logError(
73
- "Slice",
74
- `Error loading template ${componentName}`,
75
- error
76
- );
77
- }
78
- }
79
-
80
- //Load class if not loaded previously
81
- if (!this.controller.classes.has(componentName)) {
82
- try {
83
- const ComponentClass = await this.getClass(modulePath);
84
- this.controller.classes.set(componentName, ComponentClass);
85
- this.logger.logInfo("Slice", `Class ${componentName} loaded`);
86
- } catch (error) {
87
- console.log(error);
88
- this.logger.logError(
89
- "Slice",
90
- `Error loading class ${modulePath}`,
91
- error
92
- );
93
- }
94
- }
95
-
96
- //Load css if not loaded previously and component category is Visual
97
- if (!this.controller.requestedStyles.has(componentName) && isVisual) {
98
- try {
99
- const css = await this.controller.fetchText(componentName, "css");
100
- this.stylesManager.registerComponentStyles(componentName, css);
101
- this.logger.logInfo("Slice", `CSS ${componentName} loaded`);
102
- } catch (error) {
103
- console.log(error);
104
- this.logger.logError(
105
- "Slice",
106
- `Error loading css ${componentName}`,
107
- error
108
- );
109
- }
110
- }
111
-
112
- //Create instance
113
- try {
114
- let componentIds = {};
115
- if (props.id) componentIds.id = props.id;
116
- if (props.sliceId) componentIds.sliceId = props.sliceId;
117
-
118
- delete props.id;
119
- delete props.sliceId;
120
-
121
- const ComponentClass = this.controller.classes.get(componentName);
122
- const componentInstance = new ComponentClass(props);
123
-
124
- if (componentIds.id) componentInstance.id = componentIds.id;
125
- if (componentIds.sliceId)
126
- componentInstance.sliceId = componentIds.sliceId;
127
-
128
- this.stylesManager.handleInstanceStyles(componentInstance, props);
129
-
130
- if (!this.controller.registerComponent(componentInstance)) {
131
- this.logger.logError(
132
- "Slice",
133
- `Error registering instance ${componentName} ${componentInstance.sliceId}`
134
- );
135
- return null;
136
- }
137
-
138
- if (sliceConfig.debugger.enabled && compontentCategory === "Visual") {
139
- this.debugger.attachDebugMode(componentInstance);
140
- }
141
-
142
- //if the component has a method called init, call it
143
- if (componentInstance.init) await componentInstance.init();
144
-
145
- this.logger.logInfo(
146
- "Slice",
147
- `Instance ${componentInstance.sliceId} created`
148
- );
149
- return componentInstance;
150
- } catch (error) {
151
- console.log(error);
152
- this.logger.logError(
153
- "Slice",
154
- `Error creating instance ${componentName}`,
155
- error
156
- );
157
- }
158
- }
159
-
160
- setTheme(themeName) {
161
- this.stylesManager.setTheme(themeName);
162
- }
163
-
164
- attachTemplate(componentInstance) {
165
- this.controller.loadTemplateToComponent(componentInstance);
166
- }
167
- }
168
-
169
- async function init() {
170
- window.slice = new Slice();
171
-
172
- if (sliceConfig.debugger.enabled) {
173
- const DebuggerModule = await window.slice.getClass(
174
- `${sliceConfig.paths.components}/Structural/Debugger/Debugger.js`
175
- );
176
- window.slice.debugger = new DebuggerModule();
177
- await window.slice.debugger.enableDebugMode();
178
- document.body.appendChild(window.slice.debugger);
179
- }
180
-
181
- if (sliceConfig.translator.enabled) {
182
- const translator = await window.slice.build("Translator");
183
- window.slice.translator = translator;
184
- window.slice.logger.logInfo("Slice", "Translator succesfuly enabled");
185
- }
186
-
187
- await window.slice.stylesManager.init();
188
-
189
- await window.slice.stylesManager.setTheme(
190
- sliceConfig.stylesManager.defaultTheme
191
- );
192
- }
193
-
194
- await init();
@@ -1,23 +0,0 @@
1
-
2
-
3
-
4
- slice-tester {
5
-
6
-
7
- &.red{
8
- background-color: red;
9
- }
10
-
11
- &.blue{
12
- background-color: blue;
13
- }
14
-
15
- &.green{
16
- background-color: green;
17
- }
18
-
19
-
20
-
21
-
22
-
23
- }
@@ -1,10 +0,0 @@
1
- @import url("https://fonts.googleapis.com/css2?family=Montserrat&family=Poppins&family=Roboto&display=swap");
2
-
3
- :root {
4
- --font-family: "Roboto", sans-serif;
5
- --border-radius-slice: 5px;
6
- --slice-border: 1px;
7
- }
8
- body {
9
- background-color: var(--primary-background-color);
10
- }
@@ -1,38 +0,0 @@
1
- :root {
2
- --font-primary-color: #fff;
3
-
4
- /** primary **/
5
- --primary-color: #0066ff;
6
- --primary-color-rgb: rgb(0, 102, 255);
7
- --primary-background-color: #000;
8
- --primary-color-contrast: #000;
9
- --primary-color-shade: #222;
10
-
11
- /** secondary **/
12
- --secondary-color: #63ccfd;
13
- --secondary-color-rgb: rgb(99, 204, 253);
14
- --secondary-background-color: #222;
15
- --secondary-color-contrast: #fff;
16
-
17
- /** tertiary **/
18
- --tertiary-background-color: #444;
19
-
20
- /** success **/
21
- --success-color: #00ff40;
22
- --success-contrast: #000;
23
-
24
- /** warning **/
25
- --warning-color: #ffff40;
26
- --warning-contrast: #000;
27
-
28
- /** danger **/
29
- --danger-color: #ff0000;
30
- --danger-contrast: #000;
31
-
32
- /** medium **/
33
- --medium-color: #92949c;
34
- --medium-contrast: #fff;
35
-
36
- /* Disabled color */
37
- --disabled-color: #7f7f7f;
38
- }
@@ -1,31 +0,0 @@
1
- :root {
2
- --font-primary-color: #000;
3
- --font-secondary-color: #474747;
4
- /** primary **/
5
- --primary-color: #0066ff;
6
- --primary-color-rgb: rgb(0, 102, 255);
7
- --primary-background-color: #fff;
8
- --primary-color-contrast: #fff;
9
- --primary-color-shade: #ddd;
10
- /** secondary **/
11
- --secondary-color: #63ccfd;
12
- --secondary-color-rgb: rgb(99, 204, 253);
13
- --secondary-background-color: #ddd;
14
- --secondary-color-contrast: #fff;
15
- /** tertiary **/
16
- --tertiary-background-color: #c4c4c4;
17
- /** success **/
18
- --success-color: #00ff40;
19
- --success-contrast: #fff;
20
- /** warning **/
21
- --warning-color: #ffff40;
22
- --warning-contrast: #000;
23
- /** danger **/
24
- --danger-color: #ff0000;
25
- --danger-contrast: #fff;
26
- /** medium **/
27
- --medium-color: #92949c;
28
- --medium--contrast: #000;
29
-
30
- --disabled-color: #7f7f7f;
31
- }
@@ -1,30 +0,0 @@
1
- :root {
2
- --font-primary-color: #2f1335;
3
- /** primary **/
4
- --primary-color: #8e44ad; /* Morado oscuro */
5
- --primary-color-rgb: rgb(142, 68, 173);
6
- --primary-background-color: #fff;
7
- --primary-color-contrast: #fff;
8
- --primary-color-shade: #ddd;
9
- /** secondary **/
10
- --secondary-color: #9b59b6; /* Morado */
11
- --secondary-color-rgb: rgb(155, 89, 182);
12
- --secondary-background-color: #ddd;
13
- --secondary-color-contrast: #fff;
14
- /** tertiary **/
15
- --tertiary-background-color: #3498db; /* Azul */
16
- /** success **/
17
- --success-color: #27ae60; /* Verde */
18
- --success-contrast: #fff;
19
- /** warning **/
20
- --warning-color: #f39c12; /* Naranja */
21
- --warning-contrast: #000;
22
- /** danger **/
23
- --danger-color: #e74c3c; /* Rojo */
24
- --danger-contrast: #fff;
25
- /** medium **/
26
- --medium-color: #bdc3c7; /* Plata */
27
- --medium--contrast: #000;
28
-
29
- --disabled-color: #7f7f7f;
30
- }
@@ -1,12 +0,0 @@
1
- {
2
- "name": "slice",
3
- "version": "1.0.0",
4
- "description": "Framework with frontend and backend components",
5
- "main": "Slice.js",
6
- "type": "module",
7
- "scripts": {
8
- "test": "echo \"Error: no test specified\" && exit 1"
9
- },
10
- "author": "",
11
- "license": "ISC"
12
- }
@@ -1,32 +0,0 @@
1
- {
2
- "debugger": {
3
- "enabled": true,
4
- "click": "right"
5
- },
6
- "stylesManager": {
7
- "defaultTheme": "Light"
8
- },
9
- "logger": {
10
- "enabled": true,
11
- "showLogs": {
12
- "console": {
13
- "error": true,
14
- "warning": true,
15
- "info": true
16
- },
17
- "toast": {
18
- "error": true,
19
- "warning": true,
20
- "info": true
21
- }
22
- }
23
- },
24
- "translator": {
25
- "enabled": true
26
- },
27
- "paths": {
28
- "components": "./Components",
29
- "themes": "./Themes",
30
- "styles": "./Styles"
31
- }
32
- }
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Document</title>
7
- </head>
8
-
9
- <body>
10
- <script src="/Slice/Slice.js" type="module"></script>
11
- <script src="index.js" type="module"></script>
12
- <div style="width: 300px" id="form"></div>
13
- </body>
14
- </html>