mol_wire_lib 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/.nojekyll +0 -0
- package/node.deps.json +1 -1
- package/node.esm.js +1133 -1130
- package/node.esm.js.map +1 -1
- package/node.js +1133 -1130
- package/node.js.map +1 -1
- package/node.test.js +3168 -3165
- package/node.test.js.map +1 -1
- package/package.json +2 -2
- package/web.deps.json +1 -1
- package/web.esm.js +1139 -1136
- package/web.esm.js.map +1 -1
- package/web.js +1139 -1136
- package/web.js.map +1 -1
- package/web.test.js +1570 -1570
- package/web.test.js.map +1 -1
package/node.js
CHANGED
|
@@ -18,1197 +18,1200 @@ $.$$ = $
|
|
|
18
18
|
var $node = $node || {}
|
|
19
19
|
void function( module ) { var exports = module.exports = this; function require( id ) { return $node[ id.replace( /^.\// , "../" ) ] };
|
|
20
20
|
;
|
|
21
|
-
"use strict";
|
|
22
|
-
Error.stackTraceLimit = 50;
|
|
23
|
-
var $;
|
|
24
|
-
(function ($) {
|
|
25
|
-
})($ || ($ = {}));
|
|
26
|
-
module.exports = $;
|
|
21
|
+
"use strict";
|
|
22
|
+
Error.stackTraceLimit = 50;
|
|
23
|
+
var $;
|
|
24
|
+
(function ($) {
|
|
25
|
+
})($ || ($ = {}));
|
|
26
|
+
module.exports = $;
|
|
27
27
|
//mam.ts
|
|
28
28
|
;
|
|
29
29
|
|
|
30
30
|
$node[ "../mam.ts" ] = $node[ "../mam.ts" ] = module.exports }.call( {} , {} )
|
|
31
31
|
;
|
|
32
|
-
"use strict";
|
|
33
|
-
var $;
|
|
34
|
-
(function ($) {
|
|
35
|
-
function $mol_fail(error) {
|
|
36
|
-
throw error;
|
|
37
|
-
}
|
|
38
|
-
$.$mol_fail = $mol_fail;
|
|
39
|
-
})($ || ($ = {}));
|
|
32
|
+
"use strict";
|
|
33
|
+
var $;
|
|
34
|
+
(function ($) {
|
|
35
|
+
function $mol_fail(error) {
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
$.$mol_fail = $mol_fail;
|
|
39
|
+
})($ || ($ = {}));
|
|
40
40
|
//mol/fail/fail.ts
|
|
41
41
|
;
|
|
42
|
-
"use strict";
|
|
43
|
-
var $;
|
|
44
|
-
(function ($) {
|
|
45
|
-
let $mol_wire_cursor;
|
|
46
|
-
(function ($mol_wire_cursor) {
|
|
47
|
-
$mol_wire_cursor[$mol_wire_cursor["stale"] = new (class stale extends Number {
|
|
48
|
-
})(-1)] = "stale";
|
|
49
|
-
$mol_wire_cursor[$mol_wire_cursor["doubt"] = new (class doubt extends Number {
|
|
50
|
-
})(-2)] = "doubt";
|
|
51
|
-
$mol_wire_cursor[$mol_wire_cursor["fresh"] = new (class fresh extends Number {
|
|
52
|
-
})(-3)] = "fresh";
|
|
53
|
-
$mol_wire_cursor[$mol_wire_cursor["final"] = new (class solid extends Number {
|
|
54
|
-
})(-4)] = "final";
|
|
55
|
-
})($mol_wire_cursor = $.$mol_wire_cursor || ($.$mol_wire_cursor = {}));
|
|
56
|
-
})($ || ($ = {}));
|
|
42
|
+
"use strict";
|
|
43
|
+
var $;
|
|
44
|
+
(function ($) {
|
|
45
|
+
let $mol_wire_cursor;
|
|
46
|
+
(function ($mol_wire_cursor) {
|
|
47
|
+
$mol_wire_cursor[$mol_wire_cursor["stale"] = new (class stale extends Number {
|
|
48
|
+
})(-1)] = "stale";
|
|
49
|
+
$mol_wire_cursor[$mol_wire_cursor["doubt"] = new (class doubt extends Number {
|
|
50
|
+
})(-2)] = "doubt";
|
|
51
|
+
$mol_wire_cursor[$mol_wire_cursor["fresh"] = new (class fresh extends Number {
|
|
52
|
+
})(-3)] = "fresh";
|
|
53
|
+
$mol_wire_cursor[$mol_wire_cursor["final"] = new (class solid extends Number {
|
|
54
|
+
})(-4)] = "final";
|
|
55
|
+
})($mol_wire_cursor = $.$mol_wire_cursor || ($.$mol_wire_cursor = {}));
|
|
56
|
+
})($ || ($ = {}));
|
|
57
57
|
//mol/wire/cursor/cursor.ts
|
|
58
58
|
;
|
|
59
|
-
"use strict";
|
|
60
|
-
var $;
|
|
61
|
-
(function ($) {
|
|
62
|
-
class $mol_wire_pub extends Array {
|
|
63
|
-
static get [Symbol.species]() {
|
|
64
|
-
return Array;
|
|
65
|
-
}
|
|
66
|
-
sub_from = 0;
|
|
67
|
-
get sub_list() {
|
|
68
|
-
const res = [];
|
|
69
|
-
for (let i = this.sub_from; i < this.length; i += 2) {
|
|
70
|
-
res.push(this[i]);
|
|
71
|
-
}
|
|
72
|
-
return res;
|
|
73
|
-
}
|
|
74
|
-
get sub_empty() {
|
|
75
|
-
return this.sub_from === this.length;
|
|
76
|
-
}
|
|
77
|
-
sub_on(sub, pub_pos) {
|
|
78
|
-
const pos = this.length;
|
|
79
|
-
this.push(sub, pub_pos);
|
|
80
|
-
return pos;
|
|
81
|
-
}
|
|
82
|
-
sub_off(sub_pos) {
|
|
83
|
-
if (!(sub_pos < this.length)) {
|
|
84
|
-
$mol_fail(new Error(`Wrong pos ${sub_pos}`));
|
|
85
|
-
}
|
|
86
|
-
const end = this.length - 2;
|
|
87
|
-
if (sub_pos !== end) {
|
|
88
|
-
this.peer_move(end, sub_pos);
|
|
89
|
-
}
|
|
90
|
-
this.pop();
|
|
91
|
-
this.pop();
|
|
92
|
-
if (this.length === this.sub_from)
|
|
93
|
-
this.reap();
|
|
94
|
-
}
|
|
95
|
-
reap() { }
|
|
96
|
-
track_promote() {
|
|
97
|
-
$mol_wire_auto?.track_next(this);
|
|
98
|
-
}
|
|
99
|
-
up() { }
|
|
100
|
-
down() { }
|
|
101
|
-
emit() {
|
|
102
|
-
for (let i = this.sub_from; i < this.length; i += 2) {
|
|
103
|
-
;
|
|
104
|
-
this[i].stale();
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
stale() {
|
|
108
|
-
if (!this.affect($mol_wire_cursor.stale))
|
|
109
|
-
return false;
|
|
110
|
-
while ($mol_wire_affected.length) {
|
|
111
|
-
const next = $mol_wire_affected.pop();
|
|
112
|
-
next.affect($mol_wire_cursor.doubt);
|
|
113
|
-
}
|
|
114
|
-
return true;
|
|
115
|
-
}
|
|
116
|
-
affect(quant) {
|
|
117
|
-
for (let i = this.sub_from; i < this.length; i += 2) {
|
|
118
|
-
const sub = this[i];
|
|
119
|
-
$mol_wire_affected.push(sub);
|
|
120
|
-
}
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
peer_move(from_pos, to_pos) {
|
|
124
|
-
const peer = this[from_pos];
|
|
125
|
-
const self_pos = this[from_pos + 1];
|
|
126
|
-
this[to_pos] = peer;
|
|
127
|
-
this[to_pos + 1] = self_pos;
|
|
128
|
-
peer.peer_repos(self_pos, to_pos);
|
|
129
|
-
}
|
|
130
|
-
peer_repos(peer_pos, self_pos) {
|
|
131
|
-
this[peer_pos + 1] = self_pos;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
$.$mol_wire_pub = $mol_wire_pub;
|
|
135
|
-
})($ || ($ = {}));
|
|
59
|
+
"use strict";
|
|
60
|
+
var $;
|
|
61
|
+
(function ($) {
|
|
62
|
+
class $mol_wire_pub extends Array {
|
|
63
|
+
static get [Symbol.species]() {
|
|
64
|
+
return Array;
|
|
65
|
+
}
|
|
66
|
+
sub_from = 0;
|
|
67
|
+
get sub_list() {
|
|
68
|
+
const res = [];
|
|
69
|
+
for (let i = this.sub_from; i < this.length; i += 2) {
|
|
70
|
+
res.push(this[i]);
|
|
71
|
+
}
|
|
72
|
+
return res;
|
|
73
|
+
}
|
|
74
|
+
get sub_empty() {
|
|
75
|
+
return this.sub_from === this.length;
|
|
76
|
+
}
|
|
77
|
+
sub_on(sub, pub_pos) {
|
|
78
|
+
const pos = this.length;
|
|
79
|
+
this.push(sub, pub_pos);
|
|
80
|
+
return pos;
|
|
81
|
+
}
|
|
82
|
+
sub_off(sub_pos) {
|
|
83
|
+
if (!(sub_pos < this.length)) {
|
|
84
|
+
$mol_fail(new Error(`Wrong pos ${sub_pos}`));
|
|
85
|
+
}
|
|
86
|
+
const end = this.length - 2;
|
|
87
|
+
if (sub_pos !== end) {
|
|
88
|
+
this.peer_move(end, sub_pos);
|
|
89
|
+
}
|
|
90
|
+
this.pop();
|
|
91
|
+
this.pop();
|
|
92
|
+
if (this.length === this.sub_from)
|
|
93
|
+
this.reap();
|
|
94
|
+
}
|
|
95
|
+
reap() { }
|
|
96
|
+
track_promote() {
|
|
97
|
+
$mol_wire_auto?.track_next(this);
|
|
98
|
+
}
|
|
99
|
+
up() { }
|
|
100
|
+
down() { }
|
|
101
|
+
emit() {
|
|
102
|
+
for (let i = this.sub_from; i < this.length; i += 2) {
|
|
103
|
+
;
|
|
104
|
+
this[i].stale();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
stale() {
|
|
108
|
+
if (!this.affect($mol_wire_cursor.stale))
|
|
109
|
+
return false;
|
|
110
|
+
while ($mol_wire_affected.length) {
|
|
111
|
+
const next = $mol_wire_affected.pop();
|
|
112
|
+
next.affect($mol_wire_cursor.doubt);
|
|
113
|
+
}
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
affect(quant) {
|
|
117
|
+
for (let i = this.sub_from; i < this.length; i += 2) {
|
|
118
|
+
const sub = this[i];
|
|
119
|
+
$mol_wire_affected.push(sub);
|
|
120
|
+
}
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
peer_move(from_pos, to_pos) {
|
|
124
|
+
const peer = this[from_pos];
|
|
125
|
+
const self_pos = this[from_pos + 1];
|
|
126
|
+
this[to_pos] = peer;
|
|
127
|
+
this[to_pos + 1] = self_pos;
|
|
128
|
+
peer.peer_repos(self_pos, to_pos);
|
|
129
|
+
}
|
|
130
|
+
peer_repos(peer_pos, self_pos) {
|
|
131
|
+
this[peer_pos + 1] = self_pos;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
$.$mol_wire_pub = $mol_wire_pub;
|
|
135
|
+
})($ || ($ = {}));
|
|
136
136
|
//mol/wire/pub/pub.ts
|
|
137
137
|
;
|
|
138
|
-
"use strict";
|
|
138
|
+
"use strict";
|
|
139
139
|
//mol/wire/sub/sub.ts
|
|
140
140
|
;
|
|
141
|
-
"use strict";
|
|
142
|
-
var $;
|
|
143
|
-
(function ($) {
|
|
144
|
-
$.$mol_wire_auto = null;
|
|
145
|
-
$.$mol_wire_affected = [];
|
|
146
|
-
})($ || ($ = {}));
|
|
141
|
+
"use strict";
|
|
142
|
+
var $;
|
|
143
|
+
(function ($) {
|
|
144
|
+
$.$mol_wire_auto = null;
|
|
145
|
+
$.$mol_wire_affected = [];
|
|
146
|
+
})($ || ($ = {}));
|
|
147
147
|
//mol/wire/wire.ts
|
|
148
148
|
;
|
|
149
|
-
"use strict";
|
|
150
|
-
var $;
|
|
151
|
-
(function ($) {
|
|
152
|
-
$['devtoolsFormatters'] = $['devtoolsFormatters'] || [];
|
|
153
|
-
function $mol_dev_format_register(config) {
|
|
154
|
-
$['devtoolsFormatters'].push(config);
|
|
155
|
-
}
|
|
156
|
-
$.$mol_dev_format_register = $mol_dev_format_register;
|
|
157
|
-
$.$mol_dev_format_head = Symbol('$mol_dev_format_head');
|
|
158
|
-
$.$mol_dev_format_body = Symbol('$mol_dev_format_body');
|
|
159
|
-
$mol_dev_format_register({
|
|
160
|
-
header: (val, config = false) => {
|
|
161
|
-
if (config)
|
|
162
|
-
return null;
|
|
163
|
-
if (!val)
|
|
164
|
-
return null;
|
|
165
|
-
if ($.$mol_dev_format_head in val) {
|
|
166
|
-
return val[$.$mol_dev_format_head]();
|
|
167
|
-
}
|
|
168
|
-
if (typeof val === 'function') {
|
|
169
|
-
return $mol_dev_format_native(val);
|
|
170
|
-
}
|
|
171
|
-
return null;
|
|
172
|
-
},
|
|
173
|
-
hasBody: val => val[$.$mol_dev_format_body],
|
|
174
|
-
body: val => val[$.$mol_dev_format_body](),
|
|
175
|
-
});
|
|
176
|
-
function $mol_dev_format_native(obj) {
|
|
177
|
-
if (typeof obj === 'undefined')
|
|
178
|
-
return $.$mol_dev_format_shade('undefined');
|
|
179
|
-
if (typeof obj !== 'object' && typeof obj !== 'function')
|
|
180
|
-
return obj;
|
|
181
|
-
return [
|
|
182
|
-
'object',
|
|
183
|
-
{
|
|
184
|
-
object: obj,
|
|
185
|
-
config: true,
|
|
186
|
-
},
|
|
187
|
-
];
|
|
188
|
-
}
|
|
189
|
-
$.$mol_dev_format_native = $mol_dev_format_native;
|
|
190
|
-
function $mol_dev_format_auto(obj) {
|
|
191
|
-
if (obj == null)
|
|
192
|
-
return $.$mol_dev_format_shade(String(obj));
|
|
193
|
-
if (typeof obj === 'object' && $.$mol_dev_format_head in obj) {
|
|
194
|
-
return obj[$.$mol_dev_format_head]();
|
|
195
|
-
}
|
|
196
|
-
return [
|
|
197
|
-
'object',
|
|
198
|
-
{
|
|
199
|
-
object: obj,
|
|
200
|
-
config: false,
|
|
201
|
-
},
|
|
202
|
-
];
|
|
203
|
-
}
|
|
204
|
-
$.$mol_dev_format_auto = $mol_dev_format_auto;
|
|
205
|
-
function $mol_dev_format_element(element, style, ...content) {
|
|
206
|
-
const styles = [];
|
|
207
|
-
for (let key in style)
|
|
208
|
-
styles.push(`${key} : ${style[key]}`);
|
|
209
|
-
return [
|
|
210
|
-
element,
|
|
211
|
-
{
|
|
212
|
-
style: styles.join(' ; '),
|
|
213
|
-
},
|
|
214
|
-
...content,
|
|
215
|
-
];
|
|
216
|
-
}
|
|
217
|
-
$.$mol_dev_format_element = $mol_dev_format_element;
|
|
218
|
-
function $mol_dev_format_span(style, ...content) {
|
|
219
|
-
return $mol_dev_format_element('span', {
|
|
220
|
-
'vertical-align': '8%',
|
|
221
|
-
...style,
|
|
222
|
-
}, ...content);
|
|
223
|
-
}
|
|
224
|
-
$.$mol_dev_format_span = $mol_dev_format_span;
|
|
225
|
-
$.$mol_dev_format_div = $mol_dev_format_element.bind(null, 'div');
|
|
226
|
-
$.$mol_dev_format_ol = $mol_dev_format_element.bind(null, 'ol');
|
|
227
|
-
$.$mol_dev_format_li = $mol_dev_format_element.bind(null, 'li');
|
|
228
|
-
$.$mol_dev_format_table = $mol_dev_format_element.bind(null, 'table');
|
|
229
|
-
$.$mol_dev_format_tr = $mol_dev_format_element.bind(null, 'tr');
|
|
230
|
-
$.$mol_dev_format_td = $mol_dev_format_element.bind(null, 'td');
|
|
231
|
-
$.$mol_dev_format_accent = $mol_dev_format_span.bind(null, {
|
|
232
|
-
'color': 'magenta',
|
|
233
|
-
});
|
|
234
|
-
$.$mol_dev_format_strong = $mol_dev_format_span.bind(null, {
|
|
235
|
-
'font-weight': 'bold',
|
|
236
|
-
});
|
|
237
|
-
$.$mol_dev_format_string = $mol_dev_format_span.bind(null, {
|
|
238
|
-
'color': 'green',
|
|
239
|
-
});
|
|
240
|
-
$.$mol_dev_format_shade = $mol_dev_format_span.bind(null, {
|
|
241
|
-
'color': 'gray',
|
|
242
|
-
});
|
|
243
|
-
$.$mol_dev_format_indent = $.$mol_dev_format_div.bind(null, {
|
|
244
|
-
'margin-left': '13px'
|
|
245
|
-
});
|
|
246
|
-
})($ || ($ = {}));
|
|
149
|
+
"use strict";
|
|
150
|
+
var $;
|
|
151
|
+
(function ($) {
|
|
152
|
+
$['devtoolsFormatters'] = $['devtoolsFormatters'] || [];
|
|
153
|
+
function $mol_dev_format_register(config) {
|
|
154
|
+
$['devtoolsFormatters'].push(config);
|
|
155
|
+
}
|
|
156
|
+
$.$mol_dev_format_register = $mol_dev_format_register;
|
|
157
|
+
$.$mol_dev_format_head = Symbol('$mol_dev_format_head');
|
|
158
|
+
$.$mol_dev_format_body = Symbol('$mol_dev_format_body');
|
|
159
|
+
$mol_dev_format_register({
|
|
160
|
+
header: (val, config = false) => {
|
|
161
|
+
if (config)
|
|
162
|
+
return null;
|
|
163
|
+
if (!val)
|
|
164
|
+
return null;
|
|
165
|
+
if ($.$mol_dev_format_head in val) {
|
|
166
|
+
return val[$.$mol_dev_format_head]();
|
|
167
|
+
}
|
|
168
|
+
if (typeof val === 'function') {
|
|
169
|
+
return $mol_dev_format_native(val);
|
|
170
|
+
}
|
|
171
|
+
return null;
|
|
172
|
+
},
|
|
173
|
+
hasBody: val => val[$.$mol_dev_format_body],
|
|
174
|
+
body: val => val[$.$mol_dev_format_body](),
|
|
175
|
+
});
|
|
176
|
+
function $mol_dev_format_native(obj) {
|
|
177
|
+
if (typeof obj === 'undefined')
|
|
178
|
+
return $.$mol_dev_format_shade('undefined');
|
|
179
|
+
if (typeof obj !== 'object' && typeof obj !== 'function')
|
|
180
|
+
return obj;
|
|
181
|
+
return [
|
|
182
|
+
'object',
|
|
183
|
+
{
|
|
184
|
+
object: obj,
|
|
185
|
+
config: true,
|
|
186
|
+
},
|
|
187
|
+
];
|
|
188
|
+
}
|
|
189
|
+
$.$mol_dev_format_native = $mol_dev_format_native;
|
|
190
|
+
function $mol_dev_format_auto(obj) {
|
|
191
|
+
if (obj == null)
|
|
192
|
+
return $.$mol_dev_format_shade(String(obj));
|
|
193
|
+
if (typeof obj === 'object' && $.$mol_dev_format_head in obj) {
|
|
194
|
+
return obj[$.$mol_dev_format_head]();
|
|
195
|
+
}
|
|
196
|
+
return [
|
|
197
|
+
'object',
|
|
198
|
+
{
|
|
199
|
+
object: obj,
|
|
200
|
+
config: false,
|
|
201
|
+
},
|
|
202
|
+
];
|
|
203
|
+
}
|
|
204
|
+
$.$mol_dev_format_auto = $mol_dev_format_auto;
|
|
205
|
+
function $mol_dev_format_element(element, style, ...content) {
|
|
206
|
+
const styles = [];
|
|
207
|
+
for (let key in style)
|
|
208
|
+
styles.push(`${key} : ${style[key]}`);
|
|
209
|
+
return [
|
|
210
|
+
element,
|
|
211
|
+
{
|
|
212
|
+
style: styles.join(' ; '),
|
|
213
|
+
},
|
|
214
|
+
...content,
|
|
215
|
+
];
|
|
216
|
+
}
|
|
217
|
+
$.$mol_dev_format_element = $mol_dev_format_element;
|
|
218
|
+
function $mol_dev_format_span(style, ...content) {
|
|
219
|
+
return $mol_dev_format_element('span', {
|
|
220
|
+
'vertical-align': '8%',
|
|
221
|
+
...style,
|
|
222
|
+
}, ...content);
|
|
223
|
+
}
|
|
224
|
+
$.$mol_dev_format_span = $mol_dev_format_span;
|
|
225
|
+
$.$mol_dev_format_div = $mol_dev_format_element.bind(null, 'div');
|
|
226
|
+
$.$mol_dev_format_ol = $mol_dev_format_element.bind(null, 'ol');
|
|
227
|
+
$.$mol_dev_format_li = $mol_dev_format_element.bind(null, 'li');
|
|
228
|
+
$.$mol_dev_format_table = $mol_dev_format_element.bind(null, 'table');
|
|
229
|
+
$.$mol_dev_format_tr = $mol_dev_format_element.bind(null, 'tr');
|
|
230
|
+
$.$mol_dev_format_td = $mol_dev_format_element.bind(null, 'td');
|
|
231
|
+
$.$mol_dev_format_accent = $mol_dev_format_span.bind(null, {
|
|
232
|
+
'color': 'magenta',
|
|
233
|
+
});
|
|
234
|
+
$.$mol_dev_format_strong = $mol_dev_format_span.bind(null, {
|
|
235
|
+
'font-weight': 'bold',
|
|
236
|
+
});
|
|
237
|
+
$.$mol_dev_format_string = $mol_dev_format_span.bind(null, {
|
|
238
|
+
'color': 'green',
|
|
239
|
+
});
|
|
240
|
+
$.$mol_dev_format_shade = $mol_dev_format_span.bind(null, {
|
|
241
|
+
'color': 'gray',
|
|
242
|
+
});
|
|
243
|
+
$.$mol_dev_format_indent = $.$mol_dev_format_div.bind(null, {
|
|
244
|
+
'margin-left': '13px'
|
|
245
|
+
});
|
|
246
|
+
})($ || ($ = {}));
|
|
247
247
|
//mol/dev/format/format.ts
|
|
248
248
|
;
|
|
249
|
-
"use strict";
|
|
250
|
-
var $;
|
|
251
|
-
(function ($) {
|
|
252
|
-
class $mol_wire_pub_sub extends $mol_wire_pub {
|
|
253
|
-
pub_from = 0;
|
|
254
|
-
cursor = $mol_wire_cursor.stale;
|
|
255
|
-
get pub_list() {
|
|
256
|
-
const res = [];
|
|
257
|
-
for (let i = this.pub_from; i < this.sub_from; i += 2) {
|
|
258
|
-
res.push(this[i]);
|
|
259
|
-
}
|
|
260
|
-
return res;
|
|
261
|
-
}
|
|
262
|
-
track_on() {
|
|
263
|
-
this.cursor = this.pub_from;
|
|
264
|
-
const sub = $mol_wire_auto;
|
|
265
|
-
$mol_wire_auto = this;
|
|
266
|
-
return sub;
|
|
267
|
-
}
|
|
268
|
-
track_promote() {
|
|
269
|
-
if (this.cursor >= this.pub_from) {
|
|
270
|
-
$mol_fail(new Error('Circular subscription'));
|
|
271
|
-
}
|
|
272
|
-
super.track_promote();
|
|
273
|
-
}
|
|
274
|
-
track_next(pub) {
|
|
275
|
-
if (this.cursor < 0)
|
|
276
|
-
$mol_fail(new Error('Promo to non begun sub'));
|
|
277
|
-
if (this.cursor < this.sub_from) {
|
|
278
|
-
const next = this[this.cursor];
|
|
279
|
-
if (pub === undefined)
|
|
280
|
-
return next ?? null;
|
|
281
|
-
if (next === pub) {
|
|
282
|
-
this.cursor += 2;
|
|
283
|
-
return next;
|
|
284
|
-
}
|
|
285
|
-
next?.sub_off(this[this.cursor + 1]);
|
|
286
|
-
}
|
|
287
|
-
else {
|
|
288
|
-
if (pub === undefined)
|
|
289
|
-
return null;
|
|
290
|
-
if (this.sub_from < this.length) {
|
|
291
|
-
this.peer_move(this.sub_from, this.length);
|
|
292
|
-
}
|
|
293
|
-
this.sub_from += 2;
|
|
294
|
-
}
|
|
295
|
-
this[this.cursor] = pub;
|
|
296
|
-
this[this.cursor + 1] = pub.sub_on(this, this.cursor);
|
|
297
|
-
this.cursor += 2;
|
|
298
|
-
return pub;
|
|
299
|
-
}
|
|
300
|
-
track_off(sub) {
|
|
301
|
-
$mol_wire_auto = sub;
|
|
302
|
-
if (this.cursor < 0)
|
|
303
|
-
$mol_fail(new Error('End of non begun sub'));
|
|
304
|
-
this.forget(this.cursor);
|
|
305
|
-
for (let cursor = this.pub_from; cursor < this.sub_from; cursor += 2) {
|
|
306
|
-
const pub = this[cursor];
|
|
307
|
-
pub.up();
|
|
308
|
-
}
|
|
309
|
-
this.cursor = $mol_wire_cursor.fresh;
|
|
310
|
-
}
|
|
311
|
-
pub_off(sub_pos) {
|
|
312
|
-
this[sub_pos] = undefined;
|
|
313
|
-
this[sub_pos + 1] = undefined;
|
|
314
|
-
}
|
|
315
|
-
destructor() {
|
|
316
|
-
for (let cursor = this.length - 2; cursor >= this.sub_from; cursor -= 2) {
|
|
317
|
-
const sub = this[cursor];
|
|
318
|
-
const pos = this[cursor + 1];
|
|
319
|
-
sub.pub_off(pos);
|
|
320
|
-
this.pop();
|
|
321
|
-
this.pop();
|
|
322
|
-
}
|
|
323
|
-
this.forget();
|
|
324
|
-
this.cursor = $mol_wire_cursor.final;
|
|
325
|
-
}
|
|
326
|
-
forget(from = this.pub_from) {
|
|
327
|
-
let tail = 0;
|
|
328
|
-
for (let cursor = from; cursor < this.sub_from; cursor += 2) {
|
|
329
|
-
const pub = this[cursor];
|
|
330
|
-
pub?.sub_off(this[cursor + 1]);
|
|
331
|
-
if (this.sub_from < this.length) {
|
|
332
|
-
this.peer_move(this.length - 2, cursor);
|
|
333
|
-
this.pop();
|
|
334
|
-
this.pop();
|
|
335
|
-
}
|
|
336
|
-
else {
|
|
337
|
-
++tail;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
for (; tail; --tail) {
|
|
341
|
-
this.pop();
|
|
342
|
-
this.pop();
|
|
343
|
-
}
|
|
344
|
-
this.sub_from = from;
|
|
345
|
-
}
|
|
346
|
-
affect(quant) {
|
|
347
|
-
if (this.cursor
|
|
348
|
-
return false;
|
|
349
|
-
this.cursor
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
}
|
|
249
|
+
"use strict";
|
|
250
|
+
var $;
|
|
251
|
+
(function ($) {
|
|
252
|
+
class $mol_wire_pub_sub extends $mol_wire_pub {
|
|
253
|
+
pub_from = 0;
|
|
254
|
+
cursor = $mol_wire_cursor.stale;
|
|
255
|
+
get pub_list() {
|
|
256
|
+
const res = [];
|
|
257
|
+
for (let i = this.pub_from; i < this.sub_from; i += 2) {
|
|
258
|
+
res.push(this[i]);
|
|
259
|
+
}
|
|
260
|
+
return res;
|
|
261
|
+
}
|
|
262
|
+
track_on() {
|
|
263
|
+
this.cursor = this.pub_from;
|
|
264
|
+
const sub = $mol_wire_auto;
|
|
265
|
+
$mol_wire_auto = this;
|
|
266
|
+
return sub;
|
|
267
|
+
}
|
|
268
|
+
track_promote() {
|
|
269
|
+
if (this.cursor >= this.pub_from) {
|
|
270
|
+
$mol_fail(new Error('Circular subscription'));
|
|
271
|
+
}
|
|
272
|
+
super.track_promote();
|
|
273
|
+
}
|
|
274
|
+
track_next(pub) {
|
|
275
|
+
if (this.cursor < 0)
|
|
276
|
+
$mol_fail(new Error('Promo to non begun sub'));
|
|
277
|
+
if (this.cursor < this.sub_from) {
|
|
278
|
+
const next = this[this.cursor];
|
|
279
|
+
if (pub === undefined)
|
|
280
|
+
return next ?? null;
|
|
281
|
+
if (next === pub) {
|
|
282
|
+
this.cursor += 2;
|
|
283
|
+
return next;
|
|
284
|
+
}
|
|
285
|
+
next?.sub_off(this[this.cursor + 1]);
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
if (pub === undefined)
|
|
289
|
+
return null;
|
|
290
|
+
if (this.sub_from < this.length) {
|
|
291
|
+
this.peer_move(this.sub_from, this.length);
|
|
292
|
+
}
|
|
293
|
+
this.sub_from += 2;
|
|
294
|
+
}
|
|
295
|
+
this[this.cursor] = pub;
|
|
296
|
+
this[this.cursor + 1] = pub.sub_on(this, this.cursor);
|
|
297
|
+
this.cursor += 2;
|
|
298
|
+
return pub;
|
|
299
|
+
}
|
|
300
|
+
track_off(sub) {
|
|
301
|
+
$mol_wire_auto = sub;
|
|
302
|
+
if (this.cursor < 0)
|
|
303
|
+
$mol_fail(new Error('End of non begun sub'));
|
|
304
|
+
this.forget(this.cursor);
|
|
305
|
+
for (let cursor = this.pub_from; cursor < this.sub_from; cursor += 2) {
|
|
306
|
+
const pub = this[cursor];
|
|
307
|
+
pub.up();
|
|
308
|
+
}
|
|
309
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
310
|
+
}
|
|
311
|
+
pub_off(sub_pos) {
|
|
312
|
+
this[sub_pos] = undefined;
|
|
313
|
+
this[sub_pos + 1] = undefined;
|
|
314
|
+
}
|
|
315
|
+
destructor() {
|
|
316
|
+
for (let cursor = this.length - 2; cursor >= this.sub_from; cursor -= 2) {
|
|
317
|
+
const sub = this[cursor];
|
|
318
|
+
const pos = this[cursor + 1];
|
|
319
|
+
sub.pub_off(pos);
|
|
320
|
+
this.pop();
|
|
321
|
+
this.pop();
|
|
322
|
+
}
|
|
323
|
+
this.forget();
|
|
324
|
+
this.cursor = $mol_wire_cursor.final;
|
|
325
|
+
}
|
|
326
|
+
forget(from = this.pub_from) {
|
|
327
|
+
let tail = 0;
|
|
328
|
+
for (let cursor = from; cursor < this.sub_from; cursor += 2) {
|
|
329
|
+
const pub = this[cursor];
|
|
330
|
+
pub?.sub_off(this[cursor + 1]);
|
|
331
|
+
if (this.sub_from < this.length) {
|
|
332
|
+
this.peer_move(this.length - 2, cursor);
|
|
333
|
+
this.pop();
|
|
334
|
+
this.pop();
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
++tail;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
for (; tail; --tail) {
|
|
341
|
+
this.pop();
|
|
342
|
+
this.pop();
|
|
343
|
+
}
|
|
344
|
+
this.sub_from = from;
|
|
345
|
+
}
|
|
346
|
+
affect(quant) {
|
|
347
|
+
if (this.cursor === $mol_wire_cursor.final)
|
|
348
|
+
return false;
|
|
349
|
+
if (this.cursor >= quant)
|
|
350
|
+
return false;
|
|
351
|
+
this.cursor = quant;
|
|
352
|
+
return super.affect(quant);
|
|
353
|
+
}
|
|
354
|
+
[$mol_dev_format_head]() {
|
|
355
|
+
return $mol_dev_format_native(this);
|
|
356
|
+
}
|
|
357
|
+
get pub_empty() {
|
|
358
|
+
return this.sub_from === this.pub_from;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
$.$mol_wire_pub_sub = $mol_wire_pub_sub;
|
|
362
|
+
})($ || ($ = {}));
|
|
361
363
|
//mol/wire/pub/sub/sub.ts
|
|
362
364
|
;
|
|
363
|
-
"use strict";
|
|
364
|
-
var $;
|
|
365
|
-
(function ($) {
|
|
366
|
-
$.$mol_compare_deep_cache = new WeakMap();
|
|
367
|
-
function $mol_compare_deep(left, right) {
|
|
368
|
-
if (Object.is(left, right))
|
|
369
|
-
return true;
|
|
370
|
-
if (left === null)
|
|
371
|
-
return false;
|
|
372
|
-
if (right === null)
|
|
373
|
-
return false;
|
|
374
|
-
if (typeof left !== 'object')
|
|
375
|
-
return false;
|
|
376
|
-
if (typeof right !== 'object')
|
|
377
|
-
return false;
|
|
378
|
-
const left_proto = Reflect.getPrototypeOf(left);
|
|
379
|
-
const right_proto = Reflect.getPrototypeOf(right);
|
|
380
|
-
if (left_proto !== right_proto)
|
|
381
|
-
return false;
|
|
382
|
-
if (left instanceof Boolean)
|
|
383
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
384
|
-
if (left instanceof Number)
|
|
385
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
386
|
-
if (left instanceof String)
|
|
387
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
388
|
-
if (left instanceof Date)
|
|
389
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
390
|
-
if (left instanceof RegExp)
|
|
391
|
-
return left.source === right['source'] && left.flags === right['flags'];
|
|
392
|
-
let left_cache = $.$mol_compare_deep_cache.get(left);
|
|
393
|
-
if (left_cache) {
|
|
394
|
-
const right_cache = left_cache.get(right);
|
|
395
|
-
if (typeof right_cache === 'boolean')
|
|
396
|
-
return right_cache;
|
|
397
|
-
}
|
|
398
|
-
else {
|
|
399
|
-
left_cache = new WeakMap([[right, true]]);
|
|
400
|
-
$.$mol_compare_deep_cache.set(left, left_cache);
|
|
401
|
-
}
|
|
402
|
-
let result;
|
|
403
|
-
try {
|
|
404
|
-
if (left_proto && !Reflect.getPrototypeOf(left_proto))
|
|
405
|
-
result = compare_pojo(left, right);
|
|
406
|
-
else if (Array.isArray(left))
|
|
407
|
-
result = compare_array(left, right);
|
|
408
|
-
else if (left instanceof Set)
|
|
409
|
-
result = compare_set(left, right);
|
|
410
|
-
else if (left instanceof Map)
|
|
411
|
-
result = compare_map(left, right);
|
|
412
|
-
else if (ArrayBuffer.isView(left))
|
|
413
|
-
result = compare_buffer(left, right);
|
|
414
|
-
else if (Symbol.toPrimitive in left)
|
|
415
|
-
result = compare_primitive(left, right);
|
|
416
|
-
else
|
|
417
|
-
result = false;
|
|
418
|
-
}
|
|
419
|
-
finally {
|
|
420
|
-
left_cache.set(right, result);
|
|
421
|
-
}
|
|
422
|
-
return result;
|
|
423
|
-
}
|
|
424
|
-
$.$mol_compare_deep = $mol_compare_deep;
|
|
425
|
-
function compare_array(left, right) {
|
|
426
|
-
const len = left.length;
|
|
427
|
-
if (len !== right.length)
|
|
428
|
-
return false;
|
|
429
|
-
for (let i = 0; i < len; ++i) {
|
|
430
|
-
if (!$mol_compare_deep(left[i], right[i]))
|
|
431
|
-
return false;
|
|
432
|
-
}
|
|
433
|
-
return true;
|
|
434
|
-
}
|
|
435
|
-
function compare_buffer(left, right) {
|
|
436
|
-
const len = left.byteLength;
|
|
437
|
-
if (len !== right.byteLength)
|
|
438
|
-
return false;
|
|
439
|
-
for (let i = 0; i < len; ++i) {
|
|
440
|
-
if (left[i] !== right[i])
|
|
441
|
-
return false;
|
|
442
|
-
}
|
|
443
|
-
return true;
|
|
444
|
-
}
|
|
445
|
-
function compare_iterator(left, right, compare) {
|
|
446
|
-
while (true) {
|
|
447
|
-
const left_next = left.next();
|
|
448
|
-
const right_next = right.next();
|
|
449
|
-
if (left_next.done !== right_next.done)
|
|
450
|
-
return false;
|
|
451
|
-
if (left_next.done)
|
|
452
|
-
break;
|
|
453
|
-
if (!compare(left_next.value, right_next.value))
|
|
454
|
-
return false;
|
|
455
|
-
}
|
|
456
|
-
return true;
|
|
457
|
-
}
|
|
458
|
-
function compare_set(left, right) {
|
|
459
|
-
if (left.size !== right.size)
|
|
460
|
-
return false;
|
|
461
|
-
return compare_iterator(left.values(), right.values(), $mol_compare_deep);
|
|
462
|
-
}
|
|
463
|
-
function compare_map(left, right) {
|
|
464
|
-
if (left.size !== right.size)
|
|
465
|
-
return false;
|
|
466
|
-
return compare_iterator(left.keys(), right.keys(), Object.is)
|
|
467
|
-
&& compare_iterator(left.values(), right.values(), $mol_compare_deep);
|
|
468
|
-
}
|
|
469
|
-
function compare_pojo(left, right) {
|
|
470
|
-
const left_keys = Object.getOwnPropertyNames(left);
|
|
471
|
-
const right_keys = Object.getOwnPropertyNames(right);
|
|
472
|
-
if (left_keys.length !== right_keys.length)
|
|
473
|
-
return false;
|
|
474
|
-
for (let key of left_keys) {
|
|
475
|
-
if (!$mol_compare_deep(left[key], Reflect.get(right, key)))
|
|
476
|
-
return false;
|
|
477
|
-
}
|
|
478
|
-
return true;
|
|
479
|
-
}
|
|
480
|
-
function compare_primitive(left, right) {
|
|
481
|
-
return Object.is(left[Symbol.toPrimitive]('default'), right[Symbol.toPrimitive]('default'));
|
|
482
|
-
}
|
|
483
|
-
})($ || ($ = {}));
|
|
365
|
+
"use strict";
|
|
366
|
+
var $;
|
|
367
|
+
(function ($) {
|
|
368
|
+
$.$mol_compare_deep_cache = new WeakMap();
|
|
369
|
+
function $mol_compare_deep(left, right) {
|
|
370
|
+
if (Object.is(left, right))
|
|
371
|
+
return true;
|
|
372
|
+
if (left === null)
|
|
373
|
+
return false;
|
|
374
|
+
if (right === null)
|
|
375
|
+
return false;
|
|
376
|
+
if (typeof left !== 'object')
|
|
377
|
+
return false;
|
|
378
|
+
if (typeof right !== 'object')
|
|
379
|
+
return false;
|
|
380
|
+
const left_proto = Reflect.getPrototypeOf(left);
|
|
381
|
+
const right_proto = Reflect.getPrototypeOf(right);
|
|
382
|
+
if (left_proto !== right_proto)
|
|
383
|
+
return false;
|
|
384
|
+
if (left instanceof Boolean)
|
|
385
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
386
|
+
if (left instanceof Number)
|
|
387
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
388
|
+
if (left instanceof String)
|
|
389
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
390
|
+
if (left instanceof Date)
|
|
391
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
392
|
+
if (left instanceof RegExp)
|
|
393
|
+
return left.source === right['source'] && left.flags === right['flags'];
|
|
394
|
+
let left_cache = $.$mol_compare_deep_cache.get(left);
|
|
395
|
+
if (left_cache) {
|
|
396
|
+
const right_cache = left_cache.get(right);
|
|
397
|
+
if (typeof right_cache === 'boolean')
|
|
398
|
+
return right_cache;
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
left_cache = new WeakMap([[right, true]]);
|
|
402
|
+
$.$mol_compare_deep_cache.set(left, left_cache);
|
|
403
|
+
}
|
|
404
|
+
let result;
|
|
405
|
+
try {
|
|
406
|
+
if (left_proto && !Reflect.getPrototypeOf(left_proto))
|
|
407
|
+
result = compare_pojo(left, right);
|
|
408
|
+
else if (Array.isArray(left))
|
|
409
|
+
result = compare_array(left, right);
|
|
410
|
+
else if (left instanceof Set)
|
|
411
|
+
result = compare_set(left, right);
|
|
412
|
+
else if (left instanceof Map)
|
|
413
|
+
result = compare_map(left, right);
|
|
414
|
+
else if (ArrayBuffer.isView(left))
|
|
415
|
+
result = compare_buffer(left, right);
|
|
416
|
+
else if (Symbol.toPrimitive in left)
|
|
417
|
+
result = compare_primitive(left, right);
|
|
418
|
+
else
|
|
419
|
+
result = false;
|
|
420
|
+
}
|
|
421
|
+
finally {
|
|
422
|
+
left_cache.set(right, result);
|
|
423
|
+
}
|
|
424
|
+
return result;
|
|
425
|
+
}
|
|
426
|
+
$.$mol_compare_deep = $mol_compare_deep;
|
|
427
|
+
function compare_array(left, right) {
|
|
428
|
+
const len = left.length;
|
|
429
|
+
if (len !== right.length)
|
|
430
|
+
return false;
|
|
431
|
+
for (let i = 0; i < len; ++i) {
|
|
432
|
+
if (!$mol_compare_deep(left[i], right[i]))
|
|
433
|
+
return false;
|
|
434
|
+
}
|
|
435
|
+
return true;
|
|
436
|
+
}
|
|
437
|
+
function compare_buffer(left, right) {
|
|
438
|
+
const len = left.byteLength;
|
|
439
|
+
if (len !== right.byteLength)
|
|
440
|
+
return false;
|
|
441
|
+
for (let i = 0; i < len; ++i) {
|
|
442
|
+
if (left[i] !== right[i])
|
|
443
|
+
return false;
|
|
444
|
+
}
|
|
445
|
+
return true;
|
|
446
|
+
}
|
|
447
|
+
function compare_iterator(left, right, compare) {
|
|
448
|
+
while (true) {
|
|
449
|
+
const left_next = left.next();
|
|
450
|
+
const right_next = right.next();
|
|
451
|
+
if (left_next.done !== right_next.done)
|
|
452
|
+
return false;
|
|
453
|
+
if (left_next.done)
|
|
454
|
+
break;
|
|
455
|
+
if (!compare(left_next.value, right_next.value))
|
|
456
|
+
return false;
|
|
457
|
+
}
|
|
458
|
+
return true;
|
|
459
|
+
}
|
|
460
|
+
function compare_set(left, right) {
|
|
461
|
+
if (left.size !== right.size)
|
|
462
|
+
return false;
|
|
463
|
+
return compare_iterator(left.values(), right.values(), $mol_compare_deep);
|
|
464
|
+
}
|
|
465
|
+
function compare_map(left, right) {
|
|
466
|
+
if (left.size !== right.size)
|
|
467
|
+
return false;
|
|
468
|
+
return compare_iterator(left.keys(), right.keys(), Object.is)
|
|
469
|
+
&& compare_iterator(left.values(), right.values(), $mol_compare_deep);
|
|
470
|
+
}
|
|
471
|
+
function compare_pojo(left, right) {
|
|
472
|
+
const left_keys = Object.getOwnPropertyNames(left);
|
|
473
|
+
const right_keys = Object.getOwnPropertyNames(right);
|
|
474
|
+
if (left_keys.length !== right_keys.length)
|
|
475
|
+
return false;
|
|
476
|
+
for (let key of left_keys) {
|
|
477
|
+
if (!$mol_compare_deep(left[key], Reflect.get(right, key)))
|
|
478
|
+
return false;
|
|
479
|
+
}
|
|
480
|
+
return true;
|
|
481
|
+
}
|
|
482
|
+
function compare_primitive(left, right) {
|
|
483
|
+
return Object.is(left[Symbol.toPrimitive]('default'), right[Symbol.toPrimitive]('default'));
|
|
484
|
+
}
|
|
485
|
+
})($ || ($ = {}));
|
|
484
486
|
//mol/compare/deep/deep.ts
|
|
485
487
|
;
|
|
486
|
-
"use strict";
|
|
487
|
-
var $;
|
|
488
|
-
(function ($) {
|
|
489
|
-
function $mol_guid(length = 8, exists = () => false) {
|
|
490
|
-
for (;;) {
|
|
491
|
-
let id = Math.random().toString(36).substring(2, length + 2).toUpperCase();
|
|
492
|
-
if (exists(id))
|
|
493
|
-
continue;
|
|
494
|
-
return id;
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
$.$mol_guid = $mol_guid;
|
|
498
|
-
})($ || ($ = {}));
|
|
488
|
+
"use strict";
|
|
489
|
+
var $;
|
|
490
|
+
(function ($) {
|
|
491
|
+
function $mol_guid(length = 8, exists = () => false) {
|
|
492
|
+
for (;;) {
|
|
493
|
+
let id = Math.random().toString(36).substring(2, length + 2).toUpperCase();
|
|
494
|
+
if (exists(id))
|
|
495
|
+
continue;
|
|
496
|
+
return id;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
$.$mol_guid = $mol_guid;
|
|
500
|
+
})($ || ($ = {}));
|
|
499
501
|
//mol/guid/guid.ts
|
|
500
502
|
;
|
|
501
|
-
"use strict";
|
|
502
|
-
var $;
|
|
503
|
-
(function ($) {
|
|
504
|
-
$.$mol_key_store = new WeakMap();
|
|
505
|
-
function $mol_key(value) {
|
|
506
|
-
if (!value)
|
|
507
|
-
return JSON.stringify(value);
|
|
508
|
-
if (typeof value !== 'object' && typeof value !== 'function')
|
|
509
|
-
return JSON.stringify(value);
|
|
510
|
-
return JSON.stringify(value, (field, value) => {
|
|
511
|
-
if (!value)
|
|
512
|
-
return value;
|
|
513
|
-
if (typeof value !== 'object' && typeof value !== 'function')
|
|
514
|
-
return value;
|
|
515
|
-
if (Array.isArray(value))
|
|
516
|
-
return value;
|
|
517
|
-
const proto = Reflect.getPrototypeOf(value);
|
|
518
|
-
if (!proto)
|
|
519
|
-
return value;
|
|
520
|
-
if (Reflect.getPrototypeOf(proto) === null)
|
|
521
|
-
return value;
|
|
522
|
-
if ('toJSON' in value)
|
|
523
|
-
return value;
|
|
524
|
-
if (value instanceof RegExp)
|
|
525
|
-
return value.toString();
|
|
526
|
-
let key = $.$mol_key_store.get(value);
|
|
527
|
-
if (key)
|
|
528
|
-
return key;
|
|
529
|
-
key = $mol_guid();
|
|
530
|
-
$.$mol_key_store.set(value, key);
|
|
531
|
-
return key;
|
|
532
|
-
});
|
|
533
|
-
}
|
|
534
|
-
$.$mol_key = $mol_key;
|
|
535
|
-
})($ || ($ = {}));
|
|
503
|
+
"use strict";
|
|
504
|
+
var $;
|
|
505
|
+
(function ($) {
|
|
506
|
+
$.$mol_key_store = new WeakMap();
|
|
507
|
+
function $mol_key(value) {
|
|
508
|
+
if (!value)
|
|
509
|
+
return JSON.stringify(value);
|
|
510
|
+
if (typeof value !== 'object' && typeof value !== 'function')
|
|
511
|
+
return JSON.stringify(value);
|
|
512
|
+
return JSON.stringify(value, (field, value) => {
|
|
513
|
+
if (!value)
|
|
514
|
+
return value;
|
|
515
|
+
if (typeof value !== 'object' && typeof value !== 'function')
|
|
516
|
+
return value;
|
|
517
|
+
if (Array.isArray(value))
|
|
518
|
+
return value;
|
|
519
|
+
const proto = Reflect.getPrototypeOf(value);
|
|
520
|
+
if (!proto)
|
|
521
|
+
return value;
|
|
522
|
+
if (Reflect.getPrototypeOf(proto) === null)
|
|
523
|
+
return value;
|
|
524
|
+
if ('toJSON' in value)
|
|
525
|
+
return value;
|
|
526
|
+
if (value instanceof RegExp)
|
|
527
|
+
return value.toString();
|
|
528
|
+
let key = $.$mol_key_store.get(value);
|
|
529
|
+
if (key)
|
|
530
|
+
return key;
|
|
531
|
+
key = $mol_guid();
|
|
532
|
+
$.$mol_key_store.set(value, key);
|
|
533
|
+
return key;
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
$.$mol_key = $mol_key;
|
|
537
|
+
})($ || ($ = {}));
|
|
536
538
|
//mol/key/key.ts
|
|
537
539
|
;
|
|
538
|
-
"use strict";
|
|
539
|
-
var $;
|
|
540
|
-
(function ($) {
|
|
541
|
-
$.$mol_ambient_ref = Symbol('$mol_ambient_ref');
|
|
542
|
-
function $mol_ambient(overrides) {
|
|
543
|
-
return Object.setPrototypeOf(overrides, this || $);
|
|
544
|
-
}
|
|
545
|
-
$.$mol_ambient = $mol_ambient;
|
|
546
|
-
})($ || ($ = {}));
|
|
540
|
+
"use strict";
|
|
541
|
+
var $;
|
|
542
|
+
(function ($) {
|
|
543
|
+
$.$mol_ambient_ref = Symbol('$mol_ambient_ref');
|
|
544
|
+
function $mol_ambient(overrides) {
|
|
545
|
+
return Object.setPrototypeOf(overrides, this || $);
|
|
546
|
+
}
|
|
547
|
+
$.$mol_ambient = $mol_ambient;
|
|
548
|
+
})($ || ($ = {}));
|
|
547
549
|
//mol/ambient/ambient.ts
|
|
548
550
|
;
|
|
549
|
-
"use strict";
|
|
550
|
-
var $;
|
|
551
|
-
(function ($) {
|
|
552
|
-
const instances = new WeakSet();
|
|
553
|
-
function $mol_delegate(proto, target) {
|
|
554
|
-
const proxy = new Proxy(proto, {
|
|
555
|
-
get: (_, field) => {
|
|
556
|
-
const obj = target();
|
|
557
|
-
let val = Reflect.get(obj, field);
|
|
558
|
-
if (typeof val === 'function') {
|
|
559
|
-
val = val.bind(obj);
|
|
560
|
-
}
|
|
561
|
-
return val;
|
|
562
|
-
},
|
|
563
|
-
has: (_, field) => Reflect.has(target(), field),
|
|
564
|
-
set: (_, field, value) => Reflect.set(target(), field, value),
|
|
565
|
-
getOwnPropertyDescriptor: (_, field) => Reflect.getOwnPropertyDescriptor(target(), field),
|
|
566
|
-
ownKeys: () => Reflect.ownKeys(target()),
|
|
567
|
-
getPrototypeOf: () => Reflect.getPrototypeOf(target()),
|
|
568
|
-
setPrototypeOf: (_, donor) => Reflect.setPrototypeOf(target(), donor),
|
|
569
|
-
isExtensible: () => Reflect.isExtensible(target()),
|
|
570
|
-
preventExtensions: () => Reflect.preventExtensions(target()),
|
|
571
|
-
apply: (_, self, args) => Reflect.apply(target(), self, args),
|
|
572
|
-
construct: (_, args, retarget) => Reflect.construct(target(), args, retarget),
|
|
573
|
-
defineProperty: (_, field, descr) => Reflect.defineProperty(target(), field, descr),
|
|
574
|
-
deleteProperty: (_, field) => Reflect.deleteProperty(target(), field),
|
|
575
|
-
});
|
|
576
|
-
instances.add(proxy);
|
|
577
|
-
return proxy;
|
|
578
|
-
}
|
|
579
|
-
$.$mol_delegate = $mol_delegate;
|
|
580
|
-
Reflect.defineProperty($mol_delegate, Symbol.hasInstance, {
|
|
581
|
-
value: (obj) => instances.has(obj),
|
|
582
|
-
});
|
|
583
|
-
})($ || ($ = {}));
|
|
551
|
+
"use strict";
|
|
552
|
+
var $;
|
|
553
|
+
(function ($) {
|
|
554
|
+
const instances = new WeakSet();
|
|
555
|
+
function $mol_delegate(proto, target) {
|
|
556
|
+
const proxy = new Proxy(proto, {
|
|
557
|
+
get: (_, field) => {
|
|
558
|
+
const obj = target();
|
|
559
|
+
let val = Reflect.get(obj, field);
|
|
560
|
+
if (typeof val === 'function') {
|
|
561
|
+
val = val.bind(obj);
|
|
562
|
+
}
|
|
563
|
+
return val;
|
|
564
|
+
},
|
|
565
|
+
has: (_, field) => Reflect.has(target(), field),
|
|
566
|
+
set: (_, field, value) => Reflect.set(target(), field, value),
|
|
567
|
+
getOwnPropertyDescriptor: (_, field) => Reflect.getOwnPropertyDescriptor(target(), field),
|
|
568
|
+
ownKeys: () => Reflect.ownKeys(target()),
|
|
569
|
+
getPrototypeOf: () => Reflect.getPrototypeOf(target()),
|
|
570
|
+
setPrototypeOf: (_, donor) => Reflect.setPrototypeOf(target(), donor),
|
|
571
|
+
isExtensible: () => Reflect.isExtensible(target()),
|
|
572
|
+
preventExtensions: () => Reflect.preventExtensions(target()),
|
|
573
|
+
apply: (_, self, args) => Reflect.apply(target(), self, args),
|
|
574
|
+
construct: (_, args, retarget) => Reflect.construct(target(), args, retarget),
|
|
575
|
+
defineProperty: (_, field, descr) => Reflect.defineProperty(target(), field, descr),
|
|
576
|
+
deleteProperty: (_, field) => Reflect.deleteProperty(target(), field),
|
|
577
|
+
});
|
|
578
|
+
instances.add(proxy);
|
|
579
|
+
return proxy;
|
|
580
|
+
}
|
|
581
|
+
$.$mol_delegate = $mol_delegate;
|
|
582
|
+
Reflect.defineProperty($mol_delegate, Symbol.hasInstance, {
|
|
583
|
+
value: (obj) => instances.has(obj),
|
|
584
|
+
});
|
|
585
|
+
})($ || ($ = {}));
|
|
584
586
|
//mol/delegate/delegate.ts
|
|
585
587
|
;
|
|
586
|
-
"use strict";
|
|
587
|
-
var $;
|
|
588
|
-
(function ($) {
|
|
589
|
-
$.$mol_owning_map = new WeakMap();
|
|
590
|
-
function $mol_owning_allow(having) {
|
|
591
|
-
try {
|
|
592
|
-
if (!having)
|
|
593
|
-
return false;
|
|
594
|
-
if (typeof having !== 'object')
|
|
595
|
-
return false;
|
|
596
|
-
if (having instanceof $mol_delegate)
|
|
597
|
-
return false;
|
|
598
|
-
if (typeof having['destructor'] !== 'function')
|
|
599
|
-
return false;
|
|
600
|
-
return true;
|
|
601
|
-
}
|
|
602
|
-
catch {
|
|
603
|
-
return false;
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
$.$mol_owning_allow = $mol_owning_allow;
|
|
607
|
-
function $mol_owning_get(having, Owner) {
|
|
608
|
-
if (!$mol_owning_allow(having))
|
|
609
|
-
return null;
|
|
610
|
-
while (true) {
|
|
611
|
-
const owner = $.$mol_owning_map.get(having);
|
|
612
|
-
if (!owner)
|
|
613
|
-
return owner;
|
|
614
|
-
if (!Owner)
|
|
615
|
-
return owner;
|
|
616
|
-
if (owner instanceof Owner)
|
|
617
|
-
return owner;
|
|
618
|
-
having = owner;
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
$.$mol_owning_get = $mol_owning_get;
|
|
622
|
-
function $mol_owning_check(owner, having) {
|
|
623
|
-
if (!$mol_owning_allow(having))
|
|
624
|
-
return false;
|
|
625
|
-
if ($.$mol_owning_map.get(having) !== owner)
|
|
626
|
-
return false;
|
|
627
|
-
return true;
|
|
628
|
-
}
|
|
629
|
-
$.$mol_owning_check = $mol_owning_check;
|
|
630
|
-
function $mol_owning_catch(owner, having) {
|
|
631
|
-
if (!$mol_owning_allow(having))
|
|
632
|
-
return false;
|
|
633
|
-
if ($.$mol_owning_map.get(having))
|
|
634
|
-
return false;
|
|
635
|
-
$.$mol_owning_map.set(having, owner);
|
|
636
|
-
return true;
|
|
637
|
-
}
|
|
638
|
-
$.$mol_owning_catch = $mol_owning_catch;
|
|
639
|
-
})($ || ($ = {}));
|
|
588
|
+
"use strict";
|
|
589
|
+
var $;
|
|
590
|
+
(function ($) {
|
|
591
|
+
$.$mol_owning_map = new WeakMap();
|
|
592
|
+
function $mol_owning_allow(having) {
|
|
593
|
+
try {
|
|
594
|
+
if (!having)
|
|
595
|
+
return false;
|
|
596
|
+
if (typeof having !== 'object')
|
|
597
|
+
return false;
|
|
598
|
+
if (having instanceof $mol_delegate)
|
|
599
|
+
return false;
|
|
600
|
+
if (typeof having['destructor'] !== 'function')
|
|
601
|
+
return false;
|
|
602
|
+
return true;
|
|
603
|
+
}
|
|
604
|
+
catch {
|
|
605
|
+
return false;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
$.$mol_owning_allow = $mol_owning_allow;
|
|
609
|
+
function $mol_owning_get(having, Owner) {
|
|
610
|
+
if (!$mol_owning_allow(having))
|
|
611
|
+
return null;
|
|
612
|
+
while (true) {
|
|
613
|
+
const owner = $.$mol_owning_map.get(having);
|
|
614
|
+
if (!owner)
|
|
615
|
+
return owner;
|
|
616
|
+
if (!Owner)
|
|
617
|
+
return owner;
|
|
618
|
+
if (owner instanceof Owner)
|
|
619
|
+
return owner;
|
|
620
|
+
having = owner;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
$.$mol_owning_get = $mol_owning_get;
|
|
624
|
+
function $mol_owning_check(owner, having) {
|
|
625
|
+
if (!$mol_owning_allow(having))
|
|
626
|
+
return false;
|
|
627
|
+
if ($.$mol_owning_map.get(having) !== owner)
|
|
628
|
+
return false;
|
|
629
|
+
return true;
|
|
630
|
+
}
|
|
631
|
+
$.$mol_owning_check = $mol_owning_check;
|
|
632
|
+
function $mol_owning_catch(owner, having) {
|
|
633
|
+
if (!$mol_owning_allow(having))
|
|
634
|
+
return false;
|
|
635
|
+
if ($.$mol_owning_map.get(having))
|
|
636
|
+
return false;
|
|
637
|
+
$.$mol_owning_map.set(having, owner);
|
|
638
|
+
return true;
|
|
639
|
+
}
|
|
640
|
+
$.$mol_owning_catch = $mol_owning_catch;
|
|
641
|
+
})($ || ($ = {}));
|
|
640
642
|
//mol/owning/owning.ts
|
|
641
643
|
;
|
|
642
|
-
"use strict";
|
|
643
|
-
var $;
|
|
644
|
-
(function ($) {
|
|
645
|
-
function $mol_fail_hidden(error) {
|
|
646
|
-
throw error;
|
|
647
|
-
}
|
|
648
|
-
$.$mol_fail_hidden = $mol_fail_hidden;
|
|
649
|
-
})($ || ($ = {}));
|
|
644
|
+
"use strict";
|
|
645
|
+
var $;
|
|
646
|
+
(function ($) {
|
|
647
|
+
function $mol_fail_hidden(error) {
|
|
648
|
+
throw error;
|
|
649
|
+
}
|
|
650
|
+
$.$mol_fail_hidden = $mol_fail_hidden;
|
|
651
|
+
})($ || ($ = {}));
|
|
650
652
|
//mol/fail/hidden/hidden.ts
|
|
651
653
|
;
|
|
652
|
-
"use strict";
|
|
654
|
+
"use strict";
|
|
653
655
|
//mol/type/writable/writable.ts
|
|
654
656
|
;
|
|
655
|
-
"use strict";
|
|
656
|
-
var $;
|
|
657
|
-
(function ($) {
|
|
658
|
-
class $mol_object2 {
|
|
659
|
-
static $ = $;
|
|
660
|
-
[$mol_ambient_ref] = null;
|
|
661
|
-
get $() {
|
|
662
|
-
if (this[$mol_ambient_ref])
|
|
663
|
-
return this[$mol_ambient_ref];
|
|
664
|
-
const owner = $mol_owning_get(this);
|
|
665
|
-
return this[$mol_ambient_ref] = owner?.$ || $mol_object2.$;
|
|
666
|
-
}
|
|
667
|
-
set $(next) {
|
|
668
|
-
if (this[$mol_ambient_ref])
|
|
669
|
-
$mol_fail_hidden(new Error('Context already defined'));
|
|
670
|
-
this[$mol_ambient_ref] = next;
|
|
671
|
-
}
|
|
672
|
-
static create(init) {
|
|
673
|
-
const obj = new this;
|
|
674
|
-
if (init)
|
|
675
|
-
init(obj);
|
|
676
|
-
return obj;
|
|
677
|
-
}
|
|
678
|
-
static [Symbol.toPrimitive]() {
|
|
679
|
-
return this.toString();
|
|
680
|
-
}
|
|
681
|
-
static toString() {
|
|
682
|
-
if (Symbol.toStringTag in this)
|
|
683
|
-
return this[Symbol.toStringTag];
|
|
684
|
-
return this.name;
|
|
685
|
-
}
|
|
686
|
-
destructor() { }
|
|
687
|
-
toString() {
|
|
688
|
-
return this[Symbol.toStringTag] || this.constructor.name + '()';
|
|
689
|
-
}
|
|
690
|
-
toJSON() {
|
|
691
|
-
return this.toString();
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
$.$mol_object2 = $mol_object2;
|
|
695
|
-
})($ || ($ = {}));
|
|
657
|
+
"use strict";
|
|
658
|
+
var $;
|
|
659
|
+
(function ($) {
|
|
660
|
+
class $mol_object2 {
|
|
661
|
+
static $ = $;
|
|
662
|
+
[$mol_ambient_ref] = null;
|
|
663
|
+
get $() {
|
|
664
|
+
if (this[$mol_ambient_ref])
|
|
665
|
+
return this[$mol_ambient_ref];
|
|
666
|
+
const owner = $mol_owning_get(this);
|
|
667
|
+
return this[$mol_ambient_ref] = owner?.$ || $mol_object2.$;
|
|
668
|
+
}
|
|
669
|
+
set $(next) {
|
|
670
|
+
if (this[$mol_ambient_ref])
|
|
671
|
+
$mol_fail_hidden(new Error('Context already defined'));
|
|
672
|
+
this[$mol_ambient_ref] = next;
|
|
673
|
+
}
|
|
674
|
+
static create(init) {
|
|
675
|
+
const obj = new this;
|
|
676
|
+
if (init)
|
|
677
|
+
init(obj);
|
|
678
|
+
return obj;
|
|
679
|
+
}
|
|
680
|
+
static [Symbol.toPrimitive]() {
|
|
681
|
+
return this.toString();
|
|
682
|
+
}
|
|
683
|
+
static toString() {
|
|
684
|
+
if (Symbol.toStringTag in this)
|
|
685
|
+
return this[Symbol.toStringTag];
|
|
686
|
+
return this.name;
|
|
687
|
+
}
|
|
688
|
+
destructor() { }
|
|
689
|
+
toString() {
|
|
690
|
+
return this[Symbol.toStringTag] || this.constructor.name + '()';
|
|
691
|
+
}
|
|
692
|
+
toJSON() {
|
|
693
|
+
return this.toString();
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
$.$mol_object2 = $mol_object2;
|
|
697
|
+
})($ || ($ = {}));
|
|
696
698
|
//mol/object2/object2.ts
|
|
697
699
|
;
|
|
698
|
-
"use strict";
|
|
699
|
-
var $;
|
|
700
|
-
(function ($) {
|
|
701
|
-
class $mol_after_timeout extends $mol_object2 {
|
|
702
|
-
delay;
|
|
703
|
-
task;
|
|
704
|
-
id;
|
|
705
|
-
constructor(delay, task) {
|
|
706
|
-
super();
|
|
707
|
-
this.delay = delay;
|
|
708
|
-
this.task = task;
|
|
709
|
-
this.id = setTimeout(task, delay);
|
|
710
|
-
}
|
|
711
|
-
destructor() {
|
|
712
|
-
clearTimeout(this.id);
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
$.$mol_after_timeout = $mol_after_timeout;
|
|
716
|
-
})($ || ($ = {}));
|
|
700
|
+
"use strict";
|
|
701
|
+
var $;
|
|
702
|
+
(function ($) {
|
|
703
|
+
class $mol_after_timeout extends $mol_object2 {
|
|
704
|
+
delay;
|
|
705
|
+
task;
|
|
706
|
+
id;
|
|
707
|
+
constructor(delay, task) {
|
|
708
|
+
super();
|
|
709
|
+
this.delay = delay;
|
|
710
|
+
this.task = task;
|
|
711
|
+
this.id = setTimeout(task, delay);
|
|
712
|
+
}
|
|
713
|
+
destructor() {
|
|
714
|
+
clearTimeout(this.id);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
$.$mol_after_timeout = $mol_after_timeout;
|
|
718
|
+
})($ || ($ = {}));
|
|
717
719
|
//mol/after/timeout/timeout.ts
|
|
718
720
|
;
|
|
719
|
-
"use strict";
|
|
720
|
-
var $;
|
|
721
|
-
(function ($) {
|
|
722
|
-
class $mol_after_frame extends $mol_after_timeout {
|
|
723
|
-
task;
|
|
724
|
-
constructor(task) {
|
|
725
|
-
super(16, task);
|
|
726
|
-
this.task = task;
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
$.$mol_after_frame = $mol_after_frame;
|
|
730
|
-
})($ || ($ = {}));
|
|
721
|
+
"use strict";
|
|
722
|
+
var $;
|
|
723
|
+
(function ($) {
|
|
724
|
+
class $mol_after_frame extends $mol_after_timeout {
|
|
725
|
+
task;
|
|
726
|
+
constructor(task) {
|
|
727
|
+
super(16, task);
|
|
728
|
+
this.task = task;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
$.$mol_after_frame = $mol_after_frame;
|
|
732
|
+
})($ || ($ = {}));
|
|
731
733
|
//mol/after/frame/frame.node.ts
|
|
732
734
|
;
|
|
733
|
-
"use strict";
|
|
734
|
-
var $;
|
|
735
|
-
(function ($) {
|
|
736
|
-
function $mol_wire_method(host, field, descr) {
|
|
737
|
-
if (!descr)
|
|
738
|
-
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
739
|
-
const orig = descr?.value ?? host[field];
|
|
740
|
-
const sup = Reflect.getPrototypeOf(host);
|
|
741
|
-
if (typeof sup[field] === 'function') {
|
|
742
|
-
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
743
|
-
}
|
|
744
|
-
const value = function (...args) {
|
|
745
|
-
const fiber = $mol_wire_fiber.temp(this ?? null, orig, ...args);
|
|
746
|
-
return fiber.sync();
|
|
747
|
-
};
|
|
748
|
-
Object.defineProperty(value, 'name', { value: orig.name + ' ' });
|
|
749
|
-
Object.assign(value, { orig });
|
|
750
|
-
const descr2 = { ...descr, value };
|
|
751
|
-
Reflect.defineProperty(host, field, descr2);
|
|
752
|
-
return descr2;
|
|
753
|
-
}
|
|
754
|
-
$.$mol_wire_method = $mol_wire_method;
|
|
755
|
-
})($ || ($ = {}));
|
|
735
|
+
"use strict";
|
|
736
|
+
var $;
|
|
737
|
+
(function ($) {
|
|
738
|
+
function $mol_wire_method(host, field, descr) {
|
|
739
|
+
if (!descr)
|
|
740
|
+
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
741
|
+
const orig = descr?.value ?? host[field];
|
|
742
|
+
const sup = Reflect.getPrototypeOf(host);
|
|
743
|
+
if (typeof sup[field] === 'function') {
|
|
744
|
+
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
745
|
+
}
|
|
746
|
+
const value = function (...args) {
|
|
747
|
+
const fiber = $mol_wire_fiber.temp(this ?? null, orig, ...args);
|
|
748
|
+
return fiber.sync();
|
|
749
|
+
};
|
|
750
|
+
Object.defineProperty(value, 'name', { value: orig.name + ' ' });
|
|
751
|
+
Object.assign(value, { orig });
|
|
752
|
+
const descr2 = { ...descr, value };
|
|
753
|
+
Reflect.defineProperty(host, field, descr2);
|
|
754
|
+
return descr2;
|
|
755
|
+
}
|
|
756
|
+
$.$mol_wire_method = $mol_wire_method;
|
|
757
|
+
})($ || ($ = {}));
|
|
756
758
|
//mol/wire/method/method.ts
|
|
757
759
|
;
|
|
758
|
-
"use strict";
|
|
759
|
-
var $;
|
|
760
|
-
(function ($) {
|
|
761
|
-
const handled = new WeakSet();
|
|
762
|
-
class $mol_wire_fiber extends $mol_wire_pub_sub {
|
|
763
|
-
host;
|
|
764
|
-
task;
|
|
765
|
-
static temp(host, task, ...args) {
|
|
766
|
-
const existen = $mol_wire_auto?.track_next();
|
|
767
|
-
reuse: if (existen) {
|
|
768
|
-
if (!(existen instanceof $mol_wire_fiber))
|
|
769
|
-
break reuse;
|
|
770
|
-
if (existen.host !== host)
|
|
771
|
-
break reuse;
|
|
772
|
-
if (existen.task !== task)
|
|
773
|
-
break reuse;
|
|
774
|
-
if (!$mol_compare_deep(existen.args, args))
|
|
775
|
-
break reuse;
|
|
776
|
-
return existen;
|
|
777
|
-
}
|
|
778
|
-
return new this(host, task, host + '.' + task.name + '(#)', ...args);
|
|
779
|
-
}
|
|
780
|
-
static persist(host, task, ...args) {
|
|
781
|
-
const field = task.name + '()';
|
|
782
|
-
let dict, key, existen, fiber;
|
|
783
|
-
if (args.length) {
|
|
784
|
-
key = `${host}.${task.name}(${args.map(v => $mol_key(v)).join(',')})`;
|
|
785
|
-
dict = Object.getOwnPropertyDescriptor(host, field)?.value;
|
|
786
|
-
if (dict)
|
|
787
|
-
existen = dict.get(key);
|
|
788
|
-
else
|
|
789
|
-
dict = host[field] = new Map();
|
|
790
|
-
}
|
|
791
|
-
else {
|
|
792
|
-
key = `${host}.${field}`;
|
|
793
|
-
existen = Object.getOwnPropertyDescriptor(host, field)?.value;
|
|
794
|
-
}
|
|
795
|
-
reuse: if (existen) {
|
|
796
|
-
if (!(existen instanceof $mol_wire_fiber))
|
|
797
|
-
break reuse;
|
|
798
|
-
if (existen.host !== host)
|
|
799
|
-
break reuse;
|
|
800
|
-
if (existen.task !== task)
|
|
801
|
-
break reuse;
|
|
802
|
-
return existen;
|
|
803
|
-
}
|
|
804
|
-
fiber = new this(host, task, key, ...args);
|
|
805
|
-
if (args.length)
|
|
806
|
-
dict.set(key, fiber);
|
|
807
|
-
else
|
|
808
|
-
host[field] = fiber;
|
|
809
|
-
return fiber;
|
|
810
|
-
}
|
|
811
|
-
static warm = true;
|
|
812
|
-
static planning = [];
|
|
813
|
-
static reaping = [];
|
|
814
|
-
static plan_task = null;
|
|
815
|
-
static plan() {
|
|
816
|
-
if (this.plan_task)
|
|
817
|
-
return;
|
|
818
|
-
this.plan_task = new $mol_after_frame(() => {
|
|
819
|
-
try {
|
|
820
|
-
this.sync();
|
|
821
|
-
}
|
|
822
|
-
finally {
|
|
823
|
-
$mol_wire_fiber.plan_task = null;
|
|
824
|
-
}
|
|
825
|
-
});
|
|
826
|
-
}
|
|
827
|
-
static sync() {
|
|
828
|
-
while (this.planning.length) {
|
|
829
|
-
const fibers = this.planning.splice(0, this.planning.length);
|
|
830
|
-
for (const fiber of fibers) {
|
|
831
|
-
fiber.up();
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
while (this.reaping.length) {
|
|
835
|
-
const fibers = this.reaping.splice(0, this.reaping.length);
|
|
836
|
-
for (const fiber of fibers) {
|
|
837
|
-
if (!fiber.sub_empty)
|
|
838
|
-
continue;
|
|
839
|
-
fiber.destructor();
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
cache = undefined;
|
|
844
|
-
get args() {
|
|
845
|
-
return this.slice(0, this.pub_from);
|
|
846
|
-
}
|
|
847
|
-
get result() {
|
|
848
|
-
if (this.cache instanceof Promise)
|
|
849
|
-
return;
|
|
850
|
-
if (this.cache instanceof Error)
|
|
851
|
-
return;
|
|
852
|
-
return this.cache;
|
|
853
|
-
}
|
|
854
|
-
get persist() {
|
|
855
|
-
const id = this[Symbol.toStringTag];
|
|
856
|
-
return id[id.length - 2] !== '#';
|
|
857
|
-
}
|
|
858
|
-
field() {
|
|
859
|
-
return this.task.name + '()';
|
|
860
|
-
}
|
|
861
|
-
constructor(host, task, id, ...args) {
|
|
862
|
-
super(...args, undefined);
|
|
863
|
-
this.host = host;
|
|
864
|
-
this.task = task;
|
|
865
|
-
this.pop();
|
|
866
|
-
this.pub_from = this.sub_from = args.length;
|
|
867
|
-
this[Symbol.toStringTag] = id;
|
|
868
|
-
}
|
|
869
|
-
destructor() {
|
|
870
|
-
super.destructor();
|
|
871
|
-
const prev = this.cache;
|
|
872
|
-
if ($mol_owning_check(this, prev)) {
|
|
873
|
-
prev.destructor();
|
|
874
|
-
}
|
|
875
|
-
this.
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
$mol_wire_fiber.
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
$mol_wire_fiber.
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
this.
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
pub
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
this.
|
|
993
|
-
this.
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
this.
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
760
|
+
"use strict";
|
|
761
|
+
var $;
|
|
762
|
+
(function ($) {
|
|
763
|
+
const handled = new WeakSet();
|
|
764
|
+
class $mol_wire_fiber extends $mol_wire_pub_sub {
|
|
765
|
+
host;
|
|
766
|
+
task;
|
|
767
|
+
static temp(host, task, ...args) {
|
|
768
|
+
const existen = $mol_wire_auto?.track_next();
|
|
769
|
+
reuse: if (existen) {
|
|
770
|
+
if (!(existen instanceof $mol_wire_fiber))
|
|
771
|
+
break reuse;
|
|
772
|
+
if (existen.host !== host)
|
|
773
|
+
break reuse;
|
|
774
|
+
if (existen.task !== task)
|
|
775
|
+
break reuse;
|
|
776
|
+
if (!$mol_compare_deep(existen.args, args))
|
|
777
|
+
break reuse;
|
|
778
|
+
return existen;
|
|
779
|
+
}
|
|
780
|
+
return new this(host, task, host + '.' + task.name + '(#)', ...args);
|
|
781
|
+
}
|
|
782
|
+
static persist(host, task, ...args) {
|
|
783
|
+
const field = task.name + '()';
|
|
784
|
+
let dict, key, existen, fiber;
|
|
785
|
+
if (args.length) {
|
|
786
|
+
key = `${host}.${task.name}(${args.map(v => $mol_key(v)).join(',')})`;
|
|
787
|
+
dict = Object.getOwnPropertyDescriptor(host, field)?.value;
|
|
788
|
+
if (dict)
|
|
789
|
+
existen = dict.get(key);
|
|
790
|
+
else
|
|
791
|
+
dict = host[field] = new Map();
|
|
792
|
+
}
|
|
793
|
+
else {
|
|
794
|
+
key = `${host}.${field}`;
|
|
795
|
+
existen = Object.getOwnPropertyDescriptor(host, field)?.value;
|
|
796
|
+
}
|
|
797
|
+
reuse: if (existen) {
|
|
798
|
+
if (!(existen instanceof $mol_wire_fiber))
|
|
799
|
+
break reuse;
|
|
800
|
+
if (existen.host !== host)
|
|
801
|
+
break reuse;
|
|
802
|
+
if (existen.task !== task)
|
|
803
|
+
break reuse;
|
|
804
|
+
return existen;
|
|
805
|
+
}
|
|
806
|
+
fiber = new this(host, task, key, ...args);
|
|
807
|
+
if (args.length)
|
|
808
|
+
dict.set(key, fiber);
|
|
809
|
+
else
|
|
810
|
+
host[field] = fiber;
|
|
811
|
+
return fiber;
|
|
812
|
+
}
|
|
813
|
+
static warm = true;
|
|
814
|
+
static planning = [];
|
|
815
|
+
static reaping = [];
|
|
816
|
+
static plan_task = null;
|
|
817
|
+
static plan() {
|
|
818
|
+
if (this.plan_task)
|
|
819
|
+
return;
|
|
820
|
+
this.plan_task = new $mol_after_frame(() => {
|
|
821
|
+
try {
|
|
822
|
+
this.sync();
|
|
823
|
+
}
|
|
824
|
+
finally {
|
|
825
|
+
$mol_wire_fiber.plan_task = null;
|
|
826
|
+
}
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
static sync() {
|
|
830
|
+
while (this.planning.length) {
|
|
831
|
+
const fibers = this.planning.splice(0, this.planning.length);
|
|
832
|
+
for (const fiber of fibers) {
|
|
833
|
+
fiber.up();
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
while (this.reaping.length) {
|
|
837
|
+
const fibers = this.reaping.splice(0, this.reaping.length);
|
|
838
|
+
for (const fiber of fibers) {
|
|
839
|
+
if (!fiber.sub_empty)
|
|
840
|
+
continue;
|
|
841
|
+
fiber.destructor();
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
cache = undefined;
|
|
846
|
+
get args() {
|
|
847
|
+
return this.slice(0, this.pub_from);
|
|
848
|
+
}
|
|
849
|
+
get result() {
|
|
850
|
+
if (this.cache instanceof Promise)
|
|
851
|
+
return;
|
|
852
|
+
if (this.cache instanceof Error)
|
|
853
|
+
return;
|
|
854
|
+
return this.cache;
|
|
855
|
+
}
|
|
856
|
+
get persist() {
|
|
857
|
+
const id = this[Symbol.toStringTag];
|
|
858
|
+
return id[id.length - 2] !== '#';
|
|
859
|
+
}
|
|
860
|
+
field() {
|
|
861
|
+
return this.task.name + '()';
|
|
862
|
+
}
|
|
863
|
+
constructor(host, task, id, ...args) {
|
|
864
|
+
super(...args, undefined);
|
|
865
|
+
this.host = host;
|
|
866
|
+
this.task = task;
|
|
867
|
+
this.pop();
|
|
868
|
+
this.pub_from = this.sub_from = args.length;
|
|
869
|
+
this[Symbol.toStringTag] = id;
|
|
870
|
+
}
|
|
871
|
+
destructor() {
|
|
872
|
+
super.destructor();
|
|
873
|
+
const prev = this.cache;
|
|
874
|
+
if ($mol_owning_check(this, prev)) {
|
|
875
|
+
prev.destructor();
|
|
876
|
+
}
|
|
877
|
+
if (this.persist) {
|
|
878
|
+
if (this.pub_from === 0) {
|
|
879
|
+
this.host[this.field()] = null;
|
|
880
|
+
}
|
|
881
|
+
else {
|
|
882
|
+
this.host[this.field()].delete(this[Symbol.toStringTag]);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
plan() {
|
|
887
|
+
$mol_wire_fiber.planning.push(this);
|
|
888
|
+
$mol_wire_fiber.plan();
|
|
889
|
+
}
|
|
890
|
+
reap() {
|
|
891
|
+
$mol_wire_fiber.reaping.push(this);
|
|
892
|
+
$mol_wire_fiber.plan();
|
|
893
|
+
}
|
|
894
|
+
toString() {
|
|
895
|
+
return this[Symbol.toStringTag];
|
|
896
|
+
}
|
|
897
|
+
[$mol_dev_format_head]() {
|
|
898
|
+
const cursor = this.cursor >= 0
|
|
899
|
+
? '@' + this.cursor
|
|
900
|
+
: this.cursor?.constructor?.name;
|
|
901
|
+
return $mol_dev_format_div({}, $mol_dev_format_native(this), $mol_dev_format_shade(' ' + cursor + ' = '), $mol_dev_format_auto(this.cache));
|
|
902
|
+
}
|
|
903
|
+
get $() {
|
|
904
|
+
return this.host['$'];
|
|
905
|
+
}
|
|
906
|
+
affect(quant) {
|
|
907
|
+
if (!super.affect(quant))
|
|
908
|
+
return false;
|
|
909
|
+
if (this.sub_from === this.length) {
|
|
910
|
+
this.plan();
|
|
911
|
+
}
|
|
912
|
+
return true;
|
|
913
|
+
}
|
|
914
|
+
down() {
|
|
915
|
+
if (this.persist)
|
|
916
|
+
return;
|
|
917
|
+
this.destructor();
|
|
918
|
+
}
|
|
919
|
+
up() {
|
|
920
|
+
if (this.cursor === $mol_wire_cursor.fresh)
|
|
921
|
+
return;
|
|
922
|
+
if (this.cursor === $mol_wire_cursor.final)
|
|
923
|
+
return;
|
|
924
|
+
check: if (this.cursor === $mol_wire_cursor.doubt) {
|
|
925
|
+
for (let i = this.pub_from; i < this.sub_from; i += 2) {
|
|
926
|
+
;
|
|
927
|
+
this[i]?.up();
|
|
928
|
+
if (this.cursor !== $mol_wire_cursor.doubt)
|
|
929
|
+
break check;
|
|
930
|
+
}
|
|
931
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
932
|
+
return;
|
|
933
|
+
}
|
|
934
|
+
const bu = this.track_on();
|
|
935
|
+
let result;
|
|
936
|
+
try {
|
|
937
|
+
result = this.task.call(this.host, ...this.args);
|
|
938
|
+
if (result instanceof Promise) {
|
|
939
|
+
const put = (res) => {
|
|
940
|
+
if (this.cache === result)
|
|
941
|
+
this.put(res);
|
|
942
|
+
return res;
|
|
943
|
+
};
|
|
944
|
+
result = Object.assign(result.then(put, put), {
|
|
945
|
+
destructor: result['destructor']
|
|
946
|
+
});
|
|
947
|
+
handled.add(result);
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
catch (error) {
|
|
951
|
+
result = error;
|
|
952
|
+
if (result instanceof Promise && !handled.has(result)) {
|
|
953
|
+
result = Object.assign(result.finally(() => {
|
|
954
|
+
if (this.cache === result)
|
|
955
|
+
this.stale();
|
|
956
|
+
}), {
|
|
957
|
+
destructor: result['destructor']
|
|
958
|
+
});
|
|
959
|
+
handled.add(result);
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
this.track_off(bu);
|
|
963
|
+
this.put(result);
|
|
964
|
+
}
|
|
965
|
+
put(next) {
|
|
966
|
+
const prev = this.cache;
|
|
967
|
+
if (next !== prev) {
|
|
968
|
+
if ($mol_owning_check(this, prev)) {
|
|
969
|
+
prev.destructor();
|
|
970
|
+
}
|
|
971
|
+
this.cache = next;
|
|
972
|
+
if (this.persist && $mol_owning_catch(this, next)) {
|
|
973
|
+
try {
|
|
974
|
+
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
975
|
+
}
|
|
976
|
+
catch { }
|
|
977
|
+
}
|
|
978
|
+
if (this.sub_from < this.length) {
|
|
979
|
+
if (!$mol_compare_deep(prev, next)) {
|
|
980
|
+
this.emit();
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
985
|
+
if (next instanceof Promise)
|
|
986
|
+
return next;
|
|
987
|
+
if (this.persist) {
|
|
988
|
+
for (let cursor = this.pub_from; cursor < this.sub_from; cursor += 2) {
|
|
989
|
+
const pub = this[cursor];
|
|
990
|
+
pub?.down();
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
else {
|
|
994
|
+
this.cursor = this.pub_from;
|
|
995
|
+
this.forget();
|
|
996
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
997
|
+
}
|
|
998
|
+
return next;
|
|
999
|
+
}
|
|
1000
|
+
recall(...args) {
|
|
1001
|
+
return this.put(this.task.call(this.host, ...args));
|
|
1002
|
+
}
|
|
1003
|
+
sync() {
|
|
1004
|
+
if (!$mol_wire_fiber.warm) {
|
|
1005
|
+
return this.result;
|
|
1006
|
+
}
|
|
1007
|
+
this.track_promote();
|
|
1008
|
+
this.up();
|
|
1009
|
+
if (this.cache instanceof Error) {
|
|
1010
|
+
return $mol_fail_hidden(this.cache);
|
|
1011
|
+
}
|
|
1012
|
+
if (this.cache instanceof Promise) {
|
|
1013
|
+
return $mol_fail_hidden(this.cache);
|
|
1014
|
+
}
|
|
1015
|
+
return this.cache;
|
|
1016
|
+
}
|
|
1017
|
+
async async() {
|
|
1018
|
+
while (true) {
|
|
1019
|
+
this.up();
|
|
1020
|
+
if (this.cache instanceof Error) {
|
|
1021
|
+
$mol_fail_hidden(this.cache);
|
|
1022
|
+
}
|
|
1023
|
+
if (!(this.cache instanceof Promise))
|
|
1024
|
+
return this.cache;
|
|
1025
|
+
await this.cache;
|
|
1026
|
+
if (this.cursor === $mol_wire_cursor.final) {
|
|
1027
|
+
await new Promise(() => { });
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
__decorate([
|
|
1033
|
+
$mol_wire_method
|
|
1034
|
+
], $mol_wire_fiber.prototype, "recall", null);
|
|
1035
|
+
$.$mol_wire_fiber = $mol_wire_fiber;
|
|
1036
|
+
})($ || ($ = {}));
|
|
1034
1037
|
//mol/wire/fiber/fiber.ts
|
|
1035
1038
|
;
|
|
1036
|
-
"use strict";
|
|
1037
|
-
var $;
|
|
1038
|
-
(function ($) {
|
|
1039
|
-
function $mol_wire_probe(task, next) {
|
|
1040
|
-
const warm = $mol_wire_fiber.warm;
|
|
1041
|
-
try {
|
|
1042
|
-
$mol_wire_fiber.warm = false;
|
|
1043
|
-
return task();
|
|
1044
|
-
}
|
|
1045
|
-
finally {
|
|
1046
|
-
$mol_wire_fiber.warm = warm;
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
$.$mol_wire_probe = $mol_wire_probe;
|
|
1050
|
-
})($ || ($ = {}));
|
|
1039
|
+
"use strict";
|
|
1040
|
+
var $;
|
|
1041
|
+
(function ($) {
|
|
1042
|
+
function $mol_wire_probe(task, next) {
|
|
1043
|
+
const warm = $mol_wire_fiber.warm;
|
|
1044
|
+
try {
|
|
1045
|
+
$mol_wire_fiber.warm = false;
|
|
1046
|
+
return task();
|
|
1047
|
+
}
|
|
1048
|
+
finally {
|
|
1049
|
+
$mol_wire_fiber.warm = warm;
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
$.$mol_wire_probe = $mol_wire_probe;
|
|
1053
|
+
})($ || ($ = {}));
|
|
1051
1054
|
//mol/wire/probe/probe.ts
|
|
1052
1055
|
;
|
|
1053
|
-
"use strict";
|
|
1054
|
-
var $;
|
|
1055
|
-
(function ($) {
|
|
1056
|
-
function $mol_wire_solid() {
|
|
1057
|
-
$mol_wire_auto.reap = nothing;
|
|
1058
|
-
}
|
|
1059
|
-
$.$mol_wire_solid = $mol_wire_solid;
|
|
1060
|
-
const nothing = () => { };
|
|
1061
|
-
})($ || ($ = {}));
|
|
1056
|
+
"use strict";
|
|
1057
|
+
var $;
|
|
1058
|
+
(function ($) {
|
|
1059
|
+
function $mol_wire_solid() {
|
|
1060
|
+
$mol_wire_auto.reap = nothing;
|
|
1061
|
+
}
|
|
1062
|
+
$.$mol_wire_solid = $mol_wire_solid;
|
|
1063
|
+
const nothing = () => { };
|
|
1064
|
+
})($ || ($ = {}));
|
|
1062
1065
|
//mol/wire/solid/solid.ts
|
|
1063
1066
|
;
|
|
1064
|
-
"use strict";
|
|
1065
|
-
var $;
|
|
1066
|
-
(function ($) {
|
|
1067
|
-
function $mol_wire_sync(obj) {
|
|
1068
|
-
return new Proxy(obj, {
|
|
1069
|
-
get(obj, field) {
|
|
1070
|
-
const val = obj[field];
|
|
1071
|
-
if (typeof val !== 'function')
|
|
1072
|
-
return val;
|
|
1073
|
-
return function $mol_wire_sync(...args) {
|
|
1074
|
-
const fiber = $mol_wire_fiber.temp(obj, val, ...args);
|
|
1075
|
-
return fiber.sync();
|
|
1076
|
-
};
|
|
1077
|
-
}
|
|
1078
|
-
});
|
|
1079
|
-
}
|
|
1080
|
-
$.$mol_wire_sync = $mol_wire_sync;
|
|
1081
|
-
})($ || ($ = {}));
|
|
1067
|
+
"use strict";
|
|
1068
|
+
var $;
|
|
1069
|
+
(function ($) {
|
|
1070
|
+
function $mol_wire_sync(obj) {
|
|
1071
|
+
return new Proxy(obj, {
|
|
1072
|
+
get(obj, field) {
|
|
1073
|
+
const val = obj[field];
|
|
1074
|
+
if (typeof val !== 'function')
|
|
1075
|
+
return val;
|
|
1076
|
+
return function $mol_wire_sync(...args) {
|
|
1077
|
+
const fiber = $mol_wire_fiber.temp(obj, val, ...args);
|
|
1078
|
+
return fiber.sync();
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
$.$mol_wire_sync = $mol_wire_sync;
|
|
1084
|
+
})($ || ($ = {}));
|
|
1082
1085
|
//mol/wire/sync/sync.ts
|
|
1083
1086
|
;
|
|
1084
|
-
"use strict";
|
|
1085
|
-
var $;
|
|
1086
|
-
(function ($) {
|
|
1087
|
-
function $mol_wire_async(obj) {
|
|
1088
|
-
return new Proxy(obj, {
|
|
1089
|
-
get(obj, field) {
|
|
1090
|
-
const val = obj[field];
|
|
1091
|
-
if (typeof val !== 'function')
|
|
1092
|
-
return val;
|
|
1093
|
-
let fiber;
|
|
1094
|
-
return function $mol_wire_async(...args) {
|
|
1095
|
-
fiber?.destructor();
|
|
1096
|
-
fiber = $mol_wire_fiber.temp(obj, val, ...args);
|
|
1097
|
-
return fiber.async();
|
|
1098
|
-
};
|
|
1099
|
-
}
|
|
1100
|
-
});
|
|
1101
|
-
}
|
|
1102
|
-
$.$mol_wire_async = $mol_wire_async;
|
|
1103
|
-
})($ || ($ = {}));
|
|
1087
|
+
"use strict";
|
|
1088
|
+
var $;
|
|
1089
|
+
(function ($) {
|
|
1090
|
+
function $mol_wire_async(obj) {
|
|
1091
|
+
return new Proxy(obj, {
|
|
1092
|
+
get(obj, field) {
|
|
1093
|
+
const val = obj[field];
|
|
1094
|
+
if (typeof val !== 'function')
|
|
1095
|
+
return val;
|
|
1096
|
+
let fiber;
|
|
1097
|
+
return function $mol_wire_async(...args) {
|
|
1098
|
+
fiber?.destructor();
|
|
1099
|
+
fiber = $mol_wire_fiber.temp(obj, val, ...args);
|
|
1100
|
+
return fiber.async();
|
|
1101
|
+
};
|
|
1102
|
+
}
|
|
1103
|
+
});
|
|
1104
|
+
}
|
|
1105
|
+
$.$mol_wire_async = $mol_wire_async;
|
|
1106
|
+
})($ || ($ = {}));
|
|
1104
1107
|
//mol/wire/async/async.ts
|
|
1105
1108
|
;
|
|
1106
|
-
"use strict";
|
|
1107
|
-
var $;
|
|
1108
|
-
(function ($) {
|
|
1109
|
-
const cacthed = new WeakMap();
|
|
1110
|
-
function $mol_fail_catch(error) {
|
|
1111
|
-
if (typeof error !== 'object')
|
|
1112
|
-
return false;
|
|
1113
|
-
if (cacthed.get(error))
|
|
1114
|
-
return false;
|
|
1115
|
-
cacthed.set(error, true);
|
|
1116
|
-
return true;
|
|
1117
|
-
}
|
|
1118
|
-
$.$mol_fail_catch = $mol_fail_catch;
|
|
1119
|
-
})($ || ($ = {}));
|
|
1109
|
+
"use strict";
|
|
1110
|
+
var $;
|
|
1111
|
+
(function ($) {
|
|
1112
|
+
const cacthed = new WeakMap();
|
|
1113
|
+
function $mol_fail_catch(error) {
|
|
1114
|
+
if (typeof error !== 'object')
|
|
1115
|
+
return false;
|
|
1116
|
+
if (cacthed.get(error))
|
|
1117
|
+
return false;
|
|
1118
|
+
cacthed.set(error, true);
|
|
1119
|
+
return true;
|
|
1120
|
+
}
|
|
1121
|
+
$.$mol_fail_catch = $mol_fail_catch;
|
|
1122
|
+
})($ || ($ = {}));
|
|
1120
1123
|
//mol/fail/catch/catch.ts
|
|
1121
1124
|
;
|
|
1122
|
-
"use strict";
|
|
1123
|
-
var $;
|
|
1124
|
-
(function ($) {
|
|
1125
|
-
function $mol_fail_log(error) {
|
|
1126
|
-
if (error instanceof Promise)
|
|
1127
|
-
return false;
|
|
1128
|
-
if (!$mol_fail_catch(error))
|
|
1129
|
-
return false;
|
|
1130
|
-
console.error(error);
|
|
1131
|
-
return true;
|
|
1132
|
-
}
|
|
1133
|
-
$.$mol_fail_log = $mol_fail_log;
|
|
1134
|
-
})($ || ($ = {}));
|
|
1125
|
+
"use strict";
|
|
1126
|
+
var $;
|
|
1127
|
+
(function ($) {
|
|
1128
|
+
function $mol_fail_log(error) {
|
|
1129
|
+
if (error instanceof Promise)
|
|
1130
|
+
return false;
|
|
1131
|
+
if (!$mol_fail_catch(error))
|
|
1132
|
+
return false;
|
|
1133
|
+
console.error(error);
|
|
1134
|
+
return true;
|
|
1135
|
+
}
|
|
1136
|
+
$.$mol_fail_log = $mol_fail_log;
|
|
1137
|
+
})($ || ($ = {}));
|
|
1135
1138
|
//mol/fail/log/log.ts
|
|
1136
1139
|
;
|
|
1137
|
-
"use strict";
|
|
1138
|
-
var $;
|
|
1139
|
-
(function ($) {
|
|
1140
|
-
$.$mol_wire_mem = (keys) => (host, field, descr) => {
|
|
1141
|
-
if (!descr)
|
|
1142
|
-
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
1143
|
-
const orig = descr?.value ?? host[field];
|
|
1144
|
-
const sup = Reflect.getPrototypeOf(host);
|
|
1145
|
-
if (typeof sup[field] === 'function') {
|
|
1146
|
-
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
1147
|
-
}
|
|
1148
|
-
function value(...args) {
|
|
1149
|
-
let atom = $mol_wire_fiber.persist(this, orig, ...args.slice(0, keys));
|
|
1150
|
-
if (args[keys] === undefined)
|
|
1151
|
-
return atom.sync();
|
|
1152
|
-
try {
|
|
1153
|
-
atom.sync();
|
|
1154
|
-
}
|
|
1155
|
-
catch (error) {
|
|
1156
|
-
$mol_fail_log(error);
|
|
1157
|
-
}
|
|
1158
|
-
return atom.recall(...args);
|
|
1159
|
-
}
|
|
1160
|
-
Object.defineProperty(value, 'name', { value: orig.name + ' ' });
|
|
1161
|
-
Object.assign(value, { orig });
|
|
1162
|
-
const descr2 = { ...descr, value };
|
|
1163
|
-
Reflect.defineProperty(host, field, descr2);
|
|
1164
|
-
return descr2;
|
|
1165
|
-
};
|
|
1166
|
-
})($ || ($ = {}));
|
|
1140
|
+
"use strict";
|
|
1141
|
+
var $;
|
|
1142
|
+
(function ($) {
|
|
1143
|
+
$.$mol_wire_mem = (keys) => (host, field, descr) => {
|
|
1144
|
+
if (!descr)
|
|
1145
|
+
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
1146
|
+
const orig = descr?.value ?? host[field];
|
|
1147
|
+
const sup = Reflect.getPrototypeOf(host);
|
|
1148
|
+
if (typeof sup[field] === 'function') {
|
|
1149
|
+
Object.defineProperty(orig, 'name', { value: sup[field].name });
|
|
1150
|
+
}
|
|
1151
|
+
function value(...args) {
|
|
1152
|
+
let atom = $mol_wire_fiber.persist(this, orig, ...args.slice(0, keys));
|
|
1153
|
+
if (args[keys] === undefined)
|
|
1154
|
+
return atom.sync();
|
|
1155
|
+
try {
|
|
1156
|
+
atom.sync();
|
|
1157
|
+
}
|
|
1158
|
+
catch (error) {
|
|
1159
|
+
$mol_fail_log(error);
|
|
1160
|
+
}
|
|
1161
|
+
return atom.recall(...args);
|
|
1162
|
+
}
|
|
1163
|
+
Object.defineProperty(value, 'name', { value: orig.name + ' ' });
|
|
1164
|
+
Object.assign(value, { orig });
|
|
1165
|
+
const descr2 = { ...descr, value };
|
|
1166
|
+
Reflect.defineProperty(host, field, descr2);
|
|
1167
|
+
return descr2;
|
|
1168
|
+
};
|
|
1169
|
+
})($ || ($ = {}));
|
|
1167
1170
|
//mol/wire/mem/mem.ts
|
|
1168
1171
|
;
|
|
1169
|
-
"use strict";
|
|
1170
|
-
var $;
|
|
1171
|
-
(function ($) {
|
|
1172
|
-
function $mol_const(value) {
|
|
1173
|
-
var getter = (() => value);
|
|
1174
|
-
getter['()'] = value;
|
|
1175
|
-
getter[Symbol.toStringTag] = value;
|
|
1176
|
-
return getter;
|
|
1177
|
-
}
|
|
1178
|
-
$.$mol_const = $mol_const;
|
|
1179
|
-
})($ || ($ = {}));
|
|
1172
|
+
"use strict";
|
|
1173
|
+
var $;
|
|
1174
|
+
(function ($) {
|
|
1175
|
+
function $mol_const(value) {
|
|
1176
|
+
var getter = (() => value);
|
|
1177
|
+
getter['()'] = value;
|
|
1178
|
+
getter[Symbol.toStringTag] = value;
|
|
1179
|
+
return getter;
|
|
1180
|
+
}
|
|
1181
|
+
$.$mol_const = $mol_const;
|
|
1182
|
+
})($ || ($ = {}));
|
|
1180
1183
|
//mol/const/const.ts
|
|
1181
1184
|
;
|
|
1182
|
-
"use strict";
|
|
1183
|
-
var $;
|
|
1184
|
-
(function ($) {
|
|
1185
|
-
function $mol_wire_field(host, field, descr) {
|
|
1186
|
-
if (!descr)
|
|
1187
|
-
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
1188
|
-
const _get = descr?.get || $mol_const(descr?.value);
|
|
1189
|
-
const _set = descr?.set || function (next) {
|
|
1190
|
-
$mol_wire_fiber.persist(this, _get).put(next);
|
|
1191
|
-
};
|
|
1192
|
-
const sup = Reflect.getPrototypeOf(host);
|
|
1193
|
-
const sup_descr = Reflect.getOwnPropertyDescriptor(sup, field);
|
|
1194
|
-
Object.defineProperty(_get, 'name', { value: sup_descr?.get?.name ?? field });
|
|
1195
|
-
Object.defineProperty(_set, 'name', { value: sup_descr?.set?.name ?? field });
|
|
1196
|
-
function get() {
|
|
1197
|
-
return $mol_wire_fiber.persist(this, _get).sync();
|
|
1198
|
-
}
|
|
1199
|
-
function set(next) {
|
|
1200
|
-
$mol_wire_fiber.temp(this, _set, next).sync();
|
|
1201
|
-
}
|
|
1202
|
-
Object.defineProperty(get, 'name', { value: _get.name + '$' });
|
|
1203
|
-
Object.defineProperty(set, 'name', { value: _set.name + '@' });
|
|
1204
|
-
Object.assign(get, { orig: _get });
|
|
1205
|
-
Object.assign(set, { orig: _set });
|
|
1206
|
-
const { value, writable, ...descr2 } = { ...descr, get, set };
|
|
1207
|
-
Reflect.defineProperty(host, field, descr2);
|
|
1208
|
-
return descr2;
|
|
1209
|
-
}
|
|
1210
|
-
$.$mol_wire_field = $mol_wire_field;
|
|
1211
|
-
})($ || ($ = {}));
|
|
1185
|
+
"use strict";
|
|
1186
|
+
var $;
|
|
1187
|
+
(function ($) {
|
|
1188
|
+
function $mol_wire_field(host, field, descr) {
|
|
1189
|
+
if (!descr)
|
|
1190
|
+
descr = Reflect.getOwnPropertyDescriptor(host, field);
|
|
1191
|
+
const _get = descr?.get || $mol_const(descr?.value);
|
|
1192
|
+
const _set = descr?.set || function (next) {
|
|
1193
|
+
$mol_wire_fiber.persist(this, _get).put(next);
|
|
1194
|
+
};
|
|
1195
|
+
const sup = Reflect.getPrototypeOf(host);
|
|
1196
|
+
const sup_descr = Reflect.getOwnPropertyDescriptor(sup, field);
|
|
1197
|
+
Object.defineProperty(_get, 'name', { value: sup_descr?.get?.name ?? field });
|
|
1198
|
+
Object.defineProperty(_set, 'name', { value: sup_descr?.set?.name ?? field });
|
|
1199
|
+
function get() {
|
|
1200
|
+
return $mol_wire_fiber.persist(this, _get).sync();
|
|
1201
|
+
}
|
|
1202
|
+
function set(next) {
|
|
1203
|
+
$mol_wire_fiber.temp(this, _set, next).sync();
|
|
1204
|
+
}
|
|
1205
|
+
Object.defineProperty(get, 'name', { value: _get.name + '$' });
|
|
1206
|
+
Object.defineProperty(set, 'name', { value: _set.name + '@' });
|
|
1207
|
+
Object.assign(get, { orig: _get });
|
|
1208
|
+
Object.assign(set, { orig: _set });
|
|
1209
|
+
const { value, writable, ...descr2 } = { ...descr, get, set };
|
|
1210
|
+
Reflect.defineProperty(host, field, descr2);
|
|
1211
|
+
return descr2;
|
|
1212
|
+
}
|
|
1213
|
+
$.$mol_wire_field = $mol_wire_field;
|
|
1214
|
+
})($ || ($ = {}));
|
|
1212
1215
|
//mol/wire/field/field.ts
|
|
1213
1216
|
|
|
1214
1217
|
//# sourceMappingURL=node.js.map
|