@jsenv/navi 0.29.355 → 0.29.357

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.
@@ -142,7 +142,8 @@ to start when unsure which export solves a problem.
142
142
  - `control_group.md` — `<Group>`: several controls reading as one framed
143
143
  object. Read before negative margins or `border-radius: 0` by hand.
144
144
  - `form_changed.md` — a form sends nothing when nothing changed; what "changed"
145
- is measured against; `pristineKey`; `standalone`. Read before
145
+ is measured against; `pristineKey`; `standalone`; what follows a send, and
146
+ `command="--navi-void"` for a form that keeps its popup open. Read before
146
147
  `canSendWhileUnchanged`, and before a control inside a group whose value it
147
148
  has no business joining.
148
149
  - `field_validation.md` — what only a browser can answer versus "is this value
@@ -42,6 +42,33 @@ is (`--navi-reset`), stay put as it is (`--navi-void`). Left out, the surface th
42
42
  form sits in decides: a popup closes, a slide goes on, a form on a page does
43
43
  nothing.
44
44
 
45
+ ### A popup that stays open
46
+
47
+ A side panel, a dialog or a popover closes once a form inside it is sent. When
48
+ the popup is a place one keeps working in — a panel where a push is sent, two
49
+ fields are fixed, an account is linked — the form says it stays:
50
+
51
+ ```jsx
52
+ <SidePanel signal={openUserSignal} value={user.id}>
53
+ <Form action={sendPush} command="--navi-void">
54
+
55
+ </Form>
56
+ </SidePanel>
57
+ ```
58
+
59
+ The form says it, not the popup. A popup does not know which of its forms is
60
+ its answer: the same panel can hold a form you edit in over and over and a
61
+ "delete" whose send has to close it. A popup that stays open whatever is sent
62
+ inside it would make every form in it that should close say so again, which
63
+ is the same repetition in the other direction. Nor does a `SidePanel` get a
64
+ different default from a `Dialog`: the same content in either one should
65
+ behave the same, and on a small screen a `SidePanel` often _is_ a dialog.
66
+
67
+ When the popup's open state is a url param (`signal` bound to a route's search
68
+ param), closing it takes the param out of the url. A form that forgot
69
+ `--navi-void` then looks like a screen that reloaded: the panel is gone, and so
70
+ is what a reload would have brought back.
71
+
45
72
  `--navi-reset` is the one to reach for when the form is a place one comes back
46
73
  to — an entry created, then the next one: the fields go back to their
47
74
  `defaultValue`, ready for the next entry. (What the form is measured against
@@ -9,7 +9,7 @@ It answers three questions, and they are independent:
9
9
  1. **Is there anything between the popup and the page at all?** That is
10
10
  `backdrop`.
11
11
  2. **What does a press outside do?** Close, cancel, be absorbed, pass through.
12
- That is `pointerInteractionOutsideEffect`.
12
+ That is `pressOutside`.
13
13
  3. **How far does what is behind withdraw?** Dimmed, blurred, barely marked,
14
14
  not painted at all. That is the paint: `backdropVariant`, `backdropColor`,
15
15
  `backdropFilter`.
@@ -41,7 +41,7 @@ that gave no sign it would.
41
41
  `backdrop={false}` is how that popup says there is no wall:
42
42
 
43
43
  ```jsx
44
- <Popover pointerInteractionOutsideEffect="close" backdrop={false}>
44
+ <Popover pressOutside="close" backdrop={false}>
45
45
  ```
46
46
 
47
47
  The popup then hears an outside press from the document itself, and takes
@@ -92,9 +92,9 @@ limitation as `layer="local"`, see [`dialog_shape.md`](./dialog_shape.md)).
92
92
  Focus is not trapped either, deliberately — a page meant to be reachable is
93
93
  meant to be reachable with the keyboard too.
94
94
 
95
- `pointerInteractionOutsideEffect="capture"` and `backdrop={false}` contradict
95
+ `pressOutside="capture"` and `backdrop={false}` contradict
96
96
  each other — absorbing is what a wall does — and navi warns rather than
97
- silently behaving like `"none"`.
97
+ silently behaving like `"ignore"`.
98
98
 
99
99
  ## Where the outside begins
100
100
 
@@ -131,8 +131,8 @@ the surface:
131
131
 
132
132
  A press on that row — left of the wheel, right of it, or anywhere in the height
133
133
  it reserves while the wheel is hidden — does exactly what the same press on the
134
- backdrop does, `pointerInteractionOutsideEffect` and all: `"cancel"`
135
- reverts, `"capture"` absorbs it, `"none"` (a `Popover`'s default, where no
134
+ backdrop does, `pressOutside` and all: `"cancel"`
135
+ reverts, `"capture"` absorbs it, `"ignore"` (a `Popover`'s default, where no
136
136
  backdrop is rendered at all) leaves it without an answer.
137
137
 
138
138
  It is opt-in because navi cannot infer it: a background can come from anywhere,
@@ -179,7 +179,7 @@ panel that closes on that press then reopens on the click that follows is a
179
179
  panel meant to stay open, blinking.
180
180
 
181
181
  ```jsx
182
- <SidePanel id="error_panel" signal={openCardIdSignal} closeOnClickOutside>
182
+ <SidePanel id="error_panel" signal={openCardIdSignal} closeByPressOutside>
183
183
 
184
184
  </SidePanel>
185
185
 
@@ -236,12 +236,12 @@ Both are forwarded by `Popup`, `SidePanel`, `Picker` and `SplitButton`, next to
236
236
  When the choice is the app's rather than one popup's, it goes on `:root`. Each
237
237
  kind of backdrop has a colour **and** a filter, and they travel together:
238
238
 
239
- | kind | tokens |
240
- | ------------------------------------------------------------ | --------------------------------------------------------------------------------- |
241
- | the default (`pointerInteractionOutsideEffect` close/cancel) | `--navi-backdrop-close-background`, `--navi-backdrop-close-backdrop-filter` |
242
- | `pointerInteractionOutsideEffect="capture"` | `--navi-backdrop-capture-background`, `--navi-backdrop-capture-backdrop-filter` |
243
- | `backdropVariant="discrete"` | `--navi-backdrop-discrete-background`, `--navi-backdrop-discrete-backdrop-filter` |
244
- | `animation="lifting"`, `backdropVariant="lift"` | `--navi-backdrop-lift-background`, `--navi-backdrop-lift-backdrop-filter` |
239
+ | kind | tokens |
240
+ | ----------------------------------------------- | --------------------------------------------------------------------------------- |
241
+ | the default (`pressOutside` close/cancel) | `--navi-backdrop-close-background`, `--navi-backdrop-close-backdrop-filter` |
242
+ | `pressOutside="capture"` | `--navi-backdrop-capture-background`, `--navi-backdrop-capture-backdrop-filter` |
243
+ | `backdropVariant="discrete"` | `--navi-backdrop-discrete-background`, `--navi-backdrop-discrete-backdrop-filter` |
244
+ | `animation="lifting"`, `backdropVariant="lift"` | `--navi-backdrop-lift-background`, `--navi-backdrop-lift-backdrop-filter` |
245
245
 
246
246
  Only `capture` blurs out of the box among the three above: the rest of the page
247
247
  is genuinely unreachable then, so it reads as clearly secondary. Nothing else
@@ -313,10 +313,10 @@ one it is, so the same two lines hold under both renderers.
313
313
 
314
314
  Painting is resolved through two variables the popup and its backdrop carry,
315
315
  `--backdrop-background` and `--backdrop-filter`. Navi's own rules — the ones
316
- keyed on `pointerInteractionOutsideEffect` and on `backdropVariant` — write them
316
+ keyed on `pressOutside` and on `backdropVariant` — write them
317
317
  as defaults; the props write them inline on the same element, which beats every
318
318
  rule. So `backdropColor` wins over `backdropVariant="invisible"`, and a variant
319
319
  is only ever what the caller did not say.
320
320
 
321
- A `Popover` with `pointerInteractionOutsideEffect="none"` renders no backdrop at
321
+ A `Popover` with `pressOutside="ignore"` renders no backdrop at
322
322
  all: there is nothing to paint, and both props are ignored.
@@ -93,6 +93,8 @@ Two traps, both about the thumbnail:
93
93
  - **A scene under `lift="box"`** keeps the thumbnail at its own size in the
94
94
  corner of a growing, empty box, then swaps. Choose the kind by what grows:
95
95
  text and controls keep their scale (`box`), a drawing does not (`scene`).
96
+ Dev warns when the lifted node is, box for box, an `<svg>`, `<img>`,
97
+ `<picture>`, `<canvas>` or `<video>` under `box`.
96
98
  - **A thumbnail that is not the scene framed.** `scene` assumes the thumbnail
97
99
  is either the whole drawing smaller, or a band cut from its middle as wide as
98
100
  it. A thumbnail letterboxed inside a box of another aspect ratio (an SVG
@@ -157,6 +159,7 @@ const currentKeySignal = useSignal(undefined);
157
159
  <Dialog
158
160
  id={ZOOM_ID}
159
161
  animation="lifting"
162
+ lift="scene"
160
163
  mount="while-opened"
161
164
  onOpen={(e) => {
162
165
  currentKeySignal.value = e.detail.value;
@@ -688,12 +688,12 @@ the popup without closing it, and the error callout stays where the press was.
688
688
  The gestures that close a popup do not all mean the same thing, and that is on
689
689
  purpose:
690
690
 
691
- | gesture | what it means | who decides |
692
- | ------------------------------ | ------------- | --------------------------------------------------- |
693
- | Escape | cancel | `escapeEffect="cancel"` (default) |
694
- | a click outside | close, keep | `pointerInteractionOutsideEffect="close"` (default) |
695
- | a close cross (`--navi-close`) | close, keep | [the cross](#the-close-cross) |
696
- | `--navi-cancel` on a button | cancel | the button |
691
+ | gesture | what it means | who decides |
692
+ | ------------------------------ | ------------- | --------------------------------- |
693
+ | Escape | cancel | `escapeEffect="cancel"` (default) |
694
+ | a press outside | close, keep | `pressOutside="close"` (default) |
695
+ | a close cross (`--navi-close`) | close, keep | [the cross](#the-close-cross) |
696
+ | `--navi-cancel` on a button | cancel | the button |
697
697
 
698
698
  Escape says "forget it". It is the one gesture that has meant that everywhere,
699
699
  for as long as there have been dialogs, and navi keeps it that way. **A popup
@@ -927,7 +927,7 @@ the renderer.
927
927
 
928
928
  ```jsx
929
929
  const Panel = ({ children }) => (
930
- <SidePanel id="error_panel" signal={openCardIdSignal} closeOnClickOutside>
930
+ <SidePanel id="error_panel" signal={openCardIdSignal} closeByPressOutside>
931
931
  {children}
932
932
  </SidePanel>
933
933
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/navi",
3
- "version": "0.29.355",
3
+ "version": "0.29.357",
4
4
  "type": "module",
5
5
  "description": "Library of components including navigation to create frontend applications",
6
6
  "repository": {