slicejs-cli 2.0.3 → 2.0.6

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 (128) hide show
  1. package/ProjectTemplate/api/index.js +97 -0
  2. package/ProjectTemplate/src/App/index.html +22 -0
  3. package/ProjectTemplate/src/App/index.js +63 -0
  4. package/ProjectTemplate/src/App/style.css +40 -0
  5. package/ProjectTemplate/src/Components/AppComponents/ButtonDocumentation/ButtonDocumentation.css +16 -0
  6. package/ProjectTemplate/src/Components/AppComponents/ButtonDocumentation/ButtonDocumentation.html +22 -0
  7. package/ProjectTemplate/src/Components/AppComponents/ButtonDocumentation/ButtonDocumentation.js +102 -0
  8. package/ProjectTemplate/src/Components/AppComponents/CardDocumentation/CardDocumentation.css +15 -0
  9. package/ProjectTemplate/src/Components/AppComponents/CardDocumentation/CardDocumentation.html +38 -0
  10. package/ProjectTemplate/src/Components/AppComponents/CardDocumentation/CardDocumentation.js +113 -0
  11. package/ProjectTemplate/src/Components/AppComponents/CheckboxDocumentation/CheckboxDocumentation.css +21 -0
  12. package/ProjectTemplate/src/Components/AppComponents/CheckboxDocumentation/CheckboxDocumentation.html +35 -0
  13. package/ProjectTemplate/src/Components/AppComponents/CheckboxDocumentation/CheckboxDocumentation.js +103 -0
  14. package/ProjectTemplate/src/Components/AppComponents/CodeVisualizer/CodeVisualizer.css +14 -0
  15. package/ProjectTemplate/src/Components/AppComponents/CodeVisualizer/CodeVisualizer.html +3 -0
  16. package/ProjectTemplate/src/Components/AppComponents/CodeVisualizer/CodeVisualizer.js +45 -0
  17. package/ProjectTemplate/src/Components/AppComponents/Documentation/Documentation.css +0 -0
  18. package/ProjectTemplate/src/Components/AppComponents/Documentation/Documentation.html +30 -0
  19. package/ProjectTemplate/src/Components/AppComponents/Documentation/Documentation.js +75 -0
  20. package/ProjectTemplate/src/Components/AppComponents/DocumentationPage/DocumentationPage.css +62 -0
  21. package/ProjectTemplate/src/Components/AppComponents/DocumentationPage/DocumentationPage.html +0 -0
  22. package/ProjectTemplate/src/Components/AppComponents/DocumentationPage/DocumentationPage.js +241 -0
  23. package/ProjectTemplate/src/Components/AppComponents/InputDocumentation/InputDocumentation.css +41 -0
  24. package/ProjectTemplate/src/Components/AppComponents/InputDocumentation/InputDocumentation.html +95 -0
  25. package/ProjectTemplate/src/Components/AppComponents/InputDocumentation/InputDocumentation.js +315 -0
  26. package/ProjectTemplate/src/Components/AppComponents/LandingMenu/LandingMenu.css +108 -0
  27. package/ProjectTemplate/src/Components/AppComponents/LandingMenu/LandingMenu.html +16 -0
  28. package/ProjectTemplate/src/Components/AppComponents/LandingMenu/LandingMenu.js +33 -0
  29. package/ProjectTemplate/src/Components/AppComponents/LandingPage/LandingPage.css +14 -0
  30. package/ProjectTemplate/src/Components/AppComponents/LandingPage/LandingPage.html +0 -0
  31. package/ProjectTemplate/src/Components/AppComponents/LandingPage/LandingPage.js +53 -0
  32. package/ProjectTemplate/src/Components/AppComponents/MainMenu/MainMenu.css +80 -0
  33. package/ProjectTemplate/src/Components/AppComponents/MainMenu/MainMenu.html +39 -0
  34. package/ProjectTemplate/src/Components/AppComponents/MainMenu/MainMenu.js +42 -0
  35. package/ProjectTemplate/src/Components/AppComponents/MyLayout/MyLayout.css +0 -0
  36. package/ProjectTemplate/src/Components/AppComponents/MyLayout/MyLayout.html +0 -0
  37. package/ProjectTemplate/src/Components/AppComponents/MyLayout/MyLayout.js +13 -0
  38. package/ProjectTemplate/src/Components/AppComponents/MyNavigation/MyNavigation.css +49 -0
  39. package/ProjectTemplate/src/Components/AppComponents/MyNavigation/MyNavigation.html +1 -0
  40. package/ProjectTemplate/src/Components/AppComponents/MyNavigation/MyNavigation.js +60 -0
  41. package/ProjectTemplate/src/Components/AppComponents/Playground/Playground.css +12 -0
  42. package/ProjectTemplate/src/Components/AppComponents/Playground/Playground.html +0 -0
  43. package/ProjectTemplate/src/Components/AppComponents/Playground/Playground.js +126 -0
  44. package/ProjectTemplate/src/Components/AppComponents/SliceTeamCard/SliceTeamCard.css +104 -0
  45. package/ProjectTemplate/src/Components/AppComponents/SliceTeamCard/SliceTeamCard.html +12 -0
  46. package/ProjectTemplate/src/Components/AppComponents/SliceTeamCard/SliceTeamCard.js +74 -0
  47. package/ProjectTemplate/src/Components/AppComponents/SwitchDocumentation/SwitchDocumentation.css +21 -0
  48. package/ProjectTemplate/src/Components/AppComponents/SwitchDocumentation/SwitchDocumentation.html +35 -0
  49. package/ProjectTemplate/src/Components/AppComponents/SwitchDocumentation/SwitchDocumentation.js +103 -0
  50. package/ProjectTemplate/src/Components/AppComponents/TheSliceTeam/TheSliceTeam.css +23 -0
  51. package/ProjectTemplate/src/Components/AppComponents/TheSliceTeam/TheSliceTeam.html +6 -0
  52. package/ProjectTemplate/src/Components/AppComponents/TheSliceTeam/TheSliceTeam.js +129 -0
  53. package/ProjectTemplate/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.css +0 -0
  54. package/ProjectTemplate/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.html +7 -0
  55. package/ProjectTemplate/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.js +15 -0
  56. package/ProjectTemplate/src/Components/Service/FetchManager/FetchManager.js +133 -0
  57. package/ProjectTemplate/src/Components/Service/IndexedDbManager/IndexedDbManager.js +141 -0
  58. package/ProjectTemplate/src/Components/Service/Link/Link.js +26 -0
  59. package/ProjectTemplate/src/Components/Visual/Button/Button.css +47 -0
  60. package/ProjectTemplate/src/Components/Visual/Button/Button.html +5 -0
  61. package/ProjectTemplate/src/Components/Visual/Button/Button.js +70 -0
  62. package/ProjectTemplate/src/Components/Visual/Card/Card.css +68 -0
  63. package/ProjectTemplate/src/Components/Visual/Card/Card.html +7 -0
  64. package/ProjectTemplate/src/Components/Visual/Card/Card.js +107 -0
  65. package/ProjectTemplate/src/Components/Visual/Checkbox/Checkbox.css +87 -0
  66. package/ProjectTemplate/src/Components/Visual/Checkbox/Checkbox.html +8 -0
  67. package/ProjectTemplate/src/Components/Visual/Checkbox/Checkbox.js +86 -0
  68. package/ProjectTemplate/src/Components/Visual/Details/Details.css +70 -0
  69. package/ProjectTemplate/src/Components/Visual/Details/Details.html +9 -0
  70. package/ProjectTemplate/src/Components/Visual/Details/Details.js +76 -0
  71. package/ProjectTemplate/src/Components/Visual/DropDown/DropDown.css +60 -0
  72. package/ProjectTemplate/src/Components/Visual/DropDown/DropDown.html +5 -0
  73. package/ProjectTemplate/src/Components/Visual/DropDown/DropDown.js +63 -0
  74. package/ProjectTemplate/src/Components/Visual/Grid/Grid.css +7 -0
  75. package/ProjectTemplate/src/Components/Visual/Grid/Grid.html +1 -0
  76. package/ProjectTemplate/src/Components/Visual/Grid/Grid.js +57 -0
  77. package/ProjectTemplate/src/Components/Visual/Icon/Icon.css +510 -0
  78. package/ProjectTemplate/src/Components/Visual/Icon/Icon.html +1 -0
  79. package/ProjectTemplate/src/Components/Visual/Icon/Icon.js +89 -0
  80. package/ProjectTemplate/src/Components/Visual/Icon/slc.eot +0 -0
  81. package/ProjectTemplate/src/Components/Visual/Icon/slc.json +555 -0
  82. package/ProjectTemplate/src/Components/Visual/Icon/slc.styl +507 -0
  83. package/ProjectTemplate/src/Components/Visual/Icon/slc.svg +1485 -0
  84. package/ProjectTemplate/src/Components/Visual/Icon/slc.symbol.svg +1059 -0
  85. package/ProjectTemplate/src/Components/Visual/Icon/slc.ttf +0 -0
  86. package/ProjectTemplate/src/Components/Visual/Icon/slc.woff +0 -0
  87. package/ProjectTemplate/src/Components/Visual/Icon/slc.woff2 +0 -0
  88. package/ProjectTemplate/src/Components/Visual/Input/Input.css +91 -0
  89. package/ProjectTemplate/src/Components/Visual/Input/Input.html +4 -0
  90. package/ProjectTemplate/src/Components/Visual/Input/Input.js +215 -0
  91. package/ProjectTemplate/src/Components/Visual/Layout/Layout.css +0 -0
  92. package/ProjectTemplate/src/Components/Visual/Layout/Layout.html +0 -0
  93. package/ProjectTemplate/src/Components/Visual/Layout/Layout.js +49 -0
  94. package/ProjectTemplate/src/Components/Visual/Loading/Loading.css +56 -0
  95. package/ProjectTemplate/src/Components/Visual/Loading/Loading.html +83 -0
  96. package/ProjectTemplate/src/Components/Visual/Loading/Loading.js +38 -0
  97. package/ProjectTemplate/src/Components/Visual/MultiRoute/MultiRoute.js +93 -0
  98. package/ProjectTemplate/src/Components/Visual/Navbar/Navbar.css +115 -0
  99. package/ProjectTemplate/src/Components/Visual/Navbar/Navbar.html +44 -0
  100. package/ProjectTemplate/src/Components/Visual/Navbar/Navbar.js +141 -0
  101. package/ProjectTemplate/src/Components/Visual/NotFound/NotFound.css +117 -0
  102. package/ProjectTemplate/src/Components/Visual/NotFound/NotFound.html +24 -0
  103. package/ProjectTemplate/src/Components/Visual/NotFound/NotFound.js +16 -0
  104. package/ProjectTemplate/src/Components/Visual/Route/Route.js +93 -0
  105. package/ProjectTemplate/src/Components/Visual/Select/Select.css +84 -0
  106. package/ProjectTemplate/src/Components/Visual/Select/Select.html +8 -0
  107. package/ProjectTemplate/src/Components/Visual/Select/Select.js +195 -0
  108. package/ProjectTemplate/src/Components/Visual/Switch/Switch.css +76 -0
  109. package/ProjectTemplate/src/Components/Visual/Switch/Switch.html +8 -0
  110. package/ProjectTemplate/src/Components/Visual/Switch/Switch.js +102 -0
  111. package/ProjectTemplate/src/Components/Visual/TreeItem/TreeItem.css +36 -0
  112. package/ProjectTemplate/src/Components/Visual/TreeItem/TreeItem.html +1 -0
  113. package/ProjectTemplate/src/Components/Visual/TreeItem/TreeItem.js +126 -0
  114. package/ProjectTemplate/src/Components/Visual/TreeView/TreeView.css +8 -0
  115. package/ProjectTemplate/src/Components/Visual/TreeView/TreeView.html +1 -0
  116. package/ProjectTemplate/src/Components/Visual/TreeView/TreeView.js +48 -0
  117. package/ProjectTemplate/src/Components/components.js +42 -0
  118. package/ProjectTemplate/src/Styles/sliceStyles.css +34 -0
  119. package/ProjectTemplate/src/Themes/Dark.css +42 -0
  120. package/ProjectTemplate/src/Themes/Light.css +31 -0
  121. package/ProjectTemplate/src/Themes/Slice.css +47 -0
  122. package/ProjectTemplate/src/images/Slice.js-logo.png +0 -0
  123. package/ProjectTemplate/src/images/favicon.ico +0 -0
  124. package/ProjectTemplate/src/images/im2/Slice.js-logo.png +0 -0
  125. package/ProjectTemplate/src/routes.js +36 -0
  126. package/ProjectTemplate/src/sliceConfig.json +58 -0
  127. package/package.json +2 -2
  128. package/post.js +5 -2
@@ -0,0 +1,107 @@
1
+ export default class Card extends HTMLElement {
2
+ constructor(props) {
3
+ super();
4
+ slice.attachTemplate(this);
5
+ this.$card = this.querySelector('.slice-card');
6
+ this.$title = this.querySelector('.title');
7
+ this.$text = this.querySelector('.text');
8
+ this.$cover = this.querySelector('.card_cover');
9
+ slice.controller.setComponentProps(this, props);
10
+
11
+ this.$cover.addEventListener('click', () => {
12
+ this.isOpen = !this.isOpen;
13
+ });
14
+
15
+ this.$card.addEventListener('mouseover', () => {
16
+ this.$cover.style.backgroundColor = this.$color.icon;
17
+ this.$icon.color = this.$color.card;
18
+ });
19
+ this.$card.addEventListener('mouseout', () => {
20
+ this.$cover.style.backgroundColor = this.$color.card;
21
+ this.$icon.color = this.$color.icon;
22
+ });
23
+
24
+ this.debuggerProps = ['title', 'text', 'icon', 'customColor', 'isOpen'];
25
+ }
26
+
27
+ async init() {
28
+ if (this.isOpen === undefined) {
29
+ this.isOpen = false;
30
+ }
31
+
32
+ if (!this.customColor) {
33
+ this.$color = {
34
+ icon: 'var(--primary-color-contrast)',
35
+ card: 'var(--primary-color)',
36
+ };
37
+ }
38
+
39
+ if (!this._icon) {
40
+ this.icon = { name: 'sliceJs', iconStyle: 'filled' };
41
+ }
42
+
43
+ this.$icon = await slice.build('Icon', {
44
+ name: this.icon.name,
45
+ size: '150px',
46
+ color: this.$color.icon,
47
+ iconStyle: this._icon.iconStyle,
48
+ });
49
+ this.$cover.appendChild(this.$icon);
50
+ }
51
+
52
+ get title() {
53
+ return this._title;
54
+ }
55
+
56
+ set title(value) {
57
+ this._title = value;
58
+ this.$title.textContent = value;
59
+ }
60
+
61
+ get text() {
62
+ return this._text;
63
+ }
64
+
65
+ set text(value) {
66
+ this._text = value;
67
+ this.$text.textContent = value;
68
+ }
69
+
70
+ get icon() {
71
+ return this._icon;
72
+ }
73
+
74
+ set icon(value) {
75
+ this._icon = value;
76
+ if (!this.$icon) return;
77
+ this.$icon.name = value.name;
78
+ this.$icon.iconStyle = value.iconStyle;
79
+ }
80
+
81
+ get isOpen() {
82
+ return this._isOpen;
83
+ }
84
+
85
+ set isOpen(boolean) {
86
+ this._isOpen = boolean;
87
+ if (boolean) {
88
+ this.$cover.style.zIndex = 0;
89
+ } else {
90
+ this.$cover.style.zIndex = 1;
91
+ }
92
+ }
93
+
94
+ get customColor() {
95
+ return this._customColor;
96
+ }
97
+
98
+ set customColor(value) {
99
+ this._customColor = value;
100
+ this.$color = value;
101
+ if (value.card) {
102
+ this.$cover.style.backgroundColor = value.card;
103
+ }
104
+ }
105
+ }
106
+
107
+ customElements.define('slice-card', Card);
@@ -0,0 +1,87 @@
1
+ .slice_checkbox input {
2
+ position: absolute;
3
+ opacity: 0;
4
+ cursor: pointer;
5
+ height: 0;
6
+ width: 0;
7
+ }
8
+
9
+ .slice_checkbox_container {
10
+ width: fit-content;
11
+ }
12
+ .slice_checkbox {
13
+ display: flex;
14
+ align-items: center;
15
+ user-select: none;
16
+ margin-top: 25px;
17
+ margin-bottom: 25px;
18
+ position: relative;
19
+ user-select: none;
20
+ }
21
+ .checkbox_label {
22
+ margin: 5px;
23
+ font-family: var(--font-family);
24
+ color: var(--font-primary-color);
25
+ }
26
+ .checkmark {
27
+ position: relative;
28
+ top: 0;
29
+ left: 0;
30
+ height: 1.3em;
31
+ width: 1.3em;
32
+ background-color: var(--secondary-background-color);
33
+ border: var(--slice-border) solid var(--primary-color);
34
+ transition: all 0.3s;
35
+ border-radius: var(--border-radius-slice);
36
+ cursor: pointer;
37
+ }
38
+ .slice_checkbox input:checked ~ .checkmark {
39
+ border: var(--slice-border) solid var(--success-color);
40
+ background-color: var(--success-color);
41
+ animation: pop 0.5s;
42
+ animation-direction: alternate;
43
+ }
44
+
45
+ .checkmark:after {
46
+ content: "";
47
+ position: absolute;
48
+ display: none;
49
+ }
50
+
51
+ .slice_checkbox input:checked ~ .checkmark:after {
52
+ display: block;
53
+ }
54
+
55
+ .slice_checkbox .checkmark:after {
56
+ left: 0.45em;
57
+ top: 0.25em;
58
+ width: 0.25em;
59
+ height: 0.5em;
60
+ border: solid white;
61
+ border-width: 0 0.15em 0.15em 0;
62
+ transform: rotate(45deg);
63
+ }
64
+ .disabled {
65
+ border-color: var(--disabled-color);
66
+ background-color: var(--primary-color-shade);
67
+ color: var(--disabled-color);
68
+ cursor: not-allowed;
69
+ }
70
+ @keyframes pop {
71
+ 0% {
72
+ transform: scale(1);
73
+ }
74
+
75
+ 50% {
76
+ transform: scale(0.9);
77
+ }
78
+
79
+ 100% {
80
+ transform: scale(1);
81
+ }
82
+ }
83
+ .checkbox_label {
84
+ margin-left: 5px;
85
+ font-family: var(--font-family);
86
+ color: var(--font-primary-color);
87
+ }
@@ -0,0 +1,8 @@
1
+ <div class="slice_checkbox_container">
2
+ <div class="slice_checkbox">
3
+ <label>
4
+ <input type="checkbox" />
5
+ <div class="checkmark"></div>
6
+ </label>
7
+ </div>
8
+ </div>
@@ -0,0 +1,86 @@
1
+ export default class Checkbox extends HTMLElement {
2
+ constructor(props) {
3
+ super();
4
+ slice.attachTemplate(this);
5
+ this.$checkbox = this.querySelector('.slice_checkbox');
6
+ this.$checkmark = this.querySelector('.checkmark');
7
+
8
+ slice.controller.setComponentProps(this, props);
9
+ this.debuggerProps = ['checked', 'disabled', 'customColor', 'labelPlacement'];
10
+ }
11
+
12
+ init() {
13
+ if (this._checked === undefined) {
14
+ this.checked = false;
15
+ }
16
+
17
+ if (!this.disabled) {
18
+ this._disabled = false;
19
+ }
20
+ }
21
+
22
+ get checked() {
23
+ return this._checked;
24
+ }
25
+
26
+ set checked(value) {
27
+ this._checked = value;
28
+ this.querySelector('input').checked = value;
29
+ }
30
+
31
+ get label() {
32
+ return this._label;
33
+ }
34
+
35
+ set label(value) {
36
+ this._label = value;
37
+ if (this.querySelector('.checkbox_label')) {
38
+ this.querySelector('.checkbox_label').textContent = value;
39
+ } else {
40
+ const label = document.createElement('label');
41
+ label.classList.add('checkbox_label');
42
+ label.textContent = value;
43
+ this.$checkbox.appendChild(label);
44
+ }
45
+ }
46
+
47
+ get customColor() {
48
+ return this._customColor;
49
+ }
50
+
51
+ set customColor(value) {
52
+ this._customColor = value;
53
+ this.style = `--success-color: ${value};`;
54
+ }
55
+
56
+ get labelPlacement() {
57
+ return this._labelPlacement;
58
+ }
59
+
60
+ set labelPlacement(value) {
61
+ if (value === 'left') {
62
+ this.$checkbox.style = ` flex-direction: row-reverse;`;
63
+ }
64
+ if (value === 'right') {
65
+ this.$checkbox.style = `flex-direction: row;`;
66
+ }
67
+ if (value === 'top') {
68
+ this.$checkbox.style = `flex-direction: column-reverse;`;
69
+ }
70
+ if (value === 'bottom') {
71
+ this.$checkbox.style = `flex-direction: column;`;
72
+ }
73
+ }
74
+
75
+ get disabled() {
76
+ return this._disabled;
77
+ }
78
+
79
+ set disabled(value) {
80
+ this._disabled = value;
81
+ this.querySelector('input').disabled = value;
82
+ this.$checkmark.classList.add('disabled');
83
+ }
84
+ }
85
+
86
+ customElements.define('slice-checkbox', Checkbox);
@@ -0,0 +1,70 @@
1
+ slice-details {
2
+ font-family: var(--font-family);
3
+ color: var(--font-primary-color);
4
+ }
5
+ .details_summary {
6
+ cursor: pointer;
7
+ display: flex;
8
+ align-items: center;
9
+ border-bottom: var(--slice-border) solid var(--primary-color);
10
+ padding: 10px;
11
+ }
12
+ .details_summary .caret {
13
+ transform: rotate(-90deg);
14
+ margin-right: 10px;
15
+ color: var(--primary-color);
16
+ }
17
+ .details_title {
18
+ width: 100%;
19
+ font-weight: bold;
20
+ }
21
+ .details_text {
22
+ color: var(--font-secondary-color);
23
+ }
24
+ .details_container {
25
+ padding-left: 5px;
26
+ padding: 10px;
27
+ background-color: var(--secondary-background-color);
28
+ border-radius: var(--border-radius-slice);
29
+ visibility: hidden;
30
+ display: block;
31
+ height: 0; /* Inicia con altura 0 */
32
+ overflow: hidden;
33
+ transition:
34
+ height 0.3s ease,
35
+ visibility 0.3s ease; /* Agrega transición a height */
36
+ }
37
+
38
+ .details_open {
39
+ height: auto; /* Altura se ajustará automáticamente después de la transición */
40
+ visibility: visible;
41
+ }
42
+
43
+ .symbol {
44
+ border-radius: 5px;
45
+ width: 20px;
46
+ height: 20px;
47
+ position: relative;
48
+ transition: transform 0.3s ease;
49
+ }
50
+
51
+ .symbol::before,
52
+ .symbol::after {
53
+ content: '';
54
+ position: absolute;
55
+ background-color: var(--primary-color);
56
+ width: 15px;
57
+ height: 2px;
58
+ top: 50%;
59
+ left: 0;
60
+ transition: transform 0.5s ease;
61
+ }
62
+
63
+ .symbol.plus::after {
64
+ transform: rotate(90deg);
65
+ }
66
+
67
+ .symbol.minus::before,
68
+ .symbol.minus::after {
69
+ transform: rotate(360deg);
70
+ }
@@ -0,0 +1,9 @@
1
+ <div class="details_summary">
2
+ <div class="symbol plus"></div>
3
+ <span class="details_title"></span>
4
+ </div>
5
+ <div class="details_container">
6
+ <div class="full_details">
7
+ <div class="details_text"></div>
8
+ </div>
9
+ </div>
@@ -0,0 +1,76 @@
1
+ export default class Details extends HTMLElement {
2
+ constructor(props) {
3
+ super();
4
+ slice.attachTemplate(this);
5
+
6
+ this.$detailsTitle = this.querySelector('.details_title');
7
+ this.$detailsText = this.querySelector('.details_text');
8
+ this.$details = this.querySelector('.full_details');
9
+ this.$summary = this.querySelector('.details_summary');
10
+ this.$container = this.querySelector('.details_container'); // Referencia al contenedor
11
+
12
+ this.$summary.addEventListener('click', () => {
13
+ this.toggleDetails();
14
+ });
15
+
16
+ slice.controller.setComponentProps(this, props);
17
+ this.debuggerProps = ['title', 'text'];
18
+ }
19
+
20
+ toggleDetails() {
21
+ const isOpen = this.$container.classList.toggle('details_open');
22
+ const symbol = this.$summary.querySelector('.symbol');
23
+
24
+ if (isOpen) {
25
+ symbol.classList.remove('plus');
26
+ symbol.classList.add('minus');
27
+
28
+ // Obtener la altura total del contenedor
29
+ const fullHeight = this.$container.scrollHeight + 'px';
30
+
31
+ // Establecer la altura para iniciar la animación
32
+ this.$container.style.height = fullHeight;
33
+
34
+ // Después de la transición, ajustar la altura a 'auto'
35
+ this.$container.addEventListener('transitionend', function onTransitionEnd() {
36
+ this.style.height = 'auto';
37
+ this.removeEventListener('transitionend', onTransitionEnd);
38
+ });
39
+ } else {
40
+ symbol.classList.remove('minus');
41
+ symbol.classList.add('plus');
42
+
43
+ // Establecer la altura para iniciar la animación de cierre
44
+ this.$container.style.height = this.$container.scrollHeight + 'px';
45
+
46
+ // Forzar el reflujo para que la transición funcione
47
+ requestAnimationFrame(() => {
48
+ this.$container.style.height = '0';
49
+ });
50
+ }
51
+ }
52
+
53
+ get title() {
54
+ return this._title;
55
+ }
56
+
57
+ set title(value) {
58
+ this._title = value;
59
+ this.$detailsTitle.textContent = value;
60
+ }
61
+
62
+ get text() {
63
+ return this._text;
64
+ }
65
+
66
+ set text(value) {
67
+ this._text = value;
68
+ this.$detailsText.textContent = value;
69
+ }
70
+
71
+ addDetail(value) {
72
+ this.$details.appendChild(value);
73
+ }
74
+ }
75
+
76
+ customElements.define('slice-details', Details);
@@ -0,0 +1,60 @@
1
+ .slice_dropdown_label {
2
+ cursor: pointer;
3
+ }
4
+ .slice_dropdown {
5
+ cursor: pointer;
6
+ user-select: none;
7
+ display: flex;
8
+ justify-content: center;
9
+ display: flex;
10
+ border-radius: var(--border-radius-slice);
11
+ border: var(--slice-border) solid var(--primary-color);
12
+ align-items: center;
13
+ }
14
+ .slice_dropdown .caret {
15
+ margin-left: 10px;
16
+ border-top-color: var(--primary-color-contrast);
17
+ }
18
+ .slice_dropbox {
19
+ display: flex;
20
+ flex-direction: column;
21
+ border: var(--slice-border) solid var(--primary-color);
22
+ list-style: none;
23
+ font-family: var(--font-family);
24
+ visibility: hidden;
25
+ overflow: hidden;
26
+ position: absolute;
27
+ opacity: 0;
28
+ transition: 0s, opacity 0.3s;
29
+ top: 100%;
30
+ z-index: 1;
31
+ background-color: var(--primary-color);
32
+ border-radius: var(--border-radius-slice);
33
+ box-shadow: 0 0 10px 0 #00000050;
34
+ }
35
+ .slice_dropbox_open {
36
+ overflow-y: scroll;
37
+ min-height: min-content;
38
+ max-height: 200px;
39
+ visibility: visible;
40
+ opacity: 1;
41
+ }
42
+ .slice_dropbox_open::-webkit-scrollbar {
43
+ width: 5px;
44
+ }
45
+ .slice_dropbox_open::-webkit-scrollbar-thumb {
46
+ background: var(--secondary-color);
47
+ border-radius: var(--border-radius-slice);
48
+ }
49
+ .slice_dropbox {
50
+ width: 100%;
51
+ }
52
+ .slice_dropbox_open div a {
53
+ text-decoration: none;
54
+ color: var(--primary-color-contrast);
55
+ width: 100%;
56
+ }
57
+ .slice_dropbox_open div {
58
+ width: 100%;
59
+ padding: 5px;
60
+ }
@@ -0,0 +1,5 @@
1
+ <div class="slice_dropdown">
2
+ <label class="slice_dropdown_label"></label>
3
+ <div class="caret"></div>
4
+ </div>
5
+ <div class="slice_dropbox"></div>
@@ -0,0 +1,63 @@
1
+ export default class DropDown extends HTMLElement {
2
+ constructor(props) {
3
+ super();
4
+ slice.attachTemplate(this);
5
+
6
+ this.$dropdown = this.querySelector('.slice_dropdown');
7
+ this.$box = this.querySelector('.slice_dropbox');
8
+ this.$label = this.querySelector('.slice_dropdown_label');
9
+ this.$caret = this.querySelector('.caret');
10
+
11
+ this.addEventListener('click', () => {
12
+ this.toggleDrop();
13
+ });
14
+
15
+ this.$box.addEventListener('mouseleave', () => {
16
+ this.closeDrop();
17
+ });
18
+
19
+ slice.controller.setComponentProps(this, props);
20
+ this.debuggerProps = ['label', 'dropbox'];
21
+ }
22
+
23
+ init() {}
24
+
25
+ get label() {
26
+ return this._label;
27
+ }
28
+
29
+ set label(value) {
30
+ this._label;
31
+ this.$label.textContent = value;
32
+ }
33
+
34
+ get options() {
35
+ return this._options;
36
+ }
37
+
38
+ set options(values) {
39
+ this._options = values;
40
+ values.forEach((element) => {
41
+ const div = document.createElement('div');
42
+ const e = document.createElement('a');
43
+ e.addEventListener('click', () => {
44
+ this.closeDrop();
45
+ });
46
+ e.textContent = element.text;
47
+ e.href = element.href;
48
+ div.appendChild(e);
49
+ this.$box.appendChild(div);
50
+ });
51
+ }
52
+
53
+ toggleDrop() {
54
+ this.$box.classList.toggle('slice_dropbox_open');
55
+ this.$caret.classList.toggle('caret_open');
56
+ }
57
+ closeDrop() {
58
+ this.$box.classList.remove('slice_dropbox_open');
59
+ this.$caret.classList.remove('caret_open');
60
+ }
61
+ }
62
+
63
+ customElements.define('slice-dropdown', DropDown);
@@ -0,0 +1,7 @@
1
+ .grid-container {
2
+ display: grid;
3
+ grid-template-columns: repeat(1, 1fr);
4
+ grid-template-rows: repeat(1, 1fr);
5
+ gap: 10px;
6
+ margin: 0 auto;
7
+ }
@@ -0,0 +1 @@
1
+ <div class="grid-container"></div>
@@ -0,0 +1,57 @@
1
+ export default class Grid extends HTMLElement {
2
+ constructor(props) {
3
+ super();
4
+ slice.attachTemplate(this);
5
+
6
+ this.$grid = this.querySelector('.grid-container');
7
+
8
+ slice.controller.setComponentProps(this, props);
9
+ this.debuggerProps = ['columns', 'rows'];
10
+ }
11
+
12
+ async init() {
13
+ if (!this.rows || !this.columns) {
14
+ throw new Error('Grid cannot be build if rows or columns are not created.');
15
+ }
16
+ }
17
+
18
+ set columns(value) {
19
+ this._columns = value;
20
+ this.$grid.style.gridTemplateColumns = `repeat(${value}, 1fr)`;
21
+ }
22
+
23
+ get columns() {
24
+ return this._columns;
25
+ }
26
+
27
+ set rows(value) {
28
+ this.$grid.style.gridTemplateRows = `repeat(${value}, 1fr)`;
29
+ this._rows = value;
30
+ }
31
+
32
+ get rows() {
33
+ return this._rows;
34
+ }
35
+
36
+ set items(values) {
37
+ this.setItems(values);
38
+ this._items = values;
39
+ }
40
+
41
+ get items() {
42
+ return this._items;
43
+ }
44
+
45
+ async setItem(item) {
46
+ item.classList.add('grid-item');
47
+ this.$grid.appendChild(item);
48
+ }
49
+
50
+ async setItems(items) {
51
+ for (let i = 0; i < items.length; i++) {
52
+ this.setItem(items[i]);
53
+ }
54
+ }
55
+ }
56
+
57
+ customElements.define('slice-grid', Grid);