@jsenv/navi 0.20.17 → 0.20.19

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.
@@ -6302,6 +6302,9 @@ const DIMENSION_PROPS = {
6302
6302
  boxFlow === "flex-x" || boxFlow === "inline-flex-x";
6303
6303
  if (selfHorizontalFlexFlow || inHorizontalFlexFlow) {
6304
6304
  if (!inHorizontalFlexFlow) {
6305
+ if (parentBoxFlow === "flex-y" || parentBoxFlow === "inline-flex-y") {
6306
+ return { minWidth: "100%", width: "auto" };
6307
+ }
6305
6308
  return {
6306
6309
  flexGrow: 1,
6307
6310
  flexBasis: "0%",
@@ -6326,6 +6329,9 @@ const DIMENSION_PROPS = {
6326
6329
  boxFlow === "flex-y" || boxFlow === "inline-flex-y";
6327
6330
  if (selfVerticalFlexFlow || inVerticalFlexFlow) {
6328
6331
  if (!inVerticalFlexFlow) {
6332
+ if (parentBoxFlow === "flex-x" || parentBoxFlow === "inline-flex-x") {
6333
+ return { minHeight: "100%", height: "auto" };
6334
+ }
6329
6335
  return {
6330
6336
  flexGrow: 1,
6331
6337
  flexBasis: "0%",
@@ -18784,7 +18790,7 @@ const selectByTextStrings = (element, range, startText, endText) => {
18784
18790
  };
18785
18791
 
18786
18792
  installImportMetaCssBuild(import.meta);/* eslint-disable jsenv/no-unknown-params */
18787
- import.meta.css = [/* css */`
18793
+ const css$3 = /* css */`
18788
18794
  *[data-navi-space] {
18789
18795
  /* user-select: none; */
18790
18796
  padding-left: 0.25em;
@@ -18792,7 +18798,6 @@ import.meta.css = [/* css */`
18792
18798
 
18793
18799
  .navi_text {
18794
18800
  position: relative;
18795
- color: inherit;
18796
18801
 
18797
18802
  &[data-has-absolute-child] {
18798
18803
  display: inline-block;
@@ -18893,7 +18898,7 @@ import.meta.css = [/* css */`
18893
18898
  transition-timing-function: ease;
18894
18899
  }
18895
18900
  }
18896
- `, "@jsenv/navi/src/text/text.jsx"];
18901
+ `;
18897
18902
 
18898
18903
  // We could use <span data-navi-space=""> </span>
18899
18904
  // but we prefer to use zero width space as it has the nice side effects of
@@ -18956,10 +18961,7 @@ const applySpacingOnTextChildren = (children, spacing = REGULAR_SPACE) => {
18956
18961
  }
18957
18962
  const currentChild = childArray[i - 1];
18958
18963
  const nextChild = childArray[i];
18959
- if (!shouldInjectSpacingAfter(currentChild)) {
18960
- continue;
18961
- }
18962
- if (!shouldInjectSpacingBefore(nextChild)) {
18964
+ if (!shouldInjectSpacingBetween(currentChild, nextChild)) {
18963
18965
  continue;
18964
18966
  }
18965
18967
  childrenWithGap.push(separator);
@@ -18973,35 +18975,36 @@ const markAsOutsideTextFlow = jsxElement => {
18973
18975
  const isMarkedAsOutsideTextFlow = jsxElement => {
18974
18976
  return outsideTextFlowSet.has(jsxElement.type);
18975
18977
  };
18976
- const shouldInjectSpacingAfter = jsxChild => {
18977
- if (typeof jsxChild === "string") {
18978
- if (/\s$/.test(jsxChild)) {
18979
- return false;
18980
- }
18978
+ const isPreactNode = jsxChild => {
18979
+ return jsxChild !== null && typeof jsxChild === "object" && jsxChild.type !== undefined;
18980
+ };
18981
+ const shouldInjectSpacingBetween = (left, right) => {
18982
+ const leftIsNode = isPreactNode(left);
18983
+ const rightIsNode = isPreactNode(right);
18984
+ // only inject spacing when at least one side is a preact node
18985
+ if (!leftIsNode && !rightIsNode) {
18986
+ return false;
18981
18987
  }
18982
- if (isMarkedAsOutsideTextFlow(jsxChild)) {
18983
- // we can mark jsx element as "outsideFlow" to avoid spacing injection between it and surrounding text
18988
+ if (leftIsNode && isMarkedAsOutsideTextFlow(left)) {
18984
18989
  return false;
18985
18990
  }
18986
- return true;
18987
- };
18988
- const shouldInjectSpacingBefore = jsxChild => {
18989
- if (typeof jsxChild === "string") {
18990
- if (/^\s/.test(jsxChild)) {
18991
- return false;
18992
- }
18991
+ if (rightIsNode && isMarkedAsOutsideTextFlow(right)) {
18992
+ return false;
18993
18993
  }
18994
- if (isMarkedAsOutsideTextFlow(jsxChild)) {
18995
- // we can mark jsx element as "outsideFlow" to avoid spacing injection between it and surrounding text
18994
+ if (rightIsNode && right.props && right.props.overflowPinned) {
18996
18995
  return false;
18997
18996
  }
18998
- if (jsxChild && jsxChild.props && jsxChild.props.overflowPinned) {
18997
+ if (typeof left === "string" && /\s$/.test(left)) {
18998
+ return false;
18999
+ }
19000
+ if (typeof right === "string" && /^\s/.test(right)) {
18999
19001
  return false;
19000
19002
  }
19001
19003
  return true;
19002
19004
  };
19003
19005
  const OverflowPinnedElementContext = createContext(null);
19004
19006
  const Text = props => {
19007
+ import.meta.css = [css$3, "@jsenv/navi/src/text/text.jsx"];
19005
19008
  const {
19006
19009
  overflowEllipsis,
19007
19010
  ...rest
@@ -19159,7 +19162,7 @@ const TextBasic = ({
19159
19162
  });
19160
19163
  };
19161
19164
 
19162
- installImportMetaCssBuild(import.meta);import.meta.css = [/* css */`
19165
+ installImportMetaCssBuild(import.meta);const css$2 = /* css */`
19163
19166
  @layer navi {
19164
19167
  /* Ensure data attributes from box.jsx can win to update display */
19165
19168
  .navi_icon {
@@ -19197,7 +19200,7 @@ installImportMetaCssBuild(import.meta);import.meta.css = [/* css */`
19197
19200
  cursor: default;
19198
19201
  user-select: none;
19199
19202
  }
19200
- .navi_icon_foreground {
19203
+ .navi_text.navi_icon_foreground {
19201
19204
  position: absolute;
19202
19205
  inset: 0;
19203
19206
  display: inline-flex;
@@ -19234,7 +19237,7 @@ installImportMetaCssBuild(import.meta);import.meta.css = [/* css */`
19234
19237
  width: 100%;
19235
19238
  height: 100%;
19236
19239
  }
19237
- `, "@jsenv/navi/src/graphic/icon.jsx"];
19240
+ `;
19238
19241
  const Icon = ({
19239
19242
  href,
19240
19243
  children,
@@ -19247,6 +19250,7 @@ const Icon = ({
19247
19250
  onClick,
19248
19251
  ...props
19249
19252
  }) => {
19253
+ import.meta.css = [css$2, "@jsenv/navi/src/graphic/icon.jsx"];
19250
19254
  const innerChildren = href ? jsx("svg", {
19251
19255
  width: "100%",
19252
19256
  height: "100%",
@@ -30093,7 +30097,7 @@ const Address = ({
30093
30097
  });
30094
30098
  };
30095
30099
 
30096
- installImportMetaCssBuild(import.meta);import.meta.css = [/* css */`
30100
+ installImportMetaCssBuild(import.meta);const css$1 = /* css */`
30097
30101
  @layer navi {
30098
30102
  }
30099
30103
  .navi_badge {
@@ -30121,7 +30125,7 @@ installImportMetaCssBuild(import.meta);import.meta.css = [/* css */`
30121
30125
  --x-color-contrasting: var(--navi-color-white);
30122
30126
  }
30123
30127
  }
30124
- `, "@jsenv/navi/src/text/badge.jsx"];
30128
+ `;
30125
30129
  const BadgeStyleCSSVars$1 = {
30126
30130
  borderWidth: "--border-width",
30127
30131
  borderRadius: "--border-radius",
@@ -30138,6 +30142,7 @@ const Badge = ({
30138
30142
  className,
30139
30143
  ...props
30140
30144
  }) => {
30145
+ import.meta.css = [css$1, "@jsenv/navi/src/text/badge.jsx"];
30141
30146
  const defaultRef = useRef();
30142
30147
  const ref = props.ref || defaultRef;
30143
30148
  useDarkBackgroundAttribute(ref);
@@ -30216,10 +30221,10 @@ const formatNumber = (value, { lang } = {}) => {
30216
30221
  return new Intl.NumberFormat(lang).format(value);
30217
30222
  };
30218
30223
 
30219
- installImportMetaCssBuild(import.meta);import.meta.css = [/* css */`
30224
+ installImportMetaCssBuild(import.meta);const css = /* css */`
30220
30225
  @layer navi {
30221
30226
  }
30222
- .navi_badge_count {
30227
+ .navi_text.navi_badge_count {
30223
30228
  --font-size: 0.7em;
30224
30229
  --x-background: var(--background);
30225
30230
  --x-background-color: var(--background-color, var(--x-background));
@@ -30305,7 +30310,7 @@ installImportMetaCssBuild(import.meta);import.meta.css = [/* css */`
30305
30310
  }
30306
30311
  }
30307
30312
  }
30308
- `, "@jsenv/navi/src/text/badge_count.jsx"];
30313
+ `;
30309
30314
  const BadgeStyleCSSVars = {
30310
30315
  borderWidth: "--border-width",
30311
30316
  borderRadius: "--border-radius",
@@ -30335,6 +30340,7 @@ const BadgeCount = ({
30335
30340
  loading,
30336
30341
  ...props
30337
30342
  }) => {
30343
+ import.meta.css = [css, "@jsenv/navi/src/text/badge_count.jsx"];
30338
30344
  const defaultRef = useRef();
30339
30345
  const ref = props.ref || defaultRef;
30340
30346
  useDarkBackgroundAttribute(ref, [loading]);