@yuneta/gobj-ui 7.31.0 → 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.
- package/README.md +10 -1
- package/dist/gobj-ui.cjs.js +338 -37
- package/dist/gobj-ui.es.js +332 -31
- package/package.json +1 -1
- package/src/c_g6_nodes_tree.js +117 -3
- package/src/c_yui_gobj_tree_js.js +1 -1
- package/src/c_yui_treedb_graph.js +1 -1
- package/src/c_yui_treedb_schema.js +256 -8
- package/src/g6_nodes_tree_focus.wiring.test.js +50 -0
- package/src/tabulator.css +22 -0
- package/src/treedb_schema_lit_edge.wiring.test.js +222 -0
package/dist/gobj-ui.es.js
CHANGED
|
@@ -52242,7 +52242,7 @@ var attrs_table$9 = [
|
|
|
52242
52242
|
SDATA(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"),
|
|
52243
52243
|
SDATA(data_type_t.DTP_STRING, "layout", 0, "vertical-compact", "Current layout key"),
|
|
52244
52244
|
SDATA(data_type_t.DTP_INTEGER, "collapse_threshold", 0, 10, "Auto-collapse a node whose direct children exceed this number. 0 disables auto-collapse."),
|
|
52245
|
-
SDATA(data_type_t.DTP_INTEGER, "minimap_min_nodes", 0, 20, "Show the minimap from this many cards on (0 = never).
|
|
52245
|
+
SDATA(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"),
|
|
52246
52246
|
SDATA_END()
|
|
52247
52247
|
];
|
|
52248
52248
|
var CAMERA = yui_graph_camera_behaviors();
|
|
@@ -66954,7 +66954,7 @@ var attrs_table$4 = [
|
|
|
66954
66954
|
SDATA(data_type_t.DTP_BOOLEAN, "with_gridline", 0, true, "Use gridline plugin"),
|
|
66955
66955
|
SDATA(data_type_t.DTP_BOOLEAN, "with_fullscreen", 0, true, "Use fullscreen plugin"),
|
|
66956
66956
|
SDATA(data_type_t.DTP_BOOLEAN, "with_toolbar", 0, true, "Use toolbar plugin"),
|
|
66957
|
-
SDATA(data_type_t.DTP_INTEGER, "minimap_min_nodes", 0,
|
|
66957
|
+
SDATA(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"),
|
|
66958
66958
|
SDATA(data_type_t.DTP_STRING, "toolbar_position", 0, "right-top", "Toolbar position: top-left, top-right, bottom-left, bottom-right, left-top, right-top"),
|
|
66959
66959
|
SDATA(data_type_t.DTP_LIST, "layout_names", sdata_flag_t.SDF_RD, JSON.stringify(Object.keys(_layouts)), "Available layout names (read-only, for parent to query)"),
|
|
66960
66960
|
SDATA(data_type_t.DTP_STRING, "hook_port_position", 0, "bottom", "Hook port position"),
|
|
@@ -67049,6 +67049,8 @@ var PRIVATE_DATA$4 = {
|
|
|
67049
67049
|
_link_saved_styles: [],
|
|
67050
67050
|
_focus_topic: null,
|
|
67051
67051
|
_focus_ids: [],
|
|
67052
|
+
_lit_edge_id: null,
|
|
67053
|
+
_lit_ids: [],
|
|
67052
67054
|
_on_pointerdown_focus: null,
|
|
67053
67055
|
_on_native_contextmenu: null,
|
|
67054
67056
|
_uninstall_long_press: null,
|
|
@@ -67281,10 +67283,19 @@ function build_graph$1(gobj) {
|
|
|
67281
67283
|
}
|
|
67282
67284
|
}
|
|
67283
67285
|
},
|
|
67284
|
-
edge: {
|
|
67285
|
-
|
|
67286
|
-
|
|
67287
|
-
|
|
67286
|
+
edge: {
|
|
67287
|
+
style: {
|
|
67288
|
+
startArrow: true,
|
|
67289
|
+
endArrow: false
|
|
67290
|
+
},
|
|
67291
|
+
state: { lit: () => ({
|
|
67292
|
+
stroke: highlight_color(priv.theme),
|
|
67293
|
+
lineWidth: 3,
|
|
67294
|
+
halo: true,
|
|
67295
|
+
haloStroke: highlight_halo(priv.theme),
|
|
67296
|
+
haloLineWidth: 8
|
|
67297
|
+
}) }
|
|
67298
|
+
},
|
|
67288
67299
|
plugins: []
|
|
67289
67300
|
});
|
|
67290
67301
|
graph.setTheme(priv.theme);
|
|
@@ -67784,6 +67795,7 @@ function configure_behaviour(gobj) {
|
|
|
67784
67795
|
break;
|
|
67785
67796
|
case "edition":
|
|
67786
67797
|
priv.edit_mode = true;
|
|
67798
|
+
unlight_edge$1(gobj);
|
|
67787
67799
|
behaviors = [
|
|
67788
67800
|
{
|
|
67789
67801
|
type: "drag-canvas",
|
|
@@ -68381,7 +68393,7 @@ function reshape_nodes(gobj, ids) {
|
|
|
68381
68393
|
log_error(`${gobj_short_name(gobj)}: cannot reshape the nodes: ${e}`);
|
|
68382
68394
|
return;
|
|
68383
68395
|
}
|
|
68384
|
-
repaint_cards(gobj, touched);
|
|
68396
|
+
repaint_cards$1(gobj, touched);
|
|
68385
68397
|
}
|
|
68386
68398
|
function all_record_node_ids(gobj) {
|
|
68387
68399
|
let graph = gobj.priv.graph;
|
|
@@ -68401,7 +68413,7 @@ function update_topic_node(gobj, desc, node_name, record) {
|
|
|
68401
68413
|
return;
|
|
68402
68414
|
}
|
|
68403
68415
|
nodedata.data.record = record;
|
|
68404
|
-
repaint_cards(gobj, /* @__PURE__ */ new Set([node_name]));
|
|
68416
|
+
repaint_cards$1(gobj, /* @__PURE__ */ new Set([node_name]));
|
|
68405
68417
|
} catch (e) {
|
|
68406
68418
|
log_error(e.message);
|
|
68407
68419
|
}
|
|
@@ -70119,7 +70131,7 @@ function paint_selection(gobj, ids) {
|
|
|
70119
70131
|
let prev = priv._selected_paint_ids || [];
|
|
70120
70132
|
let next = ids || [];
|
|
70121
70133
|
priv._selected_paint_ids = next;
|
|
70122
|
-
repaint_cards(gobj, /* @__PURE__ */ new Set([...prev, ...next]));
|
|
70134
|
+
repaint_cards$1(gobj, /* @__PURE__ */ new Set([...prev, ...next]));
|
|
70123
70135
|
update_zoom_selection_button(gobj);
|
|
70124
70136
|
}
|
|
70125
70137
|
/************************************************************
|
|
@@ -71628,7 +71640,7 @@ function show_node_popover(gobj) {
|
|
|
71628
71640
|
lineWidth: lw
|
|
71629
71641
|
}
|
|
71630
71642
|
}]);
|
|
71631
|
-
repaint_cards(gobj, /* @__PURE__ */ new Set([node_id]));
|
|
71643
|
+
repaint_cards$1(gobj, /* @__PURE__ */ new Set([node_id]));
|
|
71632
71644
|
graph.draw();
|
|
71633
71645
|
};
|
|
71634
71646
|
let undo_node = () => {
|
|
@@ -71941,6 +71953,79 @@ function node_innerHTML_of(nd, theme, highlight, selected, anchored, pills_html)
|
|
|
71941
71953
|
return null;
|
|
71942
71954
|
}
|
|
71943
71955
|
/************************************************************
|
|
71956
|
+
* The cards painted with the highlight: a find or topic focus
|
|
71957
|
+
* (`_focus_ids`) and the two ends of a lit edge (`_lit_ids`).
|
|
71958
|
+
* Kept apart so that lighting an edge does not erase a find,
|
|
71959
|
+
* and a find does not put out an edge.
|
|
71960
|
+
************************************************************/
|
|
71961
|
+
function highlighted_ids(gobj) {
|
|
71962
|
+
let priv = gobj.priv;
|
|
71963
|
+
return /* @__PURE__ */ new Set([...priv._focus_ids || [], ...priv._lit_ids || []]);
|
|
71964
|
+
}
|
|
71965
|
+
/************************************************************
|
|
71966
|
+
* Light an edge: the edge itself and its two ends, so a click
|
|
71967
|
+
* on a line says which two records it joins. A second click on
|
|
71968
|
+
* the same edge, or a click on the canvas, puts it out.
|
|
71969
|
+
*
|
|
71970
|
+
* Not in edition: there a click SELECTS the edge, with its own
|
|
71971
|
+
* ring and its affordances (select_edge).
|
|
71972
|
+
************************************************************/
|
|
71973
|
+
function light_edge$1(gobj, edge_id) {
|
|
71974
|
+
let priv = gobj.priv;
|
|
71975
|
+
let graph = priv.graph;
|
|
71976
|
+
if (!graph || !edge_id) return;
|
|
71977
|
+
let same = priv._lit_edge_id === edge_id;
|
|
71978
|
+
unlight_edge$1(gobj);
|
|
71979
|
+
if (same) return;
|
|
71980
|
+
let ed;
|
|
71981
|
+
try {
|
|
71982
|
+
ed = graph.getEdgeData(edge_id);
|
|
71983
|
+
} catch (e) {
|
|
71984
|
+
log_error(`${gobj_short_name(gobj)}: cannot light the edge ${edge_id}: ${e}`);
|
|
71985
|
+
return;
|
|
71986
|
+
}
|
|
71987
|
+
priv._lit_edge_id = edge_id;
|
|
71988
|
+
priv._lit_ids = [ed.source, ed.target];
|
|
71989
|
+
try {
|
|
71990
|
+
graph.updateData({ edges: [{
|
|
71991
|
+
id: edge_id,
|
|
71992
|
+
states: ["lit"]
|
|
71993
|
+
}] });
|
|
71994
|
+
} catch (e) {
|
|
71995
|
+
log_error(`${gobj_short_name(gobj)}: edge state not set: ${e}`);
|
|
71996
|
+
}
|
|
71997
|
+
repaint_cards$1(gobj, new Set(priv._lit_ids));
|
|
71998
|
+
}
|
|
71999
|
+
function unlight_edge$1(gobj) {
|
|
72000
|
+
let priv = gobj.priv;
|
|
72001
|
+
let graph = priv.graph;
|
|
72002
|
+
let edge_id = priv._lit_edge_id;
|
|
72003
|
+
let ids = priv._lit_ids || [];
|
|
72004
|
+
priv._lit_edge_id = null;
|
|
72005
|
+
priv._lit_ids = [];
|
|
72006
|
+
if (!graph) return;
|
|
72007
|
+
if (edge_id) {
|
|
72008
|
+
let exists = false;
|
|
72009
|
+
try {
|
|
72010
|
+
exists = !!graph.getEdgeData(edge_id);
|
|
72011
|
+
} catch (e) {
|
|
72012
|
+
exists = false;
|
|
72013
|
+
}
|
|
72014
|
+
if (exists) try {
|
|
72015
|
+
graph.updateData({ edges: [{
|
|
72016
|
+
id: edge_id,
|
|
72017
|
+
states: []
|
|
72018
|
+
}] });
|
|
72019
|
+
} catch (e) {
|
|
72020
|
+
log_error(`${gobj_short_name(gobj)}: edge state not cleared: ${e}`);
|
|
72021
|
+
}
|
|
72022
|
+
}
|
|
72023
|
+
if (ids.length) repaint_cards$1(gobj, new Set(ids));
|
|
72024
|
+
else if (edge_id) graph.draw().catch((e) => {
|
|
72025
|
+
log_error(`${gobj_short_name(gobj)}: redraw failed: ${e}`);
|
|
72026
|
+
});
|
|
72027
|
+
}
|
|
72028
|
+
/************************************************************
|
|
71944
72029
|
* Repaint these cards with the flags they carry RIGHT NOW.
|
|
71945
72030
|
*
|
|
71946
72031
|
* One place, because the flags are independent and each used to
|
|
@@ -71949,11 +72034,11 @@ function node_innerHTML_of(nd, theme, highlight, selected, anchored, pills_html)
|
|
|
71949
72034
|
* repainted over a match erased the amber. Both are read here
|
|
71950
72035
|
* from where they live.
|
|
71951
72036
|
************************************************************/
|
|
71952
|
-
function repaint_cards(gobj, ids) {
|
|
72037
|
+
function repaint_cards$1(gobj, ids) {
|
|
71953
72038
|
let priv = gobj.priv;
|
|
71954
72039
|
let graph = priv.graph;
|
|
71955
72040
|
if (!graph || !ids || !ids.size) return;
|
|
71956
|
-
let focus =
|
|
72041
|
+
let focus = highlighted_ids(gobj);
|
|
71957
72042
|
let selected = new Set(priv._selected_paint_ids || []);
|
|
71958
72043
|
let updates = [];
|
|
71959
72044
|
for (let id of ids) {
|
|
@@ -72000,14 +72085,14 @@ function apply_node_highlight(gobj, prev_ids, next_ids) {
|
|
|
72000
72085
|
let next = new Set(next_ids || []);
|
|
72001
72086
|
let touched = /* @__PURE__ */ new Set([...prev_ids || [], ...next]);
|
|
72002
72087
|
if (touched.size === 0) return;
|
|
72003
|
-
repaint_cards(gobj, touched);
|
|
72088
|
+
repaint_cards$1(gobj, touched);
|
|
72004
72089
|
}
|
|
72005
72090
|
function refresh_html_nodes_theme(gobj, theme) {
|
|
72006
72091
|
let priv = gobj.priv;
|
|
72007
72092
|
let graph = priv.graph;
|
|
72008
72093
|
if (!graph) return;
|
|
72009
72094
|
let nodes = graph.getData().nodes || [];
|
|
72010
|
-
let highlighted =
|
|
72095
|
+
let highlighted = highlighted_ids(gobj);
|
|
72011
72096
|
let selected = new Set(priv._selected_paint_ids || []);
|
|
72012
72097
|
let updates = [];
|
|
72013
72098
|
for (let i = 0; i < nodes.length; i++) {
|
|
@@ -72555,7 +72640,7 @@ function apply_node_properties(gobj, node_id, fill, stroke, lineWidth, scope, sh
|
|
|
72555
72640
|
if (updates.length > 0) {
|
|
72556
72641
|
graph.updateNodeData(updates);
|
|
72557
72642
|
if (reshaped.length) reshape_nodes(gobj, reshaped);
|
|
72558
|
-
repaint_cards(gobj, repaint);
|
|
72643
|
+
repaint_cards$1(gobj, repaint);
|
|
72559
72644
|
graph.draw().then(() => {
|
|
72560
72645
|
mark_graph_dirty(gobj);
|
|
72561
72646
|
});
|
|
@@ -73546,6 +73631,10 @@ async function reconcile_fold_apply(gobj, opts, visible) {
|
|
|
73546
73631
|
if (priv._selected_node_id && gone.has(priv._selected_node_id)) deselect_node(gobj);
|
|
73547
73632
|
if (priv._detail_node_id && gone.has(priv._detail_node_id)) hide_node_detail(gobj);
|
|
73548
73633
|
priv._focus_ids = (priv._focus_ids || []).filter((id) => !gone.has(id));
|
|
73634
|
+
if ((priv._lit_ids || []).some((id) => gone.has(id))) {
|
|
73635
|
+
priv._lit_edge_id = null;
|
|
73636
|
+
priv._lit_ids = (priv._lit_ids || []).filter((id) => !gone.has(id));
|
|
73637
|
+
}
|
|
73549
73638
|
priv._selected_paint_ids = (priv._selected_paint_ids || []).filter((id) => !gone.has(id));
|
|
73550
73639
|
if (priv.anchor_state === "on" && gone.has(priv.anchor_id)) {
|
|
73551
73640
|
priv.anchor_id = "";
|
|
@@ -73669,7 +73758,7 @@ async function reconcile_fold_apply(gobj, opts, visible) {
|
|
|
73669
73758
|
}
|
|
73670
73759
|
}
|
|
73671
73760
|
if (resize.length) graph.updateNodeData(resize);
|
|
73672
|
-
if (repaint.size) repaint_cards(gobj, repaint);
|
|
73761
|
+
if (repaint.size) repaint_cards$1(gobj, repaint);
|
|
73673
73762
|
try {
|
|
73674
73763
|
refresh_minimap(gobj);
|
|
73675
73764
|
} catch (e) {
|
|
@@ -74200,7 +74289,7 @@ function ac_toggle_anchor(gobj, event, kw, src) {
|
|
|
74200
74289
|
priv.anchor_id = "";
|
|
74201
74290
|
}
|
|
74202
74291
|
update_toolbar(gobj);
|
|
74203
|
-
if (was) repaint_cards(gobj, /* @__PURE__ */ new Set([was]));
|
|
74292
|
+
if (was) repaint_cards$1(gobj, /* @__PURE__ */ new Set([was]));
|
|
74204
74293
|
return 0;
|
|
74205
74294
|
}
|
|
74206
74295
|
/************************************************************
|
|
@@ -74686,7 +74775,7 @@ function ac_node_click$2(gobj, event, kw, src) {
|
|
|
74686
74775
|
priv.anchor_id = node_id;
|
|
74687
74776
|
priv.anchor_state = "on";
|
|
74688
74777
|
update_toolbar(gobj);
|
|
74689
|
-
repaint_cards(gobj, /* @__PURE__ */ new Set([node_id]));
|
|
74778
|
+
repaint_cards$1(gobj, /* @__PURE__ */ new Set([node_id]));
|
|
74690
74779
|
gobj_post_event(gobj, "EV_CENTER_ANCHOR", {}, gobj);
|
|
74691
74780
|
return 0;
|
|
74692
74781
|
}
|
|
@@ -74721,7 +74810,7 @@ function ac_node_click$2(gobj, event, kw, src) {
|
|
|
74721
74810
|
/************************************************************
|
|
74722
74811
|
* Edge click - publish edge clicked event with semantic data
|
|
74723
74812
|
************************************************************/
|
|
74724
|
-
function ac_edge_click(gobj, event, kw, src) {
|
|
74813
|
+
function ac_edge_click$1(gobj, event, kw, src) {
|
|
74725
74814
|
let priv = gobj.priv;
|
|
74726
74815
|
let graph = priv.graph;
|
|
74727
74816
|
let edge_id = kw && kw.id ? kw.id : "";
|
|
@@ -74741,7 +74830,7 @@ function ac_edge_click(gobj, event, kw, src) {
|
|
|
74741
74830
|
if (priv.edit_mode) {
|
|
74742
74831
|
deselect_node(gobj);
|
|
74743
74832
|
select_edge(gobj, edge_id);
|
|
74744
|
-
}
|
|
74833
|
+
} else light_edge$1(gobj, edge_id);
|
|
74745
74834
|
}
|
|
74746
74835
|
} catch (e) {}
|
|
74747
74836
|
return 0;
|
|
@@ -75132,9 +75221,10 @@ function ac_confirmed$1(gobj, event, kw, src) {
|
|
|
75132
75221
|
/************************************************************
|
|
75133
75222
|
* Canvas click
|
|
75134
75223
|
************************************************************/
|
|
75135
|
-
function ac_canvas_click(gobj, event, kw, src) {
|
|
75224
|
+
function ac_canvas_click$1(gobj, event, kw, src) {
|
|
75136
75225
|
let priv = gobj.priv;
|
|
75137
75226
|
hide_node_detail(gobj);
|
|
75227
|
+
unlight_edge$1(gobj);
|
|
75138
75228
|
if (priv._linking_mode) {
|
|
75139
75229
|
exit_linking_mode(gobj);
|
|
75140
75230
|
return 0;
|
|
@@ -75290,7 +75380,7 @@ function create_gclass$4(gclass_name) {
|
|
|
75290
75380
|
],
|
|
75291
75381
|
[
|
|
75292
75382
|
"EV_EDGE_CLICK",
|
|
75293
|
-
ac_edge_click,
|
|
75383
|
+
ac_edge_click$1,
|
|
75294
75384
|
null
|
|
75295
75385
|
],
|
|
75296
75386
|
[
|
|
@@ -75410,7 +75500,7 @@ function create_gclass$4(gclass_name) {
|
|
|
75410
75500
|
],
|
|
75411
75501
|
[
|
|
75412
75502
|
"EV_CANVAS_CLICK",
|
|
75413
|
-
ac_canvas_click,
|
|
75503
|
+
ac_canvas_click$1,
|
|
75414
75504
|
null
|
|
75415
75505
|
],
|
|
75416
75506
|
[
|
|
@@ -75736,7 +75826,7 @@ var attrs_table$3 = [
|
|
|
75736
75826
|
SDATA(data_type_t.DTP_BOOLEAN, "with_treedb_tables", 0, false, "Include treedb tables"),
|
|
75737
75827
|
SDATA(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"),
|
|
75738
75828
|
SDATA(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"),
|
|
75739
|
-
SDATA(data_type_t.DTP_INTEGER, "minimap_min_nodes", 0,
|
|
75829
|
+
SDATA(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"),
|
|
75740
75830
|
SDATA(data_type_t.DTP_BOOLEAN, "with_gridline", 0, true, "Draw the grid under the graph. Forwarded to the G6 child"),
|
|
75741
75831
|
SDATA(data_type_t.DTP_BOOLEAN, "with_fullscreen", 0, true, "Offer the full-screen button. Forwarded to the G6 child"),
|
|
75742
75832
|
SDATA(data_type_t.DTP_BOOLEAN, "with_toolbar", 0, true, "Float the camera toolbar over the canvas. Forwarded to the G6 child"),
|
|
@@ -78465,6 +78555,14 @@ function register_c_yui_treedb_graph() {
|
|
|
78465
78555
|
* via the host-supplied `node_route`). An alternate landing to the
|
|
78466
78556
|
* topic cards, in the spirit of "every treedb is a graph".
|
|
78467
78557
|
*
|
|
78558
|
+
* A click on an EDGE lights it: the line in amber, its two cards
|
|
78559
|
+
* ringed and the hook row and the fkey row it joins washed, so a
|
|
78560
|
+
* line says which two fields it ties. A second click on it, or a
|
|
78561
|
+
* click on the canvas, puts it out. The amber is the node graph's
|
|
78562
|
+
* find (C_G6_NODES_TREE). And the drawing always carries a
|
|
78563
|
+
* MINIMAP (yui_graph_minimap.js): a schema of more cards than the
|
|
78564
|
+
* screen holds is the usual case.
|
|
78565
|
+
*
|
|
78468
78566
|
* The CAMERA is the family's (yui_graph_camera.js): the same
|
|
78469
78567
|
* toolbar cluster -- zoom in/out, readout, fit, 1:1 -- and the
|
|
78470
78568
|
* same wheel: it SCROLLS, and Ctrl + wheel zooms, over the cards
|
|
@@ -78499,6 +78597,10 @@ var topic_colors = [
|
|
|
78499
78597
|
"rgb(66, 146, 198)"
|
|
78500
78598
|
];
|
|
78501
78599
|
var SYSTEM_TOPIC_COLOR = "rgb(148, 163, 184)";
|
|
78600
|
+
var LIT_COLOR_DARK = "#f0a020";
|
|
78601
|
+
var LIT_COLOR_LIGHT = "#b45309";
|
|
78602
|
+
var LIT_HALO_DARK = "rgba(240,160,32,0.35)";
|
|
78603
|
+
var LIT_HALO_LIGHT = "rgba(180,83,9,0.35)";
|
|
78502
78604
|
/***************************************************************
|
|
78503
78605
|
* Data
|
|
78504
78606
|
***************************************************************/
|
|
@@ -78517,7 +78619,8 @@ var PRIVATE_DATA$2 = {
|
|
|
78517
78619
|
$canvas: null,
|
|
78518
78620
|
graph: null,
|
|
78519
78621
|
theme_observer: null,
|
|
78520
|
-
unforward_wheel: null
|
|
78622
|
+
unforward_wheel: null,
|
|
78623
|
+
lit_edge_id: null
|
|
78521
78624
|
};
|
|
78522
78625
|
var __gclass__$2 = null;
|
|
78523
78626
|
/******************************
|
|
@@ -78698,7 +78801,7 @@ function row_placement(index, height) {
|
|
|
78698
78801
|
* The card itself. Header = topic name on its topic colour;
|
|
78699
78802
|
* body = one line per field, in schema order.
|
|
78700
78803
|
************************************************************/
|
|
78701
|
-
function build_card_innerHTML(topic, rows, color, dark) {
|
|
78804
|
+
function build_card_innerHTML(topic, rows, color, dark, lit_rows) {
|
|
78702
78805
|
let surface = dark ? "#1b2230" : "#ffffff";
|
|
78703
78806
|
let bg = dark ? `color-mix(in srgb, ${color} 18%, #232b38)` : `color-mix(in srgb, ${color} 6%, ${surface})`;
|
|
78704
78807
|
let border = dark ? `color-mix(in srgb, ${color} 85%, #ffffff)` : color;
|
|
@@ -78708,15 +78811,29 @@ function build_card_innerHTML(topic, rows, color, dark) {
|
|
|
78708
78811
|
let mute_color = dark ? "#98a2b0" : "#7c8694";
|
|
78709
78812
|
let rule_color = dark ? "rgba(255,255,255,0.06)" : "rgba(15,23,42,0.05)";
|
|
78710
78813
|
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)";
|
|
78814
|
+
let border_w = "1.5px";
|
|
78815
|
+
let lit = lit_rows instanceof Set;
|
|
78816
|
+
let lit_color = dark ? LIT_COLOR_DARK : LIT_COLOR_LIGHT;
|
|
78817
|
+
if (lit) {
|
|
78818
|
+
border = lit_color;
|
|
78819
|
+
border_w = "3px";
|
|
78820
|
+
shadow = `0 0 0 4px ${dark ? LIT_HALO_DARK : LIT_HALO_LIGHT}`;
|
|
78821
|
+
}
|
|
78711
78822
|
let rows_html = "";
|
|
78712
78823
|
for (let row of rows) {
|
|
78713
78824
|
let lead = row.is_pkey ? "#" : row.required ? "*" : "";
|
|
78714
78825
|
let name_weight = row.is_pkey || row.is_pkey2 ? "700" : row.required ? "600" : "400";
|
|
78715
78826
|
let name_color = row.is_hook || row.is_fkey ? title_color : text_color;
|
|
78827
|
+
let row_bg = "transparent";
|
|
78828
|
+
if (lit && lit_rows.has(row.name)) {
|
|
78829
|
+
row_bg = `color-mix(in srgb, ${lit_color} ${dark ? 35 : 22}%, transparent)`;
|
|
78830
|
+
name_weight = "700";
|
|
78831
|
+
}
|
|
78716
78832
|
rows_html += ` <div class="TREEDB_SCHEMA_FIELD" style="
|
|
78717
78833
|
display: flex; align-items: center; gap: 6px;
|
|
78718
78834
|
height: ${CARD_ROW_H}px; line-height: ${CARD_ROW_H}px;
|
|
78719
78835
|
padding: 0 10px; border-top: 1px solid ${rule_color};
|
|
78836
|
+
background: ${row_bg};
|
|
78720
78837
|
">
|
|
78721
78838
|
<span style="
|
|
78722
78839
|
width: 8px; flex: 0 0 8px; text-align: center;
|
|
@@ -78740,7 +78857,7 @@ function build_card_innerHTML(topic, rows, color, dark) {
|
|
|
78740
78857
|
width: 100%;
|
|
78741
78858
|
height: 100%;
|
|
78742
78859
|
background: ${bg};
|
|
78743
|
-
border:
|
|
78860
|
+
border: ${border_w} solid ${border};
|
|
78744
78861
|
border-radius: 8px;
|
|
78745
78862
|
box-shadow: ${shadow};
|
|
78746
78863
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
@@ -78898,6 +79015,149 @@ function edge_style(dark) {
|
|
|
78898
79015
|
};
|
|
78899
79016
|
}
|
|
78900
79017
|
/************************************************************
|
|
79018
|
+
* The edge options: the style, and the `lit` state of an edge
|
|
79019
|
+
* a click lit (light_edge). Both together, because setEdge()
|
|
79020
|
+
* REPLACES the options: a theme switch that set only the style
|
|
79021
|
+
* would drop the state.
|
|
79022
|
+
************************************************************/
|
|
79023
|
+
function edge_options(dark) {
|
|
79024
|
+
return {
|
|
79025
|
+
style: edge_style(dark),
|
|
79026
|
+
state: { lit: {
|
|
79027
|
+
stroke: dark ? LIT_COLOR_DARK : LIT_COLOR_LIGHT,
|
|
79028
|
+
lineWidth: 3,
|
|
79029
|
+
halo: true,
|
|
79030
|
+
haloStroke: dark ? LIT_HALO_DARK : LIT_HALO_LIGHT,
|
|
79031
|
+
haloLineWidth: 8
|
|
79032
|
+
} }
|
|
79033
|
+
};
|
|
79034
|
+
}
|
|
79035
|
+
/************************************************************
|
|
79036
|
+
* The rows of `topic` the lit edge touches, as a Set (empty
|
|
79037
|
+
* rows still mark the card), or null when the card is not one
|
|
79038
|
+
* of its ends.
|
|
79039
|
+
************************************************************/
|
|
79040
|
+
function lit_rows_of(gobj, topic) {
|
|
79041
|
+
let priv = gobj.priv;
|
|
79042
|
+
if (!priv.graph || !priv.lit_edge_id) return null;
|
|
79043
|
+
let ed;
|
|
79044
|
+
try {
|
|
79045
|
+
ed = priv.graph.getEdgeData(priv.lit_edge_id);
|
|
79046
|
+
} catch (e) {
|
|
79047
|
+
return null;
|
|
79048
|
+
}
|
|
79049
|
+
let style = ed.style || {};
|
|
79050
|
+
let rows = null;
|
|
79051
|
+
if (ed.source === topic) {
|
|
79052
|
+
rows = rows || /* @__PURE__ */ new Set();
|
|
79053
|
+
rows.add(style.sourcePort);
|
|
79054
|
+
}
|
|
79055
|
+
if (ed.target === topic) {
|
|
79056
|
+
rows = rows || /* @__PURE__ */ new Set();
|
|
79057
|
+
rows.add(style.targetPort);
|
|
79058
|
+
}
|
|
79059
|
+
return rows;
|
|
79060
|
+
}
|
|
79061
|
+
/************************************************************
|
|
79062
|
+
* Repaint the cards of these topics, lit or not as they are now.
|
|
79063
|
+
************************************************************/
|
|
79064
|
+
function repaint_cards(gobj, topics) {
|
|
79065
|
+
let graph = gobj.priv.graph;
|
|
79066
|
+
let dark = yui_is_dark();
|
|
79067
|
+
let updates = [];
|
|
79068
|
+
for (let topic of topics) {
|
|
79069
|
+
let nd;
|
|
79070
|
+
try {
|
|
79071
|
+
nd = graph.getNodeData(topic);
|
|
79072
|
+
} catch (e) {
|
|
79073
|
+
continue;
|
|
79074
|
+
}
|
|
79075
|
+
let data = nd && nd.data;
|
|
79076
|
+
if (!is_object(data) || !Array.isArray(data.rows)) continue;
|
|
79077
|
+
updates.push({
|
|
79078
|
+
id: topic,
|
|
79079
|
+
style: { innerHTML: build_card_innerHTML(data.topic_name, data.rows, data.color, dark, lit_rows_of(gobj, topic)) }
|
|
79080
|
+
});
|
|
79081
|
+
}
|
|
79082
|
+
if (updates.length > 0) graph.updateNodeData(updates);
|
|
79083
|
+
}
|
|
79084
|
+
/************************************************************
|
|
79085
|
+
* Light an edge: the line, its two cards and the two rows it
|
|
79086
|
+
* joins -- a click on a line says which hook it is and which
|
|
79087
|
+
* fkey it lands on. A second click on it, or a click on the
|
|
79088
|
+
* canvas, puts it out.
|
|
79089
|
+
************************************************************/
|
|
79090
|
+
function light_edge(gobj, edge_id) {
|
|
79091
|
+
let priv = gobj.priv;
|
|
79092
|
+
let graph = priv.graph;
|
|
79093
|
+
if (!graph) return;
|
|
79094
|
+
let same = priv.lit_edge_id === edge_id;
|
|
79095
|
+
unlight_edge(gobj, false);
|
|
79096
|
+
if (!same && edge_id) {
|
|
79097
|
+
let ed;
|
|
79098
|
+
try {
|
|
79099
|
+
ed = graph.getEdgeData(edge_id);
|
|
79100
|
+
} catch (e) {
|
|
79101
|
+
log_error(`${gobj_short_name(gobj)}: cannot light the edge ${edge_id}: ${e}`);
|
|
79102
|
+
ed = null;
|
|
79103
|
+
}
|
|
79104
|
+
if (ed) {
|
|
79105
|
+
priv.lit_edge_id = edge_id;
|
|
79106
|
+
graph.updateData({ edges: [{
|
|
79107
|
+
id: edge_id,
|
|
79108
|
+
states: ["lit"]
|
|
79109
|
+
}] });
|
|
79110
|
+
repaint_cards(gobj, /* @__PURE__ */ new Set([ed.source, ed.target]));
|
|
79111
|
+
}
|
|
79112
|
+
}
|
|
79113
|
+
graph.draw().catch((e) => {
|
|
79114
|
+
log_error(`${gobj_short_name(gobj)}: schema graph redraw failed: ${e}`);
|
|
79115
|
+
});
|
|
79116
|
+
}
|
|
79117
|
+
function unlight_edge(gobj, draw) {
|
|
79118
|
+
let priv = gobj.priv;
|
|
79119
|
+
let graph = priv.graph;
|
|
79120
|
+
let edge_id = priv.lit_edge_id;
|
|
79121
|
+
if (!graph || !edge_id) {
|
|
79122
|
+
priv.lit_edge_id = null;
|
|
79123
|
+
return;
|
|
79124
|
+
}
|
|
79125
|
+
let ed = null;
|
|
79126
|
+
try {
|
|
79127
|
+
ed = graph.getEdgeData(edge_id);
|
|
79128
|
+
} catch (e) {
|
|
79129
|
+
ed = null;
|
|
79130
|
+
}
|
|
79131
|
+
priv.lit_edge_id = null;
|
|
79132
|
+
if (!ed) return;
|
|
79133
|
+
graph.updateData({ edges: [{
|
|
79134
|
+
id: edge_id,
|
|
79135
|
+
states: []
|
|
79136
|
+
}] });
|
|
79137
|
+
repaint_cards(gobj, /* @__PURE__ */ new Set([ed.source, ed.target]));
|
|
79138
|
+
if (draw) graph.draw().catch((e) => {
|
|
79139
|
+
log_error(`${gobj_short_name(gobj)}: schema graph redraw failed: ${e}`);
|
|
79140
|
+
});
|
|
79141
|
+
}
|
|
79142
|
+
/************************************************************
|
|
79143
|
+
* A card in the minimap: a block of its size in its topic's
|
|
79144
|
+
* colour, darkened on the light scheme so a yellow topic does
|
|
79145
|
+
* not vanish on the white panel. G6 clones a node's key shape,
|
|
79146
|
+
* and the key shape of an html card is a DOM element, which
|
|
79147
|
+
* clones into nothing (see yui_graph_minimap.js).
|
|
79148
|
+
************************************************************/
|
|
79149
|
+
function minimap_shape(gobj, id, element_type, element) {
|
|
79150
|
+
if (element_type !== "node") return element;
|
|
79151
|
+
try {
|
|
79152
|
+
let nd = gobj.priv.graph.getNodeData(id);
|
|
79153
|
+
let color = nd && nd.data && nd.data.color || SYSTEM_TOPIC_COLOR;
|
|
79154
|
+
return yui_graph_minimap_block(nd, yui_is_dark() ? color : getStrokeColor(color));
|
|
79155
|
+
} catch (e) {
|
|
79156
|
+
log_error(`${gobj_short_name(gobj)}: minimap shape failed: ${e}`);
|
|
79157
|
+
return element;
|
|
79158
|
+
}
|
|
79159
|
+
}
|
|
79160
|
+
/************************************************************
|
|
78901
79161
|
* Build the G6 schema graph.
|
|
78902
79162
|
************************************************************/
|
|
78903
79163
|
function build_graph(gobj) {
|
|
@@ -78929,7 +79189,7 @@ function build_graph(gobj) {
|
|
|
78929
79189
|
autoResize: true,
|
|
78930
79190
|
animation: false,
|
|
78931
79191
|
data,
|
|
78932
|
-
edge:
|
|
79192
|
+
edge: edge_options(dark),
|
|
78933
79193
|
layout: {
|
|
78934
79194
|
type: "antv-dagre",
|
|
78935
79195
|
rankdir: "LR",
|
|
@@ -78940,7 +79200,12 @@ function build_graph(gobj) {
|
|
|
78940
79200
|
"drag-canvas",
|
|
78941
79201
|
...yui_graph_camera_behaviors(),
|
|
78942
79202
|
"drag-element"
|
|
78943
|
-
]
|
|
79203
|
+
],
|
|
79204
|
+
plugins: [{
|
|
79205
|
+
key: "minimap",
|
|
79206
|
+
type: "minimap",
|
|
79207
|
+
...yui_graph_minimap_options((id, element_type, element) => minimap_shape(gobj, id, element_type, element))
|
|
79208
|
+
}]
|
|
78944
79209
|
});
|
|
78945
79210
|
} catch (e) {
|
|
78946
79211
|
log_error(`${gobj_short_name(gobj)}: schema graph create failed: ${e}`);
|
|
@@ -78957,6 +79222,13 @@ function build_graph(gobj) {
|
|
|
78957
79222
|
let node_id = evt && evt.target && evt.target.id;
|
|
78958
79223
|
gobj_send_event(gobj, "EV_NODE_CLICK", { node_id }, gobj);
|
|
78959
79224
|
});
|
|
79225
|
+
graph.on(EdgeEvent.CLICK, (evt) => {
|
|
79226
|
+
let edge_id = evt && evt.target && evt.target.id;
|
|
79227
|
+
gobj_send_event(gobj, "EV_EDGE_CLICK", { edge_id }, gobj);
|
|
79228
|
+
});
|
|
79229
|
+
graph.on(CanvasEvent.CLICK, () => {
|
|
79230
|
+
gobj_send_event(gobj, "EV_CANVAS_CLICK", {}, gobj);
|
|
79231
|
+
});
|
|
78960
79232
|
graph.render().then(() => {
|
|
78961
79233
|
yui_graph_update_zoom($container, priv.graph);
|
|
78962
79234
|
}).catch((e) => {
|
|
@@ -78968,6 +79240,7 @@ function build_graph(gobj) {
|
|
|
78968
79240
|
************************************************************/
|
|
78969
79241
|
function destroy_graph(gobj) {
|
|
78970
79242
|
let priv = gobj.priv;
|
|
79243
|
+
priv.lit_edge_id = null;
|
|
78971
79244
|
if (priv.unforward_wheel) {
|
|
78972
79245
|
priv.unforward_wheel();
|
|
78973
79246
|
priv.unforward_wheel = null;
|
|
@@ -79016,6 +79289,22 @@ function ac_node_click$1(gobj, event, kw, src) {
|
|
|
79016
79289
|
return 0;
|
|
79017
79290
|
}
|
|
79018
79291
|
/************************************************************
|
|
79292
|
+
* An edge was clicked: light it, or put it out if it was lit.
|
|
79293
|
+
************************************************************/
|
|
79294
|
+
function ac_edge_click(gobj, event, kw, src) {
|
|
79295
|
+
let edge_id = kw && kw.edge_id;
|
|
79296
|
+
if (!edge_id) return 0;
|
|
79297
|
+
light_edge(gobj, edge_id);
|
|
79298
|
+
return 0;
|
|
79299
|
+
}
|
|
79300
|
+
/************************************************************
|
|
79301
|
+
* A click on the empty canvas puts the lit edge out.
|
|
79302
|
+
************************************************************/
|
|
79303
|
+
function ac_canvas_click(gobj, event, kw, src) {
|
|
79304
|
+
unlight_edge(gobj, true);
|
|
79305
|
+
return 0;
|
|
79306
|
+
}
|
|
79307
|
+
/************************************************************
|
|
79019
79308
|
* Shown by the host: match the canvas to the container now it
|
|
79020
79309
|
* is visible and sized (G6 renders at 0×0 while display:none).
|
|
79021
79310
|
* A resize only, never a fit: the camera stays where it was, so
|
|
@@ -79048,14 +79337,14 @@ function ac_theme(gobj, event, kw, src) {
|
|
|
79048
79337
|
let dark = kw && kw.theme ? kw.theme === "dark" : yui_is_dark();
|
|
79049
79338
|
try {
|
|
79050
79339
|
graph.setTheme(dark ? "dark" : "light");
|
|
79051
|
-
graph.setEdge(
|
|
79340
|
+
graph.setEdge(edge_options(dark));
|
|
79052
79341
|
let updates = [];
|
|
79053
79342
|
for (let node of graph.getNodeData()) {
|
|
79054
79343
|
let data = node.data;
|
|
79055
79344
|
if (!is_object(data) || !Array.isArray(data.rows)) continue;
|
|
79056
79345
|
updates.push({
|
|
79057
79346
|
id: node.id,
|
|
79058
|
-
style: { innerHTML: build_card_innerHTML(data.topic_name, data.rows, data.color, dark) }
|
|
79347
|
+
style: { innerHTML: build_card_innerHTML(data.topic_name, data.rows, data.color, dark, lit_rows_of(gobj, node.id)) }
|
|
79059
79348
|
});
|
|
79060
79349
|
}
|
|
79061
79350
|
if (updates.length > 0) graph.updateNodeData(updates);
|
|
@@ -79127,6 +79416,16 @@ function create_gclass$2(gclass_name) {
|
|
|
79127
79416
|
ac_node_click$1,
|
|
79128
79417
|
null
|
|
79129
79418
|
],
|
|
79419
|
+
[
|
|
79420
|
+
"EV_EDGE_CLICK",
|
|
79421
|
+
ac_edge_click,
|
|
79422
|
+
null
|
|
79423
|
+
],
|
|
79424
|
+
[
|
|
79425
|
+
"EV_CANVAS_CLICK",
|
|
79426
|
+
ac_canvas_click,
|
|
79427
|
+
null
|
|
79428
|
+
],
|
|
79130
79429
|
[
|
|
79131
79430
|
"EV_SHOW",
|
|
79132
79431
|
ac_show$1,
|
|
@@ -79165,6 +79464,8 @@ function create_gclass$2(gclass_name) {
|
|
|
79165
79464
|
]]];
|
|
79166
79465
|
const event_types = [
|
|
79167
79466
|
["EV_NODE_CLICK", event_flag_t.EVF_OUTPUT_EVENT | event_flag_t.EVF_NO_WARN_SUBS],
|
|
79467
|
+
["EV_EDGE_CLICK", 0],
|
|
79468
|
+
["EV_CANVAS_CLICK", 0],
|
|
79168
79469
|
["EV_SHOW", 0],
|
|
79169
79470
|
["EV_THEME", 0],
|
|
79170
79471
|
["EV_REBUILD", 0],
|