@yuneta/gobj-ui 7.23.176 → 7.23.178

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.
@@ -76448,7 +76448,12 @@ function ensure_dev_style() {
76448
76448
  .dir-in .TRAFFIC_ARROW, .dir-in .TRAFFIC_EVENT { color: #059669; }
76449
76449
  .dir-err .TRAFFIC_ARROW, .dir-err .TRAFFIC_EVENT { color: #dc2626; }
76450
76450
  .TRAFFIC_META { margin-left: auto; opacity: 0.6; font-size: 11px; white-space: nowrap; }
76451
- .TRAFFIC_ENTRY:hover .TRAFFIC_KW { margin: 2px 0 0 16px; }
76451
+ /* The indent of a nested block is NOT a hover effect: it used to be given
76452
+ only on .TRAFFIC_ENTRY:hover, so moving the cursor across the log made
76453
+ every payload under it jump 16px sideways and reflow. A payload being
76454
+ read must not move because the pointer passed over it.
76455
+ (No backticks in here: this stylesheet is a template literal.) */
76456
+ .TRAFFIC_KW { margin: 2px 0 0 16px; }
76452
76457
  .TRAFFIC_FULL { margin: 4px 0 0 16px; padding: 6px 8px; font-family: monospace; font-size: 11px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; background: rgba(0,0,0,0.04); border-radius: 4px; overflow-x: auto; }
76453
76458
  .TRAFFIC_ROW { display: flex; gap: 6px; align-items: baseline; }
76454
76459
  .TRAFFIC_BULLET { opacity: 0.45; flex: 0 0 auto; }
@@ -76503,8 +76508,8 @@ details.TRAFFIC_NEST > summary::-webkit-details-marker { display: none; }
76503
76508
  ******************************/
76504
76509
  /************************************************************
76505
76510
  * 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.
76511
+ * Type-coloured; long strings clipped (the whole value is in the Expanded
76512
+ * view); timestamp fields get an ISO annotation.
76508
76513
  ************************************************************/
76509
76514
  function traffic_scalar_row(key, value) {
76510
76515
  let cls;
@@ -76522,14 +76527,10 @@ function traffic_scalar_row(key, value) {
76522
76527
  cls = "t-str";
76523
76528
  text = String(value);
76524
76529
  }
76525
- let full = text;
76526
76530
  if (text.length > 200) text = text.slice(0, 200) + "…";
76527
76531
  let val_children = [[
76528
76532
  "span",
76529
- {
76530
- class: "TRAFFIC_VAL " + cls,
76531
- title: full
76532
- },
76533
+ { class: "TRAFFIC_VAL " + cls },
76533
76534
  text
76534
76535
  ]];
76535
76536
  if (key in TRAFFIC_TS_FIELDS && typeof value === "number") {
@@ -76562,6 +76563,29 @@ function traffic_scalar_row(key, value) {
76562
76563
  ]
76563
76564
  ];
76564
76565
  }
76566
+ var PREVIEW_MAX_KEYS = 4;
76567
+ var PREVIEW_MAX_CHARS = 90;
76568
+ var PREVIEW_MAX_VALUE = 28;
76569
+ function preview_scalar(v) {
76570
+ if (v === null) return "null";
76571
+ if (typeof v === "string") return "\"" + (v.length > PREVIEW_MAX_VALUE ? v.slice(0, PREVIEW_MAX_VALUE) + "…" : v) + "\"";
76572
+ if (typeof v === "object") return Array.isArray(v) ? "[…]" : "{…}";
76573
+ return String(v);
76574
+ }
76575
+ function object_preview(obj, count) {
76576
+ let keys = Object.keys(obj);
76577
+ let parts = [];
76578
+ let used = 0;
76579
+ for (let k of keys) {
76580
+ if (parts.length >= PREVIEW_MAX_KEYS) break;
76581
+ let part = k + ": " + preview_scalar(obj[k]);
76582
+ if (parts.length > 0 && used + part.length > PREVIEW_MAX_CHARS) break;
76583
+ parts.push(part);
76584
+ used += part.length + 2;
76585
+ }
76586
+ if (parts.length < count) parts.push("…");
76587
+ return "{" + parts.join(", ") + "}";
76588
+ }
76565
76589
  /************************************************************
76566
76590
  * One field of any type. Scalars → a bullet row; objects and
76567
76591
  * arrays → a collapsed <details> so metadata / nested payloads
@@ -76592,7 +76616,7 @@ function traffic_value_node(key, value) {
76592
76616
  ]
76593
76617
  ]
76594
76618
  ];
76595
- let hint = is_arr ? `[${count}]` : `{${count}}`;
76619
+ let hint = is_arr ? `[${count}]` : object_preview(value, count);
76596
76620
  return [
76597
76621
  "details",
76598
76622
  { class: "TRAFFIC_NEST" },
@@ -76677,10 +76701,7 @@ function render_detailed(e) {
76677
76701
  ]);
76678
76702
  return (0, _yuneta_gobj_js.createElement2)([
76679
76703
  "div",
76680
- {
76681
- class: "TRAFFIC_ENTRY " + dir_class(e.dir),
76682
- title: e.title
76683
- },
76704
+ { class: "TRAFFIC_ENTRY " + dir_class(e.dir) },
76684
76705
  children
76685
76706
  ]);
76686
76707
  }
@@ -76735,20 +76756,14 @@ function render_full(e) {
76735
76756
  ]];
76736
76757
  return (0, _yuneta_gobj_js.createElement2)([
76737
76758
  "div",
76738
- {
76739
- class: "TRAFFIC_ENTRY " + dir_class(e.dir),
76740
- title: e.title
76741
- },
76759
+ { class: "TRAFFIC_ENTRY " + dir_class(e.dir) },
76742
76760
  children
76743
76761
  ]);
76744
76762
  }
76745
76763
  function render_log(e) {
76746
76764
  let $row = (0, _yuneta_gobj_js.createElement2)([
76747
76765
  "div",
76748
- {
76749
- class: "YDEV_LOGROW YDEV_LOG_" + e.level,
76750
- title: e.level
76751
- },
76766
+ { class: "YDEV_LOGROW YDEV_LOG_" + e.level },
76752
76767
  [
76753
76768
  [
76754
76769
  "span",
@@ -76443,7 +76443,12 @@ function ensure_dev_style() {
76443
76443
  .dir-in .TRAFFIC_ARROW, .dir-in .TRAFFIC_EVENT { color: #059669; }
76444
76444
  .dir-err .TRAFFIC_ARROW, .dir-err .TRAFFIC_EVENT { color: #dc2626; }
76445
76445
  .TRAFFIC_META { margin-left: auto; opacity: 0.6; font-size: 11px; white-space: nowrap; }
76446
- .TRAFFIC_ENTRY:hover .TRAFFIC_KW { margin: 2px 0 0 16px; }
76446
+ /* The indent of a nested block is NOT a hover effect: it used to be given
76447
+ only on .TRAFFIC_ENTRY:hover, so moving the cursor across the log made
76448
+ every payload under it jump 16px sideways and reflow. A payload being
76449
+ read must not move because the pointer passed over it.
76450
+ (No backticks in here: this stylesheet is a template literal.) */
76451
+ .TRAFFIC_KW { margin: 2px 0 0 16px; }
76447
76452
  .TRAFFIC_FULL { margin: 4px 0 0 16px; padding: 6px 8px; font-family: monospace; font-size: 11px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; background: rgba(0,0,0,0.04); border-radius: 4px; overflow-x: auto; }
76448
76453
  .TRAFFIC_ROW { display: flex; gap: 6px; align-items: baseline; }
76449
76454
  .TRAFFIC_BULLET { opacity: 0.45; flex: 0 0 auto; }
@@ -76498,8 +76503,8 @@ details.TRAFFIC_NEST > summary::-webkit-details-marker { display: none; }
76498
76503
  ******************************/
76499
76504
  /************************************************************
76500
76505
  * One scalar field as a bullet row: `• key: value`.
76501
- * Type-coloured; long strings clipped (full text on hover);
76502
- * timestamp fields get an ISO annotation.
76506
+ * Type-coloured; long strings clipped (the whole value is in the Expanded
76507
+ * view); timestamp fields get an ISO annotation.
76503
76508
  ************************************************************/
76504
76509
  function traffic_scalar_row(key, value) {
76505
76510
  let cls;
@@ -76517,14 +76522,10 @@ function traffic_scalar_row(key, value) {
76517
76522
  cls = "t-str";
76518
76523
  text = String(value);
76519
76524
  }
76520
- let full = text;
76521
76525
  if (text.length > 200) text = text.slice(0, 200) + "…";
76522
76526
  let val_children = [[
76523
76527
  "span",
76524
- {
76525
- class: "TRAFFIC_VAL " + cls,
76526
- title: full
76527
- },
76528
+ { class: "TRAFFIC_VAL " + cls },
76528
76529
  text
76529
76530
  ]];
76530
76531
  if (key in TRAFFIC_TS_FIELDS && typeof value === "number") {
@@ -76557,6 +76558,29 @@ function traffic_scalar_row(key, value) {
76557
76558
  ]
76558
76559
  ];
76559
76560
  }
76561
+ var PREVIEW_MAX_KEYS = 4;
76562
+ var PREVIEW_MAX_CHARS = 90;
76563
+ var PREVIEW_MAX_VALUE = 28;
76564
+ function preview_scalar(v) {
76565
+ if (v === null) return "null";
76566
+ if (typeof v === "string") return "\"" + (v.length > PREVIEW_MAX_VALUE ? v.slice(0, PREVIEW_MAX_VALUE) + "…" : v) + "\"";
76567
+ if (typeof v === "object") return Array.isArray(v) ? "[…]" : "{…}";
76568
+ return String(v);
76569
+ }
76570
+ function object_preview(obj, count) {
76571
+ let keys = Object.keys(obj);
76572
+ let parts = [];
76573
+ let used = 0;
76574
+ for (let k of keys) {
76575
+ if (parts.length >= PREVIEW_MAX_KEYS) break;
76576
+ let part = k + ": " + preview_scalar(obj[k]);
76577
+ if (parts.length > 0 && used + part.length > PREVIEW_MAX_CHARS) break;
76578
+ parts.push(part);
76579
+ used += part.length + 2;
76580
+ }
76581
+ if (parts.length < count) parts.push("…");
76582
+ return "{" + parts.join(", ") + "}";
76583
+ }
76560
76584
  /************************************************************
76561
76585
  * One field of any type. Scalars → a bullet row; objects and
76562
76586
  * arrays → a collapsed <details> so metadata / nested payloads
@@ -76587,7 +76611,7 @@ function traffic_value_node(key, value) {
76587
76611
  ]
76588
76612
  ]
76589
76613
  ];
76590
- let hint = is_arr ? `[${count}]` : `{${count}}`;
76614
+ let hint = is_arr ? `[${count}]` : object_preview(value, count);
76591
76615
  return [
76592
76616
  "details",
76593
76617
  { class: "TRAFFIC_NEST" },
@@ -76672,10 +76696,7 @@ function render_detailed(e) {
76672
76696
  ]);
76673
76697
  return createElement2([
76674
76698
  "div",
76675
- {
76676
- class: "TRAFFIC_ENTRY " + dir_class(e.dir),
76677
- title: e.title
76678
- },
76699
+ { class: "TRAFFIC_ENTRY " + dir_class(e.dir) },
76679
76700
  children
76680
76701
  ]);
76681
76702
  }
@@ -76730,20 +76751,14 @@ function render_full(e) {
76730
76751
  ]];
76731
76752
  return createElement2([
76732
76753
  "div",
76733
- {
76734
- class: "TRAFFIC_ENTRY " + dir_class(e.dir),
76735
- title: e.title
76736
- },
76754
+ { class: "TRAFFIC_ENTRY " + dir_class(e.dir) },
76737
76755
  children
76738
76756
  ]);
76739
76757
  }
76740
76758
  function render_log(e) {
76741
76759
  let $row = createElement2([
76742
76760
  "div",
76743
- {
76744
- class: "YDEV_LOGROW YDEV_LOG_" + e.level,
76745
- title: e.level
76746
- },
76761
+ { class: "YDEV_LOGROW YDEV_LOG_" + e.level },
76747
76762
  [
76748
76763
  [
76749
76764
  "span",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.176",
3
+ "version": "7.23.178",
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
@@ -468,7 +468,12 @@ function ensure_dev_style()
468
468
  .dir-in .TRAFFIC_ARROW, .dir-in .TRAFFIC_EVENT { color: #059669; }
469
469
  .dir-err .TRAFFIC_ARROW, .dir-err .TRAFFIC_EVENT { color: #dc2626; }
470
470
  .TRAFFIC_META { margin-left: auto; opacity: 0.6; font-size: 11px; white-space: nowrap; }
471
- .TRAFFIC_ENTRY:hover .TRAFFIC_KW { margin: 2px 0 0 16px; }
471
+ /* The indent of a nested block is NOT a hover effect: it used to be given
472
+ only on .TRAFFIC_ENTRY:hover, so moving the cursor across the log made
473
+ every payload under it jump 16px sideways and reflow. A payload being
474
+ read must not move because the pointer passed over it.
475
+ (No backticks in here: this stylesheet is a template literal.) */
476
+ .TRAFFIC_KW { margin: 2px 0 0 16px; }
472
477
  .TRAFFIC_FULL { margin: 4px 0 0 16px; padding: 6px 8px; font-family: monospace; font-size: 11px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; background: rgba(0,0,0,0.04); border-radius: 4px; overflow-x: auto; }
473
478
  .TRAFFIC_ROW { display: flex; gap: 6px; align-items: baseline; }
474
479
  .TRAFFIC_BULLET { opacity: 0.45; flex: 0 0 auto; }
@@ -527,8 +532,8 @@ details.TRAFFIC_NEST > summary::-webkit-details-marker { display: none; }
527
532
 
528
533
  /************************************************************
529
534
  * One scalar field as a bullet row: `• key: value`.
530
- * Type-coloured; long strings clipped (full text on hover);
531
- * timestamp fields get an ISO annotation.
535
+ * Type-coloured; long strings clipped (the whole value is in the Expanded
536
+ * view); timestamp fields get an ISO annotation.
532
537
  ************************************************************/
533
538
  function traffic_scalar_row(key, value)
534
539
  {
@@ -548,13 +553,16 @@ function traffic_scalar_row(key, value)
548
553
  text = String(value);
549
554
  }
550
555
 
551
- let full = text;
552
556
  if(text.length > 200) {
553
557
  text = text.slice(0, 200) + "…";
554
558
  }
555
559
 
560
+ /* No `title` with the full text: a tooltip that pops over the log while
561
+ it is being read is what this window had too much of, and the whole
562
+ value is one click away in the Expanded view. On a value SHORTER than
563
+ the clip -- almost all of them -- it repeated the visible text anyway. */
556
564
  let val_children = [
557
- ['span', {class: 'TRAFFIC_VAL ' + cls, title: full}, text],
565
+ ['span', {class: 'TRAFFIC_VAL ' + cls}, text],
558
566
  ];
559
567
  if((key in TRAFFIC_TS_FIELDS) && typeof value === "number") {
560
568
  let iso = traffic_iso(value);
@@ -570,6 +578,67 @@ function traffic_scalar_row(key, value)
570
578
  ]];
571
579
  }
572
580
 
581
+ /* What a FOLDED object says about itself, the way a browser console says it:
582
+ * its first fields rather than a count. `{5}` is true and tells the reader
583
+ * nothing -- a list of twelve column descriptors was twelve identical `{5}`,
584
+ * and finding the one for `tags` meant opening them one at a time. The
585
+ * console prints `Object { header: "id", fillspace: 18, … }` and that is the
586
+ * idea copied here.
587
+ *
588
+ * Strings are QUOTED, unlike the expanded rows: in one line of several
589
+ * fields the quotes are what separate a value from the next key.
590
+ * A nested container is not entered -- it says `{…}` / `[…]` -- because a
591
+ * preview that recursed would be as long as the thing it previews.
592
+ *
593
+ * The count is not lost: it stays in the tooltip, for an object whose first
594
+ * fields do not fit. */
595
+ const PREVIEW_MAX_KEYS = 4;
596
+ const PREVIEW_MAX_CHARS = 90;
597
+ const PREVIEW_MAX_VALUE = 28;
598
+
599
+ function preview_scalar(v)
600
+ {
601
+ if(v === null) {
602
+ return "null";
603
+ }
604
+ if(typeof v === "string") {
605
+ let text = (v.length > PREVIEW_MAX_VALUE) ?
606
+ v.slice(0, PREVIEW_MAX_VALUE) + "…" : v;
607
+ return '"' + text + '"';
608
+ }
609
+ if(typeof v === "object") {
610
+ return Array.isArray(v) ? "[…]" : "{…}";
611
+ }
612
+ return String(v);
613
+ }
614
+
615
+ function object_preview(obj, count)
616
+ {
617
+ let keys = Object.keys(obj);
618
+ let parts = [];
619
+ let used = 0;
620
+
621
+ for(let k of keys) {
622
+ if(parts.length >= PREVIEW_MAX_KEYS) {
623
+ break;
624
+ }
625
+ let part = k + ": " + preview_scalar(obj[k]);
626
+ /* Stop at the width, but never with an empty preview: one field
627
+ too wide still says more than a number. */
628
+ if(parts.length > 0 && used + part.length > PREVIEW_MAX_CHARS) {
629
+ break;
630
+ }
631
+ parts.push(part);
632
+ used += part.length + 2;
633
+ }
634
+
635
+ if(parts.length < count) {
636
+ parts.push("…");
637
+ }
638
+
639
+ return "{" + parts.join(", ") + "}";
640
+ }
641
+
573
642
  /************************************************************
574
643
  * One field of any type. Scalars → a bullet row; objects and
575
644
  * arrays → a collapsed <details> so metadata / nested payloads
@@ -591,7 +660,7 @@ function traffic_value_node(key, value)
591
660
  ]];
592
661
  }
593
662
 
594
- let hint = is_arr ? `[${count}]` : `{${count}}`;
663
+ let hint = is_arr ? `[${count}]` : object_preview(value, count);
595
664
  return ['details', {class: 'TRAFFIC_NEST'}, [
596
665
  ['summary', {}, [
597
666
  ['span', {class: 'TRAFFIC_BULLET'}, '▸'],
@@ -649,7 +718,7 @@ function render_detailed(e)
649
718
  } else if(!kw) {
650
719
  children.push(['div', {class: 'TRAFFIC_KW'}, traffic_bullets(e.jn)]);
651
720
  }
652
- return createElement2(['div', {class: 'TRAFFIC_ENTRY ' + dir_class(e.dir), title: e.title}, children]);
721
+ return createElement2(['div', {class: 'TRAFFIC_ENTRY ' + dir_class(e.dir)}, children]);
653
722
  }
654
723
 
655
724
  /* Whether an Expanded-view section is shown (persisted toggles). schema
@@ -709,14 +778,14 @@ function render_full(e)
709
778
  ['div', {class: 'TRAFFIC_HEADER'}, head],
710
779
  ['pre', {class: 'TRAFFIC_FULL'}, text],
711
780
  ];
712
- return createElement2(['div', {class: 'TRAFFIC_ENTRY ' + dir_class(e.dir), title: e.title}, children]);
781
+ return createElement2(['div', {class: 'TRAFFIC_ENTRY ' + dir_class(e.dir)}, children]);
713
782
  }
714
783
 
715
784
  /* A mirrored framework log line (error/warning/info/debug/msg). */
716
785
  function render_log(e)
717
786
  {
718
787
  let $row = createElement2(
719
- ['div', {class: 'YDEV_LOGROW YDEV_LOG_' + e.level, title: e.level}, [
788
+ ['div', {class: 'YDEV_LOGROW YDEV_LOG_' + e.level}, [
720
789
  ['span', {class: 'YDEV_LOG_LVL'}, e.level],
721
790
  ['span', {class: 'YDEV_LOG_TXT'}, ''],
722
791
  ['span', {class: 'TRAFFIC_META'}, e.ts],