@jsenv/navi 0.29.371 → 0.29.372
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 +77 -23
- package/dist/dev/jsenv_navi.js.map +2 -2
- package/dist/jsenv_navi.js +77 -23
- package/dist/jsenv_navi.js.map +2 -2
- package/package.json +1 -1
package/dist/dev/jsenv_navi.js
CHANGED
|
@@ -30047,12 +30047,17 @@ const TRANSITION_WALL_CSS = /* css */ `[data-navi-transition-wall] {
|
|
|
30047
30047
|
left: 0;
|
|
30048
30048
|
|
|
30049
30049
|
&[data-navi-transition-wall="rest"] {
|
|
30050
|
+
clip-path: var(--wall-holes);
|
|
30050
30051
|
transition: opacity var(--navi-route-transition-duration, .3s) ease;
|
|
30051
30052
|
position: fixed;
|
|
30052
30053
|
inset: 0;
|
|
30053
30054
|
}
|
|
30054
30055
|
}
|
|
30055
30056
|
|
|
30057
|
+
:root:not(:active-view-transition) [data-navi-transition-wall="rest"] {
|
|
30058
|
+
clip-path: var(--wall-holes-arriving, var(--wall-holes));
|
|
30059
|
+
}
|
|
30060
|
+
|
|
30056
30061
|
:root[data-navi-route-transition] {
|
|
30057
30062
|
& .navi_dialog::backdrop, & .navi_popover_backdrop {
|
|
30058
30063
|
backdrop-filter: none;
|
|
@@ -30086,6 +30091,10 @@ let wallElements = [];
|
|
|
30086
30091
|
// the opacity they are heading to once it plays.
|
|
30087
30092
|
let restWallElements = [];
|
|
30088
30093
|
let restWallOpacity = "0";
|
|
30094
|
+
// Where each picture stood in the state being left, by element: a hole in
|
|
30095
|
+
// the rest walls is cut only where a picture stands at EVERY moment of the
|
|
30096
|
+
// movement, which takes both states' rectangles.
|
|
30097
|
+
let leavingRects = new Map();
|
|
30089
30098
|
|
|
30090
30099
|
/**
|
|
30091
30100
|
* Name what stands around the area, before the picture of the state being left
|
|
@@ -30100,8 +30109,12 @@ const nameTransitionFurniture = (owner, areaElement) => {
|
|
|
30100
30109
|
nameFurnitureAround(areaElement);
|
|
30101
30110
|
const sources = paintTransitionWalls(areaElement);
|
|
30102
30111
|
// The state being left has walls: what no picture covers starts dimmed.
|
|
30112
|
+
// The frame the first picture is taken on shows the live document, so the
|
|
30113
|
+
// holes are this state's rectangles, stand-ins inside.
|
|
30103
30114
|
removeRestWalls();
|
|
30104
|
-
|
|
30115
|
+
leavingRects = measurePictureRects(areaElement);
|
|
30116
|
+
paintRestWalls(sources, "1");
|
|
30117
|
+
cutRestWalls([...leavingRects.values()]);
|
|
30105
30118
|
};
|
|
30106
30119
|
|
|
30107
30120
|
/**
|
|
@@ -30128,10 +30141,38 @@ const holdTransitionFurniture = (owner, areaElement) => {
|
|
|
30128
30141
|
// have), from the state arriving otherwise (they come up from nothing).
|
|
30129
30142
|
restWallOpacity = sources.length > 0 ? "1" : "0";
|
|
30130
30143
|
if (restWallElements.length === 0) {
|
|
30131
|
-
paintRestWalls(
|
|
30132
|
-
}
|
|
30133
|
-
|
|
30134
|
-
|
|
30144
|
+
paintRestWalls(sources, "0");
|
|
30145
|
+
}
|
|
30146
|
+
// For the length of the movement a picture is only ever where the two
|
|
30147
|
+
// states' rectangles meet: the pages' pictures slide, and a taller page
|
|
30148
|
+
// arriving does not make the one leaving any taller. A picture only one
|
|
30149
|
+
// state has travels away from where it stood, so it gets no hole at all.
|
|
30150
|
+
const arrivingRects = measurePictureRects(areaElement);
|
|
30151
|
+
const holes = [];
|
|
30152
|
+
for (const [target, arrivingRect] of arrivingRects) {
|
|
30153
|
+
const leavingRect = leavingRects.get(target);
|
|
30154
|
+
if (!leavingRect) {
|
|
30155
|
+
continue;
|
|
30156
|
+
}
|
|
30157
|
+
const left =
|
|
30158
|
+
leavingRect.left > arrivingRect.left
|
|
30159
|
+
? leavingRect.left
|
|
30160
|
+
: arrivingRect.left;
|
|
30161
|
+
const top =
|
|
30162
|
+
leavingRect.top > arrivingRect.top ? leavingRect.top : arrivingRect.top;
|
|
30163
|
+
const right =
|
|
30164
|
+
leavingRect.right < arrivingRect.right
|
|
30165
|
+
? leavingRect.right
|
|
30166
|
+
: arrivingRect.right;
|
|
30167
|
+
const bottom =
|
|
30168
|
+
leavingRect.bottom < arrivingRect.bottom
|
|
30169
|
+
? leavingRect.bottom
|
|
30170
|
+
: arrivingRect.bottom;
|
|
30171
|
+
if (right > left && bottom > top) {
|
|
30172
|
+
holes.push({ left, top, right, bottom });
|
|
30173
|
+
}
|
|
30174
|
+
}
|
|
30175
|
+
cutRestWalls(holes, [...arrivingRects.values()]);
|
|
30135
30176
|
const cssText = `${travelRule("old", namesLeaving, "--navi-route-transition-leave")}${travelRule("new", namesArriving, "--navi-route-transition-enter")}`;
|
|
30136
30177
|
if (!cssText) {
|
|
30137
30178
|
return;
|
|
@@ -30294,11 +30335,11 @@ const createWall = (source) => {
|
|
|
30294
30335
|
};
|
|
30295
30336
|
|
|
30296
30337
|
// One per open wall, over the window, at the opacity of the state they are
|
|
30297
|
-
// painted from
|
|
30298
|
-
// stand-in of its own and shows the live document through nowhere — and on
|
|
30299
|
-
// the
|
|
30300
|
-
//
|
|
30301
|
-
const paintRestWalls = (
|
|
30338
|
+
// painted from. A hole is cut where a picture stands, since the picture has
|
|
30339
|
+
// a stand-in of its own and shows the live document through nowhere — and on
|
|
30340
|
+
// the frames the live document IS shown, the first and the last, a hole is
|
|
30341
|
+
// what keeps the two from being painted on top of each other.
|
|
30342
|
+
const paintRestWalls = (sources, opacity) => {
|
|
30302
30343
|
for (const source of sources) {
|
|
30303
30344
|
const restWall = createWall(source);
|
|
30304
30345
|
restWall.setAttribute(WALL_ATTRIBUTE, "rest");
|
|
@@ -30306,25 +30347,37 @@ const paintRestWalls = (areaElement, sources, opacity) => {
|
|
|
30306
30347
|
document.body.appendChild(restWall);
|
|
30307
30348
|
restWallElements.push(restWall);
|
|
30308
30349
|
}
|
|
30309
|
-
cutRestWalls(areaElement);
|
|
30310
30350
|
};
|
|
30311
30351
|
|
|
30312
|
-
|
|
30313
|
-
|
|
30314
|
-
const cutRestWalls = (areaElement) => {
|
|
30315
|
-
if (restWallElements.length === 0) {
|
|
30316
|
-
return;
|
|
30317
|
-
}
|
|
30318
|
-
// One evenodd polygon: the window, then each hole entered from and left by
|
|
30319
|
-
// the window's origin, so the bridges between them have no area.
|
|
30320
|
-
let polygon = "0 0, 100% 0, 100% 100%, 0 100%, 0 0";
|
|
30352
|
+
const measurePictureRects = (areaElement) => {
|
|
30353
|
+
const rects = new Map();
|
|
30321
30354
|
for (const target of pictureTargets(areaElement)) {
|
|
30322
|
-
|
|
30323
|
-
polygon += `, ${left}px ${top}px, ${right}px ${top}px, ${right}px ${bottom}px, ${left}px ${bottom}px, ${left}px ${top}px, 0 0`;
|
|
30355
|
+
rects.set(target, target.getBoundingClientRect());
|
|
30324
30356
|
}
|
|
30357
|
+
return rects;
|
|
30358
|
+
};
|
|
30359
|
+
|
|
30360
|
+
// The holes for the movement, and the ones for its last frame (see the CSS).
|
|
30361
|
+
const cutRestWalls = (holes, holesArriving = null) => {
|
|
30325
30362
|
for (const restWall of restWallElements) {
|
|
30326
|
-
restWall.style.
|
|
30363
|
+
restWall.style.setProperty("--wall-holes", holesPolygon(holes));
|
|
30364
|
+
if (holesArriving) {
|
|
30365
|
+
restWall.style.setProperty(
|
|
30366
|
+
"--wall-holes-arriving",
|
|
30367
|
+
holesPolygon(holesArriving),
|
|
30368
|
+
);
|
|
30369
|
+
}
|
|
30370
|
+
}
|
|
30371
|
+
};
|
|
30372
|
+
|
|
30373
|
+
// One evenodd polygon: the window, then each hole entered from and left by
|
|
30374
|
+
// the window's origin, so the bridges between them have no area.
|
|
30375
|
+
const holesPolygon = (holes) => {
|
|
30376
|
+
let polygon = "0 0, 100% 0, 100% 100%, 0 100%, 0 0";
|
|
30377
|
+
for (const { left, top, right, bottom } of holes) {
|
|
30378
|
+
polygon += `, ${left}px ${top}px, ${right}px ${top}px, ${right}px ${bottom}px, ${left}px ${bottom}px, ${left}px ${top}px, 0 0`;
|
|
30327
30379
|
}
|
|
30380
|
+
return `polygon(evenodd, ${polygon})`;
|
|
30328
30381
|
};
|
|
30329
30382
|
|
|
30330
30383
|
const removeRestWalls = () => {
|
|
@@ -30333,6 +30386,7 @@ const removeRestWalls = () => {
|
|
|
30333
30386
|
}
|
|
30334
30387
|
restWallElements = [];
|
|
30335
30388
|
restWallOpacity = "0";
|
|
30389
|
+
leavingRects = new Map();
|
|
30336
30390
|
};
|
|
30337
30391
|
|
|
30338
30392
|
installImportMetaCssBuild(import.meta);
|