mol_dump_lib 0.0.659 → 0.0.661

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
@@ -3777,6 +3777,12 @@ var $;
3777
3777
  (obj.style) = () => ({"paddingTop": (this.gap_after())});
3778
3778
  return obj;
3779
3779
  }
3780
+ item_height_min(id){
3781
+ return 1;
3782
+ }
3783
+ item_width_min(id){
3784
+ return 1;
3785
+ }
3780
3786
  view_window(){
3781
3787
  return [0, 0];
3782
3788
  }
@@ -3907,7 +3913,7 @@ var $;
3907
3913
  min = 0;
3908
3914
  top = Math.ceil(rect?.top ?? 0);
3909
3915
  while (min < (kids.length - 1)) {
3910
- const height = kids[min]?.minimal_height() ?? 0;
3916
+ const height = this.item_height_min(min);
3911
3917
  if (top + height >= limit_top)
3912
3918
  break;
3913
3919
  top += height;
@@ -3929,21 +3935,46 @@ var $;
3929
3935
  }
3930
3936
  while (anchoring && ((top2 > limit_top) && (min2 > 0))) {
3931
3937
  --min2;
3932
- top2 -= kids[min2]?.minimal_height() ?? 0;
3938
+ top2 -= this.item_height_min(min2);
3933
3939
  }
3934
3940
  while (bottom2 < limit_bottom && max2 < kids.length) {
3935
- bottom2 += kids[max2]?.minimal_height() ?? 0;
3941
+ bottom2 += this.item_height_min(max2);
3936
3942
  ++max2;
3937
3943
  }
3938
3944
  return [min2, max2];
3939
3945
  }
3946
+ item_height_min(index) {
3947
+ try {
3948
+ return this.sub()[index]?.minimal_height() ?? 0;
3949
+ }
3950
+ catch (error) {
3951
+ $mol_fail_log(error);
3952
+ return 0;
3953
+ }
3954
+ }
3955
+ row_width_min(index) {
3956
+ try {
3957
+ return this.sub()[index]?.minimal_width() ?? 0;
3958
+ }
3959
+ catch (error) {
3960
+ $mol_fail_log(error);
3961
+ return 0;
3962
+ }
3963
+ }
3940
3964
  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));
3965
+ let gap = 0;
3966
+ const skipped = this.view_window()[0];
3967
+ for (let i = 0; i < skipped; ++i)
3968
+ gap += this.item_height_min(i);
3969
+ return gap;
3943
3970
  }
3944
3971
  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));
3972
+ let gap = 0;
3973
+ const from = this.view_window()[1];
3974
+ const to = this.sub().length;
3975
+ for (let i = from; i < to; ++i)
3976
+ gap += this.item_height_min(i);
3977
+ return gap;
3947
3978
  }
3948
3979
  sub_visible() {
3949
3980
  return [
@@ -3953,15 +3984,18 @@ var $;
3953
3984
  ];
3954
3985
  }
3955
3986
  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);
3987
+ let height = 0;
3988
+ const len = this.sub().length;
3989
+ for (let i = 0; i < len; ++i)
3990
+ height += this.item_height_min(i);
3991
+ return height;
3992
+ }
3993
+ minimal_width() {
3994
+ let width = 0;
3995
+ const len = this.sub().length;
3996
+ for (let i = 0; i < len; ++i)
3997
+ width = Math.max(width, this.item_width_min(i));
3998
+ return width;
3965
3999
  }
3966
4000
  force_render(path) {
3967
4001
  const kids = this.rows();
@@ -3993,6 +4027,9 @@ var $;
3993
4027
  __decorate([
3994
4028
  $mol_mem
3995
4029
  ], $mol_list.prototype, "minimal_height", null);
4030
+ __decorate([
4031
+ $mol_mem
4032
+ ], $mol_list.prototype, "minimal_width", null);
3996
4033
  $$.$mol_list = $mol_list;
3997
4034
  })($$ = $.$$ || ($.$$ = {}));
3998
4035
  })($ || ($ = {}));
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