@jsenv/navi 0.29.356 → 0.29.357
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 +32 -11
- package/dist/dev/jsenv_navi.js.map +5 -5
- package/dist/jsenv_navi.js +11 -11
- package/dist/jsenv_navi.js.map +5 -5
- package/docs/popup_lift.md +3 -0
- package/package.json +1 -1
package/dist/dev/jsenv_navi.js
CHANGED
|
@@ -6975,7 +6975,7 @@ const css$13 = /* css */ `
|
|
|
6975
6975
|
* for free (`status`/`alert`); reach for this when the role is not enough to tell two
|
|
6976
6976
|
* callouts apart.
|
|
6977
6977
|
* @param {Function} [options.onClose] - Callback when callout is closed
|
|
6978
|
-
* @param {boolean} [options.
|
|
6978
|
+
* @param {boolean} [options.closeByPressOutside] - Whether a press outside closes the callout (defaults to true for "info" status)
|
|
6979
6979
|
* @param {boolean|number} [options.closeByScroll=false] - Dismiss the callout once the page has
|
|
6980
6980
|
* scrolled under it. `true` uses a short distance, a number sets it in pixels
|
|
6981
6981
|
* (`closeByScroll: 100` waits for 100px). Measured from where the scroll containers stood when
|
|
@@ -7043,15 +7043,15 @@ const openCallout = (
|
|
|
7043
7043
|
status = "",
|
|
7044
7044
|
testId,
|
|
7045
7045
|
onClose,
|
|
7046
|
-
|
|
7047
|
-
closeOnFocusLeave =
|
|
7046
|
+
closeByPressOutside = status === "info",
|
|
7047
|
+
closeOnFocusLeave = closeByPressOutside,
|
|
7048
7048
|
closeByScroll = false,
|
|
7049
|
+
closeButton = true,
|
|
7049
7050
|
openingEvent,
|
|
7050
7051
|
reopen = "toggle",
|
|
7051
7052
|
showErrorStack,
|
|
7052
7053
|
skipFocus = false,
|
|
7053
7054
|
icon = true,
|
|
7054
|
-
closeButton = true,
|
|
7055
7055
|
debug = () => {},
|
|
7056
7056
|
} = {},
|
|
7057
7057
|
) => {
|
|
@@ -7139,7 +7139,7 @@ const openCallout = (
|
|
|
7139
7139
|
const clickOrSpaceOutside =
|
|
7140
7140
|
reason === "click_outside" || reason === "space_outside";
|
|
7141
7141
|
if (clickOrSpaceOutside) {
|
|
7142
|
-
if (!
|
|
7142
|
+
if (!closeByPressOutside) {
|
|
7143
7143
|
return;
|
|
7144
7144
|
}
|
|
7145
7145
|
if (callout.status === "error") {
|
|
@@ -7267,9 +7267,9 @@ const openCallout = (
|
|
|
7267
7267
|
updateStatus(options.status);
|
|
7268
7268
|
}
|
|
7269
7269
|
|
|
7270
|
-
if (Object.hasOwn(options, "
|
|
7271
|
-
|
|
7272
|
-
if (
|
|
7270
|
+
if (Object.hasOwn(options, "closeByPressOutside")) {
|
|
7271
|
+
closeByPressOutside = options.closeByPressOutside;
|
|
7272
|
+
if (closeByPressOutside) {
|
|
7273
7273
|
closeOnFocusLeave = true;
|
|
7274
7274
|
}
|
|
7275
7275
|
}
|
|
@@ -7473,7 +7473,7 @@ const openCallout = (
|
|
|
7473
7473
|
const openingDownEvent =
|
|
7474
7474
|
findEvent(openingEvent, "mousedown") ||
|
|
7475
7475
|
findEvent(openingEvent, "pointerdown");
|
|
7476
|
-
if (
|
|
7476
|
+
if (closeByPressOutside && openingEvent && openingDownEvent) {
|
|
7477
7477
|
const upType =
|
|
7478
7478
|
openingDownEvent.type === "pointerdown" ? "pointerup" : "mouseup";
|
|
7479
7479
|
debug(
|
|
@@ -8718,7 +8718,7 @@ const createCalloutManager = (
|
|
|
8718
8718
|
testId: tokenData.testId,
|
|
8719
8719
|
icon: tokenData.icon,
|
|
8720
8720
|
closeButton: tokenData.closeButton,
|
|
8721
|
-
|
|
8721
|
+
closeByPressOutside: tokenData.status !== "error",
|
|
8722
8722
|
closeByScroll: tokenData.closeByScroll,
|
|
8723
8723
|
anchorElement,
|
|
8724
8724
|
openingEvent: event,
|
|
@@ -12618,7 +12618,7 @@ defineInteractionDetector({
|
|
|
12618
12618
|
// button to press, and what closes it is the hand going quiet.
|
|
12619
12619
|
skipFocus: true,
|
|
12620
12620
|
closeButton: false,
|
|
12621
|
-
|
|
12621
|
+
closeByPressOutside: false,
|
|
12622
12622
|
closeOnFocusLeave: false,
|
|
12623
12623
|
onClose: () => {
|
|
12624
12624
|
hint = null;
|
|
@@ -60461,6 +60461,9 @@ const liftPopupFromAnchor = (
|
|
|
60461
60461
|
popupEl.removeAttribute(ARRIVING_ATTRIBUTE);
|
|
60462
60462
|
};
|
|
60463
60463
|
const liftTarget = (target) => {
|
|
60464
|
+
if (lift === "box") {
|
|
60465
|
+
warnDrawingLiftedAsBox(target);
|
|
60466
|
+
}
|
|
60464
60467
|
publishBoxPaint(target);
|
|
60465
60468
|
startMovement(reveal, () => target);
|
|
60466
60469
|
};
|
|
@@ -60484,6 +60487,24 @@ const liftPopupFromAnchor = (
|
|
|
60484
60487
|
});
|
|
60485
60488
|
};
|
|
60486
60489
|
|
|
60490
|
+
// A drawing under lift="box" is drawn at its own size in a box that is not:
|
|
60491
|
+
// the big picture cropped to a corner of the shrinking box, the small one
|
|
60492
|
+
// riding a corner of the growing box, then a swap. Nothing about it errors,
|
|
60493
|
+
// and at normal speed it only reads as a jolt, so it is named here.
|
|
60494
|
+
const DRAWING_SELECTOR = "svg, img, picture, canvas, video";
|
|
60495
|
+
const warnDrawingLiftedAsBox = (liftedElement) => {
|
|
60496
|
+
let current = liftedElement;
|
|
60497
|
+
while (current) {
|
|
60498
|
+
if (current.matches(DRAWING_SELECTOR)) {
|
|
60499
|
+
console.warn(
|
|
60500
|
+
`[navi] animation="lifting" with lift="box" lifts a <${current.localName}>: its pictures keep their own size while the box moving between them changes size, so the drawing is cropped then swapped rather than scaled. For a drawing, a photo or a video, use lift="scene".`,
|
|
60501
|
+
);
|
|
60502
|
+
return;
|
|
60503
|
+
}
|
|
60504
|
+
current = sameBoxChild(current);
|
|
60505
|
+
}
|
|
60506
|
+
};
|
|
60507
|
+
|
|
60487
60508
|
const publishBoxPaint = (liftedElement) => {
|
|
60488
60509
|
const { backgroundColor, backgroundImage } = getComputedStyle(
|
|
60489
60510
|
findPaintedBox(liftedElement),
|