mol_view_tree2_lib 1.0.196 → 1.0.197

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 CHANGED
@@ -16,11 +16,17 @@ declare namespace $ {
16
16
 
17
17
  declare namespace $ {
18
18
  const $mol_ambient_ref: unique symbol;
19
+ /** @deprecated use $ instead */
19
20
  type $mol_ambient_context = $;
20
21
  function $mol_ambient(this: $ | void, overrides: Partial<$>): $;
21
22
  }
22
23
 
23
24
  declare namespace $ {
25
+ /**
26
+ * Proxy that delegates all to lazy returned target.
27
+ *
28
+ * $mol_delegate( Array.prototype , ()=> fetch_array() )
29
+ */
24
30
  function $mol_delegate<Value extends object>(proto: Value, target: () => Value): Value;
25
31
  }
26
32
 
@@ -82,6 +88,7 @@ declare namespace $ {
82
88
  }
83
89
 
84
90
  declare namespace $ {
91
+ /** Position in any resource. */
85
92
  class $mol_span extends $mol_object2 {
86
93
  readonly uri: string;
87
94
  readonly source: string;
@@ -89,9 +96,13 @@ declare namespace $ {
89
96
  readonly col: number;
90
97
  readonly length: number;
91
98
  constructor(uri: string, source: string, row: number, col: number, length: number);
99
+ /** Span for begin of unknown resource */
92
100
  static unknown: $mol_span;
101
+ /** Makes new span for begin of resource. */
93
102
  static begin(uri: string, source?: string): $mol_span;
103
+ /** Makes new span for end of resource. */
94
104
  static end(uri: string, source: string): $mol_span;
105
+ /** Makes new span for entire resource. */
95
106
  static entire(uri: string, source: string): $mol_span;
96
107
  toString(): string;
97
108
  toJSON(): {
@@ -100,14 +111,19 @@ declare namespace $ {
100
111
  col: number;
101
112
  length: number;
102
113
  };
114
+ /** Makes new error for this span. */
103
115
  error(message: string, Class?: ErrorConstructor): Error;
116
+ /** Makes new span for same uri. */
104
117
  span(row: number, col: number, length: number): $mol_span;
118
+ /** Makes new span after end of this. */
105
119
  after(length?: number): $mol_span;
120
+ /** Makes new span between begin and end. */
106
121
  slice(begin: number, end?: number): $mol_span;
107
122
  }
108
123
  }
109
124
 
110
125
  declare namespace $ {
126
+ /** Syntax error with cordinates and source line snippet. */
111
127
  class $mol_error_syntax extends SyntaxError {
112
128
  reason: string;
113
129
  line: string;
@@ -117,10 +133,12 @@ declare namespace $ {
117
133
  }
118
134
 
119
135
  declare namespace $ {
136
+ /** Parses tree format from string. */
120
137
  function $mol_tree2_from_string(this: $, str: string, uri?: string): $mol_tree2;
121
138
  }
122
139
 
123
140
  declare namespace $ {
141
+ /** Serializes tree to string in tree format. */
124
142
  function $mol_tree2_to_string(this: $, tree: $mol_tree2): string;
125
143
  }
126
144
 
@@ -129,37 +147,74 @@ declare namespace $ {
129
147
  }
130
148
 
131
149
  declare namespace $ {
150
+ /** Path by types in tree. */
132
151
  type $mol_tree2_path = Array<string | number | null>;
152
+ /** Hask tool for processing node. */
133
153
  type $mol_tree2_hack<Context> = (input: $mol_tree2, belt: $mol_tree2_belt<Context>, context: Context) => readonly $mol_tree2[];
154
+ /** Collection of hask tools for processing tree. */
134
155
  type $mol_tree2_belt<Context> = Record<string, $mol_tree2_hack<Context>>;
156
+ /**
157
+ * Abstract Syntax Tree with human readable serialization.
158
+ * Avoid direct instantiation. Use static factories instead.
159
+ * @see https://github.com/nin-jin/tree.d
160
+ */
135
161
  class $mol_tree2 extends Object {
162
+ /** Type of structural node, `value` should be empty */
136
163
  readonly type: string;
164
+ /** Content of data node, `type` should be empty */
137
165
  readonly value: string;
166
+ /** Child nodes */
138
167
  readonly kids: readonly $mol_tree2[];
168
+ /** Position in most far source resource */
139
169
  readonly span: $mol_span;
140
- constructor(type: string, value: string, kids: readonly $mol_tree2[], span: $mol_span);
170
+ constructor(
171
+ /** Type of structural node, `value` should be empty */
172
+ type: string,
173
+ /** Content of data node, `type` should be empty */
174
+ value: string,
175
+ /** Child nodes */
176
+ kids: readonly $mol_tree2[],
177
+ /** Position in most far source resource */
178
+ span: $mol_span);
179
+ /** Makes collection node. */
141
180
  static list(kids: readonly $mol_tree2[], span?: $mol_span): $mol_tree2;
181
+ /** Makes new derived collection node. */
142
182
  list(kids: readonly $mol_tree2[]): $mol_tree2;
183
+ /** Makes data node for any string. */
143
184
  static data(value: string, kids?: readonly $mol_tree2[], span?: $mol_span): $mol_tree2;
185
+ /** Makes new derived data node. */
144
186
  data(value: string, kids?: readonly $mol_tree2[]): $mol_tree2;
187
+ /** Makes struct node. */
145
188
  static struct(type: string, kids?: readonly $mol_tree2[], span?: $mol_span): $mol_tree2;
189
+ /** Makes new derived structural node. */
146
190
  struct(type: string, kids?: readonly $mol_tree2[]): $mol_tree2;
191
+ /** Makes new derived node with different kids id defined. */
147
192
  clone(kids: readonly $mol_tree2[], span?: $mol_span): $mol_tree2;
193
+ /** Returns multiline text content. */
148
194
  text(): string;
195
+ /** Parses tree format. */
196
+ /** @deprecated Use $mol_tree2_from_string */
149
197
  static fromString(str: string, uri?: string): $mol_tree2;
198
+ /** Serializes to tree format. */
150
199
  toString(): string;
200
+ /** Makes new tree with node overrided by path. */
151
201
  insert(value: $mol_tree2 | null, ...path: $mol_tree2_path): $mol_tree2;
202
+ /** Makes new tree with node overrided by path. */
152
203
  update(value: readonly $mol_tree2[], ...path: $mol_tree2_path): readonly $mol_tree2[];
204
+ /** Query nodes by path. */
153
205
  select(...path: $mol_tree2_path): $mol_tree2;
206
+ /** Filter kids by path or value. */
154
207
  filter(path: string[], value?: string): $mol_tree2;
155
208
  hack_self<Context extends {
156
209
  span?: $mol_span;
157
210
  [key: string]: unknown;
158
211
  } = {}>(belt: $mol_tree2_belt<Context>, context?: Context): readonly $mol_tree2[];
212
+ /** Transform tree through context with transformers */
159
213
  hack<Context extends {
160
214
  span?: $mol_span;
161
215
  [key: string]: unknown;
162
216
  } = {}>(belt: $mol_tree2_belt<Context>, context?: Context): $mol_tree2[];
217
+ /** Makes Error with node coordinates. */
163
218
  error(message: string, Class?: ErrorConstructor): Error;
164
219
  }
165
220
  class $mol_tree2_empty extends $mol_tree2 {
@@ -272,6 +327,7 @@ declare namespace $ {
272
327
  }
273
328
 
274
329
  declare namespace $ {
330
+ /** Makes JSON from json.tree. */
275
331
  function $mol_tree2_to_json(this: $, tree: $mol_tree2): unknown;
276
332
  }
277
333
 
@@ -295,21 +351,44 @@ declare namespace $ {
295
351
  }
296
352
 
297
353
  declare namespace $ {
354
+ /**
355
+ * Return `unknown` when `A` and `B` are the same type. `never` otherwise.
356
+ *
357
+ * $mol_type_equals< unknown , any > & number // never
358
+ * $mol_type_equals< never , never > & number // number
359
+ */
298
360
  type $mol_type_equals<A, B> = (<X>() => X extends A ? 1 : 2) extends (<X>() => X extends B ? 1 : 2) ? unknown : never;
299
361
  }
300
362
 
301
363
  declare namespace $ {
364
+ /**
365
+ * Reqursive converts intersection of records to record of intersections
366
+ *
367
+ * // { a : { x : 1 , y : 2 } }
368
+ * $mol_type_merge< { a : { x : 1 } }&{ a : { y : 2 } } >
369
+ */
302
370
  type $mol_type_merge<Intersection> = Intersection extends (...a: any[]) => any ? Intersection : Intersection extends new (...a: any[]) => any ? Intersection : Intersection extends object ? $mol_type_merge_object<Intersection> extends Intersection ? unknown extends $mol_type_equals<{
303
371
  [Key in keyof Intersection]: Intersection[Key];
304
372
  }, Intersection> ? Intersection : {
305
373
  [Key in keyof Intersection]: $mol_type_merge<Intersection[Key]>;
306
374
  } : Intersection : Intersection;
375
+ /**
376
+ * Flat converts intersection of records to record of intersections
377
+ *
378
+ * // { a: 1, b: 2 }
379
+ * $mol_type_merge< { a: 1 } & { b: 2 } >
380
+ */
307
381
  type $mol_type_merge_object<Intersection> = {
308
382
  [Key in keyof Intersection]: Intersection[Key];
309
383
  };
310
384
  }
311
385
 
312
386
  declare namespace $ {
387
+ /**
388
+ * Converts union of types to intersection of same types
389
+ *
390
+ * $mol_type_intersect< number | string > // number & string
391
+ */
313
392
  type $mol_type_intersect<Union> = (Union extends any ? (_: Union) => void : never) extends ((_: infer Intersection) => void) ? Intersection : never;
314
393
  }
315
394
 
@@ -346,15 +425,19 @@ declare namespace $ {
346
425
  readonly [k in key]: Source[key] extends string ? Source[key] : string;
347
426
  }> & $mol_regexp_groups<Source[key]>>;
348
427
  }[keyof Source]>> : never;
428
+ /** Type safe reguar expression builder */
349
429
  export class $mol_regexp<Groups extends Record<string, string>> extends RegExp {
350
430
  readonly groups: (Extract<keyof Groups, string>)[];
431
+ /** Prefer to use $mol_regexp.from */
351
432
  constructor(source: string, flags?: string, groups?: (Extract<keyof Groups, string>)[]);
352
433
  [Symbol.matchAll](str: string): RegExpStringIterator<RegExpExecArray & $mol_type_override<RegExpExecArray, {
353
434
  groups?: {
354
435
  [key in keyof Groups]: string;
355
436
  };
356
437
  }>>;
438
+ /** Parses input and returns found capture groups or null */
357
439
  [Symbol.match](str: string): null | RegExpMatchArray;
440
+ /** Splits string by regexp edges */
358
441
  [Symbol.split](str: string): string[];
359
442
  test(str: string): boolean;
360
443
  exec(str: string): RegExpExecArray & $mol_type_override<RegExpExecArray, {
@@ -364,6 +447,7 @@ declare namespace $ {
364
447
  }> | null;
365
448
  generate(params: Groups_to_params<Groups>): string | null;
366
449
  get native(): RegExp;
450
+ /** Makes regexp that greedy repeats this pattern with delimiter */
367
451
  static separated<Chunk extends $mol_regexp_source, Sep extends $mol_regexp_source>(chunk: Chunk, sep: Sep): $mol_regexp<[$mol_regexp<[[Chunk], Sep] extends infer T ? T extends [[Chunk], Sep] ? T extends $mol_regexp_source[] ? $mol_type_merge<$mol_type_intersect<{ [key in Extract<keyof T, number>]: $mol_regexp_groups<T[key]>; }[Extract<keyof T, number>]>> : T extends RegExp ? Record<string, string> extends NonNullable<NonNullable<ReturnType<T["exec"]>>["groups"]> ? {} : NonNullable<NonNullable<ReturnType<T["exec"]>>["groups"]> : T extends {
368
452
  readonly [x: string]: $mol_regexp_source;
369
453
  } ? $mol_type_merge<$mol_type_intersect<{ [key_1 in keyof T]: $mol_type_merge<Omit<{ readonly [k in Extract<keyof T, string>]: string; }, key_1> & { readonly [k_1 in key_1]: T[key_1] extends string ? T[key_1] : string; } & $mol_regexp_groups<T[key_1]>>; }[keyof T]>> : never : never : never>, Chunk] extends infer T_1 ? T_1 extends [$mol_regexp<[[Chunk], Sep] extends infer T_2 ? T_2 extends [[Chunk], Sep] ? T_2 extends $mol_regexp_source[] ? $mol_type_merge<$mol_type_intersect<{ [key_4 in Extract<keyof T_2, number>]: $mol_regexp_groups<T_2[key_4]>; }[Extract<keyof T_2, number>]>> : T_2 extends RegExp ? Record<string, string> extends NonNullable<NonNullable<ReturnType<T_2["exec"]>>["groups"]> ? {} : NonNullable<NonNullable<ReturnType<T_2["exec"]>>["groups"]> : T_2 extends {
@@ -371,14 +455,23 @@ declare namespace $ {
371
455
  } ? $mol_type_merge<$mol_type_intersect<{ [key_5 in keyof T_2]: $mol_type_merge<Omit<{ readonly [k in Extract<keyof T_2, string>]: string; }, key_5> & { readonly [k_1 in key_5]: T_2[key_5] extends string ? T_2[key_5] : string; } & $mol_regexp_groups<T_2[key_5]>>; }[keyof T_2]>> : never : never : never>, Chunk] ? T_1 extends $mol_regexp_source[] ? $mol_type_merge<$mol_type_intersect<{ [key_2 in Extract<keyof T_1, number>]: $mol_regexp_groups<T_1[key_2]>; }[Extract<keyof T_1, number>]>> : T_1 extends RegExp ? Record<string, string> extends NonNullable<NonNullable<ReturnType<T_1["exec"]>>["groups"]> ? {} : NonNullable<NonNullable<ReturnType<T_1["exec"]>>["groups"]> : T_1 extends {
372
456
  readonly [x: string]: $mol_regexp_source;
373
457
  } ? $mol_type_merge<$mol_type_intersect<{ [key_3 in keyof T_1]: $mol_type_merge<Omit<{ readonly [k in Extract<keyof T_1, string>]: string; }, key_3> & { readonly [k_1 in key_3]: T_1[key_3] extends string ? T_1[key_3] : string; } & $mol_regexp_groups<T_1[key_3]>>; }[keyof T_1]>> : never : never : never>;
458
+ /** Makes regexp that non-greedy repeats this pattern from min to max count */
374
459
  static repeat<Source extends $mol_regexp_source>(source: Source, min?: number, max?: number): $mol_regexp<$mol_regexp_groups<Source>>;
460
+ /** Makes regexp that greedy repeats this pattern from min to max count */
375
461
  static repeat_greedy<Source extends $mol_regexp_source>(source: Source, min?: number, max?: number): $mol_regexp<$mol_regexp_groups<Source>>;
462
+ /** Makes regexp that match any of options */
376
463
  static vary<Sources extends readonly $mol_regexp_source[]>(sources: Sources, flags?: string): $mol_regexp<$mol_regexp_groups<Sources[number]>>;
464
+ /** Makes regexp that allow absent of this pattern */
377
465
  static optional<Source extends $mol_regexp_source>(source: Source): $mol_regexp<$mol_regexp_groups<Source>>;
466
+ /** Makes regexp that look ahead for pattern */
378
467
  static force_after(source: $mol_regexp_source): $mol_regexp<Record<string, string>>;
468
+ /** Makes regexp that look ahead for pattern */
379
469
  static forbid_after(source: $mol_regexp_source): $mol_regexp<Record<string, string>>;
470
+ /** Converts some js values to regexp */
380
471
  static from<Source extends $mol_regexp_source>(source: Source, { ignoreCase, multiline }?: Partial<Pick<RegExp, 'ignoreCase' | 'multiline'>>): $mol_regexp<$mol_regexp_groups<Source>>;
472
+ /** Makes regexp which includes only unicode category */
381
473
  static unicode_only(...category: $mol_unicode_category): $mol_regexp<Record<string, string>>;
474
+ /** Makes regexp which excludes unicode category */
382
475
  static unicode_except(...category: $mol_unicode_category): $mol_regexp<Record<string, string>>;
383
476
  static char_range(from: number, to: number): $mol_regexp<{}>;
384
477
  static char_only(...allowed: readonly [$mol_regexp_source, ...$mol_regexp_source[]]): $mol_regexp<{}>;
@@ -427,6 +520,9 @@ declare namespace $ {
427
520
  }
428
521
 
429
522
  declare namespace $ {
523
+ /**
524
+ * Fails if `Actual` type is not subtype of `Expected`.
525
+ */
430
526
  type $mol_type_enforce<Actual extends Expected, Expected> = Actual;
431
527
  }
432
528
 
@@ -455,57 +551,130 @@ declare namespace $ {
455
551
  }
456
552
 
457
553
  declare namespace $ {
554
+ /** Generates unique identifier. */
458
555
  function $mol_guid(length?: number, exists?: (id: string) => boolean): string;
459
556
  }
460
557
 
461
558
  declare namespace $ {
559
+ /** Special status statuses. */
462
560
  enum $mol_wire_cursor {
561
+ /** Update required. */
463
562
  stale = -1,
563
+ /** Some of (transitive) pub update required. */
464
564
  doubt = -2,
565
+ /** Actual state but may be dropped. */
465
566
  fresh = -3,
567
+ /** State will never be changed. */
466
568
  final = -4
467
569
  }
468
570
  }
469
571
 
470
572
  declare namespace $ {
573
+ /**
574
+ * Collects subscribers in compact array. 28B
575
+ */
471
576
  class $mol_wire_pub extends Object {
472
577
  constructor(id?: string);
473
578
  [Symbol.toStringTag]: string;
474
579
  data: unknown[];
475
580
  static get [Symbol.species](): ArrayConstructor;
581
+ /**
582
+ * Index of first subscriber.
583
+ */
476
584
  protected sub_from: number;
585
+ /**
586
+ * All current subscribers.
587
+ */
477
588
  get sub_list(): readonly $mol_wire_sub[];
589
+ /**
590
+ * Has any subscribers or not.
591
+ */
478
592
  get sub_empty(): boolean;
593
+ /**
594
+ * Subscribe subscriber to this publisher events and return position of subscriber that required to unsubscribe.
595
+ */
479
596
  sub_on(sub: $mol_wire_pub, pub_pos: number): number;
597
+ /**
598
+ * Unsubscribe subscriber from this publisher events by subscriber position provided by `on(pub)`.
599
+ */
480
600
  sub_off(sub_pos: number): void;
601
+ /**
602
+ * Called when last sub was unsubscribed.
603
+ **/
481
604
  reap(): void;
605
+ /**
606
+ * Autowire this publisher with current subscriber.
607
+ **/
482
608
  promote(): void;
609
+ /**
610
+ * Enforce actualization. Should not throw errors.
611
+ */
483
612
  fresh(): void;
613
+ /**
614
+ * Allow to put data to caches in the subtree.
615
+ */
484
616
  complete(): void;
485
617
  get incompleted(): boolean;
618
+ /**
619
+ * Notify subscribers about self changes.
620
+ */
486
621
  emit(quant?: $mol_wire_cursor): void;
622
+ /**
623
+ * Moves peer from one position to another. Doesn't clear data at old position!
624
+ */
487
625
  peer_move(from_pos: number, to_pos: number): void;
626
+ /**
627
+ * Updates self position in the peer.
628
+ */
488
629
  peer_repos(peer_pos: number, self_pos: number): void;
489
630
  }
490
631
  }
491
632
 
492
633
  declare namespace $ {
634
+ /** Generic subscriber interface */
493
635
  interface $mol_wire_sub extends $mol_wire_pub {
494
636
  temp: boolean;
495
637
  pub_list: $mol_wire_pub[];
638
+ /**
639
+ * Begin auto wire to publishers.
640
+ * Returns previous auto subscriber that must me transfer to the `end`.
641
+ */
496
642
  track_on(): $mol_wire_sub | null;
643
+ /**
644
+ * Returns next auto wired publisher. It can be easely repormoted.
645
+ * Or promotes next publisher to auto wire its togeter.
646
+ * Must be used only between `track_on` and `track_off`.
647
+ */
497
648
  track_next(pub?: $mol_wire_pub): $mol_wire_pub | null;
498
649
  pub_off(pub_pos: number): void;
650
+ /**
651
+ * Unsubscribes from unpromoted publishers.
652
+ */
499
653
  track_cut(sub: $mol_wire_pub | null): void;
654
+ /**
655
+ * Ends auto wire to publishers.
656
+ */
500
657
  track_off(sub: $mol_wire_pub | null): void;
658
+ /**
659
+ * Receive notification about publisher changes.
660
+ */
501
661
  absorb(quant: $mol_wire_cursor, pos: number): void;
662
+ /**
663
+ * Unsubscribes from all publishers.
664
+ */
502
665
  destructor(): void;
503
666
  }
504
667
  }
505
668
 
506
669
  declare namespace $ {
507
670
  let $mol_wire_auto_sub: $mol_wire_sub | null;
671
+ /**
672
+ * When fulfilled, all publishers are promoted to this subscriber on access to its.
673
+ */
508
674
  function $mol_wire_auto(next?: $mol_wire_sub | null): $mol_wire_sub | null;
675
+ /**
676
+ * Affection queue. Used to prevent accidental stack overflow on emit.
677
+ */
509
678
  const $mol_wire_affected: ($mol_wire_sub | number)[];
510
679
  }
511
680
 
@@ -538,6 +707,13 @@ declare namespace $ {
538
707
  }
539
708
 
540
709
  declare namespace $ {
710
+ /**
711
+ * Publisher that can auto collect other publishers. 32B
712
+ *
713
+ * P1 P2 P3 P4 S1 S2 S3
714
+ * ^ ^
715
+ * pubs_from subs_from
716
+ */
541
717
  class $mol_wire_pub_sub extends $mol_wire_pub implements $mol_wire_sub {
542
718
  protected pub_from: number;
543
719
  protected cursor: $mol_wire_cursor;
@@ -554,6 +730,9 @@ declare namespace $ {
554
730
  complete_pubs(): void;
555
731
  absorb(quant?: $mol_wire_cursor, pos?: number): void;
556
732
  [$mol_dev_format_head](): any[];
733
+ /**
734
+ * Is subscribed to any publisher or not.
735
+ */
557
736
  get pub_empty(): boolean;
558
737
  }
559
738
  }
@@ -573,6 +752,13 @@ declare namespace $ {
573
752
  }
574
753
 
575
754
  declare namespace $ {
755
+ /**
756
+ * Suspendable task with support both sync/async api.
757
+ *
758
+ * A1 A2 A3 A4 P1 P2 P3 P4 S1 S2 S3
759
+ * ^ ^ ^
760
+ * args_from pubs_from subs_from
761
+ **/
576
762
  abstract class $mol_wire_fiber<Host, Args extends readonly unknown[], Result> extends $mol_wire_pub_sub {
577
763
  readonly task: (this: Host, ...args: Args) => Result;
578
764
  readonly host?: Host | undefined;
@@ -599,7 +785,15 @@ declare namespace $ {
599
785
  fresh(): this | undefined;
600
786
  refresh(): void;
601
787
  abstract put(next: Result | Error | Promise<Result | Error>): Result | Error | Promise<Result | Error>;
788
+ /**
789
+ * Synchronous execution. Throws Promise when waits async task (SuspenseAPI provider).
790
+ * Should be called inside SuspenseAPI consumer (ie fiber).
791
+ */
602
792
  sync(): Awaited<Result>;
793
+ /**
794
+ * Asynchronous execution.
795
+ * It's SuspenseAPI consumer. So SuspenseAPI providers can be called inside.
796
+ */
603
797
  async_raw(): Promise<Result>;
604
798
  async(): Promise<Result> & {
605
799
  destructor(): void;
@@ -610,6 +804,7 @@ declare namespace $ {
610
804
  }
611
805
 
612
806
  declare namespace $ {
807
+ /** Returns string key for any value. */
613
808
  function $mol_key<Value>(value: Value): string;
614
809
  }
615
810
 
@@ -632,31 +827,48 @@ declare namespace $ {
632
827
 
633
828
  declare namespace $ {
634
829
  let $mol_compare_deep_cache: WeakMap<any, WeakMap<any, boolean>>;
830
+ /**
831
+ * Deeply compares two values. Returns true if equal.
832
+ * Define `Symbol.toPrimitive` to customize.
833
+ */
635
834
  function $mol_compare_deep<Value>(left: Value, right: Value): boolean;
636
835
  }
637
836
 
638
837
  declare namespace $ {
838
+ /** Logger event data */
639
839
  type $mol_log3_event<Fields> = {
640
840
  [key in string]: unknown;
641
841
  } & {
842
+ /** Time of event creation */
642
843
  time?: string;
844
+ /** Place of event creation */
643
845
  place: unknown;
846
+ /** Short description of event */
644
847
  message: string;
645
848
  } & Fields;
849
+ /** Logger function */
646
850
  type $mol_log3_logger<Fields, Res = void> = (this: $, event: $mol_log3_event<Fields>) => Res;
851
+ /** Log begin of some task */
647
852
  let $mol_log3_come: $mol_log3_logger<{}>;
853
+ /** Log end of some task */
648
854
  let $mol_log3_done: $mol_log3_logger<{}>;
855
+ /** Log error */
649
856
  let $mol_log3_fail: $mol_log3_logger<{}>;
857
+ /** Log warning message */
650
858
  let $mol_log3_warn: $mol_log3_logger<{
651
859
  hint: string;
652
860
  }>;
861
+ /** Log some generic event */
653
862
  let $mol_log3_rise: $mol_log3_logger<{}>;
863
+ /** Log begin of log group, returns func to close group */
654
864
  let $mol_log3_area: $mol_log3_logger<{}, () => void>;
865
+ /** Log begin of collapsed group only when some logged inside, returns func to close group */
655
866
  function $mol_log3_area_lazy(this: $, event: $mol_log3_event<{}>): () => void;
656
867
  let $mol_log3_stack: (() => void)[];
657
868
  }
658
869
 
659
870
  declare namespace $ {
871
+ /** Module for working with terminal. Text coloring when output in terminal */
660
872
  class $mol_term_color {
661
873
  static reset: (str: string) => string;
662
874
  static bold: (str: string) => string;
@@ -688,6 +900,7 @@ declare namespace $ {
688
900
  }
689
901
 
690
902
  declare namespace $ {
903
+ /** One-shot fiber */
691
904
  class $mol_wire_task<Host, Args extends readonly unknown[], Result> extends $mol_wire_fiber<Host, Args, Result> {
692
905
  static getter<Host, Args extends readonly unknown[], Result>(task: (this: Host, ...args: Args) => Result): (host: Host, args: Args) => $mol_wire_task<Host, Args, Result>;
693
906
  get temp(): boolean;
@@ -698,6 +911,9 @@ declare namespace $ {
698
911
  }
699
912
 
700
913
  declare namespace $ {
914
+ /**
915
+ * Decorates method to fiber to ensure it is executed only once inside other fiber.
916
+ */
701
917
  function $mol_wire_method<Host extends object, Args extends readonly any[]>(host: Host, field: PropertyKey, descr?: TypedPropertyDescriptor<(...args: Args) => any>): {
702
918
  value: (this: Host, ...args: Args) => any;
703
919
  enumerable?: boolean;
@@ -709,10 +925,20 @@ declare namespace $ {
709
925
  }
710
926
 
711
927
  declare namespace $ {
928
+ /**
929
+ * Returns `Tuple` without first element.
930
+ *
931
+ * $mol_type_tail<[ 1 , 2 , 3 ]> // [ 2, 3 ]
932
+ */
712
933
  type $mol_type_tail<Tuple extends readonly any[]> = ((...tail: Tuple) => any) extends ((head: any, ...tail: infer Tail) => any) ? Tail : never;
713
934
  }
714
935
 
715
936
  declare namespace $ {
937
+ /**
938
+ * Returns last element of `Tuple`.
939
+ *
940
+ * $mol_type_tail<[ 1 , 2 , 3 ]> // 3
941
+ */
716
942
  type $mol_type_foot<Tuple extends readonly any[]> = Tuple['length'] extends 0 ? never : Tuple[$mol_type_tail<Tuple>['length']];
717
943
  }
718
944
 
@@ -729,6 +955,7 @@ declare namespace $ {
729
955
  }
730
956
 
731
957
  declare namespace $ {
958
+ /** Long-living fiber. */
732
959
  class $mol_wire_atom<Host, Args extends readonly unknown[], Result> extends $mol_wire_fiber<Host, Args, Result> {
733
960
  static solo<Host, Args extends readonly unknown[], Result>(host: Host, task: (this: Host, ...args: Args) => Result): $mol_wire_atom<Host, Args, Result>;
734
961
  static plex<Host, Args extends readonly unknown[], Result>(host: Host, task: (this: Host, ...args: Args) => Result, key: Args[0]): $mol_wire_atom<Host, Args, Result>;
@@ -736,6 +963,9 @@ declare namespace $ {
736
963
  static watcher: $mol_after_frame | null;
737
964
  static watch(): void;
738
965
  watch(): void;
966
+ /**
967
+ * Update atom value through another temp fiber.
968
+ */
739
969
  resync(args: Args): Error | Result | Promise<Error | Result>;
740
970
  once(): Awaited<Result>;
741
971
  channel(): ((next?: $mol_type_foot<Args>) => Awaited<Result>) & {
@@ -747,12 +977,14 @@ declare namespace $ {
747
977
  }
748
978
 
749
979
  declare namespace $ {
980
+ /** Decorates solo object channel to [mol_wire_atom](../atom/atom.ts). */
750
981
  export function $mol_wire_solo<Args extends any[]>(host: object, field: string, descr?: TypedPropertyDescriptor<(...args: Args) => any>): TypedPropertyDescriptor<(...args: First_optional<Args>) => any>;
751
982
  type First_optional<Args extends any[]> = Args extends [] ? [] : [Args[0] | undefined, ...$mol_type_tail<Args>];
752
983
  export {};
753
984
  }
754
985
 
755
986
  declare namespace $ {
987
+ /** Reactive memoizing multiplexed property decorator. */
756
988
  function $mol_wire_plex<Args extends [any, ...any[]]>(host: object, field: string, descr?: TypedPropertyDescriptor<(...args: Args) => any>): {
757
989
  value: (this: typeof host, ...args: Args) => any;
758
990
  enumerable?: boolean;
@@ -764,7 +996,25 @@ declare namespace $ {
764
996
  }
765
997
 
766
998
  declare namespace $ {
999
+ /**
1000
+ * Reactive memoizing solo property decorator from [mol_wire](../wire/README.md)
1001
+ * @example
1002
+ * '@' $mol_mem
1003
+ * name(next?: string) {
1004
+ * return next ?? 'default'
1005
+ * }
1006
+ * @see https://mol.hyoo.ru/#!section=docs/=qxmh6t_sinbmb
1007
+ */
767
1008
  let $mol_mem: typeof $mol_wire_solo;
1009
+ /**
1010
+ * Reactive memoizing multiplexed property decorator [mol_wire](../wire/README.md)
1011
+ * @example
1012
+ * '@' $mol_mem_key
1013
+ * name(id: number, next?: string) {
1014
+ * return next ?? 'default'
1015
+ * }
1016
+ * @see https://mol.hyoo.ru/#!section=docs/=qxmh6t_sinbmb
1017
+ */
768
1018
  let $mol_mem_key: typeof $mol_wire_plex;
769
1019
  }
770
1020
 
@@ -804,6 +1054,10 @@ declare namespace $ {
804
1054
  }
805
1055
 
806
1056
  declare namespace $ {
1057
+ /**
1058
+ * Convert asynchronous (promise-based) API to synchronous by wrapping function and method calls in a fiber.
1059
+ * @see https://mol.hyoo.ru/#!section=docs/=1fcpsq_1wh0h2
1060
+ */
807
1061
  export function $mol_wire_sync<Host extends object>(obj: Host): ObjectOrFunctionResultAwaited<Host>;
808
1062
  type FunctionResultAwaited<Some> = Some extends (...args: infer Args) => infer Res ? (...args: Args) => Awaited<Res> : Some;
809
1063
  type ConstructorResultAwaited<Some> = Some extends new (...args: infer Args) => infer Res ? new (...args: Args) => Res : {};
@@ -853,6 +1107,9 @@ declare namespace $ {
853
1107
  }
854
1108
 
855
1109
  declare namespace $ {
1110
+ /**
1111
+ * Disable reaping of current subscriber
1112
+ */
856
1113
  function $mol_wire_solid(): void;
857
1114
  }
858
1115
 
@@ -861,6 +1118,7 @@ declare namespace $ {
861
1118
  }
862
1119
 
863
1120
  declare namespace $ {
1121
+ /** Run code without state changes */
864
1122
  function $mol_wire_probe<Value>(task: () => Value, def?: Value): Value | undefined;
865
1123
  }
866
1124
 
@@ -902,6 +1160,11 @@ declare namespace $ {
902
1160
  }
903
1161
 
904
1162
  declare namespace $ {
1163
+ /**
1164
+ * Returns closure that returns constant value.
1165
+ * @example
1166
+ * const rnd = $mol_const( Math.random() )
1167
+ */
905
1168
  function $mol_const<Value>(value: Value): {
906
1169
  (): Value;
907
1170
  '()': Value;
@@ -909,10 +1172,15 @@ declare namespace $ {
909
1172
  }
910
1173
 
911
1174
  declare namespace $ {
1175
+ /**
1176
+ * Decorates method to fiber to ensure it is executed only once inside other fiber from [mol_wire](../wire/README.md)
1177
+ * @see https://mol.hyoo.ru/#!section=docs/=1fcpsq_1wh0h2
1178
+ */
912
1179
  let $mol_action: typeof $mol_wire_method;
913
1180
  }
914
1181
 
915
1182
  declare namespace $ {
1183
+ /** Convert a pseudo-synchronous (Suspense API) API to an explicit asynchronous one (for integrating with external systems). */
916
1184
  export function $mol_wire_async<Host extends object>(obj: Host): ObjectOrFunctionResultPromisify<Host>;
917
1185
  type FunctionResultPromisify<Some> = Some extends (...args: infer Args) => infer Res ? Res extends PromiseLike<unknown> ? Some : (...args: Args) => Promise<Res> : Some;
918
1186
  type MethodsResultPromisify<Host extends Object> = {
@@ -943,6 +1211,7 @@ declare namespace $ {
943
1211
  }
944
1212
 
945
1213
  declare namespace $ {
1214
+ /** Temporary buffer. Recursive usage isn't supported. */
946
1215
  function $mol_charset_buffer(size: number): Uint8Array<ArrayBuffer>;
947
1216
  }
948
1217
 
@@ -1001,6 +1270,10 @@ declare namespace $ {
1001
1270
  protected static changed: Set<$mol_file_base>;
1002
1271
  protected static frame: null | $mol_after_timeout;
1003
1272
  protected static changed_add(type: 'change' | 'rename', path: string): void;
1273
+ /**
1274
+ * Должно быть больше, чем время между событиями от вотчера при записи внешним процессом.
1275
+ * Иначе запуск ресетов паралельно с изменением может привести к неконсистентности.
1276
+ */
1004
1277
  static watch_debounce(): number;
1005
1278
  static flush(): void;
1006
1279
  protected static watching: boolean;
@@ -1102,6 +1375,10 @@ declare namespace $ {
1102
1375
  interface $mol_locale_dict {
1103
1376
  [key: string]: string;
1104
1377
  }
1378
+ /**
1379
+ * Localisation in $mol framework
1380
+ * @see https://mol.hyoo.ru/#!section=docs/=s5aqnb_odub8l
1381
+ */
1105
1382
  class $mol_locale extends $mol_object {
1106
1383
  static lang_default(): string;
1107
1384
  static lang(next?: string): string;