mol_dump_lib 0.0.848 → 0.0.850

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
@@ -5774,51 +5774,60 @@ var $;
5774
5774
 
5775
5775
  ;
5776
5776
  ($.$mol_list) = class $mol_list extends ($.$mol_view) {
5777
- rows(){
5778
- return [];
5779
- }
5780
5777
  gap_before(){
5781
5778
  return 0;
5782
5779
  }
5783
- gap_after(){
5784
- return 0;
5785
- }
5786
- render_visible_only(){
5787
- return true;
5788
- }
5789
- render_over(){
5790
- return 0;
5791
- }
5792
- sub(){
5793
- return (this.rows());
5794
- }
5795
- Empty(){
5780
+ Gap_before(){
5796
5781
  const obj = new this.$.$mol_view();
5782
+ (obj.style) = () => ({"paddingTop": (this.gap_before())});
5797
5783
  return obj;
5798
5784
  }
5799
- Gap_before(){
5785
+ Empty(){
5800
5786
  const obj = new this.$.$mol_view();
5801
- (obj.style) = () => ({"paddingTop": (this.gap_before())});
5802
5787
  return obj;
5803
5788
  }
5789
+ gap_after(){
5790
+ return 0;
5791
+ }
5804
5792
  Gap_after(){
5805
5793
  const obj = new this.$.$mol_view();
5806
5794
  (obj.style) = () => ({"paddingTop": (this.gap_after())});
5807
5795
  return obj;
5808
5796
  }
5797
+ rows(){
5798
+ return [
5799
+ (this.Gap_before()),
5800
+ (this.Empty()),
5801
+ (this.Gap_after())
5802
+ ];
5803
+ }
5804
+ render_visible_only(){
5805
+ return true;
5806
+ }
5807
+ render_over(){
5808
+ return 0.1;
5809
+ }
5810
+ sub(){
5811
+ return (this.rows());
5812
+ }
5809
5813
  item_height_min(id){
5810
5814
  return 1;
5811
5815
  }
5812
5816
  item_width_min(id){
5813
5817
  return 1;
5814
5818
  }
5819
+ view_window_shift(next){
5820
+ if(next !== undefined) return next;
5821
+ return 0;
5822
+ }
5815
5823
  view_window(){
5816
5824
  return [0, 0];
5817
5825
  }
5818
5826
  };
5819
- ($mol_mem(($.$mol_list.prototype), "Empty"));
5820
5827
  ($mol_mem(($.$mol_list.prototype), "Gap_before"));
5828
+ ($mol_mem(($.$mol_list.prototype), "Empty"));
5821
5829
  ($mol_mem(($.$mol_list.prototype), "Gap_after"));
5830
+ ($mol_mem(($.$mol_list.prototype), "view_window_shift"));
5822
5831
 
5823
5832
 
5824
5833
  ;
@@ -5902,7 +5911,15 @@ var $;
5902
5911
  class $mol_list extends $.$mol_list {
5903
5912
  sub() {
5904
5913
  const rows = this.rows();
5905
- return (rows.length === 0) ? [this.Empty()] : rows;
5914
+ const next = (rows.length === 0) ? [this.Empty()] : rows;
5915
+ const prev = $mol_mem_cached(() => this.sub());
5916
+ const [start, end] = $mol_mem_cached(() => this.view_window()) ?? [0, 0];
5917
+ if (prev && $mol_mem_cached(() => prev[start] !== next[start])) {
5918
+ const index = $mol_mem_cached(() => next.indexOf(prev[start])) ?? -1;
5919
+ if (index >= 0)
5920
+ this.view_window_shift(index - start);
5921
+ }
5922
+ return next;
5906
5923
  }
5907
5924
  render_visible_only() {
5908
5925
  return this.$.$mol_support_css_overflow_anchor();
@@ -5917,6 +5934,9 @@ var $;
5917
5934
  if (next)
5918
5935
  return next;
5919
5936
  let [min, max] = $mol_mem_cached(() => this.view_window()) ?? [0, 0];
5937
+ const shift = this.view_window_shift();
5938
+ min += shift;
5939
+ max += shift;
5920
5940
  let max2 = max = Math.min(max, kids.length);
5921
5941
  let min2 = min = Math.max(0, Math.min(min, max - 1));
5922
5942
  const anchoring = this.render_visible_only();
@@ -6060,25 +6080,16 @@ var $;
6060
6080
  "use strict";
6061
6081
  var $;
6062
6082
  (function ($) {
6063
- $mol_style_attach("mol/list/list.view.css", "[mol_list] {\n\twill-change: contents;\n\tdisplay: flex;\n\tflex-direction: column;\n\tflex-shrink: 0;\n\tmax-width: 100%;\n\t/* display: flex;\n\talign-items: stretch;\n\talign-content: stretch; */\n\ttransition: none;\n\tmin-height: 1.5rem;\n}\n\n[mol_list_gap_before] ,\n[mol_list_gap_after] {\n\tdisplay: block !important;\n\tflex: none;\n\ttransition: none;\n\toverflow-anchor: none;\n}\n");
6083
+ $mol_style_attach("mol/list/list.view.css", "[mol_list] {\n\twill-change: contents;\n\tdisplay: flex;\n\tflex-direction: column;\n\tflex-shrink: 0;\n\tmax-width: 100%;\n\t/* display: flex;\n\talign-items: stretch;\n\talign-content: stretch; */\n\ttransition: none;\n\tmin-height: 1.5rem;\n\t/* will-change: contents; */\n}\n\n[mol_list_gap_before] ,\n[mol_list_gap_after] {\n\tdisplay: block !important;\n\tflex: none;\n\ttransition: none;\n\toverflow-anchor: none;\n}\n");
6064
6084
  })($ || ($ = {}));
6065
6085
 
6066
6086
  ;
6067
6087
  ($.$mol_speck) = class $mol_speck extends ($.$mol_view) {
6068
- theme(){
6069
- return "$mol_theme_accent";
6070
- }
6071
6088
  value(){
6072
6089
  return null;
6073
6090
  }
6074
- minimal_width(){
6075
- return 12;
6076
- }
6077
- attr(){
6078
- return {...(super.attr()), "mol_theme": (this.theme())};
6079
- }
6080
- style(){
6081
- return {...(super.style()), "minHeight": "1em"};
6091
+ theme(){
6092
+ return "$mol_theme_accent";
6082
6093
  }
6083
6094
  sub(){
6084
6095
  return [(this.value())];
@@ -6110,7 +6121,7 @@ var $;
6110
6121
  "use strict";
6111
6122
  var $;
6112
6123
  (function ($) {
6113
- $mol_style_attach("mol/speck/speck.view.css", "[mol_speck] {\n\tfont-size: .75rem;\n\tborder-radius: 1rem;\n\tmargin: -0.5rem -0.2rem;\n\talign-self: flex-start;\n\tmin-height: 1em;\n\tvertical-align: sub;\n\tpadding: 0 .2rem;\n\tposition: absolute;\n\tz-index: var(--mol_layer_speck);\n\ttext-align: center;\n\tline-height: .9;\n\tdisplay: inline-block;\n\twhite-space: nowrap;\n\ttext-overflow: ellipsis;\n\tuser-select: none;\n\tbox-shadow: 0 0 3px rgba(0,0,0,.5);\n}\n");
6124
+ $mol_style_attach("mol/speck/speck.view.css", "[mol_speck] {\n\tfont-size: .75rem;\n\tborder-radius: 1rem;\n\tmargin: -0.5rem -0.2rem;\n\talign-self: flex-start;\n\tmin-height: 1em;\n\tmin-width: .75rem;\n\tvertical-align: sub;\n\tpadding: 0 .2rem;\n\tposition: absolute;\n\tz-index: var(--mol_layer_speck);\n\ttext-align: center;\n\tline-height: .9;\n\tdisplay: inline-block;\n\twhite-space: nowrap;\n\ttext-overflow: ellipsis;\n\tuser-select: none;\n\tbox-shadow: 0 0 3px rgba(0,0,0,.5);\n}\n");
6114
6125
  })($ || ($ = {}));
6115
6126
 
6116
6127
  ;
package/node.test.js CHANGED
@@ -5765,51 +5765,60 @@ var $;
5765
5765
 
5766
5766
  ;
5767
5767
  ($.$mol_list) = class $mol_list extends ($.$mol_view) {
5768
- rows(){
5769
- return [];
5770
- }
5771
5768
  gap_before(){
5772
5769
  return 0;
5773
5770
  }
5774
- gap_after(){
5775
- return 0;
5776
- }
5777
- render_visible_only(){
5778
- return true;
5779
- }
5780
- render_over(){
5781
- return 0;
5782
- }
5783
- sub(){
5784
- return (this.rows());
5785
- }
5786
- Empty(){
5771
+ Gap_before(){
5787
5772
  const obj = new this.$.$mol_view();
5773
+ (obj.style) = () => ({"paddingTop": (this.gap_before())});
5788
5774
  return obj;
5789
5775
  }
5790
- Gap_before(){
5776
+ Empty(){
5791
5777
  const obj = new this.$.$mol_view();
5792
- (obj.style) = () => ({"paddingTop": (this.gap_before())});
5793
5778
  return obj;
5794
5779
  }
5780
+ gap_after(){
5781
+ return 0;
5782
+ }
5795
5783
  Gap_after(){
5796
5784
  const obj = new this.$.$mol_view();
5797
5785
  (obj.style) = () => ({"paddingTop": (this.gap_after())});
5798
5786
  return obj;
5799
5787
  }
5788
+ rows(){
5789
+ return [
5790
+ (this.Gap_before()),
5791
+ (this.Empty()),
5792
+ (this.Gap_after())
5793
+ ];
5794
+ }
5795
+ render_visible_only(){
5796
+ return true;
5797
+ }
5798
+ render_over(){
5799
+ return 0.1;
5800
+ }
5801
+ sub(){
5802
+ return (this.rows());
5803
+ }
5800
5804
  item_height_min(id){
5801
5805
  return 1;
5802
5806
  }
5803
5807
  item_width_min(id){
5804
5808
  return 1;
5805
5809
  }
5810
+ view_window_shift(next){
5811
+ if(next !== undefined) return next;
5812
+ return 0;
5813
+ }
5806
5814
  view_window(){
5807
5815
  return [0, 0];
5808
5816
  }
5809
5817
  };
5810
- ($mol_mem(($.$mol_list.prototype), "Empty"));
5811
5818
  ($mol_mem(($.$mol_list.prototype), "Gap_before"));
5819
+ ($mol_mem(($.$mol_list.prototype), "Empty"));
5812
5820
  ($mol_mem(($.$mol_list.prototype), "Gap_after"));
5821
+ ($mol_mem(($.$mol_list.prototype), "view_window_shift"));
5813
5822
 
5814
5823
 
5815
5824
  ;
@@ -5893,7 +5902,15 @@ var $;
5893
5902
  class $mol_list extends $.$mol_list {
5894
5903
  sub() {
5895
5904
  const rows = this.rows();
5896
- return (rows.length === 0) ? [this.Empty()] : rows;
5905
+ const next = (rows.length === 0) ? [this.Empty()] : rows;
5906
+ const prev = $mol_mem_cached(() => this.sub());
5907
+ const [start, end] = $mol_mem_cached(() => this.view_window()) ?? [0, 0];
5908
+ if (prev && $mol_mem_cached(() => prev[start] !== next[start])) {
5909
+ const index = $mol_mem_cached(() => next.indexOf(prev[start])) ?? -1;
5910
+ if (index >= 0)
5911
+ this.view_window_shift(index - start);
5912
+ }
5913
+ return next;
5897
5914
  }
5898
5915
  render_visible_only() {
5899
5916
  return this.$.$mol_support_css_overflow_anchor();
@@ -5908,6 +5925,9 @@ var $;
5908
5925
  if (next)
5909
5926
  return next;
5910
5927
  let [min, max] = $mol_mem_cached(() => this.view_window()) ?? [0, 0];
5928
+ const shift = this.view_window_shift();
5929
+ min += shift;
5930
+ max += shift;
5911
5931
  let max2 = max = Math.min(max, kids.length);
5912
5932
  let min2 = min = Math.max(0, Math.min(min, max - 1));
5913
5933
  const anchoring = this.render_visible_only();
@@ -6051,25 +6071,16 @@ var $;
6051
6071
  "use strict";
6052
6072
  var $;
6053
6073
  (function ($) {
6054
- $mol_style_attach("mol/list/list.view.css", "[mol_list] {\n\twill-change: contents;\n\tdisplay: flex;\n\tflex-direction: column;\n\tflex-shrink: 0;\n\tmax-width: 100%;\n\t/* display: flex;\n\talign-items: stretch;\n\talign-content: stretch; */\n\ttransition: none;\n\tmin-height: 1.5rem;\n}\n\n[mol_list_gap_before] ,\n[mol_list_gap_after] {\n\tdisplay: block !important;\n\tflex: none;\n\ttransition: none;\n\toverflow-anchor: none;\n}\n");
6074
+ $mol_style_attach("mol/list/list.view.css", "[mol_list] {\n\twill-change: contents;\n\tdisplay: flex;\n\tflex-direction: column;\n\tflex-shrink: 0;\n\tmax-width: 100%;\n\t/* display: flex;\n\talign-items: stretch;\n\talign-content: stretch; */\n\ttransition: none;\n\tmin-height: 1.5rem;\n\t/* will-change: contents; */\n}\n\n[mol_list_gap_before] ,\n[mol_list_gap_after] {\n\tdisplay: block !important;\n\tflex: none;\n\ttransition: none;\n\toverflow-anchor: none;\n}\n");
6055
6075
  })($ || ($ = {}));
6056
6076
 
6057
6077
  ;
6058
6078
  ($.$mol_speck) = class $mol_speck extends ($.$mol_view) {
6059
- theme(){
6060
- return "$mol_theme_accent";
6061
- }
6062
6079
  value(){
6063
6080
  return null;
6064
6081
  }
6065
- minimal_width(){
6066
- return 12;
6067
- }
6068
- attr(){
6069
- return {...(super.attr()), "mol_theme": (this.theme())};
6070
- }
6071
- style(){
6072
- return {...(super.style()), "minHeight": "1em"};
6082
+ theme(){
6083
+ return "$mol_theme_accent";
6073
6084
  }
6074
6085
  sub(){
6075
6086
  return [(this.value())];
@@ -6101,7 +6112,7 @@ var $;
6101
6112
  "use strict";
6102
6113
  var $;
6103
6114
  (function ($) {
6104
- $mol_style_attach("mol/speck/speck.view.css", "[mol_speck] {\n\tfont-size: .75rem;\n\tborder-radius: 1rem;\n\tmargin: -0.5rem -0.2rem;\n\talign-self: flex-start;\n\tmin-height: 1em;\n\tvertical-align: sub;\n\tpadding: 0 .2rem;\n\tposition: absolute;\n\tz-index: var(--mol_layer_speck);\n\ttext-align: center;\n\tline-height: .9;\n\tdisplay: inline-block;\n\twhite-space: nowrap;\n\ttext-overflow: ellipsis;\n\tuser-select: none;\n\tbox-shadow: 0 0 3px rgba(0,0,0,.5);\n}\n");
6115
+ $mol_style_attach("mol/speck/speck.view.css", "[mol_speck] {\n\tfont-size: .75rem;\n\tborder-radius: 1rem;\n\tmargin: -0.5rem -0.2rem;\n\talign-self: flex-start;\n\tmin-height: 1em;\n\tmin-width: .75rem;\n\tvertical-align: sub;\n\tpadding: 0 .2rem;\n\tposition: absolute;\n\tz-index: var(--mol_layer_speck);\n\ttext-align: center;\n\tline-height: .9;\n\tdisplay: inline-block;\n\twhite-space: nowrap;\n\ttext-overflow: ellipsis;\n\tuser-select: none;\n\tbox-shadow: 0 0 3px rgba(0,0,0,.5);\n}\n");
6105
6116
  })($ || ($ = {}));
6106
6117
 
6107
6118
  ;
@@ -8856,6 +8867,9 @@ var $;
8856
8867
  sort() {
8857
8868
  return $mol_fail(new TypeError(`Mutable sort is forbidden. Use toSorted instead.`));
8858
8869
  }
8870
+ indexOf(needle) {
8871
+ return this.findIndex(item => item === needle);
8872
+ }
8859
8873
  [Symbol.toPrimitive]() {
8860
8874
  return $mol_guid();
8861
8875
  }