@jsenv/navi 0.21.4 → 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.
- package/dist/jsenv_navi.js +103 -37
- package/dist/jsenv_navi.js.map +11 -10
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -18829,10 +18829,7 @@ const css$3 = /* css */`
|
|
|
18829
18829
|
|
|
18830
18830
|
.navi_text {
|
|
18831
18831
|
position: relative;
|
|
18832
|
-
|
|
18833
|
-
&[data-has-absolute-child] {
|
|
18834
|
-
display: inline-block;
|
|
18835
|
-
}
|
|
18832
|
+
border-radius: var(--x-border-radius);
|
|
18836
18833
|
|
|
18837
18834
|
/* There is a chrome specific bug that prevents text-transform: capitalize to be applied in nested DOM structure */
|
|
18838
18835
|
/* The CSS below ensure capitalize is propagated to the bold clones */
|
|
@@ -18865,6 +18862,7 @@ const css$3 = /* css */`
|
|
|
18865
18862
|
}
|
|
18866
18863
|
|
|
18867
18864
|
&[data-text-overflow] {
|
|
18865
|
+
min-width: 0;
|
|
18868
18866
|
flex-wrap: wrap;
|
|
18869
18867
|
text-overflow: ellipsis;
|
|
18870
18868
|
overflow: hidden;
|
|
@@ -18882,20 +18880,78 @@ const css$3 = /* css */`
|
|
|
18882
18880
|
}
|
|
18883
18881
|
}
|
|
18884
18882
|
}
|
|
18885
|
-
}
|
|
18886
18883
|
|
|
18887
|
-
|
|
18888
|
-
|
|
18889
|
-
width: 100%;
|
|
18890
|
-
height: 1em;
|
|
18891
|
-
background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
|
|
18892
|
-
background-size: 200% 100%;
|
|
18893
|
-
border-radius: 4px;
|
|
18884
|
+
&[data-skeleton] {
|
|
18885
|
+
--x-border-radius: 0.2em;
|
|
18894
18886
|
|
|
18895
|
-
|
|
18896
|
-
|
|
18887
|
+
/* Children stay in the DOM to preserve natural layout dimensions,
|
|
18888
|
+
but are hidden so only the skeleton is visible. */
|
|
18889
|
+
visibility: hidden;
|
|
18890
|
+
|
|
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%;
|
|
18897
|
+
}
|
|
18898
|
+
|
|
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
|
+
}
|
|
18933
|
+
|
|
18934
|
+
.navi_text_skeleton {
|
|
18935
|
+
position: absolute;
|
|
18936
|
+
inset: 0;
|
|
18937
|
+
background: linear-gradient(
|
|
18938
|
+
90deg,
|
|
18939
|
+
#e0e0e0 25%,
|
|
18940
|
+
#f0f0f0 50%,
|
|
18941
|
+
#e0e0e0 75%
|
|
18942
|
+
);
|
|
18943
|
+
background-size: 200% 100%;
|
|
18944
|
+
border-radius: inherit;
|
|
18945
|
+
}
|
|
18946
|
+
|
|
18947
|
+
&[data-loading] {
|
|
18948
|
+
.navi_text_skeleton {
|
|
18949
|
+
animation: navi_text_skeleton_shimmer 1.5s infinite;
|
|
18950
|
+
}
|
|
18951
|
+
}
|
|
18897
18952
|
}
|
|
18898
18953
|
}
|
|
18954
|
+
|
|
18899
18955
|
@keyframes navi_text_skeleton_shimmer {
|
|
18900
18956
|
0% {
|
|
18901
18957
|
background-position: 200% 0;
|
|
@@ -18905,9 +18961,6 @@ const css$3 = /* css */`
|
|
|
18905
18961
|
}
|
|
18906
18962
|
}
|
|
18907
18963
|
|
|
18908
|
-
.navi_custom_space {
|
|
18909
|
-
}
|
|
18910
|
-
|
|
18911
18964
|
.navi_text_bold_wrapper {
|
|
18912
18965
|
position: relative;
|
|
18913
18966
|
display: inline-block;
|
|
@@ -19062,21 +19115,14 @@ const shouldInjectSpacingBetween = (left, right) => {
|
|
|
19062
19115
|
const OverflowPinnedElementContext = createContext(null);
|
|
19063
19116
|
const Text = props => {
|
|
19064
19117
|
import.meta.css = [css$3, "@jsenv/navi/src/text/text.jsx"];
|
|
19065
|
-
|
|
19066
|
-
overflowEllipsis,
|
|
19067
|
-
loading,
|
|
19068
|
-
skeleton,
|
|
19069
|
-
...rest
|
|
19070
|
-
} = props;
|
|
19071
|
-
if (loading || skeleton) {
|
|
19118
|
+
if (props.loading || props.skeleton) {
|
|
19072
19119
|
return jsx(TextSkeleton, {
|
|
19073
|
-
|
|
19074
|
-
...rest
|
|
19120
|
+
...props
|
|
19075
19121
|
});
|
|
19076
19122
|
}
|
|
19077
|
-
if (overflowEllipsis) {
|
|
19123
|
+
if (props.overflowEllipsis) {
|
|
19078
19124
|
return jsx(TextOverflow, {
|
|
19079
|
-
...
|
|
19125
|
+
...props
|
|
19080
19126
|
});
|
|
19081
19127
|
}
|
|
19082
19128
|
if (props.overflowPinned) {
|
|
@@ -19095,16 +19141,36 @@ const Text = props => {
|
|
|
19095
19141
|
};
|
|
19096
19142
|
const TextSkeleton = ({
|
|
19097
19143
|
loading,
|
|
19144
|
+
children,
|
|
19098
19145
|
...props
|
|
19099
19146
|
}) => {
|
|
19100
|
-
|
|
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
|
+
})
|
|
19157
|
+
});
|
|
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.
|
|
19161
|
+
const hasChildren = children !== null && children !== undefined && children !== false;
|
|
19162
|
+
const innerChildren = hasChildren ? children : jsx("span", {
|
|
19163
|
+
className: "navi_text_skeleton_children_placeholder",
|
|
19164
|
+
"aria-hidden": "true",
|
|
19165
|
+
children: "W"
|
|
19166
|
+
});
|
|
19167
|
+
return jsx(Text, {
|
|
19168
|
+
"data-skeleton": "",
|
|
19169
|
+
"data-loading": loading ? "" : undefined,
|
|
19101
19170
|
...props,
|
|
19102
|
-
|
|
19103
|
-
|
|
19104
|
-
|
|
19105
|
-
,
|
|
19106
|
-
|
|
19107
|
-
children: undefined
|
|
19171
|
+
skeleton: undefined,
|
|
19172
|
+
childrenOutsideFlow: skeletonOverlay,
|
|
19173
|
+
children: innerChildren
|
|
19108
19174
|
});
|
|
19109
19175
|
};
|
|
19110
19176
|
const TextOverflow = ({
|
|
@@ -19125,7 +19191,8 @@ const TextOverflow = ({
|
|
|
19125
19191
|
|
|
19126
19192
|
preLine: rest.as === "p",
|
|
19127
19193
|
...rest,
|
|
19128
|
-
|
|
19194
|
+
overflowEllipsis: undefined,
|
|
19195
|
+
"data-text-overflow": "",
|
|
19129
19196
|
spacing: "pre",
|
|
19130
19197
|
children: jsxs("span", {
|
|
19131
19198
|
className: "navi_text_overflow_wrapper",
|
|
@@ -19203,7 +19270,6 @@ const TextBasic = ({
|
|
|
19203
19270
|
...boxProps,
|
|
19204
19271
|
bold: undefined,
|
|
19205
19272
|
"data-bold": bold ? "" : undefined,
|
|
19206
|
-
"data-has-absolute-child": "",
|
|
19207
19273
|
children: [jsx("span", {
|
|
19208
19274
|
className: "navi_text_bold_background",
|
|
19209
19275
|
"aria-hidden": "true",
|