@yuneta/gobj-ui 7.23.83 → 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.
@@ -13982,7 +13982,7 @@ function ac_json_item_clicked(gobj, event, kw, src) {
13982
13982
  /************************************************************
13983
13983
  * EV_LANGUAGE_CHANGED — re-translate chrome + re-render
13984
13984
  ************************************************************/
13985
- function ac_language_changed$6(gobj, event, kw, src) {
13985
+ function ac_language_changed$8(gobj, event, kw, src) {
13986
13986
  let priv = gobj.priv;
13987
13987
  let $container = gobj_read_attr(gobj, "$container");
13988
13988
  if ($container) {
@@ -14043,7 +14043,7 @@ function create_gclass$12(gclass_name) {
14043
14043
  ],
14044
14044
  [
14045
14045
  "EV_LANGUAGE_CHANGED",
14046
- ac_language_changed$6,
14046
+ ac_language_changed$8,
14047
14047
  null
14048
14048
  ],
14049
14049
  [
@@ -14119,7 +14119,7 @@ function create_gclass$12(gclass_name) {
14119
14119
  ],
14120
14120
  [
14121
14121
  "EV_LANGUAGE_CHANGED",
14122
- ac_language_changed$6,
14122
+ ac_language_changed$8,
14123
14123
  null
14124
14124
  ],
14125
14125
  [
@@ -15058,7 +15058,7 @@ function ac_theme_changed(gobj, event, kw, src) {
15058
15058
  * inside an innerHTML string, where refresh_language()
15059
15059
  * cannot reach.
15060
15060
  ************************************************************/
15061
- function ac_language_changed$5(gobj, event, kw, src) {
15061
+ function ac_language_changed$7(gobj, event, kw, src) {
15062
15062
  let $container = gobj_read_attr(gobj, "$container");
15063
15063
  if ($container) refresh_language($container, t);
15064
15064
  load_fsm(gobj);
@@ -15165,7 +15165,7 @@ function create_gclass$11(gclass_name) {
15165
15165
  ],
15166
15166
  [
15167
15167
  "EV_LANGUAGE_CHANGED",
15168
- ac_language_changed$5,
15168
+ ac_language_changed$7,
15169
15169
  null
15170
15170
  ],
15171
15171
  [
@@ -16722,7 +16722,7 @@ function ac_copy_all(gobj, event, kw, src) {
16722
16722
  * is. Re-rendering is the only way both end up in the same
16723
16723
  * language.
16724
16724
  ************************************************************/
16725
- function ac_language_changed$4(gobj, event, kw, src) {
16725
+ function ac_language_changed$6(gobj, event, kw, src) {
16726
16726
  let priv = gobj.priv;
16727
16727
  let $container = gobj_read_attr(gobj, "$container");
16728
16728
  if ($container) {
@@ -16814,7 +16814,7 @@ function create_gclass$10(gclass_name) {
16814
16814
  ],
16815
16815
  [
16816
16816
  "EV_LANGUAGE_CHANGED",
16817
- ac_language_changed$4,
16817
+ ac_language_changed$6,
16818
16818
  null
16819
16819
  ],
16820
16820
  [
@@ -19398,7 +19398,7 @@ function ac_gclass_closed(gobj, event, kw, src) {
19398
19398
  * A rebuild, not a re-translation: the words live inside the
19399
19399
  * innerHTML of G6 nodes, where refresh_language() cannot go.
19400
19400
  ************************************************************/
19401
- function ac_language_changed$3(gobj, event, kw, src) {
19401
+ function ac_language_changed$5(gobj, event, kw, src) {
19402
19402
  let $container = gobj_read_attr(gobj, "$container");
19403
19403
  if ($container) refresh_language($container, t);
19404
19404
  hide_popover(gobj);
@@ -19542,7 +19542,7 @@ function create_gclass$9(gclass_name) {
19542
19542
  ],
19543
19543
  [
19544
19544
  "EV_LANGUAGE_CHANGED",
19545
- ac_language_changed$3,
19545
+ ac_language_changed$5,
19546
19546
  null
19547
19547
  ]
19548
19548
  ]]], gmt$9, 0, attrs_table$9, PRIVATE_DATA$9, 0, 0, 0, 0);
@@ -25730,7 +25730,7 @@ function refuse_if_readonly$2(gobj, event) {
25730
25730
  * placeholder, its loading/error notices — drawn once, from its own lang
25731
25731
  * dict. Re-apply it in the new language.
25732
25732
  ***************************************************************/
25733
- function ac_language_changed$2(gobj, event, kw, src) {
25733
+ function ac_language_changed$4(gobj, event, kw, src) {
25734
25734
  let bar = gobj_read_attr(gobj, "selection_bar");
25735
25735
  if (bar) bar.refresh();
25736
25736
  let tabulator = gobj_read_attr(gobj, "tabulator");
@@ -26568,7 +26568,7 @@ function create_gclass$5(gclass_name) {
26568
26568
  const states = [["ST_IDLE", [
26569
26569
  [
26570
26570
  "EV_LANGUAGE_CHANGED",
26571
- ac_language_changed$2,
26571
+ ac_language_changed$4,
26572
26572
  null
26573
26573
  ],
26574
26574
  [
@@ -27415,8 +27415,10 @@ function fold_reveal(model, state, node_key) {
27415
27415
  *
27416
27416
  * `radial`: the root in the middle and a ring per depth, each
27417
27417
  * subtree owning a sector proportional to its leaves; the radius
27418
- * of a ring grows until its neighbours sit side by side, so
27419
- * nothing overlaps by construction (see `layout_radial`).
27418
+ * of a ring grows until its neighbours sit side by side AND
27419
+ * until it clears the ring inside it, so nothing overlaps by
27420
+ * construction, across the ring or along the radius (see
27421
+ * `layout_radial`).
27420
27422
  *
27421
27423
  * Pure: takes plain nodes and edges, returns positions. The G6
27422
27424
  * classes in c_g6_nodes_tree.js are two thin adapters over it.
@@ -27596,6 +27598,10 @@ function tidy_tree_lr(nodes, edges, o) {
27596
27598
  }
27597
27599
  return pos;
27598
27600
  }
27601
+ function extent_at(n, a) {
27602
+ if (!n) return 0;
27603
+ return Math.abs(n.w * Math.cos(a)) + Math.abs(n.h * Math.sin(a));
27604
+ }
27599
27605
  /************************************************************
27600
27606
  * The radial tree: the root in the middle, a ring per depth.
27601
27607
  *
@@ -27638,14 +27644,15 @@ function layout_radial(nodes, edges, opts) {
27638
27644
  let ring_of = (id) => t.depth.get(id) + (single ? 0 : 1);
27639
27645
  let angle = /* @__PURE__ */ new Map();
27640
27646
  let rings = [];
27641
- let sector = (root_id, root_from, root_span) => {
27647
+ let sector = (root_id, root_from, root_span, root_parent) => {
27642
27648
  let stack = [{
27643
27649
  id: root_id,
27644
27650
  from: root_from,
27645
- span: root_span
27651
+ span: root_span,
27652
+ parent: root_parent
27646
27653
  }];
27647
27654
  while (stack.length) {
27648
- let { id, from, span } = stack.pop();
27655
+ let { id, from, span, parent } = stack.pop();
27649
27656
  let a = from + span / 2;
27650
27657
  angle.set(id, a);
27651
27658
  let ring = ring_of(id);
@@ -27654,7 +27661,9 @@ function layout_radial(nodes, edges, opts) {
27654
27661
  rings[ring].push({
27655
27662
  id,
27656
27663
  angle: a,
27657
- diag: Math.hypot(n.w, n.h)
27664
+ diag: Math.hypot(n.w, n.h),
27665
+ ext: extent_at(n, a),
27666
+ parent_ext: parent ? extent_at(t.by_id.get(parent), a) : 0
27658
27667
  });
27659
27668
  let cursor = from;
27660
27669
  for (let kid of t.children.get(id) || []) {
@@ -27662,7 +27671,8 @@ function layout_radial(nodes, edges, opts) {
27662
27671
  stack.push({
27663
27672
  id: kid,
27664
27673
  from: cursor,
27665
- span: part
27674
+ span: part,
27675
+ parent: id
27666
27676
  });
27667
27677
  cursor += part;
27668
27678
  }
@@ -27674,20 +27684,21 @@ function layout_radial(nodes, edges, opts) {
27674
27684
  let cursor = -Math.PI / 2;
27675
27685
  for (let kid of t.children.get(root) || []) {
27676
27686
  let part = 2 * Math.PI * leaves.get(kid) / leaves.get(root);
27677
- sector(kid, cursor, part);
27687
+ sector(kid, cursor, part, root);
27678
27688
  cursor += part;
27679
27689
  }
27680
27690
  } else {
27681
27691
  let cursor = -Math.PI / 2;
27682
27692
  for (let root of t.roots) {
27683
27693
  let part = 2 * Math.PI * leaves.get(root) / total;
27684
- sector(root, cursor, part);
27694
+ sector(root, cursor, part, null);
27685
27695
  cursor += part;
27686
27696
  }
27687
27697
  }
27688
27698
  let radius = [0];
27689
27699
  for (let ring = 1; ring < rings.length; ring++) {
27690
27700
  let r = radius[ring - 1] + o.ranksep;
27701
+ for (let n of rings[ring] || []) r = Math.max(r, radius[ring - 1] + (n.parent_ext + n.ext) / 2 + o.nodesep);
27691
27702
  let list = (rings[ring] || []).slice().sort((a, b) => a.angle - b.angle);
27692
27703
  for (let i = 0; i < list.length && list.length > 1; i++) {
27693
27704
  let a = list[i];
@@ -54673,11 +54684,14 @@ var PRIVATE_DATA$4 = {
54673
54684
  _edge_icon_el: null,
54674
54685
  _edge_delete_el: null,
54675
54686
  _edge_popover_el: null,
54687
+ _edge_preview_undo: null,
54676
54688
  _port_icon_el: null,
54677
54689
  _port_popover_el: null,
54690
+ _port_preview_undo: null,
54678
54691
  _node_icon_el: null,
54679
54692
  _node_delete_el: null,
54680
54693
  _node_popover_el: null,
54694
+ _node_preview_undo: null,
54681
54695
  _node_detail_el: null,
54682
54696
  _detail_node_id: null,
54683
54697
  _delete_confirm_el: null,
@@ -54761,12 +54775,16 @@ function mt_writing$1(gobj, path) {
54761
54775
  * Framework Method: Start
54762
54776
  ***************************************************************/
54763
54777
  function mt_start$4(gobj) {
54778
+ let shell = yui_shell_of(gobj);
54779
+ if (shell) gobj_subscribe_event(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
54764
54780
  return 0;
54765
54781
  }
54766
54782
  /***************************************************************
54767
54783
  * Framework Method: Stop
54768
54784
  ***************************************************************/
54769
54785
  function mt_stop$4(gobj) {
54786
+ let shell = yui_shell_of(gobj);
54787
+ if (shell) gobj_unsubscribe_event(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
54770
54788
  return 0;
54771
54789
  }
54772
54790
  /***************************************************************
@@ -54774,10 +54792,6 @@ function mt_stop$4(gobj) {
54774
54792
  ***************************************************************/
54775
54793
  function mt_destroy$4(gobj) {
54776
54794
  let priv = gobj.priv;
54777
- if (priv._on_language_changed) {
54778
- i18next.off("languageChanged", priv._on_language_changed);
54779
- priv._on_language_changed = null;
54780
- }
54781
54795
  uninstall_fold_listener(gobj);
54782
54796
  if (priv._on_pointerdown_focus) {
54783
54797
  priv.$container.removeEventListener("pointerdown", priv._on_pointerdown_focus, true);
@@ -54972,11 +54986,6 @@ function configure_events(gobj) {
54972
54986
  priv.last_zoom = z;
54973
54987
  if (priv.anchor_state === "on" && priv.anchor_id) yui_graph_center_on(priv.graph, priv.anchor_id);
54974
54988
  });
54975
- priv._on_language_changed = () => {
54976
- update_toolbar(gobj);
54977
- repaint_more_chips(gobj);
54978
- };
54979
- i18next.on("languageChanged", priv._on_language_changed);
54980
54989
  priv._on_pointerdown_focus = (ev) => {
54981
54990
  let target = ev.target;
54982
54991
  if (target && typeof target.closest === "function") {
@@ -55494,12 +55503,23 @@ var LR_LAYOUTS = ["dagre"];
55494
55503
  * toolbar's +/-, and the two-finger pinch of g6_touch_gestures.
55495
55504
  * `enable` on the scroll keeps the two apart: a Ctrl wheel is
55496
55505
  * the zoom's, so the scroll stands aside for it.
55506
+ *
55507
+ * And the two have to name the SAME key, or the gesture falls
55508
+ * between them: the scroll stood aside for Meta as well, while
55509
+ * the zoom listened for Control alone, so Cmd + wheel neither
55510
+ * scrolled nor zoomed. It is ONE key and not two because a G6
55511
+ * `trigger` is a CHORD, not a list of alternatives -- its
55512
+ * `Shortcut.match()` compares the held keys to the bound ones
55513
+ * as a SET, so ["Control", "Meta"] means both keys down at
55514
+ * once. Control it is, on every platform: it is what a
55515
+ * trackpad pinch arrives as, so a Mac keeps its pinch and
55516
+ * gains nothing to press by mistake.
55497
55517
  ************************************************************/
55498
55518
  function camera_behaviors() {
55499
55519
  return [{
55500
55520
  type: "scroll-canvas",
55501
55521
  key: "scroll-canvas",
55502
- enable: (event) => !(event && (event.ctrlKey || event.metaKey))
55522
+ enable: (event) => !(event && event.ctrlKey)
55503
55523
  }, {
55504
55524
  type: "zoom-canvas",
55505
55525
  key: "zoom-canvas",
@@ -56967,6 +56987,34 @@ function hide_overlay(gobj, ...keys) {
56967
56987
  /************************************************************
56968
56988
  * Enable the save button (mark graph as dirty).
56969
56989
  ************************************************************/
56990
+ /************************************************************
56991
+ * A popover that PREVIEWS its changes owes an undo.
56992
+ *
56993
+ * What the preview writes is not the reader's answer until
56994
+ * `apply` is pressed, and `cancel` used to be the only way
56995
+ * back: every other way out of the popover -- a click on the
56996
+ * canvas, the icon pressed again, the element going away --
56997
+ * left the preview standing on the element, and the next Save
56998
+ * wrote it to `__graphs__`. So the undo is kept beside the
56999
+ * popover and run by whoever hides it; `apply` drops it first,
57000
+ * because then the preview IS the answer.
57001
+ ************************************************************/
57002
+ function set_preview_undo(gobj, key, undo) {
57003
+ gobj.priv[key] = undo;
57004
+ }
57005
+ function drop_preview_undo(gobj, key) {
57006
+ gobj.priv[key] = null;
57007
+ }
57008
+ function run_preview_undo(gobj, key) {
57009
+ let undo = gobj.priv[key];
57010
+ gobj.priv[key] = null;
57011
+ if (!undo || gobj_is_destroying(gobj)) return;
57012
+ try {
57013
+ undo();
57014
+ } catch (e) {
57015
+ log_error(`${gobj_short_name(gobj)}: cannot undo the preview: ${e}`);
57016
+ }
57017
+ }
56970
57018
  function mark_graph_dirty(gobj) {
56971
57019
  let $container = gobj_read_attr(gobj, "$container");
56972
57020
  enableElements($container, ".EV_SAVE_GRAPH");
@@ -57564,6 +57612,26 @@ function port_hit_slop_world(graph) {
57564
57612
  return slop / zoom;
57565
57613
  }
57566
57614
  /************************************************************
57615
+ * Whether a point landed on a port, by the port's SHAPE.
57616
+ *
57617
+ * A port was a circle and the test was a radius; since 7.23.81
57618
+ * it can be a square, a diamond or a triangle too, and a circle
57619
+ * around a diamond answers for the air off its corners while
57620
+ * missing the middle of its edges. `r` is the drawn radius with
57621
+ * the hit slop already added, and the shapes are the ones
57622
+ * TreedbCard.drawPortShapes() draws from it.
57623
+ *
57624
+ * dx, dy the point, relative to the port's centre
57625
+ ************************************************************/
57626
+ function port_shape_hit(shape, dx, dy, r) {
57627
+ switch (shape) {
57628
+ case "square": return Math.abs(dx) <= r && Math.abs(dy) <= r;
57629
+ case "diamond": return Math.abs(dx) + Math.abs(dy) <= r;
57630
+ case "triangle": return dy <= r && 2 * Math.abs(dx) - dy <= r;
57631
+ default: return Math.hypot(dx, dy) <= r;
57632
+ }
57633
+ }
57634
+ /************************************************************
57567
57635
  * Detect if a click in canvas coordinates hits a port.
57568
57636
  * Returns the port key string, or null if no port hit.
57569
57637
  ************************************************************/
@@ -57585,7 +57653,7 @@ function detect_port_click(gobj, node_id, canvasX, canvasY) {
57585
57653
  let dx = canvasX - px;
57586
57654
  let dy = canvasY - py;
57587
57655
  let dist = Math.sqrt(dx * dx + dy * dy);
57588
- if (dist <= r + slop && dist < best_dist) {
57656
+ if (port_shape_hit(ports[i].shape, dx, dy, r + slop) && dist < best_dist) {
57589
57657
  best_dist = dist;
57590
57658
  best_key = ports[i].key;
57591
57659
  }
@@ -57726,6 +57794,7 @@ function toggle_port_popover(gobj) {
57726
57794
  else show_port_popover(gobj);
57727
57795
  }
57728
57796
  function hide_port_popover(gobj) {
57797
+ run_preview_undo(gobj, "_port_preview_undo");
57729
57798
  hide_overlay(gobj, "_port_popover_el");
57730
57799
  }
57731
57800
  function ports_with(ports, port_key, changes) {
@@ -57747,6 +57816,18 @@ function show_port_popover(gobj) {
57747
57816
  let xy = port_icon_xy(gobj);
57748
57817
  if (!xy) return;
57749
57818
  const popover = create_popover_base(xy.x + floating_popover_dx(), xy.y, "g6-port-popover", "#d9d9d9", 180);
57819
+ let undo_port = () => {
57820
+ graph.updateNodeData([{
57821
+ id: node_id,
57822
+ style: { ports: ports_with(nodeData.style.ports, port_key, {
57823
+ shape: orig_shape,
57824
+ r: orig_r
57825
+ }) }
57826
+ }]);
57827
+ graph.draw().then(() => {
57828
+ update_port_resize_handles_position(gobj);
57829
+ });
57830
+ };
57750
57831
  function preview_port() {
57751
57832
  let r = parseInt(rInput.value) || orig_r;
57752
57833
  graph.updateNodeData([{
@@ -57790,27 +57871,19 @@ function show_port_popover(gobj) {
57790
57871
  text: "cancel",
57791
57872
  style: BTN_STYLE_CANCEL,
57792
57873
  onClick: () => {
57793
- graph.updateNodeData([{
57794
- id: node_id,
57795
- style: { ports: ports_with(nodeData.style.ports, port_key, {
57796
- shape: orig_shape,
57797
- r: orig_r
57798
- }) }
57799
- }]);
57800
- graph.draw().then(() => {
57801
- update_port_resize_handles_position(gobj);
57802
- });
57803
57874
  hide_port_popover(gobj);
57804
57875
  }
57805
57876
  }, {
57806
57877
  text: "apply",
57807
57878
  style: "flex:1;padding:6px;background:#1890ff;color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:13px;font-weight:500;",
57808
57879
  onClick: () => {
57880
+ drop_preview_undo(gobj, "_port_preview_undo");
57809
57881
  apply_port_properties(gobj, node_id, port_key, shapeSelect.value, parseInt(rInput.value) || orig_r, scopeSelect.value);
57810
57882
  }
57811
57883
  }]);
57812
57884
  priv.$container.appendChild(popover);
57813
57885
  priv._port_popover_el = popover;
57886
+ set_preview_undo(gobj, "_port_preview_undo", undo_port);
57814
57887
  clamp_popover_position(gobj, popover);
57815
57888
  }
57816
57889
  /************************************************************
@@ -58412,6 +58485,16 @@ function show_edge_popover(gobj) {
58412
58485
  let mid = get_edge_viewport_midpoint(gobj, edge_id);
58413
58486
  if (!mid) return;
58414
58487
  const popover = create_popover_base(mid.x + floating_popover_dx(), mid.y + floating_icon_dy(), "g6-edge-popover", "#d9d9d9", 180);
58488
+ let undo_edge = () => {
58489
+ graph.updateEdgeData([{
58490
+ id: edge_id,
58491
+ style: {
58492
+ lineWidth: origLW,
58493
+ stroke: origStroke
58494
+ }
58495
+ }]);
58496
+ graph.draw();
58497
+ };
58415
58498
  function preview_edge() {
58416
58499
  let lw = parseInt(lwInput.value) || 2;
58417
58500
  let color = colorInput.value;
@@ -58447,25 +58530,19 @@ function show_edge_popover(gobj) {
58447
58530
  text: "cancel",
58448
58531
  style: BTN_STYLE_CANCEL,
58449
58532
  onClick: () => {
58450
- graph.updateEdgeData([{
58451
- id: edge_id,
58452
- style: {
58453
- lineWidth: origLW,
58454
- stroke: origStroke
58455
- }
58456
- }]);
58457
- graph.draw();
58458
58533
  deselect_edge(gobj);
58459
58534
  }
58460
58535
  }, {
58461
58536
  text: "apply",
58462
58537
  style: "flex:1;padding:6px;background:#52c41a;color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:13px;font-weight:500;",
58463
58538
  onClick: () => {
58539
+ drop_preview_undo(gobj, "_edge_preview_undo");
58464
58540
  apply_edge_properties(gobj, edge_id, parseInt(lwInput.value) || 2, colorInput.value, scopeSelect.value);
58465
58541
  }
58466
58542
  }]);
58467
58543
  priv.$container.appendChild(popover);
58468
58544
  priv._edge_popover_el = popover;
58545
+ set_preview_undo(gobj, "_edge_preview_undo", undo_edge);
58469
58546
  clamp_popover_position(gobj, popover);
58470
58547
  }
58471
58548
  /************************************************************
@@ -58487,6 +58564,7 @@ function clamp_popover_position(gobj, popover) {
58487
58564
  popover.style.top = top + "px";
58488
58565
  }
58489
58566
  function hide_edge_popover(gobj) {
58567
+ run_preview_undo(gobj, "_edge_preview_undo");
58490
58568
  hide_overlay(gobj, "_edge_popover_el");
58491
58569
  }
58492
58570
  /************************************************************
@@ -58562,6 +58640,22 @@ function show_node_popover(gobj) {
58562
58640
  if (!rect) return;
58563
58641
  const popover = create_popover_base(rect.right + floating_popover_dx(), rect.top + floating_icon_dy(), "g6-node-popover", "#d9d9d9", 180);
58564
58642
  let node_graph_type = nodeData.data && nodeData.data.desc ? nodeData.data.desc.node_treedb_type : null;
58643
+ let undo_node = () => {
58644
+ let restoreStyle = {
58645
+ fill: origFill,
58646
+ stroke: origStroke,
58647
+ lineWidth: origLW
58648
+ };
58649
+ if (node_graph_type === "hierarchical") {
58650
+ let record = nodeData.data.record || {};
58651
+ 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));
58652
+ }
58653
+ graph.updateNodeData([{
58654
+ id: node_id,
58655
+ style: restoreStyle
58656
+ }]);
58657
+ graph.draw();
58658
+ };
58565
58659
  function preview_node() {
58566
58660
  let fill = fillInput.value;
58567
58661
  let updateStyle = {
@@ -58612,34 +58706,23 @@ function show_node_popover(gobj) {
58612
58706
  text: "cancel",
58613
58707
  style: BTN_STYLE_CANCEL,
58614
58708
  onClick: () => {
58615
- let restoreStyle = {
58616
- fill: origFill,
58617
- stroke: origStroke,
58618
- lineWidth: origLW
58619
- };
58620
- if (node_graph_type === "hierarchical") {
58621
- let record = nodeData.data.record || {};
58622
- 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));
58623
- }
58624
- graph.updateNodeData([{
58625
- id: node_id,
58626
- style: restoreStyle
58627
- }]);
58628
- graph.draw();
58629
58709
  hide_node_popover(gobj);
58630
58710
  }
58631
58711
  }, {
58632
58712
  text: "apply",
58633
58713
  style: "flex:1;padding:6px;background:#1890ff;color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:13px;font-weight:500;",
58634
58714
  onClick: () => {
58715
+ drop_preview_undo(gobj, "_node_preview_undo");
58635
58716
  apply_node_properties(gobj, node_id, fillInput.value, strokeInput.value, parseInt(lwInput.value) || 1, scopeSelect.value, shapeSelect.value);
58636
58717
  }
58637
58718
  }]);
58638
58719
  priv.$container.appendChild(popover);
58639
58720
  priv._node_popover_el = popover;
58721
+ set_preview_undo(gobj, "_node_preview_undo", undo_node);
58640
58722
  clamp_popover_position(gobj, popover);
58641
58723
  }
58642
58724
  function hide_node_popover(gobj) {
58725
+ run_preview_undo(gobj, "_node_preview_undo");
58643
58726
  hide_overlay(gobj, "_node_popover_el");
58644
58727
  }
58645
58728
  /************************************************************
@@ -60282,6 +60365,17 @@ async function reconcile_fold_apply(gobj, opts, visible) {
60282
60365
  return changed;
60283
60366
  }
60284
60367
  /************************************************************
60368
+ * The application changed language: what this gclass DRAWS has
60369
+ * to be drawn again. `refresh_language()` reaches what carries
60370
+ * an i18n key in the DOM; a G6 toolbar and the html of a chip
60371
+ * are built here and carry none.
60372
+ ************************************************************/
60373
+ function ac_language_changed$3(gobj, event, kw, src) {
60374
+ update_toolbar(gobj);
60375
+ repaint_more_chips(gobj);
60376
+ return 0;
60377
+ }
60378
+ /************************************************************
60285
60379
  * Repaint the `+N` chips (theme or language changed).
60286
60380
  ************************************************************/
60287
60381
  function repaint_more_chips(gobj) {
@@ -61517,6 +61611,11 @@ function create_gclass$4(gclass_name) {
61517
61611
  "EV_THEME",
61518
61612
  ac_theme$1,
61519
61613
  null
61614
+ ],
61615
+ [
61616
+ "EV_LANGUAGE_CHANGED",
61617
+ ac_language_changed$3,
61618
+ null
61520
61619
  ]
61521
61620
  ]]];
61522
61621
  const event_types = [
@@ -61577,7 +61676,8 @@ function create_gclass$4(gclass_name) {
61577
61676
  ["EV_SHOW", 0],
61578
61677
  ["EV_HIDE", 0],
61579
61678
  ["EV_RESIZE", 0],
61580
- ["EV_THEME", 0]
61679
+ ["EV_THEME", 0],
61680
+ ["EV_LANGUAGE_CHANGED", 0]
61581
61681
  ];
61582
61682
  __gclass__$4 = gclass_create(gclass_name, event_types, states, gmt$4, 0, attrs_table$4, PRIVATE_DATA$4, 0, 0, 0, gclass_flag_t.gcflag_manual_start);
61583
61683
  if (!__gclass__$4) return -1;
@@ -61665,6 +61765,7 @@ var PRIVATE_DATA$3 = {
61665
61765
  layout: null,
61666
61766
  _topics_subscribed: {},
61667
61767
  _legend_state: null,
61768
+ _find_result: null,
61668
61769
  _links_subscribed: false,
61669
61770
  is_pinhold_window: false
61670
61771
  };
@@ -61718,6 +61819,8 @@ function mt_writing(gobj, path) {
61718
61819
  ***************************************************************/
61719
61820
  function mt_start$3(gobj) {
61720
61821
  let priv = gobj.priv;
61822
+ let shell = yui_shell_of(gobj);
61823
+ if (shell) gobj_subscribe_event(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
61721
61824
  if (priv.gobj_nodes_tree) gobj_start(priv.gobj_nodes_tree);
61722
61825
  if (priv.gobj_treedb_tables) gobj_start(priv.gobj_treedb_tables);
61723
61826
  request_treedb_descs(gobj);
@@ -61728,7 +61831,10 @@ function mt_start$3(gobj) {
61728
61831
  ***************************************************************/
61729
61832
  function mt_stop$3(gobj) {
61730
61833
  let shell = yui_shell_of(gobj);
61731
- if (shell) yui_shell_set_sub_routes(shell, gobj_read_str_attr(gobj, "base_route"), null);
61834
+ if (shell) {
61835
+ yui_shell_set_sub_routes(shell, gobj_read_str_attr(gobj, "base_route"), null);
61836
+ gobj_unsubscribe_event(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
61837
+ }
61732
61838
  close_json_viewer(gobj);
61733
61839
  gobj_stop_children(gobj);
61734
61840
  }
@@ -63130,11 +63236,13 @@ function refresh_legend(gobj) {
63130
63236
  },
63131
63237
  hidden ? `${entry.total}` : `${entry.visible}/${entry.total}`
63132
63238
  ]);
63239
+ let body_key = is_main ? "main topic" : hidden ? "show topic" : "hide topic";
63133
63240
  let body_attrs = {
63134
63241
  class: "GRAPH_LEGEND_ITEM button is-small" + (focused ? " GRAPH_LEGEND_FOCUSED" : "") + (is_main ? " GRAPH_LEGEND_MAIN" : ""),
63135
63242
  type: "button",
63136
63243
  style: "gap:0; flex:0 0 auto;" + (focused ? " box-shadow: inset 0 0 0 2px var(--bulma-text, #2e333d);" : ""),
63137
- title: is_main ? t("main topic") : hidden ? t("show topic") : t("hide topic"),
63244
+ title: t(body_key),
63245
+ "data-i18n-title": body_key,
63138
63246
  "aria-label": topic_name,
63139
63247
  "aria-pressed": hidden ? "false" : "true"
63140
63248
  };
@@ -63161,6 +63269,7 @@ function refresh_legend(gobj) {
63161
63269
  title: t("main topic"),
63162
63270
  "data-i18n-title": "main topic",
63163
63271
  "aria-label": t("main topic"),
63272
+ "data-i18n-aria-label": "main topic",
63164
63273
  "aria-pressed": "true"
63165
63274
  },
63166
63275
  [[
@@ -63198,7 +63307,8 @@ function refresh_legend(gobj) {
63198
63307
  style: "padding:0 .4rem;",
63199
63308
  title: t("main topic"),
63200
63309
  "data-i18n-title": "main topic",
63201
- "aria-label": t("main topic")
63310
+ "aria-label": t("main topic"),
63311
+ "data-i18n-aria-label": "main topic"
63202
63312
  },
63203
63313
  [[
63204
63314
  "span",
@@ -63222,6 +63332,7 @@ function refresh_legend(gobj) {
63222
63332
  title: t("loose records"),
63223
63333
  "data-i18n-title": "loose records",
63224
63334
  "aria-label": t("loose records"),
63335
+ "data-i18n-aria-label": "loose records",
63225
63336
  "aria-pressed": entry.loose_shown ? "true" : "false"
63226
63337
  },
63227
63338
  `+${entry.loose}`,
@@ -63242,6 +63353,7 @@ function refresh_legend(gobj) {
63242
63353
  title: t("highlight topic"),
63243
63354
  "data-i18n-title": "highlight topic",
63244
63355
  "aria-label": t("highlight topic"),
63356
+ "data-i18n-aria-label": "highlight topic",
63245
63357
  "aria-pressed": focused ? "true" : "false"
63246
63358
  },
63247
63359
  [["i", {
@@ -63268,6 +63380,18 @@ function refresh_legend(gobj) {
63268
63380
  }
63269
63381
  }
63270
63382
  /************************************************************
63383
+ * The application changed language. `refresh_language()` has
63384
+ * already been over the document by now (the shell runs it
63385
+ * before publishing), so what is left is what carries no key:
63386
+ * the legend, whose chips say an ACTION that depends on the
63387
+ * state, and the find box's counted line.
63388
+ ************************************************************/
63389
+ function ac_language_changed$2(gobj, event, kw, src) {
63390
+ refresh_legend(gobj);
63391
+ refresh_find_result(gobj);
63392
+ return 0;
63393
+ }
63394
+ /************************************************************
63271
63395
  * The engine said what is drawn: repaint the strip.
63272
63396
  ************************************************************/
63273
63397
  function ac_legend_state(gobj, event, kw, src) {
@@ -63409,6 +63533,12 @@ function ac_toggle_node_labels(gobj, event, kw, src) {
63409
63533
  * term typed is an ANSWER and is shown; an empty box shows nothing.
63410
63534
  ************************************************************/
63411
63535
  function ac_find_result(gobj, event, kw, src) {
63536
+ gobj.priv._find_result = kw || null;
63537
+ refresh_find_result(gobj);
63538
+ return 0;
63539
+ }
63540
+ function refresh_find_result(gobj) {
63541
+ let kw = gobj.priv._find_result;
63412
63542
  let $container = gobj_read_attr(gobj, "$container");
63413
63543
  if (!$container) return 0;
63414
63544
  let $result = $container.querySelector(".GRAPH_FIND_RESULT");
@@ -63662,6 +63792,11 @@ function create_gclass$3(gclass_name) {
63662
63792
  "EV_TRANSPORT_STATE",
63663
63793
  ac_transport_state$1,
63664
63794
  null
63795
+ ],
63796
+ [
63797
+ "EV_LANGUAGE_CHANGED",
63798
+ ac_language_changed$2,
63799
+ null
63665
63800
  ]
63666
63801
  ]]];
63667
63802
  const event_types = [
@@ -63703,6 +63838,7 @@ function create_gclass$3(gclass_name) {
63703
63838
  ["EV_RECORD_WRITTEN", event_flag_t.EVF_OUTPUT_EVENT | event_flag_t.EVF_NO_WARN_SUBS],
63704
63839
  ["EV_SHOW", 0],
63705
63840
  ["EV_HIDE", 0],
63841
+ ["EV_LANGUAGE_CHANGED", 0],
63706
63842
  ["EV_TRANSPORT_STATE", 0]
63707
63843
  ];
63708
63844
  __gclass__$3 = gclass_create(gclass_name, event_types, states, gmt$3, 0, attrs_table$3, PRIVATE_DATA$3, 0, 0, 0, 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.83",
3
+ "version": "7.23.84",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",