@jsenv/navi 0.29.511 → 0.29.513
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 +110 -13
- package/dist/dev/jsenv_navi.js.map +6 -6
- package/dist/jsenv_navi.js +95 -12
- package/dist/jsenv_navi.js.map +6 -6
- package/docs/route_transitions.md +6 -1
- package/package.json +1 -1
package/dist/dev/jsenv_navi.js
CHANGED
|
@@ -38356,6 +38356,10 @@ const releaseTransitionDestination = (owner) => {
|
|
|
38356
38356
|
* inside its rectangle — which is where the hand thinks it pressed. The same
|
|
38357
38357
|
* move route_travel.jsx makes for the box a finger reaches for mid-flight.
|
|
38358
38358
|
*
|
|
38359
|
+
* A `RouteTravel` holds this too. It leaves the bars live, so a control there
|
|
38360
|
+
* gets its click on its own; what this serves is a control in the part of a bar
|
|
38361
|
+
* photographed for the travel (`data-navi-fixed-bar-overhang`, fixed_bar.jsx).
|
|
38362
|
+
*
|
|
38359
38363
|
* ASKED FOR, never derived, and that is the whole safety of it: only the
|
|
38360
38364
|
* application knows the control does not move. One that travels with the pages
|
|
38361
38365
|
* has a rectangle where it WILL be, not where it is seen, and a press handed to
|
|
@@ -38461,7 +38465,7 @@ const warnAboutPressablesThatMove = (areaElement) => {
|
|
|
38461
38465
|
}
|
|
38462
38466
|
warnOnce$1(
|
|
38463
38467
|
"inside-area",
|
|
38464
|
-
`A control asking to stay pressable during a route transition stands inside the pages (the element marked ${AREA_ATTRIBUTE}), and the pages are what moves: its rectangle says where it will BE, not where it is drawn, so a press aimed at what is on screen would be handed to whatever ends up under the finger. Only the furniture around the pages stands still for the length of a movement.`,
|
|
38468
|
+
`A control asking to stay pressable during a route transition stands inside the pages (the element marked ${AREA_ATTRIBUTE}, or the box of a RouteTravel), and the pages are what moves: its rectangle says where it will BE, not where it is drawn, so a press aimed at what is on screen would be handed to whatever ends up under the finger. Only the furniture around the pages stands still for the length of a movement.`,
|
|
38465
38469
|
);
|
|
38466
38470
|
return;
|
|
38467
38471
|
}
|
|
@@ -41731,7 +41735,8 @@ const css$16 = /* css */`.navi_route_travel {
|
|
|
41731
41735
|
* root's name is dropped for that time (`view-transition-name: none`), so what
|
|
41732
41736
|
* stands around the box — a tab row beside it — stays live and answers a press
|
|
41733
41737
|
* mid-travel. The application's own rule for the root applies again the moment
|
|
41734
|
-
* the travel is over.
|
|
41738
|
+
* the travel is over. What stands out of a `FixedBar` is the exception, when it
|
|
41739
|
+
* asks to stay over the pages (see `data-navi-fixed-bar-overhang` there).
|
|
41735
41740
|
*/
|
|
41736
41741
|
const RouteTravel = ({
|
|
41737
41742
|
routes: routesProp,
|
|
@@ -41814,7 +41819,11 @@ const RouteTravel = ({
|
|
|
41814
41819
|
// by CSS until then, so an empty hand here costs nothing: there is
|
|
41815
41820
|
// nothing to stop, only nowhere to put them yet.
|
|
41816
41821
|
animations: null,
|
|
41817
|
-
ended: false
|
|
41822
|
+
ended: false,
|
|
41823
|
+
// The box as it set off, kept rather than read from the ref: the
|
|
41824
|
+
// navigation a travel asks for can take the box down (see the update
|
|
41825
|
+
// callback), and the name it wears is still given back to it.
|
|
41826
|
+
element: elementRef.current
|
|
41818
41827
|
};
|
|
41819
41828
|
travelRef.current = travel;
|
|
41820
41829
|
// A press landing on a playing travel lands on the document root: the box
|
|
@@ -41830,7 +41839,7 @@ const RouteTravel = ({
|
|
|
41830
41839
|
});
|
|
41831
41840
|
// Whether the document's offset is this row's business at all (see
|
|
41832
41841
|
// pagesScrollTheDocument), asked once and before anything is swapped.
|
|
41833
|
-
travel.scrollsDocument = pagesScrollTheDocument(
|
|
41842
|
+
travel.scrollsDocument = pagesScrollTheDocument(travel.element);
|
|
41834
41843
|
if (travel.scrollsDocument) {
|
|
41835
41844
|
// One of the tabs is about to be swapped out from under that scrollport,
|
|
41836
41845
|
// and whatever the browser does with the offset meanwhile — clamping it
|
|
@@ -41847,8 +41856,12 @@ const RouteTravel = ({
|
|
|
41847
41856
|
// at the same moment and for the same reason: whoever names something for
|
|
41848
41857
|
// a movement between two pages decides on it now (see
|
|
41849
41858
|
// transition_destination.js).
|
|
41850
|
-
nameForTravel(
|
|
41859
|
+
nameForTravel(travel.element);
|
|
41851
41860
|
holdTransitionDestination(travel, page.route.buildUrl(page.params));
|
|
41861
|
+
// The bars stay live, except what one of them has photographed on its own
|
|
41862
|
+
// (see fixed_bar.jsx), which is deaf like any picture and may have asked to
|
|
41863
|
+
// keep answering.
|
|
41864
|
+
holdTransitionPress(travel, travel.element);
|
|
41852
41865
|
document.documentElement.setAttribute(TRAVEL_ATTRIBUTE, direction);
|
|
41853
41866
|
document.documentElement.setAttribute(TRAVEL_AXIS_ATTRIBUTE, axis);
|
|
41854
41867
|
if (scrub) {
|
|
@@ -41859,7 +41872,7 @@ const RouteTravel = ({
|
|
|
41859
41872
|
// The box as it stands before anything moves, and the band the furniture
|
|
41860
41873
|
// around it leaves free: rendering is held, so both are still the page
|
|
41861
41874
|
// being left (see transition_window.js).
|
|
41862
|
-
const stateBefore = measureTransitionWindowState(
|
|
41875
|
+
const stateBefore = measureTransitionWindowState(travel.element);
|
|
41863
41876
|
// The hold a navigation already took, if this travel is the answer to one:
|
|
41864
41877
|
// taking another would be taking a hold on a page that is holding still.
|
|
41865
41878
|
const releaseRendering = takeoverRoutingRenderingHold();
|
|
@@ -41897,6 +41910,19 @@ const RouteTravel = ({
|
|
|
41897
41910
|
} = travel.page;
|
|
41898
41911
|
arriveAtScrollPosition(route.buildUrl(params));
|
|
41899
41912
|
}
|
|
41913
|
+
// The box itself may be gone: rendered inside one of the pages of its
|
|
41914
|
+
// row rather than around them, it went down with the page being left,
|
|
41915
|
+
// and there is no box left for the page arriving to be photographed in.
|
|
41916
|
+
// The navigation stands — it is what was asked for — and the movement
|
|
41917
|
+
// is dropped.
|
|
41918
|
+
if (!travel.element.isConnected) {
|
|
41919
|
+
{
|
|
41920
|
+
warnBoxTakenDown(travel.page);
|
|
41921
|
+
}
|
|
41922
|
+
travel.viewTransition.skipTransition();
|
|
41923
|
+
endTravel(travel);
|
|
41924
|
+
return;
|
|
41925
|
+
}
|
|
41900
41926
|
// The page arriving is in the DOM and the transition has not started
|
|
41901
41927
|
// playing: the one moment both boxes can be known. After the scroll,
|
|
41902
41928
|
// which is what the box is measured through: the two states are at the
|
|
@@ -41904,7 +41930,7 @@ const RouteTravel = ({
|
|
|
41904
41930
|
// (see transition_window.js).
|
|
41905
41931
|
// The bars stay live under the pictures for a travel: only the box is
|
|
41906
41932
|
// photographed (see the TRAVEL_ATTRIBUTE css).
|
|
41907
|
-
holdTransitionWindow(travel,
|
|
41933
|
+
holdTransitionWindow(travel, travel.element, stateBefore, {
|
|
41908
41934
|
furnitureLive: true
|
|
41909
41935
|
});
|
|
41910
41936
|
});
|
|
@@ -42251,13 +42277,14 @@ const RouteTravel = ({
|
|
|
42251
42277
|
// Given back, so another box may wear it: kept, two of them on a page
|
|
42252
42278
|
// would both answer to it and the browser refuses the whole transition
|
|
42253
42279
|
// rather than pick.
|
|
42254
|
-
unnameAfterTravel(
|
|
42280
|
+
unnameAfterTravel(travel.element);
|
|
42255
42281
|
document.documentElement.removeAttribute(TRAVEL_ATTRIBUTE);
|
|
42256
42282
|
document.documentElement.removeAttribute(TRAVEL_AXIS_ATTRIBUTE);
|
|
42257
42283
|
document.documentElement.removeAttribute(DRAGGED_ATTRIBUTE);
|
|
42258
42284
|
document.documentElement.removeAttribute(TURNED_ATTRIBUTE);
|
|
42259
42285
|
releaseTransitionWindow(travel);
|
|
42260
42286
|
releaseTransitionDestination(travel);
|
|
42287
|
+
releaseTransitionPress(travel);
|
|
42261
42288
|
}
|
|
42262
42289
|
};
|
|
42263
42290
|
|
|
@@ -42813,6 +42840,17 @@ const currentPageIndex = pages => {
|
|
|
42813
42840
|
// A transition skipped by another one starting is an outcome, not a failure.
|
|
42814
42841
|
const ignoreSkipped = () => {};
|
|
42815
42842
|
|
|
42843
|
+
// Said once, whatever the number of swipes: a box in the wrong place is one
|
|
42844
|
+
// fact about the application, and repeating it every time would bury it.
|
|
42845
|
+
let boxTakenDownWarned = false;
|
|
42846
|
+
const warnBoxTakenDown = page => {
|
|
42847
|
+
if (boxTakenDownWarned) {
|
|
42848
|
+
return;
|
|
42849
|
+
}
|
|
42850
|
+
boxTakenDownWarned = true;
|
|
42851
|
+
console.warn(`[navi] RouteTravel: the page ${page.route.buildUrl(page.params)} is not rendered under this box — the navigation took the box down with the page it was in, so the travel is dropped. The box must outlive every page of its row: around those <Route>s (a layout route), or around one <Route> whose params are the tabs, never inside one of the pages.`);
|
|
42852
|
+
};
|
|
42853
|
+
|
|
42816
42854
|
// The name is lent to the box that is travelling and taken back afterwards.
|
|
42817
42855
|
// There is one transition in a document at a time, so one box wears it at a
|
|
42818
42856
|
// time — and the others, unnamed, are simply not captured: they stay live
|
|
@@ -57973,7 +58011,8 @@ const LinkPseudoElements = ["::-navi-loader", "::-navi-indicator"];
|
|
|
57973
58011
|
* press on it is aimed at what the reader can see. Say it there, and only
|
|
57974
58012
|
* there: a control that TRAVELS with the pages has a rectangle where it will
|
|
57975
58013
|
* be, not where it is seen, and a press handed to it fires something nobody
|
|
57976
|
-
* aimed at.
|
|
58014
|
+
* aimed at. A `RouteTravel` honours it as well, for a control in the part of
|
|
58015
|
+
* a `FixedBar` it photographs (`data-navi-fixed-bar-overhang`).
|
|
57977
58016
|
* @param {boolean} [props.replace] - Go to the destination by TAKING THE PLACE
|
|
57978
58017
|
* of the current history entry instead of stacking onto it: the link stays a
|
|
57979
58018
|
* link (an address, a middle click, the keyboard, `aria-current`), only the
|
|
@@ -60533,6 +60572,7 @@ const css$Y = /* css */`@layer navi {
|
|
|
60533
60572
|
--navi-fixed-bar-border-width: 1px;
|
|
60534
60573
|
--navi-fixed-bar-border-color: var(--navi-separator-color-default);
|
|
60535
60574
|
--navi-fixed-bar-padding: 0px;
|
|
60575
|
+
--navi-fixed-bar-shadow: none;
|
|
60536
60576
|
}
|
|
60537
60577
|
}
|
|
60538
60578
|
|
|
@@ -60597,6 +60637,46 @@ const css$Y = /* css */`@layer navi {
|
|
|
60597
60637
|
var(--navi-fixed-bar-border-color);
|
|
60598
60638
|
}
|
|
60599
60639
|
}
|
|
60640
|
+
|
|
60641
|
+
.navi_fixed_bar_shadow {
|
|
60642
|
+
z-index: -1;
|
|
60643
|
+
border-radius: inherit;
|
|
60644
|
+
box-shadow: var(--navi-fixed-bar-shadow);
|
|
60645
|
+
pointer-events: none;
|
|
60646
|
+
position: absolute;
|
|
60647
|
+
inset: 0;
|
|
60648
|
+
}
|
|
60649
|
+
|
|
60650
|
+
.navi_fixed_bar[data-area="top"] > .navi_fixed_bar_shadow {
|
|
60651
|
+
bottom: calc(-1 * var(--navi-fixed-bar-border-width));
|
|
60652
|
+
clip-path: inset(0 0 -100vh);
|
|
60653
|
+
}
|
|
60654
|
+
|
|
60655
|
+
.navi_fixed_bar[data-area="bottom"] > .navi_fixed_bar_shadow {
|
|
60656
|
+
top: calc(-1 * var(--navi-fixed-bar-border-width));
|
|
60657
|
+
clip-path: inset(-100vh 0 0);
|
|
60658
|
+
}
|
|
60659
|
+
|
|
60660
|
+
.navi_fixed_bar[data-area="left"] > .navi_fixed_bar_shadow {
|
|
60661
|
+
right: calc(-1 * var(--navi-fixed-bar-border-width));
|
|
60662
|
+
clip-path: inset(0 -100vw 0 0);
|
|
60663
|
+
}
|
|
60664
|
+
|
|
60665
|
+
.navi_fixed_bar[data-area="right"] > .navi_fixed_bar_shadow {
|
|
60666
|
+
left: calc(-1 * var(--navi-fixed-bar-border-width));
|
|
60667
|
+
clip-path: inset(0 0 0 -100vw);
|
|
60668
|
+
}
|
|
60669
|
+
|
|
60670
|
+
@supports (view-transition-name: match-element) {
|
|
60671
|
+
:root[data-navi-route-travel] .navi_fixed_bar_shadow, :root[data-navi-route-travel] [data-navi-fixed-bar-overhang] {
|
|
60672
|
+
view-transition-name: match-element;
|
|
60673
|
+
view-transition-class: navi_fixed_bar_over_pages;
|
|
60674
|
+
}
|
|
60675
|
+
}
|
|
60676
|
+
|
|
60677
|
+
:root[data-navi-route-travel-turned]::view-transition-group(.navi_fixed_bar_over_pages) {
|
|
60678
|
+
display: block;
|
|
60679
|
+
}
|
|
60600
60680
|
`;
|
|
60601
60681
|
const FixedBarStyleCSSVars = {
|
|
60602
60682
|
// width/height go through the vars the size calc reads: written as plain
|
|
@@ -60608,7 +60688,8 @@ const FixedBarStyleCSSVars = {
|
|
|
60608
60688
|
padding: "--navi-fixed-bar-padding",
|
|
60609
60689
|
background: "--navi-fixed-bar-background",
|
|
60610
60690
|
borderWidth: "--navi-fixed-bar-border-width",
|
|
60611
|
-
borderColor: "--navi-fixed-bar-border-color"
|
|
60691
|
+
borderColor: "--navi-fixed-bar-border-color",
|
|
60692
|
+
shadow: ["--navi-fixed-bar-shadow", "boxShadow"]
|
|
60612
60693
|
};
|
|
60613
60694
|
|
|
60614
60695
|
/**
|
|
@@ -60622,6 +60703,7 @@ const FixedBarStyleCSSVars = {
|
|
|
60622
60703
|
* border?: boolean,
|
|
60623
60704
|
* borderWidth?: string|number,
|
|
60624
60705
|
* borderColor?: string,
|
|
60706
|
+
* shadow?: string,
|
|
60625
60707
|
* }>}
|
|
60626
60708
|
* @param {"top"|"bottom"|"left"|"right"} [props.area="top"] - Which edge of
|
|
60627
60709
|
* the window it is pinned to. One bar per edge: a second one does not stack
|
|
@@ -60644,6 +60726,18 @@ const FixedBarStyleCSSVars = {
|
|
|
60644
60726
|
* @param {string|number} [props.padding=0] - Along the bar only: left/right on
|
|
60645
60727
|
* a top or bottom bar, top/bottom on a side one. Across it, the size is
|
|
60646
60728
|
* `height`/`width`.
|
|
60729
|
+
* @param {string} [props.shadow] - What the bar casts over the content, in
|
|
60730
|
+
* `box-shadow` syntax, cut at the bar's box on every side but the content's.
|
|
60731
|
+
* Takes no room. Prefer it to a `boxShadow` or a `filter` on the bar: those
|
|
60732
|
+
* are covered by the pages while a `RouteTravel` plays, this one stays over
|
|
60733
|
+
* them.
|
|
60734
|
+
*
|
|
60735
|
+
* A child standing out of the bar's box (a raised button, the notch around it)
|
|
60736
|
+
* wears `data-navi-fixed-bar-overhang`: unmarked, the pages of a `RouteTravel`
|
|
60737
|
+
* cover it wherever they have paint behind it. Marked, it stays over them, and
|
|
60738
|
+
* like anything photographed it is deaf for the length of the travel —
|
|
60739
|
+
* `pressableDuringRouteTransition` on a control inside it keeps that control
|
|
60740
|
+
* answering. The rest of the bar stays live.
|
|
60647
60741
|
*/
|
|
60648
60742
|
const FixedBar = ({
|
|
60649
60743
|
children,
|
|
@@ -60707,12 +60801,14 @@ const FixedBar = ({
|
|
|
60707
60801
|
setFixedBarSpace(area, barElement, null);
|
|
60708
60802
|
};
|
|
60709
60803
|
}, [area, vertical]);
|
|
60710
|
-
return
|
|
60804
|
+
return jsxs(Box, {
|
|
60711
60805
|
baseClassName: "navi_fixed_bar",
|
|
60712
60806
|
"data-area": area,
|
|
60713
60807
|
...props,
|
|
60714
60808
|
styleCSSVars: FixedBarStyleCSSVars,
|
|
60715
|
-
children: children
|
|
60809
|
+
children: [children, jsx("span", {
|
|
60810
|
+
className: "navi_fixed_bar_shadow"
|
|
60811
|
+
})]
|
|
60716
60812
|
});
|
|
60717
60813
|
};
|
|
60718
60814
|
|
|
@@ -63909,7 +64005,8 @@ const COMMAND_DEFAULT_PROPS_FACTORIES = {
|
|
|
63909
64005
|
* button in a bar the two states share, standing exactly where its picture is
|
|
63910
64006
|
* drawn — must still close it. What `<Link pressableDuringRouteTransition>`
|
|
63911
64007
|
* says, for the other half of a toggle. Only for a control that does not
|
|
63912
|
-
* travel with the pages.
|
|
64008
|
+
* travel with the pages. A `RouteTravel` honours it as well, for a control in
|
|
64009
|
+
* the part of a `FixedBar` it photographs (`data-navi-fixed-bar-overhang`).
|
|
63913
64010
|
* @param {Function} [action] What the press runs: a button holds no value, so
|
|
63914
64011
|
* every press is one call. Inside a `<Form>` or a group it carries the value
|
|
63915
64012
|
* around it, merged over the action's bound params — a value that is not an
|