@jsenv/navi 0.30.38 → 0.30.40
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 -15
- package/dist/dev/jsenv_navi.js.map +4 -4
- package/dist/jsenv_navi.js +77 -15
- package/dist/jsenv_navi.js.map +4 -4
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -41321,6 +41321,11 @@ const css$16 = /* css */`@property --navi-route-row-pin {
|
|
|
41321
41321
|
inherits: false
|
|
41322
41322
|
}
|
|
41323
41323
|
|
|
41324
|
+
@property --navi-route-row-stand {
|
|
41325
|
+
syntax: "*";
|
|
41326
|
+
inherits: false
|
|
41327
|
+
}
|
|
41328
|
+
|
|
41324
41329
|
.navi_route_travel {
|
|
41325
41330
|
flex-direction: column;
|
|
41326
41331
|
display: flex;
|
|
@@ -41862,16 +41867,14 @@ const RouteTravel = ({
|
|
|
41862
41867
|
movement.rowTaken = true;
|
|
41863
41868
|
// A travel no hand set off holds nothing: it goes where it goes.
|
|
41864
41869
|
releaseHeldPage();
|
|
41865
|
-
|
|
41866
|
-
row.setAttribute("data-route-row-taken", "");
|
|
41870
|
+
holdRowAt(row, position);
|
|
41867
41871
|
afterFrames(2, () => {
|
|
41868
41872
|
if (movementRef.current !== movement) {
|
|
41869
41873
|
return;
|
|
41870
41874
|
}
|
|
41871
41875
|
// A scroller again, standing where no page does: not snapped meanwhile.
|
|
41872
41876
|
row.setAttribute("data-route-row-travelling", "");
|
|
41873
|
-
|
|
41874
|
-
row.style.removeProperty("--navi-route-row-stand");
|
|
41877
|
+
releaseTakenRow(row);
|
|
41875
41878
|
afterFrames(1, () => {
|
|
41876
41879
|
if (movementRef.current === movement) {
|
|
41877
41880
|
travelRowTo(latestRef.current.currentIndex, movement);
|
|
@@ -41891,7 +41894,7 @@ const RouteTravel = ({
|
|
|
41891
41894
|
movementRef.current = null;
|
|
41892
41895
|
letRowGo(movement);
|
|
41893
41896
|
putRowBack(movement);
|
|
41894
|
-
|
|
41897
|
+
releaseTakenRow(row);
|
|
41895
41898
|
publishRouteRowMove(null);
|
|
41896
41899
|
releaseHeldPage();
|
|
41897
41900
|
releasePaneAtRest(row);
|
|
@@ -42369,6 +42372,22 @@ const copyScrollPositions = (from, to) => {
|
|
|
42369
42372
|
// A tab pressed over a row a hand has left moving holds it still (takeRowFromHand):
|
|
42370
42373
|
// what the row says meanwhile is not a hand moving it.
|
|
42371
42374
|
const isRowTaken = row => row.hasAttribute("data-route-row-taken");
|
|
42375
|
+
|
|
42376
|
+
// What the CSS offsets while the row is taken. A picture left meanwhile is a clone
|
|
42377
|
+
// of the live page, and takes its offset along.
|
|
42378
|
+
const STANDING_IN_ROW = ":scope > [data-route-row-pane], :scope > [data-route-row-live], :scope > [data-route-row-pictures] > *";
|
|
42379
|
+
const holdRowAt = (row, position) => {
|
|
42380
|
+
for (const element of row.querySelectorAll(STANDING_IN_ROW)) {
|
|
42381
|
+
element.style.setProperty("--navi-route-row-stand", `${-position}px`);
|
|
42382
|
+
}
|
|
42383
|
+
row.setAttribute("data-route-row-taken", "");
|
|
42384
|
+
};
|
|
42385
|
+
const releaseTakenRow = row => {
|
|
42386
|
+
row.removeAttribute("data-route-row-taken");
|
|
42387
|
+
for (const element of row.querySelectorAll(STANDING_IN_ROW)) {
|
|
42388
|
+
element.style.removeProperty("--navi-route-row-stand");
|
|
42389
|
+
}
|
|
42390
|
+
};
|
|
42372
42391
|
const afterFrames = (count, callback) => {
|
|
42373
42392
|
if (count === 0) {
|
|
42374
42393
|
callback();
|
|
@@ -83643,6 +83662,17 @@ const createListItems = () => {
|
|
|
83643
83662
|
}
|
|
83644
83663
|
return null;
|
|
83645
83664
|
},
|
|
83665
|
+
// Whether a run stands for the item at that index without holding it: the
|
|
83666
|
+
// page it belongs to has not answered yet. An id missing from what the runs
|
|
83667
|
+
// hold says the item is gone only once the page where it stood is in.
|
|
83668
|
+
itemOnItsWayAt: (index) => {
|
|
83669
|
+
for (const locator of locatorByOwner.values()) {
|
|
83670
|
+
if (locator.awaits(index)) {
|
|
83671
|
+
return true;
|
|
83672
|
+
}
|
|
83673
|
+
}
|
|
83674
|
+
return false;
|
|
83675
|
+
},
|
|
83646
83676
|
// The room the item at that index takes: the room it took when it was
|
|
83647
83677
|
// last drawn, else the room its run is given for it (see List.Items'
|
|
83648
83678
|
// itemSize), else undefined.
|
|
@@ -86617,10 +86647,14 @@ const useListScrollSync = ({
|
|
|
86617
86647
|
// Not there yet, but where it stood is drawn already: the item
|
|
86618
86648
|
// standing in for it at that index (see holdWindow). The list is placed
|
|
86619
86649
|
// on that one, measured like any other, and the named item takes over
|
|
86620
|
-
// where it lands.
|
|
86621
|
-
|
|
86622
|
-
|
|
86623
|
-
|
|
86650
|
+
// where it lands. Held for as long as the page at that index has not
|
|
86651
|
+
// answered — the first one, or the one a press sends the list to: only
|
|
86652
|
+
// an answer without the item says it is gone.
|
|
86653
|
+
const standInIndex = scrolledWanted.index;
|
|
86654
|
+
const hasStandIn = typeof standInIndex === "number";
|
|
86655
|
+
if (listItems.pagesSignal.peek() === 0 || hasStandIn && listItems.itemOnItsWayAt(standInIndex)) {
|
|
86656
|
+
if (hasStandIn) {
|
|
86657
|
+
placeItem(findItemElementAt(getListEl(), standInIndex), scrolledWanted.offset || 0, scrolledWanted.align);
|
|
86624
86658
|
}
|
|
86625
86659
|
return;
|
|
86626
86660
|
}
|
|
@@ -86684,11 +86718,13 @@ const useListScrollSync = ({
|
|
|
86684
86718
|
const itemRect = itemEl.getBoundingClientRect();
|
|
86685
86719
|
const viewportSize = (horizontal ? viewportRect.width : viewportRect.height) / scale;
|
|
86686
86720
|
const itemSize = (horizontal ? itemRect.width : itemRect.height) / scale;
|
|
86687
|
-
const
|
|
86688
|
-
|
|
86689
|
-
|
|
86690
|
-
|
|
86691
|
-
|
|
86721
|
+
const offsetWanted = resolveHeldOffset({
|
|
86722
|
+
align,
|
|
86723
|
+
offset,
|
|
86724
|
+
scrollInset: getItemScrollInset(scrollerEl, itemEl, horizontal),
|
|
86725
|
+
viewportSize,
|
|
86726
|
+
itemSize
|
|
86727
|
+
});
|
|
86692
86728
|
const offsetNow = (horizontal ? itemRect.left - viewportRect.left : itemRect.top - viewportRect.top) / scale;
|
|
86693
86729
|
const scrollNow = horizontal ? scrollerEl.scrollLeft : scrollerEl.scrollTop;
|
|
86694
86730
|
const delta = offsetNow - offsetWanted;
|
|
@@ -87417,6 +87453,7 @@ const useListScrollSync = ({
|
|
|
87417
87453
|
}
|
|
87418
87454
|
let index = null;
|
|
87419
87455
|
let offset = 0;
|
|
87456
|
+
let align;
|
|
87420
87457
|
if (typeof wanted === "number") {
|
|
87421
87458
|
index = wanted;
|
|
87422
87459
|
} else if (wanted && wanted.id !== undefined) {
|
|
@@ -87425,6 +87462,7 @@ const useListScrollSync = ({
|
|
|
87425
87462
|
index = wanted.index;
|
|
87426
87463
|
}
|
|
87427
87464
|
offset = wanted.offset || 0;
|
|
87465
|
+
align = wanted.align;
|
|
87428
87466
|
}
|
|
87429
87467
|
if (index === null || index < 0 || index >= total) {
|
|
87430
87468
|
return null;
|
|
@@ -87435,7 +87473,15 @@ const useListScrollSync = ({
|
|
|
87435
87473
|
const rect = itemEl.getBoundingClientRect();
|
|
87436
87474
|
itemSize = horizontal ? rect.width : rect.height;
|
|
87437
87475
|
}
|
|
87438
|
-
|
|
87476
|
+
// Not drawn yet, the item weighs nothing and has no inset: centred, it
|
|
87477
|
+
// stands half the screen down, which is where it will be put.
|
|
87478
|
+
const above = resolveHeldOffset({
|
|
87479
|
+
align,
|
|
87480
|
+
offset,
|
|
87481
|
+
scrollInset: getItemScrollInset(scrollerEl, itemEl, horizontal),
|
|
87482
|
+
viewportSize: screenSize,
|
|
87483
|
+
itemSize
|
|
87484
|
+
});
|
|
87439
87485
|
return {
|
|
87440
87486
|
index,
|
|
87441
87487
|
above
|
|
@@ -87990,6 +88036,21 @@ const resolveOpenOffset = (offset, viewportSize, itemSize) => {
|
|
|
87990
88036
|
}
|
|
87991
88037
|
return offset;
|
|
87992
88038
|
};
|
|
88039
|
+
// How far from the start of the view an item held at `{ offset, align }`
|
|
88040
|
+
// stands: read the same way where the list is placed (placeItem) and where the
|
|
88041
|
+
// window is sized around it (readHold), or the window frames a screen the
|
|
88042
|
+
// item is not on. Centred in what the room at the start leaves of the view (a
|
|
88043
|
+
// fixed bar, a sticky header), not in the whole of it.
|
|
88044
|
+
const resolveHeldOffset = ({
|
|
88045
|
+
align,
|
|
88046
|
+
offset,
|
|
88047
|
+
scrollInset,
|
|
88048
|
+
viewportSize,
|
|
88049
|
+
itemSize
|
|
88050
|
+
}) => {
|
|
88051
|
+
const alignedOffset = align === "center" ? scrollInset + (viewportSize - scrollInset - itemSize) / 2 : align === "end" ? viewportSize - itemSize : scrollInset;
|
|
88052
|
+
return resolveOpenOffset(alignedOffset + offset, viewportSize, itemSize);
|
|
88053
|
+
};
|
|
87993
88054
|
|
|
87994
88055
|
// The room an item must be given at the top (or left) of the view: the
|
|
87995
88056
|
// scroller's own scroll-padding — where a fixed bar publishes the space it
|
|
@@ -90158,6 +90219,7 @@ const useRunItems = (store, {
|
|
|
90158
90219
|
});
|
|
90159
90220
|
return found;
|
|
90160
90221
|
},
|
|
90222
|
+
awaits: itemIndex => itemIndex >= runStart && itemIndex < runEnd && getItemAt(itemIndex) === undefined,
|
|
90161
90223
|
roomAt: roomOf,
|
|
90162
90224
|
givenRoomAt: givenRoomOf
|
|
90163
90225
|
});
|