slicejs-web-framework 2.3.4 → 2.3.5

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/api/index.js CHANGED
@@ -97,12 +97,6 @@ function bundlesDirectoryExists() {
97
97
  return fs.existsSync(bundleDir) && fs.statSync(bundleDir).isDirectory();
98
98
  }
99
99
 
100
- // Capturar todas las peticiones a bundles para debugging
101
- app.use('/bundles/', (req, res, next) => {
102
- console.log(`🔍 Bundle request: ${req.method} ${req.originalUrl}`);
103
- next();
104
- });
105
-
106
100
  // Middleware personalizado para archivos de bundles con MIME types correctos
107
101
  // ⚠️ DEBE IR ANTES del middleware general para tener prioridad
108
102
  app.use('/bundles/', (req, res, next) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slicejs-web-framework",
3
- "version": "2.3.4",
3
+ "version": "2.3.5",
4
4
  "description": "",
5
5
  "engines": {
6
6
  "node": ">=20"
@@ -0,0 +1,8 @@
1
+ slice-link {
2
+ display: inline-flex;
3
+ }
4
+
5
+ slice-link .slice-link {
6
+ color: inherit;
7
+ text-decoration: none;
8
+ }
@@ -0,0 +1 @@
1
+ <a href="#" class="slice-link" data-route></a>
@@ -0,0 +1,63 @@
1
+ export default class Link extends HTMLElement {
2
+ static props = {
3
+ path: { type: 'string', default: '#' },
4
+ classes: { type: 'string', default: '' },
5
+ text: { type: 'string', default: '' }
6
+ };
7
+
8
+ constructor(props = {}) {
9
+ super();
10
+ slice.attachTemplate(this);
11
+ this.$anchor = this.querySelector('.slice-link');
12
+
13
+ slice.controller.setComponentProps(this, props);
14
+ this.debuggerProps = ['path', 'classes', 'text'];
15
+ }
16
+
17
+ async init() {
18
+ this.updateLink();
19
+ this.addEventListener('click', this.onClick.bind(this));
20
+ }
21
+
22
+ updateLink() {
23
+ if (!this.$anchor) return;
24
+ this.$anchor.setAttribute('href', this.path || '#');
25
+ this.$anchor.textContent = this.text || '';
26
+ this.$anchor.className = `slice-link ${this.classes || ''}`.trim();
27
+ }
28
+
29
+ async onClick(event) {
30
+ event.preventDefault();
31
+ const path = this.path || this.$anchor?.getAttribute('href') || '#';
32
+ slice.router.navigate(path);
33
+ }
34
+
35
+ set path(value) {
36
+ this._path = value;
37
+ this.updateLink();
38
+ }
39
+
40
+ get path() {
41
+ return this._path;
42
+ }
43
+
44
+ set classes(value) {
45
+ this._classes = value;
46
+ this.updateLink();
47
+ }
48
+
49
+ get classes() {
50
+ return this._classes;
51
+ }
52
+
53
+ set text(value) {
54
+ this._text = value;
55
+ this.updateLink();
56
+ }
57
+
58
+ get text() {
59
+ return this._text;
60
+ }
61
+ }
62
+
63
+ customElements.define('slice-link', Link);
@@ -16,12 +16,12 @@ const components = {
16
16
  "Navbar": "Visual",
17
17
  "NotFound": "Visual",
18
18
  "Route": "Visual",
19
+ "Link": "Visual",
19
20
  "Select": "Visual",
20
21
  "Switch": "Visual",
21
22
  "TreeItem": "Visual",
22
23
  "TreeView": "Visual",
23
24
  "FetchManager": "Service",
24
25
  "IndexedDbManager": "Service",
25
- "Link": "Service",
26
26
  "LocalStorageManager": "Service"
27
- }; export default components;
27
+ }; export default components;
@@ -1,60 +1,68 @@
1
- {
2
- "server": {
3
- "port": 3001,
4
- "host": "localhost"
5
- },
6
- "debugger": {
7
- "enabled": false,
8
- "click": "right"
9
- },
10
- "events": {
11
- "enabled": true
12
- },
13
- "context": {
14
- "enabled": true
15
- },
16
- "stylesManager": {
17
- "requestedStyles": ["sliceStyles"]
18
- },
19
- "themeManager": {
20
- "enabled": true,
21
- "defaultTheme": "Slice",
22
- "saveThemeLocally": false,
23
- "useBrowserTheme": false
24
- },
25
- "logger": {
26
- "enabled": true,
27
- "showLogs": {
28
- "console": {
29
- "error": true,
30
- "warning": true,
31
- "info": false
32
- }
33
- }
34
- },
35
- "paths": {
36
- "components": {
37
- "AppComponents": {
38
- "path": "/Components/AppComponents",
39
- "type": "Visual"
40
- },
41
- "Visual": {
42
- "path": "/Components/Visual",
43
- "type": "Visual"
44
- },
45
- "Service": {
46
- "path": "/Components/Service",
47
- "type": "Service"
48
- }
49
- },
50
- "themes": "/Themes",
51
- "styles": "/Styles",
52
- "routesFile": "/routes.js"
53
- },
54
- "router": {
55
- "defaultRoute": "/"
56
- },
57
- "loading": {
58
- "enabled": true
59
- }
60
- }
1
+ {
2
+ "server": {
3
+ "port": 3001,
4
+ "host": "localhost"
5
+ },
6
+ "debugger": {
7
+ "enabled": false,
8
+ "click": "right"
9
+ },
10
+ "events": {
11
+ "enabled": true,
12
+ "ui": {
13
+ "enabled": true,
14
+ "shortcut": "alt+shift+e"
15
+ }
16
+ },
17
+ "context": {
18
+ "enabled": true,
19
+ "ui": {
20
+ "enabled": true,
21
+ "shortcut": "alt+shift+c"
22
+ }
23
+ },
24
+ "stylesManager": {
25
+ "requestedStyles": ["sliceStyles"]
26
+ },
27
+ "themeManager": {
28
+ "enabled": true,
29
+ "defaultTheme": "Slice",
30
+ "saveThemeLocally": false,
31
+ "useBrowserTheme": false
32
+ },
33
+ "logger": {
34
+ "enabled": true,
35
+ "showLogs": {
36
+ "console": {
37
+ "error": true,
38
+ "warning": true,
39
+ "info": false
40
+ }
41
+ }
42
+ },
43
+ "paths": {
44
+ "components": {
45
+ "AppComponents": {
46
+ "path": "/Components/AppComponents",
47
+ "type": "Visual"
48
+ },
49
+ "Visual": {
50
+ "path": "/Components/Visual",
51
+ "type": "Visual"
52
+ },
53
+ "Service": {
54
+ "path": "/Components/Service",
55
+ "type": "Service"
56
+ }
57
+ },
58
+ "themes": "/Themes",
59
+ "styles": "/Styles",
60
+ "routesFile": "/routes.js"
61
+ },
62
+ "router": {
63
+ "defaultRoute": "/"
64
+ },
65
+ "loading": {
66
+ "enabled": true
67
+ }
68
+ }
@@ -1,26 +0,0 @@
1
- export default class Link extends HTMLElement {
2
- constructor(props = {}) {
3
- super();
4
- this.props = props;
5
- this.innerHTML = this.getTemplate(props);
6
- this.init();
7
- }
8
-
9
- init() {
10
- this.addEventListener('click', this.onClick);
11
- }
12
-
13
- async onClick(event) {
14
- event.preventDefault();
15
- const path = this.querySelector('a').getAttribute('href');
16
- const routeTargets = document.querySelectorAll('slice-routetarget');
17
- slice.router.navigate(path);
18
- }
19
-
20
- getTemplate(props = {}) {
21
- const { path = '#', classes = '', text = '' } = props;
22
- return `<a href="${path}" class="${classes}" data-route>${text}</a>`;
23
- }
24
- }
25
-
26
- customElements.define('slice-link', Link);