@jsenv/navi 0.29.227 → 0.29.229
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 +97 -66
- package/dist/dev/jsenv_navi.js.map +4 -4
- package/dist/jsenv_navi.js +97 -66
- package/dist/jsenv_navi.js.map +4 -4
- package/docs/AI_INSTRUCTIONS.md +3 -2
- package/docs/data_states.md +7 -0
- package/docs/scroll.md +25 -0
- package/package.json +1 -1
package/dist/dev/jsenv_navi.js
CHANGED
|
@@ -3209,6 +3209,12 @@ const actionWeakMap = new WeakMap();
|
|
|
3209
3209
|
*
|
|
3210
3210
|
* @param {Function} callback
|
|
3211
3211
|
* @param {object} [rootOptions]
|
|
3212
|
+
* @param {(params: any, action: object) => any} [rootOptions.provisionalValue] -
|
|
3213
|
+
* a value the action holds while a run is in flight and it has none of its
|
|
3214
|
+
* own, so a screen already knowing the answer draws it as a refresh rather
|
|
3215
|
+
* than a first load (data_states.md). Called at the start of every run whose
|
|
3216
|
+
* value is undefined; the answer replaces it as usual, and `undefined` means
|
|
3217
|
+
* "nothing known". A resource `GET` uses it to draw the row its store holds.
|
|
3212
3218
|
* @param {{ ms?: number, max?: number }} [rootOptions.keep] - how long an
|
|
3213
3219
|
* answer stays good once it has landed. Without it an answer lives exactly as
|
|
3214
3220
|
* long as something references it: the screen that asked goes away, and
|
|
@@ -3248,6 +3254,7 @@ const createAction = (callback, rootOptions = {}) => {
|
|
|
3248
3254
|
value,
|
|
3249
3255
|
resultToValue,
|
|
3250
3256
|
valueToData,
|
|
3257
|
+
provisionalValue,
|
|
3251
3258
|
dataDefault,
|
|
3252
3259
|
data = dataDefault,
|
|
3253
3260
|
|
|
@@ -3706,6 +3713,12 @@ const createAction = (callback, rootOptions = {}) => {
|
|
|
3706
3713
|
actionAbortMap.set(action, abort);
|
|
3707
3714
|
|
|
3708
3715
|
batch(() => {
|
|
3716
|
+
if (provisionalValue && valueSignal.peek() === undefined) {
|
|
3717
|
+
const provisional = provisionalValue(params, action);
|
|
3718
|
+
if (provisional !== undefined) {
|
|
3719
|
+
valueSignal.value = provisional;
|
|
3720
|
+
}
|
|
3721
|
+
}
|
|
3709
3722
|
runningStateSignal.value = RUNNING;
|
|
3710
3723
|
if (!isPrerun) {
|
|
3711
3724
|
isPrerunSignal.value = false;
|
|
@@ -15129,17 +15142,15 @@ const resource = (
|
|
|
15129
15142
|
return item;
|
|
15130
15143
|
},
|
|
15131
15144
|
});
|
|
15132
|
-
const createRestActionForRoot = createRestActionFactoryForRoot(name, {
|
|
15133
|
-
idKey,
|
|
15134
|
-
store,
|
|
15135
|
-
declarationSite,
|
|
15136
|
-
});
|
|
15137
15145
|
// The row a GET designates, when the store already holds it — by its params:
|
|
15138
15146
|
// the value under idKey may be the id or any unique key (a route opening a
|
|
15139
15147
|
// user by id or by slug names both `id`), and a unique key may be given under
|
|
15140
|
-
// its own name
|
|
15141
|
-
//
|
|
15142
|
-
//
|
|
15148
|
+
// its own name. findItemByParams is what a GET draws while its request is in
|
|
15149
|
+
// flight (the action's provisionalValue). findItemInStore adds, when the
|
|
15150
|
+
// params name no row (a GET without params, or whose params carry no key),
|
|
15151
|
+
// the row the action last completed with: that fallback answers a GET under
|
|
15152
|
+
// a network policy (see applyNetworkPolicy) and only there — a GET of a row
|
|
15153
|
+
// the store lacks must draw its skeleton, never the row read just before.
|
|
15143
15154
|
const selectByAnyKey = (value) => {
|
|
15144
15155
|
const item = store.select(value);
|
|
15145
15156
|
if (item) {
|
|
@@ -15191,6 +15202,12 @@ const resource = (
|
|
|
15191
15202
|
return store.select(lastItemId) || null;
|
|
15192
15203
|
});
|
|
15193
15204
|
};
|
|
15205
|
+
const createRestActionForRoot = createRestActionFactoryForRoot(name, {
|
|
15206
|
+
idKey,
|
|
15207
|
+
store,
|
|
15208
|
+
findItemByParams,
|
|
15209
|
+
declarationSite,
|
|
15210
|
+
});
|
|
15194
15211
|
return createResource(name, {
|
|
15195
15212
|
idKey,
|
|
15196
15213
|
uniqueKeys,
|
|
@@ -16182,6 +16199,7 @@ const createRestActionFactoryForRoot = (
|
|
|
16182
16199
|
{
|
|
16183
16200
|
idKey,
|
|
16184
16201
|
store, // see array_signal_store.js
|
|
16202
|
+
findItemByParams,
|
|
16185
16203
|
declarationSite,
|
|
16186
16204
|
},
|
|
16187
16205
|
) => {
|
|
@@ -16253,6 +16271,16 @@ const createRestActionFactoryForRoot = (
|
|
|
16253
16271
|
return applyResultToValue(result);
|
|
16254
16272
|
},
|
|
16255
16273
|
valueToData: (itemId) => store.select(itemId),
|
|
16274
|
+
// While the request is out, the row the store already holds for these
|
|
16275
|
+
// params is drawn: the action starts on the "refresh over a known
|
|
16276
|
+
// answer" line of data_states.md rather than the first-load one.
|
|
16277
|
+
provisionalValue:
|
|
16278
|
+
verb === "GET"
|
|
16279
|
+
? (params) => {
|
|
16280
|
+
const item = untracked(() => findItemByParams(params));
|
|
16281
|
+
return item ? item[idKey] : undefined;
|
|
16282
|
+
}
|
|
16283
|
+
: undefined,
|
|
16256
16284
|
completeSideEffect: onActionComplete,
|
|
16257
16285
|
});
|
|
16258
16286
|
};
|
|
@@ -65632,52 +65660,59 @@ const ListContent = ({
|
|
|
65632
65660
|
children
|
|
65633
65661
|
}) => {
|
|
65634
65662
|
const listProps = useContext(BoxForwardedPropsContext);
|
|
65635
|
-
return
|
|
65636
|
-
|
|
65637
|
-
|
|
65638
|
-
|
|
65639
|
-
|
|
65640
|
-
|
|
65641
|
-
|
|
65642
|
-
|
|
65643
|
-
|
|
65644
|
-
|
|
65645
|
-
|
|
65646
|
-
|
|
65647
|
-
|
|
65648
|
-
|
|
65649
|
-
|
|
65650
|
-
|
|
65651
|
-
|
|
65652
|
-
|
|
65653
|
-
|
|
65654
|
-
|
|
65655
|
-
|
|
65656
|
-
|
|
65657
|
-
|
|
65658
|
-
|
|
65659
|
-
|
|
65660
|
-
|
|
65661
|
-
|
|
65662
|
-
|
|
65663
|
-
|
|
65664
|
-
|
|
65665
|
-
|
|
65666
|
-
|
|
65667
|
-
|
|
65668
|
-
|
|
65669
|
-
|
|
65670
|
-
|
|
65671
|
-
|
|
65672
|
-
|
|
65673
|
-
|
|
65674
|
-
|
|
65675
|
-
|
|
65676
|
-
|
|
65677
|
-
|
|
65663
|
+
return (
|
|
65664
|
+
// Every provider the list puts around its items stands OUTSIDE the <ul>:
|
|
65665
|
+
// the walk that gives the rows their places (see ListDeclaredChildren) is
|
|
65666
|
+
// over the <ul>'s children, and one component between it and the caller's
|
|
65667
|
+
// rows is one child — all the rows would then stand in a single slot, and
|
|
65668
|
+
// reordering them would move nothing.
|
|
65669
|
+
jsx(PendingScrollRefContext.Provider, {
|
|
65670
|
+
value: pendingScrollRef,
|
|
65671
|
+
children: jsx(Box, {
|
|
65672
|
+
className: "navi_list_scroll_container",
|
|
65673
|
+
overflow: overflow,
|
|
65674
|
+
overflowX: overflowX,
|
|
65675
|
+
overflowY: overflowY,
|
|
65676
|
+
...scrollBoxPaddingProps,
|
|
65677
|
+
children: jsx(UnorderedList, {
|
|
65678
|
+
role: role,
|
|
65679
|
+
fallback: fallback,
|
|
65680
|
+
fallbackShown: fallbackShown,
|
|
65681
|
+
searchFallback: searchFallback,
|
|
65682
|
+
searchFallbackShown: searchFallbackShown,
|
|
65683
|
+
loadingPlaceholderShown: loadingPlaceholderShown,
|
|
65684
|
+
error: error,
|
|
65685
|
+
searchNoMatchMode: searchNoMatchMode,
|
|
65686
|
+
separator: separator,
|
|
65687
|
+
itemTransition: itemTransition,
|
|
65688
|
+
expandX: expandX
|
|
65689
|
+
// Deliberately not expandY here (unlike expandX above): the outer
|
|
65690
|
+
// .navi_list_container already gets its own expandY treatment (see
|
|
65691
|
+
// ListUI's own Box above) to fill whatever space its *own* parent
|
|
65692
|
+
// gives it (e.g. a flex-column ancestor's flex-grow) — the <ul>
|
|
65693
|
+
// itself must stay auto-height regardless, or it gets capped to
|
|
65694
|
+
// match .navi_list_scroll_container's own (possibly much smaller)
|
|
65695
|
+
// flex-resolved height instead of its real content height. That
|
|
65696
|
+
// breaks two things at once: virtual scroll's own filler sizing
|
|
65697
|
+
// (nothing to overflow into the scroll container in the first
|
|
65698
|
+
// place) and any sticky List.Item header/footer inside it (their
|
|
65699
|
+
// sticky "containing block" — the <ul>'s own box — would be
|
|
65700
|
+
// artificially small, so they run out of room to stay stuck well
|
|
65701
|
+
// before the user has actually scrolled through all the content).
|
|
65702
|
+
,
|
|
65703
|
+
horizontal: horizontal,
|
|
65704
|
+
spacing: spacing,
|
|
65705
|
+
columns: columns,
|
|
65706
|
+
itemColumns: itemColumns,
|
|
65707
|
+
...listProps,
|
|
65708
|
+
tracker: tracker,
|
|
65709
|
+
renderWindow: renderWindow,
|
|
65710
|
+
virtual: virtual,
|
|
65711
|
+
children: children
|
|
65712
|
+
})
|
|
65678
65713
|
})
|
|
65679
65714
|
})
|
|
65680
|
-
|
|
65715
|
+
);
|
|
65681
65716
|
};
|
|
65682
65717
|
// Where the items sit is a question about the track (the <ul>), not about the
|
|
65683
65718
|
// frame around it: the frame's only child is the scroll box, which fills it and
|
|
@@ -65882,17 +65917,14 @@ const useListScrollSync = ({
|
|
|
65882
65917
|
item
|
|
65883
65918
|
});
|
|
65884
65919
|
};
|
|
65885
|
-
|
|
65886
|
-
|
|
65887
|
-
|
|
65888
|
-
|
|
65889
|
-
const
|
|
65890
|
-
if (
|
|
65891
|
-
|
|
65892
|
-
|
|
65893
|
-
scrollItemIntoView(itemEl);
|
|
65894
|
-
return;
|
|
65895
|
-
}
|
|
65920
|
+
|
|
65921
|
+
// Whether the row is drawn is asked of the dom, not of the render window:
|
|
65922
|
+
// the window says what a run draws, and a list whose rows are declared one
|
|
65923
|
+
// by one has them all in the dom whatever the window says.
|
|
65924
|
+
const itemEl = findRowElement(getListEl(), item.id);
|
|
65925
|
+
if (itemEl) {
|
|
65926
|
+
scrollItemIntoView(itemEl);
|
|
65927
|
+
return;
|
|
65896
65928
|
}
|
|
65897
65929
|
// Not in DOM — shift the render window. The item will read
|
|
65898
65930
|
// pendingScrollRef on mount and scroll into view.
|
|
@@ -66014,9 +66046,8 @@ const useListScrollSync = ({
|
|
|
66014
66046
|
}, []);
|
|
66015
66047
|
// Watch scores of the top renderBudget items.
|
|
66016
66048
|
// When scores change during an active search, scroll to top to reveal the most relevant items.
|
|
66017
|
-
// When search becomes empty,
|
|
66018
|
-
//
|
|
66019
|
-
// and survives render-window shifts or item reordering.
|
|
66049
|
+
// When search becomes empty, put the list back at the offset (and the render
|
|
66050
|
+
// window) it was at when the search started — see docs/scroll.md.
|
|
66020
66051
|
|
|
66021
66052
|
// NOTE POUR LE JOUR OU ON A LE MULTISELECT:
|
|
66022
66053
|
// Lorsqu'on selectionne quelque chose pendant une recherche, alors ensuite meme si on clear
|