@jsenv/navi 0.29.338 → 0.29.340

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.
@@ -58739,7 +58739,7 @@ const clipOf = (side, distance) => {
58739
58739
  * the root's picture (see the CSS in dialog.jsx). The fixed bars are part of
58740
58740
  * that picture, under the wall like the rest of the page. The popup is placed
58741
58741
  * between the bars, and its picture keeps to the room between them on the
58742
- * way as well: the moving box is clipped to that room (clipToRoomBetweenBars),
58742
+ * way as well: the moving box is clipped to that room (animateMovingBox),
58743
58743
  * so a card half under the bottom bar leaves from under it and comes back
58744
58744
  * under it.
58745
58745
  */
@@ -58777,22 +58777,29 @@ const DURATION_PROPERTY = "--navi-popup-lift-duration";
58777
58777
  // The fixed bars (fixed_bar.jsx): the popup is placed in the room between
58778
58778
  // them, and the moving picture is clipped to that room on the way.
58779
58779
  const FIXED_BAR_SELECTOR = ".navi_fixed_bar";
58780
- // The corners and the paint of the lifted node, published the same way. The
58781
- // pictures are clipped to the moving box (dialog.jsx), and a card with rounded
58782
- // corners must not travel with square ones; the box wears the card's own
58783
- // background, so where it has grown past the picture it carries it is the card
58784
- // that has grown, not a picture fading into a bigger one. Read off the lifted
58785
- // node rather than the anchor: the anchor is often a bare trigger around the
58786
- // card, painting nothing of its own, while the lifted node IS the card.
58787
- const BORDER_RADIUS_PROPERTY = "--navi-popup-lift-border-radius";
58780
+ // The paint of the lifted node, published the same way: the box wears the
58781
+ // card's own background, so where it has grown past the picture it carries it
58782
+ // is the card that has grown, not a picture fading into a bigger one. Read off
58783
+ // the lifted node rather than the anchor: the anchor is often a bare trigger
58784
+ // around the card, painting nothing of its own, while the lifted node IS the
58785
+ // card and a card does not change colour on the way.
58788
58786
  const BACKGROUND_COLOR_PROPERTY = "--navi-popup-lift-background-color";
58789
58787
  const BACKGROUND_IMAGE_PROPERTY = "--navi-popup-lift-background-image";
58788
+ // The corners of the box the movement starts from, published the same way —
58789
+ // and, unlike the paint, not kept for the length of the movement: a corner is
58790
+ // written per box, on purpose, the same card at two sizes not wanting the same
58791
+ // round (a 6px corner stops showing on a big card). The moving box leaves with
58792
+ // the corners of the box it leaves and arrives with those of the box it
58793
+ // arrives on, the two authored values interpolated on the group's own clock
58794
+ // (see animateMovingBox).
58795
+ const BORDER_RADIUS_PROPERTY = "--navi-popup-lift-border-radius";
58790
58796
 
58791
58797
  let releaseLiftInProgress = null;
58792
- // The clip of the movement in progress (clipToRoomBetweenBars): cancelled
58793
- // with the movement, so a finished one cannot go on applying its last inset
58794
- // to the next movement's picture.
58795
- let clipInProgress = null;
58798
+ // What the moving box is told frame by frame on top of the browser's own morph
58799
+ // (animateMovingBox: its corners, its clip to the room between the bars),
58800
+ // cancelled with the movement so a finished one cannot go on applying its
58801
+ // last values to the next movement's picture.
58802
+ let boxAnimationInProgress = null;
58796
58803
  // The page held still for the length of the movement. Its picture is frozen
58797
58804
  // anyway, and the browser keeps following the live anchor: a scroll would
58798
58805
  // carry the arriving box along under a page that does not move, and past the
@@ -58838,6 +58845,8 @@ const liftPopupFromAnchor = (
58838
58845
  if (!opened) {
58839
58846
  publishBoxPaint(elementLeaving);
58840
58847
  }
58848
+ const cornersLeaving = readCorners(elementLeaving);
58849
+ root.style.setProperty(BORDER_RADIUS_PROPERTY, cornersLeaving);
58841
58850
 
58842
58851
  let giveBackNameArriving = null;
58843
58852
  let stopWaitingForTarget = null;
@@ -58847,8 +58856,8 @@ const liftPopupFromAnchor = (
58847
58856
  }
58848
58857
  releaseLiftInProgress = null;
58849
58858
  stopWaitingForTarget?.();
58850
- clipInProgress?.cancel();
58851
- clipInProgress = null;
58859
+ boxAnimationInProgress?.cancel();
58860
+ boxAnimationInProgress = null;
58852
58861
  releaseScrollHold?.();
58853
58862
  releaseScrollHold = null;
58854
58863
  // Given up on, or replaced, while still waiting to be lifted: shown where
@@ -58871,6 +58880,7 @@ const liftPopupFromAnchor = (
58871
58880
  const room = measureRoomBetweenBars();
58872
58881
  const boxLeaving = room ? elementLeaving.getBoundingClientRect() : null;
58873
58882
  let boxArriving = null;
58883
+ let cornersArriving = null;
58874
58884
  const viewTransition = startViewTransition(() => {
58875
58885
  // The name is the arriving box's from here on: worn by both, it is worn
58876
58886
  // by neither. Written rather than removed, so a name the element also
@@ -58880,18 +58890,24 @@ const liftPopupFromAnchor = (
58880
58890
  const elementArriving = resolveElementArriving();
58881
58891
  if (elementArriving) {
58882
58892
  giveBackNameArriving = wearLiftName(elementArriving);
58893
+ cornersArriving = readCorners(elementArriving);
58883
58894
  if (room) {
58884
58895
  boxArriving = elementArriving.getBoundingClientRect();
58885
58896
  }
58886
58897
  }
58887
58898
  });
58888
- if (room) {
58889
- viewTransition.ready.then(() => {
58890
- if (boxArriving) {
58891
- clipToRoomBetweenBars(room, boxLeaving, boxArriving);
58892
- }
58893
- }, ignore);
58894
- }
58899
+ viewTransition.ready.then(() => {
58900
+ if (cornersArriving === null) {
58901
+ return;
58902
+ }
58903
+ animateMovingBox({
58904
+ cornersFrom: cornersLeaving,
58905
+ cornersTo: cornersArriving,
58906
+ room,
58907
+ boxFrom: boxLeaving,
58908
+ boxTo: boxArriving,
58909
+ });
58910
+ }, ignore);
58895
58911
  viewTransition.finished.then(release, release);
58896
58912
  };
58897
58913
 
@@ -58932,17 +58948,30 @@ const liftPopupFromAnchor = (
58932
58948
  };
58933
58949
 
58934
58950
  const publishBoxPaint = (liftedElement) => {
58935
- const { borderRadius, backgroundColor, backgroundImage } = getComputedStyle(
58951
+ const { backgroundColor, backgroundImage } = getComputedStyle(
58936
58952
  findPaintedBox(liftedElement),
58937
58953
  );
58938
58954
  const root = document.documentElement;
58939
- if (borderRadius) {
58940
- root.style.setProperty(BORDER_RADIUS_PROPERTY, borderRadius);
58941
- }
58942
58955
  root.style.setProperty(BACKGROUND_COLOR_PROPERTY, backgroundColor);
58943
58956
  root.style.setProperty(BACKGROUND_IMAGE_PROPERTY, backgroundImage);
58944
58957
  };
58945
58958
 
58959
+ // The corners of a box: the first round found going down through children
58960
+ // that are the same box, the outermost one being what clips the others; a
58961
+ // bare trigger around a card carries its corners on itself or on the card,
58962
+ // and either is found. Square when none does.
58963
+ const readCorners = (element) => {
58964
+ let current = element;
58965
+ while (current) {
58966
+ const { borderRadius } = getComputedStyle(current);
58967
+ if (borderRadius && !/^(?:0px\s*)+$/.test(borderRadius)) {
58968
+ return borderRadius;
58969
+ }
58970
+ current = sameBoxChild(current);
58971
+ }
58972
+ return "0px";
58973
+ };
58974
+
58946
58975
  // The lifted node is often a wrapper painting nothing, around the card that
58947
58976
  // paints: what the moving box has to wear is the card's paint, found by going
58948
58977
  // down through children that are the same box, until one paints.
@@ -59049,15 +59078,17 @@ const measureRoomBetweenBars = () => {
59049
59078
  return room;
59050
59079
  };
59051
59080
 
59052
- // Clips the moving picture to the room between the bars, for the length of
59053
- // the movement. The clip is written in the moving box's own coordinates, and
59054
- // the box goes from one rectangle to the other along the browser's own
59055
- // easing: each inset is an affine function of that progress, so two keyframes
59056
- // with the group's timing follow the box exactly, and a negative inset — the
59057
- // box clear of that bar clips nothing. The easing is the one on the
59058
- // group's keyframes: a CSS animation carries it there, and the animation's
59059
- // own timing reads linear.
59060
- const clipToRoomBetweenBars = (room, boxFrom, boxTo) => {
59081
+ // What the moving picture is told on top of the browser's own morph, from one
59082
+ // end of the movement to the other, on the group's own clock: its corners,
59083
+ // from those of the box it leaves to those of the box it arrives on; and, when
59084
+ // there are fixed bars, its clip to the room between them. The clip is written
59085
+ // in the moving box's own coordinates, and the box goes from one rectangle to
59086
+ // the other along the browser's own easing: each inset is an affine function
59087
+ // of that progress, so two keyframes with the group's timing follow the box
59088
+ // exactly, and a negative inset — the box clear of that bar — clips nothing.
59089
+ // The easing is the one on the group's keyframes: a CSS animation carries it
59090
+ // there, and the animation's own timing reads linear.
59091
+ const animateMovingBox = ({ cornersFrom, cornersTo, room, boxFrom, boxTo }) => {
59061
59092
  const groupAnimation = document
59062
59093
  .getAnimations()
59063
59094
  .find(
@@ -59070,18 +59101,18 @@ const clipToRoomBetweenBars = (room, boxFrom, boxTo) => {
59070
59101
  const { duration } = groupAnimation.effect.getTiming();
59071
59102
  const [firstKeyframe] = groupAnimation.effect.getKeyframes();
59072
59103
  const easing = firstKeyframe?.easing || "ease";
59073
- clipInProgress?.cancel();
59074
- clipInProgress = document.documentElement.animate(
59075
- [
59076
- { clipPath: insetToRoom(room, boxFrom), easing },
59077
- { clipPath: insetToRoom(room, boxTo) },
59078
- ],
59079
- {
59080
- duration,
59081
- fill: "both",
59082
- pseudoElement: `::view-transition-image-pair(${NAME})`,
59083
- },
59084
- );
59104
+ const from = { borderRadius: cornersFrom, easing };
59105
+ const to = { borderRadius: cornersTo };
59106
+ if (room && boxFrom && boxTo) {
59107
+ from.clipPath = insetToRoom(room, boxFrom);
59108
+ to.clipPath = insetToRoom(room, boxTo);
59109
+ }
59110
+ boxAnimationInProgress?.cancel();
59111
+ boxAnimationInProgress = document.documentElement.animate([from, to], {
59112
+ duration,
59113
+ fill: "both",
59114
+ pseudoElement: `::view-transition-image-pair(${NAME})`,
59115
+ });
59085
59116
  };
59086
59117
 
59087
59118
  const insetToRoom = (room, box) =>
@@ -59710,8 +59741,11 @@ const css$E = /* css */`
59710
59741
  then swapping.
59711
59742
 
59712
59743
  The box paints what the lifted card paints behind its content
59713
- (published by popup_lift.js, with its corners): where it has grown past
59714
- the picture it carries, it is the card that has grown. */
59744
+ (published by popup_lift.js): where it has grown past the picture it
59745
+ carries, it is the card that has grown. Its corners are those of the
59746
+ box it leaves, and travel to those of the box it arrives on — a corner
59747
+ is written per box, the same card at two sizes not wanting the same
59748
+ round (see animateMovingBox in popup_lift.js). */
59715
59749
  &::view-transition-image-pair(navi-popup-lift) {
59716
59750
  background-image: var(--navi-popup-lift-background-image, none);
59717
59751
  background-color: var(--navi-popup-lift-background-color, transparent);
@@ -72220,6 +72254,10 @@ const css$t = /* css */`@layer navi {
72220
72254
  }
72221
72255
  }
72222
72256
 
72257
+ &[data-open-on]:not([data-open-on~="single_click"]) {
72258
+ --x-picker-cursor: auto;
72259
+ }
72260
+
72223
72261
  &[data-open-on~="longpress"] {
72224
72262
  -webkit-touch-callout: none;
72225
72263
  user-select: none;
@@ -72295,7 +72333,7 @@ const css$t = /* css */`@layer navi {
72295
72333
  --x-picker-cursor: default;
72296
72334
  }
72297
72335
 
72298
- &[data-readonly-opens] {
72336
+ &[data-readonly-opens]:not([data-open-on]) {
72299
72337
  --x-picker-cursor: pointer;
72300
72338
  }
72301
72339