@yuneta/gobj-ui 7.23.66 → 7.23.68
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 +66 -6
- package/dist/gobj-ui.cjs.js +454 -90
- package/dist/gobj-ui.es.js +455 -91
- package/package.json +1 -1
- package/src/c_g6_nodes_tree.js +160 -16
- package/src/c_yui_treedb_graph.js +268 -82
- package/src/treedb_fold_model.js +171 -15
- package/src/treedb_fold_model.test.js +120 -2
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -26914,17 +26914,26 @@ function parents_of(descs, desc, record) {
|
|
|
26914
26914
|
* topics: [topic_name, ...] topics with records, in desc order
|
|
26915
26915
|
* }
|
|
26916
26916
|
************************************************************/
|
|
26917
|
-
function fold_build_model(descs, records) {
|
|
26917
|
+
function fold_build_model(descs, records, opts) {
|
|
26918
26918
|
let nodes = /* @__PURE__ */ new Map();
|
|
26919
26919
|
let groups = /* @__PURE__ */ new Map();
|
|
26920
26920
|
let topics = [];
|
|
26921
26921
|
descs = (0, _yuneta_gobj_js.is_object)(descs) ? descs : {};
|
|
26922
26922
|
records = (0, _yuneta_gobj_js.is_object)(records) ? records : {};
|
|
26923
|
+
opts = (0, _yuneta_gobj_js.is_object)(opts) ? opts : {};
|
|
26924
|
+
let hidden = new Set((0, _yuneta_gobj_js.is_array)(opts.hidden_topics) ? opts.hidden_topics : []);
|
|
26925
|
+
let loose_shown = new Set((0, _yuneta_gobj_js.is_array)(opts.loose_topics) ? opts.loose_topics : []);
|
|
26926
|
+
let main_topic = opts.main_topic || fold_main_topic(descs);
|
|
26927
|
+
if (main_topic && (!descs[main_topic] || hidden.has(main_topic))) main_topic = "";
|
|
26928
|
+
let linked = fold_linked_topics(descs, main_topic);
|
|
26929
|
+
let totals = {};
|
|
26923
26930
|
for (let topic_name of Object.keys(descs)) {
|
|
26924
26931
|
if (topic_name.substring(0, 2) === "__") continue;
|
|
26925
26932
|
descs[topic_name];
|
|
26926
26933
|
let list = records[topic_name];
|
|
26927
26934
|
if (!(0, _yuneta_gobj_js.is_array)(list)) continue;
|
|
26935
|
+
totals[topic_name] = list.length;
|
|
26936
|
+
if (hidden.has(topic_name)) continue;
|
|
26928
26937
|
topics.push(topic_name);
|
|
26929
26938
|
for (let i = 0; i < list.length; i++) {
|
|
26930
26939
|
let record = list[i];
|
|
@@ -26953,21 +26962,100 @@ function fold_build_model(descs, records) {
|
|
|
26953
26962
|
}
|
|
26954
26963
|
for (let node of nodes.values()) for (let hook of Object.keys(node.hooks)) groups.set(fold_group_key(node.key, hook), node.hooks[hook]);
|
|
26955
26964
|
let roots = {};
|
|
26956
|
-
|
|
26957
|
-
for (let
|
|
26965
|
+
let loose = {};
|
|
26966
|
+
for (let topic_name of topics) {
|
|
26967
|
+
roots[topic_name] = [];
|
|
26968
|
+
loose[topic_name] = [];
|
|
26969
|
+
}
|
|
26970
|
+
for (let node of nodes.values()) {
|
|
26971
|
+
if (node.parents.length > 0) continue;
|
|
26972
|
+
let t = node.topic_name;
|
|
26973
|
+
if (main_topic && t !== main_topic && linked.has(t)) {
|
|
26974
|
+
loose[t].push(node.key);
|
|
26975
|
+
if (loose_shown.has(t)) roots[t].push(node.key);
|
|
26976
|
+
} else roots[t].push(node.key);
|
|
26977
|
+
}
|
|
26958
26978
|
let reached = reach_from(nodes, [].concat(...Object.values(roots)));
|
|
26959
|
-
for (let node of nodes.values())
|
|
26960
|
-
|
|
26979
|
+
for (let node of nodes.values()) {
|
|
26980
|
+
if (reached.has(node.key)) continue;
|
|
26981
|
+
let t = node.topic_name;
|
|
26982
|
+
if (main_topic && t !== main_topic && linked.has(t)) {
|
|
26983
|
+
if (node.parents.length > 0) loose[t].push(node.key);
|
|
26984
|
+
if (!loose_shown.has(t)) continue;
|
|
26985
|
+
}
|
|
26986
|
+
roots[t].push(node.key);
|
|
26961
26987
|
for (let k of reach_from(nodes, [node.key])) reached.add(k);
|
|
26962
26988
|
}
|
|
26963
26989
|
for (let topic_name of topics) if (roots[topic_name].length > 0) groups.set(fold_root_group_key(topic_name), roots[topic_name]);
|
|
26964
26990
|
return {
|
|
26965
26991
|
nodes,
|
|
26966
26992
|
groups,
|
|
26967
|
-
topics
|
|
26993
|
+
topics,
|
|
26994
|
+
totals,
|
|
26995
|
+
hidden,
|
|
26996
|
+
main_topic,
|
|
26997
|
+
linked,
|
|
26998
|
+
loose,
|
|
26999
|
+
loose_shown
|
|
26968
27000
|
};
|
|
26969
27001
|
}
|
|
26970
27002
|
/************************************************************
|
|
27003
|
+
* The topic the schema hangs the others from: the one whose hooks
|
|
27004
|
+
* reach the most OTHER topics, a self-referent hook breaking a tie
|
|
27005
|
+
* (a tree of places over a flat list of groups), schema order
|
|
27006
|
+
* breaking the rest. "" when no topic reaches another -- a treedb of
|
|
27007
|
+
* unrelated lists has no trunk, and every topic is a tree of its own.
|
|
27008
|
+
************************************************************/
|
|
27009
|
+
function fold_main_topic(descs) {
|
|
27010
|
+
descs = (0, _yuneta_gobj_js.is_object)(descs) ? descs : {};
|
|
27011
|
+
let best = "";
|
|
27012
|
+
let best_score = 0;
|
|
27013
|
+
let best_self = false;
|
|
27014
|
+
for (let topic_name of Object.keys(descs)) {
|
|
27015
|
+
if (topic_name.substring(0, 2) === "__") continue;
|
|
27016
|
+
let reach = hook_targets(descs, topic_name);
|
|
27017
|
+
let self = reach.has(topic_name);
|
|
27018
|
+
reach.delete(topic_name);
|
|
27019
|
+
let score = reach.size;
|
|
27020
|
+
if (score === 0) continue;
|
|
27021
|
+
if (score > best_score || score === best_score && self && !best_self) {
|
|
27022
|
+
best = topic_name;
|
|
27023
|
+
best_score = score;
|
|
27024
|
+
best_self = self;
|
|
27025
|
+
}
|
|
27026
|
+
}
|
|
27027
|
+
return best;
|
|
27028
|
+
}
|
|
27029
|
+
function hook_targets(descs, topic_name) {
|
|
27030
|
+
let out = /* @__PURE__ */ new Set();
|
|
27031
|
+
let desc = descs[topic_name];
|
|
27032
|
+
if (!desc || desc.node_treedb_type === "extended") return out;
|
|
27033
|
+
let cols = (0, _yuneta_gobj_js.is_array)(desc.cols) ? desc.cols : [];
|
|
27034
|
+
for (let col of cols) {
|
|
27035
|
+
if (!(0, _yuneta_gobj_js.is_object)(col.hook) || !(0, _yuneta_gobj_js.is_array)(col.flag) || col.flag.indexOf("hook") < 0) continue;
|
|
27036
|
+
for (let child of Object.keys(col.hook)) if (child.substring(0, 2) !== "__" && descs[child]) out.add(child);
|
|
27037
|
+
}
|
|
27038
|
+
return out;
|
|
27039
|
+
}
|
|
27040
|
+
/************************************************************
|
|
27041
|
+
* The topics the schema hangs from `main_topic`, main included:
|
|
27042
|
+
* reached by following hooks from it. A record of one of these
|
|
27043
|
+
* with no parent is LOOSE; a topic outside the set is its own tree.
|
|
27044
|
+
* Empty when there is no main topic.
|
|
27045
|
+
************************************************************/
|
|
27046
|
+
function fold_linked_topics(descs, main_topic) {
|
|
27047
|
+
let linked = /* @__PURE__ */ new Set();
|
|
27048
|
+
if (!main_topic || !(0, _yuneta_gobj_js.is_object)(descs) || !descs[main_topic]) return linked;
|
|
27049
|
+
let queue = [main_topic];
|
|
27050
|
+
while (queue.length) {
|
|
27051
|
+
let t = queue.shift();
|
|
27052
|
+
if (linked.has(t)) continue;
|
|
27053
|
+
linked.add(t);
|
|
27054
|
+
for (let child of hook_targets(descs, t)) if (!linked.has(child)) queue.push(child);
|
|
27055
|
+
}
|
|
27056
|
+
return linked;
|
|
27057
|
+
}
|
|
27058
|
+
/************************************************************
|
|
26971
27059
|
* Everything reachable downwards from `start`, cycles included.
|
|
26972
27060
|
************************************************************/
|
|
26973
27061
|
function reach_from(nodes, start) {
|
|
@@ -26998,7 +27086,10 @@ function fold_group_total(model, group_key) {
|
|
|
26998
27086
|
}
|
|
26999
27087
|
function fold_group_shown(model, state, group_key) {
|
|
27000
27088
|
let total = fold_group_total(model, group_key);
|
|
27001
|
-
let n
|
|
27089
|
+
let n;
|
|
27090
|
+
if (state.shown.has(group_key)) n = state.shown.get(group_key);
|
|
27091
|
+
else if (group_key.charAt(0) === "|") n = state.page_size;
|
|
27092
|
+
else n = 0;
|
|
27002
27093
|
return Math.min(n, total);
|
|
27003
27094
|
}
|
|
27004
27095
|
function fold_is_open(state, group_key) {
|
|
@@ -54104,6 +54195,9 @@ var attrs_table$4 = [
|
|
|
54104
54195
|
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "fkey_port_position", 0, "top", "Fkey port position"),
|
|
54105
54196
|
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_INTEGER, "expand_depth", 0, 2, "Levels open when a treedb loads: 1 = the roots alone, 2 = the roots and their children. Every open hook shows its first page"),
|
|
54106
54197
|
(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; the `+N` chip after the page opens the next one"),
|
|
54198
|
+
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_LIST, "hidden_topics", 0, "[]", "Topics left out of the tree: no card, no pill counts them, no edge reaches them"),
|
|
54199
|
+
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "main_topic", 0, "", "The topic the tree hangs from; empty = deduced (the one whose hooks reach the most others). Its parentless records are the roots; a parentless record of a topic linked to it is LOOSE and shown only on request"),
|
|
54200
|
+
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_LIST, "loose_topics", 0, "[]", "Topics whose loose records (no parent, in a topic the schema hangs from the main one) are shown as roots"),
|
|
54107
54201
|
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "confirm_delete_node", 0, true, "Ask confirmation before deleting a node"),
|
|
54108
54202
|
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "confirm_unlink_edge", 0, true, "Ask confirmation before unlinking an edge"),
|
|
54109
54203
|
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "wide", 0, "40px", "Height of header"),
|
|
@@ -54172,12 +54266,17 @@ var PRIVATE_DATA$4 = {
|
|
|
54172
54266
|
selection_mode: false,
|
|
54173
54267
|
_selected_paint_ids: [],
|
|
54174
54268
|
_pending_focus_topic: null,
|
|
54269
|
+
_pending_focus_all: false,
|
|
54270
|
+
_find_hidden_matches: 0,
|
|
54175
54271
|
_pending_find: null,
|
|
54176
54272
|
_layout_asked: "",
|
|
54177
54273
|
_nodes_total: 0,
|
|
54178
54274
|
_nodes_placed: 0,
|
|
54179
54275
|
expand_depth: 2,
|
|
54180
54276
|
fold_page_size: 24,
|
|
54277
|
+
hidden_topics: null,
|
|
54278
|
+
main_topic: "",
|
|
54279
|
+
loose_topics: null,
|
|
54181
54280
|
_fold_model: null,
|
|
54182
54281
|
_fold_state: null,
|
|
54183
54282
|
_fold_listener: null,
|
|
@@ -55661,10 +55760,11 @@ async function graph_fit_selection(gobj, ids) {
|
|
|
55661
55760
|
* once the data loads (see ac_load_data). Guarded end-to-end — a
|
|
55662
55761
|
* missing G6 API or an unknown topic logs and no-ops, never throws.
|
|
55663
55762
|
************************************************************/
|
|
55664
|
-
function graph_focus_topic(gobj, topic) {
|
|
55763
|
+
function graph_focus_topic(gobj, topic, reveal_all) {
|
|
55665
55764
|
let priv = gobj.priv;
|
|
55666
55765
|
if (!priv.graph || !priv.graph_rendered || !priv._fold_model) {
|
|
55667
55766
|
priv._pending_focus_topic = topic;
|
|
55767
|
+
priv._pending_focus_all = !!reveal_all;
|
|
55668
55768
|
return;
|
|
55669
55769
|
}
|
|
55670
55770
|
let model = priv._fold_model;
|
|
@@ -55677,7 +55777,7 @@ function graph_focus_topic(gobj, topic) {
|
|
|
55677
55777
|
let revealed = 0;
|
|
55678
55778
|
for (let key of keys) {
|
|
55679
55779
|
if (visible.has(key)) continue;
|
|
55680
|
-
if (revealed >= state.page_size) break;
|
|
55780
|
+
if (!reveal_all && revealed >= state.page_size) break;
|
|
55681
55781
|
fold_reveal(model, state, key);
|
|
55682
55782
|
revealed++;
|
|
55683
55783
|
}
|
|
@@ -55752,23 +55852,26 @@ function graph_find_nodes(gobj, term) {
|
|
|
55752
55852
|
let model = priv._fold_model;
|
|
55753
55853
|
let state = priv._fold_state;
|
|
55754
55854
|
let keys = [];
|
|
55855
|
+
let hidden_matches = 0;
|
|
55755
55856
|
if (!(0, _yuneta_gobj_js.empty_string)(term)) {
|
|
55756
55857
|
let needle = String(term).toLowerCase();
|
|
55757
|
-
|
|
55758
|
-
let record = node.record || {};
|
|
55858
|
+
let matches = (topic_name, record) => {
|
|
55759
55859
|
let label = "";
|
|
55760
55860
|
try {
|
|
55761
|
-
label = node_label(priv.descs[
|
|
55861
|
+
label = node_label(priv.descs[topic_name] || {}, record) || "";
|
|
55762
55862
|
} catch (e) {
|
|
55763
55863
|
label = "";
|
|
55764
55864
|
}
|
|
55765
|
-
|
|
55865
|
+
return [
|
|
55766
55866
|
label,
|
|
55767
55867
|
record.id,
|
|
55768
|
-
|
|
55769
|
-
].filter((v) => typeof v === "string").join(" ").toLowerCase().includes(needle)
|
|
55770
|
-
}
|
|
55868
|
+
topic_name
|
|
55869
|
+
].filter((v) => typeof v === "string").join(" ").toLowerCase().includes(needle);
|
|
55870
|
+
};
|
|
55871
|
+
for (let node of model.nodes.values()) if (matches(node.topic_name, node.record || {})) keys.push(node.key);
|
|
55872
|
+
for (let topic_name of model.hidden) for (let record of priv.records[topic_name] || []) if ((0, _yuneta_gobj_js.is_object)(record) && matches(topic_name, record)) hidden_matches++;
|
|
55771
55873
|
}
|
|
55874
|
+
priv._find_hidden_matches = hidden_matches;
|
|
55772
55875
|
let visible = fold_visible_set(model, state);
|
|
55773
55876
|
let revealed = 0;
|
|
55774
55877
|
for (let key of keys) {
|
|
@@ -58699,7 +58802,11 @@ function uninstall_fold_listener(gobj) {
|
|
|
58699
58802
|
************************************************************/
|
|
58700
58803
|
function rebuild_fold_model(gobj) {
|
|
58701
58804
|
let priv = gobj.priv;
|
|
58702
|
-
priv._fold_model = fold_build_model(priv.descs || {}, priv.records || {}
|
|
58805
|
+
priv._fold_model = fold_build_model(priv.descs || {}, priv.records || {}, {
|
|
58806
|
+
hidden_topics: (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "hidden_topics") || [],
|
|
58807
|
+
main_topic: (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "main_topic") || "",
|
|
58808
|
+
loose_topics: (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "loose_topics") || []
|
|
58809
|
+
});
|
|
58703
58810
|
if (!priv._fold_state) priv._fold_state = fold_new_state((0, _yuneta_gobj_js.gobj_read_integer_attr)(gobj, "fold_page_size"));
|
|
58704
58811
|
if (!priv._pill_sig) priv._pill_sig = /* @__PURE__ */ new Map();
|
|
58705
58812
|
}
|
|
@@ -58761,8 +58868,47 @@ async function reconcile_fold_now(gobj, opts) {
|
|
|
58761
58868
|
} finally {
|
|
58762
58869
|
history_resume(gobj);
|
|
58763
58870
|
}
|
|
58871
|
+
publish_legend_state(gobj, visible);
|
|
58764
58872
|
return changed;
|
|
58765
58873
|
}
|
|
58874
|
+
/************************************************************
|
|
58875
|
+
* What the legend has to say, published after every reconcile:
|
|
58876
|
+
* one entry per topic of the treedb, hidden ones included, with
|
|
58877
|
+
* its colour, how many records it has, how many are on screen,
|
|
58878
|
+
* how many are LOOSE, and the flags -- plus which topic is the
|
|
58879
|
+
* main one and whether it was deduced or chosen. The host draws
|
|
58880
|
+
* the strip from this and nothing else; the engine is the truth.
|
|
58881
|
+
************************************************************/
|
|
58882
|
+
function publish_legend_state(gobj, visible) {
|
|
58883
|
+
let priv = gobj.priv;
|
|
58884
|
+
let model = priv._fold_model;
|
|
58885
|
+
if (!model || !priv.descs) return;
|
|
58886
|
+
let on_screen = {};
|
|
58887
|
+
for (let key of visible) {
|
|
58888
|
+
let node = model.nodes.get(key);
|
|
58889
|
+
if (node) on_screen[node.topic_name] = (on_screen[node.topic_name] || 0) + 1;
|
|
58890
|
+
}
|
|
58891
|
+
let topics = [];
|
|
58892
|
+
for (const [topic_name, desc] of Object.entries(priv.descs)) {
|
|
58893
|
+
if (topic_name.substring(0, 2) === "__" || !desc) continue;
|
|
58894
|
+
let loose = model.loose[topic_name] || [];
|
|
58895
|
+
topics.push({
|
|
58896
|
+
topic: topic_name,
|
|
58897
|
+
color: desc.color || "",
|
|
58898
|
+
total: model.totals[topic_name] || 0,
|
|
58899
|
+
visible: on_screen[topic_name] || 0,
|
|
58900
|
+
loose: loose.length,
|
|
58901
|
+
loose_shown: model.loose_shown.has(topic_name),
|
|
58902
|
+
hidden: model.hidden.has(topic_name),
|
|
58903
|
+
linked: model.linked.has(topic_name)
|
|
58904
|
+
});
|
|
58905
|
+
}
|
|
58906
|
+
(0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_LEGEND_STATE", {
|
|
58907
|
+
main_topic: model.main_topic,
|
|
58908
|
+
main_chosen: !!(0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "main_topic"),
|
|
58909
|
+
topics
|
|
58910
|
+
});
|
|
58911
|
+
}
|
|
58766
58912
|
async function reconcile_fold_apply(gobj, opts, visible) {
|
|
58767
58913
|
let priv = gobj.priv;
|
|
58768
58914
|
let graph = priv.graph;
|
|
@@ -59036,8 +59182,10 @@ function ac_load_data(gobj, event, kw, src) {
|
|
|
59036
59182
|
sync_history_plugin(gobj);
|
|
59037
59183
|
if (priv._pending_focus_topic !== null) {
|
|
59038
59184
|
let ft = priv._pending_focus_topic;
|
|
59185
|
+
let all = priv._pending_focus_all;
|
|
59039
59186
|
priv._pending_focus_topic = null;
|
|
59040
|
-
|
|
59187
|
+
priv._pending_focus_all = false;
|
|
59188
|
+
graph_focus_topic(gobj, ft, all);
|
|
59041
59189
|
}
|
|
59042
59190
|
if (priv._pending_find !== null) {
|
|
59043
59191
|
let term = priv._pending_find;
|
|
@@ -59353,7 +59501,7 @@ function ac_zoom_selection(gobj, event, kw, src) {
|
|
|
59353
59501
|
return 0;
|
|
59354
59502
|
}
|
|
59355
59503
|
function ac_focus_topic(gobj, event, kw, src) {
|
|
59356
|
-
graph_focus_topic(gobj, kw && kw.topic);
|
|
59504
|
+
graph_focus_topic(gobj, kw && kw.topic, !!(kw && kw.reveal === "all"));
|
|
59357
59505
|
return 0;
|
|
59358
59506
|
}
|
|
59359
59507
|
/************************************************************
|
|
@@ -59436,6 +59584,43 @@ function ac_collapse_all$1(gobj, event, kw, src) {
|
|
|
59436
59584
|
return 0;
|
|
59437
59585
|
}
|
|
59438
59586
|
/************************************************************
|
|
59587
|
+
* The legend's three settings, from the host, which persists
|
|
59588
|
+
* them. Each rebuilds the tree; the fold state is kept -- it is
|
|
59589
|
+
* keyed by group, and a group that is gone is never read -- except
|
|
59590
|
+
* for a new MAIN topic, whose roots are other roots: the tree
|
|
59591
|
+
* opens again at `expand_depth`.
|
|
59592
|
+
************************************************************/
|
|
59593
|
+
function ac_set_hidden_topics(gobj, event, kw, src) {
|
|
59594
|
+
let priv = gobj.priv;
|
|
59595
|
+
let topics = kw && (0, _yuneta_gobj_js.is_array)(kw.topics) ? kw.topics : [];
|
|
59596
|
+
(0, _yuneta_gobj_js.gobj_write_attr)(gobj, "hidden_topics", topics);
|
|
59597
|
+
if (!priv._fold_model) return 0;
|
|
59598
|
+
rebuild_fold_model(gobj);
|
|
59599
|
+
reconcile_fold(gobj, {});
|
|
59600
|
+
return 0;
|
|
59601
|
+
}
|
|
59602
|
+
function ac_set_main_topic(gobj, event, kw, src) {
|
|
59603
|
+
let priv = gobj.priv;
|
|
59604
|
+
(0, _yuneta_gobj_js.gobj_write_str_attr)(gobj, "main_topic", kw && kw.topic || "");
|
|
59605
|
+
if (!priv._fold_model) return 0;
|
|
59606
|
+
rebuild_fold_model(gobj);
|
|
59607
|
+
fold_expand_to_depth(priv._fold_model, priv._fold_state, (0, _yuneta_gobj_js.gobj_read_integer_attr)(gobj, "expand_depth"));
|
|
59608
|
+
reconcile_fold(gobj, {
|
|
59609
|
+
relayout: true,
|
|
59610
|
+
fit: true
|
|
59611
|
+
});
|
|
59612
|
+
return 0;
|
|
59613
|
+
}
|
|
59614
|
+
function ac_set_loose_topics(gobj, event, kw, src) {
|
|
59615
|
+
let priv = gobj.priv;
|
|
59616
|
+
let topics = kw && (0, _yuneta_gobj_js.is_array)(kw.topics) ? kw.topics : [];
|
|
59617
|
+
(0, _yuneta_gobj_js.gobj_write_attr)(gobj, "loose_topics", topics);
|
|
59618
|
+
if (!priv._fold_model) return 0;
|
|
59619
|
+
rebuild_fold_model(gobj);
|
|
59620
|
+
reconcile_fold(gobj, {});
|
|
59621
|
+
return 0;
|
|
59622
|
+
}
|
|
59623
|
+
/************************************************************
|
|
59439
59624
|
* Tell whoever asked how many nodes the term matched. The count is
|
|
59440
59625
|
* the answer to the question the box asks; without it "nothing moved"
|
|
59441
59626
|
* and "nothing matched" look the same.
|
|
@@ -59443,7 +59628,8 @@ function ac_collapse_all$1(gobj, event, kw, src) {
|
|
|
59443
59628
|
function publish_find_result(gobj, term, matches) {
|
|
59444
59629
|
(0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_FIND_RESULT", {
|
|
59445
59630
|
term,
|
|
59446
|
-
matches
|
|
59631
|
+
matches,
|
|
59632
|
+
hidden_matches: gobj.priv._find_hidden_matches || 0
|
|
59447
59633
|
});
|
|
59448
59634
|
}
|
|
59449
59635
|
/************************************************************
|
|
@@ -59909,6 +60095,21 @@ function create_gclass$4(gclass_name) {
|
|
|
59909
60095
|
ac_collapse_all$1,
|
|
59910
60096
|
null
|
|
59911
60097
|
],
|
|
60098
|
+
[
|
|
60099
|
+
"EV_SET_HIDDEN_TOPICS",
|
|
60100
|
+
ac_set_hidden_topics,
|
|
60101
|
+
null
|
|
60102
|
+
],
|
|
60103
|
+
[
|
|
60104
|
+
"EV_SET_MAIN_TOPIC",
|
|
60105
|
+
ac_set_main_topic,
|
|
60106
|
+
null
|
|
60107
|
+
],
|
|
60108
|
+
[
|
|
60109
|
+
"EV_SET_LOOSE_TOPICS",
|
|
60110
|
+
ac_set_loose_topics,
|
|
60111
|
+
null
|
|
60112
|
+
],
|
|
59912
60113
|
[
|
|
59913
60114
|
"EV_CENTER",
|
|
59914
60115
|
ac_center,
|
|
@@ -60010,6 +60211,10 @@ function create_gclass$4(gclass_name) {
|
|
|
60010
60211
|
["EV_SHOW_MORE", 0],
|
|
60011
60212
|
["EV_EXPAND_ALL", 0],
|
|
60012
60213
|
["EV_COLLAPSE_ALL", 0],
|
|
60214
|
+
["EV_SET_HIDDEN_TOPICS", 0],
|
|
60215
|
+
["EV_SET_MAIN_TOPIC", 0],
|
|
60216
|
+
["EV_SET_LOOSE_TOPICS", 0],
|
|
60217
|
+
["EV_LEGEND_STATE", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT],
|
|
60013
60218
|
["EV_CENTER", 0],
|
|
60014
60219
|
["EV_FULLSCREEN", 0],
|
|
60015
60220
|
["EV_SET_LAYOUT", 0],
|
|
@@ -60071,6 +60276,9 @@ var attrs_table$3 = [
|
|
|
60071
60276
|
(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"),
|
|
60072
60277
|
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "operation_mode", _yuneta_gobj_js.sdata_flag_t.SDF_PERSIST, "reading", "Current operation mode (internal behaviour or role). Changed by the user trough the gui."),
|
|
60073
60278
|
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "layout", _yuneta_gobj_js.sdata_flag_t.SDF_PERSIST, "", "Current graph layout. User preference. Changed by the user through the gui."),
|
|
60279
|
+
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_LIST, "hidden_topics", _yuneta_gobj_js.sdata_flag_t.SDF_PERSIST, "[]", "Topics hidden from the graph (legend). User preference, per treedb"),
|
|
60280
|
+
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "main_topic", _yuneta_gobj_js.sdata_flag_t.SDF_PERSIST, "", "The topic the tree hangs from; empty = deduced by the graph. User preference, per treedb"),
|
|
60281
|
+
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_LIST, "loose_topics", _yuneta_gobj_js.sdata_flag_t.SDF_PERSIST, "[]", "Topics whose LOOSE records (no parent) are shown. User preference, per treedb"),
|
|
60074
60282
|
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "gobj_remote_yuno", 0, null, "Remote Yuno to request data"),
|
|
60075
60283
|
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "treedb_name", 0, null, "Remote service treedb name"),
|
|
60076
60284
|
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_DICT, "descs", 0, null, "Descriptions of topics obtained"),
|
|
@@ -60112,6 +60320,7 @@ var PRIVATE_DATA$3 = {
|
|
|
60112
60320
|
operation_mode: null,
|
|
60113
60321
|
layout: null,
|
|
60114
60322
|
_topics_subscribed: {},
|
|
60323
|
+
_legend_state: null,
|
|
60115
60324
|
_links_subscribed: false,
|
|
60116
60325
|
is_pinhold_window: false
|
|
60117
60326
|
};
|
|
@@ -60144,7 +60353,10 @@ function mt_create$3(gobj) {
|
|
|
60144
60353
|
hook_port_position: "bottom",
|
|
60145
60354
|
fkey_port_position: "top",
|
|
60146
60355
|
expand_depth: (0, _yuneta_gobj_js.gobj_read_integer_attr)(gobj, "expand_depth"),
|
|
60147
|
-
fold_page_size: (0, _yuneta_gobj_js.gobj_read_integer_attr)(gobj, "fold_page_size")
|
|
60356
|
+
fold_page_size: (0, _yuneta_gobj_js.gobj_read_integer_attr)(gobj, "fold_page_size"),
|
|
60357
|
+
hidden_topics: (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "hidden_topics") || [],
|
|
60358
|
+
main_topic: (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "main_topic") || "",
|
|
60359
|
+
loose_topics: (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "loose_topics") || []
|
|
60148
60360
|
}, gobj);
|
|
60149
60361
|
populate_nodes_tree_options(gobj);
|
|
60150
60362
|
if (priv.with_treedb_tables) {}
|
|
@@ -60211,8 +60423,8 @@ function build_ui$3(gobj) {
|
|
|
60211
60423
|
[
|
|
60212
60424
|
"div",
|
|
60213
60425
|
{
|
|
60214
|
-
class: "GRAPH_LEGEND is-
|
|
60215
|
-
style: "display:flex; flex-wrap:
|
|
60426
|
+
class: "GRAPH_LEGEND is-flex-grow-0",
|
|
60427
|
+
style: "display:flex; flex-wrap:nowrap; align-items:center; gap:.35rem; padding:.3rem .5rem; overflow-x:auto; min-height:2.2rem;"
|
|
60216
60428
|
},
|
|
60217
60429
|
[]
|
|
60218
60430
|
],
|
|
@@ -60403,29 +60615,6 @@ function make_toolbar(gobj) {
|
|
|
60403
60615
|
} }
|
|
60404
60616
|
],
|
|
60405
60617
|
...yui_graph_fold_items(gobj, (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "wide")),
|
|
60406
|
-
[
|
|
60407
|
-
"button",
|
|
60408
|
-
{
|
|
60409
|
-
class: "GRAPH_LEGEND_BTN button ml-2",
|
|
60410
|
-
title: (0, i18next.t)("legend"),
|
|
60411
|
-
"aria-label": (0, i18next.t)("legend"),
|
|
60412
|
-
"data-i18n-title": "legend",
|
|
60413
|
-
"data-i18n-aria-label": "legend"
|
|
60414
|
-
},
|
|
60415
|
-
[["i", { class: "yi-square" }], [
|
|
60416
|
-
"span",
|
|
60417
|
-
{
|
|
60418
|
-
class: "is-hidden-mobile",
|
|
60419
|
-
style: "padding-left:5px;",
|
|
60420
|
-
i18n: "legend"
|
|
60421
|
-
},
|
|
60422
|
-
"legend"
|
|
60423
|
-
]],
|
|
60424
|
-
{ click: (evt) => {
|
|
60425
|
-
evt.stopPropagation();
|
|
60426
|
-
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_TOGGLE_LEGEND", {}, gobj);
|
|
60427
|
-
} }
|
|
60428
|
-
],
|
|
60429
60618
|
[
|
|
60430
60619
|
"button",
|
|
60431
60620
|
{
|
|
@@ -61455,55 +61644,185 @@ function refresh_legend(gobj) {
|
|
|
61455
61644
|
if (!$container) return;
|
|
61456
61645
|
let $legend = $container.querySelector(".GRAPH_LEGEND");
|
|
61457
61646
|
if (!$legend) return;
|
|
61458
|
-
let
|
|
61647
|
+
let state = priv._legend_state;
|
|
61459
61648
|
$legend.textContent = "";
|
|
61460
|
-
if (!
|
|
61461
|
-
|
|
61462
|
-
|
|
61463
|
-
|
|
61649
|
+
if (!state || !(0, _yuneta_gobj_js.is_array)(state.topics)) return;
|
|
61650
|
+
let topics = state.topics.slice().sort((a, b) => {
|
|
61651
|
+
return (a.topic === state.main_topic ? 0 : 1) - (b.topic === state.main_topic ? 0 : 1);
|
|
61652
|
+
});
|
|
61653
|
+
for (let entry of topics) {
|
|
61654
|
+
let topic_name = entry.topic;
|
|
61655
|
+
let is_main = topic_name === state.main_topic;
|
|
61464
61656
|
let focused = priv.focus_topic === topic_name;
|
|
61465
|
-
let
|
|
61657
|
+
let hidden = !!entry.hidden;
|
|
61658
|
+
let controls = [];
|
|
61659
|
+
controls.push(["span", {
|
|
61660
|
+
class: "GRAPH_LEGEND_SWATCH",
|
|
61661
|
+
style: `display:inline-block; width:.8rem; height:.8rem; border-radius:3px; margin-right:.35rem; flex:0 0 auto; background:${entry.color || "#94a3b8"}; border:1px solid rgba(0,0,0,.25);` + (hidden ? "opacity:.35;" : "")
|
|
61662
|
+
}], [
|
|
61663
|
+
"span",
|
|
61664
|
+
{
|
|
61665
|
+
class: "GRAPH_LEGEND_NAME",
|
|
61666
|
+
style: hidden ? "text-decoration:line-through; opacity:.6;" : ""
|
|
61667
|
+
},
|
|
61668
|
+
topic_name
|
|
61669
|
+
], [
|
|
61670
|
+
"span",
|
|
61671
|
+
{
|
|
61672
|
+
class: "GRAPH_LEGEND_COUNT has-text-grey",
|
|
61673
|
+
style: "margin-left:.35rem; font-size:.8em;"
|
|
61674
|
+
},
|
|
61675
|
+
hidden ? `${entry.total}` : `${entry.visible}/${entry.total}`
|
|
61676
|
+
]);
|
|
61677
|
+
let body_attrs = {
|
|
61678
|
+
class: "GRAPH_LEGEND_ITEM button is-small" + (focused ? " is-primary is-light" : "") + (is_main ? " GRAPH_LEGEND_MAIN" : ""),
|
|
61679
|
+
type: "button",
|
|
61680
|
+
style: "gap:0; flex:0 0 auto;",
|
|
61681
|
+
title: is_main ? (0, i18next.t)("main topic") : hidden ? (0, i18next.t)("show topic") : (0, i18next.t)("hide topic"),
|
|
61682
|
+
"aria-label": topic_name,
|
|
61683
|
+
"aria-pressed": hidden ? "false" : "true"
|
|
61684
|
+
};
|
|
61685
|
+
if (is_main) body_attrs.disabled = "disabled";
|
|
61686
|
+
let $body = (0, _yuneta_gobj_js.createElement2)([
|
|
61687
|
+
"button",
|
|
61688
|
+
body_attrs,
|
|
61689
|
+
controls,
|
|
61690
|
+
{ click: (evt) => {
|
|
61691
|
+
evt.stopPropagation();
|
|
61692
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_LEGEND_TOPIC", {
|
|
61693
|
+
topic: topic_name,
|
|
61694
|
+
action: "toggle"
|
|
61695
|
+
}, gobj);
|
|
61696
|
+
} }
|
|
61697
|
+
]);
|
|
61698
|
+
let extras = [];
|
|
61699
|
+
if (is_main && state.main_chosen) extras.push([
|
|
61700
|
+
"button",
|
|
61701
|
+
{
|
|
61702
|
+
class: "GRAPH_LEGEND_STAR button is-small is-warning is-light",
|
|
61703
|
+
type: "button",
|
|
61704
|
+
style: "padding:0 .4rem;",
|
|
61705
|
+
title: (0, i18next.t)("main topic"),
|
|
61706
|
+
"data-i18n-title": "main topic",
|
|
61707
|
+
"aria-label": (0, i18next.t)("main topic"),
|
|
61708
|
+
"aria-pressed": "true"
|
|
61709
|
+
},
|
|
61710
|
+
"★",
|
|
61711
|
+
{ click: (evt) => {
|
|
61712
|
+
evt.stopPropagation();
|
|
61713
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_LEGEND_TOPIC", {
|
|
61714
|
+
topic: "",
|
|
61715
|
+
action: "main"
|
|
61716
|
+
}, gobj);
|
|
61717
|
+
} }
|
|
61718
|
+
]);
|
|
61719
|
+
else if (is_main) extras.push([
|
|
61720
|
+
"span",
|
|
61721
|
+
{
|
|
61722
|
+
class: "GRAPH_LEGEND_STAR button is-small is-static",
|
|
61723
|
+
style: "padding:0 .4rem;",
|
|
61724
|
+
title: (0, i18next.t)("main topic"),
|
|
61725
|
+
"data-i18n-title": "main topic"
|
|
61726
|
+
},
|
|
61727
|
+
"★"
|
|
61728
|
+
]);
|
|
61729
|
+
else if (!hidden) extras.push([
|
|
61466
61730
|
"button",
|
|
61467
61731
|
{
|
|
61468
|
-
class: "
|
|
61469
|
-
|
|
61470
|
-
"
|
|
61732
|
+
class: "GRAPH_LEGEND_STAR button is-small",
|
|
61733
|
+
type: "button",
|
|
61734
|
+
style: "padding:0 .4rem;",
|
|
61735
|
+
title: (0, i18next.t)("main topic"),
|
|
61736
|
+
"data-i18n-title": "main topic",
|
|
61737
|
+
"aria-label": (0, i18next.t)("main topic")
|
|
61738
|
+
},
|
|
61739
|
+
"☆",
|
|
61740
|
+
{ click: (evt) => {
|
|
61741
|
+
evt.stopPropagation();
|
|
61742
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_LEGEND_TOPIC", {
|
|
61743
|
+
topic: topic_name,
|
|
61744
|
+
action: "main"
|
|
61745
|
+
}, gobj);
|
|
61746
|
+
} }
|
|
61747
|
+
]);
|
|
61748
|
+
if (!hidden && entry.linked && entry.loose > 0) extras.push([
|
|
61749
|
+
"button",
|
|
61750
|
+
{
|
|
61751
|
+
class: "GRAPH_LEGEND_LOOSE button is-small" + (entry.loose_shown ? " is-warning is-light" : ""),
|
|
61752
|
+
type: "button",
|
|
61753
|
+
style: "padding:0 .45rem;",
|
|
61754
|
+
title: (0, i18next.t)("loose records"),
|
|
61755
|
+
"data-i18n-title": "loose records",
|
|
61756
|
+
"aria-label": (0, i18next.t)("loose records"),
|
|
61757
|
+
"aria-pressed": entry.loose_shown ? "true" : "false"
|
|
61758
|
+
},
|
|
61759
|
+
`+${entry.loose}`,
|
|
61760
|
+
{ click: (evt) => {
|
|
61761
|
+
evt.stopPropagation();
|
|
61762
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_LEGEND_TOPIC", {
|
|
61763
|
+
topic: topic_name,
|
|
61764
|
+
action: "loose"
|
|
61765
|
+
}, gobj);
|
|
61766
|
+
} }
|
|
61767
|
+
]);
|
|
61768
|
+
if (!hidden) extras.push([
|
|
61769
|
+
"button",
|
|
61770
|
+
{
|
|
61771
|
+
class: "GRAPH_LEGEND_FOCUS button is-small" + (focused ? " is-primary is-light" : ""),
|
|
61772
|
+
type: "button",
|
|
61773
|
+
style: "padding:0 .4rem;",
|
|
61774
|
+
title: (0, i18next.t)("highlight topic"),
|
|
61775
|
+
"data-i18n-title": "highlight topic",
|
|
61776
|
+
"aria-label": (0, i18next.t)("highlight topic"),
|
|
61471
61777
|
"aria-pressed": focused ? "true" : "false"
|
|
61472
61778
|
},
|
|
61473
|
-
[["
|
|
61474
|
-
class: "GRAPH_LEGEND_SWATCH",
|
|
61475
|
-
style: `display:inline-block; width:.8rem; height:.8rem; border-radius:3px; margin-right:.4rem; background:${desc.color}; border:1px solid rgba(0,0,0,.25);`
|
|
61476
|
-
}], [
|
|
61477
|
-
"span",
|
|
61478
|
-
{},
|
|
61479
|
-
topic_name
|
|
61480
|
-
]],
|
|
61779
|
+
[["i", { class: "yi-location-crosshairs" }]],
|
|
61481
61780
|
{ click: (evt) => {
|
|
61482
61781
|
evt.stopPropagation();
|
|
61483
|
-
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_LEGEND_TOPIC", {
|
|
61782
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_LEGEND_TOPIC", {
|
|
61783
|
+
topic: topic_name,
|
|
61784
|
+
action: "focus"
|
|
61785
|
+
}, gobj);
|
|
61484
61786
|
} }
|
|
61485
61787
|
]);
|
|
61486
|
-
$
|
|
61788
|
+
let $chip = (0, _yuneta_gobj_js.createElement2)([
|
|
61789
|
+
"div",
|
|
61790
|
+
{
|
|
61791
|
+
class: "GRAPH_LEGEND_CHIP buttons has-addons",
|
|
61792
|
+
style: "margin:0; flex:0 0 auto; flex-wrap:nowrap;"
|
|
61793
|
+
},
|
|
61794
|
+
[$body].concat(extras.map((spec) => (0, _yuneta_gobj_js.createElement2)(spec)))
|
|
61795
|
+
]);
|
|
61796
|
+
$legend.appendChild($chip);
|
|
61487
61797
|
}
|
|
61488
61798
|
}
|
|
61489
61799
|
/************************************************************
|
|
61490
|
-
*
|
|
61800
|
+
* The engine said what is drawn: repaint the strip.
|
|
61491
61801
|
************************************************************/
|
|
61492
|
-
function
|
|
61493
|
-
let
|
|
61494
|
-
|
|
61495
|
-
|
|
61496
|
-
if (!$legend) {
|
|
61497
|
-
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: no legend strip to toggle`);
|
|
61498
|
-
return -1;
|
|
61499
|
-
}
|
|
61500
|
-
if ($legend.classList.contains("is-hidden")) {
|
|
61501
|
-
refresh_legend(gobj);
|
|
61502
|
-
$legend.classList.remove("is-hidden");
|
|
61503
|
-
} else $legend.classList.add("is-hidden");
|
|
61802
|
+
function ac_legend_state(gobj, event, kw, src) {
|
|
61803
|
+
let priv = gobj.priv;
|
|
61804
|
+
priv._legend_state = kw || null;
|
|
61805
|
+
refresh_legend(gobj);
|
|
61504
61806
|
return 0;
|
|
61505
61807
|
}
|
|
61506
61808
|
/************************************************************
|
|
61809
|
+
*
|
|
61810
|
+
************************************************************/
|
|
61811
|
+
/************************************************************
|
|
61812
|
+
* One of the legend's settings changed: write it, SAVE it (they
|
|
61813
|
+
* are the reader's, per treedb) and tell the engine.
|
|
61814
|
+
************************************************************/
|
|
61815
|
+
function set_legend_list_attr(gobj, name, event_name, topics) {
|
|
61816
|
+
let priv = gobj.priv;
|
|
61817
|
+
(0, _yuneta_gobj_js.gobj_write_attr)(gobj, name, topics);
|
|
61818
|
+
(0, _yuneta_gobj_js.gobj_save_persistent_attrs)(gobj, name);
|
|
61819
|
+
if (priv.gobj_nodes_tree) (0, _yuneta_gobj_js.gobj_send_event)(priv.gobj_nodes_tree, event_name, { topics }, gobj);
|
|
61820
|
+
}
|
|
61821
|
+
function legend_list_attr(gobj, name) {
|
|
61822
|
+
let list = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, name);
|
|
61823
|
+
return (0, _yuneta_gobj_js.is_array)(list) ? list.slice() : [];
|
|
61824
|
+
}
|
|
61825
|
+
/************************************************************
|
|
61507
61826
|
* A legend entry was clicked: focus that topic, or clear the focus if
|
|
61508
61827
|
* it was already the focused one. Published UP rather than applied
|
|
61509
61828
|
* here, so the URL follows — the host owns the route.
|
|
@@ -61511,12 +61830,46 @@ function ac_toggle_legend(gobj, event, kw, src) {
|
|
|
61511
61830
|
function ac_legend_topic(gobj, event, kw, src) {
|
|
61512
61831
|
let priv = gobj.priv;
|
|
61513
61832
|
let topic = kw && kw.topic || "";
|
|
61514
|
-
|
|
61833
|
+
let action = kw && kw.action || "focus";
|
|
61834
|
+
if (!topic && action !== "main") {
|
|
61515
61835
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: legend click with no topic`);
|
|
61516
61836
|
return -1;
|
|
61517
61837
|
}
|
|
61838
|
+
let state = priv._legend_state || {};
|
|
61839
|
+
switch (action) {
|
|
61840
|
+
case "toggle": {
|
|
61841
|
+
if (topic === state.main_topic) {
|
|
61842
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: the main topic '${topic}' cannot be hidden`);
|
|
61843
|
+
return -1;
|
|
61844
|
+
}
|
|
61845
|
+
let hidden = legend_list_attr(gobj, "hidden_topics");
|
|
61846
|
+
if ((0, _yuneta_gobj_js.str_in_list)(hidden, topic)) (0, _yuneta_gobj_js.delete_from_list)(hidden, topic);
|
|
61847
|
+
else hidden.push(topic);
|
|
61848
|
+
set_legend_list_attr(gobj, "hidden_topics", "EV_SET_HIDDEN_TOPICS", hidden);
|
|
61849
|
+
return 0;
|
|
61850
|
+
}
|
|
61851
|
+
case "loose": {
|
|
61852
|
+
let loose = legend_list_attr(gobj, "loose_topics");
|
|
61853
|
+
if ((0, _yuneta_gobj_js.str_in_list)(loose, topic)) (0, _yuneta_gobj_js.delete_from_list)(loose, topic);
|
|
61854
|
+
else loose.push(topic);
|
|
61855
|
+
set_legend_list_attr(gobj, "loose_topics", "EV_SET_LOOSE_TOPICS", loose);
|
|
61856
|
+
return 0;
|
|
61857
|
+
}
|
|
61858
|
+
case "main":
|
|
61859
|
+
(0, _yuneta_gobj_js.gobj_write_str_attr)(gobj, "main_topic", topic);
|
|
61860
|
+
(0, _yuneta_gobj_js.gobj_save_persistent_attrs)(gobj, "main_topic");
|
|
61861
|
+
if (priv.gobj_nodes_tree) (0, _yuneta_gobj_js.gobj_send_event)(priv.gobj_nodes_tree, "EV_SET_MAIN_TOPIC", { topic }, gobj);
|
|
61862
|
+
return 0;
|
|
61863
|
+
case "focus": break;
|
|
61864
|
+
default:
|
|
61865
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: legend action unknown: ${action}`);
|
|
61866
|
+
return -1;
|
|
61867
|
+
}
|
|
61518
61868
|
let next = priv.focus_topic === topic ? "" : topic;
|
|
61519
|
-
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_SET_FOCUS_TOPIC", {
|
|
61869
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_SET_FOCUS_TOPIC", {
|
|
61870
|
+
topic: next,
|
|
61871
|
+
reveal: "all"
|
|
61872
|
+
}, gobj);
|
|
61520
61873
|
(0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_TOPIC_SELECTED", { topic: next });
|
|
61521
61874
|
return 0;
|
|
61522
61875
|
}
|
|
@@ -61572,17 +61925,28 @@ function ac_find_result(gobj, event, kw, src) {
|
|
|
61572
61925
|
$count.textContent = "";
|
|
61573
61926
|
return 0;
|
|
61574
61927
|
}
|
|
61575
|
-
|
|
61928
|
+
let text = (0, i18next.t)("matches", { count: kw && kw.matches || 0 });
|
|
61929
|
+
let hidden = kw && kw.hidden_matches || 0;
|
|
61930
|
+
if (hidden > 0) text += ` (+${hidden} ${(0, i18next.t)("hidden topics")})`;
|
|
61931
|
+
$count.textContent = text;
|
|
61576
61932
|
$result.classList.remove("is-hidden");
|
|
61577
61933
|
return 0;
|
|
61578
61934
|
}
|
|
61579
61935
|
function ac_set_focus_topic(gobj, event, kw, src) {
|
|
61580
61936
|
let priv = gobj.priv;
|
|
61581
61937
|
priv.focus_topic = kw && kw.topic || "";
|
|
61582
|
-
if (priv.
|
|
61583
|
-
|
|
61584
|
-
|
|
61585
|
-
|
|
61938
|
+
if (priv.focus_topic) {
|
|
61939
|
+
let hidden = legend_list_attr(gobj, "hidden_topics");
|
|
61940
|
+
if ((0, _yuneta_gobj_js.str_in_list)(hidden, priv.focus_topic)) {
|
|
61941
|
+
(0, _yuneta_gobj_js.delete_from_list)(hidden, priv.focus_topic);
|
|
61942
|
+
set_legend_list_attr(gobj, "hidden_topics", "EV_SET_HIDDEN_TOPICS", hidden);
|
|
61943
|
+
}
|
|
61944
|
+
}
|
|
61945
|
+
if (priv.gobj_nodes_tree) (0, _yuneta_gobj_js.gobj_send_event)(priv.gobj_nodes_tree, "EV_FOCUS_TOPIC", {
|
|
61946
|
+
topic: priv.focus_topic,
|
|
61947
|
+
reveal: kw && kw.reveal || "page"
|
|
61948
|
+
}, gobj);
|
|
61949
|
+
refresh_legend(gobj);
|
|
61586
61950
|
return 0;
|
|
61587
61951
|
}
|
|
61588
61952
|
/************************************************************
|
|
@@ -61766,13 +62130,13 @@ function create_gclass$3(gclass_name) {
|
|
|
61766
62130
|
null
|
|
61767
62131
|
],
|
|
61768
62132
|
[
|
|
61769
|
-
"
|
|
61770
|
-
|
|
62133
|
+
"EV_LEGEND_TOPIC",
|
|
62134
|
+
ac_legend_topic,
|
|
61771
62135
|
null
|
|
61772
62136
|
],
|
|
61773
62137
|
[
|
|
61774
|
-
"
|
|
61775
|
-
|
|
62138
|
+
"EV_LEGEND_STATE",
|
|
62139
|
+
ac_legend_state,
|
|
61776
62140
|
null
|
|
61777
62141
|
],
|
|
61778
62142
|
[
|
|
@@ -61826,8 +62190,8 @@ function create_gclass$3(gclass_name) {
|
|
|
61826
62190
|
["EV_COLLAPSE_ALL", 0],
|
|
61827
62191
|
["EV_FIND_RESULT", 0],
|
|
61828
62192
|
["EV_LAYOUT_AUTOSET", 0],
|
|
61829
|
-
["EV_TOGGLE_LEGEND", 0],
|
|
61830
62193
|
["EV_LEGEND_TOPIC", 0],
|
|
62194
|
+
["EV_LEGEND_STATE", 0],
|
|
61831
62195
|
["EV_TOPIC_SELECTED", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS],
|
|
61832
62196
|
["EV_OPERATION_MODE_CHANGED", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS],
|
|
61833
62197
|
["EV_RECORD_WRITTEN", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS],
|