slicejs-web-framework 1.0.30 → 1.0.32
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/Slice/Components/Structural/Controller/Controller.js +125 -12
- package/Slice/Components/Structural/Debugger/Debugger.css +590 -65
- package/Slice/Components/Structural/Debugger/Debugger.html +72 -9
- package/Slice/Components/Structural/Debugger/Debugger.js +523 -213
- package/Slice/Slice.js +5 -0
- package/package.json +1 -1
- package/src/Components/Visual/Button/Button.js +40 -17
package/Slice/Slice.js
CHANGED
|
@@ -11,6 +11,7 @@ export default class Slice {
|
|
|
11
11
|
this.loggerConfig = sliceConfig.logger;
|
|
12
12
|
this.debuggerConfig = sliceConfig.debugger;
|
|
13
13
|
this.loadingConfig = sliceConfig.loading;
|
|
14
|
+
this.productionConfig = sliceConfig.production;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
async getClass(module) {
|
|
@@ -22,6 +23,10 @@ export default class Slice {
|
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
isProduction(){
|
|
27
|
+
return this.productionConfig.enabled;
|
|
28
|
+
}
|
|
29
|
+
|
|
25
30
|
getComponent(componentSliceId) {
|
|
26
31
|
return this.controller.activeComponents.get(componentSliceId);
|
|
27
32
|
}
|
package/package.json
CHANGED
|
@@ -1,31 +1,48 @@
|
|
|
1
1
|
export default class Button extends HTMLElement {
|
|
2
|
+
|
|
3
|
+
static props = {
|
|
4
|
+
value: {
|
|
5
|
+
type: 'string',
|
|
6
|
+
default: 'Button',
|
|
7
|
+
required: false
|
|
8
|
+
},
|
|
9
|
+
onClickCallback: {
|
|
10
|
+
type: 'function',
|
|
11
|
+
default: null
|
|
12
|
+
},
|
|
13
|
+
customColor: {
|
|
14
|
+
type: 'object',
|
|
15
|
+
default: null
|
|
16
|
+
},
|
|
17
|
+
icon: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
default: null
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
2
23
|
constructor(props) {
|
|
3
24
|
super();
|
|
4
25
|
slice.attachTemplate(this);
|
|
5
26
|
this.$value = this.querySelector('.slice_button_value');
|
|
6
27
|
this.$button = this.querySelector('.slice_button');
|
|
28
|
+
this.$container = this.querySelector('.slice_button_container');
|
|
29
|
+
|
|
7
30
|
if (props.onClickCallback) {
|
|
8
31
|
this.onClickCallback = props.onClickCallback;
|
|
9
|
-
this.
|
|
10
|
-
'click',
|
|
11
|
-
async () => await this.onClickCallback()
|
|
12
|
-
);
|
|
13
|
-
//revisar esta verga por si habria q deletear o no
|
|
32
|
+
this.$container.addEventListener('click', async () => await this.onClickCallback());
|
|
14
33
|
}
|
|
15
34
|
|
|
16
35
|
slice.controller.setComponentProps(this, props);
|
|
17
|
-
this.debuggerProps = ['value', 'onClickCallback', 'customColor'];
|
|
18
36
|
}
|
|
19
37
|
|
|
20
38
|
async init() {
|
|
21
39
|
if (this.icon) {
|
|
22
40
|
this.$icon = await slice.build('Icon', {
|
|
23
41
|
name: this.icon,
|
|
24
|
-
size: '
|
|
25
|
-
color: '
|
|
26
|
-
// iconStyle: this._icon.iconStyle,
|
|
42
|
+
size: '20px',
|
|
43
|
+
color: 'currentColor',
|
|
27
44
|
});
|
|
28
|
-
this.$button.
|
|
45
|
+
this.$button.insertBefore(this.$icon, this.$value);
|
|
29
46
|
}
|
|
30
47
|
}
|
|
31
48
|
|
|
@@ -55,16 +72,22 @@ export default class Button extends HTMLElement {
|
|
|
55
72
|
|
|
56
73
|
set customColor(value) {
|
|
57
74
|
this._customColor = value;
|
|
75
|
+
if (!value) return;
|
|
76
|
+
|
|
77
|
+
// Mantener la misma API: { button: 'color', label: 'color' }
|
|
58
78
|
if (value.button) {
|
|
59
|
-
this.style =
|
|
79
|
+
this.$button.style.backgroundColor = value.button;
|
|
80
|
+
this.$button.style.borderColor = value.button;
|
|
60
81
|
}
|
|
61
82
|
if (value.label) {
|
|
62
|
-
this.$button.style =
|
|
83
|
+
this.$button.style.color = value.label;
|
|
84
|
+
this.$value.style.color = value.label;
|
|
85
|
+
// También aplicar al icono si existe
|
|
86
|
+
if (this.$icon) {
|
|
87
|
+
this.$icon.style.color = value.label;
|
|
88
|
+
}
|
|
63
89
|
}
|
|
64
90
|
}
|
|
65
|
-
|
|
66
|
-
handleButtonClick() {
|
|
67
|
-
this.onClickCallback();
|
|
68
|
-
}
|
|
69
91
|
}
|
|
70
|
-
|
|
92
|
+
|
|
93
|
+
customElements.define('slice-button', Button);
|