@jsenv/navi 0.29.511 → 0.29.512

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.
@@ -41814,7 +41814,11 @@ const RouteTravel = ({
41814
41814
  // by CSS until then, so an empty hand here costs nothing: there is
41815
41815
  // nothing to stop, only nowhere to put them yet.
41816
41816
  animations: null,
41817
- ended: false
41817
+ ended: false,
41818
+ // The box as it set off, kept rather than read from the ref: the
41819
+ // navigation a travel asks for can take the box down (see the update
41820
+ // callback), and the name it wears is still given back to it.
41821
+ element: elementRef.current
41818
41822
  };
41819
41823
  travelRef.current = travel;
41820
41824
  // A press landing on a playing travel lands on the document root: the box
@@ -41830,7 +41834,7 @@ const RouteTravel = ({
41830
41834
  });
41831
41835
  // Whether the document's offset is this row's business at all (see
41832
41836
  // pagesScrollTheDocument), asked once and before anything is swapped.
41833
- travel.scrollsDocument = pagesScrollTheDocument(elementRef.current);
41837
+ travel.scrollsDocument = pagesScrollTheDocument(travel.element);
41834
41838
  if (travel.scrollsDocument) {
41835
41839
  // One of the tabs is about to be swapped out from under that scrollport,
41836
41840
  // and whatever the browser does with the offset meanwhile — clamping it
@@ -41847,7 +41851,7 @@ const RouteTravel = ({
41847
41851
  // at the same moment and for the same reason: whoever names something for
41848
41852
  // a movement between two pages decides on it now (see
41849
41853
  // transition_destination.js).
41850
- nameForTravel(elementRef.current);
41854
+ nameForTravel(travel.element);
41851
41855
  holdTransitionDestination(travel, page.route.buildUrl(page.params));
41852
41856
  document.documentElement.setAttribute(TRAVEL_ATTRIBUTE, direction);
41853
41857
  document.documentElement.setAttribute(TRAVEL_AXIS_ATTRIBUTE, axis);
@@ -41859,7 +41863,7 @@ const RouteTravel = ({
41859
41863
  // The box as it stands before anything moves, and the band the furniture
41860
41864
  // around it leaves free: rendering is held, so both are still the page
41861
41865
  // being left (see transition_window.js).
41862
- const stateBefore = measureTransitionWindowState(elementRef.current);
41866
+ const stateBefore = measureTransitionWindowState(travel.element);
41863
41867
  // The hold a navigation already took, if this travel is the answer to one:
41864
41868
  // taking another would be taking a hold on a page that is holding still.
41865
41869
  const releaseRendering = takeoverRoutingRenderingHold();
@@ -41897,6 +41901,19 @@ const RouteTravel = ({
41897
41901
  } = travel.page;
41898
41902
  arriveAtScrollPosition(route.buildUrl(params));
41899
41903
  }
41904
+ // The box itself may be gone: rendered inside one of the pages of its
41905
+ // row rather than around them, it went down with the page being left,
41906
+ // and there is no box left for the page arriving to be photographed in.
41907
+ // The navigation stands — it is what was asked for — and the movement
41908
+ // is dropped.
41909
+ if (!travel.element.isConnected) {
41910
+ {
41911
+ warnBoxTakenDown(travel.page);
41912
+ }
41913
+ travel.viewTransition.skipTransition();
41914
+ endTravel(travel);
41915
+ return;
41916
+ }
41900
41917
  // The page arriving is in the DOM and the transition has not started
41901
41918
  // playing: the one moment both boxes can be known. After the scroll,
41902
41919
  // which is what the box is measured through: the two states are at the
@@ -41904,7 +41921,7 @@ const RouteTravel = ({
41904
41921
  // (see transition_window.js).
41905
41922
  // The bars stay live under the pictures for a travel: only the box is
41906
41923
  // photographed (see the TRAVEL_ATTRIBUTE css).
41907
- holdTransitionWindow(travel, elementRef.current, stateBefore, {
41924
+ holdTransitionWindow(travel, travel.element, stateBefore, {
41908
41925
  furnitureLive: true
41909
41926
  });
41910
41927
  });
@@ -42251,7 +42268,7 @@ const RouteTravel = ({
42251
42268
  // Given back, so another box may wear it: kept, two of them on a page
42252
42269
  // would both answer to it and the browser refuses the whole transition
42253
42270
  // rather than pick.
42254
- unnameAfterTravel(elementRef.current);
42271
+ unnameAfterTravel(travel.element);
42255
42272
  document.documentElement.removeAttribute(TRAVEL_ATTRIBUTE);
42256
42273
  document.documentElement.removeAttribute(TRAVEL_AXIS_ATTRIBUTE);
42257
42274
  document.documentElement.removeAttribute(DRAGGED_ATTRIBUTE);
@@ -42813,6 +42830,17 @@ const currentPageIndex = pages => {
42813
42830
  // A transition skipped by another one starting is an outcome, not a failure.
42814
42831
  const ignoreSkipped = () => {};
42815
42832
 
42833
+ // Said once, whatever the number of swipes: a box in the wrong place is one
42834
+ // fact about the application, and repeating it every time would bury it.
42835
+ let boxTakenDownWarned = false;
42836
+ const warnBoxTakenDown = page => {
42837
+ if (boxTakenDownWarned) {
42838
+ return;
42839
+ }
42840
+ boxTakenDownWarned = true;
42841
+ 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.`);
42842
+ };
42843
+
42816
42844
  // The name is lent to the box that is travelling and taken back afterwards.
42817
42845
  // There is one transition in a document at a time, so one box wears it at a
42818
42846
  // time — and the others, unnamed, are simply not captured: they stay live
@@ -60533,6 +60561,7 @@ const css$Y = /* css */`@layer navi {
60533
60561
  --navi-fixed-bar-border-width: 1px;
60534
60562
  --navi-fixed-bar-border-color: var(--navi-separator-color-default);
60535
60563
  --navi-fixed-bar-padding: 0px;
60564
+ --navi-fixed-bar-shadow: none;
60536
60565
  }
60537
60566
  }
60538
60567
 
@@ -60597,6 +60626,45 @@ const css$Y = /* css */`@layer navi {
60597
60626
  var(--navi-fixed-bar-border-color);
60598
60627
  }
60599
60628
  }
60629
+
60630
+ .navi_fixed_bar_shadow {
60631
+ border-radius: inherit;
60632
+ box-shadow: var(--navi-fixed-bar-shadow);
60633
+ pointer-events: none;
60634
+ position: absolute;
60635
+ inset: 0;
60636
+ }
60637
+
60638
+ .navi_fixed_bar[data-area="top"] > .navi_fixed_bar_shadow {
60639
+ bottom: calc(-1 * var(--navi-fixed-bar-border-width));
60640
+ clip-path: inset(0 0 -100vh);
60641
+ }
60642
+
60643
+ .navi_fixed_bar[data-area="bottom"] > .navi_fixed_bar_shadow {
60644
+ top: calc(-1 * var(--navi-fixed-bar-border-width));
60645
+ clip-path: inset(-100vh 0 0);
60646
+ }
60647
+
60648
+ .navi_fixed_bar[data-area="left"] > .navi_fixed_bar_shadow {
60649
+ right: calc(-1 * var(--navi-fixed-bar-border-width));
60650
+ clip-path: inset(0 -100vw 0 0);
60651
+ }
60652
+
60653
+ .navi_fixed_bar[data-area="right"] > .navi_fixed_bar_shadow {
60654
+ left: calc(-1 * var(--navi-fixed-bar-border-width));
60655
+ clip-path: inset(0 0 0 -100vw);
60656
+ }
60657
+
60658
+ @supports (view-transition-name: match-element) {
60659
+ :root[data-navi-route-travel] .navi_fixed_bar_shadow {
60660
+ view-transition-name: match-element;
60661
+ view-transition-class: navi_fixed_bar_shadow;
60662
+ }
60663
+ }
60664
+
60665
+ :root[data-navi-route-travel-turned]::view-transition-group(.navi_fixed_bar_shadow) {
60666
+ display: block;
60667
+ }
60600
60668
  `;
60601
60669
  const FixedBarStyleCSSVars = {
60602
60670
  // width/height go through the vars the size calc reads: written as plain
@@ -60608,7 +60676,8 @@ const FixedBarStyleCSSVars = {
60608
60676
  padding: "--navi-fixed-bar-padding",
60609
60677
  background: "--navi-fixed-bar-background",
60610
60678
  borderWidth: "--navi-fixed-bar-border-width",
60611
- borderColor: "--navi-fixed-bar-border-color"
60679
+ borderColor: "--navi-fixed-bar-border-color",
60680
+ shadow: ["--navi-fixed-bar-shadow", "boxShadow"]
60612
60681
  };
60613
60682
 
60614
60683
  /**
@@ -60622,6 +60691,7 @@ const FixedBarStyleCSSVars = {
60622
60691
  * border?: boolean,
60623
60692
  * borderWidth?: string|number,
60624
60693
  * borderColor?: string,
60694
+ * shadow?: string,
60625
60695
  * }>}
60626
60696
  * @param {"top"|"bottom"|"left"|"right"} [props.area="top"] - Which edge of
60627
60697
  * the window it is pinned to. One bar per edge: a second one does not stack
@@ -60644,6 +60714,11 @@ const FixedBarStyleCSSVars = {
60644
60714
  * @param {string|number} [props.padding=0] - Along the bar only: left/right on
60645
60715
  * a top or bottom bar, top/bottom on a side one. Across it, the size is
60646
60716
  * `height`/`width`.
60717
+ * @param {string} [props.shadow] - What the bar casts over the content, in
60718
+ * `box-shadow` syntax, cut at the bar's box on every side but the content's.
60719
+ * Takes no room. Prefer it to a `boxShadow` or a `filter` on the bar: those
60720
+ * are covered by the pages while a `RouteTravel` plays, this one stays over
60721
+ * them.
60647
60722
  */
60648
60723
  const FixedBar = ({
60649
60724
  children,
@@ -60707,12 +60782,14 @@ const FixedBar = ({
60707
60782
  setFixedBarSpace(area, barElement, null);
60708
60783
  };
60709
60784
  }, [area, vertical]);
60710
- return jsx(Box, {
60785
+ return jsxs(Box, {
60711
60786
  baseClassName: "navi_fixed_bar",
60712
60787
  "data-area": area,
60713
60788
  ...props,
60714
60789
  styleCSSVars: FixedBarStyleCSSVars,
60715
- children: children
60790
+ children: [children, jsx("span", {
60791
+ className: "navi_fixed_bar_shadow"
60792
+ })]
60716
60793
  });
60717
60794
  };
60718
60795