@yuneta/gobj-ui 7.4.4 → 7.4.5

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.
@@ -55708,7 +55708,6 @@ function refresh_minimap(gobj) {
55708
55708
  return;
55709
55709
  }
55710
55710
  if (graph_get_plugin(gobj, "minimap")) return;
55711
- (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: minimap: adding for ${n} nodes (threshold ${threshold})`);
55712
55711
  graph_add_plugin(gobj, "minimap", {
55713
55712
  size: [200, 140],
55714
55713
  position: "bottom-left",
@@ -55732,12 +55731,6 @@ function refresh_minimap(gobj) {
55732
55731
  }
55733
55732
  }
55734
55733
  });
55735
- try {
55736
- graph.draw();
55737
- } catch (e) {
55738
- (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot draw the minimap: ${e}`);
55739
- }
55740
- (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: minimap: plugin is ${graph_get_plugin(gobj, "minimap") ? "up" : "MISSING"}`);
55741
55734
  }
55742
55735
  /************************************************************
55743
55736
  * The innerHTML of ONE node, in the given theme and highlight state.
@@ -56530,30 +56523,32 @@ function ac_load_data(gobj, event, kw, src) {
56530
56523
  break;
56531
56524
  }
56532
56525
  }
56533
- if (do_links && priv.graph) graph_draw(gobj).then(() => {
56534
- create_links(gobj);
56526
+ if (do_links && priv.graph) {
56527
+ try {
56528
+ refresh_minimap(gobj);
56529
+ } catch (e) {
56530
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: refresh_minimap failed: ${e}`);
56531
+ }
56535
56532
  graph_draw(gobj).then(() => {
56536
- graph_layout(gobj).then(() => {
56537
- if (priv.edit_mode) graph_add_plugin(gobj, "history");
56538
- else graph_remove_plugin(gobj, "history");
56539
- try {
56540
- refresh_minimap(gobj);
56541
- } catch (e) {
56542
- (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: refresh_minimap failed: ${e}`);
56543
- }
56544
- if (priv._pending_focus_topic !== null) {
56545
- let ft = priv._pending_focus_topic;
56546
- priv._pending_focus_topic = null;
56547
- graph_focus_topic(gobj, ft);
56548
- }
56549
- if (priv._pending_find !== null) {
56550
- let term = priv._pending_find;
56551
- priv._pending_find = null;
56552
- publish_find_result(gobj, term, graph_find_nodes(gobj, term));
56553
- }
56533
+ create_links(gobj);
56534
+ graph_draw(gobj).then(() => {
56535
+ graph_layout(gobj).then(() => {
56536
+ if (priv.edit_mode) graph_add_plugin(gobj, "history");
56537
+ else graph_remove_plugin(gobj, "history");
56538
+ if (priv._pending_focus_topic !== null) {
56539
+ let ft = priv._pending_focus_topic;
56540
+ priv._pending_focus_topic = null;
56541
+ graph_focus_topic(gobj, ft);
56542
+ }
56543
+ if (priv._pending_find !== null) {
56544
+ let term = priv._pending_find;
56545
+ priv._pending_find = null;
56546
+ publish_find_result(gobj, term, graph_find_nodes(gobj, term));
56547
+ }
56548
+ });
56554
56549
  });
56555
56550
  });
56556
- });
56551
+ }
56557
56552
  return 0;
56558
56553
  }
56559
56554
  /************************************************************
@@ -55695,7 +55695,6 @@ function refresh_minimap(gobj) {
55695
55695
  return;
55696
55696
  }
55697
55697
  if (graph_get_plugin(gobj, "minimap")) return;
55698
- log_warning(`${gobj_short_name(gobj)}: minimap: adding for ${n} nodes (threshold ${threshold})`);
55699
55698
  graph_add_plugin(gobj, "minimap", {
55700
55699
  size: [200, 140],
55701
55700
  position: "bottom-left",
@@ -55719,12 +55718,6 @@ function refresh_minimap(gobj) {
55719
55718
  }
55720
55719
  }
55721
55720
  });
55722
- try {
55723
- graph.draw();
55724
- } catch (e) {
55725
- log_error(`${gobj_short_name(gobj)}: cannot draw the minimap: ${e}`);
55726
- }
55727
- log_warning(`${gobj_short_name(gobj)}: minimap: plugin is ${graph_get_plugin(gobj, "minimap") ? "up" : "MISSING"}`);
55728
55721
  }
55729
55722
  /************************************************************
55730
55723
  * The innerHTML of ONE node, in the given theme and highlight state.
@@ -56517,30 +56510,32 @@ function ac_load_data(gobj, event, kw, src) {
56517
56510
  break;
56518
56511
  }
56519
56512
  }
56520
- if (do_links && priv.graph) graph_draw(gobj).then(() => {
56521
- create_links(gobj);
56513
+ if (do_links && priv.graph) {
56514
+ try {
56515
+ refresh_minimap(gobj);
56516
+ } catch (e) {
56517
+ log_error(`${gobj_short_name(gobj)}: refresh_minimap failed: ${e}`);
56518
+ }
56522
56519
  graph_draw(gobj).then(() => {
56523
- graph_layout(gobj).then(() => {
56524
- if (priv.edit_mode) graph_add_plugin(gobj, "history");
56525
- else graph_remove_plugin(gobj, "history");
56526
- try {
56527
- refresh_minimap(gobj);
56528
- } catch (e) {
56529
- log_error(`${gobj_short_name(gobj)}: refresh_minimap failed: ${e}`);
56530
- }
56531
- if (priv._pending_focus_topic !== null) {
56532
- let ft = priv._pending_focus_topic;
56533
- priv._pending_focus_topic = null;
56534
- graph_focus_topic(gobj, ft);
56535
- }
56536
- if (priv._pending_find !== null) {
56537
- let term = priv._pending_find;
56538
- priv._pending_find = null;
56539
- publish_find_result(gobj, term, graph_find_nodes(gobj, term));
56540
- }
56520
+ create_links(gobj);
56521
+ graph_draw(gobj).then(() => {
56522
+ graph_layout(gobj).then(() => {
56523
+ if (priv.edit_mode) graph_add_plugin(gobj, "history");
56524
+ else graph_remove_plugin(gobj, "history");
56525
+ if (priv._pending_focus_topic !== null) {
56526
+ let ft = priv._pending_focus_topic;
56527
+ priv._pending_focus_topic = null;
56528
+ graph_focus_topic(gobj, ft);
56529
+ }
56530
+ if (priv._pending_find !== null) {
56531
+ let term = priv._pending_find;
56532
+ priv._pending_find = null;
56533
+ publish_find_result(gobj, term, graph_find_nodes(gobj, term));
56534
+ }
56535
+ });
56541
56536
  });
56542
56537
  });
56543
- });
56538
+ }
56544
56539
  return 0;
56545
56540
  }
56546
56541
  /************************************************************
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.4.4",
3
+ "version": "7.4.5",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -4524,8 +4524,6 @@ function refresh_minimap(gobj)
4524
4524
  return; /* already up */
4525
4525
  }
4526
4526
 
4527
- log_warning(`${gobj_short_name(gobj)}: minimap: adding for ${n} nodes ` +
4528
- `(threshold ${threshold})`);
4529
4527
  graph_add_plugin(
4530
4528
  gobj,
4531
4529
  "minimap",
@@ -4558,18 +4556,6 @@ function refresh_minimap(gobj)
4558
4556
  }
4559
4557
  }
4560
4558
  );
4561
-
4562
- /* The plugin builds its canvas on its FIRST render, and it renders off
4563
- * the graph's draw events — which have all already happened by the time
4564
- * the node count is known and this runs. Without a draw of its own it
4565
- * sits there having never painted, with no container in the DOM at all. */
4566
- try {
4567
- graph.draw();
4568
- } catch(e) {
4569
- log_error(`${gobj_short_name(gobj)}: cannot draw the minimap: ${e}`);
4570
- }
4571
- log_warning(`${gobj_short_name(gobj)}: minimap: plugin is ` +
4572
- `${graph_get_plugin(gobj, "minimap")? "up" : "MISSING"}`);
4573
4559
  }
4574
4560
 
4575
4561
  /************************************************************
@@ -5768,6 +5754,19 @@ function ac_load_data(gobj, event, kw, src)
5768
5754
  }
5769
5755
 
5770
5756
  if(do_links && priv.graph) {
5757
+ /* Decided BEFORE the drawing, not after it.
5758
+ *
5759
+ * The plugin builds its canvas on its FIRST render, and it renders
5760
+ * off the graph's draw events — so a minimap added after the last
5761
+ * draw is instantiated, bound, and never painted: no container in
5762
+ * the DOM at all, and nothing anywhere says so. Added here it rides
5763
+ * the two draws and the layout that follow. The node count it needs
5764
+ * is already known: the records were turned into nodes above. */
5765
+ try {
5766
+ refresh_minimap(gobj);
5767
+ } catch(e) {
5768
+ log_error(`${gobj_short_name(gobj)}: refresh_minimap failed: ${e}`);
5769
+ }
5771
5770
  graph_draw(gobj).then(() => { // draw nodes, else the link fails
5772
5771
  create_links(gobj);
5773
5772
  graph_draw(gobj).then(() => {
@@ -5777,18 +5776,6 @@ function ac_load_data(gobj, event, kw, src)
5777
5776
  } else {
5778
5777
  graph_remove_plugin(gobj, "history");
5779
5778
  }
5780
- /* The graph knows its size now: a minimap appears only
5781
- * when there is something to be lost in.
5782
- *
5783
- * Guarded because this runs inside a .then(): an
5784
- * exception here becomes an unhandled rejection, which
5785
- * is not a console error and not a pageerror — it is
5786
- * nothing at all, and the feature just fails to appear. */
5787
- try {
5788
- refresh_minimap(gobj);
5789
- } catch(e) {
5790
- log_error(`${gobj_short_name(gobj)}: refresh_minimap failed: ${e}`);
5791
- }
5792
5779
  /* Nodes exist and are positioned now: apply a focus
5793
5780
  * requested before the data was ready (deep link). */
5794
5781
  if(priv._pending_focus_topic !== null) {