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