@yuneta/gobj-ui 5.15.0 → 5.17.0

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
@@ -430,12 +430,32 @@ Logical DOM classes: `JSON_VIEWER`, `JSON_TOOLBAR`, `JSON_SEARCH`, `JSON_TREE`,
430
430
  `JSON_ROW`, `JSON_KEY`, `JSON_VALUE`, `JSON_SUMMARY`, `JSON_COLLAPSED`,
431
431
  `JSON_TIME`. The gclass imports its own `c_yui_json.css`.
432
432
 
433
+ ### What a node in the graph is CALLED
434
+
435
+ `C_G6_NODES_TREE` (the record graph inside `C_YUI_TREEDB_GRAPH`) labels a card
436
+ by what NAMES the record, which is not always what KEYS it. A topic whose id
437
+ column is flagged `rowid` or `uuid` keys its records by a value nobody reads —
438
+ that is the point of those flags — and the name lives in the secondary key the
439
+ topic declares (`pkey2s`). `treedb_system_schema` is the case that forced it:
440
+ its `topics` and `cols` records are keyed by rowid and named in `value`, so the
441
+ graph drew cards reading `181`, `225`, `193`.
442
+
443
+ The rule is in **`treedb_node_label.js`** (pure, unit-tested): read the pkey
444
+ column's flags from the desc; if the key is synthetic, take the first `pkey2s`
445
+ field the record actually carries; otherwise keep the id. **The pkey is never
446
+ lost** — it is the card's tooltip, on the chip and on the entity card alike.
447
+
448
+ It needs the descriptor to carry `pkey2s`, which `tranger2_topic_desc()` only
449
+ clones from **SDK > 7.13.0**. Against an older node the desc has no `pkey2s`, the
450
+ label falls back to the id, and nothing else changes.
451
+
433
452
  ### Read-only treedbs: `readonly`
434
453
 
435
- `C_YUI_TREEDB_TOPICS` takes a **`readonly`** attr, propagated to every topic it
436
- builds. It is not one more button flag: it is the STATE of the treedb and it
437
- beats each `with_*` flag at once, because a treedb whose tranger the yuno does
438
- not master answers **every** write with
454
+ `C_YUI_TREEDB_TOPICS` and `C_YUI_TREEDB_GRAPH` take a **`readonly`** attr; the
455
+ topics view propagates it to every topic it builds. It is not one more button
456
+ flag: it is the STATE of the treedb and it beats each `with_*` flag at once,
457
+ because a treedb whose tranger the yuno does not master answers **every** write
458
+ with
439
459
 
440
460
  ```
441
461
  ERROR -1: <yuno>: treedb '<name>' is READ-ONLY, this yuno is not the master of its tranger
@@ -453,23 +473,59 @@ buttons, the in-row edit icons, and the write half of the record form's toolbar
453
473
  (`copy` stays — reading a record includes taking it with you) with the cells not
454
474
  editable. The record form still OPENS: looking is the point of a replica.
455
475
 
476
+ In the **graph** it takes away the `edition` operation mode, which is the only
477
+ one that draws the create / delete / link affordances — the mode select stops
478
+ offering it, and a graph left in edition on a master comes back in `reading` on
479
+ a replica (the mode is a persisted preference). The other modes are untouched:
480
+ panning, zooming and opening a node are reading.
481
+
456
482
  Two implementation notes worth keeping:
457
483
 
458
484
  - the decision lives in **`treedb_write_plan.js`** (pure, tested), not in five
459
485
  `!readonly && with_x` expressions — five places to forget the sixth;
460
- - and the write **events** are refused as well, in both gclasses, with a
486
+ - and the write **events** are refused as well, in every gclass, with a
461
487
  `log_error`. Hiding a button is not the same as refusing a write: an event can
462
488
  still arrive from a keyboard path or a form that outlived the flag, and an
463
489
  ignored write is exactly the behaviour this whole change exists to stop.
464
490
 
465
- ### C_YUI_TREEDB_SCHEMA — the treedb as a graph of topics (prototype)
466
-
467
- A landing view that draws a treedb as a **graph of topics** one node per
468
- topic, one edge per hook/fkey relationship — built from the schema `descs`
469
- **alone**: no data, no backend calls. It is the "every treedb is a graph" rule
470
- applied to the schema itself, and an alternate landing to the topic cards. A
471
- node click opens that topic's table through a real hash navigation, so the
472
- graph is a navigation surface rather than a picture.
491
+ ### C_YUI_TREEDB_SCHEMA — the treedb drawn the way its `.c` draws it
492
+
493
+ A landing view that draws a treedb the way its schema literal draws it in ASCII
494
+ (`treedb_schema_*.c`, `treedb_system_schema.c`): **one card per topic**,
495
+ listing its fields in schema order, and **one edge per hook**, leaving the row
496
+ that declares the hook and landing on the fkey row of the child it names. Built
497
+ from the schema `descs` **alone**: no data, no backend calls. It is the "every
498
+ treedb is a graph" rule applied to the schema itself, and an alternate landing
499
+ to the topic cards. A node click opens that topic's table through a real hash
500
+ navigation, so the graph is a navigation surface rather than a picture.
501
+
502
+ The marks are the notation of those `.c` literals, so the drawing and the
503
+ source read the same:
504
+
505
+ | Mark | Meaning |
506
+ |------|---------|
507
+ | `{}` | dict hook — N unique children |
508
+ | `[]` | list hook — n not-unique children |
509
+ | `()` | a single child |
510
+ | `(↖)` | 1 fkey — 1 parent |
511
+ | `[↖]` | n fkeys — n parents |
512
+ | `{↖}` | N fkeys — N parents |
513
+ | `*` | required |
514
+ | `#` | the primary key |
515
+
516
+ `dict` and `object` are one shape and `list` and `array` are another, exactly
517
+ as tr_treedb's hook/fkey switches treat them. A self-referent hook (a tree)
518
+ draws as a loop.
519
+
520
+ **Not to be confused with the node graph** (`C_G6_NODES_TREE`, hosted by
521
+ `C_YUI_TREEDB_GRAPH`), which draws the **records**. On a treedb whose records
522
+ are schemas — `treedb_system_schema` — that one draws a box per column,
523
+ hundreds of them, each labelled by a pkey that is a rowid: a correct picture of
524
+ the storage and an unreadable picture of the schema. This view answers the
525
+ schema question; that one answers the data question.
526
+
527
+ The demo `test-app/schema.html` mounts it alone against the real yuneta agent
528
+ schema, so the drawing can be held against the ASCII one in its `.c`.
473
529
 
474
530
  **Contract:**
475
531
 
@@ -482,8 +538,9 @@ graph is a navigation surface rather than a picture.
482
538
  graph in place, preserving the user's zoom/pan), plus the internal
483
539
  `EV_NODE_CLICK` a node click sends into the FSM.
484
540
 
485
- Marked a **prototype**: it is barrel-exported and public from 4.0.0, but its
486
- shape may still move. Renders with `@antv/g6` (no CSS of its own).
541
+ Barrel-exported and public from 4.0.0. Renders with `@antv/g6`; the cards are
542
+ HTML nodes carrying their own inline colours, so a theme switch repaints them in
543
+ place (no CSS of its own).
487
544
 
488
545
  ### Frontend view — `setup_frontend_view`
489
546