@yuneta/gobj-ui 7.31.1 → 7.31.3

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.
@@ -42112,7 +42112,7 @@ var PrepareRendererPlugin = /*#__PURE__*/ function() {
42112
42112
  }]);
42113
42113
  }();
42114
42114
  PrepareRendererPlugin.tag = "Prepare";
42115
- var CanvasEvent$2 = /*#__PURE__*/ function(CanvasEvent) {
42115
+ var CanvasEvent$3 = /*#__PURE__*/ function(CanvasEvent) {
42116
42116
  CanvasEvent["READY"] = "ready";
42117
42117
  CanvasEvent["BEFORE_RENDER"] = "beforerender";
42118
42118
  CanvasEvent["RERENDER"] = "rerender";
@@ -42126,9 +42126,9 @@ var CanvasEvent$2 = /*#__PURE__*/ function(CanvasEvent) {
42126
42126
  }({});
42127
42127
  new CustomEvent(ElementEvent.MOUNTED);
42128
42128
  new CustomEvent(ElementEvent.UNMOUNTED);
42129
- new CustomEvent(CanvasEvent$2.BEFORE_RENDER);
42130
- new CustomEvent(CanvasEvent$2.RERENDER);
42131
- new CustomEvent(CanvasEvent$2.AFTER_RENDER);
42129
+ new CustomEvent(CanvasEvent$3.BEFORE_RENDER);
42130
+ new CustomEvent(CanvasEvent$3.RERENDER);
42131
+ new CustomEvent(CanvasEvent$3.AFTER_RENDER);
42132
42132
  var RefCountCache = /*#__PURE__*/ function() {
42133
42133
  function RefCountCache() {
42134
42134
  _classCallCheck(this, RefCountCache);
@@ -42725,7 +42725,7 @@ var HTMLRenderingPlugin = /*#__PURE__*/ function() {
42725
42725
  }
42726
42726
  };
42727
42727
  renderingService.hooks.init.tap(HTMLRenderingPlugin.tag, function() {
42728
- canvas.addEventListener(CanvasEvent$2.RESIZE, handleCanvasResize);
42728
+ canvas.addEventListener(CanvasEvent$3.RESIZE, handleCanvasResize);
42729
42729
  canvas.addEventListener(ElementEvent.MOUNTED, handleMounted);
42730
42730
  canvas.addEventListener(ElementEvent.UNMOUNTED, handleUnmounted);
42731
42731
  canvas.addEventListener(ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
@@ -42736,7 +42736,7 @@ var HTMLRenderingPlugin = /*#__PURE__*/ function() {
42736
42736
  });
42737
42737
  renderingService.hooks.destroy.tap(HTMLRenderingPlugin.tag, function() {
42738
42738
  if (_this.$camera) _this.$camera.remove();
42739
- canvas.removeEventListener(CanvasEvent$2.RESIZE, handleCanvasResize);
42739
+ canvas.removeEventListener(CanvasEvent$3.RESIZE, handleCanvasResize);
42740
42740
  canvas.removeEventListener(ElementEvent.MOUNTED, handleMounted);
42741
42741
  canvas.removeEventListener(ElementEvent.UNMOUNTED, handleUnmounted);
42742
42742
  canvas.removeEventListener(ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
@@ -52247,7 +52247,7 @@ var attrs_table$9 = [
52247
52247
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "wide", 0, "40px", "Height of header. 40px and not 36: it is what an untouched Bulma control measures, so the find box stood 4px taller than every button beside it, and it is what the third graph of the family (C_YUI_TREEDB_GRAPH) uses"),
52248
52248
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "layout", 0, "vertical-compact", "Current layout key"),
52249
52249
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_INTEGER, "collapse_threshold", 0, 10, "Auto-collapse a node whose direct children exceed this number. 0 disables auto-collapse."),
52250
- (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_INTEGER, "minimap_min_nodes", 0, 20, "Show the minimap from this many cards on (0 = never). Lower than the treedb graph's 30: this tree opens at actual size, not fitted, so the reader is past its edge sooner"),
52250
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_INTEGER, "minimap_min_nodes", 0, 20, "Show the minimap from this many cards on (0 = never). The treedb graph shows it from 10"),
52251
52251
  (0, _yuneta_gobj_js.SDATA_END)()
52252
52252
  ];
52253
52253
  var CAMERA = yui_graph_camera_behaviors();
@@ -66959,7 +66959,7 @@ var attrs_table$4 = [
66959
66959
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_gridline", 0, true, "Use gridline plugin"),
66960
66960
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_fullscreen", 0, true, "Use fullscreen plugin"),
66961
66961
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_toolbar", 0, true, "Use toolbar plugin"),
66962
- (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_INTEGER, "minimap_min_nodes", 0, 30, "Show the minimap from this many nodes on (0 = never). A minimap of a graph that fits on screen is decoration; one of two hundred cards is the only way to know where you are"),
66962
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_INTEGER, "minimap_min_nodes", 0, 10, "Show the minimap from this many nodes on (0 = never). A minimap of a graph that fits on screen is decoration; one of two hundred cards is the only way to know where you are. 10, not 30: a row of 26 cards already runs off both sides of the screen"),
66963
66963
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "toolbar_position", 0, "right-top", "Toolbar position: top-left, top-right, bottom-left, bottom-right, left-top, right-top"),
66964
66964
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_LIST, "layout_names", _yuneta_gobj_js.sdata_flag_t.SDF_RD, JSON.stringify(Object.keys(_layouts)), "Available layout names (read-only, for parent to query)"),
66965
66965
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "hook_port_position", 0, "bottom", "Hook port position"),
@@ -67054,6 +67054,8 @@ var PRIVATE_DATA$4 = {
67054
67054
  _link_saved_styles: [],
67055
67055
  _focus_topic: null,
67056
67056
  _focus_ids: [],
67057
+ _lit_edge_id: null,
67058
+ _lit_ids: [],
67057
67059
  _on_pointerdown_focus: null,
67058
67060
  _on_native_contextmenu: null,
67059
67061
  _uninstall_long_press: null,
@@ -67286,10 +67288,20 @@ function build_graph$1(gobj) {
67286
67288
  }
67287
67289
  }
67288
67290
  },
67289
- edge: { style: {
67290
- startArrow: true,
67291
- endArrow: false
67292
- } },
67291
+ edge: {
67292
+ style: {
67293
+ startArrow: true,
67294
+ endArrow: false,
67295
+ increasedLineWidthForHitTesting: 14
67296
+ },
67297
+ state: { lit: () => ({
67298
+ stroke: highlight_color(priv.theme),
67299
+ lineWidth: 4,
67300
+ halo: true,
67301
+ haloStroke: highlight_halo(priv.theme),
67302
+ haloLineWidth: 8
67303
+ }) }
67304
+ },
67293
67305
  plugins: []
67294
67306
  });
67295
67307
  graph.setTheme(priv.theme);
@@ -67789,6 +67801,7 @@ function configure_behaviour(gobj) {
67789
67801
  break;
67790
67802
  case "edition":
67791
67803
  priv.edit_mode = true;
67804
+ unlight_edge$1(gobj);
67792
67805
  behaviors = [
67793
67806
  {
67794
67807
  type: "drag-canvas",
@@ -68386,7 +68399,7 @@ function reshape_nodes(gobj, ids) {
68386
68399
  (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot reshape the nodes: ${e}`);
68387
68400
  return;
68388
68401
  }
68389
- repaint_cards(gobj, touched);
68402
+ repaint_cards$1(gobj, touched);
68390
68403
  }
68391
68404
  function all_record_node_ids(gobj) {
68392
68405
  let graph = gobj.priv.graph;
@@ -68406,7 +68419,7 @@ function update_topic_node(gobj, desc, node_name, record) {
68406
68419
  return;
68407
68420
  }
68408
68421
  nodedata.data.record = record;
68409
- repaint_cards(gobj, /* @__PURE__ */ new Set([node_name]));
68422
+ repaint_cards$1(gobj, /* @__PURE__ */ new Set([node_name]));
68410
68423
  } catch (e) {
68411
68424
  (0, _yuneta_gobj_js.log_error)(e.message);
68412
68425
  }
@@ -70124,7 +70137,7 @@ function paint_selection(gobj, ids) {
70124
70137
  let prev = priv._selected_paint_ids || [];
70125
70138
  let next = ids || [];
70126
70139
  priv._selected_paint_ids = next;
70127
- repaint_cards(gobj, /* @__PURE__ */ new Set([...prev, ...next]));
70140
+ repaint_cards$1(gobj, /* @__PURE__ */ new Set([...prev, ...next]));
70128
70141
  update_zoom_selection_button(gobj);
70129
70142
  }
70130
70143
  /************************************************************
@@ -71633,7 +71646,7 @@ function show_node_popover(gobj) {
71633
71646
  lineWidth: lw
71634
71647
  }
71635
71648
  }]);
71636
- repaint_cards(gobj, /* @__PURE__ */ new Set([node_id]));
71649
+ repaint_cards$1(gobj, /* @__PURE__ */ new Set([node_id]));
71637
71650
  graph.draw();
71638
71651
  };
71639
71652
  let undo_node = () => {
@@ -71946,6 +71959,79 @@ function node_innerHTML_of(nd, theme, highlight, selected, anchored, pills_html)
71946
71959
  return null;
71947
71960
  }
71948
71961
  /************************************************************
71962
+ * The cards painted with the highlight: a find or topic focus
71963
+ * (`_focus_ids`) and the two ends of a lit edge (`_lit_ids`).
71964
+ * Kept apart so that lighting an edge does not erase a find,
71965
+ * and a find does not put out an edge.
71966
+ ************************************************************/
71967
+ function highlighted_ids(gobj) {
71968
+ let priv = gobj.priv;
71969
+ return /* @__PURE__ */ new Set([...priv._focus_ids || [], ...priv._lit_ids || []]);
71970
+ }
71971
+ /************************************************************
71972
+ * Light an edge: the edge itself and its two ends, so a click
71973
+ * on a line says which two records it joins. A second click on
71974
+ * the same edge, or a click on the canvas, puts it out.
71975
+ *
71976
+ * Not in edition: there a click SELECTS the edge, with its own
71977
+ * ring and its affordances (select_edge).
71978
+ ************************************************************/
71979
+ function light_edge$1(gobj, edge_id) {
71980
+ let priv = gobj.priv;
71981
+ let graph = priv.graph;
71982
+ if (!graph || !edge_id) return;
71983
+ let same = priv._lit_edge_id === edge_id;
71984
+ unlight_edge$1(gobj);
71985
+ if (same) return;
71986
+ let ed;
71987
+ try {
71988
+ ed = graph.getEdgeData(edge_id);
71989
+ } catch (e) {
71990
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot light the edge ${edge_id}: ${e}`);
71991
+ return;
71992
+ }
71993
+ priv._lit_edge_id = edge_id;
71994
+ priv._lit_ids = [ed.source, ed.target];
71995
+ try {
71996
+ graph.updateData({ edges: [{
71997
+ id: edge_id,
71998
+ states: ["lit"]
71999
+ }] });
72000
+ } catch (e) {
72001
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: edge state not set: ${e}`);
72002
+ }
72003
+ repaint_cards$1(gobj, new Set(priv._lit_ids));
72004
+ }
72005
+ function unlight_edge$1(gobj) {
72006
+ let priv = gobj.priv;
72007
+ let graph = priv.graph;
72008
+ let edge_id = priv._lit_edge_id;
72009
+ let ids = priv._lit_ids || [];
72010
+ priv._lit_edge_id = null;
72011
+ priv._lit_ids = [];
72012
+ if (!graph) return;
72013
+ if (edge_id) {
72014
+ let exists = false;
72015
+ try {
72016
+ exists = !!graph.getEdgeData(edge_id);
72017
+ } catch (e) {
72018
+ exists = false;
72019
+ }
72020
+ if (exists) try {
72021
+ graph.updateData({ edges: [{
72022
+ id: edge_id,
72023
+ states: []
72024
+ }] });
72025
+ } catch (e) {
72026
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: edge state not cleared: ${e}`);
72027
+ }
72028
+ }
72029
+ if (ids.length) repaint_cards$1(gobj, new Set(ids));
72030
+ else if (edge_id) graph.draw().catch((e) => {
72031
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: redraw failed: ${e}`);
72032
+ });
72033
+ }
72034
+ /************************************************************
71949
72035
  * Repaint these cards with the flags they carry RIGHT NOW.
71950
72036
  *
71951
72037
  * One place, because the flags are independent and each used to
@@ -71954,11 +72040,11 @@ function node_innerHTML_of(nd, theme, highlight, selected, anchored, pills_html)
71954
72040
  * repainted over a match erased the amber. Both are read here
71955
72041
  * from where they live.
71956
72042
  ************************************************************/
71957
- function repaint_cards(gobj, ids) {
72043
+ function repaint_cards$1(gobj, ids) {
71958
72044
  let priv = gobj.priv;
71959
72045
  let graph = priv.graph;
71960
72046
  if (!graph || !ids || !ids.size) return;
71961
- let focus = new Set(priv._focus_ids || []);
72047
+ let focus = highlighted_ids(gobj);
71962
72048
  let selected = new Set(priv._selected_paint_ids || []);
71963
72049
  let updates = [];
71964
72050
  for (let id of ids) {
@@ -72005,14 +72091,14 @@ function apply_node_highlight(gobj, prev_ids, next_ids) {
72005
72091
  let next = new Set(next_ids || []);
72006
72092
  let touched = /* @__PURE__ */ new Set([...prev_ids || [], ...next]);
72007
72093
  if (touched.size === 0) return;
72008
- repaint_cards(gobj, touched);
72094
+ repaint_cards$1(gobj, touched);
72009
72095
  }
72010
72096
  function refresh_html_nodes_theme(gobj, theme) {
72011
72097
  let priv = gobj.priv;
72012
72098
  let graph = priv.graph;
72013
72099
  if (!graph) return;
72014
72100
  let nodes = graph.getData().nodes || [];
72015
- let highlighted = new Set(priv._focus_ids || []);
72101
+ let highlighted = highlighted_ids(gobj);
72016
72102
  let selected = new Set(priv._selected_paint_ids || []);
72017
72103
  let updates = [];
72018
72104
  for (let i = 0; i < nodes.length; i++) {
@@ -72560,7 +72646,7 @@ function apply_node_properties(gobj, node_id, fill, stroke, lineWidth, scope, sh
72560
72646
  if (updates.length > 0) {
72561
72647
  graph.updateNodeData(updates);
72562
72648
  if (reshaped.length) reshape_nodes(gobj, reshaped);
72563
- repaint_cards(gobj, repaint);
72649
+ repaint_cards$1(gobj, repaint);
72564
72650
  graph.draw().then(() => {
72565
72651
  mark_graph_dirty(gobj);
72566
72652
  });
@@ -72685,7 +72771,7 @@ function default_edge_stroke(gobj, d, theme) {
72685
72771
  function edge_inherited_style_of(gobj, d) {
72686
72772
  let priv = gobj.priv;
72687
72773
  let style = {
72688
- lineWidth: d.is_tree ? 2 : 1.6,
72774
+ lineWidth: d.is_tree ? 2.5 : 2,
72689
72775
  stroke: default_edge_stroke(gobj, d, priv.theme),
72690
72776
  themed_default: true
72691
72777
  };
@@ -73551,6 +73637,10 @@ async function reconcile_fold_apply(gobj, opts, visible) {
73551
73637
  if (priv._selected_node_id && gone.has(priv._selected_node_id)) deselect_node(gobj);
73552
73638
  if (priv._detail_node_id && gone.has(priv._detail_node_id)) hide_node_detail(gobj);
73553
73639
  priv._focus_ids = (priv._focus_ids || []).filter((id) => !gone.has(id));
73640
+ if ((priv._lit_ids || []).some((id) => gone.has(id))) {
73641
+ priv._lit_edge_id = null;
73642
+ priv._lit_ids = (priv._lit_ids || []).filter((id) => !gone.has(id));
73643
+ }
73554
73644
  priv._selected_paint_ids = (priv._selected_paint_ids || []).filter((id) => !gone.has(id));
73555
73645
  if (priv.anchor_state === "on" && gone.has(priv.anchor_id)) {
73556
73646
  priv.anchor_id = "";
@@ -73674,7 +73764,7 @@ async function reconcile_fold_apply(gobj, opts, visible) {
73674
73764
  }
73675
73765
  }
73676
73766
  if (resize.length) graph.updateNodeData(resize);
73677
- if (repaint.size) repaint_cards(gobj, repaint);
73767
+ if (repaint.size) repaint_cards$1(gobj, repaint);
73678
73768
  try {
73679
73769
  refresh_minimap(gobj);
73680
73770
  } catch (e) {
@@ -74205,7 +74295,7 @@ function ac_toggle_anchor(gobj, event, kw, src) {
74205
74295
  priv.anchor_id = "";
74206
74296
  }
74207
74297
  update_toolbar(gobj);
74208
- if (was) repaint_cards(gobj, /* @__PURE__ */ new Set([was]));
74298
+ if (was) repaint_cards$1(gobj, /* @__PURE__ */ new Set([was]));
74209
74299
  return 0;
74210
74300
  }
74211
74301
  /************************************************************
@@ -74691,7 +74781,7 @@ function ac_node_click$2(gobj, event, kw, src) {
74691
74781
  priv.anchor_id = node_id;
74692
74782
  priv.anchor_state = "on";
74693
74783
  update_toolbar(gobj);
74694
- repaint_cards(gobj, /* @__PURE__ */ new Set([node_id]));
74784
+ repaint_cards$1(gobj, /* @__PURE__ */ new Set([node_id]));
74695
74785
  (0, _yuneta_gobj_js.gobj_post_event)(gobj, "EV_CENTER_ANCHOR", {}, gobj);
74696
74786
  return 0;
74697
74787
  }
@@ -74726,7 +74816,7 @@ function ac_node_click$2(gobj, event, kw, src) {
74726
74816
  /************************************************************
74727
74817
  * Edge click - publish edge clicked event with semantic data
74728
74818
  ************************************************************/
74729
- function ac_edge_click(gobj, event, kw, src) {
74819
+ function ac_edge_click$1(gobj, event, kw, src) {
74730
74820
  let priv = gobj.priv;
74731
74821
  let graph = priv.graph;
74732
74822
  let edge_id = kw && kw.id ? kw.id : "";
@@ -74746,7 +74836,7 @@ function ac_edge_click(gobj, event, kw, src) {
74746
74836
  if (priv.edit_mode) {
74747
74837
  deselect_node(gobj);
74748
74838
  select_edge(gobj, edge_id);
74749
- }
74839
+ } else light_edge$1(gobj, edge_id);
74750
74840
  }
74751
74841
  } catch (e) {}
74752
74842
  return 0;
@@ -75137,9 +75227,10 @@ function ac_confirmed$1(gobj, event, kw, src) {
75137
75227
  /************************************************************
75138
75228
  * Canvas click
75139
75229
  ************************************************************/
75140
- function ac_canvas_click(gobj, event, kw, src) {
75230
+ function ac_canvas_click$1(gobj, event, kw, src) {
75141
75231
  let priv = gobj.priv;
75142
75232
  hide_node_detail(gobj);
75233
+ unlight_edge$1(gobj);
75143
75234
  if (priv._linking_mode) {
75144
75235
  exit_linking_mode(gobj);
75145
75236
  return 0;
@@ -75295,7 +75386,7 @@ function create_gclass$4(gclass_name) {
75295
75386
  ],
75296
75387
  [
75297
75388
  "EV_EDGE_CLICK",
75298
- ac_edge_click,
75389
+ ac_edge_click$1,
75299
75390
  null
75300
75391
  ],
75301
75392
  [
@@ -75415,7 +75506,7 @@ function create_gclass$4(gclass_name) {
75415
75506
  ],
75416
75507
  [
75417
75508
  "EV_CANVAS_CLICK",
75418
- ac_canvas_click,
75509
+ ac_canvas_click$1,
75419
75510
  null
75420
75511
  ],
75421
75512
  [
@@ -75741,7 +75832,7 @@ var attrs_table$3 = [
75741
75832
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_treedb_tables", 0, false, "Include treedb tables"),
75742
75833
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_INTEGER, "expand_depth", 0, 1, "Levels of the treedb open when it loads, until the reader steps (`fold_level`): 1 = the roots alone (the default), 2 = the roots and their children. Forwarded to the G6 child"),
75743
75834
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_INTEGER, "fold_page_size", 0, 24, "Children of one hook shown per page in the graph; a `+N` chip opens the next page. Forwarded to the G6 child"),
75744
- (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_INTEGER, "minimap_min_nodes", 0, 30, "Show the minimap from this many nodes on (0 = never). Forwarded to the G6 child"),
75835
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_INTEGER, "minimap_min_nodes", 0, 10, "Show the minimap from this many nodes on (0 = never). Forwarded to the G6 child"),
75745
75836
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_gridline", 0, true, "Draw the grid under the graph. Forwarded to the G6 child"),
75746
75837
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_fullscreen", 0, true, "Offer the full-screen button. Forwarded to the G6 child"),
75747
75838
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_toolbar", 0, true, "Float the camera toolbar over the canvas. Forwarded to the G6 child"),
@@ -78470,6 +78561,14 @@ function register_c_yui_treedb_graph() {
78470
78561
  * via the host-supplied `node_route`). An alternate landing to the
78471
78562
  * topic cards, in the spirit of "every treedb is a graph".
78472
78563
  *
78564
+ * A click on an EDGE lights it: the line in amber, its two cards
78565
+ * ringed and the hook row and the fkey row it joins washed, so a
78566
+ * line says which two fields it ties. A second click on it, or a
78567
+ * click on the canvas, puts it out. The amber is the node graph's
78568
+ * find (C_G6_NODES_TREE). And the drawing always carries a
78569
+ * MINIMAP (yui_graph_minimap.js): a schema of more cards than the
78570
+ * screen holds is the usual case.
78571
+ *
78473
78572
  * The CAMERA is the family's (yui_graph_camera.js): the same
78474
78573
  * toolbar cluster -- zoom in/out, readout, fit, 1:1 -- and the
78475
78574
  * same wheel: it SCROLLS, and Ctrl + wheel zooms, over the cards
@@ -78504,6 +78603,11 @@ var topic_colors = [
78504
78603
  "rgb(66, 146, 198)"
78505
78604
  ];
78506
78605
  var SYSTEM_TOPIC_COLOR = "rgb(148, 163, 184)";
78606
+ var LIT_COLOR_DARK = "#f0a020";
78607
+ var LIT_COLOR_LIGHT = "#b45309";
78608
+ var LIT_HALO_DARK = "rgba(240,160,32,0.35)";
78609
+ var LIT_HALO_LIGHT = "rgba(180,83,9,0.35)";
78610
+ var EDGE_HIT_WIDTH = 14;
78507
78611
  /***************************************************************
78508
78612
  * Data
78509
78613
  ***************************************************************/
@@ -78522,7 +78626,8 @@ var PRIVATE_DATA$2 = {
78522
78626
  $canvas: null,
78523
78627
  graph: null,
78524
78628
  theme_observer: null,
78525
- unforward_wheel: null
78629
+ unforward_wheel: null,
78630
+ lit_edge_id: null
78526
78631
  };
78527
78632
  var __gclass__$2 = null;
78528
78633
  /******************************
@@ -78703,7 +78808,7 @@ function row_placement(index, height) {
78703
78808
  * The card itself. Header = topic name on its topic colour;
78704
78809
  * body = one line per field, in schema order.
78705
78810
  ************************************************************/
78706
- function build_card_innerHTML(topic, rows, color, dark) {
78811
+ function build_card_innerHTML(topic, rows, color, dark, lit_rows) {
78707
78812
  let surface = dark ? "#1b2230" : "#ffffff";
78708
78813
  let bg = dark ? `color-mix(in srgb, ${color} 18%, #232b38)` : `color-mix(in srgb, ${color} 6%, ${surface})`;
78709
78814
  let border = dark ? `color-mix(in srgb, ${color} 85%, #ffffff)` : color;
@@ -78713,15 +78818,29 @@ function build_card_innerHTML(topic, rows, color, dark) {
78713
78818
  let mute_color = dark ? "#98a2b0" : "#7c8694";
78714
78819
  let rule_color = dark ? "rgba(255,255,255,0.06)" : "rgba(15,23,42,0.05)";
78715
78820
  let shadow = dark ? "0 1px 3px rgba(0,0,0,0.45), 0 1px 2px rgba(0,0,0,0.30)" : "0 1px 3px rgba(15,23,42,0.12), 0 1px 2px rgba(15,23,42,0.06)";
78821
+ let border_w = "1.5px";
78822
+ let lit = lit_rows instanceof Set;
78823
+ let lit_color = dark ? LIT_COLOR_DARK : LIT_COLOR_LIGHT;
78824
+ if (lit) {
78825
+ border = lit_color;
78826
+ border_w = "3px";
78827
+ shadow = `0 0 0 4px ${dark ? LIT_HALO_DARK : LIT_HALO_LIGHT}`;
78828
+ }
78716
78829
  let rows_html = "";
78717
78830
  for (let row of rows) {
78718
78831
  let lead = row.is_pkey ? "#" : row.required ? "*" : "";
78719
78832
  let name_weight = row.is_pkey || row.is_pkey2 ? "700" : row.required ? "600" : "400";
78720
78833
  let name_color = row.is_hook || row.is_fkey ? title_color : text_color;
78834
+ let row_bg = "transparent";
78835
+ if (lit && lit_rows.has(row.name)) {
78836
+ row_bg = `color-mix(in srgb, ${lit_color} ${dark ? 35 : 22}%, transparent)`;
78837
+ name_weight = "700";
78838
+ }
78721
78839
  rows_html += ` <div class="TREEDB_SCHEMA_FIELD" style="
78722
78840
  display: flex; align-items: center; gap: 6px;
78723
78841
  height: ${CARD_ROW_H}px; line-height: ${CARD_ROW_H}px;
78724
78842
  padding: 0 10px; border-top: 1px solid ${rule_color};
78843
+ background: ${row_bg};
78725
78844
  ">
78726
78845
  <span style="
78727
78846
  width: 8px; flex: 0 0 8px; text-align: center;
@@ -78745,7 +78864,7 @@ function build_card_innerHTML(topic, rows, color, dark) {
78745
78864
  width: 100%;
78746
78865
  height: 100%;
78747
78866
  background: ${bg};
78748
- border: 1.5px solid ${border};
78867
+ border: ${border_w} solid ${border};
78749
78868
  border-radius: 8px;
78750
78869
  box-shadow: ${shadow};
78751
78870
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
@@ -78897,12 +79016,156 @@ function schema_to_graph(gobj) {
78897
79016
  function edge_style(dark) {
78898
79017
  return {
78899
79018
  stroke: dark ? "#7a8593" : "#9aa4b2",
78900
- lineWidth: 1.2,
79019
+ lineWidth: 2,
79020
+ increasedLineWidthForHitTesting: EDGE_HIT_WIDTH,
78901
79021
  startArrow: true,
78902
79022
  endArrow: false
78903
79023
  };
78904
79024
  }
78905
79025
  /************************************************************
79026
+ * The edge options: the style, and the `lit` state of an edge
79027
+ * a click lit (light_edge). Both together, because setEdge()
79028
+ * REPLACES the options: a theme switch that set only the style
79029
+ * would drop the state.
79030
+ ************************************************************/
79031
+ function edge_options(dark) {
79032
+ return {
79033
+ style: edge_style(dark),
79034
+ state: { lit: {
79035
+ stroke: dark ? LIT_COLOR_DARK : LIT_COLOR_LIGHT,
79036
+ lineWidth: 4,
79037
+ halo: true,
79038
+ haloStroke: dark ? LIT_HALO_DARK : LIT_HALO_LIGHT,
79039
+ haloLineWidth: 8
79040
+ } }
79041
+ };
79042
+ }
79043
+ /************************************************************
79044
+ * The rows of `topic` the lit edge touches, as a Set (empty
79045
+ * rows still mark the card), or null when the card is not one
79046
+ * of its ends.
79047
+ ************************************************************/
79048
+ function lit_rows_of(gobj, topic) {
79049
+ let priv = gobj.priv;
79050
+ if (!priv.graph || !priv.lit_edge_id) return null;
79051
+ let ed;
79052
+ try {
79053
+ ed = priv.graph.getEdgeData(priv.lit_edge_id);
79054
+ } catch (e) {
79055
+ return null;
79056
+ }
79057
+ let style = ed.style || {};
79058
+ let rows = null;
79059
+ if (ed.source === topic) {
79060
+ rows = rows || /* @__PURE__ */ new Set();
79061
+ rows.add(style.sourcePort);
79062
+ }
79063
+ if (ed.target === topic) {
79064
+ rows = rows || /* @__PURE__ */ new Set();
79065
+ rows.add(style.targetPort);
79066
+ }
79067
+ return rows;
79068
+ }
79069
+ /************************************************************
79070
+ * Repaint the cards of these topics, lit or not as they are now.
79071
+ ************************************************************/
79072
+ function repaint_cards(gobj, topics) {
79073
+ let graph = gobj.priv.graph;
79074
+ let dark = yui_is_dark();
79075
+ let updates = [];
79076
+ for (let topic of topics) {
79077
+ let nd;
79078
+ try {
79079
+ nd = graph.getNodeData(topic);
79080
+ } catch (e) {
79081
+ continue;
79082
+ }
79083
+ let data = nd && nd.data;
79084
+ if (!(0, _yuneta_gobj_js.is_object)(data) || !Array.isArray(data.rows)) continue;
79085
+ updates.push({
79086
+ id: topic,
79087
+ style: { innerHTML: build_card_innerHTML(data.topic_name, data.rows, data.color, dark, lit_rows_of(gobj, topic)) }
79088
+ });
79089
+ }
79090
+ if (updates.length > 0) graph.updateNodeData(updates);
79091
+ }
79092
+ /************************************************************
79093
+ * Light an edge: the line, its two cards and the two rows it
79094
+ * joins -- a click on a line says which hook it is and which
79095
+ * fkey it lands on. A second click on it, or a click on the
79096
+ * canvas, puts it out.
79097
+ ************************************************************/
79098
+ function light_edge(gobj, edge_id) {
79099
+ let priv = gobj.priv;
79100
+ let graph = priv.graph;
79101
+ if (!graph) return;
79102
+ let same = priv.lit_edge_id === edge_id;
79103
+ unlight_edge(gobj, false);
79104
+ if (!same && edge_id) {
79105
+ let ed;
79106
+ try {
79107
+ ed = graph.getEdgeData(edge_id);
79108
+ } catch (e) {
79109
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot light the edge ${edge_id}: ${e}`);
79110
+ ed = null;
79111
+ }
79112
+ if (ed) {
79113
+ priv.lit_edge_id = edge_id;
79114
+ graph.updateData({ edges: [{
79115
+ id: edge_id,
79116
+ states: ["lit"]
79117
+ }] });
79118
+ repaint_cards(gobj, /* @__PURE__ */ new Set([ed.source, ed.target]));
79119
+ }
79120
+ }
79121
+ graph.draw().catch((e) => {
79122
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: schema graph redraw failed: ${e}`);
79123
+ });
79124
+ }
79125
+ function unlight_edge(gobj, draw) {
79126
+ let priv = gobj.priv;
79127
+ let graph = priv.graph;
79128
+ let edge_id = priv.lit_edge_id;
79129
+ if (!graph || !edge_id) {
79130
+ priv.lit_edge_id = null;
79131
+ return;
79132
+ }
79133
+ let ed = null;
79134
+ try {
79135
+ ed = graph.getEdgeData(edge_id);
79136
+ } catch (e) {
79137
+ ed = null;
79138
+ }
79139
+ priv.lit_edge_id = null;
79140
+ if (!ed) return;
79141
+ graph.updateData({ edges: [{
79142
+ id: edge_id,
79143
+ states: []
79144
+ }] });
79145
+ repaint_cards(gobj, /* @__PURE__ */ new Set([ed.source, ed.target]));
79146
+ if (draw) graph.draw().catch((e) => {
79147
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: schema graph redraw failed: ${e}`);
79148
+ });
79149
+ }
79150
+ /************************************************************
79151
+ * A card in the minimap: a block of its size in its topic's
79152
+ * colour, darkened on the light scheme so a yellow topic does
79153
+ * not vanish on the white panel. G6 clones a node's key shape,
79154
+ * and the key shape of an html card is a DOM element, which
79155
+ * clones into nothing (see yui_graph_minimap.js).
79156
+ ************************************************************/
79157
+ function minimap_shape(gobj, id, element_type, element) {
79158
+ if (element_type !== "node") return element;
79159
+ try {
79160
+ let nd = gobj.priv.graph.getNodeData(id);
79161
+ let color = nd && nd.data && nd.data.color || SYSTEM_TOPIC_COLOR;
79162
+ return yui_graph_minimap_block(nd, yui_is_dark() ? color : getStrokeColor(color));
79163
+ } catch (e) {
79164
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: minimap shape failed: ${e}`);
79165
+ return element;
79166
+ }
79167
+ }
79168
+ /************************************************************
78906
79169
  * Build the G6 schema graph.
78907
79170
  ************************************************************/
78908
79171
  function build_graph(gobj) {
@@ -78934,7 +79197,7 @@ function build_graph(gobj) {
78934
79197
  autoResize: true,
78935
79198
  animation: false,
78936
79199
  data,
78937
- edge: { style: edge_style(dark) },
79200
+ edge: edge_options(dark),
78938
79201
  layout: {
78939
79202
  type: "antv-dagre",
78940
79203
  rankdir: "LR",
@@ -78945,7 +79208,12 @@ function build_graph(gobj) {
78945
79208
  "drag-canvas",
78946
79209
  ...yui_graph_camera_behaviors(),
78947
79210
  "drag-element"
78948
- ]
79211
+ ],
79212
+ plugins: [{
79213
+ key: "minimap",
79214
+ type: "minimap",
79215
+ ...yui_graph_minimap_options((id, element_type, element) => minimap_shape(gobj, id, element_type, element))
79216
+ }]
78949
79217
  });
78950
79218
  } catch (e) {
78951
79219
  (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: schema graph create failed: ${e}`);
@@ -78962,6 +79230,13 @@ function build_graph(gobj) {
78962
79230
  let node_id = evt && evt.target && evt.target.id;
78963
79231
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_CLICK", { node_id }, gobj);
78964
79232
  });
79233
+ graph.on(_antv_g6.EdgeEvent.CLICK, (evt) => {
79234
+ let edge_id = evt && evt.target && evt.target.id;
79235
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_EDGE_CLICK", { edge_id }, gobj);
79236
+ });
79237
+ graph.on(_antv_g6.CanvasEvent.CLICK, () => {
79238
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CANVAS_CLICK", {}, gobj);
79239
+ });
78965
79240
  graph.render().then(() => {
78966
79241
  yui_graph_update_zoom($container, priv.graph);
78967
79242
  }).catch((e) => {
@@ -78973,6 +79248,7 @@ function build_graph(gobj) {
78973
79248
  ************************************************************/
78974
79249
  function destroy_graph(gobj) {
78975
79250
  let priv = gobj.priv;
79251
+ priv.lit_edge_id = null;
78976
79252
  if (priv.unforward_wheel) {
78977
79253
  priv.unforward_wheel();
78978
79254
  priv.unforward_wheel = null;
@@ -79021,6 +79297,22 @@ function ac_node_click$1(gobj, event, kw, src) {
79021
79297
  return 0;
79022
79298
  }
79023
79299
  /************************************************************
79300
+ * An edge was clicked: light it, or put it out if it was lit.
79301
+ ************************************************************/
79302
+ function ac_edge_click(gobj, event, kw, src) {
79303
+ let edge_id = kw && kw.edge_id;
79304
+ if (!edge_id) return 0;
79305
+ light_edge(gobj, edge_id);
79306
+ return 0;
79307
+ }
79308
+ /************************************************************
79309
+ * A click on the empty canvas puts the lit edge out.
79310
+ ************************************************************/
79311
+ function ac_canvas_click(gobj, event, kw, src) {
79312
+ unlight_edge(gobj, true);
79313
+ return 0;
79314
+ }
79315
+ /************************************************************
79024
79316
  * Shown by the host: match the canvas to the container now it
79025
79317
  * is visible and sized (G6 renders at 0×0 while display:none).
79026
79318
  * A resize only, never a fit: the camera stays where it was, so
@@ -79053,14 +79345,14 @@ function ac_theme(gobj, event, kw, src) {
79053
79345
  let dark = kw && kw.theme ? kw.theme === "dark" : yui_is_dark();
79054
79346
  try {
79055
79347
  graph.setTheme(dark ? "dark" : "light");
79056
- graph.setEdge({ style: edge_style(dark) });
79348
+ graph.setEdge(edge_options(dark));
79057
79349
  let updates = [];
79058
79350
  for (let node of graph.getNodeData()) {
79059
79351
  let data = node.data;
79060
79352
  if (!(0, _yuneta_gobj_js.is_object)(data) || !Array.isArray(data.rows)) continue;
79061
79353
  updates.push({
79062
79354
  id: node.id,
79063
- style: { innerHTML: build_card_innerHTML(data.topic_name, data.rows, data.color, dark) }
79355
+ style: { innerHTML: build_card_innerHTML(data.topic_name, data.rows, data.color, dark, lit_rows_of(gobj, node.id)) }
79064
79356
  });
79065
79357
  }
79066
79358
  if (updates.length > 0) graph.updateNodeData(updates);
@@ -79132,6 +79424,16 @@ function create_gclass$2(gclass_name) {
79132
79424
  ac_node_click$1,
79133
79425
  null
79134
79426
  ],
79427
+ [
79428
+ "EV_EDGE_CLICK",
79429
+ ac_edge_click,
79430
+ null
79431
+ ],
79432
+ [
79433
+ "EV_CANVAS_CLICK",
79434
+ ac_canvas_click,
79435
+ null
79436
+ ],
79135
79437
  [
79136
79438
  "EV_SHOW",
79137
79439
  ac_show$1,
@@ -79170,6 +79472,8 @@ function create_gclass$2(gclass_name) {
79170
79472
  ]]];
79171
79473
  const event_types = [
79172
79474
  ["EV_NODE_CLICK", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS],
79475
+ ["EV_EDGE_CLICK", 0],
79476
+ ["EV_CANVAS_CLICK", 0],
79173
79477
  ["EV_SHOW", 0],
79174
79478
  ["EV_THEME", 0],
79175
79479
  ["EV_REBUILD", 0],