@yuneta/gobj-ui 7.27.21 → 7.27.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5077,7 +5077,7 @@ whose keys `validate-locales` reads in its `app_config.json`.
5077
5077
  **A key the reader cannot follow is PUBLISHED by its module** (since
5078
5078
  `7.26.27`): an exported `<NAME>_I18N_KEYS` array of string literals, which
5079
5079
  `validate-locales` reads in every module the app mounts and asks the locales
5080
- for. `yui_dev.js` publishes the 51 keys of the Developer window
5080
+ for. `yui_dev.js` publishes the 53 keys of the Developer window
5081
5081
  (`YUI_DEV_I18N_KEYS`) -- they used to be a comment each consumer copied, and
5082
5082
  one consumer lacked 35 --, `c_g6_nodes_tree.js` those of its shape tables,
5083
5083
  popover labels, floating buttons and error messages
@@ -85181,8 +85181,11 @@ function dir_arrow(dir) {
85181
85181
  function dev_num(key, def) {
85182
85182
  return Number((0, _yuneta_gobj_js.kw_get_local_storage_value)(key, def === void 0 ? 0 : def, false));
85183
85183
  }
85184
+ function traffic_view_of(v) {
85185
+ return v === "expanded" || v === "line" ? v : "collapsed";
85186
+ }
85184
85187
  function dev_traffic_view() {
85185
- return (0, _yuneta_gobj_js.kw_get_local_storage_value)("dev_traffic_view", "collapsed", false) === "expanded" ? "expanded" : "collapsed";
85188
+ return traffic_view_of((0, _yuneta_gobj_js.kw_get_local_storage_value)("dev_traffic_view", "collapsed", false));
85186
85189
  }
85187
85190
  function dev_traces_payload() {
85188
85191
  return dev_num("dev_traces_payload", 1) ? 1 : 0;
@@ -85204,7 +85207,12 @@ function console_traffic(title, jn, direction, size) {
85204
85207
  let kw = jn && jn.kw && typeof jn.kw === "object" ? jn.kw : jn;
85205
85208
  let color = direction === 2 ? "#16a34a" : direction === 3 ? "#dc2626" : "#2563eb";
85206
85209
  let head = "%c" + dir_arrow(direction) + " " + (title ? "[" + title + "] " : "") + event + (size ? " (" + size + "b)" : "");
85207
- if (dev_traffic_view() === "expanded") {
85210
+ let view = dev_traffic_view();
85211
+ if (view === "line") {
85212
+ window.console.log(head, "color:" + color);
85213
+ return;
85214
+ }
85215
+ if (view === "expanded") {
85208
85216
  let text;
85209
85217
  try {
85210
85218
  text = JSON.stringify(full_sections(kw), null, 4);
@@ -85217,7 +85225,7 @@ function console_traffic(title, jn, direction, size) {
85217
85225
  window.console.log(head, "color:" + color, kw);
85218
85226
  }
85219
85227
  function set_traffic_view(v) {
85220
- (0, _yuneta_gobj_js.kw_set_local_storage_value)("dev_traffic_view", v === "expanded" ? "expanded" : "collapsed");
85228
+ (0, _yuneta_gobj_js.kw_set_local_storage_value)("dev_traffic_view", traffic_view_of(v));
85221
85229
  rerender_all();
85222
85230
  refresh_dev_chrome();
85223
85231
  }
@@ -85386,6 +85394,9 @@ function ensure_dev_style() {
85386
85394
  .TRAFFIC_ENTRY.dir-out { border-left-color: #2563eb; }
85387
85395
  .TRAFFIC_ENTRY.dir-in { border-left-color: #059669; }
85388
85396
  .TRAFFIC_ENTRY.dir-err { border-left-color: #dc2626; }
85397
+ /* The line view: one row per message, no margin between rows, so a burst
85398
+ of messages reads as a list. */
85399
+ .TRAFFIC_ENTRY.TRAFFIC_NAME { margin: 1px 0; padding: 1px 8px; line-height: 1.45; display: flex; align-items: baseline; gap: 8px; }
85389
85400
  .TRAFFIC_HEADER { display: flex; align-items: baseline; gap: 8px; }
85390
85401
  .TRAFFIC_ARROW { font-weight: 700; }
85391
85402
  .TRAFFIC_EVENT { font-weight: 700; }
@@ -85777,6 +85788,19 @@ function render_full(e) {
85777
85788
  children
85778
85789
  ]);
85779
85790
  }
85791
+ function render_name(e) {
85792
+ let kids = event_spans(e);
85793
+ kids.push([
85794
+ "span",
85795
+ { class: "TRAFFIC_META" },
85796
+ `${traffic_size(e.size)} · ${e.ts}`
85797
+ ]);
85798
+ return (0, _yuneta_gobj_js.createElement2)([
85799
+ "div",
85800
+ { class: "TRAFFIC_ENTRY TRAFFIC_NAME " + dir_class(e.dir) },
85801
+ kids
85802
+ ]);
85803
+ }
85780
85804
  function render_log(e) {
85781
85805
  let $row = (0, _yuneta_gobj_js.createElement2)([
85782
85806
  "div",
@@ -85805,7 +85829,9 @@ function render_log(e) {
85805
85829
  }
85806
85830
  function render_entry(e) {
85807
85831
  if (e.kind === "log") return render_log(e);
85808
- if (dev_traffic_view() === "expanded") return render_full(e);
85832
+ let view = dev_traffic_view();
85833
+ if (view === "line") return render_name(e);
85834
+ if (view === "expanded") return render_full(e);
85809
85835
  return render_detailed(e);
85810
85836
  }
85811
85837
  /******************************
@@ -86177,7 +86203,9 @@ function traffic_to_text() {
86177
86203
  }
86178
86204
  let head = `${e.ts} ${dir_arrow(e.dir)} ${e.title ? "[" + e.title + "] " : ""}${e.event}${e.command ? " " + e.command : ""}`;
86179
86205
  out.push(head);
86180
- if (dev_traffic_view() !== "expanded" && e.$node) {
86206
+ let view = dev_traffic_view();
86207
+ if (view === "line") continue;
86208
+ if (view !== "expanded" && e.$node) {
86181
86209
  out.push(...entry_shown_lines(e.$node));
86182
86210
  out.push("");
86183
86211
  continue;
@@ -86273,6 +86301,7 @@ function build_control_bar() {
86273
86301
  } }
86274
86302
  ];
86275
86303
  let VIEW_TITLES = {
86304
+ line: "traffic one line per message",
86276
86305
  collapsed: "traffic payload folded",
86277
86306
  expanded: "traffic payload laid out"
86278
86307
  };
@@ -86300,7 +86329,11 @@ function build_control_bar() {
86300
86329
  class: "YDEV_SEG",
86301
86330
  id: "ydev-seg"
86302
86331
  },
86303
- [mk_view("collapsed", "collapsed"), mk_view("expanded", "expanded")]
86332
+ [
86333
+ mk_view("line", "one line"),
86334
+ mk_view("collapsed", "collapsed"),
86335
+ mk_view("expanded", "expanded")
86336
+ ]
86304
86337
  ];
86305
86338
  let OUT_TITLES = {
86306
86339
  window: "dev window only",
@@ -85176,8 +85176,11 @@ function dir_arrow(dir) {
85176
85176
  function dev_num(key, def) {
85177
85177
  return Number(kw_get_local_storage_value(key, def === void 0 ? 0 : def, false));
85178
85178
  }
85179
+ function traffic_view_of(v) {
85180
+ return v === "expanded" || v === "line" ? v : "collapsed";
85181
+ }
85179
85182
  function dev_traffic_view() {
85180
- return kw_get_local_storage_value("dev_traffic_view", "collapsed", false) === "expanded" ? "expanded" : "collapsed";
85183
+ return traffic_view_of(kw_get_local_storage_value("dev_traffic_view", "collapsed", false));
85181
85184
  }
85182
85185
  function dev_traces_payload() {
85183
85186
  return dev_num("dev_traces_payload", 1) ? 1 : 0;
@@ -85199,7 +85202,12 @@ function console_traffic(title, jn, direction, size) {
85199
85202
  let kw = jn && jn.kw && typeof jn.kw === "object" ? jn.kw : jn;
85200
85203
  let color = direction === 2 ? "#16a34a" : direction === 3 ? "#dc2626" : "#2563eb";
85201
85204
  let head = "%c" + dir_arrow(direction) + " " + (title ? "[" + title + "] " : "") + event + (size ? " (" + size + "b)" : "");
85202
- if (dev_traffic_view() === "expanded") {
85205
+ let view = dev_traffic_view();
85206
+ if (view === "line") {
85207
+ window.console.log(head, "color:" + color);
85208
+ return;
85209
+ }
85210
+ if (view === "expanded") {
85203
85211
  let text;
85204
85212
  try {
85205
85213
  text = JSON.stringify(full_sections(kw), null, 4);
@@ -85212,7 +85220,7 @@ function console_traffic(title, jn, direction, size) {
85212
85220
  window.console.log(head, "color:" + color, kw);
85213
85221
  }
85214
85222
  function set_traffic_view(v) {
85215
- kw_set_local_storage_value("dev_traffic_view", v === "expanded" ? "expanded" : "collapsed");
85223
+ kw_set_local_storage_value("dev_traffic_view", traffic_view_of(v));
85216
85224
  rerender_all();
85217
85225
  refresh_dev_chrome();
85218
85226
  }
@@ -85381,6 +85389,9 @@ function ensure_dev_style() {
85381
85389
  .TRAFFIC_ENTRY.dir-out { border-left-color: #2563eb; }
85382
85390
  .TRAFFIC_ENTRY.dir-in { border-left-color: #059669; }
85383
85391
  .TRAFFIC_ENTRY.dir-err { border-left-color: #dc2626; }
85392
+ /* The line view: one row per message, no margin between rows, so a burst
85393
+ of messages reads as a list. */
85394
+ .TRAFFIC_ENTRY.TRAFFIC_NAME { margin: 1px 0; padding: 1px 8px; line-height: 1.45; display: flex; align-items: baseline; gap: 8px; }
85384
85395
  .TRAFFIC_HEADER { display: flex; align-items: baseline; gap: 8px; }
85385
85396
  .TRAFFIC_ARROW { font-weight: 700; }
85386
85397
  .TRAFFIC_EVENT { font-weight: 700; }
@@ -85772,6 +85783,19 @@ function render_full(e) {
85772
85783
  children
85773
85784
  ]);
85774
85785
  }
85786
+ function render_name(e) {
85787
+ let kids = event_spans(e);
85788
+ kids.push([
85789
+ "span",
85790
+ { class: "TRAFFIC_META" },
85791
+ `${traffic_size(e.size)} · ${e.ts}`
85792
+ ]);
85793
+ return createElement2([
85794
+ "div",
85795
+ { class: "TRAFFIC_ENTRY TRAFFIC_NAME " + dir_class(e.dir) },
85796
+ kids
85797
+ ]);
85798
+ }
85775
85799
  function render_log(e) {
85776
85800
  let $row = createElement2([
85777
85801
  "div",
@@ -85800,7 +85824,9 @@ function render_log(e) {
85800
85824
  }
85801
85825
  function render_entry(e) {
85802
85826
  if (e.kind === "log") return render_log(e);
85803
- if (dev_traffic_view() === "expanded") return render_full(e);
85827
+ let view = dev_traffic_view();
85828
+ if (view === "line") return render_name(e);
85829
+ if (view === "expanded") return render_full(e);
85804
85830
  return render_detailed(e);
85805
85831
  }
85806
85832
  /******************************
@@ -86172,7 +86198,9 @@ function traffic_to_text() {
86172
86198
  }
86173
86199
  let head = `${e.ts} ${dir_arrow(e.dir)} ${e.title ? "[" + e.title + "] " : ""}${e.event}${e.command ? " " + e.command : ""}`;
86174
86200
  out.push(head);
86175
- if (dev_traffic_view() !== "expanded" && e.$node) {
86201
+ let view = dev_traffic_view();
86202
+ if (view === "line") continue;
86203
+ if (view !== "expanded" && e.$node) {
86176
86204
  out.push(...entry_shown_lines(e.$node));
86177
86205
  out.push("");
86178
86206
  continue;
@@ -86268,6 +86296,7 @@ function build_control_bar() {
86268
86296
  } }
86269
86297
  ];
86270
86298
  let VIEW_TITLES = {
86299
+ line: "traffic one line per message",
86271
86300
  collapsed: "traffic payload folded",
86272
86301
  expanded: "traffic payload laid out"
86273
86302
  };
@@ -86295,7 +86324,11 @@ function build_control_bar() {
86295
86324
  class: "YDEV_SEG",
86296
86325
  id: "ydev-seg"
86297
86326
  },
86298
- [mk_view("collapsed", "collapsed"), mk_view("expanded", "expanded")]
86327
+ [
86328
+ mk_view("line", "one line"),
86329
+ mk_view("collapsed", "collapsed"),
86330
+ mk_view("expanded", "expanded")
86331
+ ]
86299
86332
  ];
86300
86333
  let OUT_TITLES = {
86301
86334
  window: "dev window only",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.27.21",
3
+ "version": "7.27.22",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
package/src/yui_dev.js CHANGED
@@ -86,7 +86,7 @@ export const YUI_DEV_I18N_KEYS = [
86
86
  "dev window and browser console", "dev window only", "developer",
87
87
  "clear the filter", "errors", "expand", "expanded",
88
88
  "filter events / payload", "find", "i18n", "i18next debug output",
89
- "incoming", "log", "machine trace shape", "metadata", "outgoing",
89
+ "incoming", "log", "machine trace shape", "metadata", "one line", "outgoing",
90
90
  "output", "payload", "periodic", "schema", "show",
91
91
  "show the payload of the traces",
92
92
  "show this section in the expanded view", "simple mach", "start / stop",
@@ -95,7 +95,7 @@ export const YUI_DEV_I18N_KEYS = [
95
95
  "trace the creation and destruction of gobjs",
96
96
  "trace the messages to and from the backend",
97
97
  "trace the periodic timer event", "trace the start and stop of gobjs",
98
- "traces", "traffic", "traffic payload folded",
98
+ "traces", "traffic", "traffic one line per message", "traffic payload folded",
99
99
  "traffic payload laid out", "view", "window", "yuno monitor"
100
100
  ];
101
101
 
@@ -202,13 +202,21 @@ function dev_num(key, def)
202
202
  * the traffic's lives in the VIEW group, the traces' in the TRACES row,
203
203
  * beside the chip that picks the machine-trace shape.
204
204
  *
205
- * The traffic payload is ALWAYS there; the view says whether it is folded.
206
- * The old `dev_view_mode` key is left where it is and simply stops being
207
- * read (same as SIMPLE_MACH_KEY below). */
205
+ * The view says how much room a message takes: `line` (its event name
206
+ * alone, one row per message), `collapsed` (the payload folded) or
207
+ * `expanded` (the payload laid out). `line` is the old `Name only`, back
208
+ * in 7.27.22 now that the selector is the traffic's alone: it is what you
209
+ * want to see WHICH messages go and come, and open one of the other two
210
+ * to read them. The old `dev_view_mode` key is left where it is and simply
211
+ * stops being read (same as SIMPLE_MACH_KEY below). */
212
+ function traffic_view_of(v)
213
+ {
214
+ return (v === "expanded" || v === "line") ? v : "collapsed";
215
+ }
216
+
208
217
  function dev_traffic_view()
209
218
  {
210
- let v = kw_get_local_storage_value("dev_traffic_view", "collapsed", false);
211
- return (v === "expanded") ? "expanded" : "collapsed";
219
+ return traffic_view_of(kw_get_local_storage_value("dev_traffic_view", "collapsed", false));
212
220
  }
213
221
 
214
222
  /* Whether the trace's PAYLOAD lines (level `json`: the kw a trace dumps
@@ -274,7 +282,7 @@ function apply_console_route()
274
282
  * It follows the VIEW, because the window and the console are two sinks of
275
283
  * ONE feed and may not disagree about what they are showing: `expanded`
276
284
  * prints the payload laid out, `collapsed` hands the object to the console
277
- * and lets it fold it. The same promise the log filter made in 7.23.33 --
285
+ * and lets it fold it, `line` prints the head alone. The same promise the log filter made in 7.23.33 --
278
286
  * one rule, two sinks -- which the traffic half had never kept. */
279
287
  function console_traffic(title, jn, direction, size)
280
288
  {
@@ -284,7 +292,12 @@ function console_traffic(title, jn, direction, size)
284
292
  let head = "%c" + dir_arrow(direction) + " " + (title ? "[" + title + "] " : "") + event +
285
293
  (size ? " (" + size + "b)" : "");
286
294
 
287
- if(dev_traffic_view() === "expanded") {
295
+ let view = dev_traffic_view();
296
+ if(view === "line") {
297
+ window.console.log(head, "color:" + color);
298
+ return;
299
+ }
300
+ if(view === "expanded") {
288
301
  let text;
289
302
  try {
290
303
  text = JSON.stringify(full_sections(kw), null, 4);
@@ -300,7 +313,7 @@ function console_traffic(title, jn, direction, size)
300
313
 
301
314
  function set_traffic_view(v)
302
315
  {
303
- kw_set_local_storage_value("dev_traffic_view", (v === "expanded") ? "expanded" : "collapsed");
316
+ kw_set_local_storage_value("dev_traffic_view", traffic_view_of(v));
304
317
  rerender_all();
305
318
  refresh_dev_chrome();
306
319
  }
@@ -508,6 +521,9 @@ function ensure_dev_style()
508
521
  .TRAFFIC_ENTRY.dir-out { border-left-color: #2563eb; }
509
522
  .TRAFFIC_ENTRY.dir-in { border-left-color: #059669; }
510
523
  .TRAFFIC_ENTRY.dir-err { border-left-color: #dc2626; }
524
+ /* The line view: one row per message, no margin between rows, so a burst
525
+ of messages reads as a list. */
526
+ .TRAFFIC_ENTRY.TRAFFIC_NAME { margin: 1px 0; padding: 1px 8px; line-height: 1.45; display: flex; align-items: baseline; gap: 8px; }
511
527
  .TRAFFIC_HEADER { display: flex; align-items: baseline; gap: 8px; }
512
528
  .TRAFFIC_ARROW { font-weight: 700; }
513
529
  .TRAFFIC_EVENT { font-weight: 700; }
@@ -895,6 +911,14 @@ function render_full(e)
895
911
  return createElement2(['div', {class: 'TRAFFIC_ENTRY ' + dir_class(e.dir)}, children]);
896
912
  }
897
913
 
914
+ /* Line view: the message's head and nothing else. */
915
+ function render_name(e)
916
+ {
917
+ let kids = event_spans(e);
918
+ kids.push(['span', {class: 'TRAFFIC_META'}, `${traffic_size(e.size)} · ${e.ts}`]);
919
+ return createElement2(['div', {class: 'TRAFFIC_ENTRY TRAFFIC_NAME ' + dir_class(e.dir)}, kids]);
920
+ }
921
+
898
922
  /* A mirrored framework log line (error/warning/info/debug/msg). */
899
923
  function render_log(e)
900
924
  {
@@ -923,8 +947,9 @@ function render_log(e)
923
947
  return $row;
924
948
  }
925
949
 
926
- /* A TRAFFIC entry always shows its payload -- folded (`collapsed`, the
927
- * bullets) or laid out (`expanded`, the JSON). A trace line is written by
950
+ /* A TRAFFIC entry shows its head alone (`line`), or with its payload --
951
+ * folded (`collapsed`, the bullets) or laid out (`expanded`, the JSON).
952
+ * A trace line is written by
928
953
  * the runtime and is painted as it comes; what shapes it is the TRACES row
929
954
  * (the machine-trace format chip and the payload chip), not this. */
930
955
  function render_entry(e)
@@ -932,7 +957,11 @@ function render_entry(e)
932
957
  if(e.kind === "log") {
933
958
  return render_log(e);
934
959
  }
935
- if(dev_traffic_view() === "expanded") {
960
+ let view = dev_traffic_view();
961
+ if(view === "line") {
962
+ return render_name(e);
963
+ }
964
+ if(view === "expanded") {
936
965
  return render_full(e);
937
966
  }
938
967
  return render_detailed(e);
@@ -1478,7 +1507,8 @@ function entry_shown_lines($entry)
1478
1507
  /* Serialize the currently-visible (filtered) traffic to plain text:
1479
1508
  * one header line per entry (time · direction · title · event/command)
1480
1509
  * followed by its payload AS THE VIEW SHOWS IT -- folded, what is on
1481
- * screen (entry_shown_lines()); laid out, the whole payload. Honours the
1510
+ * screen (entry_shown_lines()); laid out, the whole payload; in the line
1511
+ * view, none (the header line alone, no blank line). Honours the
1482
1512
  * active filters and search so the copy matches exactly what is on
1483
1513
  * screen. */
1484
1514
  function traffic_to_text()
@@ -1499,7 +1529,11 @@ function traffic_to_text()
1499
1529
  `${e.title ? "[" + e.title + "] " : ""}${e.event}` +
1500
1530
  `${e.command ? " " + e.command : ""}`;
1501
1531
  out.push(head);
1502
- if(dev_traffic_view() !== "expanded" && e.$node) {
1532
+ let view = dev_traffic_view();
1533
+ if(view === "line") {
1534
+ continue;
1535
+ }
1536
+ if(view !== "expanded" && e.$node) {
1503
1537
  out.push(...entry_shown_lines(e.$node));
1504
1538
  out.push("");
1505
1539
  continue;
@@ -1609,6 +1643,7 @@ function build_control_bar()
1609
1643
  * in the TRACES row (the machine-trace chip and `payload`), because
1610
1644
  * both feeds can be on at once and neither may steer the other. */
1611
1645
  let VIEW_TITLES = {
1646
+ line: 'traffic one line per message',
1612
1647
  collapsed: 'traffic payload folded',
1613
1648
  expanded: 'traffic payload laid out',
1614
1649
  };
@@ -1625,6 +1660,7 @@ function build_control_bar()
1625
1660
  }];
1626
1661
 
1627
1662
  let view_seg = ['div', {class: 'YDEV_SEG', id: 'ydev-seg'}, [
1663
+ mk_view('line', 'one line'),
1628
1664
  mk_view('collapsed', 'collapsed'),
1629
1665
  mk_view('expanded', 'expanded'),
1630
1666
  ]];
@@ -1964,4 +2000,6 @@ export {
1964
2000
  object_preview, object_preview_parts,
1965
2001
  /* And the copy of the folded view, with the renderer it reads. */
1966
2002
  entry_shown_lines, render_detailed,
2003
+ /* And the line view's row. */
2004
+ render_name,
1967
2005
  };
@@ -19,10 +19,11 @@ import {install_dom_double} from "../test/dom_double.js";
19
19
 
20
20
  let entry_shown_lines;
21
21
  let render_detailed;
22
+ let render_name;
22
23
 
23
24
  beforeAll(async () => {
24
25
  install_dom_double();
25
- ({entry_shown_lines, render_detailed} = await import("./yui_dev.js"));
26
+ ({entry_shown_lines, render_detailed, render_name} = await import("./yui_dev.js"));
26
27
  });
27
28
 
28
29
  function painted(kw)
@@ -59,3 +60,18 @@ describe("entry_shown_lines", () => {
59
60
  ]);
60
61
  });
61
62
  });
63
+
64
+ describe("render_name (the line view)", () => {
65
+ it("paints the head of the message alone, in one row", () => {
66
+ const $e = render_name({
67
+ kind: "traffic", dir: "in", event: "EV_YUNO_STATS", command: "",
68
+ title: "gui_agent_yuno <== wss://cc:1996", ts: "09:19:03.421", size: 1024,
69
+ kw: {result: 0, data: {yuno_id: "2046", kind: "cpu"}},
70
+ });
71
+ expect($e.classList.contains("TRAFFIC_NAME")).toBe(true);
72
+ expect($e.querySelector(".TRAFFIC_EVENT").textContent).toBe("EV_YUNO_STATS");
73
+ expect($e.querySelector(".TRAFFIC_KW")).toBe(null);
74
+ expect($e.querySelector(".TRAFFIC_FULL")).toBe(null);
75
+ expect(entry_shown_lines($e)).toEqual([]);
76
+ });
77
+ });