slicejs-web-framework 1.0.19 → 1.0.21
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/Debugger/Debugger.js +3 -3
- package/Slice/Slice.js +2 -1
- package/package.json +1 -1
- package/src/Components/AppComponents/HomePage/HomePage.css +203 -0
- package/src/Components/AppComponents/HomePage/HomePage.html +49 -0
- package/src/Components/AppComponents/HomePage/HomePage.js +196 -0
- package/src/Components/AppComponents/Playground/Playground.js +0 -15
- package/src/Components/components.js +2 -24
- package/src/routes.js +4 -86
- package/src/sliceConfig.json +0 -3
- package/src/Components/AppComponents/ButtonDocumentation/ButtonDocumentation.css +0 -16
- package/src/Components/AppComponents/ButtonDocumentation/ButtonDocumentation.html +0 -22
- package/src/Components/AppComponents/ButtonDocumentation/ButtonDocumentation.js +0 -102
- package/src/Components/AppComponents/CardDocumentation/CardDocumentation.css +0 -15
- package/src/Components/AppComponents/CardDocumentation/CardDocumentation.html +0 -38
- package/src/Components/AppComponents/CardDocumentation/CardDocumentation.js +0 -113
- package/src/Components/AppComponents/CheckboxDocumentation/CheckboxDocumentation.css +0 -21
- package/src/Components/AppComponents/CheckboxDocumentation/CheckboxDocumentation.html +0 -35
- package/src/Components/AppComponents/CheckboxDocumentation/CheckboxDocumentation.js +0 -103
- package/src/Components/AppComponents/Documentation/Documentation.css +0 -0
- package/src/Components/AppComponents/Documentation/Documentation.html +0 -30
- package/src/Components/AppComponents/Documentation/Documentation.js +0 -75
- package/src/Components/AppComponents/DocumentationPage/DocumentationPage.css +0 -62
- package/src/Components/AppComponents/DocumentationPage/DocumentationPage.html +0 -0
- package/src/Components/AppComponents/DocumentationPage/DocumentationPage.js +0 -283
- package/src/Components/AppComponents/InputDocumentation/InputDocumentation.css +0 -41
- package/src/Components/AppComponents/InputDocumentation/InputDocumentation.html +0 -95
- package/src/Components/AppComponents/InputDocumentation/InputDocumentation.js +0 -315
- package/src/Components/AppComponents/Installation/Installation.css +0 -185
- package/src/Components/AppComponents/Installation/Installation.html +0 -102
- package/src/Components/AppComponents/Installation/Installation.js +0 -61
- package/src/Components/AppComponents/LandingMenu/LandingMenu.css +0 -108
- package/src/Components/AppComponents/LandingMenu/LandingMenu.html +0 -16
- package/src/Components/AppComponents/LandingMenu/LandingMenu.js +0 -33
- package/src/Components/AppComponents/LandingPage/LandingPage.css +0 -14
- package/src/Components/AppComponents/LandingPage/LandingPage.html +0 -0
- package/src/Components/AppComponents/LandingPage/LandingPage.js +0 -53
- package/src/Components/AppComponents/MainMenu/MainMenu.css +0 -80
- package/src/Components/AppComponents/MainMenu/MainMenu.html +0 -39
- package/src/Components/AppComponents/MainMenu/MainMenu.js +0 -42
- package/src/Components/AppComponents/MyLayout/MyLayout.css +0 -0
- package/src/Components/AppComponents/MyLayout/MyLayout.html +0 -0
- package/src/Components/AppComponents/MyLayout/MyLayout.js +0 -13
- package/src/Components/AppComponents/MyNavigation/MyNavigation.css +0 -49
- package/src/Components/AppComponents/MyNavigation/MyNavigation.html +0 -1
- package/src/Components/AppComponents/MyNavigation/MyNavigation.js +0 -60
- package/src/Components/AppComponents/RoutingDocumentation/RoutingDocumentation.css +0 -89
- package/src/Components/AppComponents/RoutingDocumentation/RoutingDocumentation.html +0 -108
- package/src/Components/AppComponents/RoutingDocumentation/RoutingDocumentation.js +0 -177
- package/src/Components/AppComponents/ServiceDocumentation/ServiceDocumentation.css +0 -82
- package/src/Components/AppComponents/ServiceDocumentation/ServiceDocumentation.html +0 -74
- package/src/Components/AppComponents/ServiceDocumentation/ServiceDocumentation.js +0 -416
- package/src/Components/AppComponents/SliceStylesDocumentation/SliceStylesDocumentation.css +0 -56
- package/src/Components/AppComponents/SliceStylesDocumentation/SliceStylesDocumentation.html +0 -28
- package/src/Components/AppComponents/SliceStylesDocumentation/SliceStylesDocumentation.js +0 -134
- package/src/Components/AppComponents/SliceTeamCard/SliceTeamCard.css +0 -104
- package/src/Components/AppComponents/SliceTeamCard/SliceTeamCard.html +0 -12
- package/src/Components/AppComponents/SliceTeamCard/SliceTeamCard.js +0 -74
- package/src/Components/AppComponents/StructuralDocumentation/StructuralDocumentation.css +0 -72
- package/src/Components/AppComponents/StructuralDocumentation/StructuralDocumentation.html +0 -98
- package/src/Components/AppComponents/StructuralDocumentation/StructuralDocumentation.js +0 -219
- package/src/Components/AppComponents/SwitchDocumentation/SwitchDocumentation.css +0 -21
- package/src/Components/AppComponents/SwitchDocumentation/SwitchDocumentation.html +0 -35
- package/src/Components/AppComponents/SwitchDocumentation/SwitchDocumentation.js +0 -103
- package/src/Components/AppComponents/TheBuildMethod/TheBuildMethod.css +0 -296
- package/src/Components/AppComponents/TheBuildMethod/TheBuildMethod.html +0 -89
- package/src/Components/AppComponents/TheBuildMethod/TheBuildMethod.js +0 -86
- package/src/Components/AppComponents/TheSliceTeam/TheSliceTeam.css +0 -208
- package/src/Components/AppComponents/TheSliceTeam/TheSliceTeam.html +0 -18
- package/src/Components/AppComponents/TheSliceTeam/TheSliceTeam.js +0 -111
- package/src/Components/AppComponents/ThemesDocumentation/ThemesDocumentation.css +0 -61
- package/src/Components/AppComponents/ThemesDocumentation/ThemesDocumentation.html +0 -80
- package/src/Components/AppComponents/ThemesDocumentation/ThemesDocumentation.js +0 -149
- package/src/Components/AppComponents/VisualDocumentation/VisualDocumentation.css +0 -70
- package/src/Components/AppComponents/VisualDocumentation/VisualDocumentation.html +0 -67
- package/src/Components/AppComponents/VisualDocumentation/VisualDocumentation.js +0 -193
- package/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.css +0 -475
- package/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.html +0 -389
- package/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.js +0 -95
- /package/src/Components/{AppComponents → Visual}/CodeVisualizer/CodeVisualizer.css +0 -0
- /package/src/Components/{AppComponents → Visual}/CodeVisualizer/CodeVisualizer.html +0 -0
- /package/src/Components/{AppComponents → Visual}/CodeVisualizer/CodeVisualizer.js +0 -0
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
export default class SwitchDocumentation extends HTMLElement {
|
|
2
|
-
constructor(props) {
|
|
3
|
-
super();
|
|
4
|
-
slice.attachTemplate(this);
|
|
5
|
-
|
|
6
|
-
slice.controller.setComponentProps(this, props);
|
|
7
|
-
this.debuggerProps = [];
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
async init() {
|
|
11
|
-
await this.createSwitch(this.querySelector('.mySwitch'), {}, `{}`);
|
|
12
|
-
await this.createSwitch(
|
|
13
|
-
this.querySelector('.colorSwitch'),
|
|
14
|
-
{ customColor: 'gold' },
|
|
15
|
-
`{
|
|
16
|
-
customColor: "gold"
|
|
17
|
-
}`
|
|
18
|
-
);
|
|
19
|
-
await this.createSwitch(
|
|
20
|
-
this.querySelector('.label'),
|
|
21
|
-
{
|
|
22
|
-
label: 'Switch',
|
|
23
|
-
},
|
|
24
|
-
`{
|
|
25
|
-
label: "Switch",
|
|
26
|
-
}`
|
|
27
|
-
);
|
|
28
|
-
await this.createSwitch(
|
|
29
|
-
this.querySelector('.labelLeft'),
|
|
30
|
-
{
|
|
31
|
-
label: 'Left',
|
|
32
|
-
labelPlacement: 'left',
|
|
33
|
-
},
|
|
34
|
-
`{
|
|
35
|
-
label: "Left",
|
|
36
|
-
labelPlacement: "left",
|
|
37
|
-
}`
|
|
38
|
-
);
|
|
39
|
-
await this.createSwitch(
|
|
40
|
-
this.querySelector('.labelTop'),
|
|
41
|
-
{
|
|
42
|
-
label: 'Top',
|
|
43
|
-
labelPlacement: 'top',
|
|
44
|
-
},
|
|
45
|
-
`{
|
|
46
|
-
label: "Top",
|
|
47
|
-
labelPlacement: "top",
|
|
48
|
-
}`
|
|
49
|
-
);
|
|
50
|
-
await this.createSwitch(
|
|
51
|
-
this.querySelector('.labelRight'),
|
|
52
|
-
{
|
|
53
|
-
label: 'Right',
|
|
54
|
-
labelPlacement: 'right',
|
|
55
|
-
},
|
|
56
|
-
`{
|
|
57
|
-
label: "Right",
|
|
58
|
-
labelPlacement: "right",
|
|
59
|
-
}`
|
|
60
|
-
);
|
|
61
|
-
await this.createSwitch(
|
|
62
|
-
this.querySelector('.labelBottom'),
|
|
63
|
-
{
|
|
64
|
-
label: 'Bottom',
|
|
65
|
-
labelPlacement: 'bottom',
|
|
66
|
-
},
|
|
67
|
-
`{
|
|
68
|
-
label: "Bottom",
|
|
69
|
-
labelPlacement: "bottom",
|
|
70
|
-
}`
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
async createSwitch(appendTo, switchProps, codeProps) {
|
|
75
|
-
if (!codeProps) {
|
|
76
|
-
codeProps = '{}';
|
|
77
|
-
}
|
|
78
|
-
const mySwitch = await slice.build('Switch', switchProps);
|
|
79
|
-
|
|
80
|
-
const componentCode = await slice.build('CodeVisualizer', {
|
|
81
|
-
value: `const mySwitch = await slice.build("Switch", ${codeProps});
|
|
82
|
-
|
|
83
|
-
`,
|
|
84
|
-
language: 'javascript',
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
const div = document.createElement('div');
|
|
88
|
-
const switchDiv = document.createElement('div');
|
|
89
|
-
switchDiv.classList.add('switchs');
|
|
90
|
-
switchDiv.appendChild(mySwitch);
|
|
91
|
-
div.classList.add('switchs_container');
|
|
92
|
-
div.appendChild(switchDiv);
|
|
93
|
-
div.appendChild(componentCode);
|
|
94
|
-
|
|
95
|
-
if (appendTo) {
|
|
96
|
-
appendTo.appendChild(div);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return div;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
customElements.define('slice-switchdocumentation', SwitchDocumentation);
|
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
slice-the-build-method {
|
|
2
|
-
font-family: var(--font-family);
|
|
3
|
-
color: var(--font-primary-color);
|
|
4
|
-
display: block;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
slice-the-build-method .build-method-container {
|
|
8
|
-
max-width: 90%;
|
|
9
|
-
margin: 0 auto;
|
|
10
|
-
padding: 20px;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
slice-the-build-method .build-method-header {
|
|
14
|
-
display: flex;
|
|
15
|
-
align-items: center;
|
|
16
|
-
margin-bottom: 1.5rem;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
slice-the-build-method h1 {
|
|
20
|
-
font-size: 2.2rem;
|
|
21
|
-
color: var(--primary-color);
|
|
22
|
-
border-bottom: 2px solid var(--secondary-background-color);
|
|
23
|
-
padding-bottom: 0.5rem;
|
|
24
|
-
margin-right: 1rem;
|
|
25
|
-
margin-bottom: 0;
|
|
26
|
-
flex-grow: 1;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
slice-the-build-method .build-method-badge {
|
|
30
|
-
background-color: var(--primary-color);
|
|
31
|
-
color: var(--primary-color-contrast);
|
|
32
|
-
padding: 6px 12px;
|
|
33
|
-
border-radius: 20px;
|
|
34
|
-
font-size: 0.9rem;
|
|
35
|
-
font-weight: bold;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
slice-the-build-method h2 {
|
|
39
|
-
font-size: 1.8rem;
|
|
40
|
-
margin-top: 2.5rem;
|
|
41
|
-
margin-bottom: 1.2rem;
|
|
42
|
-
color: var(--primary-color);
|
|
43
|
-
position: relative;
|
|
44
|
-
padding-left: 1rem;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
slice-the-build-method h2:before {
|
|
48
|
-
content: "";
|
|
49
|
-
position: absolute;
|
|
50
|
-
left: 0;
|
|
51
|
-
height: 100%;
|
|
52
|
-
width: 4px;
|
|
53
|
-
background-color: var(--primary-color);
|
|
54
|
-
border-radius: 4px;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
slice-the-build-method h3 {
|
|
58
|
-
font-size: 1.5rem;
|
|
59
|
-
margin-top: 1.8rem;
|
|
60
|
-
margin-bottom: 1rem;
|
|
61
|
-
color: var(--font-primary-color);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
slice-the-build-method p {
|
|
65
|
-
margin-bottom: 1.2rem;
|
|
66
|
-
line-height: 1.7;
|
|
67
|
-
text-align: justify;
|
|
68
|
-
font-size: 1.05rem;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
slice-the-build-method code {
|
|
72
|
-
font-family: monospace;
|
|
73
|
-
background-color: var(--secondary-background-color);
|
|
74
|
-
padding: 3px 6px;
|
|
75
|
-
border-radius: 4px;
|
|
76
|
-
font-size: 0.95em;
|
|
77
|
-
color: var(--primary-color);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
slice-the-build-method .syntax-box {
|
|
81
|
-
background-color: var(--secondary-background-color);
|
|
82
|
-
padding: 20px;
|
|
83
|
-
border-radius: var(--border-radius-slice);
|
|
84
|
-
margin: 20px 0;
|
|
85
|
-
overflow-x: auto;
|
|
86
|
-
border-left: 4px solid var(--primary-color);
|
|
87
|
-
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
|
|
88
|
-
transition: transform 0.2s ease;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
slice-the-build-method .syntax-box:hover {
|
|
92
|
-
transform: translateY(-2px);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
slice-the-build-method .syntax-box code {
|
|
96
|
-
font-size: 1.2em;
|
|
97
|
-
background: none;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
slice-the-build-method .parameters-section,
|
|
101
|
-
slice-the-build-method .return-section {
|
|
102
|
-
background-color: var(--primary-background-color);
|
|
103
|
-
padding: 15px 20px;
|
|
104
|
-
border-radius: var(--border-radius-slice);
|
|
105
|
-
margin: 15px 0;
|
|
106
|
-
border: 1px solid var(--secondary-background-color);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
slice-the-build-method .parameters-list {
|
|
110
|
-
list-style: none;
|
|
111
|
-
margin: 0;
|
|
112
|
-
padding: 0;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
slice-the-build-method .parameters-list li {
|
|
116
|
-
display: grid;
|
|
117
|
-
grid-template-columns: 1fr 1fr 3fr;
|
|
118
|
-
gap: 15px;
|
|
119
|
-
margin-bottom: 12px;
|
|
120
|
-
padding-bottom: 12px;
|
|
121
|
-
border-bottom: 1px solid var(--secondary-background-color);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
slice-the-build-method .parameters-list li:last-child {
|
|
125
|
-
border-bottom: none;
|
|
126
|
-
margin-bottom: 0;
|
|
127
|
-
padding-bottom: 0;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
slice-the-build-method .param-name {
|
|
131
|
-
font-weight: bold;
|
|
132
|
-
color: var(--primary-color);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
slice-the-build-method .param-type {
|
|
136
|
-
font-style: italic;
|
|
137
|
-
color: var(--font-secondary-color);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
slice-the-build-method .example-card {
|
|
141
|
-
background-color: var(--primary-background-color);
|
|
142
|
-
border-radius: var(--border-radius-slice);
|
|
143
|
-
padding: 20px;
|
|
144
|
-
margin-bottom: 30px;
|
|
145
|
-
border: 1px solid var(--secondary-background-color);
|
|
146
|
-
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
|
|
147
|
-
transition: box-shadow 0.3s ease;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
slice-the-build-method .example-card:hover {
|
|
151
|
-
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
slice-the-build-method .example-card h3 {
|
|
155
|
-
margin-top: 0;
|
|
156
|
-
color: var(--primary-color);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
slice-the-build-method .method-examples div[class$="-container"] {
|
|
160
|
-
margin-top: 1rem;
|
|
161
|
-
border-radius: var(--border-radius-slice);
|
|
162
|
-
overflow: hidden;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
slice-the-build-method .lifecycle-diagram {
|
|
166
|
-
background-color: var(--primary-background-color);
|
|
167
|
-
border-radius: var(--border-radius-slice);
|
|
168
|
-
padding: 20px;
|
|
169
|
-
border: 1px solid var(--secondary-background-color);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
slice-the-build-method .lifecycle-steps {
|
|
173
|
-
list-style: none;
|
|
174
|
-
margin: 0;
|
|
175
|
-
padding: 0;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
slice-the-build-method .lifecycle-steps li {
|
|
179
|
-
display: flex;
|
|
180
|
-
align-items: center;
|
|
181
|
-
margin-bottom: 15px;
|
|
182
|
-
padding-bottom: 15px;
|
|
183
|
-
border-bottom: 1px dashed var(--secondary-background-color);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
slice-the-build-method .lifecycle-steps li:last-child {
|
|
187
|
-
margin-bottom: 0;
|
|
188
|
-
padding-bottom: 0;
|
|
189
|
-
border-bottom: none;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
slice-the-build-method .step-number {
|
|
193
|
-
display: flex;
|
|
194
|
-
align-items: center;
|
|
195
|
-
justify-content: center;
|
|
196
|
-
width: 30px;
|
|
197
|
-
height: 30px;
|
|
198
|
-
background-color: var(--primary-color);
|
|
199
|
-
color: var(--primary-color-contrast);
|
|
200
|
-
border-radius: 50%;
|
|
201
|
-
margin-right: 15px;
|
|
202
|
-
font-weight: bold;
|
|
203
|
-
flex-shrink: 0;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
slice-the-build-method .step-content {
|
|
207
|
-
flex-grow: 1;
|
|
208
|
-
line-height: 1.5;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
slice-the-build-method .best-practices-container {
|
|
212
|
-
background-color: var(--primary-background-color);
|
|
213
|
-
border-radius: var(--border-radius-slice);
|
|
214
|
-
padding: 20px;
|
|
215
|
-
border: 1px solid var(--secondary-background-color);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
slice-the-build-method .best-practices-list {
|
|
219
|
-
list-style: none;
|
|
220
|
-
margin: 0;
|
|
221
|
-
padding: 0;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
slice-the-build-method .best-practices-list li {
|
|
225
|
-
display: flex;
|
|
226
|
-
align-items: flex-start;
|
|
227
|
-
margin-bottom: 15px;
|
|
228
|
-
line-height: 1.6;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
slice-the-build-method .best-practices-list li:last-child {
|
|
232
|
-
margin-bottom: 0;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
slice-the-build-method .practice-icon {
|
|
236
|
-
display: inline-block;
|
|
237
|
-
margin-right: 10px;
|
|
238
|
-
color: var(--success-color);
|
|
239
|
-
font-weight: bold;
|
|
240
|
-
font-size: 1.2rem;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
slice-the-build-method .method-introduction,
|
|
244
|
-
slice-the-build-method .method-syntax,
|
|
245
|
-
slice-the-build-method .method-examples,
|
|
246
|
-
slice-the-build-method .method-lifecycle,
|
|
247
|
-
slice-the-build-method .method-best-practices {
|
|
248
|
-
margin-bottom: 3.5rem;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
slice-the-build-method section {
|
|
252
|
-
padding-top: 15px;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
@media only screen and (max-width: 770px) {
|
|
256
|
-
slice-the-build-method .build-method-container {
|
|
257
|
-
max-width: 100%;
|
|
258
|
-
padding: 15px;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
slice-the-build-method .build-method-header {
|
|
262
|
-
flex-direction: column;
|
|
263
|
-
align-items: flex-start;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
slice-the-build-method .build-method-badge {
|
|
267
|
-
margin-top: 10px;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
slice-the-build-method h1 {
|
|
271
|
-
font-size: 1.8rem;
|
|
272
|
-
margin-right: 0;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
slice-the-build-method h2 {
|
|
276
|
-
font-size: 1.5rem;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
slice-the-build-method h3 {
|
|
280
|
-
font-size: 1.3rem;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
slice-the-build-method .parameters-list li {
|
|
284
|
-
grid-template-columns: 1fr;
|
|
285
|
-
gap: 5px;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
slice-the-build-method .lifecycle-steps li {
|
|
289
|
-
flex-direction: column;
|
|
290
|
-
align-items: flex-start;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
slice-the-build-method .step-number {
|
|
294
|
-
margin-bottom: 10px;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
<div class="build-method-container">
|
|
2
|
-
<div class="build-method-header">
|
|
3
|
-
<h1 id="build-method">The Build Method</h1>
|
|
4
|
-
<div class="build-method-badge">Core API</div>
|
|
5
|
-
</div>
|
|
6
|
-
|
|
7
|
-
<section class="method-introduction">
|
|
8
|
-
<p>
|
|
9
|
-
The <code>build</code> method is the cornerstone of Slice.js component creation. It's an asynchronous method that instantiates and configures components, handling all of the necessary resource loading, template attachment, and initialization.
|
|
10
|
-
</p>
|
|
11
|
-
</section>
|
|
12
|
-
|
|
13
|
-
<section class="method-syntax">
|
|
14
|
-
<h2 id="syntax">Syntax</h2>
|
|
15
|
-
<div class="syntax-box">
|
|
16
|
-
<code>await slice.build(componentName, props);</code>
|
|
17
|
-
</div>
|
|
18
|
-
<div class="parameters-section">
|
|
19
|
-
<h3>Parameters</h3>
|
|
20
|
-
<ul class="parameters-list">
|
|
21
|
-
<li><div class="param-name">componentName</div><div class="param-type">string</div><div class="param-description">The name of the component to build as registered in components.js</div></li>
|
|
22
|
-
<li><div class="param-name">props</div><div class="param-type">object</div><div class="param-description">(Optional) An object containing properties to set on the component</div></li>
|
|
23
|
-
</ul>
|
|
24
|
-
</div>
|
|
25
|
-
<div class="return-section">
|
|
26
|
-
<h3>Return Value</h3>
|
|
27
|
-
<p>A Promise that resolves to the constructed component instance, or null if construction fails.</p>
|
|
28
|
-
</div>
|
|
29
|
-
</section>
|
|
30
|
-
|
|
31
|
-
<section class="method-examples">
|
|
32
|
-
<h2 id="examples">Examples</h2>
|
|
33
|
-
|
|
34
|
-
<div class="example-card">
|
|
35
|
-
<h3 id="basic-usage">Basic Usage</h3>
|
|
36
|
-
<p>Creating a simple button component and adding it to the DOM:</p>
|
|
37
|
-
<div class="basic-example-container"></div>
|
|
38
|
-
</div>
|
|
39
|
-
|
|
40
|
-
<div class="example-card">
|
|
41
|
-
<h3 id="advanced-props">Advanced Properties</h3>
|
|
42
|
-
<p>Building a component with more complex properties:</p>
|
|
43
|
-
<div class="advanced-example-container"></div>
|
|
44
|
-
</div>
|
|
45
|
-
|
|
46
|
-
<div class="example-card">
|
|
47
|
-
<h3 id="nested-components">Building Nested Components</h3>
|
|
48
|
-
<p>Creating a structure of components that contain other components:</p>
|
|
49
|
-
<div class="nested-components-container"></div>
|
|
50
|
-
</div>
|
|
51
|
-
|
|
52
|
-
<div class="example-card">
|
|
53
|
-
<h3 id="error-handling">Error Handling</h3>
|
|
54
|
-
<p>Proper error handling when building components:</p>
|
|
55
|
-
<div class="error-handling-container"></div>
|
|
56
|
-
</div>
|
|
57
|
-
</section>
|
|
58
|
-
|
|
59
|
-
<section class="method-lifecycle">
|
|
60
|
-
<h2 id="build-lifecycle">Build Lifecycle</h2>
|
|
61
|
-
<p>When <code>slice.build()</code> is called, the following steps occur:</p>
|
|
62
|
-
<div class="lifecycle-diagram">
|
|
63
|
-
<ol class="lifecycle-steps">
|
|
64
|
-
<li><div class="step-number">1</div><div class="step-content">Verify that the component exists in the component registry</div></li>
|
|
65
|
-
<li><div class="step-number">2</div><div class="step-content">Load the component's template (HTML) if not already cached</div></li>
|
|
66
|
-
<li><div class="step-number">3</div><div class="step-content">Load the component's class (JS) if not already cached</div></li>
|
|
67
|
-
<li><div class="step-number">4</div><div class="step-content">Load the component's styles (CSS) if not already cached</div></li>
|
|
68
|
-
<li><div class="step-number">5</div><div class="step-content">Create an instance of the component with the provided properties</div></li>
|
|
69
|
-
<li><div class="step-number">6</div><div class="step-content">Call the component's <code>init()</code> method if it exists</div></li>
|
|
70
|
-
<li><div class="step-number">7</div><div class="step-content">Attach debug mode if enabled in configuration</div></li>
|
|
71
|
-
<li><div class="step-number">8</div><div class="step-content">Register the component in the controller's active components registry</div></li>
|
|
72
|
-
<li><div class="step-number">9</div><div class="step-content">Return the fully initialized component instance</div></li>
|
|
73
|
-
</ol>
|
|
74
|
-
</div>
|
|
75
|
-
</section>
|
|
76
|
-
|
|
77
|
-
<section class="method-best-practices">
|
|
78
|
-
<h2 id="best-practices">Best Practices</h2>
|
|
79
|
-
<div class="best-practices-container">
|
|
80
|
-
<ul class="best-practices-list">
|
|
81
|
-
<li><span class="practice-icon">✓</span> Always use <code>await</code> with <code>slice.build()</code> since it returns a Promise</li>
|
|
82
|
-
<li><span class="practice-icon">✓</span> Provide a unique <code>sliceId</code> for components that need to be referenced later</li>
|
|
83
|
-
<li><span class="practice-icon">✓</span> Implement proper error handling around component building</li>
|
|
84
|
-
<li><span class="practice-icon">✓</span> Use the component's <code>init()</code> method for additional setup rather than the constructor</li>
|
|
85
|
-
<li><span class="practice-icon">✓</span> Remember that component properties are set after construction but before initialization</li>
|
|
86
|
-
</ul>
|
|
87
|
-
</div>
|
|
88
|
-
</section>
|
|
89
|
-
</div>
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
export default class TheBuildMethod extends HTMLElement {
|
|
2
|
-
constructor(props) {
|
|
3
|
-
super();
|
|
4
|
-
slice.attachTemplate(this);
|
|
5
|
-
|
|
6
|
-
slice.controller.setComponentProps(this, props);
|
|
7
|
-
this.debuggerProps = [];
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
async init() {
|
|
11
|
-
// Crear ejemplos de código para la documentación
|
|
12
|
-
const basicBuildExample = await slice.build('CodeVisualizer', {
|
|
13
|
-
value: `// Construir un componente básico
|
|
14
|
-
const myButton = await slice.build("Button", {
|
|
15
|
-
value: "Click me!"
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
// Añadir el componente al DOM
|
|
19
|
-
document.querySelector("#container").appendChild(myButton);`,
|
|
20
|
-
language: 'javascript'
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const advancedBuildExample = await slice.build('CodeVisualizer', {
|
|
24
|
-
value: `// Componente con propiedades más avanzadas
|
|
25
|
-
const customCard = await slice.build("Card", {
|
|
26
|
-
title: "Custom Card",
|
|
27
|
-
text: "This is a custom card with specific styling",
|
|
28
|
-
icon: {
|
|
29
|
-
name: "github",
|
|
30
|
-
iconStyle: "filled"
|
|
31
|
-
},
|
|
32
|
-
customColor: {
|
|
33
|
-
card: "#3a0ca3",
|
|
34
|
-
icon: "#f72585"
|
|
35
|
-
},
|
|
36
|
-
sliceId: "my-custom-card" // ID personalizado para referencia futura
|
|
37
|
-
});`,
|
|
38
|
-
language: 'javascript'
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
const nestedComponentsExample = await slice.build('CodeVisualizer', {
|
|
42
|
-
value: `// Construcción de componentes anidados
|
|
43
|
-
const grid = await slice.build("Grid", {
|
|
44
|
-
columns: 2,
|
|
45
|
-
rows: 1
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// Construir componentes hijos
|
|
49
|
-
const card1 = await slice.build("Card", {
|
|
50
|
-
title: "First Card"
|
|
51
|
-
});
|
|
52
|
-
const card2 = await slice.build("Card", {
|
|
53
|
-
title: "Second Card"
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// Añadir componentes hijos al grid
|
|
57
|
-
await grid.setItem(card1);
|
|
58
|
-
await grid.setItem(card2);
|
|
59
|
-
|
|
60
|
-
// Añadir el grid al DOM
|
|
61
|
-
document.body.appendChild(grid);`,
|
|
62
|
-
language: 'javascript'
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
const errorHandlingExample = await slice.build('CodeVisualizer', {
|
|
66
|
-
value: `// Manejo de errores al construir componentes
|
|
67
|
-
try {
|
|
68
|
-
const component = await slice.build("NonExistentComponent", {});
|
|
69
|
-
if (!component) {
|
|
70
|
-
console.error("Component could not be built");
|
|
71
|
-
}
|
|
72
|
-
} catch (error) {
|
|
73
|
-
console.error("Error building component:", error);
|
|
74
|
-
}`,
|
|
75
|
-
language: 'javascript'
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
// Añadir los ejemplos al DOM
|
|
79
|
-
this.querySelector('.basic-example-container').appendChild(basicBuildExample);
|
|
80
|
-
this.querySelector('.advanced-example-container').appendChild(advancedBuildExample);
|
|
81
|
-
this.querySelector('.nested-components-container').appendChild(nestedComponentsExample);
|
|
82
|
-
this.querySelector('.error-handling-container').appendChild(errorHandlingExample);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
customElements.define('slice-the-build-method', TheBuildMethod);
|