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 +0 -6
- package/package.json +1 -1
- package/src/Components/Visual/Link/Link.css +8 -0
- package/src/Components/Visual/Link/Link.html +1 -0
- package/src/Components/Visual/Link/Link.js +63 -0
- package/src/Components/components.js +2 -2
- package/src/sliceConfig.json +68 -60
- package/src/Components/Service/Link/Link.js +0 -26
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
|
@@ -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;
|
package/src/sliceConfig.json
CHANGED
|
@@ -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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
"path": "/Components/
|
|
47
|
-
"type": "
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"
|
|
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);
|