@jsenv/navi 0.29.430 → 0.29.432

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.
@@ -143,7 +143,9 @@ start when unsure which export solves a problem.
143
143
  own actions). Before passing `open`, calling `triggerNaviCommand`, or
144
144
  writing a close button.
145
145
  - `popup_backdrop.md` — three independent questions: a wall or not, what an
146
- outside press does, how far the page withdraws. Before CSS for a backdrop.
146
+ outside press does, how far the page withdraws; and the browser's
147
+ `theme-color` that a popup paints over. Before CSS for a backdrop, or a
148
+ `theme-color` meta.
147
149
  - `popup_lift.md` — `animation="lifting"`: the pressed card brought to the front.
148
150
  Before giving a `Dialog` or a `Picker` `animation="lifting"`.
149
151
  - `dialog_shape.md` — bounds rather than a width, the container ceiling, the
@@ -26,6 +26,7 @@ linking to them, and turning them into tabs.
26
26
  - [What the search param buys: the way back is in the address](#what-the-search-param-buys-the-way-back-is-in-the-address)
27
27
  - [The wiring](#the-wiring)
28
28
  - [Places inside the layer](#places-inside-the-layer)
29
+ - [A link inside the layer leads to a page](#a-link-inside-the-layer-leads-to-a-page)
29
30
  - [What it costs](#what-it-costs)
30
31
 
31
32
  ## The rule that decides everything else: the position belongs in the URL
@@ -783,7 +784,9 @@ Every piece of it answers something:
783
784
  off screen;
784
785
  - **no `defineRouteTransition` for it.** The page beneath does not change, so
785
786
  there is no pair of pages to move between — route transitions are for pages
786
- replacing pages ([route_transitions.md](./route_transitions.md)).
787
+ replacing pages ([route_transitions.md](./route_transitions.md)). When a link
788
+ inside the layer does change it, see
789
+ [below](#a-link-inside-the-layer-leads-to-a-page).
787
790
 
788
791
  ### Places inside the layer
789
792
 
@@ -811,6 +814,30 @@ is shown. A popup's `value` answers another one, WHICH of several popups is open
811
814
  (one sheet per card under a single `?seat=<gameId>`), not what varies inside one
812
815
  (see [popup_open.md](./popup_open.md#signal--the-app-holds-it-both-ways)).
813
816
 
817
+ ### A link inside the layer leads to a page
818
+
819
+ The terms of use behind an About dialog, a profile behind a name in the
820
+ notifications: a link inside the layer leads to another page, and the layer does
821
+ not follow — its params are `weak`, the link drops them, and the layer closes in
822
+ the navigation that brings the page. The back button brings both back: the page,
823
+ and the layer over it as it was, on the tab it was on.
824
+
825
+ Neither is a movement of the layer's. **The page changing is its movement**: a
826
+ layer opened or closed by the navigation that puts another page on screen plays
827
+ no entrance and no exit, and its slides land where the address puts them rather
828
+ than travelling there — a tab row's indicator with them. A route transition
829
+ towards that page already carries the layer: photographed with the page it
830
+ covers, it leaves with that page and comes back with it
831
+ ([route_transitions.md](./route_transitions.md#pages-between-fixed-bars-the-transition-area)).
832
+ Without one, the page cuts, and the layer cuts with it. Played on its own as
833
+ well, the layer would move twice — dropping in over a page that is sliding.
834
+
835
+ The line is the page, not how the navigation was made: the back button closing
836
+ the layer itself (`/me?settings` → `/me`) is the layer's own movement, and plays
837
+ its exit. A page is what navi moves between — a new path, or a param that a
838
+ relation or a `RouteTravel` row names as a page. A search param the page merely
839
+ reads keeps the page, and a layer that changes with it moves on its own.
840
+
814
841
  ### What it costs
815
842
 
816
843
  This is a compromise, and it is worth stating rather than discovering:
@@ -254,6 +254,59 @@ eye is on — a picture opened full, a plan, a card painting its own surface.
254
254
  `"invisible"` is the one kind with no filter token: it paints nothing, and a
255
255
  filter would still be seen.
256
256
 
257
+ ## Above the screen: the browser's colour
258
+
259
+ On a phone the browser paints a band above the page — Chrome's address bar, the
260
+ status bar of an installed app — in the colour of `<meta name="theme-color">`.
261
+ It touches the page's top edge, so it reads as part of whatever is drawn there.
262
+ A backdrop that stops at the top of the viewport, under a band still at full
263
+ brightness, reads as two layers that do not belong together. So navi works that
264
+ colour out from what is on screen:
265
+
266
+ - **The page says it with `<Head>`**, the way it says its title:
267
+
268
+ ```jsx
269
+ <Head>
270
+ <meta name="theme-color" content="#2563a8" />
271
+ </Head>
272
+ ```
273
+
274
+ The last `<Head>` to arrive wins, whatever order they leave in (a route
275
+ transition puts the arriving page up before it takes the leaving one down). A
276
+ `theme-color` meta written in the HTML shows when no `<Head>` gives one.
277
+
278
+ - **Each open popup in the top layer paints over it**, in the order they
279
+ opened: its backdrop colour over the colour under it, then its own background
280
+ over that when it is flush with the top edge — `marginWithContainer={0}` with
281
+ `expand`/`expandY` or a top `positionArea`, which is what a full-screen
282
+ dialog or a `SidePanel side="top"` is. A wash of `rgba(12, 23, 44, 0.45)` over
283
+ a `#2563a8` bar gives `#1a4170`. A navy full-screen dialog gives its navy.
284
+
285
+ The colour changes when the opening starts, and changes back when the closing
286
+ starts. If the page under an open popup changes its colour, the popup paints
287
+ over the new one. Each `media` a page gives (one colour per
288
+ `prefers-color-scheme`) is painted over on its own.
289
+
290
+ Nothing is written at the call site. The `themeColor` prop is for what navi
291
+ cannot read:
292
+
293
+ - the `backdropFilter` is left out: a flat colour has nothing to blur;
294
+ - a surface painted with an image or a gradient has no colour to read, and
295
+ `themeColor="#0c172c"` gives it one;
296
+ - `themeColor={false}` leaves the colour under the popup as it is.
297
+
298
+ A popup that lays nothing over the edge changes nothing: `backdropVariant="invisible"`,
299
+ `backdrop={false}`, a `Popover` without a backdrop, any `layer="local"` popup.
300
+ A `Popover` paints its backdrop only, never its surface: it has no notion of
301
+ being flush with an edge.
302
+
303
+ **A `<Head>` inside a popup does not give the popup's colour.** It counts as a
304
+ page's `<Head>`, under every popup, including the one holding it. It also stays
305
+ after the closing. A popup's content stays mounted once built (`mount`, see
306
+ [`popup_open.md`](./popup_open.md)), and its `<Head>` stays with it, so its colour
307
+ remains after the popup has gone. `themeColor` lasts exactly as long as the
308
+ popup is open.
309
+
257
310
  ## Why props, and not a rule in the app's stylesheet
258
311
 
259
312
  **The backdrop is not inside the popup**, and which element it is depends on the
@@ -636,7 +636,10 @@ opens or closes on its own — Escape, the backdrop, a `--navi-close` — and af
636
636
  a close a busy control denied, when the signal says "open" again, because that
637
637
  is what is true (see [state_binding.md](./state_binding.md)). A signal already
638
638
  `true` at mount means the popup was already open when the page appeared: no
639
- entrance plays.
639
+ entrance plays. Nor does an opening — or an exit — the signal asks for in the
640
+ navigation that puts another page on screen: that page is the popup's movement
641
+ ([navigation.md](./navigation.md#a-link-inside-the-layer-leads-to-a-page)), and
642
+ the same holds for `open` and `navState`.
640
643
 
641
644
  `value` makes the signal say WHICH popup is open, for several sharing it — one
642
645
  sheet per card in a feed, with a single `?seat=<gameId>` for all of them:
@@ -267,7 +267,11 @@ travelling with the pages has a rectangle where it will be, not where it is seen
267
267
  finger is on the box — and leaves the bars live.
268
268
 
269
269
  A **modal `Dialog` open on a page** is furniture of the same kind: it travels with
270
- its page, or holds if both states have it. Its wall cannot be photographed (see
270
+ its page, or holds if both states have it. One the navigation itself opens or
271
+ closes — a layer whose `weak` param the link drops, or the back brings back —
272
+ moves that way only, with no entrance or exit of its own on top
273
+ ([navigation.md](./navigation.md#a-link-inside-the-layer-leads-to-a-page)). The
274
+ dialog's wall cannot be photographed (see
271
275
  [view_transitions.md](./view_transitions.md#the-top-layer-is-painted-through-the-roots-picture)),
272
276
  and dropping it for the movement makes the window blink under the press, so navi
273
277
  paints it into the pictures: a page leaving from under a wall leaves dimmed, one
@@ -450,8 +454,9 @@ What that means for a page and for the application around it:
450
454
  - **It is taken down after the page arriving is up.** A cleanup that puts back
451
455
  what it found — a document title, a class on `<body>`, a value in a shared store
452
456
  — puts a stale value back over the new page's. Such a registration is written as
453
- "the last to arrive wins": navi's `<Head>` keeps its titles as a stack, and a
454
- slot shows the last `SlotFill` to arrive.
457
+ "the last to arrive wins": navi's `<Head>` keeps its titles and its
458
+ `theme-color` metas as a stack, and a slot shows the last `SlotFill` to
459
+ arrive.
455
460
  - **What it fills outside its own nodes leaves at once.** A `SlotFill` in a page
456
461
  kept while leaving steps out of its slot, so a bar each page fills shows the
457
462
  page arriving — or nothing, when that page fills none.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/navi",
3
- "version": "0.29.430",
3
+ "version": "0.29.432",
4
4
  "type": "module",
5
5
  "description": "Library of components including navigation to create frontend applications",
6
6
  "repository": {