@jsenv/navi 0.21.5 → 0.21.6

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.
@@ -18829,6 +18829,7 @@ const css$3 = /* css */`
18829
18829
 
18830
18830
  .navi_text {
18831
18831
  position: relative;
18832
+ border-radius: var(--x-border-radius);
18832
18833
 
18833
18834
  /* There is a chrome specific bug that prevents text-transform: capitalize to be applied in nested DOM structure */
18834
18835
  /* The CSS below ensure capitalize is propagated to the bold clones */
@@ -18880,35 +18881,59 @@ const css$3 = /* css */`
18880
18881
  }
18881
18882
  }
18882
18883
 
18883
- /* When skeleton + overflow ellipsis: skeleton fills available space,
18884
- no text to clip so disable overflow machinery. */
18885
- &[data-text-overflow][data-skeleton] {
18886
- flex-wrap: nowrap;
18887
- text-overflow: clip;
18888
- /* overflow:hidden on [data-text-overflow] would clip the absolutely
18889
- positioned skeleton span — keep it visible */
18890
- overflow: visible;
18884
+ &[data-skeleton] {
18885
+ --x-border-radius: 0.2em;
18891
18886
 
18892
- .navi_text_overflow_wrapper {
18893
- display: contents;
18894
- .navi_text_overflow_text {
18895
- display: contents;
18887
+ /* Children stay in the DOM to preserve natural layout dimensions,
18888
+ but are hidden so only the skeleton is visible. */
18889
+ visibility: hidden;
18896
18890
 
18897
- max-width: none;
18898
- text-overflow: clip;
18899
- overflow: visible;
18900
- }
18891
+ /* When there are no children a placeholder "W" is injected (see JSX).
18892
+ It must stretch to the full available width so the skeleton
18893
+ fills the container rather than collapsing to a single character. */
18894
+ .navi_text_skeleton_children_placeholder {
18895
+ display: inline-flex;
18896
+ width: 100%;
18901
18897
  }
18902
- }
18903
18898
 
18904
- &[data-skeleton] {
18905
- /* Keep layout space — children are hidden, skeleton overlays absolutely */
18906
- visibility: hidden;
18899
+ /* Three-level structure to respect padding AND border-radius:
18900
+
18901
+ 1. navi_text_skeleton_container — absolutely fills the border box
18902
+ (inset:0), then applies padding:inherit so its content box equals
18903
+ the parent's content box. line-height:normal prevents the container
18904
+ from inheriting a large line-height that would make it taller than
18905
+ the border box. border-radius:inherit passes the radius down.
18906
+ visibility:visible overrides the parent's visibility:hidden.
18907
+
18908
+ 2. navi_text_skeleton_inset — a relative block that fills 100% of the
18909
+ container's content box (= parent's content box). It is the
18910
+ positioned ancestor for the absolutely placed skeleton bar.
18911
+ border-radius:inherit chains the radius further down.
18912
+
18913
+ 3. navi_text_skeleton — the visible gradient bar. position:absolute
18914
+ inset:0 fills the inset box precisely. border-radius:inherit
18915
+ finally applies the radius at this level, which is now correctly
18916
+ sized to the content area. */
18917
+ .navi_text_skeleton_container {
18918
+ position: absolute;
18919
+ inset: 0;
18920
+ padding: inherit;
18921
+ line-height: normal;
18922
+ border-radius: inherit;
18923
+ visibility: visible;
18924
+ }
18925
+
18926
+ .navi_text_skeleton_inset {
18927
+ position: relative;
18928
+ display: inline-flex;
18929
+ width: 100%;
18930
+ height: 100%;
18931
+ border-radius: inherit;
18932
+ }
18907
18933
 
18908
18934
  .navi_text_skeleton {
18909
18935
  position: absolute;
18910
18936
  inset: 0;
18911
- /* top/bottom inset may not perfectly align with text bounds — acceptable */
18912
18937
  background: linear-gradient(
18913
18938
  90deg,
18914
18939
  #e0e0e0 25%,
@@ -18916,14 +18941,7 @@ const css$3 = /* css */`
18916
18941
  #e0e0e0 75%
18917
18942
  );
18918
18943
  background-size: 200% 100%;
18919
- border-radius: 4px;
18920
- visibility: visible;
18921
- }
18922
-
18923
- &[data-empty] {
18924
- .navi_text_skeleton {
18925
- height: 1em;
18926
- }
18944
+ border-radius: inherit;
18927
18945
  }
18928
18946
 
18929
18947
  &[data-loading] {
@@ -19126,25 +19144,32 @@ const TextSkeleton = ({
19126
19144
  children,
19127
19145
  ...props
19128
19146
  }) => {
19129
- const skeletonSpan = jsx("span", {
19130
- className: "navi_text_skeleton",
19131
- "aria-hidden": "true"
19147
+ // Three-level structure see CSS comment on [data-skeleton] for details.
19148
+ const skeletonOverlay = jsx("span", {
19149
+ className: "navi_text_skeleton_container",
19150
+ "aria-hidden": "true",
19151
+ children: jsx("span", {
19152
+ className: "navi_text_skeleton_inset",
19153
+ children: jsx("span", {
19154
+ className: "navi_text_skeleton"
19155
+ })
19156
+ })
19132
19157
  });
19133
- // When there are no children we inject an invisible "W" so the element takes
19134
- // its natural text height (matching current font-size) instead of relying on
19135
- // min-height which can be off. The W is hidden via CSS visibility:hidden.
19158
+ // When there are no children, inject a full-width placeholder so the element
19159
+ // has measurable height driven by the current font-size/line-height, and the
19160
+ // skeleton fills the available width instead of shrinking to a single char.
19136
19161
  const hasChildren = children !== null && children !== undefined && children !== false;
19137
19162
  const innerChildren = hasChildren ? children : jsx("span", {
19163
+ className: "navi_text_skeleton_children_placeholder",
19138
19164
  "aria-hidden": "true",
19139
19165
  children: "W"
19140
19166
  });
19141
19167
  return jsx(Text, {
19142
19168
  "data-skeleton": "",
19143
19169
  "data-loading": loading ? "" : undefined,
19144
- "data-empty": !hasChildren ? "" : undefined,
19145
19170
  ...props,
19146
19171
  skeleton: undefined,
19147
- childrenOutsideFlow: skeletonSpan,
19172
+ childrenOutsideFlow: skeletonOverlay,
19148
19173
  children: innerChildren
19149
19174
  });
19150
19175
  };