@yuneta/gobj-ui 7.27.21 → 7.27.23

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.
@@ -23677,6 +23677,60 @@ function describe_js_gobj(target_gobj, is_root) {
23677
23677
  }
23678
23678
  return d;
23679
23679
  }
23680
+ /************************************************************
23681
+ * A descriptor from ONE node of the `view-gobj-tree` answer
23682
+ * of a backend yuno.
23683
+ *
23684
+ * `shortname` is the key the node hangs from in that answer;
23685
+ * the node itself repeats it, so the argument is only the
23686
+ * fallback for a filtered answer that dropped the field.
23687
+ ************************************************************/
23688
+ function describe_backend_node(shortname, node, is_root) {
23689
+ if (!node || typeof node !== "object") return null;
23690
+ let flags = Array.isArray(node.gobj_flags) ? node.gobj_flags : [];
23691
+ let has = (flag) => flags.indexOf(flag) !== -1;
23692
+ let d = {
23693
+ gclass: node.gclass || "",
23694
+ name: node.name || "",
23695
+ shortname: node.shortname || shortname || "",
23696
+ fullname: node.fullname || "",
23697
+ parent: node.parent || "",
23698
+ state: node.state || "",
23699
+ running: !!node.running,
23700
+ playing: !!node.playing,
23701
+ service: !!node.service || has("gobj_flag_service") || has("gobj_flag_default_service"),
23702
+ volatil: !!node.volatil || has("gobj_flag_volatil"),
23703
+ pure_child: has("gobj_flag_pure_child"),
23704
+ disabled: !!node.disabled,
23705
+ bottom_gobj: node.bottom_gobj || "",
23706
+ commands: !!node.commands,
23707
+ gobj_flags: flags,
23708
+ gobj_trace_level: Array.isArray(node.gobj_trace_level) ? node.gobj_trace_level : [],
23709
+ is_yuno: is_root !== void 0 ? !!is_root : has("gobj_flag_yuno"),
23710
+ children: []
23711
+ };
23712
+ let children = node.children && typeof node.children === "object" ? node.children : null;
23713
+ if (children) for (let key of Object.keys(children)) {
23714
+ let cd = describe_backend_node(key, children[key], false);
23715
+ if (cd) d.children.push(cd);
23716
+ }
23717
+ return d;
23718
+ }
23719
+ /************************************************************
23720
+ * The whole `view-gobj-tree` answer -> the root descriptor.
23721
+ *
23722
+ * That answer is a dict of ONE key (the shortname of the gobj
23723
+ * the command was asked about) even though it is shaped as a
23724
+ * dict all the way down. Returns null for anything else, and
23725
+ * the caller reports it: an empty tree and a malformed answer
23726
+ * must not look the same.
23727
+ ************************************************************/
23728
+ function describe_backend_tree(data) {
23729
+ if (!data || typeof data !== "object" || Array.isArray(data)) return null;
23730
+ let keys = Object.keys(data);
23731
+ if (keys.length === 0) return null;
23732
+ return describe_backend_node(keys[0], data[keys[0]], true);
23733
+ }
23680
23734
  /******************************
23681
23735
  * Readouts
23682
23736
  ******************************/
@@ -23709,6 +23763,7 @@ function node_badge_keys(d) {
23709
23763
  if (d.disabled) badges.push("disabled");
23710
23764
  if (d.bottom_gobj) badges.push("bottom");
23711
23765
  if (d.commands) badges.push("commands");
23766
+ if (Array.isArray(d.gobj_trace_level) && d.gobj_trace_level.length > 0) badges.push("traces");
23712
23767
  return badges;
23713
23768
  }
23714
23769
  /************************************************************
@@ -23746,7 +23801,8 @@ function node_labels(t) {
23746
23801
  "pure child": t("pure child"),
23747
23802
  "disabled": t("disabled"),
23748
23803
  "bottom": t("bottom"),
23749
- "commands": t("commands")
23804
+ "commands": t("commands"),
23805
+ "traces": t("traces")
23750
23806
  },
23751
23807
  field: {
23752
23808
  gclass: t("gclass"),
@@ -23795,6 +23851,82 @@ function node_info_rows(d, t) {
23795
23851
  if (kids > 0) rows.push([f.children, d.is_collapsed ? kids + " " + f.collapsed : String(kids)]);
23796
23852
  return rows;
23797
23853
  }
23854
+ /******************************
23855
+ * Trace levels
23856
+ ******************************/
23857
+ /************************************************************
23858
+ * The rows of the TRACES block of a backend gobj, one per
23859
+ * level it can trace: the gclass' own levels first (the ones
23860
+ * that are about this gobj), then the global ones.
23861
+ *
23862
+ * `d` is the descriptor (its `gobj_trace_level` is what the
23863
+ * gobj traces NOW, whatever the reason). `info` is what the
23864
+ * host fetched for its gclass:
23865
+ *
23866
+ * gclass_levels {name: description} info-gclass-trace
23867
+ * global_levels {name: description} info-global-trace
23868
+ * gclass_on [name, ...] get-gclass-trace
23869
+ * global_on [name, ...] get-global-trace
23870
+ *
23871
+ * `get-gclass-trace` answers the gclass' levels OR'ed with the
23872
+ * global ones (gobj_get_gclass_trace_level), so a level on in
23873
+ * both is counted as global: that is the one that would still
23874
+ * hold it on if the gclass let go.
23875
+ *
23876
+ * Each row says, for the two columns of the block:
23877
+ *
23878
+ * gobj_on, gobj_locked the gobj traces it; locked when
23879
+ * that comes from its gclass or
23880
+ * from the global level -- turning
23881
+ * the gobj's own bit off would not
23882
+ * stop it
23883
+ * gclass_on, gclass_locked every gobj of the gclass traces
23884
+ * it; locked when it is global
23885
+ * origin "global" | "gclass" | ""
23886
+ ************************************************************/
23887
+ function trace_rows(d, info) {
23888
+ let rows = [];
23889
+ if (!d || !info) return rows;
23890
+ let list = (x) => Array.isArray(x) ? x : [];
23891
+ let now = list(d.gobj_trace_level);
23892
+ let global_on = list(info.global_on);
23893
+ let gclass_on = list(info.gclass_on);
23894
+ let seen = {};
23895
+ let add = (group, levels) => {
23896
+ if (!levels || typeof levels !== "object") return;
23897
+ for (let level of Object.keys(levels)) {
23898
+ if (seen[level]) continue;
23899
+ seen[level] = true;
23900
+ let by_global = global_on.indexOf(level) >= 0;
23901
+ let by_gclass = !by_global && gclass_on.indexOf(level) >= 0;
23902
+ rows.push({
23903
+ level,
23904
+ description: String(levels[level] || ""),
23905
+ group,
23906
+ gobj_on: now.indexOf(level) >= 0 || by_global || by_gclass,
23907
+ gobj_locked: by_global || by_gclass,
23908
+ gclass_on: by_global || by_gclass,
23909
+ gclass_locked: by_global,
23910
+ origin: by_global ? "global" : by_gclass ? "gclass" : ""
23911
+ });
23912
+ }
23913
+ };
23914
+ add("gclass", info.gclass_levels);
23915
+ add("global", info.global_levels);
23916
+ return rows;
23917
+ }
23918
+ /************************************************************
23919
+ * The levels a scope holds ON ITS OWN -- what "remove the
23920
+ * traces" of that scope has to turn off. Not the locked ones:
23921
+ * they are held by a wider scope, and turning them off here
23922
+ * would change nothing.
23923
+ ************************************************************/
23924
+ function own_trace_levels(rows, scope) {
23925
+ let out = [];
23926
+ for (let r of rows || []) if (scope === "gobj" && r.gobj_on && !r.gobj_locked) out.push(r.level);
23927
+ else if (scope === "gclass" && r.gclass_on && !r.gclass_locked) out.push(r.level);
23928
+ return out;
23929
+ }
23798
23930
  //#endregion
23799
23931
  //#region src/gclass_describe.js
23800
23932
  /***********************************************************************
@@ -24183,7 +24315,42 @@ function is_mobile$3() {
24183
24315
  /***********************************************************************
24184
24316
  * c_yui_gobj_tree_js.js
24185
24317
  *
24186
- * Hierarchical tree graph (G6) of the gobj tree of the own yuno.
24318
+ * Hierarchical tree graph (G6) of the gobj tree of a yuno.
24319
+ *
24320
+ * Two sources (`source`):
24321
+ *
24322
+ * - "local" (default): the yuno of THIS browser, read live.
24323
+ * - "remote": a BACKEND yuno. The view cannot ask a backend
24324
+ * anything -- it has no transport, and which link reaches
24325
+ * the yuno is the host's business -- so it publishes what
24326
+ * it WANTS and the host answers with the data:
24327
+ *
24328
+ * out EV_TREE_WANTED {} Refresh pressed
24329
+ * in EV_LOAD_TREE {tree} the `view-gobj-tree` answer
24330
+ * out EV_TRACE_INFO_WANTED {gclass} a card was opened
24331
+ * in EV_TRACE_INFO {gclass, gclass_levels, global_levels,
24332
+ * gclass_on, global_on, error}
24333
+ * out EV_SET_TRACE_LEVEL {scope: "gobj"|"gclass", gobj,
24334
+ * gclass, levels: [...], set}
24335
+ * out EV_GCLASS_WANTED {gclass} the gclass button
24336
+ * in EV_GCLASS_DESCRIPTION {gclass, description}
24337
+ *
24338
+ * The host loads the FIRST tree on its own (it opened the
24339
+ * view); the view asks again only when Refresh is pressed.
24340
+ * After a trace is set the host loads the tree and the
24341
+ * trace info again: the card the reader is on stays open.
24342
+ *
24343
+ * In "remote" the popover of a card has a TRACES block: one
24344
+ * row per level (the gclass' own, then the global ones), a
24345
+ * checkbox for THIS gobj (`set-gobj-trace`) and one for every
24346
+ * gobj of its gclass (`set-gclass-trace`). A level that is on
24347
+ * for the gclass, or globally, is shown on and locked in the
24348
+ * gobj column, with where it comes from: it cannot be turned
24349
+ * off from one gobj. A gclass level is saved by the yuno and
24350
+ * survives a restart; a gobj level lasts until the yuno ends.
24351
+ *
24352
+ * The output events are published ONLY in "remote", so a host
24353
+ * of a local tree (the Frontend view) declares none of them.
24187
24354
  *
24188
24355
  * Copyright (c) 2025-2026, ArtGins.
24189
24356
  * All Rights Reserved.
@@ -24199,6 +24366,8 @@ var attrs_table$9 = [
24199
24366
  SDATA(data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
24200
24367
  SDATA(data_type_t.DTP_POINTER, "$container", 0, null, "Container element"),
24201
24368
  SDATA(data_type_t.DTP_STRING, "canvas_id", 0, "", "Canvas ID"),
24369
+ SDATA(data_type_t.DTP_STRING, "source", 0, "local", "Whose tree: local (this browser yuno, read live) | remote (a backend yuno, loaded by the host with EV_LOAD_TREE)"),
24370
+ SDATA(data_type_t.DTP_STRING, "yuno_name", 0, "", "remote: the name the yuno is shown by (the gclass window says it before the gclass)"),
24202
24371
  SDATA(data_type_t.DTP_STRING, "wide", 0, "40px", "Height of header. 40px and not 36: it is what an untouched Bulma control measures, so the find box stood 4px taller than every button beside it, and it is what the third graph of the family (C_YUI_TREEDB_GRAPH) uses"),
24203
24372
  SDATA(data_type_t.DTP_STRING, "layout", 0, "vertical-compact", "Current layout key"),
24204
24373
  SDATA(data_type_t.DTP_INTEGER, "collapse_threshold", 0, 10, "Auto-collapse a node whose direct children exceed this number. 0 disables auto-collapse."),
@@ -24323,7 +24492,10 @@ var PRIVATE_DATA$9 = {
24323
24492
  anchor_state: "off",
24324
24493
  restoring: false,
24325
24494
  restored: false,
24326
- last_zoom: 1
24495
+ last_zoom: 1,
24496
+ remote_root: null,
24497
+ trace_info: {},
24498
+ trace_pending: false
24327
24499
  };
24328
24500
  var __gclass__$9 = null;
24329
24501
  var __layout_registered__ = false;
@@ -25380,8 +25552,10 @@ function load_tree(gobj) {
25380
25552
  let priv = gobj.priv;
25381
25553
  let graph = priv.graph;
25382
25554
  if (!graph) return;
25383
- let root = describe_js_gobj(gobj_yuno(), true);
25555
+ let remote = is_remote(gobj);
25556
+ let root = remote ? priv.remote_root : describe_js_gobj(gobj_yuno(), true);
25384
25557
  if (!root) {
25558
+ if (remote) return;
25385
25559
  log_error(`${gobj_short_name(gobj)}: no yuno to draw`);
25386
25560
  return;
25387
25561
  }
@@ -25516,6 +25690,309 @@ function render_popover_body(gobj, node_data) {
25516
25690
  <span style="color:var(--bulma-text-strong, #1A1A1A); word-break:break-all;">${escapeHtml(String(value))}</span>
25517
25691
  </div>
25518
25692
  `).join("");
25693
+ if (is_remote(gobj)) $body.appendChild(build_traces_block(gobj, node_data));
25694
+ }
25695
+ /************************************************************
25696
+ * Whose tree this is.
25697
+ ************************************************************/
25698
+ function is_remote(gobj) {
25699
+ return gobj_read_str_attr(gobj, "source") === "remote";
25700
+ }
25701
+ /************************************************************
25702
+ * The TRACES block of a backend gobj's popover.
25703
+ *
25704
+ * Two columns of checkboxes, THIS gobj and every gobj of its
25705
+ * gclass, one row per level (trace_rows() in the model says
25706
+ * what each row holds). A box is an action: its change is
25707
+ * sent to the FSM, which publishes it to the host, and the
25708
+ * block stays locked until the host has loaded what the
25709
+ * backend says now -- the box shows the backend's state, not
25710
+ * the click.
25711
+ ************************************************************/
25712
+ var TRACES_NOTE_STYLE = "color:var(--bulma-text-weak, #6B7280); margin:4px 0;";
25713
+ var TRACES_CELL_STYLE = "padding:1px 4px; text-align:center;";
25714
+ function build_traces_block(gobj, d) {
25715
+ let priv = gobj.priv;
25716
+ let info = priv.trace_info[d.gclass] || null;
25717
+ let kids = [[
25718
+ "div",
25719
+ {
25720
+ class: "GOBJ_TREE_TRACES_HEAD",
25721
+ i18n: "traces",
25722
+ style: "font-weight:700; margin:8px 0 2px 0; padding-top:6px; border-top:1px solid var(--bulma-border-weak, #E5E7EB);"
25723
+ },
25724
+ t("traces")
25725
+ ]];
25726
+ if (!info) {
25727
+ kids.push([
25728
+ "div",
25729
+ {
25730
+ class: "GOBJ_TREE_TRACES_NOTE",
25731
+ i18n: "loading",
25732
+ style: TRACES_NOTE_STYLE
25733
+ },
25734
+ t("loading")
25735
+ ]);
25736
+ return createElement2([
25737
+ "div",
25738
+ { class: "GOBJ_TREE_TRACES" },
25739
+ kids
25740
+ ]);
25741
+ }
25742
+ if (info.error) {
25743
+ kids.push([
25744
+ "div",
25745
+ {
25746
+ class: "GOBJ_TREE_TRACES_ERROR",
25747
+ style: "color:var(--bulma-danger, #dc2626); margin:4px 0;"
25748
+ },
25749
+ text_node(info.error)
25750
+ ]);
25751
+ return createElement2([
25752
+ "div",
25753
+ { class: "GOBJ_TREE_TRACES" },
25754
+ kids
25755
+ ]);
25756
+ }
25757
+ let rows = trace_rows(d, info);
25758
+ let pending = !!priv.trace_pending;
25759
+ let trs = [];
25760
+ let group = "";
25761
+ for (let r of rows) {
25762
+ if (r.group !== group) {
25763
+ group = r.group;
25764
+ let $label = group === "gclass" ? text_node(d.gclass) : createElement2([
25765
+ "span",
25766
+ { i18n: "global" },
25767
+ t("global")
25768
+ ]);
25769
+ trs.push([
25770
+ "tr",
25771
+ { class: "GOBJ_TREE_TRACES_GROUP" },
25772
+ [[
25773
+ "td",
25774
+ {
25775
+ colspan: 3,
25776
+ style: "padding:4px 4px 1px 4px; font-weight:600; color:var(--bulma-text-weak, #6B7280);"
25777
+ },
25778
+ [$label]
25779
+ ]]
25780
+ ]);
25781
+ }
25782
+ let origin = null;
25783
+ if (r.origin === "global") origin = [
25784
+ "span",
25785
+ {
25786
+ class: "GOBJ_TREE_TRACES_ORIGIN",
25787
+ i18n: "global",
25788
+ style: "margin-left:6px; color:var(--bulma-text-weak, #6B7280);"
25789
+ },
25790
+ t("global")
25791
+ ];
25792
+ else if (r.origin === "gclass") origin = [
25793
+ "span",
25794
+ {
25795
+ class: "GOBJ_TREE_TRACES_ORIGIN",
25796
+ i18n: "gclass",
25797
+ style: "margin-left:6px; color:var(--bulma-text-weak, #6B7280);"
25798
+ },
25799
+ t("gclass")
25800
+ ];
25801
+ let $level = createElement2([
25802
+ "td",
25803
+ {
25804
+ class: "GOBJ_TREE_TRACES_LEVEL",
25805
+ style: "padding:1px 4px; word-break:break-all;"
25806
+ },
25807
+ []
25808
+ ]);
25809
+ $level.appendChild(text_node(r.level));
25810
+ if (origin) $level.appendChild(createElement2(origin));
25811
+ $level.setAttribute("title", r.description);
25812
+ trs.push([
25813
+ "tr",
25814
+ { class: "GOBJ_TREE_TRACES_ROW" },
25815
+ [
25816
+ $level,
25817
+ [
25818
+ "td",
25819
+ { style: TRACES_CELL_STYLE },
25820
+ [trace_checkbox(gobj, "gobj", r.level, r.gobj_on, pending || r.gobj_locked)]
25821
+ ],
25822
+ [
25823
+ "td",
25824
+ { style: TRACES_CELL_STYLE },
25825
+ [trace_checkbox(gobj, "gclass", r.level, r.gclass_on, pending || r.gclass_locked)]
25826
+ ]
25827
+ ]
25828
+ ]);
25829
+ }
25830
+ kids.push([
25831
+ "table",
25832
+ {
25833
+ class: "GOBJ_TREE_TRACES_TABLE",
25834
+ style: "width:100%; border-collapse:collapse;"
25835
+ },
25836
+ [[
25837
+ "thead",
25838
+ {},
25839
+ [[
25840
+ "tr",
25841
+ {},
25842
+ [
25843
+ [
25844
+ "th",
25845
+ {
25846
+ i18n: "level",
25847
+ style: "padding:1px 4px; text-align:left;"
25848
+ },
25849
+ t("level")
25850
+ ],
25851
+ [
25852
+ "th",
25853
+ {
25854
+ i18n: "this gobj",
25855
+ style: TRACES_CELL_STYLE
25856
+ },
25857
+ t("this gobj")
25858
+ ],
25859
+ [
25860
+ "th",
25861
+ {
25862
+ i18n: "all of the gclass",
25863
+ style: TRACES_CELL_STYLE
25864
+ },
25865
+ t("all of the gclass")
25866
+ ]
25867
+ ]
25868
+ ]]
25869
+ ], [
25870
+ "tbody",
25871
+ {},
25872
+ trs
25873
+ ]]
25874
+ ]);
25875
+ kids.push([
25876
+ "div",
25877
+ {
25878
+ class: "GOBJ_TREE_TRACES_NOTE",
25879
+ i18n: "gclass traces survive a restart, gobj traces end with the yuno",
25880
+ style: TRACES_NOTE_STYLE
25881
+ },
25882
+ t("gclass traces survive a restart, gobj traces end with the yuno")
25883
+ ]);
25884
+ let none_gobj = pending || own_trace_levels(rows, "gobj").length === 0;
25885
+ let none_gclass = pending || own_trace_levels(rows, "gclass").length === 0;
25886
+ let btn_style = "padding:0 8px; height:22px; font-size:11px; white-space:nowrap;";
25887
+ let clear = (scope) => {
25888
+ return { click: (evt) => {
25889
+ evt.stopPropagation();
25890
+ gobj_send_event(gobj, "EV_TRACES_CLEARED", { scope }, gobj);
25891
+ } };
25892
+ };
25893
+ let $clear_gobj = createElement2([
25894
+ "button",
25895
+ {
25896
+ type: "button",
25897
+ class: "GOBJ_TREE_TRACES_CLEAR_GOBJ button is-small",
25898
+ style: btn_style,
25899
+ i18n: "remove the traces of this gobj",
25900
+ title: t("remove the traces of this gobj"),
25901
+ "data-i18n-title": "remove the traces of this gobj",
25902
+ "aria-label": t("remove the traces of this gobj"),
25903
+ "data-i18n-aria-label": "remove the traces of this gobj"
25904
+ },
25905
+ t("remove the traces of this gobj"),
25906
+ clear("gobj")
25907
+ ]);
25908
+ let $clear_gclass = createElement2([
25909
+ "button",
25910
+ {
25911
+ type: "button",
25912
+ class: "GOBJ_TREE_TRACES_CLEAR_GCLASS button is-small",
25913
+ style: btn_style,
25914
+ i18n: "remove the traces of the gclass",
25915
+ title: t("remove the traces of the gclass"),
25916
+ "data-i18n-title": "remove the traces of the gclass",
25917
+ "aria-label": t("remove the traces of the gclass"),
25918
+ "data-i18n-aria-label": "remove the traces of the gclass"
25919
+ },
25920
+ t("remove the traces of the gclass"),
25921
+ clear("gclass")
25922
+ ]);
25923
+ $clear_gobj.disabled = none_gobj;
25924
+ $clear_gclass.disabled = none_gclass;
25925
+ kids.push([
25926
+ "div",
25927
+ {
25928
+ class: "GOBJ_TREE_TRACES_TOOLS",
25929
+ style: "display:flex; flex-wrap:wrap; gap:4px; margin-top:4px;"
25930
+ },
25931
+ [$clear_gobj, $clear_gclass]
25932
+ ]);
25933
+ return createElement2([
25934
+ "div",
25935
+ { class: "GOBJ_TREE_TRACES" },
25936
+ kids
25937
+ ]);
25938
+ }
25939
+ function trace_checkbox(gobj, scope, level, on, locked) {
25940
+ let $cb = null;
25941
+ if (scope === "gobj") $cb = createElement2(["input", {
25942
+ type: "checkbox",
25943
+ class: "GOBJ_TREE_TRACE_GOBJ",
25944
+ title: t("this gobj"),
25945
+ "data-i18n-title": "this gobj",
25946
+ "aria-label": t("this gobj"),
25947
+ "data-i18n-aria-label": "this gobj"
25948
+ }]);
25949
+ else $cb = createElement2(["input", {
25950
+ type: "checkbox",
25951
+ class: "GOBJ_TREE_TRACE_GCLASS",
25952
+ title: t("all of the gclass"),
25953
+ "data-i18n-title": "all of the gclass",
25954
+ "aria-label": t("all of the gclass"),
25955
+ "data-i18n-aria-label": "all of the gclass"
25956
+ }]);
25957
+ $cb.setAttribute("data-level", level);
25958
+ $cb.checked = !!on;
25959
+ $cb.disabled = !!locked;
25960
+ $cb.addEventListener("change", (evt) => {
25961
+ evt.stopPropagation();
25962
+ gobj_send_event(gobj, "EV_TRACE_TOGGLED", {
25963
+ scope,
25964
+ level,
25965
+ set: !!evt.target.checked
25966
+ }, gobj);
25967
+ });
25968
+ return $cb;
25969
+ }
25970
+ /************************************************************
25971
+ * Rebuild the graph and leave the popover where it was, on
25972
+ * the same gobj -- by full name, the node ids are new. A
25973
+ * reader who just ticked a trace is still reading that card.
25974
+ ************************************************************/
25975
+ function reload_keeping_popover(gobj, opts) {
25976
+ let priv = gobj.priv;
25977
+ let $popover = priv.$popover;
25978
+ let keep = priv.popover_node && $popover && $popover.style.display === "block" ? priv.popover_node.full_name : null;
25979
+ let left = $popover ? $popover.style.left : "";
25980
+ let top = $popover ? $popover.style.top : "";
25981
+ refresh_tree(gobj, opts);
25982
+ if (!keep || !priv.node_by_id) return;
25983
+ for (let id of Object.keys(priv.node_by_id)) {
25984
+ let d = priv.node_by_id[id];
25985
+ if (d.full_name === keep) {
25986
+ priv.popover_node = d;
25987
+ priv.$popover_title.textContent = d.short_name || d.gclass + (d.name ? "^" + d.name : "");
25988
+ priv.$popover_title.title = priv.$popover_title.textContent;
25989
+ render_popover_body(gobj, d);
25990
+ $popover.style.left = left;
25991
+ $popover.style.top = top;
25992
+ $popover.style.display = "block";
25993
+ return;
25994
+ }
25995
+ }
25519
25996
  }
25520
25997
  /************************************************************
25521
25998
  * Show popover next to the click position.
@@ -25840,6 +26317,10 @@ function ac_find_nodes$2(gobj, event, kw, src) {
25840
26317
  }
25841
26318
  function ac_refresh$3(gobj, event, kw, src) {
25842
26319
  save_view_state(gobj);
26320
+ if (is_remote(gobj)) {
26321
+ gobj_publish_event(gobj, "EV_TREE_WANTED", {});
26322
+ return 0;
26323
+ }
25843
26324
  refresh_tree(gobj);
25844
26325
  return 0;
25845
26326
  }
@@ -26099,6 +26580,7 @@ function ac_node_click$3(gobj, event, kw, src) {
26099
26580
  let client_x = kw.client_x || 0;
26100
26581
  let client_y = kw.client_y || 0;
26101
26582
  show_popover(gobj, node_data, client_x, client_y);
26583
+ if (is_remote(gobj)) gobj_publish_event(gobj, "EV_TRACE_INFO_WANTED", { gclass: node_data.gclass });
26102
26584
  return 0;
26103
26585
  }
26104
26586
  /************************************************************
@@ -26153,23 +26635,45 @@ function ac_hide$5(gobj, event, kw, src) {
26153
26635
  * first rather than stacking windows nobody closes.
26154
26636
  ************************************************************/
26155
26637
  function ac_open_gclass(gobj, event, kw, src) {
26156
- let priv = gobj.priv;
26157
- let node_data = priv.popover_node;
26638
+ let node_data = gobj.priv.popover_node;
26158
26639
  if (!node_data || !node_data.gclass) {
26159
26640
  log_error(`${gobj_short_name(gobj)}: EV_OPEN_GCLASS with no node`);
26160
26641
  return -1;
26161
26642
  }
26643
+ if (is_remote(gobj)) {
26644
+ gobj_publish_event(gobj, "EV_GCLASS_WANTED", { gclass: node_data.gclass });
26645
+ return 0;
26646
+ }
26647
+ open_gclass_window(gobj, node_data.gclass, null, node_data.state || "");
26648
+ return 0;
26649
+ }
26650
+ /************************************************************
26651
+ * remote: the `view-gclass` answer the host fetched.
26652
+ ************************************************************/
26653
+ function ac_gclass_description(gobj, event, kw, src) {
26654
+ let priv = gobj.priv;
26655
+ if (!kw || !kw.gclass || !kw.description || typeof kw.description !== "object") {
26656
+ log_error(`${gobj_short_name(gobj)}: EV_GCLASS_DESCRIPTION without a gclass description`);
26657
+ return -1;
26658
+ }
26659
+ let d = priv.popover_node;
26660
+ open_gclass_window(gobj, kw.gclass, kw.description, d && d.gclass === kw.gclass ? d.state || "" : "");
26661
+ return 0;
26662
+ }
26663
+ function open_gclass_window(gobj, gclass, description, state) {
26664
+ let priv = gobj.priv;
26162
26665
  close_gclass_view(priv.gclass_view);
26163
26666
  priv.gclass_view = null;
26164
- priv.gclass_view = open_gclass_view(gobj, node_data.gclass, {
26165
- title_prefix: gobj_yuno_name() || "",
26166
- current_state: node_data.state || "",
26667
+ let opts = {
26668
+ title_prefix: is_remote(gobj) ? gobj_read_str_attr(gobj, "yuno_name") || "" : gobj_yuno_name() || "",
26669
+ current_state: state,
26167
26670
  on_close: () => {
26168
26671
  if (gobj_is_destroying(gobj)) return;
26169
26672
  gobj_send_event(gobj, "EV_GCLASS_CLOSED", {}, gobj);
26170
26673
  }
26171
- });
26172
- return 0;
26674
+ };
26675
+ if (description) opts.description = description;
26676
+ priv.gclass_view = open_gclass_view(gobj, gclass, opts);
26173
26677
  }
26174
26678
  /************************************************************
26175
26679
  * The reader dismissed the gclass window (its own ✕).
@@ -26183,6 +26687,99 @@ function ac_gclass_closed(gobj, event, kw, src) {
26183
26687
  return 0;
26184
26688
  }
26185
26689
  /************************************************************
26690
+ * remote: the host loaded the tree (`view-gobj-tree`).
26691
+ *
26692
+ * The first one is framed like any opening; the next ones
26693
+ * keep the camera and the card the reader is on.
26694
+ ************************************************************/
26695
+ function ac_load_tree(gobj, event, kw, src) {
26696
+ let priv = gobj.priv;
26697
+ if (!is_remote(gobj)) {
26698
+ log_error(`${gobj_short_name(gobj)}: EV_LOAD_TREE on a tree whose source is not remote`);
26699
+ return -1;
26700
+ }
26701
+ let root = describe_backend_tree(kw && kw.tree);
26702
+ if (!root) {
26703
+ log_warning(`${gobj_short_name(gobj)}: what was loaded is not a view-gobj-tree answer`);
26704
+ return -1;
26705
+ }
26706
+ let first = !priv.remote_root;
26707
+ priv.remote_root = root;
26708
+ priv.trace_pending = false;
26709
+ reload_keeping_popover(gobj, first ? {} : { preserve_view: true });
26710
+ return 0;
26711
+ }
26712
+ /************************************************************
26713
+ * remote: the trace levels of a gclass, as the backend has
26714
+ * them now (or why they could not be read).
26715
+ ************************************************************/
26716
+ function ac_trace_info(gobj, event, kw, src) {
26717
+ let priv = gobj.priv;
26718
+ if (!kw || !kw.gclass) {
26719
+ log_error(`${gobj_short_name(gobj)}: EV_TRACE_INFO without a gclass`);
26720
+ return -1;
26721
+ }
26722
+ let list = (x) => Array.isArray(x) ? x : [];
26723
+ priv.trace_info[kw.gclass] = {
26724
+ gclass_levels: kw.gclass_levels || {},
26725
+ global_levels: kw.global_levels || {},
26726
+ gclass_on: list(kw.gclass_on),
26727
+ global_on: list(kw.global_on),
26728
+ error: kw.error || ""
26729
+ };
26730
+ priv.trace_pending = false;
26731
+ let d = priv.popover_node;
26732
+ if (d && d.gclass === kw.gclass && priv.$popover && priv.$popover.style.display === "block") render_popover_body(gobj, d);
26733
+ return 0;
26734
+ }
26735
+ /************************************************************
26736
+ * A box of the TRACES block was ticked or cleared.
26737
+ ************************************************************/
26738
+ function ac_trace_toggled(gobj, event, kw, src) {
26739
+ let d = gobj.priv.popover_node;
26740
+ if (!is_remote(gobj) || !d) {
26741
+ log_error(`${gobj_short_name(gobj)}: a trace set with no backend card open`);
26742
+ return -1;
26743
+ }
26744
+ if (!kw.level || kw.scope !== "gobj" && kw.scope !== "gclass") {
26745
+ log_error(`${gobj_short_name(gobj)}: a trace set of no level or scope: '${kw.scope}' '${kw.level}'`);
26746
+ return -1;
26747
+ }
26748
+ set_trace_levels(gobj, d, kw.scope, [kw.level], !!kw.set);
26749
+ return 0;
26750
+ }
26751
+ /************************************************************
26752
+ * "Remove the traces" of the gobj or of its gclass: every
26753
+ * level that scope holds on its own.
26754
+ ************************************************************/
26755
+ function ac_traces_cleared(gobj, event, kw, src) {
26756
+ let priv = gobj.priv;
26757
+ let d = priv.popover_node;
26758
+ if (!is_remote(gobj) || !d) {
26759
+ log_error(`${gobj_short_name(gobj)}: traces removed with no backend card open`);
26760
+ return -1;
26761
+ }
26762
+ let levels = own_trace_levels(trace_rows(d, priv.trace_info[d.gclass]), kw.scope);
26763
+ if (!levels.length) {
26764
+ log_error(`${gobj_short_name(gobj)}: no ${kw.scope} trace of ${d.full_name} to remove`);
26765
+ return -1;
26766
+ }
26767
+ set_trace_levels(gobj, d, kw.scope, levels, false);
26768
+ return 0;
26769
+ }
26770
+ function set_trace_levels(gobj, d, scope, levels, set) {
26771
+ let priv = gobj.priv;
26772
+ priv.trace_pending = true;
26773
+ render_popover_body(gobj, d);
26774
+ gobj_publish_event(gobj, "EV_SET_TRACE_LEVEL", {
26775
+ scope,
26776
+ gobj: d.full_name,
26777
+ gclass: d.gclass,
26778
+ levels,
26779
+ set
26780
+ });
26781
+ }
26782
+ /************************************************************
26186
26783
  * The app switched language.
26187
26784
  *
26188
26785
  * A rebuild, not a re-translation: the words live inside the
@@ -26213,28 +26810,7 @@ function create_gclass$9(gclass_name) {
26213
26810
  log_error(`GClass ALREADY created: ${gclass_name}`);
26214
26811
  return -1;
26215
26812
  }
26216
- __gclass__$9 = gclass_create(gclass_name, [
26217
- ["EV_FIND_NODES", 0],
26218
- ["EV_REFRESH", 0],
26219
- ["EV_THEME", 0],
26220
- ["EV_CHANGE_LAYOUT", 0],
26221
- ["EV_TOGGLE_COLLAPSE", 0],
26222
- ["EV_EXPAND_ALL", 0],
26223
- ["EV_COLLAPSE_ALL", 0],
26224
- ["EV_ZOOM_IN", 0],
26225
- ["EV_ZOOM_OUT", 0],
26226
- ["EV_ZOOM_RESET", 0],
26227
- ["EV_CENTER", 0],
26228
- ["EV_NODE_CLICK", 0],
26229
- ["EV_TOGGLE_ANCHOR", 0],
26230
- ["EV_CENTER_ANCHOR", 0],
26231
- ["EV_RESIZE", 0],
26232
- ["EV_SHOW", 0],
26233
- ["EV_HIDE", 0],
26234
- ["EV_OPEN_GCLASS", 0],
26235
- ["EV_GCLASS_CLOSED", 0],
26236
- ["EV_LANGUAGE_CHANGED", 0]
26237
- ], [["ST_IDLE", [
26813
+ const states = [["ST_IDLE", [
26238
26814
  [
26239
26815
  "EV_FIND_NODES",
26240
26816
  ac_find_nodes$2,
@@ -26334,8 +26910,65 @@ function create_gclass$9(gclass_name) {
26334
26910
  "EV_LANGUAGE_CHANGED",
26335
26911
  ac_language_changed$5,
26336
26912
  null
26913
+ ],
26914
+ [
26915
+ "EV_LOAD_TREE",
26916
+ ac_load_tree,
26917
+ null
26918
+ ],
26919
+ [
26920
+ "EV_TRACE_INFO",
26921
+ ac_trace_info,
26922
+ null
26923
+ ],
26924
+ [
26925
+ "EV_TRACE_TOGGLED",
26926
+ ac_trace_toggled,
26927
+ null
26928
+ ],
26929
+ [
26930
+ "EV_TRACES_CLEARED",
26931
+ ac_traces_cleared,
26932
+ null
26933
+ ],
26934
+ [
26935
+ "EV_GCLASS_DESCRIPTION",
26936
+ ac_gclass_description,
26937
+ null
26337
26938
  ]
26338
- ]]], gmt$9, 0, attrs_table$9, PRIVATE_DATA$9, 0, 0, 0, 0);
26939
+ ]]];
26940
+ const event_types = [
26941
+ ["EV_FIND_NODES", 0],
26942
+ ["EV_REFRESH", 0],
26943
+ ["EV_THEME", 0],
26944
+ ["EV_CHANGE_LAYOUT", 0],
26945
+ ["EV_TOGGLE_COLLAPSE", 0],
26946
+ ["EV_EXPAND_ALL", 0],
26947
+ ["EV_COLLAPSE_ALL", 0],
26948
+ ["EV_ZOOM_IN", 0],
26949
+ ["EV_ZOOM_OUT", 0],
26950
+ ["EV_ZOOM_RESET", 0],
26951
+ ["EV_CENTER", 0],
26952
+ ["EV_NODE_CLICK", 0],
26953
+ ["EV_TOGGLE_ANCHOR", 0],
26954
+ ["EV_CENTER_ANCHOR", 0],
26955
+ ["EV_RESIZE", 0],
26956
+ ["EV_SHOW", 0],
26957
+ ["EV_HIDE", 0],
26958
+ ["EV_OPEN_GCLASS", 0],
26959
+ ["EV_GCLASS_CLOSED", 0],
26960
+ ["EV_LANGUAGE_CHANGED", 0],
26961
+ ["EV_LOAD_TREE", 0],
26962
+ ["EV_TRACE_INFO", 0],
26963
+ ["EV_TRACE_TOGGLED", 0],
26964
+ ["EV_TRACES_CLEARED", 0],
26965
+ ["EV_GCLASS_DESCRIPTION", 0],
26966
+ ["EV_TREE_WANTED", event_flag_t.EVF_OUTPUT_EVENT],
26967
+ ["EV_TRACE_INFO_WANTED", event_flag_t.EVF_OUTPUT_EVENT],
26968
+ ["EV_SET_TRACE_LEVEL", event_flag_t.EVF_OUTPUT_EVENT],
26969
+ ["EV_GCLASS_WANTED", event_flag_t.EVF_OUTPUT_EVENT]
26970
+ ];
26971
+ __gclass__$9 = gclass_create(gclass_name, event_types, states, gmt$9, 0, attrs_table$9, PRIVATE_DATA$9, 0, 0, 0, 0);
26339
26972
  if (!__gclass__$9) return -1;
26340
26973
  return 0;
26341
26974
  }
@@ -85176,8 +85809,11 @@ function dir_arrow(dir) {
85176
85809
  function dev_num(key, def) {
85177
85810
  return Number(kw_get_local_storage_value(key, def === void 0 ? 0 : def, false));
85178
85811
  }
85812
+ function traffic_view_of(v) {
85813
+ return v === "expanded" || v === "line" ? v : "collapsed";
85814
+ }
85179
85815
  function dev_traffic_view() {
85180
- return kw_get_local_storage_value("dev_traffic_view", "collapsed", false) === "expanded" ? "expanded" : "collapsed";
85816
+ return traffic_view_of(kw_get_local_storage_value("dev_traffic_view", "collapsed", false));
85181
85817
  }
85182
85818
  function dev_traces_payload() {
85183
85819
  return dev_num("dev_traces_payload", 1) ? 1 : 0;
@@ -85199,7 +85835,12 @@ function console_traffic(title, jn, direction, size) {
85199
85835
  let kw = jn && jn.kw && typeof jn.kw === "object" ? jn.kw : jn;
85200
85836
  let color = direction === 2 ? "#16a34a" : direction === 3 ? "#dc2626" : "#2563eb";
85201
85837
  let head = "%c" + dir_arrow(direction) + " " + (title ? "[" + title + "] " : "") + event + (size ? " (" + size + "b)" : "");
85202
- if (dev_traffic_view() === "expanded") {
85838
+ let view = dev_traffic_view();
85839
+ if (view === "line") {
85840
+ window.console.log(head, "color:" + color);
85841
+ return;
85842
+ }
85843
+ if (view === "expanded") {
85203
85844
  let text;
85204
85845
  try {
85205
85846
  text = JSON.stringify(full_sections(kw), null, 4);
@@ -85212,7 +85853,7 @@ function console_traffic(title, jn, direction, size) {
85212
85853
  window.console.log(head, "color:" + color, kw);
85213
85854
  }
85214
85855
  function set_traffic_view(v) {
85215
- kw_set_local_storage_value("dev_traffic_view", v === "expanded" ? "expanded" : "collapsed");
85856
+ kw_set_local_storage_value("dev_traffic_view", traffic_view_of(v));
85216
85857
  rerender_all();
85217
85858
  refresh_dev_chrome();
85218
85859
  }
@@ -85381,6 +86022,9 @@ function ensure_dev_style() {
85381
86022
  .TRAFFIC_ENTRY.dir-out { border-left-color: #2563eb; }
85382
86023
  .TRAFFIC_ENTRY.dir-in { border-left-color: #059669; }
85383
86024
  .TRAFFIC_ENTRY.dir-err { border-left-color: #dc2626; }
86025
+ /* The line view: one row per message, no margin between rows, so a burst
86026
+ of messages reads as a list. */
86027
+ .TRAFFIC_ENTRY.TRAFFIC_NAME { margin: 1px 0; padding: 1px 8px; line-height: 1.45; display: flex; align-items: baseline; gap: 8px; }
85384
86028
  .TRAFFIC_HEADER { display: flex; align-items: baseline; gap: 8px; }
85385
86029
  .TRAFFIC_ARROW { font-weight: 700; }
85386
86030
  .TRAFFIC_EVENT { font-weight: 700; }
@@ -85772,6 +86416,19 @@ function render_full(e) {
85772
86416
  children
85773
86417
  ]);
85774
86418
  }
86419
+ function render_name(e) {
86420
+ let kids = event_spans(e);
86421
+ kids.push([
86422
+ "span",
86423
+ { class: "TRAFFIC_META" },
86424
+ `${traffic_size(e.size)} · ${e.ts}`
86425
+ ]);
86426
+ return createElement2([
86427
+ "div",
86428
+ { class: "TRAFFIC_ENTRY TRAFFIC_NAME " + dir_class(e.dir) },
86429
+ kids
86430
+ ]);
86431
+ }
85775
86432
  function render_log(e) {
85776
86433
  let $row = createElement2([
85777
86434
  "div",
@@ -85800,7 +86457,9 @@ function render_log(e) {
85800
86457
  }
85801
86458
  function render_entry(e) {
85802
86459
  if (e.kind === "log") return render_log(e);
85803
- if (dev_traffic_view() === "expanded") return render_full(e);
86460
+ let view = dev_traffic_view();
86461
+ if (view === "line") return render_name(e);
86462
+ if (view === "expanded") return render_full(e);
85804
86463
  return render_detailed(e);
85805
86464
  }
85806
86465
  /******************************
@@ -86172,7 +86831,9 @@ function traffic_to_text() {
86172
86831
  }
86173
86832
  let head = `${e.ts} ${dir_arrow(e.dir)} ${e.title ? "[" + e.title + "] " : ""}${e.event}${e.command ? " " + e.command : ""}`;
86174
86833
  out.push(head);
86175
- if (dev_traffic_view() !== "expanded" && e.$node) {
86834
+ let view = dev_traffic_view();
86835
+ if (view === "line") continue;
86836
+ if (view !== "expanded" && e.$node) {
86176
86837
  out.push(...entry_shown_lines(e.$node));
86177
86838
  out.push("");
86178
86839
  continue;
@@ -86268,6 +86929,7 @@ function build_control_bar() {
86268
86929
  } }
86269
86930
  ];
86270
86931
  let VIEW_TITLES = {
86932
+ line: "traffic one line per message",
86271
86933
  collapsed: "traffic payload folded",
86272
86934
  expanded: "traffic payload laid out"
86273
86935
  };
@@ -86295,7 +86957,11 @@ function build_control_bar() {
86295
86957
  class: "YDEV_SEG",
86296
86958
  id: "ydev-seg"
86297
86959
  },
86298
- [mk_view("collapsed", "collapsed"), mk_view("expanded", "expanded")]
86960
+ [
86961
+ mk_view("line", "one line"),
86962
+ mk_view("collapsed", "collapsed"),
86963
+ mk_view("expanded", "expanded")
86964
+ ]
86299
86965
  ];
86300
86966
  let OUT_TITLES = {
86301
86967
  window: "dev window only",