@jsenv/navi 0.29.140 → 0.29.141
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/jsenv_navi.js +217 -219
- package/dist/jsenv_navi.js.map +23 -28
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -61984,12 +61984,9 @@ const ListVirtualContext = createContext(null);
|
|
|
61984
61984
|
// that returning a component of one's own — instead of a bare <List.Item> —
|
|
61985
61985
|
// works the same way.
|
|
61986
61986
|
const ListRowContext = createContext(null);
|
|
61987
|
-
// The slot a child of the list stands in
|
|
61988
|
-
//
|
|
61989
|
-
//
|
|
61990
|
-
// context subscriber is re-rendered even when preact skipped the component
|
|
61991
|
-
// that holds it, which is what lets a row nobody rebuilt follow the list all
|
|
61992
|
-
// the same.
|
|
61987
|
+
// The slot a child of the list stands in, by id (see ListDeclaredChildren). A
|
|
61988
|
+
// row takes its place in the collection by slot: the place is then the list's
|
|
61989
|
+
// to move, and the row's to follow — see createListVirtual.
|
|
61993
61990
|
const ListSlotContext = createContext(null);
|
|
61994
61991
|
const css$x = /* css */`
|
|
61995
61992
|
@layer navi {
|
|
@@ -64947,9 +64944,7 @@ const ListItemUI = props => {
|
|
|
64947
64944
|
// registered the row, decided it is inside the render window, and placed its
|
|
64948
64945
|
// separator. All that is left here is to draw it.
|
|
64949
64946
|
const row = useContext(ListRowContext);
|
|
64950
|
-
|
|
64951
|
-
// ListDeclaredChildren).
|
|
64952
|
-
const slot = useContext(ListSlotContext);
|
|
64947
|
+
const slotId = useContext(ListSlotContext);
|
|
64953
64948
|
// There is no standalone match/matchScore/highlight prop — participation
|
|
64954
64949
|
// in a matching system (search, filter…) only goes through `matchInfo`
|
|
64955
64950
|
// (e.g. useSearchText's getItemMatchInfo(item): { match, matchScore,
|
|
@@ -64975,18 +64970,20 @@ const ListItemUI = props => {
|
|
|
64975
64970
|
// Where a row sits is where it was declared, full stop: a list is written in
|
|
64976
64971
|
// the order it reads. Its slot is what says that — a search that reorders
|
|
64977
64972
|
// rows reorders the rows it declares, and the slots follow. A row drawn by a
|
|
64978
|
-
// run already knows its place; the run gave it.
|
|
64973
|
+
// run already knows its place; the run gave it. The place is taken in the
|
|
64974
|
+
// name of this very component (idDefault, not the row's id): two components
|
|
64975
|
+
// may stand for the same row for a moment, one leaving as the other arrives,
|
|
64976
|
+
// and the one leaving must give back its own place, not the newcomer's.
|
|
64979
64977
|
if (!row) {
|
|
64980
64978
|
if (props.filtered) {
|
|
64981
|
-
virtual.drop(
|
|
64979
|
+
virtual.drop(idDefault);
|
|
64982
64980
|
} else {
|
|
64983
|
-
props.index = virtual.take(
|
|
64981
|
+
props.index = virtual.take(idDefault, 1, slotId);
|
|
64984
64982
|
}
|
|
64985
64983
|
}
|
|
64986
|
-
const rowId = props.id;
|
|
64987
64984
|
useLayoutEffect(() => {
|
|
64988
64985
|
return () => {
|
|
64989
|
-
virtual.drop(
|
|
64986
|
+
virtual.drop(idDefault);
|
|
64990
64987
|
};
|
|
64991
64988
|
}, []);
|
|
64992
64989
|
// Every row that is drawn registers itself, whether it was declared one by
|
|
@@ -65355,9 +65352,10 @@ List.Item = ListItem;
|
|
|
65355
65352
|
// So the places are read off the walk instead of off the renders: the list
|
|
65356
65353
|
// names a slot for each of its children and declares them here, in order,
|
|
65357
65354
|
// before any of them renders (see ListDeclaredChildren). A child then takes
|
|
65358
|
-
// its place BY SLOT and
|
|
65359
|
-
//
|
|
65360
|
-
//
|
|
65355
|
+
// its place BY SLOT, and the place is a signal: it moves when what stands
|
|
65356
|
+
// before it changes — a row filtered out, a run taking in rows, a slot added
|
|
65357
|
+
// or moved — and the child follows, rendered again for it whether or not
|
|
65358
|
+
// anything else would have rendered it.
|
|
65361
65359
|
const createListVirtual = () => {
|
|
65362
65360
|
const totalSignal = signal(0);
|
|
65363
65361
|
// Bumped whenever a run takes in rows. The list itself has to hear about it:
|
|
@@ -65369,100 +65367,108 @@ const createListVirtual = () => {
|
|
|
65369
65367
|
// an attribute: what is drawn is from before, and the app may want to say so
|
|
65370
65368
|
// without taking anything away.
|
|
65371
65369
|
const refreshingSignal = signal(0);
|
|
65372
|
-
//
|
|
65373
|
-
//
|
|
65374
|
-
//
|
|
65375
|
-
const
|
|
65376
|
-
//
|
|
65377
|
-
//
|
|
65370
|
+
// The slots each walk declared, in order, by the slot the walk stands in
|
|
65371
|
+
// (null for the list's own children). Together they are a tree: a group's
|
|
65372
|
+
// rows live inside the group's slot.
|
|
65373
|
+
const slotIdsByParent = new Map();
|
|
65374
|
+
// Who took a place — a row, or a run of rows — and how many rows of the
|
|
65375
|
+
// collection it stands for. The place itself is a signal, see take.
|
|
65378
65376
|
const ownerById = new Map();
|
|
65379
|
-
|
|
65380
|
-
//
|
|
65381
|
-
//
|
|
65382
|
-
|
|
65383
|
-
// going over the others again.
|
|
65384
|
-
const orderedOwnerIds = [];
|
|
65385
|
-
let rowTotal = 0;
|
|
65377
|
+
// The owners standing in each slot, in the order they took their place.
|
|
65378
|
+
// One, as a rule; a child that renders several rows keeps them in the order
|
|
65379
|
+
// they first rendered, which is all it can be told.
|
|
65380
|
+
const ownerIdsBySlot = new Map();
|
|
65386
65381
|
const locatorByOwner = new Map();
|
|
65387
|
-
|
|
65388
|
-
//
|
|
65389
|
-
|
|
65390
|
-
|
|
65382
|
+
// The slots as the tree reads, first to last, and where each stands in it.
|
|
65383
|
+
// Rebuilt once a walk has changed the tree, read to place the owners.
|
|
65384
|
+
const slotWalk = [];
|
|
65385
|
+
const rankBySlot = new Map();
|
|
65386
|
+
let rowTotal = 0;
|
|
65387
|
+
// Owners have left and the others have not been moved up yet. Done on the
|
|
65388
|
+
// next ask rather than on the spot: rows leave many at a time (a search, a
|
|
65389
|
+
// list unmounting), and moving the others up once is enough.
|
|
65391
65390
|
let placesStale = false;
|
|
65392
|
-
|
|
65393
|
-
//
|
|
65394
|
-
//
|
|
65395
|
-
|
|
65396
|
-
|
|
65397
|
-
|
|
65398
|
-
|
|
65399
|
-
|
|
65400
|
-
|
|
65391
|
+
// Where the last slot holding an owner stands: an owner arriving at or after
|
|
65392
|
+
// it is placed at the end without going over the others — a whole first
|
|
65393
|
+
// render, rows arriving in order, costs each row nothing but itself.
|
|
65394
|
+
let rankOwnedLast = -1;
|
|
65395
|
+
const rebuildWalk = () => {
|
|
65396
|
+
slotWalk.length = 0;
|
|
65397
|
+
rankBySlot.clear();
|
|
65398
|
+
const visit = parentSlotId => {
|
|
65399
|
+
const slotIds = slotIdsByParent.get(parentSlotId);
|
|
65400
|
+
if (!slotIds) {
|
|
65401
|
+
return;
|
|
65401
65402
|
}
|
|
65402
|
-
|
|
65403
|
-
|
|
65404
|
-
|
|
65405
|
-
|
|
65403
|
+
for (const slotId of slotIds) {
|
|
65404
|
+
rankBySlot.set(slotId, slotWalk.length);
|
|
65405
|
+
slotWalk.push(slotId);
|
|
65406
|
+
visit(slotId);
|
|
65406
65407
|
}
|
|
65407
|
-
}
|
|
65408
|
-
|
|
65409
|
-
// Where a slot sits, said as the ranks of the slots it lives in, outermost
|
|
65410
|
-
// first: comparing two of them keeps a group's rows inside their group and
|
|
65411
|
-
// the groups where the list declared them.
|
|
65412
|
-
const pathOf = slotId => {
|
|
65413
|
-
const pathCached = pathCache.get(slotId);
|
|
65414
|
-
if (pathCached) {
|
|
65415
|
-
return pathCached;
|
|
65416
|
-
}
|
|
65417
|
-
const slot = slotById.get(slotId);
|
|
65418
|
-
if (!slot) {
|
|
65419
|
-
return null;
|
|
65420
|
-
}
|
|
65421
|
-
let path;
|
|
65422
|
-
if (slot.parentId === null) {
|
|
65423
|
-
path = [slot.order];
|
|
65424
|
-
} else {
|
|
65425
|
-
const parentPath = pathOf(slot.parentId);
|
|
65426
|
-
path = parentPath === null ? [slot.order] : [...parentPath, slot.order];
|
|
65427
|
-
}
|
|
65428
|
-
pathCache.set(slotId, path);
|
|
65429
|
-
return path;
|
|
65408
|
+
};
|
|
65409
|
+
visit(null);
|
|
65430
65410
|
};
|
|
65431
|
-
//
|
|
65432
|
-
//
|
|
65433
|
-
//
|
|
65434
|
-
// slot moving or a child taking a different number of rows.
|
|
65411
|
+
// Every place, in one go: a place is the sum of what stands before it, so
|
|
65412
|
+
// there is nothing to hand out one at a time. Writing a place that did not
|
|
65413
|
+
// change wakes nobody — a signal ignores a value equal to its own.
|
|
65435
65414
|
const refreshPlaces = () => {
|
|
65436
65415
|
placesStale = false;
|
|
65437
|
-
const owners = [...ownerById.entries()];
|
|
65438
|
-
owners.sort(([, leftOwner], [, rightOwner]) => {
|
|
65439
|
-
const comparison = comparePath(pathOf(leftOwner.slotId), pathOf(rightOwner.slotId));
|
|
65440
|
-
if (comparison !== 0) {
|
|
65441
|
-
return comparison;
|
|
65442
|
-
}
|
|
65443
|
-
return leftOwner.sequence - rightOwner.sequence;
|
|
65444
|
-
});
|
|
65445
|
-
orderedOwnerIds.length = 0;
|
|
65446
65416
|
let index = 0;
|
|
65447
|
-
|
|
65448
|
-
|
|
65449
|
-
|
|
65450
|
-
|
|
65417
|
+
let rank = 0;
|
|
65418
|
+
rankOwnedLast = -1;
|
|
65419
|
+
while (rank < slotWalk.length) {
|
|
65420
|
+
const ownerIds = ownerIdsBySlot.get(slotWalk[rank]);
|
|
65421
|
+
if (ownerIds) {
|
|
65422
|
+
for (const ownerId of ownerIds) {
|
|
65423
|
+
const owner = ownerById.get(ownerId);
|
|
65424
|
+
owner.placeSignal.value = index;
|
|
65425
|
+
index += owner.rowCount;
|
|
65426
|
+
}
|
|
65427
|
+
rankOwnedLast = rank;
|
|
65428
|
+
}
|
|
65429
|
+
rank++;
|
|
65451
65430
|
}
|
|
65452
65431
|
rowTotal = index;
|
|
65453
|
-
totalSignal.value =
|
|
65432
|
+
totalSignal.value = index;
|
|
65454
65433
|
};
|
|
65455
|
-
|
|
65456
|
-
|
|
65457
|
-
if (
|
|
65458
|
-
|
|
65434
|
+
const addToSlot = (slotId, ownerId) => {
|
|
65435
|
+
const ownerIds = ownerIdsBySlot.get(slotId);
|
|
65436
|
+
if (ownerIds) {
|
|
65437
|
+
ownerIds.push(ownerId);
|
|
65438
|
+
} else {
|
|
65439
|
+
ownerIdsBySlot.set(slotId, [ownerId]);
|
|
65440
|
+
}
|
|
65441
|
+
};
|
|
65442
|
+
const removeFromSlot = (slotId, ownerId) => {
|
|
65443
|
+
const ownerIds = ownerIdsBySlot.get(slotId);
|
|
65444
|
+
if (!ownerIds) {
|
|
65445
|
+
return;
|
|
65459
65446
|
}
|
|
65460
|
-
const
|
|
65461
|
-
|
|
65462
|
-
|
|
65463
|
-
|
|
65447
|
+
const index = ownerIds.indexOf(ownerId);
|
|
65448
|
+
if (index !== -1) {
|
|
65449
|
+
ownerIds.splice(index, 1);
|
|
65450
|
+
}
|
|
65451
|
+
if (ownerIds.length === 0) {
|
|
65452
|
+
ownerIdsBySlot.delete(slotId);
|
|
65453
|
+
}
|
|
65454
|
+
};
|
|
65455
|
+
// A slot the walk no longer names: whatever stood in it is gone, and so is
|
|
65456
|
+
// whatever a walk inside it had declared.
|
|
65457
|
+
const dropSlot = slotId => {
|
|
65458
|
+
const ownerIds = ownerIdsBySlot.get(slotId);
|
|
65459
|
+
if (ownerIds) {
|
|
65460
|
+
for (const ownerId of ownerIds) {
|
|
65461
|
+
ownerById.delete(ownerId);
|
|
65462
|
+
}
|
|
65463
|
+
ownerIdsBySlot.delete(slotId);
|
|
65464
|
+
}
|
|
65465
|
+
const childSlotIds = slotIdsByParent.get(slotId);
|
|
65466
|
+
if (childSlotIds) {
|
|
65467
|
+
slotIdsByParent.delete(slotId);
|
|
65468
|
+
for (const childSlotId of childSlotIds) {
|
|
65469
|
+
dropSlot(childSlotId);
|
|
65470
|
+
}
|
|
65464
65471
|
}
|
|
65465
|
-
return lastOwner.sequence < owner.sequence;
|
|
65466
65472
|
};
|
|
65467
65473
|
const virtual = {
|
|
65468
65474
|
totalSignal,
|
|
@@ -65486,40 +65492,30 @@ const createListVirtual = () => {
|
|
|
65486
65492
|
renderSkeleton: undefined,
|
|
65487
65493
|
// The children a walk stands over, in order — said in one call, before any
|
|
65488
65494
|
// of them renders, so that what a child asks next is answered against the
|
|
65489
|
-
// whole picture and not against the children that happened to render
|
|
65495
|
+
// whole picture and not against the children that happened to render
|
|
65496
|
+
// first. Said again on every render of the walk, and heard only when
|
|
65497
|
+
// something moved.
|
|
65490
65498
|
declareSlots: (parentSlotId, slotIds) => {
|
|
65491
|
-
const
|
|
65492
|
-
|
|
65493
|
-
|
|
65494
|
-
dropSlot(slotId);
|
|
65495
|
-
pathCache.clear();
|
|
65496
|
-
placesStale = true;
|
|
65497
|
-
}
|
|
65499
|
+
const slotIdsPrevious = slotIdsByParent.get(parentSlotId);
|
|
65500
|
+
if (slotIdsPrevious && sameSlotIds(slotIdsPrevious, slotIds)) {
|
|
65501
|
+
return;
|
|
65498
65502
|
}
|
|
65499
|
-
|
|
65500
|
-
|
|
65501
|
-
const
|
|
65502
|
-
|
|
65503
|
-
|
|
65504
|
-
|
|
65505
|
-
slotById.set(slotId, {
|
|
65506
|
-
parentId: parentSlotId,
|
|
65507
|
-
order
|
|
65508
|
-
});
|
|
65509
|
-
} else if (slot.order !== order) {
|
|
65510
|
-
slot.order = order;
|
|
65511
|
-
pathCache.clear();
|
|
65512
|
-
placesStale = true;
|
|
65503
|
+
if (slotIdsPrevious) {
|
|
65504
|
+
const slotIdSet = new Set(slotIds);
|
|
65505
|
+
for (const slotId of slotIdsPrevious) {
|
|
65506
|
+
if (!slotIdSet.has(slotId)) {
|
|
65507
|
+
dropSlot(slotId);
|
|
65508
|
+
}
|
|
65513
65509
|
}
|
|
65514
|
-
order++;
|
|
65515
|
-
}
|
|
65516
|
-
// Now, rather than when the first child asks: the walk has just said
|
|
65517
|
-
// where everything stands, so every place can be settled once instead of
|
|
65518
|
-
// once per child.
|
|
65519
|
-
if (placesStale) {
|
|
65520
|
-
refreshPlaces();
|
|
65521
65510
|
}
|
|
65511
|
+
slotIdsByParent.set(parentSlotId, slotIds);
|
|
65512
|
+
rebuildWalk();
|
|
65513
|
+
refreshPlaces();
|
|
65522
65514
|
},
|
|
65515
|
+
// Whether something has taken this slot for its own: what it renders
|
|
65516
|
+
// inside is then its to place (a run draws its groups with their rows
|
|
65517
|
+
// already placed), and no walk inside it has anything to declare.
|
|
65518
|
+
slotHasOwner: slotId => ownerIdsBySlot.has(slotId),
|
|
65523
65519
|
// Whether any run of rows lives in this list: what makes a render window
|
|
65524
65520
|
// mean anything (see List's renderBudget).
|
|
65525
65521
|
hasRuns: () => locatorByOwner.size > 0,
|
|
@@ -65539,127 +65535,129 @@ const createListVirtual = () => {
|
|
|
65539
65535
|
}
|
|
65540
65536
|
return null;
|
|
65541
65537
|
},
|
|
65542
|
-
// The place the
|
|
65543
|
-
//
|
|
65544
|
-
// and answered
|
|
65545
|
-
//
|
|
65538
|
+
// The place the owner's rows start at — read from a signal, so that the
|
|
65539
|
+
// owner is rendered again when it moves (see createListVirtual). Asked on
|
|
65540
|
+
// every render, and answered without a second look for as long as the
|
|
65541
|
+
// owner stands in the same slot for the same number of rows.
|
|
65546
65542
|
take: (ownerId, rowCount, slotId) => {
|
|
65547
|
-
|
|
65548
|
-
if (
|
|
65543
|
+
let owner = ownerById.get(ownerId);
|
|
65544
|
+
if (owner) {
|
|
65545
|
+
if (owner.slotId !== slotId || owner.rowCount !== rowCount) {
|
|
65546
|
+
removeFromSlot(owner.slotId, ownerId);
|
|
65547
|
+
addToSlot(slotId, ownerId);
|
|
65548
|
+
owner.slotId = slotId;
|
|
65549
|
+
owner.rowCount = rowCount;
|
|
65550
|
+
placesStale = true;
|
|
65551
|
+
}
|
|
65549
65552
|
if (placesStale) {
|
|
65550
65553
|
refreshPlaces();
|
|
65551
65554
|
}
|
|
65552
|
-
return
|
|
65555
|
+
return owner.placeSignal.value;
|
|
65556
|
+
}
|
|
65557
|
+
if (placesStale) {
|
|
65558
|
+
refreshPlaces();
|
|
65553
65559
|
}
|
|
65554
|
-
const
|
|
65560
|
+
const rank = rankBySlot.get(slotId);
|
|
65561
|
+
addToSlot(slotId, ownerId);
|
|
65562
|
+
if (rank !== undefined && rank >= rankOwnedLast) {
|
|
65563
|
+
owner = {
|
|
65564
|
+
slotId,
|
|
65565
|
+
rowCount,
|
|
65566
|
+
placeSignal: signal(rowTotal)
|
|
65567
|
+
};
|
|
65568
|
+
ownerById.set(ownerId, owner);
|
|
65569
|
+
rowTotal += rowCount;
|
|
65570
|
+
rankOwnedLast = rank;
|
|
65571
|
+
totalSignal.value = rowTotal;
|
|
65572
|
+
return owner.placeSignal.value;
|
|
65573
|
+
}
|
|
65574
|
+
owner = {
|
|
65555
65575
|
slotId,
|
|
65556
65576
|
rowCount,
|
|
65557
|
-
|
|
65577
|
+
placeSignal: signal(0)
|
|
65558
65578
|
};
|
|
65559
65579
|
ownerById.set(ownerId, owner);
|
|
65560
|
-
if (!previous && !placesStale && standsLast(owner)) {
|
|
65561
|
-
orderedOwnerIds.push(ownerId);
|
|
65562
|
-
placeByOwner.set(ownerId, rowTotal);
|
|
65563
|
-
rowTotal += rowCount;
|
|
65564
|
-
totalSignal.value = rowTotal;
|
|
65565
|
-
return placeByOwner.get(ownerId);
|
|
65566
|
-
}
|
|
65567
|
-
placesStale = true;
|
|
65568
65580
|
refreshPlaces();
|
|
65569
|
-
return
|
|
65581
|
+
return owner.placeSignal.value;
|
|
65570
65582
|
},
|
|
65571
|
-
// The
|
|
65572
|
-
//
|
|
65583
|
+
// The owner stands for no row of the collection: it was filtered out by a
|
|
65584
|
+
// search, or it is gone.
|
|
65573
65585
|
drop: ownerId => {
|
|
65574
|
-
|
|
65586
|
+
const owner = ownerById.get(ownerId);
|
|
65587
|
+
if (!owner) {
|
|
65575
65588
|
return;
|
|
65576
65589
|
}
|
|
65577
|
-
|
|
65578
|
-
|
|
65590
|
+
ownerById.delete(ownerId);
|
|
65591
|
+
removeFromSlot(owner.slotId, ownerId);
|
|
65592
|
+
if (placesStale) {
|
|
65593
|
+
return;
|
|
65594
|
+
}
|
|
65595
|
+
placesStale = true;
|
|
65596
|
+
queueMicrotask(() => {
|
|
65597
|
+
if (placesStale) {
|
|
65598
|
+
refreshPlaces();
|
|
65599
|
+
}
|
|
65600
|
+
});
|
|
65579
65601
|
}
|
|
65580
65602
|
};
|
|
65581
65603
|
return virtual;
|
|
65582
65604
|
};
|
|
65583
|
-
|
|
65584
|
-
|
|
65585
|
-
|
|
65586
|
-
|
|
65605
|
+
const sameSlotIds = (left, right) => {
|
|
65606
|
+
if (left.length !== right.length) {
|
|
65607
|
+
return false;
|
|
65608
|
+
}
|
|
65609
|
+
let index = 0;
|
|
65610
|
+
while (index < left.length) {
|
|
65611
|
+
if (left[index] !== right[index]) {
|
|
65612
|
+
return false;
|
|
65613
|
+
}
|
|
65614
|
+
index++;
|
|
65615
|
+
}
|
|
65616
|
+
return true;
|
|
65617
|
+
};
|
|
65618
|
+
|
|
65619
|
+
// The walk that gives the list's children their places: a slot for each of
|
|
65620
|
+
// them, declared to the list's virtual all at once before any child renders,
|
|
65621
|
+
// and handed to the child through a provider of its own — which is what lets
|
|
65622
|
+
// the row reach it however deep the caller buried it in components of theirs.
|
|
65587
65623
|
//
|
|
65588
|
-
//
|
|
65589
|
-
//
|
|
65590
|
-
//
|
|
65591
|
-
//
|
|
65624
|
+
// A slot is named the way preact tells the child apart: by key when it has
|
|
65625
|
+
// one, by position otherwise, and inside the array it was given in — a nested
|
|
65626
|
+
// array is one child to preact, so what follows the array keeps its name
|
|
65627
|
+
// however many rows the array holds. A child preact would not render (null,
|
|
65628
|
+
// a boolean) has no slot: it is not there.
|
|
65592
65629
|
const ListDeclaredChildren = ({
|
|
65593
65630
|
children
|
|
65594
65631
|
}) => {
|
|
65595
65632
|
const virtual = useContext(ListVirtualContext);
|
|
65596
|
-
const
|
|
65597
|
-
|
|
65598
|
-
|
|
65599
|
-
const slotsPrevious = slotsRef.current;
|
|
65600
|
-
const childArray = flattenChildren(children);
|
|
65601
|
-
const slots = new Map();
|
|
65602
|
-
const slotIds = [];
|
|
65603
|
-
let index = 0;
|
|
65604
|
-
for (const child of childArray) {
|
|
65605
|
-
const childKey = child && child.key !== undefined && child.key !== null ? `k${child.key}` : `i${index}`;
|
|
65606
|
-
let slotId = parentSlotId === null ? childKey : `${parentSlotId}/${childKey}`;
|
|
65607
|
-
if (slots.has(slotId)) {
|
|
65608
|
-
// Two children answering to the same key: preact cannot tell them apart
|
|
65609
|
-
// either, but a slot each is what keeps them both on screen.
|
|
65610
|
-
slotId = `${slotId}#${index}`;
|
|
65611
|
-
}
|
|
65612
|
-
const slotPrevious = slotsPrevious.get(slotId);
|
|
65613
|
-
slots.set(slotId, slotPrevious && slotPrevious.order === index ? slotPrevious : {
|
|
65614
|
-
id: slotId,
|
|
65615
|
-
order: index
|
|
65616
|
-
});
|
|
65617
|
-
slotIds.push(slotId);
|
|
65618
|
-
index++;
|
|
65633
|
+
const parentSlotId = useContext(ListSlotContext);
|
|
65634
|
+
if (parentSlotId !== null && virtual.slotHasOwner(parentSlotId)) {
|
|
65635
|
+
return children;
|
|
65619
65636
|
}
|
|
65620
|
-
|
|
65637
|
+
const slotIds = [];
|
|
65638
|
+
const declared = [];
|
|
65639
|
+
declareChildren(children, parentSlotId === null ? "" : `${parentSlotId}/`, slotIds, declared);
|
|
65621
65640
|
virtual.declareSlots(parentSlotId, slotIds);
|
|
65622
65641
|
return jsx(Fragment$1, {
|
|
65623
|
-
children:
|
|
65624
|
-
const slotId = slotIds[childIndex];
|
|
65625
|
-
return jsx(ListSlotContext.Provider, {
|
|
65626
|
-
value: slots.get(slotId),
|
|
65627
|
-
children: child
|
|
65628
|
-
}, slotId);
|
|
65629
|
-
})
|
|
65642
|
+
children: declared
|
|
65630
65643
|
});
|
|
65631
65644
|
};
|
|
65632
|
-
|
|
65633
|
-
|
|
65634
|
-
|
|
65635
|
-
|
|
65636
|
-
|
|
65637
|
-
|
|
65638
|
-
|
|
65639
|
-
|
|
65640
|
-
|
|
65641
|
-
|
|
65642
|
-
|
|
65643
|
-
|
|
65644
|
-
};
|
|
65645
|
-
|
|
65646
|
-
// Two slots compared by where they sit (see pathOf). A slot no walk declared
|
|
65647
|
-
// sorts after them all: it stands nowhere the list knows of.
|
|
65648
|
-
const comparePath = (leftPath, rightPath) => {
|
|
65649
|
-
if (leftPath === null) {
|
|
65650
|
-
return rightPath === null ? 0 : 1;
|
|
65651
|
-
}
|
|
65652
|
-
if (rightPath === null) {
|
|
65653
|
-
return -1;
|
|
65654
|
-
}
|
|
65655
|
-
let depth = 0;
|
|
65656
|
-
while (depth < leftPath.length && depth < rightPath.length) {
|
|
65657
|
-
if (leftPath[depth] !== rightPath[depth]) {
|
|
65658
|
-
return leftPath[depth] - rightPath[depth];
|
|
65645
|
+
const declareChildren = (children, prefix, slotIds, declared) => {
|
|
65646
|
+
const childArray = Array.isArray(children) ? children : [children];
|
|
65647
|
+
let index = 0;
|
|
65648
|
+
for (const child of childArray) {
|
|
65649
|
+
if (Array.isArray(child)) {
|
|
65650
|
+
declareChildren(child, `${prefix}${index}/`, slotIds, declared);
|
|
65651
|
+
} else if (child !== null && child !== undefined && child !== false && child !== true) {
|
|
65652
|
+
const slotId = child.key === undefined || child.key === null ? `${prefix}i${index}` : `${prefix}k${child.key}`;
|
|
65653
|
+
slotIds.push(slotId);
|
|
65654
|
+
declared.push(jsx(ListSlotContext.Provider, {
|
|
65655
|
+
value: slotId,
|
|
65656
|
+
children: child
|
|
65657
|
+
}, slotId));
|
|
65659
65658
|
}
|
|
65660
|
-
|
|
65659
|
+
index++;
|
|
65661
65660
|
}
|
|
65662
|
-
return leftPath.length - rightPath.length;
|
|
65663
65661
|
};
|
|
65664
65662
|
const VISIBILITY_HIDDEN_STYLE = {
|
|
65665
65663
|
visibility: "hidden"
|
|
@@ -65795,7 +65793,7 @@ const ListItems = ({
|
|
|
65795
65793
|
}) => {
|
|
65796
65794
|
const ownerId = useId();
|
|
65797
65795
|
const virtual = useContext(ListVirtualContext);
|
|
65798
|
-
const
|
|
65796
|
+
const slotId = useContext(ListSlotContext);
|
|
65799
65797
|
const renderWindow = useContext(RenderWindowContext);
|
|
65800
65798
|
const separator = useContext(SeparatorContext);
|
|
65801
65799
|
const store = useItemStore({
|
|
@@ -65817,7 +65815,7 @@ const ListItems = ({
|
|
|
65817
65815
|
skeletonRow.rowMinHeight = `${virtualItemSize}px`;
|
|
65818
65816
|
}
|
|
65819
65817
|
}
|
|
65820
|
-
const runStart = virtual.take(ownerId, store.rowCount,
|
|
65818
|
+
const runStart = virtual.take(ownerId, store.rowCount, slotId);
|
|
65821
65819
|
const runEnd = runStart + store.rowCount;
|
|
65822
65820
|
const getItemAt = index => store.getItem(index);
|
|
65823
65821
|
const windowFrom = renderWindow.start > runStart ? renderWindow.start : runStart;
|