mol_time_all 1.1.12 → 1.1.13
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/README.md +45 -0
- package/node.d.ts +151 -136
- package/node.deps.json +1 -1
- package/node.esm.js +629 -600
- package/node.esm.js.map +1 -1
- package/node.js +629 -600
- package/node.js.map +1 -1
- package/node.test.js +2192 -4345
- package/node.test.js.map +1 -1
- package/package.json +2 -3
- package/web.d.ts +151 -136
- package/web.deps.json +1 -1
- package/web.esm.js +628 -597
- package/web.esm.js.map +1 -1
- package/web.js +628 -597
- package/web.js.map +1 -1
- package/web.test.js +877 -3278
- package/web.test.js.map +1 -1
package/web.test.js
CHANGED
|
@@ -1,3332 +1,931 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
function require( path ){ return $node[ path ] };
|
|
2
|
-
"use strict";
|
|
3
|
-
var $;
|
|
4
|
-
(function ($) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
})($ || ($ = {}));
|
|
11
|
-
//ambient.js.map
|
|
12
|
-
;
|
|
13
|
-
"use strict";
|
|
14
|
-
var $;
|
|
15
|
-
(function ($) {
|
|
16
|
-
function $mol_fail(error) {
|
|
17
|
-
throw error;
|
|
18
|
-
}
|
|
19
|
-
$.$mol_fail = $mol_fail;
|
|
20
|
-
})($ || ($ = {}));
|
|
21
|
-
//fail.js.map
|
|
22
|
-
;
|
|
23
|
-
"use strict";
|
|
24
|
-
var $;
|
|
25
|
-
(function ($) {
|
|
26
|
-
function $mol_fail_hidden(error) {
|
|
27
|
-
throw error;
|
|
28
|
-
}
|
|
29
|
-
$.$mol_fail_hidden = $mol_fail_hidden;
|
|
30
|
-
})($ || ($ = {}));
|
|
3
|
+
"use strict";
|
|
4
|
+
var $;
|
|
5
|
+
(function ($) {
|
|
6
|
+
function $mol_fail_hidden(error) {
|
|
7
|
+
throw error;
|
|
8
|
+
}
|
|
9
|
+
$.$mol_fail_hidden = $mol_fail_hidden;
|
|
10
|
+
})($ || ($ = {}));
|
|
31
11
|
//hidden.js.map
|
|
32
12
|
;
|
|
33
|
-
"use strict";
|
|
34
|
-
var $;
|
|
35
|
-
(function ($_1) {
|
|
36
|
-
function $mol_test(set) {
|
|
37
|
-
for (let name in set) {
|
|
38
|
-
const code = set[name];
|
|
39
|
-
const test = (typeof code === 'string') ? new Function('', code) : code;
|
|
40
|
-
$_1.$mol_test_all.push(test);
|
|
41
|
-
}
|
|
42
|
-
$mol_test_schedule();
|
|
43
|
-
}
|
|
44
|
-
$_1.$mol_test = $mol_test;
|
|
45
|
-
$_1.$mol_test_mocks = [];
|
|
46
|
-
$_1.$mol_test_all = [];
|
|
47
|
-
async function $mol_test_run() {
|
|
48
|
-
for (var test of $_1.$mol_test_all) {
|
|
49
|
-
let context = Object.create($_1.$$);
|
|
50
|
-
for (let mock of $_1.$mol_test_mocks)
|
|
51
|
-
await mock(context);
|
|
52
|
-
await test(context);
|
|
53
|
-
}
|
|
54
|
-
$_1
|
|
55
|
-
place: '$mol_test',
|
|
56
|
-
message: '
|
|
57
|
-
count: $_1.$mol_test_all.length,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
$_1.$mol_test_run = $mol_test_run;
|
|
61
|
-
let scheduled = false;
|
|
62
|
-
function $mol_test_schedule() {
|
|
63
|
-
if (scheduled)
|
|
64
|
-
return;
|
|
65
|
-
scheduled = true;
|
|
66
|
-
setTimeout(() => {
|
|
67
|
-
scheduled = false;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
console.assert(
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
13
|
+
"use strict";
|
|
14
|
+
var $;
|
|
15
|
+
(function ($_1) {
|
|
16
|
+
function $mol_test(set) {
|
|
17
|
+
for (let name in set) {
|
|
18
|
+
const code = set[name];
|
|
19
|
+
const test = (typeof code === 'string') ? new Function('', code) : code;
|
|
20
|
+
$_1.$mol_test_all.push(test);
|
|
21
|
+
}
|
|
22
|
+
$mol_test_schedule();
|
|
23
|
+
}
|
|
24
|
+
$_1.$mol_test = $mol_test;
|
|
25
|
+
$_1.$mol_test_mocks = [];
|
|
26
|
+
$_1.$mol_test_all = [];
|
|
27
|
+
async function $mol_test_run() {
|
|
28
|
+
for (var test of $_1.$mol_test_all) {
|
|
29
|
+
let context = Object.create($_1.$$);
|
|
30
|
+
for (let mock of $_1.$mol_test_mocks)
|
|
31
|
+
await mock(context);
|
|
32
|
+
await test(context);
|
|
33
|
+
}
|
|
34
|
+
$_1.$$.$mol_log3_done({
|
|
35
|
+
place: '$mol_test',
|
|
36
|
+
message: 'All tests passed',
|
|
37
|
+
count: $_1.$mol_test_all.length,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
$_1.$mol_test_run = $mol_test_run;
|
|
41
|
+
let scheduled = false;
|
|
42
|
+
function $mol_test_schedule() {
|
|
43
|
+
if (scheduled)
|
|
44
|
+
return;
|
|
45
|
+
scheduled = true;
|
|
46
|
+
setTimeout(async () => {
|
|
47
|
+
scheduled = false;
|
|
48
|
+
try {
|
|
49
|
+
await $mol_test_run();
|
|
50
|
+
}
|
|
51
|
+
finally {
|
|
52
|
+
$_1.$$.$mol_test_complete();
|
|
53
|
+
}
|
|
54
|
+
}, 0);
|
|
55
|
+
}
|
|
56
|
+
$_1.$mol_test_schedule = $mol_test_schedule;
|
|
57
|
+
$_1.$mol_test_mocks.push(context => {
|
|
58
|
+
let seed = 0;
|
|
59
|
+
context.Math = Object.create(Math);
|
|
60
|
+
context.Math.random = () => Math.sin(seed++);
|
|
61
|
+
const forbidden = ['XMLHttpRequest', 'fetch'];
|
|
62
|
+
for (let api of forbidden) {
|
|
63
|
+
context[api] = new Proxy(function () { }, {
|
|
64
|
+
get() {
|
|
65
|
+
$_1.$mol_fail_hidden(new Error(`${api} is forbidden in tests`));
|
|
66
|
+
},
|
|
67
|
+
apply() {
|
|
68
|
+
$_1.$mol_fail_hidden(new Error(`${api} is forbidden in tests`));
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
$mol_test({
|
|
74
|
+
'mocked Math.random'($) {
|
|
75
|
+
console.assert($.Math.random() === 0);
|
|
76
|
+
console.assert($.Math.random() === Math.sin(1));
|
|
77
|
+
},
|
|
78
|
+
'forbidden XMLHttpRequest'($) {
|
|
79
|
+
try {
|
|
80
|
+
console.assert(void new $.XMLHttpRequest);
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
console.assert(error.message === 'XMLHttpRequest is forbidden in tests');
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
'forbidden fetch'($) {
|
|
87
|
+
try {
|
|
88
|
+
console.assert(void $.fetch(''));
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
console.assert(error.message === 'fetch is forbidden in tests');
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
})($ || ($ = {}));
|
|
111
96
|
//test.test.js.map
|
|
112
97
|
;
|
|
113
|
-
"use strict";
|
|
114
|
-
var $;
|
|
115
|
-
(function ($) {
|
|
116
|
-
|
|
98
|
+
"use strict";
|
|
99
|
+
var $;
|
|
100
|
+
(function ($) {
|
|
101
|
+
function $mol_test_complete() {
|
|
102
|
+
}
|
|
103
|
+
$.$mol_test_complete = $mol_test_complete;
|
|
104
|
+
})($ || ($ = {}));
|
|
105
|
+
//test.web.test.js.map
|
|
106
|
+
;
|
|
107
|
+
"use strict";
|
|
108
|
+
var $;
|
|
109
|
+
(function ($) {
|
|
110
|
+
})($ || ($ = {}));
|
|
117
111
|
//context.js.map
|
|
118
112
|
;
|
|
119
|
-
"use strict";
|
|
120
|
-
var $;
|
|
121
|
-
(function ($) {
|
|
122
|
-
$.$mol_dom_context = self;
|
|
123
|
-
})($ || ($ = {}));
|
|
113
|
+
"use strict";
|
|
114
|
+
var $;
|
|
115
|
+
(function ($) {
|
|
116
|
+
$.$mol_dom_context = self;
|
|
117
|
+
})($ || ($ = {}));
|
|
124
118
|
//context.web.js.map
|
|
125
119
|
;
|
|
126
|
-
"use strict";
|
|
127
|
-
var $;
|
|
128
|
-
(function ($) {
|
|
129
|
-
function $mol_dom_render_children(el, childNodes) {
|
|
130
|
-
const node_set = new Set(childNodes);
|
|
131
|
-
let nextNode = el.firstChild;
|
|
132
|
-
for (let view of childNodes) {
|
|
133
|
-
if (view == null)
|
|
134
|
-
continue;
|
|
135
|
-
if (view instanceof $.$mol_dom_context.Node) {
|
|
136
|
-
while (true) {
|
|
137
|
-
if (!nextNode) {
|
|
138
|
-
el.appendChild(view);
|
|
139
|
-
break;
|
|
140
|
-
}
|
|
141
|
-
if (nextNode == view) {
|
|
142
|
-
nextNode = nextNode.nextSibling;
|
|
143
|
-
break;
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
if (node_set.has(nextNode)) {
|
|
147
|
-
el.insertBefore(view, nextNode);
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
const nn = nextNode.nextSibling;
|
|
152
|
-
el.removeChild(nextNode);
|
|
153
|
-
nextNode = nn;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
if (nextNode && nextNode.nodeName === '#text') {
|
|
160
|
-
const str = String(view);
|
|
161
|
-
if (nextNode.nodeValue !== str)
|
|
162
|
-
nextNode.nodeValue = str;
|
|
163
|
-
nextNode = nextNode.nextSibling;
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
const textNode = $.$mol_dom_context.document.createTextNode(String(view));
|
|
167
|
-
el.insertBefore(textNode, nextNode);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
while (nextNode) {
|
|
172
|
-
const currNode = nextNode;
|
|
173
|
-
nextNode = currNode.nextSibling;
|
|
174
|
-
el.removeChild(currNode);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
$.$mol_dom_render_children = $mol_dom_render_children;
|
|
178
|
-
})($ || ($ = {}));
|
|
120
|
+
"use strict";
|
|
121
|
+
var $;
|
|
122
|
+
(function ($) {
|
|
123
|
+
function $mol_dom_render_children(el, childNodes) {
|
|
124
|
+
const node_set = new Set(childNodes);
|
|
125
|
+
let nextNode = el.firstChild;
|
|
126
|
+
for (let view of childNodes) {
|
|
127
|
+
if (view == null)
|
|
128
|
+
continue;
|
|
129
|
+
if (view instanceof $.$mol_dom_context.Node) {
|
|
130
|
+
while (true) {
|
|
131
|
+
if (!nextNode) {
|
|
132
|
+
el.appendChild(view);
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
if (nextNode == view) {
|
|
136
|
+
nextNode = nextNode.nextSibling;
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
if (node_set.has(nextNode)) {
|
|
141
|
+
el.insertBefore(view, nextNode);
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
const nn = nextNode.nextSibling;
|
|
146
|
+
el.removeChild(nextNode);
|
|
147
|
+
nextNode = nn;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
if (nextNode && nextNode.nodeName === '#text') {
|
|
154
|
+
const str = String(view);
|
|
155
|
+
if (nextNode.nodeValue !== str)
|
|
156
|
+
nextNode.nodeValue = str;
|
|
157
|
+
nextNode = nextNode.nextSibling;
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
const textNode = $.$mol_dom_context.document.createTextNode(String(view));
|
|
161
|
+
el.insertBefore(textNode, nextNode);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
while (nextNode) {
|
|
166
|
+
const currNode = nextNode;
|
|
167
|
+
nextNode = currNode.nextSibling;
|
|
168
|
+
el.removeChild(currNode);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
$.$mol_dom_render_children = $mol_dom_render_children;
|
|
172
|
+
})($ || ($ = {}));
|
|
179
173
|
//children.js.map
|
|
180
174
|
;
|
|
181
|
-
"use strict";
|
|
175
|
+
"use strict";
|
|
176
|
+
//error.js.map
|
|
177
|
+
;
|
|
178
|
+
"use strict";
|
|
182
179
|
//assert.test.js.map
|
|
183
180
|
;
|
|
184
|
-
"use strict";
|
|
181
|
+
"use strict";
|
|
185
182
|
//assert.js.map
|
|
186
183
|
;
|
|
187
|
-
"use strict";
|
|
184
|
+
"use strict";
|
|
188
185
|
//deep.test.js.map
|
|
189
186
|
;
|
|
190
|
-
"use strict";
|
|
187
|
+
"use strict";
|
|
191
188
|
//deep.js.map
|
|
192
189
|
;
|
|
193
|
-
"use strict";
|
|
194
|
-
var $;
|
|
195
|
-
(function ($) {
|
|
196
|
-
$.$mol_test({
|
|
197
|
-
'Make empty div'() {
|
|
198
|
-
$.$mol_assert_equal(($.$mol_jsx("div", null)).outerHTML, '<div></div>');
|
|
199
|
-
},
|
|
200
|
-
'Define native field'() {
|
|
201
|
-
const dom = $.$mol_jsx("input", { value: '123' });
|
|
202
|
-
$.$mol_assert_equal(dom.outerHTML, '<input value="123">');
|
|
203
|
-
$.$mol_assert_equal(dom.value, '123');
|
|
204
|
-
},
|
|
205
|
-
'Define classes'() {
|
|
206
|
-
const dom = $.$mol_jsx("div", {
|
|
207
|
-
$.$mol_assert_equal(dom.outerHTML, '<div class="foo bar"></div>');
|
|
208
|
-
},
|
|
209
|
-
'Define styles'() {
|
|
210
|
-
const dom = $.$mol_jsx("div", { style: { color: 'red' } });
|
|
211
|
-
$.$mol_assert_equal(dom.outerHTML, '<div style="color: red;"></div>');
|
|
212
|
-
},
|
|
213
|
-
'Define dataset'() {
|
|
214
|
-
const dom = $.$mol_jsx("div", { dataset: { foo: 'bar' } });
|
|
215
|
-
$.$mol_assert_equal(dom.outerHTML, '<div data-foo="bar"></div>');
|
|
216
|
-
},
|
|
217
|
-
'Define attributes'() {
|
|
218
|
-
const dom = $.$mol_jsx("div", { lang: "ru", hidden: true });
|
|
219
|
-
$.$mol_assert_equal(dom.outerHTML, '<div lang="ru" hidden=""></div>');
|
|
220
|
-
},
|
|
221
|
-
'Define child nodes'() {
|
|
222
|
-
const dom = $.$mol_jsx("div", null,
|
|
223
|
-
"hello",
|
|
224
|
-
$.$mol_jsx("strong", null, "world"),
|
|
225
|
-
"!");
|
|
226
|
-
$.$mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
|
|
227
|
-
},
|
|
228
|
-
'Function as component'() {
|
|
229
|
-
const Button = ({ hint }, target) => {
|
|
230
|
-
return $.$mol_jsx("button", { title: hint }, target());
|
|
231
|
-
};
|
|
232
|
-
const dom = $.$mol_jsx(Button, { id: "/foo", hint: "click me" }, () => 'hey!');
|
|
233
|
-
$.$mol_assert_equal(dom.outerHTML, '<button title="click me" id="/foo">hey!</button>');
|
|
234
|
-
},
|
|
235
|
-
'Nested guid generation'() {
|
|
236
|
-
const Foo = () => {
|
|
237
|
-
return $.$mol_jsx("div", null,
|
|
238
|
-
$.$mol_jsx(Bar, { id: "/bar" },
|
|
239
|
-
$.$mol_jsx("img", { id: "/icon" })));
|
|
240
|
-
};
|
|
241
|
-
const Bar = (props, icon) => {
|
|
242
|
-
return $.$mol_jsx("span", null, icon);
|
|
243
|
-
};
|
|
244
|
-
const dom = $.$mol_jsx(Foo, { id: "/foo" });
|
|
245
|
-
$.$mol_assert_equal(dom.outerHTML, '<div id="/foo"><span id="/foo/bar"><img id="/foo/icon"></span></div>');
|
|
246
|
-
},
|
|
247
|
-
'Fail on non unique ids'() {
|
|
248
|
-
const App = () => {
|
|
249
|
-
return $.$mol_jsx("div", null,
|
|
250
|
-
$.$mol_jsx("span", { id: "/bar" }),
|
|
251
|
-
$.$mol_jsx("span", { id: "/bar" }));
|
|
252
|
-
};
|
|
253
|
-
$.$mol_assert_fail(() => $.$mol_jsx(App, { id: "/foo" }), 'JSX already has tag with id "/bar"');
|
|
254
|
-
},
|
|
255
|
-
});
|
|
256
|
-
})($ || ($ = {}));
|
|
190
|
+
"use strict";
|
|
191
|
+
var $;
|
|
192
|
+
(function ($) {
|
|
193
|
+
$.$mol_test({
|
|
194
|
+
'Make empty div'() {
|
|
195
|
+
$.$mol_assert_equal(($.$mol_jsx("div", null)).outerHTML, '<div></div>');
|
|
196
|
+
},
|
|
197
|
+
'Define native field'() {
|
|
198
|
+
const dom = $.$mol_jsx("input", { value: '123' });
|
|
199
|
+
$.$mol_assert_equal(dom.outerHTML, '<input value="123">');
|
|
200
|
+
$.$mol_assert_equal(dom.value, '123');
|
|
201
|
+
},
|
|
202
|
+
'Define classes'() {
|
|
203
|
+
const dom = $.$mol_jsx("div", { class: 'foo bar' });
|
|
204
|
+
$.$mol_assert_equal(dom.outerHTML, '<div class="foo bar"></div>');
|
|
205
|
+
},
|
|
206
|
+
'Define styles'() {
|
|
207
|
+
const dom = $.$mol_jsx("div", { style: { color: 'red' } });
|
|
208
|
+
$.$mol_assert_equal(dom.outerHTML, '<div style="color: red;"></div>');
|
|
209
|
+
},
|
|
210
|
+
'Define dataset'() {
|
|
211
|
+
const dom = $.$mol_jsx("div", { dataset: { foo: 'bar' } });
|
|
212
|
+
$.$mol_assert_equal(dom.outerHTML, '<div data-foo="bar"></div>');
|
|
213
|
+
},
|
|
214
|
+
'Define attributes'() {
|
|
215
|
+
const dom = $.$mol_jsx("div", { lang: "ru", hidden: true });
|
|
216
|
+
$.$mol_assert_equal(dom.outerHTML, '<div lang="ru" hidden=""></div>');
|
|
217
|
+
},
|
|
218
|
+
'Define child nodes'() {
|
|
219
|
+
const dom = $.$mol_jsx("div", null,
|
|
220
|
+
"hello",
|
|
221
|
+
$.$mol_jsx("strong", null, "world"),
|
|
222
|
+
"!");
|
|
223
|
+
$.$mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
|
|
224
|
+
},
|
|
225
|
+
'Function as component'() {
|
|
226
|
+
const Button = ({ hint }, target) => {
|
|
227
|
+
return $.$mol_jsx("button", { title: hint }, target());
|
|
228
|
+
};
|
|
229
|
+
const dom = $.$mol_jsx(Button, { id: "/foo", hint: "click me" }, () => 'hey!');
|
|
230
|
+
$.$mol_assert_equal(dom.outerHTML, '<button title="click me" id="/foo">hey!</button>');
|
|
231
|
+
},
|
|
232
|
+
'Nested guid generation'() {
|
|
233
|
+
const Foo = () => {
|
|
234
|
+
return $.$mol_jsx("div", null,
|
|
235
|
+
$.$mol_jsx(Bar, { id: "/bar" },
|
|
236
|
+
$.$mol_jsx("img", { id: "/icon" })));
|
|
237
|
+
};
|
|
238
|
+
const Bar = (props, icon) => {
|
|
239
|
+
return $.$mol_jsx("span", null, icon);
|
|
240
|
+
};
|
|
241
|
+
const dom = $.$mol_jsx(Foo, { id: "/foo" });
|
|
242
|
+
$.$mol_assert_equal(dom.outerHTML, '<div id="/foo"><span id="/foo/bar"><img id="/foo/icon"></span></div>');
|
|
243
|
+
},
|
|
244
|
+
'Fail on non unique ids'() {
|
|
245
|
+
const App = () => {
|
|
246
|
+
return $.$mol_jsx("div", null,
|
|
247
|
+
$.$mol_jsx("span", { id: "/bar" }),
|
|
248
|
+
$.$mol_jsx("span", { id: "/bar" }));
|
|
249
|
+
};
|
|
250
|
+
$.$mol_assert_fail(() => $.$mol_jsx(App, { id: "/foo" }), 'JSX already has tag with id "/bar"');
|
|
251
|
+
},
|
|
252
|
+
});
|
|
253
|
+
})($ || ($ = {}));
|
|
257
254
|
//jsx.test.js.map
|
|
258
255
|
;
|
|
259
|
-
"use strict";
|
|
260
|
-
var $;
|
|
261
|
-
(function ($) {
|
|
262
|
-
$.$mol_jsx_prefix = '';
|
|
263
|
-
$.$mol_jsx_booked = null;
|
|
264
|
-
$.$mol_jsx_document = {
|
|
265
|
-
getElementById: () => null,
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
view[
|
|
285
|
-
view
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
256
|
+
"use strict";
|
|
257
|
+
var $;
|
|
258
|
+
(function ($) {
|
|
259
|
+
$.$mol_jsx_prefix = '';
|
|
260
|
+
$.$mol_jsx_booked = null;
|
|
261
|
+
$.$mol_jsx_document = {
|
|
262
|
+
getElementById: () => null,
|
|
263
|
+
createElementNS: (space, name) => $.$mol_dom_context.document.createElementNS(space, name),
|
|
264
|
+
createDocumentFragment: () => $.$mol_dom_context.document.createDocumentFragment(),
|
|
265
|
+
};
|
|
266
|
+
$.$mol_jsx_frag = '';
|
|
267
|
+
function $mol_jsx(Elem, props, ...childNodes) {
|
|
268
|
+
const id = props && props.id || '';
|
|
269
|
+
if (Elem && $.$mol_jsx_booked) {
|
|
270
|
+
if ($.$mol_jsx_booked.has(id)) {
|
|
271
|
+
$.$mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(id)}`));
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
$.$mol_jsx_booked.add(id);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
const guid = $.$mol_jsx_prefix + id;
|
|
278
|
+
let node = guid ? $.$mol_jsx_document.getElementById(guid) : null;
|
|
279
|
+
if (typeof Elem !== 'string') {
|
|
280
|
+
if ('prototype' in Elem) {
|
|
281
|
+
const view = node && node[Elem] || new Elem;
|
|
282
|
+
Object.assign(view, props);
|
|
283
|
+
view[Symbol.toStringTag] = guid;
|
|
284
|
+
view.childNodes = childNodes;
|
|
285
|
+
if (!view.ownerDocument)
|
|
286
|
+
view.ownerDocument = $.$mol_jsx_document;
|
|
287
|
+
node = view.valueOf();
|
|
288
|
+
node[Elem] = view;
|
|
289
|
+
return node;
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
const prefix = $.$mol_jsx_prefix;
|
|
293
|
+
const booked = $.$mol_jsx_booked;
|
|
294
|
+
try {
|
|
295
|
+
$.$mol_jsx_prefix = guid;
|
|
296
|
+
$.$mol_jsx_booked = new Set;
|
|
297
|
+
return Elem(props, ...childNodes);
|
|
298
|
+
}
|
|
299
|
+
finally {
|
|
300
|
+
$.$mol_jsx_prefix = prefix;
|
|
301
|
+
$.$mol_jsx_booked = booked;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
if (!node) {
|
|
306
|
+
node = Elem
|
|
307
|
+
? $.$mol_jsx_document.createElementNS(props?.xmlns ?? 'http://www.w3.org/1999/xhtml', Elem)
|
|
308
|
+
: $.$mol_jsx_document.createDocumentFragment();
|
|
309
|
+
}
|
|
310
|
+
$.$mol_dom_render_children(node, [].concat(...childNodes));
|
|
311
|
+
if (!Elem)
|
|
312
|
+
return node;
|
|
313
|
+
for (const key in props) {
|
|
314
|
+
if (typeof props[key] === 'string') {
|
|
315
|
+
;
|
|
316
|
+
node.setAttribute(key, props[key]);
|
|
317
|
+
}
|
|
318
|
+
else if (props[key] &&
|
|
319
|
+
typeof props[key] === 'object' &&
|
|
320
|
+
Reflect.getPrototypeOf(props[key]) === Reflect.getPrototypeOf({})) {
|
|
321
|
+
if (typeof node[key] === 'object') {
|
|
322
|
+
Object.assign(node[key], props[key]);
|
|
323
|
+
continue;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
node[key] = props[key];
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
if (guid)
|
|
331
|
+
node.id = guid;
|
|
332
|
+
return node;
|
|
333
|
+
}
|
|
334
|
+
$.$mol_jsx = $mol_jsx;
|
|
335
|
+
})($ || ($ = {}));
|
|
327
336
|
//jsx.js.map
|
|
328
337
|
;
|
|
329
|
-
"use strict";
|
|
330
|
-
var $;
|
|
331
|
-
(function ($) {
|
|
332
|
-
$.$mol_test({
|
|
333
|
-
'nulls & undefineds'() {
|
|
334
|
-
$.$mol_assert_ok($.$mol_compare_deep(null, null));
|
|
335
|
-
$.$mol_assert_ok($.$mol_compare_deep(undefined, undefined));
|
|
336
|
-
$.$mol_assert_not($.$mol_compare_deep(undefined, null));
|
|
337
|
-
$.$mol_assert_not($.$mol_compare_deep({}, null));
|
|
338
|
-
},
|
|
339
|
-
'number'() {
|
|
340
|
-
$.$mol_assert_ok($.$mol_compare_deep(1, 1));
|
|
341
|
-
$.$mol_assert_ok($.$mol_compare_deep(Number.NaN, Number.NaN));
|
|
342
|
-
$.$mol_assert_not($.$mol_compare_deep(1, 2));
|
|
343
|
-
},
|
|
344
|
-
'Number'() {
|
|
345
|
-
$.$mol_assert_ok($.$mol_compare_deep(Object(1), Object(1)));
|
|
346
|
-
$.$mol_assert_ok($.$mol_compare_deep(Object(Number.NaN), Object(Number.NaN)));
|
|
347
|
-
$.$mol_assert_not($.$mol_compare_deep(Object(1), Object(2)));
|
|
348
|
-
},
|
|
349
|
-
'empty POJOs'() {
|
|
350
|
-
$.$mol_assert_ok($.$mol_compare_deep({}, {}));
|
|
351
|
-
},
|
|
352
|
-
'different POJOs'() {
|
|
353
|
-
$.$mol_assert_not($.$mol_compare_deep({ a: 1 }, { b: 2 }));
|
|
354
|
-
},
|
|
355
|
-
'different POJOs with same keys but different values'() {
|
|
356
|
-
$.$mol_assert_not($.$mol_compare_deep({ a: 1 }, { a: 2 }));
|
|
357
|
-
},
|
|
358
|
-
'different POJOs with different keys but same values'() {
|
|
359
|
-
$.$mol_assert_not($.$mol_compare_deep({}, { a: undefined }));
|
|
360
|
-
},
|
|
361
|
-
'Array'() {
|
|
362
|
-
$.$mol_assert_ok($.$mol_compare_deep([], []));
|
|
363
|
-
$.$mol_assert_ok($.$mol_compare_deep([1, [2]], [1, [2]]));
|
|
364
|
-
$.$mol_assert_not($.$mol_compare_deep([1, 2], [1, 3]));
|
|
365
|
-
$.$mol_assert_not($.$mol_compare_deep([1, 2,], [1, 3, undefined]));
|
|
366
|
-
},
|
|
367
|
-
'same POJO trees'() {
|
|
368
|
-
$.$mol_assert_ok($.$mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
|
|
369
|
-
},
|
|
370
|
-
'different classes with same values'() {
|
|
371
|
-
class Obj {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
const
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
$.$
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
$.$
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
"foo",
|
|
405
|
-
$.$mol_jsx("br", null))
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
"
|
|
410
|
-
$.$mol_jsx("br", null))
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
"foo",
|
|
415
|
-
$.$mol_jsx("
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
$.$
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
$.$
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
$.$
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
$.$
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
});
|
|
448
|
-
})($ || ($ = {}));
|
|
338
|
+
"use strict";
|
|
339
|
+
var $;
|
|
340
|
+
(function ($) {
|
|
341
|
+
$.$mol_test({
|
|
342
|
+
'nulls & undefineds'() {
|
|
343
|
+
$.$mol_assert_ok($.$mol_compare_deep(null, null));
|
|
344
|
+
$.$mol_assert_ok($.$mol_compare_deep(undefined, undefined));
|
|
345
|
+
$.$mol_assert_not($.$mol_compare_deep(undefined, null));
|
|
346
|
+
$.$mol_assert_not($.$mol_compare_deep({}, null));
|
|
347
|
+
},
|
|
348
|
+
'number'() {
|
|
349
|
+
$.$mol_assert_ok($.$mol_compare_deep(1, 1));
|
|
350
|
+
$.$mol_assert_ok($.$mol_compare_deep(Number.NaN, Number.NaN));
|
|
351
|
+
$.$mol_assert_not($.$mol_compare_deep(1, 2));
|
|
352
|
+
},
|
|
353
|
+
'Number'() {
|
|
354
|
+
$.$mol_assert_ok($.$mol_compare_deep(Object(1), Object(1)));
|
|
355
|
+
$.$mol_assert_ok($.$mol_compare_deep(Object(Number.NaN), Object(Number.NaN)));
|
|
356
|
+
$.$mol_assert_not($.$mol_compare_deep(Object(1), Object(2)));
|
|
357
|
+
},
|
|
358
|
+
'empty POJOs'() {
|
|
359
|
+
$.$mol_assert_ok($.$mol_compare_deep({}, {}));
|
|
360
|
+
},
|
|
361
|
+
'different POJOs'() {
|
|
362
|
+
$.$mol_assert_not($.$mol_compare_deep({ a: 1 }, { b: 2 }));
|
|
363
|
+
},
|
|
364
|
+
'different POJOs with same keys but different values'() {
|
|
365
|
+
$.$mol_assert_not($.$mol_compare_deep({ a: 1 }, { a: 2 }));
|
|
366
|
+
},
|
|
367
|
+
'different POJOs with different keys but same values'() {
|
|
368
|
+
$.$mol_assert_not($.$mol_compare_deep({}, { a: undefined }));
|
|
369
|
+
},
|
|
370
|
+
'Array'() {
|
|
371
|
+
$.$mol_assert_ok($.$mol_compare_deep([], []));
|
|
372
|
+
$.$mol_assert_ok($.$mol_compare_deep([1, [2]], [1, [2]]));
|
|
373
|
+
$.$mol_assert_not($.$mol_compare_deep([1, 2], [1, 3]));
|
|
374
|
+
$.$mol_assert_not($.$mol_compare_deep([1, 2,], [1, 3, undefined]));
|
|
375
|
+
},
|
|
376
|
+
'same POJO trees'() {
|
|
377
|
+
$.$mol_assert_ok($.$mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
|
|
378
|
+
},
|
|
379
|
+
'different classes with same values'() {
|
|
380
|
+
class Obj {
|
|
381
|
+
foo = 1;
|
|
382
|
+
}
|
|
383
|
+
const a = new Obj;
|
|
384
|
+
const b = new class extends Obj {
|
|
385
|
+
};
|
|
386
|
+
$.$mol_assert_not($.$mol_compare_deep(a, b));
|
|
387
|
+
},
|
|
388
|
+
'same POJOs with cyclic reference'() {
|
|
389
|
+
const a = { foo: {} };
|
|
390
|
+
a['self'] = a;
|
|
391
|
+
const b = { foo: {} };
|
|
392
|
+
b['self'] = b;
|
|
393
|
+
$.$mol_assert_ok($.$mol_compare_deep(a, b));
|
|
394
|
+
},
|
|
395
|
+
'empty Element'() {
|
|
396
|
+
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", null), $.$mol_jsx("div", null)));
|
|
397
|
+
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", null), $.$mol_jsx("span", null)));
|
|
398
|
+
},
|
|
399
|
+
'Element with attributes'() {
|
|
400
|
+
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", { dir: "rtl" }), $.$mol_jsx("div", { dir: "rtl" })));
|
|
401
|
+
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { dir: "rtl" }), $.$mol_jsx("div", null)));
|
|
402
|
+
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { dir: "rtl" }), $.$mol_jsx("div", { dir: "ltr" })));
|
|
403
|
+
},
|
|
404
|
+
'Element with styles'() {
|
|
405
|
+
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", { style: { color: 'red' } }), $.$mol_jsx("div", { style: { color: 'red' } })));
|
|
406
|
+
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { style: { color: 'red' } }), $.$mol_jsx("div", { style: {} })));
|
|
407
|
+
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { style: { color: 'red' } }), $.$mol_jsx("div", { style: { color: 'blue' } })));
|
|
408
|
+
},
|
|
409
|
+
'Element with content'() {
|
|
410
|
+
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", null,
|
|
411
|
+
"foo",
|
|
412
|
+
$.$mol_jsx("br", null)), $.$mol_jsx("div", null,
|
|
413
|
+
"foo",
|
|
414
|
+
$.$mol_jsx("br", null))));
|
|
415
|
+
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", null,
|
|
416
|
+
"foo",
|
|
417
|
+
$.$mol_jsx("br", null)), $.$mol_jsx("div", null,
|
|
418
|
+
"bar",
|
|
419
|
+
$.$mol_jsx("br", null))));
|
|
420
|
+
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", null,
|
|
421
|
+
"foo",
|
|
422
|
+
$.$mol_jsx("br", null)), $.$mol_jsx("div", null,
|
|
423
|
+
"foo",
|
|
424
|
+
$.$mol_jsx("hr", null))));
|
|
425
|
+
},
|
|
426
|
+
'Element with handlers'() {
|
|
427
|
+
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", { onclick: () => 1 }), $.$mol_jsx("div", { onclick: () => 1 })));
|
|
428
|
+
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { onclick: () => 1 }), $.$mol_jsx("div", { onclick: () => 2 })));
|
|
429
|
+
},
|
|
430
|
+
'Date'() {
|
|
431
|
+
$.$mol_assert_ok($.$mol_compare_deep(new Date(12345), new Date(12345)));
|
|
432
|
+
$.$mol_assert_not($.$mol_compare_deep(new Date(12345), new Date(12346)));
|
|
433
|
+
},
|
|
434
|
+
'RegExp'() {
|
|
435
|
+
$.$mol_assert_ok($.$mol_compare_deep(/\x22/mig, /\x22/mig));
|
|
436
|
+
$.$mol_assert_not($.$mol_compare_deep(/\x22/mig, /\x21/mig));
|
|
437
|
+
$.$mol_assert_not($.$mol_compare_deep(/\x22/mig, /\x22/mg));
|
|
438
|
+
},
|
|
439
|
+
'Map'() {
|
|
440
|
+
$.$mol_assert_ok($.$mol_compare_deep(new Map, new Map));
|
|
441
|
+
$.$mol_assert_ok($.$mol_compare_deep(new Map([[[1], [2]]]), new Map([[[1], [2]]])));
|
|
442
|
+
$.$mol_assert_not($.$mol_compare_deep(new Map([[1, 2]]), new Map([[1, 3]])));
|
|
443
|
+
},
|
|
444
|
+
'Set'() {
|
|
445
|
+
$.$mol_assert_ok($.$mol_compare_deep(new Set, new Set));
|
|
446
|
+
$.$mol_assert_ok($.$mol_compare_deep(new Set([1, [2]]), new Set([1, [2]])));
|
|
447
|
+
$.$mol_assert_not($.$mol_compare_deep(new Set([1]), new Set([2])));
|
|
448
|
+
},
|
|
449
|
+
'Uint8Array'() {
|
|
450
|
+
$.$mol_assert_ok($.$mol_compare_deep(new Uint8Array, new Uint8Array));
|
|
451
|
+
$.$mol_assert_ok($.$mol_compare_deep(new Uint8Array([0]), new Uint8Array([0])));
|
|
452
|
+
$.$mol_assert_not($.$mol_compare_deep(new Uint8Array([0]), new Uint8Array([1])));
|
|
453
|
+
},
|
|
454
|
+
});
|
|
455
|
+
})($ || ($ = {}));
|
|
449
456
|
//deep.test.js.map
|
|
450
457
|
;
|
|
451
|
-
"use strict";
|
|
452
|
-
var $;
|
|
453
|
-
(function ($) {
|
|
454
|
-
const a_stack = [];
|
|
455
|
-
const b_stack = [];
|
|
456
|
-
let cache = null;
|
|
457
|
-
function $mol_compare_deep(a, b) {
|
|
458
|
-
if (Object.is(a, b))
|
|
459
|
-
return true;
|
|
460
|
-
const a_type = typeof a;
|
|
461
|
-
const b_type = typeof b;
|
|
462
|
-
if (a_type !== b_type)
|
|
463
|
-
return false;
|
|
464
|
-
if (a_type === 'function')
|
|
465
|
-
return
|
|
466
|
-
if (a_type !== 'object')
|
|
467
|
-
return false;
|
|
468
|
-
if (!a || !b)
|
|
469
|
-
return false;
|
|
470
|
-
if (a instanceof Error)
|
|
471
|
-
return false;
|
|
472
|
-
if (a['constructor'] !== b['constructor'])
|
|
473
|
-
return false;
|
|
474
|
-
if (a instanceof RegExp)
|
|
475
|
-
return
|
|
476
|
-
const ref = a_stack.indexOf(a);
|
|
477
|
-
if (ref >= 0) {
|
|
478
|
-
return Object.is(b_stack[ref], b);
|
|
479
|
-
}
|
|
480
|
-
if (!cache)
|
|
481
|
-
cache = new WeakMap;
|
|
482
|
-
let a_cache = cache.get(a);
|
|
483
|
-
if (a_cache) {
|
|
484
|
-
const b_cache = a_cache.get(b);
|
|
485
|
-
if (typeof b_cache === 'boolean')
|
|
486
|
-
return b_cache;
|
|
487
|
-
}
|
|
488
|
-
else {
|
|
489
|
-
a_cache = new WeakMap();
|
|
490
|
-
cache.set(a, a_cache);
|
|
491
|
-
}
|
|
492
|
-
a_stack.push(a);
|
|
493
|
-
b_stack.push(b);
|
|
494
|
-
let result;
|
|
495
|
-
try {
|
|
496
|
-
if (
|
|
497
|
-
const a_iter = a[Symbol.iterator]();
|
|
498
|
-
const b_iter = b[Symbol.iterator]();
|
|
499
|
-
while (true) {
|
|
500
|
-
const a_next = a_iter.next();
|
|
501
|
-
const b_next = b_iter.next();
|
|
502
|
-
if (a_next.done !== b_next.done)
|
|
503
|
-
return result = false;
|
|
504
|
-
if (a_next.done)
|
|
505
|
-
break;
|
|
506
|
-
if (!$mol_compare_deep(a_next.value, b_next.value))
|
|
507
|
-
return result = false;
|
|
508
|
-
}
|
|
509
|
-
return result = true;
|
|
510
|
-
}
|
|
511
|
-
let count = 0;
|
|
512
|
-
for (let key in a) {
|
|
513
|
-
try {
|
|
514
|
-
if (!$mol_compare_deep(a[key], b[key]))
|
|
515
|
-
return result = false;
|
|
516
|
-
}
|
|
517
|
-
catch (error) {
|
|
518
|
-
$.$mol_fail_hidden(new $.$mol_error_mix(`Failed ${JSON.stringify(key)} fields comparison of ${a} and ${b}`, error));
|
|
519
|
-
}
|
|
520
|
-
++count;
|
|
521
|
-
}
|
|
522
|
-
for (let key in b) {
|
|
523
|
-
--count;
|
|
524
|
-
if (count < 0)
|
|
525
|
-
return result = false;
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
a_stack.
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
$.$mol_compare_deep = $mol_compare_deep;
|
|
547
|
-
})($ || ($ = {}));
|
|
458
|
+
"use strict";
|
|
459
|
+
var $;
|
|
460
|
+
(function ($) {
|
|
461
|
+
const a_stack = [];
|
|
462
|
+
const b_stack = [];
|
|
463
|
+
let cache = null;
|
|
464
|
+
function $mol_compare_deep(a, b) {
|
|
465
|
+
if (Object.is(a, b))
|
|
466
|
+
return true;
|
|
467
|
+
const a_type = typeof a;
|
|
468
|
+
const b_type = typeof b;
|
|
469
|
+
if (a_type !== b_type)
|
|
470
|
+
return false;
|
|
471
|
+
if (a_type === 'function')
|
|
472
|
+
return a['toString']() === b['toString']();
|
|
473
|
+
if (a_type !== 'object')
|
|
474
|
+
return false;
|
|
475
|
+
if (!a || !b)
|
|
476
|
+
return false;
|
|
477
|
+
if (a instanceof Error)
|
|
478
|
+
return false;
|
|
479
|
+
if (a['constructor'] !== b['constructor'])
|
|
480
|
+
return false;
|
|
481
|
+
if (a instanceof RegExp)
|
|
482
|
+
return a.toString() === b['toString']();
|
|
483
|
+
const ref = a_stack.indexOf(a);
|
|
484
|
+
if (ref >= 0) {
|
|
485
|
+
return Object.is(b_stack[ref], b);
|
|
486
|
+
}
|
|
487
|
+
if (!cache)
|
|
488
|
+
cache = new WeakMap;
|
|
489
|
+
let a_cache = cache.get(a);
|
|
490
|
+
if (a_cache) {
|
|
491
|
+
const b_cache = a_cache.get(b);
|
|
492
|
+
if (typeof b_cache === 'boolean')
|
|
493
|
+
return b_cache;
|
|
494
|
+
}
|
|
495
|
+
else {
|
|
496
|
+
a_cache = new WeakMap();
|
|
497
|
+
cache.set(a, a_cache);
|
|
498
|
+
}
|
|
499
|
+
a_stack.push(a);
|
|
500
|
+
b_stack.push(b);
|
|
501
|
+
let result;
|
|
502
|
+
try {
|
|
503
|
+
if (Symbol.iterator in a) {
|
|
504
|
+
const a_iter = a[Symbol.iterator]();
|
|
505
|
+
const b_iter = b[Symbol.iterator]();
|
|
506
|
+
while (true) {
|
|
507
|
+
const a_next = a_iter.next();
|
|
508
|
+
const b_next = b_iter.next();
|
|
509
|
+
if (a_next.done !== b_next.done)
|
|
510
|
+
return result = false;
|
|
511
|
+
if (a_next.done)
|
|
512
|
+
break;
|
|
513
|
+
if (!$mol_compare_deep(a_next.value, b_next.value))
|
|
514
|
+
return result = false;
|
|
515
|
+
}
|
|
516
|
+
return result = true;
|
|
517
|
+
}
|
|
518
|
+
let count = 0;
|
|
519
|
+
for (let key in a) {
|
|
520
|
+
try {
|
|
521
|
+
if (!$mol_compare_deep(a[key], b[key]))
|
|
522
|
+
return result = false;
|
|
523
|
+
}
|
|
524
|
+
catch (error) {
|
|
525
|
+
$.$mol_fail_hidden(new $.$mol_error_mix(`Failed ${JSON.stringify(key)} fields comparison of ${a} and ${b}`, error));
|
|
526
|
+
}
|
|
527
|
+
++count;
|
|
528
|
+
}
|
|
529
|
+
for (let key in b) {
|
|
530
|
+
--count;
|
|
531
|
+
if (count < 0)
|
|
532
|
+
return result = false;
|
|
533
|
+
}
|
|
534
|
+
if (a instanceof Number || a instanceof String || a instanceof Symbol || a instanceof Boolean || a instanceof Date) {
|
|
535
|
+
if (!Object.is(a['valueOf'](), b['valueOf']()))
|
|
536
|
+
return result = false;
|
|
537
|
+
}
|
|
538
|
+
return result = true;
|
|
539
|
+
}
|
|
540
|
+
finally {
|
|
541
|
+
a_stack.pop();
|
|
542
|
+
b_stack.pop();
|
|
543
|
+
if (a_stack.length === 0) {
|
|
544
|
+
cache = null;
|
|
545
|
+
}
|
|
546
|
+
else {
|
|
547
|
+
a_cache.set(b, result);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
$.$mol_compare_deep = $mol_compare_deep;
|
|
552
|
+
})($ || ($ = {}));
|
|
548
553
|
//deep.js.map
|
|
549
554
|
;
|
|
550
|
-
"use strict";
|
|
551
|
-
var $;
|
|
552
|
-
(function ($) {
|
|
553
|
-
$.$mol_test({
|
|
554
|
-
'must be false'() {
|
|
555
|
-
$.$mol_assert_not(0);
|
|
556
|
-
},
|
|
557
|
-
'must be true'() {
|
|
558
|
-
$.$mol_assert_ok(1);
|
|
559
|
-
},
|
|
560
|
-
'two must be equal'() {
|
|
561
|
-
$.$mol_assert_equal(2, 2);
|
|
562
|
-
},
|
|
563
|
-
'three must be equal'() {
|
|
564
|
-
$.$mol_assert_equal(2, 2, 2);
|
|
565
|
-
},
|
|
566
|
-
'two must be unique'() {
|
|
567
|
-
$.$mol_assert_unique([3], [3]);
|
|
568
|
-
},
|
|
569
|
-
'three must be unique'() {
|
|
570
|
-
$.$mol_assert_unique([3], [3], [3]);
|
|
571
|
-
},
|
|
572
|
-
'two must be alike'() {
|
|
573
|
-
$.$mol_assert_like([3], [3]);
|
|
574
|
-
},
|
|
575
|
-
'three must be alike'() {
|
|
576
|
-
$.$mol_assert_like([3], [3], [3]);
|
|
577
|
-
},
|
|
578
|
-
});
|
|
579
|
-
})($ || ($ = {}));
|
|
555
|
+
"use strict";
|
|
556
|
+
var $;
|
|
557
|
+
(function ($) {
|
|
558
|
+
$.$mol_test({
|
|
559
|
+
'must be false'() {
|
|
560
|
+
$.$mol_assert_not(0);
|
|
561
|
+
},
|
|
562
|
+
'must be true'() {
|
|
563
|
+
$.$mol_assert_ok(1);
|
|
564
|
+
},
|
|
565
|
+
'two must be equal'() {
|
|
566
|
+
$.$mol_assert_equal(2, 2);
|
|
567
|
+
},
|
|
568
|
+
'three must be equal'() {
|
|
569
|
+
$.$mol_assert_equal(2, 2, 2);
|
|
570
|
+
},
|
|
571
|
+
'two must be unique'() {
|
|
572
|
+
$.$mol_assert_unique([3], [3]);
|
|
573
|
+
},
|
|
574
|
+
'three must be unique'() {
|
|
575
|
+
$.$mol_assert_unique([3], [3], [3]);
|
|
576
|
+
},
|
|
577
|
+
'two must be alike'() {
|
|
578
|
+
$.$mol_assert_like([3], [3]);
|
|
579
|
+
},
|
|
580
|
+
'three must be alike'() {
|
|
581
|
+
$.$mol_assert_like([3], [3], [3]);
|
|
582
|
+
},
|
|
583
|
+
});
|
|
584
|
+
})($ || ($ = {}));
|
|
580
585
|
//assert.test.js.map
|
|
581
586
|
;
|
|
582
|
-
"use strict";
|
|
583
|
-
var $;
|
|
584
|
-
(function ($) {
|
|
585
|
-
function $mol_assert_ok(value) {
|
|
586
|
-
if (value)
|
|
587
|
-
return;
|
|
588
|
-
$.$mol_fail(new Error(`${value} ≠ true`));
|
|
589
|
-
}
|
|
590
|
-
$.$mol_assert_ok = $mol_assert_ok;
|
|
591
|
-
function $mol_assert_not(value) {
|
|
592
|
-
if (!value)
|
|
593
|
-
return;
|
|
594
|
-
$.$mol_fail(new Error(`${value} ≠ false`));
|
|
595
|
-
}
|
|
596
|
-
$.$mol_assert_not = $mol_assert_not;
|
|
597
|
-
function $mol_assert_fail(handler, ErrorRight) {
|
|
598
|
-
const fail = $.$mol_fail;
|
|
599
|
-
try {
|
|
600
|
-
$.$mol_fail = $.$mol_fail_hidden;
|
|
601
|
-
handler();
|
|
602
|
-
}
|
|
603
|
-
catch (error) {
|
|
604
|
-
if (!ErrorRight)
|
|
605
|
-
return error;
|
|
606
|
-
$.$mol_fail = fail;
|
|
607
|
-
if (typeof ErrorRight === 'string') {
|
|
608
|
-
$mol_assert_equal(error.message, ErrorRight);
|
|
609
|
-
}
|
|
610
|
-
else {
|
|
611
|
-
$mol_assert_ok(error instanceof ErrorRight);
|
|
612
|
-
}
|
|
613
|
-
return error;
|
|
614
|
-
}
|
|
615
|
-
finally {
|
|
616
|
-
$.$mol_fail = fail;
|
|
617
|
-
}
|
|
618
|
-
$.$mol_fail(new Error('Not failed'));
|
|
619
|
-
}
|
|
620
|
-
$.$mol_assert_fail = $mol_assert_fail;
|
|
621
|
-
function $mol_assert_equal(...args) {
|
|
622
|
-
for (let i = 0; i < args.length; ++i) {
|
|
623
|
-
for (let j = 0; j < args.length; ++j) {
|
|
624
|
-
if (i === j)
|
|
625
|
-
continue;
|
|
626
|
-
if (Number.isNaN(args[i]) && Number.isNaN(args[j]))
|
|
627
|
-
continue;
|
|
628
|
-
if (args[i] !== args[j])
|
|
629
|
-
$.$mol_fail(new Error(`Not equal\n${args[i]}\n${args[j]}`));
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
$.$mol_assert_equal = $mol_assert_equal;
|
|
634
|
-
function $mol_assert_unique(...args) {
|
|
635
|
-
for (let i = 0; i < args.length; ++i) {
|
|
636
|
-
for (let j = 0; j < args.length; ++j) {
|
|
637
|
-
if (i === j)
|
|
638
|
-
continue;
|
|
639
|
-
if (args[i] === args[j] || (Number.isNaN(args[i]) && Number.isNaN(args[j]))) {
|
|
640
|
-
$.$mol_fail(new Error(`args[${i}] = args[${j}] = ${args[i]}`));
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
$.$mol_assert_unique = $mol_assert_unique;
|
|
646
|
-
function $mol_assert_like(head, ...tail) {
|
|
647
|
-
for (let value of tail) {
|
|
648
|
-
if (
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
}
|
|
587
|
+
"use strict";
|
|
588
|
+
var $;
|
|
589
|
+
(function ($) {
|
|
590
|
+
function $mol_assert_ok(value) {
|
|
591
|
+
if (value)
|
|
592
|
+
return;
|
|
593
|
+
$.$mol_fail(new Error(`${value} ≠ true`));
|
|
594
|
+
}
|
|
595
|
+
$.$mol_assert_ok = $mol_assert_ok;
|
|
596
|
+
function $mol_assert_not(value) {
|
|
597
|
+
if (!value)
|
|
598
|
+
return;
|
|
599
|
+
$.$mol_fail(new Error(`${value} ≠ false`));
|
|
600
|
+
}
|
|
601
|
+
$.$mol_assert_not = $mol_assert_not;
|
|
602
|
+
function $mol_assert_fail(handler, ErrorRight) {
|
|
603
|
+
const fail = $.$mol_fail;
|
|
604
|
+
try {
|
|
605
|
+
$.$mol_fail = $.$mol_fail_hidden;
|
|
606
|
+
handler();
|
|
607
|
+
}
|
|
608
|
+
catch (error) {
|
|
609
|
+
if (!ErrorRight)
|
|
610
|
+
return error;
|
|
611
|
+
$.$mol_fail = fail;
|
|
612
|
+
if (typeof ErrorRight === 'string') {
|
|
613
|
+
$mol_assert_equal(error.message, ErrorRight);
|
|
614
|
+
}
|
|
615
|
+
else {
|
|
616
|
+
$mol_assert_ok(error instanceof ErrorRight);
|
|
617
|
+
}
|
|
618
|
+
return error;
|
|
619
|
+
}
|
|
620
|
+
finally {
|
|
621
|
+
$.$mol_fail = fail;
|
|
622
|
+
}
|
|
623
|
+
$.$mol_fail(new Error('Not failed'));
|
|
624
|
+
}
|
|
625
|
+
$.$mol_assert_fail = $mol_assert_fail;
|
|
626
|
+
function $mol_assert_equal(...args) {
|
|
627
|
+
for (let i = 0; i < args.length; ++i) {
|
|
628
|
+
for (let j = 0; j < args.length; ++j) {
|
|
629
|
+
if (i === j)
|
|
630
|
+
continue;
|
|
631
|
+
if (Number.isNaN(args[i]) && Number.isNaN(args[j]))
|
|
632
|
+
continue;
|
|
633
|
+
if (args[i] !== args[j])
|
|
634
|
+
$.$mol_fail(new Error(`Not equal (${i + 1}:${j + 1})\n${args[i]}\n${args[j]}`));
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
$.$mol_assert_equal = $mol_assert_equal;
|
|
639
|
+
function $mol_assert_unique(...args) {
|
|
640
|
+
for (let i = 0; i < args.length; ++i) {
|
|
641
|
+
for (let j = 0; j < args.length; ++j) {
|
|
642
|
+
if (i === j)
|
|
643
|
+
continue;
|
|
644
|
+
if (args[i] === args[j] || (Number.isNaN(args[i]) && Number.isNaN(args[j]))) {
|
|
645
|
+
$.$mol_fail(new Error(`args[${i}] = args[${j}] = ${args[i]}`));
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
$.$mol_assert_unique = $mol_assert_unique;
|
|
651
|
+
function $mol_assert_like(head, ...tail) {
|
|
652
|
+
for (let [index, value] of Object.entries(tail)) {
|
|
653
|
+
if (!$.$mol_compare_deep(value, head)) {
|
|
654
|
+
const print = (val) => {
|
|
655
|
+
if (!val)
|
|
656
|
+
return val;
|
|
657
|
+
if (typeof val !== 'object')
|
|
658
|
+
return val;
|
|
659
|
+
if ('outerHTML' in val)
|
|
660
|
+
return val.outerHTML;
|
|
661
|
+
try {
|
|
662
|
+
return JSON.stringify(val);
|
|
663
|
+
}
|
|
664
|
+
catch (error) {
|
|
665
|
+
console.error(error);
|
|
666
|
+
return val;
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
return $.$mol_fail(new Error(`Not like (1:${+index + 2})\n${print(head)}\n---\n${print(value)}`));
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
$.$mol_assert_like = $mol_assert_like;
|
|
674
|
+
})($ || ($ = {}));
|
|
667
675
|
//assert.js.map
|
|
668
676
|
;
|
|
669
|
-
"use strict";
|
|
670
|
-
var $;
|
|
671
|
-
(function ($) {
|
|
672
|
-
$.$mol_test({
|
|
673
|
-
'parse and serial'() {
|
|
674
|
-
$.$mol_assert_equal(new $.$mol_time_duration('P42.1Y').toString(), 'P42.1YT');
|
|
675
|
-
$.$mol_assert_equal(new $.$mol_time_duration('P42.1M').toString(), 'P42.1MT');
|
|
676
|
-
$.$mol_assert_equal(new $.$mol_time_duration('P42.1D').toString(), 'P42.1DT');
|
|
677
|
-
$.$mol_assert_equal(new $.$mol_time_duration('PT42.1h').toString(), 'PT42.1H');
|
|
678
|
-
$.$mol_assert_equal(new $.$mol_time_duration('PT42.1m').toString(), 'PT42.1M');
|
|
679
|
-
$.$mol_assert_equal(new $.$mol_time_duration('PT42.1s').toString(), 'PT42.1S');
|
|
680
|
-
$.$mol_assert_equal(new $.$mol_time_duration('P1Y2M3DT4h5m6.7s').toString(), 'P1Y2M3DT4H5M6.7S');
|
|
681
|
-
},
|
|
682
|
-
'format typed'() {
|
|
683
|
-
$.$mol_assert_equal(new $.$mol_time_duration('P1Y2M3DT4h5m6s').toString('P#Y#M#DT#h#m#s'), 'P1Y2M3DT4H5M6S');
|
|
684
|
-
},
|
|
685
|
-
});
|
|
686
|
-
})($ || ($ = {}));
|
|
677
|
+
"use strict";
|
|
678
|
+
var $;
|
|
679
|
+
(function ($) {
|
|
680
|
+
$.$mol_test({
|
|
681
|
+
'parse and serial'() {
|
|
682
|
+
$.$mol_assert_equal(new $.$mol_time_duration('P42.1Y').toString(), 'P42.1YT');
|
|
683
|
+
$.$mol_assert_equal(new $.$mol_time_duration('P42.1M').toString(), 'P42.1MT');
|
|
684
|
+
$.$mol_assert_equal(new $.$mol_time_duration('P42.1D').toString(), 'P42.1DT');
|
|
685
|
+
$.$mol_assert_equal(new $.$mol_time_duration('PT42.1h').toString(), 'PT42.1H');
|
|
686
|
+
$.$mol_assert_equal(new $.$mol_time_duration('PT42.1m').toString(), 'PT42.1M');
|
|
687
|
+
$.$mol_assert_equal(new $.$mol_time_duration('PT42.1s').toString(), 'PT42.1S');
|
|
688
|
+
$.$mol_assert_equal(new $.$mol_time_duration('P1Y2M3DT4h5m6.7s').toString(), 'P1Y2M3DT4H5M6.7S');
|
|
689
|
+
},
|
|
690
|
+
'format typed'() {
|
|
691
|
+
$.$mol_assert_equal(new $.$mol_time_duration('P1Y2M3DT4h5m6s').toString('P#Y#M#DT#h#m#s'), 'P1Y2M3DT4H5M6S');
|
|
692
|
+
},
|
|
693
|
+
});
|
|
694
|
+
})($ || ($ = {}));
|
|
687
695
|
//duration.test.js.map
|
|
688
696
|
;
|
|
689
|
-
"use strict";
|
|
690
|
-
var $;
|
|
691
|
-
(function ($) {
|
|
692
|
-
$.$mol_test({
|
|
693
|
-
'parse and serial'() {
|
|
694
|
-
$.$mol_assert_equal(new $.$mol_time_moment('2014').toString(), '2014');
|
|
695
|
-
$.$mol_assert_equal(new $.$mol_time_moment('2014-01').toString(), '2014-01');
|
|
696
|
-
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02').toString(), '2014-01-02');
|
|
697
|
-
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02T03').toString(), '2014-01-02T03');
|
|
698
|
-
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02T03:04').toString(), '2014-01-02T03:04');
|
|
699
|
-
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02T03:04:05').toString(), '2014-01-02T03:04:05');
|
|
700
|
-
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02T03:04:05.006').toString(), '2014-01-02T03:04:05.006');
|
|
701
|
-
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02T03:04:05.006Z').toString(), '2014-01-02T03:04:05.006+00:00');
|
|
702
|
-
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02T03:04:05.006+07:00').toString(), '2014-01-02T03:04:05.006+07:00');
|
|
703
|
-
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02T03:04:05+07:08').toString(), '2014-01-02T03:04:05+07:08');
|
|
704
|
-
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02T03:04+07:08').toString(), '2014-01-02T03:04+07:08');
|
|
705
|
-
$.$mol_assert_equal(new $.$mol_time_moment('T03:04+07:08').toString(), 'T03:04+07:08');
|
|
706
|
-
$.$mol_assert_equal(new $.$mol_time_moment('T03:04:05').toString(), 'T03:04:05');
|
|
707
|
-
$.$mol_assert_equal(new $.$mol_time_moment('T03:04').toString(), 'T03:04');
|
|
708
|
-
$.$mol_assert_equal(new $.$mol_time_moment('T03').toString(), 'T03');
|
|
709
|
-
},
|
|
710
|
-
'format simple'() {
|
|
711
|
-
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02T01:02:03.000000').toString('AD YY-M-D h:m:s'), '21 14-1-2 1:2:3');
|
|
712
|
-
},
|
|
713
|
-
'format padded'() {
|
|
714
|
-
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02T01:02:03.000').toString('YYYY-MM-DD hh:mm:ss'), '2014-01-02 01:02:03');
|
|
715
|
-
},
|
|
716
|
-
'format time zone'() {
|
|
717
|
-
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02T01:02:03+05:00').toString('Z'), '+05:00');
|
|
718
|
-
},
|
|
719
|
-
'format names'() {
|
|
720
|
-
$.$mol_assert_ok(new $.$mol_time_moment('2014-01-02T01:02:03.000').toString('Month Mon | WeekDay WD'));
|
|
721
|
-
},
|
|
722
|
-
'shifting'() {
|
|
723
|
-
$.$mol_assert_equal(new $.$mol_time_moment('T15:54:58.243+03:00').shift({}).toString(), 'T15:54:58.243+03:00');
|
|
724
|
-
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02').shift('P1Y').toString(), '2015-01-02');
|
|
725
|
-
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02').shift('P12M').toString(), '2015-01-02');
|
|
726
|
-
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02').shift('P365D').toString(), '2015-01-02');
|
|
727
|
-
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02').shift('PT8760h').toString(), '2015-01-02');
|
|
728
|
-
$.$mol_assert_equal(new $.$mol_time_moment('2014-01').shift('PT8760h').toString(), '2015-01');
|
|
729
|
-
$.$mol_assert_equal(new $.$mol_time_moment('2014-01').shift('PT-8760h').toString(), '2013-01');
|
|
730
|
-
},
|
|
731
|
-
'normalization'() {
|
|
732
|
-
$.$mol_assert_equal(new $.$mol_time_moment(
|
|
733
|
-
},
|
|
734
|
-
'iso week day'() {
|
|
735
|
-
$.$mol_assert_equal(new $.$mol_time_moment('2017-09-17').weekday,
|
|
736
|
-
$.$mol_assert_equal(new $.$mol_time_moment('2017-09-18').weekday,
|
|
737
|
-
},
|
|
738
|
-
|
|
739
|
-
|
|
697
|
+
"use strict";
|
|
698
|
+
var $;
|
|
699
|
+
(function ($) {
|
|
700
|
+
$.$mol_test({
|
|
701
|
+
'parse and serial'() {
|
|
702
|
+
$.$mol_assert_equal(new $.$mol_time_moment('2014').toString(), '2014');
|
|
703
|
+
$.$mol_assert_equal(new $.$mol_time_moment('2014-01').toString(), '2014-01');
|
|
704
|
+
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02').toString(), '2014-01-02');
|
|
705
|
+
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02T03').toString(), '2014-01-02T03');
|
|
706
|
+
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02T03:04').toString(), '2014-01-02T03:04');
|
|
707
|
+
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02T03:04:05').toString(), '2014-01-02T03:04:05');
|
|
708
|
+
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02T03:04:05.006').toString(), '2014-01-02T03:04:05.006');
|
|
709
|
+
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02T03:04:05.006Z').toString(), '2014-01-02T03:04:05.006+00:00');
|
|
710
|
+
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02T03:04:05.006+07:00').toString(), '2014-01-02T03:04:05.006+07:00');
|
|
711
|
+
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02T03:04:05+07:08').toString(), '2014-01-02T03:04:05+07:08');
|
|
712
|
+
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02T03:04+07:08').toString(), '2014-01-02T03:04+07:08');
|
|
713
|
+
$.$mol_assert_equal(new $.$mol_time_moment('T03:04+07:08').toString(), 'T03:04+07:08');
|
|
714
|
+
$.$mol_assert_equal(new $.$mol_time_moment('T03:04:05').toString(), 'T03:04:05');
|
|
715
|
+
$.$mol_assert_equal(new $.$mol_time_moment('T03:04').toString(), 'T03:04');
|
|
716
|
+
$.$mol_assert_equal(new $.$mol_time_moment('T03').toString(), 'T03');
|
|
717
|
+
},
|
|
718
|
+
'format simple'() {
|
|
719
|
+
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02T01:02:03.000000').toString('AD YY-M-D h:m:s'), '21 14-1-2 1:2:3');
|
|
720
|
+
},
|
|
721
|
+
'format padded'() {
|
|
722
|
+
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02T01:02:03.000').toString('YYYY-MM-DD hh:mm:ss'), '2014-01-02 01:02:03');
|
|
723
|
+
},
|
|
724
|
+
'format time zone'() {
|
|
725
|
+
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02T01:02:03+05:00').toString('Z'), '+05:00');
|
|
726
|
+
},
|
|
727
|
+
'format names'() {
|
|
728
|
+
$.$mol_assert_ok(new $.$mol_time_moment('2014-01-02T01:02:03.000').toString('Month Mon | WeekDay WD'));
|
|
729
|
+
},
|
|
730
|
+
'shifting'() {
|
|
731
|
+
$.$mol_assert_equal(new $.$mol_time_moment('T15:54:58.243+03:00').shift({}).toString(), 'T15:54:58.243+03:00');
|
|
732
|
+
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02').shift('P1Y').toString(), '2015-01-02');
|
|
733
|
+
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02').shift('P12M').toString(), '2015-01-02');
|
|
734
|
+
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02').shift('P365D').toString(), '2015-01-02');
|
|
735
|
+
$.$mol_assert_equal(new $.$mol_time_moment('2014-01-02').shift('PT8760h').toString(), '2015-01-02');
|
|
736
|
+
$.$mol_assert_equal(new $.$mol_time_moment('2014-01').shift('PT8760h').toString(), '2015-01');
|
|
737
|
+
$.$mol_assert_equal(new $.$mol_time_moment('2014-01').shift('PT-8760h').toString(), '2013-01');
|
|
738
|
+
},
|
|
739
|
+
'normalization'() {
|
|
740
|
+
$.$mol_assert_equal(new $.$mol_time_moment({ year: 2015, month: 6, day: 34 }).normal.toString(), '2015-08-04');
|
|
741
|
+
},
|
|
742
|
+
'iso week day'() {
|
|
743
|
+
$.$mol_assert_equal(new $.$mol_time_moment('2017-09-17').weekday, $.$mol_time_moment_weekdays.sunday);
|
|
744
|
+
$.$mol_assert_equal(new $.$mol_time_moment('2017-09-18').weekday, $.$mol_time_moment_weekdays.monday);
|
|
745
|
+
},
|
|
746
|
+
'change offset'() {
|
|
747
|
+
$.$mol_assert_equal(new $.$mol_time_moment('2021-04-10 +03:00').toOffset('Z').toString(), '2021-04-09T21:00:00+00:00');
|
|
748
|
+
}
|
|
749
|
+
});
|
|
750
|
+
})($ || ($ = {}));
|
|
740
751
|
//moment.test.js.map
|
|
741
752
|
;
|
|
742
|
-
"use strict";
|
|
743
|
-
var $;
|
|
744
|
-
(function ($) {
|
|
745
|
-
$.$mol_test({
|
|
746
|
-
'triplets'() {
|
|
747
|
-
$.$mol_assert_equal(new $.$mol_time_interval('2015-01-01/P1M').end.toString(), '2015-02-01');
|
|
748
|
-
$.$mol_assert_equal(new $.$mol_time_interval('P1M/2015-02-01').start.toString(), '2015-01-01');
|
|
749
|
-
$.$mol_assert_equal(new $.$mol_time_interval('2015-01-01/2015-02-01').duration.toString(), 'PT2678400S');
|
|
750
|
-
}
|
|
751
|
-
});
|
|
752
|
-
})($ || ($ = {}));
|
|
753
|
+
"use strict";
|
|
754
|
+
var $;
|
|
755
|
+
(function ($) {
|
|
756
|
+
$.$mol_test({
|
|
757
|
+
'triplets'() {
|
|
758
|
+
$.$mol_assert_equal(new $.$mol_time_interval('2015-01-01/P1M').end.toString(), '2015-02-01');
|
|
759
|
+
$.$mol_assert_equal(new $.$mol_time_interval('P1M/2015-02-01').start.toString(), '2015-01-01');
|
|
760
|
+
$.$mol_assert_equal(new $.$mol_time_interval('2015-01-01/2015-02-01').duration.toString(), 'PT2678400S');
|
|
761
|
+
}
|
|
762
|
+
});
|
|
763
|
+
})($ || ($ = {}));
|
|
753
764
|
//interval.test.js.map
|
|
754
765
|
;
|
|
755
|
-
"use strict";
|
|
756
|
-
var $;
|
|
757
|
-
(function ($) {
|
|
758
|
-
function $mol_log3_area_lazy(event) {
|
|
759
|
-
const self = this;
|
|
760
|
-
const stack = self.$mol_log3_stack;
|
|
761
|
-
const deep = stack.length;
|
|
762
|
-
let logged = false;
|
|
763
|
-
stack.push(() => {
|
|
764
|
-
logged = true;
|
|
765
|
-
self.$mol_log3_area.call(self, event);
|
|
766
|
-
});
|
|
767
|
-
return () => {
|
|
768
|
-
if (logged)
|
|
769
|
-
self.console.groupEnd();
|
|
770
|
-
if (stack.length > deep)
|
|
771
|
-
stack.length = deep;
|
|
772
|
-
};
|
|
773
|
-
}
|
|
774
|
-
$.$mol_log3_area_lazy = $mol_log3_area_lazy;
|
|
775
|
-
$.$mol_log3_stack = [];
|
|
776
|
-
})($ || ($ = {}));
|
|
766
|
+
"use strict";
|
|
767
|
+
var $;
|
|
768
|
+
(function ($) {
|
|
769
|
+
function $mol_log3_area_lazy(event) {
|
|
770
|
+
const self = this;
|
|
771
|
+
const stack = self.$mol_log3_stack;
|
|
772
|
+
const deep = stack.length;
|
|
773
|
+
let logged = false;
|
|
774
|
+
stack.push(() => {
|
|
775
|
+
logged = true;
|
|
776
|
+
self.$mol_log3_area.call(self, event);
|
|
777
|
+
});
|
|
778
|
+
return () => {
|
|
779
|
+
if (logged)
|
|
780
|
+
self.console.groupEnd();
|
|
781
|
+
if (stack.length > deep)
|
|
782
|
+
stack.length = deep;
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
$.$mol_log3_area_lazy = $mol_log3_area_lazy;
|
|
786
|
+
$.$mol_log3_stack = [];
|
|
787
|
+
})($ || ($ = {}));
|
|
777
788
|
//log3.js.map
|
|
778
789
|
;
|
|
779
|
-
"use strict";
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
790
|
+
"use strict";
|
|
791
|
+
//extract.test.js.map
|
|
792
|
+
;
|
|
793
|
+
"use strict";
|
|
794
|
+
//extract.js.map
|
|
795
|
+
;
|
|
796
|
+
"use strict";
|
|
797
|
+
var $;
|
|
798
|
+
(function ($_1) {
|
|
799
|
+
$_1.$mol_test_mocks.push($ => {
|
|
800
|
+
$.$mol_log3_come = () => { };
|
|
801
|
+
$.$mol_log3_done = () => { };
|
|
802
|
+
$.$mol_log3_fail = () => { };
|
|
803
|
+
$.$mol_log3_warn = () => { };
|
|
804
|
+
$.$mol_log3_rise = () => { };
|
|
805
|
+
$.$mol_log3_area = () => () => { };
|
|
806
|
+
});
|
|
807
|
+
})($ || ($ = {}));
|
|
791
808
|
//log3.test.js.map
|
|
792
809
|
;
|
|
793
|
-
"use strict";
|
|
794
|
-
var $;
|
|
795
|
-
(function ($) {
|
|
796
|
-
function $mol_log3_web_make(level, color) {
|
|
797
|
-
return function $mol_log3_logger(event) {
|
|
798
|
-
const pending = this.$mol_log3_stack.pop();
|
|
799
|
-
if (pending)
|
|
800
|
-
pending();
|
|
801
|
-
let tpl = '%c';
|
|
802
|
-
const chunks = Object.values(event);
|
|
803
|
-
for (let i = 0; i < chunks.length; ++i) {
|
|
804
|
-
tpl += (typeof chunks[i] === 'string') ? ' ⦙ %s' : ' ⦙ %o';
|
|
805
|
-
}
|
|
806
|
-
const style = `color:${color};font-weight:bolder`;
|
|
807
|
-
this.console[level](tpl, style, ...chunks);
|
|
808
|
-
const self = this;
|
|
809
|
-
return () => self.console.groupEnd();
|
|
810
|
-
};
|
|
811
|
-
}
|
|
812
|
-
$.$mol_log3_web_make = $mol_log3_web_make;
|
|
813
|
-
$.$mol_log3_come = $mol_log3_web_make('info', 'royalblue');
|
|
814
|
-
$.$mol_log3_done = $mol_log3_web_make('info', 'forestgreen');
|
|
815
|
-
$.$mol_log3_fail = $mol_log3_web_make('error', 'orangered');
|
|
816
|
-
$.$mol_log3_warn = $mol_log3_web_make('warn', 'goldenrod');
|
|
817
|
-
$.$mol_log3_rise = $mol_log3_web_make('log', 'magenta');
|
|
818
|
-
$.$mol_log3_area = $mol_log3_web_make('group', 'cyan');
|
|
819
|
-
})($ || ($ = {}));
|
|
810
|
+
"use strict";
|
|
811
|
+
var $;
|
|
812
|
+
(function ($) {
|
|
813
|
+
function $mol_log3_web_make(level, color) {
|
|
814
|
+
return function $mol_log3_logger(event) {
|
|
815
|
+
const pending = this.$mol_log3_stack.pop();
|
|
816
|
+
if (pending)
|
|
817
|
+
pending();
|
|
818
|
+
let tpl = '%c';
|
|
819
|
+
const chunks = Object.values(event);
|
|
820
|
+
for (let i = 0; i < chunks.length; ++i) {
|
|
821
|
+
tpl += (typeof chunks[i] === 'string') ? ' ⦙ %s' : ' ⦙ %o';
|
|
822
|
+
}
|
|
823
|
+
const style = `color:${color};font-weight:bolder`;
|
|
824
|
+
this.console[level](tpl, style, ...chunks);
|
|
825
|
+
const self = this;
|
|
826
|
+
return () => self.console.groupEnd();
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
$.$mol_log3_web_make = $mol_log3_web_make;
|
|
830
|
+
$.$mol_log3_come = $mol_log3_web_make('info', 'royalblue');
|
|
831
|
+
$.$mol_log3_done = $mol_log3_web_make('info', 'forestgreen');
|
|
832
|
+
$.$mol_log3_fail = $mol_log3_web_make('error', 'orangered');
|
|
833
|
+
$.$mol_log3_warn = $mol_log3_web_make('warn', 'goldenrod');
|
|
834
|
+
$.$mol_log3_rise = $mol_log3_web_make('log', 'magenta');
|
|
835
|
+
$.$mol_log3_area = $mol_log3_web_make('group', 'cyan');
|
|
836
|
+
})($ || ($ = {}));
|
|
820
837
|
//log3.web.js.map
|
|
821
838
|
;
|
|
822
|
-
"use strict";
|
|
823
|
-
var $;
|
|
824
|
-
(function ($) {
|
|
825
|
-
function $mol_dom_parse(text, type = 'application/xhtml+xml') {
|
|
826
|
-
const parser = new $.$mol_dom_context.DOMParser();
|
|
827
|
-
const doc = parser.parseFromString(text, type);
|
|
828
|
-
const error = doc.getElementsByTagName('parsererror')[0];
|
|
829
|
-
if (error)
|
|
830
|
-
throw new Error(error.textContent);
|
|
831
|
-
return doc;
|
|
832
|
-
}
|
|
833
|
-
$.$mol_dom_parse = $mol_dom_parse;
|
|
834
|
-
})($ || ($ = {}));
|
|
835
|
-
//parse.js.map
|
|
836
|
-
;
|
|
837
|
-
"use strict";
|
|
838
|
-
var $;
|
|
839
|
-
(function ($) {
|
|
840
|
-
$.$mol_test({
|
|
841
|
-
'Attach to document'() {
|
|
842
|
-
const doc = $.$mol_dom_parse('<html><body id="/foo"></body></html>');
|
|
843
|
-
$.$mol_jsx_attach(doc, () => $.$mol_jsx("body", { id: "/foo" }, "bar"));
|
|
844
|
-
$.$mol_assert_equal(doc.documentElement.outerHTML, '<html><body id="/foo">bar</body></html>');
|
|
845
|
-
},
|
|
846
|
-
});
|
|
847
|
-
})($ || ($ = {}));
|
|
848
|
-
//attach.test.js.map
|
|
849
|
-
;
|
|
850
|
-
"use strict";
|
|
851
|
-
var $;
|
|
852
|
-
(function ($) {
|
|
853
|
-
function $mol_jsx_attach(next, action) {
|
|
854
|
-
const prev = $.$mol_jsx_document;
|
|
855
|
-
try {
|
|
856
|
-
$.$mol_jsx_document = next;
|
|
857
|
-
return action();
|
|
858
|
-
}
|
|
859
|
-
finally {
|
|
860
|
-
$.$mol_jsx_document = prev;
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
$.$mol_jsx_attach = $mol_jsx_attach;
|
|
864
|
-
})($ || ($ = {}));
|
|
865
|
-
//attach.js.map
|
|
866
|
-
;
|
|
867
|
-
"use strict";
|
|
868
|
-
var $;
|
|
869
|
-
(function ($) {
|
|
870
|
-
$.$mol_test({
|
|
871
|
-
'get'() {
|
|
872
|
-
const proxy = $.$mol_delegate({}, () => ({ foo: 777 }));
|
|
873
|
-
$.$mol_assert_equal(proxy.foo, 777);
|
|
874
|
-
},
|
|
875
|
-
'has'() {
|
|
876
|
-
const proxy = $.$mol_delegate({}, () => ({ foo: 777 }));
|
|
877
|
-
$.$mol_assert_equal('foo' in proxy, true);
|
|
878
|
-
},
|
|
879
|
-
'set'() {
|
|
880
|
-
const target = { foo: 777 };
|
|
881
|
-
const proxy = $.$mol_delegate({}, () => target);
|
|
882
|
-
proxy.foo = 123;
|
|
883
|
-
$.$mol_assert_equal(target.foo, 123);
|
|
884
|
-
},
|
|
885
|
-
'getOwnPropertyDescriptor'() {
|
|
886
|
-
const proxy = $.$mol_delegate({}, () => ({ foo: 777 }));
|
|
887
|
-
$.$mol_assert_like(Object.getOwnPropertyDescriptor(proxy, 'foo'), {
|
|
888
|
-
value: 777,
|
|
889
|
-
writable: true,
|
|
890
|
-
enumerable: true,
|
|
891
|
-
configurable: true,
|
|
892
|
-
});
|
|
893
|
-
},
|
|
894
|
-
'ownKeys'() {
|
|
895
|
-
const proxy = $.$mol_delegate({}, () => ({ foo: 777, [Symbol.toStringTag]: 'bar' }));
|
|
896
|
-
$.$mol_assert_like(Reflect.ownKeys(proxy), ['foo', Symbol.toStringTag]);
|
|
897
|
-
},
|
|
898
|
-
'getPrototypeOf'() {
|
|
899
|
-
class Foo {
|
|
900
|
-
}
|
|
901
|
-
const proxy = $.$mol_delegate({}, () => new Foo);
|
|
902
|
-
$.$mol_assert_equal(Object.getPrototypeOf(proxy), Foo.prototype);
|
|
903
|
-
},
|
|
904
|
-
'setPrototypeOf'() {
|
|
905
|
-
class Foo {
|
|
906
|
-
}
|
|
907
|
-
const target = {};
|
|
908
|
-
const proxy = $.$mol_delegate({}, () => target);
|
|
909
|
-
Object.setPrototypeOf(proxy, Foo.prototype);
|
|
910
|
-
$.$mol_assert_equal(Object.getPrototypeOf(target), Foo.prototype);
|
|
911
|
-
},
|
|
912
|
-
'instanceof'() {
|
|
913
|
-
class Foo {
|
|
914
|
-
}
|
|
915
|
-
const proxy = $.$mol_delegate({}, () => new Foo);
|
|
916
|
-
$.$mol_assert_ok(proxy instanceof Foo);
|
|
917
|
-
$.$mol_assert_ok(proxy instanceof $.$mol_delegate);
|
|
918
|
-
},
|
|
919
|
-
'autobind'() {
|
|
920
|
-
class Foo {
|
|
921
|
-
}
|
|
922
|
-
const proxy = $.$mol_delegate({}, () => new Foo);
|
|
923
|
-
$.$mol_assert_ok(proxy.valueOf() instanceof Foo);
|
|
924
|
-
$.$mol_assert_not(proxy.valueOf() instanceof $.$mol_delegate);
|
|
925
|
-
},
|
|
926
|
-
});
|
|
927
|
-
})($ || ($ = {}));
|
|
928
|
-
//delegate.test.js.map
|
|
929
|
-
;
|
|
930
|
-
"use strict";
|
|
931
|
-
var $;
|
|
932
|
-
(function ($) {
|
|
933
|
-
const instances = new WeakSet();
|
|
934
|
-
function $mol_delegate(proto, target) {
|
|
935
|
-
const proxy = new Proxy(proto, {
|
|
936
|
-
get: (_, field) => {
|
|
937
|
-
const obj = target();
|
|
938
|
-
let val = Reflect.get(obj, field);
|
|
939
|
-
if (typeof val === 'function') {
|
|
940
|
-
val = val.bind(obj);
|
|
941
|
-
}
|
|
942
|
-
return val;
|
|
943
|
-
},
|
|
944
|
-
has: (_, field) => Reflect.has(target(), field),
|
|
945
|
-
set: (_, field, value) => Reflect.set(target(), field, value),
|
|
946
|
-
getOwnPropertyDescriptor: (_, field) => Reflect.getOwnPropertyDescriptor(target(), field),
|
|
947
|
-
ownKeys: () => Reflect.ownKeys(target()),
|
|
948
|
-
getPrototypeOf: () => Reflect.getPrototypeOf(target()),
|
|
949
|
-
setPrototypeOf: (_, donor) => Reflect.setPrototypeOf(target(), donor),
|
|
950
|
-
isExtensible: () => Reflect.isExtensible(target()),
|
|
951
|
-
preventExtensions: () => Reflect.preventExtensions(target()),
|
|
952
|
-
apply: (_, self, args) => Reflect.apply(target(), self, args),
|
|
953
|
-
construct: (_, args, retarget) => Reflect.construct(target(), args, retarget),
|
|
954
|
-
defineProperty: (_, field, descr) => Reflect.defineProperty(target(), field, descr),
|
|
955
|
-
deleteProperty: (_, field) => Reflect.deleteProperty(target(), field),
|
|
956
|
-
});
|
|
957
|
-
instances.add(proxy);
|
|
958
|
-
return proxy;
|
|
959
|
-
}
|
|
960
|
-
$.$mol_delegate = $mol_delegate;
|
|
961
|
-
Reflect.defineProperty($mol_delegate, Symbol.hasInstance, {
|
|
962
|
-
value: (obj) => instances.has(obj),
|
|
963
|
-
});
|
|
964
|
-
})($ || ($ = {}));
|
|
965
|
-
//delegate.js.map
|
|
966
|
-
;
|
|
967
|
-
"use strict";
|
|
968
|
-
var $;
|
|
969
|
-
(function ($) {
|
|
970
|
-
$.$mol_owning_map = new WeakMap();
|
|
971
|
-
function $mol_owning_allow(having) {
|
|
972
|
-
try {
|
|
973
|
-
if (!having)
|
|
974
|
-
return false;
|
|
975
|
-
if (typeof having !== 'object')
|
|
976
|
-
return false;
|
|
977
|
-
if (having instanceof $.$mol_delegate)
|
|
978
|
-
return false;
|
|
979
|
-
if (typeof having['destructor'] !== 'function')
|
|
980
|
-
return false;
|
|
981
|
-
return true;
|
|
982
|
-
}
|
|
983
|
-
catch (_a) {
|
|
984
|
-
return false;
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
$.$mol_owning_allow = $mol_owning_allow;
|
|
988
|
-
function $mol_owning_get(having, Owner) {
|
|
989
|
-
if (!$mol_owning_allow(having))
|
|
990
|
-
return null;
|
|
991
|
-
while (true) {
|
|
992
|
-
const owner = $.$mol_owning_map.get(having);
|
|
993
|
-
if (!owner)
|
|
994
|
-
return owner;
|
|
995
|
-
if (!Owner)
|
|
996
|
-
return owner;
|
|
997
|
-
if (owner instanceof Owner)
|
|
998
|
-
return owner;
|
|
999
|
-
having = owner;
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
$.$mol_owning_get = $mol_owning_get;
|
|
1003
|
-
function $mol_owning_check(owner, having) {
|
|
1004
|
-
if (!$mol_owning_allow(having))
|
|
1005
|
-
return false;
|
|
1006
|
-
if ($.$mol_owning_map.get(having) !== owner)
|
|
1007
|
-
return false;
|
|
1008
|
-
return true;
|
|
1009
|
-
}
|
|
1010
|
-
$.$mol_owning_check = $mol_owning_check;
|
|
1011
|
-
function $mol_owning_catch(owner, having) {
|
|
1012
|
-
if (!$mol_owning_allow(having))
|
|
1013
|
-
return false;
|
|
1014
|
-
if ($.$mol_owning_map.get(having))
|
|
1015
|
-
return false;
|
|
1016
|
-
$.$mol_owning_map.set(having, owner);
|
|
1017
|
-
return true;
|
|
1018
|
-
}
|
|
1019
|
-
$.$mol_owning_catch = $mol_owning_catch;
|
|
1020
|
-
})($ || ($ = {}));
|
|
1021
|
-
//owning.js.map
|
|
1022
|
-
;
|
|
1023
|
-
"use strict";
|
|
1024
|
-
//writable.test.js.map
|
|
1025
|
-
;
|
|
1026
|
-
"use strict";
|
|
1027
|
-
//writable.js.map
|
|
1028
|
-
;
|
|
1029
|
-
"use strict";
|
|
1030
|
-
var $;
|
|
1031
|
-
(function ($) {
|
|
1032
|
-
var _a;
|
|
1033
|
-
class $mol_object2 {
|
|
1034
|
-
constructor(init) {
|
|
1035
|
-
this[_a] = null;
|
|
1036
|
-
if (init)
|
|
1037
|
-
init(this);
|
|
1038
|
-
}
|
|
1039
|
-
get $() {
|
|
1040
|
-
if (this[$.$mol_ambient_ref])
|
|
1041
|
-
return this[$.$mol_ambient_ref];
|
|
1042
|
-
const owner = $.$mol_owning_get(this);
|
|
1043
|
-
return this[$.$mol_ambient_ref] = (owner === null || owner === void 0 ? void 0 : owner.$) || $mol_object2.$;
|
|
1044
|
-
}
|
|
1045
|
-
set $(next) {
|
|
1046
|
-
if (this[$.$mol_ambient_ref])
|
|
1047
|
-
$.$mol_fail_hidden(new Error('Context already defined'));
|
|
1048
|
-
this[$.$mol_ambient_ref] = next;
|
|
1049
|
-
}
|
|
1050
|
-
static create(init) {
|
|
1051
|
-
return new this(init);
|
|
1052
|
-
}
|
|
1053
|
-
static toString() { return this[Symbol.toStringTag] || this.name; }
|
|
1054
|
-
destructor() { }
|
|
1055
|
-
toString() {
|
|
1056
|
-
return this[Symbol.toStringTag] || this.constructor.name + '()';
|
|
1057
|
-
}
|
|
1058
|
-
toJSON() {
|
|
1059
|
-
return this.toString();
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
_a = $.$mol_ambient_ref;
|
|
1063
|
-
$mol_object2.$ = $;
|
|
1064
|
-
$.$mol_object2 = $mol_object2;
|
|
1065
|
-
})($ || ($ = {}));
|
|
1066
|
-
//object2.js.map
|
|
1067
|
-
;
|
|
1068
|
-
"use strict";
|
|
1069
|
-
var $;
|
|
1070
|
-
(function ($) {
|
|
1071
|
-
$.$mol_test({
|
|
1072
|
-
'init with overload'() {
|
|
1073
|
-
class X extends $.$mol_object {
|
|
1074
|
-
foo() {
|
|
1075
|
-
return 1;
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
var x = X.make({
|
|
1079
|
-
foo: () => 2,
|
|
1080
|
-
});
|
|
1081
|
-
$.$mol_assert_equal(x.foo(), 2);
|
|
1082
|
-
},
|
|
1083
|
-
});
|
|
1084
|
-
})($ || ($ = {}));
|
|
1085
|
-
//object.test.js.map
|
|
1086
|
-
;
|
|
1087
|
-
"use strict";
|
|
1088
|
-
var $;
|
|
1089
|
-
(function ($_1) {
|
|
1090
|
-
let $$;
|
|
1091
|
-
(function ($$) {
|
|
1092
|
-
let $;
|
|
1093
|
-
})($$ = $_1.$$ || ($_1.$$ = {}));
|
|
1094
|
-
$_1.$mol_object_field = Symbol('$mol_object_field');
|
|
1095
|
-
class $mol_object extends $_1.$mol_object2 {
|
|
1096
|
-
static make(config) {
|
|
1097
|
-
return super.create(obj => {
|
|
1098
|
-
for (let key in config)
|
|
1099
|
-
obj[key] = config[key];
|
|
1100
|
-
});
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
$_1.$mol_object = $mol_object;
|
|
1104
|
-
})($ || ($ = {}));
|
|
1105
|
-
//object.js.map
|
|
1106
|
-
;
|
|
1107
|
-
"use strict";
|
|
1108
|
-
var $;
|
|
1109
|
-
(function ($) {
|
|
1110
|
-
$.$mol_test({
|
|
1111
|
-
'run callback'() {
|
|
1112
|
-
class Plus1 extends $.$mol_wrapper {
|
|
1113
|
-
static wrap(task) {
|
|
1114
|
-
return function (...args) {
|
|
1115
|
-
return task.call(this, ...args) + 1;
|
|
1116
|
-
};
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
$.$mol_assert_equal(Plus1.run(() => 2), 3);
|
|
1120
|
-
},
|
|
1121
|
-
'wrap function'() {
|
|
1122
|
-
class Plus1 extends $.$mol_wrapper {
|
|
1123
|
-
static wrap(task) {
|
|
1124
|
-
return function (...args) {
|
|
1125
|
-
return task.call(this, ...args) + 1;
|
|
1126
|
-
};
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
const obj = {
|
|
1130
|
-
level: 2,
|
|
1131
|
-
pow: Plus1.func(function (a) {
|
|
1132
|
-
return a ** this.level;
|
|
1133
|
-
})
|
|
1134
|
-
};
|
|
1135
|
-
$.$mol_assert_equal(obj.pow(2), 5);
|
|
1136
|
-
},
|
|
1137
|
-
'decorate field getter'() {
|
|
1138
|
-
class Plus1 extends $.$mol_wrapper {
|
|
1139
|
-
static wrap(task) {
|
|
1140
|
-
return function (...args) {
|
|
1141
|
-
return Plus1.last = (task.call(this, ...args) || 0) + 1;
|
|
1142
|
-
};
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1145
|
-
Plus1.last = 0;
|
|
1146
|
-
class Foo {
|
|
1147
|
-
static get two() {
|
|
1148
|
-
return 1;
|
|
1149
|
-
}
|
|
1150
|
-
static set two(next) { }
|
|
1151
|
-
}
|
|
1152
|
-
__decorate([
|
|
1153
|
-
Plus1.field
|
|
1154
|
-
], Foo, "two", null);
|
|
1155
|
-
$.$mol_assert_equal(Foo.two, 2);
|
|
1156
|
-
Foo.two = 3;
|
|
1157
|
-
$.$mol_assert_equal(Plus1.last, 2);
|
|
1158
|
-
$.$mol_assert_equal(Foo.two, 2);
|
|
1159
|
-
},
|
|
1160
|
-
'decorate instance method'() {
|
|
1161
|
-
class Plus1 extends $.$mol_wrapper {
|
|
1162
|
-
static wrap(task) {
|
|
1163
|
-
return function (...args) {
|
|
1164
|
-
return task.call(this, ...args) + 1;
|
|
1165
|
-
};
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
class Foo1 {
|
|
1169
|
-
constructor() {
|
|
1170
|
-
this.level = 2;
|
|
1171
|
-
}
|
|
1172
|
-
pow(a) {
|
|
1173
|
-
return a ** this.level;
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
__decorate([
|
|
1177
|
-
Plus1.method
|
|
1178
|
-
], Foo1.prototype, "pow", null);
|
|
1179
|
-
const Foo2 = Foo1;
|
|
1180
|
-
const foo = new Foo2;
|
|
1181
|
-
$.$mol_assert_equal(foo.pow(2), 5);
|
|
1182
|
-
},
|
|
1183
|
-
'decorate static method'() {
|
|
1184
|
-
class Plus1 extends $.$mol_wrapper {
|
|
1185
|
-
static wrap(task) {
|
|
1186
|
-
return function (...args) {
|
|
1187
|
-
return task.call(this, ...args) + 1;
|
|
1188
|
-
};
|
|
1189
|
-
}
|
|
1190
|
-
}
|
|
1191
|
-
class Foo {
|
|
1192
|
-
static pow(a) {
|
|
1193
|
-
return a ** this.level;
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
Foo.level = 2;
|
|
1197
|
-
__decorate([
|
|
1198
|
-
Plus1.method
|
|
1199
|
-
], Foo, "pow", null);
|
|
1200
|
-
$.$mol_assert_equal(Foo.pow(2), 5);
|
|
1201
|
-
},
|
|
1202
|
-
'decorate class'() {
|
|
1203
|
-
class BarInc extends $.$mol_wrapper {
|
|
1204
|
-
static wrap(task) {
|
|
1205
|
-
return function (...args) {
|
|
1206
|
-
const foo = task.call(this, ...args);
|
|
1207
|
-
foo.bar++;
|
|
1208
|
-
return foo;
|
|
1209
|
-
};
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
let Foo = class Foo {
|
|
1213
|
-
constructor(bar) {
|
|
1214
|
-
this.bar = bar;
|
|
1215
|
-
}
|
|
1216
|
-
};
|
|
1217
|
-
Foo = __decorate([
|
|
1218
|
-
BarInc.class
|
|
1219
|
-
], Foo);
|
|
1220
|
-
$.$mol_assert_equal(new Foo(2).bar, 3);
|
|
1221
|
-
},
|
|
1222
|
-
});
|
|
1223
|
-
})($ || ($ = {}));
|
|
1224
|
-
//wrapper.test.js.map
|
|
1225
|
-
;
|
|
1226
|
-
"use strict";
|
|
1227
|
-
var $;
|
|
1228
|
-
(function ($) {
|
|
1229
|
-
class $mol_wrapper extends $.$mol_object2 {
|
|
1230
|
-
static run(task) {
|
|
1231
|
-
return this.func(task)();
|
|
1232
|
-
}
|
|
1233
|
-
static func(func) {
|
|
1234
|
-
return this.wrap(func);
|
|
1235
|
-
}
|
|
1236
|
-
static get class() {
|
|
1237
|
-
return (Class) => {
|
|
1238
|
-
const construct = (target, args) => new Class(...args);
|
|
1239
|
-
const handler = {
|
|
1240
|
-
construct: this.func(construct)
|
|
1241
|
-
};
|
|
1242
|
-
handler[Symbol.toStringTag] = Class.name + '#';
|
|
1243
|
-
return new Proxy(Class, handler);
|
|
1244
|
-
};
|
|
1245
|
-
}
|
|
1246
|
-
static get method() {
|
|
1247
|
-
return (obj, name, descr) => {
|
|
1248
|
-
descr.value = this.func(descr.value);
|
|
1249
|
-
return descr;
|
|
1250
|
-
};
|
|
1251
|
-
}
|
|
1252
|
-
static get field() {
|
|
1253
|
-
return (obj, name, descr) => {
|
|
1254
|
-
descr.get = descr.set = this.func(descr.get);
|
|
1255
|
-
return descr;
|
|
1256
|
-
};
|
|
1257
|
-
}
|
|
1258
|
-
}
|
|
1259
|
-
$.$mol_wrapper = $mol_wrapper;
|
|
1260
|
-
})($ || ($ = {}));
|
|
1261
|
-
//wrapper.js.map
|
|
1262
|
-
;
|
|
1263
|
-
"use strict";
|
|
1264
|
-
var $;
|
|
1265
|
-
(function ($) {
|
|
1266
|
-
$.$mol_after_mock_queue = [];
|
|
1267
|
-
function $mol_after_mock_warp() {
|
|
1268
|
-
const queue = $.$mol_after_mock_queue.splice(0);
|
|
1269
|
-
for (const task of queue)
|
|
1270
|
-
task();
|
|
1271
|
-
}
|
|
1272
|
-
$.$mol_after_mock_warp = $mol_after_mock_warp;
|
|
1273
|
-
class $mol_after_mock_commmon extends $.$mol_object2 {
|
|
1274
|
-
constructor(task) {
|
|
1275
|
-
super();
|
|
1276
|
-
this.task = task;
|
|
1277
|
-
this.promise = Promise.resolve();
|
|
1278
|
-
this.cancelled = false;
|
|
1279
|
-
$.$mol_after_mock_queue.push(task);
|
|
1280
|
-
}
|
|
1281
|
-
destructor() {
|
|
1282
|
-
const index = $.$mol_after_mock_queue.indexOf(this.task);
|
|
1283
|
-
if (index >= 0)
|
|
1284
|
-
$.$mol_after_mock_queue.splice(index, 1);
|
|
1285
|
-
}
|
|
1286
|
-
}
|
|
1287
|
-
$.$mol_after_mock_commmon = $mol_after_mock_commmon;
|
|
1288
|
-
class $mol_after_mock_timeout extends $mol_after_mock_commmon {
|
|
1289
|
-
constructor(delay, task) {
|
|
1290
|
-
super(task);
|
|
1291
|
-
this.delay = delay;
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
$.$mol_after_mock_timeout = $mol_after_mock_timeout;
|
|
1295
|
-
})($ || ($ = {}));
|
|
1296
|
-
//mock.test.js.map
|
|
1297
|
-
;
|
|
1298
|
-
"use strict";
|
|
1299
|
-
var $;
|
|
1300
|
-
(function ($_1) {
|
|
1301
|
-
$_1.$mol_test_mocks.push($ => {
|
|
1302
|
-
$.$mol_after_frame = $_1.$mol_after_mock_commmon;
|
|
1303
|
-
});
|
|
1304
|
-
})($ || ($ = {}));
|
|
1305
|
-
//frame.test.js.map
|
|
1306
|
-
;
|
|
1307
|
-
"use strict";
|
|
1308
|
-
var $;
|
|
1309
|
-
(function ($) {
|
|
1310
|
-
class $mol_after_frame extends $.$mol_object2 {
|
|
1311
|
-
constructor(task) {
|
|
1312
|
-
super();
|
|
1313
|
-
this.task = task;
|
|
1314
|
-
this.cancelled = false;
|
|
1315
|
-
this.promise = $mol_after_frame.promise.then(() => {
|
|
1316
|
-
if (this.cancelled)
|
|
1317
|
-
return;
|
|
1318
|
-
task();
|
|
1319
|
-
});
|
|
1320
|
-
}
|
|
1321
|
-
static get promise() {
|
|
1322
|
-
if (this._promise)
|
|
1323
|
-
return this._promise;
|
|
1324
|
-
return this._promise = new Promise(done => requestAnimationFrame(() => {
|
|
1325
|
-
this._promise = null;
|
|
1326
|
-
done();
|
|
1327
|
-
}));
|
|
1328
|
-
}
|
|
1329
|
-
destructor() {
|
|
1330
|
-
this.cancelled = true;
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
$mol_after_frame._promise = null;
|
|
1334
|
-
$.$mol_after_frame = $mol_after_frame;
|
|
1335
|
-
})($ || ($ = {}));
|
|
1336
|
-
//frame.web.js.map
|
|
1337
|
-
;
|
|
1338
|
-
"use strict";
|
|
1339
|
-
var $;
|
|
1340
|
-
(function ($) {
|
|
1341
|
-
$.$mol_test({
|
|
1342
|
-
'objects by reference'() {
|
|
1343
|
-
$.$mol_assert_equal($.$mol_compare_any({}, {}), false);
|
|
1344
|
-
},
|
|
1345
|
-
'primitives by value'() {
|
|
1346
|
-
$.$mol_assert_equal($.$mol_compare_any('a', 'a'), true);
|
|
1347
|
-
},
|
|
1348
|
-
'NaN by value'() {
|
|
1349
|
-
$.$mol_assert_equal($.$mol_compare_any(Number.NaN, Number.NaN), true);
|
|
1350
|
-
},
|
|
1351
|
-
'NaN not equal zero'() {
|
|
1352
|
-
$.$mol_assert_equal($.$mol_compare_any(Number.NaN, 0), false);
|
|
1353
|
-
},
|
|
1354
|
-
});
|
|
1355
|
-
})($ || ($ = {}));
|
|
1356
|
-
//any.test.js.map
|
|
1357
|
-
;
|
|
1358
|
-
"use strict";
|
|
1359
|
-
var $;
|
|
1360
|
-
(function ($) {
|
|
1361
|
-
function $mol_compare_any(a, b) {
|
|
1362
|
-
if (a === b)
|
|
1363
|
-
return true;
|
|
1364
|
-
if (!Number.isNaN(a))
|
|
1365
|
-
return false;
|
|
1366
|
-
if (!Number.isNaN(b))
|
|
1367
|
-
return false;
|
|
1368
|
-
return true;
|
|
1369
|
-
}
|
|
1370
|
-
$.$mol_compare_any = $mol_compare_any;
|
|
1371
|
-
})($ || ($ = {}));
|
|
1372
|
-
//any.js.map
|
|
1373
|
-
;
|
|
1374
|
-
"use strict";
|
|
1375
|
-
var $;
|
|
1376
|
-
(function ($) {
|
|
1377
|
-
$.$mol_test({
|
|
1378
|
-
'return source when same object'() {
|
|
1379
|
-
const target = {};
|
|
1380
|
-
$.$mol_assert_equal($.$mol_conform(target, target), target);
|
|
1381
|
-
},
|
|
1382
|
-
'return target when some is not object'() {
|
|
1383
|
-
const obj = { a: 1 };
|
|
1384
|
-
$.$mol_assert_equal($.$mol_conform(true, obj), true);
|
|
1385
|
-
$.$mol_assert_equal($.$mol_conform(obj, true), obj);
|
|
1386
|
-
},
|
|
1387
|
-
'return target when some is null'() {
|
|
1388
|
-
const obj = { a: 1 };
|
|
1389
|
-
$.$mol_assert_equal($.$mol_conform(null, obj), null);
|
|
1390
|
-
$.$mol_assert_equal($.$mol_conform(obj, null), obj);
|
|
1391
|
-
},
|
|
1392
|
-
'return target when some is undefined'() {
|
|
1393
|
-
const obj = { a: 1 };
|
|
1394
|
-
$.$mol_assert_equal($.$mol_conform(undefined, obj), undefined);
|
|
1395
|
-
$.$mol_assert_equal($.$mol_conform(obj, undefined), obj);
|
|
1396
|
-
},
|
|
1397
|
-
'return target when different keys count'() {
|
|
1398
|
-
const target = [1, 2, 3];
|
|
1399
|
-
const source = [1, 2, 3, undefined];
|
|
1400
|
-
const result = $.$mol_conform(target, source);
|
|
1401
|
-
$.$mol_assert_equal(result, target);
|
|
1402
|
-
$.$mol_assert_equal(result.join(','), '1,2,3');
|
|
1403
|
-
},
|
|
1404
|
-
'return source when array values are strong equal'() {
|
|
1405
|
-
const source = [1, 2, 3];
|
|
1406
|
-
$.$mol_assert_equal($.$mol_conform([1, 2, 3], source), source);
|
|
1407
|
-
},
|
|
1408
|
-
'return source when object values are strong equal'() {
|
|
1409
|
-
const source = { a: 1, b: 2 };
|
|
1410
|
-
$.$mol_assert_equal($.$mol_conform({ a: 1, b: 2 }, source), source);
|
|
1411
|
-
},
|
|
1412
|
-
'return target when some values are not equal'() {
|
|
1413
|
-
const target = [1, 2, 3];
|
|
1414
|
-
const source = [1, 2, 5];
|
|
1415
|
-
const result = $.$mol_conform(target, source);
|
|
1416
|
-
$.$mol_assert_equal(result, target);
|
|
1417
|
-
$.$mol_assert_equal(result.join(','), '1,2,3');
|
|
1418
|
-
},
|
|
1419
|
-
'return source when values are deep equal'() {
|
|
1420
|
-
const source = { foo: { bar: 1 } };
|
|
1421
|
-
$.$mol_assert_equal($.$mol_conform({ foo: { bar: 1 } }, source), source);
|
|
1422
|
-
},
|
|
1423
|
-
'return target with equal values from source and not equal from target'() {
|
|
1424
|
-
const source = { foo: { xxx: 1 }, bar: { xxx: 2 } };
|
|
1425
|
-
const target = { foo: { xxx: 1 }, bar: { xxx: 3 } };
|
|
1426
|
-
const result = $.$mol_conform(target, source);
|
|
1427
|
-
$.$mol_assert_equal(result, target);
|
|
1428
|
-
$.$mol_assert_equal(result.foo, source.foo);
|
|
1429
|
-
$.$mol_assert_equal(result.bar, target.bar);
|
|
1430
|
-
},
|
|
1431
|
-
'return target when equal but with different class'() {
|
|
1432
|
-
const target = { '0': 1 };
|
|
1433
|
-
$.$mol_assert_equal($.$mol_conform(target, [1]), target);
|
|
1434
|
-
},
|
|
1435
|
-
'return target when conformer for class is not defined'() {
|
|
1436
|
-
const Obj = class {
|
|
1437
|
-
};
|
|
1438
|
-
const source = new Obj;
|
|
1439
|
-
const target = new Obj;
|
|
1440
|
-
const result = $.$mol_conform(target, source);
|
|
1441
|
-
$.$mol_assert_equal(result, target);
|
|
1442
|
-
},
|
|
1443
|
-
'return target when has cyclic reference'() {
|
|
1444
|
-
const source = { foo: {} };
|
|
1445
|
-
source['self'] = source;
|
|
1446
|
-
const target = { foo: {} };
|
|
1447
|
-
target['self'] = target;
|
|
1448
|
-
const result = $.$mol_conform(target, source);
|
|
1449
|
-
$.$mol_assert_equal(result, target);
|
|
1450
|
-
$.$mol_assert_equal(result['self'], target);
|
|
1451
|
-
$.$mol_assert_equal(result.foo, source.foo);
|
|
1452
|
-
},
|
|
1453
|
-
'return source when equal dates'() {
|
|
1454
|
-
const source = new Date(12345);
|
|
1455
|
-
const target = new Date(12345);
|
|
1456
|
-
const result = $.$mol_conform(target, source);
|
|
1457
|
-
$.$mol_assert_equal(result, source);
|
|
1458
|
-
},
|
|
1459
|
-
'return source when equal regular expressions'() {
|
|
1460
|
-
const source = /\x22/mig;
|
|
1461
|
-
const target = /\x22/mig;
|
|
1462
|
-
const result = $.$mol_conform(target, source);
|
|
1463
|
-
$.$mol_assert_equal(result, source);
|
|
1464
|
-
},
|
|
1465
|
-
'return cached value if already conformed'() {
|
|
1466
|
-
const source = { foo: { xxx: 1 }, bar: { xxx: 3 } };
|
|
1467
|
-
const target = { foo: { xxx: 2 }, bar: { xxx: 3 } };
|
|
1468
|
-
const result = $.$mol_conform(target, source);
|
|
1469
|
-
target.foo.xxx = 1;
|
|
1470
|
-
$.$mol_assert_equal($.$mol_conform(target.foo, source.foo), target.foo);
|
|
1471
|
-
},
|
|
1472
|
-
'skip readlony fields'() {
|
|
1473
|
-
const source = { foo: {}, bar: {} };
|
|
1474
|
-
const target = { foo: {}, bar: {} };
|
|
1475
|
-
Object.defineProperty(target, 'bar', { value: {}, writable: false });
|
|
1476
|
-
const result = $.$mol_conform(target, source);
|
|
1477
|
-
$.$mol_assert_equal(result, target);
|
|
1478
|
-
$.$mol_assert_equal(result.foo, source.foo);
|
|
1479
|
-
$.$mol_assert_equal(result.bar, target.bar);
|
|
1480
|
-
},
|
|
1481
|
-
'object with NaN'() {
|
|
1482
|
-
const source = { foo: Number.NaN };
|
|
1483
|
-
const target = { foo: Number.NaN };
|
|
1484
|
-
const result = $.$mol_conform(target, source);
|
|
1485
|
-
$.$mol_assert_equal(result, source);
|
|
1486
|
-
},
|
|
1487
|
-
'array with NaN'() {
|
|
1488
|
-
const source = [Number.NaN];
|
|
1489
|
-
const target = [Number.NaN];
|
|
1490
|
-
const result = $.$mol_conform(target, source);
|
|
1491
|
-
$.$mol_assert_equal(result, source);
|
|
1492
|
-
},
|
|
1493
|
-
});
|
|
1494
|
-
})($ || ($ = {}));
|
|
1495
|
-
//conform.test.js.map
|
|
1496
|
-
;
|
|
1497
|
-
"use strict";
|
|
1498
|
-
var $;
|
|
1499
|
-
(function ($) {
|
|
1500
|
-
const cache = new WeakMap();
|
|
1501
|
-
$.$mol_conform_stack = [];
|
|
1502
|
-
function $mol_conform(target, source) {
|
|
1503
|
-
if ($.$mol_compare_any(target, source))
|
|
1504
|
-
return source;
|
|
1505
|
-
if (!target || typeof target !== 'object')
|
|
1506
|
-
return target;
|
|
1507
|
-
if (!source || typeof source !== 'object')
|
|
1508
|
-
return target;
|
|
1509
|
-
if (target instanceof Error)
|
|
1510
|
-
return target;
|
|
1511
|
-
if (source instanceof Error)
|
|
1512
|
-
return target;
|
|
1513
|
-
if (target['constructor'] !== source['constructor'])
|
|
1514
|
-
return target;
|
|
1515
|
-
if (cache.get(target))
|
|
1516
|
-
return target;
|
|
1517
|
-
cache.set(target, true);
|
|
1518
|
-
const conform = $.$mol_conform_handlers.get(target['constructor']);
|
|
1519
|
-
if (!conform)
|
|
1520
|
-
return target;
|
|
1521
|
-
if ($.$mol_conform_stack.indexOf(target) !== -1)
|
|
1522
|
-
return target;
|
|
1523
|
-
$.$mol_conform_stack.push(target);
|
|
1524
|
-
try {
|
|
1525
|
-
return conform(target, source);
|
|
1526
|
-
}
|
|
1527
|
-
finally {
|
|
1528
|
-
$.$mol_conform_stack.pop();
|
|
1529
|
-
}
|
|
1530
|
-
}
|
|
1531
|
-
$.$mol_conform = $mol_conform;
|
|
1532
|
-
$.$mol_conform_handlers = new WeakMap();
|
|
1533
|
-
function $mol_conform_handler(cl, handler) {
|
|
1534
|
-
$.$mol_conform_handlers.set(cl, handler);
|
|
1535
|
-
}
|
|
1536
|
-
$.$mol_conform_handler = $mol_conform_handler;
|
|
1537
|
-
function $mol_conform_array(target, source) {
|
|
1538
|
-
if (source.length !== target.length)
|
|
1539
|
-
return target;
|
|
1540
|
-
for (let i = 0; i < target.length; ++i) {
|
|
1541
|
-
if (!$.$mol_compare_any(source[i], target[i]))
|
|
1542
|
-
return target;
|
|
1543
|
-
}
|
|
1544
|
-
return source;
|
|
1545
|
-
}
|
|
1546
|
-
$.$mol_conform_array = $mol_conform_array;
|
|
1547
|
-
$mol_conform_handler(Array, $mol_conform_array);
|
|
1548
|
-
$mol_conform_handler(Uint8Array, $mol_conform_array);
|
|
1549
|
-
$mol_conform_handler(Uint16Array, $mol_conform_array);
|
|
1550
|
-
$mol_conform_handler(Uint32Array, $mol_conform_array);
|
|
1551
|
-
$mol_conform_handler(Object, (target, source) => {
|
|
1552
|
-
let count = 0;
|
|
1553
|
-
let equal = true;
|
|
1554
|
-
for (let key in target) {
|
|
1555
|
-
const conformed = $mol_conform(target[key], source[key]);
|
|
1556
|
-
if (conformed !== target[key]) {
|
|
1557
|
-
try {
|
|
1558
|
-
target[key] = conformed;
|
|
1559
|
-
}
|
|
1560
|
-
catch (error) { }
|
|
1561
|
-
if (!$.$mol_compare_any(conformed, target[key]))
|
|
1562
|
-
equal = false;
|
|
1563
|
-
}
|
|
1564
|
-
if (!$.$mol_compare_any(conformed, source[key]))
|
|
1565
|
-
equal = false;
|
|
1566
|
-
++count;
|
|
1567
|
-
}
|
|
1568
|
-
for (let key in source)
|
|
1569
|
-
if (--count < 0)
|
|
1570
|
-
break;
|
|
1571
|
-
return (equal && count === 0) ? source : target;
|
|
1572
|
-
});
|
|
1573
|
-
$mol_conform_handler(Date, (target, source) => {
|
|
1574
|
-
if (target.getTime() === source.getTime())
|
|
1575
|
-
return source;
|
|
1576
|
-
return target;
|
|
1577
|
-
});
|
|
1578
|
-
$mol_conform_handler(RegExp, (target, source) => {
|
|
1579
|
-
if (target.toString() === source.toString())
|
|
1580
|
-
return source;
|
|
1581
|
-
return target;
|
|
1582
|
-
});
|
|
1583
|
-
})($ || ($ = {}));
|
|
1584
|
-
//conform.js.map
|
|
1585
|
-
;
|
|
1586
|
-
"use strict";
|
|
1587
|
-
var $;
|
|
1588
|
-
(function ($) {
|
|
1589
|
-
$.$mol_test({
|
|
1590
|
-
'trim array'() {
|
|
1591
|
-
const array = [undefined, null, 0, false, null, undefined, undefined];
|
|
1592
|
-
const correct = [undefined, null, 0, false, null];
|
|
1593
|
-
$.$mol_array_trim(array);
|
|
1594
|
-
$.$mol_assert_like(array, correct);
|
|
1595
|
-
}
|
|
1596
|
-
});
|
|
1597
|
-
})($ || ($ = {}));
|
|
1598
|
-
//trim.test.js.map
|
|
1599
|
-
;
|
|
1600
|
-
"use strict";
|
|
1601
|
-
var $;
|
|
1602
|
-
(function ($) {
|
|
1603
|
-
function $mol_array_trim(array) {
|
|
1604
|
-
let last = array.length;
|
|
1605
|
-
while (last > 0) {
|
|
1606
|
-
--last;
|
|
1607
|
-
const value = array[last];
|
|
1608
|
-
if (value === undefined)
|
|
1609
|
-
array.pop();
|
|
1610
|
-
else
|
|
1611
|
-
break;
|
|
1612
|
-
}
|
|
1613
|
-
return array;
|
|
1614
|
-
}
|
|
1615
|
-
$.$mol_array_trim = $mol_array_trim;
|
|
1616
|
-
})($ || ($ = {}));
|
|
1617
|
-
//trim.js.map
|
|
1618
|
-
;
|
|
1619
|
-
"use strict";
|
|
1620
|
-
var $;
|
|
1621
|
-
(function ($) {
|
|
1622
|
-
$['devtoolsFormatters'] = $['devtoolsFormatters'] || [];
|
|
1623
|
-
function $mol_dev_format_register(config) {
|
|
1624
|
-
$['devtoolsFormatters'].push(config);
|
|
1625
|
-
}
|
|
1626
|
-
$.$mol_dev_format_register = $mol_dev_format_register;
|
|
1627
|
-
$.$mol_dev_format_head = Symbol('$mol_dev_format_head');
|
|
1628
|
-
$.$mol_dev_format_body = Symbol('$mol_dev_format_body');
|
|
1629
|
-
$mol_dev_format_register({
|
|
1630
|
-
header: (val, config = false) => {
|
|
1631
|
-
if (config)
|
|
1632
|
-
return null;
|
|
1633
|
-
if (!val)
|
|
1634
|
-
return null;
|
|
1635
|
-
if ($.$mol_dev_format_head in val) {
|
|
1636
|
-
return val[$.$mol_dev_format_head]();
|
|
1637
|
-
}
|
|
1638
|
-
return null;
|
|
1639
|
-
},
|
|
1640
|
-
hasBody: val => val[$.$mol_dev_format_body],
|
|
1641
|
-
body: val => val[$.$mol_dev_format_body](),
|
|
1642
|
-
});
|
|
1643
|
-
function $mol_dev_format_native(obj) {
|
|
1644
|
-
if (typeof obj === 'undefined')
|
|
1645
|
-
return $.$mol_dev_format_shade('undefined');
|
|
1646
|
-
if (typeof obj !== 'object')
|
|
1647
|
-
return obj;
|
|
1648
|
-
return [
|
|
1649
|
-
'object',
|
|
1650
|
-
{
|
|
1651
|
-
object: obj,
|
|
1652
|
-
config: true,
|
|
1653
|
-
},
|
|
1654
|
-
];
|
|
1655
|
-
}
|
|
1656
|
-
$.$mol_dev_format_native = $mol_dev_format_native;
|
|
1657
|
-
function $mol_dev_format_auto(obj) {
|
|
1658
|
-
if (obj == null)
|
|
1659
|
-
return $.$mol_dev_format_shade(String(obj));
|
|
1660
|
-
if (typeof obj === 'object' && $.$mol_dev_format_head in obj) {
|
|
1661
|
-
return obj[$.$mol_dev_format_head]();
|
|
1662
|
-
}
|
|
1663
|
-
return [
|
|
1664
|
-
'object',
|
|
1665
|
-
{
|
|
1666
|
-
object: obj,
|
|
1667
|
-
config: false,
|
|
1668
|
-
},
|
|
1669
|
-
];
|
|
1670
|
-
}
|
|
1671
|
-
$.$mol_dev_format_auto = $mol_dev_format_auto;
|
|
1672
|
-
function $mol_dev_format_element(element, style, ...content) {
|
|
1673
|
-
const styles = [];
|
|
1674
|
-
for (let key in style)
|
|
1675
|
-
styles.push(`${key} : ${style[key]}`);
|
|
1676
|
-
return [
|
|
1677
|
-
element,
|
|
1678
|
-
{
|
|
1679
|
-
style: styles.join(' ; '),
|
|
1680
|
-
},
|
|
1681
|
-
...content,
|
|
1682
|
-
];
|
|
1683
|
-
}
|
|
1684
|
-
$.$mol_dev_format_element = $mol_dev_format_element;
|
|
1685
|
-
function $mol_dev_format_span(style, ...content) {
|
|
1686
|
-
return $mol_dev_format_element('span', Object.assign({ 'vertical-align': '8%' }, style), ...content);
|
|
1687
|
-
}
|
|
1688
|
-
$.$mol_dev_format_span = $mol_dev_format_span;
|
|
1689
|
-
$.$mol_dev_format_div = $mol_dev_format_element.bind(null, 'div');
|
|
1690
|
-
$.$mol_dev_format_ol = $mol_dev_format_element.bind(null, 'ol');
|
|
1691
|
-
$.$mol_dev_format_li = $mol_dev_format_element.bind(null, 'li');
|
|
1692
|
-
$.$mol_dev_format_table = $mol_dev_format_element.bind(null, 'table');
|
|
1693
|
-
$.$mol_dev_format_tr = $mol_dev_format_element.bind(null, 'tr');
|
|
1694
|
-
$.$mol_dev_format_td = $mol_dev_format_element.bind(null, 'td');
|
|
1695
|
-
$.$mol_dev_format_accent = $mol_dev_format_span.bind(null, {
|
|
1696
|
-
'color': 'magenta',
|
|
1697
|
-
});
|
|
1698
|
-
$.$mol_dev_format_strong = $mol_dev_format_span.bind(null, {
|
|
1699
|
-
'font-weight': 'bold',
|
|
1700
|
-
});
|
|
1701
|
-
$.$mol_dev_format_string = $mol_dev_format_span.bind(null, {
|
|
1702
|
-
'color': 'green',
|
|
1703
|
-
});
|
|
1704
|
-
$.$mol_dev_format_shade = $mol_dev_format_span.bind(null, {
|
|
1705
|
-
'color': 'gray',
|
|
1706
|
-
});
|
|
1707
|
-
$.$mol_dev_format_indent = $.$mol_dev_format_div.bind(null, {
|
|
1708
|
-
'margin-left': '13px'
|
|
1709
|
-
});
|
|
1710
|
-
})($ || ($ = {}));
|
|
1711
|
-
//format.js.map
|
|
1712
|
-
;
|
|
1713
|
-
"use strict";
|
|
1714
|
-
var $;
|
|
1715
|
-
(function ($_1) {
|
|
1716
|
-
$_1.$mol_test_mocks.push(async ($) => {
|
|
1717
|
-
await $_1.$mol_fiber_warp();
|
|
1718
|
-
$_1.$mol_fiber.deadline = Date.now() + 100;
|
|
1719
|
-
});
|
|
1720
|
-
$_1.$mol_test({
|
|
1721
|
-
'sync to async': async ($) => {
|
|
1722
|
-
const sum = $_1.$mol_fiber_async((a, b) => a + b);
|
|
1723
|
-
const res = await sum(1, 2);
|
|
1724
|
-
$_1.$mol_assert_equal(res, 3);
|
|
1725
|
-
},
|
|
1726
|
-
});
|
|
1727
|
-
})($ || ($ = {}));
|
|
1728
|
-
//fiber.test.js.map
|
|
1729
|
-
;
|
|
1730
|
-
"use strict";
|
|
1731
|
-
var $;
|
|
1732
|
-
(function ($) {
|
|
1733
|
-
function $mol_fiber_defer(calculate) {
|
|
1734
|
-
const fiber = new $mol_fiber;
|
|
1735
|
-
fiber.calculate = calculate;
|
|
1736
|
-
fiber[Symbol.toStringTag] = calculate.name;
|
|
1737
|
-
fiber.schedule();
|
|
1738
|
-
return fiber;
|
|
1739
|
-
}
|
|
1740
|
-
$.$mol_fiber_defer = $mol_fiber_defer;
|
|
1741
|
-
function $mol_fiber_func(calculate) {
|
|
1742
|
-
$.$mol_ambient({}).$mol_log3_warn({
|
|
1743
|
-
place: '$mol_fiber_func',
|
|
1744
|
-
message: 'Deprecated',
|
|
1745
|
-
hint: 'Use $mol_fiber.func instead',
|
|
1746
|
-
});
|
|
1747
|
-
return $mol_fiber.func(calculate);
|
|
1748
|
-
}
|
|
1749
|
-
$.$mol_fiber_func = $mol_fiber_func;
|
|
1750
|
-
function $mol_fiber_root(calculate) {
|
|
1751
|
-
const wrapper = function (...args) {
|
|
1752
|
-
const fiber = new $mol_fiber();
|
|
1753
|
-
fiber.calculate = calculate.bind(this, ...args);
|
|
1754
|
-
fiber[Symbol.toStringTag] = wrapper[Symbol.toStringTag];
|
|
1755
|
-
return fiber.wake();
|
|
1756
|
-
};
|
|
1757
|
-
wrapper[Symbol.toStringTag] = calculate.name;
|
|
1758
|
-
return wrapper;
|
|
1759
|
-
}
|
|
1760
|
-
$.$mol_fiber_root = $mol_fiber_root;
|
|
1761
|
-
function $mol_fiber_method(obj, name, descr) {
|
|
1762
|
-
$.$mol_ambient({}).$mol_log3_warn({
|
|
1763
|
-
place: '$mol_fiber_method',
|
|
1764
|
-
message: 'Deprecated',
|
|
1765
|
-
hint: 'Use $mol_fiber.method instead',
|
|
1766
|
-
});
|
|
1767
|
-
return $mol_fiber.method(obj, name, descr);
|
|
1768
|
-
}
|
|
1769
|
-
$.$mol_fiber_method = $mol_fiber_method;
|
|
1770
|
-
function $mol_fiber_async(task) {
|
|
1771
|
-
return (...args) => new Promise($mol_fiber_root((done, fail) => {
|
|
1772
|
-
try {
|
|
1773
|
-
done(task(...args));
|
|
1774
|
-
}
|
|
1775
|
-
catch (error) {
|
|
1776
|
-
if ('then' in error)
|
|
1777
|
-
return $.$mol_fail_hidden(error);
|
|
1778
|
-
fail(error);
|
|
1779
|
-
}
|
|
1780
|
-
}));
|
|
1781
|
-
}
|
|
1782
|
-
$.$mol_fiber_async = $mol_fiber_async;
|
|
1783
|
-
function $mol_fiber_sync(request) {
|
|
1784
|
-
return function $mol_fiber_sync_wrapper(...args) {
|
|
1785
|
-
const slave = $mol_fiber.current;
|
|
1786
|
-
let master = slave && slave.master;
|
|
1787
|
-
if (!master || master.constructor !== $mol_fiber) {
|
|
1788
|
-
master = new $mol_fiber;
|
|
1789
|
-
master.cursor = -3;
|
|
1790
|
-
master.error = request.call(this, ...args).then((next) => master.push(next), (error) => master.fail(error));
|
|
1791
|
-
const prefix = slave ? `${slave}/${slave.cursor / 2}:` : '/';
|
|
1792
|
-
master[Symbol.toStringTag] = prefix + (request.name || $mol_fiber_sync.name);
|
|
1793
|
-
}
|
|
1794
|
-
return master.get();
|
|
1795
|
-
};
|
|
1796
|
-
}
|
|
1797
|
-
$.$mol_fiber_sync = $mol_fiber_sync;
|
|
1798
|
-
async function $mol_fiber_warp() {
|
|
1799
|
-
const deadline = $mol_fiber.deadline;
|
|
1800
|
-
try {
|
|
1801
|
-
$mol_fiber.deadline = Number.POSITIVE_INFINITY;
|
|
1802
|
-
while ($mol_fiber.queue.length)
|
|
1803
|
-
await $mol_fiber.tick();
|
|
1804
|
-
return Promise.resolve();
|
|
1805
|
-
}
|
|
1806
|
-
finally {
|
|
1807
|
-
$mol_fiber.deadline = deadline;
|
|
1808
|
-
}
|
|
1809
|
-
}
|
|
1810
|
-
$.$mol_fiber_warp = $mol_fiber_warp;
|
|
1811
|
-
function $mol_fiber_fence(func) {
|
|
1812
|
-
const prev = $mol_fiber.current;
|
|
1813
|
-
try {
|
|
1814
|
-
$mol_fiber.current = null;
|
|
1815
|
-
return func();
|
|
1816
|
-
}
|
|
1817
|
-
finally {
|
|
1818
|
-
$mol_fiber.current = prev;
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
|
-
$.$mol_fiber_fence = $mol_fiber_fence;
|
|
1822
|
-
function $mol_fiber_unlimit(task) {
|
|
1823
|
-
const deadline = $mol_fiber.deadline;
|
|
1824
|
-
try {
|
|
1825
|
-
$mol_fiber.deadline = Number.POSITIVE_INFINITY;
|
|
1826
|
-
return task();
|
|
1827
|
-
}
|
|
1828
|
-
finally {
|
|
1829
|
-
$mol_fiber.deadline = deadline;
|
|
1830
|
-
}
|
|
1831
|
-
}
|
|
1832
|
-
$.$mol_fiber_unlimit = $mol_fiber_unlimit;
|
|
1833
|
-
class $mol_fiber_solid extends $.$mol_wrapper {
|
|
1834
|
-
static func(task) {
|
|
1835
|
-
function wrapped(...args) {
|
|
1836
|
-
const deadline = $mol_fiber.deadline;
|
|
1837
|
-
try {
|
|
1838
|
-
$mol_fiber.deadline = Number.POSITIVE_INFINITY;
|
|
1839
|
-
return task.call(this, ...args);
|
|
1840
|
-
}
|
|
1841
|
-
catch (error) {
|
|
1842
|
-
if ('then' in error)
|
|
1843
|
-
$.$mol_fail(new Error('Solid fiber can not be suspended.'));
|
|
1844
|
-
return $.$mol_fail_hidden(error);
|
|
1845
|
-
}
|
|
1846
|
-
finally {
|
|
1847
|
-
$mol_fiber.deadline = deadline;
|
|
1848
|
-
}
|
|
1849
|
-
}
|
|
1850
|
-
return $mol_fiber.func(wrapped);
|
|
1851
|
-
}
|
|
1852
|
-
}
|
|
1853
|
-
$.$mol_fiber_solid = $mol_fiber_solid;
|
|
1854
|
-
class $mol_fiber extends $.$mol_wrapper {
|
|
1855
|
-
constructor() {
|
|
1856
|
-
super(...arguments);
|
|
1857
|
-
this.cursor = 0;
|
|
1858
|
-
this.masters = [];
|
|
1859
|
-
this._value = undefined;
|
|
1860
|
-
this._error = null;
|
|
1861
|
-
}
|
|
1862
|
-
static wrap(task) {
|
|
1863
|
-
return function $mol_fiber_wrapper(...args) {
|
|
1864
|
-
const slave = $mol_fiber.current;
|
|
1865
|
-
let master = slave && slave.master;
|
|
1866
|
-
if (!master || master.constructor !== $mol_fiber) {
|
|
1867
|
-
master = new $mol_fiber;
|
|
1868
|
-
master.calculate = task.bind(this, ...args);
|
|
1869
|
-
const prefix = slave ? `${slave}/${slave.cursor / 2}:` : '/';
|
|
1870
|
-
master[Symbol.toStringTag] = `${prefix}${task.name}`;
|
|
1871
|
-
}
|
|
1872
|
-
return master.get();
|
|
1873
|
-
};
|
|
1874
|
-
}
|
|
1875
|
-
static async tick() {
|
|
1876
|
-
while ($mol_fiber.queue.length > 0) {
|
|
1877
|
-
const now = Date.now();
|
|
1878
|
-
if (now >= $mol_fiber.deadline) {
|
|
1879
|
-
$mol_fiber.schedule();
|
|
1880
|
-
$mol_fiber.liveline = now;
|
|
1881
|
-
return;
|
|
1882
|
-
}
|
|
1883
|
-
const task = $mol_fiber.queue.shift();
|
|
1884
|
-
await task();
|
|
1885
|
-
}
|
|
1886
|
-
}
|
|
1887
|
-
static schedule() {
|
|
1888
|
-
if (!$mol_fiber.scheduled) {
|
|
1889
|
-
$mol_fiber.scheduled = new $.$mol_after_frame(async () => {
|
|
1890
|
-
const now = Date.now();
|
|
1891
|
-
let quant = $mol_fiber.quant;
|
|
1892
|
-
if ($mol_fiber.liveline) {
|
|
1893
|
-
quant = Math.max(quant, Math.floor((now - $mol_fiber.liveline) / 2));
|
|
1894
|
-
$mol_fiber.liveline = 0;
|
|
1895
|
-
}
|
|
1896
|
-
$mol_fiber.deadline = now + quant;
|
|
1897
|
-
$mol_fiber.scheduled = null;
|
|
1898
|
-
await $mol_fiber.tick();
|
|
1899
|
-
});
|
|
1900
|
-
}
|
|
1901
|
-
const promise = new this.$.Promise(done => this.queue.push(() => (done(null), promise)));
|
|
1902
|
-
return promise;
|
|
1903
|
-
}
|
|
1904
|
-
get value() { return this._value; }
|
|
1905
|
-
set value(next) {
|
|
1906
|
-
this._value = next;
|
|
1907
|
-
}
|
|
1908
|
-
get error() { return this._error; }
|
|
1909
|
-
set error(next) {
|
|
1910
|
-
this._error = next;
|
|
1911
|
-
}
|
|
1912
|
-
schedule() {
|
|
1913
|
-
$mol_fiber.schedule().then(() => this.wake());
|
|
1914
|
-
}
|
|
1915
|
-
wake() {
|
|
1916
|
-
const unscoupe = this.$.$mol_log3_area_lazy({
|
|
1917
|
-
place: this,
|
|
1918
|
-
message: 'Wake'
|
|
1919
|
-
});
|
|
1920
|
-
try {
|
|
1921
|
-
if (this.cursor > -2)
|
|
1922
|
-
return this.get();
|
|
1923
|
-
}
|
|
1924
|
-
catch (error) {
|
|
1925
|
-
if ('then' in error)
|
|
1926
|
-
return;
|
|
1927
|
-
$.$mol_fail_hidden(error);
|
|
1928
|
-
}
|
|
1929
|
-
finally {
|
|
1930
|
-
unscoupe();
|
|
1931
|
-
}
|
|
1932
|
-
}
|
|
1933
|
-
push(value) {
|
|
1934
|
-
value = this.$.$mol_conform(value, this.value);
|
|
1935
|
-
if (this.error !== null || !Object.is(this.value, value)) {
|
|
1936
|
-
if ($mol_fiber.logs)
|
|
1937
|
-
this.$.$mol_log3_done({
|
|
1938
|
-
place: this,
|
|
1939
|
-
message: 'Changed',
|
|
1940
|
-
next: value,
|
|
1941
|
-
value: this.value,
|
|
1942
|
-
error: this.error,
|
|
1943
|
-
});
|
|
1944
|
-
this.obsolete_slaves();
|
|
1945
|
-
this.forget();
|
|
1946
|
-
}
|
|
1947
|
-
else {
|
|
1948
|
-
if ($mol_fiber.logs)
|
|
1949
|
-
this.$.$mol_log3_done({
|
|
1950
|
-
place: this,
|
|
1951
|
-
message: 'Same value',
|
|
1952
|
-
value,
|
|
1953
|
-
});
|
|
1954
|
-
}
|
|
1955
|
-
this.error = null;
|
|
1956
|
-
this.value = value;
|
|
1957
|
-
this.complete();
|
|
1958
|
-
return value;
|
|
1959
|
-
}
|
|
1960
|
-
fail(error) {
|
|
1961
|
-
this.complete();
|
|
1962
|
-
if ($mol_fiber.logs)
|
|
1963
|
-
this.$.$mol_log3_fail({
|
|
1964
|
-
place: this,
|
|
1965
|
-
message: error.message,
|
|
1966
|
-
});
|
|
1967
|
-
this.error = error;
|
|
1968
|
-
this.obsolete_slaves();
|
|
1969
|
-
return error;
|
|
1970
|
-
}
|
|
1971
|
-
wait(promise) {
|
|
1972
|
-
this.error = promise;
|
|
1973
|
-
if ($mol_fiber.logs)
|
|
1974
|
-
this.$.$mol_log3_warn({
|
|
1975
|
-
place: this,
|
|
1976
|
-
message: `Wait`,
|
|
1977
|
-
hint: `Don't panic, it's normal`,
|
|
1978
|
-
promise,
|
|
1979
|
-
});
|
|
1980
|
-
this.cursor = 0;
|
|
1981
|
-
return promise;
|
|
1982
|
-
}
|
|
1983
|
-
complete() {
|
|
1984
|
-
if (this.cursor <= -2)
|
|
1985
|
-
return;
|
|
1986
|
-
for (let index = 0; index < this.masters.length; index += 2) {
|
|
1987
|
-
this.complete_master(index);
|
|
1988
|
-
}
|
|
1989
|
-
this.cursor = -2;
|
|
1990
|
-
}
|
|
1991
|
-
complete_master(master_index) {
|
|
1992
|
-
this.disobey(master_index);
|
|
1993
|
-
}
|
|
1994
|
-
pull() {
|
|
1995
|
-
if ($mol_fiber.logs)
|
|
1996
|
-
this.$.$mol_log3_come({
|
|
1997
|
-
place: this,
|
|
1998
|
-
message: 'Pull',
|
|
1999
|
-
});
|
|
2000
|
-
this.push(this.calculate());
|
|
2001
|
-
}
|
|
2002
|
-
update() {
|
|
2003
|
-
const slave = $mol_fiber.current;
|
|
2004
|
-
try {
|
|
2005
|
-
$mol_fiber.current = this;
|
|
2006
|
-
this.pull();
|
|
2007
|
-
}
|
|
2008
|
-
catch (error) {
|
|
2009
|
-
if (Object(error) !== error)
|
|
2010
|
-
error = new Error(error);
|
|
2011
|
-
if ('then' in error) {
|
|
2012
|
-
if (!slave) {
|
|
2013
|
-
const listener = () => this.wake();
|
|
2014
|
-
error = error.then(listener, listener);
|
|
2015
|
-
}
|
|
2016
|
-
this.wait(error);
|
|
2017
|
-
}
|
|
2018
|
-
else {
|
|
2019
|
-
this.fail(error);
|
|
2020
|
-
}
|
|
2021
|
-
}
|
|
2022
|
-
finally {
|
|
2023
|
-
$mol_fiber.current = slave;
|
|
2024
|
-
}
|
|
2025
|
-
}
|
|
2026
|
-
get() {
|
|
2027
|
-
if (this.cursor > 0) {
|
|
2028
|
-
this.$.$mol_fail(new Error(`Cyclic dependency at ${this}`));
|
|
2029
|
-
}
|
|
2030
|
-
const slave = $mol_fiber.current;
|
|
2031
|
-
if (slave)
|
|
2032
|
-
slave.master = this;
|
|
2033
|
-
if (this.cursor > -2)
|
|
2034
|
-
this.update();
|
|
2035
|
-
if (this.error !== null)
|
|
2036
|
-
return this.$.$mol_fail_hidden(this.error);
|
|
2037
|
-
return this.value;
|
|
2038
|
-
}
|
|
2039
|
-
limit() {
|
|
2040
|
-
if (!$mol_fiber.deadline)
|
|
2041
|
-
return;
|
|
2042
|
-
if (!$mol_fiber.current)
|
|
2043
|
-
return;
|
|
2044
|
-
if (Date.now() < $mol_fiber.deadline)
|
|
2045
|
-
return;
|
|
2046
|
-
this.$.$mol_fail_hidden($mol_fiber.schedule());
|
|
2047
|
-
}
|
|
2048
|
-
get master() {
|
|
2049
|
-
return this.masters[this.cursor];
|
|
2050
|
-
}
|
|
2051
|
-
set master(next) {
|
|
2052
|
-
if (this.cursor === -1)
|
|
2053
|
-
return;
|
|
2054
|
-
const cursor = this.cursor;
|
|
2055
|
-
const prev = this.masters[this.cursor];
|
|
2056
|
-
if (prev !== next) {
|
|
2057
|
-
if (prev)
|
|
2058
|
-
this.rescue(prev, cursor);
|
|
2059
|
-
this.masters[cursor] = next;
|
|
2060
|
-
this.masters[cursor + 1] = this.obey(next, cursor);
|
|
2061
|
-
}
|
|
2062
|
-
this.cursor = cursor + 2;
|
|
2063
|
-
}
|
|
2064
|
-
rescue(master, master_index) { }
|
|
2065
|
-
obey(master, master_index) { return -1; }
|
|
2066
|
-
lead(slave, master_index) { return -1; }
|
|
2067
|
-
dislead(slave_index) {
|
|
2068
|
-
this.destructor();
|
|
2069
|
-
}
|
|
2070
|
-
disobey(master_index) {
|
|
2071
|
-
const master = this.masters[master_index];
|
|
2072
|
-
if (!master)
|
|
2073
|
-
return;
|
|
2074
|
-
master.dislead(this.masters[master_index + 1]);
|
|
2075
|
-
this.masters[master_index] = undefined;
|
|
2076
|
-
this.masters[master_index + 1] = undefined;
|
|
2077
|
-
this.$.$mol_array_trim(this.masters);
|
|
2078
|
-
}
|
|
2079
|
-
obsolete_slaves() { }
|
|
2080
|
-
obsolete(master_index) { }
|
|
2081
|
-
forget() {
|
|
2082
|
-
this.value = undefined;
|
|
2083
|
-
}
|
|
2084
|
-
abort() {
|
|
2085
|
-
this.forget();
|
|
2086
|
-
return true;
|
|
2087
|
-
}
|
|
2088
|
-
destructor() {
|
|
2089
|
-
if (!this.abort())
|
|
2090
|
-
return;
|
|
2091
|
-
if ($mol_fiber.logs)
|
|
2092
|
-
this.$.$mol_log3_done({
|
|
2093
|
-
place: this,
|
|
2094
|
-
message: 'Destructed',
|
|
2095
|
-
});
|
|
2096
|
-
this.complete();
|
|
2097
|
-
}
|
|
2098
|
-
[$.$mol_dev_format_head]() {
|
|
2099
|
-
return $.$mol_dev_format_native(this);
|
|
2100
|
-
}
|
|
2101
|
-
}
|
|
2102
|
-
$mol_fiber.logs = false;
|
|
2103
|
-
$mol_fiber.quant = 16;
|
|
2104
|
-
$mol_fiber.deadline = 0;
|
|
2105
|
-
$mol_fiber.liveline = 0;
|
|
2106
|
-
$mol_fiber.current = null;
|
|
2107
|
-
$mol_fiber.scheduled = null;
|
|
2108
|
-
$mol_fiber.queue = [];
|
|
2109
|
-
$.$mol_fiber = $mol_fiber;
|
|
2110
|
-
})($ || ($ = {}));
|
|
2111
|
-
//fiber.js.map
|
|
2112
|
-
;
|
|
2113
|
-
"use strict";
|
|
2114
|
-
var $;
|
|
2115
|
-
(function ($) {
|
|
2116
|
-
class $mol_defer extends $.$mol_object {
|
|
2117
|
-
constructor(run) {
|
|
2118
|
-
super();
|
|
2119
|
-
this.run = run;
|
|
2120
|
-
$mol_defer.add(this);
|
|
2121
|
-
}
|
|
2122
|
-
destructor() {
|
|
2123
|
-
$mol_defer.drop(this);
|
|
2124
|
-
}
|
|
2125
|
-
static schedule() {
|
|
2126
|
-
if (this.timer)
|
|
2127
|
-
return;
|
|
2128
|
-
this.timer = this.scheduleNative(() => {
|
|
2129
|
-
this.timer = null;
|
|
2130
|
-
this.run();
|
|
2131
|
-
});
|
|
2132
|
-
}
|
|
2133
|
-
static unschedule() {
|
|
2134
|
-
if (!this.timer)
|
|
2135
|
-
return;
|
|
2136
|
-
cancelAnimationFrame(this.timer);
|
|
2137
|
-
this.timer = null;
|
|
2138
|
-
}
|
|
2139
|
-
static add(defer) {
|
|
2140
|
-
this.all.push(defer);
|
|
2141
|
-
this.schedule();
|
|
2142
|
-
}
|
|
2143
|
-
static drop(defer) {
|
|
2144
|
-
var index = this.all.indexOf(defer);
|
|
2145
|
-
if (index >= 0)
|
|
2146
|
-
this.all.splice(index, 1);
|
|
2147
|
-
}
|
|
2148
|
-
static run() {
|
|
2149
|
-
if (this.all.length === 0)
|
|
2150
|
-
return;
|
|
2151
|
-
this.schedule();
|
|
2152
|
-
for (var defer; defer = this.all.shift();)
|
|
2153
|
-
defer.run();
|
|
2154
|
-
}
|
|
2155
|
-
}
|
|
2156
|
-
$mol_defer.all = [];
|
|
2157
|
-
$mol_defer.timer = null;
|
|
2158
|
-
$mol_defer.scheduleNative = (typeof requestAnimationFrame == 'function')
|
|
2159
|
-
? handler => requestAnimationFrame(handler)
|
|
2160
|
-
: handler => setTimeout(handler, 16);
|
|
2161
|
-
$.$mol_defer = $mol_defer;
|
|
2162
|
-
})($ || ($ = {}));
|
|
2163
|
-
//defer.js.map
|
|
2164
|
-
;
|
|
2165
|
-
"use strict";
|
|
2166
|
-
var $;
|
|
2167
|
-
(function ($_1) {
|
|
2168
|
-
$_1.$mol_test({
|
|
2169
|
-
'Value has js-path name'() {
|
|
2170
|
-
class App extends $_1.$mol_object2 {
|
|
2171
|
-
static get title() { return new $_1.$mol_object2; }
|
|
2172
|
-
}
|
|
2173
|
-
__decorate([
|
|
2174
|
-
$_1.$mol_atom2_field
|
|
2175
|
-
], App, "title", null);
|
|
2176
|
-
$_1.$mol_assert_equal(`${App.title}`, 'App.title');
|
|
2177
|
-
},
|
|
2178
|
-
'Simple property'() {
|
|
2179
|
-
class App extends $_1.$mol_object2 {
|
|
2180
|
-
}
|
|
2181
|
-
App.value = 1;
|
|
2182
|
-
__decorate([
|
|
2183
|
-
$_1.$mol_atom2_field
|
|
2184
|
-
], App, "value", void 0);
|
|
2185
|
-
$_1.$mol_assert_equal(App.value, 1);
|
|
2186
|
-
App.value = 2;
|
|
2187
|
-
$_1.$mol_assert_equal(App.value, 2);
|
|
2188
|
-
},
|
|
2189
|
-
'Instant actualization'($) {
|
|
2190
|
-
class Source extends $_1.$mol_object2 {
|
|
2191
|
-
constructor() {
|
|
2192
|
-
super(...arguments);
|
|
2193
|
-
this.value = 1;
|
|
2194
|
-
}
|
|
2195
|
-
get $() { return $; }
|
|
2196
|
-
destructor() { }
|
|
2197
|
-
}
|
|
2198
|
-
__decorate([
|
|
2199
|
-
$_1.$mol_atom2_field
|
|
2200
|
-
], Source.prototype, "value", void 0);
|
|
2201
|
-
class App extends $_1.$mol_object2 {
|
|
2202
|
-
static get $() { return $; }
|
|
2203
|
-
static get source() { return Source.create(); }
|
|
2204
|
-
static get value() { return this.source.value + 1; }
|
|
2205
|
-
}
|
|
2206
|
-
__decorate([
|
|
2207
|
-
$_1.$mol_atom2_field
|
|
2208
|
-
], App, "source", null);
|
|
2209
|
-
__decorate([
|
|
2210
|
-
$_1.$mol_atom2_field
|
|
2211
|
-
], App, "value", null);
|
|
2212
|
-
$_1.$mol_assert_equal(App.value, 2);
|
|
2213
|
-
App.source.value = 2;
|
|
2214
|
-
$_1.$mol_assert_equal(App.value, 3);
|
|
2215
|
-
},
|
|
2216
|
-
'Access to cached value'($) {
|
|
2217
|
-
class App extends $_1.$mol_object2 {
|
|
2218
|
-
static get $() { return $; }
|
|
2219
|
-
static get value() { return 1; }
|
|
2220
|
-
}
|
|
2221
|
-
__decorate([
|
|
2222
|
-
$_1.$mol_atom2_field
|
|
2223
|
-
], App, "value", null);
|
|
2224
|
-
$_1.$mol_assert_equal($_1.$mol_atom2_value(() => App.value), undefined);
|
|
2225
|
-
$_1.$mol_assert_equal(App.value, 1);
|
|
2226
|
-
$_1.$mol_assert_equal($_1.$mol_atom2_value(() => App.value), 1);
|
|
2227
|
-
},
|
|
2228
|
-
'Do not recalc slaves on equal changes'($) {
|
|
2229
|
-
class App extends $_1.$mol_object2 {
|
|
2230
|
-
static get $() { return $; }
|
|
2231
|
-
static get result() { return this.first[0] + this.counter++; }
|
|
2232
|
-
}
|
|
2233
|
-
App.first = [1];
|
|
2234
|
-
App.counter = 0;
|
|
2235
|
-
__decorate([
|
|
2236
|
-
$_1.$mol_atom2_field
|
|
2237
|
-
], App, "first", void 0);
|
|
2238
|
-
__decorate([
|
|
2239
|
-
$_1.$mol_atom2_field
|
|
2240
|
-
], App, "result", null);
|
|
2241
|
-
$_1.$mol_assert_equal(App.result, 1);
|
|
2242
|
-
App.first = [1];
|
|
2243
|
-
$_1.$mol_assert_equal(App.result, 1);
|
|
2244
|
-
},
|
|
2245
|
-
'Do not recalc grand slave on equal direct slave result '($) {
|
|
2246
|
-
class App extends $_1.$mol_object2 {
|
|
2247
|
-
static get $() { return $; }
|
|
2248
|
-
static get second() { return Math.abs(this.first); }
|
|
2249
|
-
static get result() { return this.second + ++this.counter; }
|
|
2250
|
-
}
|
|
2251
|
-
App.first = 1;
|
|
2252
|
-
App.counter = 0;
|
|
2253
|
-
__decorate([
|
|
2254
|
-
$_1.$mol_atom2_field
|
|
2255
|
-
], App, "first", void 0);
|
|
2256
|
-
__decorate([
|
|
2257
|
-
$_1.$mol_atom2_field
|
|
2258
|
-
], App, "second", null);
|
|
2259
|
-
__decorate([
|
|
2260
|
-
$_1.$mol_atom2_field
|
|
2261
|
-
], App, "result", null);
|
|
2262
|
-
$_1.$mol_assert_equal(App.result, 2);
|
|
2263
|
-
App.first = -1;
|
|
2264
|
-
$_1.$mol_assert_equal(App.result, 2);
|
|
2265
|
-
},
|
|
2266
|
-
'Recalc when [not changed master] changes [following master]'($) {
|
|
2267
|
-
class App extends $_1.$mol_object2 {
|
|
2268
|
-
static get $() { return $; }
|
|
2269
|
-
static get second() {
|
|
2270
|
-
this.third = this.first;
|
|
2271
|
-
return 0;
|
|
2272
|
-
}
|
|
2273
|
-
static get result() { return this.second + this.third + ++this.counter; }
|
|
2274
|
-
}
|
|
2275
|
-
App.first = 1;
|
|
2276
|
-
App.third = 0;
|
|
2277
|
-
App.counter = 0;
|
|
2278
|
-
__decorate([
|
|
2279
|
-
$_1.$mol_atom2_field
|
|
2280
|
-
], App, "first", void 0);
|
|
2281
|
-
__decorate([
|
|
2282
|
-
$_1.$mol_atom2_field
|
|
2283
|
-
], App, "second", null);
|
|
2284
|
-
__decorate([
|
|
2285
|
-
$_1.$mol_atom2_field
|
|
2286
|
-
], App, "third", void 0);
|
|
2287
|
-
__decorate([
|
|
2288
|
-
$_1.$mol_atom2_field
|
|
2289
|
-
], App, "result", null);
|
|
2290
|
-
$_1.$mol_assert_equal(App.result, 2);
|
|
2291
|
-
App.first = 5;
|
|
2292
|
-
$_1.$mol_assert_equal(App.result, 7);
|
|
2293
|
-
},
|
|
2294
|
-
'Branch switching'($) {
|
|
2295
|
-
class App extends $_1.$mol_object2 {
|
|
2296
|
-
static get $() { return $; }
|
|
2297
|
-
static get second() { return 2; }
|
|
2298
|
-
static get result() {
|
|
2299
|
-
return (this.condition ? this.first : this.second) + this.counter++;
|
|
2300
|
-
}
|
|
2301
|
-
}
|
|
2302
|
-
App.first = 1;
|
|
2303
|
-
App.condition = true;
|
|
2304
|
-
App.counter = 0;
|
|
2305
|
-
__decorate([
|
|
2306
|
-
$_1.$mol_atom2_field
|
|
2307
|
-
], App, "first", void 0);
|
|
2308
|
-
__decorate([
|
|
2309
|
-
$_1.$mol_atom2_field
|
|
2310
|
-
], App, "second", null);
|
|
2311
|
-
__decorate([
|
|
2312
|
-
$_1.$mol_atom2_field
|
|
2313
|
-
], App, "condition", void 0);
|
|
2314
|
-
__decorate([
|
|
2315
|
-
$_1.$mol_atom2_field
|
|
2316
|
-
], App, "result", null);
|
|
2317
|
-
$_1.$mol_assert_equal(App.result, 1);
|
|
2318
|
-
App.condition = false;
|
|
2319
|
-
$_1.$mol_assert_equal(App.result, 3);
|
|
2320
|
-
App.first = 10;
|
|
2321
|
-
$_1.$mol_assert_equal(App.result, 3);
|
|
2322
|
-
},
|
|
2323
|
-
'Forbidden self invalidation'($) {
|
|
2324
|
-
class App extends $_1.$mol_object2 {
|
|
2325
|
-
static get $() { return $; }
|
|
2326
|
-
static get second() { return this.first + 1; }
|
|
2327
|
-
static get result() {
|
|
2328
|
-
this.second;
|
|
2329
|
-
return this.first++;
|
|
2330
|
-
}
|
|
2331
|
-
}
|
|
2332
|
-
App.first = 1;
|
|
2333
|
-
__decorate([
|
|
2334
|
-
$_1.$mol_atom2_field
|
|
2335
|
-
], App, "first", void 0);
|
|
2336
|
-
__decorate([
|
|
2337
|
-
$_1.$mol_atom2_field
|
|
2338
|
-
], App, "second", null);
|
|
2339
|
-
__decorate([
|
|
2340
|
-
$_1.$mol_atom2_field
|
|
2341
|
-
], App, "result", null);
|
|
2342
|
-
$_1.$mol_assert_fail(() => App.result);
|
|
2343
|
-
},
|
|
2344
|
-
'Side effect inside computation'($) {
|
|
2345
|
-
class App extends $_1.$mol_object2 {
|
|
2346
|
-
static get $() { return $; }
|
|
2347
|
-
static increase() { return ++this.first; }
|
|
2348
|
-
static get result() {
|
|
2349
|
-
return this.increase() + 1;
|
|
2350
|
-
}
|
|
2351
|
-
}
|
|
2352
|
-
App.first = 1;
|
|
2353
|
-
__decorate([
|
|
2354
|
-
$_1.$mol_atom2_field
|
|
2355
|
-
], App, "first", void 0);
|
|
2356
|
-
__decorate([
|
|
2357
|
-
$_1.$mol_fiber.method
|
|
2358
|
-
], App, "increase", null);
|
|
2359
|
-
__decorate([
|
|
2360
|
-
$_1.$mol_atom2_field
|
|
2361
|
-
], App, "result", null);
|
|
2362
|
-
$_1.$mol_assert_equal(App.result, 3);
|
|
2363
|
-
},
|
|
2364
|
-
'Forbidden cyclic dependency'($) {
|
|
2365
|
-
class App extends $_1.$mol_object2 {
|
|
2366
|
-
static get $() { return $; }
|
|
2367
|
-
static get first() { return this.second - 1; }
|
|
2368
|
-
static get second() { return this.first + 1; }
|
|
2369
|
-
}
|
|
2370
|
-
__decorate([
|
|
2371
|
-
$_1.$mol_atom2_field
|
|
2372
|
-
], App, "first", null);
|
|
2373
|
-
__decorate([
|
|
2374
|
-
$_1.$mol_atom2_field
|
|
2375
|
-
], App, "second", null);
|
|
2376
|
-
$_1.$mol_assert_fail(() => App.first);
|
|
2377
|
-
},
|
|
2378
|
-
'Forget sub fibers on complete'($) {
|
|
2379
|
-
class App extends $_1.$mol_object2 {
|
|
2380
|
-
static get $() { return $; }
|
|
2381
|
-
static count() { return this.counter++; }
|
|
2382
|
-
static get result() { return this.count() + this.data; }
|
|
2383
|
-
}
|
|
2384
|
-
App.counter = 0;
|
|
2385
|
-
App.data = 1;
|
|
2386
|
-
__decorate([
|
|
2387
|
-
$_1.$mol_fiber.method
|
|
2388
|
-
], App, "count", null);
|
|
2389
|
-
__decorate([
|
|
2390
|
-
$_1.$mol_atom2_field
|
|
2391
|
-
], App, "data", void 0);
|
|
2392
|
-
__decorate([
|
|
2393
|
-
$_1.$mol_atom2_field
|
|
2394
|
-
], App, "result", null);
|
|
2395
|
-
$_1.$mol_assert_equal(App.result, 1);
|
|
2396
|
-
App.data = 2;
|
|
2397
|
-
$_1.$mol_assert_equal(App.result, 3);
|
|
2398
|
-
},
|
|
2399
|
-
async 'Automatic destroy owned value on self destruction'($) {
|
|
2400
|
-
let counter = 0;
|
|
2401
|
-
class Having extends $_1.$mol_object2 {
|
|
2402
|
-
destructor() { counter++; }
|
|
2403
|
-
}
|
|
2404
|
-
class App extends $_1.$mol_object2 {
|
|
2405
|
-
static get $() { return $; }
|
|
2406
|
-
static get having() { return Having.create(); }
|
|
2407
|
-
static get result() {
|
|
2408
|
-
if (this.condition)
|
|
2409
|
-
this.having;
|
|
2410
|
-
return 0;
|
|
2411
|
-
}
|
|
2412
|
-
}
|
|
2413
|
-
App.condition = true;
|
|
2414
|
-
__decorate([
|
|
2415
|
-
$_1.$mol_atom2_field
|
|
2416
|
-
], App, "having", null);
|
|
2417
|
-
__decorate([
|
|
2418
|
-
$_1.$mol_atom2_field
|
|
2419
|
-
], App, "condition", void 0);
|
|
2420
|
-
__decorate([
|
|
2421
|
-
$_1.$mol_atom2_field
|
|
2422
|
-
], App, "result", null);
|
|
2423
|
-
App.result;
|
|
2424
|
-
App.condition = false;
|
|
2425
|
-
App.result;
|
|
2426
|
-
$_1.$mol_assert_equal(counter, 0);
|
|
2427
|
-
await $_1.$mol_fiber_warp();
|
|
2428
|
-
$_1.$mol_assert_equal(counter, 1);
|
|
2429
|
-
},
|
|
2430
|
-
async 'Do not destroy putted value'($) {
|
|
2431
|
-
class App extends $_1.$mol_object2 {
|
|
2432
|
-
static get $() { return $; }
|
|
2433
|
-
static get target() {
|
|
2434
|
-
return this.condition ? this.source : 0;
|
|
2435
|
-
}
|
|
2436
|
-
}
|
|
2437
|
-
App.condition = true;
|
|
2438
|
-
__decorate([
|
|
2439
|
-
$_1.$mol_atom2_field
|
|
2440
|
-
], App, "source", void 0);
|
|
2441
|
-
__decorate([
|
|
2442
|
-
$_1.$mol_atom2_field
|
|
2443
|
-
], App, "condition", void 0);
|
|
2444
|
-
__decorate([
|
|
2445
|
-
$_1.$mol_atom2_field
|
|
2446
|
-
], App, "target", null);
|
|
2447
|
-
App.source = 1;
|
|
2448
|
-
$_1.$mol_assert_equal(App.target, 1);
|
|
2449
|
-
App.condition = false;
|
|
2450
|
-
$_1.$mol_assert_equal(App.target, 0);
|
|
2451
|
-
await $_1.$mol_fiber_warp();
|
|
2452
|
-
App.condition = true;
|
|
2453
|
-
$_1.$mol_assert_equal(App.target, 1);
|
|
2454
|
-
},
|
|
2455
|
-
'Restore after error'($) {
|
|
2456
|
-
class App extends $_1.$mol_object2 {
|
|
2457
|
-
static get $() { return $; }
|
|
2458
|
-
static get broken() {
|
|
2459
|
-
if (this.condition)
|
|
2460
|
-
$_1.$mol_fail(new Error('test error'));
|
|
2461
|
-
return 1;
|
|
2462
|
-
}
|
|
2463
|
-
static get result() { return this.broken; }
|
|
2464
|
-
}
|
|
2465
|
-
App.condition = false;
|
|
2466
|
-
__decorate([
|
|
2467
|
-
$_1.$mol_atom2_field
|
|
2468
|
-
], App, "condition", void 0);
|
|
2469
|
-
__decorate([
|
|
2470
|
-
$_1.$mol_atom2_field
|
|
2471
|
-
], App, "broken", null);
|
|
2472
|
-
__decorate([
|
|
2473
|
-
$_1.$mol_atom2_field
|
|
2474
|
-
], App, "result", null);
|
|
2475
|
-
$_1.$mol_assert_equal(App.result, 1);
|
|
2476
|
-
App.condition = true;
|
|
2477
|
-
$_1.$mol_assert_fail(() => App.result);
|
|
2478
|
-
App.condition = false;
|
|
2479
|
-
$_1.$mol_assert_equal(App.result, 1);
|
|
2480
|
-
},
|
|
2481
|
-
async 'auto fresh only when alive'($) {
|
|
2482
|
-
let state = 1;
|
|
2483
|
-
const monitor = new $.$mol_atom2;
|
|
2484
|
-
monitor.$ = $;
|
|
2485
|
-
monitor.calculate = () => {
|
|
2486
|
-
new $.$mol_after_frame($_1.$mol_atom2.current.fresh);
|
|
2487
|
-
return state;
|
|
2488
|
-
};
|
|
2489
|
-
$_1.$mol_assert_equal(monitor.get(), 1);
|
|
2490
|
-
state = 2;
|
|
2491
|
-
$_1.$mol_assert_equal(monitor.get(), 1);
|
|
2492
|
-
$.$mol_after_mock_warp();
|
|
2493
|
-
$_1.$mol_assert_equal(monitor.get(), 2);
|
|
2494
|
-
state = 3;
|
|
2495
|
-
$_1.$mol_assert_equal(monitor.get(), 2);
|
|
2496
|
-
monitor.destructor();
|
|
2497
|
-
$_1.$mol_assert_equal(monitor.value, undefined);
|
|
2498
|
-
$.$mol_after_mock_warp();
|
|
2499
|
-
await $.$mol_fiber_warp();
|
|
2500
|
-
$_1.$mol_assert_equal(monitor.value, undefined);
|
|
2501
|
-
},
|
|
2502
|
-
});
|
|
2503
|
-
})($ || ($ = {}));
|
|
2504
|
-
//atom2.test.js.map
|
|
2505
|
-
;
|
|
2506
|
-
"use strict";
|
|
2507
|
-
var $;
|
|
2508
|
-
(function ($) {
|
|
2509
|
-
function $mol_atom2_value(task, next) {
|
|
2510
|
-
const cached = $mol_atom2.cached;
|
|
2511
|
-
try {
|
|
2512
|
-
$mol_atom2.cached = true;
|
|
2513
|
-
$mol_atom2.cached_next = next;
|
|
2514
|
-
return task();
|
|
2515
|
-
}
|
|
2516
|
-
finally {
|
|
2517
|
-
$mol_atom2.cached = cached;
|
|
2518
|
-
}
|
|
2519
|
-
}
|
|
2520
|
-
$.$mol_atom2_value = $mol_atom2_value;
|
|
2521
|
-
class $mol_atom2 extends $.$mol_fiber {
|
|
2522
|
-
constructor() {
|
|
2523
|
-
super(...arguments);
|
|
2524
|
-
this.slaves = [];
|
|
2525
|
-
}
|
|
2526
|
-
static get current() {
|
|
2527
|
-
const atom = $.$mol_fiber.current;
|
|
2528
|
-
if (atom instanceof $mol_atom2)
|
|
2529
|
-
return atom;
|
|
2530
|
-
return null;
|
|
2531
|
-
}
|
|
2532
|
-
static reap(atom) {
|
|
2533
|
-
this.reap_queue.push(atom);
|
|
2534
|
-
if (this.reap_task)
|
|
2535
|
-
return;
|
|
2536
|
-
this.reap_task = $.$mol_fiber_defer(() => {
|
|
2537
|
-
this.reap_task = null;
|
|
2538
|
-
while (true) {
|
|
2539
|
-
const atom = this.reap_queue.pop();
|
|
2540
|
-
if (!atom)
|
|
2541
|
-
break;
|
|
2542
|
-
if (!atom.alone)
|
|
2543
|
-
continue;
|
|
2544
|
-
atom.destructor();
|
|
2545
|
-
}
|
|
2546
|
-
});
|
|
2547
|
-
}
|
|
2548
|
-
rescue(master, cursor) {
|
|
2549
|
-
if (!(master instanceof $mol_atom2))
|
|
2550
|
-
return;
|
|
2551
|
-
const master_index = this.masters.length;
|
|
2552
|
-
const slave_index = this.masters[cursor + 1] + 1;
|
|
2553
|
-
master.slaves[slave_index] = master_index;
|
|
2554
|
-
this.masters.push(master, this.masters[cursor + 1]);
|
|
2555
|
-
}
|
|
2556
|
-
subscribe(promise) {
|
|
2557
|
-
const obsolete = () => this.obsolete();
|
|
2558
|
-
return promise.then(obsolete, obsolete);
|
|
2559
|
-
}
|
|
2560
|
-
get() {
|
|
2561
|
-
if ($mol_atom2.cached) {
|
|
2562
|
-
if ($mol_atom2.cached_next !== undefined) {
|
|
2563
|
-
this.push($mol_atom2.cached_next);
|
|
2564
|
-
$mol_atom2.cached_next = undefined;
|
|
2565
|
-
}
|
|
2566
|
-
return this.value;
|
|
2567
|
-
}
|
|
2568
|
-
const value = super.get();
|
|
2569
|
-
if (value === undefined)
|
|
2570
|
-
$.$mol_fail(new Error(`Not defined: ${this}`));
|
|
2571
|
-
return value;
|
|
2572
|
-
}
|
|
2573
|
-
pull() {
|
|
2574
|
-
if (this.cursor === 0)
|
|
2575
|
-
return super.pull();
|
|
2576
|
-
if ($mol_atom2.logs)
|
|
2577
|
-
this.$.$mol_log3_come({
|
|
2578
|
-
place: this,
|
|
2579
|
-
message: 'Check doubt masters',
|
|
2580
|
-
});
|
|
2581
|
-
const masters = this.masters;
|
|
2582
|
-
for (let index = 0; index < masters.length; index += 2) {
|
|
2583
|
-
const master = masters[index];
|
|
2584
|
-
if (!master)
|
|
2585
|
-
continue;
|
|
2586
|
-
try {
|
|
2587
|
-
master.get();
|
|
2588
|
-
}
|
|
2589
|
-
catch (error) {
|
|
2590
|
-
if ('then' in error)
|
|
2591
|
-
$.$mol_fail_hidden(error);
|
|
2592
|
-
this.cursor = 0;
|
|
2593
|
-
}
|
|
2594
|
-
if (this.cursor !== 0)
|
|
2595
|
-
continue;
|
|
2596
|
-
if ($mol_atom2.logs)
|
|
2597
|
-
this.$.$mol_log3_done({
|
|
2598
|
-
place: this,
|
|
2599
|
-
message: 'Obsoleted while checking',
|
|
2600
|
-
});
|
|
2601
|
-
return super.pull();
|
|
2602
|
-
}
|
|
2603
|
-
if ($mol_atom2.logs)
|
|
2604
|
-
this.$.$mol_log3_done({
|
|
2605
|
-
place: this,
|
|
2606
|
-
message: 'Masters not changed',
|
|
2607
|
-
});
|
|
2608
|
-
this.cursor = -2;
|
|
2609
|
-
}
|
|
2610
|
-
get value() { return this._value; }
|
|
2611
|
-
set value(next) {
|
|
2612
|
-
const prev = this._value;
|
|
2613
|
-
if (prev && this.$.$mol_owning_check(this, prev))
|
|
2614
|
-
prev.destructor();
|
|
2615
|
-
if (next && this.$.$mol_owning_catch(this, next)) {
|
|
2616
|
-
try {
|
|
2617
|
-
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
2618
|
-
}
|
|
2619
|
-
catch (_a) { }
|
|
2620
|
-
next[$.$mol_object_field] = this[$.$mol_object_field];
|
|
2621
|
-
}
|
|
2622
|
-
this._value = next;
|
|
2623
|
-
}
|
|
2624
|
-
get error() { return this._error; }
|
|
2625
|
-
set error(next) {
|
|
2626
|
-
const prev = this._error;
|
|
2627
|
-
if (prev && this.$.$mol_owning_check(this, prev))
|
|
2628
|
-
prev.destructor();
|
|
2629
|
-
if (next && this.$.$mol_owning_catch(this, next)) {
|
|
2630
|
-
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
2631
|
-
next[$.$mol_object_field] = this[$.$mol_object_field];
|
|
2632
|
-
}
|
|
2633
|
-
this._error = next;
|
|
2634
|
-
}
|
|
2635
|
-
put(next) {
|
|
2636
|
-
this.cursor = this.masters.length;
|
|
2637
|
-
next = this.push(next);
|
|
2638
|
-
this.cursor = -3;
|
|
2639
|
-
return next;
|
|
2640
|
-
}
|
|
2641
|
-
complete_master(master_index) {
|
|
2642
|
-
if (this.masters[master_index] instanceof $mol_atom2) {
|
|
2643
|
-
if (master_index >= this.cursor)
|
|
2644
|
-
this.disobey(master_index);
|
|
2645
|
-
}
|
|
2646
|
-
else {
|
|
2647
|
-
this.disobey(master_index);
|
|
2648
|
-
}
|
|
2649
|
-
}
|
|
2650
|
-
obey(master, master_index) {
|
|
2651
|
-
return master.lead(this, master_index);
|
|
2652
|
-
}
|
|
2653
|
-
lead(slave, master_index) {
|
|
2654
|
-
if ($mol_atom2.logs)
|
|
2655
|
-
this.$.$mol_log3_rise({
|
|
2656
|
-
place: this,
|
|
2657
|
-
message: 'Leads',
|
|
2658
|
-
slave,
|
|
2659
|
-
});
|
|
2660
|
-
const slave_index = this.slaves.length;
|
|
2661
|
-
this.slaves[slave_index] = slave;
|
|
2662
|
-
this.slaves[slave_index + 1] = master_index;
|
|
2663
|
-
return slave_index;
|
|
2664
|
-
}
|
|
2665
|
-
dislead(slave_index) {
|
|
2666
|
-
if (slave_index < 0)
|
|
2667
|
-
return;
|
|
2668
|
-
if ($mol_atom2.logs)
|
|
2669
|
-
this.$.$mol_log3_rise({
|
|
2670
|
-
place: this,
|
|
2671
|
-
message: 'Disleads',
|
|
2672
|
-
slave: this.slaves[slave_index],
|
|
2673
|
-
});
|
|
2674
|
-
this.slaves[slave_index] = undefined;
|
|
2675
|
-
this.slaves[slave_index + 1] = undefined;
|
|
2676
|
-
$.$mol_array_trim(this.slaves);
|
|
2677
|
-
if (this.cursor > -3 && this.alone)
|
|
2678
|
-
$mol_atom2.reap(this);
|
|
2679
|
-
}
|
|
2680
|
-
obsolete(master_index = -1) {
|
|
2681
|
-
if (this.cursor > 0) {
|
|
2682
|
-
if (master_index >= this.cursor - 2)
|
|
2683
|
-
return;
|
|
2684
|
-
const path = [];
|
|
2685
|
-
let current = this;
|
|
2686
|
-
collect: while (current) {
|
|
2687
|
-
path.push(current);
|
|
2688
|
-
current = current.masters[current.cursor - 2];
|
|
2689
|
-
}
|
|
2690
|
-
this.$.$mol_fail(new Error(`Obsoleted while calculation \n\n${path.join('\n')}\n`));
|
|
2691
|
-
}
|
|
2692
|
-
if (this.cursor === 0)
|
|
2693
|
-
return;
|
|
2694
|
-
if ($mol_atom2.logs)
|
|
2695
|
-
this.$.$mol_log3_rise({
|
|
2696
|
-
place: this,
|
|
2697
|
-
message: 'Obsoleted',
|
|
2698
|
-
});
|
|
2699
|
-
if (this.cursor !== -1)
|
|
2700
|
-
this.doubt_slaves();
|
|
2701
|
-
this.cursor = 0;
|
|
2702
|
-
}
|
|
2703
|
-
doubt(master_index = -1) {
|
|
2704
|
-
if (this.cursor > 0) {
|
|
2705
|
-
if (master_index >= this.cursor - 2)
|
|
2706
|
-
return;
|
|
2707
|
-
const path = [];
|
|
2708
|
-
let current = this;
|
|
2709
|
-
collect: while (current) {
|
|
2710
|
-
path.push(current);
|
|
2711
|
-
current = current.masters[current.cursor - 2];
|
|
2712
|
-
}
|
|
2713
|
-
this.$.$mol_fail(new Error(`Doubted while calculation \n\n${path.join('\n')}\n`));
|
|
2714
|
-
}
|
|
2715
|
-
if (this.cursor >= -1)
|
|
2716
|
-
return;
|
|
2717
|
-
if ($mol_atom2.logs)
|
|
2718
|
-
this.$.$mol_log3_rise({
|
|
2719
|
-
place: this,
|
|
2720
|
-
message: 'Doubted',
|
|
2721
|
-
});
|
|
2722
|
-
this.cursor = -1;
|
|
2723
|
-
this.doubt_slaves();
|
|
2724
|
-
}
|
|
2725
|
-
obsolete_slaves() {
|
|
2726
|
-
for (let index = 0; index < this.slaves.length; index += 2) {
|
|
2727
|
-
const slave = this.slaves[index];
|
|
2728
|
-
if (slave)
|
|
2729
|
-
slave.obsolete(this.slaves[index + 1]);
|
|
2730
|
-
}
|
|
2731
|
-
}
|
|
2732
|
-
doubt_slaves() {
|
|
2733
|
-
for (let index = 0; index < this.slaves.length; index += 2) {
|
|
2734
|
-
const slave = this.slaves[index];
|
|
2735
|
-
if (slave)
|
|
2736
|
-
slave.doubt(this.slaves[index + 1]);
|
|
2737
|
-
}
|
|
2738
|
-
}
|
|
2739
|
-
get fresh() {
|
|
2740
|
-
return () => {
|
|
2741
|
-
if (this.cursor !== -2)
|
|
2742
|
-
return;
|
|
2743
|
-
this.cursor = 0;
|
|
2744
|
-
$.$mol_fiber_solid.run(() => this.update());
|
|
2745
|
-
};
|
|
2746
|
-
}
|
|
2747
|
-
get alone() {
|
|
2748
|
-
return this.slaves.length === 0;
|
|
2749
|
-
}
|
|
2750
|
-
get derived() {
|
|
2751
|
-
for (let index = 0; index < this.masters.length; index += 2) {
|
|
2752
|
-
if (this.masters[index])
|
|
2753
|
-
return true;
|
|
2754
|
-
}
|
|
2755
|
-
return false;
|
|
2756
|
-
}
|
|
2757
|
-
destructor() {
|
|
2758
|
-
if (!this.abort())
|
|
2759
|
-
return;
|
|
2760
|
-
if ($mol_atom2.logs)
|
|
2761
|
-
this.$.$mol_log3_rise({
|
|
2762
|
-
place: this,
|
|
2763
|
-
message: 'Destructed'
|
|
2764
|
-
});
|
|
2765
|
-
this.cursor = -3;
|
|
2766
|
-
for (let index = 0; index < this.masters.length; index += 2) {
|
|
2767
|
-
this.complete_master(index);
|
|
2768
|
-
}
|
|
2769
|
-
}
|
|
2770
|
-
}
|
|
2771
|
-
$mol_atom2.logs = false;
|
|
2772
|
-
$mol_atom2.cached = false;
|
|
2773
|
-
$mol_atom2.cached_next = undefined;
|
|
2774
|
-
$mol_atom2.reap_task = null;
|
|
2775
|
-
$mol_atom2.reap_queue = [];
|
|
2776
|
-
$.$mol_atom2 = $mol_atom2;
|
|
2777
|
-
})($ || ($ = {}));
|
|
2778
|
-
//atom2.js.map
|
|
2779
|
-
;
|
|
2780
|
-
"use strict";
|
|
2781
|
-
//param.test.js.map
|
|
2782
|
-
;
|
|
2783
|
-
"use strict";
|
|
2784
|
-
//param.js.map
|
|
2785
|
-
;
|
|
2786
|
-
"use strict";
|
|
2787
|
-
//result.test.js.map
|
|
2788
|
-
;
|
|
2789
|
-
"use strict";
|
|
2790
|
-
//result.js.map
|
|
2791
|
-
;
|
|
2792
|
-
"use strict";
|
|
2793
|
-
var $;
|
|
2794
|
-
(function ($) {
|
|
2795
|
-
class $mol_mem_force extends Object {
|
|
2796
|
-
constructor() {
|
|
2797
|
-
super();
|
|
2798
|
-
this.$mol_mem_force = true;
|
|
2799
|
-
}
|
|
2800
|
-
static toString() { return this.name; }
|
|
2801
|
-
}
|
|
2802
|
-
$mol_mem_force.$mol_mem_force = true;
|
|
2803
|
-
$.$mol_mem_force = $mol_mem_force;
|
|
2804
|
-
class $mol_mem_force_cache extends $mol_mem_force {
|
|
2805
|
-
}
|
|
2806
|
-
$.$mol_mem_force_cache = $mol_mem_force_cache;
|
|
2807
|
-
class $mol_mem_force_update extends $mol_mem_force {
|
|
2808
|
-
}
|
|
2809
|
-
$.$mol_mem_force_update = $mol_mem_force_update;
|
|
2810
|
-
class $mol_mem_force_fail extends $mol_mem_force_cache {
|
|
2811
|
-
}
|
|
2812
|
-
$.$mol_mem_force_fail = $mol_mem_force_fail;
|
|
2813
|
-
})($ || ($ = {}));
|
|
2814
|
-
//force.js.map
|
|
2815
|
-
;
|
|
2816
|
-
"use strict";
|
|
2817
|
-
var $;
|
|
2818
|
-
(function ($_1) {
|
|
2819
|
-
$_1.$mol_test({
|
|
2820
|
-
'Property method'($) {
|
|
2821
|
-
class App extends $_1.$mol_object2 {
|
|
2822
|
-
static value(next = 1) { return next + 1; }
|
|
2823
|
-
}
|
|
2824
|
-
App.$ = $;
|
|
2825
|
-
__decorate([
|
|
2826
|
-
$_1.$mol_mem
|
|
2827
|
-
], App, "value", null);
|
|
2828
|
-
$_1.$mol_assert_equal(App.value(), 2);
|
|
2829
|
-
App.value(2);
|
|
2830
|
-
$_1.$mol_assert_equal(App.value(), 3);
|
|
2831
|
-
},
|
|
2832
|
-
'auto sync of properties'($) {
|
|
2833
|
-
class X extends $_1.$mol_object2 {
|
|
2834
|
-
foo(next) {
|
|
2835
|
-
return next || 1;
|
|
2836
|
-
}
|
|
2837
|
-
bar() {
|
|
2838
|
-
return this.foo() + 1;
|
|
2839
|
-
}
|
|
2840
|
-
xxx() {
|
|
2841
|
-
return this.bar() + 1;
|
|
2842
|
-
}
|
|
2843
|
-
}
|
|
2844
|
-
__decorate([
|
|
2845
|
-
$_1.$mol_mem
|
|
2846
|
-
], X.prototype, "foo", null);
|
|
2847
|
-
__decorate([
|
|
2848
|
-
$_1.$mol_mem
|
|
2849
|
-
], X.prototype, "bar", null);
|
|
2850
|
-
__decorate([
|
|
2851
|
-
$_1.$mol_mem
|
|
2852
|
-
], X.prototype, "xxx", null);
|
|
2853
|
-
const x = new X;
|
|
2854
|
-
x.$ = $;
|
|
2855
|
-
$_1.$mol_assert_equal(x.bar(), 2);
|
|
2856
|
-
$_1.$mol_assert_equal(x.xxx(), 3);
|
|
2857
|
-
x.foo(5);
|
|
2858
|
-
$_1.$mol_assert_equal(x.xxx(), 7);
|
|
2859
|
-
},
|
|
2860
|
-
async 'must be deferred destroyed when no longer referenced'($) {
|
|
2861
|
-
let foo;
|
|
2862
|
-
let foo_destroyed = false;
|
|
2863
|
-
class B extends $_1.$mol_object2 {
|
|
2864
|
-
showing(next) {
|
|
2865
|
-
if (next === void 0)
|
|
2866
|
-
return true;
|
|
2867
|
-
return next;
|
|
2868
|
-
}
|
|
2869
|
-
foo() {
|
|
2870
|
-
return foo = new class extends $_1.$mol_object {
|
|
2871
|
-
destructor() {
|
|
2872
|
-
foo_destroyed = true;
|
|
2873
|
-
}
|
|
2874
|
-
};
|
|
2875
|
-
}
|
|
2876
|
-
bar() {
|
|
2877
|
-
return this.showing() ? this.foo() : null;
|
|
2878
|
-
}
|
|
2879
|
-
}
|
|
2880
|
-
__decorate([
|
|
2881
|
-
$_1.$mol_mem
|
|
2882
|
-
], B.prototype, "showing", null);
|
|
2883
|
-
__decorate([
|
|
2884
|
-
$_1.$mol_mem
|
|
2885
|
-
], B.prototype, "foo", null);
|
|
2886
|
-
__decorate([
|
|
2887
|
-
$_1.$mol_mem
|
|
2888
|
-
], B.prototype, "bar", null);
|
|
2889
|
-
var b = new B;
|
|
2890
|
-
b.$ = $;
|
|
2891
|
-
var bar = b.bar();
|
|
2892
|
-
$_1.$mol_assert_ok(bar);
|
|
2893
|
-
b.showing(false);
|
|
2894
|
-
b.bar();
|
|
2895
|
-
await $_1.$mol_fiber_warp();
|
|
2896
|
-
$_1.$mol_assert_ok(foo_destroyed);
|
|
2897
|
-
$_1.$mol_assert_not(b.bar());
|
|
2898
|
-
b.showing(true);
|
|
2899
|
-
$_1.$mol_defer.run();
|
|
2900
|
-
$_1.$mol_assert_unique(b.bar(), bar);
|
|
2901
|
-
},
|
|
2902
|
-
async 'wait for data'($) {
|
|
2903
|
-
class Test extends $_1.$mol_object2 {
|
|
2904
|
-
source() {
|
|
2905
|
-
return $_1.$mol_fiber_sync(() => new Promise(done => done('Jin')))();
|
|
2906
|
-
}
|
|
2907
|
-
middle() {
|
|
2908
|
-
return this.source();
|
|
2909
|
-
}
|
|
2910
|
-
target() {
|
|
2911
|
-
return this.middle();
|
|
2912
|
-
}
|
|
2913
|
-
}
|
|
2914
|
-
__decorate([
|
|
2915
|
-
$_1.$mol_mem
|
|
2916
|
-
], Test.prototype, "source", null);
|
|
2917
|
-
__decorate([
|
|
2918
|
-
$_1.$mol_mem
|
|
2919
|
-
], Test.prototype, "middle", null);
|
|
2920
|
-
__decorate([
|
|
2921
|
-
$_1.$mol_mem
|
|
2922
|
-
], Test.prototype, "target", null);
|
|
2923
|
-
const t = new Test;
|
|
2924
|
-
t.$ = $;
|
|
2925
|
-
$_1.$mol_assert_fail(() => t.target().valueOf(), Promise);
|
|
2926
|
-
await $_1.$mol_fiber_warp();
|
|
2927
|
-
$_1.$mol_assert_equal(t.target(), 'Jin');
|
|
2928
|
-
},
|
|
2929
|
-
});
|
|
2930
|
-
})($ || ($ = {}));
|
|
2931
|
-
//mem.test.js.map
|
|
2932
|
-
;
|
|
2933
|
-
"use strict";
|
|
2934
|
-
var $;
|
|
2935
|
-
(function ($) {
|
|
2936
|
-
$.$mol_mem_cached = $.$mol_atom2_value;
|
|
2937
|
-
function $mol_mem_persist() {
|
|
2938
|
-
const atom = $.$mol_atom2.current;
|
|
2939
|
-
if (!atom)
|
|
2940
|
-
return;
|
|
2941
|
-
if (atom.hasOwnProperty('destructor'))
|
|
2942
|
-
return;
|
|
2943
|
-
atom.destructor = () => { };
|
|
2944
|
-
}
|
|
2945
|
-
$.$mol_mem_persist = $mol_mem_persist;
|
|
2946
|
-
function $mol_mem(proto, name, descr) {
|
|
2947
|
-
if (!descr)
|
|
2948
|
-
descr = Reflect.getOwnPropertyDescriptor(proto, name);
|
|
2949
|
-
const orig = descr.value;
|
|
2950
|
-
const store = new WeakMap();
|
|
2951
|
-
Object.defineProperty(proto, name + "()", {
|
|
2952
|
-
get: function () {
|
|
2953
|
-
return store.get(this);
|
|
2954
|
-
}
|
|
2955
|
-
});
|
|
2956
|
-
const get_cache = (host) => {
|
|
2957
|
-
let cache = store.get(host);
|
|
2958
|
-
if (cache)
|
|
2959
|
-
return cache;
|
|
2960
|
-
let cache2 = new $.$mol_atom2;
|
|
2961
|
-
cache2.calculate = orig.bind(host);
|
|
2962
|
-
cache2[Symbol.toStringTag] = `${host}.${name}()`;
|
|
2963
|
-
cache2.abort = () => {
|
|
2964
|
-
store.delete(host);
|
|
2965
|
-
cache2.forget();
|
|
2966
|
-
return true;
|
|
2967
|
-
};
|
|
2968
|
-
$.$mol_owning_catch(host, cache2);
|
|
2969
|
-
cache2[$.$mol_object_field] = name;
|
|
2970
|
-
store.set(host, cache2);
|
|
2971
|
-
return cache2;
|
|
2972
|
-
};
|
|
2973
|
-
function value(next, force) {
|
|
2974
|
-
if (next === undefined) {
|
|
2975
|
-
const cache = get_cache(this);
|
|
2976
|
-
if (force === $.$mol_mem_force_cache)
|
|
2977
|
-
return cache.obsolete(Number.NaN);
|
|
2978
|
-
if ($.$mol_atom2.current)
|
|
2979
|
-
return cache.get();
|
|
2980
|
-
else
|
|
2981
|
-
return $.$mol_fiber.run(() => cache.get());
|
|
2982
|
-
}
|
|
2983
|
-
return $.$mol_fiber.run(() => {
|
|
2984
|
-
if (force === $.$mol_mem_force_fail)
|
|
2985
|
-
return get_cache(this).fail(next);
|
|
2986
|
-
if (force !== $.$mol_mem_force_cache)
|
|
2987
|
-
next = orig.call(this, next);
|
|
2988
|
-
return get_cache(this).put(next);
|
|
2989
|
-
});
|
|
2990
|
-
}
|
|
2991
|
-
return Object.assign(Object.assign({}, descr || {}), { value: Object.assign(value, { orig }) });
|
|
2992
|
-
}
|
|
2993
|
-
$.$mol_mem = $mol_mem;
|
|
2994
|
-
})($ || ($ = {}));
|
|
2995
|
-
//mem.js.map
|
|
2996
|
-
;
|
|
2997
|
-
"use strict";
|
|
2998
|
-
var $;
|
|
2999
|
-
(function ($) {
|
|
3000
|
-
$.$mol_test({
|
|
3001
|
-
'const returns stored value'() {
|
|
3002
|
-
const foo = { bar: $.$mol_const(Math.random()) };
|
|
3003
|
-
$.$mol_assert_equal(foo.bar(), foo.bar());
|
|
3004
|
-
$.$mol_assert_equal(foo.bar(), foo.bar['()']);
|
|
3005
|
-
},
|
|
3006
|
-
});
|
|
3007
|
-
})($ || ($ = {}));
|
|
3008
|
-
//const.test.js.map
|
|
3009
|
-
;
|
|
3010
|
-
"use strict";
|
|
3011
|
-
var $;
|
|
3012
|
-
(function ($) {
|
|
3013
|
-
function $mol_const(value) {
|
|
3014
|
-
var getter = (() => value);
|
|
3015
|
-
getter['()'] = value;
|
|
3016
|
-
getter[Symbol.toStringTag] = value;
|
|
3017
|
-
return getter;
|
|
3018
|
-
}
|
|
3019
|
-
$.$mol_const = $mol_const;
|
|
3020
|
-
})($ || ($ = {}));
|
|
3021
|
-
//const.js.map
|
|
3022
|
-
;
|
|
3023
|
-
"use strict";
|
|
3024
|
-
var $;
|
|
3025
|
-
(function ($) {
|
|
3026
|
-
function $mol_atom2_field(proto, name, descr) {
|
|
3027
|
-
if (!descr)
|
|
3028
|
-
descr = Object.getOwnPropertyDescriptor(proto, name);
|
|
3029
|
-
const get = descr ? (descr.get || $.$mol_const(descr.value)) : (() => undefined);
|
|
3030
|
-
const set = descr && descr.set || function (next) { get_cache(this).put(next); };
|
|
3031
|
-
const store = new WeakMap();
|
|
3032
|
-
Object.defineProperty(proto, name + "@", {
|
|
3033
|
-
get: function () {
|
|
3034
|
-
return store.get(this);
|
|
3035
|
-
}
|
|
3036
|
-
});
|
|
3037
|
-
const get_cache = (host) => {
|
|
3038
|
-
let cache = store.get(host);
|
|
3039
|
-
if (!cache) {
|
|
3040
|
-
cache = new $.$mol_atom2;
|
|
3041
|
-
cache.calculate = get.bind(host);
|
|
3042
|
-
cache[Symbol.toStringTag] = `${host}.${name}`;
|
|
3043
|
-
cache.abort = () => {
|
|
3044
|
-
store.delete(host);
|
|
3045
|
-
cache.forget();
|
|
3046
|
-
return true;
|
|
3047
|
-
};
|
|
3048
|
-
$.$mol_owning_catch(host, cache);
|
|
3049
|
-
store.set(host, cache);
|
|
3050
|
-
}
|
|
3051
|
-
return cache;
|
|
3052
|
-
};
|
|
3053
|
-
return {
|
|
3054
|
-
get() {
|
|
3055
|
-
return get_cache(this).get();
|
|
3056
|
-
},
|
|
3057
|
-
set,
|
|
3058
|
-
};
|
|
3059
|
-
}
|
|
3060
|
-
$.$mol_atom2_field = $mol_atom2_field;
|
|
3061
|
-
})($ || ($ = {}));
|
|
3062
|
-
//field.js.map
|
|
3063
|
-
;
|
|
3064
|
-
"use strict";
|
|
3065
|
-
var $;
|
|
3066
|
-
(function ($_1) {
|
|
3067
|
-
$_1.$mol_test({
|
|
3068
|
-
async 'Autorun'($) {
|
|
3069
|
-
class App extends $_1.$mol_object2 {
|
|
3070
|
-
static get init() {
|
|
3071
|
-
++this.counter;
|
|
3072
|
-
return this.state;
|
|
3073
|
-
}
|
|
3074
|
-
}
|
|
3075
|
-
App.$ = $;
|
|
3076
|
-
App.state = 1;
|
|
3077
|
-
App.counter = 0;
|
|
3078
|
-
__decorate([
|
|
3079
|
-
$_1.$mol_atom2_field
|
|
3080
|
-
], App, "state", void 0);
|
|
3081
|
-
__decorate([
|
|
3082
|
-
$_1.$mol_atom2_field
|
|
3083
|
-
], App, "init", null);
|
|
3084
|
-
const autorun = $_1.$mol_atom2_autorun(() => App.init);
|
|
3085
|
-
autorun.$ = $;
|
|
3086
|
-
try {
|
|
3087
|
-
await $_1.$mol_fiber_warp();
|
|
3088
|
-
$_1.$mol_assert_equal(App.counter, 1);
|
|
3089
|
-
App.state = 2;
|
|
3090
|
-
$_1.$mol_assert_equal(App.counter, 1);
|
|
3091
|
-
await $_1.$mol_fiber_warp();
|
|
3092
|
-
$_1.$mol_assert_equal(App.counter, 2);
|
|
3093
|
-
App.state = 3;
|
|
3094
|
-
}
|
|
3095
|
-
finally {
|
|
3096
|
-
autorun.destructor();
|
|
3097
|
-
}
|
|
3098
|
-
App.state = 4;
|
|
3099
|
-
await $_1.$mol_fiber_warp();
|
|
3100
|
-
$_1.$mol_assert_equal(App.counter, 2);
|
|
3101
|
-
},
|
|
3102
|
-
});
|
|
3103
|
-
})($ || ($ = {}));
|
|
3104
|
-
//autorun.test.js.map
|
|
3105
|
-
;
|
|
3106
|
-
"use strict";
|
|
3107
|
-
var $;
|
|
3108
|
-
(function ($) {
|
|
3109
|
-
function $mol_atom2_autorun(calculate) {
|
|
3110
|
-
return $.$mol_atom2.create(atom => {
|
|
3111
|
-
atom.calculate = calculate;
|
|
3112
|
-
atom.obsolete_slaves = atom.schedule;
|
|
3113
|
-
atom.doubt_slaves = atom.schedule;
|
|
3114
|
-
atom[Symbol.toStringTag] = calculate[Symbol.toStringTag] || calculate.name || '$mol_atom2_autorun';
|
|
3115
|
-
atom.schedule();
|
|
3116
|
-
});
|
|
3117
|
-
}
|
|
3118
|
-
$.$mol_atom2_autorun = $mol_atom2_autorun;
|
|
3119
|
-
})($ || ($ = {}));
|
|
3120
|
-
//autorun.js.map
|
|
3121
|
-
;
|
|
3122
|
-
"use strict";
|
|
3123
|
-
var $;
|
|
3124
|
-
(function ($_1) {
|
|
3125
|
-
$_1.$mol_test({
|
|
3126
|
-
'Class as component'() {
|
|
3127
|
-
class Foo extends $_1.$mol_jsx_view {
|
|
3128
|
-
constructor() {
|
|
3129
|
-
super(...arguments);
|
|
3130
|
-
this.title = '';
|
|
3131
|
-
}
|
|
3132
|
-
render() {
|
|
3133
|
-
return $_1.$mol_jsx("div", null,
|
|
3134
|
-
this.title,
|
|
3135
|
-
" ",
|
|
3136
|
-
this.childNodes.join('-'));
|
|
3137
|
-
}
|
|
3138
|
-
}
|
|
3139
|
-
const dom = $_1.$mol_jsx(Foo, { id: "/foo", title: "bar" },
|
|
3140
|
-
"xxx",
|
|
3141
|
-
123);
|
|
3142
|
-
$_1.$mol_assert_equal(dom.outerHTML, '<div id="/foo">bar xxx-123</div>');
|
|
3143
|
-
},
|
|
3144
|
-
'View by element'() {
|
|
3145
|
-
class Br extends $_1.$mol_jsx_view {
|
|
3146
|
-
render() {
|
|
3147
|
-
view = this;
|
|
3148
|
-
return $_1.$mol_jsx("br", { id: "/foo" });
|
|
3149
|
-
}
|
|
3150
|
-
}
|
|
3151
|
-
let view;
|
|
3152
|
-
$_1.$mol_assert_equal(Br.of($_1.$mol_jsx(Br, null)), view);
|
|
3153
|
-
},
|
|
3154
|
-
'Attached view rerender'() {
|
|
3155
|
-
const doc = $_1.$mol_dom_parse('<html><body id="/foo"></body></html>');
|
|
3156
|
-
class Title extends $_1.$mol_jsx_view {
|
|
3157
|
-
constructor() {
|
|
3158
|
-
super(...arguments);
|
|
3159
|
-
this.value = 'foo';
|
|
3160
|
-
}
|
|
3161
|
-
render() {
|
|
3162
|
-
return $_1.$mol_jsx("div", null, this.value);
|
|
3163
|
-
}
|
|
3164
|
-
}
|
|
3165
|
-
const dom = $_1.$mol_jsx_attach(doc, () => $_1.$mol_jsx(Title, { id: "/foo" }));
|
|
3166
|
-
const title = Title.of(dom);
|
|
3167
|
-
$_1.$mol_assert_equal(title.ownerDocument, doc);
|
|
3168
|
-
$_1.$mol_assert_equal(doc.documentElement.outerHTML, '<html><body id="/foo">foo</body></html>');
|
|
3169
|
-
title.value = 'bar';
|
|
3170
|
-
title.valueOf();
|
|
3171
|
-
$_1.$mol_assert_equal(doc.documentElement.outerHTML, '<html><body id="/foo">bar</body></html>');
|
|
3172
|
-
},
|
|
3173
|
-
async 'Reactive attached view'($) {
|
|
3174
|
-
const doc = $_1.$mol_dom_parse('<html><body id="/foo"></body></html>');
|
|
3175
|
-
class Task extends $_1.$mol_object2 {
|
|
3176
|
-
title(next) { return next || 'foo'; }
|
|
3177
|
-
}
|
|
3178
|
-
__decorate([
|
|
3179
|
-
$_1.$mol_mem
|
|
3180
|
-
], Task.prototype, "title", null);
|
|
3181
|
-
class App extends $_1.$mol_jsx_view {
|
|
3182
|
-
task() { return new Task; }
|
|
3183
|
-
valueOf() {
|
|
3184
|
-
return super.valueOf();
|
|
3185
|
-
}
|
|
3186
|
-
render() {
|
|
3187
|
-
return $_1.$mol_jsx("div", null, this.task().title());
|
|
3188
|
-
}
|
|
3189
|
-
}
|
|
3190
|
-
__decorate([
|
|
3191
|
-
$_1.$mol_mem
|
|
3192
|
-
], App.prototype, "task", null);
|
|
3193
|
-
__decorate([
|
|
3194
|
-
$_1.$mol_mem
|
|
3195
|
-
], App.prototype, "valueOf", null);
|
|
3196
|
-
const task = new Task;
|
|
3197
|
-
task.$ = $;
|
|
3198
|
-
const autorun = $.$mol_atom2_autorun(() => $_1.$mol_jsx_attach(doc, () => $_1.$mol_jsx(App, { "$": $, id: "/foo", task: () => task })));
|
|
3199
|
-
autorun.$ = $;
|
|
3200
|
-
await $_1.$mol_fiber_warp();
|
|
3201
|
-
$_1.$mol_assert_equal(doc.documentElement.outerHTML, '<html><body id="/foo">foo</body></html>');
|
|
3202
|
-
task.title('bar');
|
|
3203
|
-
await $_1.$mol_fiber_warp();
|
|
3204
|
-
$_1.$mol_assert_equal(doc.documentElement.outerHTML, '<html><body id="/foo">bar</body></html>');
|
|
3205
|
-
},
|
|
3206
|
-
});
|
|
3207
|
-
})($ || ($ = {}));
|
|
3208
|
-
//view.test.js.map
|
|
3209
|
-
;
|
|
3210
|
-
"use strict";
|
|
3211
|
-
var $;
|
|
3212
|
-
(function ($) {
|
|
3213
|
-
class $mol_jsx_view extends $.$mol_object2 {
|
|
3214
|
-
static of(node) {
|
|
3215
|
-
return node[this];
|
|
3216
|
-
}
|
|
3217
|
-
valueOf() {
|
|
3218
|
-
const prefix = $.$mol_jsx_prefix;
|
|
3219
|
-
const booked = $.$mol_jsx_booked;
|
|
3220
|
-
const document = $.$mol_jsx_document;
|
|
3221
|
-
try {
|
|
3222
|
-
$.$mol_jsx_prefix = this[Symbol.toStringTag];
|
|
3223
|
-
$.$mol_jsx_booked = new Set;
|
|
3224
|
-
$.$mol_jsx_document = this.ownerDocument;
|
|
3225
|
-
return this.render();
|
|
3226
|
-
}
|
|
3227
|
-
finally {
|
|
3228
|
-
$.$mol_jsx_prefix = prefix;
|
|
3229
|
-
$.$mol_jsx_booked = booked;
|
|
3230
|
-
$.$mol_jsx_document = document;
|
|
3231
|
-
}
|
|
3232
|
-
}
|
|
3233
|
-
render() {
|
|
3234
|
-
return $.$mol_fail(new Error('dom_tree() not implemented'));
|
|
3235
|
-
}
|
|
3236
|
-
}
|
|
3237
|
-
$.$mol_jsx_view = $mol_jsx_view;
|
|
3238
|
-
})($ || ($ = {}));
|
|
3239
|
-
//view.js.map
|
|
3240
|
-
;
|
|
3241
|
-
"use strict";
|
|
839
|
+
"use strict";
|
|
3242
840
|
//equals.test.js.map
|
|
3243
841
|
;
|
|
3244
|
-
"use strict";
|
|
842
|
+
"use strict";
|
|
3245
843
|
//equals.js.map
|
|
3246
844
|
;
|
|
3247
|
-
"use strict";
|
|
3248
|
-
var $;
|
|
3249
|
-
(function ($) {
|
|
3250
|
-
$.$mol_test({
|
|
3251
|
-
'equal paths'() {
|
|
3252
|
-
const diff = $.$mol_diff_path([1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]);
|
|
3253
|
-
$.$mol_assert_like(diff, {
|
|
3254
|
-
prefix: [1, 2, 3, 4],
|
|
3255
|
-
suffix: [[], [], []],
|
|
3256
|
-
});
|
|
3257
|
-
},
|
|
3258
|
-
'different suffix'() {
|
|
3259
|
-
const diff = $.$mol_diff_path([1, 2, 3, 4], [1, 2, 3, 5], [1, 2, 5, 4]);
|
|
3260
|
-
$.$mol_assert_like(diff, {
|
|
3261
|
-
prefix: [1, 2],
|
|
3262
|
-
suffix: [[3, 4], [3, 5], [5, 4]],
|
|
3263
|
-
});
|
|
3264
|
-
},
|
|
3265
|
-
'one contains other'() {
|
|
3266
|
-
const diff = $.$mol_diff_path([1, 2, 3, 4], [1, 2], [1, 2, 3]);
|
|
3267
|
-
$.$mol_assert_like(diff, {
|
|
3268
|
-
prefix: [1, 2],
|
|
3269
|
-
suffix: [[3, 4], [], [3]],
|
|
3270
|
-
});
|
|
3271
|
-
},
|
|
3272
|
-
'fully different'() {
|
|
3273
|
-
const diff = $.$mol_diff_path([1, 2], [3, 4], [5, 6]);
|
|
3274
|
-
$.$mol_assert_like(diff, {
|
|
3275
|
-
prefix: [],
|
|
3276
|
-
suffix: [[1, 2], [3, 4], [5, 6]],
|
|
3277
|
-
});
|
|
3278
|
-
},
|
|
3279
|
-
});
|
|
3280
|
-
})($ || ($ = {}));
|
|
845
|
+
"use strict";
|
|
846
|
+
var $;
|
|
847
|
+
(function ($) {
|
|
848
|
+
$.$mol_test({
|
|
849
|
+
'equal paths'() {
|
|
850
|
+
const diff = $.$mol_diff_path([1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]);
|
|
851
|
+
$.$mol_assert_like(diff, {
|
|
852
|
+
prefix: [1, 2, 3, 4],
|
|
853
|
+
suffix: [[], [], []],
|
|
854
|
+
});
|
|
855
|
+
},
|
|
856
|
+
'different suffix'() {
|
|
857
|
+
const diff = $.$mol_diff_path([1, 2, 3, 4], [1, 2, 3, 5], [1, 2, 5, 4]);
|
|
858
|
+
$.$mol_assert_like(diff, {
|
|
859
|
+
prefix: [1, 2],
|
|
860
|
+
suffix: [[3, 4], [3, 5], [5, 4]],
|
|
861
|
+
});
|
|
862
|
+
},
|
|
863
|
+
'one contains other'() {
|
|
864
|
+
const diff = $.$mol_diff_path([1, 2, 3, 4], [1, 2], [1, 2, 3]);
|
|
865
|
+
$.$mol_assert_like(diff, {
|
|
866
|
+
prefix: [1, 2],
|
|
867
|
+
suffix: [[3, 4], [], [3]],
|
|
868
|
+
});
|
|
869
|
+
},
|
|
870
|
+
'fully different'() {
|
|
871
|
+
const diff = $.$mol_diff_path([1, 2], [3, 4], [5, 6]);
|
|
872
|
+
$.$mol_assert_like(diff, {
|
|
873
|
+
prefix: [],
|
|
874
|
+
suffix: [[1, 2], [3, 4], [5, 6]],
|
|
875
|
+
});
|
|
876
|
+
},
|
|
877
|
+
});
|
|
878
|
+
})($ || ($ = {}));
|
|
3281
879
|
//path.test.js.map
|
|
3282
880
|
;
|
|
3283
|
-
"use strict";
|
|
3284
|
-
var $;
|
|
3285
|
-
(function ($) {
|
|
3286
|
-
function $mol_diff_path(...paths) {
|
|
3287
|
-
const limit = Math.min(...paths.map(path => path.length));
|
|
3288
|
-
lookup: for (var i = 0; i < limit; ++i) {
|
|
3289
|
-
const first = paths[0][i];
|
|
3290
|
-
for (let j = 1; j < paths.length; ++j) {
|
|
3291
|
-
if (paths[j][i] !== first)
|
|
3292
|
-
break lookup;
|
|
3293
|
-
}
|
|
3294
|
-
}
|
|
3295
|
-
return {
|
|
3296
|
-
prefix: paths[0].slice(0, i),
|
|
3297
|
-
suffix: paths.map(path => path.slice(i)),
|
|
3298
|
-
};
|
|
3299
|
-
}
|
|
3300
|
-
$.$mol_diff_path = $mol_diff_path;
|
|
3301
|
-
})($ || ($ = {}));
|
|
881
|
+
"use strict";
|
|
882
|
+
var $;
|
|
883
|
+
(function ($) {
|
|
884
|
+
function $mol_diff_path(...paths) {
|
|
885
|
+
const limit = Math.min(...paths.map(path => path.length));
|
|
886
|
+
lookup: for (var i = 0; i < limit; ++i) {
|
|
887
|
+
const first = paths[0][i];
|
|
888
|
+
for (let j = 1; j < paths.length; ++j) {
|
|
889
|
+
if (paths[j][i] !== first)
|
|
890
|
+
break lookup;
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
return {
|
|
894
|
+
prefix: paths[0].slice(0, i),
|
|
895
|
+
suffix: paths.map(path => path.slice(i)),
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
$.$mol_diff_path = $mol_diff_path;
|
|
899
|
+
})($ || ($ = {}));
|
|
3302
900
|
//path.js.map
|
|
3303
901
|
;
|
|
3304
|
-
"use strict";
|
|
3305
|
-
var $;
|
|
3306
|
-
(function ($) {
|
|
3307
|
-
class $mol_error_mix extends Error {
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
const
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
const
|
|
3320
|
-
|
|
3321
|
-
this.
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
902
|
+
"use strict";
|
|
903
|
+
var $;
|
|
904
|
+
(function ($) {
|
|
905
|
+
class $mol_error_mix extends Error {
|
|
906
|
+
errors;
|
|
907
|
+
constructor(message, ...errors) {
|
|
908
|
+
super(message);
|
|
909
|
+
this.errors = errors;
|
|
910
|
+
if (errors.length) {
|
|
911
|
+
const stacks = [...errors.map(error => error.stack), this.stack];
|
|
912
|
+
const diff = $.$mol_diff_path(...stacks.map(stack => {
|
|
913
|
+
if (!stack)
|
|
914
|
+
return [];
|
|
915
|
+
return stack.split('\n').reverse();
|
|
916
|
+
}));
|
|
917
|
+
const head = diff.prefix.reverse().join('\n');
|
|
918
|
+
const tails = diff.suffix.map(path => path.reverse().map(line => line.replace(/^(?!\s+at)/, '\tat (.) ')).join('\n')).join('\n\tat (.) -----\n');
|
|
919
|
+
this.stack = `Error: ${this.constructor.name}\n\tat (.) /"""\\\n${tails}\n\tat (.) \\___/\n${head}`;
|
|
920
|
+
this.message += errors.map(error => '\n' + error.message).join('');
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
toJSON() {
|
|
924
|
+
return this.message;
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
$.$mol_error_mix = $mol_error_mix;
|
|
928
|
+
})($ || ($ = {}));
|
|
3330
929
|
//mix.js.map
|
|
3331
930
|
|
|
3332
931
|
//# sourceMappingURL=web.test.js.map
|