slicejs-cli 1.0.44 → 1.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Service/FetchManager/FetchManager.js +109 -37
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Service/Translator/Translator.js +15 -15
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Service/Translator/messages.json +50 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Controller/Controller.js +81 -83
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Debugger/Debugger.css +47 -10
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Debugger/Debugger.html +7 -3
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Debugger/Debugger.js +114 -41
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Logger/Logger.js +11 -11
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/StylesManager/StylesManager.js +32 -28
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Button/Button.css +44 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Button/Button.html +5 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Button/Button.js +39 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Card/Card.css +63 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Card/Card.html +7 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Card/Card.js +110 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Checkbox/Checkbox.css +87 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Checkbox/Checkbox.html +8 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Checkbox/Checkbox.js +87 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/CodeValidator/CodeValidator.css +97 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/CodeValidator/CodeValidator.html +18 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/CodeValidator/CodeValidator.js +86 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/Icon.css +505 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/Icon.html +1 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/Icon.js +95 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.eot +0 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.json +550 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.styl +502 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.svg +1470 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.symbol.svg +1035 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.ttf +0 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.woff +0 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.woff2 +0 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Input/Input.css +87 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Input/Input.html +4 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Input/Input.js +210 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Loading/Loading.css +56 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Loading/Loading.html +83 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Loading/Loading.js +39 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Navbar/Navbar.css +30 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Navbar/Navbar.html +6 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Navbar/Navbar.js +39 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Select/Select.css +91 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Select/Select.html +8 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Select/Select.js +210 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Switch/Switch.css +76 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Switch/Switch.html +8 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Switch/Switch.js +109 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester/Tester.css +34 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester/Tester.html +7 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester/Tester.js +33 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester2/Tester2.css +34 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester2/Tester2.html +43 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester2/Tester2.js +39 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/ToastAlert/ToastAlert.css +110 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/ToastAlert/ToastAlert.html +12 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/ToastAlert/ToastAlert.js +65 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/complexNavbar/complexNavbar.css +163 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/complexNavbar/complexNavbar.html +15 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/complexNavbar/complexNavbar.js +48 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/imageCarousel/img-carousel.css +56 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/imageCarousel/img-carousel.html +6 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/imageCarousel/img-carousel.js +119 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/components.js +22 -11
- package/PROJECT_TEMPLATES/Basic/Slice/Slice.js +169 -147
- package/PROJECT_TEMPLATES/Basic/Slice/Styles/sliceStyles.css +10 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Themes/Dark.css +33 -9
- package/PROJECT_TEMPLATES/Basic/Slice/Themes/Light.css +27 -10
- package/PROJECT_TEMPLATES/Basic/Slice/Themes/Slice.css +27 -12
- package/PROJECT_TEMPLATES/Basic/Slice/package.json +12 -0
- package/PROJECT_TEMPLATES/Basic/Slice/sliceConfig.json +9 -1
- package/PROJECT_TEMPLATES/Basic/src/Views/LandingPage/index.html +9 -13
- package/PROJECT_TEMPLATES/Basic/src/Views/LandingPage/index.js +381 -9
- package/commands/Validations.js +0 -1
- package/commands/createComponent/createComponent.js +4 -1
- package/commands/deleteComponent/deleteComponent.js +7 -1
- package/commands/listComponents/listComponents.js +11 -7
- package/package.json +1 -1
- package/post.js +4 -4
|
@@ -1,62 +1,134 @@
|
|
|
1
|
-
|
|
2
|
-
constructor(
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export default class FetchManager {
|
|
2
|
+
constructor(props) {
|
|
3
|
+
const { baseUrl, timeout } = props;
|
|
4
|
+
if (baseUrl !== undefined) {
|
|
5
|
+
this.baseUrl = baseUrl;
|
|
5
6
|
}
|
|
6
7
|
this.methods = ["GET", "POST", "PUT", "DELETE"];
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
this.lastRequest = null;
|
|
9
|
+
this.cacheEnabled = false;
|
|
10
|
+
this.defaultHeaders = {};
|
|
11
|
+
timeout ? (this.timeout = timeout) : (this.timeout = 10000);
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
async request(
|
|
14
|
-
|
|
14
|
+
async request(
|
|
15
|
+
method,
|
|
16
|
+
data,
|
|
17
|
+
endpoint,
|
|
18
|
+
onRequestSuccess,
|
|
19
|
+
onRequestError,
|
|
20
|
+
refetchOnError = false,
|
|
21
|
+
requestOptions = {}
|
|
22
|
+
) {
|
|
15
23
|
if (!this.methods.includes(method)) throw new Error("Invalid method");
|
|
16
|
-
if(data && typeof data !== "object")
|
|
17
|
-
|
|
24
|
+
if (data && typeof data !== "object")
|
|
25
|
+
throw new Error("Invalid data, not JSON");
|
|
26
|
+
const controller = new AbortController();
|
|
18
27
|
|
|
19
28
|
let options;
|
|
20
|
-
if(method
|
|
29
|
+
if (method !== "GET") {
|
|
21
30
|
options = {
|
|
22
31
|
method: method,
|
|
23
32
|
headers: {
|
|
24
|
-
"Content-Type": "application/json"
|
|
33
|
+
"Content-Type": "application/json",
|
|
34
|
+
...this.defaultHeaders,
|
|
35
|
+
...requestOptions.headers,
|
|
25
36
|
},
|
|
26
37
|
signal: controller.signal,
|
|
27
|
-
}
|
|
28
|
-
}else{
|
|
38
|
+
};
|
|
39
|
+
} else {
|
|
29
40
|
options = {
|
|
30
41
|
method: method,
|
|
42
|
+
headers: {
|
|
43
|
+
...this.defaultHeaders,
|
|
44
|
+
...requestOptions.headers,
|
|
45
|
+
},
|
|
31
46
|
signal: controller.signal,
|
|
32
|
-
}
|
|
47
|
+
};
|
|
33
48
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if(data!=null){
|
|
49
|
+
|
|
50
|
+
if (data) {
|
|
37
51
|
options.body = JSON.stringify(data);
|
|
38
52
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
53
|
+
|
|
54
|
+
let loading;
|
|
55
|
+
if (!slice.controller.getComponent("Loading")) {
|
|
56
|
+
loading = await slice.build("Loading", { sliceId: "Loading" });
|
|
57
|
+
} else {
|
|
58
|
+
loading = slice.controller.getComponent("Loading");
|
|
42
59
|
}
|
|
43
|
-
|
|
44
|
-
let loading = await slice.getInstance("Loading", {id:"myLoading"});
|
|
45
60
|
loading.start();
|
|
46
|
-
const timeoutId = setTimeout(() => controller.abort(), this.timeout || 10000)
|
|
61
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeout || 10000);
|
|
62
|
+
|
|
63
|
+
try {
|
|
64
|
+
let response;
|
|
65
|
+
|
|
66
|
+
// Check if cache is enabled and a cached response exists
|
|
67
|
+
if (this.cacheEnabled && this.lastRequest && this.lastRequest.endpoint === endpoint) {
|
|
68
|
+
return this.lastRequest.response;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (this.baseUrl !== undefined) {
|
|
72
|
+
response = await fetch(this.baseUrl + endpoint, options);
|
|
73
|
+
} else {
|
|
74
|
+
response = await fetch(endpoint, options);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (response.ok) {
|
|
78
|
+
if (typeof onRequestSuccess === "function") {
|
|
79
|
+
onRequestSuccess(data, response);
|
|
80
|
+
}
|
|
81
|
+
} else {
|
|
82
|
+
if (typeof onRequestError === "function") {
|
|
83
|
+
onRequestError(data, response);
|
|
84
|
+
}
|
|
85
|
+
if (refetchOnError) {
|
|
86
|
+
// Retry the request in case of error
|
|
87
|
+
return await this.request(
|
|
88
|
+
method,
|
|
89
|
+
data,
|
|
90
|
+
endpoint,
|
|
91
|
+
onRequestSuccess,
|
|
92
|
+
onRequestError,
|
|
93
|
+
refetchOnError,
|
|
94
|
+
requestOptions
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
let output = await response.json();
|
|
100
|
+
loading.stop();
|
|
101
|
+
|
|
102
|
+
// Cache the response if cache is enabled
|
|
103
|
+
if (this.cacheEnabled) {
|
|
104
|
+
this.lastRequest = { data, response, endpoint };
|
|
105
|
+
}
|
|
47
106
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
107
|
+
return output;
|
|
108
|
+
} catch (error) {
|
|
109
|
+
if (error.message === "Failed to fetch") {
|
|
110
|
+
slice.logger.logError("Se perdió la conexión a internet");
|
|
111
|
+
} else {
|
|
112
|
+
console.error("Error al realizar la solicitud:", error);
|
|
113
|
+
}
|
|
114
|
+
loading.stop();
|
|
115
|
+
throw error;
|
|
116
|
+
} finally {
|
|
117
|
+
clearTimeout(timeoutId);
|
|
53
118
|
}
|
|
54
|
-
|
|
55
|
-
let output = await response.json();
|
|
56
|
-
loading.stop();
|
|
119
|
+
}
|
|
57
120
|
|
|
58
|
-
|
|
121
|
+
// Enable or disable caching of responses
|
|
122
|
+
enableCache() {
|
|
123
|
+
this.cacheEnabled = true;
|
|
59
124
|
}
|
|
60
|
-
|
|
61
|
-
}
|
|
62
125
|
|
|
126
|
+
disableCache() {
|
|
127
|
+
this.cacheEnabled = false;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Set default headers for all requests
|
|
131
|
+
setDefaultHeaders(headers) {
|
|
132
|
+
this.defaultHeaders = headers;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -1,22 +1,16 @@
|
|
|
1
|
+
import messages from "./messages.json" assert { type: "json" };
|
|
2
|
+
|
|
1
3
|
export default class Translator {
|
|
2
4
|
|
|
3
5
|
constructor() {
|
|
4
|
-
this.messages=
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
"es":{
|
|
13
|
-
|
|
14
|
-
"myInput":{
|
|
15
|
-
"placeholder":"Escribe aquí"
|
|
16
|
-
}
|
|
17
|
-
}
|
|
6
|
+
this.messages=messages;
|
|
7
|
+
this.currentLanguage = 'en';
|
|
8
|
+
|
|
9
|
+
if(slice.translator){
|
|
10
|
+
throw new Error("Translator already initialized")
|
|
11
|
+
}else{
|
|
12
|
+
slice.translator = this;
|
|
18
13
|
}
|
|
19
|
-
this.currentLanguage = 'en';
|
|
20
14
|
}
|
|
21
15
|
|
|
22
16
|
|
|
@@ -51,6 +45,12 @@ export default class Translator {
|
|
|
51
45
|
|
|
52
46
|
}
|
|
53
47
|
|
|
48
|
+
setMessages(messagesObject){
|
|
49
|
+
this.messages=messagesObject;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"en": {
|
|
3
|
+
"myInput": {
|
|
4
|
+
"placeholder": "Type here"
|
|
5
|
+
},
|
|
6
|
+
"cardYoutube": {
|
|
7
|
+
"title": "Youtube in English",
|
|
8
|
+
"text": "Youtube is a video sharing platform. You can watch videos, upload your own videos and comment on videos."
|
|
9
|
+
},
|
|
10
|
+
"cardGoogle": {
|
|
11
|
+
"title": "Google in English",
|
|
12
|
+
"text": "Google is a search engine. You can search for information, images, videos and much more."
|
|
13
|
+
},
|
|
14
|
+
"cardFacebook": {
|
|
15
|
+
"title": "Facebook in English",
|
|
16
|
+
"text": "Facebook is a social network. You can share photos, videos, statuses and chat with your friends."
|
|
17
|
+
},
|
|
18
|
+
"cardTwitter": {
|
|
19
|
+
"title": "Twitter in English",
|
|
20
|
+
"text": "Twitter is a social network. You can share tweets, follow other people and stay informed."
|
|
21
|
+
},
|
|
22
|
+
"buttonLanguage": {
|
|
23
|
+
"value": "Change language"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"es": {
|
|
27
|
+
"myInput": {
|
|
28
|
+
"placeholder": "Escribe aquí"
|
|
29
|
+
},
|
|
30
|
+
"cardYoutube": {
|
|
31
|
+
"title": "Youtube en Español",
|
|
32
|
+
"text": "Youtube es una plataforma de intercambio de videos. Puedes ver videos, subir tus propios videos y comentar en videos."
|
|
33
|
+
},
|
|
34
|
+
"cardGoogle": {
|
|
35
|
+
"title": "Google en Español",
|
|
36
|
+
"text": "Google es un motor de búsqueda. Puedes buscar información, imágenes, videos y mucho más."
|
|
37
|
+
},
|
|
38
|
+
"cardFacebook": {
|
|
39
|
+
"title": "Facebook en Español",
|
|
40
|
+
"text": "Facebook es una red social. Puedes compartir fotos, videos, estados y chatear con tus amigos."
|
|
41
|
+
},
|
|
42
|
+
"cardTwitter": {
|
|
43
|
+
"title": "Twitter en Español",
|
|
44
|
+
"text": "Twitter es una red social. Puedes compartir tweets, seguir a otras personas y mantenerte informado."
|
|
45
|
+
},
|
|
46
|
+
"buttonLanguage": {
|
|
47
|
+
"value": "Cambiar idioma"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -1,108 +1,106 @@
|
|
|
1
1
|
import components from "../../components.js";
|
|
2
2
|
|
|
3
3
|
export default class Controller {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
let sliceId = component.sliceId;
|
|
25
|
-
|
|
26
|
-
if (sliceId && sliceId.trim() !== ""){
|
|
27
|
-
if (this.activeComponents.has(sliceId)) {
|
|
28
|
-
slice.logger.logError("Controller", `A component with the same slice id attribute is already registered: ${sliceId}`);
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
}else {
|
|
32
|
-
sliceId = `slice-${this.idCounter}`;
|
|
33
|
-
component.sliceId = sliceId;
|
|
34
|
-
this.idCounter++;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
this.activeComponents.set(sliceId, component);
|
|
38
|
-
return true;
|
|
39
|
-
|
|
4
|
+
constructor() {
|
|
5
|
+
this.componentCategories = new Map(Object.entries(components));
|
|
6
|
+
this.templates = new Map();
|
|
7
|
+
this.classes = new Map();
|
|
8
|
+
this.requestedStyles = new Set();
|
|
9
|
+
this.activeComponents = new Map();
|
|
10
|
+
this.idCounter = 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
registerComponent(component) {
|
|
14
|
+
const htmlId = component.id;
|
|
15
|
+
|
|
16
|
+
if (htmlId && htmlId.trim() !== "") {
|
|
17
|
+
if (this.activeComponents.has(htmlId)) {
|
|
18
|
+
slice.logger.logError(
|
|
19
|
+
"Controller",
|
|
20
|
+
`A component with the same html id attribute is already registered: ${htmlId}`
|
|
21
|
+
);
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
40
24
|
}
|
|
41
25
|
|
|
42
|
-
|
|
43
|
-
return this.activeComponents.get(id);
|
|
44
|
-
}
|
|
26
|
+
let sliceId = component.sliceId;
|
|
45
27
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
component.
|
|
57
|
-
|
|
28
|
+
if (sliceId && sliceId.trim() !== "") {
|
|
29
|
+
if (this.activeComponents.has(sliceId)) {
|
|
30
|
+
slice.logger.logError(
|
|
31
|
+
"Controller",
|
|
32
|
+
`A component with the same slice id attribute is already registered: ${sliceId}`
|
|
33
|
+
);
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
sliceId = `${component.constructor.name[0].toLowerCase()}${component.constructor.name.slice(1)}-${this.idCounter}`;
|
|
38
|
+
component.sliceId = sliceId;
|
|
39
|
+
this.idCounter++;
|
|
58
40
|
}
|
|
59
41
|
|
|
42
|
+
this.activeComponents.set(sliceId, component);
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
60
45
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
46
|
+
getComponent(id) {
|
|
47
|
+
return this.activeComponents.get(id);
|
|
48
|
+
}
|
|
64
49
|
|
|
65
|
-
|
|
50
|
+
//Attach template to component
|
|
51
|
+
loadTemplateToComponent(component) {
|
|
52
|
+
const className = component.constructor.name;
|
|
53
|
+
const template = this.templates.get(className);
|
|
66
54
|
|
|
67
|
-
|
|
55
|
+
if (!template) {
|
|
56
|
+
console.error(`Template not found for component: ${className}`);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
68
59
|
|
|
69
|
-
|
|
60
|
+
component.innerHTML = template.innerHTML;
|
|
61
|
+
return component;
|
|
62
|
+
}
|
|
70
63
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
64
|
+
getComponentCategory(componentSliceId) {
|
|
65
|
+
return this.componentCategories.get(componentSliceId);
|
|
66
|
+
}
|
|
74
67
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
68
|
+
async fetchText(componentName, fileType) {
|
|
69
|
+
const componentCategory = this.getComponentCategory(componentName);
|
|
78
70
|
|
|
79
|
-
|
|
80
|
-
path = `Slice/${slice.paths.themes}/${componentName}.css`;
|
|
81
|
-
}
|
|
71
|
+
let path;
|
|
82
72
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return html;
|
|
86
|
-
|
|
73
|
+
if (fileType === "css") {
|
|
74
|
+
path = `Slice/${slice.paths.components}/${componentCategory}/${componentName}/${componentName}.css`;
|
|
87
75
|
}
|
|
88
76
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
component[prop] = props[prop];
|
|
93
|
-
}
|
|
94
|
-
}
|
|
77
|
+
if (fileType === "html") {
|
|
78
|
+
path = `Slice/${slice.paths.components}/${componentCategory}/${componentName}/${componentName}.html`;
|
|
79
|
+
}
|
|
95
80
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
component.visualProps = filteredProps;
|
|
81
|
+
if (fileType === "theme") {
|
|
82
|
+
path = `Slice/${slice.paths.themes}/${componentName}.css`;
|
|
99
83
|
}
|
|
100
84
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
this.activeComponents.delete(sliceId);
|
|
104
|
-
component.remove();
|
|
85
|
+
if (fileType === "styles") {
|
|
86
|
+
path = `Slice/${slice.paths.styles}/${componentName}.css`;
|
|
105
87
|
}
|
|
106
88
|
|
|
89
|
+
const response = await fetch(path);
|
|
90
|
+
const html = await response.text();
|
|
91
|
+
return html;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
setComponentProps(component, props) {
|
|
95
|
+
for (const prop in props) {
|
|
96
|
+
component[`_${prop}`] = null;
|
|
97
|
+
component[prop] = props[prop];
|
|
98
|
+
}
|
|
99
|
+
}
|
|
107
100
|
|
|
101
|
+
destroyComponent(component) {
|
|
102
|
+
const sliceId = component.sliceId;
|
|
103
|
+
this.activeComponents.delete(sliceId);
|
|
104
|
+
component.remove();
|
|
105
|
+
}
|
|
108
106
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
#debugger-container {
|
|
2
|
+
font-family: var(--font-family);
|
|
2
3
|
display: none;
|
|
3
4
|
position: fixed;
|
|
4
5
|
top: 20px;
|
|
5
6
|
left: 20px;
|
|
6
|
-
padding:
|
|
7
|
-
border:
|
|
7
|
+
padding: 10px;
|
|
8
|
+
border: var(--slice-border) solid var(--primary-color);
|
|
8
9
|
background-color: var(--primary-background-color);
|
|
9
10
|
z-index: 1000;
|
|
10
11
|
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
|
@@ -15,6 +16,12 @@
|
|
|
15
16
|
display: block;
|
|
16
17
|
}
|
|
17
18
|
|
|
19
|
+
.slice_thead td {
|
|
20
|
+
font-weight: bold;
|
|
21
|
+
background-color: var(--primary-color);
|
|
22
|
+
color: var(--primary-color-contrast);
|
|
23
|
+
}
|
|
24
|
+
|
|
18
25
|
#close-debugger {
|
|
19
26
|
cursor: pointer;
|
|
20
27
|
position: absolute;
|
|
@@ -29,27 +36,57 @@ h3 {
|
|
|
29
36
|
margin-bottom: 10px;
|
|
30
37
|
}
|
|
31
38
|
|
|
39
|
+
#component-details {
|
|
40
|
+
color: var(--font-primary-color);
|
|
41
|
+
}
|
|
42
|
+
.component-details-table {
|
|
43
|
+
overflow: scroll;
|
|
44
|
+
input {
|
|
45
|
+
outline: none;
|
|
46
|
+
border-bottom: 1px solid var(--tertiary-background-color);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
.component-details-table::-webkit-scrollbar {
|
|
50
|
+
width: 5px;
|
|
51
|
+
height: 5px;
|
|
52
|
+
}
|
|
53
|
+
.component-details-table::-webkit-scrollbar-thumb {
|
|
54
|
+
background: var(--secondary-color);
|
|
55
|
+
border-radius: var(--border-radius-slice);
|
|
56
|
+
}
|
|
57
|
+
|
|
32
58
|
#component-details table {
|
|
33
59
|
width: 100%;
|
|
34
60
|
border-collapse: collapse;
|
|
35
61
|
margin-top: 10px;
|
|
62
|
+
/* border: 1px solid var(--primary-color); */
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.debugger-header {
|
|
66
|
+
border-bottom: 1px solid var(--primary-color);
|
|
67
|
+
user-select: none;
|
|
68
|
+
cursor: grab;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.debugger-header:active {
|
|
72
|
+
cursor: grabbing;
|
|
36
73
|
}
|
|
37
74
|
|
|
38
75
|
#component-details th,
|
|
39
76
|
#component-details td {
|
|
40
|
-
|
|
41
|
-
padding: 12px;
|
|
77
|
+
padding: 10px;
|
|
42
78
|
text-align: left;
|
|
79
|
+
border-bottom: 1px solid var(--primary-color);
|
|
43
80
|
}
|
|
44
81
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
color: #2b2a4c;
|
|
82
|
+
input {
|
|
83
|
+
border: 0px;
|
|
48
84
|
}
|
|
49
85
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
color:
|
|
86
|
+
.slice_component-details td,
|
|
87
|
+
input {
|
|
88
|
+
background-color: var(--secondary-background-color);
|
|
89
|
+
color: var(--font-primary-color);
|
|
53
90
|
}
|
|
54
91
|
|
|
55
92
|
/* Estilo para las filas impares, solo para mejorar la legibilidad */
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
<div id="debugger-container">
|
|
2
|
-
|
|
2
|
+
<div class="debugger-header">
|
|
3
|
+
<div id="close-debugger">[×]</div>
|
|
3
4
|
<h3>Component Details</h3>
|
|
4
|
-
|
|
5
|
+
</div>
|
|
6
|
+
<div id="component-details">
|
|
7
|
+
<ul class="component-details-list"></ul>
|
|
8
|
+
<div class="component-details-table"></div>
|
|
9
|
+
</div>
|
|
5
10
|
</div>
|
|
6
|
-
|