@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
package/dist/jsenv_navi.js
CHANGED
|
@@ -24730,6 +24730,10 @@ const DROP_CONTAINER_ATTRIBUTE = "data-drop-container";
|
|
|
24730
24730
|
// every outcome — a list runs one way, and something being put somewhere goes
|
|
24731
24731
|
// wherever it is put.
|
|
24732
24732
|
const AXIS_ATTRIBUTE = "data-drag-axis";
|
|
24733
|
+
// Which of those axes a press takes it by, when not all of them: a card pulled
|
|
24734
|
+
// up out of a strip that scrolls sideways, then carried both ways. Said nothing,
|
|
24735
|
+
// it is every axis the drag walks.
|
|
24736
|
+
const INTENT_AXIS_ATTRIBUTE = "data-drag-intent-axis";
|
|
24733
24737
|
// How the items of a reordered list are laid out: "column", "row", or "wrap" for
|
|
24734
24738
|
// side by side over several lines. Said nothing, it is read from where the
|
|
24735
24739
|
// items stand.
|
|
@@ -24825,6 +24829,10 @@ defineInteractionDetector({
|
|
|
24825
24829
|
? "xy"
|
|
24826
24830
|
: "y"
|
|
24827
24831
|
: "xy");
|
|
24832
|
+
const intentAxis =
|
|
24833
|
+
element
|
|
24834
|
+
.closest(`[${INTENT_AXIS_ATTRIBUTE}]`)
|
|
24835
|
+
?.getAttribute(INTENT_AXIS_ATTRIBUTE) || axes;
|
|
24828
24836
|
// Where the places are, read at setup for the same reason as the axes: they
|
|
24829
24837
|
// are what the gesture is about, and it is what holds the two sides of it
|
|
24830
24838
|
// that says them.
|
|
@@ -24838,11 +24846,13 @@ defineInteractionDetector({
|
|
|
24838
24846
|
if (canReorder) {
|
|
24839
24847
|
element.setAttribute(REORDERABLE_ATTRIBUTE, "");
|
|
24840
24848
|
}
|
|
24841
|
-
// What @jsenv/dom puts on a drag source: the axes
|
|
24842
|
-
// whoever else answers this press (a sheet pushed
|
|
24843
|
-
//
|
|
24844
|
-
//
|
|
24845
|
-
|
|
24849
|
+
// What @jsenv/dom puts on a drag source: the axes a press takes it by,
|
|
24850
|
+
// written in the DOM for whoever else answers this press (a sheet pushed
|
|
24851
|
+
// down to close it, a row of slides, a finger given back to the scroll), no
|
|
24852
|
+
// iOS callout, the touch left to the scroll until the press becomes a grab,
|
|
24853
|
+
// and the listener that lets the grab take it back. Once taken, the copy
|
|
24854
|
+
// walks `axes`.
|
|
24855
|
+
const unmarkDragSource = markDragSource(element, intentAxis);
|
|
24846
24856
|
|
|
24847
24857
|
// What a release can mean, which is not all of what was declared: "grab",
|
|
24848
24858
|
// "release" and "refuse" are moments, not outcomes, and "moving" is the carry
|
|
@@ -36853,6 +36863,14 @@ const collectBranches = (children, path = "") => {
|
|
|
36853
36863
|
const paramsMatching = routeParams ? route.matchesParams(routeParams) : true;
|
|
36854
36864
|
if (!matchingBranch && matching && paramsMatching) {
|
|
36855
36865
|
matchingBranch = branch;
|
|
36866
|
+
if (!routeParams) {
|
|
36867
|
+
// The params are part of the page this branch shows: /games/a and
|
|
36868
|
+
// /games/b are two pages on one branch, and the container renders
|
|
36869
|
+
// between them so the second is announced like any other (see
|
|
36870
|
+
// publishRouteRender) — a movement between the two waits on it.
|
|
36871
|
+
// eslint-disable-next-line no-unused-expressions
|
|
36872
|
+
route.paramsSignal.value;
|
|
36873
|
+
}
|
|
36856
36874
|
}
|
|
36857
36875
|
}
|
|
36858
36876
|
};
|
|
@@ -36917,6 +36935,59 @@ const RouteUI = ({
|
|
|
36917
36935
|
return element;
|
|
36918
36936
|
};
|
|
36919
36937
|
|
|
36938
|
+
/*
|
|
36939
|
+
* What ONE navigation asks of a route transition, worn by the element being
|
|
36940
|
+
* pressed: `<Link routeTransition>`, `<Button routeTransition>`, or the
|
|
36941
|
+
* attribute by hand on any anchor. A type travels as its name — all most
|
|
36942
|
+
* presses have to say — and anything more (a way round, a pace) as the same
|
|
36943
|
+
* object navTo() takes, written as JSON.
|
|
36944
|
+
*
|
|
36945
|
+
* Apart from route_transition.jsx, which plays the request: the press handlers
|
|
36946
|
+
* and the --navi-nav-to command read it too, and importing the transition
|
|
36947
|
+
* machinery there would pull it into an application that defines no
|
|
36948
|
+
* transition.
|
|
36949
|
+
*/
|
|
36950
|
+
|
|
36951
|
+
const ROUTE_TRANSITION_REQUEST_ATTRIBUTE = "data-navi-route-transition-request";
|
|
36952
|
+
|
|
36953
|
+
// The attributes to spread on the element. Nothing when nothing is asked, so
|
|
36954
|
+
// that the attribute written by hand on the same element is left standing.
|
|
36955
|
+
const writeRouteTransitionRequest = (routeTransition) => {
|
|
36956
|
+
if (routeTransition === undefined || routeTransition === null) {
|
|
36957
|
+
return null;
|
|
36958
|
+
}
|
|
36959
|
+
return {
|
|
36960
|
+
[ROUTE_TRANSITION_REQUEST_ATTRIBUTE]:
|
|
36961
|
+
typeof routeTransition === "string"
|
|
36962
|
+
? routeTransition
|
|
36963
|
+
: JSON.stringify(routeTransition),
|
|
36964
|
+
};
|
|
36965
|
+
};
|
|
36966
|
+
|
|
36967
|
+
// The request as navTo() takes it — a type name or the object — and undefined
|
|
36968
|
+
// when the element asks nothing.
|
|
36969
|
+
const readRouteTransitionRequest = (element) => {
|
|
36970
|
+
const asked = element.getAttribute(ROUTE_TRANSITION_REQUEST_ATTRIBUTE);
|
|
36971
|
+
if (asked === null) {
|
|
36972
|
+
return undefined;
|
|
36973
|
+
}
|
|
36974
|
+
const value = asked.trim();
|
|
36975
|
+
if (value === "") {
|
|
36976
|
+
return undefined;
|
|
36977
|
+
}
|
|
36978
|
+
if (value[0] !== "{") {
|
|
36979
|
+
return value;
|
|
36980
|
+
}
|
|
36981
|
+
try {
|
|
36982
|
+
return JSON.parse(value);
|
|
36983
|
+
} catch {
|
|
36984
|
+
console.warn(
|
|
36985
|
+
`${ROUTE_TRANSITION_REQUEST_ATTRIBUTE} is neither a type name nor JSON: ${value}`,
|
|
36986
|
+
);
|
|
36987
|
+
return undefined;
|
|
36988
|
+
}
|
|
36989
|
+
};
|
|
36990
|
+
|
|
36920
36991
|
/**
|
|
36921
36992
|
* Where a route movement is heading, said before its first picture is taken.
|
|
36922
36993
|
*
|
|
@@ -38328,10 +38399,6 @@ const TRANSITION_COVERED_ATTRIBUTE = "data-navi-route-transition-covered";
|
|
|
38328
38399
|
// right for a page that IS the whole viewport.
|
|
38329
38400
|
const TRANSITION_AREA_ATTRIBUTE = "data-navi-route-transition-area";
|
|
38330
38401
|
const TRANSITION_TARGET_ATTRIBUTE = "data-navi-route-transition-target";
|
|
38331
|
-
// What ONE navigation asks for, over whatever the relations say: worn by the
|
|
38332
|
-
// link being pressed (see <Link routeTransition>), or handed to navTo(). It answers
|
|
38333
|
-
// for that navigation and for no other — the next one is back to the relations.
|
|
38334
|
-
const TRANSITION_REQUEST_ATTRIBUTE = "data-navi-route-transition-request";
|
|
38335
38402
|
// What a history entry remembers of the crossing that created it, in the
|
|
38336
38403
|
// entry's own state: `{ from, type, direction, duration }` (see recordCrossing).
|
|
38337
38404
|
const CROSSING_STATE_KEY = "jsenv_route_transition";
|
|
@@ -38872,13 +38939,32 @@ const defineRouteTransition = (from, to, transition) => {
|
|
|
38872
38939
|
* "before" the other — so give it a movement that does not need one:
|
|
38873
38940
|
* `"cross-fade"`, or a custom type whose CSS is keyed on the type alone.
|
|
38874
38941
|
*
|
|
38875
|
-
*
|
|
38876
|
-
*
|
|
38877
|
-
*
|
|
38942
|
+
* Unless the history says it: `{ type: "slide-x", direction: "history" }` is
|
|
38943
|
+
* the grammar of a navigation stack, where every link goes one level deeper
|
|
38944
|
+
* and every back one level up. A push plays forward, a traversal retraces its
|
|
38945
|
+
* crossing or, with none remembered, plays back when it lands lower in the
|
|
38946
|
+
* history and forward when it lands higher, and a replace — the same level —
|
|
38947
|
+
* plays nothing. It plays only when the page changes: a push that opens a
|
|
38948
|
+
* layer over the page keeps the page. The relations written still answer
|
|
38949
|
+
* first, and a page written from anywhere then answers for its way out only
|
|
38950
|
+
* on a back — a link out of it is a push like any other (see findRelation).
|
|
38951
|
+
*
|
|
38952
|
+
* @param {string|{type?: string, duration?: number|string, direction?: "history"}} transition -
|
|
38953
|
+
* same forms as defineRouteTransition's. `"none"` (or removing the default)
|
|
38954
|
+
* puts the silence back.
|
|
38878
38955
|
* @returns {() => void} remove this default.
|
|
38879
38956
|
*/
|
|
38880
38957
|
const defineRouteDefaultTransition = transition => {
|
|
38881
|
-
const
|
|
38958
|
+
const {
|
|
38959
|
+
direction
|
|
38960
|
+
} = typeof transition === "object" && transition !== null ? transition : {};
|
|
38961
|
+
if (direction !== undefined && direction !== "history") {
|
|
38962
|
+
throw new TypeError(`defineRouteDefaultTransition takes direction: "history" or no direction, not ${JSON.stringify(direction)}: a default is about pages no relation orders, and "history" is the one thing that orders them — the depth of the entries the navigation goes between.`);
|
|
38963
|
+
}
|
|
38964
|
+
const value = {
|
|
38965
|
+
...normalizeTransition(transition),
|
|
38966
|
+
readsHistory: direction === "history"
|
|
38967
|
+
};
|
|
38882
38968
|
defaultTransition = value;
|
|
38883
38969
|
installRouteTransitionCss();
|
|
38884
38970
|
return () => {
|
|
@@ -38931,29 +39017,8 @@ const readNavigationRequest = ({
|
|
|
38931
39017
|
return normalizeRequest(routeTransition);
|
|
38932
39018
|
}
|
|
38933
39019
|
if (element && element.getAttribute) {
|
|
38934
|
-
const asked = element
|
|
38935
|
-
|
|
38936
|
-
return null;
|
|
38937
|
-
}
|
|
38938
|
-
const value = asked.trim();
|
|
38939
|
-
if (value === "") {
|
|
38940
|
-
return null;
|
|
38941
|
-
}
|
|
38942
|
-
// A type is a name, and a name is all most links have to say. Anything
|
|
38943
|
-
// more — a way round, a pace — is the same object the API takes
|
|
38944
|
-
// everywhere else, written as JSON so that it travels on an attribute
|
|
38945
|
-
// (and so that a plain <a> can say it too).
|
|
38946
|
-
if (value[0] === "{") {
|
|
38947
|
-
let parsed;
|
|
38948
|
-
try {
|
|
38949
|
-
parsed = JSON.parse(value);
|
|
38950
|
-
} catch {
|
|
38951
|
-
console.warn(`${TRANSITION_REQUEST_ATTRIBUTE} is neither a type name nor JSON: ${value}`);
|
|
38952
|
-
return null;
|
|
38953
|
-
}
|
|
38954
|
-
return normalizeRequest(parsed);
|
|
38955
|
-
}
|
|
38956
|
-
return normalizeRequest(value);
|
|
39020
|
+
const asked = readRouteTransitionRequest(element);
|
|
39021
|
+
return asked === undefined ? null : normalizeRequest(asked);
|
|
38957
39022
|
}
|
|
38958
39023
|
return null;
|
|
38959
39024
|
};
|
|
@@ -39039,6 +39104,31 @@ const crossingRecordedOn = state => {
|
|
|
39039
39104
|
}
|
|
39040
39105
|
return crossing;
|
|
39041
39106
|
};
|
|
39107
|
+
|
|
39108
|
+
/**
|
|
39109
|
+
* Which way the history says a navigation goes, for a default that reads it
|
|
39110
|
+
* (see defineRouteDefaultTransition): a push is one level deeper, a traversal
|
|
39111
|
+
* goes where the depth of the entry it lands on puts it — back when that is
|
|
39112
|
+
* not known, as in readTraversalReplay —, and anything else (a replace) stays
|
|
39113
|
+
* on its level: null.
|
|
39114
|
+
*/
|
|
39115
|
+
const readHistoryDirection = (navigationType, {
|
|
39116
|
+
state,
|
|
39117
|
+
fromState
|
|
39118
|
+
}) => {
|
|
39119
|
+
if (navigationType === "push") {
|
|
39120
|
+
return "forward";
|
|
39121
|
+
}
|
|
39122
|
+
if (navigationType !== "traverse") {
|
|
39123
|
+
return null;
|
|
39124
|
+
}
|
|
39125
|
+
const depthIn = navDepthOf(state);
|
|
39126
|
+
const depthOut = navDepthOf(fromState);
|
|
39127
|
+
if (depthIn !== undefined && depthOut !== undefined && depthIn > depthOut) {
|
|
39128
|
+
return "forward";
|
|
39129
|
+
}
|
|
39130
|
+
return "back";
|
|
39131
|
+
};
|
|
39042
39132
|
const navDepthOf = state => {
|
|
39043
39133
|
if (state && typeof state[NAV_DEPTH_STATE_KEY] === "number") {
|
|
39044
39134
|
return state[NAV_DEPTH_STATE_KEY];
|
|
@@ -39222,6 +39312,10 @@ let navigationAnimated = false;
|
|
|
39222
39312
|
// "push", "replace", "traverse", … — a push is the one navigation that creates
|
|
39223
39313
|
// the entry a crossing is recorded on.
|
|
39224
39314
|
let navigationType = null;
|
|
39315
|
+
// Which way the history says this navigation goes — "forward", "back", or null
|
|
39316
|
+
// for a replace — when the default reads it (see readHistoryDirection), and
|
|
39317
|
+
// undefined when nothing does.
|
|
39318
|
+
let navigationHistoryDirection;
|
|
39225
39319
|
// What was decided for the navigation now landing — a movement, or "none" —
|
|
39226
39320
|
// which is what its entry remembers (see recordCrossing). Null while nothing
|
|
39227
39321
|
// has been decided, and for a navigation nothing was said about.
|
|
@@ -39239,14 +39333,19 @@ observeBeforeRouting(details => {
|
|
|
39239
39333
|
navigationType = details.navigationType;
|
|
39240
39334
|
navigationUrl = details.url;
|
|
39241
39335
|
navigationFromUrl = documentUrlSignal.peek();
|
|
39242
|
-
// A traversal has no element and no call to ask anything: what it asks is
|
|
39243
|
-
// the crossing it retraces — reversed for a back, as it was for a forward.
|
|
39244
39336
|
// Read before the document state moves, so the state peeked is the entry
|
|
39245
39337
|
// being left.
|
|
39338
|
+
const fromState = documentStateSignal.peek();
|
|
39339
|
+
// A traversal has no element and no call to ask anything: what it asks is
|
|
39340
|
+
// the crossing it retraces — reversed for a back, as it was for a forward.
|
|
39246
39341
|
navigationRequest = navigationType === "traverse" ? readTraversalReplay(details, {
|
|
39247
39342
|
fromUrl: navigationFromUrl,
|
|
39248
|
-
fromState
|
|
39343
|
+
fromState
|
|
39249
39344
|
}) : readNavigationRequest(details);
|
|
39345
|
+
navigationHistoryDirection = defaultTransition && defaultTransition.readsHistory ? readHistoryDirection(navigationType, {
|
|
39346
|
+
state: details.state,
|
|
39347
|
+
fromState
|
|
39348
|
+
}) : undefined;
|
|
39250
39349
|
if (relations.length === 0 && !defaultTransition && !navigationRequest) {
|
|
39251
39350
|
return;
|
|
39252
39351
|
}
|
|
@@ -39264,17 +39363,24 @@ observeAfterRouting(() => {
|
|
|
39264
39363
|
const url = navigationUrl;
|
|
39265
39364
|
const fromUrl = navigationFromUrl;
|
|
39266
39365
|
const type = navigationType;
|
|
39366
|
+
const historyDirection = navigationHistoryDirection;
|
|
39267
39367
|
// Read here and dropped here: a request answers for the navigation it was
|
|
39268
39368
|
// made on, and the next one is back to the relations.
|
|
39269
39369
|
navigationRequest = null;
|
|
39270
39370
|
navigationUrl = null;
|
|
39271
39371
|
navigationFromUrl = null;
|
|
39272
39372
|
navigationType = null;
|
|
39273
|
-
|
|
39373
|
+
navigationHistoryDirection = undefined;
|
|
39374
|
+
// A default reading the history plays between two pages a level apart: not
|
|
39375
|
+
// on a replace, and not on a navigation that keeps the page — a push
|
|
39376
|
+
// opening a layer over it moves the layer, not the page (see
|
|
39377
|
+
// page_change.js).
|
|
39378
|
+
const base = defaultTransition && (!defaultTransition.readsHistory || historyDirection !== null && isRenderingPageChange()) ? defaultTransition : null;
|
|
39379
|
+
if (!navigationAnimated && (request || base)) {
|
|
39274
39380
|
const {
|
|
39275
39381
|
type,
|
|
39276
39382
|
duration
|
|
39277
|
-
} = resolveTransition(request,
|
|
39383
|
+
} = resolveTransition(request, base);
|
|
39278
39384
|
if (type === "none") {
|
|
39279
39385
|
navigationDecision = {
|
|
39280
39386
|
type: "none"
|
|
@@ -39287,11 +39393,12 @@ observeAfterRouting(() => {
|
|
|
39287
39393
|
// A default has no direction: nothing says which of two arbitrary
|
|
39288
39394
|
// pages is before the other, and the attribute is then worn empty —
|
|
39289
39395
|
// present for whoever keys on "one of ours is playing", silent on the
|
|
39290
|
-
// way. A request is the other case: a
|
|
39291
|
-
// press that names the movement means
|
|
39292
|
-
// otherwise — and a movement of navi's is
|
|
39293
|
-
// so left empty it would play nothing at
|
|
39294
|
-
|
|
39396
|
+
// way — unless it reads the history. A request is the other case: a
|
|
39397
|
+
// navigation IS a way round, so a press that names the movement means
|
|
39398
|
+
// forward unless it says otherwise — and a movement of navi's is
|
|
39399
|
+
// written on the direction, so left empty it would play nothing at
|
|
39400
|
+
// all.
|
|
39401
|
+
direction: request && request.direction !== undefined ? request.direction : request && request.typeSaid ? "forward" : base && base.readsHistory ? historyDirection : "",
|
|
39295
39402
|
type,
|
|
39296
39403
|
duration
|
|
39297
39404
|
});
|
|
@@ -39407,6 +39514,12 @@ const findRelation = (fromPage, toPage) => {
|
|
|
39407
39514
|
};
|
|
39408
39515
|
}
|
|
39409
39516
|
}
|
|
39517
|
+
// Leaving such a page plays back because leaving it is assumed to be
|
|
39518
|
+
// closing it. With the default reading the history, that is known instead:
|
|
39519
|
+
// a link out of it is a push, one level deeper, and the default answers.
|
|
39520
|
+
if (navigationHistoryDirection !== undefined && navigationHistoryDirection !== "back") {
|
|
39521
|
+
return null;
|
|
39522
|
+
}
|
|
39410
39523
|
for (const relation of relations) {
|
|
39411
39524
|
if (relation.from) {
|
|
39412
39525
|
continue;
|
|
@@ -40320,7 +40433,11 @@ const RouteTravel = ({
|
|
|
40320
40433
|
// a travel is between two of them, and by the time anything renders the first
|
|
40321
40434
|
// one is already gone. Written after each render (below), so a subscriber
|
|
40322
40435
|
// reading it — they all run before Preact flushes — reads the one being left.
|
|
40323
|
-
|
|
40436
|
+
// The page and not its place in the row: a row given again around the page
|
|
40437
|
+
// on screen (a window over a list, read anew around it) puts that page at
|
|
40438
|
+
// another index without anything having moved.
|
|
40439
|
+
const currentPage = currentIndex === -1 ? null : pages[currentIndex];
|
|
40440
|
+
const currentPageRef = useRef(currentPage);
|
|
40324
40441
|
|
|
40325
40442
|
// Where a page is asked for, whoever asks: a page is a route AND the params
|
|
40326
40443
|
// that say which of its tabs, and a caller told only the route would send the
|
|
@@ -40516,11 +40633,13 @@ const RouteTravel = ({
|
|
|
40516
40633
|
if (index === -1) {
|
|
40517
40634
|
return;
|
|
40518
40635
|
}
|
|
40519
|
-
|
|
40520
|
-
|
|
40521
|
-
//
|
|
40522
|
-
//
|
|
40523
|
-
|
|
40636
|
+
const page = pages[index];
|
|
40637
|
+
if (samePage(page, currentPageRef.current)) {
|
|
40638
|
+
// Where the row already was — the first reading of all, a row given
|
|
40639
|
+
// again around the page on screen, and any move this box has already
|
|
40640
|
+
// taken note of (a render writes it too). What it was still waiting
|
|
40641
|
+
// for is here nonetheless, so the wait is called off.
|
|
40642
|
+
if (samePage(pageAskedForRef.current, page)) {
|
|
40524
40643
|
pageAskedForRef.current = null;
|
|
40525
40644
|
}
|
|
40526
40645
|
return;
|
|
@@ -40529,13 +40648,12 @@ const RouteTravel = ({
|
|
|
40529
40648
|
// between two of them is a page change the path does not show (see
|
|
40530
40649
|
// page_change.js).
|
|
40531
40650
|
notePageChange();
|
|
40532
|
-
const page = pages[index];
|
|
40533
40651
|
// A page this box asked for itself — a travel's own navigation, or one
|
|
40534
40652
|
// it had given up waiting on: what arrives here is the answer to a
|
|
40535
40653
|
// question already answered, not somebody going somewhere.
|
|
40536
40654
|
if (samePage(pageAskedForRef.current, page)) {
|
|
40537
40655
|
pageAskedForRef.current = null;
|
|
40538
|
-
|
|
40656
|
+
currentPageRef.current = page;
|
|
40539
40657
|
return;
|
|
40540
40658
|
}
|
|
40541
40659
|
// Somewhere else arrived first: whatever this box was still waiting for
|
|
@@ -40547,15 +40665,15 @@ const RouteTravel = ({
|
|
|
40547
40665
|
// flight is the answer, aimed somewhere else. Starting a second one on
|
|
40548
40666
|
// top would leave this one's pictures to be dropped mid-slide.
|
|
40549
40667
|
if (travelRef.current) {
|
|
40550
|
-
|
|
40668
|
+
currentPageRef.current = page;
|
|
40551
40669
|
retargetTravel(travelRef.current, page);
|
|
40552
40670
|
return;
|
|
40553
40671
|
}
|
|
40554
|
-
const fromIndex =
|
|
40555
|
-
|
|
40556
|
-
if (fromIndex === -1
|
|
40557
|
-
// Arriving from outside this row
|
|
40558
|
-
//
|
|
40672
|
+
const fromIndex = pageIndexOf(pages, currentPageRef.current);
|
|
40673
|
+
currentPageRef.current = page;
|
|
40674
|
+
if (fromIndex === -1) {
|
|
40675
|
+
// Arriving from outside this row: there is no pair of pages to show,
|
|
40676
|
+
// so there is nothing to travel between.
|
|
40559
40677
|
return;
|
|
40560
40678
|
}
|
|
40561
40679
|
beginTravel({
|
|
@@ -40590,8 +40708,8 @@ const RouteTravel = ({
|
|
|
40590
40708
|
// What the next announcement will compare itself against: written after the
|
|
40591
40709
|
// render that shows it, so it is always the page one is looking at.
|
|
40592
40710
|
useLayoutEffect(() => {
|
|
40593
|
-
|
|
40594
|
-
}, [
|
|
40711
|
+
currentPageRef.current = currentPage;
|
|
40712
|
+
}, [currentPage]);
|
|
40595
40713
|
|
|
40596
40714
|
// Let go of far enough: the movement carries on from under the finger, at its
|
|
40597
40715
|
// own pace, to the end.
|
|
@@ -43553,13 +43671,15 @@ const navToCommand = (source, event, { argument }) => {
|
|
|
43553
43671
|
return {
|
|
43554
43672
|
target,
|
|
43555
43673
|
// Which way there is worn by the source, as a link wears it (see
|
|
43556
|
-
// link_replace.js, link_return.js, link_open.js
|
|
43674
|
+
// link_replace.js, link_return.js, link_open.js,
|
|
43675
|
+
// route_transition_request.js):
|
|
43557
43676
|
// `<Button command="--navi-nav-to:/done" replace>`.
|
|
43558
43677
|
implementation: () =>
|
|
43559
43678
|
navTo(argument, {
|
|
43560
43679
|
replace: linkAsksForReplace(source),
|
|
43561
43680
|
asReturn: linkAsksForReturn(source),
|
|
43562
43681
|
open: linkAsksToOpen(source),
|
|
43682
|
+
routeTransition: readRouteTransitionRequest(source),
|
|
43563
43683
|
}),
|
|
43564
43684
|
};
|
|
43565
43685
|
};
|
|
@@ -56456,10 +56576,8 @@ const LinkPlain = props => {
|
|
|
56456
56576
|
|
|
56457
56577
|
// What this link asks of a route transition, worn as an attribute so that
|
|
56458
56578
|
// the navigation reads it off the element being pressed (see
|
|
56459
|
-
//
|
|
56460
|
-
|
|
56461
|
-
// writes it by hand.
|
|
56462
|
-
const routeTransitionRequest = routeTransition === undefined || routeTransition === null ? undefined : typeof routeTransition === "string" ? routeTransition : JSON.stringify(routeTransition);
|
|
56579
|
+
// route_transition_request.js, which owns the name and does the reading).
|
|
56580
|
+
const routeTransitionRequest = writeRouteTransitionRequest(routeTransition);
|
|
56463
56581
|
|
|
56464
56582
|
// Which way this link goes to the place it aims at, worn as an attribute so
|
|
56465
56583
|
// that whoever answers the press reads it off the anchor (see
|
|
@@ -56550,7 +56668,7 @@ const LinkPlain = props => {
|
|
|
56550
56668
|
open: undefined,
|
|
56551
56669
|
document: undefined,
|
|
56552
56670
|
prefetch: undefined,
|
|
56553
|
-
|
|
56671
|
+
...routeTransitionRequest,
|
|
56554
56672
|
...(pressableDuringRouteTransition ? {
|
|
56555
56673
|
[PRESSABLE_ATTRIBUTE]: ""
|
|
56556
56674
|
} : null),
|
|
@@ -61260,6 +61378,7 @@ const ButtonUI = props => {
|
|
|
61260
61378
|
asReturn,
|
|
61261
61379
|
open,
|
|
61262
61380
|
document: isDocument,
|
|
61381
|
+
routeTransition,
|
|
61263
61382
|
pressableDuringRouteTransition,
|
|
61264
61383
|
prefetch = true,
|
|
61265
61384
|
// visual
|
|
@@ -61317,6 +61436,11 @@ const ButtonUI = props => {
|
|
|
61317
61436
|
[LINK_DOCUMENT_ATTRIBUTE]: ""
|
|
61318
61437
|
} : null;
|
|
61319
61438
|
|
|
61439
|
+
// What this press asks of a route transition (see
|
|
61440
|
+
// route_transition_request.js): read off the anchor by the navigation, off
|
|
61441
|
+
// the source by --navi-nav-to.
|
|
61442
|
+
const routeTransitionRequest = writeRouteTransitionRequest(routeTransition);
|
|
61443
|
+
|
|
61320
61444
|
// Worn as an attribute too, and read at the document by whoever catches the
|
|
61321
61445
|
// press a movement would have swallowed (see transition_press.js).
|
|
61322
61446
|
const pressableRequest = pressableDuringRouteTransition ? {
|
|
@@ -61373,6 +61497,8 @@ const ButtonUI = props => {
|
|
|
61373
61497
|
...openRequest,
|
|
61374
61498
|
document: undefined,
|
|
61375
61499
|
...documentRequest,
|
|
61500
|
+
routeTransition: undefined,
|
|
61501
|
+
...routeTransitionRequest,
|
|
61376
61502
|
pressableDuringRouteTransition: undefined,
|
|
61377
61503
|
...pressableRequest,
|
|
61378
61504
|
prefetch: undefined
|
|
@@ -62029,6 +62155,7 @@ const COMMAND_DEFAULT_PROPS_FACTORIES = {
|
|
|
62029
62155
|
* replace?: boolean,
|
|
62030
62156
|
* asReturn?: boolean,
|
|
62031
62157
|
* open?: string | { id: string, type?: "push" | "replace" },
|
|
62158
|
+
* routeTransition?: string | { type?: string, duration?: number | string, direction?: "forward" | "back" },
|
|
62032
62159
|
* document?: boolean,
|
|
62033
62160
|
* actionStandalone?: boolean,
|
|
62034
62161
|
* actionAbortable?: boolean,
|
|
@@ -62077,6 +62204,11 @@ const COMMAND_DEFAULT_PROPS_FACTORIES = {
|
|
|
62077
62204
|
* @param {string|{id: string, type?: "push"|"replace"}} [open] Lands with one
|
|
62078
62205
|
* of the destination's popups open, named the way its `navState` names it:
|
|
62079
62206
|
* what `<Link open>` says, for a press drawn as a button.
|
|
62207
|
+
* @param {string|{type?: string, duration?: number|string, direction?: "forward"|"back"}} [routeTransition]
|
|
62208
|
+
* What the press asks of a route transition, for that one navigation — a
|
|
62209
|
+
* type name, or an object to also say the pace or which way it plays, over
|
|
62210
|
+
* what the pair's relation says: what `<Link routeTransition>` says, read
|
|
62211
|
+
* off an `href`, a `route` or a `--navi-nav-to` command.
|
|
62080
62212
|
* @param {boolean} [document] The `href` is ANOTHER DOCUMENT of this origin —
|
|
62081
62213
|
* an admin panel, a status page, anything built as its own entry point — so
|
|
62082
62214
|
* the press is left to the browser and loads that page, instead of being
|