@jsenv/navi 0.29.325 → 0.29.327
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 +78 -12
- package/dist/dev/jsenv_navi.js.map +5 -5
- package/dist/jsenv_navi.js +45 -16
- package/dist/jsenv_navi.js.map +5 -5
- package/package.json +2 -2
package/dist/jsenv_navi.js
CHANGED
|
@@ -3092,6 +3092,15 @@ const resolveActionProxies = (actionSet) => {
|
|
|
3092
3092
|
|
|
3093
3093
|
const NO_PARAMS = { __no_params__: true };
|
|
3094
3094
|
const mergeActionParams = (currentParams, newParams) => {
|
|
3095
|
+
if (newParams === null) {
|
|
3096
|
+
// `null` is a question that cannot be asked: a callback destructuring its
|
|
3097
|
+
// params throws on it. It is what a computed says when it has not got
|
|
3098
|
+
// enough to ask with, and "nothing to ask" is said with `undefined`
|
|
3099
|
+
// everywhere below (and by the run guards reading paramsSignal), so it
|
|
3100
|
+
// becomes that here, at the one door params coming from a binding go
|
|
3101
|
+
// through.
|
|
3102
|
+
newParams = undefined;
|
|
3103
|
+
}
|
|
3095
3104
|
// The order of these two checks is load-bearing. Checking `undefined` first
|
|
3096
3105
|
// looks symmetric — "no new params, keep whatever is there, NO_PARAMS
|
|
3097
3106
|
// included" — and breaks routing: merge(NO_PARAMS, undefined) must yield
|
|
@@ -3349,7 +3358,10 @@ const createAction = (callback, rootOptions = {}) => {
|
|
|
3349
3358
|
*
|
|
3350
3359
|
* @param {any} newParamsOrSignal - params, or a signal holding them (the
|
|
3351
3360
|
* result then retargets itself as the signal changes), or an object whose
|
|
3352
|
-
* values may be signals.
|
|
3361
|
+
* values may be signals. A signal with nothing to ask yet — a question
|
|
3362
|
+
* computed from a form still missing a field — holds `undefined` or
|
|
3363
|
+
* `null`: the instance then has no params, which is what
|
|
3364
|
+
* `useAsyncData(action, { run: true })` reads to start nothing.
|
|
3353
3365
|
* @param {object} [options]
|
|
3354
3366
|
* @param {number} [options.debounce] - milliseconds the params must stay
|
|
3355
3367
|
* stable before the instance follows them. What it buys is a screen that
|
|
@@ -10896,9 +10908,11 @@ const swipeTypeOf = (axis, pulled) => {
|
|
|
10896
10908
|
* copy is captured where it lands rather than where it was let go of.
|
|
10897
10909
|
*
|
|
10898
10910
|
* And the promise matters in both cases: the gesture holds its copy until the
|
|
10899
|
-
* answer settles. Returning the transition is what makes a landing continuous;
|
|
10900
|
-
*
|
|
10901
|
-
* screen has to say so.
|
|
10911
|
+
* answer settles. Returning the transition is what makes a landing continuous;
|
|
10912
|
+
* rejecting brings the copy back over the original, because the thing still
|
|
10913
|
+
* exists and the screen has to say so. That holds for every outcome that carries
|
|
10914
|
+
* a copy — `land` and `reorder` as much as `toss` and `leave` — so a place can be
|
|
10915
|
+
* asked about rather than taken: refuse, and the board is as it was.
|
|
10902
10916
|
*
|
|
10903
10917
|
* Starting a document transition is the application's call and not navi's: a
|
|
10904
10918
|
* `view-transition-name` must be unique per document, so only the application can
|
|
@@ -16509,6 +16523,11 @@ const generateSignalId = () => {
|
|
|
16509
16523
|
* as the user moved. `"push"` is for a state whose values ARE places one came
|
|
16510
16524
|
* from (the photo one is looking at in a gallery). Whatever is said here, one
|
|
16511
16525
|
* write can say otherwise: `signal.set(value, { history })`.
|
|
16526
|
+
* Either way every write reaches the address, synchronously, and browsers
|
|
16527
|
+
* refuse an address written too often (Safari: 100 writes per 10 s, then a
|
|
16528
|
+
* SecurityError). A value one DRAGS is written at 60 Hz: keep it in the
|
|
16529
|
+
* gesture while the finger is down and write the state once, on release —
|
|
16530
|
+
* an address is not a recording of a gesture.
|
|
16512
16531
|
* @param {boolean} [options.debug=false] - Enable debug logging for this signal's operations
|
|
16513
16532
|
* @returns {import("@preact/signals").Signal} A signal that can be synchronized with a source signal and/or persisted in localStorage. The signal includes a `validity` property for validation state.
|
|
16514
16533
|
*
|
|
@@ -26544,11 +26563,7 @@ const setupBrowserIntegrationViaHistory = ({
|
|
|
26544
26563
|
[NAV_DEPTH_STATE_KEY]: getNavDepth(),
|
|
26545
26564
|
},
|
|
26546
26565
|
});
|
|
26547
|
-
|
|
26548
|
-
window.history.pushState(effectiveState, null, url);
|
|
26549
|
-
} else {
|
|
26550
|
-
window.history.replaceState(effectiveState, null, url);
|
|
26551
|
-
}
|
|
26566
|
+
writeHistoryEntry(navigationType, effectiveState, url);
|
|
26552
26567
|
rememberEntryIsOfThisDocument();
|
|
26553
26568
|
updateDocumentUrl(url);
|
|
26554
26569
|
updateDocumentState(effectiveState);
|
|
@@ -26568,14 +26583,14 @@ const setupBrowserIntegrationViaHistory = ({
|
|
|
26568
26583
|
[NAV_DEPTH_STATE_KEY]: getNavDepth(),
|
|
26569
26584
|
},
|
|
26570
26585
|
});
|
|
26571
|
-
|
|
26586
|
+
writeHistoryEntry("replace", state, url);
|
|
26572
26587
|
rememberEntryIsOfThisDocument();
|
|
26573
26588
|
} else if (redirected) {
|
|
26574
26589
|
// The entry the browser is on names an address that only sends
|
|
26575
26590
|
// elsewhere — a cold load on it, or a back into it. Written over where
|
|
26576
26591
|
// it stands (the entry keeps its place in the stack, hence its state
|
|
26577
26592
|
// and the depth in it): pressing back must not walk into it again.
|
|
26578
|
-
|
|
26593
|
+
writeHistoryEntry("replace", state, url);
|
|
26579
26594
|
rememberEntryIsOfThisDocument();
|
|
26580
26595
|
}
|
|
26581
26596
|
updateDocumentUrl(url);
|
|
@@ -26828,7 +26843,7 @@ const setupBrowserIntegrationViaHistory = ({
|
|
|
26828
26843
|
// The entry itself has to lose them too, not just the document state:
|
|
26829
26844
|
// getDocumentState() reads the entry back, and every state write copies
|
|
26830
26845
|
// what it finds there onto the next one.
|
|
26831
|
-
|
|
26846
|
+
writeHistoryEntry("replace", state, url);
|
|
26832
26847
|
}
|
|
26833
26848
|
handleRoutingTask(url, {
|
|
26834
26849
|
reason: "routing initialization",
|
|
@@ -26850,11 +26865,25 @@ const setupBrowserIntegrationViaHistory = ({
|
|
|
26850
26865
|
visitedUrlsSignal,
|
|
26851
26866
|
};
|
|
26852
26867
|
};
|
|
26868
|
+
const ADDRESS_WRITE_ADVICE = `An address is not a recording of a gesture: a value dragged per frame belongs to the gesture, and the state bound to the url is written once, on release.`;
|
|
26869
|
+
const writeHistoryEntry = (navigationType, state, url) => {
|
|
26870
|
+
try {
|
|
26871
|
+
if (navigationType === "push") {
|
|
26872
|
+
window.history.pushState(state, null, url);
|
|
26873
|
+
} else {
|
|
26874
|
+
window.history.replaceState(state, null, url);
|
|
26875
|
+
}
|
|
26876
|
+
} catch (e) {
|
|
26877
|
+
if (e.name !== "SecurityError") {
|
|
26878
|
+
throw e;
|
|
26879
|
+
}
|
|
26880
|
+
throw new Error(
|
|
26881
|
+
`The browser refused to write the address ${url}: ${e.message}. ${ADDRESS_WRITE_ADVICE}`,
|
|
26882
|
+
{ cause: e },
|
|
26883
|
+
);
|
|
26884
|
+
}
|
|
26885
|
+
};
|
|
26853
26886
|
|
|
26854
|
-
// Read before the history is written, in both places that ask: a push or a
|
|
26855
|
-
// replace onto the url already displayed. Never a traverse — the browser has
|
|
26856
|
-
// already moved window.location.href when a popstate is handled, so the
|
|
26857
|
-
// comparison would say "same" about every back and forward.
|
|
26858
26887
|
const isStateOnlyNavigation = (
|
|
26859
26888
|
url,
|
|
26860
26889
|
{ navigationType },
|