slicejs-cli 2.0.3 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/ProjectTemplate/api/index.js +97 -0
  2. package/ProjectTemplate/src/App/index.html +22 -0
  3. package/ProjectTemplate/src/App/index.js +63 -0
  4. package/ProjectTemplate/src/App/style.css +40 -0
  5. package/ProjectTemplate/src/Components/AppComponents/ButtonDocumentation/ButtonDocumentation.css +16 -0
  6. package/ProjectTemplate/src/Components/AppComponents/ButtonDocumentation/ButtonDocumentation.html +22 -0
  7. package/ProjectTemplate/src/Components/AppComponents/ButtonDocumentation/ButtonDocumentation.js +102 -0
  8. package/ProjectTemplate/src/Components/AppComponents/CardDocumentation/CardDocumentation.css +15 -0
  9. package/ProjectTemplate/src/Components/AppComponents/CardDocumentation/CardDocumentation.html +38 -0
  10. package/ProjectTemplate/src/Components/AppComponents/CardDocumentation/CardDocumentation.js +113 -0
  11. package/ProjectTemplate/src/Components/AppComponents/CheckboxDocumentation/CheckboxDocumentation.css +21 -0
  12. package/ProjectTemplate/src/Components/AppComponents/CheckboxDocumentation/CheckboxDocumentation.html +35 -0
  13. package/ProjectTemplate/src/Components/AppComponents/CheckboxDocumentation/CheckboxDocumentation.js +103 -0
  14. package/ProjectTemplate/src/Components/AppComponents/CodeVisualizer/CodeVisualizer.css +14 -0
  15. package/ProjectTemplate/src/Components/AppComponents/CodeVisualizer/CodeVisualizer.html +3 -0
  16. package/ProjectTemplate/src/Components/AppComponents/CodeVisualizer/CodeVisualizer.js +45 -0
  17. package/ProjectTemplate/src/Components/AppComponents/Documentation/Documentation.css +0 -0
  18. package/ProjectTemplate/src/Components/AppComponents/Documentation/Documentation.html +30 -0
  19. package/ProjectTemplate/src/Components/AppComponents/Documentation/Documentation.js +75 -0
  20. package/ProjectTemplate/src/Components/AppComponents/DocumentationPage/DocumentationPage.css +62 -0
  21. package/ProjectTemplate/src/Components/AppComponents/DocumentationPage/DocumentationPage.html +0 -0
  22. package/ProjectTemplate/src/Components/AppComponents/DocumentationPage/DocumentationPage.js +241 -0
  23. package/ProjectTemplate/src/Components/AppComponents/InputDocumentation/InputDocumentation.css +41 -0
  24. package/ProjectTemplate/src/Components/AppComponents/InputDocumentation/InputDocumentation.html +95 -0
  25. package/ProjectTemplate/src/Components/AppComponents/InputDocumentation/InputDocumentation.js +315 -0
  26. package/ProjectTemplate/src/Components/AppComponents/LandingMenu/LandingMenu.css +108 -0
  27. package/ProjectTemplate/src/Components/AppComponents/LandingMenu/LandingMenu.html +16 -0
  28. package/ProjectTemplate/src/Components/AppComponents/LandingMenu/LandingMenu.js +33 -0
  29. package/ProjectTemplate/src/Components/AppComponents/LandingPage/LandingPage.css +14 -0
  30. package/ProjectTemplate/src/Components/AppComponents/LandingPage/LandingPage.html +0 -0
  31. package/ProjectTemplate/src/Components/AppComponents/LandingPage/LandingPage.js +53 -0
  32. package/ProjectTemplate/src/Components/AppComponents/MainMenu/MainMenu.css +80 -0
  33. package/ProjectTemplate/src/Components/AppComponents/MainMenu/MainMenu.html +39 -0
  34. package/ProjectTemplate/src/Components/AppComponents/MainMenu/MainMenu.js +42 -0
  35. package/ProjectTemplate/src/Components/AppComponents/MyLayout/MyLayout.css +0 -0
  36. package/ProjectTemplate/src/Components/AppComponents/MyLayout/MyLayout.html +0 -0
  37. package/ProjectTemplate/src/Components/AppComponents/MyLayout/MyLayout.js +13 -0
  38. package/ProjectTemplate/src/Components/AppComponents/MyNavigation/MyNavigation.css +49 -0
  39. package/ProjectTemplate/src/Components/AppComponents/MyNavigation/MyNavigation.html +1 -0
  40. package/ProjectTemplate/src/Components/AppComponents/MyNavigation/MyNavigation.js +60 -0
  41. package/ProjectTemplate/src/Components/AppComponents/Playground/Playground.css +12 -0
  42. package/ProjectTemplate/src/Components/AppComponents/Playground/Playground.html +0 -0
  43. package/ProjectTemplate/src/Components/AppComponents/Playground/Playground.js +126 -0
  44. package/ProjectTemplate/src/Components/AppComponents/SliceTeamCard/SliceTeamCard.css +104 -0
  45. package/ProjectTemplate/src/Components/AppComponents/SliceTeamCard/SliceTeamCard.html +12 -0
  46. package/ProjectTemplate/src/Components/AppComponents/SliceTeamCard/SliceTeamCard.js +74 -0
  47. package/ProjectTemplate/src/Components/AppComponents/SwitchDocumentation/SwitchDocumentation.css +21 -0
  48. package/ProjectTemplate/src/Components/AppComponents/SwitchDocumentation/SwitchDocumentation.html +35 -0
  49. package/ProjectTemplate/src/Components/AppComponents/SwitchDocumentation/SwitchDocumentation.js +103 -0
  50. package/ProjectTemplate/src/Components/AppComponents/TheSliceTeam/TheSliceTeam.css +23 -0
  51. package/ProjectTemplate/src/Components/AppComponents/TheSliceTeam/TheSliceTeam.html +6 -0
  52. package/ProjectTemplate/src/Components/AppComponents/TheSliceTeam/TheSliceTeam.js +129 -0
  53. package/ProjectTemplate/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.css +0 -0
  54. package/ProjectTemplate/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.html +7 -0
  55. package/ProjectTemplate/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.js +15 -0
  56. package/ProjectTemplate/src/Components/Service/FetchManager/FetchManager.js +133 -0
  57. package/ProjectTemplate/src/Components/Service/IndexedDbManager/IndexedDbManager.js +141 -0
  58. package/ProjectTemplate/src/Components/Service/Link/Link.js +26 -0
  59. package/ProjectTemplate/src/Components/Visual/Button/Button.css +47 -0
  60. package/ProjectTemplate/src/Components/Visual/Button/Button.html +5 -0
  61. package/ProjectTemplate/src/Components/Visual/Button/Button.js +70 -0
  62. package/ProjectTemplate/src/Components/Visual/Card/Card.css +68 -0
  63. package/ProjectTemplate/src/Components/Visual/Card/Card.html +7 -0
  64. package/ProjectTemplate/src/Components/Visual/Card/Card.js +107 -0
  65. package/ProjectTemplate/src/Components/Visual/Checkbox/Checkbox.css +87 -0
  66. package/ProjectTemplate/src/Components/Visual/Checkbox/Checkbox.html +8 -0
  67. package/ProjectTemplate/src/Components/Visual/Checkbox/Checkbox.js +86 -0
  68. package/ProjectTemplate/src/Components/Visual/Details/Details.css +70 -0
  69. package/ProjectTemplate/src/Components/Visual/Details/Details.html +9 -0
  70. package/ProjectTemplate/src/Components/Visual/Details/Details.js +76 -0
  71. package/ProjectTemplate/src/Components/Visual/DropDown/DropDown.css +60 -0
  72. package/ProjectTemplate/src/Components/Visual/DropDown/DropDown.html +5 -0
  73. package/ProjectTemplate/src/Components/Visual/DropDown/DropDown.js +63 -0
  74. package/ProjectTemplate/src/Components/Visual/Grid/Grid.css +7 -0
  75. package/ProjectTemplate/src/Components/Visual/Grid/Grid.html +1 -0
  76. package/ProjectTemplate/src/Components/Visual/Grid/Grid.js +57 -0
  77. package/ProjectTemplate/src/Components/Visual/Icon/Icon.css +510 -0
  78. package/ProjectTemplate/src/Components/Visual/Icon/Icon.html +1 -0
  79. package/ProjectTemplate/src/Components/Visual/Icon/Icon.js +89 -0
  80. package/ProjectTemplate/src/Components/Visual/Icon/slc.eot +0 -0
  81. package/ProjectTemplate/src/Components/Visual/Icon/slc.json +555 -0
  82. package/ProjectTemplate/src/Components/Visual/Icon/slc.styl +507 -0
  83. package/ProjectTemplate/src/Components/Visual/Icon/slc.svg +1485 -0
  84. package/ProjectTemplate/src/Components/Visual/Icon/slc.symbol.svg +1059 -0
  85. package/ProjectTemplate/src/Components/Visual/Icon/slc.ttf +0 -0
  86. package/ProjectTemplate/src/Components/Visual/Icon/slc.woff +0 -0
  87. package/ProjectTemplate/src/Components/Visual/Icon/slc.woff2 +0 -0
  88. package/ProjectTemplate/src/Components/Visual/Input/Input.css +91 -0
  89. package/ProjectTemplate/src/Components/Visual/Input/Input.html +4 -0
  90. package/ProjectTemplate/src/Components/Visual/Input/Input.js +215 -0
  91. package/ProjectTemplate/src/Components/Visual/Layout/Layout.css +0 -0
  92. package/ProjectTemplate/src/Components/Visual/Layout/Layout.html +0 -0
  93. package/ProjectTemplate/src/Components/Visual/Layout/Layout.js +49 -0
  94. package/ProjectTemplate/src/Components/Visual/Loading/Loading.css +56 -0
  95. package/ProjectTemplate/src/Components/Visual/Loading/Loading.html +83 -0
  96. package/ProjectTemplate/src/Components/Visual/Loading/Loading.js +38 -0
  97. package/ProjectTemplate/src/Components/Visual/MultiRoute/MultiRoute.js +93 -0
  98. package/ProjectTemplate/src/Components/Visual/Navbar/Navbar.css +115 -0
  99. package/ProjectTemplate/src/Components/Visual/Navbar/Navbar.html +44 -0
  100. package/ProjectTemplate/src/Components/Visual/Navbar/Navbar.js +141 -0
  101. package/ProjectTemplate/src/Components/Visual/NotFound/NotFound.css +117 -0
  102. package/ProjectTemplate/src/Components/Visual/NotFound/NotFound.html +24 -0
  103. package/ProjectTemplate/src/Components/Visual/NotFound/NotFound.js +16 -0
  104. package/ProjectTemplate/src/Components/Visual/Route/Route.js +93 -0
  105. package/ProjectTemplate/src/Components/Visual/Select/Select.css +84 -0
  106. package/ProjectTemplate/src/Components/Visual/Select/Select.html +8 -0
  107. package/ProjectTemplate/src/Components/Visual/Select/Select.js +195 -0
  108. package/ProjectTemplate/src/Components/Visual/Switch/Switch.css +76 -0
  109. package/ProjectTemplate/src/Components/Visual/Switch/Switch.html +8 -0
  110. package/ProjectTemplate/src/Components/Visual/Switch/Switch.js +102 -0
  111. package/ProjectTemplate/src/Components/Visual/TreeItem/TreeItem.css +36 -0
  112. package/ProjectTemplate/src/Components/Visual/TreeItem/TreeItem.html +1 -0
  113. package/ProjectTemplate/src/Components/Visual/TreeItem/TreeItem.js +126 -0
  114. package/ProjectTemplate/src/Components/Visual/TreeView/TreeView.css +8 -0
  115. package/ProjectTemplate/src/Components/Visual/TreeView/TreeView.html +1 -0
  116. package/ProjectTemplate/src/Components/Visual/TreeView/TreeView.js +48 -0
  117. package/ProjectTemplate/src/Components/components.js +42 -0
  118. package/ProjectTemplate/src/Styles/sliceStyles.css +34 -0
  119. package/ProjectTemplate/src/Themes/Dark.css +42 -0
  120. package/ProjectTemplate/src/Themes/Light.css +31 -0
  121. package/ProjectTemplate/src/Themes/Slice.css +47 -0
  122. package/ProjectTemplate/src/images/Slice.js-logo.png +0 -0
  123. package/ProjectTemplate/src/images/favicon.ico +0 -0
  124. package/ProjectTemplate/src/images/im2/Slice.js-logo.png +0 -0
  125. package/ProjectTemplate/src/routes.js +36 -0
  126. package/ProjectTemplate/src/sliceConfig.json +58 -0
  127. package/package.json +2 -2
  128. package/post.js +5 -2
@@ -0,0 +1,97 @@
1
+ import express from 'express';
2
+ import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+ import { dirname } from 'path';
5
+ import inquirer from 'inquirer';
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = dirname(__filename);
9
+ import sliceConfig from '../src/sliceConfig.json' assert { type: 'json' };
10
+
11
+ let server;
12
+
13
+ const app = express();
14
+ const PORT = 3001;
15
+
16
+ const isProduction = sliceConfig.production === true;
17
+ const folderDeployed = isProduction ? 'dist' : 'src';
18
+
19
+ // Servir archivos estáticos desde la carpeta 'Slice'
20
+ app.use('/Slice/', express.static(path.join(__dirname,'..','Slice')));
21
+ // Servir archivos estáticos desde la carpeta 'App'
22
+
23
+
24
+
25
+ app.get('/testing1', (req, res) => {
26
+ res.send(` Actual route in server: __dirname: ${__dirname} __filename: ${__filename} - checking if file exists: ${path.join(__dirname, '..', 'src','App', 'index.html')}`);
27
+ });
28
+
29
+
30
+ app.use(express.static(path.join(__dirname,'..', folderDeployed)));
31
+
32
+
33
+ app.get('/testing2', (req, res) => {
34
+ res.send(` Actual route in server: __dirname: ${__dirname} __filename: ${__filename} - checking if file exists: ${path.join(__dirname, '..', 'src','App', 'index.html')}`);
35
+ });
36
+
37
+ if(isProduction){
38
+
39
+ }
40
+
41
+
42
+ // Ruta para servir el index.html desde la carpeta 'App'
43
+ app.get('*', (req, res) => {
44
+ const filePath = path.join(__dirname, '..', 'src','App', 'index.html');
45
+ res.sendFile(filePath);
46
+ });
47
+
48
+ function startServer() {
49
+ server = app.listen(PORT, () => {
50
+ showMenu();
51
+ });
52
+ }
53
+
54
+ async function showMenu() {
55
+
56
+ console.clear();
57
+ console.log("\n=================================");
58
+ console.log(" SLICE SERVER MENU ");
59
+ console.log("=================================\n");
60
+
61
+ const url = `http://localhost:${PORT}`;
62
+ console.log(`Server is running on port ${PORT}, ${url}\n`);
63
+
64
+ while (true) {
65
+ const { action } = await inquirer.prompt([
66
+ {
67
+ type: 'list',
68
+ name: 'action',
69
+ message: 'Select an option:',
70
+ choices: ['Restart Server', 'Stop Server (Exit)']
71
+ }
72
+ ]);
73
+
74
+ if (action === 'Stop Server (Exit)') {
75
+ console.log('\nShutting down server...');
76
+ server.close(() => {
77
+ console.log('Server stopped.');
78
+ process.exit(0);
79
+ });
80
+ break;
81
+ } else if (action === 'Restart Server') {
82
+ console.log('\nRestarting server...');
83
+ server.close(() => {
84
+ console.log('Server stopped. Restarting...');
85
+ startServer();
86
+ });
87
+ break;
88
+ }
89
+ }
90
+ }
91
+
92
+ startServer();
93
+
94
+
95
+ export default app;
96
+
97
+
@@ -0,0 +1,22 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Slice - Documentation</title>
7
+ <link rel="icon" type="image/x-icon" href="/../../images/favicon.ico" />
8
+ <link rel="stylesheet" type="text/css" href="/App/style.css" />
9
+
10
+ <!-- Prism -->
11
+
12
+
13
+
14
+ <!-- Eliminar Prism despues-->
15
+ </head>
16
+
17
+ <body>
18
+ <div id="app">
19
+ <script src="/App/index.js" type="module"></script>
20
+ </div>
21
+ </body>
22
+ </html>
@@ -0,0 +1,63 @@
1
+ import Slice from '../../Slice/Slice.js';
2
+
3
+ const CACHE_NAME = 'slice-cache-v1';
4
+ const urlsToCache = [
5
+ // Añade aquí las rutas de los archivos que deseas almacenar
6
+ './Slice/Slice.js',
7
+ './Slice/Components/Structural/Logger/Logger.js',
8
+ './Slice/Components/Structural/Debugger/Debugger.js',
9
+ './Slice/Components/Structural/Router/Router.js',
10
+ './Slice/Components/Structural/Router/routes.js',
11
+ './Slice/Components/Structural/Controller/Controller.js',
12
+ './Slice/Components/Structural/StylesManager/StylesManager.js',
13
+ './Slice/Components/Structural/StylesManager/ThemeManager/ThemeManager.js',
14
+ ];
15
+
16
+ self.addEventListener('install', (event) => {
17
+ event.waitUntil(
18
+ caches.open(CACHE_NAME).then((cache) => {
19
+ console.log('Opened cache');
20
+ return cache.addAll(urlsToCache);
21
+ })
22
+ );
23
+ });
24
+
25
+ self.addEventListener('fetch', (event) => {
26
+ event.respondWith(
27
+ caches.match(event.request).then((response) => {
28
+ if (response) {
29
+ return response;
30
+ }
31
+ return fetch(event.request);
32
+ })
33
+ );
34
+ });
35
+
36
+ self.addEventListener('activate', (event) => {
37
+ const cacheWhitelist = [CACHE_NAME];
38
+
39
+ event.waitUntil(
40
+ caches.keys().then((cacheNames) => {
41
+ return Promise.all(
42
+ cacheNames.map((cacheName) => {
43
+ if (cacheWhitelist.indexOf(cacheName) === -1) {
44
+ return caches.delete(cacheName);
45
+ }
46
+ })
47
+ );
48
+ })
49
+ );
50
+ });
51
+
52
+ if ('serviceWorker' in navigator) {
53
+ window.addEventListener('load', () => {
54
+ navigator.serviceWorker
55
+ .register('/service-worker.js')
56
+ .then((registration) => {
57
+ console.log('Service Worker registrado con éxito:', registration);
58
+ })
59
+ .catch((error) => {
60
+ console.log('Error al registrar el Service Worker:', error);
61
+ });
62
+ });
63
+ }
@@ -0,0 +1,40 @@
1
+ /* :root {
2
+ --docs-width: 64%;
3
+ }
4
+ slice-layout {
5
+ display: flex;
6
+ justify-content: center;
7
+ }
8
+
9
+ p {
10
+ text-align: justify;
11
+ }
12
+ h1 {
13
+ padding-top: 10px;
14
+ padding-bottom: 10px;
15
+ border-bottom: 1px solid var(--secondary-background-color);
16
+ }
17
+ h2 {
18
+ padding-top: 10px;
19
+ }
20
+ .grid-container {
21
+ overflow-x: auto;
22
+ }
23
+ @media only screen and (max-width: 770px) {
24
+ :root {
25
+ --docs-width: 100%;
26
+ }
27
+ }
28
+ * {
29
+ font-family: var(--font-family);
30
+ }
31
+ .docs_container {
32
+ color: var(--font-primary-color);
33
+ margin-top: 100px;
34
+ overflow-y: scroll;
35
+ overflow-x: hidden;
36
+ width: var(--docs-width);
37
+ padding-left: 10px;
38
+ padding-right: 10px;
39
+ padding-bottom: 25px;
40
+ } */
@@ -0,0 +1,16 @@
1
+ .buttonsGrid {
2
+ width: 100%;
3
+ }
4
+ .buttons {
5
+ width: 100%;
6
+ display: flex;
7
+ flex-direction: row;
8
+ justify-content: center;
9
+ align-items: center;
10
+ }
11
+ .buttonsContainer {
12
+ display: flex;
13
+ flex-direction: column;
14
+ justify-content: space-evenly;
15
+ /* width: 100%; */
16
+ }
@@ -0,0 +1,22 @@
1
+ <h1 id="sliceButton">Slice Button</h1>
2
+ <div class="myButton">
3
+ <p>
4
+ To build a simple Slice Button you only need to use the "slice.build"
5
+ method, just like that you have a Slice Button that you can customize with a
6
+ value prop.
7
+ </p>
8
+ </div>
9
+ <div class="colorButton">
10
+ <h2 id="customization">Customization</h2>
11
+ <p>
12
+ You can also cutomize your Slice Button specifying it's background color
13
+ with "customColor.button" and it's font color with "customColor.label".
14
+ </p>
15
+ </div>
16
+ <div class="onClick">
17
+ <h2 id="onClickCallback">onClickCallback</h2>
18
+ <p>
19
+ At last but not least you can add a function to your button with the prop
20
+ "onClickCallback".
21
+ </p>
22
+ </div>
@@ -0,0 +1,102 @@
1
+ export default class ButtonDocumentation 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
+ const grid = await slice.build('Grid', { columns: 2, rows: 1 });
12
+ grid.classList.add('buttonsGrid');
13
+
14
+ const simpleButton = await this.createButton(null, {});
15
+ const myButton = await this.createButton(
16
+ null,
17
+ {
18
+ value: 'Slice Button',
19
+ },
20
+ `{
21
+ value: "Slice Button",
22
+ }`
23
+ );
24
+
25
+ if (window.screen.width <= 770) {
26
+ grid.columns = 1;
27
+ }
28
+
29
+ await grid.setItem(simpleButton);
30
+ await grid.setItem(myButton);
31
+
32
+ this.querySelector('.myButton').appendChild(grid);
33
+
34
+ await this.createButton(
35
+ this.querySelector('.colorButton'),
36
+ {
37
+ value: 'Color Button',
38
+ customColor: { label: 'black', button: 'red' },
39
+ },
40
+ `{
41
+ value: "Color Button",
42
+ customColor: { label: "black", button: "red" },
43
+ }`
44
+ );
45
+ const clickButton = await this.createButton(
46
+ this.querySelector('.onClick'),
47
+ {
48
+ value: 'Click',
49
+ onClickCallback: () => {
50
+ if (clickButton.value === 'Click') {
51
+ clickButton.value = 'Clicked';
52
+ } else {
53
+ clickButton.value = 'Click';
54
+ }
55
+ },
56
+ },
57
+ `{
58
+ value: "Click",
59
+ onClickCallback: () => {
60
+ if (myButton.value === "Click") {
61
+ myButton.value = "Clicked";
62
+ } else {
63
+ myButton.value = "Click";
64
+ }
65
+ },
66
+ }`
67
+ );
68
+ }
69
+
70
+ async createButton(appendTo, buttonProps, codeProps) {
71
+ if (!codeProps) {
72
+ codeProps = '{}';
73
+ }
74
+ const myButton = await slice.build('Button', buttonProps);
75
+
76
+ const componentCode = await slice.build('CodeVisualizer', {
77
+ value: `const myButton = await slice.build("Button", ${codeProps});
78
+
79
+ `,
80
+ language: 'javascript',
81
+ });
82
+
83
+ const div = document.createElement('div');
84
+ const buttonDiv = document.createElement('div');
85
+ buttonDiv.classList.add('buttons');
86
+ buttonDiv.appendChild(myButton);
87
+ div.classList.add('buttonsContainer');
88
+ div.appendChild(buttonDiv);
89
+ div.appendChild(componentCode);
90
+
91
+ if (appendTo) {
92
+ appendTo.appendChild(div);
93
+ }
94
+ if (buttonProps.onClickCallback) {
95
+ return myButton;
96
+ }
97
+
98
+ return div;
99
+ }
100
+ }
101
+
102
+ customElements.define('slice-buttondocumentation', ButtonDocumentation);
@@ -0,0 +1,15 @@
1
+ :root {
2
+ --cards-padding: 30%;
3
+ }
4
+ .cards {
5
+ padding-left: var(--cards-padding);
6
+ padding-right: var(--cards-padding);
7
+ margin-top: 50px;
8
+ margin-bottom: 50px;
9
+ }
10
+
11
+ @media only screen and (max-width: 770px) {
12
+ :root {
13
+ --cards-padding: 20px;
14
+ }
15
+ }
@@ -0,0 +1,38 @@
1
+ <h1 id="sliceCard">Slice Card</h1>
2
+ <div class="sliceCard">
3
+ <p>
4
+ When building a "Card" component, by default it's created with the Slice
5
+ logo, and with a default title and text.
6
+ </p>
7
+ </div>
8
+ <div class="myCard">
9
+ <h2 id="myCard">Title and Text</h2>
10
+ <p>
11
+ To build your own Slice Card with your information it's as simple as just
12
+ adding "title" and "text" props to your component.
13
+ </p>
14
+ </div>
15
+ <div class="cardClick">
16
+ <h2 id="cardClick">Click Event | "isOpen" prop</h2>
17
+ <p>
18
+ The Slice Card component has an click eventListener. While the card is
19
+ uncovered and shows the information inside, it's cover can be clicked to
20
+ keep open. Changing it's "isOpen" prop to true. That same eventListener can
21
+ change it back to false, and cover up the card again.
22
+ </p>
23
+ </div>
24
+ <h1 id="customization">Customization</h1>
25
+ <div class="cardIcon">
26
+ <h2 id="icon">Icon</h2>
27
+ <p>
28
+ You can start your Slice Card customization by assignin another icon to it.
29
+ </p>
30
+ </div>
31
+ <div class="cardColor">
32
+ <h2 id="customColor">Custom Color</h2>
33
+ <p>
34
+ You can also change card color by using "customColor" props, using
35
+ "customColor.card" to change it's background, and "customColor.icon" to
36
+ change the icon's color.
37
+ </p>
38
+ </div>
@@ -0,0 +1,113 @@
1
+ export default class CardDocumentation 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.createCard(this.querySelector('.sliceCard'), {});
12
+ await this.createCard(
13
+ this.querySelector('.myCard'),
14
+ {
15
+ title: 'My Slice Card',
16
+ text: "My Slice Card's information.",
17
+ },
18
+ `{
19
+ title: "My Slice Card",
20
+ text: "My Slice Card's information.",
21
+ }`
22
+ );
23
+ await this.createCard(
24
+ this.querySelector('.cardClick'),
25
+ {
26
+ title: 'Uncover Slice Card',
27
+ text: 'isOpen is true.',
28
+ isOpen: true,
29
+ },
30
+ `{
31
+ title: "Uncover Slice Card",
32
+ text: "isOpen is true",
33
+ isOpen: true
34
+ }`
35
+ );
36
+ await this.createCard(
37
+ this.querySelector('.cardIcon'),
38
+ {
39
+ title: 'Discord',
40
+ text: 'This card has Discord Icon.',
41
+ icon: {
42
+ name: 'discord',
43
+ iconStyle: 'filled',
44
+ },
45
+ },
46
+ `{
47
+ title: "Discord",
48
+ text: "This card has Discord Icon.",
49
+ icon: {
50
+ name: "discord",
51
+ iconStyle: "filled",
52
+ }
53
+ }`
54
+ );
55
+ await this.createCard(
56
+ this.querySelector('.cardColor'),
57
+ {
58
+ title: 'Github',
59
+ text: 'This card has customized colors.',
60
+ icon: {
61
+ name: 'github',
62
+ iconStyle: 'filled',
63
+ },
64
+ customColor: {
65
+ card: 'darkblue',
66
+ icon: 'white',
67
+ },
68
+ },
69
+ `{
70
+ title: "Github",
71
+ text: "This card has customized colors.",
72
+ icon: {
73
+ name: "github",
74
+ iconStyle: "filled",
75
+ },
76
+ customColor: {
77
+ card: "darkblue",
78
+ icon: "white",
79
+ },
80
+ }`
81
+ );
82
+ }
83
+
84
+ async createCard(appendTo, cardProps, codeProps) {
85
+ if (!codeProps) {
86
+ codeProps = '{}';
87
+ }
88
+ const myCard = await slice.build('Card', cardProps);
89
+
90
+ const componentCode = await slice.build('CodeVisualizer', {
91
+ value: `const myCard = await slice.build("Card", ${codeProps});
92
+
93
+ `,
94
+ language: 'javascript',
95
+ });
96
+
97
+ const div = document.createElement('div');
98
+ const cardDiv = document.createElement('div');
99
+ cardDiv.classList.add('cards');
100
+ cardDiv.appendChild(myCard);
101
+ div.classList.add('cards_container');
102
+ div.appendChild(cardDiv);
103
+ div.appendChild(componentCode);
104
+
105
+ if (appendTo) {
106
+ appendTo.appendChild(div);
107
+ }
108
+
109
+ return div;
110
+ }
111
+ }
112
+
113
+ customElements.define('slice-carddocumentation', CardDocumentation);
@@ -0,0 +1,21 @@
1
+ .checkboxs {
2
+ width: 100%;
3
+ display: flex;
4
+ flex-direction: row;
5
+ justify-content: center;
6
+ align-items: center;
7
+ }
8
+ .labelCheckbox {
9
+ display: grid;
10
+ align-items: end;
11
+ grid-template-columns: repeat(2, 1fr);
12
+ grid-template-rows: repeat(1, 1fr);
13
+ gap: 10px;
14
+ margin: 0 auto;
15
+ }
16
+
17
+ @media only screen and (max-width: 770px) {
18
+ .labelCheckbox {
19
+ grid-template-columns: repeat(1, 1fr);
20
+ }
21
+ }
@@ -0,0 +1,35 @@
1
+ <h1 id="sliceCheckbox">Slice CheckBox</h1>
2
+ <div class="myCheckbox">
3
+ <p>This is a Slice Checkbox.</p>
4
+ </div>
5
+ <div class="colorCheckbox">
6
+ <h2 id="customColor">Custom color</h2>
7
+ <p>
8
+ You cand customize your Slice Checkbox by changing it's color with the color
9
+ prop
10
+ </p>
11
+ </div>
12
+ <h1 id="label">Label</h1>
13
+ <div class="label">
14
+ <p>You can set a label to your checkbox.</p>
15
+ </div>
16
+ <h2 id="labelPlacement">Label Placement</h2>
17
+ <p>You can also set in wich position to put the label to.</p>
18
+ <div class="labelCheckbox">
19
+ <div class="labelLeft">
20
+ <h2>Left</h2>
21
+ <p>This label is positioned at left.</p>
22
+ </div>
23
+ <div class="labelTop">
24
+ <h2>Top</h2>
25
+ <p>This label is positioned at top.</p>
26
+ </div>
27
+ <div class="labelRight">
28
+ <h2>Right (default)</h2>
29
+ <p>This label is positioned at right.</p>
30
+ </div>
31
+ <div class="labelBottom">
32
+ <h2>Bottom</h2>
33
+ <p>This label is positioned at bottom.</p>
34
+ </div>
35
+ </div>
@@ -0,0 +1,103 @@
1
+ export default class CheckboxDocumentation 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.createCheckbox(this.querySelector('.myCheckbox'), {}, `{}`);
12
+ await this.createCheckbox(
13
+ this.querySelector('.colorCheckbox'),
14
+ { customColor: 'gold' },
15
+ `{
16
+ customColor: "gold"
17
+ }`
18
+ );
19
+ await this.createCheckbox(
20
+ this.querySelector('.label'),
21
+ {
22
+ label: 'Checkbox',
23
+ },
24
+ `{
25
+ label: "Checkbox",
26
+ }`
27
+ );
28
+ await this.createCheckbox(
29
+ this.querySelector('.labelLeft'),
30
+ {
31
+ label: 'Left',
32
+ labelPlacement: 'left',
33
+ },
34
+ `{
35
+ label: "Left",
36
+ labelPlacement: "left",
37
+ }`
38
+ );
39
+ await this.createCheckbox(
40
+ this.querySelector('.labelTop'),
41
+ {
42
+ label: 'Top',
43
+ labelPlacement: 'top',
44
+ },
45
+ `{
46
+ label: "Top",
47
+ labelPlacement: "top",
48
+ }`
49
+ );
50
+ await this.createCheckbox(
51
+ this.querySelector('.labelRight'),
52
+ {
53
+ label: 'Right',
54
+ labelPlacement: 'right',
55
+ },
56
+ `{
57
+ label: "Right",
58
+ labelPlacement: "right",
59
+ }`
60
+ );
61
+ await this.createCheckbox(
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 createCheckbox(appendTo, checkboxProps, codeProps) {
75
+ if (!codeProps) {
76
+ codeProps = '{}';
77
+ }
78
+ const myCheckbox = await slice.build('Checkbox', checkboxProps);
79
+
80
+ const componentCode = await slice.build('CodeVisualizer', {
81
+ value: `const myCheckbox = await slice.build("Checkbox", ${codeProps});
82
+
83
+ `,
84
+ language: 'javascript',
85
+ });
86
+
87
+ const div = document.createElement('div');
88
+ const checkboxDiv = document.createElement('div');
89
+ checkboxDiv.classList.add('checkboxs');
90
+ checkboxDiv.appendChild(myCheckbox);
91
+ div.classList.add('checkboxs_container');
92
+ div.appendChild(checkboxDiv);
93
+ div.appendChild(componentCode);
94
+
95
+ if (appendTo) {
96
+ appendTo.appendChild(div);
97
+ }
98
+
99
+ return div;
100
+ }
101
+ }
102
+
103
+ customElements.define('slice-checkboxdocumentation', CheckboxDocumentation);