@jsenv/navi 0.29.122 → 0.29.124

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.
@@ -4536,7 +4536,11 @@ const css$11 = /* css */`
4536
4536
  height: auto; /* User agent reset */
4537
4537
  margin: 0;
4538
4538
  padding: 0; /* User agent reset */
4539
- color: revert; /* Do no inherit element color, callout is inside the element it should use document color though */
4539
+ /* The UA's ink for a [popover] element (CanvasText), not the element's:
4540
+ a callout sits inside the element but writes on its own paper. The
4541
+ color keywords are re-declared against that same ink in
4542
+ navi_css_vars.js (.navi_callout). */
4543
+ color: revert;
4540
4544
  font-weight: initial; /* Callout fells disconnected from the element, font weight should be predictible and stable */
4541
4545
  font-size: initial; /* Callout fells disconnected from the element, font size should be predictible and stable */
4542
4546
  line-height: var(
@@ -50669,6 +50673,11 @@ const SlideContainer = ({
50669
50673
  }
50670
50674
  const track = trackRef.current;
50671
50675
  const offset = `${-currentPlace.x * 100}% ${-currentPlace.y * 100}%`;
50676
+ // The travel that was ASKED for is still one box, whatever is left of it to
50677
+ // cover: a slide dragged most of the way there finishes in what is left of
50678
+ // the duration rather than taking a full one over a few pixels.
50679
+ const offsetTargetBefore = offsetRef.current;
50680
+ const targetMoves = offset !== offsetTargetBefore;
50672
50681
  // Where the track IS, read before anything is written: a travel asked for
50673
50682
  // while another is still playing must carry on from what is on screen. The
50674
50683
  // previous TARGET is where the last travel was going, not where it got to —
@@ -50679,22 +50688,36 @@ const SlideContainer = ({
50679
50688
  // var just below) and not the moving one — the animation being replaced
50680
50689
  // does not contribute to it. So the position on screen is a thing to go and
50681
50690
  // fetch, and having it in hand is also what allows the pace below.
50691
+ // Measured off the box, in px, and not read off the computed `translate`:
50692
+ // see trackOffsetPx for what that value looks like mid-animation.
50682
50693
  const travelInFlight = trackAnimationRef.current?.playState === "running";
50683
- const offsetOnScreen = travelInFlight ? getComputedStyle(track).translate : undefined;
50694
+ let offsetOnScreen;
50695
+ if (travelInFlight) {
50696
+ const onScreenPx = trackOffsetPx(track, containerRef.current);
50697
+ offsetOnScreen = `${onScreenPx.x}px ${onScreenPx.y}px`;
50698
+ }
50684
50699
  // …and where a slide let go of halfway was left, which is the same fact
50685
50700
  // said by the gesture that put it there: the track is at rest as far as any
50686
- // animation is concerned, so nothing else could tell.
50687
- const offsetDragged = travelFromRef.current;
50688
- travelFromRef.current = null;
50701
+ // animation is concerned, so nothing else could tell. Taken by the render
50702
+ // that moves the track and by no other: a `current` held outside catches up
50703
+ // with the gesture a render late (a parent's state, set from a handler that
50704
+ // runs after the address is written and read back), and a render still
50705
+ // standing on the slide being left would otherwise carry the finger's
50706
+ // offset back to it — a travel home nobody asked for.
50707
+ const offsetDragged = targetMoves ? travelFromRef.current : null;
50708
+ if (targetMoves) {
50709
+ travelFromRef.current = null;
50710
+ }
50689
50711
  const offsetBefore = offsetDragged ?? offsetOnScreen ?? offsetRef.current;
50690
- // The travel that was ASKED for is still one box, whatever is left of it to
50691
- // cover: a slide dragged most of the way there finishes in what is left of
50692
- // the duration rather than taking a full one over a few pixels.
50693
- const offsetTargetBefore = offsetRef.current;
50694
50712
  offsetRef.current = offset;
50695
50713
  // Where the track ends up, always — the animation below only covers the way
50696
- // there, and when it is over this is what holds.
50697
- track.style.setProperty("--slide-container-offset", offset);
50714
+ // there, and when it is over this is what holds. Except under a hand-off
50715
+ // still waiting for its travel: the track stays where the finger left it,
50716
+ // until the render that moves it or the frame after which the gesture gives
50717
+ // up on it (see returnToRest in onEnd).
50718
+ if (!travelFromRef.current) {
50719
+ track.style.setProperty("--slide-container-offset", offset);
50720
+ }
50698
50721
  // A travel to this very offset is already playing: left to play. Same
50699
50722
  // courtesy as the stage above — a re-render in the middle of a travel (a
50700
50723
  // signal read higher up answering) changes nothing here, and setting off
@@ -50970,19 +50993,21 @@ const SlideContainer = ({
50970
50993
  return true;
50971
50994
  };
50972
50995
 
50973
- // The caller learns where the container went: the bound signal is written and
50974
- // `onCurrentChange` is called, in that order, so a caller reading the signal
50975
- // from inside its own handler reads where it now is.
50996
+ // The caller learns where the container went: the bound signal is written,
50997
+ // then the address, then `onCurrentChange` is called in that order, so a
50998
+ // caller reading either from inside its own handler reads where it now is.
50999
+ // The signal before the address because writing the address can render on
51000
+ // the spot (a navigation lets go of what Preact had queued, see
51001
+ // rendering_hold.js), and that render must already find `current` moved.
50976
51002
  const tellCurrentChange = (area, detail, leftArea) => {
50977
- // The address first, because it is the one thing that must never disagree
50978
- // with the picture — and it is told here rather than by the caller so that
50979
- // it is told about the travels that HAPPENED and about no others: the ones
50980
- // a lock refused never reach this point, and one refused late is written
50981
- // back below (see goBackToRefusedArea).
50982
- writeUrlParam(area, detail.cause);
50983
51003
  if (currentSignal) {
50984
51004
  currentSignal.value = area;
50985
51005
  }
51006
+ // The address is told here rather than by the caller so that it is told
51007
+ // about the travels that HAPPENED and about no others: the ones a lock
51008
+ // refused never reach this point, and one refused late is written back
51009
+ // below (see goBackToRefusedArea).
51010
+ writeUrlParam(area, detail.cause);
50986
51011
  if (!onCurrentChange) {
50987
51012
  return;
50988
51013
  }
@@ -51774,9 +51799,10 @@ const SlideContainer = ({
51774
51799
  returnToRest(drag);
51775
51800
  return;
51776
51801
  }
51777
- // A container whose `current` is held outside and was not moved:
51778
- // nothing rendered, so nothing drew the travel and the track is still
51779
- // under where the finger left it. One frame is all it takes to know.
51802
+ // A container whose `current` is held outside and was not moved: no
51803
+ // render moved the track, so the hand-off is still waiting and the
51804
+ // track still under where the finger left it. One frame is all it
51805
+ // takes to know.
51780
51806
  requestAnimationFrame(() => {
51781
51807
  if (travelFromRef.current) {
51782
51808
  travelFromRef.current = null;
@@ -66774,6 +66800,13 @@ installImportMetaCssBuild(import.meta);const css$t = /* css */`
66774
66800
  --picker-background-color-readonly: var(--picker-background-color);
66775
66801
  --picker-background-color-disabled: var(--picker-background-color);
66776
66802
  --x-picker-icon-color: currentColor;
66803
+
66804
+ /* The value holds nothing but the icon, so it takes the icon's width
66805
+ rather than the box's: the box's justify-content is then what places
66806
+ it, and alignX means something. */
66807
+ .navi_picker_value {
66808
+ flex-grow: 0;
66809
+ }
66777
66810
  }
66778
66811
  /* discrete: no box at rest, a background on hover — the same word Button
66779
66812
  uses, and the same drawing. What is read is the value, not the field
@@ -66898,7 +66931,7 @@ const PickerButton = props => {
66898
66931
  rightSlot,
66899
66932
  placeholder,
66900
66933
  ui,
66901
- maxLines = 1,
66934
+ maxLines: maxLinesProp = 1,
66902
66935
  // By default the popover is at least as wide as the trigger (min-width:
66903
66936
  // --anchor-width). Set true when the CONTENT should dictate the popover width
66904
66937
  // (e.g. a Wheel) instead of being stretched to the trigger — see
@@ -66917,6 +66950,10 @@ const PickerButton = props => {
66917
66950
  readOnly,
66918
66951
  error
66919
66952
  } = props;
66953
+ // A word in a sentence is never truncated — and the clamp's overflow: hidden
66954
+ // would cut its dotted underline, which sits on the edge of the line box
66955
+ // (WebKit drops it or not depending on the subpixel position of the line).
66956
+ const maxLines = variant === "text" ? undefined : maxLinesProp;
66920
66957
  const isSingleLine = maxLines === 1;
66921
66958
  // Same rule as the root: phrasing content inside a sentence.
66922
66959
  const ContentTag = variant === "text" ? "span" : "div";
@@ -67036,10 +67073,6 @@ const PickerButton = props => {
67036
67073
  ,
67037
67074
 
67038
67075
  ui: ui,
67039
- onFocus: e => {
67040
- inputProps.onFocus?.(e);
67041
- e.target.select();
67042
- },
67043
67076
  onCopy: e => {
67044
67077
  const pickerEl = ref.current;
67045
67078
  if (isWithinPickerContent(e.target, pickerEl)) {