@jsenv/navi 0.30.20 → 0.30.21

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.
@@ -82247,10 +82278,9 @@ const Separator = ({
82247
82278
  import.meta.css = [css$y, "@jsenv/navi/src/layout/separator.jsx"];
82248
82279
 
82249
82280
  // 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.
82281
+ // styleCSSVars: `spacing` is a name Box owns, and on a box that is neither
82282
+ // flex nor grid it writes nothing for it, variable included. Last, so a
82283
+ // caller's own style still wins.
82254
82284
  const innerStyle = {
82255
82285
  ...cssVars({
82256
82286
  "--size": lengthValue(size),