@yuneta/gobj-ui 7.23.67 → 7.23.68

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
@@ -1266,6 +1266,63 @@ a level or two, with a count on every cut.
1266
1266
 
1267
1267
  One consumer key came with it: `show more`, the chip's tooltip.
1268
1268
 
1269
+ ### The legend is the graph's layer control
1270
+
1271
+ The legend strip under the toolbar is **always there** now (the *Legend*
1272
+ button is gone), and it is not a colour key: it is where the reader decides
1273
+ **what the tree is made of**. One chip per topic — swatch, name, `visible/total`
1274
+ — with a small target for each thing it can do, so a finger lands on one of
1275
+ them:
1276
+
1277
+ | control | what it does |
1278
+ |---|---|
1279
+ | the chip body | **show / hide** the topic. A hidden topic leaves the MODEL, not just the drawing: no card, no pill counts it, no edge reaches it, and whatever hung from it alone has no parent any more. The name is struck through and the count is the total. |
1280
+ | `★` / `☆` | the **main topic**: the trunk the tree hangs from. Filled on the main one (a mark, not a button — the main topic cannot be hidden, because hiding the trunk turns everything into roots, which is the pile); hollow on the others, where it moves the star. |
1281
+ | `+N` | the topic's **loose records**: the ones that should hang from the main tree and do not (a device with no place). Counted here, shown only on request. |
1282
+ | `⌖` | **highlight** the topic — the focus, with `reveal: "all"`. |
1283
+
1284
+ The **main topic is deduced** when none is chosen: the topic whose hooks reach
1285
+ the most OTHER topics, a self-referent hook breaking a tie (a tree of places
1286
+ over a flat list of groups). On the yunovatios central that is `places` (it
1287
+ reaches places, devices, users and controllers); `device_types` reaches one.
1288
+ An `extended` topic (hooks, no fkeys) never wins: the engine draws no edge
1289
+ from one, so its records hang nothing. A treedb where no topic reaches
1290
+ another has no trunk, and every topic is a tree of its own — the behaviour
1291
+ before this existed.
1292
+
1293
+ What the main topic governs, in `treedb_fold_model.js`:
1294
+
1295
+ - its parentless records are the **roots**;
1296
+ - a parentless record of a topic the schema hangs from it (`linked`: reached
1297
+ from the main topic by following hooks) is **loose**, not a root — it is
1298
+ counted per topic and drawn only when its `+N` is on;
1299
+ - a topic the schema does not tie to the main one is its own tree, with its
1300
+ own roots, as before.
1301
+
1302
+ So *places with their users and nothing else* is hiding `devices`,
1303
+ `controllers` and `device_types`; *places with their devices* is hiding
1304
+ `users` and `controllers`. Each combination is a user preference **per
1305
+ treedb**: `hidden_topics`, `main_topic` and `loose_topics` are `SDF_PERSIST`
1306
+ attrs of `C_YUI_TREEDB_GRAPH`, saved under the view's name, and both hosts
1307
+ name the view after the treedb.
1308
+
1309
+ Three edges of it: the URL wins over the strip (a route that lands on a hidden
1310
+ topic shows it first, or it would highlight nothing and say nothing about
1311
+ why); the find searches hidden topics too and counts them apart (`3 matches
1312
+ (+2 in hidden topics)`), because `0` alone reads as *does not exist* when it
1313
+ means *is hidden*; and moving the star reopens the tree at `expand_depth`,
1314
+ since other roots are another tree.
1315
+
1316
+ Wiring: the engine publishes `EV_LEGEND_STATE` after every reconcile — one
1317
+ entry per topic (hidden ones included) with colour, total, visible, loose and
1318
+ flags, plus the main topic — and the view paints the strip from that and
1319
+ nothing else. The strip's clicks are `EV_LEGEND_TOPIC {topic, action}` with
1320
+ `action` one of `toggle`, `main`, `loose`, `focus`; the view persists and
1321
+ forwards them as `EV_SET_HIDDEN_TOPICS`, `EV_SET_MAIN_TOPIC`,
1322
+ `EV_SET_LOOSE_TOPICS`. Consumer i18n keys: `show topic`, `hide topic`,
1323
+ `main topic`, `highlight topic`, `loose records`, `hidden topics`; `legend`
1324
+ is no longer used.
1325
+
1269
1326
  ### C_YUI_TREEDB_SCHEMA — the treedb drawn the way its `.c` draws it
1270
1327
 
1271
1328
  A landing view that draws a treedb the way its schema literal draws it in ASCII