olova 1.0.0 → 1.0.1
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/dist/olova.js +18 -18
- package/package.json +1 -1
package/dist/olova.js
CHANGED
|
@@ -30,7 +30,7 @@ class olova {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
defineCustomElement(name) {
|
|
33
|
-
const
|
|
33
|
+
const deshi = this;
|
|
34
34
|
class CustomElement extends HTMLElement {
|
|
35
35
|
connectedCallback() {
|
|
36
36
|
this.render();
|
|
@@ -38,7 +38,7 @@ class olova {
|
|
|
38
38
|
|
|
39
39
|
render() {
|
|
40
40
|
const props = this.getProps();
|
|
41
|
-
const componentFunction =
|
|
41
|
+
const componentFunction = deshi.components[name];
|
|
42
42
|
const renderedContent = componentFunction(props);
|
|
43
43
|
|
|
44
44
|
const tempContainer = document.createElement("div");
|
|
@@ -49,9 +49,9 @@ class olova {
|
|
|
49
49
|
|
|
50
50
|
if (renderedElement) {
|
|
51
51
|
parent.replaceChild(renderedElement, this);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
deshi.applyDirectivesToElement(renderedElement);
|
|
53
|
+
deshi.initReactiveSystem();
|
|
54
|
+
deshi.runEffects();
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -64,7 +64,7 @@ class olova {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
static get observedAttributes() {
|
|
67
|
-
return Object.keys(
|
|
67
|
+
return Object.keys(deshi.components[name]({}) || {});
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
@@ -933,9 +933,9 @@ class olova {
|
|
|
933
933
|
}
|
|
934
934
|
|
|
935
935
|
static init() {
|
|
936
|
-
const
|
|
937
|
-
window.$refs =
|
|
938
|
-
window.$ = (selector) =>
|
|
936
|
+
const deshi = new olova();
|
|
937
|
+
window.$refs = deshi.$refs;
|
|
938
|
+
window.$ = (selector) => deshi.$(selector);
|
|
939
939
|
// Create the useSignal function
|
|
940
940
|
const useSignalFunction = (obj = {}) => {
|
|
941
941
|
Object.assign(window.useSignal, obj);
|
|
@@ -946,37 +946,37 @@ class olova {
|
|
|
946
946
|
if (key === "call" || key === "apply") {
|
|
947
947
|
return Reflect.get(target, key);
|
|
948
948
|
}
|
|
949
|
-
|
|
949
|
+
deshi.track(key);
|
|
950
950
|
return Reflect.get(target, key);
|
|
951
951
|
},
|
|
952
952
|
set(target, key, value) {
|
|
953
953
|
if (Reflect.get(target, key) !== value) {
|
|
954
954
|
Reflect.set(target, key, value);
|
|
955
|
-
|
|
956
|
-
|
|
955
|
+
deshi.notify(key);
|
|
956
|
+
deshi.runEffects();
|
|
957
957
|
}
|
|
958
958
|
return true;
|
|
959
959
|
},
|
|
960
960
|
});
|
|
961
961
|
|
|
962
962
|
document.addEventListener("DOMContentLoaded", () => {
|
|
963
|
-
|
|
963
|
+
deshi.renderTemplate();
|
|
964
964
|
});
|
|
965
965
|
|
|
966
966
|
window.addEventListener("beforeunload", () => {
|
|
967
|
-
|
|
967
|
+
deshi.cleanup();
|
|
968
968
|
});
|
|
969
969
|
|
|
970
970
|
window.useEffect = (callback) => {
|
|
971
|
-
|
|
971
|
+
deshi.useEffect(callback);
|
|
972
972
|
};
|
|
973
973
|
window.component = (name, componentFunction) => {
|
|
974
|
-
|
|
974
|
+
deshi.registerComponent(name, componentFunction);
|
|
975
975
|
};
|
|
976
976
|
|
|
977
|
-
window.plugin = (name, handler) =>
|
|
977
|
+
window.plugin = (name, handler) => deshi.registerPlugin(name, handler);
|
|
978
978
|
|
|
979
|
-
return
|
|
979
|
+
return deshi;
|
|
980
980
|
}
|
|
981
981
|
|
|
982
982
|
renderTemplate() {
|