slicejs-cli 2.0.6 → 2.0.7

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/commands/init/init.js +15 -14
  2. package/package.json +1 -1
  3. package/ProjectTemplate/api/index.js +0 -97
  4. package/ProjectTemplate/src/App/index.html +0 -22
  5. package/ProjectTemplate/src/App/index.js +0 -63
  6. package/ProjectTemplate/src/App/style.css +0 -40
  7. package/ProjectTemplate/src/Components/AppComponents/ButtonDocumentation/ButtonDocumentation.css +0 -16
  8. package/ProjectTemplate/src/Components/AppComponents/ButtonDocumentation/ButtonDocumentation.html +0 -22
  9. package/ProjectTemplate/src/Components/AppComponents/ButtonDocumentation/ButtonDocumentation.js +0 -102
  10. package/ProjectTemplate/src/Components/AppComponents/CardDocumentation/CardDocumentation.css +0 -15
  11. package/ProjectTemplate/src/Components/AppComponents/CardDocumentation/CardDocumentation.html +0 -38
  12. package/ProjectTemplate/src/Components/AppComponents/CardDocumentation/CardDocumentation.js +0 -113
  13. package/ProjectTemplate/src/Components/AppComponents/CheckboxDocumentation/CheckboxDocumentation.css +0 -21
  14. package/ProjectTemplate/src/Components/AppComponents/CheckboxDocumentation/CheckboxDocumentation.html +0 -35
  15. package/ProjectTemplate/src/Components/AppComponents/CheckboxDocumentation/CheckboxDocumentation.js +0 -103
  16. package/ProjectTemplate/src/Components/AppComponents/CodeVisualizer/CodeVisualizer.css +0 -14
  17. package/ProjectTemplate/src/Components/AppComponents/CodeVisualizer/CodeVisualizer.html +0 -3
  18. package/ProjectTemplate/src/Components/AppComponents/CodeVisualizer/CodeVisualizer.js +0 -45
  19. package/ProjectTemplate/src/Components/AppComponents/Documentation/Documentation.css +0 -0
  20. package/ProjectTemplate/src/Components/AppComponents/Documentation/Documentation.html +0 -30
  21. package/ProjectTemplate/src/Components/AppComponents/Documentation/Documentation.js +0 -75
  22. package/ProjectTemplate/src/Components/AppComponents/DocumentationPage/DocumentationPage.css +0 -62
  23. package/ProjectTemplate/src/Components/AppComponents/DocumentationPage/DocumentationPage.html +0 -0
  24. package/ProjectTemplate/src/Components/AppComponents/DocumentationPage/DocumentationPage.js +0 -241
  25. package/ProjectTemplate/src/Components/AppComponents/InputDocumentation/InputDocumentation.css +0 -41
  26. package/ProjectTemplate/src/Components/AppComponents/InputDocumentation/InputDocumentation.html +0 -95
  27. package/ProjectTemplate/src/Components/AppComponents/InputDocumentation/InputDocumentation.js +0 -315
  28. package/ProjectTemplate/src/Components/AppComponents/LandingMenu/LandingMenu.css +0 -108
  29. package/ProjectTemplate/src/Components/AppComponents/LandingMenu/LandingMenu.html +0 -16
  30. package/ProjectTemplate/src/Components/AppComponents/LandingMenu/LandingMenu.js +0 -33
  31. package/ProjectTemplate/src/Components/AppComponents/LandingPage/LandingPage.css +0 -14
  32. package/ProjectTemplate/src/Components/AppComponents/LandingPage/LandingPage.html +0 -0
  33. package/ProjectTemplate/src/Components/AppComponents/LandingPage/LandingPage.js +0 -53
  34. package/ProjectTemplate/src/Components/AppComponents/MainMenu/MainMenu.css +0 -80
  35. package/ProjectTemplate/src/Components/AppComponents/MainMenu/MainMenu.html +0 -39
  36. package/ProjectTemplate/src/Components/AppComponents/MainMenu/MainMenu.js +0 -42
  37. package/ProjectTemplate/src/Components/AppComponents/MyLayout/MyLayout.css +0 -0
  38. package/ProjectTemplate/src/Components/AppComponents/MyLayout/MyLayout.html +0 -0
  39. package/ProjectTemplate/src/Components/AppComponents/MyLayout/MyLayout.js +0 -13
  40. package/ProjectTemplate/src/Components/AppComponents/MyNavigation/MyNavigation.css +0 -49
  41. package/ProjectTemplate/src/Components/AppComponents/MyNavigation/MyNavigation.html +0 -1
  42. package/ProjectTemplate/src/Components/AppComponents/MyNavigation/MyNavigation.js +0 -60
  43. package/ProjectTemplate/src/Components/AppComponents/Playground/Playground.css +0 -12
  44. package/ProjectTemplate/src/Components/AppComponents/Playground/Playground.html +0 -0
  45. package/ProjectTemplate/src/Components/AppComponents/Playground/Playground.js +0 -126
  46. package/ProjectTemplate/src/Components/AppComponents/SliceTeamCard/SliceTeamCard.css +0 -104
  47. package/ProjectTemplate/src/Components/AppComponents/SliceTeamCard/SliceTeamCard.html +0 -12
  48. package/ProjectTemplate/src/Components/AppComponents/SliceTeamCard/SliceTeamCard.js +0 -74
  49. package/ProjectTemplate/src/Components/AppComponents/SwitchDocumentation/SwitchDocumentation.css +0 -21
  50. package/ProjectTemplate/src/Components/AppComponents/SwitchDocumentation/SwitchDocumentation.html +0 -35
  51. package/ProjectTemplate/src/Components/AppComponents/SwitchDocumentation/SwitchDocumentation.js +0 -103
  52. package/ProjectTemplate/src/Components/AppComponents/TheSliceTeam/TheSliceTeam.css +0 -23
  53. package/ProjectTemplate/src/Components/AppComponents/TheSliceTeam/TheSliceTeam.html +0 -6
  54. package/ProjectTemplate/src/Components/AppComponents/TheSliceTeam/TheSliceTeam.js +0 -129
  55. package/ProjectTemplate/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.css +0 -0
  56. package/ProjectTemplate/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.html +0 -7
  57. package/ProjectTemplate/src/Components/AppComponents/WhatIsSlice/WhatIsSlice.js +0 -15
  58. package/ProjectTemplate/src/Components/Service/FetchManager/FetchManager.js +0 -133
  59. package/ProjectTemplate/src/Components/Service/IndexedDbManager/IndexedDbManager.js +0 -141
  60. package/ProjectTemplate/src/Components/Service/Link/Link.js +0 -26
  61. package/ProjectTemplate/src/Components/Visual/Button/Button.css +0 -47
  62. package/ProjectTemplate/src/Components/Visual/Button/Button.html +0 -5
  63. package/ProjectTemplate/src/Components/Visual/Button/Button.js +0 -70
  64. package/ProjectTemplate/src/Components/Visual/Card/Card.css +0 -68
  65. package/ProjectTemplate/src/Components/Visual/Card/Card.html +0 -7
  66. package/ProjectTemplate/src/Components/Visual/Card/Card.js +0 -107
  67. package/ProjectTemplate/src/Components/Visual/Checkbox/Checkbox.css +0 -87
  68. package/ProjectTemplate/src/Components/Visual/Checkbox/Checkbox.html +0 -8
  69. package/ProjectTemplate/src/Components/Visual/Checkbox/Checkbox.js +0 -86
  70. package/ProjectTemplate/src/Components/Visual/Details/Details.css +0 -70
  71. package/ProjectTemplate/src/Components/Visual/Details/Details.html +0 -9
  72. package/ProjectTemplate/src/Components/Visual/Details/Details.js +0 -76
  73. package/ProjectTemplate/src/Components/Visual/DropDown/DropDown.css +0 -60
  74. package/ProjectTemplate/src/Components/Visual/DropDown/DropDown.html +0 -5
  75. package/ProjectTemplate/src/Components/Visual/DropDown/DropDown.js +0 -63
  76. package/ProjectTemplate/src/Components/Visual/Grid/Grid.css +0 -7
  77. package/ProjectTemplate/src/Components/Visual/Grid/Grid.html +0 -1
  78. package/ProjectTemplate/src/Components/Visual/Grid/Grid.js +0 -57
  79. package/ProjectTemplate/src/Components/Visual/Icon/Icon.css +0 -510
  80. package/ProjectTemplate/src/Components/Visual/Icon/Icon.html +0 -1
  81. package/ProjectTemplate/src/Components/Visual/Icon/Icon.js +0 -89
  82. package/ProjectTemplate/src/Components/Visual/Icon/slc.eot +0 -0
  83. package/ProjectTemplate/src/Components/Visual/Icon/slc.json +0 -555
  84. package/ProjectTemplate/src/Components/Visual/Icon/slc.styl +0 -507
  85. package/ProjectTemplate/src/Components/Visual/Icon/slc.svg +0 -1485
  86. package/ProjectTemplate/src/Components/Visual/Icon/slc.symbol.svg +0 -1059
  87. package/ProjectTemplate/src/Components/Visual/Icon/slc.ttf +0 -0
  88. package/ProjectTemplate/src/Components/Visual/Icon/slc.woff +0 -0
  89. package/ProjectTemplate/src/Components/Visual/Icon/slc.woff2 +0 -0
  90. package/ProjectTemplate/src/Components/Visual/Input/Input.css +0 -91
  91. package/ProjectTemplate/src/Components/Visual/Input/Input.html +0 -4
  92. package/ProjectTemplate/src/Components/Visual/Input/Input.js +0 -215
  93. package/ProjectTemplate/src/Components/Visual/Layout/Layout.css +0 -0
  94. package/ProjectTemplate/src/Components/Visual/Layout/Layout.html +0 -0
  95. package/ProjectTemplate/src/Components/Visual/Layout/Layout.js +0 -49
  96. package/ProjectTemplate/src/Components/Visual/Loading/Loading.css +0 -56
  97. package/ProjectTemplate/src/Components/Visual/Loading/Loading.html +0 -83
  98. package/ProjectTemplate/src/Components/Visual/Loading/Loading.js +0 -38
  99. package/ProjectTemplate/src/Components/Visual/MultiRoute/MultiRoute.js +0 -93
  100. package/ProjectTemplate/src/Components/Visual/Navbar/Navbar.css +0 -115
  101. package/ProjectTemplate/src/Components/Visual/Navbar/Navbar.html +0 -44
  102. package/ProjectTemplate/src/Components/Visual/Navbar/Navbar.js +0 -141
  103. package/ProjectTemplate/src/Components/Visual/NotFound/NotFound.css +0 -117
  104. package/ProjectTemplate/src/Components/Visual/NotFound/NotFound.html +0 -24
  105. package/ProjectTemplate/src/Components/Visual/NotFound/NotFound.js +0 -16
  106. package/ProjectTemplate/src/Components/Visual/Route/Route.js +0 -93
  107. package/ProjectTemplate/src/Components/Visual/Select/Select.css +0 -84
  108. package/ProjectTemplate/src/Components/Visual/Select/Select.html +0 -8
  109. package/ProjectTemplate/src/Components/Visual/Select/Select.js +0 -195
  110. package/ProjectTemplate/src/Components/Visual/Switch/Switch.css +0 -76
  111. package/ProjectTemplate/src/Components/Visual/Switch/Switch.html +0 -8
  112. package/ProjectTemplate/src/Components/Visual/Switch/Switch.js +0 -102
  113. package/ProjectTemplate/src/Components/Visual/TreeItem/TreeItem.css +0 -36
  114. package/ProjectTemplate/src/Components/Visual/TreeItem/TreeItem.html +0 -1
  115. package/ProjectTemplate/src/Components/Visual/TreeItem/TreeItem.js +0 -126
  116. package/ProjectTemplate/src/Components/Visual/TreeView/TreeView.css +0 -8
  117. package/ProjectTemplate/src/Components/Visual/TreeView/TreeView.html +0 -1
  118. package/ProjectTemplate/src/Components/Visual/TreeView/TreeView.js +0 -48
  119. package/ProjectTemplate/src/Components/components.js +0 -42
  120. package/ProjectTemplate/src/Styles/sliceStyles.css +0 -34
  121. package/ProjectTemplate/src/Themes/Dark.css +0 -42
  122. package/ProjectTemplate/src/Themes/Light.css +0 -31
  123. package/ProjectTemplate/src/Themes/Slice.css +0 -47
  124. package/ProjectTemplate/src/images/Slice.js-logo.png +0 -0
  125. package/ProjectTemplate/src/images/favicon.ico +0 -0
  126. package/ProjectTemplate/src/images/im2/Slice.js-logo.png +0 -0
  127. package/ProjectTemplate/src/routes.js +0 -36
  128. package/ProjectTemplate/src/sliceConfig.json +0 -58
@@ -1,103 +0,0 @@
1
- export default class SwitchDocumentation extends HTMLElement {
2
- constructor(props) {
3
- super();
4
- slice.attachTemplate(this);
5
-
6
- slice.controller.setComponentProps(this, props);
7
- this.debuggerProps = [];
8
- }
9
-
10
- async init() {
11
- await this.createSwitch(this.querySelector('.mySwitch'), {}, `{}`);
12
- await this.createSwitch(
13
- this.querySelector('.colorSwitch'),
14
- { customColor: 'gold' },
15
- `{
16
- customColor: "gold"
17
- }`
18
- );
19
- await this.createSwitch(
20
- this.querySelector('.label'),
21
- {
22
- label: 'Switch',
23
- },
24
- `{
25
- label: "Switch",
26
- }`
27
- );
28
- await this.createSwitch(
29
- this.querySelector('.labelLeft'),
30
- {
31
- label: 'Left',
32
- labelPlacement: 'left',
33
- },
34
- `{
35
- label: "Left",
36
- labelPlacement: "left",
37
- }`
38
- );
39
- await this.createSwitch(
40
- this.querySelector('.labelTop'),
41
- {
42
- label: 'Top',
43
- labelPlacement: 'top',
44
- },
45
- `{
46
- label: "Top",
47
- labelPlacement: "top",
48
- }`
49
- );
50
- await this.createSwitch(
51
- this.querySelector('.labelRight'),
52
- {
53
- label: 'Right',
54
- labelPlacement: 'right',
55
- },
56
- `{
57
- label: "Right",
58
- labelPlacement: "right",
59
- }`
60
- );
61
- await this.createSwitch(
62
- this.querySelector('.labelBottom'),
63
- {
64
- label: 'Bottom',
65
- labelPlacement: 'bottom',
66
- },
67
- `{
68
- label: "Bottom",
69
- labelPlacement: "bottom",
70
- }`
71
- );
72
- }
73
-
74
- async createSwitch(appendTo, switchProps, codeProps) {
75
- if (!codeProps) {
76
- codeProps = '{}';
77
- }
78
- const mySwitch = await slice.build('Switch', switchProps);
79
-
80
- const componentCode = await slice.build('CodeVisualizer', {
81
- value: `const mySwitch = await slice.build("Switch", ${codeProps});
82
-
83
- `,
84
- language: 'javascript',
85
- });
86
-
87
- const div = document.createElement('div');
88
- const switchDiv = document.createElement('div');
89
- switchDiv.classList.add('switchs');
90
- switchDiv.appendChild(mySwitch);
91
- div.classList.add('switchs_container');
92
- div.appendChild(switchDiv);
93
- div.appendChild(componentCode);
94
-
95
- if (appendTo) {
96
- appendTo.appendChild(div);
97
- }
98
-
99
- return div;
100
- }
101
- }
102
-
103
- customElements.define('slice-switchdocumentation', SwitchDocumentation);
@@ -1,23 +0,0 @@
1
- .slice_team {
2
- display: flex;
3
- flex-direction: column;
4
- align-items: center;
5
- padding: 2rem;
6
- margin-top: 80px; /* Ajusta este valor según la altura de tu navbar */
7
- width: 100%;
8
- }
9
-
10
- .slice_team_title {
11
- font-size: 2rem;
12
- color: var(--font-primary-color);
13
- margin-bottom: 1rem;
14
- text-align: center;
15
- }
16
-
17
- .slice_team_container {
18
- display: flex;
19
- flex-direction: column; /* Cambiado para que estén en columna */
20
- align-items: center; /* Centrar las tarjetas */
21
- gap: 1.5rem;
22
- width: 100%;
23
- }
@@ -1,6 +0,0 @@
1
- <div class="slice_team">
2
- <h2 class="slice_team_title">Our Team</h2>
3
- <div class="slice_team_container"></div>
4
- </div>
5
-
6
-
@@ -1,129 +0,0 @@
1
- export default class TheSliceTeam extends HTMLElement {
2
- constructor(props) {
3
- super();
4
- slice.attachTemplate(this);
5
-
6
- this.$container = this.querySelector('.slice_team_container');
7
- this.$title = this.querySelector('.slice_team_title');
8
-
9
- slice.controller.setComponentProps(this, props);
10
- this.debuggerProps = ['members'];
11
- }
12
-
13
- async init() {
14
-
15
-
16
-
17
- const navBar = await slice.build('Navbar', {
18
- position: 'fixed',
19
- logo: {
20
- src: '../../images/Slice.js-logo.png',
21
- path: '/',
22
- },
23
- items: [
24
- {
25
- text: 'Home',
26
- path: '/',
27
- },
28
- {
29
- text: 'Documentation',
30
- path: '/Documentation',
31
- },
32
- {
33
- text: 'Playground',
34
- path: '/Playground',
35
- },
36
- {
37
- text: 'Our Team',
38
- path: '/Team',
39
- }
40
-
41
- ],
42
- buttons: [
43
- {
44
- value: 'Change Theme',
45
- // color:
46
- onClickCallback: async () => {
47
-
48
- let theme = slice.stylesManager.themeManager.currentTheme;
49
- if (theme === 'Slice') {
50
- await slice.setTheme('Light');
51
- //theme = 'Light';
52
- } else if (theme === 'Light') {
53
- await slice.setTheme('Dark');
54
- //theme = 'Dark';
55
- } else if (theme === 'Dark') {
56
- await slice.setTheme('Slice');
57
- //theme = 'Slice';
58
- }
59
- },
60
- },
61
- ],
62
- });
63
-
64
-
65
- this.appendChild(navBar);
66
-
67
- const Victor = {
68
- name: "Victor Kneider",
69
- role: "Founder. Lead Developer. Software Architect.",
70
- image:"https://avatars.githubusercontent.com/u/103617388?v=4",
71
- description: "Computer Engineer passionate and ethusiast about technology and Component-Based Development. He is the creator of Slice.js and the main developer of the project.",
72
- links: [
73
- {label: "Github", href: "https://github.com/VKneider" },
74
- {label: "Linkedin", href:"https://www.linkedin.com/in/vkneider/"}
75
- ]
76
-
77
-
78
-
79
-
80
- }
81
-
82
-
83
- const Julio = {
84
- name: "Julio Graterol",
85
- role: "Frontend Developer. Visual Components Library Creator and Designer",
86
- image:"https://avatars.githubusercontent.com/u/99130732?v=4",
87
- //julio is a frontend developer and designer, he is the creator of the visual components library and the designer of the Slice.js logo and website.
88
- description: "Frontend Developer and Designer. He is the creator of the Visual Components Library and the designer of the Slice.js logo and website.",
89
- links: [
90
- {label: "Github", href: "https://github.com/juliograterol"},
91
- {label: "Linkedin", href:"https://www.linkedin.com/in/julio-graterol-187589289/"}
92
- ]
93
-
94
-
95
- }
96
-
97
- const members = [Victor, Julio];
98
-
99
- await this.addMembers(members);
100
-
101
- }
102
-
103
- async addMembers(members) {
104
- for (let i = 0; i < members.length; i++) {
105
- await this.addMember(members[i]);
106
- }
107
- }
108
-
109
- async addMember(member) {
110
- const card = await slice.build('SliceTeamCard', {
111
- name: member.name,
112
- role: member.role,
113
- image: member.image,
114
- description: member.description,
115
- links: member.links
116
- });
117
- this.$container.appendChild(card);
118
- }
119
-
120
- get members() {
121
- return this._members;
122
- }
123
-
124
- set members(values) {
125
- this._members = values;
126
- }
127
- }
128
-
129
- window.customElements.define('slice-team', TheSliceTeam);
@@ -1,7 +0,0 @@
1
- <h1>What is Slice-js?</h1>
2
- <p>Slice.js is a web framework designed to simplify the creation of complex applications with straightforward code, enabling both novice and experienced developers to quickly advance in building web applications.
3
- </p>
4
- <p>The framework is built on a component-based architecture, allowing developers to construct web applications in a modular way by creating reusable components that can be utilized across different projects. Slice.js also provides a library of pre-built components to streamline the development process.
5
- </p>
6
- <p>In addition to this, Slice.js offers features like theming, routing, frontend component debugging, file structure organization, and other functionalities that help make web development more efficient and manageable.
7
- </p>
@@ -1,15 +0,0 @@
1
- export default class WhatIsSlice extends HTMLElement {
2
- constructor(props) {
3
- super();
4
- slice.attachTemplate(this);
5
-
6
- slice.controller.setComponentProps(this, props);
7
- this.debuggerProps = [];
8
- }
9
-
10
- init() {}
11
-
12
-
13
- }
14
-
15
- customElements.define("slice-whatisslice", WhatIsSlice);
@@ -1,133 +0,0 @@
1
- export default class FetchManager {
2
- constructor(props) {
3
- const { baseUrl, timeout } = props;
4
- if (baseUrl !== undefined) {
5
- this.baseUrl = baseUrl;
6
- }
7
- this.methods = ['GET', 'POST', 'PUT', 'DELETE'];
8
- this.lastRequest = null;
9
- this.cacheEnabled = false;
10
- this.defaultHeaders = {};
11
- timeout ? (this.timeout = timeout) : (this.timeout = 10000);
12
- }
13
-
14
- async request(
15
- method,
16
- data,
17
- endpoint,
18
- onRequestSuccess,
19
- onRequestError,
20
- refetchOnError = false,
21
- requestOptions = {}
22
- ) {
23
- if (!this.methods.includes(method)) throw new Error('Invalid method');
24
- if (data && typeof data !== 'object') throw new Error('Invalid data, not JSON');
25
- const controller = new AbortController();
26
-
27
- let options;
28
- if (method !== 'GET') {
29
- options = {
30
- method: method,
31
- headers: {
32
- 'Content-Type': 'application/json',
33
- ...this.defaultHeaders,
34
- ...requestOptions.headers,
35
- },
36
- signal: controller.signal,
37
- };
38
- } else {
39
- options = {
40
- method: method,
41
- headers: {
42
- ...this.defaultHeaders,
43
- ...requestOptions.headers,
44
- },
45
- signal: controller.signal,
46
- };
47
- }
48
-
49
- if (data) {
50
- options.body = JSON.stringify(data);
51
- }
52
-
53
- let loading;
54
- if (!slice.controller.getComponent('Loading')) {
55
- loading = await slice.build('Loading', { sliceId: 'Loading' });
56
- } else {
57
- loading = slice.controller.getComponent('Loading');
58
- }
59
- loading.start();
60
- const timeoutId = setTimeout(() => controller.abort(), this.timeout || 10000);
61
-
62
- try {
63
- let response;
64
-
65
- // Check if cache is enabled and a cached response exists
66
- if (this.cacheEnabled && this.lastRequest && this.lastRequest.endpoint === endpoint) {
67
- return this.lastRequest.response;
68
- }
69
-
70
- if (this.baseUrl !== undefined) {
71
- response = await fetch(this.baseUrl + endpoint, options);
72
- } else {
73
- response = await fetch(endpoint, options);
74
- }
75
-
76
- if (response.ok) {
77
- if (typeof onRequestSuccess === 'function') {
78
- onRequestSuccess(data, response);
79
- }
80
- } else {
81
- if (typeof onRequestError === 'function') {
82
- onRequestError(data, response);
83
- }
84
- if (refetchOnError) {
85
- // Retry the request in case of error
86
- return await this.request(
87
- method,
88
- data,
89
- endpoint,
90
- onRequestSuccess,
91
- onRequestError,
92
- refetchOnError,
93
- requestOptions
94
- );
95
- }
96
- }
97
-
98
- let output = await response.json();
99
- loading.stop();
100
-
101
- // Cache the response if cache is enabled
102
- if (this.cacheEnabled) {
103
- this.lastRequest = { data, response, endpoint };
104
- }
105
-
106
- return output;
107
- } catch (error) {
108
- if (error.message === 'Failed to fetch') {
109
- slice.logger.logError('Se perdió la conexión a internet');
110
- } else {
111
- console.error('Error al realizar la solicitud:', error);
112
- }
113
- loading.stop();
114
- throw error;
115
- } finally {
116
- clearTimeout(timeoutId);
117
- }
118
- }
119
-
120
- // Enable or disable caching of responses
121
- enableCache() {
122
- this.cacheEnabled = true;
123
- }
124
-
125
- disableCache() {
126
- this.cacheEnabled = false;
127
- }
128
-
129
- // Set default headers for all requests
130
- setDefaultHeaders(headers) {
131
- this.defaultHeaders = headers;
132
- }
133
- }
@@ -1,141 +0,0 @@
1
- export default class IndexedDbManager {
2
- constructor(databaseName, storeName) {
3
- this.databaseName = databaseName;
4
- this.storeName = storeName;
5
- this.db = null;
6
- }
7
-
8
- async openDatabase() {
9
- return new Promise((resolve, reject) => {
10
- const request = indexedDB.open(this.databaseName);
11
-
12
- request.onupgradeneeded = (event) => {
13
- const db = event.target.result;
14
- if (!db.objectStoreNames.contains(this.storeName)) {
15
- db.createObjectStore(this.storeName, {
16
- keyPath: 'id',
17
- autoIncrement: true,
18
- });
19
- }
20
- };
21
-
22
- request.onsuccess = (event) => {
23
- this.db = event.target.result;
24
- resolve(this.db);
25
- };
26
-
27
- request.onerror = (event) => {
28
- reject(new Error(`Error opening IndexedDB: ${event.target.error}`));
29
- };
30
- });
31
- }
32
-
33
- closeDatabase() {
34
- if (this.db) {
35
- this.db.close();
36
- this.db = null;
37
- }
38
- }
39
-
40
- async addItem(item) {
41
- const db = await this.openDatabase();
42
- return new Promise((resolve, reject) => {
43
- const transaction = db.transaction([this.storeName], 'readwrite');
44
- const store = transaction.objectStore(this.storeName);
45
- const request = store.add(item);
46
-
47
- request.onsuccess = () => {
48
- resolve(request.result);
49
- };
50
-
51
- request.onerror = (event) => {
52
- reject(new Error(`Error adding item to IndexedDB: ${event.target.error}`));
53
- };
54
- });
55
- }
56
-
57
- async updateItem(item) {
58
- const db = await this.openDatabase();
59
- return new Promise((resolve, reject) => {
60
- const transaction = db.transaction([this.storeName], 'readwrite');
61
- const store = transaction.objectStore(this.storeName);
62
- const request = store.put(item);
63
-
64
- request.onsuccess = () => {
65
- resolve(request.result);
66
- };
67
-
68
- request.onerror = (event) => {
69
- reject(new Error(`Error updating item in IndexedDB: ${event.target.error}`));
70
- };
71
- });
72
- }
73
-
74
- async getItem(id) {
75
- const db = await this.openDatabase();
76
- return new Promise((resolve, reject) => {
77
- const transaction = db.transaction([this.storeName], 'readonly');
78
- const store = transaction.objectStore(this.storeName);
79
- const request = store.get(id);
80
-
81
- request.onsuccess = () => {
82
- resolve(request.result);
83
- };
84
-
85
- request.onerror = (event) => {
86
- reject(new Error(`Error getting item from IndexedDB: ${event.target.error}`));
87
- };
88
- });
89
- }
90
-
91
- async deleteItem(id) {
92
- const db = await this.openDatabase();
93
- return new Promise((resolve, reject) => {
94
- const transaction = db.transaction([this.storeName], 'readwrite');
95
- const store = transaction.objectStore(this.storeName);
96
- const request = store.delete(id);
97
-
98
- request.onsuccess = () => {
99
- resolve();
100
- };
101
-
102
- request.onerror = (event) => {
103
- reject(new Error(`Error deleting item from IndexedDB: ${event.target.error}`));
104
- };
105
- });
106
- }
107
-
108
- async getAllItems() {
109
- const db = await this.openDatabase();
110
- return new Promise((resolve, reject) => {
111
- const transaction = db.transaction([this.storeName], 'readonly');
112
- const store = transaction.objectStore(this.storeName);
113
- const request = store.getAll();
114
-
115
- request.onsuccess = () => {
116
- resolve(request.result);
117
- };
118
-
119
- request.onerror = (event) => {
120
- reject(new Error(`Error getting items from IndexedDB: ${event.target.error}`));
121
- };
122
- });
123
- }
124
-
125
- async clearItems() {
126
- const db = await this.openDatabase();
127
- return new Promise((resolve, reject) => {
128
- const transaction = db.transaction([this.storeName], 'readwrite');
129
- const store = transaction.objectStore(this.storeName);
130
- const request = store.clear();
131
-
132
- request.onsuccess = () => {
133
- resolve();
134
- };
135
-
136
- request.onerror = (event) => {
137
- reject(new Error(`Error clearing items in IndexedDB: ${event.target.error}`));
138
- };
139
- });
140
- }
141
- }
@@ -1,26 +0,0 @@
1
- export default class Link extends HTMLElement {
2
- constructor(props = {}) {
3
- super();
4
- this.props = props;
5
- this.innerHTML = this.getTemplate(props);
6
- this.init();
7
- }
8
-
9
- init() {
10
- this.addEventListener('click', this.onClick);
11
- }
12
-
13
- async onClick(event) {
14
- event.preventDefault();
15
- const path = this.querySelector('a').getAttribute('href');
16
- const routeTargets = document.querySelectorAll('slice-routetarget');
17
- slice.router.navigate(path);
18
- }
19
-
20
- getTemplate(props = {}) {
21
- const { path = '#', classes = '', text = '' } = props;
22
- return `<a href="${path}" class="${classes}" data-route>${text}</a>`;
23
- }
24
- }
25
-
26
- customElements.define('slice-link', Link);
@@ -1,47 +0,0 @@
1
- .slice_button_container {
2
- padding: 10px;
3
- }
4
- .slice_button_value {
5
- user-select: none;
6
- cursor: pointer;
7
- }
8
- .slice_button {
9
- display: flex;
10
- align-items: center;
11
- justify-content: center;
12
- cursor: pointer;
13
- overflow: hidden;
14
- position: relative;
15
- max-width: fit-content;
16
- background-color: var(--primary-color);
17
- color: var(--primary-color-contrast);
18
- border-radius: var(--border-radius-slice);
19
- border: var(--slice-border) solid var(--primary-color);
20
- font-weight: 800;
21
- min-width: 100%;
22
- padding: 10px;
23
- -webkit-transition-duration: 0.4s; /* Safari */
24
- transition-duration: 0.4s;
25
- }
26
- .slice_button:after {
27
- content: "";
28
- width: 100%;
29
- height: 100%;
30
- border-radius: 100%;
31
- background: #ffffff50;
32
- position: absolute;
33
- display: block;
34
- opacity: 0;
35
- scale: 10;
36
- transition: all 1s;
37
- }
38
- .slice_button:active {
39
- transform: translateY(5px);
40
- }
41
- .slice_button:active:after {
42
- scale: 0;
43
- padding: 0;
44
- margin: 0;
45
- opacity: 1;
46
- transition: 0s;
47
- }
@@ -1,5 +0,0 @@
1
- <div class="slice_button_container">
2
- <button class="slice_button">
3
- <label class="slice_button_value"></label>
4
- </button>
5
- </div>