mol_jsx_lib 0.0.1333 → 0.0.1335
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.d.ts +11 -5
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +96 -18
- package/node.js.map +1 -1
- package/node.meta.tree +1 -0
- package/node.mjs +96 -18
- package/node.test.js +163 -18
- package/node.test.js.map +1 -1
- package/package.json +3 -2
- package/web.d.ts +11 -5
- package/web.d.ts.map +1 -1
- package/web.deps.json +1 -1
- package/web.js +96 -18
- package/web.js.map +1 -1
- package/web.meta.tree +1 -0
- package/web.mjs +96 -18
- package/web.test.js +67 -0
- package/web.test.js.map +1 -1
package/node.meta.tree
CHANGED
package/node.mjs
CHANGED
|
@@ -427,6 +427,21 @@ var $;
|
|
|
427
427
|
};
|
|
428
428
|
})($ || ($ = {}));
|
|
429
429
|
|
|
430
|
+
;
|
|
431
|
+
"use strict";
|
|
432
|
+
var $;
|
|
433
|
+
(function ($) {
|
|
434
|
+
function $mol_guid(length = 8, exists = () => false) {
|
|
435
|
+
for (;;) {
|
|
436
|
+
let id = Math.random().toString(36).substring(2, length + 2).toUpperCase();
|
|
437
|
+
if (exists(id))
|
|
438
|
+
continue;
|
|
439
|
+
return id;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
$.$mol_guid = $mol_guid;
|
|
443
|
+
})($ || ($ = {}));
|
|
444
|
+
|
|
430
445
|
;
|
|
431
446
|
"use strict";
|
|
432
447
|
var $;
|
|
@@ -445,6 +460,11 @@ var $;
|
|
|
445
460
|
var $;
|
|
446
461
|
(function ($) {
|
|
447
462
|
class $mol_wire_pub extends Object {
|
|
463
|
+
constructor(id = `$mol_wire_pub:${$mol_guid()}`) {
|
|
464
|
+
super();
|
|
465
|
+
this[Symbol.toStringTag] = id;
|
|
466
|
+
}
|
|
467
|
+
[Symbol.toStringTag];
|
|
448
468
|
data = [];
|
|
449
469
|
static get [Symbol.species]() {
|
|
450
470
|
return Array;
|
|
@@ -831,7 +851,6 @@ var $;
|
|
|
831
851
|
}
|
|
832
852
|
}
|
|
833
853
|
}
|
|
834
|
-
[Symbol.toStringTag];
|
|
835
854
|
cache = undefined;
|
|
836
855
|
get args() {
|
|
837
856
|
return this.data.slice(0, this.pub_from);
|
|
@@ -850,13 +869,12 @@ var $;
|
|
|
850
869
|
return this.task.name + '()';
|
|
851
870
|
}
|
|
852
871
|
constructor(id, task, host, args) {
|
|
853
|
-
super();
|
|
872
|
+
super(id);
|
|
854
873
|
this.task = task;
|
|
855
874
|
this.host = host;
|
|
856
875
|
if (args)
|
|
857
876
|
this.data.push(...args);
|
|
858
877
|
this.pub_from = this.sub_from = args?.length ?? 0;
|
|
859
|
-
this[Symbol.toStringTag] = id;
|
|
860
878
|
}
|
|
861
879
|
plan() {
|
|
862
880
|
$mol_wire_fiber.planning.add(this);
|
|
@@ -2200,21 +2218,6 @@ var $;
|
|
|
2200
2218
|
$.$mol_const = $mol_const;
|
|
2201
2219
|
})($ || ($ = {}));
|
|
2202
2220
|
|
|
2203
|
-
;
|
|
2204
|
-
"use strict";
|
|
2205
|
-
var $;
|
|
2206
|
-
(function ($) {
|
|
2207
|
-
function $mol_guid(length = 8, exists = () => false) {
|
|
2208
|
-
for (;;) {
|
|
2209
|
-
let id = Math.random().toString(36).substring(2, length + 2).toUpperCase();
|
|
2210
|
-
if (exists(id))
|
|
2211
|
-
continue;
|
|
2212
|
-
return id;
|
|
2213
|
-
}
|
|
2214
|
-
}
|
|
2215
|
-
$.$mol_guid = $mol_guid;
|
|
2216
|
-
})($ || ($ = {}));
|
|
2217
|
-
|
|
2218
2221
|
;
|
|
2219
2222
|
"use strict";
|
|
2220
2223
|
var $;
|
|
@@ -2886,6 +2889,81 @@ var $;
|
|
|
2886
2889
|
$.$mol_wire_set = $mol_wire_set;
|
|
2887
2890
|
})($ || ($ = {}));
|
|
2888
2891
|
|
|
2892
|
+
;
|
|
2893
|
+
"use strict";
|
|
2894
|
+
var $;
|
|
2895
|
+
(function ($) {
|
|
2896
|
+
const pubs = new WeakMap();
|
|
2897
|
+
function $mol_wire_proxy_pub(id, target) {
|
|
2898
|
+
let pub = pubs.get(target);
|
|
2899
|
+
if (!pub)
|
|
2900
|
+
pubs.set(target, pub = new $mol_wire_pub(id));
|
|
2901
|
+
return pub;
|
|
2902
|
+
}
|
|
2903
|
+
$.$mol_wire_proxy_pub = $mol_wire_proxy_pub;
|
|
2904
|
+
function $mol_wire_proxy(id, target) {
|
|
2905
|
+
if (!target)
|
|
2906
|
+
return target;
|
|
2907
|
+
const type = typeof target;
|
|
2908
|
+
if (type !== 'object' && type !== 'function')
|
|
2909
|
+
return target;
|
|
2910
|
+
return new Proxy(target, {
|
|
2911
|
+
get(target, property) {
|
|
2912
|
+
$mol_wire_proxy_pub(id, target).promote();
|
|
2913
|
+
const suffix = '.' + (typeof property === 'symbol' ? property.description : property);
|
|
2914
|
+
return $mol_wire_proxy(id + suffix, Reflect.get(target, property));
|
|
2915
|
+
},
|
|
2916
|
+
getOwnPropertyDescriptor(target, property) {
|
|
2917
|
+
$mol_wire_proxy_pub(id, target).promote();
|
|
2918
|
+
return Reflect.getOwnPropertyDescriptor(target, property);
|
|
2919
|
+
},
|
|
2920
|
+
ownKeys(target) {
|
|
2921
|
+
$mol_wire_proxy_pub(id, target).promote();
|
|
2922
|
+
return Reflect.ownKeys(target);
|
|
2923
|
+
},
|
|
2924
|
+
has(target, property) {
|
|
2925
|
+
$mol_wire_proxy_pub(id, target).promote();
|
|
2926
|
+
return Reflect.has(target, property);
|
|
2927
|
+
},
|
|
2928
|
+
getPrototypeOf(target) {
|
|
2929
|
+
$mol_wire_proxy_pub(id, target).promote();
|
|
2930
|
+
return $mol_wire_proxy(id, Reflect.getPrototypeOf(target));
|
|
2931
|
+
},
|
|
2932
|
+
isExtensible(target) {
|
|
2933
|
+
$mol_wire_proxy_pub(id, target).promote();
|
|
2934
|
+
return Reflect.isExtensible(target);
|
|
2935
|
+
},
|
|
2936
|
+
set(target, property, next) {
|
|
2937
|
+
const pub = pubs.get(target);
|
|
2938
|
+
if (pub) {
|
|
2939
|
+
const prev = Reflect.get(target, property);
|
|
2940
|
+
if ($mol_compare_deep(prev, next))
|
|
2941
|
+
return true;
|
|
2942
|
+
pub.emit();
|
|
2943
|
+
}
|
|
2944
|
+
return Reflect.set(target, property, next);
|
|
2945
|
+
},
|
|
2946
|
+
defineProperty(target, property, attributes) {
|
|
2947
|
+
pubs.get(target)?.emit();
|
|
2948
|
+
return Reflect.defineProperty(target, property, attributes);
|
|
2949
|
+
},
|
|
2950
|
+
deleteProperty(target, property) {
|
|
2951
|
+
pubs.get(target)?.emit();
|
|
2952
|
+
return Reflect.deleteProperty(target, property);
|
|
2953
|
+
},
|
|
2954
|
+
setPrototypeOf(target, proto) {
|
|
2955
|
+
pubs.get(target)?.emit();
|
|
2956
|
+
return Reflect.setPrototypeOf(target, proto);
|
|
2957
|
+
},
|
|
2958
|
+
preventExtensions(target) {
|
|
2959
|
+
pubs.get(target)?.emit();
|
|
2960
|
+
return Reflect.preventExtensions(target);
|
|
2961
|
+
},
|
|
2962
|
+
});
|
|
2963
|
+
}
|
|
2964
|
+
$.$mol_wire_proxy = $mol_wire_proxy;
|
|
2965
|
+
})($ || ($ = {}));
|
|
2966
|
+
|
|
2889
2967
|
;
|
|
2890
2968
|
"use strict";
|
|
2891
2969
|
var $;
|
package/node.test.js
CHANGED
|
@@ -418,6 +418,21 @@ var $;
|
|
|
418
418
|
};
|
|
419
419
|
})($ || ($ = {}));
|
|
420
420
|
|
|
421
|
+
;
|
|
422
|
+
"use strict";
|
|
423
|
+
var $;
|
|
424
|
+
(function ($) {
|
|
425
|
+
function $mol_guid(length = 8, exists = () => false) {
|
|
426
|
+
for (;;) {
|
|
427
|
+
let id = Math.random().toString(36).substring(2, length + 2).toUpperCase();
|
|
428
|
+
if (exists(id))
|
|
429
|
+
continue;
|
|
430
|
+
return id;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
$.$mol_guid = $mol_guid;
|
|
434
|
+
})($ || ($ = {}));
|
|
435
|
+
|
|
421
436
|
;
|
|
422
437
|
"use strict";
|
|
423
438
|
var $;
|
|
@@ -436,6 +451,11 @@ var $;
|
|
|
436
451
|
var $;
|
|
437
452
|
(function ($) {
|
|
438
453
|
class $mol_wire_pub extends Object {
|
|
454
|
+
constructor(id = `$mol_wire_pub:${$mol_guid()}`) {
|
|
455
|
+
super();
|
|
456
|
+
this[Symbol.toStringTag] = id;
|
|
457
|
+
}
|
|
458
|
+
[Symbol.toStringTag];
|
|
439
459
|
data = [];
|
|
440
460
|
static get [Symbol.species]() {
|
|
441
461
|
return Array;
|
|
@@ -822,7 +842,6 @@ var $;
|
|
|
822
842
|
}
|
|
823
843
|
}
|
|
824
844
|
}
|
|
825
|
-
[Symbol.toStringTag];
|
|
826
845
|
cache = undefined;
|
|
827
846
|
get args() {
|
|
828
847
|
return this.data.slice(0, this.pub_from);
|
|
@@ -841,13 +860,12 @@ var $;
|
|
|
841
860
|
return this.task.name + '()';
|
|
842
861
|
}
|
|
843
862
|
constructor(id, task, host, args) {
|
|
844
|
-
super();
|
|
863
|
+
super(id);
|
|
845
864
|
this.task = task;
|
|
846
865
|
this.host = host;
|
|
847
866
|
if (args)
|
|
848
867
|
this.data.push(...args);
|
|
849
868
|
this.pub_from = this.sub_from = args?.length ?? 0;
|
|
850
|
-
this[Symbol.toStringTag] = id;
|
|
851
869
|
}
|
|
852
870
|
plan() {
|
|
853
871
|
$mol_wire_fiber.planning.add(this);
|
|
@@ -2191,21 +2209,6 @@ var $;
|
|
|
2191
2209
|
$.$mol_const = $mol_const;
|
|
2192
2210
|
})($ || ($ = {}));
|
|
2193
2211
|
|
|
2194
|
-
;
|
|
2195
|
-
"use strict";
|
|
2196
|
-
var $;
|
|
2197
|
-
(function ($) {
|
|
2198
|
-
function $mol_guid(length = 8, exists = () => false) {
|
|
2199
|
-
for (;;) {
|
|
2200
|
-
let id = Math.random().toString(36).substring(2, length + 2).toUpperCase();
|
|
2201
|
-
if (exists(id))
|
|
2202
|
-
continue;
|
|
2203
|
-
return id;
|
|
2204
|
-
}
|
|
2205
|
-
}
|
|
2206
|
-
$.$mol_guid = $mol_guid;
|
|
2207
|
-
})($ || ($ = {}));
|
|
2208
|
-
|
|
2209
2212
|
;
|
|
2210
2213
|
"use strict";
|
|
2211
2214
|
var $;
|
|
@@ -2877,6 +2880,81 @@ var $;
|
|
|
2877
2880
|
$.$mol_wire_set = $mol_wire_set;
|
|
2878
2881
|
})($ || ($ = {}));
|
|
2879
2882
|
|
|
2883
|
+
;
|
|
2884
|
+
"use strict";
|
|
2885
|
+
var $;
|
|
2886
|
+
(function ($) {
|
|
2887
|
+
const pubs = new WeakMap();
|
|
2888
|
+
function $mol_wire_proxy_pub(id, target) {
|
|
2889
|
+
let pub = pubs.get(target);
|
|
2890
|
+
if (!pub)
|
|
2891
|
+
pubs.set(target, pub = new $mol_wire_pub(id));
|
|
2892
|
+
return pub;
|
|
2893
|
+
}
|
|
2894
|
+
$.$mol_wire_proxy_pub = $mol_wire_proxy_pub;
|
|
2895
|
+
function $mol_wire_proxy(id, target) {
|
|
2896
|
+
if (!target)
|
|
2897
|
+
return target;
|
|
2898
|
+
const type = typeof target;
|
|
2899
|
+
if (type !== 'object' && type !== 'function')
|
|
2900
|
+
return target;
|
|
2901
|
+
return new Proxy(target, {
|
|
2902
|
+
get(target, property) {
|
|
2903
|
+
$mol_wire_proxy_pub(id, target).promote();
|
|
2904
|
+
const suffix = '.' + (typeof property === 'symbol' ? property.description : property);
|
|
2905
|
+
return $mol_wire_proxy(id + suffix, Reflect.get(target, property));
|
|
2906
|
+
},
|
|
2907
|
+
getOwnPropertyDescriptor(target, property) {
|
|
2908
|
+
$mol_wire_proxy_pub(id, target).promote();
|
|
2909
|
+
return Reflect.getOwnPropertyDescriptor(target, property);
|
|
2910
|
+
},
|
|
2911
|
+
ownKeys(target) {
|
|
2912
|
+
$mol_wire_proxy_pub(id, target).promote();
|
|
2913
|
+
return Reflect.ownKeys(target);
|
|
2914
|
+
},
|
|
2915
|
+
has(target, property) {
|
|
2916
|
+
$mol_wire_proxy_pub(id, target).promote();
|
|
2917
|
+
return Reflect.has(target, property);
|
|
2918
|
+
},
|
|
2919
|
+
getPrototypeOf(target) {
|
|
2920
|
+
$mol_wire_proxy_pub(id, target).promote();
|
|
2921
|
+
return $mol_wire_proxy(id, Reflect.getPrototypeOf(target));
|
|
2922
|
+
},
|
|
2923
|
+
isExtensible(target) {
|
|
2924
|
+
$mol_wire_proxy_pub(id, target).promote();
|
|
2925
|
+
return Reflect.isExtensible(target);
|
|
2926
|
+
},
|
|
2927
|
+
set(target, property, next) {
|
|
2928
|
+
const pub = pubs.get(target);
|
|
2929
|
+
if (pub) {
|
|
2930
|
+
const prev = Reflect.get(target, property);
|
|
2931
|
+
if ($mol_compare_deep(prev, next))
|
|
2932
|
+
return true;
|
|
2933
|
+
pub.emit();
|
|
2934
|
+
}
|
|
2935
|
+
return Reflect.set(target, property, next);
|
|
2936
|
+
},
|
|
2937
|
+
defineProperty(target, property, attributes) {
|
|
2938
|
+
pubs.get(target)?.emit();
|
|
2939
|
+
return Reflect.defineProperty(target, property, attributes);
|
|
2940
|
+
},
|
|
2941
|
+
deleteProperty(target, property) {
|
|
2942
|
+
pubs.get(target)?.emit();
|
|
2943
|
+
return Reflect.deleteProperty(target, property);
|
|
2944
|
+
},
|
|
2945
|
+
setPrototypeOf(target, proto) {
|
|
2946
|
+
pubs.get(target)?.emit();
|
|
2947
|
+
return Reflect.setPrototypeOf(target, proto);
|
|
2948
|
+
},
|
|
2949
|
+
preventExtensions(target) {
|
|
2950
|
+
pubs.get(target)?.emit();
|
|
2951
|
+
return Reflect.preventExtensions(target);
|
|
2952
|
+
},
|
|
2953
|
+
});
|
|
2954
|
+
}
|
|
2955
|
+
$.$mol_wire_proxy = $mol_wire_proxy;
|
|
2956
|
+
})($ || ($ = {}));
|
|
2957
|
+
|
|
2880
2958
|
;
|
|
2881
2959
|
"use strict";
|
|
2882
2960
|
var $;
|
|
@@ -5657,6 +5735,73 @@ var $;
|
|
|
5657
5735
|
});
|
|
5658
5736
|
})($ || ($ = {}));
|
|
5659
5737
|
|
|
5738
|
+
;
|
|
5739
|
+
"use strict";
|
|
5740
|
+
var $;
|
|
5741
|
+
(function ($_1) {
|
|
5742
|
+
var $$;
|
|
5743
|
+
(function ($$) {
|
|
5744
|
+
$mol_test({
|
|
5745
|
+
"Deep property change"($) {
|
|
5746
|
+
const source = $mol_wire_proxy('source', {
|
|
5747
|
+
foo: {
|
|
5748
|
+
bar: 123,
|
|
5749
|
+
}
|
|
5750
|
+
});
|
|
5751
|
+
const { res } = $mol_wire_let({
|
|
5752
|
+
res() { return source.foo.bar; }
|
|
5753
|
+
});
|
|
5754
|
+
$mol_assert_equal(res(), 123);
|
|
5755
|
+
source.foo.bar = 321;
|
|
5756
|
+
$mol_assert_equal(res(), 321);
|
|
5757
|
+
},
|
|
5758
|
+
"Deep property add/remove"($) {
|
|
5759
|
+
const source = $mol_wire_proxy('source', {
|
|
5760
|
+
foo: {
|
|
5761
|
+
bar: 123,
|
|
5762
|
+
}
|
|
5763
|
+
});
|
|
5764
|
+
const { exists, props } = $mol_wire_let({
|
|
5765
|
+
exists() { return 'bar' in source.foo; },
|
|
5766
|
+
props() { return Object.keys(source.foo); },
|
|
5767
|
+
});
|
|
5768
|
+
$mol_assert_equal(exists(), true);
|
|
5769
|
+
$mol_assert_equal(props(), ['bar']);
|
|
5770
|
+
delete source.foo.bar;
|
|
5771
|
+
$mol_assert_equal(exists(), false);
|
|
5772
|
+
$mol_assert_equal(props(), []);
|
|
5773
|
+
Object.defineProperty(source.foo, 'bar', { value: 'xxx', enumerable: true });
|
|
5774
|
+
$mol_assert_equal(exists(), true);
|
|
5775
|
+
$mol_assert_equal(props(), ['bar']);
|
|
5776
|
+
},
|
|
5777
|
+
"Deep property change to equal"($) {
|
|
5778
|
+
const source = $mol_wire_proxy('source', {
|
|
5779
|
+
foo: {
|
|
5780
|
+
bar: 123,
|
|
5781
|
+
}
|
|
5782
|
+
});
|
|
5783
|
+
let count = 0;
|
|
5784
|
+
const { res } = $mol_wire_let({
|
|
5785
|
+
res() {
|
|
5786
|
+
++count;
|
|
5787
|
+
return source.foo.bar;
|
|
5788
|
+
}
|
|
5789
|
+
});
|
|
5790
|
+
res();
|
|
5791
|
+
$mol_assert_equal(count, 1);
|
|
5792
|
+
res();
|
|
5793
|
+
$mol_assert_equal(count, 1);
|
|
5794
|
+
source.foo = { bar: 123 };
|
|
5795
|
+
res();
|
|
5796
|
+
$mol_assert_equal(count, 1);
|
|
5797
|
+
source.foo = { bar: 321 };
|
|
5798
|
+
res();
|
|
5799
|
+
$mol_assert_equal(count, 2);
|
|
5800
|
+
},
|
|
5801
|
+
});
|
|
5802
|
+
})($$ = $_1.$$ || ($_1.$$ = {}));
|
|
5803
|
+
})($ || ($ = {}));
|
|
5804
|
+
|
|
5660
5805
|
;
|
|
5661
5806
|
"use strict";
|
|
5662
5807
|
var $;
|