mol_jsx_lib 0.0.1206 → 0.0.1208
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/node.deps.json +1 -1
- package/node.js +26 -2
- package/node.js.map +1 -1
- package/node.mjs +26 -2
- package/node.test.js +26 -2
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.deps.json +1 -1
- package/web.js +26 -2
- package/web.js.map +1 -1
- package/web.mjs +26 -2
package/node.mjs
CHANGED
|
@@ -1773,18 +1773,42 @@ var $;
|
|
|
1773
1773
|
factories.set(val, make);
|
|
1774
1774
|
return make;
|
|
1775
1775
|
}
|
|
1776
|
+
const getters = new WeakMap();
|
|
1777
|
+
function get_prop(host, field) {
|
|
1778
|
+
let props = getters.get(host);
|
|
1779
|
+
let get_val = props?.[field];
|
|
1780
|
+
if (get_val)
|
|
1781
|
+
return get_val;
|
|
1782
|
+
get_val = (next) => {
|
|
1783
|
+
if (next !== undefined)
|
|
1784
|
+
host[field] = next;
|
|
1785
|
+
return host[field];
|
|
1786
|
+
};
|
|
1787
|
+
Object.defineProperty(get_val, 'name', { value: field });
|
|
1788
|
+
if (!props) {
|
|
1789
|
+
props = {};
|
|
1790
|
+
getters.set(host, props);
|
|
1791
|
+
}
|
|
1792
|
+
props[field] = get_val;
|
|
1793
|
+
return get_val;
|
|
1794
|
+
}
|
|
1776
1795
|
function $mol_wire_sync(obj) {
|
|
1777
1796
|
return new Proxy(obj, {
|
|
1778
1797
|
get(obj, field) {
|
|
1779
1798
|
let val = obj[field];
|
|
1799
|
+
const temp = $mol_wire_task.getter(typeof val === 'function' ? val : get_prop(obj, field));
|
|
1780
1800
|
if (typeof val !== 'function')
|
|
1781
|
-
return
|
|
1782
|
-
const temp = $mol_wire_task.getter(val);
|
|
1801
|
+
return temp(obj, []).sync();
|
|
1783
1802
|
return function $mol_wire_sync(...args) {
|
|
1784
1803
|
const fiber = temp(obj, args);
|
|
1785
1804
|
return fiber.sync();
|
|
1786
1805
|
};
|
|
1787
1806
|
},
|
|
1807
|
+
set(obj, field, next) {
|
|
1808
|
+
const temp = $mol_wire_task.getter(get_prop(obj, field));
|
|
1809
|
+
temp(obj, [next]).sync();
|
|
1810
|
+
return true;
|
|
1811
|
+
},
|
|
1788
1812
|
construct(obj, args) {
|
|
1789
1813
|
const temp = $mol_wire_task.getter(factory(obj));
|
|
1790
1814
|
return temp(obj, args).sync();
|
package/node.test.js
CHANGED
|
@@ -1764,18 +1764,42 @@ var $;
|
|
|
1764
1764
|
factories.set(val, make);
|
|
1765
1765
|
return make;
|
|
1766
1766
|
}
|
|
1767
|
+
const getters = new WeakMap();
|
|
1768
|
+
function get_prop(host, field) {
|
|
1769
|
+
let props = getters.get(host);
|
|
1770
|
+
let get_val = props?.[field];
|
|
1771
|
+
if (get_val)
|
|
1772
|
+
return get_val;
|
|
1773
|
+
get_val = (next) => {
|
|
1774
|
+
if (next !== undefined)
|
|
1775
|
+
host[field] = next;
|
|
1776
|
+
return host[field];
|
|
1777
|
+
};
|
|
1778
|
+
Object.defineProperty(get_val, 'name', { value: field });
|
|
1779
|
+
if (!props) {
|
|
1780
|
+
props = {};
|
|
1781
|
+
getters.set(host, props);
|
|
1782
|
+
}
|
|
1783
|
+
props[field] = get_val;
|
|
1784
|
+
return get_val;
|
|
1785
|
+
}
|
|
1767
1786
|
function $mol_wire_sync(obj) {
|
|
1768
1787
|
return new Proxy(obj, {
|
|
1769
1788
|
get(obj, field) {
|
|
1770
1789
|
let val = obj[field];
|
|
1790
|
+
const temp = $mol_wire_task.getter(typeof val === 'function' ? val : get_prop(obj, field));
|
|
1771
1791
|
if (typeof val !== 'function')
|
|
1772
|
-
return
|
|
1773
|
-
const temp = $mol_wire_task.getter(val);
|
|
1792
|
+
return temp(obj, []).sync();
|
|
1774
1793
|
return function $mol_wire_sync(...args) {
|
|
1775
1794
|
const fiber = temp(obj, args);
|
|
1776
1795
|
return fiber.sync();
|
|
1777
1796
|
};
|
|
1778
1797
|
},
|
|
1798
|
+
set(obj, field, next) {
|
|
1799
|
+
const temp = $mol_wire_task.getter(get_prop(obj, field));
|
|
1800
|
+
temp(obj, [next]).sync();
|
|
1801
|
+
return true;
|
|
1802
|
+
},
|
|
1779
1803
|
construct(obj, args) {
|
|
1780
1804
|
const temp = $mol_wire_task.getter(factory(obj));
|
|
1781
1805
|
return temp(obj, args).sync();
|