mol_view_tree2_lib 1.0.195 → 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/web.test.js CHANGED
@@ -189,6 +189,12 @@ var $;
189
189
  createDocumentFragment: () => $mol_dom_context.document.createDocumentFragment(),
190
190
  };
191
191
  $.$mol_jsx_frag = '';
192
+ /**
193
+ * JSX adapter that makes DOM tree.
194
+ * Generates global unique ids for every DOM-element by components tree with ids.
195
+ * Ensures all local ids are unique.
196
+ * Can reuse an existing nodes by GUIDs when used inside [`mol_jsx_attach`](https://github.com/hyoo-ru/mam_mol/tree/master/jsx/attach).
197
+ */
192
198
  function $mol_jsx(Elem, props, ...childNodes) {
193
199
  const id = props && props.id || '';
194
200
  const guid = id ? $.$mol_jsx_prefix ? $.$mol_jsx_prefix + '/' + id : id : $.$mol_jsx_prefix;
@@ -299,6 +305,8 @@ var $;
299
305
 
300
306
  ;
301
307
  "use strict";
308
+ /** @jsx $mol_jsx */
309
+ /** @jsxFrag $mol_jsx_frag */
302
310
  var $;
303
311
  (function ($) {
304
312
  $mol_test({
@@ -404,6 +412,7 @@ var $;
404
412
  "use strict";
405
413
  var $;
406
414
  (function ($) {
415
+ /** Lazy computed lists with native Array interface. $mol_range2_array is mutable but all derived ranges are immutable. */
407
416
  function $mol_range2(item = index => index, size = () => Number.POSITIVE_INFINITY) {
408
417
  const source = typeof item === 'function' ? new $mol_range2_array() : item;
409
418
  if (typeof item !== 'function') {
@@ -452,6 +461,7 @@ var $;
452
461
  }
453
462
  $.$mol_range2 = $mol_range2;
454
463
  class $mol_range2_array extends Array {
464
+ // Lazy
455
465
  concat(...tail) {
456
466
  if (tail.length === 0)
457
467
  return this;
@@ -463,6 +473,7 @@ var $;
463
473
  }
464
474
  return $mol_range2(index => index < this.length ? this[index] : tail[0][index - this.length], () => this.length + tail[0].length);
465
475
  }
476
+ // Lazy
466
477
  filter(check, context) {
467
478
  const filtered = [];
468
479
  let cursor = -1;
@@ -475,13 +486,16 @@ var $;
475
486
  return filtered[index];
476
487
  }, () => cursor < this.length ? Number.POSITIVE_INFINITY : filtered.length);
477
488
  }
489
+ // Diligent
478
490
  forEach(proceed, context) {
479
491
  for (let [key, value] of this.entries())
480
492
  proceed.call(context, value, key, this);
481
493
  }
494
+ // Lazy
482
495
  map(proceed, context) {
483
496
  return $mol_range2(index => proceed.call(context, this[index], index, this), () => this.length);
484
497
  }
498
+ // Diligent
485
499
  reduce(merge, result) {
486
500
  let index = 0;
487
501
  if (arguments.length === 1) {
@@ -492,12 +506,15 @@ var $;
492
506
  }
493
507
  return result;
494
508
  }
509
+ // Lazy
495
510
  toReversed() {
496
511
  return $mol_range2(index => this[this.length - 1 - index], () => this.length);
497
512
  }
513
+ // Lazy
498
514
  slice(from = 0, to = this.length) {
499
515
  return $mol_range2(index => this[from + index], () => Math.min(to, this.length) - from);
500
516
  }
517
+ // Lazy
501
518
  some(check, context) {
502
519
  for (let index = 0; index < this.length; ++index) {
503
520
  if (check.call(context, this[index], index, this))
@@ -690,6 +707,7 @@ var $;
690
707
 
691
708
  ;
692
709
  "use strict";
710
+ /** @jsx $mol_jsx */
693
711
  var $;
694
712
  (function ($) {
695
713
  $mol_test({
@@ -751,6 +769,7 @@ var $;
751
769
  const obj3_copy = { test: 3, obj2: obj2_copy };
752
770
  obj1.obj3 = obj3;
753
771
  obj1_copy.obj3 = obj3_copy;
772
+ // warmup cache
754
773
  $mol_assert_not($mol_compare_deep(obj1, {}));
755
774
  $mol_assert_not($mol_compare_deep(obj2, {}));
756
775
  $mol_assert_not($mol_compare_deep(obj3, {}));
@@ -820,18 +839,34 @@ var $;
820
839
  "use strict";
821
840
  var $;
822
841
  (function ($) {
842
+ /**
843
+ * Argument must be Truthy
844
+ * @deprecated use $mol_assert_equal instead
845
+ */
823
846
  function $mol_assert_ok(value) {
824
847
  if (value)
825
848
  return;
826
849
  $mol_fail(new Error(`${value} ≠ true`));
827
850
  }
828
851
  $.$mol_assert_ok = $mol_assert_ok;
852
+ /**
853
+ * Argument must be Falsy
854
+ * @deprecated use $mol_assert_equal instead
855
+ */
829
856
  function $mol_assert_not(value) {
830
857
  if (!value)
831
858
  return;
832
859
  $mol_fail(new Error(`${value} ≠ false`));
833
860
  }
834
861
  $.$mol_assert_not = $mol_assert_not;
862
+ /**
863
+ * Handler must throw an error.
864
+ * @example
865
+ * $mol_assert_fail( ()=>{ throw new Error( 'Parse error' ) } ) // Passes because throws error
866
+ * $mol_assert_fail( ()=>{ throw new Error( 'Parse error' ) } , 'Parse error' ) // Passes because throws right message
867
+ * $mol_assert_fail( ()=>{ throw new Error( 'Parse error' ) } , Error ) // Passes because throws right class
868
+ * @see https://mol.hyoo.ru/#!section=docs/=9q9dv3_fgxjsf
869
+ */
835
870
  function $mol_assert_fail(handler, ErrorRight) {
836
871
  const fail = $.$mol_fail;
837
872
  try {
@@ -854,10 +889,18 @@ var $;
854
889
  $mol_fail(new Error('Not failed', { cause: { expect: ErrorRight } }));
855
890
  }
856
891
  $.$mol_assert_fail = $mol_assert_fail;
892
+ /** @deprecated Use $mol_assert_equal */
857
893
  function $mol_assert_like(...args) {
858
894
  $mol_assert_equal(...args);
859
895
  }
860
896
  $.$mol_assert_like = $mol_assert_like;
897
+ /**
898
+ * All arguments must not be structural equal to each other.
899
+ * @example
900
+ * $mol_assert_unique( 1 , 2 , 3 ) // Passes
901
+ * $mol_assert_unique( 1 , 1 , 2 ) // Fails because 1 === 1
902
+ * @see https://mol.hyoo.ru/#!section=docs/=9q9dv3_fgxjsf
903
+ */
861
904
  function $mol_assert_unique(...args) {
862
905
  for (let i = 0; i < args.length; ++i) {
863
906
  for (let j = 0; j < args.length; ++j) {
@@ -870,6 +913,13 @@ var $;
870
913
  }
871
914
  }
872
915
  $.$mol_assert_unique = $mol_assert_unique;
916
+ /**
917
+ * All arguments must be structural equal each other.
918
+ * @example
919
+ * $mol_assert_like( [1] , [1] , [1] ) // Passes
920
+ * $mol_assert_like( [1] , [1] , [2] ) // Fails because 1 !== 2
921
+ * @see https://mol.hyoo.ru/#!section=docs/=9q9dv3_fgxjsf
922
+ */
873
923
  function $mol_assert_equal(...args) {
874
924
  for (let i = 1; i < args.length; ++i) {
875
925
  if ($mol_compare_deep(args[0], args[i]))
@@ -1377,6 +1427,11 @@ var $;
1377
1427
  "use strict";
1378
1428
  var $;
1379
1429
  (function ($) {
1430
+ /**
1431
+ * Combines list of unary functions/classes to one function.
1432
+ *
1433
+ * const reparse = $mol_data_pipe( JSON.stringify , JSON.parse )
1434
+ **/
1380
1435
  function $mol_data_pipe(...funcs) {
1381
1436
  return $mol_data_setup(function (input) {
1382
1437
  let value = input;
@@ -1393,6 +1448,14 @@ var $;
1393
1448
  var $;
1394
1449
  (function ($) {
1395
1450
  $mol_test({
1451
+ // @todo enable on strict
1452
+ // 'no functions'() {
1453
+ // const stringify = $mol_data_pipe()
1454
+ // type Type = $mol_type_assert<
1455
+ // typeof stringify,
1456
+ // ( input : never )=> never
1457
+ // >
1458
+ // },
1396
1459
  'single function'() {
1397
1460
  const stringify = $mol_data_pipe((input) => input.toString());
1398
1461
  $mol_assert_equal(stringify(5), '5');
@@ -2209,6 +2272,10 @@ var $;
2209
2272
  "use strict";
2210
2273
  var $;
2211
2274
  (function ($) {
2275
+ /**
2276
+ * CSS Units
2277
+ * @see https://mol.hyoo.ru/#!section=docs/=xwq9q5_f966fg
2278
+ */
2212
2279
  class $mol_style_unit extends $mol_decor {
2213
2280
  literal;
2214
2281
  constructor(value, literal) {
@@ -2255,6 +2322,10 @@ var $;
2255
2322
  var $;
2256
2323
  (function ($) {
2257
2324
  const { per } = $mol_style_unit;
2325
+ /**
2326
+ * CSS Functions
2327
+ * @see https://mol.hyoo.ru/#!section=docs/=xwq9q5_f966fg
2328
+ */
2258
2329
  class $mol_style_func extends $mol_decor {
2259
2330
  name;
2260
2331
  constructor(name, value) {
@@ -2346,6 +2417,7 @@ var $;
2346
2417
  "use strict";
2347
2418
  var $;
2348
2419
  (function ($) {
2420
+ /** Create record of CSS variables. */
2349
2421
  function $mol_style_prop(prefix, keys) {
2350
2422
  const record = keys.reduce((rec, key) => {
2351
2423
  rec[key] = $mol_style_func.vary(`--${prefix}_${key}`);
@@ -2360,6 +2432,10 @@ var $;
2360
2432
  "use strict";
2361
2433
  var $;
2362
2434
  (function ($) {
2435
+ /**
2436
+ * Theme css variables
2437
+ * @see https://mol.hyoo.ru/#!section=demos/demo=mol_textarea_demo
2438
+ */
2363
2439
  $.$mol_theme = $mol_style_prop('mol_theme', [
2364
2440
  'back',
2365
2441
  'hover',
@@ -2388,11 +2464,18 @@ var $;
2388
2464
 
2389
2465
  ;
2390
2466
  "use strict";
2467
+ // namespace $ {
2468
+ // $mol_style_attach( '$mol_theme_lights', `:root { --mol_theme_back: oklch( ${ $$.$mol_lights() ? 92 : 20 }% .01 var(--mol_theme_hue) ) }` )
2469
+ // }
2391
2470
 
2392
2471
  ;
2393
2472
  "use strict";
2394
2473
  var $;
2395
2474
  (function ($) {
2475
+ /**
2476
+ * Gap in CSS
2477
+ * @see https://page.hyoo.ru/#!=msdb74_bm7nsq
2478
+ */
2396
2479
  $.$mol_gap = $mol_style_prop('mol_gap', [
2397
2480
  'page',
2398
2481
  'block',
@@ -2499,6 +2582,7 @@ var $;
2499
2582
  "use strict";
2500
2583
  var $;
2501
2584
  (function ($) {
2585
+ /// @todo right orderinng
2502
2586
  $.$mol_after_mock_queue = [];
2503
2587
  function $mol_after_mock_warp() {
2504
2588
  const queue = $.$mol_after_mock_queue.splice(0);
@@ -2837,6 +2921,7 @@ var $;
2837
2921
  var $;
2838
2922
  (function ($_1) {
2839
2923
  $mol_test({
2924
+ // https://github.com/nin-jin/slides/tree/master/reactivity#component-states
2840
2925
  'Cached channel'($) {
2841
2926
  class App extends $mol_object2 {
2842
2927
  static $ = $;
@@ -2894,6 +2979,7 @@ var $;
2894
2979
  $mol_assert_equal(App.value(5), 21);
2895
2980
  $mol_assert_equal(App.value(), 21);
2896
2981
  },
2982
+ // https://github.com/nin-jin/slides/tree/master/reactivity#wish-consistency
2897
2983
  'Auto recalculation of cached values'($) {
2898
2984
  class App extends $mol_object2 {
2899
2985
  static $ = $;
@@ -2921,6 +3007,7 @@ var $;
2921
3007
  App.xxx(5);
2922
3008
  $mol_assert_equal(App.zzz(), 7);
2923
3009
  },
3010
+ // https://github.com/nin-jin/slides/tree/master/reactivity#wish-reasonability
2924
3011
  'Skip recalculation when actually no dependency changes'($) {
2925
3012
  const log = [];
2926
3013
  class App extends $mol_object2 {
@@ -2954,6 +3041,7 @@ var $;
2954
3041
  App.zzz();
2955
3042
  $mol_assert_like(log, ['zzz', 'yyy', 'xxx', 'xxx', 'yyy']);
2956
3043
  },
3044
+ // https://github.com/nin-jin/slides/tree/master/reactivity#flow-auto
2957
3045
  'Flow: Auto'($) {
2958
3046
  class App extends $mol_object2 {
2959
3047
  static get $() { return $; }
@@ -2991,6 +3079,7 @@ var $;
2991
3079
  $mol_assert_equal(App.result(), 23);
2992
3080
  $mol_assert_equal(App.counter, 4);
2993
3081
  },
3082
+ // https://github.com/nin-jin/slides/tree/master/reactivity#dupes-equality
2994
3083
  'Dupes: Equality'($) {
2995
3084
  let counter = 0;
2996
3085
  class App extends $mol_object2 {
@@ -3014,6 +3103,7 @@ var $;
3014
3103
  App.foo({ numbs: [2] });
3015
3104
  $mol_assert_like(App.bar(), { numbs: [2], count: 2 });
3016
3105
  },
3106
+ // https://github.com/nin-jin/slides/tree/master/reactivity#cycle-fail
3017
3107
  'Cycle: Fail'($) {
3018
3108
  class App extends $mol_object2 {
3019
3109
  static $ = $;
@@ -3038,6 +3128,29 @@ var $;
3038
3128
  ], App, "test", null);
3039
3129
  App.test();
3040
3130
  },
3131
+ // https://github.com/nin-jin/slides/tree/master/reactivity#wish-stability
3132
+ // 'Update deps on push'( $ ) {
3133
+ // class App extends $mol_object2 {
3134
+ // static $ = $
3135
+ // @ $mol_wire_solo
3136
+ // static left( next = false ) {
3137
+ // return next
3138
+ // }
3139
+ // @ $mol_wire_solo
3140
+ // static right( next = false ) {
3141
+ // return next
3142
+ // }
3143
+ // @ $mol_wire_solo
3144
+ // static res( next?: boolean ) {
3145
+ // return this.left( next ) && this.right()
3146
+ // }
3147
+ // }
3148
+ // $mol_assert_equal( App.res(), false )
3149
+ // $mol_assert_equal( App.res( true ), false )
3150
+ // $mol_assert_equal( App.right( true ), true )
3151
+ // $mol_assert_equal( App.res(), true )
3152
+ // } ,
3153
+ // https://github.com/nin-jin/slides/tree/master/reactivity#wish-stability
3041
3154
  'Different order of pull and push'($) {
3042
3155
  class App extends $mol_object2 {
3043
3156
  static $ = $;
@@ -3049,7 +3162,7 @@ var $;
3049
3162
  }
3050
3163
  static slow(next) {
3051
3164
  if (next !== undefined)
3052
- this.slow();
3165
+ this.slow(); // enforce pull before push
3053
3166
  return this.store(next);
3054
3167
  }
3055
3168
  }
@@ -3068,6 +3181,7 @@ var $;
3068
3181
  App.store(777);
3069
3182
  $mol_assert_equal(App.fast(), App.slow(), 777);
3070
3183
  },
3184
+ // https://github.com/nin-jin/slides/tree/master/reactivity#wish-stability
3071
3185
  'Actions inside invariant'($) {
3072
3186
  class App extends $mol_object2 {
3073
3187
  static $ = $;
@@ -3107,6 +3221,7 @@ var $;
3107
3221
  static toggle() {
3108
3222
  const prev = this.checked();
3109
3223
  $mol_assert_unique(this.checked(!prev), prev);
3224
+ // $mol_assert_equal( this.checked() , prev )
3110
3225
  }
3111
3226
  static res() {
3112
3227
  return this.checked();
@@ -3131,6 +3246,39 @@ var $;
3131
3246
  ], App, "test", null);
3132
3247
  await $mol_wire_async(App).test();
3133
3248
  },
3249
+ // // https://github.com/nin-jin/slides/tree/master/reactivity#wish-stability
3250
+ // 'Stable order of multiple root'( $ ) {
3251
+ // class App extends $mol_object2 {
3252
+ // static $ = $
3253
+ // static counter = 0
3254
+ // @ $mol_wire_solo
3255
+ // static left_trigger( next = 0 ) {
3256
+ // return next
3257
+ // }
3258
+ // @ $mol_wire_solo
3259
+ // static left_root() {
3260
+ // this.left_trigger()
3261
+ // return ++ this.counter
3262
+ // }
3263
+ // @ $mol_wire_solo
3264
+ // static right_trigger( next = 0 ) {
3265
+ // return next
3266
+ // }
3267
+ // @ $mol_wire_solo
3268
+ // static right_root() {
3269
+ // this.right_trigger()
3270
+ // return ++ this.counter
3271
+ // }
3272
+ // }
3273
+ // $mol_assert_equal( App.left_root(), 1 )
3274
+ // $mol_assert_equal( App.right_root(), 2 )
3275
+ // App.right_trigger( 1 )
3276
+ // App.left_trigger( 1 )
3277
+ // $mol_wire_fiber.sync()
3278
+ // $mol_assert_equal( App.right_root(), 4 )
3279
+ // $mol_assert_equal( App.left_root(), 3 )
3280
+ // } ,
3281
+ // https://github.com/nin-jin/slides/tree/master/reactivity#error-store
3134
3282
  'Restore after error'($) {
3135
3283
  class App extends $mol_object2 {
3136
3284
  static get $() { return $; }
@@ -3228,6 +3376,7 @@ var $;
3228
3376
  App.showing(true);
3229
3377
  $mol_assert_unique(App.render(), details);
3230
3378
  },
3379
+ // https://github.com/nin-jin/slides/tree/master/reactivity#wish-stability
3231
3380
  async 'Hold pubs while wait async task'($) {
3232
3381
  class App extends $mol_object2 {
3233
3382
  static $ = $;
@@ -3443,6 +3592,7 @@ var $;
3443
3592
 
3444
3593
  ;
3445
3594
  "use strict";
3595
+ /** @jsx $mol_jsx */
3446
3596
  var $;
3447
3597
  (function ($) {
3448
3598
  $mol_test({
@@ -3525,6 +3675,12 @@ var $;
3525
3675
  'return result without errors'() {
3526
3676
  $mol_assert_equal($mol_try(() => false), false);
3527
3677
  },
3678
+ //'return error if thrown'() {
3679
+ //
3680
+ // const error = new Error( '$mol_try test error' )
3681
+ // $mol_assert_equal( $mol_try( ()=> { throw error } ) , error )
3682
+ //
3683
+ //} ,
3528
3684
  });
3529
3685
  })($ || ($ = {}));
3530
3686
 
@@ -3539,6 +3695,7 @@ var $;
3539
3695
  "use strict";
3540
3696
  var $;
3541
3697
  (function ($) {
3698
+ /** Watch and logs reactive states. Logger automatically added to test bundle which is adding to `test.html`. */
3542
3699
  class $mol_wire_log extends $mol_object2 {
3543
3700
  static watch(task) {
3544
3701
  return task;
@@ -3673,6 +3830,10 @@ var $;
3673
3830
  "use strict";
3674
3831
  var $;
3675
3832
  (function ($) {
3833
+ /**
3834
+ * Key names code for hotkey
3835
+ * @see [mol_hotkey](../../hotkey/hotkey.view.ts)
3836
+ */
3676
3837
  let $mol_keyboard_code;
3677
3838
  (function ($mol_keyboard_code) {
3678
3839
  $mol_keyboard_code[$mol_keyboard_code["backspace"] = 8] = "backspace";
@@ -4064,6 +4225,10 @@ var $;
4064
4225
  "use strict";
4065
4226
  var $;
4066
4227
  (function ($) {
4228
+ /**
4229
+ * Real-time refresh current atom.
4230
+ * Don't use if possible. May reduce performance.
4231
+ */
4067
4232
  function $mol_wire_watch() {
4068
4233
  const atom = $mol_wire_auto();
4069
4234
  if (atom instanceof $mol_wire_atom) {
@@ -4186,6 +4351,7 @@ var $;
4186
4351
 
4187
4352
  ;
4188
4353
  "use strict";
4354
+ /** @jsx $mol_jsx */
4189
4355
  var $;
4190
4356
  (function ($) {
4191
4357
  function $mol_view_visible_width() {
@@ -4200,6 +4366,11 @@ var $;
4200
4366
  return suffix;
4201
4367
  }
4202
4368
  $.$mol_view_state_key = $mol_view_state_key;
4369
+ /**
4370
+ * The base class for all visual components. It provides the infrastructure for reactive lazy rendering, handling exceptions.
4371
+ * @see https://mol.hyoo.ru/#!section=docs/=vv2nig_s5zr0f
4372
+ */
4373
+ /// Reactive statefull lazy ViewModel
4203
4374
  class $mol_view extends $mol_object {
4204
4375
  static Root(id) {
4205
4376
  return new this;
@@ -4264,16 +4435,22 @@ var $;
4264
4435
  state_key(suffix = '') {
4265
4436
  return this.$.$mol_view_state_key(suffix);
4266
4437
  }
4438
+ /// Name of element that created when element not found in DOM
4267
4439
  dom_name() {
4268
4440
  return $mol_dom_qname(this.constructor.toString()) || 'div';
4269
4441
  }
4442
+ /// NameSpace of element that created when element not found in DOM
4270
4443
  dom_name_space() { return 'http://www.w3.org/1999/xhtml'; }
4444
+ /// Raw child views
4271
4445
  sub() {
4272
4446
  return [];
4273
4447
  }
4448
+ /// Visible sub views with defined ambient context
4449
+ /// Render all by default
4274
4450
  sub_visible() {
4275
4451
  return this.sub();
4276
4452
  }
4453
+ /// Minimal width that used for lazy rendering
4277
4454
  minimal_width() {
4278
4455
  let min = 0;
4279
4456
  try {
@@ -4295,6 +4472,7 @@ var $;
4295
4472
  maximal_width() {
4296
4473
  return this.minimal_width();
4297
4474
  }
4475
+ /// Minimal height that used for lazy rendering
4298
4476
  minimal_height() {
4299
4477
  let min = 0;
4300
4478
  try {
@@ -4314,11 +4492,11 @@ var $;
4314
4492
  view_rect() {
4315
4493
  if ($mol_wire_probe(() => this.view_rect()) === undefined) {
4316
4494
  $mol_wire_watch();
4317
- return null;
4495
+ return null; // don't touch DOM to prevent instant reflow
4318
4496
  }
4319
4497
  else {
4320
4498
  const { width, height, left, right, top, bottom } = this.dom_node().getBoundingClientRect();
4321
- return { width, height, left, right, top, bottom };
4499
+ return { width, height, left, right, top, bottom }; // pick to optimize compare
4322
4500
  }
4323
4501
  }
4324
4502
  dom_id() {
@@ -4508,6 +4686,7 @@ var $;
4508
4686
  [$mol_dev_format_head]() {
4509
4687
  return $mol_dev_format_span({}, $mol_dev_format_native(this));
4510
4688
  }
4689
+ /** Deep search view by predicate. */
4511
4690
  *view_find(check, path = []) {
4512
4691
  if (path.length === 0 && check(this))
4513
4692
  return yield [this];
@@ -4536,6 +4715,7 @@ var $;
4536
4715
  $mol_fail_log(error);
4537
4716
  }
4538
4717
  }
4718
+ /** Renders path of views to DOM. */
4539
4719
  force_render(path) {
4540
4720
  const kids = this.sub();
4541
4721
  const index = kids.findIndex(item => {
@@ -4550,6 +4730,7 @@ var $;
4550
4730
  kids[index].force_render(path);
4551
4731
  }
4552
4732
  }
4733
+ /** Renders view to DOM and scroll to it. */
4553
4734
  ensure_visible(view, align = "start") {
4554
4735
  const path = this.view_find(v => v === view).next().value;
4555
4736
  this.force_render(new Set(path));
@@ -4564,6 +4745,9 @@ var $;
4564
4745
  const win = this.$.$mol_dom_context;
4565
4746
  if (win.parent !== win.self && !win.document.hasFocus())
4566
4747
  return;
4748
+ // new this.$.$mol_after_frame( ()=> {
4749
+ // this.dom_node().scrollIntoView({ block: 'start', inline: 'nearest' })
4750
+ // } )
4567
4751
  new this.$.$mol_after_timeout(0, () => {
4568
4752
  this.focused(true);
4569
4753
  });
@@ -4759,6 +4943,7 @@ var $;
4759
4943
  "use strict";
4760
4944
  var $;
4761
4945
  (function ($) {
4946
+ /** Plugin is component without its own DOM element, but instead uses the owner DOM element */
4762
4947
  class $mol_plugin extends $mol_view {
4763
4948
  dom_node_external(next) {
4764
4949
  return next ?? $mol_owning_get(this).host.dom_node();
@@ -4798,12 +4983,17 @@ var $;
4798
4983
  ;
4799
4984
  "use strict";
4800
4985
 
4986
+
4801
4987
  ;
4802
4988
  "use strict";
4803
4989
  var $;
4804
4990
  (function ($) {
4805
4991
  var $$;
4806
4992
  (function ($$) {
4993
+ /**
4994
+ * Plugin which adds handlers for keyboard keys.
4995
+ * @see [mol_keyboard_code](../keyboard/code/code.ts)
4996
+ */
4807
4997
  class $mol_hotkey extends $.$mol_hotkey {
4808
4998
  key() {
4809
4999
  return super.key();
@@ -4979,6 +5169,10 @@ var $;
4979
5169
  "use strict";
4980
5170
  var $;
4981
5171
  (function ($) {
5172
+ /**
5173
+ * Z-index values for layers
5174
+ * https://page.hyoo.ru/#!=xthcpx_wqmiba
5175
+ */
4982
5176
  $.$mol_layer = $mol_style_prop('mol_layer', [
4983
5177
  'hover',
4984
5178
  'focus',
@@ -4998,12 +5192,17 @@ var $;
4998
5192
  ;
4999
5193
  "use strict";
5000
5194
 
5195
+
5001
5196
  ;
5002
5197
  "use strict";
5003
5198
  var $;
5004
5199
  (function ($) {
5005
5200
  var $$;
5006
5201
  (function ($$) {
5202
+ /**
5203
+ * An input field for entering single line text.
5204
+ * @see https://mol.hyoo.ru/#!section=demos/demo=mol_string_demo
5205
+ */
5007
5206
  class $mol_string extends $.$mol_string {
5008
5207
  event_change(next) {
5009
5208
  if (!next)
@@ -5127,6 +5326,7 @@ var $;
5127
5326
  ;
5128
5327
  "use strict";
5129
5328
 
5329
+
5130
5330
  ;
5131
5331
  "use strict";
5132
5332
  var $;
@@ -5264,12 +5464,17 @@ var $;
5264
5464
  ;
5265
5465
  "use strict";
5266
5466
 
5467
+
5267
5468
  ;
5268
5469
  "use strict";
5269
5470
  var $;
5270
5471
  (function ($) {
5271
5472
  var $$;
5272
5473
  (function ($$) {
5474
+ /**
5475
+ * Output text with dimmed mismatched substrings.
5476
+ * @see https://mol.hyoo.ru/#!section=demos/demo=mol_dimmer_demo
5477
+ */
5273
5478
  class $mol_dimmer extends $.$mol_dimmer {
5274
5479
  parts() {
5275
5480
  const needle = this.needle();
@@ -5339,6 +5544,7 @@ var $;
5339
5544
  ;
5340
5545
  "use strict";
5341
5546
 
5547
+
5342
5548
  ;
5343
5549
  ($.$mol_button) = class $mol_button extends ($.$mol_view) {
5344
5550
  event_activate(next){
@@ -5473,12 +5679,17 @@ var $;
5473
5679
  ;
5474
5680
  "use strict";
5475
5681
 
5682
+
5476
5683
  ;
5477
5684
  "use strict";
5478
5685
  var $;
5479
5686
  (function ($) {
5480
5687
  var $$;
5481
5688
  (function ($$) {
5689
+ /**
5690
+ * Simple button.
5691
+ * @see https://mol.hyoo.ru/#!section=demos/demo=mol_button_demo
5692
+ */
5482
5693
  class $mol_button extends $.$mol_button {
5483
5694
  disabled() {
5484
5695
  return !this.enabled();
@@ -5494,6 +5705,7 @@ var $;
5494
5705
  this.status([null]);
5495
5706
  }
5496
5707
  catch (error) {
5708
+ // Calling actions from catch section, if throwing promise breaks idempotency
5497
5709
  Promise.resolve().then(() => this.status([error]));
5498
5710
  $mol_fail_hidden(error);
5499
5711
  }
@@ -5563,6 +5775,7 @@ var $;
5563
5775
  ;
5564
5776
  "use strict";
5565
5777
 
5778
+
5566
5779
  ;
5567
5780
  ($.$mol_button_minor) = class $mol_button_minor extends ($.$mol_button_typed) {};
5568
5781
 
@@ -5577,6 +5790,7 @@ var $;
5577
5790
  ;
5578
5791
  "use strict";
5579
5792
 
5793
+
5580
5794
  ;
5581
5795
  "use strict";
5582
5796
  var $;
@@ -5606,12 +5820,12 @@ var $;
5606
5820
  `;
5607
5821
  const dest = `
5608
5822
  query? \\
5609
- clear?event null
5823
+ clear? null
5610
5824
  Query $mol_string value? <=> query?
5611
5825
  Suggest_label $mol_dimmer
5612
5826
  needle <= query?
5613
5827
  key * escape? <=> clear?
5614
- Clear $mol_button_minor click?event <=> clear?event
5828
+ Clear $mol_button_minor click? <=> clear?
5615
5829
  `;
5616
5830
  const res = normalize($, src, dest);
5617
5831
  $mol_assert_equal(res.input, res.output);
@@ -5633,10 +5847,10 @@ var $;
5633
5847
  const dest = `
5634
5848
  Close_icon ${d}mol_icon_cross
5635
5849
  Title ${d}mol_view sub / <= title
5636
- close?event null
5850
+ close? null
5637
5851
  Close ${d}mol_button
5638
5852
  title \\close
5639
- click?event <=> close?event
5853
+ click? <=> close?
5640
5854
  title @ \\title
5641
5855
  sub2 / <= Close_icon
5642
5856
  sub /
@@ -5682,7 +5896,7 @@ var $;
5682
5896
  const dest = `
5683
5897
  clear? = Suggest_label clear?
5684
5898
  Suggest_label $mol_dimmer clear? => clear?
5685
- Clear $mol_button_minor click?e <=> clear?e
5899
+ Clear $mol_button_minor click? <=> clear?
5686
5900
  `;
5687
5901
  const res = normalize($, src, dest);
5688
5902
  $mol_assert_equal(res.input, res.output);
@@ -5698,7 +5912,7 @@ var $;
5698
5912
  $mol_assert_fail(() => normalize($, src).input, `Need an equal default values at \`/mol/view/tree2/class/props.test.ts#4:16/5\` vs \`/mol/view/tree2/class/props.test.ts#6:23/11\`
5699
5913
  <=>
5700
5914
  /mol/view/tree2/class/props.test.ts#6:19/3
5701
- click?event
5915
+ click?
5702
5916
  /mol/view/tree2/class/props.test.ts#6:7/11
5703
5917
  $mol_button_minor
5704
5918
  /mol/view/tree2/class/props.test.ts#5:12/17
@@ -6731,6 +6945,11 @@ var $;
6731
6945
  "use strict";
6732
6946
  var $;
6733
6947
  (function ($) {
6948
+ /**
6949
+ * CSS in TS.
6950
+ * Statically typed CSS style sheets. Following samples show which CSS code are generated from TS code.
6951
+ * @see https://mol.hyoo.ru/#!section=docs/=xwq9q5_f966fg
6952
+ */
6734
6953
  function $mol_style_define(Component, config) {
6735
6954
  return $mol_style_attach(Component.name, $mol_style_sheet(Component, config));
6736
6955
  }
@@ -6740,12 +6959,17 @@ var $;
6740
6959
  ;
6741
6960
  "use strict";
6742
6961
 
6962
+
6743
6963
  ;
6744
6964
  "use strict";
6745
6965
  var $;
6746
6966
  (function ($) {
6747
6967
  var $$;
6748
6968
  (function ($$) {
6969
+ /**
6970
+ * Scrolling pane.
6971
+ * @see https://mol.hyoo.ru/#!section=demos/demo=mol_scroll_demo
6972
+ */
6749
6973
  class $mol_scroll extends $.$mol_scroll {
6750
6974
  scroll_top(next, cache) {
6751
6975
  const el = this.dom_node();
@@ -6795,6 +7019,7 @@ var $;
6795
7019
  direction: 'column',
6796
7020
  grow: 1,
6797
7021
  shrink: 1,
7022
+ // basis: 0,
6798
7023
  },
6799
7024
  outline: 'none',
6800
7025
  align: {
@@ -6812,6 +7037,7 @@ var $;
6812
7037
  contain: 'content',
6813
7038
  '>': {
6814
7039
  $mol_view: {
7040
+ // transform: 'translateZ(0)', // enforce gpu scroll in all agents
6815
7041
  gridArea: '1/1',
6816
7042
  },
6817
7043
  },
@@ -6924,6 +7150,7 @@ var $;
6924
7150
  ;
6925
7151
  "use strict";
6926
7152
 
7153
+
6927
7154
  ;
6928
7155
  "use strict";
6929
7156
  var $;
@@ -6944,6 +7171,8 @@ var $;
6944
7171
  maxHeight: per(100),
6945
7172
  boxSizing: 'border-box',
6946
7173
  color: $mol_theme.text,
7174
+ // backdropFilter: blur( `3px` ), enforces layering
7175
+ // zIndex: 0 ,
6947
7176
  ':focus': {
6948
7177
  outline: 'none',
6949
7178
  },
@@ -7461,99 +7690,131 @@ var $;
7461
7690
  ;
7462
7691
  "use strict";
7463
7692
 
7693
+
7464
7694
  ;
7465
7695
  "use strict";
7466
7696
 
7697
+
7467
7698
  ;
7468
7699
  "use strict";
7469
7700
 
7701
+
7470
7702
  ;
7471
7703
  "use strict";
7472
7704
 
7705
+
7473
7706
  ;
7474
7707
  "use strict";
7475
7708
 
7709
+
7476
7710
  ;
7477
7711
  "use strict";
7478
7712
 
7713
+
7479
7714
  ;
7480
7715
  "use strict";
7481
7716
 
7717
+
7482
7718
  ;
7483
7719
  "use strict";
7484
7720
 
7721
+
7485
7722
  ;
7486
7723
  "use strict";
7487
7724
 
7725
+
7488
7726
  ;
7489
7727
  "use strict";
7490
7728
 
7729
+
7491
7730
  ;
7492
7731
  "use strict";
7493
7732
 
7733
+
7494
7734
  ;
7495
7735
  "use strict";
7496
7736
 
7737
+
7497
7738
  ;
7498
7739
  "use strict";
7499
7740
 
7741
+
7500
7742
  ;
7501
7743
  "use strict";
7502
7744
 
7745
+
7503
7746
  ;
7504
7747
  "use strict";
7505
7748
 
7749
+
7506
7750
  ;
7507
7751
  "use strict";
7508
7752
 
7753
+
7509
7754
  ;
7510
7755
  "use strict";
7511
7756
 
7757
+
7512
7758
  ;
7513
7759
  "use strict";
7514
7760
 
7761
+
7515
7762
  ;
7516
7763
  "use strict";
7517
7764
 
7765
+
7518
7766
  ;
7519
7767
  "use strict";
7520
7768
 
7769
+
7521
7770
  ;
7522
7771
  "use strict";
7523
7772
 
7773
+
7524
7774
  ;
7525
7775
  "use strict";
7526
7776
 
7777
+
7527
7778
  ;
7528
7779
  "use strict";
7529
7780
 
7781
+
7530
7782
  ;
7531
7783
  "use strict";
7532
7784
 
7785
+
7533
7786
  ;
7534
7787
  "use strict";
7535
7788
 
7789
+
7536
7790
  ;
7537
7791
  "use strict";
7538
7792
 
7793
+
7539
7794
  ;
7540
7795
  "use strict";
7541
7796
 
7797
+
7542
7798
  ;
7543
7799
  "use strict";
7544
7800
 
7801
+
7545
7802
  ;
7546
7803
  "use strict";
7547
7804
 
7805
+
7548
7806
  ;
7549
7807
  "use strict";
7550
7808
 
7809
+
7551
7810
  ;
7552
7811
  "use strict";
7553
7812
 
7813
+
7554
7814
  ;
7555
7815
  "use strict";
7556
7816
 
7817
+
7557
7818
  ;
7558
7819
  "use strict";
7559
7820
  var $;
@@ -7589,45 +7850,59 @@ var $;
7589
7850
  ;
7590
7851
  "use strict";
7591
7852
 
7853
+
7592
7854
  ;
7593
7855
  "use strict";
7594
7856
 
7857
+
7595
7858
  ;
7596
7859
  "use strict";
7597
7860
 
7861
+
7598
7862
  ;
7599
7863
  "use strict";
7600
7864
 
7865
+
7601
7866
  ;
7602
7867
  "use strict";
7603
7868
 
7869
+
7604
7870
  ;
7605
7871
  "use strict";
7606
7872
 
7873
+
7607
7874
  ;
7608
7875
  "use strict";
7609
7876
 
7877
+
7610
7878
  ;
7611
7879
  "use strict";
7612
7880
 
7881
+
7613
7882
  ;
7614
7883
  "use strict";
7615
7884
 
7885
+
7616
7886
  ;
7617
7887
  "use strict";
7618
7888
 
7889
+
7619
7890
  ;
7620
7891
  "use strict";
7621
7892
 
7893
+
7622
7894
  ;
7623
7895
  "use strict";
7624
7896
 
7897
+
7625
7898
  ;
7626
7899
  "use strict";
7627
7900
 
7901
+
7628
7902
  ;
7629
7903
  "use strict";
7630
7904
 
7905
+
7631
7906
  ;
7632
7907
  "use strict";
7633
7908
  var $;
@@ -7715,13 +7990,13 @@ var $;
7715
7990
  $mol_view_tree2_to_js_test_run(`
7716
7991
  Foo $mol_view
7717
7992
  a!? $mol_view
7718
- expanded <=> cell_test_expanded!? null
7993
+ expanded? <=> cell_test_expanded!? null
7719
7994
  `);
7720
- }, `Required prop like some*? at \`.view.tree#4:21/20\`
7995
+ }, `Required prop like some*? at \`.view.tree#4:22/20\`
7721
7996
  <=>
7722
- .view.tree#4:17/3
7723
- expanded
7724
- .view.tree#4:8/8
7997
+ .view.tree#4:18/3
7998
+ expanded?
7999
+ .view.tree#4:8/9
7725
8000
  $mol_view
7726
8001
  .view.tree#3:11/9
7727
8002
  a!?
@@ -7755,7 +8030,9 @@ var $;
7755
8030
  'Left bind read only'($) {
7756
8031
  const _foo = $mol_view_tree2_to_js_test_ex_left_read_only_foo;
7757
8032
  const foo = _foo.make({ $ });
7758
- $mol_assert_like(foo.bar1(), foo.bar1(2), foo.bar1(), foo.bar2(), 1);
8033
+ $mol_assert_like(foo.bar1(),
8034
+ // @ts-ignore
8035
+ foo.bar1(2), foo.bar1(), foo.bar2(), 1);
7759
8036
  $mol_assert_like(foo.bar2(2), foo.bar1(), 2);
7760
8037
  },
7761
8038
  'Left bind second level index'($) {
@@ -7782,7 +8059,11 @@ var $;
7782
8059
  const foo = _foo.make({ $ });
7783
8060
  $mol_assert_equal(foo.d(), foo.c(), foo.b(), foo.a(), 0);
7784
8061
  $mol_assert_equal(foo.d(1), foo.c(), foo.b(), foo.a(), 1);
7785
- $mol_assert_equal(foo.a(2), foo.b(2), foo.c(), foo.d(), 1);
8062
+ $mol_assert_equal(
8063
+ // @ts-ignore
8064
+ foo.a(2),
8065
+ // @ts-ignore
8066
+ foo.b(2), foo.c(), foo.d(), 1);
7786
8067
  $mol_assert_equal(foo.c(2), foo.b(), foo.a(), 2);
7787
8068
  $mol_assert_equal(foo.d(1), 1);
7788
8069
  $mol_assert_equal(foo.d(3), foo.c(), foo.b(), foo.a(), 3);
@@ -7818,6 +8099,10 @@ var $;
7818
8099
  'Array of array or object'($) {
7819
8100
  const _foo = $mol_view_tree2_to_js_test_ex_array_of_array_or_object_foo;
7820
8101
  const foo = _foo.make({ $ });
8102
+ // type a1 = $mol_type_assert<
8103
+ // ReturnType<typeof foo.complex>,
8104
+ // readonly (readonly(number | string)[] | Record<string, number | string>)[]
8105
+ // >
7821
8106
  $mol_assert_like(foo.complex(), ['1', [true], ['1', 21], { a: 1, str: 'some' }]);
7822
8107
  },
7823
8108
  'Array inheritance'($) {
@@ -7909,7 +8194,9 @@ var $;
7909
8194
  'simple mutable and read only channels'($) {
7910
8195
  const _foo = $mol_view_tree2_to_js_test_ex_simple_mutable_and_read_only_foo;
7911
8196
  const foo = _foo.make({ $ });
7912
- $mol_assert_equal(foo.readonly(), foo.readonly(1), foo.readonly(), null);
8197
+ $mol_assert_equal(foo.readonly(),
8198
+ // @ts-ignore
8199
+ foo.readonly(1), foo.readonly(), null);
7913
8200
  $mol_assert_equal(foo.mutable(), null);
7914
8201
  $mol_assert_equal(foo.mutable(2), foo.mutable(), 2);
7915
8202
  },