@jsenv/navi 0.29.501 → 0.29.503
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/dist/dev/jsenv_navi.js +200 -68
- package/dist/dev/jsenv_navi.js.map +11 -9
- package/dist/jsenv_navi.js +200 -68
- package/dist/jsenv_navi.js.map +11 -9
- package/docs/drag_interactions.md +5 -1
- package/docs/route_transitions.md +44 -5
- package/package.json +2 -2
|
@@ -152,6 +152,7 @@ screen has not asked for it to swap places with whatever it flew over.
|
|
|
152
152
|
| Attribute | Meaning |
|
|
153
153
|
| -------------------------------------------------------- | -------------------------------------- |
|
|
154
154
|
| `data-drag-axis="x"\|"y"\|"xy"` | which axes the drag walks |
|
|
155
|
+
| `data-drag-intent-axis="x"\|"y"` | which axis a press takes it by |
|
|
155
156
|
| `data-reorder-flow="column"\|"row"\|"wrap"` | how the items of a list are laid out |
|
|
156
157
|
| `data-drag-delay` `data-drag-slop` `data-drag-threshold` | when the press becomes a grab |
|
|
157
158
|
| `data-drag-on-contact` | a finger may drag by travelling too |
|
|
@@ -284,7 +285,10 @@ whose first pixels go clearly up or down is the page's scroll that landed on the
|
|
|
284
285
|
handle — it is given back before the browser decides, and the page scrolls. A
|
|
285
286
|
thumb pulling sideways arcs, and leans that way at first: across has to win by
|
|
286
287
|
far to be the scroll's. A source walking both axes has nothing to leave, and
|
|
287
|
-
takes the whole finger
|
|
288
|
+
takes the whole finger — unless it says which axis takes it: a card pulled up
|
|
289
|
+
out of a strip that scrolls sideways (`data-drag-intent-axis="y"`, on the card
|
|
290
|
+
or on the strip) is given back to the strip by a finger going clearly sideways,
|
|
291
|
+
and once taken its copy still walks both ways.
|
|
288
292
|
|
|
289
293
|
### Landing on a place: `land`
|
|
290
294
|
|
|
@@ -62,7 +62,14 @@ defineRouteTransition(null, SETTINGS_PAGE, "cover-top");
|
|
|
62
62
|
Arriving there plays forward from wherever, leaving plays back to wherever. It is
|
|
63
63
|
tried last — a pair naming the same destination still owns its crossing — and it
|
|
64
64
|
is not `defineRouteDefaultTransition`, which is about every navigation nothing
|
|
65
|
-
was said about.
|
|
65
|
+
was said about.
|
|
66
|
+
|
|
67
|
+
Leaving means ANY navigation out of it towards a page no relation names, not
|
|
68
|
+
only the way back: leaving is taken to be closing it. A link from it to a page
|
|
69
|
+
below it (a profile's list of games, from the profile) then plays back, as if
|
|
70
|
+
the reader were going up. That is right for a door in the furniture, and wrong
|
|
71
|
+
for a page in a stack — a default that reads the history knows the difference
|
|
72
|
+
(see [below](#a-default-transition--when)). Write it only for a door that really is furniture: a page reached from a
|
|
66
73
|
screen has that screen to be paired with, and the pair says more.
|
|
67
74
|
|
|
68
75
|
A page with no door at all is from anywhere too: reached by its address from
|
|
@@ -121,16 +128,48 @@ Two recommendations that matter more than the individual choices:
|
|
|
121
128
|
`defineRouteDefaultTransition("cross-fade")` plays on every navigation no relation
|
|
122
129
|
was written for. Two situations, two answers:
|
|
123
130
|
|
|
124
|
-
- **App-shaped UI** (bars, tabs, pages one goes into):
|
|
125
|
-
sibling tabs is part of the grammar, and a default
|
|
131
|
+
- **App-shaped UI** (bars, tabs, pages one goes into): not a directionless one.
|
|
132
|
+
The silence between sibling tabs is part of the grammar, and such a default
|
|
133
|
+
erases it. An app that is a navigation stack has one of its own (below).
|
|
126
134
|
- **Content-shaped site** (documents, articles, browsing): a global cross-fade can
|
|
127
|
-
be right — every navigation is a soft change of subject.
|
|
128
|
-
export exists for.
|
|
135
|
+
be right — every navigation is a soft change of subject.
|
|
129
136
|
|
|
130
137
|
A default has no direction (nothing says which of two arbitrary pages is
|
|
131
138
|
"before" the other), so navi's `slide-*` and `cover-*`, written on the direction,
|
|
132
139
|
play nothing there. Written relations, and `"none"`, always win over it.
|
|
133
140
|
|
|
141
|
+
One thing does order two arbitrary pages: the history. An app built as a
|
|
142
|
+
**navigation stack** — every link goes one level deeper, every back one level
|
|
143
|
+
up, and the level is the depth in the history rather than a rank per page —
|
|
144
|
+
says so on its default:
|
|
145
|
+
|
|
146
|
+
```js
|
|
147
|
+
defineRouteDefaultTransition({ type: "slide-x", direction: "history" });
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
- a push plays forward;
|
|
151
|
+
- a traversal retraces its crossing (see
|
|
152
|
+
[below](#a-traversal-retraces-its-crossing)), or with none remembered plays
|
|
153
|
+
back when it lands lower in the history and forward when it lands higher;
|
|
154
|
+
- a replace stays on its level and plays nothing;
|
|
155
|
+
- a navigation that keeps the page plays nothing either: a push opening a
|
|
156
|
+
[layer](./navigation.md#a-layer-over-the-screen-what-its-address-may-say) moves
|
|
157
|
+
the layer.
|
|
158
|
+
|
|
159
|
+
The relations still answer first, so they only say what is NOT one level deeper:
|
|
160
|
+
a sheet that flips to be edited, a composer covering from the bottom, a link
|
|
161
|
+
going up on purpose (a pair read in reverse). A page written from anywhere then
|
|
162
|
+
answers for its way out only on a back — a link out of it is a push like any
|
|
163
|
+
other. Destinations that replace each other without movement (the tabs of a
|
|
164
|
+
bottom bar) are each written from anywhere with `"none"`: arriving there plays
|
|
165
|
+
nothing, by the bar or by any link.
|
|
166
|
+
|
|
167
|
+
```js
|
|
168
|
+
for (const destination of [MY_GAMES_PAGE, ALERTS_PAGE, PLAYERS_PAGE]) {
|
|
169
|
+
defineRouteTransition(null, destination, "none");
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
134
173
|
## When one navigation knows better
|
|
135
174
|
|
|
136
175
|
A relation is written on a PAIR, so it holds for every way of reaching the page —
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/navi",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.503",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Library of components including navigation to create frontend applications",
|
|
6
6
|
"repository": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"preact": "^11.0.0-rc.2"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@jsenv/dom": "0.17.
|
|
37
|
+
"@jsenv/dom": "0.17.100",
|
|
38
38
|
"@jsenv/humanize": "1.8.11",
|
|
39
39
|
"@jsenv/validity": "0.4.7"
|
|
40
40
|
},
|