@yuneta/gobj-ui 7.27.19 → 7.27.20

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/README.md CHANGED
@@ -598,6 +598,14 @@ Back out of a deep data position land on it. Below a link there are no nodes:
598
598
  `link` + `children` (or `link` + `content`) is a config error, because a silent
599
599
  winner in "who owns the subpath" would be the worst outcome.
600
600
 
601
+ **A child already on screen stays in the document** (7.27.20+). Every change of
602
+ url below a node re-activates it, and the node used to hang its active child
603
+ again each time -- out of the document and back in, which a browser answers by
604
+ dropping the scroll of every element inside it. A topic table under a treedb
605
+ view came back at the top of a page whose rows were drawn for the bottom, and
606
+ showed nothing. Now only the node's chrome (navs, path) is rebuilt when the
607
+ active child is the one already hanging in its body.
608
+
601
609
  **The tree is a contract, not runtime state.** Once published, a node's path
602
610
  is a url a client may have bookmarked, scripted, or been sold as another door
603
611
  into the system. So there is deliberately **no reparent/move API**: the shape
@@ -33319,6 +33319,16 @@ function watch_table_size(gobj, tabulator) {
33319
33319
  });
33320
33320
  ro.observe(tabulator.element);
33321
33321
  priv.table_resize_observer = ro;
33322
+ priv.table_scroll = {
33323
+ top: 0,
33324
+ left: 0
33325
+ };
33326
+ tabulator.on("scrollVertical", (top) => {
33327
+ priv.table_scroll.top = top;
33328
+ });
33329
+ tabulator.on("scrollHorizontal", (left) => {
33330
+ priv.table_scroll.left = left;
33331
+ });
33322
33332
  }
33323
33333
  function unwatch_table_size(gobj) {
33324
33334
  let priv = gobj.priv;
@@ -35798,7 +35808,8 @@ function close_table_json_dialog(gobj) {
35798
35808
  * another tab.
35799
35809
  *
35800
35810
  * The redraw is done when the table is SEEN again, where the
35801
- * rows have their real offsets and the scroll is kept. It is
35811
+ * rows have their real offsets, after giving back the scroll the
35812
+ * browser dropped with the `display:none` (watch_table_size). It is
35802
35813
  * needed there even at the same size: Tabulator does not draw
35803
35814
  * the data that arrives while it is hidden (a node event, a
35804
35815
  * refresh), it leaves that to its next sight.
@@ -35826,6 +35837,13 @@ function ac_table_resized(gobj, event, kw, src) {
35826
35837
  tabulator.redraw(true);
35827
35838
  return 0;
35828
35839
  }
35840
+ if (was_hidden) {
35841
+ let $holder = tabulator.element.querySelector(".tabulator-tableholder");
35842
+ if ($holder) {
35843
+ $holder.scrollTop = priv.table_scroll.top;
35844
+ $holder.scrollLeft = priv.table_scroll.left;
35845
+ }
35846
+ }
35829
35847
  if (was_hidden || last.width !== kw.width || last.height !== kw.height) tabulator.redraw();
35830
35848
  return 0;
35831
35849
  }
@@ -33314,6 +33314,16 @@ function watch_table_size(gobj, tabulator) {
33314
33314
  });
33315
33315
  ro.observe(tabulator.element);
33316
33316
  priv.table_resize_observer = ro;
33317
+ priv.table_scroll = {
33318
+ top: 0,
33319
+ left: 0
33320
+ };
33321
+ tabulator.on("scrollVertical", (top) => {
33322
+ priv.table_scroll.top = top;
33323
+ });
33324
+ tabulator.on("scrollHorizontal", (left) => {
33325
+ priv.table_scroll.left = left;
33326
+ });
33317
33327
  }
33318
33328
  function unwatch_table_size(gobj) {
33319
33329
  let priv = gobj.priv;
@@ -35793,7 +35803,8 @@ function close_table_json_dialog(gobj) {
35793
35803
  * another tab.
35794
35804
  *
35795
35805
  * The redraw is done when the table is SEEN again, where the
35796
- * rows have their real offsets and the scroll is kept. It is
35806
+ * rows have their real offsets, after giving back the scroll the
35807
+ * browser dropped with the `display:none` (watch_table_size). It is
35797
35808
  * needed there even at the same size: Tabulator does not draw
35798
35809
  * the data that arrives while it is hidden (a node event, a
35799
35810
  * refresh), it leaves that to its next sight.
@@ -35821,6 +35832,13 @@ function ac_table_resized(gobj, event, kw, src) {
35821
35832
  tabulator.redraw(true);
35822
35833
  return 0;
35823
35834
  }
35835
+ if (was_hidden) {
35836
+ let $holder = tabulator.element.querySelector(".tabulator-tableholder");
35837
+ if ($holder) {
35838
+ $holder.scrollTop = priv.table_scroll.top;
35839
+ $holder.scrollLeft = priv.table_scroll.left;
35840
+ }
35841
+ }
35824
35842
  if (was_hidden || last.width !== kw.width || last.height !== kw.height) tabulator.redraw();
35825
35843
  return 0;
35826
35844
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.27.19",
3
+ "version": "7.27.20",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
package/src/c_yui_node.js CHANGED
@@ -931,10 +931,25 @@ function render_self(gobj)
931
931
  function render_child(gobj, child)
932
932
  {
933
933
  let priv = gobj.priv;
934
+ let $child = gobj_read_attr(child, "$container");
935
+
936
+ /* The child already hanging in my body is left where it is: only
937
+ * the chrome (the navs, the path) follows the route. Every change
938
+ * of url below me -- a tab of a treedb view is one -- re-activates
939
+ * this level, and re-hanging the child took its whole subtree out
940
+ * of the document and put it back, which drops the scroll of every
941
+ * element in it: a table came back at 0 with its rows still drawn
942
+ * for where the reader was, and showed only the padding above
943
+ * them. */
944
+ let in_place = !!$child && !!$child.parentNode &&
945
+ $child.parentNode.classList.contains("NODE_CHILD") &&
946
+ $child.parentNode.parentNode === priv.$body;
934
947
 
935
948
  clear_navs(gobj);
936
949
  priv.$chrome.replaceChildren();
937
- priv.$body.replaceChildren();
950
+ if(!in_place) {
951
+ priv.$body.replaceChildren();
952
+ }
938
953
 
939
954
  /* Every ancestor painting its own chrome stacks one strip per
940
955
  * level. `chrome_depth` is how a node caps that for its corner
@@ -948,8 +963,10 @@ function render_child(gobj, child)
948
963
  }
949
964
  render_path(gobj, priv.$chrome);
950
965
 
966
+ if(in_place) {
967
+ return;
968
+ }
951
969
  let $slot = createElement2(["div", {class: "NODE_CHILD"}]);
952
- let $child = gobj_read_attr(child, "$container");
953
970
  if($child) {
954
971
  $slot.appendChild($child);
955
972
  }
@@ -2050,6 +2050,19 @@ function watch_table_size(gobj, tabulator)
2050
2050
  });
2051
2051
  ro.observe(tabulator.element);
2052
2052
  priv.table_resize_observer = ro;
2053
+
2054
+ /* Where the reader is, kept for the next sight: a browser drops the
2055
+ * scroll of an element that goes `display:none`, and gives it back
2056
+ * at 0 -- the rows Tabulator drew for the old position are still
2057
+ * there, under 0, and the view shows only the padding above them.
2058
+ * Plumbing, not an action: one per scrolled pixel. */
2059
+ priv.table_scroll = {top: 0, left: 0};
2060
+ tabulator.on("scrollVertical", (top) => {
2061
+ priv.table_scroll.top = top;
2062
+ });
2063
+ tabulator.on("scrollHorizontal", (left) => {
2064
+ priv.table_scroll.left = left;
2065
+ });
2053
2066
  }
2054
2067
 
2055
2068
  function unwatch_table_size(gobj)
@@ -5463,7 +5476,8 @@ function close_table_json_dialog(gobj)
5463
5476
  * another tab.
5464
5477
  *
5465
5478
  * The redraw is done when the table is SEEN again, where the
5466
- * rows have their real offsets and the scroll is kept. It is
5479
+ * rows have their real offsets, after giving back the scroll the
5480
+ * browser dropped with the `display:none` (watch_table_size). It is
5467
5481
  * needed there even at the same size: Tabulator does not draw
5468
5482
  * the data that arrives while it is hidden (a node event, a
5469
5483
  * refresh), it leaves that to its next sight.
@@ -5494,6 +5508,13 @@ function ac_table_resized(gobj, event, kw, src)
5494
5508
  tabulator.redraw(true); /* built hidden: never laid out */
5495
5509
  return 0;
5496
5510
  }
5511
+ if(was_hidden) {
5512
+ let $holder = tabulator.element.querySelector(".tabulator-tableholder");
5513
+ if($holder) {
5514
+ $holder.scrollTop = priv.table_scroll.top;
5515
+ $holder.scrollLeft = priv.table_scroll.left;
5516
+ }
5517
+ }
5497
5518
  if(was_hidden ||
5498
5519
  last.width !== kw.width || last.height !== kw.height) {
5499
5520
  tabulator.redraw();