@yuneta/gobj-ui 7.23.157 → 7.23.159

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
@@ -1254,23 +1254,38 @@ construction rather than by a check in twenty places.
1254
1254
  ### Finding a node in the graph
1255
1255
 
1256
1256
  `C_YUI_TREEDB_GRAPH` carries a find box in the middle of its toolbar. It
1257
- matches the term against the node's **label**, its id and its topic name, puts
1258
- every match in the same amber `active` state the topic focus uses, and centres
1259
- the viewport on them.
1260
-
1261
- Two details that are not decoration:
1262
-
1257
+ matches the term against the node's **label**, its id and its topic name, and
1258
+ puts every match **on screen** in the same amber `active` state the topic focus
1259
+ uses. It changes nothing else: no group is opened, no layout runs, the camera
1260
+ does not move. Emptying the box takes the amber off and leaves the graph
1261
+ exactly as it was.
1262
+
1263
+ Details that are not decoration:
1264
+
1265
+ - it **only looks** (since `7.23.158`). It used to search the whole treedb and
1266
+ unfold a page of the matches it found, so every keystroke re-laid the graph
1267
+ out, and the groups it opened stayed open when the box was cleared. Opening
1268
+ up to a topic is the legend's focus button, which still searches the whole
1269
+ treedb and unfolds what it needs.
1270
+ - the term **stays live**. It is repainted after every change of what is on
1271
+ screen (a group opened by hand, a fold level, a refresh, a hidden topic), so
1272
+ newly shown matches arrive lit and the count follows the screen.
1273
+ - **Enter** centres the next lit card, **Shift+Enter** the previous one, in
1274
+ reading order (top to bottom, then left to right). That is the one camera
1275
+ move of the find, and the reader asks for it. The count then reads `k/N`.
1263
1276
  - it matches the **label**, not only the id. On a topic keyed by `rowid`,
1264
1277
  `uuid` or `qualified` the id is a counter or a path and the name a human
1265
1278
  knows the record by lives in a secondary key — the same reason `node_label()`
1266
1279
  exists.
1267
- - it **says how many** it found. A graph that did not move looks identical
1268
- whether nothing matched or the only match was already on screen, so the count
1269
- is shown next to the box (hidden while the box is empty; a typed term that
1270
- matches nothing shows `0`, which is an answer).
1280
+ - it **says how many** it found, and how many more it did NOT light:
1281
+ `12 matches (+513 not shown, +40 in hidden topics)`. A graph with no amber
1282
+ looks identical whether nothing matched or the matches are folded away, so
1283
+ the count is shown next to the box (hidden while the box is empty; a typed
1284
+ term that matches nothing shows `0`, which is an answer).
1271
1285
 
1272
1286
  The find and the topic focus **share the highlight**: starting one clears the
1273
- other. Two amber sets at once would say nothing about either.
1287
+ other (a topic focus also empties the box). Two amber sets at once would say
1288
+ nothing about either.
1274
1289
 
1275
1290
  The highlight is painted **into the card's own html**, not with G6's `active`
1276
1291
  element state. That state is an amber `stroke` + `halo`, both properties of a
@@ -1281,9 +1296,12 @@ changes are repainted, and a theme switch carries the highlight across (it
1281
1296
  rebuilds every card, and rebuilding them without it would clear what is on
1282
1297
  screen).
1283
1298
 
1284
- Wiring: the box sends `EV_FIND_NODES {text}` to the view, which forwards it to
1285
- `C_G6_NODES_TREE`; the graph answers `EV_FIND_RESULT {term, matches}`, which the
1286
- view declares like every other event its child publishes.
1299
+ Wiring: the box sends `EV_FIND_NODES {text}` to the view, and Enter sends
1300
+ `EV_FIND_NEXT {back}`; the view forwards both to `C_G6_NODES_TREE`. The graph
1301
+ answers `EV_FIND_RESULT {term, matches, folded_matches, hidden_matches,
1302
+ current}`, which the view declares like every other event its child publishes.
1303
+ Consumer i18n keys: `matches` (counted), `not shown`, `hidden topics`,
1304
+ `find on screen` (the box's title and name).
1287
1305
 
1288
1306
  ### The graph opens FOLDED, like a JSON viewer
1289
1307
 
@@ -1934,7 +1952,12 @@ backend** — asking is an action and belongs in the view's own FSM:
1934
1952
  |---|---|
1935
1953
  | `yui_asset_id(ref)` / `yui_asset_ids(ref)` | the id(s) a column names. A link comes back in whichever shape the READER asked for — the stored `"assets^<id>^as_foto"`, the bare `"<id>"` that `fkey_only_id` collapses it to, or an expanded `{id}` — and either alone or in a list, because an unset single-valued fkey is still an empty list. All of them are read; an empty column answers nothing rather than throwing |
1936
1954
  | `yui_asset_src(answer)` | the two shapes into one `src`. `null` when the answer carries neither — never an empty string, because `<img src="">` reloads the page in some browsers |
1937
- | `yui_asset_element(answer, opts)` | the element, picked from the **content type the backend stored**: `<img>`, `<video>` or `<audio>`. Video and audio are assets too, and an `<img>` whose src is a film shows the broken box this exists to remove |
1955
+ | `yui_asset_kind(content_type)` | `"image"`, `"video"`, `"audio"`, `"pdf"` or `"other"`, from the content type the backend stored (a `; charset=…` parameter is ignored) |
1956
+ | `yui_asset_element(answer, opts)` | the element, picked by that kind: `<img>`, `<video>`, `<audio>`, a PDF in an `<iframe>` (the browser's own viewer), or, for any other kind, a card with the content type and an open link. Video and audio are assets too, and an `<img>` whose src is a film shows the broken box this exists to remove |
1957
+ | `yui_asset_open_link(answer)` | an `<a target=_blank>` that opens the asset at full size, named through `open in a new tab`. `null` when there is nothing to open |
1958
+ | `yui_asset_href(answer)` | `{href, blob}`: the url as it comes, or a `blob:` url over inline bytes. Firefox will not NAVIGATE to a `data:` url (a new tab stays blank) and its PDF viewer does not run on one in a frame, so frames and links need a blob |
1959
+ | `yui_asset_file_answer(file)` | the answer a picked `File` would have had: a `url` answer over a `blob:` url of the File itself, so a file not saved yet goes through the same element as a stored one |
1960
+ | `yui_asset_release($root)` | revoke every `blob:` url this module made under `$root`, `$root` included. A blob url keeps its bytes alive until revoked and removing the DOM revokes nothing, so call it on whatever element you drop |
1938
1961
  | `yui_asset_missing(detail, opts)` | the marker, for when there is nothing to show |
1939
1962
 
1940
1963
  **A missing asset is now said out loud.** It used to leave a broken box and
@@ -1961,6 +1984,43 @@ if(id) {
1961
1984
  $box.appendChild(yui_asset_element(answer, {detail: device.foto_name}));
1962
1985
  ```
1963
1986
 
1987
+ #### In the treedb views
1988
+
1989
+ The treedb form and table show the asset a `file` column names, and they ask
1990
+ for it in the same way as a page of rows: the table publishes the request UP
1991
+ and its host owns the transport.
1992
+
1993
+ ```
1994
+ C_YUI_TREEDB_TOPIC_WITH_FORM C_YUI_TREEDB_TOPICS
1995
+ EV_REQUEST_ASSET {topic_name, req_id, asset_id} ──► get-asset asset_id=<id>
1996
+ (service = assets_service)
1997
+ EV_ASSET_LOADED {req_id, answer} ◄── the answer, by req_id
1998
+ EV_ASSET_FAILED {req_id, error} ◄── a refusal, no backend, or 30 s of silence
1999
+ ```
2000
+
2001
+ - **Form:** when the edit dialog opens, one request goes out per `file` column
2002
+ that names an asset. The answer reaches the form as
2003
+ `EV_SET_FILE_PREVIEW {name, id, answer, error}` and is drawn under the
2004
+ control only while the column still names that id. A picked file needs no
2005
+ request: it is previewed from the `File`.
2006
+ - **Table:** a click on a file cell opens a popup with one slot per asset the
2007
+ cell names. Each slot starts as `loading` and is filled by its own answer.
2008
+
2009
+ Set the service on the host. `"assets"` is the default, and it is what a yuno
2010
+ names its `C_ASSETS`; an empty string turns the requests off:
2011
+
2012
+ ```js
2013
+ gobj_create_service("#topics-mydb", "C_YUI_TREEDB_TOPICS", {
2014
+ gobj_remote_yuno: remote,
2015
+ treedb_name: "treedb_mydb",
2016
+ assets_service: "assets"
2017
+ }, gobj);
2018
+ ```
2019
+
2020
+ The user needs the `read` permission of that service. The service is not the
2021
+ one the connection was opened for, so a user who is not root must also hold a
2022
+ role in it, or the ievent gate refuses to route the command there.
2023
+
1964
2024
  ### JSON viewer — `setup_json_pad`
1965
2025
 
1966
2026
  `setup_json_pad(self)` opens a **blank JSON pad** (`C_YUI_JSON_PAD`) in a