@jsenv/navi 0.29.368 → 0.29.370
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 +121 -0
- package/dist/dev/jsenv_navi.js.map +5 -4
- package/dist/jsenv_navi.js +121 -0
- package/dist/jsenv_navi.js.map +5 -4
- package/package.json +1 -1
package/dist/dev/jsenv_navi.js
CHANGED
|
@@ -89,6 +89,7 @@ const css$17 = /* css */ `@layer navi {
|
|
|
89
89
|
--navi-z-index-bar: 100;
|
|
90
90
|
--navi-z-index-popup: 1000;
|
|
91
91
|
--navi-z-index-callout: var(--navi-z-index-popup);
|
|
92
|
+
--navi-z-index-top-layer: 10000;
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
`;
|
|
@@ -29928,6 +29929,8 @@ const warnOnce$1 = (id, message) => {
|
|
|
29928
29929
|
console.warn(message);
|
|
29929
29930
|
};
|
|
29930
29931
|
|
|
29932
|
+
installImportMetaCssBuild(import.meta);
|
|
29933
|
+
|
|
29931
29934
|
/**
|
|
29932
29935
|
* The furniture around the pages — the fixed bars, and the popups standing
|
|
29933
29936
|
* over them in the top layer — photographed with them for the length of a
|
|
@@ -29975,6 +29978,27 @@ const warnOnce$1 = (id, message) => {
|
|
|
29975
29978
|
* that has nothing to do with it. Being unable to answer a press is the price
|
|
29976
29979
|
* of being photographed, and a route transition is where it costs nothing:
|
|
29977
29980
|
* both pages are pictures for those few hundred milliseconds anyway.
|
|
29981
|
+
*
|
|
29982
|
+
* The WALL of a popup goes the other way round: it is not photographed at
|
|
29983
|
+
* all. The top layer is drawn during a transition only as part of the root's
|
|
29984
|
+
* picture, which is opted out while an area is marked (route_transition.jsx),
|
|
29985
|
+
* and a modal dialog's wall is its ::backdrop — a pseudo-element, which wears
|
|
29986
|
+
* no name; a popover's is a real element, but named it would be a picture the
|
|
29987
|
+
* size of the screen, sliding across the page arriving. Captured on its own,
|
|
29988
|
+
* the popup's box travels; its wall is painted nowhere for the length of the
|
|
29989
|
+
* movement, and the page under it leaves undimmed. So the wall is painted
|
|
29990
|
+
* INTO the page's picture instead: a stand-in laid over the area before each
|
|
29991
|
+
* of the two pictures is taken, painting what the wall paints, and removed
|
|
29992
|
+
* with the movement. Carried by the page's picture, it leaves with the page
|
|
29993
|
+
* being left and arrives with the page arriving, cut at the page's edge — and
|
|
29994
|
+
* under the popup's own picture, which stands over the pages (the z-order in
|
|
29995
|
+
* route_transition.jsx). The bars are under the wall as much as the page is,
|
|
29996
|
+
* and each is a picture of its own: the same stand-in is laid over every bar
|
|
29997
|
+
* outside the area. A bar the two states share is one group with two
|
|
29998
|
+
* pictures — dimmed on the side that has a wall — and its cross-fade is the
|
|
29999
|
+
* wall fading out as the page leaves, or in as it arrives; a bar only one
|
|
30000
|
+
* state has carries the wall with it. A popup with layer="local" paints its
|
|
30001
|
+
* wall inside the page and needs none of this.
|
|
29978
30002
|
*/
|
|
29979
30003
|
|
|
29980
30004
|
// The browser's top layer: painted above everything the document paints, so
|
|
@@ -29992,6 +30016,43 @@ const FURNITURE_SELECTOR = `.navi_fixed_bar, .navi_popover:is(${TOP_LAYER_SELECT
|
|
|
29992
30016
|
const TRANSITION_ATTRIBUTE$1 = "data-navi-route-transition";
|
|
29993
30017
|
const NAME_PROPERTY$1 = "view-transition-name";
|
|
29994
30018
|
const FURNITURE_NAME_PREFIX = "navi-transition-furniture-";
|
|
30019
|
+
// The walls painted in the top layer: a modal dialog's, which is its
|
|
30020
|
+
// ::backdrop, and a popover's, which is a real element shown as a popover
|
|
30021
|
+
// beside it (layout/popover.jsx) — unnamed, so covered by the pictures for
|
|
30022
|
+
// the length of the movement all the same. A top-layer dialog without a wall
|
|
30023
|
+
// is shown as a popover and has nothing to stand in for.
|
|
30024
|
+
const TOP_LAYER_WALL_SELECTOR =
|
|
30025
|
+
".navi_dialog:modal, .navi_popover_backdrop:popover-open";
|
|
30026
|
+
const WALL_ATTRIBUTE = "data-navi-transition-wall";
|
|
30027
|
+
// What the wall paints, resolved on the matched element in both cases (the
|
|
30028
|
+
// dialog for its ::backdrop, the popover's wall for itself): the same two
|
|
30029
|
+
// properties, copied onto the stand-in.
|
|
30030
|
+
const WALL_PROPERTIES = ["--backdrop-background", "--backdrop-filter"];
|
|
30031
|
+
|
|
30032
|
+
// The pictures the wall is painted into: the pages', and every bar's own.
|
|
30033
|
+
const FIXED_BAR_SELECTOR$1 = ".navi_fixed_bar";
|
|
30034
|
+
|
|
30035
|
+
const TRANSITION_WALL_CSS = /* css */ `[data-navi-transition-wall] {
|
|
30036
|
+
z-index: var(--navi-z-index-top-layer);
|
|
30037
|
+
background: var(--backdrop-background);
|
|
30038
|
+
backdrop-filter: var(--backdrop-filter);
|
|
30039
|
+
pointer-events: none;
|
|
30040
|
+
position: absolute;
|
|
30041
|
+
top: 0;
|
|
30042
|
+
left: 0;
|
|
30043
|
+
}
|
|
30044
|
+
|
|
30045
|
+
:root:not(:active-view-transition) [data-navi-transition-wall] {
|
|
30046
|
+
display: none;
|
|
30047
|
+
}
|
|
30048
|
+
`;
|
|
30049
|
+
|
|
30050
|
+
// Called from the render of whatever holds the pages, never at module scope:
|
|
30051
|
+
// a page that never travels between routes must not carry this sheet, and a
|
|
30052
|
+
// build that sees no caller drops the css with the function.
|
|
30053
|
+
const installTransitionFurnitureCss = () => {
|
|
30054
|
+
import.meta.css = [TRANSITION_WALL_CSS, "@jsenv/navi/src/nav/transition_furniture.js"];
|
|
30055
|
+
};
|
|
29995
30056
|
|
|
29996
30057
|
const nameByElement = new WeakMap();
|
|
29997
30058
|
let nameCount = 0;
|
|
@@ -30004,6 +30065,9 @@ let namedElements = new Set();
|
|
|
30004
30065
|
// The rule giving the one-sided bars their movement, written for one movement
|
|
30005
30066
|
// and taken down with it.
|
|
30006
30067
|
let travelStyleElement = null;
|
|
30068
|
+
// The stand-ins for the walls open in the top layer, painted for one picture
|
|
30069
|
+
// and taken down before the next.
|
|
30070
|
+
let wallElements = [];
|
|
30007
30071
|
|
|
30008
30072
|
/**
|
|
30009
30073
|
* Name what stands around the area, before the picture of the state being left
|
|
@@ -30016,6 +30080,7 @@ const nameTransitionFurniture = (owner, areaElement) => {
|
|
|
30016
30080
|
namedElements = new Set();
|
|
30017
30081
|
}
|
|
30018
30082
|
nameFurnitureAround(areaElement);
|
|
30083
|
+
paintTransitionWalls(areaElement);
|
|
30019
30084
|
};
|
|
30020
30085
|
|
|
30021
30086
|
/**
|
|
@@ -30036,6 +30101,7 @@ const holdTransitionFurniture = (owner, areaElement) => {
|
|
|
30036
30101
|
}
|
|
30037
30102
|
}
|
|
30038
30103
|
const namesArriving = nameFurnitureAround(areaElement);
|
|
30104
|
+
paintTransitionWalls(areaElement);
|
|
30039
30105
|
const cssText = `${travelRule("old", namesLeaving, "--navi-route-transition-leave")}${travelRule("new", namesArriving, "--navi-route-transition-enter")}`;
|
|
30040
30106
|
if (!cssText) {
|
|
30041
30107
|
return;
|
|
@@ -30118,6 +30184,60 @@ const releaseTransitionFurniture = (owner) => {
|
|
|
30118
30184
|
travelStyleElement.remove();
|
|
30119
30185
|
travelStyleElement = null;
|
|
30120
30186
|
}
|
|
30187
|
+
removeTransitionWalls();
|
|
30188
|
+
};
|
|
30189
|
+
|
|
30190
|
+
// One stand-in per open wall in every picture, walls in document order: they
|
|
30191
|
+
// stack in the top layer, and what dims the document is all of them. A wall
|
|
30192
|
+
// open anywhere covers everything the document paints, so the sources are
|
|
30193
|
+
// looked for in the whole document — a dialog opened from a bar dims the
|
|
30194
|
+
// pages too. A bar inside the area is part of the pages' picture, and the
|
|
30195
|
+
// area's stand-in answers for it.
|
|
30196
|
+
const paintTransitionWalls = (areaElement) => {
|
|
30197
|
+
removeTransitionWalls();
|
|
30198
|
+
const sources = document.querySelectorAll(TOP_LAYER_WALL_SELECTOR);
|
|
30199
|
+
if (sources.length === 0) {
|
|
30200
|
+
return;
|
|
30201
|
+
}
|
|
30202
|
+
const targets = [areaElement];
|
|
30203
|
+
for (const bar of document.querySelectorAll(FIXED_BAR_SELECTOR$1)) {
|
|
30204
|
+
if (!areaElement.contains(bar)) {
|
|
30205
|
+
targets.push(bar);
|
|
30206
|
+
}
|
|
30207
|
+
}
|
|
30208
|
+
for (const target of targets) {
|
|
30209
|
+
for (const source of sources) {
|
|
30210
|
+
const sourceStyle = getComputedStyle(source);
|
|
30211
|
+
const wall = document.createElement("div");
|
|
30212
|
+
wall.setAttribute(WALL_ATTRIBUTE, "");
|
|
30213
|
+
for (const property of WALL_PROPERTIES) {
|
|
30214
|
+
wall.style.setProperty(
|
|
30215
|
+
property,
|
|
30216
|
+
sourceStyle.getPropertyValue(property),
|
|
30217
|
+
);
|
|
30218
|
+
}
|
|
30219
|
+
target.appendChild(wall);
|
|
30220
|
+
// The target is not necessarily a containing block (the area is a plain
|
|
30221
|
+
// box), and made one for the movement it would move whatever the page
|
|
30222
|
+
// positioned against an ancestor of it: the wall is placed from
|
|
30223
|
+
// wherever its containing block turns out to be, by the offset between
|
|
30224
|
+
// that box and the target's.
|
|
30225
|
+
const targetRect = target.getBoundingClientRect();
|
|
30226
|
+
const wallRect = wall.getBoundingClientRect();
|
|
30227
|
+
wall.style.left = `${targetRect.left - wallRect.left}px`;
|
|
30228
|
+
wall.style.top = `${targetRect.top - wallRect.top}px`;
|
|
30229
|
+
wall.style.width = `${targetRect.width}px`;
|
|
30230
|
+
wall.style.height = `${targetRect.height}px`;
|
|
30231
|
+
wallElements.push(wall);
|
|
30232
|
+
}
|
|
30233
|
+
}
|
|
30234
|
+
};
|
|
30235
|
+
|
|
30236
|
+
const removeTransitionWalls = () => {
|
|
30237
|
+
for (const wall of wallElements) {
|
|
30238
|
+
wall.remove();
|
|
30239
|
+
}
|
|
30240
|
+
wallElements = [];
|
|
30121
30241
|
};
|
|
30122
30242
|
|
|
30123
30243
|
installImportMetaCssBuild(import.meta);
|
|
@@ -30969,6 +31089,7 @@ const RouteTransitionArea = ({
|
|
|
30969
31089
|
}) => {
|
|
30970
31090
|
import.meta.css = [css$12, "@jsenv/navi/src/nav/route_transition.jsx"];
|
|
30971
31091
|
installTransitionWindowCss();
|
|
31092
|
+
installTransitionFurnitureCss();
|
|
30972
31093
|
const props = {
|
|
30973
31094
|
...rest,
|
|
30974
31095
|
[TRANSITION_AREA_ATTRIBUTE]: ""
|