@yuneta/gobj-ui 7.23.171 → 7.23.172

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.
@@ -1,5 +1,4 @@
1
- import * as gobj_js from "@yuneta/gobj-js";
2
- import { SDATA, SDATA_END, clean_name, createElement2, createOneHtml, create_template_record, data_type_t, debounce, delete_from_list, duplicate_objects, empty_json, empty_string, escapeHtml, event_flag_t, flat_diff, gclass_create, gclass_find_by_name, gclass_flag_t, getPositionRelativeToBody, gobj_bottom_gobj, gobj_change_state, gobj_command, gobj_create, gobj_create_pure_child, gobj_create_service, gobj_current_state, gobj_destroy, gobj_find_child, gobj_find_service, gobj_full_name, gobj_gclass_name, gobj_is_destroying, gobj_is_playing, gobj_is_pure_child, gobj_is_running, gobj_is_service, gobj_is_volatil, gobj_match_children, gobj_name, gobj_parent, gobj_post_event, gobj_publish_event, gobj_read_attr, gobj_read_bool_attr, gobj_read_integer_attr, gobj_read_pointer_attr, gobj_read_str_attr, gobj_save_persistent_attrs, gobj_send_event, gobj_set_trace_machine_format, gobj_short_name, gobj_start, gobj_start_tree, gobj_stop, gobj_stop_children, gobj_subscribe_event, gobj_unsubscribe_event, gobj_write_attr, gobj_write_bool_attr, gobj_write_integer_attr, gobj_write_str_attr, gobj_yuno, gobj_yuno_name, is_array, is_boolean, is_date, is_gobj, is_null, is_number, is_object, is_string, json2flat, json_deep_copy, json_object_size, json_object_update, json_object_update_missing, json_size, kw_clone_by_keys, kw_flag_t, kw_get_dict, kw_get_dict_value, kw_get_int, kw_get_local_storage_value, kw_get_str, kw_has_key, kw_set_dict_value, kw_set_local_storage_value, kwid_find_one_record, kwid_new_dict, log_error, log_warning, msg_iev_get_stack, parseBoolean, parseSVG, refresh_language, safeSrc, sdata_flag_t, set_console_log_enabled, set_log_callback, sprintf, str_in_list, template_get_field_desc, trace_msg, treedb_decoder_fkey, treedb_encoder_fkey, treedb_get_field_desc, treedb_hook_data_size } from "@yuneta/gobj-js";
1
+ import { SDATA, SDATA_END, clean_name, createElement2, createOneHtml, create_template_record, data_type_t, debounce, delete_from_list, duplicate_objects, empty_json, empty_string, escapeHtml, event_flag_t, flat_diff, gclass_create, gclass_find_by_name, gclass_flag_t, getPositionRelativeToBody, gobj_bottom_gobj, gobj_change_state, gobj_command, gobj_create, gobj_create_pure_child, gobj_create_service, gobj_current_state, gobj_destroy, gobj_find_child, gobj_find_service, gobj_full_name, gobj_gclass_name, gobj_get_gclass_trace_level2, gobj_global_trace_level, gobj_global_trace_no_level, gobj_is_destroying, gobj_is_playing, gobj_is_pure_child, gobj_is_running, gobj_is_service, gobj_is_volatil, gobj_match_children, gobj_name, gobj_parent, gobj_post_event, gobj_publish_event, gobj_read_attr, gobj_read_bool_attr, gobj_read_integer_attr, gobj_read_pointer_attr, gobj_read_str_attr, gobj_save_persistent_attrs, gobj_send_event, gobj_set_trace_machine_format, gobj_short_name, gobj_start, gobj_start_tree, gobj_stop, gobj_stop_children, gobj_subscribe_event, gobj_unsubscribe_event, gobj_write_attr, gobj_write_bool_attr, gobj_write_integer_attr, gobj_write_str_attr, gobj_yuno, gobj_yuno_name, is_array, is_boolean, is_date, is_gobj, is_null, is_number, is_object, is_string, json2flat, json_deep_copy, json_object_size, json_object_update, json_object_update_missing, json_size, kw_clone_by_keys, kw_flag_t, kw_get_dict, kw_get_dict_value, kw_get_int, kw_get_local_storage_value, kw_get_str, kw_has_key, kw_set_dict_value, kw_set_local_storage_value, kwid_find_one_record, kwid_new_dict, log_error, log_warning, msg_iev_get_stack, parseBoolean, parseSVG, refresh_language, safeSrc, sdata_flag_t, set_console_log_enabled, set_log_callback, sprintf, str_in_list, template_get_field_desc, trace_level_t, trace_msg, treedb_decoder_fkey, treedb_encoder_fkey, treedb_get_field_desc, treedb_hook_data_size } from "@yuneta/gobj-js";
3
2
  import i18next, { t } from "i18next";
4
3
  import TomSelect from "tom-select";
5
4
  import { createJSONEditor } from "vanilla-jsoneditor";
@@ -76152,86 +76151,6 @@ function register_c_yui_period() {
76152
76151
  return create_gclass(GCLASS_NAME);
76153
76152
  }
76154
76153
  //#endregion
76155
- //#region src/dev_machine_trace.js
76156
- /***********************************************************************
76157
- * dev_machine_trace.js
76158
- *
76159
- * Reading a MACHINE trace line back.
76160
- *
76161
- * The developer window mirrors the runtime's log, and the
76162
- * `machine` trace is most of what lands there once it is on.
76163
- * Those lines arrive as text, so to the window they were just
76164
- * "a debug log" -- which is why its `Periodic` filter could
76165
- * not touch them: the filter works on a signature, and every
76166
- * mirrored log carried the same one (`log:debug`).
76167
- *
76168
- * This gives a machine line back its EVENT, which is the only
76169
- * thing that says whether it is noise. Both formats gobj-js
76170
- * emits (`gobj_set_trace_machine_format`):
76171
- *
76172
- * 0 verbose "🔄 mach(C_TIMER^t), st: ST_IDLE, ev: EV_TIMEOUT, ac: …"
76173
- * "<- mach(C_TIMER^t), st: ST_IDLE, ev: EV_TIMEOUT, ret: 0"
76174
- * 1 compact "🔄 EV_TIMEOUT C_TIMER^t ST_IDLE from C_TIMER^t"
76175
- *
76176
- * Copyright (c) 2026, ArtGins.
76177
- * All Rights Reserved.
76178
- ***********************************************************************/
76179
- var MACHINE_MARK_RE = /\bmach\(/;
76180
- var EVENT_FIELD_RE = /\bev:\s*([A-Za-z0-9_]+)/;
76181
- var EVENT_HEAD_RE = /^\s*\S{0,4}\s*(EV_[A-Za-z0-9_]+)(?=\s|$)/;
76182
- var PERIODIC_EVENT_RE = /PERIODIC|TIMEOUT|HEARTBEAT|PING|POLL/i;
76183
- /************************************************************
76184
- * The event of a machine trace line, or "" when the line is
76185
- * not one.
76186
- *
76187
- * "" is also the answer for a machine line that carries no
76188
- * event -- a state change ("new st(…), prev st(…)") -- and
76189
- * that is right: what it reports is not repetitive.
76190
- ************************************************************/
76191
- function machine_event_of(text) {
76192
- if (typeof text !== "string" || text.length === 0) return "";
76193
- if (MACHINE_MARK_RE.test(text)) {
76194
- let m = EVENT_FIELD_RE.exec(text);
76195
- return m ? m[1] : "";
76196
- }
76197
- let m = EVENT_HEAD_RE.exec(text);
76198
- return m ? m[1] : "";
76199
- }
76200
- /************************************************************
76201
- * Is this event one of the ones that arrive by themselves,
76202
- * for ever, and say nothing about what the app is doing?
76203
- ************************************************************/
76204
- function is_periodic_event(event_name) {
76205
- if (!event_name) return false;
76206
- return PERIODIC_EVENT_RE.test(event_name);
76207
- }
76208
- /************************************************************
76209
- * The signature of a mirrored log line: what the window
76210
- * counts it under and what its filters match on.
76211
- *
76212
- * A machine line is signed by its EVENT, so a hundred
76213
- * EV_TIMEOUTs are one recurring thing rather than a hundred
76214
- * anonymous debug lines. Everything else is signed by its
76215
- * level, as before.
76216
- ************************************************************/
76217
- function log_signature(level, text) {
76218
- let event = machine_event_of(text);
76219
- if (event) return "mach:" + event;
76220
- return "log:" + (level || "debug");
76221
- }
76222
- /************************************************************
76223
- * May the periodic filter hide this log line?
76224
- *
76225
- * Only a machine transition, and only below warning level.
76226
- * An ERROR that names EV_TIMEOUT -- "Event NOT DEFINED in
76227
- * state", which is exactly the loud one the framework wants
76228
- * seen -- must never disappear because of the word in it.
76229
- ************************************************************/
76230
- function log_is_periodic(level, text) {
76231
- if (level === "error" || level === "warning") return false;
76232
- return is_periodic_event(machine_event_of(text));
76233
- }
76234
- //#endregion
76235
76154
  //#region src/yui_dev.js
76236
76155
  /***********************************************************************
76237
76156
  * ui_dev.js
@@ -76249,10 +76168,7 @@ function log_is_periodic(level, text) {
76249
76168
  * losing history. Reopening the window repaints the buffer.
76250
76169
  ***********************************************************************/
76251
76170
  var TRAFFIC_MAX = 600;
76252
- var PERIODIC_THRESHOLD = 5;
76253
- var PERIODIC_RE = /PERIODIC|TIMEOUT|HEARTBEAT|PING/i;
76254
76171
  var TRAFFIC_LOG = [];
76255
- var TRAFFIC_COUNTS = /* @__PURE__ */ new Map();
76256
76172
  var SEARCH_TEXT = "";
76257
76173
  var LOG_ERR_COUNT = 0;
76258
76174
  var LOG_WARN_COUNT = 0;
@@ -76269,39 +76185,53 @@ var TRAFFIC_TS_FIELDS = {
76269
76185
  };
76270
76186
  var TRACE_DEFS = [
76271
76187
  [
76272
- "trace_automata",
76273
76188
  "automata",
76274
- trace_automata
76189
+ "automata",
76190
+ "trace every event of every automaton",
76191
+ automata_state,
76192
+ toggle_automata
76275
76193
  ],
76276
76194
  [
76277
- "trace_creation",
76278
76195
  "creation",
76279
- trace_creation
76196
+ "creation",
76197
+ "trace the creation and destruction of gobjs",
76198
+ () => global_bit(trace_level_t.TRACE_CREATE_DELETE),
76199
+ () => toggle_global("create_delete")
76280
76200
  ],
76281
76201
  [
76282
- "trace_start_stop",
76202
+ "start_stop",
76283
76203
  "start / stop",
76284
- trace_start_stop
76204
+ "trace the start and stop of gobjs",
76205
+ () => global_bit(trace_level_t.TRACE_START_STOP),
76206
+ () => toggle_global("start_stop")
76285
76207
  ],
76286
76208
  [
76287
- "trace_subscriptions",
76288
76209
  "subscriptions",
76289
- trace_subscriptions
76210
+ "subscriptions",
76211
+ "trace subscriptions and publications",
76212
+ () => global_bit(trace_level_t.TRACE_SUBSCRIPTIONS),
76213
+ () => toggle_global("subscriptions")
76290
76214
  ],
76291
76215
  [
76292
- "trace_i18n",
76293
76216
  "i18n",
76294
- trace_i18n
76217
+ "i18n",
76218
+ "i18next debug output",
76219
+ i18n_state,
76220
+ toggle_i18n
76295
76221
  ],
76296
76222
  [
76297
- "trace_traffic",
76298
76223
  "traffic",
76299
- trace_traffic
76224
+ "traffic",
76225
+ "trace the messages to and from the backend",
76226
+ traffic_state,
76227
+ toggle_traffic
76300
76228
  ],
76301
76229
  [
76302
- "no_poll",
76303
- "no poll",
76304
- set_no_poll
76230
+ "periodic",
76231
+ "periodic",
76232
+ "trace the periodic timer event",
76233
+ periodic_state,
76234
+ toggle_periodic
76305
76235
  ]
76306
76236
  ];
76307
76237
  /******************************
@@ -76368,45 +76298,24 @@ function dev_view() {
76368
76298
  let v = kw_get_local_storage_value("dev_view_mode", "detailed", false);
76369
76299
  return v === "compact" || v === "name" || v === "full" ? v : "detailed";
76370
76300
  }
76371
- var HIDE_PERIODIC_DEFAULT = 1;
76372
76301
  var SIMPLE_MACH_DEFAULT = 1;
76373
76302
  var SIMPLE_MACH_KEY = "dev_mach_simple";
76374
76303
  function dev_simple_mach() {
76375
76304
  return dev_num(SIMPLE_MACH_KEY, SIMPLE_MACH_DEFAULT) ? 1 : 0;
76376
76305
  }
76377
- function dev_hide_periodic() {
76378
- return dev_num("dev_hide_periodic", HIDE_PERIODIC_DEFAULT) ? true : false;
76379
- }
76380
76306
  function dev_route() {
76381
76307
  let v = kw_get_local_storage_value("dev_output_route", "both", false);
76382
76308
  return v === "window" || v === "console" ? v : "both";
76383
76309
  }
76384
76310
  function apply_console_route() {
76385
76311
  set_console_log_enabled(dev_route() !== "window");
76386
- if (typeof gobj_js.set_console_log_filter === "function") gobj_js.set_console_log_filter((level, msg) => {
76387
- if (!dev_hide_periodic()) return true;
76388
- return !log_is_periodic(level, is_string(msg) ? msg : String(msg));
76389
- });
76390
- else if (!__console_filter_warned__) {
76391
- __console_filter_warned__ = true;
76392
- console.warn("yui_dev: gobj-js has no set_console_log_filter (needs >= 7.13.6): the Periodic filter applies to this window only, not to the console");
76393
- }
76394
76312
  }
76395
- var __console_filter_warned__ = false;
76396
76313
  function console_traffic(title, jn, direction, size) {
76397
76314
  let event = jn && jn.event ? String(jn.event) : "(no event)";
76398
76315
  let kw = jn && jn.kw && typeof jn.kw === "object" ? jn.kw : jn;
76399
76316
  let color = direction === 2 ? "#16a34a" : direction === 3 ? "#dc2626" : "#2563eb";
76400
76317
  window.console.log("%c" + dir_arrow(direction) + " " + (title ? "[" + title + "] " : "") + event + (size ? " (" + size + "b)" : ""), "color:" + color, kw);
76401
76318
  }
76402
- function dev_muted() {
76403
- let a = kw_get_local_storage_value("dev_muted_events", [], false);
76404
- if (!Array.isArray(a)) a = [];
76405
- return new Set(a);
76406
- }
76407
- function dev_set_muted(set) {
76408
- kw_set_local_storage_value("dev_muted_events", Array.from(set));
76409
- }
76410
76319
  function set_view(v) {
76411
76320
  kw_set_local_storage_value("dev_view_mode", v);
76412
76321
  rerender_all();
@@ -76422,54 +76331,25 @@ function set_output_route(v) {
76422
76331
  function toggle_pref(key, def) {
76423
76332
  let v = dev_num(key, def) ? 0 : 1;
76424
76333
  kw_set_local_storage_value(key, v);
76425
- apply_console_route();
76426
- rerender_all();
76427
- refresh_dev_chrome();
76428
- }
76429
- function mute_signature(sig) {
76430
- let set = dev_muted();
76431
- set.add(sig);
76432
- dev_set_muted(set);
76433
- rerender_all();
76434
- refresh_dev_chrome();
76435
- }
76436
- function unmute_signature(sig) {
76437
- let set = dev_muted();
76438
- set.delete(sig);
76439
- dev_set_muted(set);
76440
76334
  rerender_all();
76441
76335
  refresh_dev_chrome();
76442
76336
  }
76443
76337
  /******************************
76444
76338
  * Filtering
76445
76339
  ******************************/
76446
- function traffic_signature(event, command) {
76447
- return command ? event + " · " + command : event;
76448
- }
76449
- function traffic_is_periodic(sig) {
76450
- if (PERIODIC_RE.test(sig)) return true;
76451
- return (TRAFFIC_COUNTS.get(sig) || 0) >= PERIODIC_THRESHOLD;
76452
- }
76453
76340
  function build_filter_ctx() {
76454
76341
  return {
76455
76342
  out: dev_num("dev_filter_out", 1),
76456
76343
  inc: dev_num("dev_filter_in", 1),
76457
76344
  err: dev_num("dev_filter_err", 1),
76458
- muted: dev_muted(),
76459
- hide_periodic: dev_hide_periodic(),
76460
76345
  search: SEARCH_TEXT
76461
76346
  };
76462
76347
  }
76463
76348
  function entry_hidden(e, ctx) {
76464
- if (e.kind === "log") {
76465
- if (ctx.hide_periodic && e.periodic) return true;
76466
- return !!(ctx.search && e.hay.indexOf(ctx.search) < 0);
76467
- }
76349
+ if (e.kind === "log") return !!(ctx.search && e.hay.indexOf(ctx.search) < 0);
76468
76350
  if (e.dir === 1 && !ctx.out) return true;
76469
76351
  if (e.dir === 2 && !ctx.inc) return true;
76470
76352
  if (e.dir === 3 && !ctx.err) return true;
76471
- if (ctx.muted.has(e.sig)) return true;
76472
- if (ctx.hide_periodic && traffic_is_periodic(e.sig)) return true;
76473
76353
  if (ctx.search && e.hay.indexOf(ctx.search) < 0) return true;
76474
76354
  return false;
76475
76355
  }
@@ -76493,11 +76373,6 @@ function ensure_dev_style() {
76493
76373
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
76494
76374
  }
76495
76375
  .YDEV_LOG { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 6px 10px; }
76496
- .YDEV_MUTED {
76497
- display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
76498
- padding: 4px 10px; border-bottom: 1px solid rgba(0,0,0,0.08); font-size: 12px;
76499
- }
76500
- .YDEV_MUTED:empty { display: none; }
76501
76376
  .YDEV_STATS {
76502
76377
  flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 14px;
76503
76378
  padding: 6px 10px; border-top: 1px solid rgba(0,0,0,0.1);
@@ -76529,7 +76404,6 @@ function ensure_dev_style() {
76529
76404
  .YDEV_CHIP.s-in.is-active { background: rgba(5,150,105,0.16); border-color: #059669; color: #059669; }
76530
76405
  .YDEV_CHIP.s-err.is-active { background: rgba(220,38,38,0.16); border-color: #dc2626; color: #dc2626; }
76531
76406
  .YDEV_CHIP[data-dir]:not(.is-active) { opacity: 0.4; text-decoration: line-through; }
76532
- .YDEV_CHIP[data-toggle="periodic"].is-active { background: rgba(217,119,6,0.16); border-color: #d97706; color: #b45309; font-weight: 600; }
76533
76407
  .YDEV_SEG { display: inline-flex; border: 1px solid rgba(0,0,0,0.18); border-radius: 7px; overflow: hidden; }
76534
76408
  .YDEV_SEG_BTN {
76535
76409
  font: inherit; font-size: 12px; padding: 4px 10px; border: 0;
@@ -76543,12 +76417,6 @@ function ensure_dev_style() {
76543
76417
  border: 1px solid rgba(0,0,0,0.18); border-radius: 7px;
76544
76418
  background: transparent; color: inherit;
76545
76419
  }
76546
- .YDEV_MUTED_CHIP {
76547
- font: inherit; font-family: "DejaVu Sans Mono", monospace; font-size: 12px;
76548
- display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px;
76549
- border: 1px solid rgba(217,119,6,0.5); border-radius: 999px;
76550
- background: rgba(217,119,6,0.12); color: #b45309; cursor: pointer;
76551
- }
76552
76420
  .YDEV_STAT.s-out { color: #2563eb; } .YDEV_STAT.s-in { color: #059669; } .YDEV_STAT.s-err { color: #dc2626; }
76553
76421
  .YDEV_STAT.s-warn { color: #d97706; }
76554
76422
  .YDEV_STAT.is-strong { font-weight: 700; }
@@ -76576,10 +76444,7 @@ function ensure_dev_style() {
76576
76444
  .dir-err .TRAFFIC_ARROW, .dir-err .TRAFFIC_EVENT { color: #dc2626; }
76577
76445
  .TRAFFIC_SUMMARY { opacity: 0.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; min-width: 0; }
76578
76446
  .TRAFFIC_META { margin-left: auto; opacity: 0.6; font-size: 11px; white-space: nowrap; }
76579
- .TRAFFIC_MUTE { border: 0; background: transparent; color: inherit; cursor: pointer; opacity: 0; font-size: 12px; padding: 0 2px; flex: 0 0 auto; }
76580
- .TRAFFIC_ENTRY:hover .TRAFFIC_MUTE, .TRAFFIC_LINE:hover .TRAFFIC_MUTE, .TRAFFIC_NAME:hover .TRAFFIC_MUTE { opacity: 0.5; }
76581
- .TRAFFIC_MUTE:hover { opacity: 1 !important; color: #d97706; }
76582
- .TRAFFIC_KW { margin: 2px 0 0 16px; }
76447
+ .TRAFFIC_ENTRY:hover .TRAFFIC_KW { margin: 2px 0 0 16px; }
76583
76448
  .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; }
76584
76449
  .TRAFFIC_ROW { display: flex; gap: 6px; align-items: baseline; }
76585
76450
  .TRAFFIC_BULLET { opacity: 0.45; flex: 0 0 auto; }
@@ -76623,9 +76488,7 @@ details.TRAFFIC_NEST > summary::-webkit-details-marker { display: none; }
76623
76488
  :root[data-theme="dark"] .TRAFFIC_VAL.t-bool, :root[data-theme="dark"] .TRAFFIC_VAL.t-null { color: #c084fc; }
76624
76489
  :root[data-theme="dark"] .YDEV_CHIP.is-active { background: rgba(96,165,250,0.2); border-color: #60a5fa; color: #93c5fd; }
76625
76490
  :root[data-theme="dark"] .YDEV_SEG_BTN.is-active { background: #2563eb; color: #fff; }
76626
- :root[data-theme="dark"] .YDEV_CHIP[data-toggle="periodic"].is-active { background: rgba(217,119,6,0.24); border-color: #f59e0b; color: #fbbf24; }
76627
- :root[data-theme="dark"] .YDEV_MUTED_CHIP { border-color: rgba(245,158,11,0.5); background: rgba(245,158,11,0.16); color: #fbbf24; }
76628
- `;
76491
+ :root[data-theme="dark"] `;
76629
76492
  let $style = document.createElement("style");
76630
76493
  $style.id = "yui-dev-style";
76631
76494
  $style.textContent = css;
@@ -76768,23 +76631,6 @@ function traffic_bullets(obj) {
76768
76631
  /******************************
76769
76632
  * Entry rendering (per view)
76770
76633
  ******************************/
76771
- function mute_button(sig) {
76772
- return [
76773
- "button",
76774
- {
76775
- class: "TRAFFIC_MUTE",
76776
- type: "button",
76777
- title: t("mute this message"),
76778
- "data-i18n-title": "mute this message"
76779
- },
76780
- "⊘",
76781
- { click: (ev) => {
76782
- ev.stopPropagation();
76783
- ev.preventDefault();
76784
- mute_signature(sig);
76785
- } }
76786
- ];
76787
- }
76788
76634
  function event_spans(e) {
76789
76635
  let spans = [[
76790
76636
  "span",
@@ -76822,7 +76668,6 @@ function compact_summary(kw) {
76822
76668
  }
76823
76669
  function render_detailed(e) {
76824
76670
  let head = event_spans(e);
76825
- head.push(mute_button(e.sig));
76826
76671
  head.push([
76827
76672
  "span",
76828
76673
  { class: "TRAFFIC_META" },
@@ -76881,7 +76726,6 @@ function full_sections(payload) {
76881
76726
  }
76882
76727
  function render_full(e) {
76883
76728
  let head = event_spans(e);
76884
- head.push(mute_button(e.sig));
76885
76729
  head.push([
76886
76730
  "span",
76887
76731
  { class: "TRAFFIC_META" },
@@ -76919,7 +76763,6 @@ function render_compact(e) {
76919
76763
  { class: "TRAFFIC_SUMMARY" },
76920
76764
  compact_summary(e.kw)
76921
76765
  ]);
76922
- kids.push(mute_button(e.sig));
76923
76766
  kids.push([
76924
76767
  "span",
76925
76768
  { class: "TRAFFIC_META" },
@@ -76936,7 +76779,6 @@ function render_compact(e) {
76936
76779
  }
76937
76780
  function render_name(e) {
76938
76781
  let kids = event_spans(e);
76939
- kids.push(mute_button(e.sig));
76940
76782
  kids.push([
76941
76783
  "span",
76942
76784
  { class: "TRAFFIC_META" },
@@ -76993,7 +76835,6 @@ function render_entry(e) {
76993
76835
  ******************************/
76994
76836
  function clear_traffic() {
76995
76837
  TRAFFIC_LOG.length = 0;
76996
- TRAFFIC_COUNTS.clear();
76997
76838
  LOG_ERR_COUNT = 0;
76998
76839
  LOG_WARN_COUNT = 0;
76999
76840
  let logger = document.getElementById("developer-traffic-logger");
@@ -77105,7 +76946,6 @@ function info_traffic(title, msg, direction, size) {
77105
76946
  let event = jn && jn.event ? String(jn.event) : "(no event)";
77106
76947
  let kw = jn && jn.kw && typeof jn.kw === "object" ? jn.kw : null;
77107
76948
  let command = kw && typeof kw.command === "string" ? kw.command : "";
77108
- let sig = traffic_signature(event, command);
77109
76949
  let hay = "";
77110
76950
  try {
77111
76951
  hay = (event + " " + command + " " + (kw ? JSON.stringify(kw) : "")).toLowerCase();
@@ -77116,7 +76956,6 @@ function info_traffic(title, msg, direction, size) {
77116
76956
  title: title || "",
77117
76957
  event,
77118
76958
  command,
77119
- sig,
77120
76959
  dir: direction,
77121
76960
  size,
77122
76961
  ts: traffic_now(),
@@ -77126,17 +76965,11 @@ function info_traffic(title, msg, direction, size) {
77126
76965
  $node: null
77127
76966
  };
77128
76967
  TRAFFIC_LOG.push(entry);
77129
- TRAFFIC_COUNTS.set(sig, (TRAFFIC_COUNTS.get(sig) || 0) + 1);
77130
- let crossed = dev_hide_periodic() && TRAFFIC_COUNTS.get(sig) === PERIODIC_THRESHOLD;
77131
76968
  if (TRAFFIC_LOG.length > TRAFFIC_MAX) {
77132
76969
  let old = TRAFFIC_LOG.shift();
77133
- let c = (TRAFFIC_COUNTS.get(old.sig) || 0) - 1;
77134
- if (c <= 0) TRAFFIC_COUNTS.delete(old.sig);
77135
- else TRAFFIC_COUNTS.set(old.sig, c);
77136
76970
  if (old.$node && old.$node.parentNode) old.$node.parentNode.removeChild(old.$node);
77137
76971
  }
77138
- if (crossed) rerender_all();
77139
- else if (!entry_hidden(entry, build_filter_ctx())) {
76972
+ if (!entry_hidden(entry, build_filter_ctx())) {
77140
76973
  let node = render_entry(entry);
77141
76974
  entry.$node = node;
77142
76975
  let ph = logger.querySelector(".YDEV_EMPTY");
@@ -77182,19 +77015,12 @@ function info_log(level, msg, hora) {
77182
77015
  dir: 0,
77183
77016
  size: 0,
77184
77017
  ts: traffic_now(),
77185
- sig: log_signature(lvl, text),
77186
- periodic: log_is_periodic(lvl, text),
77187
77018
  hay: (lvl + " " + text).toLowerCase(),
77188
77019
  $node: null
77189
77020
  };
77190
77021
  TRAFFIC_LOG.push(entry);
77191
77022
  if (TRAFFIC_LOG.length > TRAFFIC_MAX) {
77192
77023
  let old = TRAFFIC_LOG.shift();
77193
- if (old.kind !== "log") {
77194
- let c = (TRAFFIC_COUNTS.get(old.sig) || 0) - 1;
77195
- if (c <= 0) TRAFFIC_COUNTS.delete(old.sig);
77196
- else TRAFFIC_COUNTS.set(old.sig, c);
77197
- }
77198
77024
  if (old.$node && old.$node.parentNode) old.$node.parentNode.removeChild(old.$node);
77199
77025
  }
77200
77026
  if (!entry_hidden(entry, build_filter_ctx())) {
@@ -77212,72 +77038,97 @@ function info_log(level, msg, hora) {
77212
77038
  /******************************
77213
77039
  * Trace toggles
77214
77040
  ******************************/
77215
- function trace_traffic() {
77216
- let v = Number(kw_get_local_storage_value("trace_traffic"));
77217
- if (v) {
77218
- gobj_write_attr(gobj_yuno(), "trace_inter_event", false);
77219
- v = 0;
77220
- } else {
77221
- gobj_write_attr(gobj_yuno(), "trace_inter_event", true);
77222
- gobj_write_attr(gobj_yuno(), "trace_ievent_callback", info_traffic);
77223
- v = 1;
77224
- }
77225
- kw_set_local_storage_value("trace_traffic", v);
77041
+ function yuno_trace_command(command, kw) {
77042
+ let r = gobj_command(gobj_yuno(), command, kw, gobj_yuno());
77043
+ if (!r || r.result < 0) log_error(`yui_dev: ${command} ${JSON.stringify(kw)}: ${r ? r.comment : "no answer"}`);
77226
77044
  refresh_dev_chrome();
77227
77045
  }
77228
- function trace_automata() {
77229
- let v = Number(kw_get_local_storage_value("trace_automata"));
77230
- if (v === 0) v = 1;
77231
- else if (v === 1) v = 2;
77232
- else v = 0;
77233
- gobj_write_attr(gobj_yuno(), "tracing", v);
77234
- kw_set_local_storage_value("trace_automata", v);
77235
- refresh_dev_chrome();
77046
+ function global_bit(bit) {
77047
+ return gobj_global_trace_level() & bit ? 1 : 0;
77236
77048
  }
77237
- function trace_creation() {
77238
- let v = Number(kw_get_local_storage_value("trace_creation"));
77239
- v = v === 0 ? 1 : 0;
77240
- gobj_write_attr(gobj_yuno(), "trace_creation", v);
77241
- kw_set_local_storage_value("trace_creation", v);
77242
- refresh_dev_chrome();
77049
+ var GLOBAL_TRACE_BITS = {
77050
+ "machine": trace_level_t.TRACE_MACHINE,
77051
+ "ev_kw": trace_level_t.TRACE_EV_KW,
77052
+ "create_delete": trace_level_t.TRACE_CREATE_DELETE,
77053
+ "start_stop": trace_level_t.TRACE_START_STOP,
77054
+ "subscriptions": trace_level_t.TRACE_SUBSCRIPTIONS
77055
+ };
77056
+ function toggle_global(level) {
77057
+ yuno_trace_command("set-global-trace", {
77058
+ level,
77059
+ set: global_bit(GLOBAL_TRACE_BITS[level]) ? 0 : 1
77060
+ });
77243
77061
  }
77244
- function trace_start_stop() {
77245
- let v = Number(kw_get_local_storage_value("trace_start_stop"));
77246
- v = v === 0 ? 1 : 0;
77247
- gobj_write_attr(gobj_yuno(), "trace_start_stop", v);
77248
- kw_set_local_storage_value("trace_start_stop", v);
77249
- refresh_dev_chrome();
77062
+ function automata_state() {
77063
+ if (!global_bit(trace_level_t.TRACE_MACHINE)) return 0;
77064
+ return global_bit(trace_level_t.TRACE_EV_KW) ? 2 : 1;
77250
77065
  }
77251
- function trace_subscriptions() {
77252
- let v = Number(kw_get_local_storage_value("trace_subscriptions"));
77253
- v = v === 0 ? 1 : 0;
77254
- gobj_write_attr(gobj_yuno(), "trace_subscriptions", v);
77255
- kw_set_local_storage_value("trace_subscriptions", v);
77256
- refresh_dev_chrome();
77066
+ function toggle_automata() {
77067
+ let v = automata_state();
77068
+ if (v === 0) yuno_trace_command("set-global-trace", {
77069
+ level: "machine",
77070
+ set: 1
77071
+ });
77072
+ else if (v === 1) yuno_trace_command("set-global-trace", {
77073
+ level: "ev_kw",
77074
+ set: 1
77075
+ });
77076
+ else {
77077
+ yuno_trace_command("set-global-trace", {
77078
+ level: "ev_kw",
77079
+ set: 0
77080
+ });
77081
+ yuno_trace_command("set-global-trace", {
77082
+ level: "machine",
77083
+ set: 0
77084
+ });
77085
+ }
77257
77086
  }
77258
- function trace_i18n() {
77259
- let v = Number(kw_get_local_storage_value("trace_i18n"));
77260
- v = v === 0 ? 1 : 0;
77087
+ function traffic_state() {
77088
+ return gobj_get_gclass_trace_level2("C_IEVENT_CLI").includes("ievents") ? 1 : 0;
77089
+ }
77090
+ function toggle_traffic() {
77091
+ yuno_trace_command("set-gclass-trace", {
77092
+ gclass_name: "C_IEVENT_CLI",
77093
+ level: "ievents",
77094
+ set: traffic_state() ? 0 : 1
77095
+ });
77096
+ }
77097
+ function periodic_state() {
77098
+ let on = gobj_global_trace_level() & trace_level_t.TRACE_TIMER_PERIODIC;
77099
+ let off = gobj_global_trace_no_level() & trace_level_t.TRACE_TIMER_PERIODIC;
77100
+ return on && !off ? 1 : 0;
77101
+ }
77102
+ function toggle_periodic() {
77103
+ let v = periodic_state() ? 0 : 1;
77104
+ yuno_trace_command("set-global-trace", {
77105
+ level: "timer_periodic",
77106
+ set: v
77107
+ });
77108
+ yuno_trace_command("set-global-no-trace", {
77109
+ level: "timer_periodic",
77110
+ set: v ? 0 : 1
77111
+ });
77112
+ }
77113
+ function i18n_state() {
77114
+ return Number(kw_get_local_storage_value("trace_i18n", 0, false)) ? 1 : 0;
77115
+ }
77116
+ function toggle_i18n() {
77117
+ let v = i18n_state() ? 0 : 1;
77261
77118
  i18next.options.debug = v ? true : false;
77262
77119
  kw_set_local_storage_value("trace_i18n", v);
77263
77120
  refresh_dev_chrome();
77264
77121
  }
77265
- function set_no_poll() {
77266
- let v = Number(kw_get_local_storage_value("no_poll"));
77267
- v = v ? 0 : 1;
77268
- gobj_write_attr(gobj_yuno(), "no_poll", v);
77269
- kw_set_local_storage_value("no_poll", v);
77270
- refresh_dev_chrome();
77271
- }
77272
77122
  /******************************
77273
77123
  * Chrome (controls)
77274
77124
  ******************************/
77275
77125
  function refresh_dev_chrome() {
77276
77126
  document.querySelectorAll(".YDEV_CHIP[data-trace]").forEach(($b) => {
77277
77127
  let key = $b.getAttribute("data-trace");
77128
+ let def = TRACE_DEFS.find((d) => d[0] === key);
77278
77129
  let label = t($b.getAttribute("data-label") || "");
77279
- let v = dev_num(key, 0);
77280
- $b.textContent = key === "trace_automata" && v > 0 ? label + " " + v : label;
77130
+ let v = def ? def[3]() : 0;
77131
+ $b.textContent = key === "automata" && v > 0 ? label + " " + v : label;
77281
77132
  $b.classList.toggle("is-active", v > 0);
77282
77133
  });
77283
77134
  let view = dev_view();
@@ -77296,40 +77147,9 @@ function refresh_dev_chrome() {
77296
77147
  document.querySelectorAll(".YDEV_CHIP[data-dir]").forEach(($b) => {
77297
77148
  $b.classList.toggle("is-active", !!dev_num($b.getAttribute("data-dir"), 1));
77298
77149
  });
77299
- document.querySelectorAll(".YDEV_CHIP[data-toggle=\"periodic\"]").forEach(($b) => {
77300
- $b.classList.toggle("is-active", dev_hide_periodic());
77301
- });
77302
77150
  document.querySelectorAll(".YDEV_CHIP[data-toggle=\"automata-simple\"]").forEach(($b) => {
77303
77151
  $b.classList.toggle("is-active", !!dev_simple_mach());
77304
77152
  });
77305
- let $m = document.getElementById("ydev-muted");
77306
- if ($m) {
77307
- $m.replaceChildren();
77308
- let set = dev_muted();
77309
- if (set.size) {
77310
- let $lbl = document.createElement("span");
77311
- $lbl.className = "YDEV_LABEL";
77312
- $lbl.textContent = t("muted");
77313
- $lbl.setAttribute("data-i18n", "muted");
77314
- $m.appendChild($lbl);
77315
- set.forEach((sig) => {
77316
- $m.appendChild(createElement2([
77317
- "button",
77318
- {
77319
- class: "YDEV_MUTED_CHIP",
77320
- type: "button",
77321
- title: t("unmute"),
77322
- "data-i18n-title": "unmute"
77323
- },
77324
- "⊘ " + sig + " ✕",
77325
- { click: (ev) => {
77326
- ev.stopPropagation();
77327
- unmute_signature(sig);
77328
- } }
77329
- ]));
77330
- });
77331
- }
77332
- }
77333
77153
  update_stats();
77334
77154
  }
77335
77155
  function traffic_to_text() {
@@ -77374,19 +77194,23 @@ function dev_fallback_copy(text) {
77374
77194
  document.body.removeChild(ta);
77375
77195
  }
77376
77196
  function build_control_bar() {
77377
- let trace_chips = TRACE_DEFS.map(([key, label_key, fn]) => [
77197
+ let trace_chips = TRACE_DEFS.map(([key, label_key, title_key, state, toggle]) => [
77378
77198
  "button",
77379
77199
  {
77380
77200
  class: "YDEV_CHIP",
77381
77201
  "data-trace": key,
77382
77202
  "data-label": label_key,
77383
77203
  "data-i18n": label_key,
77384
- type: "button"
77204
+ type: "button",
77205
+ title: t(title_key),
77206
+ "data-i18n-title": title_key,
77207
+ "aria-label": t(label_key),
77208
+ "data-i18n-aria-label": label_key
77385
77209
  },
77386
77210
  t(label_key),
77387
77211
  { click: (ev) => {
77388
77212
  ev.stopPropagation();
77389
- fn();
77213
+ toggle();
77390
77214
  } }
77391
77215
  ]);
77392
77216
  let simple_mach = [
@@ -77524,29 +77348,6 @@ function build_control_bar() {
77524
77348
  mk_dir("in", "⇠", "dev_filter_in", "incoming"),
77525
77349
  mk_dir("err", "⚠", "dev_filter_err", "errors")
77526
77350
  ];
77527
- let periodic_chip = [
77528
- "button",
77529
- {
77530
- class: "YDEV_CHIP",
77531
- "data-toggle": "periodic",
77532
- type: "button",
77533
- title: t("hide the timers and the recurring traffic"),
77534
- "data-i18n-title": "hide the timers and the recurring traffic"
77535
- },
77536
- [[
77537
- "span",
77538
- { class: "YDEV_GLYPH" },
77539
- "⊘"
77540
- ], [
77541
- "span",
77542
- { "data-i18n": "periodic" },
77543
- t("periodic")
77544
- ]],
77545
- { click: (ev) => {
77546
- ev.stopPropagation();
77547
- toggle_pref("dev_hide_periodic", HIDE_PERIODIC_DEFAULT);
77548
- } }
77549
- ];
77550
77351
  let search = [
77551
77352
  "input",
77552
77353
  {
@@ -77627,7 +77428,7 @@ function build_control_bar() {
77627
77428
  grp("view", [view_seg]),
77628
77429
  expand_grp,
77629
77430
  sep(),
77630
- grp("show", [...dir_chips, periodic_chip]),
77431
+ grp("show", dir_chips),
77631
77432
  sep(),
77632
77433
  grp("find", [search]),
77633
77434
  sep(),
@@ -77662,14 +77463,6 @@ function build_dev_body() {
77662
77463
  { class: "YDEV_BODY" },
77663
77464
  [
77664
77465
  build_control_bar(),
77665
- [
77666
- "div",
77667
- {
77668
- class: "YDEV_MUTED",
77669
- id: "ydev-muted"
77670
- },
77671
- []
77672
- ],
77673
77466
  [
77674
77467
  "div",
77675
77468
  {
@@ -77702,28 +77495,16 @@ function dev_window_was_open() {
77702
77495
  return Number(kw_get_local_storage_value("open_developer_window", 0, false)) ? true : false;
77703
77496
  }
77704
77497
  /************************************************************
77705
- * Apply ALL persisted developer-trace flags to the running
77706
- * yuno. Independent of the dev window — call it once at app
77707
- * startup so a refresh keeps logging whatever was enabled.
77498
+ * Wire the developer window's sinks and the browser-side prefs.
77499
+ * Call it once at app startup.
77500
+ *
77501
+ * The TRACE LEVELS are not here: the yuno restores the ones the user
77502
+ * persisted in its own mt_create (`trace_levels` / `no_trace_levels`),
77503
+ * as a C yuno does. What is left is where the output goes.
77708
77504
  ************************************************************/
77709
77505
  function apply_dev_traces() {
77710
- let traffic = Number(kw_get_local_storage_value("trace_traffic", 0, false));
77711
- let trace = Number(kw_get_local_storage_value("trace_automata", 0, false));
77712
- let creation = Number(kw_get_local_storage_value("trace_creation", 0, false));
77713
- let start_stop = Number(kw_get_local_storage_value("trace_start_stop", 0, false));
77714
- let subscriptions = Number(kw_get_local_storage_value("trace_subscriptions", 0, false));
77715
- let i18n = Number(kw_get_local_storage_value("trace_i18n", 0, false));
77716
- let no_poll = Number(kw_get_local_storage_value("no_poll", 0, false));
77717
- if (traffic) {
77718
- gobj_write_attr(gobj_yuno(), "trace_inter_event", true);
77719
- gobj_write_attr(gobj_yuno(), "trace_ievent_callback", info_traffic);
77720
- } else gobj_write_attr(gobj_yuno(), "trace_inter_event", false);
77721
- gobj_write_attr(gobj_yuno(), "tracing", trace);
77722
- gobj_write_attr(gobj_yuno(), "trace_creation", creation);
77723
- gobj_write_attr(gobj_yuno(), "trace_start_stop", start_stop);
77724
- gobj_write_attr(gobj_yuno(), "trace_subscriptions", subscriptions);
77725
- gobj_write_attr(gobj_yuno(), "no_poll", no_poll);
77726
- i18next.options.debug = i18n ? true : false;
77506
+ gobj_write_attr(gobj_yuno(), "trace_ievent_callback", info_traffic);
77507
+ i18next.options.debug = i18n_state() ? true : false;
77727
77508
  gobj_set_trace_machine_format(dev_simple_mach());
77728
77509
  set_log_callback(info_log);
77729
77510
  apply_console_route();
@@ -77774,8 +77555,8 @@ function setup_dev(self, show) {
77774
77555
  *
77775
77556
  * Returns { $el, dispose }:
77776
77557
  * - $el: the panel element (control bar + log + stats).
77777
- * - dispose: stops the inter-event traffic trace; call it from
77778
- * the modal's on_close.
77558
+ * - dispose: call it from the modal's on_close (kept for the
77559
+ * contract; the traces outlive the panel).
77779
77560
  ************************************************************/
77780
77561
  function build_dev_panel() {
77781
77562
  ensure_dev_style();
@@ -77796,9 +77577,7 @@ function build_dev_panel() {
77796
77577
  refresh_dev_chrome();
77797
77578
  rerender_all();
77798
77579
  }, 0);
77799
- let dispose = function() {
77800
- gobj_write_attr(gobj_yuno(), "trace_inter_event", false);
77801
- };
77580
+ let dispose = function() {};
77802
77581
  return {
77803
77582
  $el,
77804
77583
  dispose