@yuneta/gobj-ui 7.27.26 → 7.27.28

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.
@@ -21177,6 +21177,424 @@ function gclass_view_model(description) {
21177
21177
  };
21178
21178
  }
21179
21179
  //#endregion
21180
+ //#region src/gobj_tree_model.js
21181
+ /***********************************************************************
21182
+ * gobj_tree_model.js
21183
+ *
21184
+ * The gobj tree of a yuno, as plain data.
21185
+ *
21186
+ * The view (C_YUI_GOBJ_TREE_JS) draws NODE DESCRIPTORS, never
21187
+ * gobjs. There are two producers of a descriptor, because the
21188
+ * view has to show the gobjs of the BACKEND too:
21189
+ *
21190
+ * - describe_js_gobj() the gobj tree of THIS browser yuno
21191
+ * - describe_backend_tree() the answer of the backend command
21192
+ * `view-gobj-tree` of another yuno
21193
+ *
21194
+ * Both answer the SAME shape, and that shape is the backend's:
21195
+ * the field names are the ones `gobj2json()` writes in
21196
+ * `kernel/c/gobj-c/src/gobj.c` (fullname, shortname, gclass,
21197
+ * name, parent, state, running, playing, service, disabled,
21198
+ * volatil, bottom_gobj, gobj_flags, commands, gobj_trace_level,
21199
+ * play_methods). Anything the browser runtime cannot answer is
21200
+ * simply absent, and every reader here treats absent as "not
21201
+ * known", never as false -- `play_methods` included, which a
21202
+ * backend built before it was added does not answer.
21203
+ *
21204
+ * Copyright (c) 2026, ArtGins.
21205
+ * All Rights Reserved.
21206
+ ***********************************************************************/
21207
+ /************************************************************
21208
+ * The role of a node: "yuno" | "service" | "volatil" | "pure" | "child"
21209
+ ************************************************************/
21210
+ function node_role(d) {
21211
+ if (!d) return "child";
21212
+ if (d.is_yuno) return "yuno";
21213
+ if (d.service) return "service";
21214
+ if (d.volatil) return "volatil";
21215
+ if (d.pure_child) return "pure";
21216
+ return "child";
21217
+ }
21218
+ /************************************************************
21219
+ * What the node is doing: "stopped" | "running" | "playing"
21220
+ ************************************************************/
21221
+ function node_status(d) {
21222
+ if (!d || !d.running) return "stopped";
21223
+ return d.playing ? "playing" : "running";
21224
+ }
21225
+ /************************************************************
21226
+ * Whether play and pause MEAN something to the node: its
21227
+ * gclass has an mt_play or an mt_pause.
21228
+ *
21229
+ * Most gclasses have neither -- a C_TCP, a C_TIMER, a C_NODE
21230
+ * -- and nothing ever plays them, so a gobj of theirs that
21231
+ * runs is doing all it can. Calling it paused painted almost
21232
+ * every card of a backend yuno amber, which is the colour of
21233
+ * something to look at.
21234
+ *
21235
+ * `play_methods` is unknown (null) for a backend yuno that does
21236
+ * not answer it in `view-gobj-tree`, and then the node is taken
21237
+ * as one that can be paused, which is what was said before.
21238
+ ************************************************************/
21239
+ function node_can_pause(d) {
21240
+ return !d || d.play_methods !== false;
21241
+ }
21242
+ var STATUS_SYMBOLS = {
21243
+ "playing": "▶︎",
21244
+ "running": "‖",
21245
+ "stopped": "■︎"
21246
+ };
21247
+ var RUNNING_SYMBOL = "●";
21248
+ var DISABLED_SYMBOL = "⊘";
21249
+ /************************************************************
21250
+ * The symbol of a node's status, which is what the reader
21251
+ * actually sees first. `disabled` overrides the rest: a
21252
+ * disabled gobj is not going to run whatever it is doing now.
21253
+ ************************************************************/
21254
+ function node_status_symbol(d) {
21255
+ if (d && d.disabled) return DISABLED_SYMBOL;
21256
+ let status = node_status(d);
21257
+ if (status === "running" && !node_can_pause(d)) return RUNNING_SYMBOL;
21258
+ return STATUS_SYMBOLS[status] || STATUS_SYMBOLS.stopped;
21259
+ }
21260
+ /************************************************************
21261
+ * The i18n key of the status, which is NOT the status itself:
21262
+ * a gobj that runs and does not play is PAUSED to the reader,
21263
+ * and "running" alone never said which of the two it was --
21264
+ * unless play and pause mean nothing to it (node_can_pause()).
21265
+ ************************************************************/
21266
+ function node_status_key(d) {
21267
+ switch (node_status(d)) {
21268
+ case "playing": return "playing";
21269
+ case "running": return node_can_pause(d) ? "running (paused)" : "running";
21270
+ default: return "stopped";
21271
+ }
21272
+ }
21273
+ /******************************
21274
+ * Producers
21275
+ ******************************/
21276
+ /************************************************************
21277
+ * A descriptor of a LIVE gobj of this browser yuno, children
21278
+ * included (the whole subtree, depth-first).
21279
+ *
21280
+ * `is_root` marks the yuno itself: the JS runtime has no
21281
+ * gobj_flag_yuno test of its own.
21282
+ ************************************************************/
21283
+ function describe_js_gobj(target_gobj, is_root) {
21284
+ if (!target_gobj) return null;
21285
+ let parent_gobj = (0, _yuneta_gobj_js.gobj_parent)(target_gobj);
21286
+ let bottom = (0, _yuneta_gobj_js.gobj_bottom_gobj)(target_gobj);
21287
+ let d = {
21288
+ gclass: (0, _yuneta_gobj_js.gobj_gclass_name)(target_gobj) || "",
21289
+ name: (0, _yuneta_gobj_js.gobj_name)(target_gobj) || "",
21290
+ shortname: (0, _yuneta_gobj_js.gobj_short_name)(target_gobj) || "",
21291
+ fullname: (0, _yuneta_gobj_js.gobj_full_name)(target_gobj) || "",
21292
+ parent: parent_gobj ? (0, _yuneta_gobj_js.gobj_short_name)(parent_gobj) || "" : "",
21293
+ state: (0, _yuneta_gobj_js.gobj_current_state)(target_gobj) || "",
21294
+ running: !!(0, _yuneta_gobj_js.gobj_is_running)(target_gobj),
21295
+ playing: !!(0, _yuneta_gobj_js.gobj_is_playing)(target_gobj),
21296
+ service: !!(0, _yuneta_gobj_js.gobj_is_service)(target_gobj),
21297
+ volatil: !!(0, _yuneta_gobj_js.gobj_is_volatil)(target_gobj),
21298
+ pure_child: !!(0, _yuneta_gobj_js.gobj_is_pure_child)(target_gobj),
21299
+ disabled: !!target_gobj.disabled,
21300
+ bottom_gobj: bottom ? (0, _yuneta_gobj_js.gobj_short_name)(bottom) || "" : "",
21301
+ commands: !!(target_gobj.gclass && target_gobj.gclass.command_table),
21302
+ play_methods: !!(target_gobj.gclass && target_gobj.gclass.gmt && (target_gobj.gclass.gmt.mt_play || target_gobj.gclass.gmt.mt_pause)),
21303
+ is_yuno: !!is_root,
21304
+ children: []
21305
+ };
21306
+ let children = target_gobj.dl_children || [];
21307
+ for (let child of children) {
21308
+ let cd = describe_js_gobj(child, false);
21309
+ if (cd) d.children.push(cd);
21310
+ }
21311
+ return d;
21312
+ }
21313
+ /************************************************************
21314
+ * A descriptor from ONE node of the `view-gobj-tree` answer
21315
+ * of a backend yuno.
21316
+ *
21317
+ * `shortname` is the key the node hangs from in that answer;
21318
+ * the node itself repeats it, so the argument is only the
21319
+ * fallback for a filtered answer that dropped the field.
21320
+ ************************************************************/
21321
+ function describe_backend_node(shortname, node, is_root) {
21322
+ if (!node || typeof node !== "object") return null;
21323
+ let flags = Array.isArray(node.gobj_flags) ? node.gobj_flags : [];
21324
+ let has = (flag) => flags.indexOf(flag) !== -1;
21325
+ let d = {
21326
+ gclass: node.gclass || "",
21327
+ name: node.name || "",
21328
+ shortname: node.shortname || shortname || "",
21329
+ fullname: node.fullname || "",
21330
+ parent: node.parent || "",
21331
+ state: node.state || "",
21332
+ running: !!node.running,
21333
+ playing: !!node.playing,
21334
+ service: !!node.service || has("gobj_flag_service") || has("gobj_flag_default_service"),
21335
+ volatil: !!node.volatil || has("gobj_flag_volatil"),
21336
+ pure_child: has("gobj_flag_pure_child"),
21337
+ disabled: !!node.disabled,
21338
+ bottom_gobj: node.bottom_gobj || "",
21339
+ commands: !!node.commands,
21340
+ play_methods: typeof node.play_methods === "boolean" ? node.play_methods : null,
21341
+ gobj_flags: flags,
21342
+ gobj_trace_level: Array.isArray(node.gobj_trace_level) ? node.gobj_trace_level : [],
21343
+ is_yuno: is_root !== void 0 ? !!is_root : has("gobj_flag_yuno"),
21344
+ children: []
21345
+ };
21346
+ let children = node.children && typeof node.children === "object" ? node.children : null;
21347
+ if (children) for (let key of Object.keys(children)) {
21348
+ let cd = describe_backend_node(key, children[key], false);
21349
+ if (cd) d.children.push(cd);
21350
+ }
21351
+ return d;
21352
+ }
21353
+ /************************************************************
21354
+ * The whole `view-gobj-tree` answer -> the root descriptor.
21355
+ *
21356
+ * That answer is a dict of ONE key (the shortname of the gobj
21357
+ * the command was asked about) even though it is shaped as a
21358
+ * dict all the way down. Returns null for anything else, and
21359
+ * the caller reports it: an empty tree and a malformed answer
21360
+ * must not look the same.
21361
+ ************************************************************/
21362
+ function describe_backend_tree(data) {
21363
+ if (!data || typeof data !== "object" || Array.isArray(data)) return null;
21364
+ let keys = Object.keys(data);
21365
+ if (keys.length === 0) return null;
21366
+ return describe_backend_node(keys[0], data[keys[0]], true);
21367
+ }
21368
+ /******************************
21369
+ * Readouts
21370
+ ******************************/
21371
+ /************************************************************
21372
+ * The i18n key of a role. Two of the five roles are not the
21373
+ * word the reader wants ("pure" and "volatil" alone say
21374
+ * nothing), so the map is explicit.
21375
+ ************************************************************/
21376
+ function role_i18n_key(role) {
21377
+ switch (role) {
21378
+ case "yuno": return "yuno";
21379
+ case "service": return "service";
21380
+ case "volatil": return "volatil child";
21381
+ case "pure": return "pure child";
21382
+ default: return "child";
21383
+ }
21384
+ }
21385
+ /************************************************************
21386
+ * The marks a node carries besides its role: what the reader
21387
+ * would otherwise have to open the popover to learn.
21388
+ *
21389
+ * Returns i18n KEYS, in a fixed order, so the card and the
21390
+ * popover cannot disagree about what a node is.
21391
+ ************************************************************/
21392
+ function node_badge_keys(d) {
21393
+ let badges = [];
21394
+ if (!d) return badges;
21395
+ let role = node_role(d);
21396
+ if (role !== "child") badges.push(role_i18n_key(role));
21397
+ if (d.disabled) badges.push("disabled");
21398
+ if (d.bottom_gobj) badges.push("bottom");
21399
+ if (d.commands) badges.push("commands");
21400
+ if (Array.isArray(d.gobj_trace_level) && d.gobj_trace_level.length > 0) badges.push("traces");
21401
+ return badges;
21402
+ }
21403
+ /************************************************************
21404
+ * The vocabulary of this view, translated.
21405
+ *
21406
+ * Written as literal t("...") calls and not as t(key): a key
21407
+ * reached through a variable is invisible to the locale
21408
+ * validator, which is how a fixed vocabulary ships in one
21409
+ * language and never changes it.
21410
+ ************************************************************/
21411
+ function node_labels(t) {
21412
+ if (typeof t !== "function") t = (k) => k;
21413
+ return {
21414
+ role: {
21415
+ "yuno": t("yuno"),
21416
+ "service": t("service"),
21417
+ "volatil child": t("volatil child"),
21418
+ "pure child": t("pure child"),
21419
+ "child": t("child")
21420
+ },
21421
+ status: {
21422
+ "playing": t("playing"),
21423
+ "running (paused)": t("running (paused)"),
21424
+ "running": t("running"),
21425
+ "stopped": t("stopped")
21426
+ },
21427
+ status_short: {
21428
+ "playing": t("playing"),
21429
+ "running": t("running"),
21430
+ "stopped": t("stopped")
21431
+ },
21432
+ badge: {
21433
+ "yuno": t("yuno"),
21434
+ "service": t("service"),
21435
+ "volatil child": t("volatil child"),
21436
+ "pure child": t("pure child"),
21437
+ "disabled": t("disabled"),
21438
+ "bottom": t("bottom"),
21439
+ "commands": t("commands"),
21440
+ "traces": t("traces")
21441
+ },
21442
+ field: {
21443
+ gclass: t("gclass"),
21444
+ name: t("name"),
21445
+ full_name: t("full name"),
21446
+ role: t("role"),
21447
+ status: t("status"),
21448
+ fsm_state: t("fsm state"),
21449
+ disabled: t("disabled"),
21450
+ parent: t("parent"),
21451
+ bottom_gobj: t("bottom gobj"),
21452
+ commands: t("commands"),
21453
+ traces: t("traces"),
21454
+ flags: t("flags"),
21455
+ children: t("children"),
21456
+ yes: t("yes"),
21457
+ collapsed: t("(collapsed)")
21458
+ }
21459
+ };
21460
+ }
21461
+ /************************************************************
21462
+ * The rows of the popover: [label, value], both translated.
21463
+ *
21464
+ * `t` is the app's translator -- the library has none of its
21465
+ * own. Values that are a fixed vocabulary (the role, the
21466
+ * status, yes) go through it too; free text does not.
21467
+ ************************************************************/
21468
+ function node_info_rows(d, t) {
21469
+ let rows = [];
21470
+ if (!d) return rows;
21471
+ let L = node_labels(t);
21472
+ let f = L.field;
21473
+ rows.push([f.gclass, d.gclass || "—"]);
21474
+ rows.push([f.name, d.name || "—"]);
21475
+ if (d.fullname && d.fullname !== d.shortname) rows.push([f.full_name, d.fullname]);
21476
+ rows.push([f.role, L.role[role_i18n_key(node_role(d))]]);
21477
+ rows.push([f.status, node_status_symbol(d) + " " + L.status[node_status_key(d)]]);
21478
+ rows.push([f.fsm_state, d.state || "—"]);
21479
+ if (d.disabled) rows.push([f.disabled, f.yes]);
21480
+ if (d.parent) rows.push([f.parent, d.parent]);
21481
+ if (d.bottom_gobj) rows.push([f.bottom_gobj, d.bottom_gobj]);
21482
+ if (d.commands) rows.push([f.commands, f.yes]);
21483
+ if (Array.isArray(d.gobj_trace_level) && d.gobj_trace_level.length > 0) rows.push([f.traces, d.gobj_trace_level.join(", ")]);
21484
+ if (Array.isArray(d.gobj_flags) && d.gobj_flags.length > 0) rows.push([f.flags, d.gobj_flags.join(", ")]);
21485
+ let kids = Array.isArray(d.children) ? d.children.length : 0;
21486
+ if (kids > 0) rows.push([f.children, d.is_collapsed ? kids + " " + f.collapsed : String(kids)]);
21487
+ return rows;
21488
+ }
21489
+ /******************************
21490
+ * Trace levels
21491
+ ******************************/
21492
+ /************************************************************
21493
+ * The trace levels of a backend gobj, one row per level it
21494
+ * can trace: the gclass' own levels first (the ones that are
21495
+ * about this gobj), then the KERNEL's (`machine`,
21496
+ * `create_delete`, `ev_kw`...).
21497
+ *
21498
+ * Two families of levels and three scopes, and the words must
21499
+ * not mix them. The kernel's levels are the table of gobj.c
21500
+ * that the C side calls "global" -- but they are not global
21501
+ * TRACES: every one of them can be set for one gobj
21502
+ * (`set-gobj-trace`), for every gobj of a gclass
21503
+ * (`set-gclass-trace`, the way to trace the machine of C_TCP
21504
+ * alone) or for the whole yuno (`set-global-trace`). A
21505
+ * gclass' own levels have only the first two scopes.
21506
+ *
21507
+ * `d` is the descriptor (its `gobj_trace_level` is what the
21508
+ * gobj traces NOW, whatever the reason). `info` is what the
21509
+ * host fetched for its gclass:
21510
+ *
21511
+ * gclass_levels {name: description} info-gclass-trace
21512
+ * global_levels {name: description} info-global-trace
21513
+ * gclass_on [name, ...] get-gclass-trace
21514
+ * global_on [name, ...] get-global-trace
21515
+ *
21516
+ * `get-gclass-trace` answers the gclass' levels OR'ed with the
21517
+ * yuno's (gobj_get_gclass_trace_level), so a level on in both
21518
+ * is counted as the yuno's: that is the one that would still
21519
+ * hold it on if the gclass let go.
21520
+ *
21521
+ * Each row says, for each scope:
21522
+ *
21523
+ * group "gclass" | "kernel"
21524
+ * gobj_on, gobj_locked the gobj traces it; locked when
21525
+ * that comes from its gclass or
21526
+ * from the yuno -- turning the
21527
+ * gobj's own bit off would not
21528
+ * stop it
21529
+ * gclass_on, gclass_locked every gobj of the gclass traces
21530
+ * it; locked when the yuno does
21531
+ * global_on the whole yuno traces it
21532
+ * origin "global" | "gclass" | ""
21533
+ ************************************************************/
21534
+ function trace_rows(d, info) {
21535
+ let rows = [];
21536
+ if (!d || !info) return rows;
21537
+ let list = (x) => Array.isArray(x) ? x : [];
21538
+ let now = list(d.gobj_trace_level);
21539
+ let global_on = list(info.global_on);
21540
+ let gclass_on = list(info.gclass_on);
21541
+ let seen = {};
21542
+ let add = (group, levels) => {
21543
+ if (!levels || typeof levels !== "object") return;
21544
+ for (let level of Object.keys(levels)) {
21545
+ if (seen[level]) continue;
21546
+ seen[level] = true;
21547
+ let by_global = global_on.indexOf(level) >= 0;
21548
+ let by_gclass = !by_global && gclass_on.indexOf(level) >= 0;
21549
+ rows.push({
21550
+ level,
21551
+ description: String(levels[level] || ""),
21552
+ group,
21553
+ gobj_on: now.indexOf(level) >= 0 || by_global || by_gclass,
21554
+ gobj_locked: by_global || by_gclass,
21555
+ gclass_on: by_global || by_gclass,
21556
+ gclass_locked: by_global,
21557
+ global_on: by_global,
21558
+ origin: by_global ? "global" : by_gclass ? "gclass" : ""
21559
+ });
21560
+ }
21561
+ };
21562
+ add("gclass", info.gclass_levels);
21563
+ add("kernel", info.global_levels);
21564
+ return rows;
21565
+ }
21566
+ /************************************************************
21567
+ * The rows of the YUNO's scope: the kernel's levels, and
21568
+ * whether the whole yuno traces each one (`set-global-trace`).
21569
+ * A gclass' own levels have no such scope.
21570
+ ************************************************************/
21571
+ function global_trace_rows(info) {
21572
+ let rows = [];
21573
+ if (!info) return rows;
21574
+ let global_on = Array.isArray(info.global_on) ? info.global_on : [];
21575
+ let levels = info.global_levels && typeof info.global_levels === "object" ? info.global_levels : {};
21576
+ for (let level of Object.keys(levels)) rows.push({
21577
+ level,
21578
+ description: String(levels[level] || ""),
21579
+ group: "kernel",
21580
+ global_on: global_on.indexOf(level) >= 0
21581
+ });
21582
+ return rows;
21583
+ }
21584
+ /************************************************************
21585
+ * The levels a scope holds ON ITS OWN -- what "remove the
21586
+ * traces" of that scope has to turn off. Not the locked ones:
21587
+ * they are held by a wider scope, and turning them off here
21588
+ * would change nothing.
21589
+ ************************************************************/
21590
+ function own_trace_levels(rows, scope) {
21591
+ let out = [];
21592
+ for (let r of rows || []) if (scope === "gobj" && r.gobj_on && !r.gobj_locked) out.push(r.level);
21593
+ else if (scope === "gclass" && r.gclass_on && !r.gclass_locked) out.push(r.level);
21594
+ else if (scope === "global" && r.global_on) out.push(r.level);
21595
+ return out;
21596
+ }
21597
+ //#endregion
21180
21598
  //#region src/c_yui_fsm_graph.js
21181
21599
  /***********************************************************************
21182
21600
  * c_yui_fsm_graph.js
@@ -22060,11 +22478,29 @@ function yui_button_mark_done($button, label) {
22060
22478
  * the host mounts `$container` wherever it wants (a C_YUI_WINDOW body
22061
22479
  * on desktop, a dialog on a phone). `yui_gclass_view.js` does both.
22062
22480
  *
22481
+ * THE LAYOUT. The head says what the gclass is called, how many gobjs
22482
+ * of it there are, the instance the reader came from with its state,
22483
+ * and the methods it implements. Then the short zones (the machine,
22484
+ * the trace levels), side by side when the VIEWER is wide -- a
22485
+ * container query: a 720px window on a wide screen is narrow -- and
22486
+ * the long tables (attributes, commands) across the whole width, each
22487
+ * showing ROWS_CAP entries and a button for the rest (a search shows
22488
+ * every match).
22489
+ *
22490
+ * ITS TRACES, when the host can set them (`traces` attr, {info,
22491
+ * pending}): the trace levels zone has one box per level for every
22492
+ * gobj of the gclass, own levels and the kernel's; a level the yuno
22493
+ * holds is locked. A box publishes EV_SET_GCLASS_TRACE {gclass,
22494
+ * levels, set} to the host (this gclass is its child; the gobj tree
22495
+ * declares it) and locks the zone until EV_SET_TRACES hands back what
22496
+ * the backend says now. Without `traces` the levels are only listed.
22497
+ *
22063
22498
  * DOM is self-describing (UPPER_SNAKE logical classes): GCLASS_VIEWER /
22064
22499
  * GCLASS_TOOLBAR / GCLASS_SEARCH / GCLASS_VIEW_SWITCH / GCLASS_ZONES /
22065
- * GCLASS_HEAD / GCLASS_ZONE / GCLASS_ZONE_TITLE / GCLASS_ZONE_BODY /
22500
+ * GCLASS_HEAD / GCLASS_METHODS / GCLASS_CURRENT / GCLASS_PAIR /
22501
+ * GCLASS_FULL / GCLASS_ZONE / GCLASS_ZONE_TITLE / GCLASS_ZONE_BODY /
22066
22502
  * GCLASS_TABLE / GCLASS_MATRIX / GCLASS_CELL / GCLASS_PUBLISHED /
22067
- * GCLASS_RAW.
22503
+ * GCLASS_TRACE_TOGGLES / GCLASS_SHOW_ALL / GCLASS_RAW.
22068
22504
  *
22069
22505
  * Copyright (c) 2026, ArtGins.
22070
22506
  * All Rights Reserved.
@@ -22094,31 +22530,27 @@ var MACHINE_VIEWS = [{
22094
22530
  var MAX_RAW_CHARS = 2e6;
22095
22531
  var ZONES = [
22096
22532
  {
22097
- id: "attrs",
22098
- key: "attributes",
22099
- col: "left"
22100
- },
22101
- {
22102
- id: "commands",
22103
- key: "commands",
22104
- col: "left"
22105
- },
22106
- {
22107
- id: "methods",
22108
- key: "methods",
22109
- col: "left"
22533
+ id: "machine",
22534
+ key: "machine",
22535
+ pair: true
22110
22536
  },
22111
22537
  {
22112
22538
  id: "traces",
22113
22539
  key: "trace levels",
22114
- col: "left"
22540
+ pair: true
22115
22541
  },
22116
22542
  {
22117
- id: "machine",
22118
- key: "machine",
22119
- col: "right"
22543
+ id: "attrs",
22544
+ key: "attributes",
22545
+ pair: false
22546
+ },
22547
+ {
22548
+ id: "commands",
22549
+ key: "commands",
22550
+ pair: false
22120
22551
  }
22121
22552
  ];
22553
+ var ROWS_CAP = 20;
22122
22554
  /***************************************************************
22123
22555
  * Data
22124
22556
  ***************************************************************/
@@ -22127,6 +22559,8 @@ var attrs_table$10 = [
22127
22559
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_JSON, "description", 0, null, "The gclass description, as `view-gclass` answers it or `describe_local_gclass()` builds it"),
22128
22560
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "gclass_name", 0, "", "Name to head the view with when the description carries none"),
22129
22561
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "current_state", 0, "", "State of the INSTANCE the host is showing, lit in the machine. Empty when the host is not showing one"),
22562
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "instance_name", 0, "", "Name of that instance, said beside its state: a gclass has several"),
22563
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_JSON, "traces", 0, null, "{info, pending}: the host can set this gclass' traces for every gobj of it (EV_SET_GCLASS_TRACE). `info` is what it read: {gclass_levels, global_levels, gclass_on, global_on, error}, null while it reads. Null: the levels are only listed"),
22130
22564
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "view_mode", 0, "zones", "View: 'zones' or 'raw'"),
22131
22565
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "$container", 0, null, "HTMLElement root, mounted by the parent"),
22132
22566
  (0, _yuneta_gobj_js.SDATA_END)()
@@ -22135,6 +22569,7 @@ var PRIVATE_DATA$10 = {
22135
22569
  model: null,
22136
22570
  search: "",
22137
22571
  collapsed: null,
22572
+ expanded: null,
22138
22573
  machine_view: "matrix",
22139
22574
  graph_gobj: null,
22140
22575
  $zones: null,
@@ -22153,6 +22588,7 @@ var __gclass__$10 = null;
22153
22588
  function mt_create$10(gobj) {
22154
22589
  let priv = gobj.priv;
22155
22590
  priv.collapsed = /* @__PURE__ */ new Set();
22591
+ priv.expanded = /* @__PURE__ */ new Set();
22156
22592
  priv.search = "";
22157
22593
  priv.machine_view = "matrix";
22158
22594
  priv.model = gclass_view_model((0, _yuneta_gobj_js.gobj_read_attr)(gobj, "description"));
@@ -22468,16 +22904,13 @@ function render_zones(gobj) {
22468
22904
  return;
22469
22905
  }
22470
22906
  let graph_mode = priv.machine_view === "graph";
22471
- let left = [];
22472
- let right = [];
22907
+ let pair = [];
22473
22908
  let full = [];
22474
22909
  for (let zone of ZONES) {
22475
22910
  let $zone = build_zone(gobj, zone);
22476
22911
  if (!$zone) continue;
22477
- if (zone.col === "right") {
22478
- if (graph_mode) full.push($zone);
22479
- else right.push($zone);
22480
- } else left.push($zone);
22912
+ if (zone.pair) pair.push($zone);
22913
+ else full.push($zone);
22481
22914
  }
22482
22915
  let $root = (0, _yuneta_gobj_js.createElement2)([
22483
22916
  "div",
@@ -22486,21 +22919,13 @@ function render_zones(gobj) {
22486
22919
  build_head(gobj, model),
22487
22920
  [
22488
22921
  "div",
22489
- { class: "GCLASS_FULL" + (graph_mode ? "" : " is-hidden") },
22490
- full
22922
+ { class: "GCLASS_PAIR" + (graph_mode ? " is-stacked" : "") },
22923
+ pair
22491
22924
  ],
22492
22925
  [
22493
22926
  "div",
22494
- { class: "GCLASS_COLS" + (graph_mode ? " is-stacked" : "") },
22495
- [[
22496
- "div",
22497
- { class: "GCLASS_COL GCLASS_COL_LEFT" },
22498
- left
22499
- ], [
22500
- "div",
22501
- { class: "GCLASS_COL GCLASS_COL_RIGHT" + (graph_mode ? " is-hidden" : "") },
22502
- right
22503
- ]]
22927
+ { class: "GCLASS_FULL" },
22928
+ full
22504
22929
  ]
22505
22930
  ]
22506
22931
  ]);
@@ -22511,8 +22936,11 @@ function render_zones(gobj) {
22511
22936
  if (priv.machine_view === "graph" && !priv.collapsed.has("machine")) build_graph_child(gobj);
22512
22937
  }
22513
22938
  /************************************************************
22514
- * The header: what this gclass is called, and the two
22515
- * numbers a reader asks for before anything else.
22939
+ * The header: what this gclass is called, how many gobjs
22940
+ * of it there are, which instance the reader came from and
22941
+ * the state it is in -- and the methods it implements, a
22942
+ * handful of chips that used to be a zone at the bottom of
22943
+ * every other.
22516
22944
  ************************************************************/
22517
22945
  function build_head(gobj, model) {
22518
22946
  let items = [[
@@ -22529,11 +22957,8 @@ function build_head(gobj, model) {
22529
22957
  String(model.instances)
22530
22958
  ], [
22531
22959
  "span",
22532
- {
22533
- class: "GCLASS_INSTANCES_LABEL",
22534
- i18n: "instances"
22535
- },
22536
- (0, i18next.t)("instances")
22960
+ { class: "GCLASS_INSTANCES_LABEL" },
22961
+ (0, i18next.t)("instances", { count: model.instances })
22537
22962
  ]]
22538
22963
  ]);
22539
22964
  for (let flag of model.gcflag) items.push([
@@ -22542,19 +22967,70 @@ function build_head(gobj, model) {
22542
22967
  text_node(flag)
22543
22968
  ]);
22544
22969
  let current = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "current_state");
22545
- if (current) items.push([
22970
+ if (current) {
22971
+ let instance = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "instance_name");
22972
+ let parts = [];
22973
+ if (instance) parts.push([
22974
+ "span",
22975
+ { class: "GCLASS_CURRENT_INSTANCE" },
22976
+ text_node(instance)
22977
+ ]);
22978
+ parts.push([
22979
+ "span",
22980
+ { class: "GCLASS_CURRENT_STATE" },
22981
+ text_node(current)
22982
+ ]);
22983
+ items.push([
22984
+ "span",
22985
+ {
22986
+ class: "GCLASS_CHIP GCLASS_CURRENT",
22987
+ title: (0, i18next.t)("current state"),
22988
+ "data-i18n-title": "current state"
22989
+ },
22990
+ parts
22991
+ ]);
22992
+ }
22993
+ let rows = [[
22994
+ "div",
22995
+ { class: "GCLASS_HEAD_ROW" },
22996
+ items
22997
+ ]];
22998
+ let methods = function(names, cls, $label) {
22999
+ if (!names.length) return;
23000
+ rows.push([
23001
+ "div",
23002
+ { class: `GCLASS_HEAD_ROW ${cls}` },
23003
+ [$label, [
23004
+ "span",
23005
+ { class: "GCLASS_CHIPS" },
23006
+ names.map((m) => [
23007
+ "span",
23008
+ row_attrs(m, { class: "GCLASS_CHIP GCLASS_METHOD" }),
23009
+ text_node(m)
23010
+ ])
23011
+ ]]
23012
+ ]);
23013
+ };
23014
+ methods(model.methods, "GCLASS_METHODS", [
23015
+ "span",
23016
+ {
23017
+ class: "GCLASS_HEAD_LABEL",
23018
+ i18n: "methods"
23019
+ },
23020
+ (0, i18next.t)("methods")
23021
+ ]);
23022
+ methods(model.internal_methods, "GCLASS_INTERNAL_METHODS", [
22546
23023
  "span",
22547
23024
  {
22548
- class: "GCLASS_CHIP GCLASS_CURRENT",
22549
- title: (0, i18next.t)("current state"),
22550
- "data-i18n-title": "current state"
23025
+ class: "GCLASS_HEAD_LABEL",
23026
+ i18n: "internal methods"
22551
23027
  },
22552
- text_node(current)
23028
+ (0, i18next.t)("internal methods")
22553
23029
  ]);
22554
23030
  return [
22555
23031
  "div",
22556
23032
  { class: "GCLASS_HEAD" },
22557
- items
23033
+ rows
22558
23034
  ];
22559
23035
  }
22560
23036
  /************************************************************
@@ -22570,25 +23046,32 @@ function build_zone(gobj, zone) {
22570
23046
  let model = priv.model;
22571
23047
  let body = null;
22572
23048
  let count = 0;
23049
+ let more = null;
22573
23050
  switch (zone.id) {
22574
23051
  case "attrs":
22575
23052
  count = model.attrs.length;
22576
23053
  body = build_attrs(model.attrs);
23054
+ more = show_all_button(gobj, zone.id, count);
22577
23055
  break;
22578
23056
  case "commands":
22579
23057
  count = model.commands.filter((c) => c.kind === "command").length;
22580
23058
  body = build_commands(model.commands);
23059
+ more = show_all_button(gobj, zone.id, count);
22581
23060
  break;
22582
- case "methods":
22583
- count = model.methods.length + model.internal_methods.length;
22584
- body = build_methods(model);
22585
- break;
22586
- case "traces":
22587
- count = model.trace_levels.length;
22588
- body = build_traces(model.trace_levels);
23061
+ case "traces": {
23062
+ let traces = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "traces");
23063
+ if (traces && typeof traces === "object") {
23064
+ let built = build_trace_toggles(gobj, model, traces);
23065
+ count = built.count;
23066
+ body = built.body;
23067
+ } else {
23068
+ count = model.trace_levels.length;
23069
+ body = build_traces(model.trace_levels);
23070
+ }
22589
23071
  break;
23072
+ }
22590
23073
  case "machine":
22591
- count = model.fsm.states.length ? `${model.fsm.states.length} · ${model.fsm.rows.length}` : model.fsm.rows.length;
23074
+ count = model.fsm.states.length ? `${(0, i18next.t)("machine states", { count: model.fsm.states.length })} · ${(0, i18next.t)("machine events", { count: model.fsm.rows.length })}` : (0, i18next.t)("machine events", { count: model.fsm.rows.length });
22592
23075
  body = build_machine(gobj, model.fsm);
22593
23076
  break;
22594
23077
  default:
@@ -22641,11 +23124,34 @@ function build_zone(gobj, zone) {
22641
23124
  [$toggle, [
22642
23125
  "div",
22643
23126
  { class: "GCLASS_ZONE_BODY" + (collapsed ? " is-hidden" : "") },
22644
- [body]
23127
+ more ? [body, more] : [body]
22645
23128
  ]]
22646
23129
  ]);
22647
23130
  }
22648
23131
  /************************************************************
23132
+ * The button under a long table: the entries past ROWS_CAP
23133
+ * are drawn and hidden (apply_search() decides), so showing
23134
+ * them is a class, not a rebuild. Null when there are none.
23135
+ ************************************************************/
23136
+ function show_all_button(gobj, zone_id, count) {
23137
+ if (count <= ROWS_CAP || gobj.priv.expanded.has(zone_id)) return null;
23138
+ return [
23139
+ "button",
23140
+ {
23141
+ class: "GCLASS_SHOW_ALL button is-small",
23142
+ type: "button",
23143
+ "data-zone": zone_id,
23144
+ title: (0, i18next.t)("show all {{n}}", { n: count }),
23145
+ "aria-label": (0, i18next.t)("show all {{n}}", { n: count })
23146
+ },
23147
+ (0, i18next.t)("show all {{n}}", { n: count }),
23148
+ { click: function(evt) {
23149
+ evt.stopPropagation();
23150
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_SHOW_ALL", { zone: zone_id }, gobj);
23151
+ } }
23152
+ ];
23153
+ }
23154
+ /************************************************************
22649
23155
  * An "empty zone" line. It says WHY it is empty, which is
22650
23156
  * never the same as saying nothing.
22651
23157
  ************************************************************/
@@ -22711,10 +23217,10 @@ function flag_chips(flags) {
22711
23217
  ************************************************************/
22712
23218
  function build_attrs(attrs) {
22713
23219
  if (!attrs.length) return empty_line("no attributes declared");
22714
- let rows = attrs.map(function(a) {
23220
+ let rows = attrs.map(function(a, i) {
22715
23221
  return [
22716
23222
  "tr",
22717
- row_attrs(`${a.id} ${a.type} ${a.flags.join(" ")} ${a.description}`),
23223
+ row_attrs(`${a.id} ${a.type} ${a.flags.join(" ")} ${a.description}`, capped_attrs(i)),
22718
23224
  [
22719
23225
  [
22720
23226
  "td",
@@ -22799,11 +23305,14 @@ function build_attrs(attrs) {
22799
23305
  function build_commands(commands) {
22800
23306
  if (!commands.length) return empty_line("no commands declared");
22801
23307
  let rows = [];
23308
+ let n = 0;
22802
23309
  for (let c of commands) {
23310
+ if (c.kind === "command") n++;
23311
+ let capped = capped_attrs(c.kind === "command" ? n - 1 : n);
22803
23312
  if (c.kind === "section") {
22804
23313
  rows.push([
22805
23314
  "tr",
22806
- row_attrs(c.label, { class: "GCLASS_ROW GCLASS_CMD_SECTION" }),
23315
+ row_attrs(c.label, Object.assign({ class: "GCLASS_ROW GCLASS_CMD_SECTION" }, capped)),
22807
23316
  [[
22808
23317
  "td",
22809
23318
  { colspan: "2" },
@@ -22825,7 +23334,7 @@ function build_commands(commands) {
22825
23334
  name_items = name_items.concat(flag_chips(c.flags));
22826
23335
  rows.push([
22827
23336
  "tr",
22828
- row_attrs(`${c.id} ${c.alias.join(" ")} ${c.description}`),
23337
+ row_attrs(`${c.id} ${c.alias.join(" ")} ${c.description}`, capped),
22829
23338
  [[
22830
23339
  "td",
22831
23340
  { class: "GCLASS_CELL_KEY" },
@@ -22838,7 +23347,7 @@ function build_commands(commands) {
22838
23347
  ]);
22839
23348
  for (let p of c.parameters) rows.push([
22840
23349
  "tr",
22841
- row_attrs(`${c.id} ${p.id} ${p.description}`, { class: "GCLASS_ROW GCLASS_CMD_PARAM" }),
23350
+ row_attrs(`${c.id} ${p.id} ${p.description}`, Object.assign({ class: "GCLASS_ROW GCLASS_CMD_PARAM" }, capped)),
22842
23351
  [[
22843
23352
  "td",
22844
23353
  { class: "GCLASS_CELL_KEY" },
@@ -22876,78 +23385,217 @@ function build_commands(commands) {
22876
23385
  ]]
22877
23386
  ]);
22878
23387
  }
23388
+ function capped_attrs(i) {
23389
+ return i >= ROWS_CAP ? { "data-capped": "1" } : {};
23390
+ }
22879
23391
  /************************************************************
22880
- * The methods zone: the ones the gclass IMPLEMENTS.
22881
- *
22882
- * A table of every possible method, mostly empty, tells the
22883
- * reader nothing -- so both sides send only what is wired,
22884
- * and this draws them as chips.
23392
+ * The trace levels zone.
22885
23393
  ************************************************************/
22886
- function build_methods(model) {
22887
- if (!model.methods.length && !model.internal_methods.length) return empty_line("no methods declared");
22888
- let blocks = [];
22889
- if (model.methods.length) blocks.push([
22890
- "div",
22891
- { class: "GCLASS_CHIPS" },
22892
- model.methods.map((m) => [
22893
- "span",
22894
- row_attrs(m, { class: "GCLASS_CHIP GCLASS_METHOD" }),
22895
- text_node(m)
22896
- ])
23394
+ function build_traces(levels) {
23395
+ if (!levels.length) return empty_line("no trace levels declared");
23396
+ return scroller([
23397
+ "table",
23398
+ { class: "GCLASS_TABLE GCLASS_TABLE_TRACES" },
23399
+ [[
23400
+ "tbody",
23401
+ {},
23402
+ levels.map(function(l) {
23403
+ return [
23404
+ "tr",
23405
+ row_attrs(`${l.id} ${l.description}`),
23406
+ [[
23407
+ "td",
23408
+ { class: "GCLASS_CELL_KEY" },
23409
+ text_node(l.id)
23410
+ ], [
23411
+ "td",
23412
+ { class: "GCLASS_CELL_DESC" },
23413
+ text_node(l.description)
23414
+ ]]
23415
+ ];
23416
+ })
23417
+ ]]
22897
23418
  ]);
22898
- if (model.internal_methods.length) {
22899
- blocks.push([
23419
+ }
23420
+ /************************************************************
23421
+ * The trace levels zone of a gclass whose host can SET its
23422
+ * traces: every gobj of it at once (`set-gclass-trace`),
23423
+ * one box per level -- its own, then the kernel's, which
23424
+ * every gclass can trace on its own (the machine of C_TCP
23425
+ * alone). A level the whole yuno traces shows on and locked,
23426
+ * because unticking the gclass would not stop it; the yuno's
23427
+ * scope is set from the gobj tree, not from here.
23428
+ *
23429
+ * A box is an action: the change goes to the FSM, which
23430
+ * tells the host, and the zone stays locked until the host
23431
+ * hands back what the backend says now (EV_SET_TRACES).
23432
+ *
23433
+ * Returns {body, count}.
23434
+ ************************************************************/
23435
+ function build_trace_toggles(gobj, model, traces) {
23436
+ let info = traces.info;
23437
+ if (!info) return {
23438
+ body: empty_line("loading"),
23439
+ count: 0
23440
+ };
23441
+ if (info.error) return {
23442
+ body: [
22900
23443
  "div",
23444
+ { class: "GCLASS_ZONE_EMPTY GCLASS_TRACES_ERROR" },
23445
+ text_node(info.error)
23446
+ ],
23447
+ count: 0
23448
+ };
23449
+ let gclass = model.id || (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "gclass_name");
23450
+ let rows = trace_rows({ gobj_trace_level: [] }, info);
23451
+ let pending = !!traces.pending;
23452
+ let trs = [];
23453
+ let group = "";
23454
+ for (let r of rows) {
23455
+ if (r.group !== group) {
23456
+ group = r.group;
23457
+ trs.push([
23458
+ "tr",
23459
+ { class: "GCLASS_TRACE_GROUP" },
23460
+ [[
23461
+ "td",
23462
+ { colspan: "3" },
23463
+ group === "gclass" ? [text_node(gclass)] : [[
23464
+ "span",
23465
+ { i18n: "kernel levels" },
23466
+ (0, i18next.t)("kernel levels")
23467
+ ]]
23468
+ ]]
23469
+ ]);
23470
+ }
23471
+ let $cb = (0, _yuneta_gobj_js.createElement2)(["input", {
23472
+ type: "checkbox",
23473
+ class: "GCLASS_TRACE_GCLASS",
23474
+ title: (0, i18next.t)("all of the gclass"),
23475
+ "data-i18n-title": "all of the gclass",
23476
+ "aria-label": (0, i18next.t)("all of the gclass"),
23477
+ "data-i18n-aria-label": "all of the gclass"
23478
+ }]);
23479
+ $cb.setAttribute("data-level", r.level);
23480
+ $cb.checked = !!r.gclass_on;
23481
+ $cb.disabled = pending || !!r.gclass_locked;
23482
+ $cb.addEventListener("change", function(evt) {
23483
+ evt.stopPropagation();
23484
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_GCLASS_TRACE_TOGGLED", {
23485
+ level: r.level,
23486
+ set: !!evt.target.checked
23487
+ }, gobj);
23488
+ });
23489
+ let key_cell = [text_node(r.level)];
23490
+ if (r.gclass_locked) key_cell.push([
23491
+ "span",
22901
23492
  {
22902
- class: "GCLASS_SUBTITLE",
22903
- i18n: "internal methods"
23493
+ class: "GCLASS_TRACE_ORIGIN",
23494
+ i18n: "yuno",
23495
+ title: (0, i18next.t)("on for the whole yuno"),
23496
+ "data-i18n-title": "on for the whole yuno"
22904
23497
  },
22905
- (0, i18next.t)("internal methods")
23498
+ (0, i18next.t)("yuno")
22906
23499
  ]);
22907
- blocks.push([
22908
- "div",
22909
- { class: "GCLASS_CHIPS" },
22910
- model.internal_methods.map((m) => [
22911
- "span",
22912
- row_attrs(m, { class: "GCLASS_CHIP GCLASS_METHOD" }),
22913
- text_node(m)
22914
- ])
23500
+ trs.push([
23501
+ "tr",
23502
+ row_attrs(`${r.level} ${r.description}`),
23503
+ [
23504
+ [
23505
+ "td",
23506
+ { class: "GCLASS_CELL_KEY" },
23507
+ key_cell
23508
+ ],
23509
+ [
23510
+ "td",
23511
+ { class: "GCLASS_CELL_DESC" },
23512
+ text_node(r.description)
23513
+ ],
23514
+ [
23515
+ "td",
23516
+ { class: "GCLASS_CELL_BOX" },
23517
+ [$cb]
23518
+ ]
23519
+ ]
22915
23520
  ]);
22916
23521
  }
22917
- return [
22918
- "div",
22919
- { class: "GCLASS_METHODS" },
22920
- blocks
22921
- ];
22922
- }
22923
- /************************************************************
22924
- * The trace levels zone.
22925
- ************************************************************/
22926
- function build_traces(levels) {
22927
- if (!levels.length) return empty_line("no trace levels declared");
22928
- return scroller([
22929
- "table",
22930
- { class: "GCLASS_TABLE GCLASS_TABLE_TRACES" },
22931
- [[
22932
- "tbody",
22933
- {},
22934
- levels.map(function(l) {
22935
- return [
22936
- "tr",
22937
- row_attrs(`${l.id} ${l.description}`),
23522
+ let none = pending || own_trace_levels(rows, "gclass").length === 0;
23523
+ let $clear = (0, _yuneta_gobj_js.createElement2)([
23524
+ "button",
23525
+ {
23526
+ type: "button",
23527
+ class: "GCLASS_TRACES_CLEAR button is-small",
23528
+ i18n: "remove the traces of the gclass",
23529
+ title: (0, i18next.t)("remove the traces of the gclass"),
23530
+ "data-i18n-title": "remove the traces of the gclass",
23531
+ "aria-label": (0, i18next.t)("remove the traces of the gclass"),
23532
+ "data-i18n-aria-label": "remove the traces of the gclass"
23533
+ },
23534
+ (0, i18next.t)("remove the traces of the gclass"),
23535
+ { click: function(evt) {
23536
+ evt.stopPropagation();
23537
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_GCLASS_TRACES_CLEARED", {}, gobj);
23538
+ } }
23539
+ ]);
23540
+ $clear.disabled = none;
23541
+ return {
23542
+ count: rows.length,
23543
+ body: [
23544
+ "div",
23545
+ { class: "GCLASS_TRACE_TOGGLES" },
23546
+ [
23547
+ scroller([
23548
+ "table",
23549
+ { class: "GCLASS_TABLE GCLASS_TABLE_TRACES" },
22938
23550
  [[
22939
- "td",
22940
- { class: "GCLASS_CELL_KEY" },
22941
- text_node(l.id)
23551
+ "thead",
23552
+ {},
23553
+ [[
23554
+ "tr",
23555
+ {},
23556
+ [
23557
+ [
23558
+ "th",
23559
+ { i18n: "level" },
23560
+ (0, i18next.t)("level")
23561
+ ],
23562
+ [
23563
+ "th",
23564
+ { i18n: "description" },
23565
+ (0, i18next.t)("description")
23566
+ ],
23567
+ [
23568
+ "th",
23569
+ {
23570
+ class: "GCLASS_CELL_BOX",
23571
+ i18n: "all of the gclass"
23572
+ },
23573
+ (0, i18next.t)("all of the gclass")
23574
+ ]
23575
+ ]
23576
+ ]]
22942
23577
  ], [
22943
- "td",
22944
- { class: "GCLASS_CELL_DESC" },
22945
- text_node(l.description)
23578
+ "tbody",
23579
+ {},
23580
+ trs
22946
23581
  ]]
22947
- ];
22948
- })
22949
- ]]
22950
- ]);
23582
+ ]),
23583
+ [
23584
+ "div",
23585
+ {
23586
+ class: "GCLASS_TRACES_NOTE",
23587
+ i18n: "the traces of a gclass survive a restart"
23588
+ },
23589
+ (0, i18next.t)("the traces of a gclass survive a restart")
23590
+ ],
23591
+ [
23592
+ "div",
23593
+ { class: "GCLASS_TRACES_TOOLS" },
23594
+ [$clear]
23595
+ ]
23596
+ ]
23597
+ ]
23598
+ };
22951
23599
  }
22952
23600
  /************************************************************
22953
23601
  * The machine: the matrix, then what it publishes.
@@ -23103,19 +23751,27 @@ function build_machine(gobj, fsm) {
23103
23751
  (0, i18next.t)("publishes")
23104
23752
  ]);
23105
23753
  blocks.push([
23106
- "div",
23107
- { class: "GCLASS_CHIPS GCLASS_PUBLISHED" },
23108
- fsm.published.map(function(p) {
23109
- return [
23110
- "span",
23111
- row_attrs(p.event, { class: "GCLASS_PUB_ROW" }),
23112
- [[
23113
- "span",
23114
- { class: "GCLASS_CHIP GCLASS_PUB_EVENT" },
23115
- text_node(p.event)
23116
- ]].concat(event_flag_chips(p.flags))
23117
- ];
23118
- })
23754
+ "table",
23755
+ { class: "GCLASS_TABLE GCLASS_PUBLISHED" },
23756
+ [[
23757
+ "tbody",
23758
+ {},
23759
+ fsm.published.map(function(p) {
23760
+ return [
23761
+ "tr",
23762
+ row_attrs(p.event, { class: "GCLASS_ROW GCLASS_PUB_ROW" }),
23763
+ [[
23764
+ "td",
23765
+ { class: "GCLASS_CELL_KEY GCLASS_PUB_EVENT" },
23766
+ text_node(p.event)
23767
+ ], [
23768
+ "td",
23769
+ { class: "GCLASS_PUB_FLAGS" },
23770
+ event_flag_chips(p.flags)
23771
+ ]]
23772
+ ];
23773
+ })
23774
+ ]]
23119
23775
  ]);
23120
23776
  }
23121
23777
  return [
@@ -23170,7 +23826,7 @@ function machine_view_switch(gobj) {
23170
23826
  ************************************************************/
23171
23827
  function build_legend(fsm, current) {
23172
23828
  let items = [];
23173
- items.push([
23829
+ if (fsm.rows.some((row) => row.cells.some((cell) => !cell))) items.push([
23174
23830
  "span",
23175
23831
  { class: "GCLASS_LEGEND_ITEM" },
23176
23832
  [["i", { class: "GCLASS_LEGEND_SWATCH is-none" }], [
@@ -23179,6 +23835,19 @@ function build_legend(fsm, current) {
23179
23835
  (0, i18next.t)("not declared in this state")
23180
23836
  ]]
23181
23837
  ]);
23838
+ if (fsm.rows.some((row) => row.cells.some((cell) => cell && cell.has_action && !cell.action))) items.push([
23839
+ "span",
23840
+ { class: "GCLASS_LEGEND_ITEM" },
23841
+ [[
23842
+ "i",
23843
+ { class: "GCLASS_LEGEND_SWATCH is-unnamed" },
23844
+ "●"
23845
+ ], [
23846
+ "span",
23847
+ { i18n: "action, its name not given by the backend" },
23848
+ (0, i18next.t)("action, its name not given by the backend")
23849
+ ]]
23850
+ ]);
23182
23851
  if (fsm.rows.some((row) => row.cells.some((cell) => cell && !cell.has_action))) items.push([
23183
23852
  "span",
23184
23853
  { class: "GCLASS_LEGEND_ITEM" },
@@ -23286,676 +23955,403 @@ function build_graph_child(gobj) {
23286
23955
  (0, _yuneta_gobj_js.gobj_destroy)(graph);
23287
23956
  return false;
23288
23957
  }
23289
- $mount.appendChild($box);
23290
- priv.graph_gobj = graph;
23291
- (0, _yuneta_gobj_js.gobj_start)(graph);
23292
- return true;
23293
- }
23294
- /************************************************************
23295
- * Destroy the hosted graph child, if any.
23296
- ************************************************************/
23297
- function teardown_graph_child(gobj) {
23298
- let priv = gobj.priv;
23299
- if (priv.graph_gobj) {
23300
- if ((0, _yuneta_gobj_js.gobj_is_running)(priv.graph_gobj)) (0, _yuneta_gobj_js.gobj_stop)(priv.graph_gobj);
23301
- (0, _yuneta_gobj_js.gobj_destroy)(priv.graph_gobj);
23302
- priv.graph_gobj = null;
23303
- }
23304
- }
23305
- /************************************************************
23306
- * Apply the current filter to what is drawn.
23307
- *
23308
- * Rows carry their own haystack (`data-find`), so this hides
23309
- * rows and never re-renders: a filter that rebuilt the view
23310
- * would lose the scroll position on every keystroke.
23311
- ************************************************************/
23312
- function apply_search(gobj) {
23313
- let priv = gobj.priv;
23314
- let $zones = priv.$zones;
23315
- if (!$zones) return;
23316
- let term = priv.search;
23317
- $zones.querySelectorAll(".GCLASS_ZONE").forEach(function($zone) {
23318
- let $rows = $zone.querySelectorAll("[data-find]");
23319
- let visible = 0;
23320
- $rows.forEach(function($row) {
23321
- let hit = !term || $row.getAttribute("data-find").indexOf(term) >= 0;
23322
- $row.classList.toggle("is-hidden", !hit);
23323
- if (hit) visible++;
23324
- });
23325
- let $none = $zone.querySelector(".GCLASS_ZONE_NO_MATCH");
23326
- let show_none = term && $rows.length > 0 && visible === 0;
23327
- if (show_none && !$none) {
23328
- let $body = $zone.querySelector(".GCLASS_ZONE_BODY");
23329
- if ($body) $body.appendChild((0, _yuneta_gobj_js.createElement2)([
23330
- "div",
23331
- {
23332
- class: "GCLASS_ZONE_EMPTY GCLASS_ZONE_NO_MATCH",
23333
- i18n: "no matches"
23334
- },
23335
- (0, i18next.t)("no matches")
23336
- ]));
23337
- } else if (!show_none && $none) $none.parentNode.removeChild($none);
23338
- });
23339
- }
23340
- /***************************
23341
- * Actions
23342
- ***************************/
23343
- /************************************************************
23344
- * EV_SET_DESCRIPTION {description, current_state}
23345
- ************************************************************/
23346
- function ac_set_description(gobj, event, kw, src) {
23347
- let priv = gobj.priv;
23348
- let description = kw.description;
23349
- if (description === void 0) {
23350
- (0, _yuneta_gobj_js.log_error)(`${GCLASS_NAME$10}: EV_SET_DESCRIPTION without a description`);
23351
- return -1;
23352
- }
23353
- (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "description", description === null ? null : (0, _yuneta_gobj_js.json_deep_copy)(description));
23354
- if (typeof kw.current_state === "string") (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "current_state", kw.current_state);
23355
- priv.model = gclass_view_model((0, _yuneta_gobj_js.gobj_read_attr)(gobj, "description"));
23356
- render_view(gobj);
23357
- return 0;
23358
- }
23359
- /************************************************************
23360
- * EV_SET_VIEW_MODE {mode}
23361
- ************************************************************/
23362
- function ac_set_view_mode(gobj, event, kw, src) {
23363
- let mode = kw.mode;
23364
- if (!VIEWS.some((v) => v.mode === mode)) {
23365
- (0, _yuneta_gobj_js.log_error)(`${GCLASS_NAME$10}: unknown view_mode '${mode}'`);
23366
- return -1;
23367
- }
23368
- if (mode === current_view_mode(gobj)) return 0;
23369
- (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "view_mode", mode);
23370
- apply_view_mode(gobj);
23371
- render_view(gobj);
23372
- return 0;
23373
- }
23374
- /************************************************************
23375
- * EV_TOGGLE_ZONE {zone}
23376
- ************************************************************/
23377
- function ac_toggle_zone(gobj, event, kw, src) {
23378
- let priv = gobj.priv;
23379
- let zone = kw.zone;
23380
- if (!ZONES.some((z) => z.id === zone)) {
23381
- (0, _yuneta_gobj_js.log_error)(`${GCLASS_NAME$10}: unknown zone '${zone}'`);
23382
- return -1;
23383
- }
23384
- let collapsed = !priv.collapsed.has(zone);
23385
- if (collapsed) priv.collapsed.add(zone);
23386
- else priv.collapsed.delete(zone);
23387
- let $zone = priv.$zones ? priv.$zones.querySelector(`.GCLASS_ZONE[data-zone="${zone}"]`) : null;
23388
- if (!$zone) {
23389
- (0, _yuneta_gobj_js.log_error)(`${GCLASS_NAME$10}: zone '${zone}' is not drawn`);
23390
- return -1;
23391
- }
23392
- $zone.classList.toggle("is-collapsed", collapsed);
23393
- let $body = $zone.querySelector(".GCLASS_ZONE_BODY");
23394
- if ($body) $body.classList.toggle("is-hidden", collapsed);
23395
- let $toggle = $zone.querySelector(".GCLASS_ZONE_TOGGLE");
23396
- if ($toggle) $toggle.setAttribute("aria-expanded", collapsed ? "false" : "true");
23397
- let $arrow = $zone.querySelector(".GCLASS_ZONE_ARROW i");
23398
- if ($arrow) $arrow.className = collapsed ? "yi-chevron-right" : "yi-chevron-down";
23399
- if (zone === "machine" && priv.machine_view === "graph") {
23400
- if (collapsed) teardown_graph_child(gobj);
23401
- else if (!priv.graph_gobj) build_graph_child(gobj);
23402
- }
23403
- return 0;
23404
- }
23405
- /************************************************************
23406
- * EV_SET_MACHINE_VIEW {mode}
23407
- ************************************************************/
23408
- function ac_set_machine_view(gobj, event, kw, src) {
23409
- let priv = gobj.priv;
23410
- let mode = kw.mode;
23411
- if (!MACHINE_VIEWS.some((v) => v.mode === mode)) {
23412
- (0, _yuneta_gobj_js.log_error)(`${GCLASS_NAME$10}: unknown machine view '${mode}'`);
23413
- return -1;
23414
- }
23415
- if (mode === priv.machine_view) return 0;
23416
- priv.machine_view = mode;
23417
- render_zones(gobj);
23418
- return 0;
23419
- }
23420
- /************************************************************
23421
- * EV_SEARCH {text}
23422
- ************************************************************/
23423
- function ac_search$1(gobj, event, kw, src) {
23424
- let priv = gobj.priv;
23425
- priv.search = String(kw.text || "").trim().toLowerCase();
23426
- apply_search(gobj);
23427
- return 0;
23958
+ $mount.appendChild($box);
23959
+ priv.graph_gobj = graph;
23960
+ (0, _yuneta_gobj_js.gobj_start)(graph);
23961
+ return true;
23428
23962
  }
23429
23963
  /************************************************************
23430
- * EV_COPY_ALL -- the description, as the backend answered it.
23964
+ * Destroy the hosted graph child, if any.
23431
23965
  ************************************************************/
23432
- function ac_copy_all(gobj, event, kw, src) {
23433
- let description = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "description");
23434
- let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
23435
- if (description === null || description === void 0) return 0;
23436
- yui_copy_json(description);
23437
- if ($container) {
23438
- let $btn = $container.querySelector(".EV_COPY_ALL");
23439
- if ($btn) yui_button_mark_done($btn, (0, i18next.t)("copied"));
23966
+ function teardown_graph_child(gobj) {
23967
+ let priv = gobj.priv;
23968
+ if (priv.graph_gobj) {
23969
+ if ((0, _yuneta_gobj_js.gobj_is_running)(priv.graph_gobj)) (0, _yuneta_gobj_js.gobj_stop)(priv.graph_gobj);
23970
+ (0, _yuneta_gobj_js.gobj_destroy)(priv.graph_gobj);
23971
+ priv.graph_gobj = null;
23440
23972
  }
23441
- return 0;
23442
23973
  }
23443
23974
  /************************************************************
23444
- * EV_LANGUAGE_CHANGED -- re-translate chrome + re-render
23975
+ * Apply the current filter to what is drawn.
23445
23976
  *
23446
- * The tables are BUILT with t(): their headers and their
23447
- * empty lines carry keys, but the matrix draws state and
23448
- * event names that are not translatable and legend text that
23449
- * is. Re-rendering is the only way both end up in the same
23450
- * language.
23977
+ * Rows carry their own haystack (`data-find`), so this hides
23978
+ * rows and never re-renders: a filter that rebuilt the view
23979
+ * would lose the scroll position on every keystroke.
23451
23980
  ************************************************************/
23452
- function ac_language_changed$6(gobj, event, kw, src) {
23981
+ function apply_search(gobj) {
23453
23982
  let priv = gobj.priv;
23454
- let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
23455
- if ($container) {
23456
- (0, _yuneta_gobj_js.refresh_language)($container, i18next.t);
23457
- if (priv.$search) priv.$search.setAttribute("placeholder", (0, i18next.t)("search"));
23458
- apply_view_mode(gobj);
23459
- }
23460
- render_view(gobj);
23461
- return 0;
23983
+ let $zones = priv.$zones;
23984
+ if (!$zones) return;
23985
+ let term = priv.search;
23986
+ $zones.querySelectorAll(".GCLASS_ZONE").forEach(function($zone) {
23987
+ let $rows = $zone.querySelectorAll("[data-find]");
23988
+ let visible = 0;
23989
+ let all = priv.expanded.has($zone.getAttribute("data-zone"));
23990
+ $rows.forEach(function($row) {
23991
+ let hit = term ? $row.getAttribute("data-find").indexOf(term) >= 0 : all || !$row.hasAttribute("data-capped");
23992
+ $row.classList.toggle("is-hidden", !hit);
23993
+ if (hit) visible++;
23994
+ });
23995
+ let $more = $zone.querySelector(".GCLASS_SHOW_ALL");
23996
+ if ($more) $more.classList.toggle("is-hidden", !!term || all);
23997
+ let $none = $zone.querySelector(".GCLASS_ZONE_NO_MATCH");
23998
+ let show_none = term && $rows.length > 0 && visible === 0;
23999
+ if (show_none && !$none) {
24000
+ let $body = $zone.querySelector(".GCLASS_ZONE_BODY");
24001
+ if ($body) $body.appendChild((0, _yuneta_gobj_js.createElement2)([
24002
+ "div",
24003
+ {
24004
+ class: "GCLASS_ZONE_EMPTY GCLASS_ZONE_NO_MATCH",
24005
+ i18n: "no matches"
24006
+ },
24007
+ (0, i18next.t)("no matches")
24008
+ ]));
24009
+ } else if (!show_none && $none) $none.parentNode.removeChild($none);
24010
+ });
23462
24011
  }
24012
+ /***************************
24013
+ * Actions
24014
+ ***************************/
23463
24015
  /************************************************************
23464
- * EV_REFRESH
24016
+ * EV_SET_DESCRIPTION {description, current_state}
23465
24017
  ************************************************************/
23466
- function ac_refresh$4(gobj, event, kw, src) {
24018
+ function ac_set_description(gobj, event, kw, src) {
24019
+ let priv = gobj.priv;
24020
+ let description = kw.description;
24021
+ if (description === void 0) {
24022
+ (0, _yuneta_gobj_js.log_error)(`${GCLASS_NAME$10}: EV_SET_DESCRIPTION without a description`);
24023
+ return -1;
24024
+ }
24025
+ (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "description", description === null ? null : (0, _yuneta_gobj_js.json_deep_copy)(description));
24026
+ if (typeof kw.current_state === "string") (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "current_state", kw.current_state);
24027
+ priv.model = gclass_view_model((0, _yuneta_gobj_js.gobj_read_attr)(gobj, "description"));
23467
24028
  render_view(gobj);
23468
24029
  return 0;
23469
24030
  }
23470
24031
  /************************************************************
23471
- * EV_SHOW / EV_HIDE -- host visibility
24032
+ * EV_SET_VIEW_MODE {mode}
23472
24033
  ************************************************************/
23473
- function ac_show$7(gobj, event, kw, src) {
23474
- let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
23475
- if ($container) $container.classList.remove("is-hidden");
23476
- return 0;
23477
- }
23478
- function ac_hide$6(gobj, event, kw, src) {
23479
- let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
23480
- if ($container) $container.classList.add("is-hidden");
23481
- return 0;
23482
- }
23483
- /***************************
23484
- * FSM
23485
- ***************************/
23486
- var gmt$10 = {
23487
- mt_create: mt_create$10,
23488
- mt_start: mt_start$10,
23489
- mt_stop: mt_stop$10,
23490
- mt_destroy: mt_destroy$10
23491
- };
23492
- /***************************************************************
23493
- * Create the GClass
23494
- ***************************************************************/
23495
- function create_gclass$10(gclass_name) {
23496
- if (__gclass__$10) {
23497
- (0, _yuneta_gobj_js.log_error)(`GClass ALREADY created: ${gclass_name}`);
24034
+ function ac_set_view_mode(gobj, event, kw, src) {
24035
+ let mode = kw.mode;
24036
+ if (!VIEWS.some((v) => v.mode === mode)) {
24037
+ (0, _yuneta_gobj_js.log_error)(`${GCLASS_NAME$10}: unknown view_mode '${mode}'`);
23498
24038
  return -1;
23499
24039
  }
23500
- __gclass__$10 = (0, _yuneta_gobj_js.gclass_create)(gclass_name, [
23501
- ["EV_SET_DESCRIPTION", 0],
23502
- ["EV_SET_VIEW_MODE", 0],
23503
- ["EV_TOGGLE_ZONE", 0],
23504
- ["EV_SET_MACHINE_VIEW", 0],
23505
- ["EV_SEARCH", 0],
23506
- ["EV_COPY_ALL", 0],
23507
- ["EV_LANGUAGE_CHANGED", 0],
23508
- ["EV_REFRESH", 0],
23509
- ["EV_SHOW", 0],
23510
- ["EV_HIDE", 0]
23511
- ], [["ST_IDLE", [
23512
- [
23513
- "EV_SET_DESCRIPTION",
23514
- ac_set_description,
23515
- null
23516
- ],
23517
- [
23518
- "EV_SET_VIEW_MODE",
23519
- ac_set_view_mode,
23520
- null
23521
- ],
23522
- [
23523
- "EV_TOGGLE_ZONE",
23524
- ac_toggle_zone,
23525
- null
23526
- ],
23527
- [
23528
- "EV_SET_MACHINE_VIEW",
23529
- ac_set_machine_view,
23530
- null
23531
- ],
23532
- [
23533
- "EV_SEARCH",
23534
- ac_search$1,
23535
- null
23536
- ],
23537
- [
23538
- "EV_COPY_ALL",
23539
- ac_copy_all,
23540
- null
23541
- ],
23542
- [
23543
- "EV_LANGUAGE_CHANGED",
23544
- ac_language_changed$6,
23545
- null
23546
- ],
23547
- [
23548
- "EV_REFRESH",
23549
- ac_refresh$4,
23550
- null
23551
- ],
23552
- [
23553
- "EV_SHOW",
23554
- ac_show$7,
23555
- null
23556
- ],
23557
- [
23558
- "EV_HIDE",
23559
- ac_hide$6,
23560
- null
23561
- ]
23562
- ]]], gmt$10, 0, attrs_table$10, PRIVATE_DATA$10, 0, 0, 0, 0);
23563
- if (!__gclass__$10) return -1;
23564
- return 0;
23565
- }
23566
- /***************************************************************
23567
- * Register GClass
23568
- ***************************************************************/
23569
- function register_c_yui_gclass() {
23570
- if ((0, _yuneta_gobj_js.gclass_find_by_name)(GCLASS_NAME$10, false)) return 0;
23571
- if (!(0, _yuneta_gobj_js.gclass_find_by_name)("C_YUI_FSM_GRAPH", false)) register_c_yui_fsm_graph();
23572
- return create_gclass$10(GCLASS_NAME$10);
23573
- }
23574
- //#endregion
23575
- //#region src/gobj_tree_model.js
23576
- /***********************************************************************
23577
- * gobj_tree_model.js
23578
- *
23579
- * The gobj tree of a yuno, as plain data.
23580
- *
23581
- * The view (C_YUI_GOBJ_TREE_JS) draws NODE DESCRIPTORS, never
23582
- * gobjs. There are two producers of a descriptor, because the
23583
- * view has to show the gobjs of the BACKEND too:
23584
- *
23585
- * - describe_js_gobj() the gobj tree of THIS browser yuno
23586
- * - describe_backend_tree() the answer of the backend command
23587
- * `view-gobj-tree` of another yuno
23588
- *
23589
- * Both answer the SAME shape, and that shape is the backend's:
23590
- * the field names are the ones `gobj2json()` writes in
23591
- * `kernel/c/gobj-c/src/gobj.c` (fullname, shortname, gclass,
23592
- * name, parent, state, running, playing, service, disabled,
23593
- * volatil, bottom_gobj, gobj_flags, commands, gobj_trace_level,
23594
- * play_methods). Anything the browser runtime cannot answer is
23595
- * simply absent, and every reader here treats absent as "not
23596
- * known", never as false -- `play_methods` included, which a
23597
- * backend built before it was added does not answer.
23598
- *
23599
- * Copyright (c) 2026, ArtGins.
23600
- * All Rights Reserved.
23601
- ***********************************************************************/
23602
- /************************************************************
23603
- * The role of a node: "yuno" | "service" | "volatil" | "pure" | "child"
23604
- ************************************************************/
23605
- function node_role(d) {
23606
- if (!d) return "child";
23607
- if (d.is_yuno) return "yuno";
23608
- if (d.service) return "service";
23609
- if (d.volatil) return "volatil";
23610
- if (d.pure_child) return "pure";
23611
- return "child";
23612
- }
23613
- /************************************************************
23614
- * What the node is doing: "stopped" | "running" | "playing"
23615
- ************************************************************/
23616
- function node_status(d) {
23617
- if (!d || !d.running) return "stopped";
23618
- return d.playing ? "playing" : "running";
23619
- }
23620
- /************************************************************
23621
- * Whether play and pause MEAN something to the node: its
23622
- * gclass has an mt_play or an mt_pause.
23623
- *
23624
- * Most gclasses have neither -- a C_TCP, a C_TIMER, a C_NODE
23625
- * -- and nothing ever plays them, so a gobj of theirs that
23626
- * runs is doing all it can. Calling it paused painted almost
23627
- * every card of a backend yuno amber, which is the colour of
23628
- * something to look at.
23629
- *
23630
- * `play_methods` is unknown (null) for a backend yuno that does
23631
- * not answer it in `view-gobj-tree`, and then the node is taken
23632
- * as one that can be paused, which is what was said before.
23633
- ************************************************************/
23634
- function node_can_pause(d) {
23635
- return !d || d.play_methods !== false;
23636
- }
23637
- var STATUS_SYMBOLS = {
23638
- "playing": "▶︎",
23639
- "running": "‖",
23640
- "stopped": "■︎"
23641
- };
23642
- var RUNNING_SYMBOL = "●";
23643
- var DISABLED_SYMBOL = "⊘";
24040
+ if (mode === current_view_mode(gobj)) return 0;
24041
+ (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "view_mode", mode);
24042
+ apply_view_mode(gobj);
24043
+ render_view(gobj);
24044
+ return 0;
24045
+ }
23644
24046
  /************************************************************
23645
- * The symbol of a node's status, which is what the reader
23646
- * actually sees first. `disabled` overrides the rest: a
23647
- * disabled gobj is not going to run whatever it is doing now.
24047
+ * EV_TOGGLE_ZONE {zone}
23648
24048
  ************************************************************/
23649
- function node_status_symbol(d) {
23650
- if (d && d.disabled) return DISABLED_SYMBOL;
23651
- let status = node_status(d);
23652
- if (status === "running" && !node_can_pause(d)) return RUNNING_SYMBOL;
23653
- return STATUS_SYMBOLS[status] || STATUS_SYMBOLS.stopped;
24049
+ function ac_toggle_zone(gobj, event, kw, src) {
24050
+ let priv = gobj.priv;
24051
+ let zone = kw.zone;
24052
+ if (!ZONES.some((z) => z.id === zone)) {
24053
+ (0, _yuneta_gobj_js.log_error)(`${GCLASS_NAME$10}: unknown zone '${zone}'`);
24054
+ return -1;
24055
+ }
24056
+ let collapsed = !priv.collapsed.has(zone);
24057
+ if (collapsed) priv.collapsed.add(zone);
24058
+ else priv.collapsed.delete(zone);
24059
+ let $zone = priv.$zones ? priv.$zones.querySelector(`.GCLASS_ZONE[data-zone="${zone}"]`) : null;
24060
+ if (!$zone) {
24061
+ (0, _yuneta_gobj_js.log_error)(`${GCLASS_NAME$10}: zone '${zone}' is not drawn`);
24062
+ return -1;
24063
+ }
24064
+ $zone.classList.toggle("is-collapsed", collapsed);
24065
+ let $body = $zone.querySelector(".GCLASS_ZONE_BODY");
24066
+ if ($body) $body.classList.toggle("is-hidden", collapsed);
24067
+ let $toggle = $zone.querySelector(".GCLASS_ZONE_TOGGLE");
24068
+ if ($toggle) $toggle.setAttribute("aria-expanded", collapsed ? "false" : "true");
24069
+ let $arrow = $zone.querySelector(".GCLASS_ZONE_ARROW i");
24070
+ if ($arrow) $arrow.className = collapsed ? "yi-chevron-right" : "yi-chevron-down";
24071
+ if (zone === "machine" && priv.machine_view === "graph") {
24072
+ if (collapsed) teardown_graph_child(gobj);
24073
+ else if (!priv.graph_gobj) build_graph_child(gobj);
24074
+ }
24075
+ return 0;
23654
24076
  }
23655
24077
  /************************************************************
23656
- * The i18n key of the status, which is NOT the status itself:
23657
- * a gobj that runs and does not play is PAUSED to the reader,
23658
- * and "running" alone never said which of the two it was --
23659
- * unless play and pause mean nothing to it (node_can_pause()).
24078
+ * EV_SET_MACHINE_VIEW {mode}
23660
24079
  ************************************************************/
23661
- function node_status_key(d) {
23662
- switch (node_status(d)) {
23663
- case "playing": return "playing";
23664
- case "running": return node_can_pause(d) ? "running (paused)" : "running";
23665
- default: return "stopped";
24080
+ function ac_set_machine_view(gobj, event, kw, src) {
24081
+ let priv = gobj.priv;
24082
+ let mode = kw.mode;
24083
+ if (!MACHINE_VIEWS.some((v) => v.mode === mode)) {
24084
+ (0, _yuneta_gobj_js.log_error)(`${GCLASS_NAME$10}: unknown machine view '${mode}'`);
24085
+ return -1;
23666
24086
  }
24087
+ if (mode === priv.machine_view) return 0;
24088
+ priv.machine_view = mode;
24089
+ render_zones(gobj);
24090
+ return 0;
23667
24091
  }
23668
- /******************************
23669
- * Producers
23670
- ******************************/
23671
24092
  /************************************************************
23672
- * A descriptor of a LIVE gobj of this browser yuno, children
23673
- * included (the whole subtree, depth-first).
23674
- *
23675
- * `is_root` marks the yuno itself: the JS runtime has no
23676
- * gobj_flag_yuno test of its own.
24093
+ * EV_SEARCH {text}
23677
24094
  ************************************************************/
23678
- function describe_js_gobj(target_gobj, is_root) {
23679
- if (!target_gobj) return null;
23680
- let parent_gobj = (0, _yuneta_gobj_js.gobj_parent)(target_gobj);
23681
- let bottom = (0, _yuneta_gobj_js.gobj_bottom_gobj)(target_gobj);
23682
- let d = {
23683
- gclass: (0, _yuneta_gobj_js.gobj_gclass_name)(target_gobj) || "",
23684
- name: (0, _yuneta_gobj_js.gobj_name)(target_gobj) || "",
23685
- shortname: (0, _yuneta_gobj_js.gobj_short_name)(target_gobj) || "",
23686
- fullname: (0, _yuneta_gobj_js.gobj_full_name)(target_gobj) || "",
23687
- parent: parent_gobj ? (0, _yuneta_gobj_js.gobj_short_name)(parent_gobj) || "" : "",
23688
- state: (0, _yuneta_gobj_js.gobj_current_state)(target_gobj) || "",
23689
- running: !!(0, _yuneta_gobj_js.gobj_is_running)(target_gobj),
23690
- playing: !!(0, _yuneta_gobj_js.gobj_is_playing)(target_gobj),
23691
- service: !!(0, _yuneta_gobj_js.gobj_is_service)(target_gobj),
23692
- volatil: !!(0, _yuneta_gobj_js.gobj_is_volatil)(target_gobj),
23693
- pure_child: !!(0, _yuneta_gobj_js.gobj_is_pure_child)(target_gobj),
23694
- disabled: !!target_gobj.disabled,
23695
- bottom_gobj: bottom ? (0, _yuneta_gobj_js.gobj_short_name)(bottom) || "" : "",
23696
- commands: !!(target_gobj.gclass && target_gobj.gclass.command_table),
23697
- play_methods: !!(target_gobj.gclass && target_gobj.gclass.gmt && (target_gobj.gclass.gmt.mt_play || target_gobj.gclass.gmt.mt_pause)),
23698
- is_yuno: !!is_root,
23699
- children: []
23700
- };
23701
- let children = target_gobj.dl_children || [];
23702
- for (let child of children) {
23703
- let cd = describe_js_gobj(child, false);
23704
- if (cd) d.children.push(cd);
23705
- }
23706
- return d;
24095
+ function ac_search$1(gobj, event, kw, src) {
24096
+ let priv = gobj.priv;
24097
+ priv.search = String(kw.text || "").trim().toLowerCase();
24098
+ apply_search(gobj);
24099
+ return 0;
23707
24100
  }
23708
24101
  /************************************************************
23709
- * A descriptor from ONE node of the `view-gobj-tree` answer
23710
- * of a backend yuno.
23711
- *
23712
- * `shortname` is the key the node hangs from in that answer;
23713
- * the node itself repeats it, so the argument is only the
23714
- * fallback for a filtered answer that dropped the field.
24102
+ * EV_COPY_ALL -- the description, as the backend answered it.
23715
24103
  ************************************************************/
23716
- function describe_backend_node(shortname, node, is_root) {
23717
- if (!node || typeof node !== "object") return null;
23718
- let flags = Array.isArray(node.gobj_flags) ? node.gobj_flags : [];
23719
- let has = (flag) => flags.indexOf(flag) !== -1;
23720
- let d = {
23721
- gclass: node.gclass || "",
23722
- name: node.name || "",
23723
- shortname: node.shortname || shortname || "",
23724
- fullname: node.fullname || "",
23725
- parent: node.parent || "",
23726
- state: node.state || "",
23727
- running: !!node.running,
23728
- playing: !!node.playing,
23729
- service: !!node.service || has("gobj_flag_service") || has("gobj_flag_default_service"),
23730
- volatil: !!node.volatil || has("gobj_flag_volatil"),
23731
- pure_child: has("gobj_flag_pure_child"),
23732
- disabled: !!node.disabled,
23733
- bottom_gobj: node.bottom_gobj || "",
23734
- commands: !!node.commands,
23735
- play_methods: typeof node.play_methods === "boolean" ? node.play_methods : null,
23736
- gobj_flags: flags,
23737
- gobj_trace_level: Array.isArray(node.gobj_trace_level) ? node.gobj_trace_level : [],
23738
- is_yuno: is_root !== void 0 ? !!is_root : has("gobj_flag_yuno"),
23739
- children: []
23740
- };
23741
- let children = node.children && typeof node.children === "object" ? node.children : null;
23742
- if (children) for (let key of Object.keys(children)) {
23743
- let cd = describe_backend_node(key, children[key], false);
23744
- if (cd) d.children.push(cd);
24104
+ function ac_copy_all(gobj, event, kw, src) {
24105
+ let description = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "description");
24106
+ let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
24107
+ if (description === null || description === void 0) return 0;
24108
+ yui_copy_json(description);
24109
+ if ($container) {
24110
+ let $btn = $container.querySelector(".EV_COPY_ALL");
24111
+ if ($btn) yui_button_mark_done($btn, (0, i18next.t)("copied"));
23745
24112
  }
23746
- return d;
24113
+ return 0;
23747
24114
  }
23748
24115
  /************************************************************
23749
- * The whole `view-gobj-tree` answer -> the root descriptor.
23750
- *
23751
- * That answer is a dict of ONE key (the shortname of the gobj
23752
- * the command was asked about) even though it is shaped as a
23753
- * dict all the way down. Returns null for anything else, and
23754
- * the caller reports it: an empty tree and a malformed answer
23755
- * must not look the same.
24116
+ * EV_SHOW_ALL {zone} -- the rows of a long table past the cap.
23756
24117
  ************************************************************/
23757
- function describe_backend_tree(data) {
23758
- if (!data || typeof data !== "object" || Array.isArray(data)) return null;
23759
- let keys = Object.keys(data);
23760
- if (keys.length === 0) return null;
23761
- return describe_backend_node(keys[0], data[keys[0]], true);
24118
+ function ac_show_all(gobj, event, kw, src) {
24119
+ let priv = gobj.priv;
24120
+ if (!ZONES.some((z) => z.id === kw.zone)) {
24121
+ (0, _yuneta_gobj_js.log_error)(`${GCLASS_NAME$10}: show all of no zone '${kw.zone}'`);
24122
+ return -1;
24123
+ }
24124
+ priv.expanded.add(kw.zone);
24125
+ apply_search(gobj);
24126
+ return 0;
23762
24127
  }
23763
- /******************************
23764
- * Readouts
23765
- ******************************/
23766
24128
  /************************************************************
23767
- * The i18n key of a role. Two of the five roles are not the
23768
- * word the reader wants ("pure" and "volatil" alone say
23769
- * nothing), so the map is explicit.
24129
+ * EV_SET_TRACES {info, pending} -- the host, with what the
24130
+ * backend says the gclass traces now.
23770
24131
  ************************************************************/
23771
- function role_i18n_key(role) {
23772
- switch (role) {
23773
- case "yuno": return "yuno";
23774
- case "service": return "service";
23775
- case "volatil": return "volatil child";
23776
- case "pure": return "pure child";
23777
- default: return "child";
23778
- }
24132
+ function ac_set_traces(gobj, event, kw, src) {
24133
+ (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "traces", {
24134
+ info: kw && kw.info && typeof kw.info === "object" ? (0, _yuneta_gobj_js.json_deep_copy)(kw.info) : null,
24135
+ pending: !!(kw && kw.pending)
24136
+ });
24137
+ refresh_zone(gobj, "traces");
24138
+ return 0;
23779
24139
  }
23780
24140
  /************************************************************
23781
- * The marks a node carries besides its role: what the reader
23782
- * would otherwise have to open the popover to learn.
23783
- *
23784
- * Returns i18n KEYS, in a fixed order, so the card and the
23785
- * popover cannot disagree about what a node is.
24141
+ * A box of the trace levels zone: {level, set}.
23786
24142
  ************************************************************/
23787
- function node_badge_keys(d) {
23788
- let badges = [];
23789
- if (!d) return badges;
23790
- let role = node_role(d);
23791
- if (role !== "child") badges.push(role_i18n_key(role));
23792
- if (d.disabled) badges.push("disabled");
23793
- if (d.bottom_gobj) badges.push("bottom");
23794
- if (d.commands) badges.push("commands");
23795
- if (Array.isArray(d.gobj_trace_level) && d.gobj_trace_level.length > 0) badges.push("traces");
23796
- return badges;
24143
+ function ac_gclass_trace_toggled(gobj, event, kw, src) {
24144
+ if (!kw || !kw.level) {
24145
+ (0, _yuneta_gobj_js.log_error)(`${GCLASS_NAME$10}: a gclass trace set of no level`);
24146
+ return -1;
24147
+ }
24148
+ return ask_gclass_trace(gobj, [kw.level], !!kw.set);
23797
24149
  }
23798
24150
  /************************************************************
23799
- * The vocabulary of this view, translated.
23800
- *
23801
- * Written as literal t("...") calls and not as t(key): a key
23802
- * reached through a variable is invisible to the locale
23803
- * validator, which is how a fixed vocabulary ships in one
23804
- * language and never changes it.
24151
+ * "Remove the traces of the gclass": every level it holds
24152
+ * on its own (not the yuno's, which it cannot let go).
23805
24153
  ************************************************************/
23806
- function node_labels(t) {
23807
- if (typeof t !== "function") t = (k) => k;
23808
- return {
23809
- role: {
23810
- "yuno": t("yuno"),
23811
- "service": t("service"),
23812
- "volatil child": t("volatil child"),
23813
- "pure child": t("pure child"),
23814
- "child": t("child")
23815
- },
23816
- status: {
23817
- "playing": t("playing"),
23818
- "running (paused)": t("running (paused)"),
23819
- "running": t("running"),
23820
- "stopped": t("stopped")
23821
- },
23822
- status_short: {
23823
- "playing": t("playing"),
23824
- "running": t("running"),
23825
- "stopped": t("stopped")
23826
- },
23827
- badge: {
23828
- "yuno": t("yuno"),
23829
- "service": t("service"),
23830
- "volatil child": t("volatil child"),
23831
- "pure child": t("pure child"),
23832
- "disabled": t("disabled"),
23833
- "bottom": t("bottom"),
23834
- "commands": t("commands"),
23835
- "traces": t("traces")
23836
- },
23837
- field: {
23838
- gclass: t("gclass"),
23839
- name: t("name"),
23840
- full_name: t("full name"),
23841
- role: t("role"),
23842
- status: t("status"),
23843
- fsm_state: t("fsm state"),
23844
- disabled: t("disabled"),
23845
- parent: t("parent"),
23846
- bottom_gobj: t("bottom gobj"),
23847
- commands: t("commands"),
23848
- traces: t("traces"),
23849
- flags: t("flags"),
23850
- children: t("children"),
23851
- yes: t("yes"),
23852
- collapsed: t("(collapsed)")
23853
- }
23854
- };
24154
+ function ac_gclass_traces_cleared(gobj, event, kw, src) {
24155
+ let traces = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "traces");
24156
+ let levels = own_trace_levels(trace_rows({ gobj_trace_level: [] }, traces && traces.info), "gclass");
24157
+ if (!levels.length) {
24158
+ (0, _yuneta_gobj_js.log_error)(`${GCLASS_NAME$10}: no gclass trace to remove`);
24159
+ return -1;
24160
+ }
24161
+ return ask_gclass_trace(gobj, levels, false);
24162
+ }
24163
+ function ask_gclass_trace(gobj, levels, set) {
24164
+ let priv = gobj.priv;
24165
+ let traces = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "traces");
24166
+ if (!traces || typeof traces !== "object") {
24167
+ (0, _yuneta_gobj_js.log_error)(`${GCLASS_NAME$10}: a gclass trace set, and no host that can set it`);
24168
+ return -1;
24169
+ }
24170
+ (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "traces", {
24171
+ info: traces.info || null,
24172
+ pending: true
24173
+ });
24174
+ refresh_zone(gobj, "traces");
24175
+ (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_SET_GCLASS_TRACE", {
24176
+ gclass: priv.model && priv.model.id || (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "gclass_name"),
24177
+ levels,
24178
+ set
24179
+ });
24180
+ return 0;
23855
24181
  }
23856
24182
  /************************************************************
23857
- * The rows of the popover: [label, value], both translated.
23858
- *
23859
- * `t` is the app's translator -- the library has none of its
23860
- * own. Values that are a fixed vocabulary (the role, the
23861
- * status, yes) go through it too; free text does not.
24183
+ * Draw ONE zone again, in place. The others stay as they
24184
+ * are: the machine's graph keeps its camera, and a table
24185
+ * keeps its scroll.
23862
24186
  ************************************************************/
23863
- function node_info_rows(d, t) {
23864
- let rows = [];
23865
- if (!d) return rows;
23866
- let L = node_labels(t);
23867
- let f = L.field;
23868
- rows.push([f.gclass, d.gclass || "—"]);
23869
- rows.push([f.name, d.name || "—"]);
23870
- if (d.fullname && d.fullname !== d.shortname) rows.push([f.full_name, d.fullname]);
23871
- rows.push([f.role, L.role[role_i18n_key(node_role(d))]]);
23872
- rows.push([f.status, node_status_symbol(d) + " " + L.status[node_status_key(d)]]);
23873
- rows.push([f.fsm_state, d.state || "—"]);
23874
- if (d.disabled) rows.push([f.disabled, f.yes]);
23875
- if (d.parent) rows.push([f.parent, d.parent]);
23876
- if (d.bottom_gobj) rows.push([f.bottom_gobj, d.bottom_gobj]);
23877
- if (d.commands) rows.push([f.commands, f.yes]);
23878
- if (Array.isArray(d.gobj_trace_level) && d.gobj_trace_level.length > 0) rows.push([f.traces, d.gobj_trace_level.join(", ")]);
23879
- if (Array.isArray(d.gobj_flags) && d.gobj_flags.length > 0) rows.push([f.flags, d.gobj_flags.join(", ")]);
23880
- let kids = Array.isArray(d.children) ? d.children.length : 0;
23881
- if (kids > 0) rows.push([f.children, d.is_collapsed ? kids + " " + f.collapsed : String(kids)]);
23882
- return rows;
24187
+ function refresh_zone(gobj, zone_id) {
24188
+ let priv = gobj.priv;
24189
+ const zone = ZONES.find((z) => z.id === zone_id);
24190
+ let $old = priv.$zones ? priv.$zones.querySelector(`.GCLASS_ZONE[data-zone="${zone_id}"]`) : null;
24191
+ if (!zone || !$old || !priv.model) return;
24192
+ let $new = build_zone(gobj, zone);
24193
+ if (!$new) return;
24194
+ $old.replaceWith($new);
24195
+ (0, _yuneta_gobj_js.refresh_language)($new, i18next.t);
24196
+ apply_search(gobj);
23883
24197
  }
23884
- /******************************
23885
- * Trace levels
23886
- ******************************/
23887
24198
  /************************************************************
23888
- * The rows of the TRACES block of a backend gobj, one per
23889
- * level it can trace: the gclass' own levels first (the ones
23890
- * that are about this gobj), then the global ones.
23891
- *
23892
- * `d` is the descriptor (its `gobj_trace_level` is what the
23893
- * gobj traces NOW, whatever the reason). `info` is what the
23894
- * host fetched for its gclass:
23895
- *
23896
- * gclass_levels {name: description} info-gclass-trace
23897
- * global_levels {name: description} info-global-trace
23898
- * gclass_on [name, ...] get-gclass-trace
23899
- * global_on [name, ...] get-global-trace
23900
- *
23901
- * `get-gclass-trace` answers the gclass' levels OR'ed with the
23902
- * global ones (gobj_get_gclass_trace_level), so a level on in
23903
- * both is counted as global: that is the one that would still
23904
- * hold it on if the gclass let go.
23905
- *
23906
- * Each row says, for the two columns of the block:
24199
+ * EV_LANGUAGE_CHANGED -- re-translate chrome + re-render
23907
24200
  *
23908
- * gobj_on, gobj_locked the gobj traces it; locked when
23909
- * that comes from its gclass or
23910
- * from the global level -- turning
23911
- * the gobj's own bit off would not
23912
- * stop it
23913
- * gclass_on, gclass_locked every gobj of the gclass traces
23914
- * it; locked when it is global
23915
- * origin "global" | "gclass" | ""
24201
+ * The tables are BUILT with t(): their headers and their
24202
+ * empty lines carry keys, but the matrix draws state and
24203
+ * event names that are not translatable and legend text that
24204
+ * is. Re-rendering is the only way both end up in the same
24205
+ * language.
23916
24206
  ************************************************************/
23917
- function trace_rows(d, info) {
23918
- let rows = [];
23919
- if (!d || !info) return rows;
23920
- let list = (x) => Array.isArray(x) ? x : [];
23921
- let now = list(d.gobj_trace_level);
23922
- let global_on = list(info.global_on);
23923
- let gclass_on = list(info.gclass_on);
23924
- let seen = {};
23925
- let add = (group, levels) => {
23926
- if (!levels || typeof levels !== "object") return;
23927
- for (let level of Object.keys(levels)) {
23928
- if (seen[level]) continue;
23929
- seen[level] = true;
23930
- let by_global = global_on.indexOf(level) >= 0;
23931
- let by_gclass = !by_global && gclass_on.indexOf(level) >= 0;
23932
- rows.push({
23933
- level,
23934
- description: String(levels[level] || ""),
23935
- group,
23936
- gobj_on: now.indexOf(level) >= 0 || by_global || by_gclass,
23937
- gobj_locked: by_global || by_gclass,
23938
- gclass_on: by_global || by_gclass,
23939
- gclass_locked: by_global,
23940
- origin: by_global ? "global" : by_gclass ? "gclass" : ""
23941
- });
23942
- }
23943
- };
23944
- add("gclass", info.gclass_levels);
23945
- add("global", info.global_levels);
23946
- return rows;
24207
+ function ac_language_changed$6(gobj, event, kw, src) {
24208
+ let priv = gobj.priv;
24209
+ let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
24210
+ if ($container) {
24211
+ (0, _yuneta_gobj_js.refresh_language)($container, i18next.t);
24212
+ if (priv.$search) priv.$search.setAttribute("placeholder", (0, i18next.t)("search"));
24213
+ apply_view_mode(gobj);
24214
+ }
24215
+ render_view(gobj);
24216
+ return 0;
23947
24217
  }
23948
24218
  /************************************************************
23949
- * The levels a scope holds ON ITS OWN -- what "remove the
23950
- * traces" of that scope has to turn off. Not the locked ones:
23951
- * they are held by a wider scope, and turning them off here
23952
- * would change nothing.
24219
+ * EV_REFRESH
23953
24220
  ************************************************************/
23954
- function own_trace_levels(rows, scope) {
23955
- let out = [];
23956
- for (let r of rows || []) if (scope === "gobj" && r.gobj_on && !r.gobj_locked) out.push(r.level);
23957
- else if (scope === "gclass" && r.gclass_on && !r.gclass_locked) out.push(r.level);
23958
- return out;
24221
+ function ac_refresh$4(gobj, event, kw, src) {
24222
+ render_view(gobj);
24223
+ return 0;
24224
+ }
24225
+ /************************************************************
24226
+ * EV_SHOW / EV_HIDE -- host visibility
24227
+ ************************************************************/
24228
+ function ac_show$7(gobj, event, kw, src) {
24229
+ let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
24230
+ if ($container) $container.classList.remove("is-hidden");
24231
+ return 0;
24232
+ }
24233
+ function ac_hide$6(gobj, event, kw, src) {
24234
+ let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
24235
+ if ($container) $container.classList.add("is-hidden");
24236
+ return 0;
24237
+ }
24238
+ /***************************
24239
+ * FSM
24240
+ ***************************/
24241
+ var gmt$10 = {
24242
+ mt_create: mt_create$10,
24243
+ mt_start: mt_start$10,
24244
+ mt_stop: mt_stop$10,
24245
+ mt_destroy: mt_destroy$10
24246
+ };
24247
+ /***************************************************************
24248
+ * Create the GClass
24249
+ ***************************************************************/
24250
+ function create_gclass$10(gclass_name) {
24251
+ if (__gclass__$10) {
24252
+ (0, _yuneta_gobj_js.log_error)(`GClass ALREADY created: ${gclass_name}`);
24253
+ return -1;
24254
+ }
24255
+ const states = [["ST_IDLE", [
24256
+ [
24257
+ "EV_SET_DESCRIPTION",
24258
+ ac_set_description,
24259
+ null
24260
+ ],
24261
+ [
24262
+ "EV_SET_VIEW_MODE",
24263
+ ac_set_view_mode,
24264
+ null
24265
+ ],
24266
+ [
24267
+ "EV_TOGGLE_ZONE",
24268
+ ac_toggle_zone,
24269
+ null
24270
+ ],
24271
+ [
24272
+ "EV_SET_MACHINE_VIEW",
24273
+ ac_set_machine_view,
24274
+ null
24275
+ ],
24276
+ [
24277
+ "EV_SEARCH",
24278
+ ac_search$1,
24279
+ null
24280
+ ],
24281
+ [
24282
+ "EV_COPY_ALL",
24283
+ ac_copy_all,
24284
+ null
24285
+ ],
24286
+ [
24287
+ "EV_LANGUAGE_CHANGED",
24288
+ ac_language_changed$6,
24289
+ null
24290
+ ],
24291
+ [
24292
+ "EV_REFRESH",
24293
+ ac_refresh$4,
24294
+ null
24295
+ ],
24296
+ [
24297
+ "EV_SHOW",
24298
+ ac_show$7,
24299
+ null
24300
+ ],
24301
+ [
24302
+ "EV_HIDE",
24303
+ ac_hide$6,
24304
+ null
24305
+ ],
24306
+ [
24307
+ "EV_SHOW_ALL",
24308
+ ac_show_all,
24309
+ null
24310
+ ],
24311
+ [
24312
+ "EV_SET_TRACES",
24313
+ ac_set_traces,
24314
+ null
24315
+ ],
24316
+ [
24317
+ "EV_GCLASS_TRACE_TOGGLED",
24318
+ ac_gclass_trace_toggled,
24319
+ null
24320
+ ],
24321
+ [
24322
+ "EV_GCLASS_TRACES_CLEARED",
24323
+ ac_gclass_traces_cleared,
24324
+ null
24325
+ ]
24326
+ ]]];
24327
+ const event_types = [
24328
+ ["EV_SET_DESCRIPTION", 0],
24329
+ ["EV_SET_VIEW_MODE", 0],
24330
+ ["EV_TOGGLE_ZONE", 0],
24331
+ ["EV_SET_MACHINE_VIEW", 0],
24332
+ ["EV_SEARCH", 0],
24333
+ ["EV_COPY_ALL", 0],
24334
+ ["EV_LANGUAGE_CHANGED", 0],
24335
+ ["EV_REFRESH", 0],
24336
+ ["EV_SHOW", 0],
24337
+ ["EV_HIDE", 0],
24338
+ ["EV_SHOW_ALL", 0],
24339
+ ["EV_SET_TRACES", 0],
24340
+ ["EV_GCLASS_TRACE_TOGGLED", 0],
24341
+ ["EV_GCLASS_TRACES_CLEARED", 0],
24342
+ ["EV_SET_GCLASS_TRACE", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT]
24343
+ ];
24344
+ __gclass__$10 = (0, _yuneta_gobj_js.gclass_create)(gclass_name, event_types, states, gmt$10, 0, attrs_table$10, PRIVATE_DATA$10, 0, 0, 0, 0);
24345
+ if (!__gclass__$10) return -1;
24346
+ return 0;
24347
+ }
24348
+ /***************************************************************
24349
+ * Register GClass
24350
+ ***************************************************************/
24351
+ function register_c_yui_gclass() {
24352
+ if ((0, _yuneta_gobj_js.gclass_find_by_name)(GCLASS_NAME$10, false)) return 0;
24353
+ if (!(0, _yuneta_gobj_js.gclass_find_by_name)("C_YUI_FSM_GRAPH", false)) register_c_yui_fsm_graph();
24354
+ return create_gclass$10(GCLASS_NAME$10);
23959
24355
  }
23960
24356
  //#endregion
23961
24357
  //#region src/gclass_describe.js
@@ -24172,6 +24568,15 @@ function gclass_view_available() {
24172
24568
  * current_state the state the INSTANCE the reader came
24173
24569
  * from is in, lit in the machine. Omitted,
24174
24570
  * nothing is lit.
24571
+ * instance_name the name of that instance, said beside its
24572
+ * state (a gclass has several).
24573
+ * traces {info, pending}: the host can set this
24574
+ * gclass' traces for every gobj of it. The
24575
+ * viewer then publishes EV_SET_GCLASS_TRACE
24576
+ * {gclass, levels, set} to the HOST (it is its
24577
+ * child), which declares it, and is handed what
24578
+ * the backend says next with EV_SET_TRACES.
24579
+ * Omitted: the levels are only listed.
24175
24580
  * title_prefix what the window says before the gclass
24176
24581
  * name (the yuno it belongs to).
24177
24582
  * on_close called when the reader dismisses it.
@@ -24201,6 +24606,8 @@ function open_gclass_view(host, gclass_name, opts) {
24201
24606
  description,
24202
24607
  gclass_name,
24203
24608
  current_state: opts.current_state || "",
24609
+ instance_name: opts.instance_name || "",
24610
+ traces: opts.traces || null,
24204
24611
  subscriber: null
24205
24612
  }, host);
24206
24613
  if (!jv) {
@@ -51098,24 +51505,41 @@ function yui_graph_minimap_repaint(plugin) {
51098
51505
  * out EV_TRACE_INFO_WANTED {gclass} a card was opened
51099
51506
  * in EV_TRACE_INFO {gclass, gclass_levels, global_levels,
51100
51507
  * gclass_on, global_on, error}
51101
- * out EV_SET_TRACE_LEVEL {scope: "gobj"|"gclass", gobj,
51102
- * gclass, levels: [...], set}
51508
+ * out EV_SET_TRACE_LEVEL {scope: "gobj"|"gclass"|"global",
51509
+ * gobj, gclass, levels: [...], set}
51103
51510
  * out EV_GCLASS_WANTED {gclass} the gclass button
51104
51511
  * in EV_GCLASS_DESCRIPTION {gclass, description}
51105
51512
  *
51106
51513
  * The host loads the FIRST tree on its own (it opened the
51107
51514
  * view); the view asks again only when Refresh is pressed.
51108
51515
  * After a trace is set the host loads the tree and the
51109
- * trace info again: the card the reader is on stays open.
51110
- *
51111
- * In "remote" the popover of a card has a TRACES block: one
51112
- * row per level (the gclass' own, then the global ones), a
51113
- * checkbox for THIS gobj (`set-gobj-trace`) and one for every
51114
- * gobj of its gclass (`set-gclass-trace`). A level that is on
51115
- * for the gclass, or globally, is shown on and locked in the
51116
- * gobj column, with where it comes from: it cannot be turned
51117
- * off from one gobj. A gclass level is saved by the yuno and
51118
- * survives a restart; a gobj level lasts until the yuno ends.
51516
+ * trace info of `gclass` again: what the reader is on stays
51517
+ * open.
51518
+ *
51519
+ * TRACES, in "remote": three scopes, each where it belongs.
51520
+ * The kernel's levels (`machine`, `create_delete`...; the
51521
+ * table gobj.c calls "global") are valid in all three, a
51522
+ * gclass' own levels in the first two:
51523
+ *
51524
+ * this gobj the popover of its card: one box per
51525
+ * level (`set-gobj-trace`). A level its
51526
+ * gclass or the yuno holds is on and
51527
+ * locked, saying which.
51528
+ * every gobj of the gclass viewer the card's GClass
51529
+ * the gclass button opens: its `trace levels` zone
51530
+ * (`set-gclass-trace`). The viewer is this
51531
+ * view's child and publishes
51532
+ * EV_SET_GCLASS_TRACE {gclass, levels, set},
51533
+ * which goes out as EV_SET_TRACE_LEVEL.
51534
+ * the whole yuno the toolbar's `traces of the yuno`, in
51535
+ * the popover (`set-global-trace`). Its
51536
+ * levels are read with EV_TRACE_INFO_WANTED
51537
+ * of the ROOT's gclass, whose answer
51538
+ * carries them like every other one.
51539
+ *
51540
+ * A gclass or yuno level is saved by the yuno and survives a
51541
+ * restart; so does a gobj level of a named service (SDK
51542
+ * 7.27.3+). Any other gobj's level lasts until the yuno ends.
51119
51543
  *
51120
51544
  * The output events are published ONLY in "remote", so a host
51121
51545
  * of a local tree (the Frontend view) declares none of them.
@@ -51298,6 +51722,8 @@ var PRIVATE_DATA$9 = {
51298
51722
  remote_root: null,
51299
51723
  trace_info: {},
51300
51724
  trace_pending: false,
51725
+ popover_mode: "",
51726
+ viewer_stale: "",
51301
51727
  view_refused: false
51302
51728
  };
51303
51729
  var __gclass__$9 = null;
@@ -51951,12 +52377,43 @@ function make_toolbar$1(gobj) {
51951
52377
  },
51952
52378
  options
51953
52379
  ]],
51954
- { change: (evt) => {
51955
- let value = evt.target.value;
51956
- (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CHANGE_LAYOUT", { layout: value }, gobj);
52380
+ { change: (evt) => {
52381
+ let value = evt.target.value;
52382
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CHANGE_LAYOUT", { layout: value }, gobj);
52383
+ } }
52384
+ ]);
52385
+ priv.$layout_select = $wrap.querySelector("select");
52386
+ if (is_remote(gobj)) right_items.push((0, _yuneta_gobj_js.createElement2)([
52387
+ "button",
52388
+ {
52389
+ type: "button",
52390
+ class: "GOBJ_TREE_YUNO_TRACES_BUTTON button",
52391
+ style: {
52392
+ height: toolbar_wide,
52393
+ "margin-left": "0.5em"
52394
+ },
52395
+ title: (0, i18next.t)("traces of the yuno"),
52396
+ "data-i18n-title": "traces of the yuno",
52397
+ "aria-label": (0, i18next.t)("traces of the yuno"),
52398
+ "data-i18n-aria-label": "traces of the yuno"
52399
+ },
52400
+ [[
52401
+ "span",
52402
+ { class: "icon" },
52403
+ [["i", { class: "yi-list-check" }]]
52404
+ ], [
52405
+ "span",
52406
+ {
52407
+ class: "is-hidden-mobile",
52408
+ i18n: "traces of the yuno"
52409
+ },
52410
+ (0, i18next.t)("traces of the yuno")
52411
+ ]],
52412
+ { click: (evt) => {
52413
+ evt.stopPropagation();
52414
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_OPEN_YUNO_TRACES", {}, gobj);
51957
52415
  } }
51958
- ]);
51959
- priv.$layout_select = $wrap.querySelector("select");
52416
+ ]));
51960
52417
  right_items.push($wrap);
51961
52418
  const $toolbar = yui_toolbar({}, [
51962
52419
  [
@@ -52567,18 +53024,110 @@ function is_remote(gobj) {
52567
53024
  return (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "source") === "remote";
52568
53025
  }
52569
53026
  /************************************************************
52570
- * The TRACES block of a backend gobj's popover.
53027
+ * Paint again whatever the popover is showing: a card, or
53028
+ * the yuno's traces.
53029
+ ************************************************************/
53030
+ function render_current_popover(gobj) {
53031
+ let priv = gobj.priv;
53032
+ if (!priv.$popover || priv.$popover.style.display !== "block") return;
53033
+ if (priv.popover_mode === "yuno") {
53034
+ priv.$popover_body.textContent = "";
53035
+ priv.$popover_body.appendChild(build_yuno_traces_block(gobj));
53036
+ } else if (priv.popover_node) render_popover_body(gobj, priv.popover_node);
53037
+ }
53038
+ /************************************************************
53039
+ * The TRACES block of a backend gobj's popover: what THIS
53040
+ * gobj traces (`set-gobj-trace`), one row per level -- the
53041
+ * gclass' own, then the kernel's (trace_rows() in the model).
52571
53042
  *
52572
- * Two columns of checkboxes, THIS gobj and every gobj of its
52573
- * gclass, one row per level (trace_rows() in the model says
52574
- * what each row holds). A box is an action: its change is
52575
- * sent to the FSM, which publishes it to the host, and the
52576
- * block stays locked until the host has loaded what the
52577
- * backend says now -- the box shows the backend's state, not
52578
- * the click.
53043
+ * ONE scope here, the gobj's. The other two live where they
53044
+ * belong: every gobj of the gclass in the gclass viewer (its
53045
+ * `trace levels` zone), the whole yuno behind the toolbar's
53046
+ * `traces of the yuno`. A level one of them holds is shown on
53047
+ * and LOCKED here, saying which one, because unticking the
53048
+ * gobj's own bit would not stop it.
53049
+ *
53050
+ * A box is an action: its change goes to the FSM, which
53051
+ * publishes it to the host, and the block stays locked until
53052
+ * the host has loaded what the backend says now -- the box
53053
+ * shows the backend's state, not the click.
52579
53054
  ************************************************************/
52580
53055
  var TRACES_NOTE_STYLE = "color:var(--bulma-text-weak, #6B7280); margin:4px 0;";
52581
53056
  var TRACES_CELL_STYLE = "padding:1px 4px; text-align:center;";
53057
+ var TRACES_ORIGIN_STYLE = "margin-left:6px; color:var(--bulma-text-weak, #6B7280);";
53058
+ var TRACES_BUTTON_STYLE = "padding:0 8px; height:22px; font-size:11px; white-space:nowrap;";
53059
+ function traces_state_note(info) {
53060
+ if (!info) return [
53061
+ "div",
53062
+ {
53063
+ class: "GOBJ_TREE_TRACES_NOTE",
53064
+ i18n: "loading",
53065
+ style: TRACES_NOTE_STYLE
53066
+ },
53067
+ (0, i18next.t)("loading")
53068
+ ];
53069
+ if (info.error) return [
53070
+ "div",
53071
+ {
53072
+ class: "GOBJ_TREE_TRACES_ERROR",
53073
+ style: "color:var(--bulma-danger, #dc2626); margin:4px 0;"
53074
+ },
53075
+ text_node(info.error)
53076
+ ];
53077
+ return null;
53078
+ }
53079
+ function trace_level_cell(level, description, $origin) {
53080
+ let $level = (0, _yuneta_gobj_js.createElement2)([
53081
+ "td",
53082
+ {
53083
+ class: "GOBJ_TREE_TRACES_LEVEL",
53084
+ style: "padding:1px 4px; word-break:break-all;"
53085
+ },
53086
+ []
53087
+ ]);
53088
+ $level.appendChild(text_node(level));
53089
+ if ($origin) $level.appendChild($origin);
53090
+ $level.setAttribute("title", description);
53091
+ return $level;
53092
+ }
53093
+ function trace_group_row(span, $label) {
53094
+ return [
53095
+ "tr",
53096
+ { class: "GOBJ_TREE_TRACES_GROUP" },
53097
+ [[
53098
+ "td",
53099
+ {
53100
+ colspan: span,
53101
+ style: "padding:4px 4px 1px 4px; font-weight:600; color:var(--bulma-text-weak, #6B7280);"
53102
+ },
53103
+ [$label]
53104
+ ]]
53105
+ ];
53106
+ }
53107
+ function traces_remove_button(gobj, scope, names, $label, disabled) {
53108
+ let $b = (0, _yuneta_gobj_js.createElement2)([
53109
+ "button",
53110
+ Object.assign({
53111
+ type: "button",
53112
+ class: `GOBJ_TREE_TRACES_CLEAR_${scope.toUpperCase()} button is-small`,
53113
+ style: TRACES_BUTTON_STYLE
53114
+ }, names),
53115
+ [$label],
53116
+ { click: (evt) => {
53117
+ evt.stopPropagation();
53118
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_TRACES_CLEARED", { scope }, gobj);
53119
+ } }
53120
+ ]);
53121
+ $b.disabled = !!disabled;
53122
+ return (0, _yuneta_gobj_js.createElement2)([
53123
+ "div",
53124
+ {
53125
+ class: "GOBJ_TREE_TRACES_TOOLS",
53126
+ style: "display:flex; flex-wrap:wrap; gap:4px; margin-top:4px;"
53127
+ },
53128
+ [$b]
53129
+ ]);
53130
+ }
52582
53131
  function build_traces_block(gobj, d) {
52583
53132
  let priv = gobj.priv;
52584
53133
  let info = priv.trace_info[d.gclass] || null;
@@ -52586,36 +53135,14 @@ function build_traces_block(gobj, d) {
52586
53135
  "div",
52587
53136
  {
52588
53137
  class: "GOBJ_TREE_TRACES_HEAD",
52589
- i18n: "traces",
53138
+ i18n: "traces of this gobj",
52590
53139
  style: "font-weight:700; margin:8px 0 2px 0; padding-top:6px; border-top:1px solid var(--bulma-border-weak, #E5E7EB);"
52591
53140
  },
52592
- (0, i18next.t)("traces")
53141
+ (0, i18next.t)("traces of this gobj")
52593
53142
  ]];
52594
- if (!info) {
52595
- kids.push([
52596
- "div",
52597
- {
52598
- class: "GOBJ_TREE_TRACES_NOTE",
52599
- i18n: "loading",
52600
- style: TRACES_NOTE_STYLE
52601
- },
52602
- (0, i18next.t)("loading")
52603
- ]);
52604
- return (0, _yuneta_gobj_js.createElement2)([
52605
- "div",
52606
- { class: "GOBJ_TREE_TRACES" },
52607
- kids
52608
- ]);
52609
- }
52610
- if (info.error) {
52611
- kids.push([
52612
- "div",
52613
- {
52614
- class: "GOBJ_TREE_TRACES_ERROR",
52615
- style: "color:var(--bulma-danger, #dc2626); margin:4px 0;"
52616
- },
52617
- text_node(info.error)
52618
- ]);
53143
+ let state = traces_state_note(info);
53144
+ if (state) {
53145
+ kids.push(state);
52619
53146
  return (0, _yuneta_gobj_js.createElement2)([
52620
53147
  "div",
52621
53148
  { class: "GOBJ_TREE_TRACES" },
@@ -52629,70 +53156,42 @@ function build_traces_block(gobj, d) {
52629
53156
  for (let r of rows) {
52630
53157
  if (r.group !== group) {
52631
53158
  group = r.group;
52632
- let $label = group === "gclass" ? text_node(d.gclass) : (0, _yuneta_gobj_js.createElement2)([
53159
+ trs.push(trace_group_row(2, group === "gclass" ? text_node(d.gclass) : (0, _yuneta_gobj_js.createElement2)([
52633
53160
  "span",
52634
- { i18n: "global" },
52635
- (0, i18next.t)("global")
52636
- ]);
52637
- trs.push([
52638
- "tr",
52639
- { class: "GOBJ_TREE_TRACES_GROUP" },
52640
- [[
52641
- "td",
52642
- {
52643
- colspan: 3,
52644
- style: "padding:4px 4px 1px 4px; font-weight:600; color:var(--bulma-text-weak, #6B7280);"
52645
- },
52646
- [$label]
52647
- ]]
52648
- ]);
53161
+ { i18n: "kernel levels" },
53162
+ (0, i18next.t)("kernel levels")
53163
+ ])));
52649
53164
  }
52650
- let origin = null;
52651
- if (r.origin === "global") origin = [
53165
+ let $origin = null;
53166
+ if (r.origin === "global") $origin = (0, _yuneta_gobj_js.createElement2)([
52652
53167
  "span",
52653
53168
  {
52654
53169
  class: "GOBJ_TREE_TRACES_ORIGIN",
52655
- i18n: "global",
52656
- style: "margin-left:6px; color:var(--bulma-text-weak, #6B7280);"
53170
+ i18n: "yuno",
53171
+ style: TRACES_ORIGIN_STYLE,
53172
+ title: (0, i18next.t)("on for the whole yuno"),
53173
+ "data-i18n-title": "on for the whole yuno"
52657
53174
  },
52658
- (0, i18next.t)("global")
52659
- ];
52660
- else if (r.origin === "gclass") origin = [
53175
+ (0, i18next.t)("yuno")
53176
+ ]);
53177
+ else if (r.origin === "gclass") $origin = (0, _yuneta_gobj_js.createElement2)([
52661
53178
  "span",
52662
53179
  {
52663
53180
  class: "GOBJ_TREE_TRACES_ORIGIN",
52664
- i18n: "gclass",
52665
- style: "margin-left:6px; color:var(--bulma-text-weak, #6B7280);"
52666
- },
52667
- (0, i18next.t)("gclass")
52668
- ];
52669
- let $level = (0, _yuneta_gobj_js.createElement2)([
52670
- "td",
52671
- {
52672
- class: "GOBJ_TREE_TRACES_LEVEL",
52673
- style: "padding:1px 4px; word-break:break-all;"
53181
+ style: TRACES_ORIGIN_STYLE,
53182
+ title: (0, i18next.t)("on for all of the gclass"),
53183
+ "data-i18n-title": "on for all of the gclass"
52674
53184
  },
52675
- []
53185
+ [text_node(d.gclass)]
52676
53186
  ]);
52677
- $level.appendChild(text_node(r.level));
52678
- if (origin) $level.appendChild((0, _yuneta_gobj_js.createElement2)(origin));
52679
- $level.setAttribute("title", r.description);
52680
53187
  trs.push([
52681
53188
  "tr",
52682
53189
  { class: "GOBJ_TREE_TRACES_ROW" },
52683
- [
52684
- $level,
52685
- [
52686
- "td",
52687
- { style: TRACES_CELL_STYLE },
52688
- [trace_checkbox(gobj, "gobj", r.level, r.gobj_on, pending || r.gobj_locked)]
52689
- ],
52690
- [
52691
- "td",
52692
- { style: TRACES_CELL_STYLE },
52693
- [trace_checkbox(gobj, "gclass", r.level, r.gclass_on, pending || r.gclass_locked)]
52694
- ]
52695
- ]
53190
+ [trace_level_cell(r.level, r.description, $origin), [
53191
+ "td",
53192
+ { style: TRACES_CELL_STYLE },
53193
+ [trace_checkbox(gobj, "gobj", r.level, r.gobj_on, pending || r.gobj_locked)]
53194
+ ]]
52696
53195
  ]);
52697
53196
  }
52698
53197
  kids.push([
@@ -52707,32 +53206,21 @@ function build_traces_block(gobj, d) {
52707
53206
  [[
52708
53207
  "tr",
52709
53208
  {},
52710
- [
52711
- [
52712
- "th",
52713
- {
52714
- i18n: "level",
52715
- style: "padding:1px 4px; text-align:left;"
52716
- },
52717
- (0, i18next.t)("level")
52718
- ],
52719
- [
52720
- "th",
52721
- {
52722
- i18n: "this gobj",
52723
- style: TRACES_CELL_STYLE
52724
- },
52725
- (0, i18next.t)("this gobj")
52726
- ],
52727
- [
52728
- "th",
52729
- {
52730
- i18n: "all of the gclass",
52731
- style: TRACES_CELL_STYLE
52732
- },
52733
- (0, i18next.t)("all of the gclass")
52734
- ]
52735
- ]
53209
+ [[
53210
+ "th",
53211
+ {
53212
+ i18n: "level",
53213
+ style: "padding:1px 4px; text-align:left;"
53214
+ },
53215
+ (0, i18next.t)("level")
53216
+ ], [
53217
+ "th",
53218
+ {
53219
+ i18n: "this gobj",
53220
+ style: TRACES_CELL_STYLE
53221
+ },
53222
+ (0, i18next.t)("this gobj")
53223
+ ]]
52736
53224
  ]]
52737
53225
  ], [
52738
53226
  "tbody",
@@ -52740,87 +53228,149 @@ function build_traces_block(gobj, d) {
52740
53228
  trs
52741
53229
  ]]
52742
53230
  ]);
52743
- kids.push([
53231
+ kids.push(d.service ? [
52744
53232
  "div",
52745
53233
  {
52746
53234
  class: "GOBJ_TREE_TRACES_NOTE",
52747
- i18n: "gclass traces survive a restart, gobj traces end with the yuno",
53235
+ i18n: "the traces of a service survive a restart",
52748
53236
  style: TRACES_NOTE_STYLE
52749
53237
  },
52750
- (0, i18next.t)("gclass traces survive a restart, gobj traces end with the yuno")
52751
- ]);
52752
- let none_gobj = pending || own_trace_levels(rows, "gobj").length === 0;
52753
- let none_gclass = pending || own_trace_levels(rows, "gclass").length === 0;
52754
- let btn_style = "padding:0 8px; height:22px; font-size:11px; white-space:nowrap;";
52755
- let clear = (scope) => {
52756
- return { click: (evt) => {
52757
- evt.stopPropagation();
52758
- (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_TRACES_CLEARED", { scope }, gobj);
52759
- } };
52760
- };
52761
- let $clear_gobj = (0, _yuneta_gobj_js.createElement2)([
52762
- "button",
53238
+ (0, i18next.t)("the traces of a service survive a restart")
53239
+ ] : [
53240
+ "div",
52763
53241
  {
52764
- type: "button",
52765
- class: "GOBJ_TREE_TRACES_CLEAR_GOBJ button is-small",
52766
- style: btn_style,
52767
- i18n: "remove the traces of this gobj",
52768
- title: (0, i18next.t)("remove the traces of this gobj"),
52769
- "data-i18n-title": "remove the traces of this gobj",
52770
- "aria-label": (0, i18next.t)("remove the traces of this gobj"),
52771
- "data-i18n-aria-label": "remove the traces of this gobj"
52772
- },
52773
- (0, i18next.t)("remove the traces of this gobj"),
52774
- clear("gobj")
53242
+ class: "GOBJ_TREE_TRACES_NOTE",
53243
+ i18n: "the traces of a gobj that is not a service end with the yuno",
53244
+ style: TRACES_NOTE_STYLE
53245
+ },
53246
+ (0, i18next.t)("the traces of a gobj that is not a service end with the yuno")
52775
53247
  ]);
52776
- let $clear_gclass = (0, _yuneta_gobj_js.createElement2)([
52777
- "button",
53248
+ kids.push(traces_remove_button(gobj, "gobj", {
53249
+ title: (0, i18next.t)("remove the traces of this gobj"),
53250
+ "data-i18n-title": "remove the traces of this gobj",
53251
+ "aria-label": (0, i18next.t)("remove the traces of this gobj"),
53252
+ "data-i18n-aria-label": "remove the traces of this gobj"
53253
+ }, (0, _yuneta_gobj_js.createElement2)([
53254
+ "span",
53255
+ { i18n: "remove the traces of this gobj" },
53256
+ (0, i18next.t)("remove the traces of this gobj")
53257
+ ]), pending || own_trace_levels(rows, "gobj").length === 0));
53258
+ return (0, _yuneta_gobj_js.createElement2)([
53259
+ "div",
53260
+ { class: "GOBJ_TREE_TRACES" },
53261
+ kids
53262
+ ]);
53263
+ }
53264
+ /************************************************************
53265
+ * The yuno's traces (`set-global-trace`): the kernel's levels,
53266
+ * and whether every gobj of the yuno traces each one. Drawn in
53267
+ * the popover, opened from the toolbar, and read from the
53268
+ * answer for the ROOT's gclass -- the yuno itself, whose
53269
+ * answer carries the yuno's levels like every other one.
53270
+ ************************************************************/
53271
+ function build_yuno_traces_block(gobj) {
53272
+ let priv = gobj.priv;
53273
+ let root = priv.remote_root;
53274
+ let info = root && priv.trace_info[root.gclass] || null;
53275
+ let kids = [];
53276
+ let state = traces_state_note(info);
53277
+ if (state) {
53278
+ kids.push(state);
53279
+ return (0, _yuneta_gobj_js.createElement2)([
53280
+ "div",
53281
+ { class: "GOBJ_TREE_YUNO_TRACES" },
53282
+ kids
53283
+ ]);
53284
+ }
53285
+ let rows = global_trace_rows(info);
53286
+ let pending = !!priv.trace_pending;
53287
+ let trs = rows.map((r) => [
53288
+ "tr",
53289
+ { class: "GOBJ_TREE_TRACES_ROW" },
53290
+ [trace_level_cell(r.level, r.description, null), [
53291
+ "td",
53292
+ { style: TRACES_CELL_STYLE },
53293
+ [trace_checkbox(gobj, "global", r.level, r.global_on, pending)]
53294
+ ]]
53295
+ ]);
53296
+ kids.push([
53297
+ "table",
52778
53298
  {
52779
- type: "button",
52780
- class: "GOBJ_TREE_TRACES_CLEAR_GCLASS button is-small",
52781
- style: btn_style,
52782
- i18n: "remove the traces of the gclass",
52783
- title: (0, i18next.t)("remove the traces of the gclass"),
52784
- "data-i18n-title": "remove the traces of the gclass",
52785
- "aria-label": (0, i18next.t)("remove the traces of the gclass"),
52786
- "data-i18n-aria-label": "remove the traces of the gclass"
53299
+ class: "GOBJ_TREE_TRACES_TABLE",
53300
+ style: "width:100%; border-collapse:collapse;"
52787
53301
  },
52788
- (0, i18next.t)("remove the traces of the gclass"),
52789
- clear("gclass")
53302
+ [[
53303
+ "thead",
53304
+ {},
53305
+ [[
53306
+ "tr",
53307
+ {},
53308
+ [[
53309
+ "th",
53310
+ {
53311
+ i18n: "kernel levels",
53312
+ style: "padding:1px 4px; text-align:left;"
53313
+ },
53314
+ (0, i18next.t)("kernel levels")
53315
+ ], [
53316
+ "th",
53317
+ {
53318
+ i18n: "the whole yuno",
53319
+ style: TRACES_CELL_STYLE
53320
+ },
53321
+ (0, i18next.t)("the whole yuno")
53322
+ ]]
53323
+ ]]
53324
+ ], [
53325
+ "tbody",
53326
+ {},
53327
+ trs
53328
+ ]]
52790
53329
  ]);
52791
- $clear_gobj.disabled = none_gobj;
52792
- $clear_gclass.disabled = none_gclass;
52793
53330
  kids.push([
52794
53331
  "div",
52795
53332
  {
52796
- class: "GOBJ_TREE_TRACES_TOOLS",
52797
- style: "display:flex; flex-wrap:wrap; gap:4px; margin-top:4px;"
53333
+ class: "GOBJ_TREE_TRACES_NOTE",
53334
+ i18n: "the yuno's traces survive a restart",
53335
+ style: TRACES_NOTE_STYLE
52798
53336
  },
52799
- [$clear_gobj, $clear_gclass]
53337
+ (0, i18next.t)("the yuno's traces survive a restart")
52800
53338
  ]);
53339
+ kids.push(traces_remove_button(gobj, "global", {
53340
+ title: (0, i18next.t)("remove the traces of the yuno"),
53341
+ "data-i18n-title": "remove the traces of the yuno",
53342
+ "aria-label": (0, i18next.t)("remove the traces of the yuno"),
53343
+ "data-i18n-aria-label": "remove the traces of the yuno"
53344
+ }, (0, _yuneta_gobj_js.createElement2)([
53345
+ "span",
53346
+ { i18n: "remove the traces of the yuno" },
53347
+ (0, i18next.t)("remove the traces of the yuno")
53348
+ ]), pending || own_trace_levels(rows, "global").length === 0));
52801
53349
  return (0, _yuneta_gobj_js.createElement2)([
52802
53350
  "div",
52803
- { class: "GOBJ_TREE_TRACES" },
53351
+ { class: "GOBJ_TREE_YUNO_TRACES" },
52804
53352
  kids
52805
53353
  ]);
52806
53354
  }
53355
+ var TRACE_BOX = {
53356
+ gobj: {
53357
+ cls: "GOBJ_TREE_TRACE_GOBJ",
53358
+ key: "this gobj"
53359
+ },
53360
+ global: {
53361
+ cls: "GOBJ_TREE_TRACE_GLOBAL",
53362
+ key: "the whole yuno"
53363
+ }
53364
+ };
52807
53365
  function trace_checkbox(gobj, scope, level, on, locked) {
52808
- let $cb = null;
52809
- if (scope === "gobj") $cb = (0, _yuneta_gobj_js.createElement2)(["input", {
52810
- type: "checkbox",
52811
- class: "GOBJ_TREE_TRACE_GOBJ",
52812
- title: (0, i18next.t)("this gobj"),
52813
- "data-i18n-title": "this gobj",
52814
- "aria-label": (0, i18next.t)("this gobj"),
52815
- "data-i18n-aria-label": "this gobj"
52816
- }]);
52817
- else $cb = (0, _yuneta_gobj_js.createElement2)(["input", {
53366
+ const box = TRACE_BOX[scope];
53367
+ let $cb = (0, _yuneta_gobj_js.createElement2)(["input", {
52818
53368
  type: "checkbox",
52819
- class: "GOBJ_TREE_TRACE_GCLASS",
52820
- title: (0, i18next.t)("all of the gclass"),
52821
- "data-i18n-title": "all of the gclass",
52822
- "aria-label": (0, i18next.t)("all of the gclass"),
52823
- "data-i18n-aria-label": "all of the gclass"
53369
+ class: box.cls,
53370
+ title: (0, i18next.t)(box.key),
53371
+ "data-i18n-title": box.key,
53372
+ "aria-label": (0, i18next.t)(box.key),
53373
+ "data-i18n-aria-label": box.key
52824
53374
  }]);
52825
53375
  $cb.setAttribute("data-level", level);
52826
53376
  $cb.checked = !!on;
@@ -52843,21 +53393,28 @@ function trace_checkbox(gobj, scope, level, on, locked) {
52843
53393
  function reload_keeping_popover(gobj, opts) {
52844
53394
  let priv = gobj.priv;
52845
53395
  let $popover = priv.$popover;
52846
- let keep = priv.popover_node && $popover && $popover.style.display === "block" ? priv.popover_node.full_name : null;
53396
+ let shown = !!($popover && $popover.style.display === "block");
53397
+ let keep = shown && priv.popover_mode === "node" && priv.popover_node ? priv.popover_node.full_name : null;
53398
+ let keep_yuno = shown && priv.popover_mode === "yuno";
52847
53399
  let left = $popover ? $popover.style.left : "";
52848
53400
  let top = $popover ? $popover.style.top : "";
52849
53401
  refresh_tree(gobj, opts);
53402
+ if (keep_yuno) {
53403
+ open_popover_frame(gobj, "yuno", (0, i18next.t)("traces of the yuno"));
53404
+ $popover.style.left = left;
53405
+ $popover.style.top = top;
53406
+ render_current_popover(gobj);
53407
+ return;
53408
+ }
52850
53409
  if (!keep || !priv.node_by_id) return;
52851
53410
  for (let id of Object.keys(priv.node_by_id)) {
52852
53411
  let d = priv.node_by_id[id];
52853
53412
  if (d.full_name === keep) {
52854
53413
  priv.popover_node = d;
52855
- priv.$popover_title.textContent = d.short_name || d.gclass + (d.name ? "^" + d.name : "");
52856
- priv.$popover_title.title = priv.$popover_title.textContent;
53414
+ open_popover_frame(gobj, "node", d.short_name || d.gclass + (d.name ? "^" + d.name : ""));
52857
53415
  render_popover_body(gobj, d);
52858
53416
  $popover.style.left = left;
52859
53417
  $popover.style.top = top;
52860
- $popover.style.display = "block";
52861
53418
  return;
52862
53419
  }
52863
53420
  }
@@ -52874,8 +53431,7 @@ function show_popover(gobj, node_data, client_x, client_y) {
52874
53431
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
52875
53432
  if (!$popover || !$title || !$container) return;
52876
53433
  priv.popover_node = node_data;
52877
- $title.textContent = node_data.short_name || node_data.gclass + (node_data.name ? "^" + node_data.name : "");
52878
- $title.title = $title.textContent;
53434
+ open_popover_frame(gobj, "node", node_data.short_name || node_data.gclass + (node_data.name ? "^" + node_data.name : ""));
52879
53435
  render_popover_body(gobj, node_data);
52880
53436
  let rect = $container.getBoundingClientRect();
52881
53437
  let offset = 10;
@@ -52905,6 +53461,41 @@ function hide_popover(gobj) {
52905
53461
  if (priv.$popover_body) priv.$popover_body.innerHTML = "";
52906
53462
  if (priv.$popover_title) priv.$popover_title.textContent = "";
52907
53463
  priv.popover_node = null;
53464
+ priv.popover_mode = "";
53465
+ }
53466
+ /************************************************************
53467
+ * The popover's frame for what it is about to show: its
53468
+ * title, and the gclass button only for a card -- the yuno's
53469
+ * traces are no gclass of their own.
53470
+ ************************************************************/
53471
+ function open_popover_frame(gobj, mode, title) {
53472
+ let priv = gobj.priv;
53473
+ priv.popover_mode = mode;
53474
+ priv.$popover_title.textContent = title;
53475
+ priv.$popover_title.title = title;
53476
+ if (priv.$popover_gclass) priv.$popover_gclass.classList.toggle("is-hidden", mode !== "node");
53477
+ priv.$popover.style.display = "block";
53478
+ }
53479
+ /************************************************************
53480
+ * The yuno's traces, in the popover, under the toolbar
53481
+ * button that opened them.
53482
+ ************************************************************/
53483
+ function show_yuno_traces(gobj) {
53484
+ let priv = gobj.priv;
53485
+ let $popover = priv.$popover;
53486
+ let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
53487
+ if (!$popover || !$container) return;
53488
+ priv.popover_node = null;
53489
+ open_popover_frame(gobj, "yuno", (0, i18next.t)("traces of the yuno"));
53490
+ render_current_popover(gobj);
53491
+ let rect = $container.getBoundingClientRect();
53492
+ let $btn = $container.querySelector(".GOBJ_TREE_YUNO_TRACES_BUTTON");
53493
+ let b = $btn ? $btn.getBoundingClientRect() : null;
53494
+ let pop = $popover.getBoundingClientRect();
53495
+ let left = b ? b.right - rect.left - pop.width : rect.width - pop.width - 8;
53496
+ let top = b ? b.bottom - rect.top + 6 : 8;
53497
+ $popover.style.left = Math.max(4, left) + "px";
53498
+ $popover.style.top = Math.max(4, top) + "px";
52908
53499
  }
52909
53500
  /************************************************************
52910
53501
  * Generic tree layout engine.
@@ -53512,7 +54103,7 @@ function ac_open_gclass(gobj, event, kw, src) {
53512
54103
  (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_GCLASS_WANTED", { gclass: node_data.gclass });
53513
54104
  return 0;
53514
54105
  }
53515
- open_gclass_window(gobj, node_data.gclass, null, node_data.state || "");
54106
+ open_gclass_window(gobj, node_data.gclass, null, node_data);
53516
54107
  return 0;
53517
54108
  }
53518
54109
  /************************************************************
@@ -53525,22 +54116,24 @@ function ac_gclass_description(gobj, event, kw, src) {
53525
54116
  return -1;
53526
54117
  }
53527
54118
  let d = priv.popover_node;
53528
- open_gclass_window(gobj, kw.gclass, kw.description, d && d.gclass === kw.gclass ? d.state || "" : "");
54119
+ open_gclass_window(gobj, kw.gclass, kw.description, d && d.gclass === kw.gclass ? d : null);
53529
54120
  return 0;
53530
54121
  }
53531
- function open_gclass_window(gobj, gclass, description, state) {
54122
+ function open_gclass_window(gobj, gclass, description, d) {
53532
54123
  let priv = gobj.priv;
53533
54124
  close_gclass_view(priv.gclass_view);
53534
54125
  priv.gclass_view = null;
53535
54126
  let opts = {
53536
54127
  title_prefix: is_remote(gobj) ? (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "yuno_name") || "" : (0, _yuneta_gobj_js.gobj_yuno_name)() || "",
53537
- current_state: state,
54128
+ current_state: d && d.state || "",
54129
+ instance_name: d && d.name || "",
53538
54130
  on_close: () => {
53539
54131
  if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return;
53540
54132
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_GCLASS_CLOSED", {}, gobj);
53541
54133
  }
53542
54134
  };
53543
54135
  if (description) opts.description = description;
54136
+ if (is_remote(gobj)) opts.traces = viewer_traces(gobj, gclass);
53544
54137
  priv.gclass_view = open_gclass_view(gobj, gclass, opts);
53545
54138
  }
53546
54139
  /************************************************************
@@ -53597,57 +54190,143 @@ function ac_trace_info(gobj, event, kw, src) {
53597
54190
  };
53598
54191
  priv.trace_pending = false;
53599
54192
  let d = priv.popover_node;
53600
- if (d && d.gclass === kw.gclass && priv.$popover && priv.$popover.style.display === "block") render_popover_body(gobj, d);
54193
+ let root = priv.remote_root;
54194
+ if (priv.popover_mode === "node" && d && d.gclass === kw.gclass || priv.popover_mode === "yuno" && root && root.gclass === kw.gclass) render_current_popover(gobj);
54195
+ let viewer = gclass_viewer_gobj(gobj);
54196
+ if (viewer) {
54197
+ let shown = (0, _yuneta_gobj_js.gobj_read_str_attr)(viewer, "gclass_name");
54198
+ if (shown === kw.gclass) (0, _yuneta_gobj_js.gobj_send_event)(viewer, "EV_SET_TRACES", viewer_traces(gobj, shown), gobj);
54199
+ else if (priv.viewer_stale === shown) (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_TRACE_INFO_WANTED", { gclass: shown });
54200
+ }
54201
+ priv.viewer_stale = "";
53601
54202
  return 0;
53602
54203
  }
53603
54204
  /************************************************************
54205
+ * The gclass viewer this view opened, while it is open.
54206
+ ************************************************************/
54207
+ function gclass_viewer_gobj(gobj) {
54208
+ let h = gobj.priv.gclass_view;
54209
+ return h && h.json_gobj && !(0, _yuneta_gobj_js.gobj_is_destroying)(h.json_gobj) ? h.json_gobj : null;
54210
+ }
54211
+ /************************************************************
54212
+ * What the gclass viewer needs to draw the traces of `gclass`
54213
+ * for every gobj of it: the levels the host read, and whether a
54214
+ * set is still in flight. Plain json: it rides in a kw.
54215
+ ************************************************************/
54216
+ function viewer_traces(gobj, gclass) {
54217
+ let priv = gobj.priv;
54218
+ return {
54219
+ info: priv.trace_info[gclass] || null,
54220
+ pending: !!priv.trace_pending
54221
+ };
54222
+ }
54223
+ /************************************************************
53604
54224
  * A box of the TRACES block was ticked or cleared.
53605
54225
  ************************************************************/
53606
54226
  function ac_trace_toggled(gobj, event, kw, src) {
53607
- let d = gobj.priv.popover_node;
53608
- if (!is_remote(gobj) || !d) {
53609
- (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: a trace set with no backend card open`);
54227
+ if (!kw.level) {
54228
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: a trace set of no level, scope '${kw.scope}'`);
53610
54229
  return -1;
53611
54230
  }
53612
- if (!kw.level || kw.scope !== "gobj" && kw.scope !== "gclass") {
53613
- (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: a trace set of no level or scope: '${kw.scope}' '${kw.level}'`);
53614
- return -1;
53615
- }
53616
- set_trace_levels(gobj, d, kw.scope, [kw.level], !!kw.set);
54231
+ let target = trace_target(gobj, kw.scope);
54232
+ if (!target) return -1;
54233
+ set_trace_levels(gobj, target, kw.scope, [kw.level], !!kw.set);
53617
54234
  return 0;
53618
54235
  }
53619
54236
  /************************************************************
54237
+ * What a set of `scope` acts on: the card the popover is on
54238
+ * (gobj), or the yuno itself, the root (global). Null, and
54239
+ * logged, when the popover is not showing it.
54240
+ ************************************************************/
54241
+ function trace_target(gobj, scope) {
54242
+ let priv = gobj.priv;
54243
+ if (!is_remote(gobj)) {
54244
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: a trace set on a tree that is not remote`);
54245
+ return null;
54246
+ }
54247
+ if (scope === "gobj") {
54248
+ if (priv.popover_mode !== "node" || !priv.popover_node) {
54249
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: a gobj trace set with no backend card open`);
54250
+ return null;
54251
+ }
54252
+ return priv.popover_node;
54253
+ }
54254
+ if (scope === "global") {
54255
+ if (priv.popover_mode !== "yuno" || !priv.remote_root) {
54256
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: a yuno trace set with the yuno's traces closed`);
54257
+ return null;
54258
+ }
54259
+ return priv.remote_root;
54260
+ }
54261
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: a trace set of no scope the popover has: '${scope}'`);
54262
+ return null;
54263
+ }
54264
+ /************************************************************
53620
54265
  * "Remove the traces" of the gobj or of its gclass: every
53621
54266
  * level that scope holds on its own.
53622
54267
  ************************************************************/
53623
54268
  function ac_traces_cleared(gobj, event, kw, src) {
53624
54269
  let priv = gobj.priv;
53625
- let d = priv.popover_node;
53626
- if (!is_remote(gobj) || !d) {
53627
- (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: traces removed with no backend card open`);
54270
+ let target = trace_target(gobj, kw.scope);
54271
+ if (!target) return -1;
54272
+ let info = priv.trace_info[target.gclass];
54273
+ let levels = own_trace_levels(kw.scope === "global" ? global_trace_rows(info) : trace_rows(target, info), kw.scope);
54274
+ if (!levels.length) {
54275
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: no ${kw.scope} trace of ${target.full_name} to remove`);
53628
54276
  return -1;
53629
54277
  }
53630
- let levels = own_trace_levels(trace_rows(d, priv.trace_info[d.gclass]), kw.scope);
53631
- if (!levels.length) {
53632
- (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: no ${kw.scope} trace of ${d.full_name} to remove`);
54278
+ set_trace_levels(gobj, target, kw.scope, levels, false);
54279
+ return 0;
54280
+ }
54281
+ /************************************************************
54282
+ * The gclass viewer asked for a set of every gobj of its
54283
+ * gclass ({gclass, levels, set}).
54284
+ ************************************************************/
54285
+ function ac_set_gclass_trace(gobj, event, kw, src) {
54286
+ let levels = kw && Array.isArray(kw.levels) ? kw.levels : [];
54287
+ if (!is_remote(gobj) || !kw.gclass || !levels.length) {
54288
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: a gclass trace set of no gclass or level, or on a tree that is not remote: '${kw && kw.gclass}'`);
53633
54289
  return -1;
53634
54290
  }
53635
- set_trace_levels(gobj, d, kw.scope, levels, false);
54291
+ set_trace_levels(gobj, {
54292
+ full_name: "",
54293
+ gclass: kw.gclass
54294
+ }, "gclass", levels, !!kw.set);
53636
54295
  return 0;
53637
54296
  }
53638
- function set_trace_levels(gobj, d, scope, levels, set) {
54297
+ function set_trace_levels(gobj, target, scope, levels, set) {
53639
54298
  let priv = gobj.priv;
53640
54299
  priv.trace_pending = true;
53641
- render_popover_body(gobj, d);
54300
+ render_current_popover(gobj);
54301
+ let viewer = gclass_viewer_gobj(gobj);
54302
+ if (viewer) {
54303
+ let shown = (0, _yuneta_gobj_js.gobj_read_str_attr)(viewer, "gclass_name");
54304
+ if (scope === "global" && shown !== target.gclass) priv.viewer_stale = shown;
54305
+ (0, _yuneta_gobj_js.gobj_send_event)(viewer, "EV_SET_TRACES", viewer_traces(gobj, shown), gobj);
54306
+ }
53642
54307
  (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_SET_TRACE_LEVEL", {
53643
54308
  scope,
53644
- gobj: d.full_name,
53645
- gclass: d.gclass,
54309
+ gobj: target.full_name || "",
54310
+ gclass: target.gclass,
53646
54311
  levels,
53647
54312
  set
53648
54313
  });
53649
54314
  }
53650
54315
  /************************************************************
54316
+ * The toolbar's "traces of the yuno": the popover shows the
54317
+ * yuno's scope, read from the answer for the root's gclass.
54318
+ ************************************************************/
54319
+ function ac_open_yuno_traces(gobj, event, kw, src) {
54320
+ let root = gobj.priv.remote_root;
54321
+ if (!is_remote(gobj) || !root) {
54322
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: the yuno's traces asked with no backend tree loaded`);
54323
+ return -1;
54324
+ }
54325
+ show_yuno_traces(gobj);
54326
+ (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_TRACE_INFO_WANTED", { gclass: root.gclass });
54327
+ return 0;
54328
+ }
54329
+ /************************************************************
53651
54330
  * The app switched language.
53652
54331
  *
53653
54332
  * A rebuild, not a re-translation: the words live inside the
@@ -53803,6 +54482,16 @@ function create_gclass$9(gclass_name) {
53803
54482
  "EV_GCLASS_DESCRIPTION",
53804
54483
  ac_gclass_description,
53805
54484
  null
54485
+ ],
54486
+ [
54487
+ "EV_OPEN_YUNO_TRACES",
54488
+ ac_open_yuno_traces,
54489
+ null
54490
+ ],
54491
+ [
54492
+ "EV_SET_GCLASS_TRACE",
54493
+ ac_set_gclass_trace,
54494
+ null
53806
54495
  ]
53807
54496
  ]]];
53808
54497
  const event_types = [
@@ -53831,6 +54520,8 @@ function create_gclass$9(gclass_name) {
53831
54520
  ["EV_TRACE_TOGGLED", 0],
53832
54521
  ["EV_TRACES_CLEARED", 0],
53833
54522
  ["EV_GCLASS_DESCRIPTION", 0],
54523
+ ["EV_OPEN_YUNO_TRACES", 0],
54524
+ ["EV_SET_GCLASS_TRACE", 0],
53834
54525
  ["EV_TREE_WANTED", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT],
53835
54526
  ["EV_TRACE_INFO_WANTED", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT],
53836
54527
  ["EV_SET_TRACE_LEVEL", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT],