slicejs-cli 1.0.53 → 1.0.55
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/commands/createComponent/createComponent.js +7 -4
- package/commands/listComponents/listComponents.js +63 -30
- package/package.json +1 -1
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Provider/TestProvider/TestProvider.js +0 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Service/FetchManager/FetchManager.js +0 -134
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Service/IndexedDbManager/IndexedDbManager.js +0 -138
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Service/LocalStorageManager/LocalStorageManager.js +0 -45
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Service/Translator/Translator.js +0 -59
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Service/Translator/messages.json +0 -50
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Controller/Controller.js +0 -106
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Debugger/Debugger.css +0 -95
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Debugger/Debugger.html +0 -10
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Debugger/Debugger.js +0 -250
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Logger/Log.js +0 -10
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Logger/Logger.js +0 -112
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/StylesManager/CustomStylesManager/CustomStylesManager.js +0 -52
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/StylesManager/StylesManager.js +0 -42
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/StylesManager/ThemeManager/ThemeManager.js +0 -25
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Button/Button.css +0 -44
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Button/Button.html +0 -5
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Button/Button.js +0 -39
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Card/Card.css +0 -63
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Card/Card.html +0 -7
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Card/Card.js +0 -110
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Checkbox/Checkbox.css +0 -87
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Checkbox/Checkbox.html +0 -8
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Checkbox/Checkbox.js +0 -87
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/CodeValidator/CodeValidator.css +0 -97
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/CodeValidator/CodeValidator.html +0 -18
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/CodeValidator/CodeValidator.js +0 -86
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/Icon.css +0 -505
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/Icon.html +0 -1
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/Icon.js +0 -95
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.eot +0 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.json +0 -550
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.styl +0 -502
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.svg +0 -1470
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.symbol.svg +0 -1035
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.ttf +0 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.woff +0 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.woff2 +0 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Input/Input.css +0 -87
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Input/Input.html +0 -4
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Input/Input.js +0 -210
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Loading/Loading.css +0 -56
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Loading/Loading.html +0 -83
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Loading/Loading.js +0 -39
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Navbar/Navbar.css +0 -30
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Navbar/Navbar.html +0 -6
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Navbar/Navbar.js +0 -39
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Select/Select.css +0 -91
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Select/Select.html +0 -8
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Select/Select.js +0 -210
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Switch/Switch.css +0 -76
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Switch/Switch.html +0 -8
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Switch/Switch.js +0 -109
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/TestComponent/TestComponent.css +0 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/TestComponent/TestComponent.html +0 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/TestComponent/TestComponent.js +0 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester/Tester.css +0 -34
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester/Tester.html +0 -7
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester/Tester.js +0 -33
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester2/Tester2.css +0 -34
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester2/Tester2.html +0 -43
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester2/Tester2.js +0 -39
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/ToastAlert/ToastAlert.css +0 -110
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/ToastAlert/ToastAlert.html +0 -12
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/ToastAlert/ToastAlert.js +0 -65
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/complexNavbar/complexNavbar.css +0 -163
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/complexNavbar/complexNavbar.html +0 -15
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/complexNavbar/complexNavbar.js +0 -48
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/imageCarousel/img-carousel.css +0 -56
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/imageCarousel/img-carousel.html +0 -6
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/imageCarousel/img-carousel.js +0 -119
- package/PROJECT_TEMPLATES/Basic/Slice/Components/components.js +0 -23
- package/PROJECT_TEMPLATES/Basic/Slice/Slice.js +0 -194
- package/PROJECT_TEMPLATES/Basic/Slice/Styles/Custom/custom.css +0 -23
- package/PROJECT_TEMPLATES/Basic/Slice/Styles/sliceStyles.css +0 -10
- package/PROJECT_TEMPLATES/Basic/Slice/Themes/Dark.css +0 -38
- package/PROJECT_TEMPLATES/Basic/Slice/Themes/Light.css +0 -31
- package/PROJECT_TEMPLATES/Basic/Slice/Themes/Slice.css +0 -30
- package/PROJECT_TEMPLATES/Basic/Slice/package.json +0 -12
- package/PROJECT_TEMPLATES/Basic/Slice/sliceConfig.json +0 -32
- package/PROJECT_TEMPLATES/Basic/src/Views/LandingPage/index.html +0 -14
- package/PROJECT_TEMPLATES/Basic/src/Views/LandingPage/index.js +0 -395
- package/PROJECT_TEMPLATES/Basic/src/Views/LandingPage/style.css +0 -0
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
.slice_dropdown {
|
|
2
|
-
font-family: var(--font-family);
|
|
3
|
-
max-width: 100%;
|
|
4
|
-
margin-bottom: 25px;
|
|
5
|
-
margin-top: 25px;
|
|
6
|
-
position: relative;
|
|
7
|
-
}
|
|
8
|
-
.slice_select_container {
|
|
9
|
-
cursor: pointer;
|
|
10
|
-
display: flex;
|
|
11
|
-
padding: 10px;
|
|
12
|
-
border-radius: var(--border-radius-slice);
|
|
13
|
-
border: var(--slice-border) solid var(--primary-color);
|
|
14
|
-
background-color: var(--primary-background-color);
|
|
15
|
-
justify-content: space-between;
|
|
16
|
-
align-items: center;
|
|
17
|
-
}
|
|
18
|
-
.slice_select {
|
|
19
|
-
pointer-events: none;
|
|
20
|
-
color: var(--font-primary-color);
|
|
21
|
-
width: 100%;
|
|
22
|
-
background: none;
|
|
23
|
-
outline: none;
|
|
24
|
-
border: none;
|
|
25
|
-
}
|
|
26
|
-
.slice_select_label {
|
|
27
|
-
color: var(--primary-color);
|
|
28
|
-
position: absolute;
|
|
29
|
-
transition: all 0.5s;
|
|
30
|
-
user-select: none;
|
|
31
|
-
}
|
|
32
|
-
.slice_select_value {
|
|
33
|
-
scale: 0.8;
|
|
34
|
-
transform: translateY(-200%);
|
|
35
|
-
transition: all 0.5s;
|
|
36
|
-
}
|
|
37
|
-
.slice_menu {
|
|
38
|
-
border: var(--slice-border) solid var(--primary-color);
|
|
39
|
-
list-style: none;
|
|
40
|
-
font-family: var(--font-family);
|
|
41
|
-
visibility: hidden;
|
|
42
|
-
overflow: hidden;
|
|
43
|
-
position: absolute;
|
|
44
|
-
opacity: 0;
|
|
45
|
-
transition: 0s, opacity 0.3s;
|
|
46
|
-
top: 100%;
|
|
47
|
-
width: 100%;
|
|
48
|
-
z-index: 1;
|
|
49
|
-
background-color: var(--primary-background-color);
|
|
50
|
-
border-radius: var(--border-radius-slice);
|
|
51
|
-
box-shadow: 0 0 10px 0 #00000050;
|
|
52
|
-
div {
|
|
53
|
-
color: var(--font-primary-color);
|
|
54
|
-
cursor: pointer;
|
|
55
|
-
padding: 10px;
|
|
56
|
-
&:hover {
|
|
57
|
-
color: var(--secondary-color-contrast);
|
|
58
|
-
background-color: var(--secondary-color);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
.menu_open {
|
|
63
|
-
overflow-y: scroll;
|
|
64
|
-
min-height: min-content;
|
|
65
|
-
max-height: 200px;
|
|
66
|
-
visibility: visible;
|
|
67
|
-
opacity: 1;
|
|
68
|
-
}
|
|
69
|
-
.menu_open::-webkit-scrollbar {
|
|
70
|
-
width: 5px;
|
|
71
|
-
}
|
|
72
|
-
.menu_open::-webkit-scrollbar-thumb {
|
|
73
|
-
background: var(--secondary-color);
|
|
74
|
-
border-radius: var(--border-radius-slice);
|
|
75
|
-
}
|
|
76
|
-
.active {
|
|
77
|
-
/* color: var(--primary-color); */
|
|
78
|
-
background-color: var(--secondary-background-color);
|
|
79
|
-
}
|
|
80
|
-
.caret {
|
|
81
|
-
margin-left: 10px;
|
|
82
|
-
width: 0;
|
|
83
|
-
height: 0;
|
|
84
|
-
border-left: 5px solid transparent;
|
|
85
|
-
border-right: 5px solid transparent;
|
|
86
|
-
border-top: 6px solid var(--primary-color-rgb);
|
|
87
|
-
transition: 0.3s;
|
|
88
|
-
}
|
|
89
|
-
.caret_open {
|
|
90
|
-
transform: rotate(180deg);
|
|
91
|
-
}
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
export default class Select extends HTMLElement {
|
|
2
|
-
constructor(props) {
|
|
3
|
-
super();
|
|
4
|
-
slice.attachTemplate(this);
|
|
5
|
-
this.$dropdown = this.querySelector(".slice_dropdown");
|
|
6
|
-
this.$selectContainer = this.querySelector(".slice_select_container");
|
|
7
|
-
this.$label = this.querySelector(".slice_select_label");
|
|
8
|
-
this.$select = this.querySelector(".slice_select");
|
|
9
|
-
this.$menu = this.querySelector(".slice_menu");
|
|
10
|
-
this.$caret = this.querySelector(".caret");
|
|
11
|
-
|
|
12
|
-
this.$selectContainer.addEventListener("click", () => {
|
|
13
|
-
this.$menu.classList.toggle("menu_open");
|
|
14
|
-
this.$caret.classList.toggle("caret_open");
|
|
15
|
-
});
|
|
16
|
-
this.$dropdown.addEventListener("mouseleave", () => {
|
|
17
|
-
this.$menu.classList.remove("menu_open");
|
|
18
|
-
this.$caret.classList.remove("caret_open");
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
if (props.visibleProp) {
|
|
22
|
-
this.visibleProp = props.visibleProp;
|
|
23
|
-
}
|
|
24
|
-
this._value = [];
|
|
25
|
-
|
|
26
|
-
if (props.onOptionSelect) {
|
|
27
|
-
this.onOptionSelect = props.onOptionSelect;
|
|
28
|
-
}
|
|
29
|
-
slice.controller.setComponentProps(this, props);
|
|
30
|
-
this.debuggerProps = [
|
|
31
|
-
"options",
|
|
32
|
-
"disabled",
|
|
33
|
-
"label",
|
|
34
|
-
"multiple",
|
|
35
|
-
"visibleProp",
|
|
36
|
-
];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
init() {
|
|
40
|
-
if(!this.disabled){
|
|
41
|
-
this._disabled=false;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if(!this._multiple){
|
|
45
|
-
this._multiple=false;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
get options() {
|
|
50
|
-
return this._options;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
removeOptionFromValue(option) {
|
|
54
|
-
const optionIndex = this.isObjectInArray(option, this._value).index;
|
|
55
|
-
if (optionIndex !== -1) {
|
|
56
|
-
this._value.splice(optionIndex, 1);
|
|
57
|
-
// Actualizar la representación visual en el elemento select
|
|
58
|
-
this.updateSelectLabel();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (this._value.length === 0) {
|
|
62
|
-
this.$label.classList.remove("slice_select_value");
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
updateSelectLabel() {
|
|
67
|
-
// Limpiar el contenido actual del elemento select
|
|
68
|
-
this.$select.value = "";
|
|
69
|
-
|
|
70
|
-
// Volver a agregar los valores seleccionados
|
|
71
|
-
if (this._value.length > 0) {
|
|
72
|
-
this.$select.value = this._value
|
|
73
|
-
.map((option) => option[this.visibleProp])
|
|
74
|
-
.join(", ");
|
|
75
|
-
this.$label.classList.add("slice_select_value");
|
|
76
|
-
} else {
|
|
77
|
-
this.$label.classList.remove("slice_select_value");
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
addSelectedOption(option) {
|
|
82
|
-
this._value.push(option);
|
|
83
|
-
this.updateSelectLabel();
|
|
84
|
-
this.$label.classList.add("slice_select_value");
|
|
85
|
-
if (!this.multiple) {
|
|
86
|
-
this.$menu.classList.remove("menu_open");
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
set options(values) {
|
|
91
|
-
this._options = values;
|
|
92
|
-
values.forEach((option) => {
|
|
93
|
-
const opt = document.createElement("div");
|
|
94
|
-
opt.textContent = option[this.visibleProp];
|
|
95
|
-
opt.addEventListener("click", () => {
|
|
96
|
-
if (this.$menu.querySelector(".active") && !this.multiple) {
|
|
97
|
-
this.$menu.querySelector(".active").classList.remove("active");
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (this._value.length === 1 && !this.multiple) {
|
|
101
|
-
this.removeOptionFromValue(this._value[0]);
|
|
102
|
-
this.addSelectedOption(option);
|
|
103
|
-
if (this.onOptionSelect) this.onOptionSelect();
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (this.isObjectInArray(option, this._value).found) {
|
|
108
|
-
this.removeOptionFromValue(option);
|
|
109
|
-
opt.classList.remove("active");
|
|
110
|
-
} else {
|
|
111
|
-
this.addSelectedOption(option);
|
|
112
|
-
opt.classList.add("active");
|
|
113
|
-
}
|
|
114
|
-
if (this.onOptionSelect) this.onOptionSelect();
|
|
115
|
-
});
|
|
116
|
-
this.$menu.appendChild(opt);
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
get value() {
|
|
121
|
-
if (this._value.length === 1) {
|
|
122
|
-
return this._value[0];
|
|
123
|
-
}
|
|
124
|
-
return this._value;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
set value(valueParam) {
|
|
128
|
-
this._value = [];
|
|
129
|
-
|
|
130
|
-
console.log(valueParam);
|
|
131
|
-
if (valueParam.length > 1 && !this.multiple) {
|
|
132
|
-
return console.error(
|
|
133
|
-
"Select is not multiple, you can only select one option"
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
const validOptions = valueParam.every(
|
|
138
|
-
(option) => this.isObjectInArray(option, this._options).found
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
if (!validOptions) {
|
|
142
|
-
console.error(
|
|
143
|
-
"Error: Al menos una de las opciones proporcionadas no está en this.options."
|
|
144
|
-
);
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Agregar las opciones a _value
|
|
149
|
-
this.$label.classList.add("slice_select_value");
|
|
150
|
-
valueParam.forEach((option) => this.addSelectedOption(option));
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
get label() {
|
|
154
|
-
return this._label;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
set label(value) {
|
|
158
|
-
this._label = value;
|
|
159
|
-
this.$label.textContent = value;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
get multiple() {
|
|
163
|
-
return this._multiple;
|
|
164
|
-
}
|
|
165
|
-
set multiple(value) {
|
|
166
|
-
this._multiple = value;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
get disabled() {
|
|
170
|
-
return this._disabled;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
set disabled(value) {
|
|
174
|
-
this._disabled = value;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
isObjectInArray(objeto, arreglo) {
|
|
178
|
-
for (let i = 0; i < arreglo.length; i++) {
|
|
179
|
-
if (this.sameObject(arreglo[i], objeto)) {
|
|
180
|
-
return { found: true, index: i };
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
return { found: false, index: -1 };
|
|
184
|
-
}
|
|
185
|
-
sameObject(objetoA, objetoB) {
|
|
186
|
-
const keysA = Object.keys(objetoA);
|
|
187
|
-
const keysB = Object.keys(objetoB);
|
|
188
|
-
|
|
189
|
-
if (keysA.length !== keysB.length) {
|
|
190
|
-
return false;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
for (const key of keysA) {
|
|
194
|
-
const valueA = objetoA[key];
|
|
195
|
-
const valueB = objetoB[key];
|
|
196
|
-
|
|
197
|
-
if (typeof valueA === "object" && typeof valueB === "object") {
|
|
198
|
-
if (!this.sameObject(valueA, valueB)) {
|
|
199
|
-
return false;
|
|
200
|
-
}
|
|
201
|
-
} else if (valueA !== valueB) {
|
|
202
|
-
return false;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
return true;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
customElements.define("slice-select", Select);
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
.slice_switch {
|
|
2
|
-
--button-width: calc(var(--button-height) * 2);
|
|
3
|
-
--button-height: 1.8em;
|
|
4
|
-
--toggle-diameter: calc(var(--button-width) / 3);
|
|
5
|
-
--button-toggle-offset: calc(
|
|
6
|
-
(var(--button-height) - var(--toggle-diameter)) / 2
|
|
7
|
-
);
|
|
8
|
-
--toggle-shadow-offset: 10px;
|
|
9
|
-
--toggle-wider: 1.8em;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.slice_switch_container {
|
|
13
|
-
width: fit-content;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.slice_switch {
|
|
17
|
-
display: flex;
|
|
18
|
-
flex-direction: row;
|
|
19
|
-
align-items: center;
|
|
20
|
-
user-select: none;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.switch_label {
|
|
24
|
-
margin: 5px;
|
|
25
|
-
font-family: var(--font-family);
|
|
26
|
-
color: var(--font-primary-color);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.slider {
|
|
30
|
-
cursor: pointer;
|
|
31
|
-
display: inline-block;
|
|
32
|
-
width: var(--button-width);
|
|
33
|
-
height: var(--button-height);
|
|
34
|
-
background-color: var(--secondary-background-color);
|
|
35
|
-
border: var(--slice-border) solid var(--primary-color);
|
|
36
|
-
border-radius: calc(var(--button-height) / 2);
|
|
37
|
-
position: relative;
|
|
38
|
-
transition: 0.3s all ease-in-out;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.slider::after {
|
|
42
|
-
content: "";
|
|
43
|
-
display: inline-block;
|
|
44
|
-
width: var(--toggle-diameter);
|
|
45
|
-
height: var(--toggle-diameter);
|
|
46
|
-
background-color: #fff;
|
|
47
|
-
border-radius: calc(var(--toggle-diameter) / 2);
|
|
48
|
-
position: absolute;
|
|
49
|
-
top: var(--button-toggle-offset);
|
|
50
|
-
transform: translateX(var(--button-toggle-offset));
|
|
51
|
-
transition: 0.3s all ease-in-out;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.slice_switch input[type="checkbox"]:checked + .slider {
|
|
55
|
-
background-color: var(--success-color);
|
|
56
|
-
border: var(--slice-border) solid var(--success-color);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.slice_switch input[type="checkbox"]:checked + .slider::after {
|
|
60
|
-
transform: translateX(
|
|
61
|
-
calc(
|
|
62
|
-
var(--button-width) - var(--toggle-diameter) - var(--button-toggle-offset)
|
|
63
|
-
)
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.slice_switch input[type="checkbox"] {
|
|
68
|
-
display: none;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.disabled {
|
|
72
|
-
border-color: var(--disabled-color);
|
|
73
|
-
background-color: var(--primary-color-shade);
|
|
74
|
-
color: var(--disabled-color);
|
|
75
|
-
cursor: not-allowed;
|
|
76
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
export default class Switch extends HTMLElement {
|
|
2
|
-
constructor(props) {
|
|
3
|
-
super();
|
|
4
|
-
slice.attachTemplate(this);
|
|
5
|
-
this.$switch = this.querySelector(".slice_switch");
|
|
6
|
-
this.$checkbox = this.querySelector("input");
|
|
7
|
-
this.toggle = props.toggle;
|
|
8
|
-
if (this.toggle) {
|
|
9
|
-
this.$checkbox.addEventListener("click", () => this.toggle());
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
slice.controller.setComponentProps(this, props);
|
|
13
|
-
this.debuggerProps = [
|
|
14
|
-
"checked",
|
|
15
|
-
"disabled",
|
|
16
|
-
"label",
|
|
17
|
-
"customColor",
|
|
18
|
-
"position",
|
|
19
|
-
];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
init() {
|
|
23
|
-
if (this._checked === undefined) {
|
|
24
|
-
this.checked = false;
|
|
25
|
-
}
|
|
26
|
-
if (this.position === undefined) {
|
|
27
|
-
this.position = "right";
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if(!this.disabled){
|
|
31
|
-
this._disabled=false;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
this.querySelector("input").addEventListener("change", (e) => {
|
|
35
|
-
this.checked = e.target.checked;
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
get checked() {
|
|
40
|
-
return this._checked;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
set checked(value) {
|
|
44
|
-
this._checked = value;
|
|
45
|
-
this.$checkbox.checked = value;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
get label() {
|
|
49
|
-
return this._label;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
set label(value) {
|
|
53
|
-
this._label = value;
|
|
54
|
-
if (this.querySelector(".switch_label")) {
|
|
55
|
-
this.querySelector(".switch_label").textContent = value;
|
|
56
|
-
} else {
|
|
57
|
-
const label = document.createElement("label");
|
|
58
|
-
label.classList.add("switch_label");
|
|
59
|
-
label.textContent = value;
|
|
60
|
-
this.$switch.appendChild(label);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
get customColor() {
|
|
65
|
-
return this._customColor;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
set customColor(value) {
|
|
69
|
-
this._customColor = value;
|
|
70
|
-
this.style = `--success-color: ${value};`;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
get position() {
|
|
74
|
-
return this._position;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
set position(value) {
|
|
78
|
-
if (value === "left") {
|
|
79
|
-
this.$switch.style = ` flex-direction: row-reverse;`;
|
|
80
|
-
}
|
|
81
|
-
if (value === "right") {
|
|
82
|
-
this.$switch.style = `flex-direction: row;`;
|
|
83
|
-
}
|
|
84
|
-
if (value === "top") {
|
|
85
|
-
this.$switch.style = `flex-direction: column-reverse;`;
|
|
86
|
-
}
|
|
87
|
-
if (value === "bottom") {
|
|
88
|
-
this.$switch.style = `flex-direction: column;`;
|
|
89
|
-
}
|
|
90
|
-
this._position = value;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
get disabled() {
|
|
94
|
-
return this._disabled;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
set disabled(value) {
|
|
98
|
-
this._disabled = value;
|
|
99
|
-
this.$checkbox.disabled = value;
|
|
100
|
-
if(value===true){
|
|
101
|
-
this.querySelector(".slider").classList.add("disabled");
|
|
102
|
-
}else{
|
|
103
|
-
this.querySelector(".slider").classList.remove("disabled");
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
customElements.define("slice-switch", Switch);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
width: 90%;
|
|
3
|
-
margin: 50px auto;
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-wrap: wrap;
|
|
6
|
-
justify-content: space-between;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.slice-tester {
|
|
10
|
-
border: 2px solid #3498db;
|
|
11
|
-
border-radius: 8px;
|
|
12
|
-
overflow: hidden;
|
|
13
|
-
margin: 15px;
|
|
14
|
-
width: 200px;
|
|
15
|
-
background-color: #fff;
|
|
16
|
-
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
|
17
|
-
transition: transform 0.3s ease-in-out;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.slice-tester:hover {
|
|
21
|
-
transform: scale(1.05);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.slice_tester_subject {
|
|
25
|
-
background-color: #3498db;
|
|
26
|
-
color: #fff;
|
|
27
|
-
padding: 10px;
|
|
28
|
-
font-weight: bold;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.slice_tester_description {
|
|
32
|
-
background-color: #ecf0f1;
|
|
33
|
-
text-align: center;
|
|
34
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export default class Tester extends HTMLElement {
|
|
2
|
-
|
|
3
|
-
constructor(props) {
|
|
4
|
-
super();
|
|
5
|
-
slice.attachTemplate(this)
|
|
6
|
-
|
|
7
|
-
for (const prop in props) {
|
|
8
|
-
this.setAttribute(prop, props[prop])
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
static observedAttributes = ['subject', 'description'];
|
|
15
|
-
|
|
16
|
-
attributeChangedCallback(attributeName, oldValue, newValue){
|
|
17
|
-
if(Tester.observedAttributes.includes(attributeName)){
|
|
18
|
-
|
|
19
|
-
switch(attributeName){
|
|
20
|
-
case 'subject':
|
|
21
|
-
this.querySelector(".slice_tester_subject").textContent=newValue;
|
|
22
|
-
|
|
23
|
-
break;
|
|
24
|
-
|
|
25
|
-
case 'description':
|
|
26
|
-
this.querySelector(".slice_tester_description").textContent=newValue;
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
customElements.define("slice-tester", Tester);
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
width: 90%;
|
|
3
|
-
margin: 50px auto;
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-wrap: wrap;
|
|
6
|
-
justify-content: space-between;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.slice-tester2 {
|
|
10
|
-
border: 2px solid #3498db;
|
|
11
|
-
border-radius: 8px;
|
|
12
|
-
overflow: hidden;
|
|
13
|
-
margin: 15px;
|
|
14
|
-
width: 200px;
|
|
15
|
-
background-color: #fff;
|
|
16
|
-
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
|
17
|
-
transition: transform 0.3s ease-in-out;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.slice-tester2:hover {
|
|
21
|
-
transform: scale(1.05);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.slice_tester2_subject {
|
|
25
|
-
background-color: #3498db;
|
|
26
|
-
color: #fff;
|
|
27
|
-
padding: 10px;
|
|
28
|
-
font-weight: bold;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.slice_tester2_description {
|
|
32
|
-
background-color: #ecf0f1;
|
|
33
|
-
text-align: center;
|
|
34
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
<div class="container">
|
|
2
|
-
<div class="slice-tester2">
|
|
3
|
-
<div class="slice_tester2_subject">Lorem Ipsum</div>
|
|
4
|
-
<span class="slice_tester2_description">Lorem Ipsum Sit Amet</span>
|
|
5
|
-
</div>
|
|
6
|
-
</div>
|
|
7
|
-
|
|
8
|
-
<style>
|
|
9
|
-
.container {
|
|
10
|
-
width: 90%;
|
|
11
|
-
margin: 50px auto;
|
|
12
|
-
display: flex;
|
|
13
|
-
flex-wrap: wrap;
|
|
14
|
-
justify-content: space-between;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.slice-tester2 {
|
|
18
|
-
border: 2px solid #00ffd5;
|
|
19
|
-
border-radius: 8px;
|
|
20
|
-
overflow: hidden;
|
|
21
|
-
margin: 15px;
|
|
22
|
-
width: 200px;
|
|
23
|
-
background-color: #fff;
|
|
24
|
-
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
|
25
|
-
transition: transform 0.3s ease-in-out;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.slice-tester2:hover {
|
|
29
|
-
transform: scale(1.05);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.slice_tester2_subject {
|
|
33
|
-
background-color: #00ffd5;
|
|
34
|
-
color: #fff;
|
|
35
|
-
padding: 10px;
|
|
36
|
-
font-weight: bold;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.slice_tester2_description {
|
|
40
|
-
background-color: #ecf0f1;
|
|
41
|
-
text-align: center;
|
|
42
|
-
}
|
|
43
|
-
</style>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export default class Tester2 extends HTMLElement {
|
|
2
|
-
|
|
3
|
-
constructor(props) {
|
|
4
|
-
super();
|
|
5
|
-
slice.attachTemplate(this)
|
|
6
|
-
|
|
7
|
-
for (const prop in props) {
|
|
8
|
-
this.setAttribute(prop, props[prop])
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
static observedAttributes = ['subject', 'description', "children"];
|
|
15
|
-
|
|
16
|
-
async attributeChangedCallback(attributeName, oldValue, newValue){
|
|
17
|
-
if(Tester2.observedAttributes.includes(attributeName)){
|
|
18
|
-
|
|
19
|
-
switch(attributeName){
|
|
20
|
-
case 'subject':
|
|
21
|
-
this.querySelector(".slice_tester2_subject").textContent=newValue;
|
|
22
|
-
|
|
23
|
-
break;
|
|
24
|
-
|
|
25
|
-
case 'description':
|
|
26
|
-
this.querySelector(".slice_tester2_description").textContent=newValue;
|
|
27
|
-
break;
|
|
28
|
-
|
|
29
|
-
case 'children':
|
|
30
|
-
|
|
31
|
-
let newTester = await slice.build("Tester", {id: "testerHijo", sliceId: "testerHijo", subject: "Este es el subject del hijo de un componente Tester2", description: "Este es el description de un componente Tester"})
|
|
32
|
-
this.appendChild(newTester);
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
customElements.define("slice-tester2", Tester2);
|