mol_wire_lib 0.0.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node.deps.json +1 -1
- package/node.esm.js +1130 -1130
- package/node.js +1130 -1130
- package/node.test.js +3165 -3165
- package/package.json +2 -2
- package/web.deps.json +1 -1
- package/web.esm.js +1136 -1136
- package/web.js +1136 -1136
- package/web.test.js +1570 -1570
- package/.nojekyll +0 -0
package/node.esm.js
CHANGED
|
@@ -18,1197 +18,1197 @@ $.$$ = $
|
|
|
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 >= quant)
|
|
348
|
-
return false;
|
|
349
|
-
this.cursor = quant;
|
|
350
|
-
return super.affect(quant);
|
|
351
|
-
}
|
|
352
|
-
[$mol_dev_format_head]() {
|
|
353
|
-
return $mol_dev_format_native(this);
|
|
354
|
-
}
|
|
355
|
-
get derived() {
|
|
356
|
-
return this.sub_from === this.pub_from;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
$.$mol_wire_pub_sub = $mol_wire_pub_sub;
|
|
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 >= quant)
|
|
348
|
+
return false;
|
|
349
|
+
this.cursor = quant;
|
|
350
|
+
return super.affect(quant);
|
|
351
|
+
}
|
|
352
|
+
[$mol_dev_format_head]() {
|
|
353
|
+
return $mol_dev_format_native(this);
|
|
354
|
+
}
|
|
355
|
+
get derived() {
|
|
356
|
+
return this.sub_from === this.pub_from;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
$.$mol_wire_pub_sub = $mol_wire_pub_sub;
|
|
360
|
+
})($ || ($ = {}));
|
|
361
361
|
//mol/wire/pub/sub/sub.ts
|
|
362
362
|
;
|
|
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
|
-
})($ || ($ = {}));
|
|
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
|
+
})($ || ($ = {}));
|
|
484
484
|
//mol/compare/deep/deep.ts
|
|
485
485
|
;
|
|
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
|
-
})($ || ($ = {}));
|
|
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
|
+
})($ || ($ = {}));
|
|
499
499
|
//mol/guid/guid.ts
|
|
500
500
|
;
|
|
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
|
-
})($ || ($ = {}));
|
|
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
|
+
})($ || ($ = {}));
|
|
536
536
|
//mol/key/key.ts
|
|
537
537
|
;
|
|
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
|
-
})($ || ($ = {}));
|
|
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
|
+
})($ || ($ = {}));
|
|
547
547
|
//mol/ambient/ambient.ts
|
|
548
548
|
;
|
|
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
|
-
})($ || ($ = {}));
|
|
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
|
+
})($ || ($ = {}));
|
|
584
584
|
//mol/delegate/delegate.ts
|
|
585
585
|
;
|
|
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
|
-
})($ || ($ = {}));
|
|
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
|
+
})($ || ($ = {}));
|
|
640
640
|
//mol/owning/owning.ts
|
|
641
641
|
;
|
|
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
|
-
})($ || ($ = {}));
|
|
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
|
+
})($ || ($ = {}));
|
|
650
650
|
//mol/fail/hidden/hidden.ts
|
|
651
651
|
;
|
|
652
|
-
"use strict";
|
|
652
|
+
"use strict";
|
|
653
653
|
//mol/type/writable/writable.ts
|
|
654
654
|
;
|
|
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
|
-
})($ || ($ = {}));
|
|
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
|
+
})($ || ($ = {}));
|
|
696
696
|
//mol/object2/object2.ts
|
|
697
697
|
;
|
|
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
|
-
})($ || ($ = {}));
|
|
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
|
+
})($ || ($ = {}));
|
|
717
717
|
//mol/after/timeout/timeout.ts
|
|
718
718
|
;
|
|
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
|
-
})($ || ($ = {}));
|
|
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
|
+
})($ || ($ = {}));
|
|
731
731
|
//mol/after/frame/frame.node.ts
|
|
732
732
|
;
|
|
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
|
-
})($ || ($ = {}));
|
|
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
|
+
})($ || ($ = {}));
|
|
756
756
|
//mol/wire/method/method.ts
|
|
757
757
|
;
|
|
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.cache = undefined;
|
|
876
|
-
if (this.persist) {
|
|
877
|
-
if (this.pub_from === 0) {
|
|
878
|
-
this.host[this.field()] = null;
|
|
879
|
-
}
|
|
880
|
-
else {
|
|
881
|
-
this.host[this.field()].delete(this[Symbol.toStringTag]);
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
plan() {
|
|
886
|
-
$mol_wire_fiber.planning.push(this);
|
|
887
|
-
$mol_wire_fiber.plan();
|
|
888
|
-
}
|
|
889
|
-
reap() {
|
|
890
|
-
$mol_wire_fiber.reaping.push(this);
|
|
891
|
-
$mol_wire_fiber.plan();
|
|
892
|
-
}
|
|
893
|
-
toString() {
|
|
894
|
-
return this[Symbol.toStringTag];
|
|
895
|
-
}
|
|
896
|
-
[$mol_dev_format_head]() {
|
|
897
|
-
const cursor = this.cursor >= 0
|
|
898
|
-
? '@' + this.cursor
|
|
899
|
-
: this.cursor?.constructor?.name;
|
|
900
|
-
return $mol_dev_format_div({}, $mol_dev_format_native(this), $mol_dev_format_shade(' ' + cursor + ' = '), $mol_dev_format_auto(this.cache));
|
|
901
|
-
}
|
|
902
|
-
get $() {
|
|
903
|
-
return this.host['$'];
|
|
904
|
-
}
|
|
905
|
-
affect(quant) {
|
|
906
|
-
if (!super.affect(quant))
|
|
907
|
-
return false;
|
|
908
|
-
if (this.sub_from === this.length) {
|
|
909
|
-
this.plan();
|
|
910
|
-
}
|
|
911
|
-
return true;
|
|
912
|
-
}
|
|
913
|
-
down() {
|
|
914
|
-
if (this.persist)
|
|
915
|
-
return;
|
|
916
|
-
this.destructor();
|
|
917
|
-
}
|
|
918
|
-
up() {
|
|
919
|
-
if (this.cursor === $mol_wire_cursor.fresh)
|
|
920
|
-
return;
|
|
921
|
-
check: if (this.cursor === $mol_wire_cursor.doubt) {
|
|
922
|
-
for (let i = this.pub_from; i < this.sub_from; i += 2) {
|
|
923
|
-
;
|
|
924
|
-
this[i]?.up();
|
|
925
|
-
if (this.cursor !== $mol_wire_cursor.doubt)
|
|
926
|
-
break check;
|
|
927
|
-
}
|
|
928
|
-
this.cursor = $mol_wire_cursor.fresh;
|
|
929
|
-
return;
|
|
930
|
-
}
|
|
931
|
-
const bu = this.track_on();
|
|
932
|
-
let result;
|
|
933
|
-
try {
|
|
934
|
-
result = this.task.call(this.host, ...this.args);
|
|
935
|
-
if (result instanceof Promise) {
|
|
936
|
-
const put = (res) => {
|
|
937
|
-
if (this.cache === result)
|
|
938
|
-
this.put(res);
|
|
939
|
-
return res;
|
|
940
|
-
};
|
|
941
|
-
result = Object.assign(result.then(put, put), {
|
|
942
|
-
destructor: result['destructor']
|
|
943
|
-
});
|
|
944
|
-
handled.add(result);
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
catch (error) {
|
|
948
|
-
result = error;
|
|
949
|
-
if (result instanceof Promise && !handled.has(result)) {
|
|
950
|
-
result = Object.assign(result.finally(() => {
|
|
951
|
-
if (this.cache === result)
|
|
952
|
-
this.stale();
|
|
953
|
-
}), {
|
|
954
|
-
destructor: result['destructor']
|
|
955
|
-
});
|
|
956
|
-
handled.add(result);
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
this.track_off(bu);
|
|
960
|
-
this.put(result);
|
|
961
|
-
}
|
|
962
|
-
put(next) {
|
|
963
|
-
const prev = this.cache;
|
|
964
|
-
if (next !== prev) {
|
|
965
|
-
if ($mol_owning_check(this, prev)) {
|
|
966
|
-
prev.destructor();
|
|
967
|
-
}
|
|
968
|
-
this.cache = next;
|
|
969
|
-
if (this.persist && $mol_owning_catch(this, next)) {
|
|
970
|
-
try {
|
|
971
|
-
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
972
|
-
}
|
|
973
|
-
catch { }
|
|
974
|
-
}
|
|
975
|
-
if (this.sub_from < this.length) {
|
|
976
|
-
if (!$mol_compare_deep(prev, next)) {
|
|
977
|
-
this.emit();
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
this.cursor = $mol_wire_cursor.fresh;
|
|
982
|
-
if (next instanceof Promise)
|
|
983
|
-
return next;
|
|
984
|
-
if (this.persist) {
|
|
985
|
-
for (let cursor = this.pub_from; cursor < this.sub_from; cursor += 2) {
|
|
986
|
-
const pub = this[cursor];
|
|
987
|
-
pub?.down();
|
|
988
|
-
}
|
|
989
|
-
}
|
|
990
|
-
else {
|
|
991
|
-
this.cursor = this.pub_from;
|
|
992
|
-
this.forget();
|
|
993
|
-
this.cursor = $mol_wire_cursor.fresh;
|
|
994
|
-
}
|
|
995
|
-
return next;
|
|
996
|
-
}
|
|
997
|
-
recall(...args) {
|
|
998
|
-
return this.put(this.task.call(this.host, ...args));
|
|
999
|
-
}
|
|
1000
|
-
sync() {
|
|
1001
|
-
if (!$mol_wire_fiber.warm) {
|
|
1002
|
-
return this.result;
|
|
1003
|
-
}
|
|
1004
|
-
this.track_promote();
|
|
1005
|
-
this.up();
|
|
1006
|
-
if (this.cache instanceof Error) {
|
|
1007
|
-
return $mol_fail_hidden(this.cache);
|
|
1008
|
-
}
|
|
1009
|
-
if (this.cache instanceof Promise) {
|
|
1010
|
-
return $mol_fail_hidden(this.cache);
|
|
1011
|
-
}
|
|
1012
|
-
return this.cache;
|
|
1013
|
-
}
|
|
1014
|
-
async async() {
|
|
1015
|
-
while (true) {
|
|
1016
|
-
this.up();
|
|
1017
|
-
if (this.cache instanceof Error) {
|
|
1018
|
-
$mol_fail_hidden(this.cache);
|
|
1019
|
-
}
|
|
1020
|
-
if (!(this.cache instanceof Promise))
|
|
1021
|
-
return this.cache;
|
|
1022
|
-
await this.cache;
|
|
1023
|
-
if (this.cursor === $mol_wire_cursor.final) {
|
|
1024
|
-
await new Promise(() => { });
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
__decorate([
|
|
1030
|
-
$mol_wire_method
|
|
1031
|
-
], $mol_wire_fiber.prototype, "recall", null);
|
|
1032
|
-
$.$mol_wire_fiber = $mol_wire_fiber;
|
|
1033
|
-
})($ || ($ = {}));
|
|
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.cache = undefined;
|
|
876
|
+
if (this.persist) {
|
|
877
|
+
if (this.pub_from === 0) {
|
|
878
|
+
this.host[this.field()] = null;
|
|
879
|
+
}
|
|
880
|
+
else {
|
|
881
|
+
this.host[this.field()].delete(this[Symbol.toStringTag]);
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
plan() {
|
|
886
|
+
$mol_wire_fiber.planning.push(this);
|
|
887
|
+
$mol_wire_fiber.plan();
|
|
888
|
+
}
|
|
889
|
+
reap() {
|
|
890
|
+
$mol_wire_fiber.reaping.push(this);
|
|
891
|
+
$mol_wire_fiber.plan();
|
|
892
|
+
}
|
|
893
|
+
toString() {
|
|
894
|
+
return this[Symbol.toStringTag];
|
|
895
|
+
}
|
|
896
|
+
[$mol_dev_format_head]() {
|
|
897
|
+
const cursor = this.cursor >= 0
|
|
898
|
+
? '@' + this.cursor
|
|
899
|
+
: this.cursor?.constructor?.name;
|
|
900
|
+
return $mol_dev_format_div({}, $mol_dev_format_native(this), $mol_dev_format_shade(' ' + cursor + ' = '), $mol_dev_format_auto(this.cache));
|
|
901
|
+
}
|
|
902
|
+
get $() {
|
|
903
|
+
return this.host['$'];
|
|
904
|
+
}
|
|
905
|
+
affect(quant) {
|
|
906
|
+
if (!super.affect(quant))
|
|
907
|
+
return false;
|
|
908
|
+
if (this.sub_from === this.length) {
|
|
909
|
+
this.plan();
|
|
910
|
+
}
|
|
911
|
+
return true;
|
|
912
|
+
}
|
|
913
|
+
down() {
|
|
914
|
+
if (this.persist)
|
|
915
|
+
return;
|
|
916
|
+
this.destructor();
|
|
917
|
+
}
|
|
918
|
+
up() {
|
|
919
|
+
if (this.cursor === $mol_wire_cursor.fresh)
|
|
920
|
+
return;
|
|
921
|
+
check: if (this.cursor === $mol_wire_cursor.doubt) {
|
|
922
|
+
for (let i = this.pub_from; i < this.sub_from; i += 2) {
|
|
923
|
+
;
|
|
924
|
+
this[i]?.up();
|
|
925
|
+
if (this.cursor !== $mol_wire_cursor.doubt)
|
|
926
|
+
break check;
|
|
927
|
+
}
|
|
928
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
929
|
+
return;
|
|
930
|
+
}
|
|
931
|
+
const bu = this.track_on();
|
|
932
|
+
let result;
|
|
933
|
+
try {
|
|
934
|
+
result = this.task.call(this.host, ...this.args);
|
|
935
|
+
if (result instanceof Promise) {
|
|
936
|
+
const put = (res) => {
|
|
937
|
+
if (this.cache === result)
|
|
938
|
+
this.put(res);
|
|
939
|
+
return res;
|
|
940
|
+
};
|
|
941
|
+
result = Object.assign(result.then(put, put), {
|
|
942
|
+
destructor: result['destructor']
|
|
943
|
+
});
|
|
944
|
+
handled.add(result);
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
catch (error) {
|
|
948
|
+
result = error;
|
|
949
|
+
if (result instanceof Promise && !handled.has(result)) {
|
|
950
|
+
result = Object.assign(result.finally(() => {
|
|
951
|
+
if (this.cache === result)
|
|
952
|
+
this.stale();
|
|
953
|
+
}), {
|
|
954
|
+
destructor: result['destructor']
|
|
955
|
+
});
|
|
956
|
+
handled.add(result);
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
this.track_off(bu);
|
|
960
|
+
this.put(result);
|
|
961
|
+
}
|
|
962
|
+
put(next) {
|
|
963
|
+
const prev = this.cache;
|
|
964
|
+
if (next !== prev) {
|
|
965
|
+
if ($mol_owning_check(this, prev)) {
|
|
966
|
+
prev.destructor();
|
|
967
|
+
}
|
|
968
|
+
this.cache = next;
|
|
969
|
+
if (this.persist && $mol_owning_catch(this, next)) {
|
|
970
|
+
try {
|
|
971
|
+
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
972
|
+
}
|
|
973
|
+
catch { }
|
|
974
|
+
}
|
|
975
|
+
if (this.sub_from < this.length) {
|
|
976
|
+
if (!$mol_compare_deep(prev, next)) {
|
|
977
|
+
this.emit();
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
982
|
+
if (next instanceof Promise)
|
|
983
|
+
return next;
|
|
984
|
+
if (this.persist) {
|
|
985
|
+
for (let cursor = this.pub_from; cursor < this.sub_from; cursor += 2) {
|
|
986
|
+
const pub = this[cursor];
|
|
987
|
+
pub?.down();
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
else {
|
|
991
|
+
this.cursor = this.pub_from;
|
|
992
|
+
this.forget();
|
|
993
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
994
|
+
}
|
|
995
|
+
return next;
|
|
996
|
+
}
|
|
997
|
+
recall(...args) {
|
|
998
|
+
return this.put(this.task.call(this.host, ...args));
|
|
999
|
+
}
|
|
1000
|
+
sync() {
|
|
1001
|
+
if (!$mol_wire_fiber.warm) {
|
|
1002
|
+
return this.result;
|
|
1003
|
+
}
|
|
1004
|
+
this.track_promote();
|
|
1005
|
+
this.up();
|
|
1006
|
+
if (this.cache instanceof Error) {
|
|
1007
|
+
return $mol_fail_hidden(this.cache);
|
|
1008
|
+
}
|
|
1009
|
+
if (this.cache instanceof Promise) {
|
|
1010
|
+
return $mol_fail_hidden(this.cache);
|
|
1011
|
+
}
|
|
1012
|
+
return this.cache;
|
|
1013
|
+
}
|
|
1014
|
+
async async() {
|
|
1015
|
+
while (true) {
|
|
1016
|
+
this.up();
|
|
1017
|
+
if (this.cache instanceof Error) {
|
|
1018
|
+
$mol_fail_hidden(this.cache);
|
|
1019
|
+
}
|
|
1020
|
+
if (!(this.cache instanceof Promise))
|
|
1021
|
+
return this.cache;
|
|
1022
|
+
await this.cache;
|
|
1023
|
+
if (this.cursor === $mol_wire_cursor.final) {
|
|
1024
|
+
await new Promise(() => { });
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
__decorate([
|
|
1030
|
+
$mol_wire_method
|
|
1031
|
+
], $mol_wire_fiber.prototype, "recall", null);
|
|
1032
|
+
$.$mol_wire_fiber = $mol_wire_fiber;
|
|
1033
|
+
})($ || ($ = {}));
|
|
1034
1034
|
//mol/wire/fiber/fiber.ts
|
|
1035
1035
|
;
|
|
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
|
-
})($ || ($ = {}));
|
|
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
|
+
})($ || ($ = {}));
|
|
1051
1051
|
//mol/wire/probe/probe.ts
|
|
1052
1052
|
;
|
|
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
|
-
})($ || ($ = {}));
|
|
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
|
+
})($ || ($ = {}));
|
|
1062
1062
|
//mol/wire/solid/solid.ts
|
|
1063
1063
|
;
|
|
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
|
-
})($ || ($ = {}));
|
|
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
|
+
})($ || ($ = {}));
|
|
1082
1082
|
//mol/wire/sync/sync.ts
|
|
1083
1083
|
;
|
|
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
|
-
})($ || ($ = {}));
|
|
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
|
+
})($ || ($ = {}));
|
|
1104
1104
|
//mol/wire/async/async.ts
|
|
1105
1105
|
;
|
|
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
|
-
})($ || ($ = {}));
|
|
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
|
+
})($ || ($ = {}));
|
|
1120
1120
|
//mol/fail/catch/catch.ts
|
|
1121
1121
|
;
|
|
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
|
-
})($ || ($ = {}));
|
|
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
|
+
})($ || ($ = {}));
|
|
1135
1135
|
//mol/fail/log/log.ts
|
|
1136
1136
|
;
|
|
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
|
-
})($ || ($ = {}));
|
|
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
|
+
})($ || ($ = {}));
|
|
1167
1167
|
//mol/wire/mem/mem.ts
|
|
1168
1168
|
;
|
|
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
|
-
})($ || ($ = {}));
|
|
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
|
+
})($ || ($ = {}));
|
|
1180
1180
|
//mol/const/const.ts
|
|
1181
1181
|
;
|
|
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
|
-
})($ || ($ = {}));
|
|
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
|
+
})($ || ($ = {}));
|
|
1212
1212
|
//mol/wire/field/field.ts
|
|
1213
1213
|
;
|
|
1214
1214
|
export default $
|