@jsenv/navi 0.30.20 → 0.30.22

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.
@@ -34071,6 +34071,9 @@ const STYLE_CSS_VARS_DEFAULT = {};
34071
34071
  // An entry of styleCSSVars is the css variable the prop writes into, alone when
34072
34072
  // the prop is named after a css style — Box then already knows how to read its
34073
34073
  // value — or paired with the style whose values it borrows when it is not.
34074
+ // A prop Box expands (padding into its four sides, alignX into
34075
+ // justify-content…) is looked up by the styles it expands into, and by its own
34076
+ // name only when the component maps none of them.
34074
34077
  const readCSSVarEntry = entry => {
34075
34078
  if (Array.isArray(entry)) {
34076
34079
  return entry;
@@ -34667,6 +34670,15 @@ const computeBox = (props, parentBoxFlow) => {
34667
34670
  if (!cssValues) {
34668
34671
  return;
34669
34672
  }
34673
+ const ownCSSVarEntry = styleContext.styleCSSVars[name];
34674
+ if (ownCSSVarEntry && !Object.keys(cssValues).some(styleName => styleContext.styleCSSVars[styleName])) {
34675
+ // Written as the styles it expands into, the prop would land inline
34676
+ // and beat what the component's stylesheet does with its variable
34677
+ // (Switch sizes its thumb from its padding).
34678
+ const [cssVarName, valueStyleName] = readCSSVarEntry(ownCSSVarEntry);
34679
+ addCSSVar(stringifyStyleValue(value, valueStyleName || name, styleContext), cssVarName, boxStylesTarget);
34680
+ return;
34681
+ }
34670
34682
  let needForwarding = false;
34671
34683
  for (const styleName of Object.keys(cssValues)) {
34672
34684
  const cssValue = cssValues[styleName];
@@ -58965,8 +58977,8 @@ const BinderStyleCSSVars = {
58965
58977
  tabBackgroundHover: "--binder-tab-background-hover",
58966
58978
  tabBorderColor: "--binder-tab-border-color",
58967
58979
  tabColor: "--binder-tab-color",
58968
- paddingX: "--binder-padding-x",
58969
- paddingY: "--binder-padding-y",
58980
+ paddingX: ["--binder-padding-x", "padding"],
58981
+ paddingY: ["--binder-padding-y", "padding"],
58970
58982
  pagePadding: ["--binder-page-padding", "padding"]
58971
58983
  };
58972
58984
  const TABS_ALIGN_TO_JUSTIFY_CONTENT = {
@@ -59516,15 +59528,19 @@ const css$Y = /* css */`@layer navi {
59516
59528
  right: var(--navi-app-inset-right);
59517
59529
  left: var(--navi-app-inset-left);
59518
59530
  max-width: var(--navi-fixed-bar-max-width);
59519
- padding-right: calc(var(--navi-fixed-bar-padding) + env(safe-area-inset-right));
59520
- padding-left: calc(var(--navi-fixed-bar-padding) + env(safe-area-inset-left));
59531
+ padding-right: calc(var(--navi-fixed-bar-padding-right, var(--navi-fixed-bar-padding)) +
59532
+ env(safe-area-inset-right));
59533
+ padding-left: calc(var(--navi-fixed-bar-padding-left, var(--navi-fixed-bar-padding)) +
59534
+ env(safe-area-inset-left));
59521
59535
  }
59522
59536
 
59523
59537
  &[data-area="left"], &[data-area="right"] {
59524
59538
  top: var(--navi-app-inset-top);
59525
59539
  bottom: var(--navi-app-inset-bottom);
59526
- padding-top: calc(var(--navi-fixed-bar-padding) + env(safe-area-inset-top));
59527
- padding-bottom: calc(var(--navi-fixed-bar-padding) + env(safe-area-inset-bottom));
59540
+ padding-top: calc(var(--navi-fixed-bar-padding-top, var(--navi-fixed-bar-padding)) +
59541
+ env(safe-area-inset-top));
59542
+ padding-bottom: calc(var(--navi-fixed-bar-padding-bottom, var(--navi-fixed-bar-padding)) +
59543
+ env(safe-area-inset-bottom));
59528
59544
  flex-direction: column;
59529
59545
  }
59530
59546
 
@@ -59601,7 +59617,14 @@ const FixedBarStyleCSSVars = {
59601
59617
  width: "--navi-fixed-bar-width",
59602
59618
  height: "--navi-fixed-bar-height",
59603
59619
  maxWidth: "--navi-fixed-bar-max-width",
59620
+ // Every side goes through a variable too: written inline, it would replace
59621
+ // the safe-area inset the stylesheet adds to it. A side across the bar is
59622
+ // read by no rule — that direction is the width/height.
59604
59623
  padding: "--navi-fixed-bar-padding",
59624
+ paddingTop: "--navi-fixed-bar-padding-top",
59625
+ paddingRight: "--navi-fixed-bar-padding-right",
59626
+ paddingBottom: "--navi-fixed-bar-padding-bottom",
59627
+ paddingLeft: "--navi-fixed-bar-padding-left",
59605
59628
  background: "--navi-fixed-bar-background",
59606
59629
  borderWidth: "--navi-fixed-bar-border-width",
59607
59630
  borderColor: "--navi-fixed-bar-border-color",
@@ -59615,6 +59638,12 @@ const FixedBarStyleCSSVars = {
59615
59638
  * height?: string|number,
59616
59639
  * maxWidth?: string|number,
59617
59640
  * padding?: string|number,
59641
+ * paddingX?: string|number,
59642
+ * paddingY?: string|number,
59643
+ * paddingTop?: string|number,
59644
+ * paddingRight?: string|number,
59645
+ * paddingBottom?: string|number,
59646
+ * paddingLeft?: string|number,
59618
59647
  * background?: string,
59619
59648
  * border?: boolean,
59620
59649
  * borderWidth?: string|number,
@@ -59641,7 +59670,9 @@ const FixedBarStyleCSSVars = {
59641
59670
  * content column narrower than the window (it stays centered).
59642
59671
  * @param {string|number} [props.padding=0] - Along the bar only: left/right on
59643
59672
  * a top or bottom bar, top/bottom on a side one. Across it, the size is
59644
- * `height`/`width`.
59673
+ * `height`/`width`. The same holds for `paddingX`/`paddingY` and each side:
59674
+ * a side across the bar is ignored. Along the bar, the safe-area inset is
59675
+ * added to it.
59645
59676
  * @param {string} [props.shadow] - What the bar casts over the content, in
59646
59677
  * `box-shadow` syntax, cut at the bar's box on every side but the content's.
59647
59678
  * Takes no room.
@@ -63026,6 +63057,7 @@ const css$R = /* css */`.navi_control_swap {
63026
63057
  --x-control-swap-size: var(--navi-control-swap-size, calc(var(--navi-control-line-height) + 2 * var(--navi-s) + 2 *
63027
63058
  var(--navi-control-border-width)));
63028
63059
  --x-control-swap-gap: var(--navi-control-swap-gap, var(--navi-xs));
63060
+ --x-control-swap-seam-travel: calc(var(--x-control-swap-gap) + var(--navi-control-border-width));
63029
63061
  height: var(--x-control-swap-size);
63030
63062
  align-items: stretch;
63031
63063
  gap: var(--x-control-swap-gap);
@@ -63039,15 +63071,45 @@ const css$R = /* css */`.navi_control_swap {
63039
63071
  min-width: 0;
63040
63072
  height: 100%;
63041
63073
  position: relative;
63074
+
63075
+ &:has( ~ .navi_control_swap_stage)[aria-expanded="true"] {
63076
+ --x-corner-top-right-radius: 0;
63077
+ --x-corner-bottom-right-radius: 0;
63078
+ }
63079
+
63080
+ .navi_control_swap_stage ~ &[aria-expanded="true"] {
63081
+ --x-corner-top-left-radius: 0;
63082
+ --x-corner-bottom-left-radius: 0;
63083
+ }
63084
+
63085
+ &:focus-visible, &[data-focus-visible] {
63086
+ z-index: var(--navi-z-index-control-focused);
63087
+ }
63042
63088
  }
63043
63089
 
63044
63090
  & > .navi_control_swap_stage {
63091
+ min-width: 0;
63092
+ margin-left: calc(-1 * var(--x-control-swap-seam-travel));
63045
63093
  overflow-clip-margin: var(--navi-focus-outline-width);
63046
63094
  flex: 1 1 0;
63047
- min-width: 0;
63048
63095
  display: flex;
63049
63096
  overflow: clip;
63050
63097
  container-type: inline-size;
63098
+
63099
+ &:hover {
63100
+ z-index: var(--navi-z-index-control-hovered);
63101
+ position: relative;
63102
+ }
63103
+
63104
+ &:has(:focus-visible, [data-focus-visible]) {
63105
+ z-index: var(--navi-z-index-control-focused);
63106
+ position: relative;
63107
+ }
63108
+
63109
+ &:has([aria-expanded="true"]) {
63110
+ z-index: var(--navi-z-index-control-expanded);
63111
+ position: relative;
63112
+ }
63051
63113
  }
63052
63114
 
63053
63115
  & > .navi_control_swap_stage > .navi_control_swap_track {
@@ -63066,20 +63128,43 @@ const css$R = /* css */`.navi_control_swap {
63066
63128
  width: 100%;
63067
63129
  height: 100%;
63068
63130
  }
63131
+
63132
+ &:first-child > :not([navi-out-of-flow]) {
63133
+ --x-corner-top-left-radius: 0;
63134
+ --x-corner-bottom-left-radius: 0;
63135
+ border-top-left-radius: 0 !important;
63136
+ border-bottom-left-radius: 0 !important;
63137
+ }
63138
+
63139
+ &:last-child > :not([navi-out-of-flow]) {
63140
+ --x-corner-top-right-radius: 0;
63141
+ --x-corner-bottom-right-radius: 0;
63142
+ border-top-right-radius: 0 !important;
63143
+ border-bottom-right-radius: 0 !important;
63144
+ }
63069
63145
  }
63070
63146
  }
63071
63147
 
63148
+ &[data-active-index="1"] > .navi_control_swap_stage {
63149
+ transform: translateX(var(--x-control-swap-seam-travel));
63150
+ }
63151
+
63072
63152
  &[data-active-index="1"] > .navi_control_swap_stage > .navi_control_swap_track {
63073
63153
  transform: translateX(calc(-100cqw - var(--x-control-swap-gap)));
63074
63154
  }
63075
63155
 
63076
- &[data-animation] > .navi_control_swap_stage > .navi_control_swap_track {
63156
+ &[data-animation] > .navi_control_swap_stage, &[data-animation] > .navi_control_swap_stage > .navi_control_swap_track {
63077
63157
  transition: transform var(--navi-control-swap-animation-duration, .22s)
63078
63158
  ease;
63079
63159
  }
63080
63160
 
63161
+ &[data-animation] > .navi_control_swap_cap {
63162
+ transition: border-radius
63163
+ var(--navi-control-swap-animation-duration, .22s) ease;
63164
+ }
63165
+
63081
63166
  @media (prefers-reduced-motion: reduce) {
63082
- &[data-animation] > .navi_control_swap_stage > .navi_control_swap_track {
63167
+ &[data-animation] > .navi_control_swap_stage, &[data-animation] > .navi_control_swap_stage > .navi_control_swap_track, &[data-animation] > .navi_control_swap_cap {
63083
63168
  transition: none;
63084
63169
  }
63085
63170
  }
@@ -63110,8 +63195,9 @@ const css$R = /* css */`.navi_control_swap {
63110
63195
  *
63111
63196
  * The row is one length tall — `--navi-control-swap-size`, a line of text
63112
63197
  * between two `s` paddings — and everything in it is that tall: the caps are
63113
- * squares of it, the control holding the floor fills it. `--navi-control-swap-gap`
63114
- * is the space between the boxes.
63198
+ * squares of it, the control holding the floor fills it. The control is joined
63199
+ * to its cap by a shared border; `--navi-control-swap-gap` is the space between
63200
+ * it and the other cap.
63115
63201
  */
63116
63202
  const ControlSwap = props => {
63117
63203
  import.meta.css = [css$R, "@jsenv/navi/src/control/control_swap/control_swap.jsx"];
@@ -70205,6 +70291,12 @@ const SlideContainer = ({
70205
70291
  // names a slide, and the container standing on its first one is a fact only
70206
70292
  // the map knows (see the layout effect that paints it).
70207
70293
  const areaOnScreen = containerRef.current.getAttribute(SLIDE_CURRENT_ATTRIBUTE);
70294
+ // Standing on the first slide by default holds a rank, and the slide at
70295
+ // that rank changes with their order. Someone outside is naming slides, so
70296
+ // the one on screen is held by its name from this answer on.
70297
+ if (current !== areaOnScreen) {
70298
+ setCurrentAreaState(areaOnScreen);
70299
+ }
70208
70300
  if (areaAsked === areaOnScreen) {
70209
70301
  return;
70210
70302
  }
@@ -82247,10 +82339,9 @@ const Separator = ({
82247
82339
  import.meta.css = [css$y, "@jsenv/navi/src/layout/separator.jsx"];
82248
82340
 
82249
82341
  // Written straight into style rather than declared through Box's own
82250
- // styleCSSVars: `size`, `margin` and `spacing` are names Box already owns (a
82251
- // font size, real margins, a gap) and it resolves those before it ever looks
82252
- // at styleCSSVars — so size="4px" would set a font size and leave the line
82253
- // as thin as it was. Last, so a caller's own style still wins.
82342
+ // styleCSSVars: `spacing` is a name Box owns, and on a box that is neither
82343
+ // flex nor grid it writes nothing for it, variable included. Last, so a
82344
+ // caller's own style still wins.
82254
82345
  const innerStyle = {
82255
82346
  ...cssVars({
82256
82347
  "--size": lengthValue(size),