@yuneta/gobj-ui 7.23.175 → 7.23.176
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 +74 -106
- package/dist/gobj-ui.es.js +74 -106
- package/package.json +1 -1
- package/src/yui_dev.js +134 -125
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -76272,21 +76272,6 @@ function traffic_iso(value) {
|
|
|
76272
76272
|
return null;
|
|
76273
76273
|
}
|
|
76274
76274
|
}
|
|
76275
|
-
/************************************************************
|
|
76276
|
-
* Clip a string for inline display (full text kept elsewhere).
|
|
76277
|
-
************************************************************/
|
|
76278
|
-
function traffic_clip(s, n) {
|
|
76279
|
-
s = String(s);
|
|
76280
|
-
return s.length > n ? s.slice(0, n) + "…" : s;
|
|
76281
|
-
}
|
|
76282
|
-
/************************************************************
|
|
76283
|
-
* A scalar rendered as a short inline token (for summaries).
|
|
76284
|
-
************************************************************/
|
|
76285
|
-
function traffic_scalar_text(v) {
|
|
76286
|
-
if (v === null) return "null";
|
|
76287
|
-
if (typeof v === "string") return traffic_clip(v, 40);
|
|
76288
|
-
return String(v);
|
|
76289
|
-
}
|
|
76290
76275
|
function dir_class(dir) {
|
|
76291
76276
|
return dir === 2 ? "dir-in" : dir === 3 ? "dir-err" : "dir-out";
|
|
76292
76277
|
}
|
|
@@ -76299,9 +76284,11 @@ function dir_arrow(dir) {
|
|
|
76299
76284
|
function dev_num(key, def) {
|
|
76300
76285
|
return Number((0, _yuneta_gobj_js.kw_get_local_storage_value)(key, def === void 0 ? 0 : def, false));
|
|
76301
76286
|
}
|
|
76302
|
-
function
|
|
76303
|
-
|
|
76304
|
-
|
|
76287
|
+
function dev_traffic_view() {
|
|
76288
|
+
return (0, _yuneta_gobj_js.kw_get_local_storage_value)("dev_traffic_view", "collapsed", false) === "expanded" ? "expanded" : "collapsed";
|
|
76289
|
+
}
|
|
76290
|
+
function dev_traces_payload() {
|
|
76291
|
+
return dev_num("dev_traces_payload", 1) ? 1 : 0;
|
|
76305
76292
|
}
|
|
76306
76293
|
var SIMPLE_MACH_DEFAULT = 1;
|
|
76307
76294
|
var SIMPLE_MACH_KEY = "dev_mach_simple";
|
|
@@ -76319,10 +76306,21 @@ function console_traffic(title, jn, direction, size) {
|
|
|
76319
76306
|
let event = jn && jn.event ? String(jn.event) : "(no event)";
|
|
76320
76307
|
let kw = jn && jn.kw && typeof jn.kw === "object" ? jn.kw : jn;
|
|
76321
76308
|
let color = direction === 2 ? "#16a34a" : direction === 3 ? "#dc2626" : "#2563eb";
|
|
76322
|
-
|
|
76309
|
+
let head = "%c" + dir_arrow(direction) + " " + (title ? "[" + title + "] " : "") + event + (size ? " (" + size + "b)" : "");
|
|
76310
|
+
if (dev_traffic_view() === "expanded") {
|
|
76311
|
+
let text;
|
|
76312
|
+
try {
|
|
76313
|
+
text = JSON.stringify(full_sections(kw), null, 4);
|
|
76314
|
+
} catch (err) {
|
|
76315
|
+
text = String(kw);
|
|
76316
|
+
}
|
|
76317
|
+
window.console.log(head, "color:" + color, "\n" + text);
|
|
76318
|
+
return;
|
|
76319
|
+
}
|
|
76320
|
+
window.console.log(head, "color:" + color, kw);
|
|
76323
76321
|
}
|
|
76324
|
-
function
|
|
76325
|
-
(0, _yuneta_gobj_js.kw_set_local_storage_value)("
|
|
76322
|
+
function set_traffic_view(v) {
|
|
76323
|
+
(0, _yuneta_gobj_js.kw_set_local_storage_value)("dev_traffic_view", v === "expanded" ? "expanded" : "collapsed");
|
|
76326
76324
|
rerender_all();
|
|
76327
76325
|
refresh_dev_chrome();
|
|
76328
76326
|
}
|
|
@@ -76348,12 +76346,12 @@ function build_filter_ctx() {
|
|
|
76348
76346
|
inc: dev_num("dev_filter_in", 1),
|
|
76349
76347
|
err: dev_num("dev_filter_err", 1),
|
|
76350
76348
|
search: SEARCH_TEXT,
|
|
76351
|
-
|
|
76349
|
+
payload: dev_traces_payload()
|
|
76352
76350
|
};
|
|
76353
76351
|
}
|
|
76354
76352
|
function entry_hidden(e, ctx) {
|
|
76355
76353
|
if (e.kind === "log") {
|
|
76356
|
-
if (e.level === "json" &&
|
|
76354
|
+
if (e.level === "json" && !ctx.payload) return true;
|
|
76357
76355
|
return !!(ctx.search && e.hay.indexOf(ctx.search) < 0);
|
|
76358
76356
|
}
|
|
76359
76357
|
if (e.dir === 1 && !ctx.out) return true;
|
|
@@ -76433,17 +76431,15 @@ function ensure_dev_style() {
|
|
|
76433
76431
|
.YDEV_TITLE_MAIN { font-weight: 700; }
|
|
76434
76432
|
.YDEV_TITLE_SUB { opacity: 0.7; font-size: 12px; }
|
|
76435
76433
|
/* -------- entries (shared) -------- */
|
|
76436
|
-
.TRAFFIC_ENTRY
|
|
76434
|
+
.TRAFFIC_ENTRY {
|
|
76437
76435
|
border-left: 3px solid #94a3b8; border-radius: 3px;
|
|
76438
76436
|
font-family: "DejaVu Sans Mono", monospace, consolas, monaco; font-size: 13px;
|
|
76439
76437
|
background: rgba(0,0,0,0.02);
|
|
76440
76438
|
}
|
|
76441
76439
|
.TRAFFIC_ENTRY { margin: 6px 0; padding: 4px 8px; line-height: 1.55; }
|
|
76442
|
-
.
|
|
76443
|
-
.
|
|
76444
|
-
.TRAFFIC_ENTRY.dir-
|
|
76445
|
-
.TRAFFIC_ENTRY.dir-in, .TRAFFIC_LINE.dir-in, .TRAFFIC_NAME.dir-in { border-left-color: #059669; }
|
|
76446
|
-
.TRAFFIC_ENTRY.dir-err, .TRAFFIC_LINE.dir-err, .TRAFFIC_NAME.dir-err { border-left-color: #dc2626; }
|
|
76440
|
+
.TRAFFIC_ENTRY.dir-out { border-left-color: #2563eb; }
|
|
76441
|
+
.TRAFFIC_ENTRY.dir-in { border-left-color: #059669; }
|
|
76442
|
+
.TRAFFIC_ENTRY.dir-err { border-left-color: #dc2626; }
|
|
76447
76443
|
.TRAFFIC_HEADER { display: flex; align-items: baseline; gap: 8px; }
|
|
76448
76444
|
.TRAFFIC_ARROW { font-weight: 700; }
|
|
76449
76445
|
.TRAFFIC_EVENT { font-weight: 700; }
|
|
@@ -76451,7 +76447,6 @@ function ensure_dev_style() {
|
|
|
76451
76447
|
.dir-out .TRAFFIC_ARROW, .dir-out .TRAFFIC_EVENT { color: #2563eb; }
|
|
76452
76448
|
.dir-in .TRAFFIC_ARROW, .dir-in .TRAFFIC_EVENT { color: #059669; }
|
|
76453
76449
|
.dir-err .TRAFFIC_ARROW, .dir-err .TRAFFIC_EVENT { color: #dc2626; }
|
|
76454
|
-
.TRAFFIC_SUMMARY { opacity: 0.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; min-width: 0; }
|
|
76455
76450
|
.TRAFFIC_META { margin-left: auto; opacity: 0.6; font-size: 11px; white-space: nowrap; }
|
|
76456
76451
|
.TRAFFIC_ENTRY:hover .TRAFFIC_KW { margin: 2px 0 0 16px; }
|
|
76457
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; }
|
|
@@ -76484,10 +76479,10 @@ details.TRAFFIC_NEST > summary::-webkit-details-marker { display: none; }
|
|
|
76484
76479
|
:root[data-theme="dark"] .YDEV_BAR, :root[data-theme="dark"] .YDEV_STATS { background: rgba(255,255,255,0.04); }
|
|
76485
76480
|
:root[data-theme="dark"] .YDEV_SEP { background: rgba(255,255,255,0.14); }
|
|
76486
76481
|
:root[data-theme="dark"] .YDEV_CHIP, :root[data-theme="dark"] .YDEV_SEG, :root[data-theme="dark"] .YDEV_SEARCH { border-color: rgba(255,255,255,0.2); }
|
|
76487
|
-
:root[data-theme="dark"] .TRAFFIC_ENTRY
|
|
76488
|
-
:root[data-theme="dark"] .TRAFFIC_ENTRY.dir-out
|
|
76489
|
-
:root[data-theme="dark"] .TRAFFIC_ENTRY.dir-in
|
|
76490
|
-
:root[data-theme="dark"] .TRAFFIC_ENTRY.dir-err
|
|
76482
|
+
:root[data-theme="dark"] .TRAFFIC_ENTRY { background: rgba(255,255,255,0.03); }
|
|
76483
|
+
:root[data-theme="dark"] .TRAFFIC_ENTRY.dir-out { border-left-color: #60a5fa; }
|
|
76484
|
+
:root[data-theme="dark"] .TRAFFIC_ENTRY.dir-in { border-left-color: #34d399; }
|
|
76485
|
+
:root[data-theme="dark"] .TRAFFIC_ENTRY.dir-err { border-left-color: #f87171; }
|
|
76491
76486
|
:root[data-theme="dark"] .dir-out .TRAFFIC_ARROW, :root[data-theme="dark"] .dir-out .TRAFFIC_EVENT { color: #60a5fa; }
|
|
76492
76487
|
:root[data-theme="dark"] .dir-in .TRAFFIC_ARROW, :root[data-theme="dark"] .dir-in .TRAFFIC_EVENT { color: #34d399; }
|
|
76493
76488
|
:root[data-theme="dark"] .dir-err .TRAFFIC_ARROW, :root[data-theme="dark"] .dir-err .TRAFFIC_EVENT { color: #f87171; }
|
|
@@ -76657,24 +76652,6 @@ function event_spans(e) {
|
|
|
76657
76652
|
]);
|
|
76658
76653
|
return spans;
|
|
76659
76654
|
}
|
|
76660
|
-
function compact_summary(kw) {
|
|
76661
|
-
if (!kw) return "";
|
|
76662
|
-
let parts = [];
|
|
76663
|
-
if ("result" in kw) parts.push("result=" + traffic_scalar_text(kw.result));
|
|
76664
|
-
if (typeof kw.comment === "string" && kw.comment) parts.push(traffic_clip(kw.comment, 80));
|
|
76665
|
-
if (!parts.length) {
|
|
76666
|
-
let n = 0;
|
|
76667
|
-
for (let k of Object.keys(kw)) {
|
|
76668
|
-
if (k === "command") continue;
|
|
76669
|
-
let v = kw[k];
|
|
76670
|
-
if (v === null || typeof v !== "object") {
|
|
76671
|
-
parts.push(k + "=" + traffic_scalar_text(v));
|
|
76672
|
-
if (++n >= 3) break;
|
|
76673
|
-
}
|
|
76674
|
-
}
|
|
76675
|
-
}
|
|
76676
|
-
return traffic_clip(parts.join(" · "), 140);
|
|
76677
|
-
}
|
|
76678
76655
|
function render_detailed(e) {
|
|
76679
76656
|
let head = event_spans(e);
|
|
76680
76657
|
head.push([
|
|
@@ -76765,43 +76742,6 @@ function render_full(e) {
|
|
|
76765
76742
|
children
|
|
76766
76743
|
]);
|
|
76767
76744
|
}
|
|
76768
|
-
function render_compact(e) {
|
|
76769
|
-
let kids = event_spans(e);
|
|
76770
|
-
kids.push([
|
|
76771
|
-
"span",
|
|
76772
|
-
{ class: "TRAFFIC_SUMMARY" },
|
|
76773
|
-
compact_summary(e.kw)
|
|
76774
|
-
]);
|
|
76775
|
-
kids.push([
|
|
76776
|
-
"span",
|
|
76777
|
-
{ class: "TRAFFIC_META" },
|
|
76778
|
-
`${traffic_size(e.size)} · ${e.ts}`
|
|
76779
|
-
]);
|
|
76780
|
-
return (0, _yuneta_gobj_js.createElement2)([
|
|
76781
|
-
"div",
|
|
76782
|
-
{
|
|
76783
|
-
class: "TRAFFIC_LINE " + dir_class(e.dir),
|
|
76784
|
-
title: e.title
|
|
76785
|
-
},
|
|
76786
|
-
kids
|
|
76787
|
-
]);
|
|
76788
|
-
}
|
|
76789
|
-
function render_name(e) {
|
|
76790
|
-
let kids = event_spans(e);
|
|
76791
|
-
kids.push([
|
|
76792
|
-
"span",
|
|
76793
|
-
{ class: "TRAFFIC_META" },
|
|
76794
|
-
e.ts
|
|
76795
|
-
]);
|
|
76796
|
-
return (0, _yuneta_gobj_js.createElement2)([
|
|
76797
|
-
"div",
|
|
76798
|
-
{
|
|
76799
|
-
class: "TRAFFIC_NAME " + dir_class(e.dir),
|
|
76800
|
-
title: e.title
|
|
76801
|
-
},
|
|
76802
|
-
kids
|
|
76803
|
-
]);
|
|
76804
|
-
}
|
|
76805
76745
|
function render_log(e) {
|
|
76806
76746
|
let $row = (0, _yuneta_gobj_js.createElement2)([
|
|
76807
76747
|
"div",
|
|
@@ -76833,10 +76773,7 @@ function render_log(e) {
|
|
|
76833
76773
|
}
|
|
76834
76774
|
function render_entry(e) {
|
|
76835
76775
|
if (e.kind === "log") return render_log(e);
|
|
76836
|
-
|
|
76837
|
-
if (view === "full") return render_full(e);
|
|
76838
|
-
if (view === "compact") return render_compact(e);
|
|
76839
|
-
if (view === "name") return render_name(e);
|
|
76776
|
+
if (dev_traffic_view() === "expanded") return render_full(e);
|
|
76840
76777
|
return render_detailed(e);
|
|
76841
76778
|
}
|
|
76842
76779
|
/******************************
|
|
@@ -76959,7 +76896,6 @@ function info_traffic(title, msg, direction, size) {
|
|
|
76959
76896
|
return;
|
|
76960
76897
|
}
|
|
76961
76898
|
let route = dev_route();
|
|
76962
|
-
if (route !== "window") console_traffic(title, jn, direction, size);
|
|
76963
76899
|
let event = jn && jn.event ? String(jn.event) : "(no event)";
|
|
76964
76900
|
let kw = jn && jn.kw && typeof jn.kw === "object" ? jn.kw : null;
|
|
76965
76901
|
let command = kw && typeof kw.command === "string" ? kw.command : "";
|
|
@@ -76982,10 +76918,12 @@ function info_traffic(title, msg, direction, size) {
|
|
|
76982
76918
|
$node: null
|
|
76983
76919
|
};
|
|
76984
76920
|
push_entry(entry);
|
|
76921
|
+
let hidden = entry_hidden(entry, build_filter_ctx());
|
|
76922
|
+
if (route !== "window" && !hidden) console_traffic(title, jn, direction, size);
|
|
76985
76923
|
let logger = document.getElementById("developer-traffic-logger");
|
|
76986
76924
|
if (!logger || route === "console") return;
|
|
76987
76925
|
ensure_dev_style();
|
|
76988
|
-
if (!
|
|
76926
|
+
if (!hidden) {
|
|
76989
76927
|
let node = render_entry(entry);
|
|
76990
76928
|
entry.$node = node;
|
|
76991
76929
|
let ph = logger.querySelector(".YDEV_EMPTY");
|
|
@@ -77148,7 +77086,7 @@ function refresh_dev_chrome() {
|
|
|
77148
77086
|
$b.textContent = key === "automata" && v > 0 ? label + " " + v : label;
|
|
77149
77087
|
$b.classList.toggle("is-active", v > 0);
|
|
77150
77088
|
});
|
|
77151
|
-
let view =
|
|
77089
|
+
let view = dev_traffic_view();
|
|
77152
77090
|
document.querySelectorAll(".YDEV_SEG_BTN[data-view]").forEach(($b) => {
|
|
77153
77091
|
$b.classList.toggle("is-active", $b.getAttribute("data-view") === view);
|
|
77154
77092
|
});
|
|
@@ -77157,7 +77095,7 @@ function refresh_dev_chrome() {
|
|
|
77157
77095
|
$b.classList.toggle("is-active", $b.getAttribute("data-output") === route);
|
|
77158
77096
|
});
|
|
77159
77097
|
let $eg = document.getElementById("ydev-expand-grp");
|
|
77160
|
-
if ($eg) $eg.style.display = view === "
|
|
77098
|
+
if ($eg) $eg.style.display = view === "expanded" ? "" : "none";
|
|
77161
77099
|
document.querySelectorAll(".YDEV_CHIP[data-expand]").forEach(($b) => {
|
|
77162
77100
|
$b.classList.toggle("is-active", full_show($b.getAttribute("data-expand")));
|
|
77163
77101
|
});
|
|
@@ -77167,6 +77105,9 @@ function refresh_dev_chrome() {
|
|
|
77167
77105
|
document.querySelectorAll(".YDEV_CHIP[data-toggle=\"automata-simple\"]").forEach(($b) => {
|
|
77168
77106
|
$b.classList.toggle("is-active", !!dev_simple_mach());
|
|
77169
77107
|
});
|
|
77108
|
+
document.querySelectorAll(".YDEV_CHIP[data-toggle=\"traces-payload\"]").forEach(($b) => {
|
|
77109
|
+
$b.classList.toggle("is-active", !!dev_traces_payload());
|
|
77110
|
+
});
|
|
77170
77111
|
update_stats();
|
|
77171
77112
|
}
|
|
77172
77113
|
function traffic_to_text() {
|
|
@@ -77249,18 +77190,46 @@ function build_control_bar() {
|
|
|
77249
77190
|
refresh_dev_chrome();
|
|
77250
77191
|
} }
|
|
77251
77192
|
];
|
|
77193
|
+
let traces_payload = [
|
|
77194
|
+
"button",
|
|
77195
|
+
{
|
|
77196
|
+
class: "YDEV_CHIP",
|
|
77197
|
+
"data-toggle": "traces-payload",
|
|
77198
|
+
type: "button",
|
|
77199
|
+
title: (0, i18next.t)("show the payload of the traces"),
|
|
77200
|
+
"data-i18n-title": "show the payload of the traces",
|
|
77201
|
+
"data-i18n": "payload",
|
|
77202
|
+
"aria-label": (0, i18next.t)("payload"),
|
|
77203
|
+
"data-i18n-aria-label": "payload"
|
|
77204
|
+
},
|
|
77205
|
+
(0, i18next.t)("payload"),
|
|
77206
|
+
{ click: (ev) => {
|
|
77207
|
+
ev.stopPropagation();
|
|
77208
|
+
(0, _yuneta_gobj_js.kw_set_local_storage_value)("dev_traces_payload", dev_traces_payload() ? 0 : 1);
|
|
77209
|
+
rerender_all();
|
|
77210
|
+
refresh_dev_chrome();
|
|
77211
|
+
} }
|
|
77212
|
+
];
|
|
77213
|
+
let VIEW_TITLES = {
|
|
77214
|
+
collapsed: "traffic payload folded",
|
|
77215
|
+
expanded: "traffic payload laid out"
|
|
77216
|
+
};
|
|
77252
77217
|
let mk_view = (v, label) => [
|
|
77253
77218
|
"button",
|
|
77254
77219
|
{
|
|
77255
77220
|
class: "YDEV_SEG_BTN",
|
|
77256
77221
|
"data-view": v,
|
|
77222
|
+
type: "button",
|
|
77223
|
+
title: (0, i18next.t)(VIEW_TITLES[v]),
|
|
77224
|
+
"data-i18n-title": VIEW_TITLES[v],
|
|
77257
77225
|
"data-i18n": label,
|
|
77258
|
-
|
|
77226
|
+
"aria-label": (0, i18next.t)(label),
|
|
77227
|
+
"data-i18n-aria-label": label
|
|
77259
77228
|
},
|
|
77260
77229
|
(0, i18next.t)(label),
|
|
77261
77230
|
{ click: (ev) => {
|
|
77262
77231
|
ev.stopPropagation();
|
|
77263
|
-
|
|
77232
|
+
set_traffic_view(v);
|
|
77264
77233
|
} }
|
|
77265
77234
|
];
|
|
77266
77235
|
let view_seg = [
|
|
@@ -77269,12 +77238,7 @@ function build_control_bar() {
|
|
|
77269
77238
|
class: "YDEV_SEG",
|
|
77270
77239
|
id: "ydev-seg"
|
|
77271
77240
|
},
|
|
77272
|
-
[
|
|
77273
|
-
mk_view("detailed", "detailed"),
|
|
77274
|
-
mk_view("full", "expanded"),
|
|
77275
|
-
mk_view("compact", "compact"),
|
|
77276
|
-
mk_view("name", "name only")
|
|
77277
|
-
]
|
|
77241
|
+
[mk_view("collapsed", "collapsed"), mk_view("expanded", "expanded")]
|
|
77278
77242
|
];
|
|
77279
77243
|
let OUT_TITLES = {
|
|
77280
77244
|
window: "dev window only",
|
|
@@ -77465,7 +77429,11 @@ function build_control_bar() {
|
|
|
77465
77429
|
"div",
|
|
77466
77430
|
{ class: "YDEV_BAR" },
|
|
77467
77431
|
[
|
|
77468
|
-
grp("traces", [
|
|
77432
|
+
grp("traces", [
|
|
77433
|
+
...trace_chips,
|
|
77434
|
+
simple_mach,
|
|
77435
|
+
traces_payload
|
|
77436
|
+
]),
|
|
77469
77437
|
sep(),
|
|
77470
77438
|
grp("output", [output_seg]),
|
|
77471
77439
|
sep(),
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -76267,21 +76267,6 @@ function traffic_iso(value) {
|
|
|
76267
76267
|
return null;
|
|
76268
76268
|
}
|
|
76269
76269
|
}
|
|
76270
|
-
/************************************************************
|
|
76271
|
-
* Clip a string for inline display (full text kept elsewhere).
|
|
76272
|
-
************************************************************/
|
|
76273
|
-
function traffic_clip(s, n) {
|
|
76274
|
-
s = String(s);
|
|
76275
|
-
return s.length > n ? s.slice(0, n) + "…" : s;
|
|
76276
|
-
}
|
|
76277
|
-
/************************************************************
|
|
76278
|
-
* A scalar rendered as a short inline token (for summaries).
|
|
76279
|
-
************************************************************/
|
|
76280
|
-
function traffic_scalar_text(v) {
|
|
76281
|
-
if (v === null) return "null";
|
|
76282
|
-
if (typeof v === "string") return traffic_clip(v, 40);
|
|
76283
|
-
return String(v);
|
|
76284
|
-
}
|
|
76285
76270
|
function dir_class(dir) {
|
|
76286
76271
|
return dir === 2 ? "dir-in" : dir === 3 ? "dir-err" : "dir-out";
|
|
76287
76272
|
}
|
|
@@ -76294,9 +76279,11 @@ function dir_arrow(dir) {
|
|
|
76294
76279
|
function dev_num(key, def) {
|
|
76295
76280
|
return Number(kw_get_local_storage_value(key, def === void 0 ? 0 : def, false));
|
|
76296
76281
|
}
|
|
76297
|
-
function
|
|
76298
|
-
|
|
76299
|
-
|
|
76282
|
+
function dev_traffic_view() {
|
|
76283
|
+
return kw_get_local_storage_value("dev_traffic_view", "collapsed", false) === "expanded" ? "expanded" : "collapsed";
|
|
76284
|
+
}
|
|
76285
|
+
function dev_traces_payload() {
|
|
76286
|
+
return dev_num("dev_traces_payload", 1) ? 1 : 0;
|
|
76300
76287
|
}
|
|
76301
76288
|
var SIMPLE_MACH_DEFAULT = 1;
|
|
76302
76289
|
var SIMPLE_MACH_KEY = "dev_mach_simple";
|
|
@@ -76314,10 +76301,21 @@ function console_traffic(title, jn, direction, size) {
|
|
|
76314
76301
|
let event = jn && jn.event ? String(jn.event) : "(no event)";
|
|
76315
76302
|
let kw = jn && jn.kw && typeof jn.kw === "object" ? jn.kw : jn;
|
|
76316
76303
|
let color = direction === 2 ? "#16a34a" : direction === 3 ? "#dc2626" : "#2563eb";
|
|
76317
|
-
|
|
76304
|
+
let head = "%c" + dir_arrow(direction) + " " + (title ? "[" + title + "] " : "") + event + (size ? " (" + size + "b)" : "");
|
|
76305
|
+
if (dev_traffic_view() === "expanded") {
|
|
76306
|
+
let text;
|
|
76307
|
+
try {
|
|
76308
|
+
text = JSON.stringify(full_sections(kw), null, 4);
|
|
76309
|
+
} catch (err) {
|
|
76310
|
+
text = String(kw);
|
|
76311
|
+
}
|
|
76312
|
+
window.console.log(head, "color:" + color, "\n" + text);
|
|
76313
|
+
return;
|
|
76314
|
+
}
|
|
76315
|
+
window.console.log(head, "color:" + color, kw);
|
|
76318
76316
|
}
|
|
76319
|
-
function
|
|
76320
|
-
kw_set_local_storage_value("
|
|
76317
|
+
function set_traffic_view(v) {
|
|
76318
|
+
kw_set_local_storage_value("dev_traffic_view", v === "expanded" ? "expanded" : "collapsed");
|
|
76321
76319
|
rerender_all();
|
|
76322
76320
|
refresh_dev_chrome();
|
|
76323
76321
|
}
|
|
@@ -76343,12 +76341,12 @@ function build_filter_ctx() {
|
|
|
76343
76341
|
inc: dev_num("dev_filter_in", 1),
|
|
76344
76342
|
err: dev_num("dev_filter_err", 1),
|
|
76345
76343
|
search: SEARCH_TEXT,
|
|
76346
|
-
|
|
76344
|
+
payload: dev_traces_payload()
|
|
76347
76345
|
};
|
|
76348
76346
|
}
|
|
76349
76347
|
function entry_hidden(e, ctx) {
|
|
76350
76348
|
if (e.kind === "log") {
|
|
76351
|
-
if (e.level === "json" &&
|
|
76349
|
+
if (e.level === "json" && !ctx.payload) return true;
|
|
76352
76350
|
return !!(ctx.search && e.hay.indexOf(ctx.search) < 0);
|
|
76353
76351
|
}
|
|
76354
76352
|
if (e.dir === 1 && !ctx.out) return true;
|
|
@@ -76428,17 +76426,15 @@ function ensure_dev_style() {
|
|
|
76428
76426
|
.YDEV_TITLE_MAIN { font-weight: 700; }
|
|
76429
76427
|
.YDEV_TITLE_SUB { opacity: 0.7; font-size: 12px; }
|
|
76430
76428
|
/* -------- entries (shared) -------- */
|
|
76431
|
-
.TRAFFIC_ENTRY
|
|
76429
|
+
.TRAFFIC_ENTRY {
|
|
76432
76430
|
border-left: 3px solid #94a3b8; border-radius: 3px;
|
|
76433
76431
|
font-family: "DejaVu Sans Mono", monospace, consolas, monaco; font-size: 13px;
|
|
76434
76432
|
background: rgba(0,0,0,0.02);
|
|
76435
76433
|
}
|
|
76436
76434
|
.TRAFFIC_ENTRY { margin: 6px 0; padding: 4px 8px; line-height: 1.55; }
|
|
76437
|
-
.
|
|
76438
|
-
.
|
|
76439
|
-
.TRAFFIC_ENTRY.dir-
|
|
76440
|
-
.TRAFFIC_ENTRY.dir-in, .TRAFFIC_LINE.dir-in, .TRAFFIC_NAME.dir-in { border-left-color: #059669; }
|
|
76441
|
-
.TRAFFIC_ENTRY.dir-err, .TRAFFIC_LINE.dir-err, .TRAFFIC_NAME.dir-err { border-left-color: #dc2626; }
|
|
76435
|
+
.TRAFFIC_ENTRY.dir-out { border-left-color: #2563eb; }
|
|
76436
|
+
.TRAFFIC_ENTRY.dir-in { border-left-color: #059669; }
|
|
76437
|
+
.TRAFFIC_ENTRY.dir-err { border-left-color: #dc2626; }
|
|
76442
76438
|
.TRAFFIC_HEADER { display: flex; align-items: baseline; gap: 8px; }
|
|
76443
76439
|
.TRAFFIC_ARROW { font-weight: 700; }
|
|
76444
76440
|
.TRAFFIC_EVENT { font-weight: 700; }
|
|
@@ -76446,7 +76442,6 @@ function ensure_dev_style() {
|
|
|
76446
76442
|
.dir-out .TRAFFIC_ARROW, .dir-out .TRAFFIC_EVENT { color: #2563eb; }
|
|
76447
76443
|
.dir-in .TRAFFIC_ARROW, .dir-in .TRAFFIC_EVENT { color: #059669; }
|
|
76448
76444
|
.dir-err .TRAFFIC_ARROW, .dir-err .TRAFFIC_EVENT { color: #dc2626; }
|
|
76449
|
-
.TRAFFIC_SUMMARY { opacity: 0.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; min-width: 0; }
|
|
76450
76445
|
.TRAFFIC_META { margin-left: auto; opacity: 0.6; font-size: 11px; white-space: nowrap; }
|
|
76451
76446
|
.TRAFFIC_ENTRY:hover .TRAFFIC_KW { margin: 2px 0 0 16px; }
|
|
76452
76447
|
.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; }
|
|
@@ -76479,10 +76474,10 @@ details.TRAFFIC_NEST > summary::-webkit-details-marker { display: none; }
|
|
|
76479
76474
|
:root[data-theme="dark"] .YDEV_BAR, :root[data-theme="dark"] .YDEV_STATS { background: rgba(255,255,255,0.04); }
|
|
76480
76475
|
:root[data-theme="dark"] .YDEV_SEP { background: rgba(255,255,255,0.14); }
|
|
76481
76476
|
:root[data-theme="dark"] .YDEV_CHIP, :root[data-theme="dark"] .YDEV_SEG, :root[data-theme="dark"] .YDEV_SEARCH { border-color: rgba(255,255,255,0.2); }
|
|
76482
|
-
:root[data-theme="dark"] .TRAFFIC_ENTRY
|
|
76483
|
-
:root[data-theme="dark"] .TRAFFIC_ENTRY.dir-out
|
|
76484
|
-
:root[data-theme="dark"] .TRAFFIC_ENTRY.dir-in
|
|
76485
|
-
:root[data-theme="dark"] .TRAFFIC_ENTRY.dir-err
|
|
76477
|
+
:root[data-theme="dark"] .TRAFFIC_ENTRY { background: rgba(255,255,255,0.03); }
|
|
76478
|
+
:root[data-theme="dark"] .TRAFFIC_ENTRY.dir-out { border-left-color: #60a5fa; }
|
|
76479
|
+
:root[data-theme="dark"] .TRAFFIC_ENTRY.dir-in { border-left-color: #34d399; }
|
|
76480
|
+
:root[data-theme="dark"] .TRAFFIC_ENTRY.dir-err { border-left-color: #f87171; }
|
|
76486
76481
|
:root[data-theme="dark"] .dir-out .TRAFFIC_ARROW, :root[data-theme="dark"] .dir-out .TRAFFIC_EVENT { color: #60a5fa; }
|
|
76487
76482
|
:root[data-theme="dark"] .dir-in .TRAFFIC_ARROW, :root[data-theme="dark"] .dir-in .TRAFFIC_EVENT { color: #34d399; }
|
|
76488
76483
|
:root[data-theme="dark"] .dir-err .TRAFFIC_ARROW, :root[data-theme="dark"] .dir-err .TRAFFIC_EVENT { color: #f87171; }
|
|
@@ -76652,24 +76647,6 @@ function event_spans(e) {
|
|
|
76652
76647
|
]);
|
|
76653
76648
|
return spans;
|
|
76654
76649
|
}
|
|
76655
|
-
function compact_summary(kw) {
|
|
76656
|
-
if (!kw) return "";
|
|
76657
|
-
let parts = [];
|
|
76658
|
-
if ("result" in kw) parts.push("result=" + traffic_scalar_text(kw.result));
|
|
76659
|
-
if (typeof kw.comment === "string" && kw.comment) parts.push(traffic_clip(kw.comment, 80));
|
|
76660
|
-
if (!parts.length) {
|
|
76661
|
-
let n = 0;
|
|
76662
|
-
for (let k of Object.keys(kw)) {
|
|
76663
|
-
if (k === "command") continue;
|
|
76664
|
-
let v = kw[k];
|
|
76665
|
-
if (v === null || typeof v !== "object") {
|
|
76666
|
-
parts.push(k + "=" + traffic_scalar_text(v));
|
|
76667
|
-
if (++n >= 3) break;
|
|
76668
|
-
}
|
|
76669
|
-
}
|
|
76670
|
-
}
|
|
76671
|
-
return traffic_clip(parts.join(" · "), 140);
|
|
76672
|
-
}
|
|
76673
76650
|
function render_detailed(e) {
|
|
76674
76651
|
let head = event_spans(e);
|
|
76675
76652
|
head.push([
|
|
@@ -76760,43 +76737,6 @@ function render_full(e) {
|
|
|
76760
76737
|
children
|
|
76761
76738
|
]);
|
|
76762
76739
|
}
|
|
76763
|
-
function render_compact(e) {
|
|
76764
|
-
let kids = event_spans(e);
|
|
76765
|
-
kids.push([
|
|
76766
|
-
"span",
|
|
76767
|
-
{ class: "TRAFFIC_SUMMARY" },
|
|
76768
|
-
compact_summary(e.kw)
|
|
76769
|
-
]);
|
|
76770
|
-
kids.push([
|
|
76771
|
-
"span",
|
|
76772
|
-
{ class: "TRAFFIC_META" },
|
|
76773
|
-
`${traffic_size(e.size)} · ${e.ts}`
|
|
76774
|
-
]);
|
|
76775
|
-
return createElement2([
|
|
76776
|
-
"div",
|
|
76777
|
-
{
|
|
76778
|
-
class: "TRAFFIC_LINE " + dir_class(e.dir),
|
|
76779
|
-
title: e.title
|
|
76780
|
-
},
|
|
76781
|
-
kids
|
|
76782
|
-
]);
|
|
76783
|
-
}
|
|
76784
|
-
function render_name(e) {
|
|
76785
|
-
let kids = event_spans(e);
|
|
76786
|
-
kids.push([
|
|
76787
|
-
"span",
|
|
76788
|
-
{ class: "TRAFFIC_META" },
|
|
76789
|
-
e.ts
|
|
76790
|
-
]);
|
|
76791
|
-
return createElement2([
|
|
76792
|
-
"div",
|
|
76793
|
-
{
|
|
76794
|
-
class: "TRAFFIC_NAME " + dir_class(e.dir),
|
|
76795
|
-
title: e.title
|
|
76796
|
-
},
|
|
76797
|
-
kids
|
|
76798
|
-
]);
|
|
76799
|
-
}
|
|
76800
76740
|
function render_log(e) {
|
|
76801
76741
|
let $row = createElement2([
|
|
76802
76742
|
"div",
|
|
@@ -76828,10 +76768,7 @@ function render_log(e) {
|
|
|
76828
76768
|
}
|
|
76829
76769
|
function render_entry(e) {
|
|
76830
76770
|
if (e.kind === "log") return render_log(e);
|
|
76831
|
-
|
|
76832
|
-
if (view === "full") return render_full(e);
|
|
76833
|
-
if (view === "compact") return render_compact(e);
|
|
76834
|
-
if (view === "name") return render_name(e);
|
|
76771
|
+
if (dev_traffic_view() === "expanded") return render_full(e);
|
|
76835
76772
|
return render_detailed(e);
|
|
76836
76773
|
}
|
|
76837
76774
|
/******************************
|
|
@@ -76954,7 +76891,6 @@ function info_traffic(title, msg, direction, size) {
|
|
|
76954
76891
|
return;
|
|
76955
76892
|
}
|
|
76956
76893
|
let route = dev_route();
|
|
76957
|
-
if (route !== "window") console_traffic(title, jn, direction, size);
|
|
76958
76894
|
let event = jn && jn.event ? String(jn.event) : "(no event)";
|
|
76959
76895
|
let kw = jn && jn.kw && typeof jn.kw === "object" ? jn.kw : null;
|
|
76960
76896
|
let command = kw && typeof kw.command === "string" ? kw.command : "";
|
|
@@ -76977,10 +76913,12 @@ function info_traffic(title, msg, direction, size) {
|
|
|
76977
76913
|
$node: null
|
|
76978
76914
|
};
|
|
76979
76915
|
push_entry(entry);
|
|
76916
|
+
let hidden = entry_hidden(entry, build_filter_ctx());
|
|
76917
|
+
if (route !== "window" && !hidden) console_traffic(title, jn, direction, size);
|
|
76980
76918
|
let logger = document.getElementById("developer-traffic-logger");
|
|
76981
76919
|
if (!logger || route === "console") return;
|
|
76982
76920
|
ensure_dev_style();
|
|
76983
|
-
if (!
|
|
76921
|
+
if (!hidden) {
|
|
76984
76922
|
let node = render_entry(entry);
|
|
76985
76923
|
entry.$node = node;
|
|
76986
76924
|
let ph = logger.querySelector(".YDEV_EMPTY");
|
|
@@ -77143,7 +77081,7 @@ function refresh_dev_chrome() {
|
|
|
77143
77081
|
$b.textContent = key === "automata" && v > 0 ? label + " " + v : label;
|
|
77144
77082
|
$b.classList.toggle("is-active", v > 0);
|
|
77145
77083
|
});
|
|
77146
|
-
let view =
|
|
77084
|
+
let view = dev_traffic_view();
|
|
77147
77085
|
document.querySelectorAll(".YDEV_SEG_BTN[data-view]").forEach(($b) => {
|
|
77148
77086
|
$b.classList.toggle("is-active", $b.getAttribute("data-view") === view);
|
|
77149
77087
|
});
|
|
@@ -77152,7 +77090,7 @@ function refresh_dev_chrome() {
|
|
|
77152
77090
|
$b.classList.toggle("is-active", $b.getAttribute("data-output") === route);
|
|
77153
77091
|
});
|
|
77154
77092
|
let $eg = document.getElementById("ydev-expand-grp");
|
|
77155
|
-
if ($eg) $eg.style.display = view === "
|
|
77093
|
+
if ($eg) $eg.style.display = view === "expanded" ? "" : "none";
|
|
77156
77094
|
document.querySelectorAll(".YDEV_CHIP[data-expand]").forEach(($b) => {
|
|
77157
77095
|
$b.classList.toggle("is-active", full_show($b.getAttribute("data-expand")));
|
|
77158
77096
|
});
|
|
@@ -77162,6 +77100,9 @@ function refresh_dev_chrome() {
|
|
|
77162
77100
|
document.querySelectorAll(".YDEV_CHIP[data-toggle=\"automata-simple\"]").forEach(($b) => {
|
|
77163
77101
|
$b.classList.toggle("is-active", !!dev_simple_mach());
|
|
77164
77102
|
});
|
|
77103
|
+
document.querySelectorAll(".YDEV_CHIP[data-toggle=\"traces-payload\"]").forEach(($b) => {
|
|
77104
|
+
$b.classList.toggle("is-active", !!dev_traces_payload());
|
|
77105
|
+
});
|
|
77165
77106
|
update_stats();
|
|
77166
77107
|
}
|
|
77167
77108
|
function traffic_to_text() {
|
|
@@ -77244,18 +77185,46 @@ function build_control_bar() {
|
|
|
77244
77185
|
refresh_dev_chrome();
|
|
77245
77186
|
} }
|
|
77246
77187
|
];
|
|
77188
|
+
let traces_payload = [
|
|
77189
|
+
"button",
|
|
77190
|
+
{
|
|
77191
|
+
class: "YDEV_CHIP",
|
|
77192
|
+
"data-toggle": "traces-payload",
|
|
77193
|
+
type: "button",
|
|
77194
|
+
title: t("show the payload of the traces"),
|
|
77195
|
+
"data-i18n-title": "show the payload of the traces",
|
|
77196
|
+
"data-i18n": "payload",
|
|
77197
|
+
"aria-label": t("payload"),
|
|
77198
|
+
"data-i18n-aria-label": "payload"
|
|
77199
|
+
},
|
|
77200
|
+
t("payload"),
|
|
77201
|
+
{ click: (ev) => {
|
|
77202
|
+
ev.stopPropagation();
|
|
77203
|
+
kw_set_local_storage_value("dev_traces_payload", dev_traces_payload() ? 0 : 1);
|
|
77204
|
+
rerender_all();
|
|
77205
|
+
refresh_dev_chrome();
|
|
77206
|
+
} }
|
|
77207
|
+
];
|
|
77208
|
+
let VIEW_TITLES = {
|
|
77209
|
+
collapsed: "traffic payload folded",
|
|
77210
|
+
expanded: "traffic payload laid out"
|
|
77211
|
+
};
|
|
77247
77212
|
let mk_view = (v, label) => [
|
|
77248
77213
|
"button",
|
|
77249
77214
|
{
|
|
77250
77215
|
class: "YDEV_SEG_BTN",
|
|
77251
77216
|
"data-view": v,
|
|
77217
|
+
type: "button",
|
|
77218
|
+
title: t(VIEW_TITLES[v]),
|
|
77219
|
+
"data-i18n-title": VIEW_TITLES[v],
|
|
77252
77220
|
"data-i18n": label,
|
|
77253
|
-
|
|
77221
|
+
"aria-label": t(label),
|
|
77222
|
+
"data-i18n-aria-label": label
|
|
77254
77223
|
},
|
|
77255
77224
|
t(label),
|
|
77256
77225
|
{ click: (ev) => {
|
|
77257
77226
|
ev.stopPropagation();
|
|
77258
|
-
|
|
77227
|
+
set_traffic_view(v);
|
|
77259
77228
|
} }
|
|
77260
77229
|
];
|
|
77261
77230
|
let view_seg = [
|
|
@@ -77264,12 +77233,7 @@ function build_control_bar() {
|
|
|
77264
77233
|
class: "YDEV_SEG",
|
|
77265
77234
|
id: "ydev-seg"
|
|
77266
77235
|
},
|
|
77267
|
-
[
|
|
77268
|
-
mk_view("detailed", "detailed"),
|
|
77269
|
-
mk_view("full", "expanded"),
|
|
77270
|
-
mk_view("compact", "compact"),
|
|
77271
|
-
mk_view("name", "name only")
|
|
77272
|
-
]
|
|
77236
|
+
[mk_view("collapsed", "collapsed"), mk_view("expanded", "expanded")]
|
|
77273
77237
|
];
|
|
77274
77238
|
let OUT_TITLES = {
|
|
77275
77239
|
window: "dev window only",
|
|
@@ -77460,7 +77424,11 @@ function build_control_bar() {
|
|
|
77460
77424
|
"div",
|
|
77461
77425
|
{ class: "YDEV_BAR" },
|
|
77462
77426
|
[
|
|
77463
|
-
grp("traces", [
|
|
77427
|
+
grp("traces", [
|
|
77428
|
+
...trace_chips,
|
|
77429
|
+
simple_mach,
|
|
77430
|
+
traces_payload
|
|
77431
|
+
]),
|
|
77464
77432
|
sep(),
|
|
77465
77433
|
grp("output", [output_seg]),
|
|
77466
77434
|
sep(),
|
package/package.json
CHANGED
package/src/yui_dev.js
CHANGED
|
@@ -79,13 +79,14 @@ const TRAFFIC_TS_FIELDS = {
|
|
|
79
79
|
* kept here so it can be copied:
|
|
80
80
|
*
|
|
81
81
|
* automata, both, browser console only, clear,
|
|
82
|
-
* clear captured traffic,
|
|
83
|
-
* copy visible traffic to clipboard, creation, data,
|
|
82
|
+
* clear captured traffic, collapsed, console, copied, copy,
|
|
83
|
+
* copy visible traffic to clipboard, creation, data,
|
|
84
84
|
* dev window and browser console, dev window only, developer,
|
|
85
85
|
* clear the filter, errors, expand, expanded, filter events / payload,
|
|
86
86
|
* find, i18n,
|
|
87
87
|
* i18next debug output, incoming, log, machine trace shape,
|
|
88
|
-
* metadata,
|
|
88
|
+
* metadata, outgoing, output, payload, periodic, schema, show,
|
|
89
|
+
* show the payload of the traces,
|
|
89
90
|
* show this section in the expanded view, simple mach,
|
|
90
91
|
* start / stop, subscriptions,
|
|
91
92
|
* trace every event of every automaton,
|
|
@@ -94,7 +95,8 @@ const TRAFFIC_TS_FIELDS = {
|
|
|
94
95
|
* trace the messages to and from the backend,
|
|
95
96
|
* trace the periodic timer event,
|
|
96
97
|
* trace the start and stop of gobjs,
|
|
97
|
-
* traces, traffic,
|
|
98
|
+
* traces, traffic, traffic payload folded,
|
|
99
|
+
* traffic payload laid out, view, window, yuno monitor
|
|
98
100
|
*
|
|
99
101
|
* wattyzer and the yunovatios GUIs carry them; check a new consumer
|
|
100
102
|
* against this list, and confirm it by DUMPING the window. */
|
|
@@ -168,29 +170,6 @@ function traffic_iso(value)
|
|
|
168
170
|
}
|
|
169
171
|
}
|
|
170
172
|
|
|
171
|
-
/************************************************************
|
|
172
|
-
* Clip a string for inline display (full text kept elsewhere).
|
|
173
|
-
************************************************************/
|
|
174
|
-
function traffic_clip(s, n)
|
|
175
|
-
{
|
|
176
|
-
s = String(s);
|
|
177
|
-
return s.length > n ? s.slice(0, n) + "…" : s;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/************************************************************
|
|
181
|
-
* A scalar rendered as a short inline token (for summaries).
|
|
182
|
-
************************************************************/
|
|
183
|
-
function traffic_scalar_text(v)
|
|
184
|
-
{
|
|
185
|
-
if(v === null) {
|
|
186
|
-
return "null";
|
|
187
|
-
}
|
|
188
|
-
if(typeof v === "string") {
|
|
189
|
-
return traffic_clip(v, 40);
|
|
190
|
-
}
|
|
191
|
-
return String(v);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
173
|
function dir_class(dir)
|
|
195
174
|
{
|
|
196
175
|
return (dir === 2) ? "dir-in" : (dir === 3) ? "dir-err" : "dir-out";
|
|
@@ -212,10 +191,33 @@ function dev_num(key, def)
|
|
|
212
191
|
return Number(kw_get_local_storage_value(key, (def === undefined ? 0 : def), false));
|
|
213
192
|
}
|
|
214
193
|
|
|
215
|
-
|
|
194
|
+
/* TRAFFIC and TRACES are two FEEDS, and each carries its own controls.
|
|
195
|
+
*
|
|
196
|
+
* They used to share one selector, and it steered the wrong one: the four
|
|
197
|
+
* view modes rewrote the traffic -- down to a bare event name -- while the
|
|
198
|
+
* trace lines ignored them altogether. Someone who ticks Traffic alone to
|
|
199
|
+
* read what is going to the backend got a list of event names, and the one
|
|
200
|
+
* feed whose shape they might want to change did not change.
|
|
201
|
+
*
|
|
202
|
+
* Both feeds can be on at once, so neither control may borrow the other's:
|
|
203
|
+
* the traffic's lives in the VIEW group, the traces' in the TRACES row,
|
|
204
|
+
* beside the chip that picks the machine-trace shape.
|
|
205
|
+
*
|
|
206
|
+
* The traffic payload is ALWAYS there; the view says whether it is folded.
|
|
207
|
+
* The old `dev_view_mode` key is left where it is and simply stops being
|
|
208
|
+
* read (same as SIMPLE_MACH_KEY below). */
|
|
209
|
+
function dev_traffic_view()
|
|
216
210
|
{
|
|
217
|
-
let v = kw_get_local_storage_value("
|
|
218
|
-
return (v === "
|
|
211
|
+
let v = kw_get_local_storage_value("dev_traffic_view", "collapsed", false);
|
|
212
|
+
return (v === "expanded") ? "expanded" : "collapsed";
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/* Whether the trace's PAYLOAD lines (level `json`: the kw a trace dumps
|
|
216
|
+
* with ev_kw, or a publication) are shown. Default ON, which is what the
|
|
217
|
+
* old default view showed. */
|
|
218
|
+
function dev_traces_payload()
|
|
219
|
+
{
|
|
220
|
+
return dev_num("dev_traces_payload", 1) ? 1 : 0;
|
|
219
221
|
}
|
|
220
222
|
|
|
221
223
|
/* Which SHAPE the machine trace is written in — the two the C kernel
|
|
@@ -268,23 +270,38 @@ function apply_console_route()
|
|
|
268
270
|
|
|
269
271
|
/* Emit one inter-event traffic line to the browser console (routes
|
|
270
272
|
* "console" and "both"). gobj-js only knows about framework logs, not this
|
|
271
|
-
* traffic feed, so the console mirror is produced here.
|
|
273
|
+
* traffic feed, so the console mirror is produced here.
|
|
274
|
+
*
|
|
275
|
+
* It follows the VIEW, because the window and the console are two sinks of
|
|
276
|
+
* ONE feed and may not disagree about what they are showing: `expanded`
|
|
277
|
+
* prints the payload laid out, `collapsed` hands the object to the console
|
|
278
|
+
* and lets it fold it. The same promise the log filter made in 7.23.33 --
|
|
279
|
+
* one rule, two sinks -- which the traffic half had never kept. */
|
|
272
280
|
function console_traffic(title, jn, direction, size)
|
|
273
281
|
{
|
|
274
282
|
let event = (jn && jn.event) ? String(jn.event) : "(no event)";
|
|
275
283
|
let kw = (jn && jn.kw && typeof jn.kw === "object") ? jn.kw : jn;
|
|
276
284
|
let color = (direction === 2) ? "#16a34a" : (direction === 3) ? "#dc2626" : "#2563eb";
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
285
|
+
let head = "%c" + dir_arrow(direction) + " " + (title ? "[" + title + "] " : "") + event +
|
|
286
|
+
(size ? " (" + size + "b)" : "");
|
|
287
|
+
|
|
288
|
+
if(dev_traffic_view() === "expanded") {
|
|
289
|
+
let text;
|
|
290
|
+
try {
|
|
291
|
+
text = JSON.stringify(full_sections(kw), null, 4);
|
|
292
|
+
} catch(err) {
|
|
293
|
+
text = String(kw);
|
|
294
|
+
}
|
|
295
|
+
window.console.log(head, "color:" + color, "\n" + text);
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
window.console.log(head, "color:" + color, kw);
|
|
283
300
|
}
|
|
284
301
|
|
|
285
|
-
function
|
|
302
|
+
function set_traffic_view(v)
|
|
286
303
|
{
|
|
287
|
-
kw_set_local_storage_value("
|
|
304
|
+
kw_set_local_storage_value("dev_traffic_view", (v === "expanded") ? "expanded" : "collapsed");
|
|
288
305
|
rerender_all();
|
|
289
306
|
refresh_dev_chrome();
|
|
290
307
|
}
|
|
@@ -320,7 +337,7 @@ function build_filter_ctx()
|
|
|
320
337
|
inc: dev_num("dev_filter_in", 1),
|
|
321
338
|
err: dev_num("dev_filter_err", 1),
|
|
322
339
|
search: SEARCH_TEXT,
|
|
323
|
-
|
|
340
|
+
payload: dev_traces_payload(),
|
|
324
341
|
};
|
|
325
342
|
}
|
|
326
343
|
|
|
@@ -328,9 +345,11 @@ function entry_hidden(e, ctx)
|
|
|
328
345
|
{
|
|
329
346
|
if(e.kind === "log") {
|
|
330
347
|
/* A `json` line is a PAYLOAD (the kw the trace dumps with ev_kw or a
|
|
331
|
-
* publication)
|
|
332
|
-
*
|
|
333
|
-
|
|
348
|
+
* publication), and the TRACES row says whether those are wanted.
|
|
349
|
+
* It used to hang off the traffic view, which is another feed's
|
|
350
|
+
* control: turning the traffic into names silently took the
|
|
351
|
+
* traces' payloads away with it. */
|
|
352
|
+
if(e.level === "json" && !ctx.payload) {
|
|
334
353
|
return true;
|
|
335
354
|
}
|
|
336
355
|
/* Mirrored console logs respect the search box only — not the
|
|
@@ -432,17 +451,15 @@ function ensure_dev_style()
|
|
|
432
451
|
.YDEV_TITLE_MAIN { font-weight: 700; }
|
|
433
452
|
.YDEV_TITLE_SUB { opacity: 0.7; font-size: 12px; }
|
|
434
453
|
/* -------- entries (shared) -------- */
|
|
435
|
-
.TRAFFIC_ENTRY
|
|
454
|
+
.TRAFFIC_ENTRY {
|
|
436
455
|
border-left: 3px solid #94a3b8; border-radius: 3px;
|
|
437
456
|
font-family: "DejaVu Sans Mono", monospace, consolas, monaco; font-size: 13px;
|
|
438
457
|
background: rgba(0,0,0,0.02);
|
|
439
458
|
}
|
|
440
459
|
.TRAFFIC_ENTRY { margin: 6px 0; padding: 4px 8px; line-height: 1.55; }
|
|
441
|
-
.
|
|
442
|
-
.
|
|
443
|
-
.TRAFFIC_ENTRY.dir-
|
|
444
|
-
.TRAFFIC_ENTRY.dir-in, .TRAFFIC_LINE.dir-in, .TRAFFIC_NAME.dir-in { border-left-color: #059669; }
|
|
445
|
-
.TRAFFIC_ENTRY.dir-err, .TRAFFIC_LINE.dir-err, .TRAFFIC_NAME.dir-err { border-left-color: #dc2626; }
|
|
460
|
+
.TRAFFIC_ENTRY.dir-out { border-left-color: #2563eb; }
|
|
461
|
+
.TRAFFIC_ENTRY.dir-in { border-left-color: #059669; }
|
|
462
|
+
.TRAFFIC_ENTRY.dir-err { border-left-color: #dc2626; }
|
|
446
463
|
.TRAFFIC_HEADER { display: flex; align-items: baseline; gap: 8px; }
|
|
447
464
|
.TRAFFIC_ARROW { font-weight: 700; }
|
|
448
465
|
.TRAFFIC_EVENT { font-weight: 700; }
|
|
@@ -450,7 +467,6 @@ function ensure_dev_style()
|
|
|
450
467
|
.dir-out .TRAFFIC_ARROW, .dir-out .TRAFFIC_EVENT { color: #2563eb; }
|
|
451
468
|
.dir-in .TRAFFIC_ARROW, .dir-in .TRAFFIC_EVENT { color: #059669; }
|
|
452
469
|
.dir-err .TRAFFIC_ARROW, .dir-err .TRAFFIC_EVENT { color: #dc2626; }
|
|
453
|
-
.TRAFFIC_SUMMARY { opacity: 0.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; min-width: 0; }
|
|
454
470
|
.TRAFFIC_META { margin-left: auto; opacity: 0.6; font-size: 11px; white-space: nowrap; }
|
|
455
471
|
.TRAFFIC_ENTRY:hover .TRAFFIC_KW { margin: 2px 0 0 16px; }
|
|
456
472
|
.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; }
|
|
@@ -483,10 +499,10 @@ details.TRAFFIC_NEST > summary::-webkit-details-marker { display: none; }
|
|
|
483
499
|
:root[data-theme="dark"] .YDEV_BAR, :root[data-theme="dark"] .YDEV_STATS { background: rgba(255,255,255,0.04); }
|
|
484
500
|
:root[data-theme="dark"] .YDEV_SEP { background: rgba(255,255,255,0.14); }
|
|
485
501
|
:root[data-theme="dark"] .YDEV_CHIP, :root[data-theme="dark"] .YDEV_SEG, :root[data-theme="dark"] .YDEV_SEARCH { border-color: rgba(255,255,255,0.2); }
|
|
486
|
-
:root[data-theme="dark"] .TRAFFIC_ENTRY
|
|
487
|
-
:root[data-theme="dark"] .TRAFFIC_ENTRY.dir-out
|
|
488
|
-
:root[data-theme="dark"] .TRAFFIC_ENTRY.dir-in
|
|
489
|
-
:root[data-theme="dark"] .TRAFFIC_ENTRY.dir-err
|
|
502
|
+
:root[data-theme="dark"] .TRAFFIC_ENTRY { background: rgba(255,255,255,0.03); }
|
|
503
|
+
:root[data-theme="dark"] .TRAFFIC_ENTRY.dir-out { border-left-color: #60a5fa; }
|
|
504
|
+
:root[data-theme="dark"] .TRAFFIC_ENTRY.dir-in { border-left-color: #34d399; }
|
|
505
|
+
:root[data-theme="dark"] .TRAFFIC_ENTRY.dir-err { border-left-color: #f87171; }
|
|
490
506
|
:root[data-theme="dark"] .dir-out .TRAFFIC_ARROW, :root[data-theme="dark"] .dir-out .TRAFFIC_EVENT { color: #60a5fa; }
|
|
491
507
|
:root[data-theme="dark"] .dir-in .TRAFFIC_ARROW, :root[data-theme="dark"] .dir-in .TRAFFIC_EVENT { color: #34d399; }
|
|
492
508
|
:root[data-theme="dark"] .dir-err .TRAFFIC_ARROW, :root[data-theme="dark"] .dir-err .TRAFFIC_EVENT { color: #f87171; }
|
|
@@ -620,36 +636,6 @@ function event_spans(e)
|
|
|
620
636
|
return spans;
|
|
621
637
|
}
|
|
622
638
|
|
|
623
|
-
/* One-line summary of the kw for the compact view. */
|
|
624
|
-
function compact_summary(kw)
|
|
625
|
-
{
|
|
626
|
-
if(!kw) {
|
|
627
|
-
return "";
|
|
628
|
-
}
|
|
629
|
-
let parts = [];
|
|
630
|
-
if("result" in kw) {
|
|
631
|
-
parts.push("result=" + traffic_scalar_text(kw.result));
|
|
632
|
-
}
|
|
633
|
-
if(typeof kw.comment === "string" && kw.comment) {
|
|
634
|
-
parts.push(traffic_clip(kw.comment, 80));
|
|
635
|
-
}
|
|
636
|
-
if(!parts.length) {
|
|
637
|
-
let n = 0;
|
|
638
|
-
for(let k of Object.keys(kw)) {
|
|
639
|
-
if(k === "command") {
|
|
640
|
-
continue;
|
|
641
|
-
}
|
|
642
|
-
let v = kw[k];
|
|
643
|
-
if(v === null || typeof v !== "object") {
|
|
644
|
-
parts.push(k + "=" + traffic_scalar_text(v));
|
|
645
|
-
if(++n >= 3) {
|
|
646
|
-
break;
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
return traffic_clip(parts.join(" · "), 140);
|
|
652
|
-
}
|
|
653
639
|
|
|
654
640
|
function render_detailed(e)
|
|
655
641
|
{
|
|
@@ -726,21 +712,6 @@ function render_full(e)
|
|
|
726
712
|
return createElement2(['div', {class: 'TRAFFIC_ENTRY ' + dir_class(e.dir), title: e.title}, children]);
|
|
727
713
|
}
|
|
728
714
|
|
|
729
|
-
function render_compact(e)
|
|
730
|
-
{
|
|
731
|
-
let kids = event_spans(e);
|
|
732
|
-
kids.push(['span', {class: 'TRAFFIC_SUMMARY'}, compact_summary(e.kw)]);
|
|
733
|
-
kids.push(['span', {class: 'TRAFFIC_META'}, `${traffic_size(e.size)} · ${e.ts}`]);
|
|
734
|
-
return createElement2(['div', {class: 'TRAFFIC_LINE ' + dir_class(e.dir), title: e.title}, kids]);
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
function render_name(e)
|
|
738
|
-
{
|
|
739
|
-
let kids = event_spans(e);
|
|
740
|
-
kids.push(['span', {class: 'TRAFFIC_META'}, e.ts]);
|
|
741
|
-
return createElement2(['div', {class: 'TRAFFIC_NAME ' + dir_class(e.dir), title: e.title}, kids]);
|
|
742
|
-
}
|
|
743
|
-
|
|
744
715
|
/* A mirrored framework log line (error/warning/info/debug/msg). */
|
|
745
716
|
function render_log(e)
|
|
746
717
|
{
|
|
@@ -769,21 +740,18 @@ function render_log(e)
|
|
|
769
740
|
return $row;
|
|
770
741
|
}
|
|
771
742
|
|
|
743
|
+
/* A TRAFFIC entry always shows its payload -- folded (`collapsed`, the
|
|
744
|
+
* bullets) or laid out (`expanded`, the JSON). A trace line is written by
|
|
745
|
+
* the runtime and is painted as it comes; what shapes it is the TRACES row
|
|
746
|
+
* (the machine-trace format chip and the payload chip), not this. */
|
|
772
747
|
function render_entry(e)
|
|
773
748
|
{
|
|
774
749
|
if(e.kind === "log") {
|
|
775
750
|
return render_log(e);
|
|
776
751
|
}
|
|
777
|
-
|
|
778
|
-
if(view === "full") {
|
|
752
|
+
if(dev_traffic_view() === "expanded") {
|
|
779
753
|
return render_full(e);
|
|
780
754
|
}
|
|
781
|
-
if(view === "compact") {
|
|
782
|
-
return render_compact(e);
|
|
783
|
-
}
|
|
784
|
-
if(view === "name") {
|
|
785
|
-
return render_name(e);
|
|
786
|
-
}
|
|
787
755
|
return render_detailed(e);
|
|
788
756
|
}
|
|
789
757
|
|
|
@@ -976,11 +944,6 @@ function info_traffic(title, msg, direction, size)
|
|
|
976
944
|
|
|
977
945
|
let route = dev_route();
|
|
978
946
|
|
|
979
|
-
/* Console side (routes "console" / "both"). */
|
|
980
|
-
if(route !== "window") {
|
|
981
|
-
console_traffic(title, jn, direction, size);
|
|
982
|
-
}
|
|
983
|
-
|
|
984
947
|
let event = (jn && jn.event) ? String(jn.event) : "(no event)";
|
|
985
948
|
let kw = (jn && jn.kw && typeof jn.kw === "object") ? jn.kw : null;
|
|
986
949
|
let command = (kw && typeof kw.command === "string") ? kw.command : "";
|
|
@@ -1000,6 +963,19 @@ function info_traffic(title, msg, direction, size)
|
|
|
1000
963
|
|
|
1001
964
|
push_entry(entry);
|
|
1002
965
|
|
|
966
|
+
/* ONE rule, two sinks. The filter used to be asked by the window only,
|
|
967
|
+
* and the console printed the very line the window had just hidden:
|
|
968
|
+
* hide the outgoing half, or type something in FIND, and the traffic
|
|
969
|
+
* went on arriving in the pane beside it. The answer is computed once,
|
|
970
|
+
* here, and both sinks obey it. */
|
|
971
|
+
let hidden = entry_hidden(entry, build_filter_ctx());
|
|
972
|
+
|
|
973
|
+
/* Console side (routes "console" / "both"), which has no window to
|
|
974
|
+
* depend on: it prints whether or not the monitor is mounted. */
|
|
975
|
+
if(route !== "window" && !hidden) {
|
|
976
|
+
console_traffic(title, jn, direction, size);
|
|
977
|
+
}
|
|
978
|
+
|
|
1003
979
|
/* Window side: the entry is buffered above whatever happens, so the
|
|
1004
980
|
* window shows what arrived before it was opened. Painted only when the
|
|
1005
981
|
* window is mounted and not routed to the console only. */
|
|
@@ -1009,7 +985,7 @@ function info_traffic(title, msg, direction, size)
|
|
|
1009
985
|
}
|
|
1010
986
|
ensure_dev_style();
|
|
1011
987
|
|
|
1012
|
-
if(!
|
|
988
|
+
if(!hidden) {
|
|
1013
989
|
let node = render_entry(entry);
|
|
1014
990
|
entry.$node = node;
|
|
1015
991
|
/* Drop the "no traffic yet" placeholder before the first row. */
|
|
@@ -1231,7 +1207,7 @@ function refresh_dev_chrome()
|
|
|
1231
1207
|
$b.classList.toggle('is-active', v > 0);
|
|
1232
1208
|
});
|
|
1233
1209
|
|
|
1234
|
-
let view =
|
|
1210
|
+
let view = dev_traffic_view();
|
|
1235
1211
|
document.querySelectorAll('.YDEV_SEG_BTN[data-view]').forEach(($b) => {
|
|
1236
1212
|
$b.classList.toggle('is-active', $b.getAttribute('data-view') === view);
|
|
1237
1213
|
});
|
|
@@ -1245,7 +1221,7 @@ function refresh_dev_chrome()
|
|
|
1245
1221
|
* the group only there, and reflect each toggle's persisted state. */
|
|
1246
1222
|
let $eg = document.getElementById('ydev-expand-grp');
|
|
1247
1223
|
if($eg) {
|
|
1248
|
-
$eg.style.display = (view === '
|
|
1224
|
+
$eg.style.display = (view === 'expanded') ? '' : 'none';
|
|
1249
1225
|
}
|
|
1250
1226
|
document.querySelectorAll('.YDEV_CHIP[data-expand]').forEach(($b) => {
|
|
1251
1227
|
$b.classList.toggle('is-active', full_show($b.getAttribute('data-expand')));
|
|
@@ -1259,6 +1235,10 @@ function refresh_dev_chrome()
|
|
|
1259
1235
|
$b.classList.toggle('is-active', !!dev_simple_mach());
|
|
1260
1236
|
});
|
|
1261
1237
|
|
|
1238
|
+
document.querySelectorAll('.YDEV_CHIP[data-toggle="traces-payload"]').forEach(($b) => {
|
|
1239
|
+
$b.classList.toggle('is-active', !!dev_traces_payload());
|
|
1240
|
+
});
|
|
1241
|
+
|
|
1262
1242
|
update_stats();
|
|
1263
1243
|
}
|
|
1264
1244
|
|
|
@@ -1356,19 +1336,48 @@ function build_control_bar()
|
|
|
1356
1336
|
}
|
|
1357
1337
|
}];
|
|
1358
1338
|
|
|
1359
|
-
|
|
1360
|
-
|
|
1339
|
+
/* The TRACES feed's payload: the `json` lines a trace dumps (an ev_kw,
|
|
1340
|
+
* a publication). It used to be taken away by the TRAFFIC view being
|
|
1341
|
+
* set to names -- another feed's control -- so nothing said where the
|
|
1342
|
+
* payloads had gone. Here it says it. */
|
|
1343
|
+
let traces_payload = ['button', {
|
|
1344
|
+
class: 'YDEV_CHIP', 'data-toggle': 'traces-payload', type: 'button',
|
|
1345
|
+
title: t('show the payload of the traces'),
|
|
1346
|
+
'data-i18n-title': 'show the payload of the traces',
|
|
1347
|
+
'data-i18n': 'payload',
|
|
1348
|
+
'aria-label': t('payload'), 'data-i18n-aria-label': 'payload',
|
|
1349
|
+
}, t('payload'), {
|
|
1350
|
+
click: (ev) => {
|
|
1351
|
+
ev.stopPropagation();
|
|
1352
|
+
kw_set_local_storage_value("dev_traces_payload", dev_traces_payload() ? 0 : 1);
|
|
1353
|
+
rerender_all();
|
|
1354
|
+
refresh_dev_chrome();
|
|
1355
|
+
}
|
|
1356
|
+
}];
|
|
1357
|
+
|
|
1358
|
+
/* The TRAFFIC feed's own control, and it only says how much room its
|
|
1359
|
+
* payload takes: the payload is always there. What shapes a TRACE is
|
|
1360
|
+
* in the TRACES row (the machine-trace chip and `payload`), because
|
|
1361
|
+
* both feeds can be on at once and neither may steer the other. */
|
|
1362
|
+
let VIEW_TITLES = {
|
|
1363
|
+
collapsed: 'traffic payload folded',
|
|
1364
|
+
expanded: 'traffic payload laid out',
|
|
1365
|
+
};
|
|
1366
|
+
let mk_view = (v, label) => ['button', {
|
|
1367
|
+
class: 'YDEV_SEG_BTN', 'data-view': v, type: 'button',
|
|
1368
|
+
title: t(VIEW_TITLES[v]), 'data-i18n-title': VIEW_TITLES[v],
|
|
1369
|
+
'data-i18n': label,
|
|
1370
|
+
'aria-label': t(label), 'data-i18n-aria-label': label,
|
|
1371
|
+
}, t(label), {
|
|
1361
1372
|
click: (ev) => {
|
|
1362
1373
|
ev.stopPropagation();
|
|
1363
|
-
|
|
1374
|
+
set_traffic_view(v);
|
|
1364
1375
|
}
|
|
1365
1376
|
}];
|
|
1366
1377
|
|
|
1367
1378
|
let view_seg = ['div', {class: 'YDEV_SEG', id: 'ydev-seg'}, [
|
|
1368
|
-
mk_view('
|
|
1369
|
-
mk_view('
|
|
1370
|
-
mk_view('compact', 'compact'),
|
|
1371
|
-
mk_view('name', 'name only'),
|
|
1379
|
+
mk_view('collapsed', 'collapsed'),
|
|
1380
|
+
mk_view('expanded', 'expanded'),
|
|
1372
1381
|
]];
|
|
1373
1382
|
|
|
1374
1383
|
/* Output routing: send traffic + all logs + automata to the dev window,
|
|
@@ -1394,8 +1403,8 @@ function build_control_bar()
|
|
|
1394
1403
|
mk_out('both', 'both'),
|
|
1395
1404
|
]];
|
|
1396
1405
|
|
|
1397
|
-
/* Expanded-view section toggles (only meaningful in the '
|
|
1398
|
-
* the group is shown/hidden by refresh_dev_chrome). */
|
|
1406
|
+
/* Expanded-view section toggles (only meaningful in the 'expanded'
|
|
1407
|
+
* traffic view; the group is shown/hidden by refresh_dev_chrome). */
|
|
1399
1408
|
/* The title says WHAT it does and not which section: composing
|
|
1400
1409
|
* `'Show ' + label + '...'` gives a string that is no i18n key, so
|
|
1401
1410
|
* it could never re-translate -- and the button's own label is the
|
|
@@ -1497,7 +1506,7 @@ function build_control_bar()
|
|
|
1497
1506
|
let sep = () => ['span', {class: 'YDEV_SEP'}, ''];
|
|
1498
1507
|
|
|
1499
1508
|
return createElement2(['div', {class: 'YDEV_BAR'}, [
|
|
1500
|
-
grp('traces', [...trace_chips, simple_mach]), sep(),
|
|
1509
|
+
grp('traces', [...trace_chips, simple_mach, traces_payload]), sep(),
|
|
1501
1510
|
grp('output', [output_seg]), sep(),
|
|
1502
1511
|
grp('view', [view_seg]), expand_grp, sep(),
|
|
1503
1512
|
grp('show', dir_chips), sep(),
|