@yuneta/gobj-ui 7.27.22 → 7.27.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3331,9 +3331,75 @@ let root = describe_js_gobj(gobj_yuno(), true); /* this browser yuno */
3331
3331
  let root = describe_backend_tree(answer); /* `view-gobj-tree` */
3332
3332
  ```
3333
3333
 
3334
- `load_tree()` calls the first one, on one line. Swapping it for the second is
3335
- the whole of showing a remote yuno; nothing below that line changes. (The
3336
- remote fetch itself is not wired yet.)
3334
+ `load_tree()` calls the first one when `source` is `"local"` and the second
3335
+ one, on what the host loaded, when it is `"remote"`; nothing below that line
3336
+ changes.
3337
+
3338
+ ### A backend yuno's tree — `source: "remote"`, `open_gobj_tree_view`
3339
+
3340
+ The same view shows the gobj tree of a **backend** yuno (7.27.23). It cannot
3341
+ fetch it: it has no transport, and which link reaches that yuno is the host's
3342
+ business. So it **publishes what it wants** and the host answers with the
3343
+ data. The host is the tree's subscriber (it is created as the host's child),
3344
+ and it declares the four output events in its FSM:
3345
+
3346
+ | Direction | Event | kw | The host does |
3347
+ |---|---|---|---|
3348
+ | out | `EV_TREE_WANTED` | `{}` | `view-gobj-tree`, then `EV_LOAD_TREE` (Refresh was pressed) |
3349
+ | in | `EV_LOAD_TREE` | `{tree}` | — the `view-gobj-tree` answer's `data` |
3350
+ | out | `EV_TRACE_INFO_WANTED` | `{gclass}` | `info-gclass-trace gclass=G`, `info-global-trace`, `get-gclass-trace gclass=G`, `get-global-trace`, then `EV_TRACE_INFO` (a card was opened) |
3351
+ | in | `EV_TRACE_INFO` | `{gclass, gclass_levels, global_levels, gclass_on, global_on, error}` | — the four answers (`{name: description}`, `{name: description}`, `[name]`, `[name]`), or `error` |
3352
+ | out | `EV_SET_TRACE_LEVEL` | `{scope, gobj, gclass, levels, set}` | per level `set-gobj-trace gobj=<gobj> level=L set=0\|1` (scope `gobj`) or `set-gclass-trace gclass=G level=L set=0\|1` (scope `gclass`), then the tree and the trace info again |
3353
+ | out | `EV_GCLASS_WANTED` | `{gclass}` | `view-gclass gclass=G`, then `EV_GCLASS_DESCRIPTION` |
3354
+ | in | `EV_GCLASS_DESCRIPTION` | `{gclass, description}` | — opens the gclass viewer on that description |
3355
+
3356
+ The host loads the **first** tree itself (it opened the view); after that the
3357
+ view asks only on Refresh. A local tree publishes none of these, so the
3358
+ Frontend view and every existing host declare nothing new.
3359
+
3360
+ `open_gobj_tree_view()` (`yui_gobj_tree_view.js`) opens such a tree in a window
3361
+ — a sheet on a phone — with an optional status line of the host above it:
3362
+
3363
+ ```js
3364
+ import {open_gobj_tree_view, close_gobj_tree_view}
3365
+ from "@yuneta/gobj-ui/src/yui_gobj_tree_view.js";
3366
+
3367
+ priv.view = open_gobj_tree_view(gobj, {
3368
+ name: "controller-2046", /* names the window, the tree and its saved arrangement */
3369
+ source: "remote",
3370
+ yuno_name: "gate_energia^2046", /* before the gclass in the gclass window's title */
3371
+ title_prefix: "gate_energia^2046",
3372
+ title: "gobj tree", /* an i18n KEY */
3373
+ $header: priv.$status,
3374
+ on_close: () => gobj_send_event(gobj, "EV_VIEW_CLOSED", {}, gobj),
3375
+ });
3376
+ /* ... the `view-gobj-tree` answer arrives: */
3377
+ gobj_send_event(priv.view.tree, "EV_LOAD_TREE", {tree: answer.data}, gobj);
3378
+ /* ... in mt_stop: */
3379
+ close_gobj_tree_view(priv.view);
3380
+ ```
3381
+
3382
+ **The TRACES block.** In a remote tree the popover of a card carries a table:
3383
+ one row per level the gobj can trace (its gclass' own, then the global ones),
3384
+ a box for **this gobj** and one for **all of the gclass**. A level that is on
3385
+ for the gclass or globally shows on and **locked** in the gobj column, with
3386
+ where it comes from (`gclass` / `global`): one gobj cannot turn it off. A box
3387
+ is an action: the block locks until the host has loaded what the backend says
3388
+ next, so a box shows the backend, never the click. **Remove the traces** of the
3389
+ gobj, or of the gclass, turns off what that scope holds on its own. The card
3390
+ of a gobj that traces anything wears a `traces` badge.
3391
+
3392
+ Note what the C runtime does with them: a gclass level is saved by the yuno
3393
+ (`trace_levels`) and **survives a restart**; a gobj level is saved too but only
3394
+ the gclass and global scopes are re-applied at start up, so it **ends with the
3395
+ yuno**. The block says so. The traces go to the yuno's log, not to the
3396
+ Developer window.
3397
+
3398
+ Consumer i18n keys (every app that mounts the tree): `global`, `this gobj`,
3399
+ `all of the gclass`, `remove the traces of this gobj`,
3400
+ `remove the traces of the gclass`,
3401
+ `gclass traces survive a restart, gobj traces end with the yuno` (plus
3402
+ `traces`, `level`, `loading` and `gclass`, which every app has).
3337
3403
 
3338
3404
  ### The gclass viewer — `yui_gclass_view.js`
3339
3405