mol_wire_pub 1.0.0 → 1.0.4

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 ADDED
File without changes
package/README.md CHANGED
@@ -36,6 +36,7 @@ Auto wiring modules. It gives ability to:
36
36
  ## Structures
37
37
 
38
38
  - [$mol_wire_set](./set) - reactive Set
39
+ - [$mol_wire_dom](./dom) - reactive DOM
39
40
 
40
41
  ## Low level API
41
42
 
package/node.d.ts CHANGED
@@ -1,2 +1,64 @@
1
+ declare let _$_: {
2
+ new (): {};
3
+ } & typeof globalThis;
4
+ declare class $ extends _$_ {
5
+ }
6
+ declare namespace $ {
7
+ export type $ = typeof $$;
8
+ export class $$ extends $ {
9
+ }
10
+ namespace $$ {
11
+ type $$ = $;
12
+ }
13
+ export {};
14
+ }
15
+
16
+ declare namespace $ {
17
+ function $mol_fail(error: any): never;
18
+ }
19
+
20
+ declare namespace $ {
21
+ enum $mol_wire_cursor {
22
+ stale,
23
+ doubt,
24
+ fresh,
25
+ final
26
+ }
27
+ }
28
+
29
+ declare namespace $ {
30
+ class $mol_wire_pub extends Array<unknown> {
31
+ static get [Symbol.species](): ArrayConstructor;
32
+ protected sub_from: number;
33
+ get sub_list(): readonly $mol_wire_sub[];
34
+ get sub_empty(): boolean;
35
+ sub_on(sub: $mol_wire_pub, pub_pos: number): number;
36
+ sub_off(sub_pos: number): void;
37
+ reap(): void;
38
+ track_promote(): void;
39
+ up(): void;
40
+ down(): void;
41
+ emit(): void;
42
+ stale(): boolean;
43
+ affect(quant: number): boolean;
44
+ peer_move(from_pos: number, to_pos: number): void;
45
+ peer_repos(peer_pos: number, self_pos: number): void;
46
+ }
47
+ }
48
+
49
+ declare namespace $ {
50
+ interface $mol_wire_sub extends $mol_wire_pub {
51
+ track_on(): $mol_wire_sub | null;
52
+ track_next(pub?: $mol_wire_pub): $mol_wire_pub | null;
53
+ pub_off(pub_pos: number): void;
54
+ track_off(sub: $mol_wire_pub | null): void;
55
+ destructor(): void;
56
+ }
57
+ }
58
+
59
+ declare namespace $ {
60
+ let $mol_wire_auto: $mol_wire_sub | null;
61
+ const $mol_wire_affected: (number | $mol_wire_sub)[];
62
+ }
1
63
 
2
64
  export = $;
package/node.deps.json CHANGED
@@ -1 +1 @@
1
- {"files":["lang.lang.tree","LICENSE","mam.jam.js","mam.ts","package.json","README.md","sandbox.config.json","tsconfig.json","tsfmt.json","mol/CNAME","mol/CODE_OF_CONDUCT.md","mol/CONTRIBUTING.md","mol/index.html","mol/LICENSE","mol/mol.meta.tree","mol/readme.md","mol/fail/fail.ts","mol/wire/cursor/cursor.ts","mol/wire/pub/pub.ts","mol/wire/sub/sub.ts","mol/wire/README.md","mol/wire/wire.ts"],"mods":{},"deps_in":{"mol/wire":{},"mol":{"mol/wire":-9007199254740991,"mol/fail":-9007199254740991},"":{"mol":-9007199254740991},"mol/wire/sub":{"mol/wire":-1},"mol/wire/pub":{"mol/wire/sub":-1},"mol/fail":{"mol/wire/pub":-4},"mol/wire/cursor":{"mol/wire/pub":-3}},"deps_out":{"mol/wire/pub":{"mol/fail":-4,"mol/wire/cursor":-3},"mol/wire":{"mol":-9007199254740991,"mol/wire/sub":-1},"mol":{"":-9007199254740991},"mol/wire/sub":{"mol/wire/pub":-1},"mol/fail":{"mol":-9007199254740991},"mol/wire/cursor":{}},"sloc":{"tree":31,"LICENSE":113,"js":10,"ts":180,"json":84,"md":515,"CNAME":1,"html":1},"deps":{"mol/wire/pub":{"..":-9007199254740991,"/mol/wire/pub":-1,"/mol/wire/sub":-3,"/mol/fail":-4,"/mol/wire/auto":-3,"/mol/wire/cursor/stale":-3,"/mol/wire/affected/length":-3,"/mol/wire/affected/pop":-4,"/mol/wire/cursor/doubt":-4,"/mol/wire/affected/push":-4},"mol/wire":{"..":-9007199254740991,"/mol/wire/auto":-1,"/mol/wire/sub":-1,"/mol/wire/affected":-1},"mol":{"..":-9007199254740991},"":{},"mol/wire/sub":{"..":-9007199254740991,"/mol/wire/sub":-1,"/mol/wire/pub":-1},"mol/fail":{"..":-9007199254740991,"/mol/fail":-1},"mol/wire/cursor":{"..":-9007199254740991,"/mol/wire/cursor":-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/fail/fail.ts","mol/wire/cursor/cursor.ts","mol/wire/pub/pub.ts","mol/wire/sub/sub.ts","mol/wire/README.md","mol/wire/wire.ts"],"mods":{},"deps_in":{"mol/wire":{},"mol":{"mol/wire":-9007199254740991,"mol/fail":-9007199254740991},"":{"mol":-9007199254740991},"mol/wire/sub":{"mol/wire":-1},"mol/wire/pub":{"mol/wire/sub":-1},"mol/fail":{"mol/wire/pub":-4},"mol/wire/cursor":{"mol/wire/pub":-3}},"deps_out":{"mol/wire/pub":{"mol/fail":-4,"mol/wire/cursor":-3},"mol/wire":{"mol":-9007199254740991,"mol/wire/sub":-1},"mol":{"":-9007199254740991},"mol/wire/sub":{"mol/wire/pub":-1},"mol/fail":{"mol":-9007199254740991},"mol/wire/cursor":{}},"sloc":{"LICENSE":113,"md":541,"tree":31,"js":10,"ts":180,"json":85,"lock":939,"CNAME":1,"html":1},"deps":{"mol/wire/pub":{"..":-9007199254740991,"/mol/wire/pub":-1,"/mol/wire/sub":-3,"/mol/fail":-4,"/mol/wire/auto":-3,"/mol/wire/cursor/stale":-3,"/mol/wire/affected/length":-3,"/mol/wire/affected/pop":-4,"/mol/wire/cursor/doubt":-4,"/mol/wire/affected/push":-4},"mol/wire":{"..":-9007199254740991,"/mol/wire/auto":-1,"/mol/wire/sub":-1,"/mol/wire/affected":-1},"mol":{"..":-9007199254740991},"":{},"mol/wire/sub":{"..":-9007199254740991,"/mol/wire/sub":-1,"/mol/wire/pub":-1},"mol/fail":{"..":-9007199254740991,"/mol/fail":-1},"mol/wire/cursor":{"..":-9007199254740991,"/mol/wire/cursor":-1}}}
package/node.esm.js CHANGED
@@ -18,132 +18,136 @@ $.$$ = $
18
18
  var $node = $node || {}
19
19
  void function( module ) { var exports = module.exports = this; function require( id ) { return $node[ id.replace( /^.\// , "../" ) ] };
20
20
  ;
21
- "use strict";
22
- Error.stackTraceLimit = 50;
23
- var $;
24
- (function ($) {
25
- })($ || ($ = {}));
26
- module.exports = $;
21
+ "use strict";
22
+ Error.stackTraceLimit = 50;
23
+ var $;
24
+ (function ($) {
25
+ })($ || ($ = {}));
26
+ module.exports = $;
27
27
  //mam.ts
28
28
  ;
29
29
 
30
30
  $node[ "../mam.ts" ] = $node[ "../mam.ts" ] = module.exports }.call( {} , {} )
31
31
  ;
32
- "use strict";
33
- var $;
34
- (function ($) {
35
- function $mol_fail(error) {
36
- throw error;
37
- }
38
- $.$mol_fail = $mol_fail;
39
- })($ || ($ = {}));
32
+ "use strict";
33
+ var $;
34
+ (function ($) {
35
+ function $mol_fail(error) {
36
+ throw error;
37
+ }
38
+ $.$mol_fail = $mol_fail;
39
+ })($ || ($ = {}));
40
40
  //mol/fail/fail.ts
41
41
  ;
42
- "use strict";
43
- var $;
44
- (function ($) {
45
- let $mol_wire_cursor;
46
- (function ($mol_wire_cursor) {
47
- $mol_wire_cursor[$mol_wire_cursor["stale"] = new (class stale extends Number {
48
- })(-1)] = "stale";
49
- $mol_wire_cursor[$mol_wire_cursor["doubt"] = new (class doubt extends Number {
50
- })(-2)] = "doubt";
51
- $mol_wire_cursor[$mol_wire_cursor["fresh"] = new (class fresh extends Number {
52
- })(-3)] = "fresh";
53
- $mol_wire_cursor[$mol_wire_cursor["final"] = new (class solid extends Number {
54
- })(-4)] = "final";
55
- })($mol_wire_cursor = $.$mol_wire_cursor || ($.$mol_wire_cursor = {}));
56
- })($ || ($ = {}));
42
+ "use strict";
43
+ var $;
44
+ (function ($) {
45
+ let $mol_wire_cursor;
46
+ (function ($mol_wire_cursor) {
47
+ $mol_wire_cursor[$mol_wire_cursor["stale"] = new (class stale extends Number {
48
+ toString() { return '🔴'; }
49
+ })(-1)] = "stale";
50
+ $mol_wire_cursor[$mol_wire_cursor["doubt"] = new (class doubt extends Number {
51
+ toString() { return '🟡'; }
52
+ })(-2)] = "doubt";
53
+ $mol_wire_cursor[$mol_wire_cursor["fresh"] = new (class fresh extends Number {
54
+ toString() { return '🟢'; }
55
+ })(-3)] = "fresh";
56
+ $mol_wire_cursor[$mol_wire_cursor["final"] = new (class solid extends Number {
57
+ toString() { return '🔵'; }
58
+ })(-4)] = "final";
59
+ })($mol_wire_cursor = $.$mol_wire_cursor || ($.$mol_wire_cursor = {}));
60
+ })($ || ($ = {}));
57
61
  //mol/wire/cursor/cursor.ts
58
62
  ;
59
- "use strict";
60
- var $;
61
- (function ($) {
62
- class $mol_wire_pub extends Array {
63
- static get [Symbol.species]() {
64
- return Array;
65
- }
66
- sub_from = 0;
67
- get sub_list() {
68
- const res = [];
69
- for (let i = this.sub_from; i < this.length; i += 2) {
70
- res.push(this[i]);
71
- }
72
- return res;
73
- }
74
- get sub_empty() {
75
- return this.sub_from === this.length;
76
- }
77
- sub_on(sub, pub_pos) {
78
- const pos = this.length;
79
- this.push(sub, pub_pos);
80
- return pos;
81
- }
82
- sub_off(sub_pos) {
83
- if (!(sub_pos < this.length)) {
84
- $mol_fail(new Error(`Wrong pos ${sub_pos}`));
85
- }
86
- const end = this.length - 2;
87
- if (sub_pos !== end) {
88
- this.peer_move(end, sub_pos);
89
- }
90
- this.pop();
91
- this.pop();
92
- if (this.length === this.sub_from)
93
- this.reap();
94
- }
95
- reap() { }
96
- track_promote() {
97
- $mol_wire_auto?.track_next(this);
98
- }
99
- up() { }
100
- down() { }
101
- emit() {
102
- for (let i = this.sub_from; i < this.length; i += 2) {
103
- ;
104
- this[i].stale();
105
- }
106
- }
107
- stale() {
108
- if (!this.affect($mol_wire_cursor.stale))
109
- return false;
110
- while ($mol_wire_affected.length) {
111
- const next = $mol_wire_affected.pop();
112
- next.affect($mol_wire_cursor.doubt);
113
- }
114
- return true;
115
- }
116
- affect(quant) {
117
- for (let i = this.sub_from; i < this.length; i += 2) {
118
- const sub = this[i];
119
- $mol_wire_affected.push(sub);
120
- }
121
- return true;
122
- }
123
- peer_move(from_pos, to_pos) {
124
- const peer = this[from_pos];
125
- const self_pos = this[from_pos + 1];
126
- this[to_pos] = peer;
127
- this[to_pos + 1] = self_pos;
128
- peer.peer_repos(self_pos, to_pos);
129
- }
130
- peer_repos(peer_pos, self_pos) {
131
- this[peer_pos + 1] = self_pos;
132
- }
133
- }
134
- $.$mol_wire_pub = $mol_wire_pub;
135
- })($ || ($ = {}));
63
+ "use strict";
64
+ var $;
65
+ (function ($) {
66
+ class $mol_wire_pub extends Array {
67
+ static get [Symbol.species]() {
68
+ return Array;
69
+ }
70
+ sub_from = 0;
71
+ get sub_list() {
72
+ const res = [];
73
+ for (let i = this.sub_from; i < this.length; i += 2) {
74
+ res.push(this[i]);
75
+ }
76
+ return res;
77
+ }
78
+ get sub_empty() {
79
+ return this.sub_from === this.length;
80
+ }
81
+ sub_on(sub, pub_pos) {
82
+ const pos = this.length;
83
+ this.push(sub, pub_pos);
84
+ return pos;
85
+ }
86
+ sub_off(sub_pos) {
87
+ if (!(sub_pos < this.length)) {
88
+ $mol_fail(new Error(`Wrong pos ${sub_pos}`));
89
+ }
90
+ const end = this.length - 2;
91
+ if (sub_pos !== end) {
92
+ this.peer_move(end, sub_pos);
93
+ }
94
+ this.pop();
95
+ this.pop();
96
+ if (this.length === this.sub_from)
97
+ this.reap();
98
+ }
99
+ reap() { }
100
+ track_promote() {
101
+ $mol_wire_auto?.track_next(this);
102
+ }
103
+ up() { }
104
+ down() { }
105
+ emit() {
106
+ for (let i = this.sub_from; i < this.length; i += 2) {
107
+ ;
108
+ this[i].stale();
109
+ }
110
+ }
111
+ stale() {
112
+ if (!this.affect($mol_wire_cursor.stale))
113
+ return false;
114
+ while ($mol_wire_affected.length) {
115
+ const next = $mol_wire_affected.pop();
116
+ next.affect($mol_wire_cursor.doubt);
117
+ }
118
+ return true;
119
+ }
120
+ affect(quant) {
121
+ for (let i = this.sub_from; i < this.length; i += 2) {
122
+ const sub = this[i];
123
+ $mol_wire_affected.push(sub);
124
+ }
125
+ return true;
126
+ }
127
+ peer_move(from_pos, to_pos) {
128
+ const peer = this[from_pos];
129
+ const self_pos = this[from_pos + 1];
130
+ this[to_pos] = peer;
131
+ this[to_pos + 1] = self_pos;
132
+ peer.peer_repos(self_pos, to_pos);
133
+ }
134
+ peer_repos(peer_pos, self_pos) {
135
+ this[peer_pos + 1] = self_pos;
136
+ }
137
+ }
138
+ $.$mol_wire_pub = $mol_wire_pub;
139
+ })($ || ($ = {}));
136
140
  //mol/wire/pub/pub.ts
137
141
  ;
138
- "use strict";
142
+ "use strict";
139
143
  //mol/wire/sub/sub.ts
140
144
  ;
141
- "use strict";
142
- var $;
143
- (function ($) {
144
- $.$mol_wire_auto = null;
145
- $.$mol_wire_affected = [];
146
- })($ || ($ = {}));
145
+ "use strict";
146
+ var $;
147
+ (function ($) {
148
+ $.$mol_wire_auto = null;
149
+ $.$mol_wire_affected = [];
150
+ })($ || ($ = {}));
147
151
  //mol/wire/wire.ts
148
152
  ;
149
153
  export default $
package/node.esm.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../mam.jam.js","-","../../../../mam.ts","../../../fail/mol/fail/fail.ts","../../cursor/mol/wire/cursor/cursor.ts","../mol/wire/pub/pub.ts","../../sub/sub.ts","../../mol/wire/wire.ts"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACbA;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,C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AAA;AAErE,CAAC,EAZS,CAAC,KAAD,CAAC,QAYV;;;ANZD","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","namespace $ {\n\n\texport function $mol_fail( error : any ) : never {\n\t\tthrow error\n\t}\n\n}\n","namespace $ {\n\t\n\t/** Special status statuses. */\n\texport enum $mol_wire_cursor {\n\t\t\n\t\t/** Update required. */\n\t\tstale = new ( class stale extends Number {} )( -1 ) as any as number,\n\t\t\n\t\t/** Some of (transitive) pub update required. */\n\t\tdoubt = new ( class doubt extends Number {} )( -2 ) as any as number,\n\t\t\n\t\t/** Actual state but may be dropped. */\n\t\tfresh = new ( class fresh extends Number {} )( -3 ) as any as number,\n\t\t\n\t\t/** State will never be changed. */\n\t\tfinal = new ( class solid extends Number {} )( -4 ) as any as number,\n\t\t\n\t}\n\t\n}\n","namespace $ {\n\t\n\t/**\n\t * Collects subscribers in compact array. 24B\n\t */\n\texport class $mol_wire_pub extends Array< unknown > {\n\t\t\n\t\t// Derived objects should be Arrays.\n\t\tstatic get [ Symbol.species ]() {\n\t\t\treturn Array\n\t\t}\n\t\t\n\t\t/**\n\t\t * Index of first subscriber.\n\t\t */\n\t\tprotected sub_from = 0 // 4B\n\t\t\n\t\t/**\n\t\t * All current subscribers.\n\t\t */\n\t\tget sub_list() {\n\t\t\tconst res = [] as $mol_wire_sub[]\n\t\t\tfor( let i = this.sub_from; i < this.length; i += 2 ) {\n\t\t\t\tres.push( this[i] as $mol_wire_sub )\n\t\t\t}\n\t\t\treturn res as readonly $mol_wire_sub[]\n\t\t}\n\t\t\n\t\t/**\n\t\t * Has any subscribers or not.\n\t\t */\n\t\tget sub_empty() {\n\t\t\treturn this.sub_from === this.length\n\t\t}\n\t\t\n\t\t/**\n\t\t * Subscribe subscriber to this publisher events and return position of subscriber that required to unsubscribe.\n\t\t */\n\t\tsub_on( sub: $mol_wire_pub, pub_pos: number ) {\n\t\t\tconst pos = this.length\n\t\t\tthis.push( sub, pub_pos )\n\t\t\treturn pos\n\t\t}\n\t\t\n\t\t/**\n\t\t * Unsubscribe subscriber from this publisher events by subscriber position provided by `on(pub)`.\n\t\t */\n\t\tsub_off( sub_pos: number ) {\n\t\t\t\n\t\t\tif(!( sub_pos < this.length )) {\n\t\t\t\t$mol_fail( new Error( `Wrong pos ${ sub_pos }` ) )\n\t\t\t}\n\t\t\t\n\t\t\tconst end = this.length - 2\n\t\t\tif( sub_pos !== end ) {\n\t\t\t\tthis.peer_move( end, sub_pos )\n\t\t\t}\n\t\t\t\n\t\t\tthis.pop()\n\t\t\tthis.pop()\n\t\t\t\n\t\t\tif( this.length === this.sub_from ) this.reap()\n\t\t\t\n\t\t}\n\t\t\n\t\t/**\n\t\t * Called when last sub was unsubscribed.\n\t\t **/\n\t\treap() { }\n\t\t\n\t\t/**\n\t\t * Autowire this publisher with current subscriber.\n\t\t **/\n\t\ttrack_promote() {\n\t\t\t$mol_wire_auto?.track_next( this )\n\t\t}\n\t\t\n\t\t/**\n\t\t * Enforce actualization. Should not throw errors.\n\t\t */\n\t\tup() {}\n\t\t\n\t\t/**\n\t\t * Subscriber stabilized and allows to free.\n\t\t */\n\t\tdown() {}\n\t\t\n\t\t/**\n\t\t * Notify subscribers about self changes.\n\t\t */\n\t\temit() {\n\t\t\tfor( let i = this.sub_from; i < this.length; i += 2 ) {\n\t\t\t\t;( this[i] as $mol_wire_pub ).stale()\n\t\t\t}\n\t\t}\n\t\t\n\t\t/**\n\t\t * Receive notification about publisher changes.\n\t\t */\n\t\tstale() {\n\t\t\t\n\t\t\tif( !this.affect( $mol_wire_cursor.stale ) ) return false\n\t\t\t\n\t\t\twhile( $mol_wire_affected.length ) {\n\t\t\t\tconst next = $mol_wire_affected.pop()! as $mol_wire_sub\n\t\t\t\tnext.affect( $mol_wire_cursor.doubt )\n\t\t\t}\n\t\t\t\n\t\t\treturn true\n\t\t}\n\t\t\n\t\t/**\n\t\t * Add self subscribers to affection queue.\n\t\t */\n\t\taffect( quant: number ) {\n\t\t\tfor( let i = this.sub_from; i < this.length; i += 2 ) {\n\t\t\t\tconst sub = this[i] as $mol_wire_sub\n\t\t\t\t$mol_wire_affected.push( sub )\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\t\n\t\t/**\n\t\t * Moves peer from one position to another. Doesn't clear data at old position!\n\t\t */\n\t\tpeer_move( from_pos: number, to_pos: number ) {\n\t\t\t\n\t\t\tconst peer = this[ from_pos ] as $mol_wire_pub\n\t\t\tconst self_pos = this[ from_pos + 1 ] as number\n\t\t\t\n\t\t\tthis[ to_pos ] = peer\n\t\t\tthis[ to_pos + 1 ] = self_pos\n\t\t\t\n\t\t\tpeer.peer_repos( self_pos, to_pos )\n\t\t}\n\t\t\n\t\t/**\n\t\t * Updates self position in the peer.\n\t\t */\n\t\tpeer_repos( peer_pos: number, self_pos: number ) {\n\t\t\tthis[ peer_pos + 1 ] = self_pos\n\t\t}\n\t\t\n\t}\n\t\n}\n",null,"namespace $ {\n\t\n\t/**\n\t * When fulfilled, all publishers are promoted to this subscriber on access to its.\n\t */\n\texport let $mol_wire_auto: $mol_wire_sub | null = null\n\t\n\t/**\n\t * Affection queue. Used to prevent accidental stack overflow on emit.\n\t */\n\texport const $mol_wire_affected = [] as ( $mol_wire_sub | number )[]\n\t\n}\n"]}
1
+ {"version":3,"sources":["../../../../mam.jam.js","-","../../../../mam.ts","../../../fail/mol/fail/fail.ts","../../cursor/mol/wire/cursor/cursor.ts","../mol/wire/pub/pub.ts","../../sub/sub.ts","../../mol/wire/wire.ts"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACbA;AACA;AACA;AACA;;ACHA,KAAK,CAAC,eAAe,GAAG,EAAE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,CAAC;QAKD,UAAU,CAAE,QAAgB,EAAE,QAAgB;YAC7C,IAAI,CAAE,QAAQ,GAAG,CAAC,CAAE,GAAG,QAAQ,CAAA;QAChC,CAAC;KAED;IA1IY,eAAa,gBA0IzB,CAAA;AAEF,CAAC,EAjJS,CAAC,KAAD,CAAC,QAiJV;;;ACjJD;AACA;AACA;;ACFA,IAAU,CAAC,CAYV;AAZD,WAAU,CAAC;IAKC,gBAAc,GAAyB,IAAI,CAAA;IAKzC,oBAAkB,GAAG,EAAkC,CAAA;AAErE,CAAC,EAZS,CAAC,KAAD,CAAC,QAYV;;;ANZD","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","namespace $ {\n\n\texport function $mol_fail( error : any ) : never {\n\t\tthrow error\n\t}\n\n}\n","namespace $ {\n\t\n\t/** Special status statuses. */\n\texport enum $mol_wire_cursor {\n\t\t\n\t\t/** Update required. */\n\t\tstale = new ( class stale extends Number { toString(){ return '🔴' } } )( -1 ) as any as number,\n\t\t\n\t\t/** Some of (transitive) pub update required. */\n\t\tdoubt = new ( class doubt extends Number { toString(){ return '🟡' } } )( -2 ) as any as number,\n\t\t\n\t\t/** Actual state but may be dropped. */\n\t\tfresh = new ( class fresh extends Number { toString(){ return '🟢' } } )( -3 ) as any as number,\n\t\t\n\t\t/** State will never be changed. */\n\t\tfinal = new ( class solid extends Number { toString(){ return '🔵' } } )( -4 ) as any as number,\n\t\t\n\t}\n\t\n}\n","namespace $ {\n\t\n\t/**\n\t * Collects subscribers in compact array. 24B\n\t */\n\texport class $mol_wire_pub extends Array< unknown > {\n\t\t\n\t\t// Derived objects should be Arrays.\n\t\tstatic get [ Symbol.species ]() {\n\t\t\treturn Array\n\t\t}\n\t\t\n\t\t/**\n\t\t * Index of first subscriber.\n\t\t */\n\t\tprotected sub_from = 0 // 4B\n\t\t\n\t\t/**\n\t\t * All current subscribers.\n\t\t */\n\t\tget sub_list() {\n\t\t\tconst res = [] as $mol_wire_sub[]\n\t\t\tfor( let i = this.sub_from; i < this.length; i += 2 ) {\n\t\t\t\tres.push( this[i] as $mol_wire_sub )\n\t\t\t}\n\t\t\treturn res as readonly $mol_wire_sub[]\n\t\t}\n\t\t\n\t\t/**\n\t\t * Has any subscribers or not.\n\t\t */\n\t\tget sub_empty() {\n\t\t\treturn this.sub_from === this.length\n\t\t}\n\t\t\n\t\t/**\n\t\t * Subscribe subscriber to this publisher events and return position of subscriber that required to unsubscribe.\n\t\t */\n\t\tsub_on( sub: $mol_wire_pub, pub_pos: number ) {\n\t\t\tconst pos = this.length\n\t\t\tthis.push( sub, pub_pos )\n\t\t\treturn pos\n\t\t}\n\t\t\n\t\t/**\n\t\t * Unsubscribe subscriber from this publisher events by subscriber position provided by `on(pub)`.\n\t\t */\n\t\tsub_off( sub_pos: number ) {\n\t\t\t\n\t\t\tif(!( sub_pos < this.length )) {\n\t\t\t\t$mol_fail( new Error( `Wrong pos ${ sub_pos }` ) )\n\t\t\t}\n\t\t\t\n\t\t\tconst end = this.length - 2\n\t\t\tif( sub_pos !== end ) {\n\t\t\t\tthis.peer_move( end, sub_pos )\n\t\t\t}\n\t\t\t\n\t\t\tthis.pop()\n\t\t\tthis.pop()\n\t\t\t\n\t\t\tif( this.length === this.sub_from ) this.reap()\n\t\t\t\n\t\t}\n\t\t\n\t\t/**\n\t\t * Called when last sub was unsubscribed.\n\t\t **/\n\t\treap() { }\n\t\t\n\t\t/**\n\t\t * Autowire this publisher with current subscriber.\n\t\t **/\n\t\ttrack_promote() {\n\t\t\t$mol_wire_auto?.track_next( this )\n\t\t}\n\t\t\n\t\t/**\n\t\t * Enforce actualization. Should not throw errors.\n\t\t */\n\t\tup() {}\n\t\t\n\t\t/**\n\t\t * Subscriber stabilized and allows to free.\n\t\t */\n\t\tdown() {}\n\t\t\n\t\t/**\n\t\t * Notify subscribers about self changes.\n\t\t */\n\t\temit() {\n\t\t\tfor( let i = this.sub_from; i < this.length; i += 2 ) {\n\t\t\t\t;( this[i] as $mol_wire_pub ).stale()\n\t\t\t}\n\t\t}\n\t\t\n\t\t/**\n\t\t * Receive notification about publisher changes.\n\t\t */\n\t\tstale() {\n\t\t\t\n\t\t\tif( !this.affect( $mol_wire_cursor.stale ) ) return false\n\t\t\t\n\t\t\twhile( $mol_wire_affected.length ) {\n\t\t\t\tconst next = $mol_wire_affected.pop()! as $mol_wire_sub\n\t\t\t\tnext.affect( $mol_wire_cursor.doubt )\n\t\t\t}\n\t\t\t\n\t\t\treturn true\n\t\t}\n\t\t\n\t\t/**\n\t\t * Add self subscribers to affection queue.\n\t\t */\n\t\taffect( quant: number ) {\n\t\t\tfor( let i = this.sub_from; i < this.length; i += 2 ) {\n\t\t\t\tconst sub = this[i] as $mol_wire_sub\n\t\t\t\t$mol_wire_affected.push( sub )\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\t\n\t\t/**\n\t\t * Moves peer from one position to another. Doesn't clear data at old position!\n\t\t */\n\t\tpeer_move( from_pos: number, to_pos: number ) {\n\t\t\t\n\t\t\tconst peer = this[ from_pos ] as $mol_wire_pub\n\t\t\tconst self_pos = this[ from_pos + 1 ] as number\n\t\t\t\n\t\t\tthis[ to_pos ] = peer\n\t\t\tthis[ to_pos + 1 ] = self_pos\n\t\t\t\n\t\t\tpeer.peer_repos( self_pos, to_pos )\n\t\t}\n\t\t\n\t\t/**\n\t\t * Updates self position in the peer.\n\t\t */\n\t\tpeer_repos( peer_pos: number, self_pos: number ) {\n\t\t\tthis[ peer_pos + 1 ] = self_pos\n\t\t}\n\t\t\n\t}\n\t\n}\n",null,"namespace $ {\n\t\n\t/**\n\t * When fulfilled, all publishers are promoted to this subscriber on access to its.\n\t */\n\texport let $mol_wire_auto: $mol_wire_sub | null = null\n\t\n\t/**\n\t * Affection queue. Used to prevent accidental stack overflow on emit.\n\t */\n\texport const $mol_wire_affected = [] as ( $mol_wire_sub | number )[]\n\t\n}\n"]}
package/node.js CHANGED
@@ -18,132 +18,136 @@ $.$$ = $
18
18
  var $node = $node || {}
19
19
  void function( module ) { var exports = module.exports = this; function require( id ) { return $node[ id.replace( /^.\// , "../" ) ] };
20
20
  ;
21
- "use strict";
22
- Error.stackTraceLimit = 50;
23
- var $;
24
- (function ($) {
25
- })($ || ($ = {}));
26
- module.exports = $;
21
+ "use strict";
22
+ Error.stackTraceLimit = 50;
23
+ var $;
24
+ (function ($) {
25
+ })($ || ($ = {}));
26
+ module.exports = $;
27
27
  //mam.ts
28
28
  ;
29
29
 
30
30
  $node[ "../mam.ts" ] = $node[ "../mam.ts" ] = module.exports }.call( {} , {} )
31
31
  ;
32
- "use strict";
33
- var $;
34
- (function ($) {
35
- function $mol_fail(error) {
36
- throw error;
37
- }
38
- $.$mol_fail = $mol_fail;
39
- })($ || ($ = {}));
32
+ "use strict";
33
+ var $;
34
+ (function ($) {
35
+ function $mol_fail(error) {
36
+ throw error;
37
+ }
38
+ $.$mol_fail = $mol_fail;
39
+ })($ || ($ = {}));
40
40
  //mol/fail/fail.ts
41
41
  ;
42
- "use strict";
43
- var $;
44
- (function ($) {
45
- let $mol_wire_cursor;
46
- (function ($mol_wire_cursor) {
47
- $mol_wire_cursor[$mol_wire_cursor["stale"] = new (class stale extends Number {
48
- })(-1)] = "stale";
49
- $mol_wire_cursor[$mol_wire_cursor["doubt"] = new (class doubt extends Number {
50
- })(-2)] = "doubt";
51
- $mol_wire_cursor[$mol_wire_cursor["fresh"] = new (class fresh extends Number {
52
- })(-3)] = "fresh";
53
- $mol_wire_cursor[$mol_wire_cursor["final"] = new (class solid extends Number {
54
- })(-4)] = "final";
55
- })($mol_wire_cursor = $.$mol_wire_cursor || ($.$mol_wire_cursor = {}));
56
- })($ || ($ = {}));
42
+ "use strict";
43
+ var $;
44
+ (function ($) {
45
+ let $mol_wire_cursor;
46
+ (function ($mol_wire_cursor) {
47
+ $mol_wire_cursor[$mol_wire_cursor["stale"] = new (class stale extends Number {
48
+ toString() { return '🔴'; }
49
+ })(-1)] = "stale";
50
+ $mol_wire_cursor[$mol_wire_cursor["doubt"] = new (class doubt extends Number {
51
+ toString() { return '🟡'; }
52
+ })(-2)] = "doubt";
53
+ $mol_wire_cursor[$mol_wire_cursor["fresh"] = new (class fresh extends Number {
54
+ toString() { return '🟢'; }
55
+ })(-3)] = "fresh";
56
+ $mol_wire_cursor[$mol_wire_cursor["final"] = new (class solid extends Number {
57
+ toString() { return '🔵'; }
58
+ })(-4)] = "final";
59
+ })($mol_wire_cursor = $.$mol_wire_cursor || ($.$mol_wire_cursor = {}));
60
+ })($ || ($ = {}));
57
61
  //mol/wire/cursor/cursor.ts
58
62
  ;
59
- "use strict";
60
- var $;
61
- (function ($) {
62
- class $mol_wire_pub extends Array {
63
- static get [Symbol.species]() {
64
- return Array;
65
- }
66
- sub_from = 0;
67
- get sub_list() {
68
- const res = [];
69
- for (let i = this.sub_from; i < this.length; i += 2) {
70
- res.push(this[i]);
71
- }
72
- return res;
73
- }
74
- get sub_empty() {
75
- return this.sub_from === this.length;
76
- }
77
- sub_on(sub, pub_pos) {
78
- const pos = this.length;
79
- this.push(sub, pub_pos);
80
- return pos;
81
- }
82
- sub_off(sub_pos) {
83
- if (!(sub_pos < this.length)) {
84
- $mol_fail(new Error(`Wrong pos ${sub_pos}`));
85
- }
86
- const end = this.length - 2;
87
- if (sub_pos !== end) {
88
- this.peer_move(end, sub_pos);
89
- }
90
- this.pop();
91
- this.pop();
92
- if (this.length === this.sub_from)
93
- this.reap();
94
- }
95
- reap() { }
96
- track_promote() {
97
- $mol_wire_auto?.track_next(this);
98
- }
99
- up() { }
100
- down() { }
101
- emit() {
102
- for (let i = this.sub_from; i < this.length; i += 2) {
103
- ;
104
- this[i].stale();
105
- }
106
- }
107
- stale() {
108
- if (!this.affect($mol_wire_cursor.stale))
109
- return false;
110
- while ($mol_wire_affected.length) {
111
- const next = $mol_wire_affected.pop();
112
- next.affect($mol_wire_cursor.doubt);
113
- }
114
- return true;
115
- }
116
- affect(quant) {
117
- for (let i = this.sub_from; i < this.length; i += 2) {
118
- const sub = this[i];
119
- $mol_wire_affected.push(sub);
120
- }
121
- return true;
122
- }
123
- peer_move(from_pos, to_pos) {
124
- const peer = this[from_pos];
125
- const self_pos = this[from_pos + 1];
126
- this[to_pos] = peer;
127
- this[to_pos + 1] = self_pos;
128
- peer.peer_repos(self_pos, to_pos);
129
- }
130
- peer_repos(peer_pos, self_pos) {
131
- this[peer_pos + 1] = self_pos;
132
- }
133
- }
134
- $.$mol_wire_pub = $mol_wire_pub;
135
- })($ || ($ = {}));
63
+ "use strict";
64
+ var $;
65
+ (function ($) {
66
+ class $mol_wire_pub extends Array {
67
+ static get [Symbol.species]() {
68
+ return Array;
69
+ }
70
+ sub_from = 0;
71
+ get sub_list() {
72
+ const res = [];
73
+ for (let i = this.sub_from; i < this.length; i += 2) {
74
+ res.push(this[i]);
75
+ }
76
+ return res;
77
+ }
78
+ get sub_empty() {
79
+ return this.sub_from === this.length;
80
+ }
81
+ sub_on(sub, pub_pos) {
82
+ const pos = this.length;
83
+ this.push(sub, pub_pos);
84
+ return pos;
85
+ }
86
+ sub_off(sub_pos) {
87
+ if (!(sub_pos < this.length)) {
88
+ $mol_fail(new Error(`Wrong pos ${sub_pos}`));
89
+ }
90
+ const end = this.length - 2;
91
+ if (sub_pos !== end) {
92
+ this.peer_move(end, sub_pos);
93
+ }
94
+ this.pop();
95
+ this.pop();
96
+ if (this.length === this.sub_from)
97
+ this.reap();
98
+ }
99
+ reap() { }
100
+ track_promote() {
101
+ $mol_wire_auto?.track_next(this);
102
+ }
103
+ up() { }
104
+ down() { }
105
+ emit() {
106
+ for (let i = this.sub_from; i < this.length; i += 2) {
107
+ ;
108
+ this[i].stale();
109
+ }
110
+ }
111
+ stale() {
112
+ if (!this.affect($mol_wire_cursor.stale))
113
+ return false;
114
+ while ($mol_wire_affected.length) {
115
+ const next = $mol_wire_affected.pop();
116
+ next.affect($mol_wire_cursor.doubt);
117
+ }
118
+ return true;
119
+ }
120
+ affect(quant) {
121
+ for (let i = this.sub_from; i < this.length; i += 2) {
122
+ const sub = this[i];
123
+ $mol_wire_affected.push(sub);
124
+ }
125
+ return true;
126
+ }
127
+ peer_move(from_pos, to_pos) {
128
+ const peer = this[from_pos];
129
+ const self_pos = this[from_pos + 1];
130
+ this[to_pos] = peer;
131
+ this[to_pos + 1] = self_pos;
132
+ peer.peer_repos(self_pos, to_pos);
133
+ }
134
+ peer_repos(peer_pos, self_pos) {
135
+ this[peer_pos + 1] = self_pos;
136
+ }
137
+ }
138
+ $.$mol_wire_pub = $mol_wire_pub;
139
+ })($ || ($ = {}));
136
140
  //mol/wire/pub/pub.ts
137
141
  ;
138
- "use strict";
142
+ "use strict";
139
143
  //mol/wire/sub/sub.ts
140
144
  ;
141
- "use strict";
142
- var $;
143
- (function ($) {
144
- $.$mol_wire_auto = null;
145
- $.$mol_wire_affected = [];
146
- })($ || ($ = {}));
145
+ "use strict";
146
+ var $;
147
+ (function ($) {
148
+ $.$mol_wire_auto = null;
149
+ $.$mol_wire_affected = [];
150
+ })($ || ($ = {}));
147
151
  //mol/wire/wire.ts
148
152
 
149
153
  //# sourceMappingURL=node.js.map