@jsenv/navi 0.29.377 → 0.29.379
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/dev/jsenv_navi.js +87 -11
- package/dist/dev/jsenv_navi.js.map +7 -7
- package/dist/jsenv_navi.js +81 -11
- package/dist/jsenv_navi.js.map +7 -7
- package/docs/AI_INSTRUCTIONS.md +3 -1
- package/docs/popup_lift.md +5 -1
- package/docs/typography.md +28 -3
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -44197,6 +44197,10 @@ time.navi_text {
|
|
|
44197
44197
|
border-radius: inherit;
|
|
44198
44198
|
}
|
|
44199
44199
|
|
|
44200
|
+
&[data-text-clamp] {
|
|
44201
|
+
min-width: 0;
|
|
44202
|
+
}
|
|
44203
|
+
|
|
44200
44204
|
&[data-text-overflow] {
|
|
44201
44205
|
text-overflow: ellipsis;
|
|
44202
44206
|
overflow-wrap: normal;
|
|
@@ -44570,6 +44574,10 @@ const shouldInjectSpacingBetween = (left, right) => {
|
|
|
44570
44574
|
* n lines. This is the only prop to use for that — `Box`'s `lineClamp` /
|
|
44571
44575
|
* `overflowEllipsis` are raw CSS mappings meant for elements that are not a
|
|
44572
44576
|
* `Text`, and `lineClamp={1}` is never the single-line truncation you want.
|
|
44577
|
+
* Either value states the `white-space` it needs — one line does not wrap,
|
|
44578
|
+
* n lines may — so it holds inside a single-line ancestor too (a `Picker`'s
|
|
44579
|
+
* value, a `Time`); an explicit `noWrap`/`pre`/`preLine` on this `Text`
|
|
44580
|
+
* still wins.
|
|
44573
44581
|
* Truncation only happens if the element may become narrower than its
|
|
44574
44582
|
* content: `maxLines` sets `min-width: 0` here, but each `Box` between this
|
|
44575
44583
|
* one and the element that carries the width must set it too.
|
|
@@ -44632,6 +44640,25 @@ const shouldInjectSpacingBetween = (left, right) => {
|
|
|
44632
44640
|
* internally for overlays such as the skeleton container.
|
|
44633
44641
|
*/
|
|
44634
44642
|
const Text = props => {
|
|
44643
|
+
if (props.maxLines > 1) {
|
|
44644
|
+
props = {
|
|
44645
|
+
...props,
|
|
44646
|
+
"data-text-clamp": ""
|
|
44647
|
+
};
|
|
44648
|
+
if (!saysWhiteSpace(props)) {
|
|
44649
|
+
// n lines means "you may wrap". white-space is inherited, so left unsaid
|
|
44650
|
+
// a single-line ancestor (a Picker's value, a Time) leaves the clamp one
|
|
44651
|
+
// line to cut, and the text runs past its box. Same tag rule as
|
|
44652
|
+
// TextOverflow: a paragraph keeps its line breaks.
|
|
44653
|
+
props = props.as === "p" ? {
|
|
44654
|
+
...props,
|
|
44655
|
+
preLine: true
|
|
44656
|
+
} : {
|
|
44657
|
+
...props,
|
|
44658
|
+
noWrap: false
|
|
44659
|
+
};
|
|
44660
|
+
}
|
|
44661
|
+
}
|
|
44635
44662
|
if (props.loading || props.skeleton) {
|
|
44636
44663
|
return jsx(TextSkeleton, {
|
|
44637
44664
|
...props
|
|
@@ -44843,6 +44870,14 @@ const TextOverflow = ({
|
|
|
44843
44870
|
children: children
|
|
44844
44871
|
});
|
|
44845
44872
|
};
|
|
44873
|
+
const saysWhiteSpace = ({
|
|
44874
|
+
noWrap,
|
|
44875
|
+
pre,
|
|
44876
|
+
preWrap,
|
|
44877
|
+
preLine
|
|
44878
|
+
}) => {
|
|
44879
|
+
return noWrap !== undefined || pre !== undefined || preWrap !== undefined || preLine !== undefined;
|
|
44880
|
+
};
|
|
44846
44881
|
const TextWithSelectRange = ({
|
|
44847
44882
|
ref,
|
|
44848
44883
|
selectRange,
|
|
@@ -58815,9 +58850,11 @@ const TimeRelative = ({
|
|
|
58815
58850
|
});
|
|
58816
58851
|
};
|
|
58817
58852
|
const TimeText = props => {
|
|
58853
|
+
// A date stays on one line, unless the caller grants it several.
|
|
58854
|
+
const noWrap = props.maxLines > 1 ? undefined : true;
|
|
58818
58855
|
return jsx(Text, {
|
|
58819
58856
|
as: "time",
|
|
58820
|
-
noWrap:
|
|
58857
|
+
noWrap: noWrap,
|
|
58821
58858
|
...props
|
|
58822
58859
|
});
|
|
58823
58860
|
};
|
|
@@ -60031,6 +60068,10 @@ const ROOT_ATTRIBUTE = "data-navi-popup-lift";
|
|
|
60031
60068
|
// What the two boxes are to each other (Dialog's `lift`: "box" | "scene"),
|
|
60032
60069
|
// worn by the root too — it decides how each picture sits in the moving box.
|
|
60033
60070
|
const KIND_ATTRIBUTE = "data-navi-popup-lift-kind";
|
|
60071
|
+
// Worn by the root when the two pictures fit the moving box the whole way
|
|
60072
|
+
// (see picturesFitTheBox): the box's edge then has nothing to cut but the
|
|
60073
|
+
// pictures' own ink — a halo, a shadow — and the CSS lets it through.
|
|
60074
|
+
const FIT_ATTRIBUTE = "data-navi-popup-lift-fit";
|
|
60034
60075
|
// The one node that IS the anchor once in front: the popup itself, or a node
|
|
60035
60076
|
// inside it.
|
|
60036
60077
|
const TARGET_SELECTOR = "[data-lift]";
|
|
@@ -60150,6 +60191,7 @@ const liftPopupFromAnchor = (
|
|
|
60150
60191
|
giveBackNameArriving?.();
|
|
60151
60192
|
root.removeAttribute(ROOT_ATTRIBUTE);
|
|
60152
60193
|
root.removeAttribute(KIND_ATTRIBUTE);
|
|
60194
|
+
root.removeAttribute(FIT_ATTRIBUTE);
|
|
60153
60195
|
root.style.removeProperty(DURATION_PROPERTY);
|
|
60154
60196
|
root.style.removeProperty(BORDER_RADIUS_PROPERTY);
|
|
60155
60197
|
root.style.removeProperty(BACKGROUND_COLOR_PROPERTY);
|
|
@@ -60161,7 +60203,7 @@ const liftPopupFromAnchor = (
|
|
|
60161
60203
|
releaseScrollHold?.();
|
|
60162
60204
|
releaseScrollHold = trapScrollInside(popupEl, { backdrop: true });
|
|
60163
60205
|
const room = measureRoomBetweenBars();
|
|
60164
|
-
const boxLeaving =
|
|
60206
|
+
const boxLeaving = elementLeaving.getBoundingClientRect();
|
|
60165
60207
|
let boxArriving = null;
|
|
60166
60208
|
let cornersArriving = null;
|
|
60167
60209
|
const viewTransition = startViewTransition(async () => {
|
|
@@ -60179,8 +60221,9 @@ const liftPopupFromAnchor = (
|
|
|
60179
60221
|
if (elementArriving) {
|
|
60180
60222
|
giveBackNameArriving = wearLiftName(elementArriving);
|
|
60181
60223
|
cornersArriving = readCorners(elementArriving);
|
|
60182
|
-
|
|
60183
|
-
|
|
60224
|
+
boxArriving = elementArriving.getBoundingClientRect();
|
|
60225
|
+
if (picturesFitTheBox(lift, boxLeaving, boxArriving)) {
|
|
60226
|
+
root.setAttribute(FIT_ATTRIBUTE, "");
|
|
60184
60227
|
}
|
|
60185
60228
|
}
|
|
60186
60229
|
});
|
|
@@ -60449,6 +60492,30 @@ const animateMovingBox = ({ cornersFrom, cornersTo, room, boxFrom, boxTo }) => {
|
|
|
60449
60492
|
});
|
|
60450
60493
|
};
|
|
60451
60494
|
|
|
60495
|
+
// Whether both pictures fit the moving box from one end to the other. The
|
|
60496
|
+
// box's clip (dialog.jsx) is its edge for a picture larger than the box: what
|
|
60497
|
+
// a card gaining room uncovers, what a scene shows past the band cut from it.
|
|
60498
|
+
// Under "box" each picture keeps its own size, so both fit only when the two
|
|
60499
|
+
// boxes are the same size; under "scene" both are drawn as wide as the box
|
|
60500
|
+
// and centred, so they fit when the two boxes have the same aspect ratio —
|
|
60501
|
+
// each picture, drawn at the other box's width, is then that box's height.
|
|
60502
|
+
// A picture's ink past its own box (a halo, a shadow) is not content the clip
|
|
60503
|
+
// is there to cut, so when they fit, the clip is lifted.
|
|
60504
|
+
const picturesFitTheBox = (lift, boxFrom, boxTo) => {
|
|
60505
|
+
if (lift === "scene") {
|
|
60506
|
+
const heightFromAtWidthTo = (boxTo.width * boxFrom.height) / boxFrom.width;
|
|
60507
|
+
const heightToAtWidthFrom = (boxFrom.width * boxTo.height) / boxTo.width;
|
|
60508
|
+
return (
|
|
60509
|
+
Math.abs(heightFromAtWidthTo - boxTo.height) < 1 &&
|
|
60510
|
+
Math.abs(heightToAtWidthFrom - boxFrom.height) < 1
|
|
60511
|
+
);
|
|
60512
|
+
}
|
|
60513
|
+
return (
|
|
60514
|
+
Math.abs(boxFrom.width - boxTo.width) < 1 &&
|
|
60515
|
+
Math.abs(boxFrom.height - boxTo.height) < 1
|
|
60516
|
+
);
|
|
60517
|
+
};
|
|
60518
|
+
|
|
60452
60519
|
const insetToRoom = (room, box) =>
|
|
60453
60520
|
`inset(${room.top - box.top}px ${box.right - room.right}px ${box.bottom - room.bottom}px ${room.left - box.left}px)`;
|
|
60454
60521
|
|
|
@@ -61097,6 +61164,12 @@ const css$E = /* css */`
|
|
|
61097
61164
|
the box, and a change of width would read as the same card zooming
|
|
61098
61165
|
then swapping.
|
|
61099
61166
|
|
|
61167
|
+
A picture holds the element's ink past its own box too — a halo, a
|
|
61168
|
+
shadow — and the clip cuts that along with the content, at the box's
|
|
61169
|
+
corners. When both pictures fit the box the whole way (popup_lift.js,
|
|
61170
|
+
picturesFitTheBox) there is no content to uncover, only ink to lose:
|
|
61171
|
+
the clip is lifted and the box carries its ink along.
|
|
61172
|
+
|
|
61100
61173
|
The box paints what the lifted card paints behind its content
|
|
61101
61174
|
(published by popup_lift.js): where it has grown past the picture it
|
|
61102
61175
|
carries, it is the card that has grown. Its corners are those of the
|
|
@@ -61114,6 +61187,9 @@ const css$E = /* css */`
|
|
|
61114
61187
|
block-size: auto;
|
|
61115
61188
|
inline-size: auto;
|
|
61116
61189
|
}
|
|
61190
|
+
&[data-navi-popup-lift-fit]::view-transition-image-pair(navi-popup-lift) {
|
|
61191
|
+
overflow: visible;
|
|
61192
|
+
}
|
|
61117
61193
|
|
|
61118
61194
|
/* The card leaves as itself and arrives as what it became: the picture
|
|
61119
61195
|
being left stays whole for most of the way, the arriving one only shows
|
|
@@ -76071,13 +76147,7 @@ const renderDayDefault = (day, {
|
|
|
76071
76147
|
type: "date",
|
|
76072
76148
|
format: format,
|
|
76073
76149
|
dayLabel: true,
|
|
76074
|
-
lang: lang
|
|
76075
|
-
// A Time keeps its date on one line by default; here a day too long for
|
|
76076
|
-
// the box is meant to wrap, so that is undone — except for maxLines={1},
|
|
76077
|
-
// which IS one line and cuts it itself (see Text's own TextOverflow):
|
|
76078
|
-
// saying "you may wrap" there would undo the truncation instead.
|
|
76079
|
-
,
|
|
76080
|
-
noWrap: maxLines === 1 || maxLines === "1" ? undefined : false,
|
|
76150
|
+
lang: lang,
|
|
76081
76151
|
maxLines: maxLines,
|
|
76082
76152
|
children: day
|
|
76083
76153
|
});
|