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/node.mjs CHANGED
@@ -4484,6 +4484,12 @@ var $;
4484
4484
  (obj.style) = () => ({"paddingTop": (this.gap_after())});
4485
4485
  return obj;
4486
4486
  }
4487
+ item_height_min(id){
4488
+ return 1;
4489
+ }
4490
+ item_width_min(id){
4491
+ return 1;
4492
+ }
4487
4493
  view_window(){
4488
4494
  return [0, 0];
4489
4495
  }
@@ -4614,7 +4620,7 @@ var $;
4614
4620
  min = 0;
4615
4621
  top = Math.ceil(rect?.top ?? 0);
4616
4622
  while (min < (kids.length - 1)) {
4617
- const height = kids[min]?.minimal_height() ?? 0;
4623
+ const height = this.item_height_min(min);
4618
4624
  if (top + height >= limit_top)
4619
4625
  break;
4620
4626
  top += height;
@@ -4636,21 +4642,46 @@ var $;
4636
4642
  }
4637
4643
  while (anchoring && ((top2 > limit_top) && (min2 > 0))) {
4638
4644
  --min2;
4639
- top2 -= kids[min2]?.minimal_height() ?? 0;
4645
+ top2 -= this.item_height_min(min2);
4640
4646
  }
4641
4647
  while (bottom2 < limit_bottom && max2 < kids.length) {
4642
- bottom2 += kids[max2]?.minimal_height() ?? 0;
4648
+ bottom2 += this.item_height_min(max2);
4643
4649
  ++max2;
4644
4650
  }
4645
4651
  return [min2, max2];
4646
4652
  }
4653
+ item_height_min(index) {
4654
+ try {
4655
+ return this.sub()[index]?.minimal_height() ?? 0;
4656
+ }
4657
+ catch (error) {
4658
+ $mol_fail_log(error);
4659
+ return 0;
4660
+ }
4661
+ }
4662
+ row_width_min(index) {
4663
+ try {
4664
+ return this.sub()[index]?.minimal_width() ?? 0;
4665
+ }
4666
+ catch (error) {
4667
+ $mol_fail_log(error);
4668
+ return 0;
4669
+ }
4670
+ }
4647
4671
  gap_before() {
4648
- const skipped = this.sub().slice(0, this.view_window()[0]);
4649
- return Math.max(0, skipped.reduce((sum, view) => sum + (view?.minimal_height() ?? 0), 0));
4672
+ let gap = 0;
4673
+ const skipped = this.view_window()[0];
4674
+ for (let i = 0; i < skipped; ++i)
4675
+ gap += this.item_height_min(i);
4676
+ return gap;
4650
4677
  }
4651
4678
  gap_after() {
4652
- const skipped = this.sub().slice(this.view_window()[1]);
4653
- return Math.max(0, skipped.reduce((sum, view) => sum + (view?.minimal_height() ?? 0), 0));
4679
+ let gap = 0;
4680
+ const from = this.view_window()[1];
4681
+ const to = this.sub().length;
4682
+ for (let i = from; i < to; ++i)
4683
+ gap += this.item_height_min(i);
4684
+ return gap;
4654
4685
  }
4655
4686
  sub_visible() {
4656
4687
  return [
@@ -4660,15 +4691,18 @@ var $;
4660
4691
  ];
4661
4692
  }
4662
4693
  minimal_height() {
4663
- return this.sub().reduce((sum, view) => {
4664
- try {
4665
- return sum + (view?.minimal_height() ?? 0);
4666
- }
4667
- catch (error) {
4668
- $mol_fail_log(error);
4669
- return sum;
4670
- }
4671
- }, 0);
4694
+ let height = 0;
4695
+ const len = this.sub().length;
4696
+ for (let i = 0; i < len; ++i)
4697
+ height += this.item_height_min(i);
4698
+ return height;
4699
+ }
4700
+ minimal_width() {
4701
+ let width = 0;
4702
+ const len = this.sub().length;
4703
+ for (let i = 0; i < len; ++i)
4704
+ width = Math.max(width, this.item_width_min(i));
4705
+ return width;
4672
4706
  }
4673
4707
  force_render(path) {
4674
4708
  const kids = this.rows();
@@ -4700,6 +4734,9 @@ var $;
4700
4734
  __decorate([
4701
4735
  $mol_mem
4702
4736
  ], $mol_list.prototype, "minimal_height", null);
4737
+ __decorate([
4738
+ $mol_mem
4739
+ ], $mol_list.prototype, "minimal_width", null);
4703
4740
  $$.$mol_list = $mol_list;
4704
4741
  })($$ = $.$$ || ($.$$ = {}));
4705
4742
  })($ || ($ = {}));
package/node.test.js CHANGED
@@ -4475,6 +4475,12 @@ var $;
4475
4475
  (obj.style) = () => ({"paddingTop": (this.gap_after())});
4476
4476
  return obj;
4477
4477
  }
4478
+ item_height_min(id){
4479
+ return 1;
4480
+ }
4481
+ item_width_min(id){
4482
+ return 1;
4483
+ }
4478
4484
  view_window(){
4479
4485
  return [0, 0];
4480
4486
  }
@@ -4605,7 +4611,7 @@ var $;
4605
4611
  min = 0;
4606
4612
  top = Math.ceil(rect?.top ?? 0);
4607
4613
  while (min < (kids.length - 1)) {
4608
- const height = kids[min]?.minimal_height() ?? 0;
4614
+ const height = this.item_height_min(min);
4609
4615
  if (top + height >= limit_top)
4610
4616
  break;
4611
4617
  top += height;
@@ -4627,21 +4633,46 @@ var $;
4627
4633
  }
4628
4634
  while (anchoring && ((top2 > limit_top) && (min2 > 0))) {
4629
4635
  --min2;
4630
- top2 -= kids[min2]?.minimal_height() ?? 0;
4636
+ top2 -= this.item_height_min(min2);
4631
4637
  }
4632
4638
  while (bottom2 < limit_bottom && max2 < kids.length) {
4633
- bottom2 += kids[max2]?.minimal_height() ?? 0;
4639
+ bottom2 += this.item_height_min(max2);
4634
4640
  ++max2;
4635
4641
  }
4636
4642
  return [min2, max2];
4637
4643
  }
4644
+ item_height_min(index) {
4645
+ try {
4646
+ return this.sub()[index]?.minimal_height() ?? 0;
4647
+ }
4648
+ catch (error) {
4649
+ $mol_fail_log(error);
4650
+ return 0;
4651
+ }
4652
+ }
4653
+ row_width_min(index) {
4654
+ try {
4655
+ return this.sub()[index]?.minimal_width() ?? 0;
4656
+ }
4657
+ catch (error) {
4658
+ $mol_fail_log(error);
4659
+ return 0;
4660
+ }
4661
+ }
4638
4662
  gap_before() {
4639
- const skipped = this.sub().slice(0, this.view_window()[0]);
4640
- return Math.max(0, skipped.reduce((sum, view) => sum + (view?.minimal_height() ?? 0), 0));
4663
+ let gap = 0;
4664
+ const skipped = this.view_window()[0];
4665
+ for (let i = 0; i < skipped; ++i)
4666
+ gap += this.item_height_min(i);
4667
+ return gap;
4641
4668
  }
4642
4669
  gap_after() {
4643
- const skipped = this.sub().slice(this.view_window()[1]);
4644
- return Math.max(0, skipped.reduce((sum, view) => sum + (view?.minimal_height() ?? 0), 0));
4670
+ let gap = 0;
4671
+ const from = this.view_window()[1];
4672
+ const to = this.sub().length;
4673
+ for (let i = from; i < to; ++i)
4674
+ gap += this.item_height_min(i);
4675
+ return gap;
4645
4676
  }
4646
4677
  sub_visible() {
4647
4678
  return [
@@ -4651,15 +4682,18 @@ var $;
4651
4682
  ];
4652
4683
  }
4653
4684
  minimal_height() {
4654
- return this.sub().reduce((sum, view) => {
4655
- try {
4656
- return sum + (view?.minimal_height() ?? 0);
4657
- }
4658
- catch (error) {
4659
- $mol_fail_log(error);
4660
- return sum;
4661
- }
4662
- }, 0);
4685
+ let height = 0;
4686
+ const len = this.sub().length;
4687
+ for (let i = 0; i < len; ++i)
4688
+ height += this.item_height_min(i);
4689
+ return height;
4690
+ }
4691
+ minimal_width() {
4692
+ let width = 0;
4693
+ const len = this.sub().length;
4694
+ for (let i = 0; i < len; ++i)
4695
+ width = Math.max(width, this.item_width_min(i));
4696
+ return width;
4663
4697
  }
4664
4698
  force_render(path) {
4665
4699
  const kids = this.rows();
@@ -4691,6 +4725,9 @@ var $;
4691
4725
  __decorate([
4692
4726
  $mol_mem
4693
4727
  ], $mol_list.prototype, "minimal_height", null);
4728
+ __decorate([
4729
+ $mol_mem
4730
+ ], $mol_list.prototype, "minimal_width", null);
4694
4731
  $$.$mol_list = $mol_list;
4695
4732
  })($$ = $.$$ || ($.$$ = {}));
4696
4733
  })($ || ($ = {}));