slicejs-web-framework 2.2.10 → 2.2.12

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.
@@ -50,7 +50,16 @@ export default class Controller {
50
50
  }
51
51
 
52
52
  try {
53
- const bundleInfo = this.bundleConfig?.bundles?.routes?.[bundleName];
53
+ let bundleInfo = this.bundleConfig?.bundles?.routes?.[bundleName];
54
+
55
+ if (!bundleInfo && this.bundleConfig?.bundles?.routes) {
56
+ const normalizedName = bundleName?.toLowerCase();
57
+ const matchedKey = Object.keys(this.bundleConfig.bundles.routes)
58
+ .find(key => key.toLowerCase() === normalizedName);
59
+ if (matchedKey) {
60
+ bundleInfo = this.bundleConfig.bundles.routes[matchedKey];
61
+ }
62
+ }
54
63
 
55
64
  if (!bundleInfo) {
56
65
  console.warn(`Bundle ${bundleName} not found in configuration`);
@@ -835,4 +844,4 @@ export default class Controller {
835
844
 
836
845
  return count;
837
846
  }
838
- }
847
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slicejs-web-framework",
3
- "version": "2.2.10",
3
+ "version": "2.2.12",
4
4
  "description": "",
5
5
  "engines": {
6
6
  "node": ">=20"
@@ -1,196 +1,196 @@
1
- export default class HomePage extends HTMLElement {
2
- constructor(props) {
3
- super();
4
- slice.attachTemplate(this);
5
-
6
- this.$examplesContainer = this.querySelector('.examples-container');
7
-
8
- slice.controller.setComponentProps(this, props);
9
- this.debuggerProps = [];
10
- }
11
-
12
- async init() {
13
- // Crear la barra de navegación
14
- const navbar = await slice.build('Navbar', {
15
- position: 'fixed',
16
- logo: {
17
- src: '/images/Slice.js-logo.png',
18
- path: '/',
19
- },
20
- items: [
21
- { text: 'Home', path: '/' },
22
- { text: 'Playground', path: '/Playground' },
23
-
24
- ],
25
- buttons: [
26
- {
27
- value: 'Change Theme',
28
- onClickCallback: async () => {
29
- const currentTheme = slice.stylesManager.themeManager.currentTheme;
30
- if (currentTheme === 'Slice') {
31
- await slice.setTheme('Light');
32
- } else if (currentTheme === 'Light') {
33
- await slice.setTheme('Dark');
34
- } else {
35
- await slice.setTheme('Slice');
36
- }
37
- },
38
- },
39
- ],
40
- });
41
-
42
- // Crear botones para la sección de llamada a la acción
43
- const docsButton = await slice.build('Button', {
44
- value: 'Documentation',
45
- onClickCallback: () => //redirect to https://slice-js-docs.vercel.app/Documentation
46
- window.open('https://slice-js-docs.vercel.app/Documentation', '_blank'),
47
- customColor: {
48
- button: 'var(--primary-color)',
49
- label: 'var(--primary-color-contrast)'
50
- }
51
- });
52
-
53
- const componentsButton = await slice.build('Button', {
54
- value: 'Components Library',
55
- onClickCallback: () => window.open('https://slice-js-docs.vercel.app/Documentation/Visual', '_blank'),
56
- customColor: {
57
- button: 'var(--secondary-color)',
58
- label: 'var(--secondary-color-contrast)'
59
- }
60
- });
61
-
62
- // Añadir botones a la sección CTA
63
- this.querySelector('.cta-buttons').appendChild(docsButton);
64
- this.querySelector('.cta-buttons').appendChild(componentsButton);
65
-
66
- // Crear features section con un enfoque diferente (sin usar Cards)
67
- await this.createFeatures();
68
-
69
- // Crear ejemplos de componentes
70
- await this.createComponentExamples();
71
-
72
- // Configurar la sección de código de inicio
73
- await this.setupGettingStartedSection();
74
-
75
- // Añadir la barra de navegación al inicio del componente
76
- this.insertBefore(navbar, this.firstChild);
77
- }
78
-
79
- async createFeatures() {
80
- // Definir características
81
- const features = [
82
- {
83
- title: 'Component-Based',
84
- description: 'Build your app using modular, reusable components following web standards.'
85
- },
86
- {
87
- title: 'Zero Dependencies',
88
- description: 'Built with vanilla JavaScript. No external libraries required.'
89
- },
90
- {
91
- title: 'Easy Routing',
92
- description: 'Simple and powerful routing system for single page applications.'
93
- },
94
- {
95
- title: 'Theme System',
96
- description: 'Built-in theme support with easy customization through CSS variables.'
97
- },
98
- {
99
- title: 'Developer Tools',
100
- description: 'Integrated debugging and logging for faster development.'
101
- },
102
- {
103
- title: 'Performance Focused',
104
- description: 'Lightweight and optimized for fast loading and execution.'
105
- }
106
- ];
107
-
108
- const featureGrid = this.querySelector('.feature-grid');
109
-
110
- // Crear y añadir cada feature como un elemento HTML simple
111
- for (const feature of features) {
112
- const featureElement = document.createElement('div');
113
- featureElement.classList.add('feature-item');
114
-
115
- const featureTitle = document.createElement('h3');
116
- featureTitle.textContent = feature.title;
117
- featureTitle.classList.add('feature-title');
118
-
119
- const featureDescription = document.createElement('p');
120
- featureDescription.textContent = feature.description;
121
- featureDescription.classList.add('feature-description');
122
-
123
- featureElement.appendChild(featureTitle);
124
- featureElement.appendChild(featureDescription);
125
-
126
- featureGrid.appendChild(featureElement);
127
- }
128
- }
129
-
130
- async createComponentExamples() {
131
- // Crear ejemplos para demostrar componentes
132
- const inputExample = await slice.build('Input', {
133
- placeholder: 'Try typing here...',
134
- type: 'text'
135
- });
136
-
137
- const switchExample = await slice.build('Switch', {
138
- label: 'Toggle me',
139
- checked: true
140
- });
141
-
142
- const checkboxExample = await slice.build('Checkbox', {
143
- label: 'Check me',
144
- labelPlacement: 'right'
145
- });
146
-
147
- const detailsExample = await slice.build('Details', {
148
- title: 'Click to expand',
149
- text: 'This is a collapsible details component that can contain any content.'
150
- });
151
-
152
- // Crear sección para cada ejemplo
153
- const exampleSections = [
154
- { title: 'Input Component', component: inputExample },
155
- { title: 'Switch Component', component: switchExample },
156
- { title: 'Checkbox Component', component: checkboxExample },
157
- { title: 'Details Component', component: detailsExample }
158
- ];
159
-
160
- // Añadir cada ejemplo a la sección de ejemplos
161
- for (const section of exampleSections) {
162
- const container = document.createElement('div');
163
- container.classList.add('example-item');
164
-
165
- const title = document.createElement('h3');
166
- title.textContent = section.title;
167
-
168
- container.appendChild(title);
169
- container.appendChild(section.component);
170
-
171
- this.$examplesContainer.appendChild(container);
172
- }
173
- }
174
-
175
- async setupGettingStartedSection() {
176
- // Opcionalmente podríamos mejorar esta sección usando el CodeVisualizer component
177
- // en lugar del código HTML estático en el template
178
- const codeVisualizer = await slice.build('CodeVisualizer', {
179
- value: `// Initialize a new Slice.js project
180
- npm run slice:init
181
-
182
- // Create a new component
183
- npm run slice:create
184
-
185
- // Start your application
186
- npm run slice:start`,
187
- language: 'bash'
188
- });
189
-
190
- const codeSample = this.querySelector('.code-sample');
191
- codeSample.innerHTML = ''; // Clear the static code sample
192
- codeSample.appendChild(codeVisualizer);
193
- }
194
- }
195
-
1
+ export default class HomePage extends HTMLElement {
2
+ constructor(props) {
3
+ super();
4
+ slice.attachTemplate(this);
5
+
6
+ this.$examplesContainer = this.querySelector('.examples-container');
7
+
8
+ slice.controller.setComponentProps(this, props);
9
+ this.debuggerProps = [];
10
+ }
11
+
12
+ async init() {
13
+ // Crear la barra de navegación
14
+ const navbar = await slice.build('Navbar', {
15
+ position: 'fixed',
16
+ logo: {
17
+ src: '/images/Slice.js-logo.png',
18
+ path: '/',
19
+ },
20
+ items: [
21
+ { text: 'Home', path: '/' },
22
+ { text: 'Playground', path: '/Playground' },
23
+
24
+ ],
25
+ buttons: [
26
+ {
27
+ value: 'Change Theme',
28
+ onClickCallback: async () => {
29
+ const currentTheme = slice.stylesManager.themeManager.currentTheme;
30
+ if (currentTheme === 'Slice') {
31
+ await slice.setTheme('Light');
32
+ } else if (currentTheme === 'Light') {
33
+ await slice.setTheme('Dark');
34
+ } else {
35
+ await slice.setTheme('Slice');
36
+ }
37
+ },
38
+ },
39
+ ],
40
+ });
41
+
42
+ // Crear botones para la sección de llamada a la acción
43
+ const docsButton = await slice.build('Button', {
44
+ value: 'Documentation',
45
+ onClickCallback: () => //redirect to https://slice-js-docs.vercel.app/Documentation
46
+ window.open('https://slice-js-docs.vercel.app/Documentation', '_blank'),
47
+ customColor: {
48
+ button: 'var(--primary-color)',
49
+ label: 'var(--primary-color-contrast)'
50
+ }
51
+ });
52
+
53
+ const componentsButton = await slice.build('Button', {
54
+ value: 'Components Library',
55
+ onClickCallback: () => window.open('https://slice-js-docs.vercel.app/Documentation/Visual', '_blank'),
56
+ customColor: {
57
+ button: 'var(--secondary-color)',
58
+ label: 'var(--secondary-color-contrast)'
59
+ }
60
+ });
61
+
62
+ // Añadir botones a la sección CTA
63
+ this.querySelector('.cta-buttons').appendChild(docsButton);
64
+ this.querySelector('.cta-buttons').appendChild(componentsButton);
65
+
66
+ // Crear features section con un enfoque diferente (sin usar Cards)
67
+ await this.createFeatures();
68
+
69
+ // Crear ejemplos de componentes
70
+ await this.createComponentExamples();
71
+
72
+ // Configurar la sección de código de inicio
73
+ await this.setupGettingStartedSection();
74
+
75
+ // Añadir la barra de navegación al inicio del componente
76
+ this.insertBefore(navbar, this.firstChild);
77
+ }
78
+
79
+ async createFeatures() {
80
+ // Definir características
81
+ const features = [
82
+ {
83
+ title: 'Component-Based',
84
+ description: 'Build your app using modular, reusable components following web standards.'
85
+ },
86
+ {
87
+ title: 'Zero Dependencies',
88
+ description: 'Built with vanilla JavaScript. No external libraries required.'
89
+ },
90
+ {
91
+ title: 'Easy Routing',
92
+ description: 'Simple and powerful routing system for single page applications.'
93
+ },
94
+ {
95
+ title: 'Theme System',
96
+ description: 'Built-in theme support with easy customization through CSS variables.'
97
+ },
98
+ {
99
+ title: 'Developer Tools',
100
+ description: 'Integrated debugging and logging for faster development.'
101
+ },
102
+ {
103
+ title: 'Performance Focused',
104
+ description: 'Lightweight and optimized for fast loading and execution.'
105
+ }
106
+ ];
107
+
108
+ const featureGrid = this.querySelector('.feature-grid');
109
+
110
+ // Crear y añadir cada feature como un elemento HTML simple
111
+ for (const feature of features) {
112
+ const featureElement = document.createElement('div');
113
+ featureElement.classList.add('feature-item');
114
+
115
+ const featureTitle = document.createElement('h3');
116
+ featureTitle.textContent = feature.title;
117
+ featureTitle.classList.add('feature-title');
118
+
119
+ const featureDescription = document.createElement('p');
120
+ featureDescription.textContent = feature.description;
121
+ featureDescription.classList.add('feature-description');
122
+
123
+ featureElement.appendChild(featureTitle);
124
+ featureElement.appendChild(featureDescription);
125
+
126
+ featureGrid.appendChild(featureElement);
127
+ }
128
+ }
129
+
130
+ async createComponentExamples() {
131
+ // Crear ejemplos para demostrar componentes
132
+ const inputExample = await slice.build('Input', {
133
+ placeholder: 'Try typing here...',
134
+ type: 'text'
135
+ });
136
+
137
+ const switchExample = await slice.build('Switch', {
138
+ label: 'Toggle me',
139
+ checked: true
140
+ });
141
+
142
+ const checkboxExample = await slice.build('Checkbox', {
143
+ label: 'Check me',
144
+ labelPlacement: 'right'
145
+ });
146
+
147
+ const detailsExample = await slice.build('Details', {
148
+ title: 'Click to expand',
149
+ text: 'This is a collapsible details component that can contain any content.'
150
+ });
151
+
152
+ // Crear sección para cada ejemplo
153
+ const exampleSections = [
154
+ { title: 'Input Component', component: inputExample },
155
+ { title: 'Switch Component', component: switchExample },
156
+ { title: 'Checkbox Component', component: checkboxExample },
157
+ { title: 'Details Component', component: detailsExample }
158
+ ];
159
+
160
+ // Añadir cada ejemplo a la sección de ejemplos
161
+ for (const section of exampleSections) {
162
+ const container = document.createElement('div');
163
+ container.classList.add('example-item');
164
+
165
+ const title = document.createElement('h3');
166
+ title.textContent = section.title;
167
+
168
+ container.appendChild(title);
169
+ container.appendChild(section.component);
170
+
171
+ this.$examplesContainer.appendChild(container);
172
+ }
173
+ }
174
+
175
+ async setupGettingStartedSection() {
176
+ // Opcionalmente podríamos mejorar esta sección usando el CodeVisualizer component
177
+ // en lugar del código HTML estático en el template
178
+ const codeVisualizer = await slice.build('CodeVisualizer', {
179
+ value: `// Initialize a new Slice.js project
180
+ npm run slice:init
181
+
182
+ // Create a new component
183
+ npm run slice:create
184
+
185
+ // Start your application
186
+ npm run slice:start`,
187
+ language: 'bash'
188
+ });
189
+
190
+ const codeSample = this.querySelector('.code-sample');
191
+ codeSample.innerHTML = ''; // Clear the static code sample
192
+ codeSample.appendChild(codeVisualizer);
193
+ }
194
+ }
195
+
196
196
  customElements.define('slice-home-page', HomePage);
@@ -1,28 +1,28 @@
1
- const components = {
2
- "HomePage": "AppComponents",
3
- "Playground": "AppComponents",
4
- "Button": "Visual",
5
- "Card": "Visual",
6
- "Checkbox": "Visual",
7
- "CodeVisualizer": "Visual",
8
- "Details": "Visual",
9
- "DropDown": "Visual",
10
- "Grid": "Visual",
11
- "Icon": "Visual",
12
- "Input": "Visual",
13
- "Layout": "Visual",
14
- "Loading": "Visual",
15
- "MultiRoute": "Visual",
16
- "Navbar": "Visual",
17
- "NotFound": "Visual",
18
- "Route": "Visual",
19
- "Select": "Visual",
20
- "Switch": "Visual",
21
- "TreeItem": "Visual",
22
- "TreeView": "Visual",
23
- "FetchManager": "Service",
24
- "IndexedDbManager": "Service",
25
- "Link": "Service",
26
- "LocalStorageManager": "Service",
27
- "Translator": "Service"
1
+ const components = {
2
+ "HomePage": "AppComponents",
3
+ "Playground": "AppComponents",
4
+ "Button": "Visual",
5
+ "Card": "Visual",
6
+ "Checkbox": "Visual",
7
+ "CodeVisualizer": "Visual",
8
+ "Details": "Visual",
9
+ "DropDown": "Visual",
10
+ "Grid": "Visual",
11
+ "Icon": "Visual",
12
+ "Input": "Visual",
13
+ "Layout": "Visual",
14
+ "Loading": "Visual",
15
+ "MultiRoute": "Visual",
16
+ "Navbar": "Visual",
17
+ "NotFound": "Visual",
18
+ "Route": "Visual",
19
+ "Select": "Visual",
20
+ "Switch": "Visual",
21
+ "TreeItem": "Visual",
22
+ "TreeView": "Visual",
23
+ "FetchManager": "Service",
24
+ "IndexedDbManager": "Service",
25
+ "Link": "Service",
26
+ "LocalStorageManager": "Service",
27
+ "Translator": "Service"
28
28
  }; export default components;