@yuneta/gobj-ui 7.26.44 → 7.26.46

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
@@ -164,6 +164,12 @@ Published as `@yuneta/gobj-ui`. Built on top of [`@yuneta/gobj-js`](https://gith
164
164
  > window the app opens on its own (the Developer window restored at start up
165
165
  > from the last session) leaves the focus in the page, or a keyboard reader's
166
166
  > first Tab lands in a window they did not open; a modal one takes it always.
167
+ > Nor does a window opened under an overlay that holds the focus -- a modal
168
+ > window, a dialog, the drawer, a toolbar menu, all drawn above every window
169
+ > that is not modal (7.26.45): it took the focus where it could not be seen,
170
+ > and the next Tab gave it back to the overlay. It opens under it, and is there
171
+ > when the overlay goes. A window placed by its host INSIDE that overlay
172
+ > (`$parent` in a modal's body) takes it as before.
167
173
  > When it goes, the focus goes back where it was -- if it was in the window;
168
174
  > - **Escape closes it** (`keyboard`, `true` by default) when the focus is in
169
175
  > it, the way its ✕ does: `EV_CLOSE_WINDOW`, so `EV_WINDOW_TO_CLOSE` still
@@ -172,8 +178,11 @@ Published as `@yuneta/gobj-ui`. Built on top of [`@yuneta/gobj-js`](https://gith
172
178
  > editor's search box), an input method composing, an inline editor that
173
179
  > closed with the key (Tabulator cancels a cell edit by removing the box --
174
180
  > the window then takes the focus back), a `textarea` or a
175
- > `contenteditable` (what is being written is not lost to one key). Turn it
176
- > off with `keyboard: false`; the key then goes on to the shell;
181
+ > `contenteditable` (what is being written is not lost to one key). Nor
182
+ > while an overlay of the shell opened AFTER the window is up (a toolbar
183
+ > menu, 7.26.45): the key goes on to the shell, which closes that overlay
184
+ > first (`yui_shell_escape_order()`). Turn it off with `keyboard: false`;
185
+ > the key then goes on to the shell;
177
186
  > - a **`modal`** one blocks the rest of the app: it hangs over a backdrop in
178
187
  > the shell's dialog layer (`yui_shell_modal_layer()`; above the drawer, the
179
188
  > dock and every other window, below the toasts, and a question it asks opens
@@ -195,7 +204,9 @@ Published as `@yuneta/gobj-ui`. Built on top of [`@yuneta/gobj-js`](https://gith
195
204
  > **The shell's Escape follows the same rule (7.26.43).** It closed the
196
205
  > overlay on top of its chain for any Escape: one typed in a table cell being
197
206
  > edited inside a dialog cancelled the edit and closed the dialog with it. The
198
- > rule is one function, `escape_is_taken()` (`src/escape_taken.js`).
207
+ > rule is one function, `escape_is_taken()` (`src/escape_taken.js`). An
208
+ > Escape that closed a cell editor took the focus with it, to `<body>`: the
209
+ > dialog on top takes it back (7.26.45), as a window does.
199
210
  >
200
211
  > **The focus trap counts only what is drawn (7.26.43).** The adaptive dialog's
201
212
  > back arrow is the first control of every dialog and is `display:none` on a
@@ -203,6 +214,24 @@ Published as `@yuneta/gobj-ui`. Built on top of [`@yuneta/gobj-js`](https://gith
203
214
  > the dialog), and every Tab after that "wrapped" to it, did nothing and was
204
215
  > prevented -- the keyboard never got into a dialog. It now skips a control
205
216
  > that is not drawn.
217
+ >
218
+ > **A shell that stops closes what it has open (7.26.46).** A logout, or a
219
+ > session cut, with the drawer, a modal or a question up: the shell closes
220
+ > each one, the top first, as if it had been dismissed -- a modal's `on_close`
221
+ > runs (its `before_close` is not asked: that guard is for the reader), a
222
+ > question answers what Escape answers. Up to 7.26.45 only the toolbar
223
+ > dropdown was closed; the others kept their focus trap, and every window
224
+ > opened afterwards believed itself under an overlay and took no focus. An
225
+ > overlay of the app that uses the shell's Escape chain passes its
226
+ > unconditional close as the fourth argument, or it is left to its owner:
227
+ >
228
+ > ```js
229
+ > yui_shell_push_escape(shell, "modal", ask_then_close, close_now);
230
+ > ```
231
+ >
232
+ > And a trap whose panel left the document without being released is dropped,
233
+ > said in the log, the next time the stack is read: it no longer stands for an
234
+ > overlay that is gone.
206
235
 
207
236
  ## Two maintained lines
208
237
 
@@ -3619,6 +3648,21 @@ opened changed did not hear its tables at all, so closing it lost a table edit
3619
3648
  without a question. And the titles of those tables change language with the
3620
3649
  shell's `EV_LANGUAGE_CHANGED` (7.26.41+), like the rest of the form.
3621
3650
 
3651
+ What the reader TYPES in a cell editor is `edited` at once (7.26.46+), as in a
3652
+ field of the form: Tabulator says `dataChanged` only when the editor commits,
3653
+ so up to 7.26.45 a half-typed cell was not edited, and a host that asks
3654
+ `edited` before it reloads or closes the form by code dropped it without a
3655
+ question. A reload or a close by code still discards the open editor (it is
3656
+ cancelled before the rows go): asking is the host's part, and `edited` is
3657
+ what tells it to.
3658
+
3659
+ A `time` / `now` column of a table is edited in a `datetime-local` box, to the
3660
+ second, read and written as the form's own time field is (`form_time_value.js`:
3661
+ an epoch in seconds, or an ISO text for a string column). Up to 7.26.45 it was
3662
+ Tabulator's `datetime` editor with a luxon `format`, and nothing gives gobj-ui
3663
+ luxon: it opened empty and threw when committed. Luxon is not taken in for one
3664
+ editor.
3665
+
3622
3666
  A table hears the reader through Tabulator's `dataChanged`, which Tabulator
3623
3667
  does not say for `setData()` / `replaceData()`, nor when its `history` module
3624
3668
  undoes or redoes a cell edit or a row move (`Ctrl+Z`; a row added or deleted
@@ -3685,6 +3729,34 @@ its API. So the form applies `disabled` to those three, and the record is still
3685
3729
  read from a disabled control — it is collected by reading each marked control,
3686
3730
  never by submitting the form.
3687
3731
 
3732
+ ### `C_YUI_FORM` — which rows a click selects
3733
+
3734
+ A form's tables select no rows unless the host asks Tabulator for it in
3735
+ `tabulator_settings` (`selectableRows`: `true`, or how many). The form's
3736
+ `selectable` (`true` by default) then says whether a click selects: it is
3737
+ Tabulator's `selectableRowsCheck`, asked when a row is drawn and at each click,
3738
+ so it governs the row's own click, which toggles the row (a row drawn while it
3739
+ was `false` stays unselectable until it is drawn again). With the defaults
3740
+ nothing is selected.
3741
+
3742
+ The checkbox column (`with_checkbox`) asks `selectable` too, and is not drawn
3743
+ when the form is not selectable (7.26.46): Tabulator's row box ticks before its
3744
+ toggle is refused, and its header box selects every row without asking. A
3745
+ click in a NESTED table selects in that table only; it bubbled up to the row
3746
+ holding the table, which toggled too.
3747
+
3748
+ ```js
3749
+ gobj_create("form", "C_YUI_FORM", {
3750
+ template: template,
3751
+ tabulator_settings: {selectableRows: 1}, // a click picks one row
3752
+ selectable: true, // false: a click selects nothing
3753
+ }, parent);
3754
+ ```
3755
+
3756
+ Up to 7.26.44 the form toggled the row again in its `rowClick`, on top of
3757
+ Tabulator's own toggle: with `selectableRows: true` a click selected nothing,
3758
+ and with `selectable: false` it selected the row (7.26.45).
3759
+
3688
3760
  ### Selecting rows in any table — `yui_table_select.js`
3689
3761
 
3690
3762
  Deleting twenty rows one confirmation at a time is not a workflow. Any view
@@ -3968,7 +4040,24 @@ range raised by hand), and leaves it when it did (the round run twice, a
3968
4040
  package.json two apps share): the package.json's git history says which, and
3969
4041
  one whose history cannot be read is refused (since `7.26.43`; up to `7.26.42`
3970
4042
  a refused app kept the files raised before the refusal, `--no-wait` could
3971
- lower a range, and "already" deployed a new bundle under the old number).
4043
+ lower a range, and "already" deployed a new bundle under the old number). Its
4044
+ log line says `range already ^x.y.z, version raised` (since `7.26.45`; up to
4045
+ `7.26.44` it said `range raised`, a commit that only reformatted the line made
4046
+ a round run again raise the version twice, and a shallow clone whose HEAD
4047
+ raised the range by hand deployed under the old number).
4048
+
4049
+ The history is read by its VALUES (since `7.26.46`): the version is raised when
4050
+ ANY state the package.json had -- every branch merged in, a merge that combines
4051
+ two sides, a rename followed to the old name -- carries it with another range,
4052
+ since a number that stood beside another range may have gone out with it. A
4053
+ shallow clone is read as far as it goes when the oldest state it holds does not
4054
+ carry the range yet (a clone of depth 2 holding the commit before the raise);
4055
+ one cut where the range was already raised is refused, and the message says
4056
+ `git fetch --unshallow`. Up to `7.26.45` the round read ONE commit, the one
4057
+ that brought the range, so a merge of a branch that raised the range by hand,
4058
+ next to a version raised on main with the old range, deployed under that
4059
+ version, and a package.json MOVED after a hand raise was taken for one born
4060
+ with the range; and `7.26.45` refused every shallow clone.
3972
4061
 
3973
4062
  ### Colour: a brand token as INK takes `-on-scheme`, as a FILL it does not
3974
4063
 
@@ -4329,7 +4418,16 @@ call of t()?" (since `7.26.32`; up to `7.26.31` it was a call NAMED `t` or
4329
4418
  `.bind()` (`i18next.t.bind(i18next)`), a destructuring (since `7.26.35`:
4330
4419
  `const {t: tt} = i18next`, a parameter `{t: tt}`), a re-export of a module the
4331
4420
  reader reads --, called as `t(k)`, `t?.(k)`, `t.call(x, k)` or
4332
- `t.apply(x, [k])`. An ARRAY given to it is i18next's list of fallback keys, and
4421
+ `t.apply(x, [k])`, and `.call`, `.apply` and `.bind` written as computed
4422
+ members too (`t["call"](x, k)`, `t["bind"](null, k)`, since `7.26.45`; up to
4423
+ `7.26.44` those forms were not read, and a key handed that way went unasked).
4424
+ Since `7.26.46` a computed member is read by a const name and by a template as
4425
+ well (``t[`call`](x, k)``, `t[M](x, k)` with `const M = "call"`, `i18next[T](k)`
4426
+ with `const T = "t"`), and so is a SPREAD of an array the source writes out:
4427
+ `t(...["k"])`, `t.call(x, ...["k"])`, `t(...KEYS)` and `t.apply(x, KEYS)` with
4428
+ `const KEYS = ["k"]` -- each element of the const read as `KEYS[0]`,
4429
+ `KEYS[1]`... (up to `7.26.45` none of them was read, and nothing failed).
4430
+ An ARRAY given to it is i18next's list of fallback keys, and
4333
4431
  each one is a key: `t([specific, "generic"])` asks for "generic". A `.bind()`
4334
4432
  that binds a KEY makes a translator whose calls hand i18next its options or its
4335
4433
  default value: `const tk = t.bind(null, "save"); tk({count: 2})` (since
@@ -4535,7 +4633,12 @@ One that may give neither (`{id: "x", name: row.name}`, a parameter) reaches
4535
4633
  it. The test of the table proves every `fallbacks` against the code: each
4536
4634
  hand-off of the position is the right side of a `||` whose left reads the
4537
4635
  positions named (or a key position of a key function whose `fallbacks` say as
4538
- much). Up to `7.26.42` the id of a card was a key in every case. What is
4636
+ much). And the other way round (since `7.26.45`): a position the code reads
4637
+ first at EVERY hand-off is named, or the validator asks for the fallback where
4638
+ the function never reads it -- the toolbar brand's id reaches a key only
4639
+ behind its `aria_label` and its `name` (in `handle_toolbar_action()`), and up
4640
+ to `7.26.44` its entry named the `aria_label` alone. Up to `7.26.42` the id of
4641
+ a card was a key in every case. What is
4539
4642
  given at those positions is read like any other key (literals, consts,
4540
4643
  branches): in the app's own code, on a call that reaches that function of
4541
4644
  gobj-ui (an app function of the same name is not mistaken for it), and in
@@ -4546,7 +4649,12 @@ member): an import under any name, a re-export from a file of the app
4546
4649
  (`export {yui_shell_show_info as say} from "@yuneta/gobj-ui/src/shell_modals.js"`),
4547
4650
  a const alias (`const show = yui_shell_show_info`), a map in a const
4548
4651
  (`const API = {info: yui_shell_show_info}; API.info(...)`, imported too),
4549
- `.call(x, ...)` and `.apply(x, [...])`; and a `.bind()` of it is read as the
4652
+ `.call(x, ...)` and `.apply(x, [...])` (also as computed members,
4653
+ `f["call"](x, ...)`, since `7.26.45`; by a const name or a template, `f[M](x,
4654
+ ...)`, and with a spread or an `.apply()` of an array the source writes out,
4655
+ `f(shell, ...["k"])`, `f.apply(x, ARGS)` with `const ARGS = [shell, "k"]`,
4656
+ since `7.26.46` -- up to `7.26.45` such a spread failed the rule per call, and
4657
+ `f[M](...)` was not read); and a `.bind()` of it is read as the
4550
4658
  call it prepares, at the positions it binds (since `7.26.43`):
4551
4659
  `yui_shell_show_info.bind(null, shell, "k")` asks for "k", and a parameter
4552
4660
  bound there fails the rule per call as it does when it is handed directly. Up
@@ -5019,7 +5127,13 @@ reading the page in another language:
5019
5127
  that no const or import makes an alias of -- a parameter `translate`, a
5020
5128
  `let` alias, `opts.translate(k)`, `i18next.getFixedT()` --, or one called
5021
5129
  through what is no name of it: `(0, t)(k)`, `[t][0](k)`,
5022
- `Reflect.apply(t, x, [k])`, `Function.prototype.call.call(t, x, k)`;
5130
+ `Reflect.apply(t, x, [k])`, `Function.prototype.call.call(t, x, k)`, or by
5131
+ a computed name the reader does not follow to ONE string (`t[m](x, k)` with
5132
+ `m` a parameter or a `let`, `t[c()? "call" : "apply"]`);
5133
+ - a key handed to a translator in a spread of what is no array the source
5134
+ writes out (`t(...args)`, `t.apply(x, args)` with `args` a parameter, a
5135
+ `let`, or a const whose array holds a spread or a hole): from the spread on,
5136
+ no position is known;
5023
5137
  - a translator handed to a FUNCTION (`{t: t}`, `yui_tabulator_lang(t)`,
5024
5138
  `run(t)`) or to any method but those listed above (`keys.reduce(t)`,
5025
5139
  `keys.sort(t)`, an alias of a method, `Reflect.apply()`): only those
@@ -5032,8 +5146,10 @@ reading the page in another language:
5032
5146
  not, and so does one a `const` holds (below);
5033
5147
  - a key function reached through a parameter (`apply(fn)` calling
5034
5148
  `fn(shell, "k")`), a `let` given more than one function, a map in a `let`,
5035
- a computed member (`API[name](...)`), or `.apply()` of an array the source
5036
- does not write out;
5149
+ or a computed member whose name the reader does not follow to one string
5150
+ (`API[name](...)` with `name` a parameter or a `let`). An `.apply()` of an
5151
+ array the source does not write out, or a spread of one, is not invisible:
5152
+ it FAILS the rule per call, since no position from it on is known;
5037
5153
  - a `data-i18n*` attribute written through an alias of `dataset`
5038
5154
  (`const ds = el.dataset; ds.i18nTitle = k`), by `Object.assign()` into it,
5039
5155
  or named by a `let`;
@@ -5084,22 +5200,46 @@ reading the page in another language:
5084
5200
  translator handed as a callback to one of the methods above over an array
5085
5201
  the reader cannot follow, or to `.then()` / `.catch()`, unmarked;
5086
5202
  - a value the reader GIVES UP on, with the file and the line (since
5087
- `7.26.43`): a chain of consts, aliases or calls more than 24 steps deep, a
5088
- const that leads back to itself, an expression that can take more than
5089
- 10000 values. A key behind it would go unasked. Up to `7.26.42` the reader
5090
- stopped there in silence -- a chain of 24 aliases of a const, or of 12
5091
- consts that branch, asked for nothing at its far end, and the build passed
5092
- -- and a chain of consts that doubles at every link (`const O1 = c()? O0 :
5093
- {...O0, ...O0}`) grew three times at every link until it died with a
5094
- `RangeError` that named no file. A const is now read once, wherever it is
5095
- read, and a spread of the same object or array twice gives its values once.
5203
+ `7.26.43`): a value read through more than 24 steps, a const that leads
5204
+ back to itself, an expression that can take more than 10000 values. A key
5205
+ behind it would go unasked. A STEP is each const, alias, call, property,
5206
+ element, and branch of `?:` / `||` / `??` the read goes through, so twelve
5207
+ consts that each branch (`const K1 = c()? K0 : "k1"`) are already 24; the
5208
+ real apps read nothing deeper than 10. Up to `7.26.42` the reader stopped
5209
+ there in silence -- a chain of 24 aliases of a const, or of 12 consts that
5210
+ branch, asked for nothing at its far end, and the build passed -- and a
5211
+ chain of consts that doubles at every link (`const O1 = c()? O0 : {...O0,
5212
+ ...O0}`) grew three times at every link until it died with a `RangeError`
5213
+ that named no file. A const is read once, wherever it is read, and a spread
5214
+ of the same object or array twice gives its values once.
5215
+
5216
+ Since `7.26.45` the line said is the one of the READ, with the place the
5217
+ count went past 24 (`src/main.js:30: the reader gave up on \`J16\` (past
5218
+ \`K2\`, src/main.js:4), ...`): the first node the read reaches at step 25,
5219
+ the same whatever was read before (since `7.26.46`; in `7.26.45` it was the
5220
+ const read before, kept, when the count went past inside it -- `K10` with
5221
+ `t(K10)` above the read, `K2` without). The verdict does not depend on the
5222
+ order of the code either: a const, a property, an element and the returns of a
5223
+ function are read once and keep the steps they took, so a later read of them
5224
+ counts those steps too. Up to `7.26.44` a const kept what its FIRST read had
5225
+ reached -- with `J0 = K10` and `J16` 28 consts away from the key, `t(J16);
5226
+ t(K10)` failed and `t(K10); t(J16)` passed --, a call started the count
5227
+ again (thirty nested calls were read through), and the line said was the
5228
+ deepest link's. A chain of aliases of a FUNCTION, or of a published list
5229
+ written into, is followed to its end, and only one that can end in a
5230
+ translator, a key function (a function of gobj-ui) or a published list is a
5231
+ give-up: up to `7.26.44` thirty aliases of any function (`const f1 = f0;
5232
+ ... f30(1)`) failed the build with no i18n involved.
5096
5233
 
5097
5234
  Up to `7.26.27` the locale cases were "skipped" with an OK: one language less
5098
5235
  validated, and nobody told. A file of the locales directory with a locale's
5099
5236
  name that does not look like one (`app.js`, a helper that needs a browser to
5100
5237
  load) is said and skipped, as before. The script runs the same when it is
5101
5238
  reached through a symlinked package with `--preserve-symlinks-main` (also from
5102
- `NODE_OPTIONS`): both sides of its "am I the script?" test are resolved.
5239
+ `NODE_OPTIONS`): both sides of its "am I the script?" test are resolved. A
5240
+ locale is IMPORTED, so its code runs: the script ends itself once what it wrote
5241
+ has left, and a timer a locale leaves running does not hold the build (since
5242
+ `7.26.46`; up to `7.26.45` it held it for ever, a failing run included).
5103
5243
 
5104
5244
  Up to `7.26.24` each app carried its own copy, and the copies had drifted into
5105
5245
  three families: only one read the codes of the schema editor, only the other