@yuneta/gobj-ui 7.23.173 → 7.23.175
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 +58 -24
- package/dist/gobj-ui.es.js +58 -24
- package/package.json +3 -3
- package/src/yui_dev.js +69 -37
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -76347,11 +76347,15 @@ function build_filter_ctx() {
|
|
|
76347
76347
|
out: dev_num("dev_filter_out", 1),
|
|
76348
76348
|
inc: dev_num("dev_filter_in", 1),
|
|
76349
76349
|
err: dev_num("dev_filter_err", 1),
|
|
76350
|
-
search: SEARCH_TEXT
|
|
76350
|
+
search: SEARCH_TEXT,
|
|
76351
|
+
view: dev_view()
|
|
76351
76352
|
};
|
|
76352
76353
|
}
|
|
76353
76354
|
function entry_hidden(e, ctx) {
|
|
76354
|
-
if (e.kind === "log")
|
|
76355
|
+
if (e.kind === "log") {
|
|
76356
|
+
if (e.level === "json" && (ctx.view === "name" || ctx.view === "compact")) return true;
|
|
76357
|
+
return !!(ctx.search && e.hay.indexOf(ctx.search) < 0);
|
|
76358
|
+
}
|
|
76355
76359
|
if (e.dir === 1 && !ctx.out) return true;
|
|
76356
76360
|
if (e.dir === 2 && !ctx.inc) return true;
|
|
76357
76361
|
if (e.dir === 3 && !ctx.err) return true;
|
|
@@ -76928,6 +76932,17 @@ function append_and_follow(logger, node) {
|
|
|
76928
76932
|
if (at_bottom) logger.scrollTop = logger.scrollHeight;
|
|
76929
76933
|
}
|
|
76930
76934
|
/************************************************************
|
|
76935
|
+
* Keep one entry in the bounded buffer, dropping the oldest
|
|
76936
|
+
* (and its row, if painted).
|
|
76937
|
+
************************************************************/
|
|
76938
|
+
function push_entry(entry) {
|
|
76939
|
+
TRAFFIC_LOG.push(entry);
|
|
76940
|
+
if (TRAFFIC_LOG.length > TRAFFIC_MAX) {
|
|
76941
|
+
let old = TRAFFIC_LOG.shift();
|
|
76942
|
+
if (old.$node && old.$node.parentNode) old.$node.parentNode.removeChild(old.$node);
|
|
76943
|
+
}
|
|
76944
|
+
}
|
|
76945
|
+
/************************************************************
|
|
76931
76946
|
* Append one inter-event message. Kept in a bounded buffer so
|
|
76932
76947
|
* view/filter switches repaint from memory. Shared by the legacy
|
|
76933
76948
|
* C_YUI_WINDOW (setup_dev) and the modal (build_dev_panel).
|
|
@@ -76945,9 +76960,6 @@ function info_traffic(title, msg, direction, size) {
|
|
|
76945
76960
|
}
|
|
76946
76961
|
let route = dev_route();
|
|
76947
76962
|
if (route !== "window") console_traffic(title, jn, direction, size);
|
|
76948
|
-
let logger = document.getElementById("developer-traffic-logger");
|
|
76949
|
-
if (!logger || route === "console") return;
|
|
76950
|
-
ensure_dev_style();
|
|
76951
76963
|
let event = jn && jn.event ? String(jn.event) : "(no event)";
|
|
76952
76964
|
let kw = jn && jn.kw && typeof jn.kw === "object" ? jn.kw : null;
|
|
76953
76965
|
let command = kw && typeof kw.command === "string" ? kw.command : "";
|
|
@@ -76969,11 +76981,10 @@ function info_traffic(title, msg, direction, size) {
|
|
|
76969
76981
|
hay,
|
|
76970
76982
|
$node: null
|
|
76971
76983
|
};
|
|
76972
|
-
|
|
76973
|
-
|
|
76974
|
-
|
|
76975
|
-
|
|
76976
|
-
}
|
|
76984
|
+
push_entry(entry);
|
|
76985
|
+
let logger = document.getElementById("developer-traffic-logger");
|
|
76986
|
+
if (!logger || route === "console") return;
|
|
76987
|
+
ensure_dev_style();
|
|
76977
76988
|
if (!entry_hidden(entry, build_filter_ctx())) {
|
|
76978
76989
|
let node = render_entry(entry);
|
|
76979
76990
|
entry.$node = node;
|
|
@@ -76994,15 +77005,8 @@ function info_log(level, msg, hora) {
|
|
|
76994
77005
|
if (__in_info_log__) return;
|
|
76995
77006
|
if (level === "error") LOG_ERR_COUNT++;
|
|
76996
77007
|
else if (level === "warning") LOG_WARN_COUNT++;
|
|
76997
|
-
if (dev_route() === "console") {
|
|
76998
|
-
update_stats();
|
|
76999
|
-
return;
|
|
77000
|
-
}
|
|
77001
|
-
let logger = document.getElementById("developer-traffic-logger");
|
|
77002
|
-
if (!logger) return;
|
|
77003
77008
|
__in_info_log__ = true;
|
|
77004
77009
|
try {
|
|
77005
|
-
ensure_dev_style();
|
|
77006
77010
|
let lvl = level || "debug";
|
|
77007
77011
|
let text;
|
|
77008
77012
|
if (lvl === "json") {
|
|
@@ -77013,21 +77017,24 @@ function info_log(level, msg, hora) {
|
|
|
77013
77017
|
}
|
|
77014
77018
|
if (text.length > 4e3) text = text.slice(0, 4e3) + "\n…(truncated)";
|
|
77015
77019
|
} else text = (0, _yuneta_gobj_js.is_string)(msg) ? msg : String(msg);
|
|
77020
|
+
let ts = (0, _yuneta_gobj_js.is_string)(hora) && hora.length >= 23 ? hora.slice(11, 23) : traffic_now();
|
|
77016
77021
|
let entry = {
|
|
77017
77022
|
kind: "log",
|
|
77018
77023
|
level: lvl,
|
|
77019
77024
|
text,
|
|
77020
77025
|
dir: 0,
|
|
77021
77026
|
size: 0,
|
|
77022
|
-
ts
|
|
77027
|
+
ts,
|
|
77023
77028
|
hay: (lvl + " " + text).toLowerCase(),
|
|
77024
77029
|
$node: null
|
|
77025
77030
|
};
|
|
77026
|
-
|
|
77027
|
-
|
|
77028
|
-
|
|
77029
|
-
|
|
77031
|
+
push_entry(entry);
|
|
77032
|
+
let logger = document.getElementById("developer-traffic-logger");
|
|
77033
|
+
if (!logger || dev_route() === "console") {
|
|
77034
|
+
update_stats();
|
|
77035
|
+
return;
|
|
77030
77036
|
}
|
|
77037
|
+
ensure_dev_style();
|
|
77031
77038
|
if (!entry_hidden(entry, build_filter_ctx())) {
|
|
77032
77039
|
let node = render_entry(entry);
|
|
77033
77040
|
entry.$node = node;
|
|
@@ -77365,7 +77372,11 @@ function build_control_bar() {
|
|
|
77365
77372
|
type: "search",
|
|
77366
77373
|
"data-role": "search",
|
|
77367
77374
|
placeholder: (0, i18next.t)("filter events / payload"),
|
|
77368
|
-
"data-i18n-placeholder": "filter events / payload"
|
|
77375
|
+
"data-i18n-placeholder": "filter events / payload",
|
|
77376
|
+
title: (0, i18next.t)("filter events / payload"),
|
|
77377
|
+
"data-i18n-title": "filter events / payload",
|
|
77378
|
+
"aria-label": (0, i18next.t)("filter events / payload"),
|
|
77379
|
+
"data-i18n-aria-label": "filter events / payload"
|
|
77369
77380
|
},
|
|
77370
77381
|
"",
|
|
77371
77382
|
{ input: (ev) => {
|
|
@@ -77373,6 +77384,29 @@ function build_control_bar() {
|
|
|
77373
77384
|
rerender_all();
|
|
77374
77385
|
} }
|
|
77375
77386
|
];
|
|
77387
|
+
let search_clear = [
|
|
77388
|
+
"button",
|
|
77389
|
+
{
|
|
77390
|
+
class: "YDEV_CHIP YDEV_SEARCH_CLEAR",
|
|
77391
|
+
type: "button",
|
|
77392
|
+
title: (0, i18next.t)("clear the filter"),
|
|
77393
|
+
"data-i18n-title": "clear the filter",
|
|
77394
|
+
"aria-label": (0, i18next.t)("clear the filter"),
|
|
77395
|
+
"data-i18n-aria-label": "clear the filter"
|
|
77396
|
+
},
|
|
77397
|
+
"✕",
|
|
77398
|
+
{ click: (ev) => {
|
|
77399
|
+
ev.stopPropagation();
|
|
77400
|
+
let $bar = ev.currentTarget.closest(".YDEV_BAR");
|
|
77401
|
+
let $input = $bar ? $bar.querySelector(".YDEV_SEARCH") : null;
|
|
77402
|
+
if ($input) {
|
|
77403
|
+
$input.value = "";
|
|
77404
|
+
$input.focus();
|
|
77405
|
+
}
|
|
77406
|
+
SEARCH_TEXT = "";
|
|
77407
|
+
rerender_all();
|
|
77408
|
+
} }
|
|
77409
|
+
];
|
|
77376
77410
|
let copy = [
|
|
77377
77411
|
"button",
|
|
77378
77412
|
{
|
|
@@ -77440,7 +77474,7 @@ function build_control_bar() {
|
|
|
77440
77474
|
sep(),
|
|
77441
77475
|
grp("show", dir_chips),
|
|
77442
77476
|
sep(),
|
|
77443
|
-
grp("find", [search]),
|
|
77477
|
+
grp("find", [search, search_clear]),
|
|
77444
77478
|
sep(),
|
|
77445
77479
|
grp("log", [copy, clear])
|
|
77446
77480
|
]
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -76342,11 +76342,15 @@ function build_filter_ctx() {
|
|
|
76342
76342
|
out: dev_num("dev_filter_out", 1),
|
|
76343
76343
|
inc: dev_num("dev_filter_in", 1),
|
|
76344
76344
|
err: dev_num("dev_filter_err", 1),
|
|
76345
|
-
search: SEARCH_TEXT
|
|
76345
|
+
search: SEARCH_TEXT,
|
|
76346
|
+
view: dev_view()
|
|
76346
76347
|
};
|
|
76347
76348
|
}
|
|
76348
76349
|
function entry_hidden(e, ctx) {
|
|
76349
|
-
if (e.kind === "log")
|
|
76350
|
+
if (e.kind === "log") {
|
|
76351
|
+
if (e.level === "json" && (ctx.view === "name" || ctx.view === "compact")) return true;
|
|
76352
|
+
return !!(ctx.search && e.hay.indexOf(ctx.search) < 0);
|
|
76353
|
+
}
|
|
76350
76354
|
if (e.dir === 1 && !ctx.out) return true;
|
|
76351
76355
|
if (e.dir === 2 && !ctx.inc) return true;
|
|
76352
76356
|
if (e.dir === 3 && !ctx.err) return true;
|
|
@@ -76923,6 +76927,17 @@ function append_and_follow(logger, node) {
|
|
|
76923
76927
|
if (at_bottom) logger.scrollTop = logger.scrollHeight;
|
|
76924
76928
|
}
|
|
76925
76929
|
/************************************************************
|
|
76930
|
+
* Keep one entry in the bounded buffer, dropping the oldest
|
|
76931
|
+
* (and its row, if painted).
|
|
76932
|
+
************************************************************/
|
|
76933
|
+
function push_entry(entry) {
|
|
76934
|
+
TRAFFIC_LOG.push(entry);
|
|
76935
|
+
if (TRAFFIC_LOG.length > TRAFFIC_MAX) {
|
|
76936
|
+
let old = TRAFFIC_LOG.shift();
|
|
76937
|
+
if (old.$node && old.$node.parentNode) old.$node.parentNode.removeChild(old.$node);
|
|
76938
|
+
}
|
|
76939
|
+
}
|
|
76940
|
+
/************************************************************
|
|
76926
76941
|
* Append one inter-event message. Kept in a bounded buffer so
|
|
76927
76942
|
* view/filter switches repaint from memory. Shared by the legacy
|
|
76928
76943
|
* C_YUI_WINDOW (setup_dev) and the modal (build_dev_panel).
|
|
@@ -76940,9 +76955,6 @@ function info_traffic(title, msg, direction, size) {
|
|
|
76940
76955
|
}
|
|
76941
76956
|
let route = dev_route();
|
|
76942
76957
|
if (route !== "window") console_traffic(title, jn, direction, size);
|
|
76943
|
-
let logger = document.getElementById("developer-traffic-logger");
|
|
76944
|
-
if (!logger || route === "console") return;
|
|
76945
|
-
ensure_dev_style();
|
|
76946
76958
|
let event = jn && jn.event ? String(jn.event) : "(no event)";
|
|
76947
76959
|
let kw = jn && jn.kw && typeof jn.kw === "object" ? jn.kw : null;
|
|
76948
76960
|
let command = kw && typeof kw.command === "string" ? kw.command : "";
|
|
@@ -76964,11 +76976,10 @@ function info_traffic(title, msg, direction, size) {
|
|
|
76964
76976
|
hay,
|
|
76965
76977
|
$node: null
|
|
76966
76978
|
};
|
|
76967
|
-
|
|
76968
|
-
|
|
76969
|
-
|
|
76970
|
-
|
|
76971
|
-
}
|
|
76979
|
+
push_entry(entry);
|
|
76980
|
+
let logger = document.getElementById("developer-traffic-logger");
|
|
76981
|
+
if (!logger || route === "console") return;
|
|
76982
|
+
ensure_dev_style();
|
|
76972
76983
|
if (!entry_hidden(entry, build_filter_ctx())) {
|
|
76973
76984
|
let node = render_entry(entry);
|
|
76974
76985
|
entry.$node = node;
|
|
@@ -76989,15 +77000,8 @@ function info_log(level, msg, hora) {
|
|
|
76989
77000
|
if (__in_info_log__) return;
|
|
76990
77001
|
if (level === "error") LOG_ERR_COUNT++;
|
|
76991
77002
|
else if (level === "warning") LOG_WARN_COUNT++;
|
|
76992
|
-
if (dev_route() === "console") {
|
|
76993
|
-
update_stats();
|
|
76994
|
-
return;
|
|
76995
|
-
}
|
|
76996
|
-
let logger = document.getElementById("developer-traffic-logger");
|
|
76997
|
-
if (!logger) return;
|
|
76998
77003
|
__in_info_log__ = true;
|
|
76999
77004
|
try {
|
|
77000
|
-
ensure_dev_style();
|
|
77001
77005
|
let lvl = level || "debug";
|
|
77002
77006
|
let text;
|
|
77003
77007
|
if (lvl === "json") {
|
|
@@ -77008,21 +77012,24 @@ function info_log(level, msg, hora) {
|
|
|
77008
77012
|
}
|
|
77009
77013
|
if (text.length > 4e3) text = text.slice(0, 4e3) + "\n…(truncated)";
|
|
77010
77014
|
} else text = is_string(msg) ? msg : String(msg);
|
|
77015
|
+
let ts = is_string(hora) && hora.length >= 23 ? hora.slice(11, 23) : traffic_now();
|
|
77011
77016
|
let entry = {
|
|
77012
77017
|
kind: "log",
|
|
77013
77018
|
level: lvl,
|
|
77014
77019
|
text,
|
|
77015
77020
|
dir: 0,
|
|
77016
77021
|
size: 0,
|
|
77017
|
-
ts
|
|
77022
|
+
ts,
|
|
77018
77023
|
hay: (lvl + " " + text).toLowerCase(),
|
|
77019
77024
|
$node: null
|
|
77020
77025
|
};
|
|
77021
|
-
|
|
77022
|
-
|
|
77023
|
-
|
|
77024
|
-
|
|
77026
|
+
push_entry(entry);
|
|
77027
|
+
let logger = document.getElementById("developer-traffic-logger");
|
|
77028
|
+
if (!logger || dev_route() === "console") {
|
|
77029
|
+
update_stats();
|
|
77030
|
+
return;
|
|
77025
77031
|
}
|
|
77032
|
+
ensure_dev_style();
|
|
77026
77033
|
if (!entry_hidden(entry, build_filter_ctx())) {
|
|
77027
77034
|
let node = render_entry(entry);
|
|
77028
77035
|
entry.$node = node;
|
|
@@ -77360,7 +77367,11 @@ function build_control_bar() {
|
|
|
77360
77367
|
type: "search",
|
|
77361
77368
|
"data-role": "search",
|
|
77362
77369
|
placeholder: t("filter events / payload"),
|
|
77363
|
-
"data-i18n-placeholder": "filter events / payload"
|
|
77370
|
+
"data-i18n-placeholder": "filter events / payload",
|
|
77371
|
+
title: t("filter events / payload"),
|
|
77372
|
+
"data-i18n-title": "filter events / payload",
|
|
77373
|
+
"aria-label": t("filter events / payload"),
|
|
77374
|
+
"data-i18n-aria-label": "filter events / payload"
|
|
77364
77375
|
},
|
|
77365
77376
|
"",
|
|
77366
77377
|
{ input: (ev) => {
|
|
@@ -77368,6 +77379,29 @@ function build_control_bar() {
|
|
|
77368
77379
|
rerender_all();
|
|
77369
77380
|
} }
|
|
77370
77381
|
];
|
|
77382
|
+
let search_clear = [
|
|
77383
|
+
"button",
|
|
77384
|
+
{
|
|
77385
|
+
class: "YDEV_CHIP YDEV_SEARCH_CLEAR",
|
|
77386
|
+
type: "button",
|
|
77387
|
+
title: t("clear the filter"),
|
|
77388
|
+
"data-i18n-title": "clear the filter",
|
|
77389
|
+
"aria-label": t("clear the filter"),
|
|
77390
|
+
"data-i18n-aria-label": "clear the filter"
|
|
77391
|
+
},
|
|
77392
|
+
"✕",
|
|
77393
|
+
{ click: (ev) => {
|
|
77394
|
+
ev.stopPropagation();
|
|
77395
|
+
let $bar = ev.currentTarget.closest(".YDEV_BAR");
|
|
77396
|
+
let $input = $bar ? $bar.querySelector(".YDEV_SEARCH") : null;
|
|
77397
|
+
if ($input) {
|
|
77398
|
+
$input.value = "";
|
|
77399
|
+
$input.focus();
|
|
77400
|
+
}
|
|
77401
|
+
SEARCH_TEXT = "";
|
|
77402
|
+
rerender_all();
|
|
77403
|
+
} }
|
|
77404
|
+
];
|
|
77371
77405
|
let copy = [
|
|
77372
77406
|
"button",
|
|
77373
77407
|
{
|
|
@@ -77435,7 +77469,7 @@ function build_control_bar() {
|
|
|
77435
77469
|
sep(),
|
|
77436
77470
|
grp("show", dir_chips),
|
|
77437
77471
|
sep(),
|
|
77438
|
-
grp("find", [search]),
|
|
77472
|
+
grp("find", [search, search_clear]),
|
|
77439
77473
|
sep(),
|
|
77440
77474
|
grp("log", [copy, clear])
|
|
77441
77475
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuneta/gobj-ui",
|
|
3
|
-
"version": "7.23.
|
|
3
|
+
"version": "7.23.175",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/gobj-ui.cjs.js",
|
|
6
6
|
"module": "dist/gobj-ui.es.js",
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@rollup/plugin-terser": "^1.0.0",
|
|
32
32
|
"@vitest/coverage-v8": "^4.1.10",
|
|
33
|
-
"@yuneta/gobj-js": "^7.22.
|
|
33
|
+
"@yuneta/gobj-js": "^7.22.2",
|
|
34
34
|
"vite": "^8.2.1",
|
|
35
35
|
"vitest": "^4.1.10"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@antv/g6": "^5.1.0",
|
|
39
|
-
"@yuneta/gobj-js": "^7.22.
|
|
39
|
+
"@yuneta/gobj-js": "^7.22.2",
|
|
40
40
|
"bulma": "^1.0.4",
|
|
41
41
|
"i18next": "^26.3.6",
|
|
42
42
|
"maplibre-gl": "^6.4.1",
|
package/src/yui_dev.js
CHANGED
|
@@ -82,7 +82,8 @@ const TRAFFIC_TS_FIELDS = {
|
|
|
82
82
|
* clear captured traffic, compact, console, copied, copy,
|
|
83
83
|
* copy visible traffic to clipboard, creation, data, detailed,
|
|
84
84
|
* dev window and browser console, dev window only, developer,
|
|
85
|
-
* errors, expand, expanded, filter events / payload,
|
|
85
|
+
* clear the filter, errors, expand, expanded, filter events / payload,
|
|
86
|
+
* find, i18n,
|
|
86
87
|
* i18next debug output, incoming, log, machine trace shape,
|
|
87
88
|
* metadata, name only, outgoing, output, periodic, schema, show,
|
|
88
89
|
* show this section in the expanded view, simple mach,
|
|
@@ -319,12 +320,19 @@ function build_filter_ctx()
|
|
|
319
320
|
inc: dev_num("dev_filter_in", 1),
|
|
320
321
|
err: dev_num("dev_filter_err", 1),
|
|
321
322
|
search: SEARCH_TEXT,
|
|
323
|
+
view: dev_view(),
|
|
322
324
|
};
|
|
323
325
|
}
|
|
324
326
|
|
|
325
327
|
function entry_hidden(e, ctx)
|
|
326
328
|
{
|
|
327
329
|
if(e.kind === "log") {
|
|
330
|
+
/* A `json` line is a PAYLOAD (the kw the trace dumps with ev_kw or a
|
|
331
|
+
* publication): the Compact and Name only views promise one line
|
|
332
|
+
* per message, so they leave it out. Its level says what it is. */
|
|
333
|
+
if(e.level === "json" && (ctx.view === "name" || ctx.view === "compact")) {
|
|
334
|
+
return true;
|
|
335
|
+
}
|
|
328
336
|
/* Mirrored console logs respect the search box only — not the
|
|
329
337
|
* in/out/err traffic filters, which are about DIRECTION and a
|
|
330
338
|
* log has none. What is traced at all is the runtime's trace
|
|
@@ -930,6 +938,21 @@ function append_and_follow(logger, node)
|
|
|
930
938
|
}
|
|
931
939
|
}
|
|
932
940
|
|
|
941
|
+
/************************************************************
|
|
942
|
+
* Keep one entry in the bounded buffer, dropping the oldest
|
|
943
|
+
* (and its row, if painted).
|
|
944
|
+
************************************************************/
|
|
945
|
+
function push_entry(entry)
|
|
946
|
+
{
|
|
947
|
+
TRAFFIC_LOG.push(entry);
|
|
948
|
+
if(TRAFFIC_LOG.length > TRAFFIC_MAX) {
|
|
949
|
+
let old = TRAFFIC_LOG.shift();
|
|
950
|
+
if(old.$node && old.$node.parentNode) {
|
|
951
|
+
old.$node.parentNode.removeChild(old.$node);
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
|
|
933
956
|
/************************************************************
|
|
934
957
|
* Append one inter-event message. Kept in a bounded buffer so
|
|
935
958
|
* view/filter switches repaint from memory. Shared by the legacy
|
|
@@ -958,16 +981,6 @@ function info_traffic(title, msg, direction, size)
|
|
|
958
981
|
console_traffic(title, jn, direction, size);
|
|
959
982
|
}
|
|
960
983
|
|
|
961
|
-
/* Window side: skip when routed to the console only, or when the window
|
|
962
|
-
* is not mounted (closed). No fallback console dump — console_traffic
|
|
963
|
-
* above already covered every route that wants console output. */
|
|
964
|
-
let logger = document.getElementById('developer-traffic-logger');
|
|
965
|
-
if(!logger || route === "console") {
|
|
966
|
-
return;
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
ensure_dev_style();
|
|
970
|
-
|
|
971
984
|
let event = (jn && jn.event) ? String(jn.event) : "(no event)";
|
|
972
985
|
let kw = (jn && jn.kw && typeof jn.kw === "object") ? jn.kw : null;
|
|
973
986
|
let command = (kw && typeof kw.command === "string") ? kw.command : "";
|
|
@@ -985,14 +998,16 @@ function info_traffic(title, msg, direction, size)
|
|
|
985
998
|
kw: kw, jn: jn, hay: hay, $node: null,
|
|
986
999
|
};
|
|
987
1000
|
|
|
988
|
-
|
|
1001
|
+
push_entry(entry);
|
|
989
1002
|
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
1003
|
+
/* Window side: the entry is buffered above whatever happens, so the
|
|
1004
|
+
* window shows what arrived before it was opened. Painted only when the
|
|
1005
|
+
* window is mounted and not routed to the console only. */
|
|
1006
|
+
let logger = document.getElementById('developer-traffic-logger');
|
|
1007
|
+
if(!logger || route === "console") {
|
|
1008
|
+
return;
|
|
995
1009
|
}
|
|
1010
|
+
ensure_dev_style();
|
|
996
1011
|
|
|
997
1012
|
if(!entry_hidden(entry, build_filter_ctx())) {
|
|
998
1013
|
let node = render_entry(entry);
|
|
@@ -1033,20 +1048,8 @@ function info_log(level, msg, hora)
|
|
|
1033
1048
|
} else if(level === "warning") {
|
|
1034
1049
|
LOG_WARN_COUNT++;
|
|
1035
1050
|
}
|
|
1036
|
-
/* Routed to the console only: the line already reached the browser
|
|
1037
|
-
* console (gobj-js gate left on), so don't mirror it into the window —
|
|
1038
|
-
* but keep the status-line tally live if the window is open. */
|
|
1039
|
-
if(dev_route() === "console") {
|
|
1040
|
-
update_stats();
|
|
1041
|
-
return;
|
|
1042
|
-
}
|
|
1043
|
-
let logger = document.getElementById('developer-traffic-logger');
|
|
1044
|
-
if(!logger) {
|
|
1045
|
-
return;
|
|
1046
|
-
}
|
|
1047
1051
|
__in_info_log__ = true;
|
|
1048
1052
|
try {
|
|
1049
|
-
ensure_dev_style();
|
|
1050
1053
|
let lvl = level || "debug";
|
|
1051
1054
|
let text;
|
|
1052
1055
|
if(lvl === "json") {
|
|
@@ -1061,18 +1064,25 @@ function info_log(level, msg, hora)
|
|
|
1061
1064
|
} else {
|
|
1062
1065
|
text = is_string(msg) ? msg : String(msg);
|
|
1063
1066
|
}
|
|
1067
|
+
/* The time the line was WRITTEN, which the backlog replayed to a
|
|
1068
|
+
* late sink makes different from now: `hora` is gobj-js's local
|
|
1069
|
+
* timestamp (YYYY-MM-DDTHH:MM:SS.mmm±hhmm). */
|
|
1070
|
+
let ts = (is_string(hora) && hora.length >= 23) ? hora.slice(11, 23) : traffic_now();
|
|
1064
1071
|
let entry = {
|
|
1065
1072
|
kind: "log", level: lvl, text: text,
|
|
1066
|
-
dir: 0, size: 0, ts:
|
|
1073
|
+
dir: 0, size: 0, ts: ts,
|
|
1067
1074
|
hay: (lvl + " " + text).toLowerCase(), $node: null,
|
|
1068
1075
|
};
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1076
|
+
/* Buffered always: the window shows what the app logged before it
|
|
1077
|
+
* was opened. Painted only when mounted and not routed to the
|
|
1078
|
+
* console only (the line already reached the console). */
|
|
1079
|
+
push_entry(entry);
|
|
1080
|
+
let logger = document.getElementById('developer-traffic-logger');
|
|
1081
|
+
if(!logger || dev_route() === "console") {
|
|
1082
|
+
update_stats();
|
|
1083
|
+
return;
|
|
1075
1084
|
}
|
|
1085
|
+
ensure_dev_style();
|
|
1076
1086
|
if(!entry_hidden(entry, build_filter_ctx())) {
|
|
1077
1087
|
let node = render_entry(entry);
|
|
1078
1088
|
entry.$node = node;
|
|
@@ -1428,6 +1438,8 @@ function build_control_bar()
|
|
|
1428
1438
|
class: 'YDEV_SEARCH', type: 'search', 'data-role': 'search',
|
|
1429
1439
|
placeholder: t('filter events / payload'),
|
|
1430
1440
|
'data-i18n-placeholder': 'filter events / payload',
|
|
1441
|
+
title: t('filter events / payload'), 'data-i18n-title': 'filter events / payload',
|
|
1442
|
+
'aria-label': t('filter events / payload'), 'data-i18n-aria-label': 'filter events / payload',
|
|
1431
1443
|
}, '', {
|
|
1432
1444
|
input: (ev) => {
|
|
1433
1445
|
SEARCH_TEXT = String(ev.target.value || '').toLowerCase().trim();
|
|
@@ -1435,6 +1447,26 @@ function build_control_bar()
|
|
|
1435
1447
|
}
|
|
1436
1448
|
}];
|
|
1437
1449
|
|
|
1450
|
+
/* Its own button: a `type=search` input shows a clear cross in some
|
|
1451
|
+
* browsers only (not in Firefox). */
|
|
1452
|
+
let search_clear = ['button', {
|
|
1453
|
+
class: 'YDEV_CHIP YDEV_SEARCH_CLEAR', type: 'button',
|
|
1454
|
+
title: t('clear the filter'), 'data-i18n-title': 'clear the filter',
|
|
1455
|
+
'aria-label': t('clear the filter'), 'data-i18n-aria-label': 'clear the filter',
|
|
1456
|
+
}, '✕', {
|
|
1457
|
+
click: (ev) => {
|
|
1458
|
+
ev.stopPropagation();
|
|
1459
|
+
let $bar = ev.currentTarget.closest('.YDEV_BAR');
|
|
1460
|
+
let $input = $bar ? $bar.querySelector('.YDEV_SEARCH') : null;
|
|
1461
|
+
if($input) {
|
|
1462
|
+
$input.value = '';
|
|
1463
|
+
$input.focus();
|
|
1464
|
+
}
|
|
1465
|
+
SEARCH_TEXT = '';
|
|
1466
|
+
rerender_all();
|
|
1467
|
+
}
|
|
1468
|
+
}];
|
|
1469
|
+
|
|
1438
1470
|
let copy = ['button', {class: 'YDEV_CHIP', type: 'button',
|
|
1439
1471
|
title: t('copy visible traffic to clipboard'),
|
|
1440
1472
|
'data-i18n-title': 'copy visible traffic to clipboard',
|
|
@@ -1469,7 +1501,7 @@ function build_control_bar()
|
|
|
1469
1501
|
grp('output', [output_seg]), sep(),
|
|
1470
1502
|
grp('view', [view_seg]), expand_grp, sep(),
|
|
1471
1503
|
grp('show', dir_chips), sep(),
|
|
1472
|
-
grp('find', [search]), sep(),
|
|
1504
|
+
grp('find', [search, search_clear]), sep(),
|
|
1473
1505
|
grp('log', [copy, clear]),
|
|
1474
1506
|
]]);
|
|
1475
1507
|
}
|