@jsenv/navi 0.29.474 → 0.29.476
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 +66 -21
- package/dist/dev/jsenv_navi.js.map +3 -3
- package/dist/jsenv_navi.js +50 -21
- package/dist/jsenv_navi.js.map +3 -3
- package/docs/drag_interactions.md +23 -4
- package/package.json +2 -2
package/dist/dev/jsenv_navi.js
CHANGED
|
@@ -23351,6 +23351,10 @@ const DROP_CONTAINER_ATTRIBUTE = "data-drop-container";
|
|
|
23351
23351
|
// every outcome — a list runs one way, and something being put somewhere goes
|
|
23352
23352
|
// wherever it is put.
|
|
23353
23353
|
const AXIS_ATTRIBUTE = "data-drag-axis";
|
|
23354
|
+
// How the items of a reordered list are laid out: "column", "row", or "wrap" for
|
|
23355
|
+
// side by side over several lines. Said nothing, it is read from where the
|
|
23356
|
+
// items stand.
|
|
23357
|
+
const FLOW_ATTRIBUTE = "data-reorder-flow";
|
|
23354
23358
|
const DELAY_ATTRIBUTE = "data-drag-delay";
|
|
23355
23359
|
const SLOP_ATTRIBUTE = "data-drag-slop";
|
|
23356
23360
|
const THRESHOLD_ATTRIBUTE$1 = "data-drag-threshold";
|
|
@@ -23446,14 +23450,24 @@ defineInteractionDetector({
|
|
|
23446
23450
|
}
|
|
23447
23451
|
// Read at setup rather than at the press: a container can say it, and it is
|
|
23448
23452
|
// what the gesture is about rather than something it discovers.
|
|
23453
|
+
const itemFlow =
|
|
23454
|
+
element.closest(`[${FLOW_ATTRIBUTE}]`)?.getAttribute(FLOW_ATTRIBUTE) ||
|
|
23455
|
+
undefined;
|
|
23449
23456
|
const axisHolder = element.closest(`[${AXIS_ATTRIBUTE}]`);
|
|
23450
23457
|
const axes =
|
|
23451
23458
|
axisHolder?.getAttribute(AXIS_ATTRIBUTE) ||
|
|
23452
|
-
// A list runs one way, and reordering walks it
|
|
23453
|
-
//
|
|
23454
|
-
//
|
|
23455
|
-
//
|
|
23456
|
-
|
|
23459
|
+
// A list runs one way, and reordering walks it: down a column, along a
|
|
23460
|
+
// row, and both for a row that wraps — its copy changes line. Anything
|
|
23461
|
+
// else goes wherever the hand takes it: a board has places all around, a
|
|
23462
|
+
// thing put somewhere has two axes to be put along, a throw goes where it
|
|
23463
|
+
// was thrown and a thing that leaves goes out by whichever edge.
|
|
23464
|
+
(canReorder && !canLand && !canToss && !canLeave
|
|
23465
|
+
? itemFlow === "row"
|
|
23466
|
+
? "x"
|
|
23467
|
+
: itemFlow === "wrap"
|
|
23468
|
+
? "xy"
|
|
23469
|
+
: "y"
|
|
23470
|
+
: "xy");
|
|
23457
23471
|
// Where the places are, read at setup for the same reason as the axes: they
|
|
23458
23472
|
// are what the gesture is about, and it is what holds the two sides of it
|
|
23459
23473
|
// that says them.
|
|
@@ -23527,6 +23541,7 @@ defineInteractionDetector({
|
|
|
23527
23541
|
: undefined,
|
|
23528
23542
|
containerElement: dropContainer || undefined,
|
|
23529
23543
|
outsideOf,
|
|
23544
|
+
itemFlow,
|
|
23530
23545
|
getItemId: (itemElement) => itemElement.id,
|
|
23531
23546
|
direction: { x: axes.includes("x"), y: axes.includes("y") },
|
|
23532
23547
|
// Where it may go, said in the DOM. A thing that is put somewhere stays
|
|
@@ -78986,6 +79001,7 @@ const useListScrollSync = ({
|
|
|
78986
79001
|
useDuplicateHeaderWarning(ref);
|
|
78987
79002
|
useStuckWindowWarning({
|
|
78988
79003
|
ref,
|
|
79004
|
+
getListEl,
|
|
78989
79005
|
scrollerElResolved,
|
|
78990
79006
|
renderWindowRef,
|
|
78991
79007
|
windowLeavesItemsOut,
|
|
@@ -80533,6 +80549,7 @@ const readItemsPerLine = listEl => {
|
|
|
80533
80549
|
// instead of scrolling — and there is no event missing to notice it by.
|
|
80534
80550
|
const useStuckWindowWarning = ({
|
|
80535
80551
|
ref,
|
|
80552
|
+
getListEl,
|
|
80536
80553
|
scrollerElResolved,
|
|
80537
80554
|
renderWindowRef,
|
|
80538
80555
|
windowLeavesItemsOut,
|
|
@@ -80561,6 +80578,22 @@ const useStuckWindowWarning = ({
|
|
|
80561
80578
|
if (canScrollerScroll(scrollerElResolved, horizontal ? "x" : "y")) {
|
|
80562
80579
|
return;
|
|
80563
80580
|
}
|
|
80581
|
+
// Scrolling nothing, the box keeps out of reach only the items past what
|
|
80582
|
+
// it shows. A list standing whole on the window's screen is one the window
|
|
80583
|
+
// covers at its next evaluation: an item added in this commit is drawn on
|
|
80584
|
+
// the resize it causes (see onGeometryChangeRef), after this effect.
|
|
80585
|
+
const listEl = getListEl();
|
|
80586
|
+
if (!listEl) {
|
|
80587
|
+
return;
|
|
80588
|
+
}
|
|
80589
|
+
const screen = readWindowScreen(scrollerElResolved, horizontal);
|
|
80590
|
+
const listRect = listEl.getBoundingClientRect();
|
|
80591
|
+
const listFrom = horizontal ? listRect.left : listRect.top;
|
|
80592
|
+
const listTo = horizontal ? listRect.right : listRect.bottom;
|
|
80593
|
+
// A pixel of slack, like canScroll.
|
|
80594
|
+
if (listFrom > screen.from - 1 && listTo < screen.to + 1) {
|
|
80595
|
+
return;
|
|
80596
|
+
}
|
|
80564
80597
|
doneRef.current = true;
|
|
80565
80598
|
const {
|
|
80566
80599
|
start,
|
|
@@ -81179,28 +81212,40 @@ const findItemElementAt = (listEl, index) => {
|
|
|
81179
81212
|
}
|
|
81180
81213
|
return null;
|
|
81181
81214
|
};
|
|
81182
|
-
//
|
|
81183
|
-
//
|
|
81184
|
-
//
|
|
81185
|
-
//
|
|
81186
|
-
//
|
|
81187
|
-
//
|
|
81188
|
-
|
|
81189
|
-
// a screen they make grow. A list off screen is met at its edge nearest to the
|
|
81190
|
-
// screen, where it comes in.
|
|
81191
|
-
const readWindowGeometry = (scrollerEl, listEl, horizontal) => {
|
|
81215
|
+
// The screen the render window is framed on, along the scroll axis and in
|
|
81216
|
+
// viewport coordinates: the viewport of the box that scrolls the list — what
|
|
81217
|
+
// "150%" is a percentage of. A box that does not scroll — a list given no
|
|
81218
|
+
// height, as tall as its items — shows no more of them than the browser does:
|
|
81219
|
+
// its viewport is cut by the browser's, or a budget in % would draw items to
|
|
81220
|
+
// fill a screen they make grow.
|
|
81221
|
+
const readWindowScreen = (scrollerEl, horizontal) => {
|
|
81192
81222
|
const scrollerRect = getScrollerViewportRect(scrollerEl);
|
|
81193
|
-
let
|
|
81194
|
-
let
|
|
81223
|
+
let from = horizontal ? scrollerRect.left : scrollerRect.top;
|
|
81224
|
+
let to = horizontal ? scrollerRect.right : scrollerRect.bottom;
|
|
81195
81225
|
if (!canScrollerScroll(scrollerEl, horizontal ? "x" : "y")) {
|
|
81196
81226
|
const browserSize = horizontal ? document.documentElement.clientWidth : document.documentElement.clientHeight;
|
|
81197
|
-
if (
|
|
81198
|
-
|
|
81227
|
+
if (from < 0) {
|
|
81228
|
+
from = 0;
|
|
81199
81229
|
}
|
|
81200
|
-
if (
|
|
81201
|
-
|
|
81230
|
+
if (to > browserSize) {
|
|
81231
|
+
to = browserSize;
|
|
81202
81232
|
}
|
|
81203
81233
|
}
|
|
81234
|
+
return {
|
|
81235
|
+
from,
|
|
81236
|
+
to
|
|
81237
|
+
};
|
|
81238
|
+
};
|
|
81239
|
+
// What the render window is placed and sized on (see evaluateWindow), along
|
|
81240
|
+
// the scroll axis and in viewport coordinates: the size of the screen (see
|
|
81241
|
+
// readWindowScreen), the part of the list on it (the band), and the items
|
|
81242
|
+
// drawn, in the order they stand. A list off screen is met at its edge nearest
|
|
81243
|
+
// to the screen, where it comes in.
|
|
81244
|
+
const readWindowGeometry = (scrollerEl, listEl, horizontal) => {
|
|
81245
|
+
const {
|
|
81246
|
+
from: screenFrom,
|
|
81247
|
+
to: screenTo
|
|
81248
|
+
} = readWindowScreen(scrollerEl, horizontal);
|
|
81204
81249
|
const screenSize = screenTo - screenFrom;
|
|
81205
81250
|
if (screenSize < 1) {
|
|
81206
81251
|
return null;
|