@jsenv/navi 0.29.363 → 0.29.365

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.
@@ -175,7 +175,9 @@ to start when unsure which export solves a problem.
175
175
  trigger's box is the card's box; `lift="box"` for a card, `"scene"` for a
176
176
  drawing framed the same way; one popup for a whole row, walked from the front
177
177
  through a `SlideContainer`, `liftAnchor` naming where the closing comes back
178
- to; what an opening costs and where the time goes;
178
+ to; `animation={{ open, close: "lifting" }}` for a popup that did not come out of what it
179
+ lands in, the landing rendered by `onClose`; what an opening costs and where
180
+ the time goes;
179
181
  the wall at half strength on the frame before the movement. Read before
180
182
  giving a `Dialog` or a `Picker` `animation="lifting"`, or before measuring
181
183
  why one opens slowly.
@@ -5,7 +5,9 @@ for one situation: the thing the user pressed is the thing the popup shows,
5
5
  brought to the front to be looked at or written in. A card in a feed becomes
6
6
  its edit sheet; a drawing in a corner becomes the drawing full width. The page
7
7
  recedes behind a wall, the box leaves its place, travels and grows, and comes
8
- back into its place on close.
8
+ back into its place on close — or, with `animation={{ open: "scaling", close: "lifting" }}`, only
9
+ lands somewhere on close (see [lifting on the way back
10
+ only](#lifting-on-the-way-back-only)).
9
11
 
10
12
  It is not a way to open a dialog with a nicer entrance. A dialog that shows
11
13
  something else than what was pressed — a menu, a confirmation, a form the
@@ -19,6 +21,7 @@ and everything below follows from that one fact.
19
21
  - [The lifted node paints itself](#the-lifted-node-paints-itself)
20
22
  - [Same width, or a wider box](#same-width-or-a-wider-box)
21
23
  - [A row of cards: one popup that walks](#a-row-of-cards-one-popup-that-walks)
24
+ - [Lifting on the way back only](#lifting-on-the-way-back-only)
22
25
  - [What it costs, and where the time goes](#what-it-costs-and-where-the-time-goes)
23
26
  - [The wall, and the frame before the movement](#the-wall-and-the-frame-before-the-movement)
24
27
  - [What the browser does around it](#what-the-browser-does-around-it)
@@ -248,6 +251,74 @@ the see-through box as backdrop (see
248
251
  written by hand on a click has to tell a click from the end of a swipe — and
249
252
  that guard is the sign the marker was missed.
250
253
 
254
+ ## Lifting on the way back only
255
+
256
+ Sometimes the opening is not a lift and the closing is. A banner says "your
257
+ level is computed"; pressing it opens a full-screen reveal, the crest big in a
258
+ halo; collecting it sends the crest down into its place on the rank plate,
259
+ which replaces the banner at that moment. The banner is not the reveal, so
260
+ nothing morphs on the way in. But on the way out one box does travel into
261
+ another, and that other box did not exist when the reveal opened.
262
+
263
+ ```jsx
264
+ <Dialog
265
+ animation={{ open: "scaling", close: "lifting" }}
266
+ liftAnchor="profile_level_crest"
267
+ onClose={(e) => {
268
+ if (e.detail.requester?.id === "level_collect") {
269
+ levelRevealedSignal.value = true; // renders the plate, and its crest
270
+ }
271
+ }}
272
+ >
273
+ <span data-lift>
274
+ <RankCrest size="220px" />
275
+ </span>
276
+ <Button id="level_collect" command="--navi-close" variant="bare">
277
+ Collect
278
+ </Button>
279
+ </Dialog>
280
+ ```
281
+
282
+ **The opening is whatever `open` says** (`"auto"` included). Only the close lifts, so none of
283
+ what a lifting opening brings is there: no wait for `data-lift`, no opaque
284
+ wall. `data-lift` is read at the close alone.
285
+
286
+ **The box it lands in can be rendered by the close.** `liftAnchor` is read
287
+ once the close has been made, `onClose` included, inside the transition. A
288
+ state written in `onClose` has rendered by the time the landing is looked up,
289
+ so the landing box can come from that state. This is also the one place where
290
+ that state can be written: before the close, the reveal would disappear from
291
+ the picture being left; after it, the picture of the arrival is already taken.
292
+ Do not write it by hand around the dialog either. Unmounting the dialog with
293
+ the component that holds it takes it off screen without a close, and the lift
294
+ never happens.
295
+
296
+ **It is waited for, briefly.** When `liftAnchor` names nothing yet, navi waits
297
+ for it to appear, up to 300 ms, before it takes the new picture. The screen is
298
+ frozen on the reveal meanwhile, so this covers a render and not a fetch: the
299
+ landing must be drawable from what the page already holds. Past the wait, the
300
+ dialog closes without landing (its picture fades out) and dev warns.
301
+
302
+ **Tell the collecting close from the others.** Escape, the back button and a
303
+ press on the wall also close the dialog, and they usually mean "not now" rather
304
+ than "collect". `onClose` receives who asked (`e.detail.requester`, the button
305
+ of a `--navi-close`). Only the close that collects writes the state, and the
306
+ others close the dialog without writing it, back into the element it opened from.
307
+
308
+ **The dialog may go away with the state.** A reveal shown in place of the
309
+ plate usually lives in the same branch as the banner and is unmounted by the
310
+ state it writes. That is fine: the picture of the reveal was taken before the
311
+ close.
312
+
313
+ **The landing box is the crest's box**, for the same reason the trigger's box
314
+ is the card's box (see [above](#the-triggers-box-is-the-cards-box)): the id
315
+ goes on the element that is exactly the small crest, not on the plate around
316
+ it.
317
+
318
+ **The opening's own exit does not play.** While a closing lift runs, the
319
+ dialog's transitions are off. `scaling`'s exit would keep the dialog painted
320
+ into the picture of the state it closes into.
321
+
251
322
  ## What it costs, and where the time goes
252
323
 
253
324
  Measured at CPU ×6 on the demo bench (`12_picker_card_demo.html#lift-bench`),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/navi",
3
- "version": "0.29.363",
3
+ "version": "0.29.365",
4
4
  "type": "module",
5
5
  "description": "Library of components including navigation to create frontend applications",
6
6
  "repository": {