@jsenv/navi 0.29.338 → 0.29.340
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 +94 -54
- package/dist/dev/jsenv_navi.js.map +4 -4
- package/dist/jsenv_navi.js +88 -50
- package/dist/jsenv_navi.js.map +4 -4
- package/docs/popup_lift.md +12 -4
- package/package.json +1 -1
package/dist/dev/jsenv_navi.js
CHANGED
|
@@ -59916,7 +59916,7 @@ const clipOf = (side, distance) => {
|
|
|
59916
59916
|
* the root's picture (see the CSS in dialog.jsx). The fixed bars are part of
|
|
59917
59917
|
* that picture, under the wall like the rest of the page. The popup is placed
|
|
59918
59918
|
* between the bars, and its picture keeps to the room between them on the
|
|
59919
|
-
* way as well: the moving box is clipped to that room (
|
|
59919
|
+
* way as well: the moving box is clipped to that room (animateMovingBox),
|
|
59920
59920
|
* so a card half under the bottom bar leaves from under it and comes back
|
|
59921
59921
|
* under it.
|
|
59922
59922
|
*/
|
|
@@ -59954,22 +59954,29 @@ const DURATION_PROPERTY = "--navi-popup-lift-duration";
|
|
|
59954
59954
|
// The fixed bars (fixed_bar.jsx): the popup is placed in the room between
|
|
59955
59955
|
// them, and the moving picture is clipped to that room on the way.
|
|
59956
59956
|
const FIXED_BAR_SELECTOR = ".navi_fixed_bar";
|
|
59957
|
-
// The
|
|
59958
|
-
//
|
|
59959
|
-
//
|
|
59960
|
-
//
|
|
59961
|
-
//
|
|
59962
|
-
//
|
|
59963
|
-
// card, painting nothing of its own, while the lifted node IS the card.
|
|
59964
|
-
const BORDER_RADIUS_PROPERTY = "--navi-popup-lift-border-radius";
|
|
59957
|
+
// The paint of the lifted node, published the same way: the box wears the
|
|
59958
|
+
// card's own background, so where it has grown past the picture it carries it
|
|
59959
|
+
// is the card that has grown, not a picture fading into a bigger one. Read off
|
|
59960
|
+
// the lifted node rather than the anchor: the anchor is often a bare trigger
|
|
59961
|
+
// around the card, painting nothing of its own, while the lifted node IS the
|
|
59962
|
+
// card — and a card does not change colour on the way.
|
|
59965
59963
|
const BACKGROUND_COLOR_PROPERTY = "--navi-popup-lift-background-color";
|
|
59966
59964
|
const BACKGROUND_IMAGE_PROPERTY = "--navi-popup-lift-background-image";
|
|
59965
|
+
// The corners of the box the movement starts from, published the same way —
|
|
59966
|
+
// and, unlike the paint, not kept for the length of the movement: a corner is
|
|
59967
|
+
// written per box, on purpose, the same card at two sizes not wanting the same
|
|
59968
|
+
// round (a 6px corner stops showing on a big card). The moving box leaves with
|
|
59969
|
+
// the corners of the box it leaves and arrives with those of the box it
|
|
59970
|
+
// arrives on, the two authored values interpolated on the group's own clock
|
|
59971
|
+
// (see animateMovingBox).
|
|
59972
|
+
const BORDER_RADIUS_PROPERTY = "--navi-popup-lift-border-radius";
|
|
59967
59973
|
|
|
59968
59974
|
let releaseLiftInProgress = null;
|
|
59969
|
-
//
|
|
59970
|
-
//
|
|
59971
|
-
//
|
|
59972
|
-
|
|
59975
|
+
// What the moving box is told frame by frame on top of the browser's own morph
|
|
59976
|
+
// (animateMovingBox: its corners, its clip to the room between the bars),
|
|
59977
|
+
// cancelled with the movement so a finished one cannot go on applying its
|
|
59978
|
+
// last values to the next movement's picture.
|
|
59979
|
+
let boxAnimationInProgress = null;
|
|
59973
59980
|
// The page held still for the length of the movement. Its picture is frozen
|
|
59974
59981
|
// anyway, and the browser keeps following the live anchor: a scroll would
|
|
59975
59982
|
// carry the arriving box along under a page that does not move, and past the
|
|
@@ -60015,6 +60022,8 @@ const liftPopupFromAnchor = (
|
|
|
60015
60022
|
if (!opened) {
|
|
60016
60023
|
publishBoxPaint(elementLeaving);
|
|
60017
60024
|
}
|
|
60025
|
+
const cornersLeaving = readCorners(elementLeaving);
|
|
60026
|
+
root.style.setProperty(BORDER_RADIUS_PROPERTY, cornersLeaving);
|
|
60018
60027
|
|
|
60019
60028
|
let giveBackNameArriving = null;
|
|
60020
60029
|
let stopWaitingForTarget = null;
|
|
@@ -60024,8 +60033,8 @@ const liftPopupFromAnchor = (
|
|
|
60024
60033
|
}
|
|
60025
60034
|
releaseLiftInProgress = null;
|
|
60026
60035
|
stopWaitingForTarget?.();
|
|
60027
|
-
|
|
60028
|
-
|
|
60036
|
+
boxAnimationInProgress?.cancel();
|
|
60037
|
+
boxAnimationInProgress = null;
|
|
60029
60038
|
releaseScrollHold?.();
|
|
60030
60039
|
releaseScrollHold = null;
|
|
60031
60040
|
// Given up on, or replaced, while still waiting to be lifted: shown where
|
|
@@ -60048,6 +60057,7 @@ const liftPopupFromAnchor = (
|
|
|
60048
60057
|
const room = measureRoomBetweenBars();
|
|
60049
60058
|
const boxLeaving = room ? elementLeaving.getBoundingClientRect() : null;
|
|
60050
60059
|
let boxArriving = null;
|
|
60060
|
+
let cornersArriving = null;
|
|
60051
60061
|
const viewTransition = startViewTransition(() => {
|
|
60052
60062
|
// The name is the arriving box's from here on: worn by both, it is worn
|
|
60053
60063
|
// by neither. Written rather than removed, so a name the element also
|
|
@@ -60057,18 +60067,24 @@ const liftPopupFromAnchor = (
|
|
|
60057
60067
|
const elementArriving = resolveElementArriving();
|
|
60058
60068
|
if (elementArriving) {
|
|
60059
60069
|
giveBackNameArriving = wearLiftName(elementArriving);
|
|
60070
|
+
cornersArriving = readCorners(elementArriving);
|
|
60060
60071
|
if (room) {
|
|
60061
60072
|
boxArriving = elementArriving.getBoundingClientRect();
|
|
60062
60073
|
}
|
|
60063
60074
|
}
|
|
60064
60075
|
});
|
|
60065
|
-
|
|
60066
|
-
|
|
60067
|
-
|
|
60068
|
-
|
|
60069
|
-
|
|
60070
|
-
|
|
60071
|
-
|
|
60076
|
+
viewTransition.ready.then(() => {
|
|
60077
|
+
if (cornersArriving === null) {
|
|
60078
|
+
return;
|
|
60079
|
+
}
|
|
60080
|
+
animateMovingBox({
|
|
60081
|
+
cornersFrom: cornersLeaving,
|
|
60082
|
+
cornersTo: cornersArriving,
|
|
60083
|
+
room,
|
|
60084
|
+
boxFrom: boxLeaving,
|
|
60085
|
+
boxTo: boxArriving,
|
|
60086
|
+
});
|
|
60087
|
+
}, ignore);
|
|
60072
60088
|
viewTransition.finished.then(release, release);
|
|
60073
60089
|
};
|
|
60074
60090
|
|
|
@@ -60114,17 +60130,30 @@ const liftPopupFromAnchor = (
|
|
|
60114
60130
|
};
|
|
60115
60131
|
|
|
60116
60132
|
const publishBoxPaint = (liftedElement) => {
|
|
60117
|
-
const {
|
|
60133
|
+
const { backgroundColor, backgroundImage } = getComputedStyle(
|
|
60118
60134
|
findPaintedBox(liftedElement),
|
|
60119
60135
|
);
|
|
60120
60136
|
const root = document.documentElement;
|
|
60121
|
-
if (borderRadius) {
|
|
60122
|
-
root.style.setProperty(BORDER_RADIUS_PROPERTY, borderRadius);
|
|
60123
|
-
}
|
|
60124
60137
|
root.style.setProperty(BACKGROUND_COLOR_PROPERTY, backgroundColor);
|
|
60125
60138
|
root.style.setProperty(BACKGROUND_IMAGE_PROPERTY, backgroundImage);
|
|
60126
60139
|
};
|
|
60127
60140
|
|
|
60141
|
+
// The corners of a box: the first round found going down through children
|
|
60142
|
+
// that are the same box, the outermost one being what clips the others; a
|
|
60143
|
+
// bare trigger around a card carries its corners on itself or on the card,
|
|
60144
|
+
// and either is found. Square when none does.
|
|
60145
|
+
const readCorners = (element) => {
|
|
60146
|
+
let current = element;
|
|
60147
|
+
while (current) {
|
|
60148
|
+
const { borderRadius } = getComputedStyle(current);
|
|
60149
|
+
if (borderRadius && !/^(?:0px\s*)+$/.test(borderRadius)) {
|
|
60150
|
+
return borderRadius;
|
|
60151
|
+
}
|
|
60152
|
+
current = sameBoxChild(current);
|
|
60153
|
+
}
|
|
60154
|
+
return "0px";
|
|
60155
|
+
};
|
|
60156
|
+
|
|
60128
60157
|
// The lifted node is often a wrapper painting nothing, around the card that
|
|
60129
60158
|
// paints: what the moving box has to wear is the card's paint, found by going
|
|
60130
60159
|
// down through children that are the same box, until one paints.
|
|
@@ -60231,15 +60260,17 @@ const measureRoomBetweenBars = () => {
|
|
|
60231
60260
|
return room;
|
|
60232
60261
|
};
|
|
60233
60262
|
|
|
60234
|
-
//
|
|
60235
|
-
// the movement
|
|
60236
|
-
// the box
|
|
60237
|
-
//
|
|
60238
|
-
//
|
|
60239
|
-
//
|
|
60240
|
-
//
|
|
60241
|
-
//
|
|
60242
|
-
|
|
60263
|
+
// What the moving picture is told on top of the browser's own morph, from one
|
|
60264
|
+
// end of the movement to the other, on the group's own clock: its corners,
|
|
60265
|
+
// from those of the box it leaves to those of the box it arrives on; and, when
|
|
60266
|
+
// there are fixed bars, its clip to the room between them. The clip is written
|
|
60267
|
+
// in the moving box's own coordinates, and the box goes from one rectangle to
|
|
60268
|
+
// the other along the browser's own easing: each inset is an affine function
|
|
60269
|
+
// of that progress, so two keyframes with the group's timing follow the box
|
|
60270
|
+
// exactly, and a negative inset — the box clear of that bar — clips nothing.
|
|
60271
|
+
// The easing is the one on the group's keyframes: a CSS animation carries it
|
|
60272
|
+
// there, and the animation's own timing reads linear.
|
|
60273
|
+
const animateMovingBox = ({ cornersFrom, cornersTo, room, boxFrom, boxTo }) => {
|
|
60243
60274
|
const groupAnimation = document
|
|
60244
60275
|
.getAnimations()
|
|
60245
60276
|
.find(
|
|
@@ -60252,18 +60283,18 @@ const clipToRoomBetweenBars = (room, boxFrom, boxTo) => {
|
|
|
60252
60283
|
const { duration } = groupAnimation.effect.getTiming();
|
|
60253
60284
|
const [firstKeyframe] = groupAnimation.effect.getKeyframes();
|
|
60254
60285
|
const easing = firstKeyframe?.easing || "ease";
|
|
60255
|
-
|
|
60256
|
-
|
|
60257
|
-
|
|
60258
|
-
|
|
60259
|
-
|
|
60260
|
-
|
|
60261
|
-
|
|
60262
|
-
|
|
60263
|
-
|
|
60264
|
-
|
|
60265
|
-
}
|
|
60266
|
-
);
|
|
60286
|
+
const from = { borderRadius: cornersFrom, easing };
|
|
60287
|
+
const to = { borderRadius: cornersTo };
|
|
60288
|
+
if (room && boxFrom && boxTo) {
|
|
60289
|
+
from.clipPath = insetToRoom(room, boxFrom);
|
|
60290
|
+
to.clipPath = insetToRoom(room, boxTo);
|
|
60291
|
+
}
|
|
60292
|
+
boxAnimationInProgress?.cancel();
|
|
60293
|
+
boxAnimationInProgress = document.documentElement.animate([from, to], {
|
|
60294
|
+
duration,
|
|
60295
|
+
fill: "both",
|
|
60296
|
+
pseudoElement: `::view-transition-image-pair(${NAME})`,
|
|
60297
|
+
});
|
|
60267
60298
|
};
|
|
60268
60299
|
|
|
60269
60300
|
const insetToRoom = (room, box) =>
|
|
@@ -60892,8 +60923,11 @@ const css$E = /* css */`
|
|
|
60892
60923
|
then swapping.
|
|
60893
60924
|
|
|
60894
60925
|
The box paints what the lifted card paints behind its content
|
|
60895
|
-
(published by popup_lift.js
|
|
60896
|
-
|
|
60926
|
+
(published by popup_lift.js): where it has grown past the picture it
|
|
60927
|
+
carries, it is the card that has grown. Its corners are those of the
|
|
60928
|
+
box it leaves, and travel to those of the box it arrives on — a corner
|
|
60929
|
+
is written per box, the same card at two sizes not wanting the same
|
|
60930
|
+
round (see animateMovingBox in popup_lift.js). */
|
|
60897
60931
|
&::view-transition-image-pair(navi-popup-lift) {
|
|
60898
60932
|
background-image: var(--navi-popup-lift-background-image, none);
|
|
60899
60933
|
background-color: var(--navi-popup-lift-background-color, transparent);
|
|
@@ -73569,6 +73603,10 @@ const css$t = /* css */`@layer navi {
|
|
|
73569
73603
|
}
|
|
73570
73604
|
}
|
|
73571
73605
|
|
|
73606
|
+
&[data-open-on]:not([data-open-on~="single_click"]) {
|
|
73607
|
+
--x-picker-cursor: auto;
|
|
73608
|
+
}
|
|
73609
|
+
|
|
73572
73610
|
&[data-open-on~="longpress"] {
|
|
73573
73611
|
-webkit-touch-callout: none;
|
|
73574
73612
|
user-select: none;
|
|
@@ -73644,7 +73682,7 @@ const css$t = /* css */`@layer navi {
|
|
|
73644
73682
|
--x-picker-cursor: default;
|
|
73645
73683
|
}
|
|
73646
73684
|
|
|
73647
|
-
&[data-readonly-opens] {
|
|
73685
|
+
&[data-readonly-opens]:not([data-open-on]) {
|
|
73648
73686
|
--x-picker-cursor: pointer;
|
|
73649
73687
|
}
|
|
73650
73688
|
|
|
@@ -74621,10 +74659,12 @@ const PickerFirstResolver = props => {
|
|
|
74621
74659
|
* press a hold would have taken. A tap then opens nothing — the press stays
|
|
74622
74660
|
* free for what the `ui` holds: a link in the card navigates, a button in it
|
|
74623
74661
|
* presses, a picker in it opens on its own click, with nothing to declare
|
|
74624
|
-
* (`selfInteractions` is for a drawing that DOES open on the press).
|
|
74625
|
-
*
|
|
74626
|
-
* the
|
|
74627
|
-
*
|
|
74662
|
+
* (`selfInteractions` is for a drawing that DOES open on the press). The
|
|
74663
|
+
* trigger says so under the mouse too: it drops the hand cursor, which is
|
|
74664
|
+
* the press's promise, and every pixel of the drawing keeps the cursor it
|
|
74665
|
+
* would have on its own. That is what lets a whole card be a picker without
|
|
74666
|
+
* every touch on it opening the sheet — and the keyboard keeps its ways in
|
|
74667
|
+
* (Enter, Space, the arrows). A hold declared INSIDE the card (`interactions={{ longpress }}`
|
|
74628
74668
|
* on something it holds) answers before this one: the nearer hold takes the
|
|
74629
74669
|
* press, the way a click is the innermost target's. Being a gesture, the open goes through
|
|
74630
74670
|
* the interaction gate as one: a `readOnly` picker refuses it and says so
|