@yuneta/gobj-ui 7.23.177 → 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; }
@@ -76508,8 +76512,8 @@ details.TRAFFIC_NEST > summary::-webkit-details-marker { display: none; }
76508
76512
  ******************************/
76509
76513
  /************************************************************
76510
76514
  * One scalar field as a bullet row: `• key: value`.
76511
- * Type-coloured; long strings clipped (full text on hover);
76512
- * timestamp fields get an ISO annotation.
76515
+ * Type-coloured; long strings clipped (the whole value is in the Expanded
76516
+ * view); timestamp fields get an ISO annotation.
76513
76517
  ************************************************************/
76514
76518
  function traffic_scalar_row(key, value) {
76515
76519
  let cls;
@@ -76527,14 +76531,10 @@ function traffic_scalar_row(key, value) {
76527
76531
  cls = "t-str";
76528
76532
  text = String(value);
76529
76533
  }
76530
- let full = text;
76531
76534
  if (text.length > 200) text = text.slice(0, 200) + "…";
76532
76535
  let val_children = [[
76533
76536
  "span",
76534
- {
76535
- class: "TRAFFIC_VAL " + cls,
76536
- title: full
76537
- },
76537
+ { class: "TRAFFIC_VAL " + cls },
76538
76538
  text
76539
76539
  ]];
76540
76540
  if (key in TRAFFIC_TS_FIELDS && typeof value === "number") {
@@ -76640,10 +76640,7 @@ function traffic_value_node(key, value) {
76640
76640
  ],
76641
76641
  [
76642
76642
  "span",
76643
- {
76644
- class: "TRAFFIC_NEST_HINT",
76645
- title: `${count}`
76646
- },
76643
+ { class: "TRAFFIC_NEST_HINT" },
76647
76644
  hint
76648
76645
  ]
76649
76646
  ]
@@ -76681,6 +76678,11 @@ function event_spans(e) {
76681
76678
  { class: "TRAFFIC_CMD" },
76682
76679
  e.command
76683
76680
  ]);
76681
+ if (e.title) spans.push([
76682
+ "span",
76683
+ { class: "TRAFFIC_SRC" },
76684
+ e.title
76685
+ ]);
76684
76686
  return spans;
76685
76687
  }
76686
76688
  function render_detailed(e) {
@@ -76708,10 +76710,7 @@ function render_detailed(e) {
76708
76710
  ]);
76709
76711
  return (0, _yuneta_gobj_js.createElement2)([
76710
76712
  "div",
76711
- {
76712
- class: "TRAFFIC_ENTRY " + dir_class(e.dir),
76713
- title: e.title
76714
- },
76713
+ { class: "TRAFFIC_ENTRY " + dir_class(e.dir) },
76715
76714
  children
76716
76715
  ]);
76717
76716
  }
@@ -76766,20 +76765,14 @@ function render_full(e) {
76766
76765
  ]];
76767
76766
  return (0, _yuneta_gobj_js.createElement2)([
76768
76767
  "div",
76769
- {
76770
- class: "TRAFFIC_ENTRY " + dir_class(e.dir),
76771
- title: e.title
76772
- },
76768
+ { class: "TRAFFIC_ENTRY " + dir_class(e.dir) },
76773
76769
  children
76774
76770
  ]);
76775
76771
  }
76776
76772
  function render_log(e) {
76777
76773
  let $row = (0, _yuneta_gobj_js.createElement2)([
76778
76774
  "div",
76779
- {
76780
- class: "YDEV_LOGROW YDEV_LOG_" + e.level,
76781
- title: e.level
76782
- },
76775
+ { class: "YDEV_LOGROW YDEV_LOG_" + e.level },
76783
76776
  [
76784
76777
  [
76785
76778
  "span",
@@ -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; }
@@ -76503,8 +76507,8 @@ details.TRAFFIC_NEST > summary::-webkit-details-marker { display: none; }
76503
76507
  ******************************/
76504
76508
  /************************************************************
76505
76509
  * One scalar field as a bullet row: `• key: value`.
76506
- * Type-coloured; long strings clipped (full text on hover);
76507
- * timestamp fields get an ISO annotation.
76510
+ * Type-coloured; long strings clipped (the whole value is in the Expanded
76511
+ * view); timestamp fields get an ISO annotation.
76508
76512
  ************************************************************/
76509
76513
  function traffic_scalar_row(key, value) {
76510
76514
  let cls;
@@ -76522,14 +76526,10 @@ function traffic_scalar_row(key, value) {
76522
76526
  cls = "t-str";
76523
76527
  text = String(value);
76524
76528
  }
76525
- let full = text;
76526
76529
  if (text.length > 200) text = text.slice(0, 200) + "…";
76527
76530
  let val_children = [[
76528
76531
  "span",
76529
- {
76530
- class: "TRAFFIC_VAL " + cls,
76531
- title: full
76532
- },
76532
+ { class: "TRAFFIC_VAL " + cls },
76533
76533
  text
76534
76534
  ]];
76535
76535
  if (key in TRAFFIC_TS_FIELDS && typeof value === "number") {
@@ -76635,10 +76635,7 @@ function traffic_value_node(key, value) {
76635
76635
  ],
76636
76636
  [
76637
76637
  "span",
76638
- {
76639
- class: "TRAFFIC_NEST_HINT",
76640
- title: `${count}`
76641
- },
76638
+ { class: "TRAFFIC_NEST_HINT" },
76642
76639
  hint
76643
76640
  ]
76644
76641
  ]
@@ -76676,6 +76673,11 @@ function event_spans(e) {
76676
76673
  { class: "TRAFFIC_CMD" },
76677
76674
  e.command
76678
76675
  ]);
76676
+ if (e.title) spans.push([
76677
+ "span",
76678
+ { class: "TRAFFIC_SRC" },
76679
+ e.title
76680
+ ]);
76679
76681
  return spans;
76680
76682
  }
76681
76683
  function render_detailed(e) {
@@ -76703,10 +76705,7 @@ function render_detailed(e) {
76703
76705
  ]);
76704
76706
  return createElement2([
76705
76707
  "div",
76706
- {
76707
- class: "TRAFFIC_ENTRY " + dir_class(e.dir),
76708
- title: e.title
76709
- },
76708
+ { class: "TRAFFIC_ENTRY " + dir_class(e.dir) },
76710
76709
  children
76711
76710
  ]);
76712
76711
  }
@@ -76761,20 +76760,14 @@ function render_full(e) {
76761
76760
  ]];
76762
76761
  return createElement2([
76763
76762
  "div",
76764
- {
76765
- class: "TRAFFIC_ENTRY " + dir_class(e.dir),
76766
- title: e.title
76767
- },
76763
+ { class: "TRAFFIC_ENTRY " + dir_class(e.dir) },
76768
76764
  children
76769
76765
  ]);
76770
76766
  }
76771
76767
  function render_log(e) {
76772
76768
  let $row = createElement2([
76773
76769
  "div",
76774
- {
76775
- class: "YDEV_LOGROW YDEV_LOG_" + e.level,
76776
- title: e.level
76777
- },
76770
+ { class: "YDEV_LOGROW YDEV_LOG_" + e.level },
76778
76771
  [
76779
76772
  [
76780
76773
  "span",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.177",
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; }
@@ -532,8 +536,8 @@ details.TRAFFIC_NEST > summary::-webkit-details-marker { display: none; }
532
536
 
533
537
  /************************************************************
534
538
  * One scalar field as a bullet row: `• key: value`.
535
- * Type-coloured; long strings clipped (full text on hover);
536
- * timestamp fields get an ISO annotation.
539
+ * Type-coloured; long strings clipped (the whole value is in the Expanded
540
+ * view); timestamp fields get an ISO annotation.
537
541
  ************************************************************/
538
542
  function traffic_scalar_row(key, value)
539
543
  {
@@ -553,13 +557,16 @@ function traffic_scalar_row(key, value)
553
557
  text = String(value);
554
558
  }
555
559
 
556
- let full = text;
557
560
  if(text.length > 200) {
558
561
  text = text.slice(0, 200) + "…";
559
562
  }
560
563
 
564
+ /* No `title` with the full text: a tooltip that pops over the log while
565
+ it is being read is what this window had too much of, and the whole
566
+ value is one click away in the Expanded view. On a value SHORTER than
567
+ the clip -- almost all of them -- it repeated the visible text anyway. */
561
568
  let val_children = [
562
- ['span', {class: 'TRAFFIC_VAL ' + cls, title: full}, text],
569
+ ['span', {class: 'TRAFFIC_VAL ' + cls}, text],
563
570
  ];
564
571
  if((key in TRAFFIC_TS_FIELDS) && typeof value === "number") {
565
572
  let iso = traffic_iso(value);
@@ -662,7 +669,7 @@ function traffic_value_node(key, value)
662
669
  ['summary', {}, [
663
670
  ['span', {class: 'TRAFFIC_BULLET'}, '▸'],
664
671
  ['span', {class: 'TRAFFIC_NEST_KEY'}, key],
665
- ['span', {class: 'TRAFFIC_NEST_HINT', title: `${count}`}, hint],
672
+ ['span', {class: 'TRAFFIC_NEST_HINT'}, hint],
666
673
  ]],
667
674
  ['div', {class: 'TRAFFIC_KW'}, traffic_bullets(value)],
668
675
  ]];
@@ -692,6 +699,20 @@ function traffic_bullets(obj)
692
699
  ******************************/
693
700
 
694
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. */
695
716
  function event_spans(e)
696
717
  {
697
718
  let spans = [['span', {class: 'TRAFFIC_ARROW'}, dir_arrow(e.dir)],
@@ -699,6 +720,9 @@ function event_spans(e)
699
720
  if(e.command) {
700
721
  spans.push(['span', {class: 'TRAFFIC_CMD'}, e.command]);
701
722
  }
723
+ if(e.title) {
724
+ spans.push(['span', {class: 'TRAFFIC_SRC'}, e.title]);
725
+ }
702
726
  return spans;
703
727
  }
704
728
 
@@ -715,7 +739,7 @@ function render_detailed(e)
715
739
  } else if(!kw) {
716
740
  children.push(['div', {class: 'TRAFFIC_KW'}, traffic_bullets(e.jn)]);
717
741
  }
718
- return createElement2(['div', {class: 'TRAFFIC_ENTRY ' + dir_class(e.dir), title: e.title}, children]);
742
+ return createElement2(['div', {class: 'TRAFFIC_ENTRY ' + dir_class(e.dir)}, children]);
719
743
  }
720
744
 
721
745
  /* Whether an Expanded-view section is shown (persisted toggles). schema
@@ -775,14 +799,14 @@ function render_full(e)
775
799
  ['div', {class: 'TRAFFIC_HEADER'}, head],
776
800
  ['pre', {class: 'TRAFFIC_FULL'}, text],
777
801
  ];
778
- return createElement2(['div', {class: 'TRAFFIC_ENTRY ' + dir_class(e.dir), title: e.title}, children]);
802
+ return createElement2(['div', {class: 'TRAFFIC_ENTRY ' + dir_class(e.dir)}, children]);
779
803
  }
780
804
 
781
805
  /* A mirrored framework log line (error/warning/info/debug/msg). */
782
806
  function render_log(e)
783
807
  {
784
808
  let $row = createElement2(
785
- ['div', {class: 'YDEV_LOGROW YDEV_LOG_' + e.level, title: e.level}, [
809
+ ['div', {class: 'YDEV_LOGROW YDEV_LOG_' + e.level}, [
786
810
  ['span', {class: 'YDEV_LOG_LVL'}, e.level],
787
811
  ['span', {class: 'YDEV_LOG_TXT'}, ''],
788
812
  ['span', {class: 'TRAFFIC_META'}, e.ts],
@@ -1757,4 +1781,11 @@ function build_dev_panel()
1757
1781
  return {$el: $el, dispose: dispose};
1758
1782
  }
1759
1783
 
1760
- 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
+ });