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.
Files changed (82) hide show
  1. package/Slice/Components/Structural/Debugger/Debugger.js +3 -3
  2. package/Slice/Slice.js +2 -1
  3. package/package.json +1 -1
  4. package/src/Components/AppComponents/HomePage/HomePage.css +203 -0
  5. package/src/Components/AppComponents/HomePage/HomePage.html +49 -0
  6. package/src/Components/AppComponents/HomePage/HomePage.js +196 -0
  7. package/src/Components/AppComponents/Playground/Playground.js +0 -15
  8. package/src/Components/components.js +2 -24
  9. package/src/routes.js +4 -86
  10. package/src/sliceConfig.json +0 -3
  11. package/src/Components/AppComponents/ButtonDocumentation/ButtonDocumentation.css +0 -16
  12. package/src/Components/AppComponents/ButtonDocumentation/ButtonDocumentation.html +0 -22
  13. package/src/Components/AppComponents/ButtonDocumentation/ButtonDocumentation.js +0 -102
  14. package/src/Components/AppComponents/CardDocumentation/CardDocumentation.css +0 -15
  15. package/src/Components/AppComponents/CardDocumentation/CardDocumentation.html +0 -38
  16. package/src/Components/AppComponents/CardDocumentation/CardDocumentation.js +0 -113
  17. package/src/Components/AppComponents/CheckboxDocumentation/CheckboxDocumentation.css +0 -21
  18. package/src/Components/AppComponents/CheckboxDocumentation/CheckboxDocumentation.html +0 -35
  19. package/src/Components/AppComponents/CheckboxDocumentation/CheckboxDocumentation.js +0 -103
  20. package/src/Components/AppComponents/Documentation/Documentation.css +0 -0
  21. package/src/Components/AppComponents/Documentation/Documentation.html +0 -30
  22. package/src/Components/AppComponents/Documentation/Documentation.js +0 -75
  23. package/src/Components/AppComponents/DocumentationPage/DocumentationPage.css +0 -62
  24. package/src/Components/AppComponents/DocumentationPage/DocumentationPage.html +0 -0
  25. package/src/Components/AppComponents/DocumentationPage/DocumentationPage.js +0 -283
  26. package/src/Components/AppComponents/InputDocumentation/InputDocumentation.css +0 -41
  27. package/src/Components/AppComponents/InputDocumentation/InputDocumentation.html +0 -95
  28. package/src/Components/AppComponents/InputDocumentation/InputDocumentation.js +0 -315
  29. package/src/Components/AppComponents/Installation/Installation.css +0 -185
  30. package/src/Components/AppComponents/Installation/Installation.html +0 -102
  31. package/src/Components/AppComponents/Installation/Installation.js +0 -61
  32. package/src/Components/AppComponents/LandingMenu/LandingMenu.css +0 -108
  33. package/src/Components/AppComponents/LandingMenu/LandingMenu.html +0 -16
  34. package/src/Components/AppComponents/LandingMenu/LandingMenu.js +0 -33
  35. package/src/Components/AppComponents/LandingPage/LandingPage.css +0 -14
  36. package/src/Components/AppComponents/LandingPage/LandingPage.html +0 -0
  37. package/src/Components/AppComponents/LandingPage/LandingPage.js +0 -53
  38. package/src/Components/AppComponents/MainMenu/MainMenu.css +0 -80
  39. package/src/Components/AppComponents/MainMenu/MainMenu.html +0 -39
  40. package/src/Components/AppComponents/MainMenu/MainMenu.js +0 -42
  41. package/src/Components/AppComponents/MyLayout/MyLayout.css +0 -0
  42. package/src/Components/AppComponents/MyLayout/MyLayout.html +0 -0
  43. package/src/Components/AppComponents/MyLayout/MyLayout.js +0 -13
  44. package/src/Components/AppComponents/MyNavigation/MyNavigation.css +0 -49
  45. package/src/Components/AppComponents/MyNavigation/MyNavigation.html +0 -1
  46. package/src/Components/AppComponents/MyNavigation/MyNavigation.js +0 -60
  47. package/src/Components/AppComponents/RoutingDocumentation/RoutingDocumentation.css +0 -89
  48. package/src/Components/AppComponents/RoutingDocumentation/RoutingDocumentation.html +0 -108
  49. package/src/Components/AppComponents/RoutingDocumentation/RoutingDocumentation.js +0 -177
  50. package/src/Components/AppComponents/ServiceDocumentation/ServiceDocumentation.css +0 -82
  51. package/src/Components/AppComponents/ServiceDocumentation/ServiceDocumentation.html +0 -74
  52. package/src/Components/AppComponents/ServiceDocumentation/ServiceDocumentation.js +0 -416
  53. package/src/Components/AppComponents/SliceStylesDocumentation/SliceStylesDocumentation.css +0 -56
  54. package/src/Components/AppComponents/SliceStylesDocumentation/SliceStylesDocumentation.html +0 -28
  55. package/src/Components/AppComponents/SliceStylesDocumentation/SliceStylesDocumentation.js +0 -134
  56. package/src/Components/AppComponents/SliceTeamCard/SliceTeamCard.css +0 -104
  57. package/src/Components/AppComponents/SliceTeamCard/SliceTeamCard.html +0 -12
  58. package/src/Components/AppComponents/SliceTeamCard/SliceTeamCard.js +0 -74
  59. package/src/Components/AppComponents/StructuralDocumentation/StructuralDocumentation.css +0 -72
  60. package/src/Components/AppComponents/StructuralDocumentation/StructuralDocumentation.html +0 -98
  61. package/src/Components/AppComponents/StructuralDocumentation/StructuralDocumentation.js +0 -219
  62. package/src/Components/AppComponents/SwitchDocumentation/SwitchDocumentation.css +0 -21
  63. package/src/Components/AppComponents/SwitchDocumentation/SwitchDocumentation.html +0 -35
  64. package/src/Components/AppComponents/SwitchDocumentation/SwitchDocumentation.js +0 -103
  65. package/src/Components/AppComponents/TheBuildMethod/TheBuildMethod.css +0 -296
  66. package/src/Components/AppComponents/TheBuildMethod/TheBuildMethod.html +0 -89
  67. package/src/Components/AppComponents/TheBuildMethod/TheBuildMethod.js +0 -86
  68. package/src/Components/AppComponents/TheSliceTeam/TheSliceTeam.css +0 -208
  69. package/src/Components/AppComponents/TheSliceTeam/TheSliceTeam.html +0 -18
  70. package/src/Components/AppComponents/TheSliceTeam/TheSliceTeam.js +0 -111
  71. package/src/Components/AppComponents/ThemesDocumentation/ThemesDocumentation.css +0 -61
  72. package/src/Components/AppComponents/ThemesDocumentation/ThemesDocumentation.html +0 -80
  73. package/src/Components/AppComponents/ThemesDocumentation/ThemesDocumentation.js +0 -149
  74. package/src/Components/AppComponents/VisualDocumentation/VisualDocumentation.css +0 -70
  75. package/src/Components/AppComponents/VisualDocumentation/VisualDocumentation.html +0 -67
  76. package/src/Components/AppComponents/VisualDocumentation/VisualDocumentation.js +0 -193
  77. package/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.css +0 -475
  78. package/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.html +0 -389
  79. package/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.js +0 -95
  80. /package/src/Components/{AppComponents → Visual}/CodeVisualizer/CodeVisualizer.css +0 -0
  81. /package/src/Components/{AppComponents → Visual}/CodeVisualizer/CodeVisualizer.html +0 -0
  82. /package/src/Components/{AppComponents → Visual}/CodeVisualizer/CodeVisualizer.js +0 -0
@@ -1,67 +0,0 @@
1
- <h1 id="visualComponents">Visual Components</h1>
2
-
3
- <p>
4
- Visual components in Slice.js are the building blocks of your user interface. These components use the Web Components API, extending <code>HTMLElement</code> to create custom elements that can be used directly in your HTML markup.
5
- </p>
6
-
7
- <h2 id="visualComponentOverview">What are Visual Components?</h2>
8
- <p>
9
- Visual components in Slice.js:
10
- </p>
11
- <ul>
12
- <li>Render visible UI elements that users can interact with</li>
13
- <li>Encapsulate HTML structure, CSS styling, and JavaScript behavior</li>
14
- <li>Follow a consistent lifecycle pattern and property management</li>
15
- <li>Can be composed together to build complex interfaces</li>
16
- </ul>
17
-
18
- <h2 id="buildingVisualComponents">Building Visual Components</h2>
19
- <p>
20
- Visual components are created using the <code>slice.build()</code> method, which handles template loading, styling, and instance creation:
21
- </p>
22
- <div class="visual-build-example"></div>
23
-
24
- <h2 id="visualComponentStructure">Visual Component Structure</h2>
25
- <p>
26
- Each visual component consists of three key files:
27
- </p>
28
- <ul>
29
- <li><strong>ComponentName.js</strong> - The JavaScript class that defines behavior and properties</li>
30
- <li><strong>ComponentName.html</strong> - The HTML template that defines structure</li>
31
- <li><strong>ComponentName.css</strong> - The CSS styles specific to the component</li>
32
- </ul>
33
-
34
- <h2 id="visualComponentLifecycle">Component Lifecycle</h2>
35
- <p>
36
- Visual components follow a standard lifecycle with two key async methods:
37
- </p>
38
- <ol>
39
- <li><strong>constructor(props)</strong> - Initialize the component and set up event listeners</li>
40
- <li><strong>async init()</strong> - Called once after construction to set default values and perform additional initialization</li>
41
- <li><strong>async update()</strong> - Called every time the component is rendered, allowing you to refresh data and update the UI</li>
42
- <li><strong>Property getters/setters</strong> - Manage the component's state and update the DOM accordingly</li>
43
- </ol>
44
-
45
- <p>Example component implementation with lifecycle methods:</p>
46
- <div class="visual-lifecycle-example"></div>
47
-
48
- <h2 id="nestedComponents">Creating Components Within Components</h2>
49
- <p>
50
- One of the key advantages of Slice.js is the ability to compose complex UIs by nesting components within each other. Here's how to create and manage nested components:
51
- </p>
52
- <div class="nested-components-example"></div>
53
-
54
- <p>Usage example with nested components:</p>
55
- <div class="nested-components-usage"></div>
56
-
57
- <h3>Key concepts for nesting components:</h3>
58
- <ul>
59
- <li><strong>Async initialization</strong>: Use async/await in the init() method to ensure child components are fully built</li>
60
- <li><strong>Component communication</strong>: Pass data down to child components via props or use custom events for child-to-parent communication</li>
61
- <li><strong>DOM management</strong>: Store references to child components for later access and manipulation</li>
62
- <li><strong>Lifecycle coordination</strong>: Ensure parent updates trigger child updates when needed</li>
63
- </ul>
64
-
65
- <h2 id="visualComponentsFaq">Frequently Asked Questions</h2>
66
- <p>Common questions about working with Visual Components in Slice.js:</p>
67
- <div class="faq-section"></div>
@@ -1,193 +0,0 @@
1
- export default class VisualDocumentation 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
- // Create code example for visual component
12
- const buildExample = await slice.build("CodeVisualizer", {
13
- value: `// Example: Building a visual component
14
- const myButton = await slice.build("Button", {
15
- value: "Click me!",
16
- onClickCallback: () => {
17
- console.log("Button clicked");
18
- }
19
- });
20
-
21
- // Add to the DOM
22
- document.getElementById("container").appendChild(myButton);`,
23
- language: "javascript"
24
- });
25
-
26
- this.querySelector(".visual-build-example").appendChild(buildExample);
27
-
28
- // Create lifecycle example
29
- const lifecycleExample = await slice.build("CodeVisualizer", {
30
- value: `export default class CustomVisualComponent extends HTMLElement {
31
- constructor(props) {
32
- super();
33
- slice.attachTemplate(this);
34
-
35
- // Get references to DOM elements
36
- this.$button = this.querySelector(".my-button");
37
-
38
- // Set up event listeners
39
- this.$button.addEventListener("click", this.handleClick.bind(this));
40
-
41
- // Register properties with controller
42
- slice.controller.setComponentProps(this, props);
43
- this.debuggerProps = ["value", "color", "disabled"];
44
- }
45
-
46
- // Lifecycle method - runs once after construction
47
- async init() {
48
- // Initialize default values
49
- if (!this.value) this.value = "Default Text";
50
- if (!this.disabled) this.disabled = false;
51
-
52
- // Additional async initialization logic
53
- await this.loadExternalData();
54
- }
55
-
56
- // Lifecycle method - runs every time the component is rendered
57
- async update() {
58
- // Update component state based on current data
59
- this.updateUI();
60
-
61
- // Refresh data or perform other operations needed on re-render
62
- await this.refreshData();
63
- }
64
-
65
- // Custom methods
66
- handleClick() {
67
- if (this.onClickCallback) this.onClickCallback();
68
- }
69
-
70
- // Getters and setters for properties
71
- get value() {
72
- return this._value;
73
- }
74
-
75
- set value(newValue) {
76
- this._value = newValue;
77
- this.$button.textContent = newValue;
78
- }
79
- }
80
-
81
- customElements.define("my-visual-component", CustomVisualComponent);`,
82
- language: "javascript"
83
- });
84
-
85
- this.querySelector(".visual-lifecycle-example").appendChild(lifecycleExample);
86
-
87
- // Create nested components example
88
- const nestedComponentsExample = await slice.build("CodeVisualizer", {
89
- value: `// Parent component: Form.js
90
- export default class Form extends HTMLElement {
91
- constructor(props) {
92
- super();
93
- slice.attachTemplate(this);
94
- this.$formContainer = this.querySelector(".form-container");
95
-
96
- slice.controller.setComponentProps(this, props);
97
- this.debuggerProps = ["title", "fields"];
98
- }
99
-
100
- async init() {
101
- // Create form title
102
- const formTitle = document.createElement("h2");
103
- formTitle.textContent = this.title || "Form";
104
- this.$formContainer.appendChild(formTitle);
105
-
106
- // Create child components (inputs)
107
- for (const field of this.fields || []) {
108
- const input = await slice.build("Input", {
109
- placeholder: field.label,
110
- type: field.type,
111
- required: field.required
112
- });
113
-
114
- this.$formContainer.appendChild(input);
115
- }
116
-
117
- // Create submit button
118
- const submitButton = await slice.build("Button", {
119
- value: "Submit",
120
- onClickCallback: () => this.handleSubmit()
121
- });
122
-
123
- this.$formContainer.appendChild(submitButton);
124
- }
125
-
126
- handleSubmit() {
127
- // Form submission logic
128
- console.log("Form submitted");
129
- }
130
- }
131
-
132
- customElements.define("slice-form", Form);`,
133
- language: "javascript"
134
- });
135
-
136
- this.querySelector(".nested-components-example").appendChild(nestedComponentsExample);
137
-
138
- // Usage example for nested components
139
- const nestedComponentsUsageExample = await slice.build("CodeVisualizer", {
140
- value: `// Using the Form component with nested components
141
- const myForm = await slice.build("Form", {
142
- title: "Contact Form",
143
- fields: [
144
- { label: "Your Name", type: "text", required: true },
145
- { label: "Email Address", type: "email", required: true },
146
- { label: "Message", type: "text", required: false }
147
- ]
148
- });
149
-
150
- document.getElementById("form-container").appendChild(myForm);`,
151
- language: "javascript"
152
- });
153
-
154
- this.querySelector(".nested-components-usage").appendChild(nestedComponentsUsageExample);
155
-
156
- // Create details components for FAQs
157
- const questions = [
158
- {
159
- title: "How do I pass data between components?",
160
- text: "You can pass data between components in several ways: 1) Through props when building a component, 2) Using custom events with addEventListener and dispatchEvent, 3) Through a shared service component, or 4) Using the slice.controller to access other components directly via getComponent()."
161
- },
162
- {
163
- title: "Can I create dynamic components at runtime?",
164
- text: "Yes, you can dynamically create components at runtime using slice.build() and then append them to the DOM. This is useful for creating components based on user interactions or data received from an API."
165
- },
166
- {
167
- title: "How do I handle component cleanup?",
168
- text: "To properly clean up a component, you should remove all event listeners and cancel any pending operations when the component is no longer needed. You can create a custom destroy() method in your component class that handles cleanup tasks."
169
- },
170
- {
171
- title: "Can I extend existing visual components?",
172
- text: "Yes, you can extend existing components by creating a new class that inherits from the component you want to extend. This allows you to add new functionality while keeping the original behavior."
173
- },
174
- {
175
- title: "How do I handle component loading states?",
176
- text: "For components that need to load data asynchronously, you can use the built-in Loading component in Slice.js. Use slice.loading.start() to show the loading indicator and slice.loading.stop() to hide it when your data is ready."
177
- }
178
- ];
179
-
180
- const faqContainer = this.querySelector(".faq-section");
181
-
182
- for (const question of questions) {
183
- const detailsComponent = await slice.build("Details", {
184
- title: question.title,
185
- text: question.text
186
- });
187
-
188
- faqContainer.appendChild(detailsComponent);
189
- }
190
- }
191
- }
192
-
193
- customElements.define("slice-visualdocumentation", VisualDocumentation);