|
@@ -19,11 +19,7 @@ function parseElements(raw_elements) {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
-function replaceUndefinedAttributes(elements, id) {
|
|
|
- const element = elements[id];
|
|
|
- if (element === undefined) {
|
|
|
- return;
|
|
|
- }
|
|
|
+function replaceUndefinedAttributes(element) {
|
|
|
element.class ??= [];
|
|
|
element.style ??= {};
|
|
|
element.props ??= {};
|
|
@@ -35,7 +31,6 @@ function replaceUndefinedAttributes(elements, id) {
|
|
|
default: { ids: element.children || [] },
|
|
|
...(element.slots ?? {}),
|
|
|
};
|
|
|
- Object.values(element.slots).forEach((slot) => slot.ids.forEach((id) => replaceUndefinedAttributes(elements, id)));
|
|
|
}
|
|
|
|
|
|
function getElement(id) {
|
|
@@ -318,7 +313,7 @@ window.onbeforeunload = function () {
|
|
|
};
|
|
|
|
|
|
function createApp(elements, options) {
|
|
|
- replaceUndefinedAttributes(elements, 0);
|
|
|
+ Object.entries(elements).forEach(([_, element]) => replaceUndefinedAttributes(element));
|
|
|
setInterval(() => ack(), 3000);
|
|
|
return (app = Vue.createApp({
|
|
|
data() {
|
|
@@ -381,7 +376,6 @@ function createApp(elements, options) {
|
|
|
const loadPromises = Object.entries(msg)
|
|
|
.filter(([_, element]) => element && (element.component || element.libraries))
|
|
|
.map(([_, element]) => loadDependencies(element, options.prefix, options.version));
|
|
|
-
|
|
|
await Promise.all(loadPromises);
|
|
|
|
|
|
for (const [id, element] of Object.entries(msg)) {
|
|
@@ -389,8 +383,8 @@ function createApp(elements, options) {
|
|
|
delete this.elements[id];
|
|
|
continue;
|
|
|
}
|
|
|
+ replaceUndefinedAttributes(element);
|
|
|
this.elements[id] = element;
|
|
|
- replaceUndefinedAttributes(this.elements, id);
|
|
|
}
|
|
|
},
|
|
|
run_javascript: (msg) => runJavascript(msg.code, msg.request_id),
|