slicejs-cli 2.0.6 → 2.0.8

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 (130) hide show
  1. package/client.js +5 -1
  2. package/commands/Validations.js +1 -2
  3. package/commands/init/init.js +15 -14
  4. package/package.json +1 -1
  5. package/ProjectTemplate/api/index.js +0 -97
  6. package/ProjectTemplate/src/App/index.html +0 -22
  7. package/ProjectTemplate/src/App/index.js +0 -63
  8. package/ProjectTemplate/src/App/style.css +0 -40
  9. package/ProjectTemplate/src/Components/AppComponents/ButtonDocumentation/ButtonDocumentation.css +0 -16
  10. package/ProjectTemplate/src/Components/AppComponents/ButtonDocumentation/ButtonDocumentation.html +0 -22
  11. package/ProjectTemplate/src/Components/AppComponents/ButtonDocumentation/ButtonDocumentation.js +0 -102
  12. package/ProjectTemplate/src/Components/AppComponents/CardDocumentation/CardDocumentation.css +0 -15
  13. package/ProjectTemplate/src/Components/AppComponents/CardDocumentation/CardDocumentation.html +0 -38
  14. package/ProjectTemplate/src/Components/AppComponents/CardDocumentation/CardDocumentation.js +0 -113
  15. package/ProjectTemplate/src/Components/AppComponents/CheckboxDocumentation/CheckboxDocumentation.css +0 -21
  16. package/ProjectTemplate/src/Components/AppComponents/CheckboxDocumentation/CheckboxDocumentation.html +0 -35
  17. package/ProjectTemplate/src/Components/AppComponents/CheckboxDocumentation/CheckboxDocumentation.js +0 -103
  18. package/ProjectTemplate/src/Components/AppComponents/CodeVisualizer/CodeVisualizer.css +0 -14
  19. package/ProjectTemplate/src/Components/AppComponents/CodeVisualizer/CodeVisualizer.html +0 -3
  20. package/ProjectTemplate/src/Components/AppComponents/CodeVisualizer/CodeVisualizer.js +0 -45
  21. package/ProjectTemplate/src/Components/AppComponents/Documentation/Documentation.css +0 -0
  22. package/ProjectTemplate/src/Components/AppComponents/Documentation/Documentation.html +0 -30
  23. package/ProjectTemplate/src/Components/AppComponents/Documentation/Documentation.js +0 -75
  24. package/ProjectTemplate/src/Components/AppComponents/DocumentationPage/DocumentationPage.css +0 -62
  25. package/ProjectTemplate/src/Components/AppComponents/DocumentationPage/DocumentationPage.html +0 -0
  26. package/ProjectTemplate/src/Components/AppComponents/DocumentationPage/DocumentationPage.js +0 -241
  27. package/ProjectTemplate/src/Components/AppComponents/InputDocumentation/InputDocumentation.css +0 -41
  28. package/ProjectTemplate/src/Components/AppComponents/InputDocumentation/InputDocumentation.html +0 -95
  29. package/ProjectTemplate/src/Components/AppComponents/InputDocumentation/InputDocumentation.js +0 -315
  30. package/ProjectTemplate/src/Components/AppComponents/LandingMenu/LandingMenu.css +0 -108
  31. package/ProjectTemplate/src/Components/AppComponents/LandingMenu/LandingMenu.html +0 -16
  32. package/ProjectTemplate/src/Components/AppComponents/LandingMenu/LandingMenu.js +0 -33
  33. package/ProjectTemplate/src/Components/AppComponents/LandingPage/LandingPage.css +0 -14
  34. package/ProjectTemplate/src/Components/AppComponents/LandingPage/LandingPage.html +0 -0
  35. package/ProjectTemplate/src/Components/AppComponents/LandingPage/LandingPage.js +0 -53
  36. package/ProjectTemplate/src/Components/AppComponents/MainMenu/MainMenu.css +0 -80
  37. package/ProjectTemplate/src/Components/AppComponents/MainMenu/MainMenu.html +0 -39
  38. package/ProjectTemplate/src/Components/AppComponents/MainMenu/MainMenu.js +0 -42
  39. package/ProjectTemplate/src/Components/AppComponents/MyLayout/MyLayout.css +0 -0
  40. package/ProjectTemplate/src/Components/AppComponents/MyLayout/MyLayout.html +0 -0
  41. package/ProjectTemplate/src/Components/AppComponents/MyLayout/MyLayout.js +0 -13
  42. package/ProjectTemplate/src/Components/AppComponents/MyNavigation/MyNavigation.css +0 -49
  43. package/ProjectTemplate/src/Components/AppComponents/MyNavigation/MyNavigation.html +0 -1
  44. package/ProjectTemplate/src/Components/AppComponents/MyNavigation/MyNavigation.js +0 -60
  45. package/ProjectTemplate/src/Components/AppComponents/Playground/Playground.css +0 -12
  46. package/ProjectTemplate/src/Components/AppComponents/Playground/Playground.html +0 -0
  47. package/ProjectTemplate/src/Components/AppComponents/Playground/Playground.js +0 -126
  48. package/ProjectTemplate/src/Components/AppComponents/SliceTeamCard/SliceTeamCard.css +0 -104
  49. package/ProjectTemplate/src/Components/AppComponents/SliceTeamCard/SliceTeamCard.html +0 -12
  50. package/ProjectTemplate/src/Components/AppComponents/SliceTeamCard/SliceTeamCard.js +0 -74
  51. package/ProjectTemplate/src/Components/AppComponents/SwitchDocumentation/SwitchDocumentation.css +0 -21
  52. package/ProjectTemplate/src/Components/AppComponents/SwitchDocumentation/SwitchDocumentation.html +0 -35
  53. package/ProjectTemplate/src/Components/AppComponents/SwitchDocumentation/SwitchDocumentation.js +0 -103
  54. package/ProjectTemplate/src/Components/AppComponents/TheSliceTeam/TheSliceTeam.css +0 -23
  55. package/ProjectTemplate/src/Components/AppComponents/TheSliceTeam/TheSliceTeam.html +0 -6
  56. package/ProjectTemplate/src/Components/AppComponents/TheSliceTeam/TheSliceTeam.js +0 -129
  57. package/ProjectTemplate/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.css +0 -0
  58. package/ProjectTemplate/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.html +0 -7
  59. package/ProjectTemplate/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.js +0 -15
  60. package/ProjectTemplate/src/Components/Service/FetchManager/FetchManager.js +0 -133
  61. package/ProjectTemplate/src/Components/Service/IndexedDbManager/IndexedDbManager.js +0 -141
  62. package/ProjectTemplate/src/Components/Service/Link/Link.js +0 -26
  63. package/ProjectTemplate/src/Components/Visual/Button/Button.css +0 -47
  64. package/ProjectTemplate/src/Components/Visual/Button/Button.html +0 -5
  65. package/ProjectTemplate/src/Components/Visual/Button/Button.js +0 -70
  66. package/ProjectTemplate/src/Components/Visual/Card/Card.css +0 -68
  67. package/ProjectTemplate/src/Components/Visual/Card/Card.html +0 -7
  68. package/ProjectTemplate/src/Components/Visual/Card/Card.js +0 -107
  69. package/ProjectTemplate/src/Components/Visual/Checkbox/Checkbox.css +0 -87
  70. package/ProjectTemplate/src/Components/Visual/Checkbox/Checkbox.html +0 -8
  71. package/ProjectTemplate/src/Components/Visual/Checkbox/Checkbox.js +0 -86
  72. package/ProjectTemplate/src/Components/Visual/Details/Details.css +0 -70
  73. package/ProjectTemplate/src/Components/Visual/Details/Details.html +0 -9
  74. package/ProjectTemplate/src/Components/Visual/Details/Details.js +0 -76
  75. package/ProjectTemplate/src/Components/Visual/DropDown/DropDown.css +0 -60
  76. package/ProjectTemplate/src/Components/Visual/DropDown/DropDown.html +0 -5
  77. package/ProjectTemplate/src/Components/Visual/DropDown/DropDown.js +0 -63
  78. package/ProjectTemplate/src/Components/Visual/Grid/Grid.css +0 -7
  79. package/ProjectTemplate/src/Components/Visual/Grid/Grid.html +0 -1
  80. package/ProjectTemplate/src/Components/Visual/Grid/Grid.js +0 -57
  81. package/ProjectTemplate/src/Components/Visual/Icon/Icon.css +0 -510
  82. package/ProjectTemplate/src/Components/Visual/Icon/Icon.html +0 -1
  83. package/ProjectTemplate/src/Components/Visual/Icon/Icon.js +0 -89
  84. package/ProjectTemplate/src/Components/Visual/Icon/slc.eot +0 -0
  85. package/ProjectTemplate/src/Components/Visual/Icon/slc.json +0 -555
  86. package/ProjectTemplate/src/Components/Visual/Icon/slc.styl +0 -507
  87. package/ProjectTemplate/src/Components/Visual/Icon/slc.svg +0 -1485
  88. package/ProjectTemplate/src/Components/Visual/Icon/slc.symbol.svg +0 -1059
  89. package/ProjectTemplate/src/Components/Visual/Icon/slc.ttf +0 -0
  90. package/ProjectTemplate/src/Components/Visual/Icon/slc.woff +0 -0
  91. package/ProjectTemplate/src/Components/Visual/Icon/slc.woff2 +0 -0
  92. package/ProjectTemplate/src/Components/Visual/Input/Input.css +0 -91
  93. package/ProjectTemplate/src/Components/Visual/Input/Input.html +0 -4
  94. package/ProjectTemplate/src/Components/Visual/Input/Input.js +0 -215
  95. package/ProjectTemplate/src/Components/Visual/Layout/Layout.css +0 -0
  96. package/ProjectTemplate/src/Components/Visual/Layout/Layout.html +0 -0
  97. package/ProjectTemplate/src/Components/Visual/Layout/Layout.js +0 -49
  98. package/ProjectTemplate/src/Components/Visual/Loading/Loading.css +0 -56
  99. package/ProjectTemplate/src/Components/Visual/Loading/Loading.html +0 -83
  100. package/ProjectTemplate/src/Components/Visual/Loading/Loading.js +0 -38
  101. package/ProjectTemplate/src/Components/Visual/MultiRoute/MultiRoute.js +0 -93
  102. package/ProjectTemplate/src/Components/Visual/Navbar/Navbar.css +0 -115
  103. package/ProjectTemplate/src/Components/Visual/Navbar/Navbar.html +0 -44
  104. package/ProjectTemplate/src/Components/Visual/Navbar/Navbar.js +0 -141
  105. package/ProjectTemplate/src/Components/Visual/NotFound/NotFound.css +0 -117
  106. package/ProjectTemplate/src/Components/Visual/NotFound/NotFound.html +0 -24
  107. package/ProjectTemplate/src/Components/Visual/NotFound/NotFound.js +0 -16
  108. package/ProjectTemplate/src/Components/Visual/Route/Route.js +0 -93
  109. package/ProjectTemplate/src/Components/Visual/Select/Select.css +0 -84
  110. package/ProjectTemplate/src/Components/Visual/Select/Select.html +0 -8
  111. package/ProjectTemplate/src/Components/Visual/Select/Select.js +0 -195
  112. package/ProjectTemplate/src/Components/Visual/Switch/Switch.css +0 -76
  113. package/ProjectTemplate/src/Components/Visual/Switch/Switch.html +0 -8
  114. package/ProjectTemplate/src/Components/Visual/Switch/Switch.js +0 -102
  115. package/ProjectTemplate/src/Components/Visual/TreeItem/TreeItem.css +0 -36
  116. package/ProjectTemplate/src/Components/Visual/TreeItem/TreeItem.html +0 -1
  117. package/ProjectTemplate/src/Components/Visual/TreeItem/TreeItem.js +0 -126
  118. package/ProjectTemplate/src/Components/Visual/TreeView/TreeView.css +0 -8
  119. package/ProjectTemplate/src/Components/Visual/TreeView/TreeView.html +0 -1
  120. package/ProjectTemplate/src/Components/Visual/TreeView/TreeView.js +0 -48
  121. package/ProjectTemplate/src/Components/components.js +0 -42
  122. package/ProjectTemplate/src/Styles/sliceStyles.css +0 -34
  123. package/ProjectTemplate/src/Themes/Dark.css +0 -42
  124. package/ProjectTemplate/src/Themes/Light.css +0 -31
  125. package/ProjectTemplate/src/Themes/Slice.css +0 -47
  126. package/ProjectTemplate/src/images/Slice.js-logo.png +0 -0
  127. package/ProjectTemplate/src/images/favicon.ico +0 -0
  128. package/ProjectTemplate/src/images/im2/Slice.js-logo.png +0 -0
  129. package/ProjectTemplate/src/routes.js +0 -36
  130. package/ProjectTemplate/src/sliceConfig.json +0 -58
package/client.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
  import { program } from "commander";
3
3
  import inquirer from "inquirer";
4
4
  import initializeProject from "./commands/init/init.js";
@@ -70,6 +70,10 @@ componentCommand
70
70
  choices: categories,
71
71
  }])
72
72
 
73
+ validations.categories = validations.loadConfig().paths.components; // Cargamos las categorías al instanciar
74
+
75
+
76
+
73
77
  if(validations.getCategoryType(answers.category)==='Visual'){
74
78
  const properties = await inquirer.prompt([
75
79
  {
@@ -6,8 +6,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
6
6
 
7
7
  class Validations {
8
8
  constructor() {
9
- this.config = this.loadConfig(); // Cargamos la configuración solo una vez al instanciar
10
- this.categories = this.config?.paths?.components;
9
+
11
10
 
12
11
  }
13
12
 
@@ -7,26 +7,27 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
7
  export default async function initializeProject(projectType) {
8
8
  try {
9
9
  // Directorio de origen en el paquete
10
- let sliceDir;
11
- let basicPosibilities = ["basic", "Basic", "-b", "-B", "b", "B"];
12
- if (basicPosibilities.includes(projectType)) {
13
- sliceDir = path.join(__dirname, '../../PROJECT_TEMPLATES/Basic/Slice');
14
- }
10
+ let sliceBaseDir = path.join(__dirname, '../','../','../','node_modules','slicejs-web-framework')
11
+ let apiDir = `${sliceBaseDir}/api`
12
+ let srcDir = `${sliceBaseDir}/src`
13
+
14
+ let destinationApi = path.join(__dirname, '../../../../api')
15
+ let destinationSrc = path.join(__dirname, '../../../../src')
15
16
 
16
- // Directorio de destino en la raíz del proyecto
17
- const destinationDir = path.join(__dirname, '../../../../Slice');
18
- const destinationSrc = path.join(__dirname, '../../../../src')
19
- const srcDir = path.join(__dirname, '../../PROJECT_TEMPLATES/Basic/src')
20
17
 
21
18
  // Verificar si el directorio de destino ya existe
22
- if (fs.existsSync(destinationDir)) {
23
- Print.error('El proyecto ya cuenta con un directorio "Slice". No es posible inicializar el proyecto nuevamente');
19
+ if (fs.existsSync(destinationApi)) {
20
+ Print.error('El proyecto ya cuenta con un directorio "api". No es posible inicializar el proyecto nuevamente');
21
+ return;
22
+ }
23
+
24
+ if (fs.existsSync(destinationSrc)) {
25
+ Print.error('El proyecto ya cuenta con un directorio "src". No es posible inicializar el proyecto nuevamente');
24
26
  return;
25
27
  }
26
28
 
27
- // Copiar el contenido del directorio de origen al directorio de destino
28
- await fs.copy(sliceDir, destinationDir, { recursive: true });
29
- await fs.copy(srcDir, destinationSrc, { recursive: true });
29
+ await fs.copy(apiDir, destinationApi , { recursive: true });
30
+ await fs.copy(srcDir, destinationSrc , { recursive: true });
30
31
 
31
32
  Print.success('Proyecto inicializado correctamente.');
32
33
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slicejs-cli",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
4
4
  "description": "Command client for developing web applications with Slice.js framework",
5
5
  "main": "client.js",
6
6
  "scripts": {
@@ -1,97 +0,0 @@
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
-
@@ -1,22 +0,0 @@
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>
@@ -1,63 +0,0 @@
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
- }
@@ -1,40 +0,0 @@
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
- } */
@@ -1,16 +0,0 @@
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
- }
@@ -1,22 +0,0 @@
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>
@@ -1,102 +0,0 @@
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);
@@ -1,15 +0,0 @@
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
- }
@@ -1,38 +0,0 @@
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>
@@ -1,113 +0,0 @@
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);
@@ -1,21 +0,0 @@
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
- }
@@ -1,35 +0,0 @@
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>