@yuneta/gobj-ui 7.23.143 → 7.23.145

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.143",
3
+ "version": "7.23.145",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -7124,6 +7124,27 @@ function auto_layout(gobj)
7124
7124
  return true;
7125
7125
  }
7126
7126
 
7127
+ /************************************************************
7128
+ * Paint the minimap again from where the nodes are NOW.
7129
+ *
7130
+ * It repaints off the graph's draw events, and a layout emits none:
7131
+ * G6 moves the nodes with a SILENT draw. So after a layout change
7132
+ * the minimap went on showing the arrangement before it.
7133
+ ************************************************************/
7134
+ function repaint_minimap(gobj)
7135
+ {
7136
+ let plugin = graph_get_plugin(gobj, "minimap");
7137
+ if(!plugin || plugin.destroyed) {
7138
+ return;
7139
+ }
7140
+ try {
7141
+ plugin.renderMinimap();
7142
+ plugin.renderMask();
7143
+ } catch(e) {
7144
+ log_error(`${gobj_short_name(gobj)}: repaint_minimap failed: ${e}`);
7145
+ }
7146
+ }
7147
+
7127
7148
  /************************************************************
7128
7149
  * Show or hide the minimap, deciding by the SIZE of the graph.
7129
7150
  *
@@ -9772,6 +9793,7 @@ async function reconcile_fold_apply(gobj, opts, visible)
9772
9793
  await graph_draw(gobj);
9773
9794
  if(changed || opts.relayout) {
9774
9795
  await graph_layout(gobj);
9796
+ repaint_minimap(gobj);
9775
9797
  }
9776
9798
 
9777
9799
  /* THE VIEWPORT, and only here.
@@ -10924,18 +10946,44 @@ function ac_fullscreen(gobj, event, kw, src)
10924
10946
 
10925
10947
  /************************************************************
10926
10948
  * Layout change
10949
+ *
10950
+ * A new layout moves EVERY node, so the camera cannot stay on the
10951
+ * coordinates it had: it would look at empty grid where the old
10952
+ * arrangement was. It goes through the reconcile instead, which
10953
+ * holds the node the reader was looking at on the same pixel (the
10954
+ * zoom is kept) and fits only if nothing is left in view.
10927
10955
  ************************************************************/
10928
10956
  function ac_set_layout(gobj, event, kw, src)
10929
10957
  {
10930
10958
  let priv = gobj.priv;
10959
+ let graph = priv.graph;
10931
10960
  let layout = select_layout(gobj, kw.layout);
10961
+
10962
+ /* The reader chose it: a later load must not auto-lay it back. */
10963
+ priv._layout_asked = gobj_read_str_attr(gobj, "layout");
10964
+
10932
10965
  /* The ports turn with the reading direction, before the lines
10933
10966
  * are laid out from them. */
10934
10967
  apply_layout_direction(gobj);
10935
- graph_set_layout(gobj, layout).then(() => {
10968
+
10969
+ let done = () => {
10936
10970
  configure_behaviour(gobj);
10937
10971
  update_toolbar(gobj);
10938
- });
10972
+ };
10973
+
10974
+ if(!priv._fold_model || !graph || !graph.rendered) {
10975
+ /* No records yet: nothing on screen to hold still. */
10976
+ graph_set_layout(gobj, layout).then(() => {
10977
+ repaint_minimap(gobj);
10978
+ done();
10979
+ });
10980
+ return 0;
10981
+ }
10982
+
10983
+ let keep = camera_anchor_node(gobj);
10984
+ let vp = keep? yui_graph_viewport_of(graph, keep) : null;
10985
+ graph.setLayout(layout);
10986
+ reconcile_fold(gobj, {relayout: true, keep: keep, keep_vp: vp}).then(done);
10939
10987
 
10940
10988
  return 0;
10941
10989
  }
@@ -0,0 +1,94 @@
1
+ /***********************************************************************
2
+ * c_yui_json_pad.css
3
+ *
4
+ * Layout of C_YUI_JSON_PAD: the two panes side by side, stacked
5
+ * when the PAD (not the screen) is narrow -- it lives in a window
6
+ * the reader resizes. The logical block names double as hooks.
7
+ *
8
+ * Copyright (c) 2026, ArtGins.
9
+ * All Rights Reserved.
10
+ ***********************************************************************/
11
+ .JSON_PAD {
12
+ height: 100%;
13
+ display: flex;
14
+ flex-direction: column;
15
+ gap: .5rem;
16
+ padding: .5rem;
17
+ container-type: inline-size;
18
+ }
19
+
20
+ .JSON_PAD_TOOLBAR {
21
+ flex: 0 0 auto;
22
+ display: flex;
23
+ flex-wrap: wrap;
24
+ align-items: center;
25
+ justify-content: flex-end;
26
+ gap: .5rem;
27
+ }
28
+
29
+ .JSON_PAD_NOTICE {
30
+ flex: 1 1 auto;
31
+ }
32
+
33
+ .JSON_PAD_PANES {
34
+ flex: 1 1 auto;
35
+ min-height: 0;
36
+ display: flex;
37
+ flex-direction: row;
38
+ gap: .5rem;
39
+ }
40
+
41
+ .JSON_PAD_PANE {
42
+ flex: 1 1 0;
43
+ min-width: 0;
44
+ min-height: 0;
45
+ display: flex;
46
+ flex-direction: column;
47
+ gap: .5rem;
48
+ }
49
+
50
+ /* Comparing: the viewers give their place to the differences, and the
51
+ * panes keep only their text areas. */
52
+ .JSON_PAD.is-comparing .JSON_PAD_PANES {
53
+ flex: 0 0 auto;
54
+ }
55
+
56
+ .JSON_PAD_DIFF {
57
+ flex: 1 1 auto;
58
+ min-height: 0;
59
+ overflow: auto;
60
+ }
61
+
62
+ .JSON_PAD_DIFF_SUMMARY {
63
+ display: flex;
64
+ flex-wrap: wrap;
65
+ gap: 1rem;
66
+ margin-bottom: .5rem;
67
+ }
68
+
69
+ .JSON_PAD_DIFF_COUNT {
70
+ display: inline-flex;
71
+ align-items: center;
72
+ gap: .35rem;
73
+ }
74
+
75
+ .JSON_PAD_DIFF_TABLE {
76
+ font-size: .85rem;
77
+ }
78
+
79
+ .JSON_PAD_DIFF_TABLE td.JSON_PAD_DIFF_PATH,
80
+ .JSON_PAD_DIFF_TABLE td.JSON_PAD_DIFF_FROM,
81
+ .JSON_PAD_DIFF_TABLE td.JSON_PAD_DIFF_TO {
82
+ font-family: monospace;
83
+ white-space: pre-wrap;
84
+ word-break: break-all;
85
+ }
86
+
87
+ @container (max-width: 40rem) {
88
+ .JSON_PAD_PANES {
89
+ flex-direction: column;
90
+ }
91
+ .JSON_PAD.is-comparing .JSON_PAD_PANE {
92
+ flex: 0 0 auto;
93
+ }
94
+ }