mol_wire_lib 1.0.1 → 1.0.2

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.
Files changed (3) hide show
  1. package/node.d.ts +277 -0
  2. package/package.json +1 -1
  3. package/web.d.ts +272 -0
package/node.d.ts CHANGED
@@ -1,2 +1,279 @@
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
+ }
63
+
64
+ declare namespace $ {
65
+ function $mol_dev_format_register(config: {
66
+ header: (val: any, config: any) => any;
67
+ hasBody: (val: any, config: any) => false;
68
+ } | {
69
+ header: (val: any, config: any) => any;
70
+ hasBody: (val: any, config: any) => boolean;
71
+ body: (val: any, config: any) => any;
72
+ }): void;
73
+ let $mol_dev_format_head: symbol;
74
+ let $mol_dev_format_body: symbol;
75
+ function $mol_dev_format_native(obj: any): any;
76
+ function $mol_dev_format_auto(obj: any): any;
77
+ function $mol_dev_format_element(element: string, style: object, ...content: any[]): any[];
78
+ function $mol_dev_format_span(style: object, ...content: any[]): any[];
79
+ let $mol_dev_format_div: (style: object, ...content: any[]) => any[];
80
+ let $mol_dev_format_ol: (style: object, ...content: any[]) => any[];
81
+ let $mol_dev_format_li: (style: object, ...content: any[]) => any[];
82
+ let $mol_dev_format_table: (style: object, ...content: any[]) => any[];
83
+ let $mol_dev_format_tr: (style: object, ...content: any[]) => any[];
84
+ let $mol_dev_format_td: (style: object, ...content: any[]) => any[];
85
+ let $mol_dev_format_accent: (...args: any[]) => any[];
86
+ let $mol_dev_format_strong: (...args: any[]) => any[];
87
+ let $mol_dev_format_string: (...args: any[]) => any[];
88
+ let $mol_dev_format_shade: (...args: any[]) => any[];
89
+ let $mol_dev_format_indent: (...args: any[]) => any[];
90
+ }
91
+
92
+ declare namespace $ {
93
+ class $mol_wire_pub_sub extends $mol_wire_pub implements $mol_wire_sub {
94
+ protected pub_from: number;
95
+ protected cursor: $mol_wire_cursor;
96
+ get pub_list(): $mol_wire_pub[];
97
+ track_on(): $mol_wire_sub | null;
98
+ track_promote(): void;
99
+ track_next(pub?: $mol_wire_pub): $mol_wire_pub | null;
100
+ track_off(sub: $mol_wire_sub | null): void;
101
+ pub_off(sub_pos: number): void;
102
+ destructor(): void;
103
+ forget(from?: number): void;
104
+ affect(quant: number): boolean;
105
+ get pub_empty(): boolean;
106
+ }
107
+ }
108
+
109
+ declare namespace $ {
110
+ let $mol_compare_deep_cache: WeakMap<any, WeakMap<any, boolean>>;
111
+ function $mol_compare_deep<Value>(left: Value, right: Value): boolean;
112
+ }
113
+
114
+ declare namespace $ {
115
+ function $mol_guid(length?: number, exists?: (id: string) => boolean): string;
116
+ }
117
+
118
+ declare namespace $ {
119
+ const $mol_key_store: WeakMap<object, string>;
120
+ function $mol_key<Value>(value: Value): string;
121
+ }
122
+
123
+ declare namespace $ {
124
+ const $mol_ambient_ref: unique symbol;
125
+ type $mol_ambient_context = $;
126
+ function $mol_ambient(this: $ | void, overrides: Partial<$>): $;
127
+ }
128
+
129
+ declare namespace $ {
130
+ function $mol_delegate<Value extends object>(proto: Value, target: () => Value): Value;
131
+ }
132
+
133
+ declare namespace $ {
134
+ const $mol_owning_map: WeakMap<any, any>;
135
+ function $mol_owning_allow<Having>(having: Having): having is Having & {
136
+ destructor(): void;
137
+ };
138
+ function $mol_owning_get<Having, Owner extends object>(having: Having, Owner?: {
139
+ new (): Owner;
140
+ }): Owner | null;
141
+ function $mol_owning_check<Owner, Having>(owner: Owner, having: Having): having is Having & {
142
+ destructor(): void;
143
+ };
144
+ function $mol_owning_catch<Owner, Having>(owner: Owner, having: Having): boolean;
145
+ }
146
+
147
+ declare namespace $ {
148
+ function $mol_fail_hidden(error: any): never;
149
+ }
150
+
151
+ declare namespace $ {
152
+ type $mol_type_writable<T> = {
153
+ -readonly [P in keyof T]: T[P];
154
+ };
155
+ }
156
+
157
+ declare namespace $ {
158
+ class $mol_object2 {
159
+ static $: typeof $$;
160
+ [$mol_ambient_ref]: typeof $$;
161
+ get $(): $;
162
+ set $(next: $);
163
+ static create<Instance>(this: new (init?: (instance: any) => void) => Instance, init?: (instance: $mol_type_writable<Instance>) => void): Instance;
164
+ static [Symbol.toPrimitive](): any;
165
+ static toString(): any;
166
+ destructor(): void;
167
+ toString(): any;
168
+ toJSON(): any;
169
+ }
170
+ }
171
+
172
+ declare namespace $ {
173
+ class $mol_after_timeout extends $mol_object2 {
174
+ delay: number;
175
+ task: () => void;
176
+ id: any;
177
+ constructor(delay: number, task: () => void);
178
+ destructor(): void;
179
+ }
180
+ }
181
+
182
+ declare namespace $ {
183
+ class $mol_after_frame extends $mol_after_timeout {
184
+ task: () => void;
185
+ constructor(task: () => void);
186
+ }
187
+ }
188
+
189
+ declare namespace $ {
190
+ function $mol_wire_method<Host extends object, Args extends readonly any[], Result>(host: Host, field: PropertyKey, descr?: TypedPropertyDescriptor<(...args: Args) => Result>): {
191
+ value: (this: Host, ...args: Args) => Result;
192
+ enumerable?: boolean | undefined;
193
+ configurable?: boolean | undefined;
194
+ writable?: boolean | undefined;
195
+ get?: (() => (...args: Args) => Result) | undefined;
196
+ set?: ((value: (...args: Args) => Result) => void) | undefined;
197
+ };
198
+ }
199
+
200
+ declare namespace $ {
201
+ class $mol_wire_fiber<Host, Args extends readonly unknown[], Result> extends $mol_wire_pub_sub {
202
+ readonly host: Host;
203
+ readonly task: (this: Host, ...args: Args) => Result;
204
+ static temp<Host, Args extends readonly unknown[], Result>(host: Host, task: (this: Host, ...args: Args) => Result, ...args: Args): $mol_wire_fiber<Host, [...Args], Result>;
205
+ static persist<Host, Args extends readonly unknown[], Result>(host: Host, task: (this: Host, ...args: Args) => Result, ...args: Args): $mol_wire_fiber<Host, [...Args], Result>;
206
+ static warm: boolean;
207
+ static planning: $mol_wire_fiber<any, any, any>[];
208
+ static reaping: $mol_wire_fiber<any, any, any>[];
209
+ static plan_task: $mol_after_frame | null;
210
+ static plan(): void;
211
+ static sync(): void;
212
+ cache: Result | Error | Promise<Result | Error>;
213
+ get args(): Args;
214
+ get result(): Result | undefined;
215
+ get persist(): boolean;
216
+ field(): string;
217
+ constructor(host: Host, task: (this: Host, ...args: Args) => Result, id: string, ...args: Args);
218
+ destructor(): void;
219
+ plan(): void;
220
+ reap(): void;
221
+ toString(): any;
222
+ get $(): any;
223
+ affect(quant: number): boolean;
224
+ down(): void;
225
+ up(): void;
226
+ put(next: Result | Error | Promise<Result | Error>): Error | Result | Promise<Error | Result>;
227
+ recall(...args: Args): Error | Result | Promise<Error | Result>;
228
+ sync(): Awaited<Result>;
229
+ async(): Promise<Result>;
230
+ }
231
+ }
232
+
233
+ declare namespace $ {
234
+ function $mol_wire_probe<Value>(task: () => Value, next?: Value): Value | undefined;
235
+ }
236
+
237
+ declare namespace $ {
238
+ function $mol_wire_solid(): void;
239
+ }
240
+
241
+ declare namespace $ {
242
+ function $mol_wire_sync<Host extends object>(obj: Host): { [key in keyof Host]: Host[key] extends (...args: infer Args) => Promise<infer Res> ? (...args: Args) => Res : Host[key]; };
243
+ }
244
+
245
+ declare namespace $ {
246
+ function $mol_wire_async<Host extends object>(obj: Host): { [key in keyof Host]: Host[key] extends (...args: infer Args) => infer Res ? Res extends Promise<any> ? Host[key] : (...args: Args) => Promise<Res> : Host[key]; };
247
+ }
248
+
249
+ declare namespace $ {
250
+ function $mol_fail_catch(error: unknown): boolean;
251
+ }
252
+
253
+ declare namespace $ {
254
+ function $mol_fail_log(error: unknown): boolean;
255
+ }
256
+
257
+ declare namespace $ {
258
+ let $mol_wire_mem: <Keys extends number>(keys: Keys) => <Host extends object, Field extends keyof Host, Prop extends Extract<Host[Field], (...args: any[]) => any>>(host: Host, field: Field, descr?: TypedPropertyDescriptor<Prop> | undefined) => {
259
+ value: (this: Host, ...args: any[]) => any;
260
+ enumerable?: boolean | undefined;
261
+ configurable?: boolean | undefined;
262
+ writable?: boolean | undefined;
263
+ get?: (() => Prop) | undefined;
264
+ set?: ((value: Prop) => void) | undefined;
265
+ };
266
+ }
267
+
268
+ declare namespace $ {
269
+ function $mol_const<Value>(value: Value): {
270
+ (): Value;
271
+ '()': Value;
272
+ };
273
+ }
274
+
275
+ declare namespace $ {
276
+ function $mol_wire_field<Host extends object, Field extends keyof Host, Value extends Host[Field]>(host: Host, field: Field, descr?: TypedPropertyDescriptor<Value>): any;
277
+ }
1
278
 
2
279
  export = $;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mol_wire_lib",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "main": "node.js",
5
5
  "module": "node.esm.js",
6
6
  "browser": "web.js",
package/web.d.ts CHANGED
@@ -1,2 +1,274 @@
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
+ }
63
+
64
+ declare namespace $ {
65
+ function $mol_dev_format_register(config: {
66
+ header: (val: any, config: any) => any;
67
+ hasBody: (val: any, config: any) => false;
68
+ } | {
69
+ header: (val: any, config: any) => any;
70
+ hasBody: (val: any, config: any) => boolean;
71
+ body: (val: any, config: any) => any;
72
+ }): void;
73
+ let $mol_dev_format_head: symbol;
74
+ let $mol_dev_format_body: symbol;
75
+ function $mol_dev_format_native(obj: any): any;
76
+ function $mol_dev_format_auto(obj: any): any;
77
+ function $mol_dev_format_element(element: string, style: object, ...content: any[]): any[];
78
+ function $mol_dev_format_span(style: object, ...content: any[]): any[];
79
+ let $mol_dev_format_div: (style: object, ...content: any[]) => any[];
80
+ let $mol_dev_format_ol: (style: object, ...content: any[]) => any[];
81
+ let $mol_dev_format_li: (style: object, ...content: any[]) => any[];
82
+ let $mol_dev_format_table: (style: object, ...content: any[]) => any[];
83
+ let $mol_dev_format_tr: (style: object, ...content: any[]) => any[];
84
+ let $mol_dev_format_td: (style: object, ...content: any[]) => any[];
85
+ let $mol_dev_format_accent: (...args: any[]) => any[];
86
+ let $mol_dev_format_strong: (...args: any[]) => any[];
87
+ let $mol_dev_format_string: (...args: any[]) => any[];
88
+ let $mol_dev_format_shade: (...args: any[]) => any[];
89
+ let $mol_dev_format_indent: (...args: any[]) => any[];
90
+ }
91
+
92
+ declare namespace $ {
93
+ class $mol_wire_pub_sub extends $mol_wire_pub implements $mol_wire_sub {
94
+ protected pub_from: number;
95
+ protected cursor: $mol_wire_cursor;
96
+ get pub_list(): $mol_wire_pub[];
97
+ track_on(): $mol_wire_sub | null;
98
+ track_promote(): void;
99
+ track_next(pub?: $mol_wire_pub): $mol_wire_pub | null;
100
+ track_off(sub: $mol_wire_sub | null): void;
101
+ pub_off(sub_pos: number): void;
102
+ destructor(): void;
103
+ forget(from?: number): void;
104
+ affect(quant: number): boolean;
105
+ get pub_empty(): boolean;
106
+ }
107
+ }
108
+
109
+ declare namespace $ {
110
+ let $mol_compare_deep_cache: WeakMap<any, WeakMap<any, boolean>>;
111
+ function $mol_compare_deep<Value>(left: Value, right: Value): boolean;
112
+ }
113
+
114
+ declare namespace $ {
115
+ function $mol_guid(length?: number, exists?: (id: string) => boolean): string;
116
+ }
117
+
118
+ declare namespace $ {
119
+ const $mol_key_store: WeakMap<object, string>;
120
+ function $mol_key<Value>(value: Value): string;
121
+ }
122
+
123
+ declare namespace $ {
124
+ const $mol_ambient_ref: unique symbol;
125
+ type $mol_ambient_context = $;
126
+ function $mol_ambient(this: $ | void, overrides: Partial<$>): $;
127
+ }
128
+
129
+ declare namespace $ {
130
+ function $mol_delegate<Value extends object>(proto: Value, target: () => Value): Value;
131
+ }
132
+
133
+ declare namespace $ {
134
+ const $mol_owning_map: WeakMap<any, any>;
135
+ function $mol_owning_allow<Having>(having: Having): having is Having & {
136
+ destructor(): void;
137
+ };
138
+ function $mol_owning_get<Having, Owner extends object>(having: Having, Owner?: {
139
+ new (): Owner;
140
+ }): Owner | null;
141
+ function $mol_owning_check<Owner, Having>(owner: Owner, having: Having): having is Having & {
142
+ destructor(): void;
143
+ };
144
+ function $mol_owning_catch<Owner, Having>(owner: Owner, having: Having): boolean;
145
+ }
146
+
147
+ declare namespace $ {
148
+ function $mol_fail_hidden(error: any): never;
149
+ }
150
+
151
+ declare namespace $ {
152
+ type $mol_type_writable<T> = {
153
+ -readonly [P in keyof T]: T[P];
154
+ };
155
+ }
156
+
157
+ declare namespace $ {
158
+ class $mol_object2 {
159
+ static $: typeof $$;
160
+ [$mol_ambient_ref]: typeof $$;
161
+ get $(): $;
162
+ set $(next: $);
163
+ static create<Instance>(this: new (init?: (instance: any) => void) => Instance, init?: (instance: $mol_type_writable<Instance>) => void): Instance;
164
+ static [Symbol.toPrimitive](): any;
165
+ static toString(): any;
166
+ destructor(): void;
167
+ toString(): any;
168
+ toJSON(): any;
169
+ }
170
+ }
171
+
172
+ declare namespace $ {
173
+ class $mol_after_frame extends $mol_object2 {
174
+ task: () => void;
175
+ static _promise: Promise<void> | null;
176
+ static get promise(): Promise<void>;
177
+ cancelled: boolean;
178
+ promise: Promise<void>;
179
+ constructor(task: () => void);
180
+ destructor(): void;
181
+ }
182
+ }
183
+
184
+ declare namespace $ {
185
+ function $mol_wire_method<Host extends object, Args extends readonly any[], Result>(host: Host, field: PropertyKey, descr?: TypedPropertyDescriptor<(...args: Args) => Result>): {
186
+ value: (this: Host, ...args: Args) => Result;
187
+ enumerable?: boolean | undefined;
188
+ configurable?: boolean | undefined;
189
+ writable?: boolean | undefined;
190
+ get?: (() => (...args: Args) => Result) | undefined;
191
+ set?: ((value: (...args: Args) => Result) => void) | undefined;
192
+ };
193
+ }
194
+
195
+ declare namespace $ {
196
+ class $mol_wire_fiber<Host, Args extends readonly unknown[], Result> extends $mol_wire_pub_sub {
197
+ readonly host: Host;
198
+ readonly task: (this: Host, ...args: Args) => Result;
199
+ static temp<Host, Args extends readonly unknown[], Result>(host: Host, task: (this: Host, ...args: Args) => Result, ...args: Args): $mol_wire_fiber<Host, [...Args], Result>;
200
+ static persist<Host, Args extends readonly unknown[], Result>(host: Host, task: (this: Host, ...args: Args) => Result, ...args: Args): $mol_wire_fiber<Host, [...Args], Result>;
201
+ static warm: boolean;
202
+ static planning: $mol_wire_fiber<any, any, any>[];
203
+ static reaping: $mol_wire_fiber<any, any, any>[];
204
+ static plan_task: $mol_after_frame | null;
205
+ static plan(): void;
206
+ static sync(): void;
207
+ cache: Result | Error | Promise<Result | Error>;
208
+ get args(): Args;
209
+ get result(): Result | undefined;
210
+ get persist(): boolean;
211
+ field(): string;
212
+ constructor(host: Host, task: (this: Host, ...args: Args) => Result, id: string, ...args: Args);
213
+ destructor(): void;
214
+ plan(): void;
215
+ reap(): void;
216
+ toString(): any;
217
+ get $(): any;
218
+ affect(quant: number): boolean;
219
+ down(): void;
220
+ up(): void;
221
+ put(next: Result | Error | Promise<Result | Error>): Error | Result | Promise<Error | Result>;
222
+ recall(...args: Args): Error | Result | Promise<Error | Result>;
223
+ sync(): Awaited<Result>;
224
+ async(): Promise<Result>;
225
+ }
226
+ }
227
+
228
+ declare namespace $ {
229
+ function $mol_wire_probe<Value>(task: () => Value, next?: Value): Value | undefined;
230
+ }
231
+
232
+ declare namespace $ {
233
+ function $mol_wire_solid(): void;
234
+ }
235
+
236
+ declare namespace $ {
237
+ function $mol_wire_sync<Host extends object>(obj: Host): { [key in keyof Host]: Host[key] extends (...args: infer Args) => Promise<infer Res> ? (...args: Args) => Res : Host[key]; };
238
+ }
239
+
240
+ declare namespace $ {
241
+ function $mol_wire_async<Host extends object>(obj: Host): { [key in keyof Host]: Host[key] extends (...args: infer Args) => infer Res ? Res extends Promise<any> ? Host[key] : (...args: Args) => Promise<Res> : Host[key]; };
242
+ }
243
+
244
+ declare namespace $ {
245
+ function $mol_fail_catch(error: unknown): boolean;
246
+ }
247
+
248
+ declare namespace $ {
249
+ function $mol_fail_log(error: unknown): boolean;
250
+ }
251
+
252
+ declare namespace $ {
253
+ let $mol_wire_mem: <Keys extends number>(keys: Keys) => <Host extends object, Field extends keyof Host, Prop extends Extract<Host[Field], (...args: any[]) => any>>(host: Host, field: Field, descr?: TypedPropertyDescriptor<Prop> | undefined) => {
254
+ value: (this: Host, ...args: any[]) => any;
255
+ enumerable?: boolean | undefined;
256
+ configurable?: boolean | undefined;
257
+ writable?: boolean | undefined;
258
+ get?: (() => Prop) | undefined;
259
+ set?: ((value: Prop) => void) | undefined;
260
+ };
261
+ }
262
+
263
+ declare namespace $ {
264
+ function $mol_const<Value>(value: Value): {
265
+ (): Value;
266
+ '()': Value;
267
+ };
268
+ }
269
+
270
+ declare namespace $ {
271
+ function $mol_wire_field<Host extends object, Field extends keyof Host, Value extends Host[Field]>(host: Host, field: Field, descr?: TypedPropertyDescriptor<Value>): any;
272
+ }
1
273
 
2
274
  export = $;