@jsenv/navi 0.29.149 → 0.29.150

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.
@@ -479,7 +479,7 @@ holds; only its mechanisms change.
479
479
  | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
480
480
  | two routes, `/new` and `/:id/edit` | one dialog, two modes — hence the value it is opened ON ([popup_open.md](./popup_open.md#opening-it-on-something)) |
481
481
  | the draft lives in the `searchParams` | it lives in the dialog, and dies with it |
482
- | cancelling = leaving the screen, which is thrown away | `unmountWhenClosed` (+ a `key` on the form), same effect |
482
+ | cancelling = leaving the screen, which is thrown away | `mount="while-opened"` (+ a `key` on the form), same effect |
483
483
  | `RouteTravel` between the two screens | nothing: a dialog has no neighbour |
484
484
  | `onLoad` + `pristineKey`: the resource arrives after | it is already in hand — the dialog is opened FROM the list |
485
485
 
@@ -169,7 +169,7 @@ which one — so the press says it, with its own value:
169
169
 
170
170
  <Dialog
171
171
  id="radar-dialog"
172
- unmountWhenClosed
172
+ mount="while-opened"
173
173
  onOpen={(e) => {
174
174
  editedRadarIdSignal.value = e.detail.value; // undefined = création
175
175
  }}
@@ -200,7 +200,7 @@ The order is the whole point, and it is a guarantee, not a coincidence:
200
200
 
201
201
  ```
202
202
  onOpen(openEvent) ← the subject is decided here
203
- children mounted ← unmountWhenClosed rebuilds them from scratch, on that subject
203
+ children mounted ← mount="while-opened" rebuilds them from scratch, on that subject
204
204
  positioned, shown
205
205
  ```
206
206
 
@@ -221,7 +221,7 @@ knowing why:
221
221
  `onnavi_command` receives the whole command string and its value, but it runs
222
222
  **after** the opening: whatever it writes lands on a popup that is already open.
223
223
  That works only as long as nothing has read the state yet — which
224
- `unmountWhenClosed` makes a real race rather than a theoretical one.
224
+ `mount="while-opened"` makes a real race rather than a theoretical one.
225
225
 
226
226
  A `navi_request_open` listener added on the element is the request itself, ahead
227
227
  of the popup acting on it — but it is ordered against the popup's own handler by
@@ -609,23 +609,28 @@ A closed popup builds nothing: `children` are mounted on the first open, and
609
609
  stay mounted afterwards — a reopened popup finds its scroll position and its
610
610
  half-typed form where it left them.
611
611
 
612
- Two props move that line:
612
+ "Closed" is two states, not one — never opened yet, and closed again after an
613
+ opening — so the `mount` prop answers both at once:
613
614
 
614
- | prop | effect |
615
- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
616
- | `mountWhenClosed` | build `children` right away — for content something depends on before any opening (a value read off it, fields a surrounding form submits, a size measured from outside) |
617
- | `unmountWhenClosed` | throw `children` away once the popup has finished closing — for content whose fresh state is its initial state |
615
+ | `mount` | before the first open | after a close |
616
+ | ----------------------------- | --------------------- | ------------- |
617
+ | `"always"` | mounted | mounted |
618
+ | `"from-first-open"` (default) | not mounted | mounted |
619
+ | `"while-opened"` | not mounted | not mounted |
618
620
 
619
- `unmountWhenClosed` is what an uncontrolled field seeded from a `defaultValue`
621
+ `"always"` is for content something depends on before any opening: a value read
622
+ off it, fields a surrounding form submits, a size measured from outside.
623
+
624
+ `"while-opened"` is what an uncontrolled field seeded from a `defaultValue`
620
625
  needs: without it, a popup reopened after the underlying value changed still
621
626
  shows what it showed at closing time.
622
627
 
623
628
  ```jsx
624
- <Dialog ref={dialogRef} unmountWhenClosed>
629
+ <Dialog ref={dialogRef} mount="while-opened">
625
630
  <Textarea defaultValue={note.text} />
626
631
  </Dialog>
627
632
  ```
628
633
 
629
634
  The content is dropped only once the exit transition is over, so the popup never
630
635
  plays it on a blank surface; a popup reopened while it was leaving keeps the
631
- content that opening just asked for. `mountWhenClosed` wins if both are set.
636
+ content that opening just asked for.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/navi",
3
- "version": "0.29.149",
3
+ "version": "0.29.150",
4
4
  "type": "module",
5
5
  "description": "Library of components including navigation to create frontend applications",
6
6
  "repository": {