@jsenv/navi 0.20.17 → 0.20.18

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.
@@ -18784,7 +18784,7 @@ const selectByTextStrings = (element, range, startText, endText) => {
18784
18784
  };
18785
18785
 
18786
18786
  installImportMetaCssBuild(import.meta);/* eslint-disable jsenv/no-unknown-params */
18787
- import.meta.css = [/* css */`
18787
+ const css$3 = /* css */`
18788
18788
  *[data-navi-space] {
18789
18789
  /* user-select: none; */
18790
18790
  padding-left: 0.25em;
@@ -18792,7 +18792,6 @@ import.meta.css = [/* css */`
18792
18792
 
18793
18793
  .navi_text {
18794
18794
  position: relative;
18795
- color: inherit;
18796
18795
 
18797
18796
  &[data-has-absolute-child] {
18798
18797
  display: inline-block;
@@ -18893,7 +18892,7 @@ import.meta.css = [/* css */`
18893
18892
  transition-timing-function: ease;
18894
18893
  }
18895
18894
  }
18896
- `, "@jsenv/navi/src/text/text.jsx"];
18895
+ `;
18897
18896
 
18898
18897
  // We could use <span data-navi-space=""> </span>
18899
18898
  // but we prefer to use zero width space as it has the nice side effects of
@@ -18956,10 +18955,7 @@ const applySpacingOnTextChildren = (children, spacing = REGULAR_SPACE) => {
18956
18955
  }
18957
18956
  const currentChild = childArray[i - 1];
18958
18957
  const nextChild = childArray[i];
18959
- if (!shouldInjectSpacingAfter(currentChild)) {
18960
- continue;
18961
- }
18962
- if (!shouldInjectSpacingBefore(nextChild)) {
18958
+ if (!shouldInjectSpacingBetween(currentChild, nextChild)) {
18963
18959
  continue;
18964
18960
  }
18965
18961
  childrenWithGap.push(separator);
@@ -18973,35 +18969,36 @@ const markAsOutsideTextFlow = jsxElement => {
18973
18969
  const isMarkedAsOutsideTextFlow = jsxElement => {
18974
18970
  return outsideTextFlowSet.has(jsxElement.type);
18975
18971
  };
18976
- const shouldInjectSpacingAfter = jsxChild => {
18977
- if (typeof jsxChild === "string") {
18978
- if (/\s$/.test(jsxChild)) {
18979
- return false;
18980
- }
18972
+ const isPreactNode = jsxChild => {
18973
+ return jsxChild !== null && typeof jsxChild === "object" && jsxChild.type !== undefined;
18974
+ };
18975
+ const shouldInjectSpacingBetween = (left, right) => {
18976
+ const leftIsNode = isPreactNode(left);
18977
+ const rightIsNode = isPreactNode(right);
18978
+ // only inject spacing when at least one side is a preact node
18979
+ if (!leftIsNode && !rightIsNode) {
18980
+ return false;
18981
18981
  }
18982
- if (isMarkedAsOutsideTextFlow(jsxChild)) {
18983
- // we can mark jsx element as "outsideFlow" to avoid spacing injection between it and surrounding text
18982
+ if (leftIsNode && isMarkedAsOutsideTextFlow(left)) {
18984
18983
  return false;
18985
18984
  }
18986
- return true;
18987
- };
18988
- const shouldInjectSpacingBefore = jsxChild => {
18989
- if (typeof jsxChild === "string") {
18990
- if (/^\s/.test(jsxChild)) {
18991
- return false;
18992
- }
18985
+ if (rightIsNode && isMarkedAsOutsideTextFlow(right)) {
18986
+ return false;
18993
18987
  }
18994
- if (isMarkedAsOutsideTextFlow(jsxChild)) {
18995
- // we can mark jsx element as "outsideFlow" to avoid spacing injection between it and surrounding text
18988
+ if (rightIsNode && right.props && right.props.overflowPinned) {
18996
18989
  return false;
18997
18990
  }
18998
- if (jsxChild && jsxChild.props && jsxChild.props.overflowPinned) {
18991
+ if (typeof left === "string" && /\s$/.test(left)) {
18992
+ return false;
18993
+ }
18994
+ if (typeof right === "string" && /^\s/.test(right)) {
18999
18995
  return false;
19000
18996
  }
19001
18997
  return true;
19002
18998
  };
19003
18999
  const OverflowPinnedElementContext = createContext(null);
19004
19000
  const Text = props => {
19001
+ import.meta.css = [css$3, "@jsenv/navi/src/text/text.jsx"];
19005
19002
  const {
19006
19003
  overflowEllipsis,
19007
19004
  ...rest
@@ -19159,7 +19156,7 @@ const TextBasic = ({
19159
19156
  });
19160
19157
  };
19161
19158
 
19162
- installImportMetaCssBuild(import.meta);import.meta.css = [/* css */`
19159
+ installImportMetaCssBuild(import.meta);const css$2 = /* css */`
19163
19160
  @layer navi {
19164
19161
  /* Ensure data attributes from box.jsx can win to update display */
19165
19162
  .navi_icon {
@@ -19197,7 +19194,7 @@ installImportMetaCssBuild(import.meta);import.meta.css = [/* css */`
19197
19194
  cursor: default;
19198
19195
  user-select: none;
19199
19196
  }
19200
- .navi_icon_foreground {
19197
+ .navi_text.navi_icon_foreground {
19201
19198
  position: absolute;
19202
19199
  inset: 0;
19203
19200
  display: inline-flex;
@@ -19234,7 +19231,7 @@ installImportMetaCssBuild(import.meta);import.meta.css = [/* css */`
19234
19231
  width: 100%;
19235
19232
  height: 100%;
19236
19233
  }
19237
- `, "@jsenv/navi/src/graphic/icon.jsx"];
19234
+ `;
19238
19235
  const Icon = ({
19239
19236
  href,
19240
19237
  children,
@@ -19247,6 +19244,7 @@ const Icon = ({
19247
19244
  onClick,
19248
19245
  ...props
19249
19246
  }) => {
19247
+ import.meta.css = [css$2, "@jsenv/navi/src/graphic/icon.jsx"];
19250
19248
  const innerChildren = href ? jsx("svg", {
19251
19249
  width: "100%",
19252
19250
  height: "100%",
@@ -30093,7 +30091,7 @@ const Address = ({
30093
30091
  });
30094
30092
  };
30095
30093
 
30096
- installImportMetaCssBuild(import.meta);import.meta.css = [/* css */`
30094
+ installImportMetaCssBuild(import.meta);const css$1 = /* css */`
30097
30095
  @layer navi {
30098
30096
  }
30099
30097
  .navi_badge {
@@ -30121,7 +30119,7 @@ installImportMetaCssBuild(import.meta);import.meta.css = [/* css */`
30121
30119
  --x-color-contrasting: var(--navi-color-white);
30122
30120
  }
30123
30121
  }
30124
- `, "@jsenv/navi/src/text/badge.jsx"];
30122
+ `;
30125
30123
  const BadgeStyleCSSVars$1 = {
30126
30124
  borderWidth: "--border-width",
30127
30125
  borderRadius: "--border-radius",
@@ -30138,6 +30136,7 @@ const Badge = ({
30138
30136
  className,
30139
30137
  ...props
30140
30138
  }) => {
30139
+ import.meta.css = [css$1, "@jsenv/navi/src/text/badge.jsx"];
30141
30140
  const defaultRef = useRef();
30142
30141
  const ref = props.ref || defaultRef;
30143
30142
  useDarkBackgroundAttribute(ref);
@@ -30216,10 +30215,10 @@ const formatNumber = (value, { lang } = {}) => {
30216
30215
  return new Intl.NumberFormat(lang).format(value);
30217
30216
  };
30218
30217
 
30219
- installImportMetaCssBuild(import.meta);import.meta.css = [/* css */`
30218
+ installImportMetaCssBuild(import.meta);const css = /* css */`
30220
30219
  @layer navi {
30221
30220
  }
30222
- .navi_badge_count {
30221
+ .navi_text.navi_badge_count {
30223
30222
  --font-size: 0.7em;
30224
30223
  --x-background: var(--background);
30225
30224
  --x-background-color: var(--background-color, var(--x-background));
@@ -30305,7 +30304,7 @@ installImportMetaCssBuild(import.meta);import.meta.css = [/* css */`
30305
30304
  }
30306
30305
  }
30307
30306
  }
30308
- `, "@jsenv/navi/src/text/badge_count.jsx"];
30307
+ `;
30309
30308
  const BadgeStyleCSSVars = {
30310
30309
  borderWidth: "--border-width",
30311
30310
  borderRadius: "--border-radius",
@@ -30335,6 +30334,7 @@ const BadgeCount = ({
30335
30334
  loading,
30336
30335
  ...props
30337
30336
  }) => {
30337
+ import.meta.css = [css, "@jsenv/navi/src/text/badge_count.jsx"];
30338
30338
  const defaultRef = useRef();
30339
30339
  const ref = props.ref || defaultRef;
30340
30340
  useDarkBackgroundAttribute(ref, [loading]);