slicejs-cli 1.0.45 → 1.0.47

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.
Files changed (76) hide show
  1. package/PROJECT_TEMPLATES/Basic/Slice/Components/Service/FetchManager/FetchManager.js +109 -37
  2. package/PROJECT_TEMPLATES/Basic/Slice/Components/Service/Translator/Translator.js +15 -15
  3. package/PROJECT_TEMPLATES/Basic/Slice/Components/Service/Translator/messages.json +50 -0
  4. package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Controller/Controller.js +81 -83
  5. package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Debugger/Debugger.css +47 -10
  6. package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Debugger/Debugger.html +7 -3
  7. package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Debugger/Debugger.js +114 -41
  8. package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Logger/Logger.js +11 -11
  9. package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/StylesManager/StylesManager.js +32 -28
  10. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Button/Button.css +44 -0
  11. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Button/Button.html +5 -0
  12. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Button/Button.js +39 -0
  13. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Card/Card.css +63 -0
  14. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Card/Card.html +7 -0
  15. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Card/Card.js +110 -0
  16. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Checkbox/Checkbox.css +87 -0
  17. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Checkbox/Checkbox.html +8 -0
  18. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Checkbox/Checkbox.js +87 -0
  19. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/CodeValidator/CodeValidator.css +97 -0
  20. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/CodeValidator/CodeValidator.html +18 -0
  21. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/CodeValidator/CodeValidator.js +86 -0
  22. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/Icon.css +505 -0
  23. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/Icon.html +1 -0
  24. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/Icon.js +95 -0
  25. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.eot +0 -0
  26. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.json +550 -0
  27. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.styl +502 -0
  28. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.svg +1470 -0
  29. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.symbol.svg +1035 -0
  30. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.ttf +0 -0
  31. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.woff +0 -0
  32. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.woff2 +0 -0
  33. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Input/Input.css +87 -0
  34. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Input/Input.html +4 -0
  35. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Input/Input.js +210 -0
  36. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Loading/Loading.css +56 -0
  37. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Loading/Loading.html +83 -0
  38. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Loading/Loading.js +39 -0
  39. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Navbar/Navbar.css +30 -0
  40. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Navbar/Navbar.html +6 -0
  41. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Navbar/Navbar.js +39 -0
  42. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Select/Select.css +91 -0
  43. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Select/Select.html +8 -0
  44. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Select/Select.js +210 -0
  45. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Switch/Switch.css +76 -0
  46. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Switch/Switch.html +8 -0
  47. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Switch/Switch.js +109 -0
  48. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester/Tester.css +34 -0
  49. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester/Tester.html +7 -0
  50. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester/Tester.js +33 -0
  51. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester2/Tester2.css +34 -0
  52. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester2/Tester2.html +43 -0
  53. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester2/Tester2.js +39 -0
  54. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/ToastAlert/ToastAlert.css +110 -0
  55. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/ToastAlert/ToastAlert.html +12 -0
  56. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/ToastAlert/ToastAlert.js +65 -0
  57. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/complexNavbar/complexNavbar.css +163 -0
  58. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/complexNavbar/complexNavbar.html +15 -0
  59. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/complexNavbar/complexNavbar.js +48 -0
  60. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/imageCarousel/img-carousel.css +56 -0
  61. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/imageCarousel/img-carousel.html +6 -0
  62. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/imageCarousel/img-carousel.js +119 -0
  63. package/PROJECT_TEMPLATES/Basic/Slice/Components/components.js +22 -11
  64. package/PROJECT_TEMPLATES/Basic/Slice/Slice.js +169 -147
  65. package/PROJECT_TEMPLATES/Basic/Slice/Styles/sliceStyles.css +10 -0
  66. package/PROJECT_TEMPLATES/Basic/Slice/Themes/Dark.css +33 -9
  67. package/PROJECT_TEMPLATES/Basic/Slice/Themes/Light.css +27 -10
  68. package/PROJECT_TEMPLATES/Basic/Slice/Themes/Slice.css +27 -12
  69. package/PROJECT_TEMPLATES/Basic/Slice/package.json +12 -0
  70. package/PROJECT_TEMPLATES/Basic/Slice/sliceConfig.json +9 -1
  71. package/PROJECT_TEMPLATES/Basic/src/Views/LandingPage/index.html +9 -13
  72. package/PROJECT_TEMPLATES/Basic/src/Views/LandingPage/index.js +381 -9
  73. package/commands/createComponent/createComponent.js +4 -1
  74. package/commands/deleteComponent/deleteComponent.js +7 -1
  75. package/commands/listComponents/listComponents.js +12 -3
  76. package/package.json +1 -1
@@ -0,0 +1,91 @@
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
+ }
@@ -0,0 +1,8 @@
1
+ <div class="slice_dropdown">
2
+ <div class="slice_select_container">
3
+ <label class="slice_select_label"></label>
4
+ <input class="slice_select" />
5
+ <div class="caret"></div>
6
+ </div>
7
+ <div class="slice_menu"></div>
8
+ </div>
@@ -0,0 +1,210 @@
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);
@@ -0,0 +1,76 @@
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
+ }
@@ -0,0 +1,8 @@
1
+ <div class="slice_switch_container">
2
+ <div class="slice_switch">
3
+ <label>
4
+ <input type="checkbox" />
5
+ <span class="slider"></span>
6
+ </label>
7
+ </div>
8
+ </div>
@@ -0,0 +1,109 @@
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);
@@ -0,0 +1,34 @@
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
+ }
@@ -0,0 +1,7 @@
1
+ <div class="container">
2
+ <div class="slice-tester">
3
+ <div class="slice_tester_subject"></div>
4
+ <span class="slice_tester_description"></span>
5
+ </div>
6
+ </div>
7
+
@@ -0,0 +1,33 @@
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);
@@ -0,0 +1,34 @@
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
+ }
@@ -0,0 +1,43 @@
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>
@@ -0,0 +1,39 @@
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);