Skip to content

Commit f3e6dfe

Browse files
committed
work
1 parent bed6e5a commit f3e6dfe

17 files changed

Lines changed: 1119 additions & 287 deletions

File tree

packages/frontend/navi/dist/jsenv_navi.js

Lines changed: 455 additions & 107 deletions
Large diffs are not rendered by default.

packages/frontend/navi/dist/jsenv_navi.js.map

Lines changed: 9 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/frontend/navi/docs/route_transitions.md

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,37 @@ of a bottom bar, side by side, neither before the other — a cut is the honest
3434
rendering of that fact. Resist the urge to fill every navigation with movement;
3535
declare the relations that exist and let the rest cut.
3636

37+
## A page opened from anywhere
38+
39+
One shape of page has no pair to write. Its door is in the fixed furniture — a
40+
gear in the top bar, a "+" in the tab bar — so it is opened from every screen of
41+
the app and closed back onto whichever one the reader was on. The relation is
42+
real and it is a single sentence ("the settings come down over the screen you
43+
were on, and go back up"), but there are twenty-five `from` pages and not one of
44+
them is the point.
45+
46+
Leave the `from` out:
47+
48+
```js
49+
defineRouteTransition(null, SETTINGS_PAGE, "cover-top");
50+
```
51+
52+
Arriving there plays forward from wherever, leaving plays back to wherever. The
53+
back half is what this exists for: closing such a page is almost always a back —
54+
the close button running `--navi-nav-back`, the browser's back button, a swipe —
55+
and a traversal carries no link and therefore no request, so `routeTransition` on
56+
the way in has no counterpart on the way out. Written on the destination, the way
57+
out is found the same way the way in was, with nothing to remember per history
58+
entry.
59+
60+
It is tried last, after every written pair, so a pair naming the same destination
61+
still owns its crossing — the map, where it was drawn, is more precise than "from
62+
wherever". And it is not `defineRouteDefaultTransition`: a default is about every
63+
navigation nothing was said about, this is about ONE destination whose door
64+
happens to be everywhere. Write it for a page whose door really is furniture; a
65+
page reached from a screen has that screen to be paired with, and the pair says
66+
more.
67+
3768
## Choosing a movement
3869

3970
- **`slide-x`** — going INTO something: a list item opened, a card followed, a
@@ -42,10 +73,13 @@ declare the relations that exist and let the rest cut.
4273
taught.
4374
- **`slide-y`** — the same relation on a vertical arrangement, when the layout
4475
genuinely reads as a column.
45-
- **`cover-x` / `cover-y`** — a page that INTERRUPTS rather than continues:
46-
settings, a composer, anything modal-like that one returns from to find the
47-
page beneath unchanged. The covered page holding still is the point — it
48-
promises "you are not leaving, this is on top".
76+
- **`cover-right` / `cover-left` / `cover-bottom` / `cover-top`** — a page that
77+
INTERRUPTS rather than continues: settings, a composer, anything modal-like
78+
that one returns from to find the page beneath unchanged. The covered page
79+
holding still is the point — it promises "you are not leaving, this is on
80+
top". The edge named is the one the page comes IN from, and the one to name is
81+
where its door is: a composer opened from a bottom bar covers from the bottom,
82+
settings pulled down from a top bar cover from the top.
4983
- **`zoom`** — a detail brought closer: a photo, a card expanded into a page.
5084
- **`cross-fade`** — a soft change with no spatial claim. Use it where a cut
5185
feels harsh but no direction would be true.
@@ -284,7 +318,7 @@ const ALERT_CREATE_ROUTE = route("/me/alerts/create");
284318
const ALERT_DETAIL_ROUTE = route("/me/alerts/:alertId"); // "create" is an alertId
285319

286320
defineRouteTransition(ALERTS_ROUTE, ALERT_DETAIL_ROUTE, "slide-x");
287-
defineRouteTransition(ALERTS_ROUTE, ALERT_CREATE_ROUTE, "cover-y");
321+
defineRouteTransition(ALERTS_ROUTE, ALERT_CREATE_ROUTE, "cover-bottom");
288322
```
289323

290324
On `/me/alerts/create` both detail and create are current; the page mentioned

packages/frontend/navi/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ export {
124124
defineRouteTransition,
125125
} from "./src/nav/route_transition.jsx";
126126
export { RouteTravel } from "./src/nav/route_travel.jsx";
127+
// What covers the box a route movement plays in from inside the document — a
128+
// sticky row above the pages — so its pictures are cut at it instead of sliding
129+
// over it (see src/nav/transition_cover.js).
130+
export { useTransitionCover } from "./src/nav/transition_cover.js";
127131
export { anyMatchingRouteSignal, routeAction } from "./src/nav/route_action.js";
128132
export { rawUrlPart, setBaseUrl } from "./src/nav/route_pattern.js";
129133
export {

packages/frontend/navi/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jsenv/navi",
3-
"version": "0.29.163",
3+
"version": "0.29.164",
44
"type": "module",
55
"description": "Library of components including navigation to create frontend applications",
66
"repository": {

packages/frontend/navi/src/control/demos/21_expandable_demo.html

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,8 @@
449449
<Heading id="parts">Parts</Heading>
450450
<p>
451451
<code>Expandable.UI</code> and <code>Expandable.Content</code> given
452-
explicitly; their order decides where the content goes.
452+
explicitly; <code>openDirection</code> decides where the content
453+
goes — the parts below are always written UI first.
453454
</p>
454455
<div className="demo-row">
455456
<div className="demo-box">
@@ -463,18 +464,18 @@
463464
</div>
464465
<div className="demo-box">
465466
<p className="demo-caption">
466-
Content then UI, in flow: the UI and the text after it are
467+
openDirection="up", in flow: the UI and the text after it are
467468
pushed down
468469
</p>
469470
<p style="color: #90a4ae">Page content before the expandable.</p>
470-
<Expandable animation>
471+
<Expandable animation openDirection="up">
472+
<Expandable.UI>Details</Expandable.UI>
471473
<Expandable.Content>
472474
<div className="demo-content">
473475
<p>Revealed above the UI.</p>
474476
<p>Two lines of content.</p>
475477
</div>
476478
</Expandable.Content>
477-
<Expandable.UI>Details</Expandable.UI>
478479
</Expandable>
479480
<p style="color: #90a4ae">Page content after the expandable.</p>
480481
</div>
@@ -486,19 +487,20 @@
486487
<p style="color: #90a4ae">Page content before the expandable.</p>
487488
<Expandable
488489
animation
490+
openDirection="up"
489491
absolute
490492
bottom="12"
491493
left="12"
492494
right="12"
493495
backgroundColor="white"
494496
>
497+
<Expandable.UI>Details</Expandable.UI>
495498
<Expandable.Content>
496499
<div className="demo-content">
497500
<p>Revealed above the UI.</p>
498501
<p>Two lines of content.</p>
499502
</div>
500503
</Expandable.Content>
501-
<Expandable.UI>Details</Expandable.UI>
502504
</Expandable>
503505
<p style="color: #90a4ae">Page content after the expandable.</p>
504506
</div>
@@ -516,7 +518,7 @@
516518
</p>
517519
<div className="demo-row">
518520
<div className="demo-box">
519-
<p className="demo-caption">content to the right</p>
521+
<p className="demo-caption">content to the right (default)</p>
520522
<Expandable layout="column" animation>
521523
<Expandable.UI style="background: #eceff1; padding: 4px">
522524
More
@@ -532,19 +534,19 @@
532534
</div>
533535
<div className="demo-box">
534536
<p className="demo-caption">
535-
content to the left (Content then UI)
537+
content to the left (openDirection="left")
536538
</p>
537-
<Expandable layout="column" animation>
539+
<Expandable layout="column" animation openDirection="left">
540+
<Expandable.UI style="background: #eceff1; padding: 4px">
541+
More
542+
</Expandable.UI>
538543
<Expandable.Content>
539544
<div className="demo-content">
540545
A paragraph long enough to wrap on several lines at its
541546
final width, revealed progressively without ever changing
542547
shape.
543548
</div>
544549
</Expandable.Content>
545-
<Expandable.UI style="background: #eceff1; padding: 4px">
546-
More
547-
</Expandable.UI>
548550
</Expandable>
549551
</div>
550552
</div>

0 commit comments

Comments
 (0)