@yuneta/gobj-ui 7.26.0 → 7.26.2
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/dist/gobj-ui.cjs.js +54 -2
- package/dist/gobj-ui.es.js +54 -2
- package/package.json +2 -2
- package/src/c_yui_shell.js +32 -0
- package/src/yui_dev.js +79 -3
- package/src/yui_dev_copy.test.js +61 -0
- package/src/yui_shell_last_route.test.js +53 -0
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -79079,6 +79079,15 @@ function ensure_dev_style() {
|
|
|
79079
79079
|
background: rgba(0,0,0,0.03);
|
|
79080
79080
|
}
|
|
79081
79081
|
.YDEV_GROUP { display: inline-flex; align-items: center; gap: 5px; }
|
|
79082
|
+
/* A whole line of the bar, whose chips scroll sideways inside it: the
|
|
79083
|
+
window never does. min-width 0 so the flex line can be narrower than
|
|
79084
|
+
its content; the chips keep their size and their label on one line. */
|
|
79085
|
+
.YDEV_GROUP_SCROLL { flex: 1 1 100%; min-width: 0; }
|
|
79086
|
+
.YDEV_SCROLL {
|
|
79087
|
+
display: flex; align-items: center; gap: 5px; min-width: 0; flex: 1 1 auto;
|
|
79088
|
+
overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; padding-bottom: 2px;
|
|
79089
|
+
}
|
|
79090
|
+
.YDEV_SCROLL > * { flex: 0 0 auto; white-space: nowrap; }
|
|
79082
79091
|
.YDEV_LABEL {
|
|
79083
79092
|
font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em;
|
|
79084
79093
|
opacity: 0.6; align-self: center;
|
|
@@ -79916,6 +79925,29 @@ function refresh_dev_chrome() {
|
|
|
79916
79925
|
});
|
|
79917
79926
|
update_stats();
|
|
79918
79927
|
}
|
|
79928
|
+
function kw_shown_lines($kw, indent, out) {
|
|
79929
|
+
if (!$kw) return out;
|
|
79930
|
+
for (let $n of $kw.children) if ($n.classList.contains("TRAFFIC_ROW")) {
|
|
79931
|
+
let $key = $n.querySelector(".TRAFFIC_KEY");
|
|
79932
|
+
let key = $key ? $key.textContent : "";
|
|
79933
|
+
let vals = [];
|
|
79934
|
+
for (let $c of $n.children) {
|
|
79935
|
+
if ($c.classList.contains("TRAFFIC_BULLET") || $c === $key) continue;
|
|
79936
|
+
vals.push($c.children.length ? Array.from($c.children).map(($x) => $x.textContent).join(" ") : $c.textContent);
|
|
79937
|
+
}
|
|
79938
|
+
out.push(`${indent}• ${key} ${vals.join(" ")}`.trimEnd());
|
|
79939
|
+
} else if ($n.tagName === "DETAILS") {
|
|
79940
|
+
let $sum = $n.querySelector(":scope > summary");
|
|
79941
|
+
let $key = $sum ? $sum.querySelector(".TRAFFIC_NEST_KEY") : null;
|
|
79942
|
+
let $hint = $sum ? $sum.querySelector(".TRAFFIC_NEST_HINT_WRAP") : null;
|
|
79943
|
+
out.push(`${indent}${$n.open ? "▾" : "▸"} ` + `${$key ? $key.textContent : ""} ${$hint ? $hint.textContent : ""}`.trimEnd());
|
|
79944
|
+
if ($n.open) kw_shown_lines($n.querySelector(":scope > .TRAFFIC_KW"), indent + " ", out);
|
|
79945
|
+
}
|
|
79946
|
+
return out;
|
|
79947
|
+
}
|
|
79948
|
+
function entry_shown_lines($entry) {
|
|
79949
|
+
return kw_shown_lines($entry ? $entry.querySelector(":scope > .TRAFFIC_KW") : null, " ", []);
|
|
79950
|
+
}
|
|
79919
79951
|
function traffic_to_text() {
|
|
79920
79952
|
let ctx = build_filter_ctx();
|
|
79921
79953
|
let out = [];
|
|
@@ -79928,6 +79960,11 @@ function traffic_to_text() {
|
|
|
79928
79960
|
}
|
|
79929
79961
|
let head = `${e.ts} ${dir_arrow(e.dir)} ${e.title ? "[" + e.title + "] " : ""}${e.event}${e.command ? " " + e.command : ""}`;
|
|
79930
79962
|
out.push(head);
|
|
79963
|
+
if (dev_traffic_view() !== "expanded" && e.$node) {
|
|
79964
|
+
out.push(...entry_shown_lines(e.$node));
|
|
79965
|
+
out.push("");
|
|
79966
|
+
continue;
|
|
79967
|
+
}
|
|
79931
79968
|
let payload = e.kw ? e.kw : e.jn;
|
|
79932
79969
|
try {
|
|
79933
79970
|
out.push(JSON.stringify(payload, null, 4));
|
|
@@ -80226,6 +80263,22 @@ function build_control_bar() {
|
|
|
80226
80263
|
(0, i18next.t)(label)
|
|
80227
80264
|
], ...items]
|
|
80228
80265
|
];
|
|
80266
|
+
let grp_scroll = (label, items) => [
|
|
80267
|
+
"div",
|
|
80268
|
+
{ class: "YDEV_GROUP YDEV_GROUP_SCROLL" },
|
|
80269
|
+
[[
|
|
80270
|
+
"span",
|
|
80271
|
+
{
|
|
80272
|
+
class: "YDEV_LABEL",
|
|
80273
|
+
"data-i18n": label
|
|
80274
|
+
},
|
|
80275
|
+
(0, i18next.t)(label)
|
|
80276
|
+
], [
|
|
80277
|
+
"div",
|
|
80278
|
+
{ class: "YDEV_SCROLL" },
|
|
80279
|
+
items
|
|
80280
|
+
]]
|
|
80281
|
+
];
|
|
80229
80282
|
let sep = () => [
|
|
80230
80283
|
"span",
|
|
80231
80284
|
{ class: "YDEV_SEP" },
|
|
@@ -80235,12 +80288,11 @@ function build_control_bar() {
|
|
|
80235
80288
|
"div",
|
|
80236
80289
|
{ class: "YDEV_BAR" },
|
|
80237
80290
|
[
|
|
80238
|
-
|
|
80291
|
+
grp_scroll("traces", [
|
|
80239
80292
|
...trace_chips,
|
|
80240
80293
|
simple_mach,
|
|
80241
80294
|
traces_payload
|
|
80242
80295
|
]),
|
|
80243
|
-
sep(),
|
|
80244
80296
|
grp("output", [output_seg]),
|
|
80245
80297
|
sep(),
|
|
80246
80298
|
grp("view", [view_seg]),
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -79074,6 +79074,15 @@ function ensure_dev_style() {
|
|
|
79074
79074
|
background: rgba(0,0,0,0.03);
|
|
79075
79075
|
}
|
|
79076
79076
|
.YDEV_GROUP { display: inline-flex; align-items: center; gap: 5px; }
|
|
79077
|
+
/* A whole line of the bar, whose chips scroll sideways inside it: the
|
|
79078
|
+
window never does. min-width 0 so the flex line can be narrower than
|
|
79079
|
+
its content; the chips keep their size and their label on one line. */
|
|
79080
|
+
.YDEV_GROUP_SCROLL { flex: 1 1 100%; min-width: 0; }
|
|
79081
|
+
.YDEV_SCROLL {
|
|
79082
|
+
display: flex; align-items: center; gap: 5px; min-width: 0; flex: 1 1 auto;
|
|
79083
|
+
overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; padding-bottom: 2px;
|
|
79084
|
+
}
|
|
79085
|
+
.YDEV_SCROLL > * { flex: 0 0 auto; white-space: nowrap; }
|
|
79077
79086
|
.YDEV_LABEL {
|
|
79078
79087
|
font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em;
|
|
79079
79088
|
opacity: 0.6; align-self: center;
|
|
@@ -79911,6 +79920,29 @@ function refresh_dev_chrome() {
|
|
|
79911
79920
|
});
|
|
79912
79921
|
update_stats();
|
|
79913
79922
|
}
|
|
79923
|
+
function kw_shown_lines($kw, indent, out) {
|
|
79924
|
+
if (!$kw) return out;
|
|
79925
|
+
for (let $n of $kw.children) if ($n.classList.contains("TRAFFIC_ROW")) {
|
|
79926
|
+
let $key = $n.querySelector(".TRAFFIC_KEY");
|
|
79927
|
+
let key = $key ? $key.textContent : "";
|
|
79928
|
+
let vals = [];
|
|
79929
|
+
for (let $c of $n.children) {
|
|
79930
|
+
if ($c.classList.contains("TRAFFIC_BULLET") || $c === $key) continue;
|
|
79931
|
+
vals.push($c.children.length ? Array.from($c.children).map(($x) => $x.textContent).join(" ") : $c.textContent);
|
|
79932
|
+
}
|
|
79933
|
+
out.push(`${indent}• ${key} ${vals.join(" ")}`.trimEnd());
|
|
79934
|
+
} else if ($n.tagName === "DETAILS") {
|
|
79935
|
+
let $sum = $n.querySelector(":scope > summary");
|
|
79936
|
+
let $key = $sum ? $sum.querySelector(".TRAFFIC_NEST_KEY") : null;
|
|
79937
|
+
let $hint = $sum ? $sum.querySelector(".TRAFFIC_NEST_HINT_WRAP") : null;
|
|
79938
|
+
out.push(`${indent}${$n.open ? "▾" : "▸"} ` + `${$key ? $key.textContent : ""} ${$hint ? $hint.textContent : ""}`.trimEnd());
|
|
79939
|
+
if ($n.open) kw_shown_lines($n.querySelector(":scope > .TRAFFIC_KW"), indent + " ", out);
|
|
79940
|
+
}
|
|
79941
|
+
return out;
|
|
79942
|
+
}
|
|
79943
|
+
function entry_shown_lines($entry) {
|
|
79944
|
+
return kw_shown_lines($entry ? $entry.querySelector(":scope > .TRAFFIC_KW") : null, " ", []);
|
|
79945
|
+
}
|
|
79914
79946
|
function traffic_to_text() {
|
|
79915
79947
|
let ctx = build_filter_ctx();
|
|
79916
79948
|
let out = [];
|
|
@@ -79923,6 +79955,11 @@ function traffic_to_text() {
|
|
|
79923
79955
|
}
|
|
79924
79956
|
let head = `${e.ts} ${dir_arrow(e.dir)} ${e.title ? "[" + e.title + "] " : ""}${e.event}${e.command ? " " + e.command : ""}`;
|
|
79925
79957
|
out.push(head);
|
|
79958
|
+
if (dev_traffic_view() !== "expanded" && e.$node) {
|
|
79959
|
+
out.push(...entry_shown_lines(e.$node));
|
|
79960
|
+
out.push("");
|
|
79961
|
+
continue;
|
|
79962
|
+
}
|
|
79926
79963
|
let payload = e.kw ? e.kw : e.jn;
|
|
79927
79964
|
try {
|
|
79928
79965
|
out.push(JSON.stringify(payload, null, 4));
|
|
@@ -80221,6 +80258,22 @@ function build_control_bar() {
|
|
|
80221
80258
|
t(label)
|
|
80222
80259
|
], ...items]
|
|
80223
80260
|
];
|
|
80261
|
+
let grp_scroll = (label, items) => [
|
|
80262
|
+
"div",
|
|
80263
|
+
{ class: "YDEV_GROUP YDEV_GROUP_SCROLL" },
|
|
80264
|
+
[[
|
|
80265
|
+
"span",
|
|
80266
|
+
{
|
|
80267
|
+
class: "YDEV_LABEL",
|
|
80268
|
+
"data-i18n": label
|
|
80269
|
+
},
|
|
80270
|
+
t(label)
|
|
80271
|
+
], [
|
|
80272
|
+
"div",
|
|
80273
|
+
{ class: "YDEV_SCROLL" },
|
|
80274
|
+
items
|
|
80275
|
+
]]
|
|
80276
|
+
];
|
|
80224
80277
|
let sep = () => [
|
|
80225
80278
|
"span",
|
|
80226
80279
|
{ class: "YDEV_SEP" },
|
|
@@ -80230,12 +80283,11 @@ function build_control_bar() {
|
|
|
80230
80283
|
"div",
|
|
80231
80284
|
{ class: "YDEV_BAR" },
|
|
80232
80285
|
[
|
|
80233
|
-
|
|
80286
|
+
grp_scroll("traces", [
|
|
80234
80287
|
...trace_chips,
|
|
80235
80288
|
simple_mach,
|
|
80236
80289
|
traces_payload
|
|
80237
80290
|
]),
|
|
80238
|
-
sep(),
|
|
80239
80291
|
grp("output", [output_seg]),
|
|
80240
80292
|
sep(),
|
|
80241
80293
|
grp("view", [view_seg]),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuneta/gobj-ui",
|
|
3
|
-
"version": "7.26.
|
|
3
|
+
"version": "7.26.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/gobj-ui.cjs.js",
|
|
6
6
|
"module": "dist/gobj-ui.es.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@rollup/plugin-terser": "^1.0.0",
|
|
32
32
|
"@vitest/coverage-v8": "^4.1.10",
|
|
33
33
|
"@yuneta/gobj-js": "^7.25.8",
|
|
34
|
-
"vite": "^8.3.
|
|
34
|
+
"vite": "^8.3.3",
|
|
35
35
|
"vitest": "^4.1.10"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
package/src/c_yui_shell.js
CHANGED
|
@@ -3276,6 +3276,37 @@ function yui_shell_last_route_under(shell_gobj, route)
|
|
|
3276
3276
|
return route;
|
|
3277
3277
|
}
|
|
3278
3278
|
|
|
3279
|
+
/************************************************************
|
|
3280
|
+
* Where the reader last was OUTSIDE `route`: the most recent
|
|
3281
|
+
* visited route that is neither `route` nor below it, or "" when
|
|
3282
|
+
* there is none (the page landed there and never left).
|
|
3283
|
+
*
|
|
3284
|
+
* It is the other half of yui_shell_last_route_under(), and it is
|
|
3285
|
+
* what a "back" button of a view means: the view the reader CAME
|
|
3286
|
+
* FROM, wherever that was. Browser Back already does that; a
|
|
3287
|
+
* button that names one fixed route instead only agrees with it
|
|
3288
|
+
* when the reader happened to come from there. Excluding the
|
|
3289
|
+
* whole subtree is the point -- going from one record of a detail
|
|
3290
|
+
* view to the next must not make "back" step through them.
|
|
3291
|
+
*
|
|
3292
|
+
* Like the other memories, a mirror of the url for the page: the
|
|
3293
|
+
* caller decides what to do with "" (a fixed fallback, usually).
|
|
3294
|
+
************************************************************/
|
|
3295
|
+
function yui_shell_last_route_outside(shell_gobj, route)
|
|
3296
|
+
{
|
|
3297
|
+
let priv = shell_gobj && shell_gobj.priv;
|
|
3298
|
+
if(!priv || !is_array(priv.route_mru) || !route) {
|
|
3299
|
+
return "";
|
|
3300
|
+
}
|
|
3301
|
+
for(let i = priv.route_mru.length - 1; i >= 0; i--) {
|
|
3302
|
+
let r = priv.route_mru[i];
|
|
3303
|
+
if(r !== route && r.indexOf(route + "/") !== 0) {
|
|
3304
|
+
return r;
|
|
3305
|
+
}
|
|
3306
|
+
}
|
|
3307
|
+
return "";
|
|
3308
|
+
}
|
|
3309
|
+
|
|
3279
3310
|
/************************************************************
|
|
3280
3311
|
* Resolve the shell that governs `gobj`: the nearest
|
|
3281
3312
|
* C_YUI_SHELL ancestor, else the last shell created on the
|
|
@@ -3716,6 +3747,7 @@ export {
|
|
|
3716
3747
|
yui_shell_zone,
|
|
3717
3748
|
yui_shell_navigate,
|
|
3718
3749
|
yui_shell_last_route_under,
|
|
3750
|
+
yui_shell_last_route_outside,
|
|
3719
3751
|
yui_shell_nav_map,
|
|
3720
3752
|
yui_shell_set_sub_routes,
|
|
3721
3753
|
yui_shell_register_event_handler,
|
package/src/yui_dev.js
CHANGED
|
@@ -419,6 +419,15 @@ function ensure_dev_style()
|
|
|
419
419
|
background: rgba(0,0,0,0.03);
|
|
420
420
|
}
|
|
421
421
|
.YDEV_GROUP { display: inline-flex; align-items: center; gap: 5px; }
|
|
422
|
+
/* A whole line of the bar, whose chips scroll sideways inside it: the
|
|
423
|
+
window never does. min-width 0 so the flex line can be narrower than
|
|
424
|
+
its content; the chips keep their size and their label on one line. */
|
|
425
|
+
.YDEV_GROUP_SCROLL { flex: 1 1 100%; min-width: 0; }
|
|
426
|
+
.YDEV_SCROLL {
|
|
427
|
+
display: flex; align-items: center; gap: 5px; min-width: 0; flex: 1 1 auto;
|
|
428
|
+
overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; padding-bottom: 2px;
|
|
429
|
+
}
|
|
430
|
+
.YDEV_SCROLL > * { flex: 0 0 auto; white-space: nowrap; }
|
|
422
431
|
.YDEV_LABEL {
|
|
423
432
|
font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em;
|
|
424
433
|
opacity: 0.6; align-self: center;
|
|
@@ -1411,10 +1420,62 @@ function refresh_dev_chrome()
|
|
|
1411
1420
|
update_stats();
|
|
1412
1421
|
}
|
|
1413
1422
|
|
|
1423
|
+
/* The payload of a FOLDED entry as text, the way it is on screen: one line
|
|
1424
|
+
* per row, a closed branch as its one-line summary (`data {places: […], …}`)
|
|
1425
|
+
* and only an OPENED branch with its content, four characters further in.
|
|
1426
|
+
*
|
|
1427
|
+
* Read from the painted DOM and not from the payload, because whether a
|
|
1428
|
+
* branch is open lives only there. It is the copy a person wants to paste
|
|
1429
|
+
* somewhere: the folded view exists because a list-map answer is 1.4 MB,
|
|
1430
|
+
* and the copy used to be that 1.4 MB laid out whatever the screen said.
|
|
1431
|
+
* The browser console copies what it shows, and so does this now. */
|
|
1432
|
+
function kw_shown_lines($kw, indent, out)
|
|
1433
|
+
{
|
|
1434
|
+
if(!$kw) {
|
|
1435
|
+
return out;
|
|
1436
|
+
}
|
|
1437
|
+
for(let $n of $kw.children) {
|
|
1438
|
+
if($n.classList.contains('TRAFFIC_ROW')) {
|
|
1439
|
+
let $key = $n.querySelector('.TRAFFIC_KEY');
|
|
1440
|
+
let key = $key ? $key.textContent : '';
|
|
1441
|
+
let vals = [];
|
|
1442
|
+
for(let $c of $n.children) {
|
|
1443
|
+
if($c.classList.contains('TRAFFIC_BULLET') || $c === $key) {
|
|
1444
|
+
continue;
|
|
1445
|
+
}
|
|
1446
|
+
vals.push($c.children.length ?
|
|
1447
|
+
Array.from($c.children).map(($x) => $x.textContent).join(' ') :
|
|
1448
|
+
$c.textContent);
|
|
1449
|
+
}
|
|
1450
|
+
out.push(`${indent}• ${key} ${vals.join(' ')}`.trimEnd());
|
|
1451
|
+
} else if($n.tagName === 'DETAILS') {
|
|
1452
|
+
let $sum = $n.querySelector(':scope > summary');
|
|
1453
|
+
let $key = $sum ? $sum.querySelector('.TRAFFIC_NEST_KEY') : null;
|
|
1454
|
+
let $hint = $sum ? $sum.querySelector('.TRAFFIC_NEST_HINT_WRAP') : null;
|
|
1455
|
+
out.push(`${indent}${$n.open ? '▾' : '▸'} ` +
|
|
1456
|
+
`${$key ? $key.textContent : ''} ${$hint ? $hint.textContent : ''}`.trimEnd());
|
|
1457
|
+
if($n.open) {
|
|
1458
|
+
kw_shown_lines($n.querySelector(':scope > .TRAFFIC_KW'), indent + ' ', out);
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
return out;
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
/* A painted folded entry as the lines of its payload. Exported for its
|
|
1466
|
+
test. */
|
|
1467
|
+
function entry_shown_lines($entry)
|
|
1468
|
+
{
|
|
1469
|
+
let $kw = $entry ? $entry.querySelector(':scope > .TRAFFIC_KW') : null;
|
|
1470
|
+
return kw_shown_lines($kw, ' ', []);
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1414
1473
|
/* Serialize the currently-visible (filtered) traffic to plain text:
|
|
1415
1474
|
* one header line per entry (time · direction · title · event/command)
|
|
1416
|
-
* followed by its
|
|
1417
|
-
*
|
|
1475
|
+
* followed by its payload AS THE VIEW SHOWS IT -- folded, what is on
|
|
1476
|
+
* screen (entry_shown_lines()); laid out, the whole payload. Honours the
|
|
1477
|
+
* active filters and search so the copy matches exactly what is on
|
|
1478
|
+
* screen. */
|
|
1418
1479
|
function traffic_to_text()
|
|
1419
1480
|
{
|
|
1420
1481
|
let ctx = build_filter_ctx();
|
|
@@ -1433,6 +1494,11 @@ function traffic_to_text()
|
|
|
1433
1494
|
`${e.title ? "[" + e.title + "] " : ""}${e.event}` +
|
|
1434
1495
|
`${e.command ? " " + e.command : ""}`;
|
|
1435
1496
|
out.push(head);
|
|
1497
|
+
if(dev_traffic_view() !== "expanded" && e.$node) {
|
|
1498
|
+
out.push(...entry_shown_lines(e.$node));
|
|
1499
|
+
out.push("");
|
|
1500
|
+
continue;
|
|
1501
|
+
}
|
|
1436
1502
|
let payload = e.kw ? e.kw : e.jn;
|
|
1437
1503
|
try {
|
|
1438
1504
|
out.push(JSON.stringify(payload, null, 4));
|
|
@@ -1672,10 +1738,18 @@ function build_control_bar()
|
|
|
1672
1738
|
|
|
1673
1739
|
let grp = (label, items) => ['div', {class: 'YDEV_GROUP'},
|
|
1674
1740
|
[['span', {class: 'YDEV_LABEL', 'data-i18n': label}, t(label)], ...items]];
|
|
1741
|
+
/* A row too long for the window scrolls ON ITS OWN: the label stays,
|
|
1742
|
+
the chips run in a strip with its own horizontal scroll. The TRACES
|
|
1743
|
+
row did not fit and pushed the whole window into scrolling sideways,
|
|
1744
|
+
the log with it. */
|
|
1745
|
+
let grp_scroll = (label, items) => ['div', {class: 'YDEV_GROUP YDEV_GROUP_SCROLL'}, [
|
|
1746
|
+
['span', {class: 'YDEV_LABEL', 'data-i18n': label}, t(label)],
|
|
1747
|
+
['div', {class: 'YDEV_SCROLL'}, items],
|
|
1748
|
+
]];
|
|
1675
1749
|
let sep = () => ['span', {class: 'YDEV_SEP'}, ''];
|
|
1676
1750
|
|
|
1677
1751
|
return createElement2(['div', {class: 'YDEV_BAR'}, [
|
|
1678
|
-
|
|
1752
|
+
grp_scroll('traces', [...trace_chips, simple_mach, traces_payload]),
|
|
1679
1753
|
grp('output', [output_seg]), sep(),
|
|
1680
1754
|
grp('view', [view_seg]), expand_grp, sep(),
|
|
1681
1755
|
grp('show', dir_chips), sep(),
|
|
@@ -1867,4 +1941,6 @@ export {
|
|
|
1867
1941
|
the stylesheet below is a template literal, so one backtick in a CSS
|
|
1868
1942
|
comment stops the whole module from parsing. */
|
|
1869
1943
|
object_preview, object_preview_parts,
|
|
1944
|
+
/* And the copy of the folded view, with the renderer it reads. */
|
|
1945
|
+
entry_shown_lines, render_detailed,
|
|
1870
1946
|
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/***********************************************************************
|
|
2
|
+
* yui_dev_copy.test.js
|
|
3
|
+
*
|
|
4
|
+
* What "copy" of the Developer window puts on the clipboard in
|
|
5
|
+
* the FOLDED view: the payload as it is on screen -- a closed
|
|
6
|
+
* branch as its one-line summary, an opened one with its
|
|
7
|
+
* content -- and not the whole payload laid out, which for a
|
|
8
|
+
* list-map answer was 1.4 MB of text.
|
|
9
|
+
*
|
|
10
|
+
* The summary has no blanks after the commas because the screen
|
|
11
|
+
* has none: createElement2 trims every text node, the preview's
|
|
12
|
+
* ", " tokens included. The copy is what is seen.
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) 2026, ArtGins.
|
|
15
|
+
* All Rights Reserved.
|
|
16
|
+
***********************************************************************/
|
|
17
|
+
import {describe, it, expect, beforeAll} from "vitest";
|
|
18
|
+
import {install_dom_double} from "../test/dom_double.js";
|
|
19
|
+
|
|
20
|
+
let entry_shown_lines;
|
|
21
|
+
let render_detailed;
|
|
22
|
+
|
|
23
|
+
beforeAll(async () => {
|
|
24
|
+
install_dom_double();
|
|
25
|
+
({entry_shown_lines, render_detailed} = await import("./yui_dev.js"));
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
function painted(kw)
|
|
29
|
+
{
|
|
30
|
+
return render_detailed({
|
|
31
|
+
kind: "traffic", dir: "in", event: "EV_MT_COMMAND_ANSWER",
|
|
32
|
+
title: "central_yuno", ts: "09:04:11.914", size: 1473431, kw: kw,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
describe("entry_shown_lines", () => {
|
|
37
|
+
it("copies a closed branch as its one-line summary", () => {
|
|
38
|
+
const $e = painted({
|
|
39
|
+
result: 0,
|
|
40
|
+
comment: "db_history_ce^1620: 524 nodos",
|
|
41
|
+
data: {places: [1, 2, 3], families: [4], devices: [5, 6]},
|
|
42
|
+
});
|
|
43
|
+
expect(entry_shown_lines($e)).toEqual([
|
|
44
|
+
" • result: 0",
|
|
45
|
+
" • comment: db_history_ce^1620: 524 nodos",
|
|
46
|
+
" ▸ data {places:[…],families:[…],devices:[…]}",
|
|
47
|
+
]);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("copies an OPENED branch with its content, four characters in", () => {
|
|
51
|
+
const $e = painted({result: 0, data: {count: 2, rows: [7, 8]}});
|
|
52
|
+
const $details = $e.querySelector("details");
|
|
53
|
+
$details.open = true;
|
|
54
|
+
expect(entry_shown_lines($e)).toEqual([
|
|
55
|
+
" • result: 0",
|
|
56
|
+
" ▾ data {count:2,rows:[…]}",
|
|
57
|
+
" • count: 2",
|
|
58
|
+
" ▸ rows [2]",
|
|
59
|
+
]);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* yui_shell_last_route_under() / yui_shell_last_route_outside():
|
|
3
|
+
* the two questions asked of the shell's memory of visited routes.
|
|
4
|
+
* They read only `priv.route_mru`, so a bare object stands in for
|
|
5
|
+
* the shell.
|
|
6
|
+
*/
|
|
7
|
+
import {describe, it, expect} from "vitest";
|
|
8
|
+
import {
|
|
9
|
+
yui_shell_last_route_under,
|
|
10
|
+
yui_shell_last_route_outside,
|
|
11
|
+
} from "./c_yui_shell.js";
|
|
12
|
+
|
|
13
|
+
function shell(mru)
|
|
14
|
+
{
|
|
15
|
+
return {priv: {route_mru: mru}};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
describe("yui_shell_last_route_outside", () => {
|
|
19
|
+
it("answers the view the reader came from", () => {
|
|
20
|
+
const s = shell(["/devices/list", "/devices/map/table", "/devices/detail/E1"]);
|
|
21
|
+
expect(yui_shell_last_route_outside(s, "/devices/detail")).toBe("/devices/map/table");
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("skips every record of the same view, not only the current one", () => {
|
|
25
|
+
const s = shell(["/alarms", "/devices/detail/E1", "/devices/detail/E2"]);
|
|
26
|
+
expect(yui_shell_last_route_outside(s, "/devices/detail")).toBe("/alarms");
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("answers the bare route of a view too", () => {
|
|
30
|
+
const s = shell(["/devices/map", "/devices/detail"]);
|
|
31
|
+
expect(yui_shell_last_route_outside(s, "/devices/detail")).toBe("/devices/map");
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("does not take a sibling that only shares a prefix for a child", () => {
|
|
35
|
+
const s = shell(["/devices/detailed", "/devices/detail/E1"]);
|
|
36
|
+
expect(yui_shell_last_route_outside(s, "/devices/detail")).toBe("/devices/detailed");
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("answers empty when the page never left the view", () => {
|
|
40
|
+
expect(yui_shell_last_route_outside(shell(["/devices/detail/E1"]), "/devices/detail")).toBe("");
|
|
41
|
+
expect(yui_shell_last_route_outside(shell([]), "/devices/detail")).toBe("");
|
|
42
|
+
expect(yui_shell_last_route_outside(null, "/devices/detail")).toBe("");
|
|
43
|
+
expect(yui_shell_last_route_outside(shell(["/x"]), "")).toBe("");
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
describe("yui_shell_last_route_under", () => {
|
|
48
|
+
it("answers the deepest recent position under a route, or the route", () => {
|
|
49
|
+
const s = shell(["/graph/users", "/alarms"]);
|
|
50
|
+
expect(yui_shell_last_route_under(s, "/graph")).toBe("/graph/users");
|
|
51
|
+
expect(yui_shell_last_route_under(s, "/cards")).toBe("/cards");
|
|
52
|
+
});
|
|
53
|
+
});
|