@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/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
|
`;
|
|
@@ -29022,6 +29023,8 @@ const onDocumentClick = (clickEvent) => {
|
|
|
29022
29023
|
}
|
|
29023
29024
|
};
|
|
29024
29025
|
|
|
29026
|
+
installImportMetaCssBuild(import.meta);
|
|
29027
|
+
|
|
29025
29028
|
/**
|
|
29026
29029
|
* The furniture around the pages — the fixed bars, and the popups standing
|
|
29027
29030
|
* over them in the top layer — photographed with them for the length of a
|
|
@@ -29069,6 +29072,27 @@ const onDocumentClick = (clickEvent) => {
|
|
|
29069
29072
|
* that has nothing to do with it. Being unable to answer a press is the price
|
|
29070
29073
|
* of being photographed, and a route transition is where it costs nothing:
|
|
29071
29074
|
* both pages are pictures for those few hundred milliseconds anyway.
|
|
29075
|
+
*
|
|
29076
|
+
* The WALL of a popup goes the other way round: it is not photographed at
|
|
29077
|
+
* all. The top layer is drawn during a transition only as part of the root's
|
|
29078
|
+
* picture, which is opted out while an area is marked (route_transition.jsx),
|
|
29079
|
+
* and a modal dialog's wall is its ::backdrop — a pseudo-element, which wears
|
|
29080
|
+
* no name; a popover's is a real element, but named it would be a picture the
|
|
29081
|
+
* size of the screen, sliding across the page arriving. Captured on its own,
|
|
29082
|
+
* the popup's box travels; its wall is painted nowhere for the length of the
|
|
29083
|
+
* movement, and the page under it leaves undimmed. So the wall is painted
|
|
29084
|
+
* INTO the page's picture instead: a stand-in laid over the area before each
|
|
29085
|
+
* of the two pictures is taken, painting what the wall paints, and removed
|
|
29086
|
+
* with the movement. Carried by the page's picture, it leaves with the page
|
|
29087
|
+
* being left and arrives with the page arriving, cut at the page's edge — and
|
|
29088
|
+
* under the popup's own picture, which stands over the pages (the z-order in
|
|
29089
|
+
* route_transition.jsx). The bars are under the wall as much as the page is,
|
|
29090
|
+
* and each is a picture of its own: the same stand-in is laid over every bar
|
|
29091
|
+
* outside the area. A bar the two states share is one group with two
|
|
29092
|
+
* pictures — dimmed on the side that has a wall — and its cross-fade is the
|
|
29093
|
+
* wall fading out as the page leaves, or in as it arrives; a bar only one
|
|
29094
|
+
* state has carries the wall with it. A popup with layer="local" paints its
|
|
29095
|
+
* wall inside the page and needs none of this.
|
|
29072
29096
|
*/
|
|
29073
29097
|
|
|
29074
29098
|
// The browser's top layer: painted above everything the document paints, so
|
|
@@ -29086,6 +29110,43 @@ const FURNITURE_SELECTOR = `.navi_fixed_bar, .navi_popover:is(${TOP_LAYER_SELECT
|
|
|
29086
29110
|
const TRANSITION_ATTRIBUTE$1 = "data-navi-route-transition";
|
|
29087
29111
|
const NAME_PROPERTY$1 = "view-transition-name";
|
|
29088
29112
|
const FURNITURE_NAME_PREFIX = "navi-transition-furniture-";
|
|
29113
|
+
// The walls painted in the top layer: a modal dialog's, which is its
|
|
29114
|
+
// ::backdrop, and a popover's, which is a real element shown as a popover
|
|
29115
|
+
// beside it (layout/popover.jsx) — unnamed, so covered by the pictures for
|
|
29116
|
+
// the length of the movement all the same. A top-layer dialog without a wall
|
|
29117
|
+
// is shown as a popover and has nothing to stand in for.
|
|
29118
|
+
const TOP_LAYER_WALL_SELECTOR =
|
|
29119
|
+
".navi_dialog:modal, .navi_popover_backdrop:popover-open";
|
|
29120
|
+
const WALL_ATTRIBUTE = "data-navi-transition-wall";
|
|
29121
|
+
// What the wall paints, resolved on the matched element in both cases (the
|
|
29122
|
+
// dialog for its ::backdrop, the popover's wall for itself): the same two
|
|
29123
|
+
// properties, copied onto the stand-in.
|
|
29124
|
+
const WALL_PROPERTIES = ["--backdrop-background", "--backdrop-filter"];
|
|
29125
|
+
|
|
29126
|
+
// The pictures the wall is painted into: the pages', and every bar's own.
|
|
29127
|
+
const FIXED_BAR_SELECTOR$1 = ".navi_fixed_bar";
|
|
29128
|
+
|
|
29129
|
+
const TRANSITION_WALL_CSS = /* css */ `[data-navi-transition-wall] {
|
|
29130
|
+
z-index: var(--navi-z-index-top-layer);
|
|
29131
|
+
background: var(--backdrop-background);
|
|
29132
|
+
backdrop-filter: var(--backdrop-filter);
|
|
29133
|
+
pointer-events: none;
|
|
29134
|
+
position: absolute;
|
|
29135
|
+
top: 0;
|
|
29136
|
+
left: 0;
|
|
29137
|
+
}
|
|
29138
|
+
|
|
29139
|
+
:root:not(:active-view-transition) [data-navi-transition-wall] {
|
|
29140
|
+
display: none;
|
|
29141
|
+
}
|
|
29142
|
+
`;
|
|
29143
|
+
|
|
29144
|
+
// Called from the render of whatever holds the pages, never at module scope:
|
|
29145
|
+
// a page that never travels between routes must not carry this sheet, and a
|
|
29146
|
+
// build that sees no caller drops the css with the function.
|
|
29147
|
+
const installTransitionFurnitureCss = () => {
|
|
29148
|
+
import.meta.css = [TRANSITION_WALL_CSS, "@jsenv/navi/src/nav/transition_furniture.js"];
|
|
29149
|
+
};
|
|
29089
29150
|
|
|
29090
29151
|
const nameByElement = new WeakMap();
|
|
29091
29152
|
let nameCount = 0;
|
|
@@ -29098,6 +29159,9 @@ let namedElements = new Set();
|
|
|
29098
29159
|
// The rule giving the one-sided bars their movement, written for one movement
|
|
29099
29160
|
// and taken down with it.
|
|
29100
29161
|
let travelStyleElement = null;
|
|
29162
|
+
// The stand-ins for the walls open in the top layer, painted for one picture
|
|
29163
|
+
// and taken down before the next.
|
|
29164
|
+
let wallElements = [];
|
|
29101
29165
|
|
|
29102
29166
|
/**
|
|
29103
29167
|
* Name what stands around the area, before the picture of the state being left
|
|
@@ -29110,6 +29174,7 @@ const nameTransitionFurniture = (owner, areaElement) => {
|
|
|
29110
29174
|
namedElements = new Set();
|
|
29111
29175
|
}
|
|
29112
29176
|
nameFurnitureAround(areaElement);
|
|
29177
|
+
paintTransitionWalls(areaElement);
|
|
29113
29178
|
};
|
|
29114
29179
|
|
|
29115
29180
|
/**
|
|
@@ -29130,6 +29195,7 @@ const holdTransitionFurniture = (owner, areaElement) => {
|
|
|
29130
29195
|
}
|
|
29131
29196
|
}
|
|
29132
29197
|
const namesArriving = nameFurnitureAround(areaElement);
|
|
29198
|
+
paintTransitionWalls(areaElement);
|
|
29133
29199
|
const cssText = `${travelRule("old", namesLeaving, "--navi-route-transition-leave")}${travelRule("new", namesArriving, "--navi-route-transition-enter")}`;
|
|
29134
29200
|
if (!cssText) {
|
|
29135
29201
|
return;
|
|
@@ -29212,6 +29278,60 @@ const releaseTransitionFurniture = (owner) => {
|
|
|
29212
29278
|
travelStyleElement.remove();
|
|
29213
29279
|
travelStyleElement = null;
|
|
29214
29280
|
}
|
|
29281
|
+
removeTransitionWalls();
|
|
29282
|
+
};
|
|
29283
|
+
|
|
29284
|
+
// One stand-in per open wall in every picture, walls in document order: they
|
|
29285
|
+
// stack in the top layer, and what dims the document is all of them. A wall
|
|
29286
|
+
// open anywhere covers everything the document paints, so the sources are
|
|
29287
|
+
// looked for in the whole document — a dialog opened from a bar dims the
|
|
29288
|
+
// pages too. A bar inside the area is part of the pages' picture, and the
|
|
29289
|
+
// area's stand-in answers for it.
|
|
29290
|
+
const paintTransitionWalls = (areaElement) => {
|
|
29291
|
+
removeTransitionWalls();
|
|
29292
|
+
const sources = document.querySelectorAll(TOP_LAYER_WALL_SELECTOR);
|
|
29293
|
+
if (sources.length === 0) {
|
|
29294
|
+
return;
|
|
29295
|
+
}
|
|
29296
|
+
const targets = [areaElement];
|
|
29297
|
+
for (const bar of document.querySelectorAll(FIXED_BAR_SELECTOR$1)) {
|
|
29298
|
+
if (!areaElement.contains(bar)) {
|
|
29299
|
+
targets.push(bar);
|
|
29300
|
+
}
|
|
29301
|
+
}
|
|
29302
|
+
for (const target of targets) {
|
|
29303
|
+
for (const source of sources) {
|
|
29304
|
+
const sourceStyle = getComputedStyle(source);
|
|
29305
|
+
const wall = document.createElement("div");
|
|
29306
|
+
wall.setAttribute(WALL_ATTRIBUTE, "");
|
|
29307
|
+
for (const property of WALL_PROPERTIES) {
|
|
29308
|
+
wall.style.setProperty(
|
|
29309
|
+
property,
|
|
29310
|
+
sourceStyle.getPropertyValue(property),
|
|
29311
|
+
);
|
|
29312
|
+
}
|
|
29313
|
+
target.appendChild(wall);
|
|
29314
|
+
// The target is not necessarily a containing block (the area is a plain
|
|
29315
|
+
// box), and made one for the movement it would move whatever the page
|
|
29316
|
+
// positioned against an ancestor of it: the wall is placed from
|
|
29317
|
+
// wherever its containing block turns out to be, by the offset between
|
|
29318
|
+
// that box and the target's.
|
|
29319
|
+
const targetRect = target.getBoundingClientRect();
|
|
29320
|
+
const wallRect = wall.getBoundingClientRect();
|
|
29321
|
+
wall.style.left = `${targetRect.left - wallRect.left}px`;
|
|
29322
|
+
wall.style.top = `${targetRect.top - wallRect.top}px`;
|
|
29323
|
+
wall.style.width = `${targetRect.width}px`;
|
|
29324
|
+
wall.style.height = `${targetRect.height}px`;
|
|
29325
|
+
wallElements.push(wall);
|
|
29326
|
+
}
|
|
29327
|
+
}
|
|
29328
|
+
};
|
|
29329
|
+
|
|
29330
|
+
const removeTransitionWalls = () => {
|
|
29331
|
+
for (const wall of wallElements) {
|
|
29332
|
+
wall.remove();
|
|
29333
|
+
}
|
|
29334
|
+
wallElements = [];
|
|
29215
29335
|
};
|
|
29216
29336
|
|
|
29217
29337
|
installImportMetaCssBuild(import.meta);
|
|
@@ -30063,6 +30183,7 @@ const RouteTransitionArea = ({
|
|
|
30063
30183
|
}) => {
|
|
30064
30184
|
import.meta.css = [css$12, "@jsenv/navi/src/nav/route_transition.jsx"];
|
|
30065
30185
|
installTransitionWindowCss();
|
|
30186
|
+
installTransitionFurnitureCss();
|
|
30066
30187
|
const props = {
|
|
30067
30188
|
...rest,
|
|
30068
30189
|
[TRANSITION_AREA_ATTRIBUTE]: ""
|