@yuneta/gobj-ui 7.23.82 → 7.23.84

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.
@@ -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$6(gobj, event, kw, src) {
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$6,
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$6,
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$5(gobj, event, kw, src) {
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$5,
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$4(gobj, event, kw, src) {
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$4,
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$3(gobj, event, kw, src) {
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$3,
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$2(gobj, event, kw, src) {
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$2,
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, so
27424
- * nothing overlaps by construction (see `layout_radial`).
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 && (event.ctrlKey || event.metaKey))
55527
+ enable: (event) => !(event && event.ctrlKey)
55508
55528
  }, {
55509
55529
  type: "zoom-canvas",
55510
55530
  key: "zoom-canvas",
@@ -56972,6 +56992,34 @@ function hide_overlay(gobj, ...keys) {
56972
56992
  /************************************************************
56973
56993
  * Enable the save button (mark graph as dirty).
56974
56994
  ************************************************************/
56995
+ /************************************************************
56996
+ * A popover that PREVIEWS its changes owes an undo.
56997
+ *
56998
+ * What the preview writes is not the reader's answer until
56999
+ * `apply` is pressed, and `cancel` used to be the only way
57000
+ * back: every other way out of the popover -- a click on the
57001
+ * canvas, the icon pressed again, the element going away --
57002
+ * left the preview standing on the element, and the next Save
57003
+ * wrote it to `__graphs__`. So the undo is kept beside the
57004
+ * popover and run by whoever hides it; `apply` drops it first,
57005
+ * because then the preview IS the answer.
57006
+ ************************************************************/
57007
+ function set_preview_undo(gobj, key, undo) {
57008
+ gobj.priv[key] = undo;
57009
+ }
57010
+ function drop_preview_undo(gobj, key) {
57011
+ gobj.priv[key] = null;
57012
+ }
57013
+ function run_preview_undo(gobj, key) {
57014
+ let undo = gobj.priv[key];
57015
+ gobj.priv[key] = null;
57016
+ if (!undo || (0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return;
57017
+ try {
57018
+ undo();
57019
+ } catch (e) {
57020
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot undo the preview: ${e}`);
57021
+ }
57022
+ }
56975
57023
  function mark_graph_dirty(gobj) {
56976
57024
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
56977
57025
  enableElements($container, ".EV_SAVE_GRAPH");
@@ -57569,6 +57617,26 @@ function port_hit_slop_world(graph) {
57569
57617
  return slop / zoom;
57570
57618
  }
57571
57619
  /************************************************************
57620
+ * Whether a point landed on a port, by the port's SHAPE.
57621
+ *
57622
+ * A port was a circle and the test was a radius; since 7.23.81
57623
+ * it can be a square, a diamond or a triangle too, and a circle
57624
+ * around a diamond answers for the air off its corners while
57625
+ * missing the middle of its edges. `r` is the drawn radius with
57626
+ * the hit slop already added, and the shapes are the ones
57627
+ * TreedbCard.drawPortShapes() draws from it.
57628
+ *
57629
+ * dx, dy the point, relative to the port's centre
57630
+ ************************************************************/
57631
+ function port_shape_hit(shape, dx, dy, r) {
57632
+ switch (shape) {
57633
+ case "square": return Math.abs(dx) <= r && Math.abs(dy) <= r;
57634
+ case "diamond": return Math.abs(dx) + Math.abs(dy) <= r;
57635
+ case "triangle": return dy <= r && 2 * Math.abs(dx) - dy <= r;
57636
+ default: return Math.hypot(dx, dy) <= r;
57637
+ }
57638
+ }
57639
+ /************************************************************
57572
57640
  * Detect if a click in canvas coordinates hits a port.
57573
57641
  * Returns the port key string, or null if no port hit.
57574
57642
  ************************************************************/
@@ -57590,7 +57658,7 @@ function detect_port_click(gobj, node_id, canvasX, canvasY) {
57590
57658
  let dx = canvasX - px;
57591
57659
  let dy = canvasY - py;
57592
57660
  let dist = Math.sqrt(dx * dx + dy * dy);
57593
- if (dist <= r + slop && dist < best_dist) {
57661
+ if (port_shape_hit(ports[i].shape, dx, dy, r + slop) && dist < best_dist) {
57594
57662
  best_dist = dist;
57595
57663
  best_key = ports[i].key;
57596
57664
  }
@@ -57731,6 +57799,7 @@ function toggle_port_popover(gobj) {
57731
57799
  else show_port_popover(gobj);
57732
57800
  }
57733
57801
  function hide_port_popover(gobj) {
57802
+ run_preview_undo(gobj, "_port_preview_undo");
57734
57803
  hide_overlay(gobj, "_port_popover_el");
57735
57804
  }
57736
57805
  function ports_with(ports, port_key, changes) {
@@ -57752,6 +57821,18 @@ function show_port_popover(gobj) {
57752
57821
  let xy = port_icon_xy(gobj);
57753
57822
  if (!xy) return;
57754
57823
  const popover = create_popover_base(xy.x + floating_popover_dx(), xy.y, "g6-port-popover", "#d9d9d9", 180);
57824
+ let undo_port = () => {
57825
+ graph.updateNodeData([{
57826
+ id: node_id,
57827
+ style: { ports: ports_with(nodeData.style.ports, port_key, {
57828
+ shape: orig_shape,
57829
+ r: orig_r
57830
+ }) }
57831
+ }]);
57832
+ graph.draw().then(() => {
57833
+ update_port_resize_handles_position(gobj);
57834
+ });
57835
+ };
57755
57836
  function preview_port() {
57756
57837
  let r = parseInt(rInput.value) || orig_r;
57757
57838
  graph.updateNodeData([{
@@ -57795,27 +57876,19 @@ function show_port_popover(gobj) {
57795
57876
  text: "cancel",
57796
57877
  style: BTN_STYLE_CANCEL,
57797
57878
  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
57879
  hide_port_popover(gobj);
57809
57880
  }
57810
57881
  }, {
57811
57882
  text: "apply",
57812
57883
  style: "flex:1;padding:6px;background:#1890ff;color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:13px;font-weight:500;",
57813
57884
  onClick: () => {
57885
+ drop_preview_undo(gobj, "_port_preview_undo");
57814
57886
  apply_port_properties(gobj, node_id, port_key, shapeSelect.value, parseInt(rInput.value) || orig_r, scopeSelect.value);
57815
57887
  }
57816
57888
  }]);
57817
57889
  priv.$container.appendChild(popover);
57818
57890
  priv._port_popover_el = popover;
57891
+ set_preview_undo(gobj, "_port_preview_undo", undo_port);
57819
57892
  clamp_popover_position(gobj, popover);
57820
57893
  }
57821
57894
  /************************************************************
@@ -58417,6 +58490,16 @@ function show_edge_popover(gobj) {
58417
58490
  let mid = get_edge_viewport_midpoint(gobj, edge_id);
58418
58491
  if (!mid) return;
58419
58492
  const popover = create_popover_base(mid.x + floating_popover_dx(), mid.y + floating_icon_dy(), "g6-edge-popover", "#d9d9d9", 180);
58493
+ let undo_edge = () => {
58494
+ graph.updateEdgeData([{
58495
+ id: edge_id,
58496
+ style: {
58497
+ lineWidth: origLW,
58498
+ stroke: origStroke
58499
+ }
58500
+ }]);
58501
+ graph.draw();
58502
+ };
58420
58503
  function preview_edge() {
58421
58504
  let lw = parseInt(lwInput.value) || 2;
58422
58505
  let color = colorInput.value;
@@ -58452,25 +58535,19 @@ function show_edge_popover(gobj) {
58452
58535
  text: "cancel",
58453
58536
  style: BTN_STYLE_CANCEL,
58454
58537
  onClick: () => {
58455
- graph.updateEdgeData([{
58456
- id: edge_id,
58457
- style: {
58458
- lineWidth: origLW,
58459
- stroke: origStroke
58460
- }
58461
- }]);
58462
- graph.draw();
58463
58538
  deselect_edge(gobj);
58464
58539
  }
58465
58540
  }, {
58466
58541
  text: "apply",
58467
58542
  style: "flex:1;padding:6px;background:#52c41a;color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:13px;font-weight:500;",
58468
58543
  onClick: () => {
58544
+ drop_preview_undo(gobj, "_edge_preview_undo");
58469
58545
  apply_edge_properties(gobj, edge_id, parseInt(lwInput.value) || 2, colorInput.value, scopeSelect.value);
58470
58546
  }
58471
58547
  }]);
58472
58548
  priv.$container.appendChild(popover);
58473
58549
  priv._edge_popover_el = popover;
58550
+ set_preview_undo(gobj, "_edge_preview_undo", undo_edge);
58474
58551
  clamp_popover_position(gobj, popover);
58475
58552
  }
58476
58553
  /************************************************************
@@ -58492,6 +58569,7 @@ function clamp_popover_position(gobj, popover) {
58492
58569
  popover.style.top = top + "px";
58493
58570
  }
58494
58571
  function hide_edge_popover(gobj) {
58572
+ run_preview_undo(gobj, "_edge_preview_undo");
58495
58573
  hide_overlay(gobj, "_edge_popover_el");
58496
58574
  }
58497
58575
  /************************************************************
@@ -58567,6 +58645,22 @@ function show_node_popover(gobj) {
58567
58645
  if (!rect) return;
58568
58646
  const popover = create_popover_base(rect.right + floating_popover_dx(), rect.top + floating_icon_dy(), "g6-node-popover", "#d9d9d9", 180);
58569
58647
  let node_graph_type = nodeData.data && nodeData.data.desc ? nodeData.data.desc.node_treedb_type : null;
58648
+ let undo_node = () => {
58649
+ let restoreStyle = {
58650
+ fill: origFill,
58651
+ stroke: origStroke,
58652
+ lineWidth: origLW
58653
+ };
58654
+ if (node_graph_type === "hierarchical") {
58655
+ let record = nodeData.data.record || {};
58656
+ 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));
58657
+ }
58658
+ graph.updateNodeData([{
58659
+ id: node_id,
58660
+ style: restoreStyle
58661
+ }]);
58662
+ graph.draw();
58663
+ };
58570
58664
  function preview_node() {
58571
58665
  let fill = fillInput.value;
58572
58666
  let updateStyle = {
@@ -58617,34 +58711,23 @@ function show_node_popover(gobj) {
58617
58711
  text: "cancel",
58618
58712
  style: BTN_STYLE_CANCEL,
58619
58713
  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
58714
  hide_node_popover(gobj);
58635
58715
  }
58636
58716
  }, {
58637
58717
  text: "apply",
58638
58718
  style: "flex:1;padding:6px;background:#1890ff;color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:13px;font-weight:500;",
58639
58719
  onClick: () => {
58720
+ drop_preview_undo(gobj, "_node_preview_undo");
58640
58721
  apply_node_properties(gobj, node_id, fillInput.value, strokeInput.value, parseInt(lwInput.value) || 1, scopeSelect.value, shapeSelect.value);
58641
58722
  }
58642
58723
  }]);
58643
58724
  priv.$container.appendChild(popover);
58644
58725
  priv._node_popover_el = popover;
58726
+ set_preview_undo(gobj, "_node_preview_undo", undo_node);
58645
58727
  clamp_popover_position(gobj, popover);
58646
58728
  }
58647
58729
  function hide_node_popover(gobj) {
58730
+ run_preview_undo(gobj, "_node_preview_undo");
58648
58731
  hide_overlay(gobj, "_node_popover_el");
58649
58732
  }
58650
58733
  /************************************************************
@@ -60287,6 +60370,17 @@ async function reconcile_fold_apply(gobj, opts, visible) {
60287
60370
  return changed;
60288
60371
  }
60289
60372
  /************************************************************
60373
+ * The application changed language: what this gclass DRAWS has
60374
+ * to be drawn again. `refresh_language()` reaches what carries
60375
+ * an i18n key in the DOM; a G6 toolbar and the html of a chip
60376
+ * are built here and carry none.
60377
+ ************************************************************/
60378
+ function ac_language_changed$3(gobj, event, kw, src) {
60379
+ update_toolbar(gobj);
60380
+ repaint_more_chips(gobj);
60381
+ return 0;
60382
+ }
60383
+ /************************************************************
60290
60384
  * Repaint the `+N` chips (theme or language changed).
60291
60385
  ************************************************************/
60292
60386
  function repaint_more_chips(gobj) {
@@ -61522,6 +61616,11 @@ function create_gclass$4(gclass_name) {
61522
61616
  "EV_THEME",
61523
61617
  ac_theme$1,
61524
61618
  null
61619
+ ],
61620
+ [
61621
+ "EV_LANGUAGE_CHANGED",
61622
+ ac_language_changed$3,
61623
+ null
61525
61624
  ]
61526
61625
  ]]];
61527
61626
  const event_types = [
@@ -61582,7 +61681,8 @@ function create_gclass$4(gclass_name) {
61582
61681
  ["EV_SHOW", 0],
61583
61682
  ["EV_HIDE", 0],
61584
61683
  ["EV_RESIZE", 0],
61585
- ["EV_THEME", 0]
61684
+ ["EV_THEME", 0],
61685
+ ["EV_LANGUAGE_CHANGED", 0]
61586
61686
  ];
61587
61687
  __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
61688
  if (!__gclass__$4) return -1;
@@ -61670,6 +61770,7 @@ var PRIVATE_DATA$3 = {
61670
61770
  layout: null,
61671
61771
  _topics_subscribed: {},
61672
61772
  _legend_state: null,
61773
+ _find_result: null,
61673
61774
  _links_subscribed: false,
61674
61775
  is_pinhold_window: false
61675
61776
  };
@@ -61723,6 +61824,8 @@ function mt_writing(gobj, path) {
61723
61824
  ***************************************************************/
61724
61825
  function mt_start$3(gobj) {
61725
61826
  let priv = gobj.priv;
61827
+ let shell = yui_shell_of(gobj);
61828
+ if (shell) (0, _yuneta_gobj_js.gobj_subscribe_event)(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
61726
61829
  if (priv.gobj_nodes_tree) (0, _yuneta_gobj_js.gobj_start)(priv.gobj_nodes_tree);
61727
61830
  if (priv.gobj_treedb_tables) (0, _yuneta_gobj_js.gobj_start)(priv.gobj_treedb_tables);
61728
61831
  request_treedb_descs(gobj);
@@ -61733,7 +61836,10 @@ function mt_start$3(gobj) {
61733
61836
  ***************************************************************/
61734
61837
  function mt_stop$3(gobj) {
61735
61838
  let shell = yui_shell_of(gobj);
61736
- if (shell) yui_shell_set_sub_routes(shell, (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "base_route"), null);
61839
+ if (shell) {
61840
+ yui_shell_set_sub_routes(shell, (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "base_route"), null);
61841
+ (0, _yuneta_gobj_js.gobj_unsubscribe_event)(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
61842
+ }
61737
61843
  close_json_viewer(gobj);
61738
61844
  (0, _yuneta_gobj_js.gobj_stop_children)(gobj);
61739
61845
  }
@@ -61911,68 +62017,64 @@ function option_label(name) {
61911
62017
  * its context menu (the child's business).
61912
62018
  ************************************************************/
61913
62019
  function node_shape_items(gobj, wide) {
61914
- let options = NODE_MODES.map((mode) => [
61915
- "option",
62020
+ return [[
62021
+ "div",
61916
62022
  {
61917
- value: mode,
61918
- "data-i18n": NODE_MODE_LABELS[mode]
62023
+ class: "GRAPH_NODE_MODE buttons has-addons",
62024
+ style: "margin:0 0 0 .5rem; flex:0 0 auto; flex-wrap:nowrap;"
61919
62025
  },
61920
- (0, i18next.t)(NODE_MODE_LABELS[mode])
61921
- ]);
61922
- return [
61923
- [
61924
- "span",
61925
- {
61926
- class: "GRAPH_NODE_MODE_LABEL is-hidden-mobile",
61927
- style: "padding-left:10px; padding-right:5px;",
61928
- i18n: "nodes"
61929
- },
61930
- "nodes"
61931
- ],
61932
- [
61933
- "div",
61934
- { class: "select" },
61935
- [[
61936
- "select",
62026
+ NODE_MODES.map((mode) => {
62027
+ let key = NODE_MODE_LABELS[mode];
62028
+ return [
62029
+ "button",
61937
62030
  {
61938
- class: "GRAPH_NODE_MODE_SELECT",
61939
- title: (0, i18next.t)("nodes"),
61940
- "data-i18n-title": "nodes",
61941
- "aria-label": (0, i18next.t)("nodes"),
61942
- "data-i18n-aria-label": "nodes"
61943
- },
61944
- options
61945
- ]],
61946
- { change: (evt) => {
61947
- evt.stopPropagation();
61948
- (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_SET_NODE_MODE", { node_mode: evt.target.value }, gobj);
61949
- } }
61950
- ],
61951
- [
61952
- "button",
61953
- {
61954
- class: "GRAPH_NODE_LABELS button",
61955
- type: "button",
61956
- style: {
61957
- height: wide,
61958
- width: "2.5em"
62031
+ class: "GRAPH_NODE_MODE_BTN button",
62032
+ type: "button",
62033
+ "data-mode": mode,
62034
+ style: {
62035
+ height: wide,
62036
+ width: "2.5em"
62037
+ },
62038
+ title: (0, i18next.t)(key),
62039
+ "data-i18n-title": key,
62040
+ "aria-label": (0, i18next.t)(key),
62041
+ "data-i18n-aria-label": key,
62042
+ "aria-pressed": "false"
61959
62043
  },
61960
- title: (0, i18next.t)("node labels"),
61961
- "data-i18n-title": "node labels",
61962
- "aria-label": (0, i18next.t)("node labels"),
61963
- "data-i18n-aria-label": "node labels",
61964
- "aria-pressed": "false"
62044
+ ["i", {
62045
+ style: "font-size:1.5em; color:inherit;",
62046
+ class: NODE_MODE_ICONS[mode]
62047
+ }],
62048
+ { click: (evt) => {
62049
+ evt.stopPropagation();
62050
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_SET_NODE_MODE", { node_mode: mode }, gobj);
62051
+ } }
62052
+ ];
62053
+ })
62054
+ ], [
62055
+ "button",
62056
+ {
62057
+ class: "GRAPH_NODE_LABELS button",
62058
+ type: "button",
62059
+ style: {
62060
+ height: wide,
62061
+ width: "2.5em"
61965
62062
  },
61966
- ["i", {
61967
- style: "font-size:1.5em; color:inherit;",
61968
- class: "yi-font"
61969
- }],
61970
- { click: (evt) => {
61971
- evt.stopPropagation();
61972
- (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_TOGGLE_NODE_LABELS", {}, gobj);
61973
- } }
61974
- ]
61975
- ];
62063
+ title: (0, i18next.t)("node labels"),
62064
+ "data-i18n-title": "node labels",
62065
+ "aria-label": (0, i18next.t)("node labels"),
62066
+ "data-i18n-aria-label": "node labels",
62067
+ "aria-pressed": "false"
62068
+ },
62069
+ ["i", {
62070
+ style: "font-size:1.5em; color:inherit;",
62071
+ class: "yi-font"
62072
+ }],
62073
+ { click: (evt) => {
62074
+ evt.stopPropagation();
62075
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_TOGGLE_NODE_LABELS", {}, gobj);
62076
+ } }
62077
+ ]];
61976
62078
  }
61977
62079
  var NODE_MODES = [
61978
62080
  "expanded",
@@ -61984,13 +62086,21 @@ var NODE_MODE_LABELS = {
61984
62086
  compact: "compact",
61985
62087
  shape: "shape"
61986
62088
  };
62089
+ var NODE_MODE_ICONS = {
62090
+ expanded: "yi-square",
62091
+ compact: "yi-bars",
62092
+ shape: "yi-hexagon-nodes"
62093
+ };
61987
62094
  function refresh_node_shape_buttons(gobj, $root) {
61988
62095
  if (!$root) return;
61989
62096
  let mode = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "node_mode");
61990
62097
  if (!NODE_MODES.includes(mode)) mode = "expanded";
61991
62098
  let labels = (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "node_labels");
61992
- let $mode = $root.querySelector(".GRAPH_NODE_MODE_SELECT");
61993
- if ($mode) $mode.value = mode;
62099
+ for (let $btn of $root.querySelectorAll(".GRAPH_NODE_MODE_BTN")) {
62100
+ let on = $btn.getAttribute("data-mode") === mode;
62101
+ $btn.classList.toggle("pressed_state", on);
62102
+ $btn.setAttribute("aria-pressed", on ? "true" : "false");
62103
+ }
61994
62104
  set_pressed_state($root, ".GRAPH_NODE_LABELS", labels);
61995
62105
  let $labels = $root.querySelector(".GRAPH_NODE_LABELS");
61996
62106
  if ($labels) {
@@ -63131,11 +63241,13 @@ function refresh_legend(gobj) {
63131
63241
  },
63132
63242
  hidden ? `${entry.total}` : `${entry.visible}/${entry.total}`
63133
63243
  ]);
63244
+ let body_key = is_main ? "main topic" : hidden ? "show topic" : "hide topic";
63134
63245
  let body_attrs = {
63135
63246
  class: "GRAPH_LEGEND_ITEM button is-small" + (focused ? " GRAPH_LEGEND_FOCUSED" : "") + (is_main ? " GRAPH_LEGEND_MAIN" : ""),
63136
63247
  type: "button",
63137
63248
  style: "gap:0; flex:0 0 auto;" + (focused ? " box-shadow: inset 0 0 0 2px var(--bulma-text, #2e333d);" : ""),
63138
- title: is_main ? (0, i18next.t)("main topic") : hidden ? (0, i18next.t)("show topic") : (0, i18next.t)("hide topic"),
63249
+ title: (0, i18next.t)(body_key),
63250
+ "data-i18n-title": body_key,
63139
63251
  "aria-label": topic_name,
63140
63252
  "aria-pressed": hidden ? "false" : "true"
63141
63253
  };
@@ -63162,6 +63274,7 @@ function refresh_legend(gobj) {
63162
63274
  title: (0, i18next.t)("main topic"),
63163
63275
  "data-i18n-title": "main topic",
63164
63276
  "aria-label": (0, i18next.t)("main topic"),
63277
+ "data-i18n-aria-label": "main topic",
63165
63278
  "aria-pressed": "true"
63166
63279
  },
63167
63280
  [[
@@ -63199,7 +63312,8 @@ function refresh_legend(gobj) {
63199
63312
  style: "padding:0 .4rem;",
63200
63313
  title: (0, i18next.t)("main topic"),
63201
63314
  "data-i18n-title": "main topic",
63202
- "aria-label": (0, i18next.t)("main topic")
63315
+ "aria-label": (0, i18next.t)("main topic"),
63316
+ "data-i18n-aria-label": "main topic"
63203
63317
  },
63204
63318
  [[
63205
63319
  "span",
@@ -63223,6 +63337,7 @@ function refresh_legend(gobj) {
63223
63337
  title: (0, i18next.t)("loose records"),
63224
63338
  "data-i18n-title": "loose records",
63225
63339
  "aria-label": (0, i18next.t)("loose records"),
63340
+ "data-i18n-aria-label": "loose records",
63226
63341
  "aria-pressed": entry.loose_shown ? "true" : "false"
63227
63342
  },
63228
63343
  `+${entry.loose}`,
@@ -63243,6 +63358,7 @@ function refresh_legend(gobj) {
63243
63358
  title: (0, i18next.t)("highlight topic"),
63244
63359
  "data-i18n-title": "highlight topic",
63245
63360
  "aria-label": (0, i18next.t)("highlight topic"),
63361
+ "data-i18n-aria-label": "highlight topic",
63246
63362
  "aria-pressed": focused ? "true" : "false"
63247
63363
  },
63248
63364
  [["i", {
@@ -63269,6 +63385,18 @@ function refresh_legend(gobj) {
63269
63385
  }
63270
63386
  }
63271
63387
  /************************************************************
63388
+ * The application changed language. `refresh_language()` has
63389
+ * already been over the document by now (the shell runs it
63390
+ * before publishing), so what is left is what carries no key:
63391
+ * the legend, whose chips say an ACTION that depends on the
63392
+ * state, and the find box's counted line.
63393
+ ************************************************************/
63394
+ function ac_language_changed$2(gobj, event, kw, src) {
63395
+ refresh_legend(gobj);
63396
+ refresh_find_result(gobj);
63397
+ return 0;
63398
+ }
63399
+ /************************************************************
63272
63400
  * The engine said what is drawn: repaint the strip.
63273
63401
  ************************************************************/
63274
63402
  function ac_legend_state(gobj, event, kw, src) {
@@ -63410,6 +63538,12 @@ function ac_toggle_node_labels(gobj, event, kw, src) {
63410
63538
  * term typed is an ANSWER and is shown; an empty box shows nothing.
63411
63539
  ************************************************************/
63412
63540
  function ac_find_result(gobj, event, kw, src) {
63541
+ gobj.priv._find_result = kw || null;
63542
+ refresh_find_result(gobj);
63543
+ return 0;
63544
+ }
63545
+ function refresh_find_result(gobj) {
63546
+ let kw = gobj.priv._find_result;
63413
63547
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
63414
63548
  if (!$container) return 0;
63415
63549
  let $result = $container.querySelector(".GRAPH_FIND_RESULT");
@@ -63663,6 +63797,11 @@ function create_gclass$3(gclass_name) {
63663
63797
  "EV_TRANSPORT_STATE",
63664
63798
  ac_transport_state$1,
63665
63799
  null
63800
+ ],
63801
+ [
63802
+ "EV_LANGUAGE_CHANGED",
63803
+ ac_language_changed$2,
63804
+ null
63666
63805
  ]
63667
63806
  ]]];
63668
63807
  const event_types = [
@@ -63704,6 +63843,7 @@ function create_gclass$3(gclass_name) {
63704
63843
  ["EV_RECORD_WRITTEN", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS],
63705
63844
  ["EV_SHOW", 0],
63706
63845
  ["EV_HIDE", 0],
63846
+ ["EV_LANGUAGE_CHANGED", 0],
63707
63847
  ["EV_TRANSPORT_STATE", 0]
63708
63848
  ];
63709
63849
  __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);