mol_mutable 0.0.49 → 0.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node.deps.json +1 -1
- package/node.js +13 -13
- package/node.js.map +1 -1
- package/node.mjs +13 -13
- package/node.mjs.map +1 -1
- package/node.test.js +286 -286
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.deps.json +1 -1
- package/web.js +13 -13
- package/web.js.map +1 -1
- package/web.mjs +13 -13
- package/web.mjs.map +1 -1
- package/web.test.js +181 -181
- package/web.test.js.map +1 -1
package/package.json
CHANGED
package/web.deps.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"files":["LICENSE","README.md","
|
|
1
|
+
{"files":["mam.ts","LICENSE","README.md","yarn.lock","mam.jam.js","tsfmt.json","package.json","tsconfig.json","lang.lang.tree","sandbox.config.json","mol/CNAME","mol/LICENSE","mol/readme.md","mol/index.html","mol/mol.meta.tree","mol/CONTRIBUTING.md","mol/CODE_OF_CONDUCT.md","mol/type/README.md","mol/type/immutable/deep/deep/deep.ts","mol/mutable/README.md","mol/mutable/mutable.ts"],"mods":{},"deps_in":{"mol":{"mol/mutable":-9007199254740991,"mol/type":-9007199254740991},"":{"mol":-9007199254740991},"mol/type/immutable/deep/deep":{"mol/mutable":-2},"mol/type/immutable/deep":{"mol/type/immutable/deep/deep":-9007199254740991},"mol/type/immutable":{"mol/type/immutable/deep":-9007199254740991},"mol/type":{"mol/type/immutable":-9007199254740991}},"deps_out":{"mol/mutable":{"mol":-9007199254740991,"mol/type/immutable/deep/deep":-2},"mol":{"":-9007199254740991},"mol/type/immutable/deep/deep":{"mol/type/immutable/deep":-9007199254740991},"mol/type/immutable/deep":{"mol/type/immutable":-9007199254740991},"mol/type/immutable":{"mol/type":-9007199254740991},"mol/type":{"mol":-9007199254740991}},"sloc":{"ts":50,"LICENSE":113,"md":508,"lock":985,"js":9,"json":93,"tree":31,"CNAME":1,"html":1},"deps":{"mol/mutable":{"..":-9007199254740991,"/mol/mutable/wrapper":-1,"/mol/type/immutable/deep":-2,"/mol/mutable":-1},"mol":{"..":-9007199254740991},"":{},"mol/type/immutable/deep/deep":{"..":-9007199254740991,"/mol/type/immutable/deep":-1},"mol/type/immutable/deep":{"..":-9007199254740991},"mol/type/immutable":{"..":-9007199254740991},"mol/type":{"..":-9007199254740991}}}
|
package/web.js
CHANGED
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
function require( path ){ return $node[ path ] };
|
|
3
|
-
"use strict"
|
|
4
|
-
|
|
5
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
6
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if ((d = decorators[i])) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
var $ = ( typeof module === 'object' ) ? ( module['export'+'s'] = globalThis ) : globalThis
|
|
13
|
-
$.$$ = $
|
|
14
|
-
|
|
15
|
-
;
|
|
16
3
|
|
|
17
4
|
var $node = $node || {}
|
|
18
5
|
void function( module ) { var exports = module.exports = this; function require( id ) { return $node[ id.replace( /^.\// , "../" ) ] };
|
|
@@ -27,6 +14,19 @@ module.exports = $;
|
|
|
27
14
|
;
|
|
28
15
|
|
|
29
16
|
$node[ "../mam.ts" ] = $node[ "../mam.ts" ] = module.exports }.call( {} , {} )
|
|
17
|
+
;
|
|
18
|
+
"use strict"
|
|
19
|
+
|
|
20
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
21
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
22
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
23
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if ((d = decorators[i])) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
24
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
var $ = ( typeof module === 'object' ) ? ( module['export'+'s'] = globalThis ) : globalThis
|
|
28
|
+
$.$$ = $
|
|
29
|
+
|
|
30
30
|
;
|
|
31
31
|
"use strict";
|
|
32
32
|
//mol/type/immutable/deep/deep/deep.ts
|
package/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../mam.
|
|
1
|
+
{"version":3,"sources":["-","../../../mam.ts","../../../mam.jam.js","../../type/immutable/deep/deep/deep.ts","../mol/mutable/mutable.ts"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;;ACHA,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC;AAK3B,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;AAMX,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,CAAA;;;ADblB;AACA;AACA;AEFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACZA;AACA;AACA;;ACFA,IAAU,CAAC,CAuCV;AAvCD,WAAU,CAAC;IAUV,SAAgB,YAAY,CAC3B,KAAY,EACZ,SAAkC,IAAI,CAAC,EAAE,CAAC,KAAK,GAAG,IAAI;QAGtD,IAAI,MAAM,GAAG,SAA8B,CAAA;QAE3C,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAE,KAAK,CAAE;YACnC,CAAC,CAAC,GAAE,EAAE,CAAC,CAAE,GAAI,KAAY,CAAW;YACpC,CAAC,CAAC,GAAE,EAAE,CAAC,CAAC,EAAE,GAAI,KAAK,EAAE,CAAC,CAAA;QAEvB,OAAO,IAAI,KAAK,CAAE,YAAY,EAAE;YAE/B,GAAG,EAAE,CAAE,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,CACxB,KAAK,CAAE,KAAK,CAAE,EACd,IAAI,CAAC,EAAE,CAAC,CAAE,MAAM,IAAI,CAAE,MAAM,GAAG,MAAM,CAAE,KAAK,EAAE,CAAE,CAAE,CAAE,CAAE,KAAK,CAAE,GAAG,IAAI,CACpE;YAED,GAAG,EAAE,GAAE,EAAE,CAAC,KAAK;YAEf,KAAK,EAAE,CAAE,GAAG,EAAE,IAAI,EAAE,CAAE,KAAK,CAAE,EAAE,EAAE;gBAChC,IAAI,KAAK;oBAAG,MAAM,CAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAAE,KAAK,CAAE,CAAE,CAAA;gBACrD,OAAO,MAAM,IAAI,KAAK,CAAA;YACvB,CAAC;SAED,CAAS,CAAA;IAEX,CAAC;IA3Be,cAAY,eA2B3B,CAAA;AAEF,CAAC,EAvCS,CAAC,KAAD,CAAC,QAuCV;;","file":"web.js","sourcesContent":[null,"Error.stackTraceLimit = 50;\n\ndeclare let _$_: { new(): {} } & typeof globalThis\ndeclare class $ extends _$_ {}\n\nnamespace $ {\n\texport type $ = typeof $$\n\texport declare class $$ extends $ {}\n\tnamespace $$ {\n\t\texport type $$ = $\n\t}\n}\n\nmodule.exports = $\n",null,null,"namespace $ {\n\t\n\texport type $mol_mutable_wrapper< Value > = {\n\t\t(\n\t\t\tpatch?: ( next: $mol_type_immutable_deep< Value > )=> $mol_type_immutable_deep< Value >\n\t\t): $mol_type_immutable_deep< Value >\n\t} & {\n\t\t[ Field in keyof Value ]: $mol_mutable_wrapper< Value[ Field ] >\n\t}\n\t\n\texport function $mol_mutable< Value >(\n\t\tinput: Value,\n\t\tupdate: ( next: Value )=> Value = next => input = next,\n\t): $mol_mutable_wrapper< Value > {\n\t\t\n\t\tlet output = undefined as undefined | Value\n\t\t\n\t\tconst clone = Array.isArray( input )\n\t\t\t? ()=> [ ... input as any ] as Value\n\t\t\t: ()=> ({ ... input })\n\t\t\n\t\treturn new Proxy( $mol_mutable, {\n\t\t\t\n\t\t\tget: ( Mut, field )=> Mut(\n\t\t\t\tinput[ field ],\n\t\t\t\tnext => ( output ?? ( output = update( clone() ) ) )[ field ] = next,\n\t\t\t),\n\t\t\t\n\t\t\tset: ()=> false,\n\t\t\t\n\t\t\tapply: ( Mut, self, [ patch ] )=> {\n\t\t\t\tif( patch ) update( output = input = patch( input ) )\n\t\t\t\treturn output ?? input\n\t\t\t},\n\t\t\t\n\t\t} ) as any\n\t\t\n\t}\n\t\n}"]}
|
package/web.mjs
CHANGED
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
function require( path ){ return $node[ path ] };
|
|
3
|
-
"use strict"
|
|
4
|
-
|
|
5
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
6
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if ((d = decorators[i])) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
var $ = ( typeof module === 'object' ) ? ( module['export'+'s'] = globalThis ) : globalThis
|
|
13
|
-
$.$$ = $
|
|
14
|
-
|
|
15
|
-
;
|
|
16
3
|
|
|
17
4
|
var $node = $node || {}
|
|
18
5
|
void function( module ) { var exports = module.exports = this; function require( id ) { return $node[ id.replace( /^.\// , "../" ) ] };
|
|
@@ -27,6 +14,19 @@ module.exports = $;
|
|
|
27
14
|
;
|
|
28
15
|
|
|
29
16
|
$node[ "../mam.ts" ] = $node[ "../mam.ts" ] = module.exports }.call( {} , {} )
|
|
17
|
+
;
|
|
18
|
+
"use strict"
|
|
19
|
+
|
|
20
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
21
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
22
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
23
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if ((d = decorators[i])) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
24
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
var $ = ( typeof module === 'object' ) ? ( module['export'+'s'] = globalThis ) : globalThis
|
|
28
|
+
$.$$ = $
|
|
29
|
+
|
|
30
30
|
;
|
|
31
31
|
"use strict";
|
|
32
32
|
//mol/type/immutable/deep/deep/deep.ts
|
package/web.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../mam.
|
|
1
|
+
{"version":3,"sources":["-","../../../mam.ts","../../../mam.jam.js","../../type/immutable/deep/deep/deep.ts","../mol/mutable/mutable.ts"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;;ACHA,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC;AAK3B,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;AAMX,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,CAAA;;;ADblB;AACA;AACA;AEFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACZA;AACA;AACA;;ACFA,IAAU,CAAC,CAuCV;AAvCD,WAAU,CAAC;IAUV,SAAgB,YAAY,CAC3B,KAAY,EACZ,SAAkC,IAAI,CAAC,EAAE,CAAC,KAAK,GAAG,IAAI;QAGtD,IAAI,MAAM,GAAG,SAA8B,CAAA;QAE3C,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAE,KAAK,CAAE;YACnC,CAAC,CAAC,GAAE,EAAE,CAAC,CAAE,GAAI,KAAY,CAAW;YACpC,CAAC,CAAC,GAAE,EAAE,CAAC,CAAC,EAAE,GAAI,KAAK,EAAE,CAAC,CAAA;QAEvB,OAAO,IAAI,KAAK,CAAE,YAAY,EAAE;YAE/B,GAAG,EAAE,CAAE,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,CACxB,KAAK,CAAE,KAAK,CAAE,EACd,IAAI,CAAC,EAAE,CAAC,CAAE,MAAM,IAAI,CAAE,MAAM,GAAG,MAAM,CAAE,KAAK,EAAE,CAAE,CAAE,CAAE,CAAE,KAAK,CAAE,GAAG,IAAI,CACpE;YAED,GAAG,EAAE,GAAE,EAAE,CAAC,KAAK;YAEf,KAAK,EAAE,CAAE,GAAG,EAAE,IAAI,EAAE,CAAE,KAAK,CAAE,EAAE,EAAE;gBAChC,IAAI,KAAK;oBAAG,MAAM,CAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAAE,KAAK,CAAE,CAAE,CAAA;gBACrD,OAAO,MAAM,IAAI,KAAK,CAAA;YACvB,CAAC;SAED,CAAS,CAAA;IAEX,CAAC;IA3Be,cAAY,eA2B3B,CAAA;AAEF,CAAC,EAvCS,CAAC,KAAD,CAAC,QAuCV;;;AJvCD","file":"web.mjs","sourcesContent":[null,"Error.stackTraceLimit = 50;\n\ndeclare let _$_: { new(): {} } & typeof globalThis\ndeclare class $ extends _$_ {}\n\nnamespace $ {\n\texport type $ = typeof $$\n\texport declare class $$ extends $ {}\n\tnamespace $$ {\n\t\texport type $$ = $\n\t}\n}\n\nmodule.exports = $\n",null,null,"namespace $ {\n\t\n\texport type $mol_mutable_wrapper< Value > = {\n\t\t(\n\t\t\tpatch?: ( next: $mol_type_immutable_deep< Value > )=> $mol_type_immutable_deep< Value >\n\t\t): $mol_type_immutable_deep< Value >\n\t} & {\n\t\t[ Field in keyof Value ]: $mol_mutable_wrapper< Value[ Field ] >\n\t}\n\t\n\texport function $mol_mutable< Value >(\n\t\tinput: Value,\n\t\tupdate: ( next: Value )=> Value = next => input = next,\n\t): $mol_mutable_wrapper< Value > {\n\t\t\n\t\tlet output = undefined as undefined | Value\n\t\t\n\t\tconst clone = Array.isArray( input )\n\t\t\t? ()=> [ ... input as any ] as Value\n\t\t\t: ()=> ({ ... input })\n\t\t\n\t\treturn new Proxy( $mol_mutable, {\n\t\t\t\n\t\t\tget: ( Mut, field )=> Mut(\n\t\t\t\tinput[ field ],\n\t\t\t\tnext => ( output ?? ( output = update( clone() ) ) )[ field ] = next,\n\t\t\t),\n\t\t\t\n\t\t\tset: ()=> false,\n\t\t\t\n\t\t\tapply: ( Mut, self, [ patch ] )=> {\n\t\t\t\tif( patch ) update( output = input = patch( input ) )\n\t\t\t\treturn output ?? input\n\t\t\t},\n\t\t\t\n\t\t} ) as any\n\t\t\n\t}\n\t\n}"]}
|
package/web.test.js
CHANGED
|
@@ -210,96 +210,6 @@ var $;
|
|
|
210
210
|
;
|
|
211
211
|
"use strict";
|
|
212
212
|
var $;
|
|
213
|
-
(function ($) {
|
|
214
|
-
$mol_test({
|
|
215
|
-
'Make empty div'() {
|
|
216
|
-
$mol_assert_equal(($mol_jsx("div", null)).outerHTML, '<div></div>');
|
|
217
|
-
},
|
|
218
|
-
'Define native field'() {
|
|
219
|
-
const dom = $mol_jsx("input", { value: '123' });
|
|
220
|
-
$mol_assert_equal(dom.outerHTML, '<input value="123">');
|
|
221
|
-
$mol_assert_equal(dom.value, '123');
|
|
222
|
-
},
|
|
223
|
-
'Define classes'() {
|
|
224
|
-
const dom = $mol_jsx("div", { class: 'foo bar' });
|
|
225
|
-
$mol_assert_equal(dom.outerHTML, '<div class="foo bar"></div>');
|
|
226
|
-
},
|
|
227
|
-
'Define styles'() {
|
|
228
|
-
const dom = $mol_jsx("div", { style: { color: 'red' } });
|
|
229
|
-
$mol_assert_equal(dom.outerHTML, '<div style="color: red;"></div>');
|
|
230
|
-
},
|
|
231
|
-
'Define dataset'() {
|
|
232
|
-
const dom = $mol_jsx("div", { dataset: { foo: 'bar' } });
|
|
233
|
-
$mol_assert_equal(dom.outerHTML, '<div data-foo="bar"></div>');
|
|
234
|
-
},
|
|
235
|
-
'Define attributes'() {
|
|
236
|
-
const dom = $mol_jsx("div", { lang: "ru", hidden: true });
|
|
237
|
-
$mol_assert_equal(dom.outerHTML, '<div lang="ru" hidden=""></div>');
|
|
238
|
-
},
|
|
239
|
-
'Define child nodes'() {
|
|
240
|
-
const dom = $mol_jsx("div", null,
|
|
241
|
-
"hello",
|
|
242
|
-
$mol_jsx("strong", null, "world"),
|
|
243
|
-
"!");
|
|
244
|
-
$mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
|
|
245
|
-
},
|
|
246
|
-
'Function as component'() {
|
|
247
|
-
const Button = (props, target) => {
|
|
248
|
-
return $mol_jsx("button", { title: props.hint }, target());
|
|
249
|
-
};
|
|
250
|
-
const dom = $mol_jsx(Button, { id: "foo", hint: "click me" }, () => 'hey!');
|
|
251
|
-
$mol_assert_equal(dom.outerHTML, '<button id="foo" title="click me" class="Button">hey!</button>');
|
|
252
|
-
},
|
|
253
|
-
'Nested guid generation'() {
|
|
254
|
-
const Foo = () => {
|
|
255
|
-
return $mol_jsx("div", null,
|
|
256
|
-
$mol_jsx(Bar, { id: "bar" },
|
|
257
|
-
$mol_jsx("img", { id: "icon" })));
|
|
258
|
-
};
|
|
259
|
-
const Bar = (props, icon) => {
|
|
260
|
-
return $mol_jsx("span", null,
|
|
261
|
-
icon,
|
|
262
|
-
$mol_jsx("i", { id: "label" }));
|
|
263
|
-
};
|
|
264
|
-
const dom = $mol_jsx(Foo, { id: "foo" });
|
|
265
|
-
$mol_assert_equal(dom.outerHTML, '<div id="foo" class="Foo"><span id="foo/bar" class="Foo_bar Bar"><img id="foo/icon" class="Foo_icon"><i id="foo/bar/label" class="Foo_bar_label Bar_label"></i></span></div>');
|
|
266
|
-
},
|
|
267
|
-
'Fail on non unique ids'() {
|
|
268
|
-
const App = () => {
|
|
269
|
-
return $mol_jsx("div", null,
|
|
270
|
-
$mol_jsx("span", { id: "bar" }),
|
|
271
|
-
$mol_jsx("span", { id: "bar" }));
|
|
272
|
-
};
|
|
273
|
-
$mol_assert_fail(() => $mol_jsx(App, { id: "foo" }), 'JSX already has tag with id "foo/bar"');
|
|
274
|
-
},
|
|
275
|
-
'Owner based guid generationn'() {
|
|
276
|
-
const Foo = () => {
|
|
277
|
-
return $mol_jsx("div", null,
|
|
278
|
-
$mol_jsx(Bar, { id: "middle", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
279
|
-
};
|
|
280
|
-
const Bar = (props) => {
|
|
281
|
-
return $mol_jsx("span", null, props.icon());
|
|
282
|
-
};
|
|
283
|
-
const dom = $mol_jsx(Foo, { id: "app" });
|
|
284
|
-
$mol_assert_equal(dom.outerHTML, '<div id="app" class="Foo"><span id="app/middle" class="Foo_middle Bar"><img id="app/icon" class="Foo_icon"></span></div>');
|
|
285
|
-
},
|
|
286
|
-
'Fail on same ids from different caller'() {
|
|
287
|
-
const Foo = () => {
|
|
288
|
-
return $mol_jsx("div", null,
|
|
289
|
-
$mol_jsx("img", { id: "icon" }),
|
|
290
|
-
$mol_jsx(Bar, { id: "bar", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
291
|
-
};
|
|
292
|
-
const Bar = (props) => {
|
|
293
|
-
return $mol_jsx("span", null, props.icon());
|
|
294
|
-
};
|
|
295
|
-
$mol_assert_fail(() => $mol_jsx(Foo, { id: "foo" }), 'JSX already has tag with id "foo/icon"');
|
|
296
|
-
},
|
|
297
|
-
});
|
|
298
|
-
})($ || ($ = {}));
|
|
299
|
-
//mol/jsx/jsx.test.tsx
|
|
300
|
-
;
|
|
301
|
-
"use strict";
|
|
302
|
-
var $;
|
|
303
213
|
(function ($) {
|
|
304
214
|
$.$mol_jsx_prefix = '';
|
|
305
215
|
$.$mol_jsx_crumbs = '';
|
|
@@ -423,97 +333,91 @@ var $;
|
|
|
423
333
|
var $;
|
|
424
334
|
(function ($) {
|
|
425
335
|
$mol_test({
|
|
426
|
-
'
|
|
427
|
-
$
|
|
428
|
-
$mol_assert_ok($mol_compare_deep(undefined, undefined));
|
|
429
|
-
$mol_assert_not($mol_compare_deep(undefined, null));
|
|
430
|
-
$mol_assert_not($mol_compare_deep({}, null));
|
|
431
|
-
},
|
|
432
|
-
'number'() {
|
|
433
|
-
$mol_assert_ok($mol_compare_deep(1, 1));
|
|
434
|
-
$mol_assert_ok($mol_compare_deep(Number.NaN, Number.NaN));
|
|
435
|
-
$mol_assert_not($mol_compare_deep(1, 2));
|
|
436
|
-
$mol_assert_ok($mol_compare_deep(Object(1), Object(1)));
|
|
437
|
-
$mol_assert_not($mol_compare_deep(Object(1), Object(2)));
|
|
336
|
+
'Make empty div'() {
|
|
337
|
+
$mol_assert_equal(($mol_jsx("div", null)).outerHTML, '<div></div>');
|
|
438
338
|
},
|
|
439
|
-
'
|
|
440
|
-
$
|
|
441
|
-
$
|
|
442
|
-
$
|
|
443
|
-
$mol_assert_not($mol_compare_deep({}, { a: undefined }));
|
|
444
|
-
$mol_assert_ok($mol_compare_deep({ a: 1, b: 2 }, { b: 2, a: 1 }));
|
|
445
|
-
$mol_assert_ok($mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
|
|
339
|
+
'Define native field'() {
|
|
340
|
+
const dom = $mol_jsx("input", { value: '123' });
|
|
341
|
+
$mol_assert_equal(dom.outerHTML, '<input value="123">');
|
|
342
|
+
$mol_assert_equal(dom.value, '123');
|
|
446
343
|
},
|
|
447
|
-
'
|
|
448
|
-
$
|
|
449
|
-
$
|
|
450
|
-
$mol_assert_not($mol_compare_deep([1, 2], [1, 3]));
|
|
451
|
-
$mol_assert_not($mol_compare_deep([1, 2,], [1, 3, undefined]));
|
|
344
|
+
'Define classes'() {
|
|
345
|
+
const dom = $mol_jsx("div", { class: 'foo bar' });
|
|
346
|
+
$mol_assert_equal(dom.outerHTML, '<div class="foo bar"></div>');
|
|
452
347
|
},
|
|
453
|
-
'
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
$mol_assert_not($mol_compare_deep(new Thing, new Thing));
|
|
457
|
-
$mol_assert_not($mol_compare_deep(() => 1, () => 1));
|
|
458
|
-
$mol_assert_not($mol_compare_deep(new RangeError('Test error'), new RangeError('Test error')));
|
|
348
|
+
'Define styles'() {
|
|
349
|
+
const dom = $mol_jsx("div", { style: { color: 'red' } });
|
|
350
|
+
$mol_assert_equal(dom.outerHTML, '<div style="color: red;"></div>');
|
|
459
351
|
},
|
|
460
|
-
'
|
|
461
|
-
const
|
|
462
|
-
|
|
463
|
-
const b = { foo: {} };
|
|
464
|
-
b['self'] = b;
|
|
465
|
-
$mol_assert_ok($mol_compare_deep(a, b));
|
|
352
|
+
'Define dataset'() {
|
|
353
|
+
const dom = $mol_jsx("div", { dataset: { foo: 'bar' } });
|
|
354
|
+
$mol_assert_equal(dom.outerHTML, '<div data-foo="bar"></div>');
|
|
466
355
|
},
|
|
467
|
-
'
|
|
468
|
-
$
|
|
469
|
-
$
|
|
356
|
+
'Define attributes'() {
|
|
357
|
+
const dom = $mol_jsx("div", { lang: "ru", hidden: true });
|
|
358
|
+
$mol_assert_equal(dom.outerHTML, '<div lang="ru" hidden=""></div>');
|
|
470
359
|
},
|
|
471
|
-
'
|
|
472
|
-
$
|
|
473
|
-
|
|
474
|
-
|
|
360
|
+
'Define child nodes'() {
|
|
361
|
+
const dom = $mol_jsx("div", null,
|
|
362
|
+
"hello",
|
|
363
|
+
$mol_jsx("strong", null, "world"),
|
|
364
|
+
"!");
|
|
365
|
+
$mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
|
|
475
366
|
},
|
|
476
|
-
'
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
$
|
|
367
|
+
'Function as component'() {
|
|
368
|
+
const Button = (props, target) => {
|
|
369
|
+
return $mol_jsx("button", { title: props.hint }, target());
|
|
370
|
+
};
|
|
371
|
+
const dom = $mol_jsx(Button, { id: "foo", hint: "click me" }, () => 'hey!');
|
|
372
|
+
$mol_assert_equal(dom.outerHTML, '<button id="foo" title="click me" class="Button">hey!</button>');
|
|
481
373
|
},
|
|
482
|
-
'
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
374
|
+
'Nested guid generation'() {
|
|
375
|
+
const Foo = () => {
|
|
376
|
+
return $mol_jsx("div", null,
|
|
377
|
+
$mol_jsx(Bar, { id: "bar" },
|
|
378
|
+
$mol_jsx("img", { id: "icon" })));
|
|
379
|
+
};
|
|
380
|
+
const Bar = (props, icon) => {
|
|
381
|
+
return $mol_jsx("span", null,
|
|
382
|
+
icon,
|
|
383
|
+
$mol_jsx("i", { id: "label" }));
|
|
384
|
+
};
|
|
385
|
+
const dom = $mol_jsx(Foo, { id: "foo" });
|
|
386
|
+
$mol_assert_equal(dom.outerHTML, '<div id="foo" class="Foo"><span id="foo/bar" class="Foo_bar Bar"><img id="foo/icon" class="Foo_icon"><i id="foo/bar/label" class="Foo_bar_label Bar_label"></i></span></div>');
|
|
488
387
|
},
|
|
489
|
-
'
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
388
|
+
'Fail on non unique ids'() {
|
|
389
|
+
const App = () => {
|
|
390
|
+
return $mol_jsx("div", null,
|
|
391
|
+
$mol_jsx("span", { id: "bar" }),
|
|
392
|
+
$mol_jsx("span", { id: "bar" }));
|
|
393
|
+
};
|
|
394
|
+
$mol_assert_fail(() => $mol_jsx(App, { id: "foo" }), 'JSX already has tag with id "foo/bar"');
|
|
493
395
|
},
|
|
494
|
-
'
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
396
|
+
'Owner based guid generationn'() {
|
|
397
|
+
const Foo = () => {
|
|
398
|
+
return $mol_jsx("div", null,
|
|
399
|
+
$mol_jsx(Bar, { id: "middle", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
400
|
+
};
|
|
401
|
+
const Bar = (props) => {
|
|
402
|
+
return $mol_jsx("span", null, props.icon());
|
|
403
|
+
};
|
|
404
|
+
const dom = $mol_jsx(Foo, { id: "app" });
|
|
405
|
+
$mol_assert_equal(dom.outerHTML, '<div id="app" class="Foo"><span id="app/middle" class="Foo_middle Bar"><img id="app/icon" class="Foo_icon"></span></div>');
|
|
498
406
|
},
|
|
499
|
-
'
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
$mol_assert_ok($mol_compare_deep(new User('Jin'), new User('Jin')));
|
|
512
|
-
$mol_assert_not($mol_compare_deep(new User('Jin'), new User('John')));
|
|
407
|
+
'Fail on same ids from different caller'() {
|
|
408
|
+
const Foo = () => {
|
|
409
|
+
return $mol_jsx("div", null,
|
|
410
|
+
$mol_jsx("img", { id: "icon" }),
|
|
411
|
+
$mol_jsx(Bar, { id: "bar", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
412
|
+
};
|
|
413
|
+
const Bar = (props) => {
|
|
414
|
+
return $mol_jsx("span", null, props.icon());
|
|
415
|
+
};
|
|
416
|
+
$mol_assert_fail(() => $mol_jsx(Foo, { id: "foo" }), 'JSX already has tag with id "foo/icon"');
|
|
513
417
|
},
|
|
514
418
|
});
|
|
515
419
|
})($ || ($ = {}));
|
|
516
|
-
//mol/
|
|
420
|
+
//mol/jsx/jsx.test.tsx
|
|
517
421
|
;
|
|
518
422
|
"use strict";
|
|
519
423
|
var $;
|
|
@@ -642,6 +546,102 @@ var $;
|
|
|
642
546
|
;
|
|
643
547
|
"use strict";
|
|
644
548
|
var $;
|
|
549
|
+
(function ($) {
|
|
550
|
+
$mol_test({
|
|
551
|
+
'nulls & undefineds'() {
|
|
552
|
+
$mol_assert_ok($mol_compare_deep(null, null));
|
|
553
|
+
$mol_assert_ok($mol_compare_deep(undefined, undefined));
|
|
554
|
+
$mol_assert_not($mol_compare_deep(undefined, null));
|
|
555
|
+
$mol_assert_not($mol_compare_deep({}, null));
|
|
556
|
+
},
|
|
557
|
+
'number'() {
|
|
558
|
+
$mol_assert_ok($mol_compare_deep(1, 1));
|
|
559
|
+
$mol_assert_ok($mol_compare_deep(Number.NaN, Number.NaN));
|
|
560
|
+
$mol_assert_not($mol_compare_deep(1, 2));
|
|
561
|
+
$mol_assert_ok($mol_compare_deep(Object(1), Object(1)));
|
|
562
|
+
$mol_assert_not($mol_compare_deep(Object(1), Object(2)));
|
|
563
|
+
},
|
|
564
|
+
'POJO'() {
|
|
565
|
+
$mol_assert_ok($mol_compare_deep({}, {}));
|
|
566
|
+
$mol_assert_not($mol_compare_deep({ a: 1 }, { b: 2 }));
|
|
567
|
+
$mol_assert_not($mol_compare_deep({ a: 1 }, { a: 2 }));
|
|
568
|
+
$mol_assert_not($mol_compare_deep({}, { a: undefined }));
|
|
569
|
+
$mol_assert_ok($mol_compare_deep({ a: 1, b: 2 }, { b: 2, a: 1 }));
|
|
570
|
+
$mol_assert_ok($mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
|
|
571
|
+
},
|
|
572
|
+
'Array'() {
|
|
573
|
+
$mol_assert_ok($mol_compare_deep([], []));
|
|
574
|
+
$mol_assert_ok($mol_compare_deep([1, [2]], [1, [2]]));
|
|
575
|
+
$mol_assert_not($mol_compare_deep([1, 2], [1, 3]));
|
|
576
|
+
$mol_assert_not($mol_compare_deep([1, 2,], [1, 3, undefined]));
|
|
577
|
+
},
|
|
578
|
+
'Non POJO are different'() {
|
|
579
|
+
class Thing extends Object {
|
|
580
|
+
}
|
|
581
|
+
$mol_assert_not($mol_compare_deep(new Thing, new Thing));
|
|
582
|
+
$mol_assert_not($mol_compare_deep(() => 1, () => 1));
|
|
583
|
+
$mol_assert_not($mol_compare_deep(new RangeError('Test error'), new RangeError('Test error')));
|
|
584
|
+
},
|
|
585
|
+
'same POJOs with cyclic reference'() {
|
|
586
|
+
const a = { foo: {} };
|
|
587
|
+
a['self'] = a;
|
|
588
|
+
const b = { foo: {} };
|
|
589
|
+
b['self'] = b;
|
|
590
|
+
$mol_assert_ok($mol_compare_deep(a, b));
|
|
591
|
+
},
|
|
592
|
+
'Date'() {
|
|
593
|
+
$mol_assert_ok($mol_compare_deep(new Date(12345), new Date(12345)));
|
|
594
|
+
$mol_assert_not($mol_compare_deep(new Date(12345), new Date(12346)));
|
|
595
|
+
},
|
|
596
|
+
'RegExp'() {
|
|
597
|
+
$mol_assert_ok($mol_compare_deep(/\x22/mig, /\x22/mig));
|
|
598
|
+
$mol_assert_not($mol_compare_deep(/\x22/mig, /\x21/mig));
|
|
599
|
+
$mol_assert_not($mol_compare_deep(/\x22/mig, /\x22/mg));
|
|
600
|
+
},
|
|
601
|
+
'Error'() {
|
|
602
|
+
$mol_assert_not($mol_compare_deep(new Error('xxx'), new Error('xxx')));
|
|
603
|
+
const fail = (message) => new Error(message);
|
|
604
|
+
$mol_assert_ok($mol_compare_deep(...['xxx', 'xxx'].map(msg => new Error(msg))));
|
|
605
|
+
$mol_assert_not($mol_compare_deep(...['xxx', 'yyy'].map(msg => new Error(msg))));
|
|
606
|
+
},
|
|
607
|
+
'Map'() {
|
|
608
|
+
$mol_assert_ok($mol_compare_deep(new Map, new Map));
|
|
609
|
+
$mol_assert_ok($mol_compare_deep(new Map([[1, [2]]]), new Map([[1, [2]]])));
|
|
610
|
+
$mol_assert_ok($mol_compare_deep(new Map([[[1], 2]]), new Map([[[1], 2]])));
|
|
611
|
+
$mol_assert_not($mol_compare_deep(new Map([[1, 2]]), new Map([[1, 3]])));
|
|
612
|
+
$mol_assert_not($mol_compare_deep(new Map([[[1], 2]]), new Map([[[3], 2]])));
|
|
613
|
+
},
|
|
614
|
+
'Set'() {
|
|
615
|
+
$mol_assert_ok($mol_compare_deep(new Set, new Set));
|
|
616
|
+
$mol_assert_ok($mol_compare_deep(new Set([1, [2]]), new Set([1, [2]])));
|
|
617
|
+
$mol_assert_not($mol_compare_deep(new Set([1]), new Set([2])));
|
|
618
|
+
},
|
|
619
|
+
'Uint8Array'() {
|
|
620
|
+
$mol_assert_ok($mol_compare_deep(new Uint8Array, new Uint8Array));
|
|
621
|
+
$mol_assert_ok($mol_compare_deep(new Uint8Array([0]), new Uint8Array([0])));
|
|
622
|
+
$mol_assert_not($mol_compare_deep(new Uint8Array([0]), new Uint8Array([1])));
|
|
623
|
+
},
|
|
624
|
+
'Custom comparator'() {
|
|
625
|
+
class User {
|
|
626
|
+
name;
|
|
627
|
+
rand;
|
|
628
|
+
constructor(name, rand = Math.random()) {
|
|
629
|
+
this.name = name;
|
|
630
|
+
this.rand = rand;
|
|
631
|
+
}
|
|
632
|
+
[Symbol.toPrimitive](mode) {
|
|
633
|
+
return this.name;
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
$mol_assert_ok($mol_compare_deep(new User('Jin'), new User('Jin')));
|
|
637
|
+
$mol_assert_not($mol_compare_deep(new User('Jin'), new User('John')));
|
|
638
|
+
},
|
|
639
|
+
});
|
|
640
|
+
})($ || ($ = {}));
|
|
641
|
+
//mol/compare/deep/deep.test.tsx
|
|
642
|
+
;
|
|
643
|
+
"use strict";
|
|
644
|
+
var $;
|
|
645
645
|
(function ($) {
|
|
646
646
|
function $mol_dom_serialize(node) {
|
|
647
647
|
const serializer = new $mol_dom_context.XMLSerializer;
|
|
@@ -809,20 +809,6 @@ var $;
|
|
|
809
809
|
;
|
|
810
810
|
"use strict";
|
|
811
811
|
var $;
|
|
812
|
-
(function ($_1) {
|
|
813
|
-
$mol_test_mocks.push($ => {
|
|
814
|
-
$.$mol_log3_come = () => { };
|
|
815
|
-
$.$mol_log3_done = () => { };
|
|
816
|
-
$.$mol_log3_fail = () => { };
|
|
817
|
-
$.$mol_log3_warn = () => { };
|
|
818
|
-
$.$mol_log3_rise = () => { };
|
|
819
|
-
$.$mol_log3_area = () => () => { };
|
|
820
|
-
});
|
|
821
|
-
})($ || ($ = {}));
|
|
822
|
-
//mol/log3/log3.test.ts
|
|
823
|
-
;
|
|
824
|
-
"use strict";
|
|
825
|
-
var $;
|
|
826
812
|
(function ($) {
|
|
827
813
|
function $mol_log3_web_make(level, color) {
|
|
828
814
|
return function $mol_log3_logger(event) {
|
|
@@ -852,6 +838,20 @@ var $;
|
|
|
852
838
|
;
|
|
853
839
|
"use strict";
|
|
854
840
|
var $;
|
|
841
|
+
(function ($_1) {
|
|
842
|
+
$mol_test_mocks.push($ => {
|
|
843
|
+
$.$mol_log3_come = () => { };
|
|
844
|
+
$.$mol_log3_done = () => { };
|
|
845
|
+
$.$mol_log3_fail = () => { };
|
|
846
|
+
$.$mol_log3_warn = () => { };
|
|
847
|
+
$.$mol_log3_rise = () => { };
|
|
848
|
+
$.$mol_log3_area = () => () => { };
|
|
849
|
+
});
|
|
850
|
+
})($ || ($ = {}));
|
|
851
|
+
//mol/log3/log3.test.ts
|
|
852
|
+
;
|
|
853
|
+
"use strict";
|
|
854
|
+
var $;
|
|
855
855
|
(function ($) {
|
|
856
856
|
const named = new WeakSet();
|
|
857
857
|
function $mol_func_name(func) {
|