@yuneta/gobj-ui 7.23.33 → 7.23.34

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.
@@ -64310,6 +64310,10 @@ function dev_view() {
64310
64310
  return v === "compact" || v === "name" || v === "full" ? v : "detailed";
64311
64311
  }
64312
64312
  var HIDE_PERIODIC_DEFAULT = 1;
64313
+ var SIMPLE_MACH_DEFAULT = 1;
64314
+ function dev_simple_mach() {
64315
+ return dev_num("dev_automata_simple", SIMPLE_MACH_DEFAULT) ? 1 : 0;
64316
+ }
64313
64317
  function dev_hide_periodic() {
64314
64318
  return dev_num("dev_hide_periodic", HIDE_PERIODIC_DEFAULT) ? true : false;
64315
64319
  }
@@ -64887,7 +64891,7 @@ function render_name(e) {
64887
64891
  ]);
64888
64892
  }
64889
64893
  function render_log(e) {
64890
- return (0, _yuneta_gobj_js.createElement2)([
64894
+ let $row = (0, _yuneta_gobj_js.createElement2)([
64891
64895
  "div",
64892
64896
  {
64893
64897
  class: "YDEV_LOGROW YDEV_LOG_" + e.level,
@@ -64902,7 +64906,7 @@ function render_log(e) {
64902
64906
  [
64903
64907
  "span",
64904
64908
  { class: "YDEV_LOG_TXT" },
64905
- e.text
64909
+ ""
64906
64910
  ],
64907
64911
  [
64908
64912
  "span",
@@ -64911,6 +64915,9 @@ function render_log(e) {
64911
64915
  ]
64912
64916
  ]
64913
64917
  ]);
64918
+ let $txt = $row.querySelector(".YDEV_LOG_TXT");
64919
+ if ($txt) $txt.textContent = e.text;
64920
+ return $row;
64914
64921
  }
64915
64922
  function render_entry(e) {
64916
64923
  if (e.kind === "log") return render_log(e);
@@ -64949,15 +64956,28 @@ function rerender_all() {
64949
64956
  }
64950
64957
  }
64951
64958
  logger.replaceChildren(frag);
64952
- if (shown === 0) {
64953
- let $empty = document.createElement("div");
64954
- $empty.className = "YDEV_EMPTY";
64955
- $empty.textContent = TRAFFIC_LOG.length ? "No messages match the current filters." : "Waiting for activity — console logs and errors show automatically; enable Traffic or Automata for more.";
64956
- logger.appendChild($empty);
64957
- }
64959
+ if (shown === 0) logger.appendChild(make_placeholder());
64958
64960
  logger.scrollTop = logger.scrollHeight;
64959
64961
  update_stats();
64960
64962
  }
64963
+ function make_placeholder() {
64964
+ let $empty = document.createElement("div");
64965
+ $empty.className = "YDEV_EMPTY";
64966
+ $empty.textContent = placeholder_text();
64967
+ return $empty;
64968
+ }
64969
+ function placeholder_text() {
64970
+ if (TRAFFIC_LOG.length) return "No messages match the current filters.";
64971
+ return "Waiting for activity — console logs and errors show automatically; enable Traffic or Automata for more.";
64972
+ }
64973
+ function refresh_placeholder() {
64974
+ let logger = document.getElementById("developer-traffic-logger");
64975
+ if (!logger) return;
64976
+ let ph = logger.querySelector(".YDEV_EMPTY");
64977
+ if (!ph) return;
64978
+ let text = placeholder_text();
64979
+ if (ph.textContent !== text) ph.textContent = text;
64980
+ }
64961
64981
  function update_stats() {
64962
64982
  let $s = document.getElementById("ydev-stats");
64963
64983
  if (!$s) return;
@@ -65061,7 +65081,7 @@ function info_traffic(title, msg, direction, size) {
65061
65081
  let ph = logger.querySelector(".YDEV_EMPTY");
65062
65082
  if (ph) ph.remove();
65063
65083
  append_and_follow(logger, node);
65064
- }
65084
+ } else refresh_placeholder();
65065
65085
  update_stats();
65066
65086
  }
65067
65087
  var __in_info_log__ = false;
@@ -65122,7 +65142,7 @@ function info_log(level, msg, hora) {
65122
65142
  let ph = logger.querySelector(".YDEV_EMPTY");
65123
65143
  if (ph) ph.remove();
65124
65144
  append_and_follow(logger, node);
65125
- }
65145
+ } else refresh_placeholder();
65126
65146
  update_stats();
65127
65147
  } finally {
65128
65148
  __in_info_log__ = false;
@@ -65219,7 +65239,7 @@ function refresh_dev_chrome() {
65219
65239
  $b.classList.toggle("is-active", dev_hide_periodic());
65220
65240
  });
65221
65241
  document.querySelectorAll(".YDEV_CHIP[data-toggle=\"automata-simple\"]").forEach(($b) => {
65222
- $b.classList.toggle("is-active", !!dev_num("dev_automata_simple", 0));
65242
+ $b.classList.toggle("is-active", !!dev_simple_mach());
65223
65243
  });
65224
65244
  let $m = document.getElementById("ydev-muted");
65225
65245
  if ($m) {
@@ -65311,12 +65331,12 @@ function build_control_bar() {
65311
65331
  class: "YDEV_CHIP",
65312
65332
  "data-toggle": "automata-simple",
65313
65333
  type: "button",
65314
- title: "Compact automata format (one line per transition, like C)"
65334
+ title: "Machine trace shape. On (default): one line per transition, event first, like the C kernel. Off: the legacy three-line shape (the call, the state change and the return)"
65315
65335
  },
65316
65336
  "Simple mach",
65317
65337
  { click: (ev) => {
65318
65338
  ev.stopPropagation();
65319
- let v = dev_num("dev_automata_simple", 0) ? 0 : 1;
65339
+ let v = dev_simple_mach() ? 0 : 1;
65320
65340
  (0, _yuneta_gobj_js.kw_set_local_storage_value)("dev_automata_simple", v);
65321
65341
  (0, _yuneta_gobj_js.gobj_set_trace_machine_format)(v);
65322
65342
  refresh_dev_chrome();
@@ -65606,7 +65626,7 @@ function apply_dev_traces() {
65606
65626
  (0, _yuneta_gobj_js.gobj_write_attr)((0, _yuneta_gobj_js.gobj_yuno)(), "trace_subscriptions", subscriptions);
65607
65627
  (0, _yuneta_gobj_js.gobj_write_attr)((0, _yuneta_gobj_js.gobj_yuno)(), "no_poll", no_poll);
65608
65628
  i18next.default.options.debug = i18n ? true : false;
65609
- (0, _yuneta_gobj_js.gobj_set_trace_machine_format)(Number((0, _yuneta_gobj_js.kw_get_local_storage_value)("dev_automata_simple", 0, false)) ? 1 : 0);
65629
+ (0, _yuneta_gobj_js.gobj_set_trace_machine_format)(dev_simple_mach());
65610
65630
  (0, _yuneta_gobj_js.set_log_callback)(info_log);
65611
65631
  apply_console_route();
65612
65632
  }
@@ -64305,6 +64305,10 @@ function dev_view() {
64305
64305
  return v === "compact" || v === "name" || v === "full" ? v : "detailed";
64306
64306
  }
64307
64307
  var HIDE_PERIODIC_DEFAULT = 1;
64308
+ var SIMPLE_MACH_DEFAULT = 1;
64309
+ function dev_simple_mach() {
64310
+ return dev_num("dev_automata_simple", SIMPLE_MACH_DEFAULT) ? 1 : 0;
64311
+ }
64308
64312
  function dev_hide_periodic() {
64309
64313
  return dev_num("dev_hide_periodic", HIDE_PERIODIC_DEFAULT) ? true : false;
64310
64314
  }
@@ -64882,7 +64886,7 @@ function render_name(e) {
64882
64886
  ]);
64883
64887
  }
64884
64888
  function render_log(e) {
64885
- return createElement2([
64889
+ let $row = createElement2([
64886
64890
  "div",
64887
64891
  {
64888
64892
  class: "YDEV_LOGROW YDEV_LOG_" + e.level,
@@ -64897,7 +64901,7 @@ function render_log(e) {
64897
64901
  [
64898
64902
  "span",
64899
64903
  { class: "YDEV_LOG_TXT" },
64900
- e.text
64904
+ ""
64901
64905
  ],
64902
64906
  [
64903
64907
  "span",
@@ -64906,6 +64910,9 @@ function render_log(e) {
64906
64910
  ]
64907
64911
  ]
64908
64912
  ]);
64913
+ let $txt = $row.querySelector(".YDEV_LOG_TXT");
64914
+ if ($txt) $txt.textContent = e.text;
64915
+ return $row;
64909
64916
  }
64910
64917
  function render_entry(e) {
64911
64918
  if (e.kind === "log") return render_log(e);
@@ -64944,15 +64951,28 @@ function rerender_all() {
64944
64951
  }
64945
64952
  }
64946
64953
  logger.replaceChildren(frag);
64947
- if (shown === 0) {
64948
- let $empty = document.createElement("div");
64949
- $empty.className = "YDEV_EMPTY";
64950
- $empty.textContent = TRAFFIC_LOG.length ? "No messages match the current filters." : "Waiting for activity — console logs and errors show automatically; enable Traffic or Automata for more.";
64951
- logger.appendChild($empty);
64952
- }
64954
+ if (shown === 0) logger.appendChild(make_placeholder());
64953
64955
  logger.scrollTop = logger.scrollHeight;
64954
64956
  update_stats();
64955
64957
  }
64958
+ function make_placeholder() {
64959
+ let $empty = document.createElement("div");
64960
+ $empty.className = "YDEV_EMPTY";
64961
+ $empty.textContent = placeholder_text();
64962
+ return $empty;
64963
+ }
64964
+ function placeholder_text() {
64965
+ if (TRAFFIC_LOG.length) return "No messages match the current filters.";
64966
+ return "Waiting for activity — console logs and errors show automatically; enable Traffic or Automata for more.";
64967
+ }
64968
+ function refresh_placeholder() {
64969
+ let logger = document.getElementById("developer-traffic-logger");
64970
+ if (!logger) return;
64971
+ let ph = logger.querySelector(".YDEV_EMPTY");
64972
+ if (!ph) return;
64973
+ let text = placeholder_text();
64974
+ if (ph.textContent !== text) ph.textContent = text;
64975
+ }
64956
64976
  function update_stats() {
64957
64977
  let $s = document.getElementById("ydev-stats");
64958
64978
  if (!$s) return;
@@ -65056,7 +65076,7 @@ function info_traffic(title, msg, direction, size) {
65056
65076
  let ph = logger.querySelector(".YDEV_EMPTY");
65057
65077
  if (ph) ph.remove();
65058
65078
  append_and_follow(logger, node);
65059
- }
65079
+ } else refresh_placeholder();
65060
65080
  update_stats();
65061
65081
  }
65062
65082
  var __in_info_log__ = false;
@@ -65117,7 +65137,7 @@ function info_log(level, msg, hora) {
65117
65137
  let ph = logger.querySelector(".YDEV_EMPTY");
65118
65138
  if (ph) ph.remove();
65119
65139
  append_and_follow(logger, node);
65120
- }
65140
+ } else refresh_placeholder();
65121
65141
  update_stats();
65122
65142
  } finally {
65123
65143
  __in_info_log__ = false;
@@ -65214,7 +65234,7 @@ function refresh_dev_chrome() {
65214
65234
  $b.classList.toggle("is-active", dev_hide_periodic());
65215
65235
  });
65216
65236
  document.querySelectorAll(".YDEV_CHIP[data-toggle=\"automata-simple\"]").forEach(($b) => {
65217
- $b.classList.toggle("is-active", !!dev_num("dev_automata_simple", 0));
65237
+ $b.classList.toggle("is-active", !!dev_simple_mach());
65218
65238
  });
65219
65239
  let $m = document.getElementById("ydev-muted");
65220
65240
  if ($m) {
@@ -65306,12 +65326,12 @@ function build_control_bar() {
65306
65326
  class: "YDEV_CHIP",
65307
65327
  "data-toggle": "automata-simple",
65308
65328
  type: "button",
65309
- title: "Compact automata format (one line per transition, like C)"
65329
+ title: "Machine trace shape. On (default): one line per transition, event first, like the C kernel. Off: the legacy three-line shape (the call, the state change and the return)"
65310
65330
  },
65311
65331
  "Simple mach",
65312
65332
  { click: (ev) => {
65313
65333
  ev.stopPropagation();
65314
- let v = dev_num("dev_automata_simple", 0) ? 0 : 1;
65334
+ let v = dev_simple_mach() ? 0 : 1;
65315
65335
  kw_set_local_storage_value("dev_automata_simple", v);
65316
65336
  gobj_set_trace_machine_format(v);
65317
65337
  refresh_dev_chrome();
@@ -65601,7 +65621,7 @@ function apply_dev_traces() {
65601
65621
  gobj_write_attr(gobj_yuno(), "trace_subscriptions", subscriptions);
65602
65622
  gobj_write_attr(gobj_yuno(), "no_poll", no_poll);
65603
65623
  i18next.options.debug = i18n ? true : false;
65604
- gobj_set_trace_machine_format(Number(kw_get_local_storage_value("dev_automata_simple", 0, false)) ? 1 : 0);
65624
+ gobj_set_trace_machine_format(dev_simple_mach());
65605
65625
  set_log_callback(info_log);
65606
65626
  apply_console_route();
65607
65627
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.33",
3
+ "version": "7.23.34",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
package/src/yui_dev.js CHANGED
@@ -185,6 +185,25 @@ function dev_view()
185
185
  * chip writes the value it already had and appears to do nothing. */
186
186
  const HIDE_PERIODIC_DEFAULT = 1;
187
187
 
188
+ /* Which SHAPE the machine trace is written in — the two the C kernel
189
+ * offers, and the chip that swaps them:
190
+ *
191
+ * 1 (default) one line per transition, event first
192
+ * 0 the legacy three-line shape: the call, the state
193
+ * change, and the `<- … ret: N` return
194
+ *
195
+ * 1 because that is what the C kernel defaults to, so a browser yuno and
196
+ * a node read alike. Like HIDE_PERIODIC_DEFAULT, a CONSTANT and not a
197
+ * literal in each of the three places that read it (the chip, the chrome
198
+ * and start up): they have to agree on what "unset" means, or the chip
199
+ * is born showing the wrong state and its first click does nothing. */
200
+ const SIMPLE_MACH_DEFAULT = 1;
201
+
202
+ function dev_simple_mach()
203
+ {
204
+ return dev_num("dev_automata_simple", SIMPLE_MACH_DEFAULT) ? 1 : 0;
205
+ }
206
+
188
207
  function dev_hide_periodic()
189
208
  {
190
209
  return dev_num("dev_hide_periodic", HIDE_PERIODIC_DEFAULT) ? true : false;
@@ -821,13 +840,29 @@ function render_name(e)
821
840
  /* A mirrored framework log line (error/warning/info/debug/msg). */
822
841
  function render_log(e)
823
842
  {
824
- return createElement2(
843
+ let $row = createElement2(
825
844
  ['div', {class: 'YDEV_LOGROW YDEV_LOG_' + e.level, title: e.level}, [
826
845
  ['span', {class: 'YDEV_LOG_LVL'}, e.level],
827
- ['span', {class: 'YDEV_LOG_TXT'}, e.text],
846
+ ['span', {class: 'YDEV_LOG_TXT'}, ''],
828
847
  ['span', {class: 'TRAFFIC_META'}, e.ts],
829
848
  ]]
830
849
  );
850
+
851
+ /* The text is assigned AFTER, and that is the whole point.
852
+ *
853
+ * createElement2() TRIMS a string content -- it has to, to decide
854
+ * whether the string is HTML by looking at its first character -- and
855
+ * the machine trace's leading spaces are its NESTING: gobj-js prefixes
856
+ * every line with `tab()`, two spaces per level of __inside__, so an
857
+ * event sent from inside another one's action is indented under it.
858
+ * Passed through createElement2 that indentation was eaten, and the
859
+ * window showed a flat column where the console showed a tree. */
860
+ let $txt = $row.querySelector('.YDEV_LOG_TXT');
861
+ if($txt) {
862
+ $txt.textContent = e.text;
863
+ }
864
+
865
+ return $row;
831
866
  }
832
867
 
833
868
  function render_entry(e)
@@ -889,17 +924,55 @@ function rerender_all()
889
924
  }
890
925
  logger.replaceChildren(frag);
891
926
  if(shown === 0) {
892
- let $empty = document.createElement('div');
893
- $empty.className = 'YDEV_EMPTY';
894
- $empty.textContent = TRAFFIC_LOG.length
895
- ? "No messages match the current filters."
896
- : "Waiting for activity — console logs and errors show automatically; enable Traffic or Automata for more.";
897
- logger.appendChild($empty);
927
+ logger.appendChild(make_placeholder());
898
928
  }
899
929
  logger.scrollTop = logger.scrollHeight;
900
930
  update_stats();
901
931
  }
902
932
 
933
+ /* The empty state, which has to say WHICH empty it is. */
934
+ function make_placeholder()
935
+ {
936
+ let $empty = document.createElement('div');
937
+ $empty.className = 'YDEV_EMPTY';
938
+ $empty.textContent = placeholder_text();
939
+ return $empty;
940
+ }
941
+
942
+ function placeholder_text()
943
+ {
944
+ if(TRAFFIC_LOG.length) {
945
+ return "No messages match the current filters.";
946
+ }
947
+ return "Waiting for activity — console logs and errors show automatically; " +
948
+ "enable Traffic or Automata for more.";
949
+ }
950
+
951
+ /* Keep whatever placeholder is on screen TRUTHFUL.
952
+ *
953
+ * A line that arrives and is filtered out changes the answer without
954
+ * changing the screen: the buffer stops being empty, so "Waiting for
955
+ * activity — enable Automata for more" becomes a lie, and the window reads
956
+ * as "nothing is happening, your traces are off" while it is in fact hiding
957
+ * 36 of them. Measured on a yuno with one timer and the Periodic filter on,
958
+ * which is now the default: the status line said `0/36 shown · 36 hidden`
959
+ * and the panel said there was no activity. */
960
+ function refresh_placeholder()
961
+ {
962
+ let logger = document.getElementById('developer-traffic-logger');
963
+ if(!logger) {
964
+ return;
965
+ }
966
+ let ph = logger.querySelector('.YDEV_EMPTY');
967
+ if(!ph) {
968
+ return;
969
+ }
970
+ let text = placeholder_text();
971
+ if(ph.textContent !== text) {
972
+ ph.textContent = text;
973
+ }
974
+ }
975
+
903
976
  /* Live counters in the status strip. */
904
977
  function update_stats()
905
978
  {
@@ -1050,6 +1123,8 @@ function info_traffic(title, msg, direction, size)
1050
1123
  ph.remove();
1051
1124
  }
1052
1125
  append_and_follow(logger, node);
1126
+ } else {
1127
+ refresh_placeholder(); /* hidden, but the buffer is no longer empty */
1053
1128
  }
1054
1129
  update_stats();
1055
1130
  }
@@ -1140,6 +1215,8 @@ function info_log(level, msg, hora)
1140
1215
  ph.remove();
1141
1216
  }
1142
1217
  append_and_follow(logger, node);
1218
+ } else {
1219
+ refresh_placeholder(); /* hidden, but the buffer is no longer empty */
1143
1220
  }
1144
1221
  update_stats();
1145
1222
  } finally {
@@ -1276,7 +1353,7 @@ function refresh_dev_chrome()
1276
1353
  });
1277
1354
 
1278
1355
  document.querySelectorAll('.YDEV_CHIP[data-toggle="automata-simple"]').forEach(($b) => {
1279
- $b.classList.toggle('is-active', !!dev_num('dev_automata_simple', 0));
1356
+ $b.classList.toggle('is-active', !!dev_simple_mach());
1280
1357
  });
1281
1358
 
1282
1359
  let $m = document.getElementById('ydev-muted');
@@ -1384,11 +1461,13 @@ function build_control_bar()
1384
1461
  * emitted while Automata is on. */
1385
1462
  let simple_mach = ['button', {
1386
1463
  class: 'YDEV_CHIP', 'data-toggle': 'automata-simple', type: 'button',
1387
- title: 'Compact automata format (one line per transition, like C)',
1464
+ title: 'Machine trace shape. On (default): one line per transition, ' +
1465
+ 'event first, like the C kernel. Off: the legacy three-line shape ' +
1466
+ '(the call, the state change and the return)',
1388
1467
  }, 'Simple mach', {
1389
1468
  click: (ev) => {
1390
1469
  ev.stopPropagation();
1391
- let v = dev_num('dev_automata_simple', 0) ? 0 : 1;
1470
+ let v = dev_simple_mach() ? 0 : 1;
1392
1471
  kw_set_local_storage_value('dev_automata_simple', v);
1393
1472
  gobj_set_trace_machine_format(v);
1394
1473
  refresh_dev_chrome();
@@ -1581,9 +1660,8 @@ function apply_dev_traces()
1581
1660
  gobj_write_attr(gobj_yuno(), "no_poll", no_poll);
1582
1661
  i18next.options.debug = i18n ? true : false;
1583
1662
 
1584
- /* Compact vs verbose automata trace format (persisted). */
1585
- gobj_set_trace_machine_format(
1586
- Number(kw_get_local_storage_value("dev_automata_simple", 0, false)) ? 1 : 0);
1663
+ /* Which shape the machine trace is written in (persisted). */
1664
+ gobj_set_trace_machine_format(dev_simple_mach());
1587
1665
 
1588
1666
  /* Mirror the browser console (log_error/warning/info/debug/msg — the
1589
1667
  * automata FSM trace arrives as debug) into the monitor. info_log no-ops