@yuneta/gobj-ui 7.23.32 → 7.23.33

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.
@@ -32,6 +32,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
32
32
  }) : target, mod));
33
33
  //#endregion
34
34
  let _yuneta_gobj_js = require("@yuneta/gobj-js");
35
+ _yuneta_gobj_js = __toESM(_yuneta_gobj_js, 1);
35
36
  let i18next = require("i18next");
36
37
  i18next = __toESM(i18next, 1);
37
38
  let tom_select = require("tom-select");
@@ -64318,7 +64319,16 @@ function dev_route() {
64318
64319
  }
64319
64320
  function apply_console_route() {
64320
64321
  (0, _yuneta_gobj_js.set_console_log_enabled)(dev_route() !== "window");
64322
+ if (typeof _yuneta_gobj_js.set_console_log_filter === "function") _yuneta_gobj_js.set_console_log_filter((level, msg) => {
64323
+ if (!dev_hide_periodic()) return true;
64324
+ return !log_is_periodic(level, (0, _yuneta_gobj_js.is_string)(msg) ? msg : String(msg));
64325
+ });
64326
+ else if (!__console_filter_warned__) {
64327
+ __console_filter_warned__ = true;
64328
+ 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");
64329
+ }
64321
64330
  }
64331
+ var __console_filter_warned__ = false;
64322
64332
  function console_traffic(title, jn, direction, size) {
64323
64333
  let event = jn && jn.event ? String(jn.event) : "(no event)";
64324
64334
  let kw = jn && jn.kw && typeof jn.kw === "object" ? jn.kw : jn;
@@ -64348,6 +64358,7 @@ function set_output_route(v) {
64348
64358
  function toggle_pref(key, def) {
64349
64359
  let v = dev_num(key, def) ? 0 : 1;
64350
64360
  (0, _yuneta_gobj_js.kw_set_local_storage_value)(key, v);
64361
+ apply_console_route();
64351
64362
  rerender_all();
64352
64363
  refresh_dev_chrome();
64353
64364
  }
@@ -1,3 +1,4 @@
1
+ import * as gobj_js from "@yuneta/gobj-js";
1
2
  import { SDATA, SDATA_END, clean_name, createElement2, createOneHtml, create_template_record, data_type_t, debounce, duplicate_objects, empty_string, escapeHtml, event_flag_t, 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, 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_get_ids, 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";
2
3
  import i18next, { t } from "i18next";
3
4
  import TomSelect from "tom-select";
@@ -64313,7 +64314,16 @@ function dev_route() {
64313
64314
  }
64314
64315
  function apply_console_route() {
64315
64316
  set_console_log_enabled(dev_route() !== "window");
64317
+ if (typeof gobj_js.set_console_log_filter === "function") gobj_js.set_console_log_filter((level, msg) => {
64318
+ if (!dev_hide_periodic()) return true;
64319
+ return !log_is_periodic(level, is_string(msg) ? msg : String(msg));
64320
+ });
64321
+ else if (!__console_filter_warned__) {
64322
+ __console_filter_warned__ = true;
64323
+ 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");
64324
+ }
64316
64325
  }
64326
+ var __console_filter_warned__ = false;
64317
64327
  function console_traffic(title, jn, direction, size) {
64318
64328
  let event = jn && jn.event ? String(jn.event) : "(no event)";
64319
64329
  let kw = jn && jn.kw && typeof jn.kw === "object" ? jn.kw : jn;
@@ -64343,6 +64353,7 @@ function set_output_route(v) {
64343
64353
  function toggle_pref(key, def) {
64344
64354
  let v = dev_num(key, def) ? 0 : 1;
64345
64355
  kw_set_local_storage_value(key, v);
64356
+ apply_console_route();
64346
64357
  rerender_all();
64347
64358
  refresh_dev_chrome();
64348
64359
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.32",
3
+ "version": "7.23.33",
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
@@ -21,6 +21,14 @@ import {
21
21
  gobj_set_trace_machine_format,
22
22
  } from "@yuneta/gobj-js";
23
23
 
24
+ /* A NAMESPACE import, deliberately, for one optional API.
25
+ *
26
+ * `set_console_log_filter` arrived in gobj-js 7.13.6, and a NAMED import of
27
+ * an export the installed copy does not have is a hard module-load error --
28
+ * it would take the whole app down instead of degrading. Read off the
29
+ * namespace, a missing export is plain `undefined` and can be tested for. */
30
+ import * as gobj_js from "@yuneta/gobj-js";
31
+
24
32
  import {log_signature, log_is_periodic} from "./dev_machine_trace.js";
25
33
 
26
34
  import i18next from 'i18next';
@@ -195,12 +203,46 @@ function dev_route()
195
203
  }
196
204
 
197
205
  /* Push the current route's console decision down to gobj-js. Called from
198
- * apply_dev_traces (startup) and whenever the Output selector changes. */
206
+ * apply_dev_traces (startup), whenever the Output selector changes, and
207
+ * whenever a filter that the console also obeys is toggled. */
199
208
  function apply_console_route()
200
209
  {
201
210
  set_console_log_enabled(dev_route() !== "window");
211
+
212
+ /* ONE rule, TWO sinks.
213
+ *
214
+ * The window's Periodic filter used to end at the window, so with the
215
+ * Output on "Both" the timers were gone from the panel and still
216
+ * arriving in the browser console, two lines a second — the same flood,
217
+ * one pane over. It cannot be fixed from this side alone: gobj-js writes
218
+ * the console line BEFORE it calls the log sink, so nothing here can
219
+ * un-print it. It hands out a say instead (`set_console_log_filter`,
220
+ * gobj-js >= 7.13.6), and this is the same predicate `entry_hidden()`
221
+ * uses, so the two panes cannot disagree about what is noise.
222
+ *
223
+ * Feature-detected rather than required: against an older gobj-js the
224
+ * window still filters and the console still floods, exactly as before,
225
+ * and the reason is logged once instead of failing. */
226
+ if(typeof gobj_js.set_console_log_filter === "function") {
227
+ gobj_js.set_console_log_filter((level, msg) => {
228
+ if(!dev_hide_periodic()) {
229
+ return true;
230
+ }
231
+ return !log_is_periodic(level, is_string(msg) ? msg : String(msg));
232
+ });
233
+ } else if(!__console_filter_warned__) {
234
+ __console_filter_warned__ = true;
235
+ console.warn(
236
+ "yui_dev: gobj-js has no set_console_log_filter (needs >= 7.13.6): " +
237
+ "the Periodic filter applies to this window only, not to the console"
238
+ );
239
+ }
202
240
  }
203
241
 
242
+ /* The warning above is worth saying, and worth saying ONCE: this runs on
243
+ * every Output change and every filter toggle. */
244
+ let __console_filter_warned__ = false;
245
+
204
246
  /* Emit one inter-event traffic line to the browser console (routes
205
247
  * "console" and "both"). gobj-js only knows about framework logs, not this
206
248
  * traffic feed, so the console mirror is produced here. */
@@ -253,6 +295,12 @@ function toggle_pref(key, def)
253
295
  {
254
296
  let v = dev_num(key, def) ? 0 : 1;
255
297
  kw_set_local_storage_value(key, v);
298
+ /* The console filter closes over dev_hide_periodic(), which reads the
299
+ * stored value on each call, so it follows this on its own. Re-pushed
300
+ * anyway: a filter installed before this module reached apply_dev_traces
301
+ * is the difference between the console obeying the chip and ignoring
302
+ * it, and one assignment is cheaper than that class of bug. */
303
+ apply_console_route();
256
304
  rerender_all();
257
305
  refresh_dev_chrome();
258
306
  }