slicejs-web-framework 1.0.16 → 1.0.17
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/package.json +1 -1
- package/src/Components/AppComponents/DocumentationPage/DocumentationPage.js +1 -1
- package/src/Components/AppComponents/Installation/Installation.css +185 -0
- package/src/Components/AppComponents/Installation/Installation.html +102 -0
- package/src/Components/AppComponents/Installation/Installation.js +61 -0
- package/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.css +475 -0
- package/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.html +389 -7
- package/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.js +83 -3
- package/src/Components/components.js +3 -2
package/package.json
CHANGED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
slice-installation {
|
|
2
|
+
font-family: var(--font-family);
|
|
3
|
+
color: var(--font-primary-color);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
slice-installation .installation-container {
|
|
7
|
+
width: 100%;
|
|
8
|
+
max-width: 800px;
|
|
9
|
+
margin: 0 auto;
|
|
10
|
+
padding: 20px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
slice-installation h1 {
|
|
14
|
+
color: var(--primary-color);
|
|
15
|
+
margin-bottom: 30px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
slice-installation h2 {
|
|
19
|
+
color: var(--primary-color);
|
|
20
|
+
margin: 30px 0 15px 0;
|
|
21
|
+
padding-bottom: 8px;
|
|
22
|
+
border-bottom: 1px solid var(--secondary-background-color);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
slice-installation .installation-intro {
|
|
26
|
+
font-size: 1.1em;
|
|
27
|
+
line-height: 1.6;
|
|
28
|
+
margin-bottom: 30px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
slice-installation .installation-step {
|
|
32
|
+
margin-bottom: 40px;
|
|
33
|
+
padding: 20px;
|
|
34
|
+
background-color: var(--secondary-background-color);
|
|
35
|
+
border-radius: var(--border-radius-slice);
|
|
36
|
+
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
slice-installation .installation-step-code {
|
|
40
|
+
position: relative;
|
|
41
|
+
margin: 15px 0;
|
|
42
|
+
background-color: var(--primary-background-color);
|
|
43
|
+
border-radius: var(--border-radius-slice);
|
|
44
|
+
border: 1px solid var(--primary-color-shade);
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
slice-installation pre {
|
|
49
|
+
margin: 0;
|
|
50
|
+
padding: 15px;
|
|
51
|
+
overflow-x: auto;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
slice-installation code {
|
|
55
|
+
font-family: 'Courier New', monospace;
|
|
56
|
+
color: var(--font-primary-color);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
slice-installation .copy-button {
|
|
60
|
+
position: absolute;
|
|
61
|
+
top: 5px;
|
|
62
|
+
right: 5px;
|
|
63
|
+
background-color: var(--primary-color);
|
|
64
|
+
color: var(--primary-color-contrast);
|
|
65
|
+
border: none;
|
|
66
|
+
border-radius: var(--border-radius-slice);
|
|
67
|
+
padding: 5px 10px;
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
font-size: 0.8em;
|
|
70
|
+
transition: all 0.3s ease;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
slice-installation .copy-button:hover {
|
|
74
|
+
background-color: var(--secondary-color);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
slice-installation .terminal {
|
|
78
|
+
background-color: #1e1e1e;
|
|
79
|
+
border-radius: var(--border-radius-slice);
|
|
80
|
+
margin: 15px 0;
|
|
81
|
+
overflow: hidden;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
slice-installation .terminal-header {
|
|
85
|
+
background-color: #323232;
|
|
86
|
+
padding: 8px 15px;
|
|
87
|
+
display: flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
slice-installation .terminal-dot {
|
|
92
|
+
height: 12px;
|
|
93
|
+
width: 12px;
|
|
94
|
+
border-radius: 50%;
|
|
95
|
+
margin-right: 6px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
slice-installation .red {
|
|
99
|
+
background-color: #ff5f56;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
slice-installation .yellow {
|
|
103
|
+
background-color: #ffbd2e;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
slice-installation .green {
|
|
107
|
+
background-color: #27c93f;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
slice-installation .terminal-title {
|
|
111
|
+
color: #cccccc;
|
|
112
|
+
margin-left: 10px;
|
|
113
|
+
font-size: 0.9em;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
slice-installation .terminal-content {
|
|
117
|
+
padding: 15px;
|
|
118
|
+
color: #f8f8f2;
|
|
119
|
+
font-family: 'Courier New', monospace;
|
|
120
|
+
font-size: 0.9em;
|
|
121
|
+
line-height: 1.5;
|
|
122
|
+
min-height: 60px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
slice-installation .terminal-output {
|
|
126
|
+
white-space: pre-wrap;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
slice-installation .note {
|
|
130
|
+
font-size: 0.9em;
|
|
131
|
+
font-style: italic;
|
|
132
|
+
color: var(--font-secondary-color);
|
|
133
|
+
margin-top: 10px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
slice-installation .installation-next-steps {
|
|
137
|
+
margin-top: 40px;
|
|
138
|
+
padding: 20px;
|
|
139
|
+
background-color: var(--primary-background-color);
|
|
140
|
+
border: 1px solid var(--primary-color);
|
|
141
|
+
border-radius: var(--border-radius-slice);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
slice-installation .installation-next-steps ul {
|
|
145
|
+
list-style-type: none;
|
|
146
|
+
padding-left: 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
slice-installation .installation-next-steps li {
|
|
150
|
+
margin-bottom: 10px;
|
|
151
|
+
padding-left: 24px;
|
|
152
|
+
position: relative;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
slice-installation .installation-next-steps li:before {
|
|
156
|
+
content: "→";
|
|
157
|
+
position: absolute;
|
|
158
|
+
left: 0;
|
|
159
|
+
color: var(--primary-color);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
slice-installation .installation-next-steps code {
|
|
163
|
+
background-color: var(--secondary-background-color);
|
|
164
|
+
padding: 2px 6px;
|
|
165
|
+
border-radius: 3px;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
@media only screen and (max-width: 770px) {
|
|
169
|
+
slice-installation .installation-container {
|
|
170
|
+
padding: 10px;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
slice-installation .installation-step {
|
|
174
|
+
padding: 15px;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
slice-installation pre {
|
|
178
|
+
padding: 10px;
|
|
179
|
+
font-size: 0.9em;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
slice-installation .terminal-content {
|
|
183
|
+
font-size: 0.8em;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<div class="installation-container">
|
|
2
|
+
<h1 id="installation-title">Installation Guide</h1>
|
|
3
|
+
|
|
4
|
+
<p class="installation-intro">
|
|
5
|
+
Getting started with Slice.js is easy! Follow these simple steps to create your first Slice.js project:
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<div class="installation-steps">
|
|
9
|
+
<div class="installation-step">
|
|
10
|
+
<h2 id="step1">Step 1: Initialize your project</h2>
|
|
11
|
+
<p>First, create a new directory for your project and initialize it with npm:</p>
|
|
12
|
+
<div class="installation-step-code">
|
|
13
|
+
<pre><code>npm init</code></pre>
|
|
14
|
+
<button class="copy-button">Copy</button>
|
|
15
|
+
</div>
|
|
16
|
+
<div class="terminal">
|
|
17
|
+
<div class="terminal-header">
|
|
18
|
+
<span class="terminal-dot red"></span>
|
|
19
|
+
<span class="terminal-dot yellow"></span>
|
|
20
|
+
<span class="terminal-dot green"></span>
|
|
21
|
+
<span class="terminal-title">Terminal</span>
|
|
22
|
+
</div>
|
|
23
|
+
<div class="terminal-content">
|
|
24
|
+
<div class="terminal-output">Follow the prompts to set up your package.json file. You can press Enter to accept the default values or customize as needed.</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<div class="installation-step">
|
|
30
|
+
<h2 id="step2">Step 2: Install Slice.js CLI</h2>
|
|
31
|
+
<p>Next, install the Slice.js CLI tool which will help you create components and manage your project:</p>
|
|
32
|
+
<div class="installation-step-code">
|
|
33
|
+
<pre><code>npm i slicejs-cli</code></pre>
|
|
34
|
+
<button class="copy-button">Copy</button>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="terminal">
|
|
37
|
+
<div class="terminal-header">
|
|
38
|
+
<span class="terminal-dot red"></span>
|
|
39
|
+
<span class="terminal-dot yellow"></span>
|
|
40
|
+
<span class="terminal-dot green"></span>
|
|
41
|
+
<span class="terminal-title">Terminal</span>
|
|
42
|
+
</div>
|
|
43
|
+
<div class="terminal-content">
|
|
44
|
+
<div class="terminal-output">added X packages, and audited Y packages in Zs</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<div class="installation-step">
|
|
50
|
+
<h2 id="step3">Step 3: Initialize Slice.js</h2>
|
|
51
|
+
<p>Initialize the Slice.js folder structure in your project:</p>
|
|
52
|
+
<div class="installation-step-code">
|
|
53
|
+
<pre><code>npm run slice:init</code></pre>
|
|
54
|
+
<button class="copy-button">Copy</button>
|
|
55
|
+
</div>
|
|
56
|
+
<div class="terminal">
|
|
57
|
+
<div class="terminal-header">
|
|
58
|
+
<span class="terminal-dot red"></span>
|
|
59
|
+
<span class="terminal-dot yellow"></span>
|
|
60
|
+
<span class="terminal-dot green"></span>
|
|
61
|
+
<span class="terminal-title">Terminal</span>
|
|
62
|
+
</div>
|
|
63
|
+
<div class="terminal-content">
|
|
64
|
+
<div class="terminal-output">Creating folder structure...
|
|
65
|
+
Slice framework initialized successfully!</div>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
<p class="note">This command creates the necessary folder structure for your Slice.js project, including directories for components, styles, and themes.</p>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<div class="installation-step">
|
|
72
|
+
<h2 id="step4">Step 4: Start the Server</h2>
|
|
73
|
+
<p>Finally, start the development server to see your Slice.js application in action:</p>
|
|
74
|
+
<div class="installation-step-code">
|
|
75
|
+
<pre><code>npm run slice:start</code></pre>
|
|
76
|
+
<button class="copy-button">Copy</button>
|
|
77
|
+
</div>
|
|
78
|
+
<div class="terminal">
|
|
79
|
+
<div class="terminal-header">
|
|
80
|
+
<span class="terminal-dot red"></span>
|
|
81
|
+
<span class="terminal-dot yellow"></span>
|
|
82
|
+
<span class="terminal-dot green"></span>
|
|
83
|
+
<span class="terminal-title">Terminal</span>
|
|
84
|
+
</div>
|
|
85
|
+
<div class="terminal-content">
|
|
86
|
+
<div class="terminal-output">Server is running on port 3001, http://localhost:3001</div>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
<div class="installation-next-steps">
|
|
93
|
+
<h2 id="next-steps">Next Steps</h2>
|
|
94
|
+
<p>Congratulations! You've successfully set up your Slice.js project. Here's what you can do next:</p>
|
|
95
|
+
<ul>
|
|
96
|
+
<li>Explore the documentation to learn about components</li>
|
|
97
|
+
<li>Create your first component with <code>npm run slice:create</code></li>
|
|
98
|
+
<li>Check out the built-in Visual components library</li>
|
|
99
|
+
<li>Build your application by adding routes and services</li>
|
|
100
|
+
</ul>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export default class Installation 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
|
+
// Add code for installation steps visualization
|
|
12
|
+
|
|
13
|
+
// Get all code blocks with copy buttons
|
|
14
|
+
const codeBlocks = this.querySelectorAll('.installation-step-code');
|
|
15
|
+
|
|
16
|
+
// Add copy functionality to each code block
|
|
17
|
+
codeBlocks.forEach(block => {
|
|
18
|
+
const copyButton = block.querySelector('.copy-button');
|
|
19
|
+
const codeText = block.querySelector('code');
|
|
20
|
+
|
|
21
|
+
copyButton.addEventListener('click', () => {
|
|
22
|
+
navigator.clipboard.writeText(codeText.textContent.trim());
|
|
23
|
+
copyButton.textContent = 'Copied!';
|
|
24
|
+
|
|
25
|
+
setTimeout(() => {
|
|
26
|
+
copyButton.textContent = 'Copy';
|
|
27
|
+
}, 2000);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Add animation for terminal output
|
|
32
|
+
const terminals = this.querySelectorAll('.terminal-output');
|
|
33
|
+
terminals.forEach(terminal => {
|
|
34
|
+
const text = terminal.textContent;
|
|
35
|
+
terminal.textContent = '';
|
|
36
|
+
let i = 0;
|
|
37
|
+
|
|
38
|
+
const typeEffect = () => {
|
|
39
|
+
if (i < text.length) {
|
|
40
|
+
terminal.textContent += text.charAt(i);
|
|
41
|
+
i++;
|
|
42
|
+
setTimeout(typeEffect, 10);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// Start the typing effect when element is in view
|
|
47
|
+
const observer = new IntersectionObserver(entries => {
|
|
48
|
+
entries.forEach(entry => {
|
|
49
|
+
if (entry.isIntersecting) {
|
|
50
|
+
typeEffect();
|
|
51
|
+
observer.unobserve(entry.target);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
observer.observe(terminal);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
customElements.define('slice-installation', Installation);
|
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
slice-whatisslice {
|
|
2
|
+
font-family: var(--font-family);
|
|
3
|
+
color: var(--font-primary-color);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
slice-whatisslice .whatisslice-container {
|
|
7
|
+
max-width: 1000px;
|
|
8
|
+
margin: 0 auto;
|
|
9
|
+
padding: 20px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
slice-whatisslice h1 {
|
|
13
|
+
color: var(--primary-color);
|
|
14
|
+
font-size: 2.5em;
|
|
15
|
+
margin-bottom: 30px;
|
|
16
|
+
text-align: center;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
slice-whatisslice h2 {
|
|
20
|
+
color: var(--primary-color);
|
|
21
|
+
font-size: 1.8em;
|
|
22
|
+
margin: 40px 0 20px;
|
|
23
|
+
padding-bottom: 8px;
|
|
24
|
+
border-bottom: 1px solid var(--secondary-background-color);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
slice-whatisslice h3 {
|
|
28
|
+
color: var(--font-primary-color);
|
|
29
|
+
font-size: 1.4em;
|
|
30
|
+
margin: 20px 0 15px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
slice-whatisslice h4 {
|
|
34
|
+
font-size: 1.2em;
|
|
35
|
+
margin: 15px 0 10px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
slice-whatisslice p {
|
|
39
|
+
line-height: 1.6;
|
|
40
|
+
margin-bottom: 15px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Intro Section */
|
|
44
|
+
slice-whatisslice .intro-section {
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
margin: 30px 0;
|
|
48
|
+
gap: 40px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
slice-whatisslice .intro-text {
|
|
52
|
+
flex: 3;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
slice-whatisslice .intro-image {
|
|
56
|
+
flex: 1;
|
|
57
|
+
display: flex;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
align-items: center;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
slice-whatisslice .slice-logo-container {
|
|
63
|
+
width: 150px;
|
|
64
|
+
height: 186px;
|
|
65
|
+
position: relative;
|
|
66
|
+
display: flex;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
align-items: center;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
slice-whatisslice .slice-logo {
|
|
73
|
+
max-width: 200px;
|
|
74
|
+
height: auto;
|
|
75
|
+
transition: transform 0.3s ease;
|
|
76
|
+
/* Apply theme's primary color using CSS filter */
|
|
77
|
+
filter: brightness(0) saturate(100%) drop-shadow(0 0 0.1rem var(--primary-color));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
slice-whatisslice .slice-logo-container:hover .slice-logo {
|
|
81
|
+
transform: scale(1.05);
|
|
82
|
+
filter: brightness(0) saturate(100%) drop-shadow(0 0 0.2rem var(--primary-color));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* Tabs */
|
|
86
|
+
slice-whatisslice .tabs-container {
|
|
87
|
+
margin: 40px 0;
|
|
88
|
+
border-radius: var(--border-radius-slice);
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
slice-whatisslice .tabs {
|
|
94
|
+
display: flex;
|
|
95
|
+
background-color: var(--secondary-background-color);
|
|
96
|
+
border-bottom: 1px solid var(--primary-color-shade);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
slice-whatisslice .tab {
|
|
100
|
+
padding: 15px 20px;
|
|
101
|
+
cursor: pointer;
|
|
102
|
+
transition: all 0.3s ease;
|
|
103
|
+
font-weight: bold;
|
|
104
|
+
text-align: center;
|
|
105
|
+
flex: 1;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
slice-whatisslice .tab:hover {
|
|
109
|
+
background-color: var(--primary-background-color);
|
|
110
|
+
color: var(--primary-color);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
slice-whatisslice .tab.active {
|
|
114
|
+
background-color: var(--primary-color);
|
|
115
|
+
color: var(--primary-color-contrast);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
slice-whatisslice .tab-contents {
|
|
119
|
+
background-color: var(--primary-background-color);
|
|
120
|
+
padding: 25px;
|
|
121
|
+
min-height: 400px;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
slice-whatisslice .tab-content {
|
|
125
|
+
display: none;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
slice-whatisslice .tab-content.active {
|
|
129
|
+
display: block;
|
|
130
|
+
animation: fadeIn 0.5s ease;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* Core Principles Grid */
|
|
134
|
+
slice-whatisslice .principles-grid {
|
|
135
|
+
display: grid;
|
|
136
|
+
grid-template-columns: repeat(2, 1fr);
|
|
137
|
+
gap: 25px;
|
|
138
|
+
margin: 30px 0;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
slice-whatisslice .principle {
|
|
142
|
+
background-color: var(--secondary-background-color);
|
|
143
|
+
padding: 20px;
|
|
144
|
+
border-radius: var(--border-radius-slice);
|
|
145
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
146
|
+
transition: transform 0.3s ease;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
slice-whatisslice .principle:hover {
|
|
150
|
+
transform: translateY(-5px);
|
|
151
|
+
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
slice-whatisslice .principle h3 {
|
|
155
|
+
color: var(--primary-color);
|
|
156
|
+
margin-top: 0;
|
|
157
|
+
border-bottom: 1px solid var(--primary-color-shade);
|
|
158
|
+
padding-bottom: 8px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/* Features List */
|
|
162
|
+
slice-whatisslice .features-list {
|
|
163
|
+
list-style: none;
|
|
164
|
+
padding-left: 0;
|
|
165
|
+
margin: 20px 0;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
slice-whatisslice .features-list li {
|
|
169
|
+
margin-bottom: 12px;
|
|
170
|
+
padding-left: 30px;
|
|
171
|
+
position: relative;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
slice-whatisslice .features-list li:before {
|
|
175
|
+
content: "✓";
|
|
176
|
+
position: absolute;
|
|
177
|
+
left: 0;
|
|
178
|
+
color: var(--primary-color);
|
|
179
|
+
font-weight: bold;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
slice-whatisslice .feature-highlight {
|
|
183
|
+
color: var(--primary-color);
|
|
184
|
+
font-weight: bold;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/* Architecture Diagram */
|
|
188
|
+
slice-whatisslice .architecture-diagram {
|
|
189
|
+
display: flex;
|
|
190
|
+
flex-direction: column;
|
|
191
|
+
gap: 20px;
|
|
192
|
+
margin: 30px 0;
|
|
193
|
+
position: relative;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
slice-whatisslice .component-box {
|
|
197
|
+
padding: 20px;
|
|
198
|
+
border-radius: var(--border-radius-slice);
|
|
199
|
+
text-align: center;
|
|
200
|
+
cursor: pointer;
|
|
201
|
+
transition: all 0.3s ease;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
slice-whatisslice .component-box h3 {
|
|
205
|
+
margin: 0 0 10px;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
slice-whatisslice .component-box p {
|
|
209
|
+
margin: 0;
|
|
210
|
+
font-size: 0.9em;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
slice-whatisslice .component-box.visual {
|
|
214
|
+
background-color: rgba(var(--primary-color-rgb), 0.15);
|
|
215
|
+
border: 2px solid var(--primary-color);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
slice-whatisslice .component-box.structural {
|
|
219
|
+
background-color: rgba(var(--secondary-color-rgb), 0.15);
|
|
220
|
+
border: 2px solid var(--secondary-color);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
slice-whatisslice .component-box.service {
|
|
224
|
+
background-color: var(--secondary-background-color);
|
|
225
|
+
border: 2px solid var(--font-primary-color);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
slice-whatisslice .component-description {
|
|
229
|
+
position: absolute;
|
|
230
|
+
right: 0;
|
|
231
|
+
top: 50%;
|
|
232
|
+
transform: translateY(-50%);
|
|
233
|
+
width: 250px;
|
|
234
|
+
background-color: var(--primary-background-color);
|
|
235
|
+
border: 1px solid var(--primary-color-shade);
|
|
236
|
+
border-radius: var(--border-radius-slice);
|
|
237
|
+
padding: 15px;
|
|
238
|
+
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
|
|
239
|
+
opacity: 0;
|
|
240
|
+
visibility: hidden;
|
|
241
|
+
transition: all 0.3s ease;
|
|
242
|
+
z-index: 2;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
slice-whatisslice .component-description.visible {
|
|
246
|
+
opacity: 1;
|
|
247
|
+
visibility: visible;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
slice-whatisslice .component-description h4 {
|
|
251
|
+
margin-top: 0;
|
|
252
|
+
color: var(--primary-color);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
slice-whatisslice .component-description code {
|
|
256
|
+
display: block;
|
|
257
|
+
background-color: var(--secondary-background-color);
|
|
258
|
+
padding: 5px;
|
|
259
|
+
margin-top: 10px;
|
|
260
|
+
font-family: monospace;
|
|
261
|
+
border-radius: 3px;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/* Data Flow */
|
|
265
|
+
slice-whatisslice .data-flow {
|
|
266
|
+
margin: 20px 0;
|
|
267
|
+
padding-left: 25px;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
slice-whatisslice .data-flow li {
|
|
271
|
+
margin-bottom: 10px;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/* Component Sections */
|
|
275
|
+
slice-whatisslice .component-section {
|
|
276
|
+
margin-bottom: 40px;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
slice-whatisslice .code-example {
|
|
280
|
+
background-color: var(--secondary-background-color);
|
|
281
|
+
border-radius: var(--border-radius-slice);
|
|
282
|
+
overflow: hidden;
|
|
283
|
+
margin: 20px 0;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
slice-whatisslice pre {
|
|
287
|
+
margin: 0;
|
|
288
|
+
padding: 15px;
|
|
289
|
+
overflow-x: auto;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
slice-whatisslice code {
|
|
293
|
+
font-family: 'Courier New', monospace;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
slice-whatisslice .lifecycle-list {
|
|
297
|
+
list-style: none;
|
|
298
|
+
padding-left: 0;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
slice-whatisslice .lifecycle-list li {
|
|
302
|
+
margin-bottom: 10px;
|
|
303
|
+
padding-left: 20px;
|
|
304
|
+
position: relative;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
slice-whatisslice .lifecycle-list li:before {
|
|
308
|
+
content: "•";
|
|
309
|
+
position: absolute;
|
|
310
|
+
left: 0;
|
|
311
|
+
color: var(--primary-color);
|
|
312
|
+
font-size: 1.5em;
|
|
313
|
+
line-height: 0.8;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/* Code Files */
|
|
317
|
+
slice-whatisslice .code-files {
|
|
318
|
+
display: flex;
|
|
319
|
+
flex-direction: column;
|
|
320
|
+
gap: 20px;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
slice-whatisslice .code-file {
|
|
324
|
+
flex: 1;
|
|
325
|
+
background-color: var(--secondary-background-color);
|
|
326
|
+
border-radius: var(--border-radius-slice);
|
|
327
|
+
overflow: hidden;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
slice-whatisslice .code-file h4 {
|
|
331
|
+
background-color: var(--primary-color);
|
|
332
|
+
color: var(--primary-color-contrast);
|
|
333
|
+
margin: 0;
|
|
334
|
+
padding: 8px 15px;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/* Benefits Grid */
|
|
338
|
+
slice-whatisslice .benefits-grid {
|
|
339
|
+
display: grid;
|
|
340
|
+
grid-template-columns: repeat(2, 1fr);
|
|
341
|
+
gap: 25px;
|
|
342
|
+
margin: 30px 0;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
slice-whatisslice .benefit {
|
|
346
|
+
background-color: var(--secondary-background-color);
|
|
347
|
+
padding: 20px;
|
|
348
|
+
border-radius: var(--border-radius-slice);
|
|
349
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
350
|
+
transition: all 0.3s ease;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
slice-whatisslice .benefit:hover {
|
|
354
|
+
transform: translateY(-5px);
|
|
355
|
+
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
slice-whatisslice .benefit h3 {
|
|
359
|
+
color: var(--primary-color);
|
|
360
|
+
margin-top: 0;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/* Comparison Table */
|
|
364
|
+
slice-whatisslice .comparison-section {
|
|
365
|
+
margin: 40px 0;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
slice-whatisslice .comparison-table {
|
|
369
|
+
overflow-x: auto;
|
|
370
|
+
margin: 20px 0;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
slice-whatisslice table {
|
|
374
|
+
width: 100%;
|
|
375
|
+
border-collapse: collapse;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
slice-whatisslice th,
|
|
379
|
+
slice-whatisslice td {
|
|
380
|
+
padding: 12px 15px;
|
|
381
|
+
text-align: center;
|
|
382
|
+
border: 1px solid var(--primary-color-shade);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
slice-whatisslice th {
|
|
386
|
+
background-color: var(--primary-color);
|
|
387
|
+
color: var(--primary-color-contrast);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
slice-whatisslice tr:nth-child(even) {
|
|
391
|
+
background-color: var(--secondary-background-color);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/* Get Started Section */
|
|
395
|
+
slice-whatisslice .get-started-section {
|
|
396
|
+
background-color: var(--secondary-background-color);
|
|
397
|
+
border-radius: var(--border-radius-slice);
|
|
398
|
+
padding: 30px;
|
|
399
|
+
margin: 40px 0 20px;
|
|
400
|
+
text-align: center;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
slice-whatisslice .action-buttons {
|
|
404
|
+
display: flex;
|
|
405
|
+
justify-content: center;
|
|
406
|
+
gap: 20px;
|
|
407
|
+
margin-top: 25px;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
slice-whatisslice .action-button {
|
|
411
|
+
background-color: var(--primary-color);
|
|
412
|
+
color: var(--primary-color-contrast);
|
|
413
|
+
text-decoration: none;
|
|
414
|
+
padding: 12px 25px;
|
|
415
|
+
border-radius: var(--border-radius-slice);
|
|
416
|
+
font-weight: bold;
|
|
417
|
+
transition: all 0.3s ease;
|
|
418
|
+
display: inline-block;
|
|
419
|
+
border: none;
|
|
420
|
+
cursor: pointer;
|
|
421
|
+
font-size: 1em;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
slice-whatisslice .action-button:hover {
|
|
425
|
+
background-color: var(--secondary-color);
|
|
426
|
+
transform: translateY(-3px);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
slice-whatisslice .action-button.github {
|
|
430
|
+
background-color: #333;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
slice-whatisslice .action-button.github:hover {
|
|
434
|
+
background-color: #555;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/* Animations */
|
|
438
|
+
@keyframes fadeIn {
|
|
439
|
+
from { opacity: 0; }
|
|
440
|
+
to { opacity: 1; }
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/* Responsive Design */
|
|
444
|
+
@media (max-width: 768px) {
|
|
445
|
+
slice-whatisslice .intro-section {
|
|
446
|
+
flex-direction: column;
|
|
447
|
+
gap: 20px;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
slice-whatisslice .principles-grid,
|
|
451
|
+
slice-whatisslice .benefits-grid {
|
|
452
|
+
grid-template-columns: 1fr;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
slice-whatisslice .tabs {
|
|
456
|
+
flex-direction: column;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
slice-whatisslice .action-buttons {
|
|
460
|
+
flex-direction: column;
|
|
461
|
+
align-items: center;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
slice-whatisslice .component-description {
|
|
465
|
+
position: static;
|
|
466
|
+
width: auto;
|
|
467
|
+
transform: none;
|
|
468
|
+
margin-top: 10px;
|
|
469
|
+
display: none;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
slice-whatisslice .component-description.visible {
|
|
473
|
+
display: block;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
@@ -1,7 +1,389 @@
|
|
|
1
|
-
<
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
<p>
|
|
7
|
-
|
|
1
|
+
<div class="whatisslice-container">
|
|
2
|
+
<h1 id="title">What is Slice.js?</h1>
|
|
3
|
+
|
|
4
|
+
<div class="intro-section">
|
|
5
|
+
<div class="intro-text">
|
|
6
|
+
<p>Slice.js is a lightweight, component-based web framework built on vanilla JavaScript that embraces modern web standards. It provides a modular approach to building web applications with reusable components while maintaining the simplicity and performance of native browser technologies.</p>
|
|
7
|
+
<p>Designed for developers who appreciate clean architecture and minimal dependencies, Slice.js offers powerful features without introducing unnecessary complexity or bloat.</p>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="intro-image">
|
|
10
|
+
<div class="slice-logo-container">
|
|
11
|
+
<img src="/images/Slice.js-logo.png" alt="Slice.js Logo" class="slice-logo">
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div class="tabs-container">
|
|
17
|
+
<div class="tabs">
|
|
18
|
+
<div class="tab active" data-tab="overview">Overview</div>
|
|
19
|
+
<div class="tab" data-tab="architecture">Architecture</div>
|
|
20
|
+
<div class="tab" data-tab="components">Components</div>
|
|
21
|
+
<div class="tab" data-tab="examples">Examples</div>
|
|
22
|
+
<div class="tab" data-tab="benefits">Benefits</div>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<div class="tab-contents">
|
|
26
|
+
<!-- Overview Tab -->
|
|
27
|
+
<div class="tab-content active" data-tab="overview">
|
|
28
|
+
<h2>Core Principles</h2>
|
|
29
|
+
<div class="principles-grid">
|
|
30
|
+
<div class="principle">
|
|
31
|
+
<h3>Component-Based</h3>
|
|
32
|
+
<p>Build your application with reusable, encapsulated components that combine HTML, CSS, and JavaScript.</p>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="principle">
|
|
35
|
+
<h3>Native Web Standards</h3>
|
|
36
|
+
<p>Built on Web Components and other standard browser APIs without requiring transpilation or complex build steps.</p>
|
|
37
|
+
</div>
|
|
38
|
+
<div class="principle">
|
|
39
|
+
<h3>Modular Architecture</h3>
|
|
40
|
+
<p>Organize your code into logical modules with clear separation of concerns between visual elements, services, and structure.</p>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="principle">
|
|
43
|
+
<h3>Developer Experience</h3>
|
|
44
|
+
<p>Simple, intuitive API with built-in debugging tools and clear documentation to accelerate development.</p>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<h2>Key Features</h2>
|
|
49
|
+
<ul class="features-list">
|
|
50
|
+
<li><span class="feature-highlight">Slice.build</span>: Create and manage component instances with a simple API</li>
|
|
51
|
+
<li><span class="feature-highlight">Component Lifecycle</span>: Control component behavior with initialization and update methods</li>
|
|
52
|
+
<li><span class="feature-highlight">Theming System</span>: Switch between themes with built-in theme manager</li>
|
|
53
|
+
<li><span class="feature-highlight">Routing</span>: Simple yet powerful routing for single-page applications</li>
|
|
54
|
+
<li><span class="feature-highlight">Visual Components Library</span>: Pre-built UI components ready to use</li>
|
|
55
|
+
<li><span class="feature-highlight">Service Components</span>: Handle business logic and external integrations</li>
|
|
56
|
+
<li><span class="feature-highlight">Development Tools</span>: Built-in debugging and component inspection</li>
|
|
57
|
+
</ul>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<!-- Architecture Tab -->
|
|
61
|
+
<div class="tab-content" data-tab="architecture">
|
|
62
|
+
<h2>Slice.js Architecture</h2>
|
|
63
|
+
<p>Slice.js is built on a three-layered architecture that separates concerns and promotes maintainable code:</p>
|
|
64
|
+
|
|
65
|
+
<div class="architecture-diagram">
|
|
66
|
+
<div class="component-box visual" data-type="visual">
|
|
67
|
+
<h3>Visual Components</h3>
|
|
68
|
+
<p>UI Elements</p>
|
|
69
|
+
</div>
|
|
70
|
+
<div class="component-box structural" data-type="structural">
|
|
71
|
+
<h3>Structural Components</h3>
|
|
72
|
+
<p>Core Framework</p>
|
|
73
|
+
</div>
|
|
74
|
+
<div class="component-box service" data-type="service">
|
|
75
|
+
<h3>Service Components</h3>
|
|
76
|
+
<p>Business Logic</p>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<div class="component-description" data-type="visual">
|
|
80
|
+
<h4>Visual Components</h4>
|
|
81
|
+
<p>Build the user interface of your application. These components render HTML, handle user interactions, and manage UI state. Examples include buttons, inputs, cards, and navigation elements.</p>
|
|
82
|
+
<code>Button.js, Card.js, Input.js</code>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<div class="component-description" data-type="structural">
|
|
86
|
+
<h4>Structural Components</h4>
|
|
87
|
+
<p>Form the backbone of the framework. These components manage the application lifecycle, routing, component registration, and other core functionality. They're mostly internal but can be customized if needed.</p>
|
|
88
|
+
<code>Router.js, Controller.js, StylesManager.js</code>
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
<div class="component-description" data-type="service">
|
|
92
|
+
<h4>Service Components</h4>
|
|
93
|
+
<p>Handle business logic, data processing, and external integrations. These components provide services to visual components and often interact with APIs, databases, or browser APIs.</p>
|
|
94
|
+
<code>FetchManager.js, IndexedDbManager.js, LocalStorageManager.js</code>
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
<h3>Data Flow</h3>
|
|
99
|
+
<p>Data in Slice.js flows in a predictable manner:</p>
|
|
100
|
+
<ol class="data-flow">
|
|
101
|
+
<li>User interacts with Visual Components</li>
|
|
102
|
+
<li>Visual Components call Service Components for data or business logic</li>
|
|
103
|
+
<li>Service Components process data and return results</li>
|
|
104
|
+
<li>Visual Components update the UI based on the results</li>
|
|
105
|
+
<li>Structural Components manage the lifecycle and coordination</li>
|
|
106
|
+
</ol>
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<!-- Components Tab -->
|
|
110
|
+
<div class="tab-content" data-tab="components">
|
|
111
|
+
<h2>Component Types</h2>
|
|
112
|
+
|
|
113
|
+
<div class="component-section">
|
|
114
|
+
<h3>Visual Components</h3>
|
|
115
|
+
<p>These components build your user interface and extend the <code>HTMLElement</code> class, leveraging the Web Components standard.</p>
|
|
116
|
+
|
|
117
|
+
<div class="code-example">
|
|
118
|
+
<pre><code class="language-javascript">export default class Button extends HTMLElement {
|
|
119
|
+
constructor(props) {
|
|
120
|
+
super();
|
|
121
|
+
slice.attachTemplate(this);
|
|
122
|
+
this.$value = this.querySelector('.slice_button_value');
|
|
123
|
+
|
|
124
|
+
slice.controller.setComponentProps(this, props);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
get value() {
|
|
128
|
+
return this._value;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
set value(value) {
|
|
132
|
+
this._value = value;
|
|
133
|
+
this.$value.textContent = value;
|
|
134
|
+
}
|
|
135
|
+
}</code></pre>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
|
|
139
|
+
<div class="component-section">
|
|
140
|
+
<h3>Service Components</h3>
|
|
141
|
+
<p>These components handle business logic, data processing, and external integrations.</p>
|
|
142
|
+
|
|
143
|
+
<div class="code-example">
|
|
144
|
+
<pre><code class="language-javascript">export default class FetchManager {
|
|
145
|
+
constructor(props) {
|
|
146
|
+
const { baseUrl, timeout } = props;
|
|
147
|
+
this.baseUrl = baseUrl;
|
|
148
|
+
this.timeout = timeout || 10000;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
async request(method, data, endpoint, onSuccess, onError) {
|
|
152
|
+
// Implementation details
|
|
153
|
+
}
|
|
154
|
+
}</code></pre>
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
<div class="component-section">
|
|
159
|
+
<h3>Component Lifecycle</h3>
|
|
160
|
+
<p>Slice.js components have a simple lifecycle that gives you control over their behavior:</p>
|
|
161
|
+
|
|
162
|
+
<ul class="lifecycle-list">
|
|
163
|
+
<li><strong>constructor</strong>: Initialize properties and set up event listeners</li>
|
|
164
|
+
<li><strong>init</strong>: Called after the component is created, good for async operations</li>
|
|
165
|
+
<li><strong>render</strong> (optional): Update the component's DOM based on props</li>
|
|
166
|
+
<li><strong>update</strong> (optional): Refresh the component when props change</li>
|
|
167
|
+
</ul>
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
<!-- Examples Tab -->
|
|
172
|
+
<div class="tab-content" data-tab="examples">
|
|
173
|
+
<h2>Getting Started with Slice.js</h2>
|
|
174
|
+
|
|
175
|
+
<div class="example-section">
|
|
176
|
+
<h3>Creating a Component</h3>
|
|
177
|
+
<p>Here's how to create a simple counter component in Slice.js:</p>
|
|
178
|
+
|
|
179
|
+
<div class="code-files">
|
|
180
|
+
<div class="code-file">
|
|
181
|
+
<h4>Counter.js</h4>
|
|
182
|
+
<pre><code class="language-javascript">export default class Counter extends HTMLElement {
|
|
183
|
+
constructor(props) {
|
|
184
|
+
super();
|
|
185
|
+
slice.attachTemplate(this);
|
|
186
|
+
|
|
187
|
+
this.$count = this.querySelector('.count');
|
|
188
|
+
this.$increment = this.querySelector('.increment');
|
|
189
|
+
this.$decrement = this.querySelector('.decrement');
|
|
190
|
+
|
|
191
|
+
this.$increment.addEventListener('click', () => this.increment());
|
|
192
|
+
this.$decrement.addEventListener('click', () => this.decrement());
|
|
193
|
+
|
|
194
|
+
slice.controller.setComponentProps(this, props);
|
|
195
|
+
this.debuggerProps = ['count'];
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
init() {
|
|
199
|
+
if (this._count === undefined) {
|
|
200
|
+
this.count = 0;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
get count() {
|
|
205
|
+
return this._count;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
set count(value) {
|
|
209
|
+
this._count = value;
|
|
210
|
+
this.$count.textContent = value;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
increment() {
|
|
214
|
+
this.count++;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
decrement() {
|
|
218
|
+
this.count--;
|
|
219
|
+
}
|
|
220
|
+
}</code></pre>
|
|
221
|
+
</div>
|
|
222
|
+
|
|
223
|
+
<div class="code-file">
|
|
224
|
+
<h4>Counter.html</h4>
|
|
225
|
+
<pre><code class="language-html"><div class="counter-container">
|
|
226
|
+
<button class="decrement">-</button>
|
|
227
|
+
<span class="count">0</span>
|
|
228
|
+
<button class="increment">+</button>
|
|
229
|
+
</div></code></pre>
|
|
230
|
+
</div>
|
|
231
|
+
|
|
232
|
+
<div class="code-file">
|
|
233
|
+
<h4>Counter.css</h4>
|
|
234
|
+
<pre><code class="language-css">slice-counter .counter-container {
|
|
235
|
+
display: flex;
|
|
236
|
+
align-items: center;
|
|
237
|
+
gap: 15px;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
slice-counter button {
|
|
241
|
+
background-color: var(--primary-color);
|
|
242
|
+
color: var(--primary-color-contrast);
|
|
243
|
+
border: none;
|
|
244
|
+
border-radius: var(--border-radius-slice);
|
|
245
|
+
width: 40px;
|
|
246
|
+
height: 40px;
|
|
247
|
+
font-size: 20px;
|
|
248
|
+
cursor: pointer;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
slice-counter .count {
|
|
252
|
+
font-size: 24px;
|
|
253
|
+
min-width: 40px;
|
|
254
|
+
text-align: center;
|
|
255
|
+
}</code></pre>
|
|
256
|
+
</div>
|
|
257
|
+
</div>
|
|
258
|
+
</div>
|
|
259
|
+
|
|
260
|
+
<div class="example-section">
|
|
261
|
+
<h3>Using the Component</h3>
|
|
262
|
+
<p>Once defined, you can use your component like this:</p>
|
|
263
|
+
|
|
264
|
+
<div class="code-example">
|
|
265
|
+
<pre><code class="language-javascript">// Create an instance of the counter
|
|
266
|
+
const counter = await slice.build('Counter', {
|
|
267
|
+
count: 5 // Initial value
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
// Add it to a parent component or container
|
|
271
|
+
const container = slice.getComponent('MainContainer');
|
|
272
|
+
container.appendChild(counter);
|
|
273
|
+
|
|
274
|
+
// Or use it in another component's template
|
|
275
|
+
const mySection = this.querySelector('.my-section');
|
|
276
|
+
mySection.appendChild(counter);
|
|
277
|
+
|
|
278
|
+
// Later, you can access or modify properties
|
|
279
|
+
console.log(counter.count); // 5
|
|
280
|
+
counter.count = 10;</code></pre>
|
|
281
|
+
</div>
|
|
282
|
+
</div>
|
|
283
|
+
</div>
|
|
284
|
+
|
|
285
|
+
<!-- Benefits Tab -->
|
|
286
|
+
<div class="tab-content" data-tab="benefits">
|
|
287
|
+
<h2>Why Choose Slice.js?</h2>
|
|
288
|
+
|
|
289
|
+
<div class="benefits-grid">
|
|
290
|
+
<div class="benefit">
|
|
291
|
+
<h3>Lightweight</h3>
|
|
292
|
+
<p>Minimal footprint without the bloat of larger frameworks, leading to faster load times and better performance.</p>
|
|
293
|
+
</div>
|
|
294
|
+
|
|
295
|
+
<div class="benefit">
|
|
296
|
+
<h3>No Build Step</h3>
|
|
297
|
+
<p>Develop directly with vanilla JavaScript, HTML, and CSS without requiring transpilers, bundlers, or complex build systems.</p>
|
|
298
|
+
</div>
|
|
299
|
+
|
|
300
|
+
<div class="benefit">
|
|
301
|
+
<h3>Easy Learning Curve</h3>
|
|
302
|
+
<p>If you know basic HTML, CSS, and JavaScript, you can start building with Slice.js right away. No new template syntax to learn.</p>
|
|
303
|
+
</div>
|
|
304
|
+
|
|
305
|
+
<div class="benefit">
|
|
306
|
+
<h3>Standards-Based</h3>
|
|
307
|
+
<p>Built on Web Components and other modern browser standards, ensuring compatibility and future-proofing your applications.</p>
|
|
308
|
+
</div>
|
|
309
|
+
|
|
310
|
+
<div class="benefit">
|
|
311
|
+
<h3>Component Library</h3>
|
|
312
|
+
<p>Comes with pre-built, customizable UI components to accelerate development and maintain consistency.</p>
|
|
313
|
+
</div>
|
|
314
|
+
|
|
315
|
+
<div class="benefit">
|
|
316
|
+
<h3>Debugging Tools</h3>
|
|
317
|
+
<p>Built-in tools for inspecting and debugging components, making development easier and more efficient.</p>
|
|
318
|
+
</div>
|
|
319
|
+
</div>
|
|
320
|
+
|
|
321
|
+
<div class="comparison-section">
|
|
322
|
+
<h3>Comparison with Other Frameworks</h3>
|
|
323
|
+
<p>See how Slice.js compares to other popular frameworks:</p>
|
|
324
|
+
|
|
325
|
+
<div class="comparison-table">
|
|
326
|
+
<table>
|
|
327
|
+
<thead>
|
|
328
|
+
<tr>
|
|
329
|
+
<th>Feature</th>
|
|
330
|
+
<th>Slice.js</th>
|
|
331
|
+
<th>React</th>
|
|
332
|
+
<th>Vue</th>
|
|
333
|
+
<th>Angular</th>
|
|
334
|
+
</tr>
|
|
335
|
+
</thead>
|
|
336
|
+
<tbody>
|
|
337
|
+
<tr>
|
|
338
|
+
<td>Build Step Required</td>
|
|
339
|
+
<td>No</td>
|
|
340
|
+
<td>Yes</td>
|
|
341
|
+
<td>Yes</td>
|
|
342
|
+
<td>Yes</td>
|
|
343
|
+
</tr>
|
|
344
|
+
<tr>
|
|
345
|
+
<td>Bundle Size</td>
|
|
346
|
+
<td>Small</td>
|
|
347
|
+
<td>Medium</td>
|
|
348
|
+
<td>Small-Medium</td>
|
|
349
|
+
<td>Large</td>
|
|
350
|
+
</tr>
|
|
351
|
+
<tr>
|
|
352
|
+
<td>Learning Curve</td>
|
|
353
|
+
<td>Low</td>
|
|
354
|
+
<td>Medium</td>
|
|
355
|
+
<td>Low-Medium</td>
|
|
356
|
+
<td>High</td>
|
|
357
|
+
</tr>
|
|
358
|
+
<tr>
|
|
359
|
+
<td>Web Standards Based</td>
|
|
360
|
+
<td>Yes</td>
|
|
361
|
+
<td>Partial</td>
|
|
362
|
+
<td>Partial</td>
|
|
363
|
+
<td>Partial</td>
|
|
364
|
+
</tr>
|
|
365
|
+
<tr>
|
|
366
|
+
<td>Component Encapsulation</td>
|
|
367
|
+
<td>Full (Shadow DOM)</td>
|
|
368
|
+
<td>Partial</td>
|
|
369
|
+
<td>Optional</td>
|
|
370
|
+
<td>Full</td>
|
|
371
|
+
</tr>
|
|
372
|
+
</tbody>
|
|
373
|
+
</table>
|
|
374
|
+
</div>
|
|
375
|
+
</div>
|
|
376
|
+
</div>
|
|
377
|
+
</div>
|
|
378
|
+
</div>
|
|
379
|
+
|
|
380
|
+
<div class="get-started-section">
|
|
381
|
+
<h2>Ready to Get Started?</h2>
|
|
382
|
+
<p>Explore the documentation, install the framework, and build your first Slice.js application:</p>
|
|
383
|
+
<div class="action-buttons">
|
|
384
|
+
<button class="action-button installation-button">Installation Guide</button>
|
|
385
|
+
<button class="action-button components-button">Component Library</button>
|
|
386
|
+
<a href="https://github.com/VKneider/slice.js" target="_blank" class="action-button github">GitHub Repository</a>
|
|
387
|
+
</div>
|
|
388
|
+
</div>
|
|
389
|
+
</div>
|
|
@@ -3,13 +3,93 @@ export default class WhatIsSlice extends HTMLElement {
|
|
|
3
3
|
super();
|
|
4
4
|
slice.attachTemplate(this);
|
|
5
5
|
|
|
6
|
+
this.$tabs = this.querySelectorAll('.tab');
|
|
7
|
+
this.$tabContents = this.querySelectorAll('.tab-content');
|
|
8
|
+
|
|
9
|
+
// Set up tab switching functionality
|
|
10
|
+
this.$tabs.forEach(tab => {
|
|
11
|
+
tab.addEventListener('click', () => {
|
|
12
|
+
const tabId = tab.getAttribute('data-tab');
|
|
13
|
+
this.switchTab(tabId);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
// Set up navigation buttons with Slice Router
|
|
18
|
+
this.setupNavigationButtons();
|
|
19
|
+
|
|
6
20
|
slice.controller.setComponentProps(this, props);
|
|
7
21
|
this.debuggerProps = [];
|
|
8
22
|
}
|
|
9
23
|
|
|
10
|
-
init() {
|
|
11
|
-
|
|
24
|
+
async init() {
|
|
25
|
+
// Set the first tab as active by default
|
|
26
|
+
this.switchTab('overview');
|
|
27
|
+
|
|
28
|
+
// Add animation to code samples for better readability
|
|
29
|
+
this.highlightCode();
|
|
30
|
+
|
|
31
|
+
// Setup diagram interactions
|
|
32
|
+
this.setupDiagramInteractions();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
setupNavigationButtons() {
|
|
36
|
+
// Set up the Installation Guide button
|
|
37
|
+
const installationButton = this.querySelector('.installation-button');
|
|
38
|
+
if (installationButton) {
|
|
39
|
+
installationButton.addEventListener('click', (event) => {
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
slice.router.navigate('/Documentation/Installation');
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Set up the Component Library button
|
|
46
|
+
const componentsButton = this.querySelector('.components-button');
|
|
47
|
+
if (componentsButton) {
|
|
48
|
+
componentsButton.addEventListener('click', (event) => {
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
slice.router.navigate('/Documentation/Components');
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
12
54
|
|
|
55
|
+
switchTab(tabId) {
|
|
56
|
+
// Remove active class from all tabs and tab contents
|
|
57
|
+
this.$tabs.forEach(tab => tab.classList.remove('active'));
|
|
58
|
+
this.$tabContents.forEach(content => content.classList.remove('active'));
|
|
59
|
+
|
|
60
|
+
// Add active class to the selected tab and content
|
|
61
|
+
this.querySelector(`.tab[data-tab="${tabId}"]`).classList.add('active');
|
|
62
|
+
this.querySelector(`.tab-content[data-tab="${tabId}"]`).classList.add('active');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
highlightCode() {
|
|
66
|
+
// Check if Prism is available (for syntax highlighting)
|
|
67
|
+
if (typeof Prism !== 'undefined') {
|
|
68
|
+
Prism.highlightAllUnder(this);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
setupDiagramInteractions() {
|
|
73
|
+
const components = this.querySelectorAll('.component-box');
|
|
74
|
+
|
|
75
|
+
components.forEach(component => {
|
|
76
|
+
component.addEventListener('mouseenter', () => {
|
|
77
|
+
const type = component.getAttribute('data-type');
|
|
78
|
+
const description = this.querySelector(`.component-description[data-type="${type}"]`);
|
|
79
|
+
if (description) {
|
|
80
|
+
description.classList.add('visible');
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
component.addEventListener('mouseleave', () => {
|
|
85
|
+
const type = component.getAttribute('data-type');
|
|
86
|
+
const description = this.querySelector(`.component-description[data-type="${type}"]`);
|
|
87
|
+
if (description) {
|
|
88
|
+
description.classList.remove('visible');
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
13
93
|
}
|
|
14
94
|
|
|
15
|
-
customElements.define("slice-whatisslice", WhatIsSlice);
|
|
95
|
+
customElements.define("slice-whatisslice", WhatIsSlice);
|
|
@@ -6,6 +6,7 @@ const components = {
|
|
|
6
6
|
"Documentation": "AppComponents",
|
|
7
7
|
"DocumentationPage": "AppComponents",
|
|
8
8
|
"InputDocumentation": "AppComponents",
|
|
9
|
+
"Installation": "AppComponents",
|
|
9
10
|
"LandingMenu": "AppComponents",
|
|
10
11
|
"LandingPage": "AppComponents",
|
|
11
12
|
"MainMenu": "AppComponents",
|
|
@@ -16,6 +17,7 @@ const components = {
|
|
|
16
17
|
"ServiceDocumentation": "AppComponents",
|
|
17
18
|
"SliceStylesDocumentation": "AppComponents",
|
|
18
19
|
"SliceTeamCard": "AppComponents",
|
|
20
|
+
"StructuralDocumentation": "AppComponents",
|
|
19
21
|
"SwitchDocumentation": "AppComponents",
|
|
20
22
|
"TheBuildMethod": "AppComponents",
|
|
21
23
|
"ThemesDocumentation": "AppComponents",
|
|
@@ -44,6 +46,5 @@ const components = {
|
|
|
44
46
|
"IndexedDbManager": "Service",
|
|
45
47
|
"Link": "Service",
|
|
46
48
|
"LocalStorageManager": "Service",
|
|
47
|
-
"Translator": "Service"
|
|
48
|
-
"StructuralDocumentation": "AppComponents",
|
|
49
|
+
"Translator": "Service"
|
|
49
50
|
}; export default components;
|