mol_wire_lib 1.0.98 → 1.0.101
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 +36 -30
- package/node.deps.json +1 -1
- package/node.esm.js +165 -152
- package/node.esm.js.map +1 -1
- package/node.js +165 -152
- package/node.js.map +1 -1
- package/node.test.js +220 -257
- package/node.test.js.map +1 -1
- package/package.json +5 -3
- package/web.d.ts +36 -30
- package/web.deps.json +1 -1
- package/web.esm.js +165 -152
- package/web.esm.js.map +1 -1
- package/web.js +165 -152
- package/web.js.map +1 -1
- package/web.test.js +55 -105
- package/web.test.js.map +1 -1
package/node.js
CHANGED
|
@@ -687,84 +687,6 @@ var $;
|
|
|
687
687
|
;
|
|
688
688
|
"use strict";
|
|
689
689
|
var $;
|
|
690
|
-
(function ($) {
|
|
691
|
-
function $mol_guid(length = 8, exists = () => false) {
|
|
692
|
-
for (;;) {
|
|
693
|
-
let id = Math.random().toString(36).substring(2, length + 2).toUpperCase();
|
|
694
|
-
if (exists(id))
|
|
695
|
-
continue;
|
|
696
|
-
return id;
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
$.$mol_guid = $mol_guid;
|
|
700
|
-
})($ || ($ = {}));
|
|
701
|
-
//mol/guid/guid.ts
|
|
702
|
-
;
|
|
703
|
-
"use strict";
|
|
704
|
-
var $;
|
|
705
|
-
(function ($) {
|
|
706
|
-
$.$mol_key_store = new WeakMap();
|
|
707
|
-
function $mol_key(value) {
|
|
708
|
-
if (!value)
|
|
709
|
-
return JSON.stringify(value);
|
|
710
|
-
if (typeof value !== 'object' && typeof value !== 'function')
|
|
711
|
-
return JSON.stringify(value);
|
|
712
|
-
return JSON.stringify(value, (field, value) => {
|
|
713
|
-
if (!value)
|
|
714
|
-
return value;
|
|
715
|
-
if (typeof value !== 'object' && typeof value !== 'function')
|
|
716
|
-
return value;
|
|
717
|
-
if (Array.isArray(value))
|
|
718
|
-
return value;
|
|
719
|
-
const proto = Reflect.getPrototypeOf(value);
|
|
720
|
-
if (!proto)
|
|
721
|
-
return value;
|
|
722
|
-
if (Reflect.getPrototypeOf(proto) === null)
|
|
723
|
-
return value;
|
|
724
|
-
if ('toJSON' in value)
|
|
725
|
-
return value;
|
|
726
|
-
if (value instanceof RegExp)
|
|
727
|
-
return value.toString();
|
|
728
|
-
let key = $.$mol_key_store.get(value);
|
|
729
|
-
if (key)
|
|
730
|
-
return key;
|
|
731
|
-
key = $mol_guid();
|
|
732
|
-
$.$mol_key_store.set(value, key);
|
|
733
|
-
return key;
|
|
734
|
-
});
|
|
735
|
-
}
|
|
736
|
-
$.$mol_key = $mol_key;
|
|
737
|
-
})($ || ($ = {}));
|
|
738
|
-
//mol/key/key.ts
|
|
739
|
-
;
|
|
740
|
-
"use strict";
|
|
741
|
-
var $;
|
|
742
|
-
(function ($) {
|
|
743
|
-
function $mol_wire_method(host, field, descr) {
|
|
744
|
-
if (!descr)
|
|
745
|
-
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
746
|
-
const orig = descr?.value ?? host[field];
|
|
747
|
-
const sup = Reflect.getPrototypeOf(host);
|
|
748
|
-
if (typeof sup[field] === 'function') {
|
|
749
|
-
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
750
|
-
}
|
|
751
|
-
const temp = $mol_wire_fiber_temp.getter(orig);
|
|
752
|
-
const value = function (...args) {
|
|
753
|
-
const fiber = temp(this ?? null, args);
|
|
754
|
-
return fiber.sync();
|
|
755
|
-
};
|
|
756
|
-
Object.defineProperty(value, 'name', { value: orig.name + ' ' });
|
|
757
|
-
Object.assign(value, { orig });
|
|
758
|
-
const descr2 = { ...descr, value };
|
|
759
|
-
Reflect.defineProperty(host, field, descr2);
|
|
760
|
-
return descr2;
|
|
761
|
-
}
|
|
762
|
-
$.$mol_wire_method = $mol_wire_method;
|
|
763
|
-
})($ || ($ = {}));
|
|
764
|
-
//mol/wire/method/method.ts
|
|
765
|
-
;
|
|
766
|
-
"use strict";
|
|
767
|
-
var $;
|
|
768
690
|
(function ($) {
|
|
769
691
|
const handled = new WeakSet();
|
|
770
692
|
class $mol_wire_fiber extends $mol_wire_pub_sub {
|
|
@@ -978,6 +900,40 @@ var $;
|
|
|
978
900
|
}
|
|
979
901
|
}
|
|
980
902
|
$.$mol_wire_fiber = $mol_wire_fiber;
|
|
903
|
+
})($ || ($ = {}));
|
|
904
|
+
//mol/wire/fiber/fiber.ts
|
|
905
|
+
;
|
|
906
|
+
"use strict";
|
|
907
|
+
var $;
|
|
908
|
+
(function ($) {
|
|
909
|
+
function $mol_wire_probe(task, next) {
|
|
910
|
+
const warm = $mol_wire_fiber.warm;
|
|
911
|
+
try {
|
|
912
|
+
$mol_wire_fiber.warm = false;
|
|
913
|
+
return task();
|
|
914
|
+
}
|
|
915
|
+
finally {
|
|
916
|
+
$mol_wire_fiber.warm = warm;
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
$.$mol_wire_probe = $mol_wire_probe;
|
|
920
|
+
})($ || ($ = {}));
|
|
921
|
+
//mol/wire/probe/probe.ts
|
|
922
|
+
;
|
|
923
|
+
"use strict";
|
|
924
|
+
var $;
|
|
925
|
+
(function ($) {
|
|
926
|
+
function $mol_wire_solid() {
|
|
927
|
+
$mol_wire_auto().reap = nothing;
|
|
928
|
+
}
|
|
929
|
+
$.$mol_wire_solid = $mol_wire_solid;
|
|
930
|
+
const nothing = () => { };
|
|
931
|
+
})($ || ($ = {}));
|
|
932
|
+
//mol/wire/solid/solid.ts
|
|
933
|
+
;
|
|
934
|
+
"use strict";
|
|
935
|
+
var $;
|
|
936
|
+
(function ($) {
|
|
981
937
|
class $mol_wire_fiber_temp extends $mol_wire_fiber {
|
|
982
938
|
static getter(task) {
|
|
983
939
|
return function $mol_wire_fiber_temp_get(host, args) {
|
|
@@ -997,10 +953,139 @@ var $;
|
|
|
997
953
|
};
|
|
998
954
|
}
|
|
999
955
|
complete() {
|
|
1000
|
-
this.
|
|
956
|
+
if (this.sub_empty)
|
|
957
|
+
this.destructor();
|
|
1001
958
|
}
|
|
1002
959
|
}
|
|
1003
960
|
$.$mol_wire_fiber_temp = $mol_wire_fiber_temp;
|
|
961
|
+
})($ || ($ = {}));
|
|
962
|
+
//mol/wire/fiber/temp/temp.ts
|
|
963
|
+
;
|
|
964
|
+
"use strict";
|
|
965
|
+
var $;
|
|
966
|
+
(function ($) {
|
|
967
|
+
function $mol_wire_sync(obj) {
|
|
968
|
+
return new Proxy(obj, {
|
|
969
|
+
get(obj, field) {
|
|
970
|
+
const val = obj[field];
|
|
971
|
+
if (typeof val !== 'function')
|
|
972
|
+
return val;
|
|
973
|
+
const temp = $mol_wire_fiber_temp.getter(val);
|
|
974
|
+
return function $mol_wire_sync(...args) {
|
|
975
|
+
const fiber = temp(obj, args);
|
|
976
|
+
return fiber.sync();
|
|
977
|
+
};
|
|
978
|
+
}
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
$.$mol_wire_sync = $mol_wire_sync;
|
|
982
|
+
})($ || ($ = {}));
|
|
983
|
+
//mol/wire/sync/sync.ts
|
|
984
|
+
;
|
|
985
|
+
"use strict";
|
|
986
|
+
var $;
|
|
987
|
+
(function ($) {
|
|
988
|
+
function $mol_wire_async(obj) {
|
|
989
|
+
return new Proxy(obj, {
|
|
990
|
+
get(obj, field) {
|
|
991
|
+
const val = obj[field];
|
|
992
|
+
if (typeof val !== 'function')
|
|
993
|
+
return val;
|
|
994
|
+
let fiber;
|
|
995
|
+
const temp = $mol_wire_fiber_temp.getter(val);
|
|
996
|
+
return function $mol_wire_async(...args) {
|
|
997
|
+
fiber?.destructor();
|
|
998
|
+
fiber = temp(obj, args);
|
|
999
|
+
return fiber.async();
|
|
1000
|
+
};
|
|
1001
|
+
}
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
$.$mol_wire_async = $mol_wire_async;
|
|
1005
|
+
})($ || ($ = {}));
|
|
1006
|
+
//mol/wire/async/async.ts
|
|
1007
|
+
;
|
|
1008
|
+
"use strict";
|
|
1009
|
+
var $;
|
|
1010
|
+
(function ($) {
|
|
1011
|
+
function $mol_guid(length = 8, exists = () => false) {
|
|
1012
|
+
for (;;) {
|
|
1013
|
+
let id = Math.random().toString(36).substring(2, length + 2).toUpperCase();
|
|
1014
|
+
if (exists(id))
|
|
1015
|
+
continue;
|
|
1016
|
+
return id;
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
$.$mol_guid = $mol_guid;
|
|
1020
|
+
})($ || ($ = {}));
|
|
1021
|
+
//mol/guid/guid.ts
|
|
1022
|
+
;
|
|
1023
|
+
"use strict";
|
|
1024
|
+
var $;
|
|
1025
|
+
(function ($) {
|
|
1026
|
+
$.$mol_key_store = new WeakMap();
|
|
1027
|
+
function $mol_key(value) {
|
|
1028
|
+
if (!value)
|
|
1029
|
+
return JSON.stringify(value);
|
|
1030
|
+
if (typeof value !== 'object' && typeof value !== 'function')
|
|
1031
|
+
return JSON.stringify(value);
|
|
1032
|
+
return JSON.stringify(value, (field, value) => {
|
|
1033
|
+
if (!value)
|
|
1034
|
+
return value;
|
|
1035
|
+
if (typeof value !== 'object' && typeof value !== 'function')
|
|
1036
|
+
return value;
|
|
1037
|
+
if (Array.isArray(value))
|
|
1038
|
+
return value;
|
|
1039
|
+
const proto = Reflect.getPrototypeOf(value);
|
|
1040
|
+
if (!proto)
|
|
1041
|
+
return value;
|
|
1042
|
+
if (Reflect.getPrototypeOf(proto) === null)
|
|
1043
|
+
return value;
|
|
1044
|
+
if ('toJSON' in value)
|
|
1045
|
+
return value;
|
|
1046
|
+
if (value instanceof RegExp)
|
|
1047
|
+
return value.toString();
|
|
1048
|
+
let key = $.$mol_key_store.get(value);
|
|
1049
|
+
if (key)
|
|
1050
|
+
return key;
|
|
1051
|
+
key = $mol_guid();
|
|
1052
|
+
$.$mol_key_store.set(value, key);
|
|
1053
|
+
return key;
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
$.$mol_key = $mol_key;
|
|
1057
|
+
})($ || ($ = {}));
|
|
1058
|
+
//mol/key/key.ts
|
|
1059
|
+
;
|
|
1060
|
+
"use strict";
|
|
1061
|
+
var $;
|
|
1062
|
+
(function ($) {
|
|
1063
|
+
function $mol_wire_method(host, field, descr) {
|
|
1064
|
+
if (!descr)
|
|
1065
|
+
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
1066
|
+
const orig = descr?.value ?? host[field];
|
|
1067
|
+
const sup = Reflect.getPrototypeOf(host);
|
|
1068
|
+
if (typeof sup[field] === 'function') {
|
|
1069
|
+
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
1070
|
+
}
|
|
1071
|
+
const temp = $mol_wire_fiber_temp.getter(orig);
|
|
1072
|
+
const value = function (...args) {
|
|
1073
|
+
const fiber = temp(this ?? null, args);
|
|
1074
|
+
return fiber.sync();
|
|
1075
|
+
};
|
|
1076
|
+
Object.defineProperty(value, 'name', { value: orig.name + ' ' });
|
|
1077
|
+
Object.assign(value, { orig });
|
|
1078
|
+
const descr2 = { ...descr, value };
|
|
1079
|
+
Reflect.defineProperty(host, field, descr2);
|
|
1080
|
+
return descr2;
|
|
1081
|
+
}
|
|
1082
|
+
$.$mol_wire_method = $mol_wire_method;
|
|
1083
|
+
})($ || ($ = {}));
|
|
1084
|
+
//mol/wire/method/method.ts
|
|
1085
|
+
;
|
|
1086
|
+
"use strict";
|
|
1087
|
+
var $;
|
|
1088
|
+
(function ($) {
|
|
1004
1089
|
class $mol_wire_fiber_persist extends $mol_wire_fiber {
|
|
1005
1090
|
static getter(task, keys) {
|
|
1006
1091
|
const field = task.name + '()';
|
|
@@ -1073,79 +1158,7 @@ var $;
|
|
|
1073
1158
|
], $mol_wire_fiber_persist.prototype, "once", null);
|
|
1074
1159
|
$.$mol_wire_fiber_persist = $mol_wire_fiber_persist;
|
|
1075
1160
|
})($ || ($ = {}));
|
|
1076
|
-
//mol/wire/fiber/
|
|
1077
|
-
;
|
|
1078
|
-
"use strict";
|
|
1079
|
-
var $;
|
|
1080
|
-
(function ($) {
|
|
1081
|
-
function $mol_wire_probe(task, next) {
|
|
1082
|
-
const warm = $mol_wire_fiber.warm;
|
|
1083
|
-
try {
|
|
1084
|
-
$mol_wire_fiber.warm = false;
|
|
1085
|
-
return task();
|
|
1086
|
-
}
|
|
1087
|
-
finally {
|
|
1088
|
-
$mol_wire_fiber.warm = warm;
|
|
1089
|
-
}
|
|
1090
|
-
}
|
|
1091
|
-
$.$mol_wire_probe = $mol_wire_probe;
|
|
1092
|
-
})($ || ($ = {}));
|
|
1093
|
-
//mol/wire/probe/probe.ts
|
|
1094
|
-
;
|
|
1095
|
-
"use strict";
|
|
1096
|
-
var $;
|
|
1097
|
-
(function ($) {
|
|
1098
|
-
function $mol_wire_solid() {
|
|
1099
|
-
$mol_wire_auto().reap = nothing;
|
|
1100
|
-
}
|
|
1101
|
-
$.$mol_wire_solid = $mol_wire_solid;
|
|
1102
|
-
const nothing = () => { };
|
|
1103
|
-
})($ || ($ = {}));
|
|
1104
|
-
//mol/wire/solid/solid.ts
|
|
1105
|
-
;
|
|
1106
|
-
"use strict";
|
|
1107
|
-
var $;
|
|
1108
|
-
(function ($) {
|
|
1109
|
-
function $mol_wire_sync(obj) {
|
|
1110
|
-
return new Proxy(obj, {
|
|
1111
|
-
get(obj, field) {
|
|
1112
|
-
const val = obj[field];
|
|
1113
|
-
if (typeof val !== 'function')
|
|
1114
|
-
return val;
|
|
1115
|
-
const temp = $mol_wire_fiber_temp.getter(val);
|
|
1116
|
-
return function $mol_wire_sync(...args) {
|
|
1117
|
-
const fiber = temp(obj, args);
|
|
1118
|
-
return fiber.sync();
|
|
1119
|
-
};
|
|
1120
|
-
}
|
|
1121
|
-
});
|
|
1122
|
-
}
|
|
1123
|
-
$.$mol_wire_sync = $mol_wire_sync;
|
|
1124
|
-
})($ || ($ = {}));
|
|
1125
|
-
//mol/wire/sync/sync.ts
|
|
1126
|
-
;
|
|
1127
|
-
"use strict";
|
|
1128
|
-
var $;
|
|
1129
|
-
(function ($) {
|
|
1130
|
-
function $mol_wire_async(obj) {
|
|
1131
|
-
return new Proxy(obj, {
|
|
1132
|
-
get(obj, field) {
|
|
1133
|
-
const val = obj[field];
|
|
1134
|
-
if (typeof val !== 'function')
|
|
1135
|
-
return val;
|
|
1136
|
-
let fiber;
|
|
1137
|
-
const temp = $mol_wire_fiber_temp.getter(val);
|
|
1138
|
-
return function $mol_wire_async(...args) {
|
|
1139
|
-
fiber?.destructor();
|
|
1140
|
-
fiber = temp(obj, args);
|
|
1141
|
-
return fiber.async();
|
|
1142
|
-
};
|
|
1143
|
-
}
|
|
1144
|
-
});
|
|
1145
|
-
}
|
|
1146
|
-
$.$mol_wire_async = $mol_wire_async;
|
|
1147
|
-
})($ || ($ = {}));
|
|
1148
|
-
//mol/wire/async/async.ts
|
|
1161
|
+
//mol/wire/fiber/persist/persist.ts
|
|
1149
1162
|
;
|
|
1150
1163
|
"use strict";
|
|
1151
1164
|
var $;
|