@yuneta/gobj-ui 7.23.178 → 7.23.179

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.
@@ -76444,6 +76444,10 @@ function ensure_dev_style() {
76444
76444
  .TRAFFIC_ARROW { font-weight: 700; }
76445
76445
  .TRAFFIC_EVENT { font-weight: 700; }
76446
76446
  .TRAFFIC_CMD { opacity: 0.75; font-weight: 600; }
76447
+ /* Where the message went through. min-width 0 and flex 0 1 auto so it is the
76448
+ part that gives way when the row runs out of width -- the event name and
76449
+ the size/time must not be the ones to go. */
76450
+ .TRAFFIC_SRC { opacity: 0.45; font-size: 11px; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
76447
76451
  .dir-out .TRAFFIC_ARROW, .dir-out .TRAFFIC_EVENT { color: #2563eb; }
76448
76452
  .dir-in .TRAFFIC_ARROW, .dir-in .TRAFFIC_EVENT { color: #059669; }
76449
76453
  .dir-err .TRAFFIC_ARROW, .dir-err .TRAFFIC_EVENT { color: #dc2626; }
@@ -76674,6 +76678,11 @@ function event_spans(e) {
76674
76678
  { class: "TRAFFIC_CMD" },
76675
76679
  e.command
76676
76680
  ]);
76681
+ if (e.title) spans.push([
76682
+ "span",
76683
+ { class: "TRAFFIC_SRC" },
76684
+ e.title
76685
+ ]);
76677
76686
  return spans;
76678
76687
  }
76679
76688
  function render_detailed(e) {
@@ -76439,6 +76439,10 @@ function ensure_dev_style() {
76439
76439
  .TRAFFIC_ARROW { font-weight: 700; }
76440
76440
  .TRAFFIC_EVENT { font-weight: 700; }
76441
76441
  .TRAFFIC_CMD { opacity: 0.75; font-weight: 600; }
76442
+ /* Where the message went through. min-width 0 and flex 0 1 auto so it is the
76443
+ part that gives way when the row runs out of width -- the event name and
76444
+ the size/time must not be the ones to go. */
76445
+ .TRAFFIC_SRC { opacity: 0.45; font-size: 11px; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
76442
76446
  .dir-out .TRAFFIC_ARROW, .dir-out .TRAFFIC_EVENT { color: #2563eb; }
76443
76447
  .dir-in .TRAFFIC_ARROW, .dir-in .TRAFFIC_EVENT { color: #059669; }
76444
76448
  .dir-err .TRAFFIC_ARROW, .dir-err .TRAFFIC_EVENT { color: #dc2626; }
@@ -76669,6 +76673,11 @@ function event_spans(e) {
76669
76673
  { class: "TRAFFIC_CMD" },
76670
76674
  e.command
76671
76675
  ]);
76676
+ if (e.title) spans.push([
76677
+ "span",
76678
+ { class: "TRAFFIC_SRC" },
76679
+ e.title
76680
+ ]);
76672
76681
  return spans;
76673
76682
  }
76674
76683
  function render_detailed(e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.178",
3
+ "version": "7.23.179",
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
@@ -464,6 +464,10 @@ function ensure_dev_style()
464
464
  .TRAFFIC_ARROW { font-weight: 700; }
465
465
  .TRAFFIC_EVENT { font-weight: 700; }
466
466
  .TRAFFIC_CMD { opacity: 0.75; font-weight: 600; }
467
+ /* Where the message went through. min-width 0 and flex 0 1 auto so it is the
468
+ part that gives way when the row runs out of width -- the event name and
469
+ the size/time must not be the ones to go. */
470
+ .TRAFFIC_SRC { opacity: 0.45; font-size: 11px; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
467
471
  .dir-out .TRAFFIC_ARROW, .dir-out .TRAFFIC_EVENT { color: #2563eb; }
468
472
  .dir-in .TRAFFIC_ARROW, .dir-in .TRAFFIC_EVENT { color: #059669; }
469
473
  .dir-err .TRAFFIC_ARROW, .dir-err .TRAFFIC_EVENT { color: #dc2626; }
@@ -695,6 +699,20 @@ function traffic_bullets(obj)
695
699
  ******************************/
696
700
 
697
701
 
702
+ /* The head of a traffic entry: direction, event, command, and WHERE the
703
+ * message went through -- the gobj and the url, which gobj-js composes
704
+ * (`c_ievent_cli`) and the browser console prints in its prefix.
705
+ *
706
+ * It is written as TEXT, dim, and not as a `title`: as a tooltip it popped a
707
+ * box over the log while it was being read, and it is the one thing in that
708
+ * tooltip that was written nowhere else -- an app browsing several backends
709
+ * cannot tell its messages apart without it. It shrinks before anything
710
+ * else in the row.
711
+ *
712
+ * The string carries its own `==>` / `<==`, which says the direction the
713
+ * arrow already says. It is left as it comes: taking it out means parsing a
714
+ * string built in another package, and it would go wrong the day that one
715
+ * writes it differently. */
698
716
  function event_spans(e)
699
717
  {
700
718
  let spans = [['span', {class: 'TRAFFIC_ARROW'}, dir_arrow(e.dir)],
@@ -702,6 +720,9 @@ function event_spans(e)
702
720
  if(e.command) {
703
721
  spans.push(['span', {class: 'TRAFFIC_CMD'}, e.command]);
704
722
  }
723
+ if(e.title) {
724
+ spans.push(['span', {class: 'TRAFFIC_SRC'}, e.title]);
725
+ }
705
726
  return spans;
706
727
  }
707
728
 
@@ -1760,4 +1781,11 @@ function build_dev_panel()
1760
1781
  return {$el: $el, dispose: dispose};
1761
1782
  }
1762
1783
 
1763
- export {info_traffic, setup_dev, build_dev_panel, apply_dev_traces, dev_window_was_open};
1784
+ export {
1785
+ info_traffic, setup_dev, build_dev_panel, apply_dev_traces, dev_window_was_open,
1786
+ /* Exported for its test: a pure formatter, and the import is also what
1787
+ guards this file from a syntax error nothing else would catch --
1788
+ the stylesheet below is a template literal, so one backtick in a CSS
1789
+ comment stops the whole module from parsing. */
1790
+ object_preview,
1791
+ };
@@ -0,0 +1,58 @@
1
+ /***********************************************************************
2
+ * yui_dev_preview.test.js
3
+ *
4
+ * What a FOLDED object says about itself in the Developer
5
+ * window: its first fields, the way a browser console says it.
6
+ *
7
+ * Importing the module at all is half of this file's job: the
8
+ * monitor's stylesheet is a template literal, so a single
9
+ * backtick in a CSS comment stops yui_dev.js from parsing --
10
+ * twice now -- and nothing else in the suite imports it.
11
+ *
12
+ * Copyright (c) 2026, ArtGins.
13
+ * All Rights Reserved.
14
+ ***********************************************************************/
15
+ import {describe, it, expect} from "vitest";
16
+ import {object_preview} from "./yui_dev.js";
17
+
18
+ describe("object_preview", () => {
19
+ it("names the first fields instead of counting them", () => {
20
+ const col = {
21
+ header: "id", fillspace: 18, type: "string",
22
+ flag: ["persistent"], hidden: false,
23
+ };
24
+ expect(object_preview(col, Object.keys(col).length)).toBe(
25
+ '{header: "id", fillspace: 18, type: "string", flag: […], …}'
26
+ );
27
+ });
28
+
29
+ it("quotes strings, so a value does not run into the next key", () => {
30
+ expect(object_preview({result: 0, comment: "ok"}, 2)).toBe(
31
+ '{result: 0, comment: "ok"}'
32
+ );
33
+ });
34
+
35
+ it("does not enter a nested container", () => {
36
+ const o = {a: {x: 1}, b: [1, 2]};
37
+ expect(object_preview(o, 2)).toBe("{a: {…}, b: […]}");
38
+ });
39
+
40
+ it("says there is more with an ellipsis", () => {
41
+ const o = {a: 1, b: 2, c: 3, d: 4, e: 5};
42
+ expect(object_preview(o, 5)).toBe("{a: 1, b: 2, c: 3, d: 4, …}");
43
+ });
44
+
45
+ it("clips a long string at 28 characters", () => {
46
+ const o = {comment: "x".repeat(60)};
47
+ expect(object_preview(o, 1)).toBe('{comment: "' + "x".repeat(28) + '…"}');
48
+ });
49
+
50
+ it("keeps one field even when it alone is too wide", () => {
51
+ const o = {only: "y".repeat(200), other: 1};
52
+ expect(object_preview(o, 2).startsWith('{only: "yyy')).toBe(true);
53
+ });
54
+
55
+ it("renders null and booleans as themselves", () => {
56
+ expect(object_preview({a: null, b: true}, 2)).toBe("{a: null, b: true}");
57
+ });
58
+ });