@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.
@@ -23682,6 +23682,60 @@ function describe_js_gobj(target_gobj, is_root) {
23682
23682
  }
23683
23683
  return d;
23684
23684
  }
23685
+ /************************************************************
23686
+ * A descriptor from ONE node of the `view-gobj-tree` answer
23687
+ * of a backend yuno.
23688
+ *
23689
+ * `shortname` is the key the node hangs from in that answer;
23690
+ * the node itself repeats it, so the argument is only the
23691
+ * fallback for a filtered answer that dropped the field.
23692
+ ************************************************************/
23693
+ function describe_backend_node(shortname, node, is_root) {
23694
+ if (!node || typeof node !== "object") return null;
23695
+ let flags = Array.isArray(node.gobj_flags) ? node.gobj_flags : [];
23696
+ let has = (flag) => flags.indexOf(flag) !== -1;
23697
+ let d = {
23698
+ gclass: node.gclass || "",
23699
+ name: node.name || "",
23700
+ shortname: node.shortname || shortname || "",
23701
+ fullname: node.fullname || "",
23702
+ parent: node.parent || "",
23703
+ state: node.state || "",
23704
+ running: !!node.running,
23705
+ playing: !!node.playing,
23706
+ service: !!node.service || has("gobj_flag_service") || has("gobj_flag_default_service"),
23707
+ volatil: !!node.volatil || has("gobj_flag_volatil"),
23708
+ pure_child: has("gobj_flag_pure_child"),
23709
+ disabled: !!node.disabled,
23710
+ bottom_gobj: node.bottom_gobj || "",
23711
+ commands: !!node.commands,
23712
+ gobj_flags: flags,
23713
+ gobj_trace_level: Array.isArray(node.gobj_trace_level) ? node.gobj_trace_level : [],
23714
+ is_yuno: is_root !== void 0 ? !!is_root : has("gobj_flag_yuno"),
23715
+ children: []
23716
+ };
23717
+ let children = node.children && typeof node.children === "object" ? node.children : null;
23718
+ if (children) for (let key of Object.keys(children)) {
23719
+ let cd = describe_backend_node(key, children[key], false);
23720
+ if (cd) d.children.push(cd);
23721
+ }
23722
+ return d;
23723
+ }
23724
+ /************************************************************
23725
+ * The whole `view-gobj-tree` answer -> the root descriptor.
23726
+ *
23727
+ * That answer is a dict of ONE key (the shortname of the gobj
23728
+ * the command was asked about) even though it is shaped as a
23729
+ * dict all the way down. Returns null for anything else, and
23730
+ * the caller reports it: an empty tree and a malformed answer
23731
+ * must not look the same.
23732
+ ************************************************************/
23733
+ function describe_backend_tree(data) {
23734
+ if (!data || typeof data !== "object" || Array.isArray(data)) return null;
23735
+ let keys = Object.keys(data);
23736
+ if (keys.length === 0) return null;
23737
+ return describe_backend_node(keys[0], data[keys[0]], true);
23738
+ }
23685
23739
  /******************************
23686
23740
  * Readouts
23687
23741
  ******************************/
@@ -23714,6 +23768,7 @@ function node_badge_keys(d) {
23714
23768
  if (d.disabled) badges.push("disabled");
23715
23769
  if (d.bottom_gobj) badges.push("bottom");
23716
23770
  if (d.commands) badges.push("commands");
23771
+ if (Array.isArray(d.gobj_trace_level) && d.gobj_trace_level.length > 0) badges.push("traces");
23717
23772
  return badges;
23718
23773
  }
23719
23774
  /************************************************************
@@ -23751,7 +23806,8 @@ function node_labels(t) {
23751
23806
  "pure child": t("pure child"),
23752
23807
  "disabled": t("disabled"),
23753
23808
  "bottom": t("bottom"),
23754
- "commands": t("commands")
23809
+ "commands": t("commands"),
23810
+ "traces": t("traces")
23755
23811
  },
23756
23812
  field: {
23757
23813
  gclass: t("gclass"),
@@ -23800,6 +23856,82 @@ function node_info_rows(d, t) {
23800
23856
  if (kids > 0) rows.push([f.children, d.is_collapsed ? kids + " " + f.collapsed : String(kids)]);
23801
23857
  return rows;
23802
23858
  }
23859
+ /******************************
23860
+ * Trace levels
23861
+ ******************************/
23862
+ /************************************************************
23863
+ * The rows of the TRACES block of a backend gobj, one per
23864
+ * level it can trace: the gclass' own levels first (the ones
23865
+ * that are about this gobj), then the global ones.
23866
+ *
23867
+ * `d` is the descriptor (its `gobj_trace_level` is what the
23868
+ * gobj traces NOW, whatever the reason). `info` is what the
23869
+ * host fetched for its gclass:
23870
+ *
23871
+ * gclass_levels {name: description} info-gclass-trace
23872
+ * global_levels {name: description} info-global-trace
23873
+ * gclass_on [name, ...] get-gclass-trace
23874
+ * global_on [name, ...] get-global-trace
23875
+ *
23876
+ * `get-gclass-trace` answers the gclass' levels OR'ed with the
23877
+ * global ones (gobj_get_gclass_trace_level), so a level on in
23878
+ * both is counted as global: that is the one that would still
23879
+ * hold it on if the gclass let go.
23880
+ *
23881
+ * Each row says, for the two columns of the block:
23882
+ *
23883
+ * gobj_on, gobj_locked the gobj traces it; locked when
23884
+ * that comes from its gclass or
23885
+ * from the global level -- turning
23886
+ * the gobj's own bit off would not
23887
+ * stop it
23888
+ * gclass_on, gclass_locked every gobj of the gclass traces
23889
+ * it; locked when it is global
23890
+ * origin "global" | "gclass" | ""
23891
+ ************************************************************/
23892
+ function trace_rows(d, info) {
23893
+ let rows = [];
23894
+ if (!d || !info) return rows;
23895
+ let list = (x) => Array.isArray(x) ? x : [];
23896
+ let now = list(d.gobj_trace_level);
23897
+ let global_on = list(info.global_on);
23898
+ let gclass_on = list(info.gclass_on);
23899
+ let seen = {};
23900
+ let add = (group, levels) => {
23901
+ if (!levels || typeof levels !== "object") return;
23902
+ for (let level of Object.keys(levels)) {
23903
+ if (seen[level]) continue;
23904
+ seen[level] = true;
23905
+ let by_global = global_on.indexOf(level) >= 0;
23906
+ let by_gclass = !by_global && gclass_on.indexOf(level) >= 0;
23907
+ rows.push({
23908
+ level,
23909
+ description: String(levels[level] || ""),
23910
+ group,
23911
+ gobj_on: now.indexOf(level) >= 0 || by_global || by_gclass,
23912
+ gobj_locked: by_global || by_gclass,
23913
+ gclass_on: by_global || by_gclass,
23914
+ gclass_locked: by_global,
23915
+ origin: by_global ? "global" : by_gclass ? "gclass" : ""
23916
+ });
23917
+ }
23918
+ };
23919
+ add("gclass", info.gclass_levels);
23920
+ add("global", info.global_levels);
23921
+ return rows;
23922
+ }
23923
+ /************************************************************
23924
+ * The levels a scope holds ON ITS OWN -- what "remove the
23925
+ * traces" of that scope has to turn off. Not the locked ones:
23926
+ * they are held by a wider scope, and turning them off here
23927
+ * would change nothing.
23928
+ ************************************************************/
23929
+ function own_trace_levels(rows, scope) {
23930
+ let out = [];
23931
+ for (let r of rows || []) if (scope === "gobj" && r.gobj_on && !r.gobj_locked) out.push(r.level);
23932
+ else if (scope === "gclass" && r.gclass_on && !r.gclass_locked) out.push(r.level);
23933
+ return out;
23934
+ }
23803
23935
  //#endregion
23804
23936
  //#region src/gclass_describe.js
23805
23937
  /***********************************************************************
@@ -24188,7 +24320,42 @@ function is_mobile$3() {
24188
24320
  /***********************************************************************
24189
24321
  * c_yui_gobj_tree_js.js
24190
24322
  *
24191
- * Hierarchical tree graph (G6) of the gobj tree of the own yuno.
24323
+ * Hierarchical tree graph (G6) of the gobj tree of a yuno.
24324
+ *
24325
+ * Two sources (`source`):
24326
+ *
24327
+ * - "local" (default): the yuno of THIS browser, read live.
24328
+ * - "remote": a BACKEND yuno. The view cannot ask a backend
24329
+ * anything -- it has no transport, and which link reaches
24330
+ * the yuno is the host's business -- so it publishes what
24331
+ * it WANTS and the host answers with the data:
24332
+ *
24333
+ * out EV_TREE_WANTED {} Refresh pressed
24334
+ * in EV_LOAD_TREE {tree} the `view-gobj-tree` answer
24335
+ * out EV_TRACE_INFO_WANTED {gclass} a card was opened
24336
+ * in EV_TRACE_INFO {gclass, gclass_levels, global_levels,
24337
+ * gclass_on, global_on, error}
24338
+ * out EV_SET_TRACE_LEVEL {scope: "gobj"|"gclass", gobj,
24339
+ * gclass, levels: [...], set}
24340
+ * out EV_GCLASS_WANTED {gclass} the gclass button
24341
+ * in EV_GCLASS_DESCRIPTION {gclass, description}
24342
+ *
24343
+ * The host loads the FIRST tree on its own (it opened the
24344
+ * view); the view asks again only when Refresh is pressed.
24345
+ * After a trace is set the host loads the tree and the
24346
+ * trace info again: the card the reader is on stays open.
24347
+ *
24348
+ * In "remote" the popover of a card has a TRACES block: one
24349
+ * row per level (the gclass' own, then the global ones), a
24350
+ * checkbox for THIS gobj (`set-gobj-trace`) and one for every
24351
+ * gobj of its gclass (`set-gclass-trace`). A level that is on
24352
+ * for the gclass, or globally, is shown on and locked in the
24353
+ * gobj column, with where it comes from: it cannot be turned
24354
+ * off from one gobj. A gclass level is saved by the yuno and
24355
+ * survives a restart; a gobj level lasts until the yuno ends.
24356
+ *
24357
+ * The output events are published ONLY in "remote", so a host
24358
+ * of a local tree (the Frontend view) declares none of them.
24192
24359
  *
24193
24360
  * Copyright (c) 2025-2026, ArtGins.
24194
24361
  * All Rights Reserved.
@@ -24204,6 +24371,8 @@ var attrs_table$9 = [
24204
24371
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
24205
24372
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "$container", 0, null, "Container element"),
24206
24373
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "canvas_id", 0, "", "Canvas ID"),
24374
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.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)"),
24375
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "yuno_name", 0, "", "remote: the name the yuno is shown by (the gclass window says it before the gclass)"),
24207
24376
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.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"),
24208
24377
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "layout", 0, "vertical-compact", "Current layout key"),
24209
24378
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_INTEGER, "collapse_threshold", 0, 10, "Auto-collapse a node whose direct children exceed this number. 0 disables auto-collapse."),
@@ -24328,7 +24497,10 @@ var PRIVATE_DATA$9 = {
24328
24497
  anchor_state: "off",
24329
24498
  restoring: false,
24330
24499
  restored: false,
24331
- last_zoom: 1
24500
+ last_zoom: 1,
24501
+ remote_root: null,
24502
+ trace_info: {},
24503
+ trace_pending: false
24332
24504
  };
24333
24505
  var __gclass__$9 = null;
24334
24506
  var __layout_registered__ = false;
@@ -25385,8 +25557,10 @@ function load_tree(gobj) {
25385
25557
  let priv = gobj.priv;
25386
25558
  let graph = priv.graph;
25387
25559
  if (!graph) return;
25388
- let root = describe_js_gobj((0, _yuneta_gobj_js.gobj_yuno)(), true);
25560
+ let remote = is_remote(gobj);
25561
+ let root = remote ? priv.remote_root : describe_js_gobj((0, _yuneta_gobj_js.gobj_yuno)(), true);
25389
25562
  if (!root) {
25563
+ if (remote) return;
25390
25564
  (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: no yuno to draw`);
25391
25565
  return;
25392
25566
  }
@@ -25521,6 +25695,309 @@ function render_popover_body(gobj, node_data) {
25521
25695
  <span style="color:var(--bulma-text-strong, #1A1A1A); word-break:break-all;">${(0, _yuneta_gobj_js.escapeHtml)(String(value))}</span>
25522
25696
  </div>
25523
25697
  `).join("");
25698
+ if (is_remote(gobj)) $body.appendChild(build_traces_block(gobj, node_data));
25699
+ }
25700
+ /************************************************************
25701
+ * Whose tree this is.
25702
+ ************************************************************/
25703
+ function is_remote(gobj) {
25704
+ return (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "source") === "remote";
25705
+ }
25706
+ /************************************************************
25707
+ * The TRACES block of a backend gobj's popover.
25708
+ *
25709
+ * Two columns of checkboxes, THIS gobj and every gobj of its
25710
+ * gclass, one row per level (trace_rows() in the model says
25711
+ * what each row holds). A box is an action: its change is
25712
+ * sent to the FSM, which publishes it to the host, and the
25713
+ * block stays locked until the host has loaded what the
25714
+ * backend says now -- the box shows the backend's state, not
25715
+ * the click.
25716
+ ************************************************************/
25717
+ var TRACES_NOTE_STYLE = "color:var(--bulma-text-weak, #6B7280); margin:4px 0;";
25718
+ var TRACES_CELL_STYLE = "padding:1px 4px; text-align:center;";
25719
+ function build_traces_block(gobj, d) {
25720
+ let priv = gobj.priv;
25721
+ let info = priv.trace_info[d.gclass] || null;
25722
+ let kids = [[
25723
+ "div",
25724
+ {
25725
+ class: "GOBJ_TREE_TRACES_HEAD",
25726
+ i18n: "traces",
25727
+ style: "font-weight:700; margin:8px 0 2px 0; padding-top:6px; border-top:1px solid var(--bulma-border-weak, #E5E7EB);"
25728
+ },
25729
+ (0, i18next.t)("traces")
25730
+ ]];
25731
+ if (!info) {
25732
+ kids.push([
25733
+ "div",
25734
+ {
25735
+ class: "GOBJ_TREE_TRACES_NOTE",
25736
+ i18n: "loading",
25737
+ style: TRACES_NOTE_STYLE
25738
+ },
25739
+ (0, i18next.t)("loading")
25740
+ ]);
25741
+ return (0, _yuneta_gobj_js.createElement2)([
25742
+ "div",
25743
+ { class: "GOBJ_TREE_TRACES" },
25744
+ kids
25745
+ ]);
25746
+ }
25747
+ if (info.error) {
25748
+ kids.push([
25749
+ "div",
25750
+ {
25751
+ class: "GOBJ_TREE_TRACES_ERROR",
25752
+ style: "color:var(--bulma-danger, #dc2626); margin:4px 0;"
25753
+ },
25754
+ text_node(info.error)
25755
+ ]);
25756
+ return (0, _yuneta_gobj_js.createElement2)([
25757
+ "div",
25758
+ { class: "GOBJ_TREE_TRACES" },
25759
+ kids
25760
+ ]);
25761
+ }
25762
+ let rows = trace_rows(d, info);
25763
+ let pending = !!priv.trace_pending;
25764
+ let trs = [];
25765
+ let group = "";
25766
+ for (let r of rows) {
25767
+ if (r.group !== group) {
25768
+ group = r.group;
25769
+ let $label = group === "gclass" ? text_node(d.gclass) : (0, _yuneta_gobj_js.createElement2)([
25770
+ "span",
25771
+ { i18n: "global" },
25772
+ (0, i18next.t)("global")
25773
+ ]);
25774
+ trs.push([
25775
+ "tr",
25776
+ { class: "GOBJ_TREE_TRACES_GROUP" },
25777
+ [[
25778
+ "td",
25779
+ {
25780
+ colspan: 3,
25781
+ style: "padding:4px 4px 1px 4px; font-weight:600; color:var(--bulma-text-weak, #6B7280);"
25782
+ },
25783
+ [$label]
25784
+ ]]
25785
+ ]);
25786
+ }
25787
+ let origin = null;
25788
+ if (r.origin === "global") origin = [
25789
+ "span",
25790
+ {
25791
+ class: "GOBJ_TREE_TRACES_ORIGIN",
25792
+ i18n: "global",
25793
+ style: "margin-left:6px; color:var(--bulma-text-weak, #6B7280);"
25794
+ },
25795
+ (0, i18next.t)("global")
25796
+ ];
25797
+ else if (r.origin === "gclass") origin = [
25798
+ "span",
25799
+ {
25800
+ class: "GOBJ_TREE_TRACES_ORIGIN",
25801
+ i18n: "gclass",
25802
+ style: "margin-left:6px; color:var(--bulma-text-weak, #6B7280);"
25803
+ },
25804
+ (0, i18next.t)("gclass")
25805
+ ];
25806
+ let $level = (0, _yuneta_gobj_js.createElement2)([
25807
+ "td",
25808
+ {
25809
+ class: "GOBJ_TREE_TRACES_LEVEL",
25810
+ style: "padding:1px 4px; word-break:break-all;"
25811
+ },
25812
+ []
25813
+ ]);
25814
+ $level.appendChild(text_node(r.level));
25815
+ if (origin) $level.appendChild((0, _yuneta_gobj_js.createElement2)(origin));
25816
+ $level.setAttribute("title", r.description);
25817
+ trs.push([
25818
+ "tr",
25819
+ { class: "GOBJ_TREE_TRACES_ROW" },
25820
+ [
25821
+ $level,
25822
+ [
25823
+ "td",
25824
+ { style: TRACES_CELL_STYLE },
25825
+ [trace_checkbox(gobj, "gobj", r.level, r.gobj_on, pending || r.gobj_locked)]
25826
+ ],
25827
+ [
25828
+ "td",
25829
+ { style: TRACES_CELL_STYLE },
25830
+ [trace_checkbox(gobj, "gclass", r.level, r.gclass_on, pending || r.gclass_locked)]
25831
+ ]
25832
+ ]
25833
+ ]);
25834
+ }
25835
+ kids.push([
25836
+ "table",
25837
+ {
25838
+ class: "GOBJ_TREE_TRACES_TABLE",
25839
+ style: "width:100%; border-collapse:collapse;"
25840
+ },
25841
+ [[
25842
+ "thead",
25843
+ {},
25844
+ [[
25845
+ "tr",
25846
+ {},
25847
+ [
25848
+ [
25849
+ "th",
25850
+ {
25851
+ i18n: "level",
25852
+ style: "padding:1px 4px; text-align:left;"
25853
+ },
25854
+ (0, i18next.t)("level")
25855
+ ],
25856
+ [
25857
+ "th",
25858
+ {
25859
+ i18n: "this gobj",
25860
+ style: TRACES_CELL_STYLE
25861
+ },
25862
+ (0, i18next.t)("this gobj")
25863
+ ],
25864
+ [
25865
+ "th",
25866
+ {
25867
+ i18n: "all of the gclass",
25868
+ style: TRACES_CELL_STYLE
25869
+ },
25870
+ (0, i18next.t)("all of the gclass")
25871
+ ]
25872
+ ]
25873
+ ]]
25874
+ ], [
25875
+ "tbody",
25876
+ {},
25877
+ trs
25878
+ ]]
25879
+ ]);
25880
+ kids.push([
25881
+ "div",
25882
+ {
25883
+ class: "GOBJ_TREE_TRACES_NOTE",
25884
+ i18n: "gclass traces survive a restart, gobj traces end with the yuno",
25885
+ style: TRACES_NOTE_STYLE
25886
+ },
25887
+ (0, i18next.t)("gclass traces survive a restart, gobj traces end with the yuno")
25888
+ ]);
25889
+ let none_gobj = pending || own_trace_levels(rows, "gobj").length === 0;
25890
+ let none_gclass = pending || own_trace_levels(rows, "gclass").length === 0;
25891
+ let btn_style = "padding:0 8px; height:22px; font-size:11px; white-space:nowrap;";
25892
+ let clear = (scope) => {
25893
+ return { click: (evt) => {
25894
+ evt.stopPropagation();
25895
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_TRACES_CLEARED", { scope }, gobj);
25896
+ } };
25897
+ };
25898
+ let $clear_gobj = (0, _yuneta_gobj_js.createElement2)([
25899
+ "button",
25900
+ {
25901
+ type: "button",
25902
+ class: "GOBJ_TREE_TRACES_CLEAR_GOBJ button is-small",
25903
+ style: btn_style,
25904
+ i18n: "remove the traces of this gobj",
25905
+ title: (0, i18next.t)("remove the traces of this gobj"),
25906
+ "data-i18n-title": "remove the traces of this gobj",
25907
+ "aria-label": (0, i18next.t)("remove the traces of this gobj"),
25908
+ "data-i18n-aria-label": "remove the traces of this gobj"
25909
+ },
25910
+ (0, i18next.t)("remove the traces of this gobj"),
25911
+ clear("gobj")
25912
+ ]);
25913
+ let $clear_gclass = (0, _yuneta_gobj_js.createElement2)([
25914
+ "button",
25915
+ {
25916
+ type: "button",
25917
+ class: "GOBJ_TREE_TRACES_CLEAR_GCLASS button is-small",
25918
+ style: btn_style,
25919
+ i18n: "remove the traces of the gclass",
25920
+ title: (0, i18next.t)("remove the traces of the gclass"),
25921
+ "data-i18n-title": "remove the traces of the gclass",
25922
+ "aria-label": (0, i18next.t)("remove the traces of the gclass"),
25923
+ "data-i18n-aria-label": "remove the traces of the gclass"
25924
+ },
25925
+ (0, i18next.t)("remove the traces of the gclass"),
25926
+ clear("gclass")
25927
+ ]);
25928
+ $clear_gobj.disabled = none_gobj;
25929
+ $clear_gclass.disabled = none_gclass;
25930
+ kids.push([
25931
+ "div",
25932
+ {
25933
+ class: "GOBJ_TREE_TRACES_TOOLS",
25934
+ style: "display:flex; flex-wrap:wrap; gap:4px; margin-top:4px;"
25935
+ },
25936
+ [$clear_gobj, $clear_gclass]
25937
+ ]);
25938
+ return (0, _yuneta_gobj_js.createElement2)([
25939
+ "div",
25940
+ { class: "GOBJ_TREE_TRACES" },
25941
+ kids
25942
+ ]);
25943
+ }
25944
+ function trace_checkbox(gobj, scope, level, on, locked) {
25945
+ let $cb = null;
25946
+ if (scope === "gobj") $cb = (0, _yuneta_gobj_js.createElement2)(["input", {
25947
+ type: "checkbox",
25948
+ class: "GOBJ_TREE_TRACE_GOBJ",
25949
+ title: (0, i18next.t)("this gobj"),
25950
+ "data-i18n-title": "this gobj",
25951
+ "aria-label": (0, i18next.t)("this gobj"),
25952
+ "data-i18n-aria-label": "this gobj"
25953
+ }]);
25954
+ else $cb = (0, _yuneta_gobj_js.createElement2)(["input", {
25955
+ type: "checkbox",
25956
+ class: "GOBJ_TREE_TRACE_GCLASS",
25957
+ title: (0, i18next.t)("all of the gclass"),
25958
+ "data-i18n-title": "all of the gclass",
25959
+ "aria-label": (0, i18next.t)("all of the gclass"),
25960
+ "data-i18n-aria-label": "all of the gclass"
25961
+ }]);
25962
+ $cb.setAttribute("data-level", level);
25963
+ $cb.checked = !!on;
25964
+ $cb.disabled = !!locked;
25965
+ $cb.addEventListener("change", (evt) => {
25966
+ evt.stopPropagation();
25967
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_TRACE_TOGGLED", {
25968
+ scope,
25969
+ level,
25970
+ set: !!evt.target.checked
25971
+ }, gobj);
25972
+ });
25973
+ return $cb;
25974
+ }
25975
+ /************************************************************
25976
+ * Rebuild the graph and leave the popover where it was, on
25977
+ * the same gobj -- by full name, the node ids are new. A
25978
+ * reader who just ticked a trace is still reading that card.
25979
+ ************************************************************/
25980
+ function reload_keeping_popover(gobj, opts) {
25981
+ let priv = gobj.priv;
25982
+ let $popover = priv.$popover;
25983
+ let keep = priv.popover_node && $popover && $popover.style.display === "block" ? priv.popover_node.full_name : null;
25984
+ let left = $popover ? $popover.style.left : "";
25985
+ let top = $popover ? $popover.style.top : "";
25986
+ refresh_tree(gobj, opts);
25987
+ if (!keep || !priv.node_by_id) return;
25988
+ for (let id of Object.keys(priv.node_by_id)) {
25989
+ let d = priv.node_by_id[id];
25990
+ if (d.full_name === keep) {
25991
+ priv.popover_node = d;
25992
+ priv.$popover_title.textContent = d.short_name || d.gclass + (d.name ? "^" + d.name : "");
25993
+ priv.$popover_title.title = priv.$popover_title.textContent;
25994
+ render_popover_body(gobj, d);
25995
+ $popover.style.left = left;
25996
+ $popover.style.top = top;
25997
+ $popover.style.display = "block";
25998
+ return;
25999
+ }
26000
+ }
25524
26001
  }
25525
26002
  /************************************************************
25526
26003
  * Show popover next to the click position.
@@ -25845,6 +26322,10 @@ function ac_find_nodes$2(gobj, event, kw, src) {
25845
26322
  }
25846
26323
  function ac_refresh$3(gobj, event, kw, src) {
25847
26324
  save_view_state(gobj);
26325
+ if (is_remote(gobj)) {
26326
+ (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_TREE_WANTED", {});
26327
+ return 0;
26328
+ }
25848
26329
  refresh_tree(gobj);
25849
26330
  return 0;
25850
26331
  }
@@ -26104,6 +26585,7 @@ function ac_node_click$3(gobj, event, kw, src) {
26104
26585
  let client_x = kw.client_x || 0;
26105
26586
  let client_y = kw.client_y || 0;
26106
26587
  show_popover(gobj, node_data, client_x, client_y);
26588
+ if (is_remote(gobj)) (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_TRACE_INFO_WANTED", { gclass: node_data.gclass });
26107
26589
  return 0;
26108
26590
  }
26109
26591
  /************************************************************
@@ -26158,23 +26640,45 @@ function ac_hide$5(gobj, event, kw, src) {
26158
26640
  * first rather than stacking windows nobody closes.
26159
26641
  ************************************************************/
26160
26642
  function ac_open_gclass(gobj, event, kw, src) {
26161
- let priv = gobj.priv;
26162
- let node_data = priv.popover_node;
26643
+ let node_data = gobj.priv.popover_node;
26163
26644
  if (!node_data || !node_data.gclass) {
26164
26645
  (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: EV_OPEN_GCLASS with no node`);
26165
26646
  return -1;
26166
26647
  }
26648
+ if (is_remote(gobj)) {
26649
+ (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_GCLASS_WANTED", { gclass: node_data.gclass });
26650
+ return 0;
26651
+ }
26652
+ open_gclass_window(gobj, node_data.gclass, null, node_data.state || "");
26653
+ return 0;
26654
+ }
26655
+ /************************************************************
26656
+ * remote: the `view-gclass` answer the host fetched.
26657
+ ************************************************************/
26658
+ function ac_gclass_description(gobj, event, kw, src) {
26659
+ let priv = gobj.priv;
26660
+ if (!kw || !kw.gclass || !kw.description || typeof kw.description !== "object") {
26661
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: EV_GCLASS_DESCRIPTION without a gclass description`);
26662
+ return -1;
26663
+ }
26664
+ let d = priv.popover_node;
26665
+ open_gclass_window(gobj, kw.gclass, kw.description, d && d.gclass === kw.gclass ? d.state || "" : "");
26666
+ return 0;
26667
+ }
26668
+ function open_gclass_window(gobj, gclass, description, state) {
26669
+ let priv = gobj.priv;
26167
26670
  close_gclass_view(priv.gclass_view);
26168
26671
  priv.gclass_view = null;
26169
- priv.gclass_view = open_gclass_view(gobj, node_data.gclass, {
26170
- title_prefix: (0, _yuneta_gobj_js.gobj_yuno_name)() || "",
26171
- current_state: node_data.state || "",
26672
+ let opts = {
26673
+ title_prefix: is_remote(gobj) ? (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "yuno_name") || "" : (0, _yuneta_gobj_js.gobj_yuno_name)() || "",
26674
+ current_state: state,
26172
26675
  on_close: () => {
26173
26676
  if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return;
26174
26677
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_GCLASS_CLOSED", {}, gobj);
26175
26678
  }
26176
- });
26177
- return 0;
26679
+ };
26680
+ if (description) opts.description = description;
26681
+ priv.gclass_view = open_gclass_view(gobj, gclass, opts);
26178
26682
  }
26179
26683
  /************************************************************
26180
26684
  * The reader dismissed the gclass window (its own ✕).
@@ -26188,6 +26692,99 @@ function ac_gclass_closed(gobj, event, kw, src) {
26188
26692
  return 0;
26189
26693
  }
26190
26694
  /************************************************************
26695
+ * remote: the host loaded the tree (`view-gobj-tree`).
26696
+ *
26697
+ * The first one is framed like any opening; the next ones
26698
+ * keep the camera and the card the reader is on.
26699
+ ************************************************************/
26700
+ function ac_load_tree(gobj, event, kw, src) {
26701
+ let priv = gobj.priv;
26702
+ if (!is_remote(gobj)) {
26703
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: EV_LOAD_TREE on a tree whose source is not remote`);
26704
+ return -1;
26705
+ }
26706
+ let root = describe_backend_tree(kw && kw.tree);
26707
+ if (!root) {
26708
+ (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: what was loaded is not a view-gobj-tree answer`);
26709
+ return -1;
26710
+ }
26711
+ let first = !priv.remote_root;
26712
+ priv.remote_root = root;
26713
+ priv.trace_pending = false;
26714
+ reload_keeping_popover(gobj, first ? {} : { preserve_view: true });
26715
+ return 0;
26716
+ }
26717
+ /************************************************************
26718
+ * remote: the trace levels of a gclass, as the backend has
26719
+ * them now (or why they could not be read).
26720
+ ************************************************************/
26721
+ function ac_trace_info(gobj, event, kw, src) {
26722
+ let priv = gobj.priv;
26723
+ if (!kw || !kw.gclass) {
26724
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: EV_TRACE_INFO without a gclass`);
26725
+ return -1;
26726
+ }
26727
+ let list = (x) => Array.isArray(x) ? x : [];
26728
+ priv.trace_info[kw.gclass] = {
26729
+ gclass_levels: kw.gclass_levels || {},
26730
+ global_levels: kw.global_levels || {},
26731
+ gclass_on: list(kw.gclass_on),
26732
+ global_on: list(kw.global_on),
26733
+ error: kw.error || ""
26734
+ };
26735
+ priv.trace_pending = false;
26736
+ let d = priv.popover_node;
26737
+ if (d && d.gclass === kw.gclass && priv.$popover && priv.$popover.style.display === "block") render_popover_body(gobj, d);
26738
+ return 0;
26739
+ }
26740
+ /************************************************************
26741
+ * A box of the TRACES block was ticked or cleared.
26742
+ ************************************************************/
26743
+ function ac_trace_toggled(gobj, event, kw, src) {
26744
+ let d = gobj.priv.popover_node;
26745
+ if (!is_remote(gobj) || !d) {
26746
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: a trace set with no backend card open`);
26747
+ return -1;
26748
+ }
26749
+ if (!kw.level || kw.scope !== "gobj" && kw.scope !== "gclass") {
26750
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: a trace set of no level or scope: '${kw.scope}' '${kw.level}'`);
26751
+ return -1;
26752
+ }
26753
+ set_trace_levels(gobj, d, kw.scope, [kw.level], !!kw.set);
26754
+ return 0;
26755
+ }
26756
+ /************************************************************
26757
+ * "Remove the traces" of the gobj or of its gclass: every
26758
+ * level that scope holds on its own.
26759
+ ************************************************************/
26760
+ function ac_traces_cleared(gobj, event, kw, src) {
26761
+ let priv = gobj.priv;
26762
+ let d = priv.popover_node;
26763
+ if (!is_remote(gobj) || !d) {
26764
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: traces removed with no backend card open`);
26765
+ return -1;
26766
+ }
26767
+ let levels = own_trace_levels(trace_rows(d, priv.trace_info[d.gclass]), kw.scope);
26768
+ if (!levels.length) {
26769
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: no ${kw.scope} trace of ${d.full_name} to remove`);
26770
+ return -1;
26771
+ }
26772
+ set_trace_levels(gobj, d, kw.scope, levels, false);
26773
+ return 0;
26774
+ }
26775
+ function set_trace_levels(gobj, d, scope, levels, set) {
26776
+ let priv = gobj.priv;
26777
+ priv.trace_pending = true;
26778
+ render_popover_body(gobj, d);
26779
+ (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_SET_TRACE_LEVEL", {
26780
+ scope,
26781
+ gobj: d.full_name,
26782
+ gclass: d.gclass,
26783
+ levels,
26784
+ set
26785
+ });
26786
+ }
26787
+ /************************************************************
26191
26788
  * The app switched language.
26192
26789
  *
26193
26790
  * A rebuild, not a re-translation: the words live inside the
@@ -26218,28 +26815,7 @@ function create_gclass$9(gclass_name) {
26218
26815
  (0, _yuneta_gobj_js.log_error)(`GClass ALREADY created: ${gclass_name}`);
26219
26816
  return -1;
26220
26817
  }
26221
- __gclass__$9 = (0, _yuneta_gobj_js.gclass_create)(gclass_name, [
26222
- ["EV_FIND_NODES", 0],
26223
- ["EV_REFRESH", 0],
26224
- ["EV_THEME", 0],
26225
- ["EV_CHANGE_LAYOUT", 0],
26226
- ["EV_TOGGLE_COLLAPSE", 0],
26227
- ["EV_EXPAND_ALL", 0],
26228
- ["EV_COLLAPSE_ALL", 0],
26229
- ["EV_ZOOM_IN", 0],
26230
- ["EV_ZOOM_OUT", 0],
26231
- ["EV_ZOOM_RESET", 0],
26232
- ["EV_CENTER", 0],
26233
- ["EV_NODE_CLICK", 0],
26234
- ["EV_TOGGLE_ANCHOR", 0],
26235
- ["EV_CENTER_ANCHOR", 0],
26236
- ["EV_RESIZE", 0],
26237
- ["EV_SHOW", 0],
26238
- ["EV_HIDE", 0],
26239
- ["EV_OPEN_GCLASS", 0],
26240
- ["EV_GCLASS_CLOSED", 0],
26241
- ["EV_LANGUAGE_CHANGED", 0]
26242
- ], [["ST_IDLE", [
26818
+ const states = [["ST_IDLE", [
26243
26819
  [
26244
26820
  "EV_FIND_NODES",
26245
26821
  ac_find_nodes$2,
@@ -26339,8 +26915,65 @@ function create_gclass$9(gclass_name) {
26339
26915
  "EV_LANGUAGE_CHANGED",
26340
26916
  ac_language_changed$5,
26341
26917
  null
26918
+ ],
26919
+ [
26920
+ "EV_LOAD_TREE",
26921
+ ac_load_tree,
26922
+ null
26923
+ ],
26924
+ [
26925
+ "EV_TRACE_INFO",
26926
+ ac_trace_info,
26927
+ null
26928
+ ],
26929
+ [
26930
+ "EV_TRACE_TOGGLED",
26931
+ ac_trace_toggled,
26932
+ null
26933
+ ],
26934
+ [
26935
+ "EV_TRACES_CLEARED",
26936
+ ac_traces_cleared,
26937
+ null
26938
+ ],
26939
+ [
26940
+ "EV_GCLASS_DESCRIPTION",
26941
+ ac_gclass_description,
26942
+ null
26342
26943
  ]
26343
- ]]], gmt$9, 0, attrs_table$9, PRIVATE_DATA$9, 0, 0, 0, 0);
26944
+ ]]];
26945
+ const event_types = [
26946
+ ["EV_FIND_NODES", 0],
26947
+ ["EV_REFRESH", 0],
26948
+ ["EV_THEME", 0],
26949
+ ["EV_CHANGE_LAYOUT", 0],
26950
+ ["EV_TOGGLE_COLLAPSE", 0],
26951
+ ["EV_EXPAND_ALL", 0],
26952
+ ["EV_COLLAPSE_ALL", 0],
26953
+ ["EV_ZOOM_IN", 0],
26954
+ ["EV_ZOOM_OUT", 0],
26955
+ ["EV_ZOOM_RESET", 0],
26956
+ ["EV_CENTER", 0],
26957
+ ["EV_NODE_CLICK", 0],
26958
+ ["EV_TOGGLE_ANCHOR", 0],
26959
+ ["EV_CENTER_ANCHOR", 0],
26960
+ ["EV_RESIZE", 0],
26961
+ ["EV_SHOW", 0],
26962
+ ["EV_HIDE", 0],
26963
+ ["EV_OPEN_GCLASS", 0],
26964
+ ["EV_GCLASS_CLOSED", 0],
26965
+ ["EV_LANGUAGE_CHANGED", 0],
26966
+ ["EV_LOAD_TREE", 0],
26967
+ ["EV_TRACE_INFO", 0],
26968
+ ["EV_TRACE_TOGGLED", 0],
26969
+ ["EV_TRACES_CLEARED", 0],
26970
+ ["EV_GCLASS_DESCRIPTION", 0],
26971
+ ["EV_TREE_WANTED", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT],
26972
+ ["EV_TRACE_INFO_WANTED", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT],
26973
+ ["EV_SET_TRACE_LEVEL", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT],
26974
+ ["EV_GCLASS_WANTED", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT]
26975
+ ];
26976
+ __gclass__$9 = (0, _yuneta_gobj_js.gclass_create)(gclass_name, event_types, states, gmt$9, 0, attrs_table$9, PRIVATE_DATA$9, 0, 0, 0, 0);
26344
26977
  if (!__gclass__$9) return -1;
26345
26978
  return 0;
26346
26979
  }
@@ -85181,8 +85814,11 @@ function dir_arrow(dir) {
85181
85814
  function dev_num(key, def) {
85182
85815
  return Number((0, _yuneta_gobj_js.kw_get_local_storage_value)(key, def === void 0 ? 0 : def, false));
85183
85816
  }
85817
+ function traffic_view_of(v) {
85818
+ return v === "expanded" || v === "line" ? v : "collapsed";
85819
+ }
85184
85820
  function dev_traffic_view() {
85185
- return (0, _yuneta_gobj_js.kw_get_local_storage_value)("dev_traffic_view", "collapsed", false) === "expanded" ? "expanded" : "collapsed";
85821
+ return traffic_view_of((0, _yuneta_gobj_js.kw_get_local_storage_value)("dev_traffic_view", "collapsed", false));
85186
85822
  }
85187
85823
  function dev_traces_payload() {
85188
85824
  return dev_num("dev_traces_payload", 1) ? 1 : 0;
@@ -85204,7 +85840,12 @@ function console_traffic(title, jn, direction, size) {
85204
85840
  let kw = jn && jn.kw && typeof jn.kw === "object" ? jn.kw : jn;
85205
85841
  let color = direction === 2 ? "#16a34a" : direction === 3 ? "#dc2626" : "#2563eb";
85206
85842
  let head = "%c" + dir_arrow(direction) + " " + (title ? "[" + title + "] " : "") + event + (size ? " (" + size + "b)" : "");
85207
- if (dev_traffic_view() === "expanded") {
85843
+ let view = dev_traffic_view();
85844
+ if (view === "line") {
85845
+ window.console.log(head, "color:" + color);
85846
+ return;
85847
+ }
85848
+ if (view === "expanded") {
85208
85849
  let text;
85209
85850
  try {
85210
85851
  text = JSON.stringify(full_sections(kw), null, 4);
@@ -85217,7 +85858,7 @@ function console_traffic(title, jn, direction, size) {
85217
85858
  window.console.log(head, "color:" + color, kw);
85218
85859
  }
85219
85860
  function set_traffic_view(v) {
85220
- (0, _yuneta_gobj_js.kw_set_local_storage_value)("dev_traffic_view", v === "expanded" ? "expanded" : "collapsed");
85861
+ (0, _yuneta_gobj_js.kw_set_local_storage_value)("dev_traffic_view", traffic_view_of(v));
85221
85862
  rerender_all();
85222
85863
  refresh_dev_chrome();
85223
85864
  }
@@ -85386,6 +86027,9 @@ function ensure_dev_style() {
85386
86027
  .TRAFFIC_ENTRY.dir-out { border-left-color: #2563eb; }
85387
86028
  .TRAFFIC_ENTRY.dir-in { border-left-color: #059669; }
85388
86029
  .TRAFFIC_ENTRY.dir-err { border-left-color: #dc2626; }
86030
+ /* The line view: one row per message, no margin between rows, so a burst
86031
+ of messages reads as a list. */
86032
+ .TRAFFIC_ENTRY.TRAFFIC_NAME { margin: 1px 0; padding: 1px 8px; line-height: 1.45; display: flex; align-items: baseline; gap: 8px; }
85389
86033
  .TRAFFIC_HEADER { display: flex; align-items: baseline; gap: 8px; }
85390
86034
  .TRAFFIC_ARROW { font-weight: 700; }
85391
86035
  .TRAFFIC_EVENT { font-weight: 700; }
@@ -85777,6 +86421,19 @@ function render_full(e) {
85777
86421
  children
85778
86422
  ]);
85779
86423
  }
86424
+ function render_name(e) {
86425
+ let kids = event_spans(e);
86426
+ kids.push([
86427
+ "span",
86428
+ { class: "TRAFFIC_META" },
86429
+ `${traffic_size(e.size)} · ${e.ts}`
86430
+ ]);
86431
+ return (0, _yuneta_gobj_js.createElement2)([
86432
+ "div",
86433
+ { class: "TRAFFIC_ENTRY TRAFFIC_NAME " + dir_class(e.dir) },
86434
+ kids
86435
+ ]);
86436
+ }
85780
86437
  function render_log(e) {
85781
86438
  let $row = (0, _yuneta_gobj_js.createElement2)([
85782
86439
  "div",
@@ -85805,7 +86462,9 @@ function render_log(e) {
85805
86462
  }
85806
86463
  function render_entry(e) {
85807
86464
  if (e.kind === "log") return render_log(e);
85808
- if (dev_traffic_view() === "expanded") return render_full(e);
86465
+ let view = dev_traffic_view();
86466
+ if (view === "line") return render_name(e);
86467
+ if (view === "expanded") return render_full(e);
85809
86468
  return render_detailed(e);
85810
86469
  }
85811
86470
  /******************************
@@ -86177,7 +86836,9 @@ function traffic_to_text() {
86177
86836
  }
86178
86837
  let head = `${e.ts} ${dir_arrow(e.dir)} ${e.title ? "[" + e.title + "] " : ""}${e.event}${e.command ? " " + e.command : ""}`;
86179
86838
  out.push(head);
86180
- if (dev_traffic_view() !== "expanded" && e.$node) {
86839
+ let view = dev_traffic_view();
86840
+ if (view === "line") continue;
86841
+ if (view !== "expanded" && e.$node) {
86181
86842
  out.push(...entry_shown_lines(e.$node));
86182
86843
  out.push("");
86183
86844
  continue;
@@ -86273,6 +86934,7 @@ function build_control_bar() {
86273
86934
  } }
86274
86935
  ];
86275
86936
  let VIEW_TITLES = {
86937
+ line: "traffic one line per message",
86276
86938
  collapsed: "traffic payload folded",
86277
86939
  expanded: "traffic payload laid out"
86278
86940
  };
@@ -86300,7 +86962,11 @@ function build_control_bar() {
86300
86962
  class: "YDEV_SEG",
86301
86963
  id: "ydev-seg"
86302
86964
  },
86303
- [mk_view("collapsed", "collapsed"), mk_view("expanded", "expanded")]
86965
+ [
86966
+ mk_view("line", "one line"),
86967
+ mk_view("collapsed", "collapsed"),
86968
+ mk_view("expanded", "expanded")
86969
+ ]
86304
86970
  ];
86305
86971
  let OUT_TITLES = {
86306
86972
  window: "dev window only",