mol_dump_lib 0.0.660 → 0.0.662

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.mjs CHANGED
@@ -2536,15 +2536,22 @@ var $;
2536
2536
  if (path.length === 0 && check(this))
2537
2537
  return yield [this];
2538
2538
  try {
2539
- for (const item of this.sub()) {
2540
- if (item instanceof $mol_view && check(item)) {
2541
- return yield [...path, this, item];
2542
- }
2539
+ const checked = new Set();
2540
+ const sub = this.sub();
2541
+ for (const item of sub) {
2542
+ if (!(item instanceof $mol_view))
2543
+ continue;
2544
+ if (!check(item))
2545
+ continue;
2546
+ checked.add(item);
2547
+ yield [...path, this, item];
2543
2548
  }
2544
- for (const item of this.sub()) {
2545
- if (item instanceof $mol_view) {
2546
- yield* item.view_find(check, [...path, this]);
2547
- }
2549
+ for (const item of sub) {
2550
+ if (!(item instanceof $mol_view))
2551
+ continue;
2552
+ if (checked.has(item))
2553
+ continue;
2554
+ yield* item.view_find(check, [...path, this]);
2548
2555
  }
2549
2556
  }
2550
2557
  catch (error) {
@@ -3777,6 +3784,12 @@ var $;
3777
3784
  (obj.style) = () => ({"paddingTop": (this.gap_after())});
3778
3785
  return obj;
3779
3786
  }
3787
+ item_height_min(id){
3788
+ return 1;
3789
+ }
3790
+ item_width_min(id){
3791
+ return 1;
3792
+ }
3780
3793
  view_window(){
3781
3794
  return [0, 0];
3782
3795
  }
@@ -3907,7 +3920,7 @@ var $;
3907
3920
  min = 0;
3908
3921
  top = Math.ceil(rect?.top ?? 0);
3909
3922
  while (min < (kids.length - 1)) {
3910
- const height = kids[min]?.minimal_height() ?? 0;
3923
+ const height = this.item_height_min(min);
3911
3924
  if (top + height >= limit_top)
3912
3925
  break;
3913
3926
  top += height;
@@ -3929,21 +3942,46 @@ var $;
3929
3942
  }
3930
3943
  while (anchoring && ((top2 > limit_top) && (min2 > 0))) {
3931
3944
  --min2;
3932
- top2 -= kids[min2]?.minimal_height() ?? 0;
3945
+ top2 -= this.item_height_min(min2);
3933
3946
  }
3934
3947
  while (bottom2 < limit_bottom && max2 < kids.length) {
3935
- bottom2 += kids[max2]?.minimal_height() ?? 0;
3948
+ bottom2 += this.item_height_min(max2);
3936
3949
  ++max2;
3937
3950
  }
3938
3951
  return [min2, max2];
3939
3952
  }
3953
+ item_height_min(index) {
3954
+ try {
3955
+ return this.sub()[index]?.minimal_height() ?? 0;
3956
+ }
3957
+ catch (error) {
3958
+ $mol_fail_log(error);
3959
+ return 0;
3960
+ }
3961
+ }
3962
+ row_width_min(index) {
3963
+ try {
3964
+ return this.sub()[index]?.minimal_width() ?? 0;
3965
+ }
3966
+ catch (error) {
3967
+ $mol_fail_log(error);
3968
+ return 0;
3969
+ }
3970
+ }
3940
3971
  gap_before() {
3941
- const skipped = this.sub().slice(0, this.view_window()[0]);
3942
- return Math.max(0, skipped.reduce((sum, view) => sum + (view?.minimal_height() ?? 0), 0));
3972
+ let gap = 0;
3973
+ const skipped = this.view_window()[0];
3974
+ for (let i = 0; i < skipped; ++i)
3975
+ gap += this.item_height_min(i);
3976
+ return gap;
3943
3977
  }
3944
3978
  gap_after() {
3945
- const skipped = this.sub().slice(this.view_window()[1]);
3946
- return Math.max(0, skipped.reduce((sum, view) => sum + (view?.minimal_height() ?? 0), 0));
3979
+ let gap = 0;
3980
+ const from = this.view_window()[1];
3981
+ const to = this.sub().length;
3982
+ for (let i = from; i < to; ++i)
3983
+ gap += this.item_height_min(i);
3984
+ return gap;
3947
3985
  }
3948
3986
  sub_visible() {
3949
3987
  return [
@@ -3953,15 +3991,18 @@ var $;
3953
3991
  ];
3954
3992
  }
3955
3993
  minimal_height() {
3956
- return this.sub().reduce((sum, view) => {
3957
- try {
3958
- return sum + (view?.minimal_height() ?? 0);
3959
- }
3960
- catch (error) {
3961
- $mol_fail_log(error);
3962
- return sum;
3963
- }
3964
- }, 0);
3994
+ let height = 0;
3995
+ const len = this.sub().length;
3996
+ for (let i = 0; i < len; ++i)
3997
+ height += this.item_height_min(i);
3998
+ return height;
3999
+ }
4000
+ minimal_width() {
4001
+ let width = 0;
4002
+ const len = this.sub().length;
4003
+ for (let i = 0; i < len; ++i)
4004
+ width = Math.max(width, this.item_width_min(i));
4005
+ return width;
3965
4006
  }
3966
4007
  force_render(path) {
3967
4008
  const kids = this.rows();
@@ -3993,6 +4034,9 @@ var $;
3993
4034
  __decorate([
3994
4035
  $mol_mem
3995
4036
  ], $mol_list.prototype, "minimal_height", null);
4037
+ __decorate([
4038
+ $mol_mem
4039
+ ], $mol_list.prototype, "minimal_width", null);
3996
4040
  $$.$mol_list = $mol_list;
3997
4041
  })($$ = $.$$ || ($.$$ = {}));
3998
4042
  })($ || ($ = {}));
package/web.view.tree CHANGED
@@ -57,6 +57,8 @@ $mol_list $mol_view
57
57
  Empty $mol_view
58
58
  Gap_before $mol_view style * paddingTop <= gap_before 0
59
59
  Gap_after $mol_view style * paddingTop <= gap_after 0
60
+ item_height_min* 1
61
+ item_width_min* 1
60
62
  view_window /
61
63
  0
62
64
  0