mol_mutable 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node.d.ts +7 -1
- package/node.deps.json +1 -1
- package/node.esm.js +14 -15
- package/node.esm.js.map +1 -1
- package/node.js +14 -15
- package/node.js.map +1 -1
- package/node.test.js +17 -15
- package/node.test.js.map +1 -1
- package/package.json +6 -2
- package/web.d.ts +7 -1
- package/web.deps.json +1 -1
- package/web.esm.js +14 -15
- package/web.esm.js.map +1 -1
- package/web.js +14 -15
- package/web.js.map +1 -1
- package/web.test.js +3 -0
- package/web.test.js.map +1 -1
package/node.d.ts
CHANGED
|
@@ -13,9 +13,15 @@ declare namespace $ {
|
|
|
13
13
|
export {};
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
declare namespace $ {
|
|
17
|
+
type $mol_type_immutable_deep<Val> = {
|
|
18
|
+
readonly [field in keyof Val]: $mol_type_immutable_deep<Val[field]>;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
declare namespace $ {
|
|
17
23
|
type $mol_mutable_wrapper<Value> = {
|
|
18
|
-
(patch?: (next: Value) => Value): Value
|
|
24
|
+
(patch?: (next: $mol_type_immutable_deep<Value>) => $mol_type_immutable_deep<Value>): $mol_type_immutable_deep<Value>;
|
|
19
25
|
} & {
|
|
20
26
|
[Field in keyof Value]: $mol_mutable_wrapper<Value[Field]>;
|
|
21
27
|
};
|
package/node.deps.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"files":["LICENSE","README.md","lang.lang.tree","mam.jam.js","mam.ts","package.json","sandbox.config.json","tsconfig.json","tsfmt.json","yarn.lock","mol/CNAME","mol/CODE_OF_CONDUCT.md","mol/CONTRIBUTING.md","mol/LICENSE","mol/index.html","mol/mol.meta.tree","mol/readme.md","mol/mutable/README.md","mol/mutable/mutable.ts"],"mods":{},"deps_in":{"mol":{"mol/mutable":-9007199254740991},"":{"mol":-9007199254740991}},"deps_out":{"mol/mutable":{"mol":-9007199254740991},"mol":{"":-9007199254740991}},"sloc":{"LICENSE":113,"md":
|
|
1
|
+
{"files":["LICENSE","README.md","lang.lang.tree","mam.jam.js","mam.ts","package.json","sandbox.config.json","tsconfig.json","tsfmt.json","yarn.lock","mol/CNAME","mol/CODE_OF_CONDUCT.md","mol/CONTRIBUTING.md","mol/LICENSE","mol/index.html","mol/mol.meta.tree","mol/readme.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":{"LICENSE":113,"md":508,"tree":31,"js":9,"ts":53,"json":92,"lock":959,"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/node.esm.js
CHANGED
|
@@ -29,29 +29,28 @@ module.exports = $;
|
|
|
29
29
|
$node[ "../mam.ts" ] = $node[ "../mam.ts" ] = module.exports }.call( {} , {} )
|
|
30
30
|
;
|
|
31
31
|
"use strict";
|
|
32
|
+
//mol/type/immutable/deep/deep/deep.ts
|
|
33
|
+
;
|
|
34
|
+
"use strict";
|
|
32
35
|
var $;
|
|
33
36
|
(function ($) {
|
|
34
37
|
function $mol_mutable(value, update = next => value = next) {
|
|
35
38
|
return new Proxy($mol_mutable, {
|
|
36
|
-
get: (mutable, field) => mutable(value[field],
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
: { ...value, [field]: next };
|
|
44
|
-
value = update(next2);
|
|
45
|
-
return value[field];
|
|
46
|
-
}),
|
|
39
|
+
get: (mutable, field) => mutable(value[field], Array.isArray(value)
|
|
40
|
+
? next => update(value = [
|
|
41
|
+
...value.slice(0, Number(field)),
|
|
42
|
+
next,
|
|
43
|
+
...value.slice(Number(field) + 1),
|
|
44
|
+
])[field]
|
|
45
|
+
: next => update(value = { ...value, [field]: next })[field]),
|
|
47
46
|
set: (mutable, field, next) => {
|
|
48
|
-
value =
|
|
47
|
+
update(value = next);
|
|
49
48
|
return true;
|
|
50
49
|
},
|
|
51
50
|
apply: (mutable, self, [patch]) => {
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
-
return value
|
|
51
|
+
if (patch)
|
|
52
|
+
update(value = patch(value));
|
|
53
|
+
return value;
|
|
55
54
|
},
|
|
56
55
|
});
|
|
57
56
|
}
|
package/node.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../mam.jam.js","-","../../../mam.ts","../mol/mutable/mutable.ts"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACZA;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;;
|
|
1
|
+
{"version":3,"sources":["../../../mam.jam.js","-","../../../mam.ts","../../type/immutable/deep/deep/deep.ts","../mol/mutable/mutable.ts"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACZA;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;;ACFA,IAAU,CAAC,CAwCV;AAxCD,WAAU,CAAC;IAQV,SAAgB,YAAY,CAC3B,KAAY,EACZ,SAAkC,IAAI,CAAC,EAAE,CAAC,KAAK,GAAG,IAAI;QAGtD,OAAO,IAAI,KAAK,CAAE,YAAY,EAAE;YAE/B,GAAG,EAAE,CAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,CAChC,KAAK,CAAE,KAAK,CAAE,EACd,KAAK,CAAC,OAAO,CAAE,KAAK,CAAE;gBACrB,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAE,KAAK,GAAG;oBACzB,GAAM,KAAgB,CAAC,KAAK,CAAE,CAAC,EAAE,MAAM,CAAE,KAAK,CAAE,CAAE;oBAClD,IAAI;oBACJ,GAAM,KAAgB,CAAC,KAAK,CAAE,MAAM,CAAE,KAAK,CAAE,GAAG,CAAC,CAAE;iBAC1C,CAAE,CAAE,KAAK,CAAE;gBACrB,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAE,KAAK,GAAG,EAAE,GAAI,KAAK,EAAE,CAAE,KAAK,CAAE,EAAE,IAAI,EAAE,CAAE,CAAE,KAAK,CAAE,CACpE;YAED,GAAG,EAAE,CAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;gBAC9B,MAAM,CAAE,KAAK,GAAG,IAAI,CAAE,CAAA;gBACtB,OAAO,IAAI,CAAA;YACZ,CAAC;YAED,KAAK,EAAE,CAAE,OAAO,EAAE,IAAI,EAAE,CAAE,KAAK,CAAE,EAAE,EAAE;gBACpC,IAAI,KAAK;oBAAG,MAAM,CAAE,KAAK,GAAG,KAAK,CAAE,KAAK,CAAE,CAAE,CAAA;gBAC5C,OAAO,KAAK,CAAA;YACb,CAAC;SAED,CAAS,CAAA;IAEX,CAAC;IA9Be,cAAY,eA8B3B,CAAA;AAEF,CAAC,EAxCS,CAAC,KAAD,CAAC,QAwCV;;;AHxCD","file":"node.esm.js","sourcesContent":[null,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,"namespace $ {\n\t\n\texport type $mol_mutable_wrapper< Value > = {\n\t\t( patch?: ( next: $mol_type_immutable_deep< Value > )=> $mol_type_immutable_deep< Value > ): $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\tvalue: Value,\n\t\tupdate: ( next: Value )=> Value = next => value = next,\n\t): $mol_mutable_wrapper< Value > {\n\t\t\n\t\treturn new Proxy( $mol_mutable, {\n\t\t\t\n\t\t\tget: ( mutable, field )=> mutable(\n\t\t\t\tvalue[ field ],\n\t\t\t\tArray.isArray( value )\n\t\t\t\t\t? next => update( value = [\n\t\t\t\t\t\t... ( value as any[] ).slice( 0, Number( field ) ),\n\t\t\t\t\t\tnext,\n\t\t\t\t\t\t... ( value as any[] ).slice( Number( field ) + 1 ),\n\t\t\t\t\t] as Value )[ field ]\n\t\t\t\t\t: next => update( value = { ... value, [ field ]: next } )[ field ],\n\t\t\t),\n\t\t\t\n\t\t\tset: ( mutable, field, next )=> {\n\t\t\t\tupdate( value = next )\n\t\t\t\treturn true\n\t\t\t},\n\t\t\t\n\t\t\tapply: ( mutable, self, [ patch ] )=> {\n\t\t\t\tif( patch ) update( value = patch( value ) )\n\t\t\t\treturn value\n\t\t\t},\n\t\t\t\n\t\t} ) as any\n\t\t\n\t}\n\t\n}"]}
|
package/node.js
CHANGED
|
@@ -29,29 +29,28 @@ module.exports = $;
|
|
|
29
29
|
$node[ "../mam.ts" ] = $node[ "../mam.ts" ] = module.exports }.call( {} , {} )
|
|
30
30
|
;
|
|
31
31
|
"use strict";
|
|
32
|
+
//mol/type/immutable/deep/deep/deep.ts
|
|
33
|
+
;
|
|
34
|
+
"use strict";
|
|
32
35
|
var $;
|
|
33
36
|
(function ($) {
|
|
34
37
|
function $mol_mutable(value, update = next => value = next) {
|
|
35
38
|
return new Proxy($mol_mutable, {
|
|
36
|
-
get: (mutable, field) => mutable(value[field],
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
: { ...value, [field]: next };
|
|
44
|
-
value = update(next2);
|
|
45
|
-
return value[field];
|
|
46
|
-
}),
|
|
39
|
+
get: (mutable, field) => mutable(value[field], Array.isArray(value)
|
|
40
|
+
? next => update(value = [
|
|
41
|
+
...value.slice(0, Number(field)),
|
|
42
|
+
next,
|
|
43
|
+
...value.slice(Number(field) + 1),
|
|
44
|
+
])[field]
|
|
45
|
+
: next => update(value = { ...value, [field]: next })[field]),
|
|
47
46
|
set: (mutable, field, next) => {
|
|
48
|
-
value =
|
|
47
|
+
update(value = next);
|
|
49
48
|
return true;
|
|
50
49
|
},
|
|
51
50
|
apply: (mutable, self, [patch]) => {
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
-
return value
|
|
51
|
+
if (patch)
|
|
52
|
+
update(value = patch(value));
|
|
53
|
+
return value;
|
|
55
54
|
},
|
|
56
55
|
});
|
|
57
56
|
}
|
package/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../mam.jam.js","-","../../../mam.ts","../mol/mutable/mutable.ts"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACZA;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;;
|
|
1
|
+
{"version":3,"sources":["../../../mam.jam.js","-","../../../mam.ts","../../type/immutable/deep/deep/deep.ts","../mol/mutable/mutable.ts"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACZA;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;;ACFA,IAAU,CAAC,CAwCV;AAxCD,WAAU,CAAC;IAQV,SAAgB,YAAY,CAC3B,KAAY,EACZ,SAAkC,IAAI,CAAC,EAAE,CAAC,KAAK,GAAG,IAAI;QAGtD,OAAO,IAAI,KAAK,CAAE,YAAY,EAAE;YAE/B,GAAG,EAAE,CAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,CAChC,KAAK,CAAE,KAAK,CAAE,EACd,KAAK,CAAC,OAAO,CAAE,KAAK,CAAE;gBACrB,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAE,KAAK,GAAG;oBACzB,GAAM,KAAgB,CAAC,KAAK,CAAE,CAAC,EAAE,MAAM,CAAE,KAAK,CAAE,CAAE;oBAClD,IAAI;oBACJ,GAAM,KAAgB,CAAC,KAAK,CAAE,MAAM,CAAE,KAAK,CAAE,GAAG,CAAC,CAAE;iBAC1C,CAAE,CAAE,KAAK,CAAE;gBACrB,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAE,KAAK,GAAG,EAAE,GAAI,KAAK,EAAE,CAAE,KAAK,CAAE,EAAE,IAAI,EAAE,CAAE,CAAE,KAAK,CAAE,CACpE;YAED,GAAG,EAAE,CAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;gBAC9B,MAAM,CAAE,KAAK,GAAG,IAAI,CAAE,CAAA;gBACtB,OAAO,IAAI,CAAA;YACZ,CAAC;YAED,KAAK,EAAE,CAAE,OAAO,EAAE,IAAI,EAAE,CAAE,KAAK,CAAE,EAAE,EAAE;gBACpC,IAAI,KAAK;oBAAG,MAAM,CAAE,KAAK,GAAG,KAAK,CAAE,KAAK,CAAE,CAAE,CAAA;gBAC5C,OAAO,KAAK,CAAA;YACb,CAAC;SAED,CAAS,CAAA;IAEX,CAAC;IA9Be,cAAY,eA8B3B,CAAA;AAEF,CAAC,EAxCS,CAAC,KAAD,CAAC,QAwCV;;","file":"node.js","sourcesContent":[null,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,"namespace $ {\n\t\n\texport type $mol_mutable_wrapper< Value > = {\n\t\t( patch?: ( next: $mol_type_immutable_deep< Value > )=> $mol_type_immutable_deep< Value > ): $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\tvalue: Value,\n\t\tupdate: ( next: Value )=> Value = next => value = next,\n\t): $mol_mutable_wrapper< Value > {\n\t\t\n\t\treturn new Proxy( $mol_mutable, {\n\t\t\t\n\t\t\tget: ( mutable, field )=> mutable(\n\t\t\t\tvalue[ field ],\n\t\t\t\tArray.isArray( value )\n\t\t\t\t\t? next => update( value = [\n\t\t\t\t\t\t... ( value as any[] ).slice( 0, Number( field ) ),\n\t\t\t\t\t\tnext,\n\t\t\t\t\t\t... ( value as any[] ).slice( Number( field ) + 1 ),\n\t\t\t\t\t] as Value )[ field ]\n\t\t\t\t\t: next => update( value = { ... value, [ field ]: next } )[ field ],\n\t\t\t),\n\t\t\t\n\t\t\tset: ( mutable, field, next )=> {\n\t\t\t\tupdate( value = next )\n\t\t\t\treturn true\n\t\t\t},\n\t\t\t\n\t\t\tapply: ( mutable, self, [ patch ] )=> {\n\t\t\t\tif( patch ) update( value = patch( value ) )\n\t\t\t\treturn value\n\t\t\t},\n\t\t\t\n\t\t} ) as any\n\t\t\n\t}\n\t\n}"]}
|
package/node.test.js
CHANGED
|
@@ -21,29 +21,28 @@ module.exports = $;
|
|
|
21
21
|
//mam.ts
|
|
22
22
|
;
|
|
23
23
|
"use strict";
|
|
24
|
+
//mol/type/immutable/deep/deep/deep.ts
|
|
25
|
+
;
|
|
26
|
+
"use strict";
|
|
24
27
|
var $;
|
|
25
28
|
(function ($) {
|
|
26
29
|
function $mol_mutable(value, update = next => value = next) {
|
|
27
30
|
return new Proxy($mol_mutable, {
|
|
28
|
-
get: (mutable, field) => mutable(value[field],
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
: { ...value, [field]: next };
|
|
36
|
-
value = update(next2);
|
|
37
|
-
return value[field];
|
|
38
|
-
}),
|
|
31
|
+
get: (mutable, field) => mutable(value[field], Array.isArray(value)
|
|
32
|
+
? next => update(value = [
|
|
33
|
+
...value.slice(0, Number(field)),
|
|
34
|
+
next,
|
|
35
|
+
...value.slice(Number(field) + 1),
|
|
36
|
+
])[field]
|
|
37
|
+
: next => update(value = { ...value, [field]: next })[field]),
|
|
39
38
|
set: (mutable, field, next) => {
|
|
40
|
-
value =
|
|
39
|
+
update(value = next);
|
|
41
40
|
return true;
|
|
42
41
|
},
|
|
43
42
|
apply: (mutable, self, [patch]) => {
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
return value
|
|
43
|
+
if (patch)
|
|
44
|
+
update(value = patch(value));
|
|
45
|
+
return value;
|
|
47
46
|
},
|
|
48
47
|
});
|
|
49
48
|
}
|
|
@@ -1025,6 +1024,9 @@ var $;
|
|
|
1025
1024
|
//mol/assert/assert.ts
|
|
1026
1025
|
;
|
|
1027
1026
|
"use strict";
|
|
1027
|
+
//mol/type/immutable/deep/deep/deep.test.ts
|
|
1028
|
+
;
|
|
1029
|
+
"use strict";
|
|
1028
1030
|
var $;
|
|
1029
1031
|
(function ($) {
|
|
1030
1032
|
$.$mol_ambient_ref = Symbol('$mol_ambient_ref');
|