@yuneta/gobj-ui 7.25.15 → 7.25.17

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
@@ -1809,6 +1809,35 @@ fails:
1809
1809
  gobj_send_event(engine, "EV_GRAPHS_WRITE_REFUSED", {topic: record.topic}, gobj);
1810
1810
  ```
1811
1811
 
1812
+ **A refused write stays OWED until a Save writes it** (since `7.25.16`). In
1813
+ `7.25.15` the Save lit by the refusal went dark again at the next repaint of
1814
+ the history buttons -- they decide the Save from `history.canUndo()`, and they
1815
+ run on every history change, every change of mode and every redraw of the
1816
+ theme -- and a refusal heard in reading was never shown. The engine now keeps
1817
+ the topic as owed: the Save stays lit while one is, in edition and on entering
1818
+ it; the Save that writes the topic again pays it, and a reload of the data
1819
+ forgets it (the view holds what the backend holds).
1820
+
1821
+ ```js
1822
+ gobj_send_event(engine, "EV_GRAPHS_WRITE_REFUSED", {topic: "users"}, host); // Save lit
1823
+ // ... a node moved and moved back (nothing to undo): Save still lit
1824
+ gobj_send_event(engine, "EV_SAVE_GRAPH", {}, engine); // writes users; Save dark
1825
+ ```
1826
+
1827
+ **The refusal reaches the engine through the real transports** (since
1828
+ `7.25.17`). The answer of a command carries back only the request's
1829
+ `__md_command__`, as its `command_stack` frame -- `C_IEVENT_CLI` and gui_agent's
1830
+ `C_AGENT_TREEDB_LINK` both do, and neither echoes the request's `record`. The
1831
+ host read the topic from that `record`, found none, logged *"a refused
1832
+ __graphs__ write names no topic"* and never told the engine: the 7.25.15 fix
1833
+ worked only in a test whose fake transport echoed the whole request. The host
1834
+ now puts the topic in the echo it asks for:
1835
+
1836
+ ```js
1837
+ kw.__md_command__ = {topic_name: "__graphs__", graph_topic: "users"};
1838
+ // the answer: __md_iev__.command_stack[0].kw === that echo, and nothing else
1839
+ ```
1840
+
1812
1841
  **Every saved look has a way back, in the context menu** (since `7.23.134`,
1813
1842
  replacing `reset sizes` / `reset topic sizes`). In edition, the node, the port
1814
1843
  and the edge menus each offer three resets — this one, its kind (`reset topic
@@ -2113,7 +2142,7 @@ columns**, each in its declared `order`, with the storage composed underneath
2113
2142
  the qualified id, the fkey to the parent, the place among the siblings, and the
2114
2143
  versions that publish the change.
2115
2144
 
2116
- **An edit here is a draft** (7.23.196, with the SDK's M36 design). A write moves
2145
+ **An edit here is a draft** (7.23.196, with SDK 7.25.0). A write moves
2117
2146
  no version and reaches no treedb. The HOST publishes it with `C_TREEDB`'s
2118
2147
  `save-schema`, which raises the `topic_version` of each topic that changed
2119
2148
  (the one that regenerates `topic_cols.json`) and the `schema_version` (the one
@@ -2206,6 +2235,7 @@ else.
2206
2235
  master the tranger, so it refuses every write), `base_route`, `$container`.
2207
2236
  - In: `EV_SHOW` (`{subpath}` — the tail it owns is `<treedb>[/<topic>]` or
2208
2237
  `<treedb>/diagram`), `EV_HIDE`, `EV_TRANSPORT_STATE`, `EV_REFRESH`,
2238
+ `EV_DRAFTS` (`{drafts: {<treedb>: [<topic>, …]}}`, see above),
2209
2239
  `EV_LANGUAGE_CHANGED`, `EV_MT_COMMAND_ANSWER`.
2210
2240
  - A **drop** of the transport — `EV_TRANSPORT_STATE {connected: false}`, or a
2211
2241
  failed answer that arrives while the transport is out of `ST_SESSION` — ends
@@ -2230,6 +2260,52 @@ else.
2230
2260
  gobj_send_event(editor, "EV_SHOW", {subpath: "db"}, host); // waits
2231
2261
  // ... the three `nodes` answers land -> ST_TOPICS of `db`
2232
2262
  ```
2263
+
2264
+ **`EV_REFRESH` waits too** (7.25.16). Heard in `ST_SAVING` -- a host that
2265
+ sends it after a Save while the writes are still in flight -- it is logged
2266
+ and run when the writes END, forgetting the drafts as a Refresh does. It
2267
+ ran at once: the load replaced `ST_SAVING`, and what was still queued (the
2268
+ topic of a topic delete, after its columns) was never sent, with no word.
2269
+
2270
+ ```js
2271
+ gobj_send_event(editor, "EV_CONFIRMED", {what: "topic", topic: "users",
2272
+ model_gen: n}, editor); // ST_SAVING, 2 deletes
2273
+ gobj_send_event(editor, "EV_REFRESH", {}, host); // logged, waits
2274
+ // ... both deletes answered -> ST_LOADING -> the model is read again
2275
+ ```
2276
+ - **A write in flight takes the body out of the keyboard's reach too**
2277
+ (7.25.17). `ST_SAVING` keeps the screen under it and marks the body busy.
2278
+ The busy class only stopped the pointer (`pointer-events: none`); the
2279
+ shell's focus trap put the focus back on the row control that had it, and
2280
+ Enter or Delete there sent `EV_DELETE_COLUMN` or `EV_SELECT_TOPIC`, which
2281
+ `ST_SAVING` does not declare (*"Event NOT DEFINED"*). The busy body is now
2282
+ also `inert`. `ST_LOADING` needs nothing: its body is emptied.
2283
+
2284
+ ```js
2285
+ // in ST_SAVING
2286
+ $container.querySelector(".SCHEMA_BODY").hasAttribute("inert"); // true
2287
+ ```
2288
+ - **A write marks the topic of its RECORD, not the topic on screen**
2289
+ (7.25.17). What "its version still has to move" is asked about is the set of
2290
+ topics this session wrote (the draft chip, the export warning,
2291
+ `validate_schema()`'s `written_topics`). A column write marked the topic on
2292
+ screen, so an import from the topics screen (no topic on it) marked nothing,
2293
+ and an import that added `roles` from the screen of `users` marked `users`.
2294
+ The mark is read from the record the store answered (a new topic has its id
2295
+ only there), then from the record queued (a column names its topic in its
2296
+ fkey), and only then from the screen.
2297
+
2298
+ ```js
2299
+ // import adding topic `roles`, run from db/users, every write answered
2300
+ editor.priv.written; // {"db.roles": true} (was {"db.users": true})
2301
+ ```
2302
+ - **The reason a load failed is a key** (7.25.17). The notice's detail was
2303
+ the text of `t()` taken when the load failed (`cannot reach the treedb`,
2304
+ `cannot load the schemas`) or the backend's words, shown as plain text: it
2305
+ did not change language, and with no comment it repeated the notice's own
2306
+ title. It is now kept as a key, written with `data-i18n` (the backend's
2307
+ words translate to themselves when no locale has them), and left out when
2308
+ it is the title.
2233
2309
  - **The loading screen is drawn** (7.25.8): the body is cleared, the drawing
2234
2310
  destroyed and every toolbar button disabled, as in `ST_SAVING`, because
2235
2311
  `ST_LOADING` declares none of a screen's actions. A **dialog** left open is
@@ -2315,6 +2391,28 @@ else.
2315
2391
  // ... the load lands: the same click now opens the form
2316
2392
  ```
2317
2393
 
2394
+ **The Save of a form open when the reload is owed keeps what was typed**
2395
+ (7.25.16). It runs the owed reload and says
2396
+ `the schemas shown may be out of date: they are read again, and the form opens again on them with your changes`.
2397
+ The load that lands closes the form and opens it again on the schemas it
2398
+ read, with the fields the operator CHANGED put back on top -- only those,
2399
+ so a field left as it was shows what the store holds now and the next Save
2400
+ does not write the old value over a newer one. A new column or topic comes
2401
+ back whole (nothing of it is in the store). Before, the form was closed and
2402
+ what was typed was lost. It is not opened again when what it edited is not
2403
+ on the schemas read (a column deleted meanwhile, another treedb, another
2404
+ screen): that is said with
2405
+ `the schemas were read again and what the form was editing is not there any more`.
2406
+ A form the operator closed while the load ran stays closed. Both texts are
2407
+ i18n keys the consumer's locales carry.
2408
+
2409
+ ```js
2410
+ // reload owed; column form of db.users.id open, header typed "Identifier"
2411
+ // Save -> refused, the model is read again
2412
+ // ... the load lands: the form opens again, header "Identifier", the rest
2413
+ // of the fields as the store holds them now; Save writes them
2414
+ ```
2415
+
2318
2416
  A write answered with no record reloads the model and
2319
2417
  says what it did not send after it
2320
2418
  (`the treedb did not describe a write back: the writes after it were not sent`).
@@ -3280,9 +3378,13 @@ a modal
3280
3378
  `TOAST*`. Every button of that chrome -- each ✕, a dialog's back arrow, a
3281
3379
  confirmation's answers (`CONFIRM_BTN`) -- carries a translatable `title` and
3282
3380
  `aria-label` (7.25.10). An answer is named by its own label, so pass i18n
3283
- KEYS as `yes_label` / `confirm_label` / … (`{yes_label: "install"}`): the
3284
- defaults (`"Yes"`, `"Delete"`) are not lower-case and no validated locale
3285
- can hold them.
3381
+ KEYS as `yes_label` / `confirm_label` / … (`{yes_label: "install"}`). The
3382
+ defaults are keys too since 7.25.16 -- `"ok"`, `"yes"`, `"no"`, `"delete"`
3383
+ and `"cancel"` (they were `"OK"`, `"Yes"`, … , which no validated locale can
3384
+ hold) -- so an app that mounts these dialogs defines those five keys, and
3385
+ its `validate-locales` asks for them. `yui_install_ask_once()` asks
3386
+ `"install this app"` (was `"Install this app?"`), answered `"install"` /
3387
+ `"not now"`.
3286
3388
 
3287
3389
  Those names identify the *kind* of block, not the *instance*: every window in
3288
3390
  the app is a `C_YUI_WINDOW`, every popup is a `MODAL`. To target **one**