slicejs-web-framework 2.3.5 → 2.4.0

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 (84) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +24 -5
  3. package/Slice/Components/Structural/Controller/Controller.js +156 -154
  4. package/Slice/Components/Structural/Debugger/Debugger.css +619 -619
  5. package/Slice/Components/Structural/Debugger/Debugger.html +72 -72
  6. package/Slice/Components/Structural/Logger/Log.js +10 -10
  7. package/Slice/Components/Structural/StylesManager/StylesManager.js +6 -3
  8. package/Slice/Slice.js +111 -51
  9. package/api/index.js +261 -233
  10. package/api/middleware/securityMiddleware.js +252 -252
  11. package/package.json +37 -37
  12. package/sliceConfig.schema.json +4 -0
  13. package/src/App/index.html +22 -22
  14. package/src/App/index.js +23 -23
  15. package/src/App/style.css +40 -40
  16. package/src/Components/AppComponents/HomePage/HomePage.css +204 -204
  17. package/src/Components/AppComponents/HomePage/HomePage.html +48 -48
  18. package/src/Components/AppComponents/HomePage/HomePage.js +195 -195
  19. package/src/Components/AppComponents/Playground/Playground.css +11 -11
  20. package/src/Components/AppComponents/Playground/Playground.js +111 -111
  21. package/src/Components/Service/FetchManager/FetchManager.js +133 -133
  22. package/src/Components/Service/IndexedDbManager/IndexedDbManager.js +141 -141
  23. package/src/Components/Service/LocalStorageManager/LocalStorageManager.js +45 -45
  24. package/src/Components/Visual/Button/Button.css +47 -47
  25. package/src/Components/Visual/Button/Button.html +5 -5
  26. package/src/Components/Visual/Button/Button.js +92 -92
  27. package/src/Components/Visual/Card/Card.css +68 -68
  28. package/src/Components/Visual/Card/Card.html +7 -7
  29. package/src/Components/Visual/Card/Card.js +107 -107
  30. package/src/Components/Visual/Checkbox/Checkbox.css +87 -87
  31. package/src/Components/Visual/Checkbox/Checkbox.html +8 -8
  32. package/src/Components/Visual/Checkbox/Checkbox.js +86 -86
  33. package/src/Components/Visual/CodeVisualizer/CodeVisualizer.css +129 -129
  34. package/src/Components/Visual/CodeVisualizer/CodeVisualizer.html +3 -3
  35. package/src/Components/Visual/CodeVisualizer/CodeVisualizer.js +259 -259
  36. package/src/Components/Visual/Details/Details.css +70 -70
  37. package/src/Components/Visual/Details/Details.html +9 -9
  38. package/src/Components/Visual/Details/Details.js +76 -76
  39. package/src/Components/Visual/DropDown/DropDown.css +60 -60
  40. package/src/Components/Visual/DropDown/DropDown.html +5 -5
  41. package/src/Components/Visual/DropDown/DropDown.js +63 -63
  42. package/src/Components/Visual/Grid/Grid.css +7 -7
  43. package/src/Components/Visual/Grid/Grid.html +1 -1
  44. package/src/Components/Visual/Grid/Grid.js +57 -57
  45. package/src/Components/Visual/Icon/Icon.css +510 -510
  46. package/src/Components/Visual/Icon/Icon.js +89 -89
  47. package/src/Components/Visual/Icon/slc.json +554 -554
  48. package/src/Components/Visual/Icon/slc.styl +507 -507
  49. package/src/Components/Visual/Icon/slc.svg +1485 -1485
  50. package/src/Components/Visual/Icon/slc.symbol.svg +1058 -1058
  51. package/src/Components/Visual/Input/Input.css +91 -91
  52. package/src/Components/Visual/Input/Input.html +4 -4
  53. package/src/Components/Visual/Input/Input.js +215 -215
  54. package/src/Components/Visual/Layout/Layout.js +49 -49
  55. package/src/Components/Visual/Loading/Loading.css +56 -56
  56. package/src/Components/Visual/Loading/Loading.html +83 -83
  57. package/src/Components/Visual/Loading/Loading.js +38 -38
  58. package/src/Components/Visual/MultiRoute/MultiRoute.js +93 -93
  59. package/src/Components/Visual/Navbar/Navbar.css +115 -115
  60. package/src/Components/Visual/Navbar/Navbar.html +44 -44
  61. package/src/Components/Visual/Navbar/Navbar.js +141 -141
  62. package/src/Components/Visual/NotFound/NotFound.css +116 -116
  63. package/src/Components/Visual/NotFound/NotFound.html +23 -23
  64. package/src/Components/Visual/NotFound/NotFound.js +16 -16
  65. package/src/Components/Visual/Route/Route.js +93 -93
  66. package/src/Components/Visual/Select/Select.css +84 -84
  67. package/src/Components/Visual/Select/Select.html +8 -8
  68. package/src/Components/Visual/Select/Select.js +195 -195
  69. package/src/Components/Visual/Switch/Switch.css +76 -76
  70. package/src/Components/Visual/Switch/Switch.html +8 -8
  71. package/src/Components/Visual/Switch/Switch.js +102 -102
  72. package/src/Components/Visual/TreeItem/TreeItem.css +36 -36
  73. package/src/Components/Visual/TreeItem/TreeItem.html +1 -1
  74. package/src/Components/Visual/TreeItem/TreeItem.js +126 -126
  75. package/src/Components/Visual/TreeView/TreeView.css +8 -8
  76. package/src/Components/Visual/TreeView/TreeView.html +1 -1
  77. package/src/Components/Visual/TreeView/TreeView.js +48 -48
  78. package/src/Styles/sliceStyles.css +34 -34
  79. package/src/Themes/Dark.css +42 -42
  80. package/src/Themes/Light.css +31 -31
  81. package/src/Themes/Slice.css +47 -47
  82. package/src/routes.js +15 -15
  83. package/src/sliceConfig.json +8 -3
  84. package/src/testing.js +887 -887
@@ -1,93 +1,93 @@
1
- export default class MultiRoute extends HTMLElement {
2
- constructor(props) {
3
- super();
4
- this.props = props;
5
- this.renderedComponents = new Map(); // Cache para componentes renderizados
6
- }
7
-
8
- init() {
9
- if (!this.props.routes || !Array.isArray(this.props.routes)) {
10
- slice.logger.logError('MultiRoute', 'No valid routes array provided in props.');
11
- return;
12
- }
13
-
14
- /*
15
- this.props.routes.forEach(route => {
16
- if (!route.path || !route.component) {
17
- slice.logger.logError('MultiRoute', 'Route must have a path and a component.');
18
- }
19
-
20
- console.log(route)
21
-
22
- slice.router.verifyDynamicRouteExistence(route)
23
- });
24
-
25
- // verify if the current route is registered in the routes.js file
26
- slice.router.verifyDynamicRouteExistence(this.props.routes)
27
- */
28
- }
29
-
30
- async render() {
31
- const currentPath = window.location.pathname;
32
- const routeMatch = this.props.routes.find((route) => route.path === currentPath);
33
-
34
- if (routeMatch) {
35
- const { component } = routeMatch;
36
-
37
- if (this.renderedComponents.has(component)) {
38
- const cachedComponent = this.renderedComponents.get(component);
39
-
40
- // Aquí nos aseguramos de que el contenido se limpie antes de insertar el componente en caché.
41
- this.innerHTML = '';
42
-
43
- // Si el componente en caché tiene un método update, lo ejecutamos
44
- if (cachedComponent.update) {
45
- await cachedComponent.update();
46
- }
47
-
48
- // Insertamos el componente en caché en el DOM
49
- this.appendChild(cachedComponent);
50
- } else {
51
- if (!slice.controller.componentCategories.has(component)) {
52
- slice.logger.logError(`${this.sliceId}`, `Component ${component} not found`);
53
- return;
54
- }
55
-
56
- // Si el componente no está en caché, lo construimos y lo almacenamos en la caché
57
- const newComponent = await slice.build(component, { sliceId: component });
58
- this.innerHTML = '';
59
- this.appendChild(newComponent);
60
-
61
- // Guardamos el componente recién construido en la caché
62
- this.renderedComponents.set(component, newComponent);
63
- }
64
- } else {
65
- // Limpiamos el contenido si no hay una coincidencia de ruta
66
- this.innerHTML = '';
67
- }
68
- }
69
-
70
- async renderIfCurrentRoute() {
71
- const currentPath = window.location.pathname;
72
- const routeMatch = this.props.routes.find((route) => route.path === currentPath);
73
-
74
- if (routeMatch) {
75
- await this.render(); // Llamamos a render() para manejar el renderizado desde la caché si es necesario
76
- return true;
77
- }
78
- return false;
79
- }
80
-
81
- removeComponent() {
82
- const currentPath = window.location.pathname;
83
- const routeMatch = this.props.routes.find((route) => route.path === currentPath);
84
-
85
- if (routeMatch) {
86
- const { component } = routeMatch;
87
- this.renderedComponents.delete(component);
88
- this.innerHTML = '';
89
- }
90
- }
91
- }
92
-
93
- customElements.define('slice-multi-route', MultiRoute);
1
+ export default class MultiRoute extends HTMLElement {
2
+ constructor(props) {
3
+ super();
4
+ this.props = props;
5
+ this.renderedComponents = new Map(); // Cache para componentes renderizados
6
+ }
7
+
8
+ init() {
9
+ if (!this.props.routes || !Array.isArray(this.props.routes)) {
10
+ slice.logger.logError('MultiRoute', 'No valid routes array provided in props.');
11
+ return;
12
+ }
13
+
14
+ /*
15
+ this.props.routes.forEach(route => {
16
+ if (!route.path || !route.component) {
17
+ slice.logger.logError('MultiRoute', 'Route must have a path and a component.');
18
+ }
19
+
20
+ console.log(route)
21
+
22
+ slice.router.verifyDynamicRouteExistence(route)
23
+ });
24
+
25
+ // verify if the current route is registered in the routes.js file
26
+ slice.router.verifyDynamicRouteExistence(this.props.routes)
27
+ */
28
+ }
29
+
30
+ async render() {
31
+ const currentPath = window.location.pathname;
32
+ const routeMatch = this.props.routes.find((route) => route.path === currentPath);
33
+
34
+ if (routeMatch) {
35
+ const { component } = routeMatch;
36
+
37
+ if (this.renderedComponents.has(component)) {
38
+ const cachedComponent = this.renderedComponents.get(component);
39
+
40
+ // Aquí nos aseguramos de que el contenido se limpie antes de insertar el componente en caché.
41
+ this.innerHTML = '';
42
+
43
+ // Si el componente en caché tiene un método update, lo ejecutamos
44
+ if (cachedComponent.update) {
45
+ await cachedComponent.update();
46
+ }
47
+
48
+ // Insertamos el componente en caché en el DOM
49
+ this.appendChild(cachedComponent);
50
+ } else {
51
+ if (!slice.controller.componentCategories.has(component)) {
52
+ slice.logger.logError(`${this.sliceId}`, `Component ${component} not found`);
53
+ return;
54
+ }
55
+
56
+ // Si el componente no está en caché, lo construimos y lo almacenamos en la caché
57
+ const newComponent = await slice.build(component, { sliceId: component });
58
+ this.innerHTML = '';
59
+ this.appendChild(newComponent);
60
+
61
+ // Guardamos el componente recién construido en la caché
62
+ this.renderedComponents.set(component, newComponent);
63
+ }
64
+ } else {
65
+ // Limpiamos el contenido si no hay una coincidencia de ruta
66
+ this.innerHTML = '';
67
+ }
68
+ }
69
+
70
+ async renderIfCurrentRoute() {
71
+ const currentPath = window.location.pathname;
72
+ const routeMatch = this.props.routes.find((route) => route.path === currentPath);
73
+
74
+ if (routeMatch) {
75
+ await this.render(); // Llamamos a render() para manejar el renderizado desde la caché si es necesario
76
+ return true;
77
+ }
78
+ return false;
79
+ }
80
+
81
+ removeComponent() {
82
+ const currentPath = window.location.pathname;
83
+ const routeMatch = this.props.routes.find((route) => route.path === currentPath);
84
+
85
+ if (routeMatch) {
86
+ const { component } = routeMatch;
87
+ this.renderedComponents.delete(component);
88
+ this.innerHTML = '';
89
+ }
90
+ }
91
+ }
92
+
93
+ customElements.define('slice-multi-route', MultiRoute);
@@ -1,115 +1,115 @@
1
- .slice_nav_header {
2
- font-family: var(--font-family);
3
- width: 100%;
4
- z-index: 1;
5
- box-shadow: 0px 0px 10px #00000050;
6
- background-color: var(--primary-color);
7
- display: flex;
8
- justify-content: space-around;
9
- align-items: center;
10
- }
11
- .direction-row-reverse {
12
- flex-direction: row-reverse;
13
- }
14
- .nav_bar_fixed {
15
- z-index: 100;
16
- width: 100%;
17
- left: 0;
18
- top: 0;
19
- position: fixed;
20
- }
21
- .slice_nav_bar {
22
- transition: transform 0.3s ease;
23
- width: 100%;
24
- justify-content: center;
25
- display: flex;
26
- align-items: center;
27
- left: 0;
28
- top: 0;
29
- }
30
- .nav_bar_menu {
31
- width: 100%;
32
- overflow-y: hidden;
33
- overflow-x: scroll;
34
- display: flex;
35
- align-items: center;
36
- justify-content: center;
37
- list-style: none;
38
- }
39
- .slice_nav_header .item {
40
- cursor: pointer;
41
- font-weight: bold;
42
- text-decoration: none;
43
- color: var(--primary-color-contrast);
44
- border-radius: var(--border-radius-slice);
45
- }
46
- .anim-item {
47
- position: absolute;
48
- top: 100%;
49
- left: 50%;
50
- width: 0%;
51
- height: 2.5px;
52
- border-radius: 5px;
53
- background-color: var(--primary-color-contrast);
54
- transition: width 0.3s ease, left 0.3s ease;
55
- }
56
- .slice_nav_header li {
57
- margin: 25px;
58
- display: flex;
59
- justify-content: center;
60
- position: relative;
61
- }
62
-
63
- .slice_nav_header li:hover .anim-item {
64
- width: 100%;
65
- left: 0;
66
- }
67
- .slice_nav_header .logo_container {
68
- padding: 10px;
69
- }
70
- .logo_container img {
71
- pointer-events: none;
72
- user-select: none;
73
- max-height: 50px;
74
- max-width: 200px;
75
- }
76
- .nav_bar_buttons {
77
- justify-content: flex-end;
78
- display: flex;
79
- }
80
-
81
- .mobile_menu_button,
82
- .mobile_close_menu {
83
- visibility: hidden;
84
- position: absolute;
85
- right: 0px;
86
- margin-right: 25px;
87
- }
88
- .mobile_close_menu {
89
- top: 25px;
90
- }
91
- @media only screen and (max-width: 1020px) {
92
- .slice_nav_bar {
93
- z-index: 1;
94
- list-style: none;
95
- width: 100%;
96
- height: 100%;
97
- position: fixed;
98
- top: 0;
99
- left: 0;
100
- display: flex;
101
- justify-content: center;
102
- align-items: center;
103
- flex-direction: column;
104
- background-color: var(--primary-color);
105
- transform: translateX(100%);
106
- }
107
- .nav_bar_menu,
108
- .nav_bar_buttons {
109
- flex-direction: column;
110
- }
111
- .mobile_menu_button,
112
- .mobile_close_menu {
113
- visibility: visible;
114
- }
115
- }
1
+ .slice_nav_header {
2
+ font-family: var(--font-family);
3
+ width: 100%;
4
+ z-index: 1;
5
+ box-shadow: 0px 0px 10px #00000050;
6
+ background-color: var(--primary-color);
7
+ display: flex;
8
+ justify-content: space-around;
9
+ align-items: center;
10
+ }
11
+ .direction-row-reverse {
12
+ flex-direction: row-reverse;
13
+ }
14
+ .nav_bar_fixed {
15
+ z-index: 100;
16
+ width: 100%;
17
+ left: 0;
18
+ top: 0;
19
+ position: fixed;
20
+ }
21
+ .slice_nav_bar {
22
+ transition: transform 0.3s ease;
23
+ width: 100%;
24
+ justify-content: center;
25
+ display: flex;
26
+ align-items: center;
27
+ left: 0;
28
+ top: 0;
29
+ }
30
+ .nav_bar_menu {
31
+ width: 100%;
32
+ overflow-y: hidden;
33
+ overflow-x: scroll;
34
+ display: flex;
35
+ align-items: center;
36
+ justify-content: center;
37
+ list-style: none;
38
+ }
39
+ .slice_nav_header .item {
40
+ cursor: pointer;
41
+ font-weight: bold;
42
+ text-decoration: none;
43
+ color: var(--primary-color-contrast);
44
+ border-radius: var(--border-radius-slice);
45
+ }
46
+ .anim-item {
47
+ position: absolute;
48
+ top: 100%;
49
+ left: 50%;
50
+ width: 0%;
51
+ height: 2.5px;
52
+ border-radius: 5px;
53
+ background-color: var(--primary-color-contrast);
54
+ transition: width 0.3s ease, left 0.3s ease;
55
+ }
56
+ .slice_nav_header li {
57
+ margin: 25px;
58
+ display: flex;
59
+ justify-content: center;
60
+ position: relative;
61
+ }
62
+
63
+ .slice_nav_header li:hover .anim-item {
64
+ width: 100%;
65
+ left: 0;
66
+ }
67
+ .slice_nav_header .logo_container {
68
+ padding: 10px;
69
+ }
70
+ .logo_container img {
71
+ pointer-events: none;
72
+ user-select: none;
73
+ max-height: 50px;
74
+ max-width: 200px;
75
+ }
76
+ .nav_bar_buttons {
77
+ justify-content: flex-end;
78
+ display: flex;
79
+ }
80
+
81
+ .mobile_menu_button,
82
+ .mobile_close_menu {
83
+ visibility: hidden;
84
+ position: absolute;
85
+ right: 0px;
86
+ margin-right: 25px;
87
+ }
88
+ .mobile_close_menu {
89
+ top: 25px;
90
+ }
91
+ @media only screen and (max-width: 1020px) {
92
+ .slice_nav_bar {
93
+ z-index: 1;
94
+ list-style: none;
95
+ width: 100%;
96
+ height: 100%;
97
+ position: fixed;
98
+ top: 0;
99
+ left: 0;
100
+ display: flex;
101
+ justify-content: center;
102
+ align-items: center;
103
+ flex-direction: column;
104
+ background-color: var(--primary-color);
105
+ transform: translateX(100%);
106
+ }
107
+ .nav_bar_menu,
108
+ .nav_bar_buttons {
109
+ flex-direction: column;
110
+ }
111
+ .mobile_menu_button,
112
+ .mobile_close_menu {
113
+ visibility: visible;
114
+ }
115
+ }
@@ -1,44 +1,44 @@
1
- <header class="slice_nav_header">
2
- <a class="logo_container"></a>
3
- <nav class="slice_nav_bar">
4
- <div class="nav_bar_menu"></div>
5
- <div class="nav_bar_buttons"></div>
6
- <div class="mobile_close_menu">
7
- <svg
8
- class="w-6 h-6 text-gray-800 dark:text-white"
9
- aria-hidden="true"
10
- xmlns="http://www.w3.org/2000/svg"
11
- width="24"
12
- height="24"
13
- fill="none"
14
- viewBox="0 0 24 24"
15
- >
16
- <path
17
- stroke="var(--primary-color-contrast)"
18
- stroke-linecap="round"
19
- stroke-linejoin="round"
20
- stroke-width="2"
21
- d="M6 18 17.94 6M18 18 6.06 6"
22
- />
23
- </svg>
24
- </div>
25
- </nav>
26
- <div class="mobile_menu_button">
27
- <svg
28
- class="w-6 h-6 text-gray-800 dark:text-white"
29
- aria-hidden="true"
30
- xmlns="http://www.w3.org/2000/svg"
31
- width="24"
32
- height="24"
33
- fill="none"
34
- viewBox="0 0 24 24"
35
- >
36
- <path
37
- stroke="var(--primary-color-contrast)"
38
- stroke-linecap="round"
39
- stroke-width="3"
40
- d="M12 6h.01M12 12h.01M12 18h.01"
41
- />
42
- </svg>
43
- </div>
44
- </header>
1
+ <header class="slice_nav_header">
2
+ <a class="logo_container"></a>
3
+ <nav class="slice_nav_bar">
4
+ <div class="nav_bar_menu"></div>
5
+ <div class="nav_bar_buttons"></div>
6
+ <div class="mobile_close_menu">
7
+ <svg
8
+ class="w-6 h-6 text-gray-800 dark:text-white"
9
+ aria-hidden="true"
10
+ xmlns="http://www.w3.org/2000/svg"
11
+ width="24"
12
+ height="24"
13
+ fill="none"
14
+ viewBox="0 0 24 24"
15
+ >
16
+ <path
17
+ stroke="var(--primary-color-contrast)"
18
+ stroke-linecap="round"
19
+ stroke-linejoin="round"
20
+ stroke-width="2"
21
+ d="M6 18 17.94 6M18 18 6.06 6"
22
+ />
23
+ </svg>
24
+ </div>
25
+ </nav>
26
+ <div class="mobile_menu_button">
27
+ <svg
28
+ class="w-6 h-6 text-gray-800 dark:text-white"
29
+ aria-hidden="true"
30
+ xmlns="http://www.w3.org/2000/svg"
31
+ width="24"
32
+ height="24"
33
+ fill="none"
34
+ viewBox="0 0 24 24"
35
+ >
36
+ <path
37
+ stroke="var(--primary-color-contrast)"
38
+ stroke-linecap="round"
39
+ stroke-width="3"
40
+ d="M12 6h.01M12 12h.01M12 18h.01"
41
+ />
42
+ </svg>
43
+ </div>
44
+ </header>