@yuneta/gobj-ui 7.23.83 → 7.23.85
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 +47 -7
- package/dist/gobj-ui.cjs.js +281 -104
- package/dist/gobj-ui.es.js +281 -104
- package/package.json +1 -1
- package/src/c_g6_nodes_tree.js +267 -88
- package/src/c_yui_treedb_graph.js +59 -3
- package/src/treedb_layout.js +55 -16
- package/src/treedb_layout.test.js +15 -0
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -13987,7 +13987,7 @@ function ac_json_item_clicked(gobj, event, kw, src) {
|
|
|
13987
13987
|
/************************************************************
|
|
13988
13988
|
* EV_LANGUAGE_CHANGED — re-translate chrome + re-render
|
|
13989
13989
|
************************************************************/
|
|
13990
|
-
function ac_language_changed$
|
|
13990
|
+
function ac_language_changed$8(gobj, event, kw, src) {
|
|
13991
13991
|
let priv = gobj.priv;
|
|
13992
13992
|
let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
|
|
13993
13993
|
if ($container) {
|
|
@@ -14048,7 +14048,7 @@ function create_gclass$12(gclass_name) {
|
|
|
14048
14048
|
],
|
|
14049
14049
|
[
|
|
14050
14050
|
"EV_LANGUAGE_CHANGED",
|
|
14051
|
-
ac_language_changed$
|
|
14051
|
+
ac_language_changed$8,
|
|
14052
14052
|
null
|
|
14053
14053
|
],
|
|
14054
14054
|
[
|
|
@@ -14124,7 +14124,7 @@ function create_gclass$12(gclass_name) {
|
|
|
14124
14124
|
],
|
|
14125
14125
|
[
|
|
14126
14126
|
"EV_LANGUAGE_CHANGED",
|
|
14127
|
-
ac_language_changed$
|
|
14127
|
+
ac_language_changed$8,
|
|
14128
14128
|
null
|
|
14129
14129
|
],
|
|
14130
14130
|
[
|
|
@@ -15063,7 +15063,7 @@ function ac_theme_changed(gobj, event, kw, src) {
|
|
|
15063
15063
|
* inside an innerHTML string, where refresh_language()
|
|
15064
15064
|
* cannot reach.
|
|
15065
15065
|
************************************************************/
|
|
15066
|
-
function ac_language_changed$
|
|
15066
|
+
function ac_language_changed$7(gobj, event, kw, src) {
|
|
15067
15067
|
let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
|
|
15068
15068
|
if ($container) (0, _yuneta_gobj_js.refresh_language)($container, i18next.t);
|
|
15069
15069
|
load_fsm(gobj);
|
|
@@ -15170,7 +15170,7 @@ function create_gclass$11(gclass_name) {
|
|
|
15170
15170
|
],
|
|
15171
15171
|
[
|
|
15172
15172
|
"EV_LANGUAGE_CHANGED",
|
|
15173
|
-
ac_language_changed$
|
|
15173
|
+
ac_language_changed$7,
|
|
15174
15174
|
null
|
|
15175
15175
|
],
|
|
15176
15176
|
[
|
|
@@ -16727,7 +16727,7 @@ function ac_copy_all(gobj, event, kw, src) {
|
|
|
16727
16727
|
* is. Re-rendering is the only way both end up in the same
|
|
16728
16728
|
* language.
|
|
16729
16729
|
************************************************************/
|
|
16730
|
-
function ac_language_changed$
|
|
16730
|
+
function ac_language_changed$6(gobj, event, kw, src) {
|
|
16731
16731
|
let priv = gobj.priv;
|
|
16732
16732
|
let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
|
|
16733
16733
|
if ($container) {
|
|
@@ -16819,7 +16819,7 @@ function create_gclass$10(gclass_name) {
|
|
|
16819
16819
|
],
|
|
16820
16820
|
[
|
|
16821
16821
|
"EV_LANGUAGE_CHANGED",
|
|
16822
|
-
ac_language_changed$
|
|
16822
|
+
ac_language_changed$6,
|
|
16823
16823
|
null
|
|
16824
16824
|
],
|
|
16825
16825
|
[
|
|
@@ -19403,7 +19403,7 @@ function ac_gclass_closed(gobj, event, kw, src) {
|
|
|
19403
19403
|
* A rebuild, not a re-translation: the words live inside the
|
|
19404
19404
|
* innerHTML of G6 nodes, where refresh_language() cannot go.
|
|
19405
19405
|
************************************************************/
|
|
19406
|
-
function ac_language_changed$
|
|
19406
|
+
function ac_language_changed$5(gobj, event, kw, src) {
|
|
19407
19407
|
let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
|
|
19408
19408
|
if ($container) (0, _yuneta_gobj_js.refresh_language)($container, i18next.t);
|
|
19409
19409
|
hide_popover(gobj);
|
|
@@ -19547,7 +19547,7 @@ function create_gclass$9(gclass_name) {
|
|
|
19547
19547
|
],
|
|
19548
19548
|
[
|
|
19549
19549
|
"EV_LANGUAGE_CHANGED",
|
|
19550
|
-
ac_language_changed$
|
|
19550
|
+
ac_language_changed$5,
|
|
19551
19551
|
null
|
|
19552
19552
|
]
|
|
19553
19553
|
]]], gmt$9, 0, attrs_table$9, PRIVATE_DATA$9, 0, 0, 0, 0);
|
|
@@ -25735,7 +25735,7 @@ function refuse_if_readonly$2(gobj, event) {
|
|
|
25735
25735
|
* placeholder, its loading/error notices — drawn once, from its own lang
|
|
25736
25736
|
* dict. Re-apply it in the new language.
|
|
25737
25737
|
***************************************************************/
|
|
25738
|
-
function ac_language_changed$
|
|
25738
|
+
function ac_language_changed$4(gobj, event, kw, src) {
|
|
25739
25739
|
let bar = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "selection_bar");
|
|
25740
25740
|
if (bar) bar.refresh();
|
|
25741
25741
|
let tabulator = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "tabulator");
|
|
@@ -26573,7 +26573,7 @@ function create_gclass$5(gclass_name) {
|
|
|
26573
26573
|
const states = [["ST_IDLE", [
|
|
26574
26574
|
[
|
|
26575
26575
|
"EV_LANGUAGE_CHANGED",
|
|
26576
|
-
ac_language_changed$
|
|
26576
|
+
ac_language_changed$4,
|
|
26577
26577
|
null
|
|
26578
26578
|
],
|
|
26579
26579
|
[
|
|
@@ -27420,8 +27420,10 @@ function fold_reveal(model, state, node_key) {
|
|
|
27420
27420
|
*
|
|
27421
27421
|
* `radial`: the root in the middle and a ring per depth, each
|
|
27422
27422
|
* subtree owning a sector proportional to its leaves; the radius
|
|
27423
|
-
* of a ring grows until its neighbours sit side by side
|
|
27424
|
-
* nothing overlaps by
|
|
27423
|
+
* of a ring grows until its neighbours sit side by side AND
|
|
27424
|
+
* until it clears the ring inside it, so nothing overlaps by
|
|
27425
|
+
* construction, across the ring or along the radius (see
|
|
27426
|
+
* `layout_radial`).
|
|
27425
27427
|
*
|
|
27426
27428
|
* Pure: takes plain nodes and edges, returns positions. The G6
|
|
27427
27429
|
* classes in c_g6_nodes_tree.js are two thin adapters over it.
|
|
@@ -27601,6 +27603,10 @@ function tidy_tree_lr(nodes, edges, o) {
|
|
|
27601
27603
|
}
|
|
27602
27604
|
return pos;
|
|
27603
27605
|
}
|
|
27606
|
+
function extent_at(n, a) {
|
|
27607
|
+
if (!n) return 0;
|
|
27608
|
+
return Math.abs(n.w * Math.cos(a)) + Math.abs(n.h * Math.sin(a));
|
|
27609
|
+
}
|
|
27604
27610
|
/************************************************************
|
|
27605
27611
|
* The radial tree: the root in the middle, a ring per depth.
|
|
27606
27612
|
*
|
|
@@ -27643,14 +27649,15 @@ function layout_radial(nodes, edges, opts) {
|
|
|
27643
27649
|
let ring_of = (id) => t.depth.get(id) + (single ? 0 : 1);
|
|
27644
27650
|
let angle = /* @__PURE__ */ new Map();
|
|
27645
27651
|
let rings = [];
|
|
27646
|
-
let sector = (root_id, root_from, root_span) => {
|
|
27652
|
+
let sector = (root_id, root_from, root_span, root_parent) => {
|
|
27647
27653
|
let stack = [{
|
|
27648
27654
|
id: root_id,
|
|
27649
27655
|
from: root_from,
|
|
27650
|
-
span: root_span
|
|
27656
|
+
span: root_span,
|
|
27657
|
+
parent: root_parent
|
|
27651
27658
|
}];
|
|
27652
27659
|
while (stack.length) {
|
|
27653
|
-
let { id, from, span } = stack.pop();
|
|
27660
|
+
let { id, from, span, parent } = stack.pop();
|
|
27654
27661
|
let a = from + span / 2;
|
|
27655
27662
|
angle.set(id, a);
|
|
27656
27663
|
let ring = ring_of(id);
|
|
@@ -27659,7 +27666,9 @@ function layout_radial(nodes, edges, opts) {
|
|
|
27659
27666
|
rings[ring].push({
|
|
27660
27667
|
id,
|
|
27661
27668
|
angle: a,
|
|
27662
|
-
diag: Math.hypot(n.w, n.h)
|
|
27669
|
+
diag: Math.hypot(n.w, n.h),
|
|
27670
|
+
ext: extent_at(n, a),
|
|
27671
|
+
parent_ext: parent ? extent_at(t.by_id.get(parent), a) : 0
|
|
27663
27672
|
});
|
|
27664
27673
|
let cursor = from;
|
|
27665
27674
|
for (let kid of t.children.get(id) || []) {
|
|
@@ -27667,7 +27676,8 @@ function layout_radial(nodes, edges, opts) {
|
|
|
27667
27676
|
stack.push({
|
|
27668
27677
|
id: kid,
|
|
27669
27678
|
from: cursor,
|
|
27670
|
-
span: part
|
|
27679
|
+
span: part,
|
|
27680
|
+
parent: id
|
|
27671
27681
|
});
|
|
27672
27682
|
cursor += part;
|
|
27673
27683
|
}
|
|
@@ -27679,20 +27689,21 @@ function layout_radial(nodes, edges, opts) {
|
|
|
27679
27689
|
let cursor = -Math.PI / 2;
|
|
27680
27690
|
for (let kid of t.children.get(root) || []) {
|
|
27681
27691
|
let part = 2 * Math.PI * leaves.get(kid) / leaves.get(root);
|
|
27682
|
-
sector(kid, cursor, part);
|
|
27692
|
+
sector(kid, cursor, part, root);
|
|
27683
27693
|
cursor += part;
|
|
27684
27694
|
}
|
|
27685
27695
|
} else {
|
|
27686
27696
|
let cursor = -Math.PI / 2;
|
|
27687
27697
|
for (let root of t.roots) {
|
|
27688
27698
|
let part = 2 * Math.PI * leaves.get(root) / total;
|
|
27689
|
-
sector(root, cursor, part);
|
|
27699
|
+
sector(root, cursor, part, null);
|
|
27690
27700
|
cursor += part;
|
|
27691
27701
|
}
|
|
27692
27702
|
}
|
|
27693
27703
|
let radius = [0];
|
|
27694
27704
|
for (let ring = 1; ring < rings.length; ring++) {
|
|
27695
27705
|
let r = radius[ring - 1] + o.ranksep;
|
|
27706
|
+
for (let n of rings[ring] || []) r = Math.max(r, radius[ring - 1] + (n.parent_ext + n.ext) / 2 + o.nodesep);
|
|
27696
27707
|
let list = (rings[ring] || []).slice().sort((a, b) => a.angle - b.angle);
|
|
27697
27708
|
for (let i = 0; i < list.length && list.length > 1; i++) {
|
|
27698
27709
|
let a = list[i];
|
|
@@ -54678,11 +54689,14 @@ var PRIVATE_DATA$4 = {
|
|
|
54678
54689
|
_edge_icon_el: null,
|
|
54679
54690
|
_edge_delete_el: null,
|
|
54680
54691
|
_edge_popover_el: null,
|
|
54692
|
+
_edge_preview_undo: null,
|
|
54681
54693
|
_port_icon_el: null,
|
|
54682
54694
|
_port_popover_el: null,
|
|
54695
|
+
_port_preview_undo: null,
|
|
54683
54696
|
_node_icon_el: null,
|
|
54684
54697
|
_node_delete_el: null,
|
|
54685
54698
|
_node_popover_el: null,
|
|
54699
|
+
_node_preview_undo: null,
|
|
54686
54700
|
_node_detail_el: null,
|
|
54687
54701
|
_detail_node_id: null,
|
|
54688
54702
|
_delete_confirm_el: null,
|
|
@@ -54766,12 +54780,16 @@ function mt_writing$1(gobj, path) {
|
|
|
54766
54780
|
* Framework Method: Start
|
|
54767
54781
|
***************************************************************/
|
|
54768
54782
|
function mt_start$4(gobj) {
|
|
54783
|
+
let shell = yui_shell_of(gobj);
|
|
54784
|
+
if (shell) (0, _yuneta_gobj_js.gobj_subscribe_event)(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
|
|
54769
54785
|
return 0;
|
|
54770
54786
|
}
|
|
54771
54787
|
/***************************************************************
|
|
54772
54788
|
* Framework Method: Stop
|
|
54773
54789
|
***************************************************************/
|
|
54774
54790
|
function mt_stop$4(gobj) {
|
|
54791
|
+
let shell = yui_shell_of(gobj);
|
|
54792
|
+
if (shell) (0, _yuneta_gobj_js.gobj_unsubscribe_event)(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
|
|
54775
54793
|
return 0;
|
|
54776
54794
|
}
|
|
54777
54795
|
/***************************************************************
|
|
@@ -54779,10 +54797,6 @@ function mt_stop$4(gobj) {
|
|
|
54779
54797
|
***************************************************************/
|
|
54780
54798
|
function mt_destroy$4(gobj) {
|
|
54781
54799
|
let priv = gobj.priv;
|
|
54782
|
-
if (priv._on_language_changed) {
|
|
54783
|
-
i18next.default.off("languageChanged", priv._on_language_changed);
|
|
54784
|
-
priv._on_language_changed = null;
|
|
54785
|
-
}
|
|
54786
54800
|
uninstall_fold_listener(gobj);
|
|
54787
54801
|
if (priv._on_pointerdown_focus) {
|
|
54788
54802
|
priv.$container.removeEventListener("pointerdown", priv._on_pointerdown_focus, true);
|
|
@@ -54977,11 +54991,6 @@ function configure_events(gobj) {
|
|
|
54977
54991
|
priv.last_zoom = z;
|
|
54978
54992
|
if (priv.anchor_state === "on" && priv.anchor_id) yui_graph_center_on(priv.graph, priv.anchor_id);
|
|
54979
54993
|
});
|
|
54980
|
-
priv._on_language_changed = () => {
|
|
54981
|
-
update_toolbar(gobj);
|
|
54982
|
-
repaint_more_chips(gobj);
|
|
54983
|
-
};
|
|
54984
|
-
i18next.default.on("languageChanged", priv._on_language_changed);
|
|
54985
54994
|
priv._on_pointerdown_focus = (ev) => {
|
|
54986
54995
|
let target = ev.target;
|
|
54987
54996
|
if (target && typeof target.closest === "function") {
|
|
@@ -55499,12 +55508,23 @@ var LR_LAYOUTS = ["dagre"];
|
|
|
55499
55508
|
* toolbar's +/-, and the two-finger pinch of g6_touch_gestures.
|
|
55500
55509
|
* `enable` on the scroll keeps the two apart: a Ctrl wheel is
|
|
55501
55510
|
* the zoom's, so the scroll stands aside for it.
|
|
55511
|
+
*
|
|
55512
|
+
* And the two have to name the SAME key, or the gesture falls
|
|
55513
|
+
* between them: the scroll stood aside for Meta as well, while
|
|
55514
|
+
* the zoom listened for Control alone, so Cmd + wheel neither
|
|
55515
|
+
* scrolled nor zoomed. It is ONE key and not two because a G6
|
|
55516
|
+
* `trigger` is a CHORD, not a list of alternatives -- its
|
|
55517
|
+
* `Shortcut.match()` compares the held keys to the bound ones
|
|
55518
|
+
* as a SET, so ["Control", "Meta"] means both keys down at
|
|
55519
|
+
* once. Control it is, on every platform: it is what a
|
|
55520
|
+
* trackpad pinch arrives as, so a Mac keeps its pinch and
|
|
55521
|
+
* gains nothing to press by mistake.
|
|
55502
55522
|
************************************************************/
|
|
55503
55523
|
function camera_behaviors() {
|
|
55504
55524
|
return [{
|
|
55505
55525
|
type: "scroll-canvas",
|
|
55506
55526
|
key: "scroll-canvas",
|
|
55507
|
-
enable: (event) => !(event &&
|
|
55527
|
+
enable: (event) => !(event && event.ctrlKey)
|
|
55508
55528
|
}, {
|
|
55509
55529
|
type: "zoom-canvas",
|
|
55510
55530
|
key: "zoom-canvas",
|
|
@@ -55636,6 +55656,52 @@ function topic_defaults_of(gobj, topic_name) {
|
|
|
55636
55656
|
return (0, _yuneta_gobj_js.is_object)(topic_props) && (0, _yuneta_gobj_js.is_object)(topic_props.defaults) ? topic_props.defaults : null;
|
|
55637
55657
|
}
|
|
55638
55658
|
/************************************************************
|
|
55659
|
+
* What a node is PAINTED with: its own colours, then the
|
|
55660
|
+
* topic's default, then the topic's colour.
|
|
55661
|
+
*
|
|
55662
|
+
* A card is html, and its html was built with `desc.color`
|
|
55663
|
+
* every time it was repainted -- so a colour chosen in the node
|
|
55664
|
+
* properties popover lasted until the next selection, focus,
|
|
55665
|
+
* theme or pill change, and was never written to `__graphs__`
|
|
55666
|
+
* at all. Only the `shape` view kept it, because a figure is a
|
|
55667
|
+
* native G6 node and `style.fill` is what paints it. The FIGURE
|
|
55668
|
+
* was already remembered (`node_shape`); this is the wiring the
|
|
55669
|
+
* colour was missing.
|
|
55670
|
+
************************************************************/
|
|
55671
|
+
function node_paint_of(gobj, desc, geometry) {
|
|
55672
|
+
let defaults = topic_defaults_of(gobj, desc.topic_name);
|
|
55673
|
+
let g = (0, _yuneta_gobj_js.is_object)(geometry) ? geometry : {};
|
|
55674
|
+
let fill = g.fill || defaults && defaults.fill || desc.color;
|
|
55675
|
+
return {
|
|
55676
|
+
fill,
|
|
55677
|
+
stroke: g.stroke || defaults && defaults.stroke || getStrokeColor(fill),
|
|
55678
|
+
lineWidth: g.lineWidth || defaults && defaults.lineWidth || 1
|
|
55679
|
+
};
|
|
55680
|
+
}
|
|
55681
|
+
/************************************************************
|
|
55682
|
+
* Write a chosen paint into an entry of `__graphs__` -- a
|
|
55683
|
+
* node's or a topic's defaults.
|
|
55684
|
+
*
|
|
55685
|
+
* A colour nobody chose is not saved: the topic's own colour,
|
|
55686
|
+
* with the stroke and the line width that go with it, is what a
|
|
55687
|
+
* card wears anyway, and writing it down would freeze today's
|
|
55688
|
+
* palette on that card -- the trap the SIZES fell into in
|
|
55689
|
+
* 7.23.80, and the palette is assigned by POSITION (`ac_descs`),
|
|
55690
|
+
* so it moves when a topic is added. Choosing it back MEANS
|
|
55691
|
+
* forgetting the entry.
|
|
55692
|
+
************************************************************/
|
|
55693
|
+
function paint_into(entry, desc, fill, stroke, line_width) {
|
|
55694
|
+
if (fill === desc.color && stroke === getStrokeColor(desc.color) && line_width === 1) {
|
|
55695
|
+
delete entry.fill;
|
|
55696
|
+
delete entry.stroke;
|
|
55697
|
+
delete entry.lineWidth;
|
|
55698
|
+
return;
|
|
55699
|
+
}
|
|
55700
|
+
entry.fill = fill;
|
|
55701
|
+
entry.stroke = stroke;
|
|
55702
|
+
entry.lineWidth = line_width;
|
|
55703
|
+
}
|
|
55704
|
+
/************************************************************
|
|
55639
55705
|
* The CARD: an html node, the tier's size, the ports, the
|
|
55640
55706
|
* saved geometry on top. The flags (focus, selection, anchor)
|
|
55641
55707
|
* are not painted here: repaint_cards() reads them where they
|
|
@@ -55646,10 +55712,11 @@ function card_shape_of(gobj, desc, record, geometry, pills_html) {
|
|
|
55646
55712
|
let node_treedb_type = desc.node_treedb_type;
|
|
55647
55713
|
let label = node_label(desc, record);
|
|
55648
55714
|
let ports = build_ports(gobj, desc);
|
|
55715
|
+
let paint = node_paint_of(gobj, desc, geometry);
|
|
55649
55716
|
let style = {
|
|
55650
|
-
fill:
|
|
55651
|
-
stroke:
|
|
55652
|
-
lineWidth:
|
|
55717
|
+
fill: paint.fill,
|
|
55718
|
+
stroke: paint.stroke,
|
|
55719
|
+
lineWidth: paint.lineWidth,
|
|
55653
55720
|
lineDash: [],
|
|
55654
55721
|
halo: false,
|
|
55655
55722
|
labelText: ""
|
|
@@ -55658,9 +55725,9 @@ function card_shape_of(gobj, desc, record, geometry, pills_html) {
|
|
|
55658
55725
|
style.size = size;
|
|
55659
55726
|
style.dx = -size[0] / 2;
|
|
55660
55727
|
style.dy = -size[1] / 2;
|
|
55661
|
-
if (node_treedb_type === "child") style.innerHTML = build_chip_innerHTML(
|
|
55662
|
-
else if (node_treedb_type === "extended") style.innerHTML = build_node_innerHTML(
|
|
55663
|
-
else style.innerHTML = build_node_innerHTML(
|
|
55728
|
+
if (node_treedb_type === "child") style.innerHTML = build_chip_innerHTML(paint.fill, priv.theme, record.icon, label, record.id);
|
|
55729
|
+
else if (node_treedb_type === "extended") style.innerHTML = build_node_innerHTML(paint.fill, priv.theme, record.icon, label, desc.topic_name, true, record.id, false, false, false, pills_html);
|
|
55730
|
+
else style.innerHTML = build_node_innerHTML(paint.fill, priv.theme, record.icon, label, desc.topic_name, false, record.id, false, false, false, pills_html);
|
|
55664
55731
|
let topic_props = priv._graph_properties[desc.topic_name];
|
|
55665
55732
|
let topic_defaults = (0, _yuneta_gobj_js.is_object)(topic_props) && (0, _yuneta_gobj_js.is_object)(topic_props.defaults) ? topic_props.defaults : null;
|
|
55666
55733
|
if (topic_defaults) {
|
|
@@ -55732,17 +55799,18 @@ function pill_shape_of(gobj, desc, record, geometry) {
|
|
|
55732
55799
|
let priv = gobj.priv;
|
|
55733
55800
|
let size = PILL_SIZE[desc.node_treedb_type] || PILL_SIZE.hierarchical;
|
|
55734
55801
|
let ports = build_ports(gobj, desc);
|
|
55802
|
+
let paint = node_paint_of(gobj, desc, geometry);
|
|
55735
55803
|
let style = {
|
|
55736
|
-
fill:
|
|
55737
|
-
stroke:
|
|
55738
|
-
lineWidth:
|
|
55804
|
+
fill: paint.fill,
|
|
55805
|
+
stroke: paint.stroke,
|
|
55806
|
+
lineWidth: paint.lineWidth,
|
|
55739
55807
|
lineDash: [],
|
|
55740
55808
|
halo: false,
|
|
55741
55809
|
labelText: "",
|
|
55742
55810
|
size: [...size],
|
|
55743
55811
|
dx: -size[0] / 2,
|
|
55744
55812
|
dy: -size[1] / 2,
|
|
55745
|
-
innerHTML: build_chip_innerHTML(
|
|
55813
|
+
innerHTML: build_chip_innerHTML(paint.fill, priv.theme, record.icon, node_label(desc, record), record.id)
|
|
55746
55814
|
};
|
|
55747
55815
|
dress_ports(gobj, style, ports, geometry, topic_defaults_of(gobj, desc.topic_name), PORT_R_PILL, true);
|
|
55748
55816
|
return {
|
|
@@ -55753,7 +55821,7 @@ function pill_shape_of(gobj, desc, record, geometry) {
|
|
|
55753
55821
|
function pill_innerHTML_of(gobj, nd, theme, highlight, selected, anchored) {
|
|
55754
55822
|
let desc = nd.data.desc;
|
|
55755
55823
|
let record = nd.data.record || {};
|
|
55756
|
-
return build_chip_innerHTML(
|
|
55824
|
+
return build_chip_innerHTML(node_fill_of(nd), theme, record.icon, node_label(desc, record), record.id, highlight, selected, anchored);
|
|
55757
55825
|
}
|
|
55758
55826
|
function node_figure_of(gobj, desc, geometry) {
|
|
55759
55827
|
let shape = geometry ? geometry.node_shape : null;
|
|
@@ -55780,8 +55848,9 @@ function figure_shape_of(gobj, desc, record, geometry, flags) {
|
|
|
55780
55848
|
let side = SHAPE_SIZE[tier] || SHAPE_SIZE.hierarchical;
|
|
55781
55849
|
let labels = (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "node_labels");
|
|
55782
55850
|
let figure = node_figure_of(gobj, desc, geometry || {});
|
|
55783
|
-
let
|
|
55784
|
-
let
|
|
55851
|
+
let paint = node_paint_of(gobj, desc, geometry);
|
|
55852
|
+
let stroke = paint.stroke;
|
|
55853
|
+
let line_width = Math.max(paint.lineWidth, 1.5);
|
|
55785
55854
|
if (f.selected) {
|
|
55786
55855
|
stroke = SELECT_RING;
|
|
55787
55856
|
line_width = 3;
|
|
@@ -55799,7 +55868,7 @@ function figure_shape_of(gobj, desc, record, geometry, flags) {
|
|
|
55799
55868
|
let style = {
|
|
55800
55869
|
size: [side, side],
|
|
55801
55870
|
radius: figure === "square" ? Math.round(side / 5) : 0,
|
|
55802
|
-
fill:
|
|
55871
|
+
fill: paint.fill,
|
|
55803
55872
|
stroke,
|
|
55804
55873
|
lineWidth: line_width,
|
|
55805
55874
|
lineDash: dash,
|
|
@@ -56972,6 +57041,34 @@ function hide_overlay(gobj, ...keys) {
|
|
|
56972
57041
|
/************************************************************
|
|
56973
57042
|
* Enable the save button (mark graph as dirty).
|
|
56974
57043
|
************************************************************/
|
|
57044
|
+
/************************************************************
|
|
57045
|
+
* A popover that PREVIEWS its changes owes an undo.
|
|
57046
|
+
*
|
|
57047
|
+
* What the preview writes is not the reader's answer until
|
|
57048
|
+
* `apply` is pressed, and `cancel` used to be the only way
|
|
57049
|
+
* back: every other way out of the popover -- a click on the
|
|
57050
|
+
* canvas, the icon pressed again, the element going away --
|
|
57051
|
+
* left the preview standing on the element, and the next Save
|
|
57052
|
+
* wrote it to `__graphs__`. So the undo is kept beside the
|
|
57053
|
+
* popover and run by whoever hides it; `apply` drops it first,
|
|
57054
|
+
* because then the preview IS the answer.
|
|
57055
|
+
************************************************************/
|
|
57056
|
+
function set_preview_undo(gobj, key, undo) {
|
|
57057
|
+
gobj.priv[key] = undo;
|
|
57058
|
+
}
|
|
57059
|
+
function drop_preview_undo(gobj, key) {
|
|
57060
|
+
gobj.priv[key] = null;
|
|
57061
|
+
}
|
|
57062
|
+
function run_preview_undo(gobj, key) {
|
|
57063
|
+
let undo = gobj.priv[key];
|
|
57064
|
+
gobj.priv[key] = null;
|
|
57065
|
+
if (!undo || (0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return;
|
|
57066
|
+
try {
|
|
57067
|
+
undo();
|
|
57068
|
+
} catch (e) {
|
|
57069
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot undo the preview: ${e}`);
|
|
57070
|
+
}
|
|
57071
|
+
}
|
|
56975
57072
|
function mark_graph_dirty(gobj) {
|
|
56976
57073
|
let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
|
|
56977
57074
|
enableElements($container, ".EV_SAVE_GRAPH");
|
|
@@ -57569,6 +57666,26 @@ function port_hit_slop_world(graph) {
|
|
|
57569
57666
|
return slop / zoom;
|
|
57570
57667
|
}
|
|
57571
57668
|
/************************************************************
|
|
57669
|
+
* Whether a point landed on a port, by the port's SHAPE.
|
|
57670
|
+
*
|
|
57671
|
+
* A port was a circle and the test was a radius; since 7.23.81
|
|
57672
|
+
* it can be a square, a diamond or a triangle too, and a circle
|
|
57673
|
+
* around a diamond answers for the air off its corners while
|
|
57674
|
+
* missing the middle of its edges. `r` is the drawn radius with
|
|
57675
|
+
* the hit slop already added, and the shapes are the ones
|
|
57676
|
+
* TreedbCard.drawPortShapes() draws from it.
|
|
57677
|
+
*
|
|
57678
|
+
* dx, dy the point, relative to the port's centre
|
|
57679
|
+
************************************************************/
|
|
57680
|
+
function port_shape_hit(shape, dx, dy, r) {
|
|
57681
|
+
switch (shape) {
|
|
57682
|
+
case "square": return Math.abs(dx) <= r && Math.abs(dy) <= r;
|
|
57683
|
+
case "diamond": return Math.abs(dx) + Math.abs(dy) <= r;
|
|
57684
|
+
case "triangle": return dy <= r && 2 * Math.abs(dx) - dy <= r;
|
|
57685
|
+
default: return Math.hypot(dx, dy) <= r;
|
|
57686
|
+
}
|
|
57687
|
+
}
|
|
57688
|
+
/************************************************************
|
|
57572
57689
|
* Detect if a click in canvas coordinates hits a port.
|
|
57573
57690
|
* Returns the port key string, or null if no port hit.
|
|
57574
57691
|
************************************************************/
|
|
@@ -57590,7 +57707,7 @@ function detect_port_click(gobj, node_id, canvasX, canvasY) {
|
|
|
57590
57707
|
let dx = canvasX - px;
|
|
57591
57708
|
let dy = canvasY - py;
|
|
57592
57709
|
let dist = Math.sqrt(dx * dx + dy * dy);
|
|
57593
|
-
if (
|
|
57710
|
+
if (port_shape_hit(ports[i].shape, dx, dy, r + slop) && dist < best_dist) {
|
|
57594
57711
|
best_dist = dist;
|
|
57595
57712
|
best_key = ports[i].key;
|
|
57596
57713
|
}
|
|
@@ -57731,6 +57848,7 @@ function toggle_port_popover(gobj) {
|
|
|
57731
57848
|
else show_port_popover(gobj);
|
|
57732
57849
|
}
|
|
57733
57850
|
function hide_port_popover(gobj) {
|
|
57851
|
+
run_preview_undo(gobj, "_port_preview_undo");
|
|
57734
57852
|
hide_overlay(gobj, "_port_popover_el");
|
|
57735
57853
|
}
|
|
57736
57854
|
function ports_with(ports, port_key, changes) {
|
|
@@ -57752,6 +57870,18 @@ function show_port_popover(gobj) {
|
|
|
57752
57870
|
let xy = port_icon_xy(gobj);
|
|
57753
57871
|
if (!xy) return;
|
|
57754
57872
|
const popover = create_popover_base(xy.x + floating_popover_dx(), xy.y, "g6-port-popover", "#d9d9d9", 180);
|
|
57873
|
+
let undo_port = () => {
|
|
57874
|
+
graph.updateNodeData([{
|
|
57875
|
+
id: node_id,
|
|
57876
|
+
style: { ports: ports_with(nodeData.style.ports, port_key, {
|
|
57877
|
+
shape: orig_shape,
|
|
57878
|
+
r: orig_r
|
|
57879
|
+
}) }
|
|
57880
|
+
}]);
|
|
57881
|
+
graph.draw().then(() => {
|
|
57882
|
+
update_port_resize_handles_position(gobj);
|
|
57883
|
+
});
|
|
57884
|
+
};
|
|
57755
57885
|
function preview_port() {
|
|
57756
57886
|
let r = parseInt(rInput.value) || orig_r;
|
|
57757
57887
|
graph.updateNodeData([{
|
|
@@ -57795,27 +57925,19 @@ function show_port_popover(gobj) {
|
|
|
57795
57925
|
text: "cancel",
|
|
57796
57926
|
style: BTN_STYLE_CANCEL,
|
|
57797
57927
|
onClick: () => {
|
|
57798
|
-
graph.updateNodeData([{
|
|
57799
|
-
id: node_id,
|
|
57800
|
-
style: { ports: ports_with(nodeData.style.ports, port_key, {
|
|
57801
|
-
shape: orig_shape,
|
|
57802
|
-
r: orig_r
|
|
57803
|
-
}) }
|
|
57804
|
-
}]);
|
|
57805
|
-
graph.draw().then(() => {
|
|
57806
|
-
update_port_resize_handles_position(gobj);
|
|
57807
|
-
});
|
|
57808
57928
|
hide_port_popover(gobj);
|
|
57809
57929
|
}
|
|
57810
57930
|
}, {
|
|
57811
57931
|
text: "apply",
|
|
57812
57932
|
style: "flex:1;padding:6px;background:#1890ff;color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:13px;font-weight:500;",
|
|
57813
57933
|
onClick: () => {
|
|
57934
|
+
drop_preview_undo(gobj, "_port_preview_undo");
|
|
57814
57935
|
apply_port_properties(gobj, node_id, port_key, shapeSelect.value, parseInt(rInput.value) || orig_r, scopeSelect.value);
|
|
57815
57936
|
}
|
|
57816
57937
|
}]);
|
|
57817
57938
|
priv.$container.appendChild(popover);
|
|
57818
57939
|
priv._port_popover_el = popover;
|
|
57940
|
+
set_preview_undo(gobj, "_port_preview_undo", undo_port);
|
|
57819
57941
|
clamp_popover_position(gobj, popover);
|
|
57820
57942
|
}
|
|
57821
57943
|
/************************************************************
|
|
@@ -58417,6 +58539,16 @@ function show_edge_popover(gobj) {
|
|
|
58417
58539
|
let mid = get_edge_viewport_midpoint(gobj, edge_id);
|
|
58418
58540
|
if (!mid) return;
|
|
58419
58541
|
const popover = create_popover_base(mid.x + floating_popover_dx(), mid.y + floating_icon_dy(), "g6-edge-popover", "#d9d9d9", 180);
|
|
58542
|
+
let undo_edge = () => {
|
|
58543
|
+
graph.updateEdgeData([{
|
|
58544
|
+
id: edge_id,
|
|
58545
|
+
style: {
|
|
58546
|
+
lineWidth: origLW,
|
|
58547
|
+
stroke: origStroke
|
|
58548
|
+
}
|
|
58549
|
+
}]);
|
|
58550
|
+
graph.draw();
|
|
58551
|
+
};
|
|
58420
58552
|
function preview_edge() {
|
|
58421
58553
|
let lw = parseInt(lwInput.value) || 2;
|
|
58422
58554
|
let color = colorInput.value;
|
|
@@ -58452,25 +58584,19 @@ function show_edge_popover(gobj) {
|
|
|
58452
58584
|
text: "cancel",
|
|
58453
58585
|
style: BTN_STYLE_CANCEL,
|
|
58454
58586
|
onClick: () => {
|
|
58455
|
-
graph.updateEdgeData([{
|
|
58456
|
-
id: edge_id,
|
|
58457
|
-
style: {
|
|
58458
|
-
lineWidth: origLW,
|
|
58459
|
-
stroke: origStroke
|
|
58460
|
-
}
|
|
58461
|
-
}]);
|
|
58462
|
-
graph.draw();
|
|
58463
58587
|
deselect_edge(gobj);
|
|
58464
58588
|
}
|
|
58465
58589
|
}, {
|
|
58466
58590
|
text: "apply",
|
|
58467
58591
|
style: "flex:1;padding:6px;background:#52c41a;color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:13px;font-weight:500;",
|
|
58468
58592
|
onClick: () => {
|
|
58593
|
+
drop_preview_undo(gobj, "_edge_preview_undo");
|
|
58469
58594
|
apply_edge_properties(gobj, edge_id, parseInt(lwInput.value) || 2, colorInput.value, scopeSelect.value);
|
|
58470
58595
|
}
|
|
58471
58596
|
}]);
|
|
58472
58597
|
priv.$container.appendChild(popover);
|
|
58473
58598
|
priv._edge_popover_el = popover;
|
|
58599
|
+
set_preview_undo(gobj, "_edge_preview_undo", undo_edge);
|
|
58474
58600
|
clamp_popover_position(gobj, popover);
|
|
58475
58601
|
}
|
|
58476
58602
|
/************************************************************
|
|
@@ -58492,6 +58618,7 @@ function clamp_popover_position(gobj, popover) {
|
|
|
58492
58618
|
popover.style.top = top + "px";
|
|
58493
58619
|
}
|
|
58494
58620
|
function hide_edge_popover(gobj) {
|
|
58621
|
+
run_preview_undo(gobj, "_edge_preview_undo");
|
|
58495
58622
|
hide_overlay(gobj, "_edge_popover_el");
|
|
58496
58623
|
}
|
|
58497
58624
|
/************************************************************
|
|
@@ -58566,23 +58693,23 @@ function show_node_popover(gobj) {
|
|
|
58566
58693
|
let rect = get_node_viewport_rect(gobj, node_id);
|
|
58567
58694
|
if (!rect) return;
|
|
58568
58695
|
const popover = create_popover_base(rect.right + floating_popover_dx(), rect.top + floating_icon_dy(), "g6-node-popover", "#d9d9d9", 180);
|
|
58569
|
-
let
|
|
58570
|
-
function preview_node() {
|
|
58571
|
-
let fill = fillInput.value;
|
|
58572
|
-
let updateStyle = {
|
|
58573
|
-
fill,
|
|
58574
|
-
stroke: strokeInput.value,
|
|
58575
|
-
lineWidth: parseInt(lwInput.value) || 1
|
|
58576
|
-
};
|
|
58577
|
-
if (node_graph_type === "hierarchical") {
|
|
58578
|
-
let record = nodeData.data.record || {};
|
|
58579
|
-
updateStyle.innerHTML = build_node_innerHTML(fill, priv.theme, record.icon, node_label(nodeData.data.desc, record), nodeData.data.desc.topic_name, false, record.id, false, false, false, pills_html_of(gobj, nodeData));
|
|
58580
|
-
}
|
|
58696
|
+
let paint_node = (fill, stroke, lw) => {
|
|
58581
58697
|
graph.updateNodeData([{
|
|
58582
58698
|
id: node_id,
|
|
58583
|
-
style:
|
|
58699
|
+
style: {
|
|
58700
|
+
fill,
|
|
58701
|
+
stroke,
|
|
58702
|
+
lineWidth: lw
|
|
58703
|
+
}
|
|
58584
58704
|
}]);
|
|
58705
|
+
repaint_cards(gobj, /* @__PURE__ */ new Set([node_id]));
|
|
58585
58706
|
graph.draw();
|
|
58707
|
+
};
|
|
58708
|
+
let undo_node = () => {
|
|
58709
|
+
paint_node(origFill, origStroke, origLW);
|
|
58710
|
+
};
|
|
58711
|
+
function preview_node() {
|
|
58712
|
+
paint_node(fillInput.value, strokeInput.value, parseInt(lwInput.value) || 1);
|
|
58586
58713
|
}
|
|
58587
58714
|
create_form_label(popover, "fill color");
|
|
58588
58715
|
let fillInput = create_form_color_input(popover, currentFill, preview_node);
|
|
@@ -58617,34 +58744,23 @@ function show_node_popover(gobj) {
|
|
|
58617
58744
|
text: "cancel",
|
|
58618
58745
|
style: BTN_STYLE_CANCEL,
|
|
58619
58746
|
onClick: () => {
|
|
58620
|
-
let restoreStyle = {
|
|
58621
|
-
fill: origFill,
|
|
58622
|
-
stroke: origStroke,
|
|
58623
|
-
lineWidth: origLW
|
|
58624
|
-
};
|
|
58625
|
-
if (node_graph_type === "hierarchical") {
|
|
58626
|
-
let record = nodeData.data.record || {};
|
|
58627
|
-
restoreStyle.innerHTML = build_node_innerHTML(origFill, priv.theme, record.icon, node_label(nodeData.data.desc, record), nodeData.data.desc.topic_name, false, record.id, false, false, false, pills_html_of(gobj, nodeData));
|
|
58628
|
-
}
|
|
58629
|
-
graph.updateNodeData([{
|
|
58630
|
-
id: node_id,
|
|
58631
|
-
style: restoreStyle
|
|
58632
|
-
}]);
|
|
58633
|
-
graph.draw();
|
|
58634
58747
|
hide_node_popover(gobj);
|
|
58635
58748
|
}
|
|
58636
58749
|
}, {
|
|
58637
58750
|
text: "apply",
|
|
58638
58751
|
style: "flex:1;padding:6px;background:#1890ff;color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:13px;font-weight:500;",
|
|
58639
58752
|
onClick: () => {
|
|
58753
|
+
drop_preview_undo(gobj, "_node_preview_undo");
|
|
58640
58754
|
apply_node_properties(gobj, node_id, fillInput.value, strokeInput.value, parseInt(lwInput.value) || 1, scopeSelect.value, shapeSelect.value);
|
|
58641
58755
|
}
|
|
58642
58756
|
}]);
|
|
58643
58757
|
priv.$container.appendChild(popover);
|
|
58644
58758
|
priv._node_popover_el = popover;
|
|
58759
|
+
set_preview_undo(gobj, "_node_preview_undo", undo_node);
|
|
58645
58760
|
clamp_popover_position(gobj, popover);
|
|
58646
58761
|
}
|
|
58647
58762
|
function hide_node_popover(gobj) {
|
|
58763
|
+
run_preview_undo(gobj, "_node_preview_undo");
|
|
58648
58764
|
hide_overlay(gobj, "_node_popover_el");
|
|
58649
58765
|
}
|
|
58650
58766
|
/************************************************************
|
|
@@ -58832,15 +58948,19 @@ function refresh_minimap(gobj) {
|
|
|
58832
58948
|
* same three-way choice — it lived inline in the theme refresh and is
|
|
58833
58949
|
* shared now. Returns null for a node that carries no desc.
|
|
58834
58950
|
************************************************************/
|
|
58951
|
+
function node_fill_of(nd) {
|
|
58952
|
+
return nd && nd.style && nd.style.fill || nd.data.desc.color;
|
|
58953
|
+
}
|
|
58835
58954
|
function node_innerHTML_of(nd, theme, highlight, selected, anchored, pills_html) {
|
|
58836
58955
|
if (!nd || !nd.data || !nd.data.desc) return null;
|
|
58837
58956
|
let desc = nd.data.desc;
|
|
58838
58957
|
let record = nd.data.record || {};
|
|
58839
58958
|
let label = node_label(desc, record);
|
|
58959
|
+
let fill = node_fill_of(nd);
|
|
58840
58960
|
switch (desc.node_treedb_type) {
|
|
58841
|
-
case "child": return build_chip_innerHTML(
|
|
58842
|
-
case "extended": return build_node_innerHTML(
|
|
58843
|
-
case "hierarchical": return build_node_innerHTML(
|
|
58961
|
+
case "child": return build_chip_innerHTML(fill, theme, record.icon, label, record.id, highlight, selected, anchored);
|
|
58962
|
+
case "extended": return build_node_innerHTML(fill, theme, record.icon, label, desc.topic_name, true, record.id, highlight, selected, anchored, pills_html);
|
|
58963
|
+
case "hierarchical": return build_node_innerHTML(fill, theme, record.icon, label, desc.topic_name, false, record.id, highlight, selected, anchored, pills_html);
|
|
58844
58964
|
}
|
|
58845
58965
|
return null;
|
|
58846
58966
|
}
|
|
@@ -59395,15 +59515,19 @@ function apply_node_properties(gobj, node_id, fill, stroke, lineWidth, scope, sh
|
|
|
59395
59515
|
if (!nodeData || !nodeData.data) return;
|
|
59396
59516
|
let source_topic = nodeData.data.desc ? nodeData.data.desc.topic_name : null;
|
|
59397
59517
|
let updates = [];
|
|
59518
|
+
let repaint = /* @__PURE__ */ new Set();
|
|
59398
59519
|
const nodes = graph.getData().nodes;
|
|
59399
59520
|
let figure = shape && (0, _yuneta_gobj_js.str_in_list)(NODE_SHAPES, shape) ? shape : "";
|
|
59400
59521
|
let reshaped = [];
|
|
59401
|
-
if (
|
|
59522
|
+
if (scope !== "this") {
|
|
59402
59523
|
let topics = scope === "same_topic" ? [source_topic] : Object.keys(priv.descs || {});
|
|
59403
59524
|
for (let topic_name of topics) {
|
|
59525
|
+
let desc = priv.descs[topic_name];
|
|
59526
|
+
if (!desc) continue;
|
|
59404
59527
|
if (!(0, _yuneta_gobj_js.is_object)(priv._graph_properties[topic_name])) priv._graph_properties[topic_name] = {};
|
|
59405
59528
|
let defaults = priv._graph_properties[topic_name].defaults || {};
|
|
59406
|
-
defaults.node_shape = figure;
|
|
59529
|
+
if (figure) defaults.node_shape = figure;
|
|
59530
|
+
paint_into(defaults, desc, fill, stroke, lineWidth);
|
|
59407
59531
|
priv._graph_properties[topic_name].defaults = defaults;
|
|
59408
59532
|
}
|
|
59409
59533
|
}
|
|
@@ -59412,27 +59536,27 @@ function apply_node_properties(gobj, node_id, fill, stroke, lineWidth, scope, sh
|
|
|
59412
59536
|
if (!nd || !nd.data || !nd.data.desc) continue;
|
|
59413
59537
|
if (scope === "this" && nodes[i].id !== node_id) continue;
|
|
59414
59538
|
if (scope === "same_topic" && nd.data.desc.topic_name !== source_topic) continue;
|
|
59539
|
+
let entry = node_props_entry(gobj, nd);
|
|
59415
59540
|
if (figure) {
|
|
59416
|
-
|
|
59541
|
+
entry.node_shape = figure;
|
|
59417
59542
|
if (node_mode_of(gobj, nodes[i].id) === "shape") reshaped.push(nodes[i].id);
|
|
59418
59543
|
}
|
|
59544
|
+
paint_into(entry, nd.data.desc, fill, stroke, lineWidth);
|
|
59419
59545
|
let updateStyle = {
|
|
59420
59546
|
fill,
|
|
59421
59547
|
stroke,
|
|
59422
59548
|
lineWidth
|
|
59423
59549
|
};
|
|
59424
|
-
if (nd.data.desc.node_treedb_type === "hierarchical") {
|
|
59425
|
-
let record = nd.data.record || {};
|
|
59426
|
-
updateStyle.innerHTML = build_node_innerHTML(fill, priv.theme, record.icon, node_label(nd.data.desc, record), nd.data.desc.topic_name, false, record.id, false, false, false, pills_html_of(gobj, nd));
|
|
59427
|
-
}
|
|
59428
59550
|
updates.push({
|
|
59429
59551
|
id: nodes[i].id,
|
|
59430
59552
|
style: updateStyle
|
|
59431
59553
|
});
|
|
59554
|
+
repaint.add(nodes[i].id);
|
|
59432
59555
|
}
|
|
59433
59556
|
if (updates.length > 0) {
|
|
59434
59557
|
graph.updateNodeData(updates);
|
|
59435
59558
|
if (reshaped.length) reshape_nodes(gobj, reshaped);
|
|
59559
|
+
repaint_cards(gobj, repaint);
|
|
59436
59560
|
graph.draw().then(() => {
|
|
59437
59561
|
mark_graph_dirty(gobj);
|
|
59438
59562
|
});
|
|
@@ -60287,6 +60411,17 @@ async function reconcile_fold_apply(gobj, opts, visible) {
|
|
|
60287
60411
|
return changed;
|
|
60288
60412
|
}
|
|
60289
60413
|
/************************************************************
|
|
60414
|
+
* The application changed language: what this gclass DRAWS has
|
|
60415
|
+
* to be drawn again. `refresh_language()` reaches what carries
|
|
60416
|
+
* an i18n key in the DOM; a G6 toolbar and the html of a chip
|
|
60417
|
+
* are built here and carry none.
|
|
60418
|
+
************************************************************/
|
|
60419
|
+
function ac_language_changed$3(gobj, event, kw, src) {
|
|
60420
|
+
update_toolbar(gobj);
|
|
60421
|
+
repaint_more_chips(gobj);
|
|
60422
|
+
return 0;
|
|
60423
|
+
}
|
|
60424
|
+
/************************************************************
|
|
60290
60425
|
* Repaint the `+N` chips (theme or language changed).
|
|
60291
60426
|
************************************************************/
|
|
60292
60427
|
function repaint_more_chips(gobj) {
|
|
@@ -61522,6 +61657,11 @@ function create_gclass$4(gclass_name) {
|
|
|
61522
61657
|
"EV_THEME",
|
|
61523
61658
|
ac_theme$1,
|
|
61524
61659
|
null
|
|
61660
|
+
],
|
|
61661
|
+
[
|
|
61662
|
+
"EV_LANGUAGE_CHANGED",
|
|
61663
|
+
ac_language_changed$3,
|
|
61664
|
+
null
|
|
61525
61665
|
]
|
|
61526
61666
|
]]];
|
|
61527
61667
|
const event_types = [
|
|
@@ -61582,7 +61722,8 @@ function create_gclass$4(gclass_name) {
|
|
|
61582
61722
|
["EV_SHOW", 0],
|
|
61583
61723
|
["EV_HIDE", 0],
|
|
61584
61724
|
["EV_RESIZE", 0],
|
|
61585
|
-
["EV_THEME", 0]
|
|
61725
|
+
["EV_THEME", 0],
|
|
61726
|
+
["EV_LANGUAGE_CHANGED", 0]
|
|
61586
61727
|
];
|
|
61587
61728
|
__gclass__$4 = (0, _yuneta_gobj_js.gclass_create)(gclass_name, event_types, states, gmt$4, 0, attrs_table$4, PRIVATE_DATA$4, 0, 0, 0, _yuneta_gobj_js.gclass_flag_t.gcflag_manual_start);
|
|
61588
61729
|
if (!__gclass__$4) return -1;
|
|
@@ -61670,6 +61811,7 @@ var PRIVATE_DATA$3 = {
|
|
|
61670
61811
|
layout: null,
|
|
61671
61812
|
_topics_subscribed: {},
|
|
61672
61813
|
_legend_state: null,
|
|
61814
|
+
_find_result: null,
|
|
61673
61815
|
_links_subscribed: false,
|
|
61674
61816
|
is_pinhold_window: false
|
|
61675
61817
|
};
|
|
@@ -61723,6 +61865,8 @@ function mt_writing(gobj, path) {
|
|
|
61723
61865
|
***************************************************************/
|
|
61724
61866
|
function mt_start$3(gobj) {
|
|
61725
61867
|
let priv = gobj.priv;
|
|
61868
|
+
let shell = yui_shell_of(gobj);
|
|
61869
|
+
if (shell) (0, _yuneta_gobj_js.gobj_subscribe_event)(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
|
|
61726
61870
|
if (priv.gobj_nodes_tree) (0, _yuneta_gobj_js.gobj_start)(priv.gobj_nodes_tree);
|
|
61727
61871
|
if (priv.gobj_treedb_tables) (0, _yuneta_gobj_js.gobj_start)(priv.gobj_treedb_tables);
|
|
61728
61872
|
request_treedb_descs(gobj);
|
|
@@ -61733,7 +61877,10 @@ function mt_start$3(gobj) {
|
|
|
61733
61877
|
***************************************************************/
|
|
61734
61878
|
function mt_stop$3(gobj) {
|
|
61735
61879
|
let shell = yui_shell_of(gobj);
|
|
61736
|
-
if (shell)
|
|
61880
|
+
if (shell) {
|
|
61881
|
+
yui_shell_set_sub_routes(shell, (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "base_route"), null);
|
|
61882
|
+
(0, _yuneta_gobj_js.gobj_unsubscribe_event)(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
|
|
61883
|
+
}
|
|
61737
61884
|
close_json_viewer(gobj);
|
|
61738
61885
|
(0, _yuneta_gobj_js.gobj_stop_children)(gobj);
|
|
61739
61886
|
}
|
|
@@ -63135,11 +63282,13 @@ function refresh_legend(gobj) {
|
|
|
63135
63282
|
},
|
|
63136
63283
|
hidden ? `${entry.total}` : `${entry.visible}/${entry.total}`
|
|
63137
63284
|
]);
|
|
63285
|
+
let body_key = is_main ? "main topic" : hidden ? "show topic" : "hide topic";
|
|
63138
63286
|
let body_attrs = {
|
|
63139
63287
|
class: "GRAPH_LEGEND_ITEM button is-small" + (focused ? " GRAPH_LEGEND_FOCUSED" : "") + (is_main ? " GRAPH_LEGEND_MAIN" : ""),
|
|
63140
63288
|
type: "button",
|
|
63141
63289
|
style: "gap:0; flex:0 0 auto;" + (focused ? " box-shadow: inset 0 0 0 2px var(--bulma-text, #2e333d);" : ""),
|
|
63142
|
-
title:
|
|
63290
|
+
title: (0, i18next.t)(body_key),
|
|
63291
|
+
"data-i18n-title": body_key,
|
|
63143
63292
|
"aria-label": topic_name,
|
|
63144
63293
|
"aria-pressed": hidden ? "false" : "true"
|
|
63145
63294
|
};
|
|
@@ -63166,6 +63315,7 @@ function refresh_legend(gobj) {
|
|
|
63166
63315
|
title: (0, i18next.t)("main topic"),
|
|
63167
63316
|
"data-i18n-title": "main topic",
|
|
63168
63317
|
"aria-label": (0, i18next.t)("main topic"),
|
|
63318
|
+
"data-i18n-aria-label": "main topic",
|
|
63169
63319
|
"aria-pressed": "true"
|
|
63170
63320
|
},
|
|
63171
63321
|
[[
|
|
@@ -63203,7 +63353,8 @@ function refresh_legend(gobj) {
|
|
|
63203
63353
|
style: "padding:0 .4rem;",
|
|
63204
63354
|
title: (0, i18next.t)("main topic"),
|
|
63205
63355
|
"data-i18n-title": "main topic",
|
|
63206
|
-
"aria-label": (0, i18next.t)("main topic")
|
|
63356
|
+
"aria-label": (0, i18next.t)("main topic"),
|
|
63357
|
+
"data-i18n-aria-label": "main topic"
|
|
63207
63358
|
},
|
|
63208
63359
|
[[
|
|
63209
63360
|
"span",
|
|
@@ -63227,6 +63378,7 @@ function refresh_legend(gobj) {
|
|
|
63227
63378
|
title: (0, i18next.t)("loose records"),
|
|
63228
63379
|
"data-i18n-title": "loose records",
|
|
63229
63380
|
"aria-label": (0, i18next.t)("loose records"),
|
|
63381
|
+
"data-i18n-aria-label": "loose records",
|
|
63230
63382
|
"aria-pressed": entry.loose_shown ? "true" : "false"
|
|
63231
63383
|
},
|
|
63232
63384
|
`+${entry.loose}`,
|
|
@@ -63247,6 +63399,7 @@ function refresh_legend(gobj) {
|
|
|
63247
63399
|
title: (0, i18next.t)("highlight topic"),
|
|
63248
63400
|
"data-i18n-title": "highlight topic",
|
|
63249
63401
|
"aria-label": (0, i18next.t)("highlight topic"),
|
|
63402
|
+
"data-i18n-aria-label": "highlight topic",
|
|
63250
63403
|
"aria-pressed": focused ? "true" : "false"
|
|
63251
63404
|
},
|
|
63252
63405
|
[["i", {
|
|
@@ -63273,6 +63426,18 @@ function refresh_legend(gobj) {
|
|
|
63273
63426
|
}
|
|
63274
63427
|
}
|
|
63275
63428
|
/************************************************************
|
|
63429
|
+
* The application changed language. `refresh_language()` has
|
|
63430
|
+
* already been over the document by now (the shell runs it
|
|
63431
|
+
* before publishing), so what is left is what carries no key:
|
|
63432
|
+
* the legend, whose chips say an ACTION that depends on the
|
|
63433
|
+
* state, and the find box's counted line.
|
|
63434
|
+
************************************************************/
|
|
63435
|
+
function ac_language_changed$2(gobj, event, kw, src) {
|
|
63436
|
+
refresh_legend(gobj);
|
|
63437
|
+
refresh_find_result(gobj);
|
|
63438
|
+
return 0;
|
|
63439
|
+
}
|
|
63440
|
+
/************************************************************
|
|
63276
63441
|
* The engine said what is drawn: repaint the strip.
|
|
63277
63442
|
************************************************************/
|
|
63278
63443
|
function ac_legend_state(gobj, event, kw, src) {
|
|
@@ -63414,6 +63579,12 @@ function ac_toggle_node_labels(gobj, event, kw, src) {
|
|
|
63414
63579
|
* term typed is an ANSWER and is shown; an empty box shows nothing.
|
|
63415
63580
|
************************************************************/
|
|
63416
63581
|
function ac_find_result(gobj, event, kw, src) {
|
|
63582
|
+
gobj.priv._find_result = kw || null;
|
|
63583
|
+
refresh_find_result(gobj);
|
|
63584
|
+
return 0;
|
|
63585
|
+
}
|
|
63586
|
+
function refresh_find_result(gobj) {
|
|
63587
|
+
let kw = gobj.priv._find_result;
|
|
63417
63588
|
let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
|
|
63418
63589
|
if (!$container) return 0;
|
|
63419
63590
|
let $result = $container.querySelector(".GRAPH_FIND_RESULT");
|
|
@@ -63667,6 +63838,11 @@ function create_gclass$3(gclass_name) {
|
|
|
63667
63838
|
"EV_TRANSPORT_STATE",
|
|
63668
63839
|
ac_transport_state$1,
|
|
63669
63840
|
null
|
|
63841
|
+
],
|
|
63842
|
+
[
|
|
63843
|
+
"EV_LANGUAGE_CHANGED",
|
|
63844
|
+
ac_language_changed$2,
|
|
63845
|
+
null
|
|
63670
63846
|
]
|
|
63671
63847
|
]]];
|
|
63672
63848
|
const event_types = [
|
|
@@ -63708,6 +63884,7 @@ function create_gclass$3(gclass_name) {
|
|
|
63708
63884
|
["EV_RECORD_WRITTEN", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS],
|
|
63709
63885
|
["EV_SHOW", 0],
|
|
63710
63886
|
["EV_HIDE", 0],
|
|
63887
|
+
["EV_LANGUAGE_CHANGED", 0],
|
|
63711
63888
|
["EV_TRANSPORT_STATE", 0]
|
|
63712
63889
|
];
|
|
63713
63890
|
__gclass__$3 = (0, _yuneta_gobj_js.gclass_create)(gclass_name, event_types, states, gmt$3, 0, attrs_table$3, PRIVATE_DATA$3, 0, 0, 0, 0);
|