@yuneta/gobj-ui 7.31.1 → 7.31.2

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,19 @@ 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
+ },
67296
+ state: { lit: () => ({
67297
+ stroke: highlight_color(priv.theme),
67298
+ lineWidth: 3,
67299
+ halo: true,
67300
+ haloStroke: highlight_halo(priv.theme),
67301
+ haloLineWidth: 8
67302
+ }) }
67303
+ },
67293
67304
  plugins: []
67294
67305
  });
67295
67306
  graph.setTheme(priv.theme);
@@ -67789,6 +67800,7 @@ function configure_behaviour(gobj) {
67789
67800
  break;
67790
67801
  case "edition":
67791
67802
  priv.edit_mode = true;
67803
+ unlight_edge$1(gobj);
67792
67804
  behaviors = [
67793
67805
  {
67794
67806
  type: "drag-canvas",
@@ -68386,7 +68398,7 @@ function reshape_nodes(gobj, ids) {
68386
68398
  (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot reshape the nodes: ${e}`);
68387
68399
  return;
68388
68400
  }
68389
- repaint_cards(gobj, touched);
68401
+ repaint_cards$1(gobj, touched);
68390
68402
  }
68391
68403
  function all_record_node_ids(gobj) {
68392
68404
  let graph = gobj.priv.graph;
@@ -68406,7 +68418,7 @@ function update_topic_node(gobj, desc, node_name, record) {
68406
68418
  return;
68407
68419
  }
68408
68420
  nodedata.data.record = record;
68409
- repaint_cards(gobj, /* @__PURE__ */ new Set([node_name]));
68421
+ repaint_cards$1(gobj, /* @__PURE__ */ new Set([node_name]));
68410
68422
  } catch (e) {
68411
68423
  (0, _yuneta_gobj_js.log_error)(e.message);
68412
68424
  }
@@ -70124,7 +70136,7 @@ function paint_selection(gobj, ids) {
70124
70136
  let prev = priv._selected_paint_ids || [];
70125
70137
  let next = ids || [];
70126
70138
  priv._selected_paint_ids = next;
70127
- repaint_cards(gobj, /* @__PURE__ */ new Set([...prev, ...next]));
70139
+ repaint_cards$1(gobj, /* @__PURE__ */ new Set([...prev, ...next]));
70128
70140
  update_zoom_selection_button(gobj);
70129
70141
  }
70130
70142
  /************************************************************
@@ -71633,7 +71645,7 @@ function show_node_popover(gobj) {
71633
71645
  lineWidth: lw
71634
71646
  }
71635
71647
  }]);
71636
- repaint_cards(gobj, /* @__PURE__ */ new Set([node_id]));
71648
+ repaint_cards$1(gobj, /* @__PURE__ */ new Set([node_id]));
71637
71649
  graph.draw();
71638
71650
  };
71639
71651
  let undo_node = () => {
@@ -71946,6 +71958,79 @@ function node_innerHTML_of(nd, theme, highlight, selected, anchored, pills_html)
71946
71958
  return null;
71947
71959
  }
71948
71960
  /************************************************************
71961
+ * The cards painted with the highlight: a find or topic focus
71962
+ * (`_focus_ids`) and the two ends of a lit edge (`_lit_ids`).
71963
+ * Kept apart so that lighting an edge does not erase a find,
71964
+ * and a find does not put out an edge.
71965
+ ************************************************************/
71966
+ function highlighted_ids(gobj) {
71967
+ let priv = gobj.priv;
71968
+ return /* @__PURE__ */ new Set([...priv._focus_ids || [], ...priv._lit_ids || []]);
71969
+ }
71970
+ /************************************************************
71971
+ * Light an edge: the edge itself and its two ends, so a click
71972
+ * on a line says which two records it joins. A second click on
71973
+ * the same edge, or a click on the canvas, puts it out.
71974
+ *
71975
+ * Not in edition: there a click SELECTS the edge, with its own
71976
+ * ring and its affordances (select_edge).
71977
+ ************************************************************/
71978
+ function light_edge$1(gobj, edge_id) {
71979
+ let priv = gobj.priv;
71980
+ let graph = priv.graph;
71981
+ if (!graph || !edge_id) return;
71982
+ let same = priv._lit_edge_id === edge_id;
71983
+ unlight_edge$1(gobj);
71984
+ if (same) return;
71985
+ let ed;
71986
+ try {
71987
+ ed = graph.getEdgeData(edge_id);
71988
+ } catch (e) {
71989
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot light the edge ${edge_id}: ${e}`);
71990
+ return;
71991
+ }
71992
+ priv._lit_edge_id = edge_id;
71993
+ priv._lit_ids = [ed.source, ed.target];
71994
+ try {
71995
+ graph.updateData({ edges: [{
71996
+ id: edge_id,
71997
+ states: ["lit"]
71998
+ }] });
71999
+ } catch (e) {
72000
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: edge state not set: ${e}`);
72001
+ }
72002
+ repaint_cards$1(gobj, new Set(priv._lit_ids));
72003
+ }
72004
+ function unlight_edge$1(gobj) {
72005
+ let priv = gobj.priv;
72006
+ let graph = priv.graph;
72007
+ let edge_id = priv._lit_edge_id;
72008
+ let ids = priv._lit_ids || [];
72009
+ priv._lit_edge_id = null;
72010
+ priv._lit_ids = [];
72011
+ if (!graph) return;
72012
+ if (edge_id) {
72013
+ let exists = false;
72014
+ try {
72015
+ exists = !!graph.getEdgeData(edge_id);
72016
+ } catch (e) {
72017
+ exists = false;
72018
+ }
72019
+ if (exists) try {
72020
+ graph.updateData({ edges: [{
72021
+ id: edge_id,
72022
+ states: []
72023
+ }] });
72024
+ } catch (e) {
72025
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: edge state not cleared: ${e}`);
72026
+ }
72027
+ }
72028
+ if (ids.length) repaint_cards$1(gobj, new Set(ids));
72029
+ else if (edge_id) graph.draw().catch((e) => {
72030
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: redraw failed: ${e}`);
72031
+ });
72032
+ }
72033
+ /************************************************************
71949
72034
  * Repaint these cards with the flags they carry RIGHT NOW.
71950
72035
  *
71951
72036
  * One place, because the flags are independent and each used to
@@ -71954,11 +72039,11 @@ function node_innerHTML_of(nd, theme, highlight, selected, anchored, pills_html)
71954
72039
  * repainted over a match erased the amber. Both are read here
71955
72040
  * from where they live.
71956
72041
  ************************************************************/
71957
- function repaint_cards(gobj, ids) {
72042
+ function repaint_cards$1(gobj, ids) {
71958
72043
  let priv = gobj.priv;
71959
72044
  let graph = priv.graph;
71960
72045
  if (!graph || !ids || !ids.size) return;
71961
- let focus = new Set(priv._focus_ids || []);
72046
+ let focus = highlighted_ids(gobj);
71962
72047
  let selected = new Set(priv._selected_paint_ids || []);
71963
72048
  let updates = [];
71964
72049
  for (let id of ids) {
@@ -72005,14 +72090,14 @@ function apply_node_highlight(gobj, prev_ids, next_ids) {
72005
72090
  let next = new Set(next_ids || []);
72006
72091
  let touched = /* @__PURE__ */ new Set([...prev_ids || [], ...next]);
72007
72092
  if (touched.size === 0) return;
72008
- repaint_cards(gobj, touched);
72093
+ repaint_cards$1(gobj, touched);
72009
72094
  }
72010
72095
  function refresh_html_nodes_theme(gobj, theme) {
72011
72096
  let priv = gobj.priv;
72012
72097
  let graph = priv.graph;
72013
72098
  if (!graph) return;
72014
72099
  let nodes = graph.getData().nodes || [];
72015
- let highlighted = new Set(priv._focus_ids || []);
72100
+ let highlighted = highlighted_ids(gobj);
72016
72101
  let selected = new Set(priv._selected_paint_ids || []);
72017
72102
  let updates = [];
72018
72103
  for (let i = 0; i < nodes.length; i++) {
@@ -72560,7 +72645,7 @@ function apply_node_properties(gobj, node_id, fill, stroke, lineWidth, scope, sh
72560
72645
  if (updates.length > 0) {
72561
72646
  graph.updateNodeData(updates);
72562
72647
  if (reshaped.length) reshape_nodes(gobj, reshaped);
72563
- repaint_cards(gobj, repaint);
72648
+ repaint_cards$1(gobj, repaint);
72564
72649
  graph.draw().then(() => {
72565
72650
  mark_graph_dirty(gobj);
72566
72651
  });
@@ -73551,6 +73636,10 @@ async function reconcile_fold_apply(gobj, opts, visible) {
73551
73636
  if (priv._selected_node_id && gone.has(priv._selected_node_id)) deselect_node(gobj);
73552
73637
  if (priv._detail_node_id && gone.has(priv._detail_node_id)) hide_node_detail(gobj);
73553
73638
  priv._focus_ids = (priv._focus_ids || []).filter((id) => !gone.has(id));
73639
+ if ((priv._lit_ids || []).some((id) => gone.has(id))) {
73640
+ priv._lit_edge_id = null;
73641
+ priv._lit_ids = (priv._lit_ids || []).filter((id) => !gone.has(id));
73642
+ }
73554
73643
  priv._selected_paint_ids = (priv._selected_paint_ids || []).filter((id) => !gone.has(id));
73555
73644
  if (priv.anchor_state === "on" && gone.has(priv.anchor_id)) {
73556
73645
  priv.anchor_id = "";
@@ -73674,7 +73763,7 @@ async function reconcile_fold_apply(gobj, opts, visible) {
73674
73763
  }
73675
73764
  }
73676
73765
  if (resize.length) graph.updateNodeData(resize);
73677
- if (repaint.size) repaint_cards(gobj, repaint);
73766
+ if (repaint.size) repaint_cards$1(gobj, repaint);
73678
73767
  try {
73679
73768
  refresh_minimap(gobj);
73680
73769
  } catch (e) {
@@ -74205,7 +74294,7 @@ function ac_toggle_anchor(gobj, event, kw, src) {
74205
74294
  priv.anchor_id = "";
74206
74295
  }
74207
74296
  update_toolbar(gobj);
74208
- if (was) repaint_cards(gobj, /* @__PURE__ */ new Set([was]));
74297
+ if (was) repaint_cards$1(gobj, /* @__PURE__ */ new Set([was]));
74209
74298
  return 0;
74210
74299
  }
74211
74300
  /************************************************************
@@ -74691,7 +74780,7 @@ function ac_node_click$2(gobj, event, kw, src) {
74691
74780
  priv.anchor_id = node_id;
74692
74781
  priv.anchor_state = "on";
74693
74782
  update_toolbar(gobj);
74694
- repaint_cards(gobj, /* @__PURE__ */ new Set([node_id]));
74783
+ repaint_cards$1(gobj, /* @__PURE__ */ new Set([node_id]));
74695
74784
  (0, _yuneta_gobj_js.gobj_post_event)(gobj, "EV_CENTER_ANCHOR", {}, gobj);
74696
74785
  return 0;
74697
74786
  }
@@ -74726,7 +74815,7 @@ function ac_node_click$2(gobj, event, kw, src) {
74726
74815
  /************************************************************
74727
74816
  * Edge click - publish edge clicked event with semantic data
74728
74817
  ************************************************************/
74729
- function ac_edge_click(gobj, event, kw, src) {
74818
+ function ac_edge_click$1(gobj, event, kw, src) {
74730
74819
  let priv = gobj.priv;
74731
74820
  let graph = priv.graph;
74732
74821
  let edge_id = kw && kw.id ? kw.id : "";
@@ -74746,7 +74835,7 @@ function ac_edge_click(gobj, event, kw, src) {
74746
74835
  if (priv.edit_mode) {
74747
74836
  deselect_node(gobj);
74748
74837
  select_edge(gobj, edge_id);
74749
- }
74838
+ } else light_edge$1(gobj, edge_id);
74750
74839
  }
74751
74840
  } catch (e) {}
74752
74841
  return 0;
@@ -75137,9 +75226,10 @@ function ac_confirmed$1(gobj, event, kw, src) {
75137
75226
  /************************************************************
75138
75227
  * Canvas click
75139
75228
  ************************************************************/
75140
- function ac_canvas_click(gobj, event, kw, src) {
75229
+ function ac_canvas_click$1(gobj, event, kw, src) {
75141
75230
  let priv = gobj.priv;
75142
75231
  hide_node_detail(gobj);
75232
+ unlight_edge$1(gobj);
75143
75233
  if (priv._linking_mode) {
75144
75234
  exit_linking_mode(gobj);
75145
75235
  return 0;
@@ -75295,7 +75385,7 @@ function create_gclass$4(gclass_name) {
75295
75385
  ],
75296
75386
  [
75297
75387
  "EV_EDGE_CLICK",
75298
- ac_edge_click,
75388
+ ac_edge_click$1,
75299
75389
  null
75300
75390
  ],
75301
75391
  [
@@ -75415,7 +75505,7 @@ function create_gclass$4(gclass_name) {
75415
75505
  ],
75416
75506
  [
75417
75507
  "EV_CANVAS_CLICK",
75418
- ac_canvas_click,
75508
+ ac_canvas_click$1,
75419
75509
  null
75420
75510
  ],
75421
75511
  [
@@ -75741,7 +75831,7 @@ var attrs_table$3 = [
75741
75831
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_treedb_tables", 0, false, "Include treedb tables"),
75742
75832
  (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
75833
  (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"),
75834
+ (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
75835
  (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
75836
  (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
75837
  (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 +78560,14 @@ function register_c_yui_treedb_graph() {
78470
78560
  * via the host-supplied `node_route`). An alternate landing to the
78471
78561
  * topic cards, in the spirit of "every treedb is a graph".
78472
78562
  *
78563
+ * A click on an EDGE lights it: the line in amber, its two cards
78564
+ * ringed and the hook row and the fkey row it joins washed, so a
78565
+ * line says which two fields it ties. A second click on it, or a
78566
+ * click on the canvas, puts it out. The amber is the node graph's
78567
+ * find (C_G6_NODES_TREE). And the drawing always carries a
78568
+ * MINIMAP (yui_graph_minimap.js): a schema of more cards than the
78569
+ * screen holds is the usual case.
78570
+ *
78473
78571
  * The CAMERA is the family's (yui_graph_camera.js): the same
78474
78572
  * toolbar cluster -- zoom in/out, readout, fit, 1:1 -- and the
78475
78573
  * same wheel: it SCROLLS, and Ctrl + wheel zooms, over the cards
@@ -78504,6 +78602,10 @@ var topic_colors = [
78504
78602
  "rgb(66, 146, 198)"
78505
78603
  ];
78506
78604
  var SYSTEM_TOPIC_COLOR = "rgb(148, 163, 184)";
78605
+ var LIT_COLOR_DARK = "#f0a020";
78606
+ var LIT_COLOR_LIGHT = "#b45309";
78607
+ var LIT_HALO_DARK = "rgba(240,160,32,0.35)";
78608
+ var LIT_HALO_LIGHT = "rgba(180,83,9,0.35)";
78507
78609
  /***************************************************************
78508
78610
  * Data
78509
78611
  ***************************************************************/
@@ -78522,7 +78624,8 @@ var PRIVATE_DATA$2 = {
78522
78624
  $canvas: null,
78523
78625
  graph: null,
78524
78626
  theme_observer: null,
78525
- unforward_wheel: null
78627
+ unforward_wheel: null,
78628
+ lit_edge_id: null
78526
78629
  };
78527
78630
  var __gclass__$2 = null;
78528
78631
  /******************************
@@ -78703,7 +78806,7 @@ function row_placement(index, height) {
78703
78806
  * The card itself. Header = topic name on its topic colour;
78704
78807
  * body = one line per field, in schema order.
78705
78808
  ************************************************************/
78706
- function build_card_innerHTML(topic, rows, color, dark) {
78809
+ function build_card_innerHTML(topic, rows, color, dark, lit_rows) {
78707
78810
  let surface = dark ? "#1b2230" : "#ffffff";
78708
78811
  let bg = dark ? `color-mix(in srgb, ${color} 18%, #232b38)` : `color-mix(in srgb, ${color} 6%, ${surface})`;
78709
78812
  let border = dark ? `color-mix(in srgb, ${color} 85%, #ffffff)` : color;
@@ -78713,15 +78816,29 @@ function build_card_innerHTML(topic, rows, color, dark) {
78713
78816
  let mute_color = dark ? "#98a2b0" : "#7c8694";
78714
78817
  let rule_color = dark ? "rgba(255,255,255,0.06)" : "rgba(15,23,42,0.05)";
78715
78818
  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)";
78819
+ let border_w = "1.5px";
78820
+ let lit = lit_rows instanceof Set;
78821
+ let lit_color = dark ? LIT_COLOR_DARK : LIT_COLOR_LIGHT;
78822
+ if (lit) {
78823
+ border = lit_color;
78824
+ border_w = "3px";
78825
+ shadow = `0 0 0 4px ${dark ? LIT_HALO_DARK : LIT_HALO_LIGHT}`;
78826
+ }
78716
78827
  let rows_html = "";
78717
78828
  for (let row of rows) {
78718
78829
  let lead = row.is_pkey ? "#" : row.required ? "*" : "";
78719
78830
  let name_weight = row.is_pkey || row.is_pkey2 ? "700" : row.required ? "600" : "400";
78720
78831
  let name_color = row.is_hook || row.is_fkey ? title_color : text_color;
78832
+ let row_bg = "transparent";
78833
+ if (lit && lit_rows.has(row.name)) {
78834
+ row_bg = `color-mix(in srgb, ${lit_color} ${dark ? 35 : 22}%, transparent)`;
78835
+ name_weight = "700";
78836
+ }
78721
78837
  rows_html += ` <div class="TREEDB_SCHEMA_FIELD" style="
78722
78838
  display: flex; align-items: center; gap: 6px;
78723
78839
  height: ${CARD_ROW_H}px; line-height: ${CARD_ROW_H}px;
78724
78840
  padding: 0 10px; border-top: 1px solid ${rule_color};
78841
+ background: ${row_bg};
78725
78842
  ">
78726
78843
  <span style="
78727
78844
  width: 8px; flex: 0 0 8px; text-align: center;
@@ -78745,7 +78862,7 @@ function build_card_innerHTML(topic, rows, color, dark) {
78745
78862
  width: 100%;
78746
78863
  height: 100%;
78747
78864
  background: ${bg};
78748
- border: 1.5px solid ${border};
78865
+ border: ${border_w} solid ${border};
78749
78866
  border-radius: 8px;
78750
78867
  box-shadow: ${shadow};
78751
78868
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
@@ -78903,6 +79020,149 @@ function edge_style(dark) {
78903
79020
  };
78904
79021
  }
78905
79022
  /************************************************************
79023
+ * The edge options: the style, and the `lit` state of an edge
79024
+ * a click lit (light_edge). Both together, because setEdge()
79025
+ * REPLACES the options: a theme switch that set only the style
79026
+ * would drop the state.
79027
+ ************************************************************/
79028
+ function edge_options(dark) {
79029
+ return {
79030
+ style: edge_style(dark),
79031
+ state: { lit: {
79032
+ stroke: dark ? LIT_COLOR_DARK : LIT_COLOR_LIGHT,
79033
+ lineWidth: 3,
79034
+ halo: true,
79035
+ haloStroke: dark ? LIT_HALO_DARK : LIT_HALO_LIGHT,
79036
+ haloLineWidth: 8
79037
+ } }
79038
+ };
79039
+ }
79040
+ /************************************************************
79041
+ * The rows of `topic` the lit edge touches, as a Set (empty
79042
+ * rows still mark the card), or null when the card is not one
79043
+ * of its ends.
79044
+ ************************************************************/
79045
+ function lit_rows_of(gobj, topic) {
79046
+ let priv = gobj.priv;
79047
+ if (!priv.graph || !priv.lit_edge_id) return null;
79048
+ let ed;
79049
+ try {
79050
+ ed = priv.graph.getEdgeData(priv.lit_edge_id);
79051
+ } catch (e) {
79052
+ return null;
79053
+ }
79054
+ let style = ed.style || {};
79055
+ let rows = null;
79056
+ if (ed.source === topic) {
79057
+ rows = rows || /* @__PURE__ */ new Set();
79058
+ rows.add(style.sourcePort);
79059
+ }
79060
+ if (ed.target === topic) {
79061
+ rows = rows || /* @__PURE__ */ new Set();
79062
+ rows.add(style.targetPort);
79063
+ }
79064
+ return rows;
79065
+ }
79066
+ /************************************************************
79067
+ * Repaint the cards of these topics, lit or not as they are now.
79068
+ ************************************************************/
79069
+ function repaint_cards(gobj, topics) {
79070
+ let graph = gobj.priv.graph;
79071
+ let dark = yui_is_dark();
79072
+ let updates = [];
79073
+ for (let topic of topics) {
79074
+ let nd;
79075
+ try {
79076
+ nd = graph.getNodeData(topic);
79077
+ } catch (e) {
79078
+ continue;
79079
+ }
79080
+ let data = nd && nd.data;
79081
+ if (!(0, _yuneta_gobj_js.is_object)(data) || !Array.isArray(data.rows)) continue;
79082
+ updates.push({
79083
+ id: topic,
79084
+ style: { innerHTML: build_card_innerHTML(data.topic_name, data.rows, data.color, dark, lit_rows_of(gobj, topic)) }
79085
+ });
79086
+ }
79087
+ if (updates.length > 0) graph.updateNodeData(updates);
79088
+ }
79089
+ /************************************************************
79090
+ * Light an edge: the line, its two cards and the two rows it
79091
+ * joins -- a click on a line says which hook it is and which
79092
+ * fkey it lands on. A second click on it, or a click on the
79093
+ * canvas, puts it out.
79094
+ ************************************************************/
79095
+ function light_edge(gobj, edge_id) {
79096
+ let priv = gobj.priv;
79097
+ let graph = priv.graph;
79098
+ if (!graph) return;
79099
+ let same = priv.lit_edge_id === edge_id;
79100
+ unlight_edge(gobj, false);
79101
+ if (!same && edge_id) {
79102
+ let ed;
79103
+ try {
79104
+ ed = graph.getEdgeData(edge_id);
79105
+ } catch (e) {
79106
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot light the edge ${edge_id}: ${e}`);
79107
+ ed = null;
79108
+ }
79109
+ if (ed) {
79110
+ priv.lit_edge_id = edge_id;
79111
+ graph.updateData({ edges: [{
79112
+ id: edge_id,
79113
+ states: ["lit"]
79114
+ }] });
79115
+ repaint_cards(gobj, /* @__PURE__ */ new Set([ed.source, ed.target]));
79116
+ }
79117
+ }
79118
+ graph.draw().catch((e) => {
79119
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: schema graph redraw failed: ${e}`);
79120
+ });
79121
+ }
79122
+ function unlight_edge(gobj, draw) {
79123
+ let priv = gobj.priv;
79124
+ let graph = priv.graph;
79125
+ let edge_id = priv.lit_edge_id;
79126
+ if (!graph || !edge_id) {
79127
+ priv.lit_edge_id = null;
79128
+ return;
79129
+ }
79130
+ let ed = null;
79131
+ try {
79132
+ ed = graph.getEdgeData(edge_id);
79133
+ } catch (e) {
79134
+ ed = null;
79135
+ }
79136
+ priv.lit_edge_id = null;
79137
+ if (!ed) return;
79138
+ graph.updateData({ edges: [{
79139
+ id: edge_id,
79140
+ states: []
79141
+ }] });
79142
+ repaint_cards(gobj, /* @__PURE__ */ new Set([ed.source, ed.target]));
79143
+ if (draw) graph.draw().catch((e) => {
79144
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: schema graph redraw failed: ${e}`);
79145
+ });
79146
+ }
79147
+ /************************************************************
79148
+ * A card in the minimap: a block of its size in its topic's
79149
+ * colour, darkened on the light scheme so a yellow topic does
79150
+ * not vanish on the white panel. G6 clones a node's key shape,
79151
+ * and the key shape of an html card is a DOM element, which
79152
+ * clones into nothing (see yui_graph_minimap.js).
79153
+ ************************************************************/
79154
+ function minimap_shape(gobj, id, element_type, element) {
79155
+ if (element_type !== "node") return element;
79156
+ try {
79157
+ let nd = gobj.priv.graph.getNodeData(id);
79158
+ let color = nd && nd.data && nd.data.color || SYSTEM_TOPIC_COLOR;
79159
+ return yui_graph_minimap_block(nd, yui_is_dark() ? color : getStrokeColor(color));
79160
+ } catch (e) {
79161
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: minimap shape failed: ${e}`);
79162
+ return element;
79163
+ }
79164
+ }
79165
+ /************************************************************
78906
79166
  * Build the G6 schema graph.
78907
79167
  ************************************************************/
78908
79168
  function build_graph(gobj) {
@@ -78934,7 +79194,7 @@ function build_graph(gobj) {
78934
79194
  autoResize: true,
78935
79195
  animation: false,
78936
79196
  data,
78937
- edge: { style: edge_style(dark) },
79197
+ edge: edge_options(dark),
78938
79198
  layout: {
78939
79199
  type: "antv-dagre",
78940
79200
  rankdir: "LR",
@@ -78945,7 +79205,12 @@ function build_graph(gobj) {
78945
79205
  "drag-canvas",
78946
79206
  ...yui_graph_camera_behaviors(),
78947
79207
  "drag-element"
78948
- ]
79208
+ ],
79209
+ plugins: [{
79210
+ key: "minimap",
79211
+ type: "minimap",
79212
+ ...yui_graph_minimap_options((id, element_type, element) => minimap_shape(gobj, id, element_type, element))
79213
+ }]
78949
79214
  });
78950
79215
  } catch (e) {
78951
79216
  (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: schema graph create failed: ${e}`);
@@ -78962,6 +79227,13 @@ function build_graph(gobj) {
78962
79227
  let node_id = evt && evt.target && evt.target.id;
78963
79228
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_CLICK", { node_id }, gobj);
78964
79229
  });
79230
+ graph.on(_antv_g6.EdgeEvent.CLICK, (evt) => {
79231
+ let edge_id = evt && evt.target && evt.target.id;
79232
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_EDGE_CLICK", { edge_id }, gobj);
79233
+ });
79234
+ graph.on(_antv_g6.CanvasEvent.CLICK, () => {
79235
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CANVAS_CLICK", {}, gobj);
79236
+ });
78965
79237
  graph.render().then(() => {
78966
79238
  yui_graph_update_zoom($container, priv.graph);
78967
79239
  }).catch((e) => {
@@ -78973,6 +79245,7 @@ function build_graph(gobj) {
78973
79245
  ************************************************************/
78974
79246
  function destroy_graph(gobj) {
78975
79247
  let priv = gobj.priv;
79248
+ priv.lit_edge_id = null;
78976
79249
  if (priv.unforward_wheel) {
78977
79250
  priv.unforward_wheel();
78978
79251
  priv.unforward_wheel = null;
@@ -79021,6 +79294,22 @@ function ac_node_click$1(gobj, event, kw, src) {
79021
79294
  return 0;
79022
79295
  }
79023
79296
  /************************************************************
79297
+ * An edge was clicked: light it, or put it out if it was lit.
79298
+ ************************************************************/
79299
+ function ac_edge_click(gobj, event, kw, src) {
79300
+ let edge_id = kw && kw.edge_id;
79301
+ if (!edge_id) return 0;
79302
+ light_edge(gobj, edge_id);
79303
+ return 0;
79304
+ }
79305
+ /************************************************************
79306
+ * A click on the empty canvas puts the lit edge out.
79307
+ ************************************************************/
79308
+ function ac_canvas_click(gobj, event, kw, src) {
79309
+ unlight_edge(gobj, true);
79310
+ return 0;
79311
+ }
79312
+ /************************************************************
79024
79313
  * Shown by the host: match the canvas to the container now it
79025
79314
  * is visible and sized (G6 renders at 0×0 while display:none).
79026
79315
  * A resize only, never a fit: the camera stays where it was, so
@@ -79053,14 +79342,14 @@ function ac_theme(gobj, event, kw, src) {
79053
79342
  let dark = kw && kw.theme ? kw.theme === "dark" : yui_is_dark();
79054
79343
  try {
79055
79344
  graph.setTheme(dark ? "dark" : "light");
79056
- graph.setEdge({ style: edge_style(dark) });
79345
+ graph.setEdge(edge_options(dark));
79057
79346
  let updates = [];
79058
79347
  for (let node of graph.getNodeData()) {
79059
79348
  let data = node.data;
79060
79349
  if (!(0, _yuneta_gobj_js.is_object)(data) || !Array.isArray(data.rows)) continue;
79061
79350
  updates.push({
79062
79351
  id: node.id,
79063
- style: { innerHTML: build_card_innerHTML(data.topic_name, data.rows, data.color, dark) }
79352
+ style: { innerHTML: build_card_innerHTML(data.topic_name, data.rows, data.color, dark, lit_rows_of(gobj, node.id)) }
79064
79353
  });
79065
79354
  }
79066
79355
  if (updates.length > 0) graph.updateNodeData(updates);
@@ -79132,6 +79421,16 @@ function create_gclass$2(gclass_name) {
79132
79421
  ac_node_click$1,
79133
79422
  null
79134
79423
  ],
79424
+ [
79425
+ "EV_EDGE_CLICK",
79426
+ ac_edge_click,
79427
+ null
79428
+ ],
79429
+ [
79430
+ "EV_CANVAS_CLICK",
79431
+ ac_canvas_click,
79432
+ null
79433
+ ],
79135
79434
  [
79136
79435
  "EV_SHOW",
79137
79436
  ac_show$1,
@@ -79170,6 +79469,8 @@ function create_gclass$2(gclass_name) {
79170
79469
  ]]];
79171
79470
  const event_types = [
79172
79471
  ["EV_NODE_CLICK", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS],
79472
+ ["EV_EDGE_CLICK", 0],
79473
+ ["EV_CANVAS_CLICK", 0],
79173
79474
  ["EV_SHOW", 0],
79174
79475
  ["EV_THEME", 0],
79175
79476
  ["EV_REBUILD", 0],