slicejs-web-framework 1.0.19 → 1.0.20

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 (81) hide show
  1. package/Slice/Components/Structural/Debugger/Debugger.js +3 -3
  2. package/Slice/Slice.js +2 -1
  3. package/package.json +1 -1
  4. package/src/Components/AppComponents/HomePage/HomePage.css +203 -0
  5. package/src/Components/AppComponents/HomePage/HomePage.html +49 -0
  6. package/src/Components/AppComponents/HomePage/HomePage.js +196 -0
  7. package/src/Components/AppComponents/Playground/Playground.js +0 -19
  8. package/src/routes.js +2 -88
  9. package/src/sliceConfig.json +0 -3
  10. package/src/Components/AppComponents/ButtonDocumentation/ButtonDocumentation.css +0 -16
  11. package/src/Components/AppComponents/ButtonDocumentation/ButtonDocumentation.html +0 -22
  12. package/src/Components/AppComponents/ButtonDocumentation/ButtonDocumentation.js +0 -102
  13. package/src/Components/AppComponents/CardDocumentation/CardDocumentation.css +0 -15
  14. package/src/Components/AppComponents/CardDocumentation/CardDocumentation.html +0 -38
  15. package/src/Components/AppComponents/CardDocumentation/CardDocumentation.js +0 -113
  16. package/src/Components/AppComponents/CheckboxDocumentation/CheckboxDocumentation.css +0 -21
  17. package/src/Components/AppComponents/CheckboxDocumentation/CheckboxDocumentation.html +0 -35
  18. package/src/Components/AppComponents/CheckboxDocumentation/CheckboxDocumentation.js +0 -103
  19. package/src/Components/AppComponents/CodeVisualizer/CodeVisualizer.css +0 -130
  20. package/src/Components/AppComponents/CodeVisualizer/CodeVisualizer.html +0 -4
  21. package/src/Components/AppComponents/CodeVisualizer/CodeVisualizer.js +0 -263
  22. package/src/Components/AppComponents/Documentation/Documentation.css +0 -0
  23. package/src/Components/AppComponents/Documentation/Documentation.html +0 -30
  24. package/src/Components/AppComponents/Documentation/Documentation.js +0 -75
  25. package/src/Components/AppComponents/DocumentationPage/DocumentationPage.css +0 -62
  26. package/src/Components/AppComponents/DocumentationPage/DocumentationPage.html +0 -0
  27. package/src/Components/AppComponents/DocumentationPage/DocumentationPage.js +0 -283
  28. package/src/Components/AppComponents/InputDocumentation/InputDocumentation.css +0 -41
  29. package/src/Components/AppComponents/InputDocumentation/InputDocumentation.html +0 -95
  30. package/src/Components/AppComponents/InputDocumentation/InputDocumentation.js +0 -315
  31. package/src/Components/AppComponents/Installation/Installation.css +0 -185
  32. package/src/Components/AppComponents/Installation/Installation.html +0 -102
  33. package/src/Components/AppComponents/Installation/Installation.js +0 -61
  34. package/src/Components/AppComponents/LandingMenu/LandingMenu.css +0 -108
  35. package/src/Components/AppComponents/LandingMenu/LandingMenu.html +0 -16
  36. package/src/Components/AppComponents/LandingMenu/LandingMenu.js +0 -33
  37. package/src/Components/AppComponents/LandingPage/LandingPage.css +0 -14
  38. package/src/Components/AppComponents/LandingPage/LandingPage.html +0 -0
  39. package/src/Components/AppComponents/LandingPage/LandingPage.js +0 -53
  40. package/src/Components/AppComponents/MainMenu/MainMenu.css +0 -80
  41. package/src/Components/AppComponents/MainMenu/MainMenu.html +0 -39
  42. package/src/Components/AppComponents/MainMenu/MainMenu.js +0 -42
  43. package/src/Components/AppComponents/MyLayout/MyLayout.css +0 -0
  44. package/src/Components/AppComponents/MyLayout/MyLayout.html +0 -0
  45. package/src/Components/AppComponents/MyLayout/MyLayout.js +0 -13
  46. package/src/Components/AppComponents/MyNavigation/MyNavigation.css +0 -49
  47. package/src/Components/AppComponents/MyNavigation/MyNavigation.html +0 -1
  48. package/src/Components/AppComponents/MyNavigation/MyNavigation.js +0 -60
  49. package/src/Components/AppComponents/RoutingDocumentation/RoutingDocumentation.css +0 -89
  50. package/src/Components/AppComponents/RoutingDocumentation/RoutingDocumentation.html +0 -108
  51. package/src/Components/AppComponents/RoutingDocumentation/RoutingDocumentation.js +0 -177
  52. package/src/Components/AppComponents/ServiceDocumentation/ServiceDocumentation.css +0 -82
  53. package/src/Components/AppComponents/ServiceDocumentation/ServiceDocumentation.html +0 -74
  54. package/src/Components/AppComponents/ServiceDocumentation/ServiceDocumentation.js +0 -416
  55. package/src/Components/AppComponents/SliceStylesDocumentation/SliceStylesDocumentation.css +0 -56
  56. package/src/Components/AppComponents/SliceStylesDocumentation/SliceStylesDocumentation.html +0 -28
  57. package/src/Components/AppComponents/SliceStylesDocumentation/SliceStylesDocumentation.js +0 -134
  58. package/src/Components/AppComponents/SliceTeamCard/SliceTeamCard.css +0 -104
  59. package/src/Components/AppComponents/SliceTeamCard/SliceTeamCard.html +0 -12
  60. package/src/Components/AppComponents/SliceTeamCard/SliceTeamCard.js +0 -74
  61. package/src/Components/AppComponents/StructuralDocumentation/StructuralDocumentation.css +0 -72
  62. package/src/Components/AppComponents/StructuralDocumentation/StructuralDocumentation.html +0 -98
  63. package/src/Components/AppComponents/StructuralDocumentation/StructuralDocumentation.js +0 -219
  64. package/src/Components/AppComponents/SwitchDocumentation/SwitchDocumentation.css +0 -21
  65. package/src/Components/AppComponents/SwitchDocumentation/SwitchDocumentation.html +0 -35
  66. package/src/Components/AppComponents/SwitchDocumentation/SwitchDocumentation.js +0 -103
  67. package/src/Components/AppComponents/TheBuildMethod/TheBuildMethod.css +0 -296
  68. package/src/Components/AppComponents/TheBuildMethod/TheBuildMethod.html +0 -89
  69. package/src/Components/AppComponents/TheBuildMethod/TheBuildMethod.js +0 -86
  70. package/src/Components/AppComponents/TheSliceTeam/TheSliceTeam.css +0 -208
  71. package/src/Components/AppComponents/TheSliceTeam/TheSliceTeam.html +0 -18
  72. package/src/Components/AppComponents/TheSliceTeam/TheSliceTeam.js +0 -111
  73. package/src/Components/AppComponents/ThemesDocumentation/ThemesDocumentation.css +0 -61
  74. package/src/Components/AppComponents/ThemesDocumentation/ThemesDocumentation.html +0 -80
  75. package/src/Components/AppComponents/ThemesDocumentation/ThemesDocumentation.js +0 -149
  76. package/src/Components/AppComponents/VisualDocumentation/VisualDocumentation.css +0 -70
  77. package/src/Components/AppComponents/VisualDocumentation/VisualDocumentation.html +0 -67
  78. package/src/Components/AppComponents/VisualDocumentation/VisualDocumentation.js +0 -193
  79. package/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.css +0 -475
  80. package/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.html +0 -389
  81. package/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.js +0 -95
@@ -1,263 +0,0 @@
1
- export default class CodeVisualizer extends HTMLElement {
2
- constructor(props) {
3
- super();
4
- slice.attachTemplate(this);
5
-
6
- this.$container = this.querySelector('.codevisualizer_container');
7
- this.$code = this.querySelector('.codevisualizer');
8
- this.$copyButton = this.querySelector('.copy-button');
9
-
10
- // Configurar el botón de copiado
11
- this.$copyButton.addEventListener('click', () => this.copyCodeToClipboard());
12
-
13
- slice.controller.setComponentProps(this, props);
14
- this.debuggerProps = ['language', 'value'];
15
- }
16
-
17
- set value(value) {
18
- this._value = value;
19
- }
20
-
21
- get value() {
22
- return this._value;
23
- }
24
-
25
- set language(value) {
26
- this._language = value;
27
- }
28
-
29
- get language() {
30
- return this._language;
31
- }
32
-
33
- init() {
34
- this.visualizeCode();
35
- }
36
-
37
- visualizeCode() {
38
- if (this._value && this._language) {
39
- const highlightedCode = this.highlightCode(this._value, this._language);
40
- this.$code.innerHTML = `<pre><code class="language-${this._language}">${highlightedCode}</code></pre>`;
41
- }
42
- }
43
-
44
- copyCodeToClipboard() {
45
- // Obtenemos el texto sin formato (sin las etiquetas HTML de resaltado)
46
- const textToCopy = this._value;
47
-
48
- // Utilizar el API de clipboard
49
- navigator.clipboard.writeText(textToCopy)
50
- .then(() => {
51
- // Cambiar el texto del botón temporalmente para indicar éxito
52
- this.$copyButton.textContent = '✓ Copiado!';
53
- this.$copyButton.classList.add('copied');
54
-
55
- // Restaurar el texto original después de 1.5 segundos
56
- setTimeout(() => {
57
- this.$copyButton.textContent = 'Copiar';
58
- this.$copyButton.classList.remove('copied');
59
- }, 1500);
60
- })
61
- .catch(err => {
62
- console.error('Error al copiar al portapapeles: ', err);
63
- this.$copyButton.textContent = '❌ Error!';
64
-
65
- setTimeout(() => {
66
- this.$copyButton.textContent = 'Copiar';
67
- }, 1500);
68
- });
69
- }
70
-
71
- highlightCode(code, language) {
72
- // Escape HTML to prevent XSS
73
- const escapedCode = this.escapeHtml(code);
74
-
75
- switch (language.toLowerCase()) {
76
- case 'javascript':
77
- case 'js':
78
- return this.highlightJavaScript(escapedCode);
79
- case 'html':
80
- return this.highlightHtml(escapedCode);
81
- case 'css':
82
- return this.highlightCss(escapedCode);
83
- default:
84
- return escapedCode;
85
- }
86
- }
87
-
88
- escapeHtml(text) {
89
- return text
90
- .replace(/&/g, '&amp;')
91
- .replace(/</g, '&lt;')
92
- .replace(/>/g, '&gt;')
93
- .replace(/"/g, '&quot;')
94
- .replace(/'/g, '&#039;');
95
- }
96
-
97
- highlightJavaScript(code) {
98
- // Este método fue rediseñado por completo para evitar problemas de superposición
99
- let tokenizedCode = code;
100
-
101
- // Creamos una estructura para almacenar todos los tokens y luego reemplazarlos de una sola vez
102
- const tokens = [];
103
-
104
- // Función para generar un ID único para cada token
105
- const generateTokenId = (index) => `__TOKEN_${index}__`;
106
-
107
- // Función para extraer tokens y reemplazarlos con marcadores
108
- const extractTokens = (regex, className) => {
109
- tokenizedCode = tokenizedCode.replace(regex, (match) => {
110
- const tokenId = generateTokenId(tokens.length);
111
- tokens.push({ id: tokenId, content: match, className });
112
- return tokenId;
113
- });
114
- };
115
-
116
- // Extraer los tokens en orden específico para evitar interferencias
117
-
118
- // 1. Primero los comentarios
119
- extractTokens(/\/\/.*$/gm, 'code-comment');
120
- extractTokens(/\/\*[\s\S]*?\*\//g, 'code-comment');
121
-
122
- // 2. Luego las cadenas de texto
123
- extractTokens(/(['"`])(?:\\.|[^\\])*?\1/g, 'code-string');
124
-
125
- // 3. Luego los números
126
- extractTokens(/\b(\d+(?:\.\d+)?)\b/g, 'code-number');
127
-
128
- // 4. Palabras clave
129
- const keywords = [
130
- 'await', 'async', 'break', 'case', 'catch', 'class', 'const', 'continue',
131
- 'debugger', 'default', 'delete', 'do', 'else', 'export', 'extends', 'false',
132
- 'finally', 'for', 'function', 'if', 'import', 'in', 'instanceof', 'new',
133
- 'null', 'return', 'super', 'switch', 'this', 'throw', 'true', 'try',
134
- 'typeof', 'var', 'void', 'while', 'with', 'yield', 'let'
135
- ];
136
- extractTokens(new RegExp(`\\b(${keywords.join('|')})\\b`, 'g'), 'code-keyword');
137
-
138
- // 5. Objetos y métodos integrados
139
- const builtins = [
140
- 'Array', 'Boolean', 'Date', 'Error', 'Function', 'JSON', 'Math',
141
- 'Number', 'Object', 'Promise', 'RegExp', 'String', 'console', 'document',
142
- 'window', 'slice', 'Map', 'Set', 'Symbol', 'setTimeout', 'setInterval'
143
- ];
144
- extractTokens(new RegExp(`\\b(${builtins.join('|')})\\b`, 'g'), 'code-builtin');
145
-
146
- // 6. Métodos y llamadas a funciones (esto debe ir después de extraer las palabras clave)
147
- extractTokens(/(\.)([a-zA-Z_$][\w$]*)\s*(?=\()/g, 'code-method');
148
-
149
- // Reemplazar los tokens con el HTML resaltado
150
- tokens.forEach(token => {
151
- tokenizedCode = tokenizedCode.replace(
152
- token.id,
153
- `<span class="${token.className}">${token.content}</span>`
154
- );
155
- });
156
-
157
- return tokenizedCode;
158
- }
159
-
160
- highlightHtml(code) {
161
- // Utilizamos un enfoque similar al de JavaScript para HTML
162
- let tokenizedCode = code;
163
- const tokens = [];
164
- const generateTokenId = (index) => `__TOKEN_${index}__`;
165
-
166
- const extractTokens = (regex, className) => {
167
- tokenizedCode = tokenizedCode.replace(regex, (match) => {
168
- const tokenId = generateTokenId(tokens.length);
169
- tokens.push({ id: tokenId, content: match, className });
170
- return tokenId;
171
- });
172
- };
173
-
174
- // Extraer tokens HTML en orden
175
-
176
- // 1. Comentarios HTML
177
- extractTokens(/&lt;!--[\s\S]*?--&gt;/g, 'code-comment');
178
-
179
- // 2. Etiquetas HTML
180
- extractTokens(/(&lt;\/?[a-zA-Z0-9-]+)(\s|&gt;)/g, (match, tag, end) => {
181
- const tokenId = generateTokenId(tokens.length);
182
- tokens.push({
183
- id: tokenId,
184
- content: `<span class="code-tag">${tag}</span>${end}`,
185
- className: 'no-class' // Ya incluye su propio elemento span
186
- });
187
- return tokenId;
188
- });
189
-
190
- // 3. Atributos HTML
191
- extractTokens(/\s([a-zA-Z0-9-]+)=(&quot;|&#039;)/g, (match, attr, quote) => {
192
- const tokenId = generateTokenId(tokens.length);
193
- tokens.push({
194
- id: tokenId,
195
- content: ` <span class="code-attribute">${attr}</span>=${quote}`,
196
- className: 'no-class' // Ya incluye su propio elemento span
197
- });
198
- return tokenId;
199
- });
200
-
201
- // Reemplazar los tokens con el HTML resaltado
202
- tokens.forEach(token => {
203
- tokenizedCode = tokenizedCode.replace(
204
- token.id,
205
- token.className === 'no-class' ? token.content : `<span class="${token.className}">${token.content}</span>`
206
- );
207
- });
208
-
209
- return tokenizedCode;
210
- }
211
-
212
- highlightCss(code) {
213
- // Utilizamos el mismo enfoque para CSS
214
- let tokenizedCode = code;
215
- const tokens = [];
216
- const generateTokenId = (index) => `__TOKEN_${index}__`;
217
-
218
- const extractTokens = (regex, className, processor = null) => {
219
- tokenizedCode = tokenizedCode.replace(regex, (match, ...groups) => {
220
- const tokenId = generateTokenId(tokens.length);
221
- const content = processor ? processor(match, ...groups) : match;
222
- tokens.push({ id: tokenId, content, className });
223
- return tokenId;
224
- });
225
- };
226
-
227
- // Comentarios CSS
228
- extractTokens(/\/\*[\s\S]*?\*\//g, 'code-comment');
229
-
230
- // Selectores CSS
231
- extractTokens(/([^\{\}]+)(?=\{)/g, 'code-selector');
232
-
233
- // Propiedad y valor CSS (manipulando la coincidencia para preservar la estructura)
234
- tokenizedCode = tokenizedCode.replace(/(\s*)([a-zA-Z-]+)(\s*):(\s*)([^;\{\}]+)(?=;)/g, (match, space1, prop, space2, space3, value) => {
235
- const propTokenId = generateTokenId(tokens.length);
236
- tokens.push({ id: propTokenId, content: prop, className: 'code-property' });
237
-
238
- const valueTokenId = generateTokenId(tokens.length);
239
- tokens.push({ id: valueTokenId, content: value, className: 'code-value' });
240
-
241
- return `${space1}<span class="code-property">${prop}</span>${space2}:${space3}<span class="code-value">${value}</span>`;
242
- });
243
-
244
- // Colores CSS
245
- extractTokens(/#([a-fA-F0-9]{3,6})\b/g, 'code-color');
246
-
247
- // Reemplazar los tokens restantes
248
- tokens.forEach(token => {
249
- if (token.className !== 'no-replace') {
250
- tokenizedCode = tokenizedCode.replace(
251
- token.id,
252
- `<span class="${token.className}">${token.content}</span>`
253
- );
254
- }
255
- });
256
-
257
- return tokenizedCode;
258
- }
259
- }
260
-
261
- customElements.define('slice-codevisualizer', CodeVisualizer);
262
-
263
-
@@ -1,30 +0,0 @@
1
- <h1>Slice Documentation</h1>
2
- <p>
3
- The Slice Framework is a modular system based on components, designed to simplify web client development. Its architecture allows functionality to be divided into reusable modules, making maintenance and expansion easier.
4
- </p>
5
- <p>
6
- Components are classified into three main categories: <span>Visual</span>, <span>Structural</span>, and <span>Services</span>. Visual components build the user interface, structural components manage the framework’s core infrastructure, and service components handle business logic and integrations.
7
- </p>
8
-
9
- <div class="visualComponents">
10
- <h2>Visual Components</h2>
11
- <p>
12
- These components define the web client interface using custom HTML tags powered by the Web Components API. They encapsulate logic for dynamic styling, UI interactions, and backend communication via HTTP requests.
13
- </p>
14
- </div>
15
-
16
- <div class="structuralComponents">
17
- <h2>Structural Components</h2>
18
- <p>
19
- Structural components provide the core framework infrastructure, managing instances, tracking activities, and optimizing performance. They ensure seamless control over application behavior and debugging.
20
- </p>
21
- </div>
22
-
23
- <div class="serviceComponents">
24
- <h2>Service Components</h2>
25
- <p>
26
- Services encapsulate business logic and facilitate integrations with technologies like HTTP requests, local storage, and IndexedDB. They promote code reusability and simplify application development.
27
- </p>
28
- </div>
29
-
30
- <div class="qna"></div>
@@ -1,75 +0,0 @@
1
- export default class Documentation extends HTMLElement {
2
- constructor(props) {
3
- super();
4
- slice.attachTemplate(this);
5
-
6
- slice.controller.setComponentProps(this, props);
7
- this.debuggerProps = [];
8
- }
9
-
10
- async init() {
11
- const htmlCard = await slice.build('Card', {
12
- title: 'HTML',
13
- text: 'HyperText Markup Language is the most basic building block of the Web. It defines the meaning and structure of web content.',
14
- icon: {
15
- name: 'html',
16
- iconStyle: 'filled',
17
- },
18
- customColor: {
19
- card: '#E36A2F',
20
- icon: 'white',
21
- },
22
- });
23
- const jsCard = await slice.build('Card', {
24
- title: 'JS',
25
- text: 'JavaScript is a lightweight interpreted (or just-in-time compiled) programming language with first-class functions.',
26
- icon: {
27
- name: 'javascript',
28
- iconStyle: 'filled',
29
- },
30
- customColor: {
31
- card: 'gold',
32
- icon: 'white',
33
- },
34
- });
35
- const cssCard = await slice.build('Card', {
36
- title: 'CSS',
37
- text: 'Cascading Style Sheets is a stylesheet language used to describe the presentation of a document written in HTML or XML (including XML dialects such as SVG, MathML or XHTML). CSS describes how elements should be rendered on screen, on paper, in speech, or on other media.',
38
- icon: {
39
- name: 'css',
40
- iconStyle: 'filled',
41
- },
42
- customColor: {
43
- card: '#519ABA',
44
- icon: 'white',
45
- },
46
- });
47
- const grid = await slice.build('Grid', {
48
- columns: 3,
49
- rows: 1,
50
- items: [htmlCard, jsCard, cssCard],
51
- });
52
-
53
- if (window.screen.width <= 770) {
54
- grid.columns = 1;
55
- }
56
-
57
- this.querySelector('.visualComponents').appendChild(grid);
58
-
59
- //Q & A
60
- const buildQuestion = await slice.build('Details', {
61
- title: 'How can i build a component?',
62
- text: "To build a component you need to call the slice.build method with it's required props.",
63
- });
64
- const buildExample = await slice.build('CodeVisualizer', {
65
- value: `const mySliceComponent = await slice.build("MySliceComponentName", props)`,
66
- language: 'javascript',
67
- });
68
-
69
- buildQuestion.addDetail(buildExample);
70
-
71
- this.querySelector('.qna').appendChild(buildQuestion);
72
- }
73
- }
74
-
75
- customElements.define('slice-documentation', Documentation);
@@ -1,62 +0,0 @@
1
- .visualComponents p span {
2
- color: var(--primary-color);
3
- }
4
- :root {
5
- --docs-width: 64%;
6
- }
7
- slice-documentation-page slice-route,
8
- slice-documentation-page slice-multi-route {
9
- display: flex;
10
- justify-content: center;
11
- }
12
-
13
- slice-mainmenu{
14
- position: fixed;
15
- top: 0;
16
- left: 0;
17
- font-family: var(--font-family);
18
- background-color: var(--primary-background-color);
19
- border-right: 1px solid var(--primary-color-shade);
20
- /* box-shadow: 10px 0 10px 0px #00000020; */
21
- display: flex;
22
- align-items: center;
23
- height: 100%;
24
- width: 17%;
25
- transition: transform 0.3s ease, width 0.3s ease;
26
- overflow-x: hidden;
27
- }
28
-
29
- p {
30
- text-align: justify;
31
- }
32
- h1 {
33
- padding-top: 10px;
34
- padding-bottom: 10px;
35
- border-bottom: 1px solid var(--secondary-background-color);
36
- }
37
- h2 {
38
- padding-top: 10px;
39
- }
40
- .grid-container {
41
- overflow-x: auto;
42
- }
43
- @media only screen and (max-width: 770px) {
44
- :root {
45
- --docs-width: 100%;
46
- }
47
- }
48
- * {
49
- font-family: var(--font-family);
50
- }
51
-
52
- slice-multi-route > :first-child {
53
- margin-top: 60px;
54
- color: var(--font-primary-color);
55
- margin-top: 60px;
56
- overflow-y: scroll;
57
- overflow-x: hidden;
58
- width: var(--docs-width);
59
- padding-left: 10px;
60
- padding-right: 10px;
61
- padding-bottom: 25px;
62
- }