@jsenv/navi 0.29.328 → 0.29.329

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.
@@ -23526,10 +23526,16 @@ const createRoutePattern = (
23526
23526
  // search params are updated. When buildMostPreciseUrl performs an ancestor
23527
23527
  // optimisation (e.g. "/map/isochrone/compare" → "/map/isochrone") it is trusted
23528
23528
  // as-is because the built pathname will differ from the route's own base pathname.
23529
- // Weak params are never inherited from their signal, but a url that already
23530
- // carries one keeps it: staying on the same screen while another param
23531
- // changes must not end the visit this param qualifies.
23532
- const carryOverWeakParams = (currentUrl, params) => {
23529
+ // A weak param is never inherited from its signal by a url built for a link
23530
+ // (see readSignalForUrlBuild). A url amended in place is another matter: the
23531
+ // route is matching, so the signal IS this visit's state, kept in step with
23532
+ // the address by every routing pass — and what it holds is carried over, so
23533
+ // that changing another param does not end the visit this one qualifies.
23534
+ // Read from the signal, not from the url being amended: several signals
23535
+ // written in one batch flush one url write at a time, and the routing pass
23536
+ // of the first would take the others for gone — and reset them — if the url
23537
+ // it wrote did not already carry what they hold.
23538
+ const carryOverWeakParams = (params) => {
23533
23539
  let paramsWithWeak = params;
23534
23540
  for (const connection of connections) {
23535
23541
  const { paramName } = connection;
@@ -23537,17 +23543,13 @@ const createRoutePattern = (
23537
23543
  continue;
23538
23544
  }
23539
23545
  const currentValue = connection.signal.peek();
23540
- if (currentValue === undefined) {
23541
- continue;
23542
- }
23543
- const currentParams = applyOn(currentUrl);
23544
- if (!currentParams || currentParams[paramName] === undefined) {
23546
+ if (connection.isDefaultValue(currentValue)) {
23545
23547
  continue;
23546
23548
  }
23547
23549
  if (paramsWithWeak === params) {
23548
23550
  paramsWithWeak = { ...params };
23549
23551
  }
23550
- paramsWithWeak[paramName] = currentParams[paramName];
23552
+ paramsWithWeak[paramName] = currentValue;
23551
23553
  }
23552
23554
  return paramsWithWeak;
23553
23555
  };
@@ -23583,7 +23585,7 @@ const createRoutePattern = (
23583
23585
  };
23584
23586
 
23585
23587
  const buildUrlPreservingPath = (currentUrl, params = {}) => {
23586
- params = carryOverWeakParams(currentUrl, params);
23588
+ params = carryOverWeakParams(params);
23587
23589
  if (currentUrl) {
23588
23590
  params = carryOverPathParams(currentUrl, params);
23589
23591
  }
@@ -35898,7 +35900,7 @@ const useUIStateController = (
35898
35900
  // reach until that popup opens. Letting it block interaction would make
35899
35901
  // a picker whose content is loading impossible to open at all.
35900
35902
  getInteractionBlockingControls: () => [],
35901
- onUIAction: (e, { skipCommand } = {}) => {
35903
+ onUIAction: (e, { skipCommand, skipBoundSignal } = {}) => {
35902
35904
  if (controlType === "button" && controller.controlHostProps.name) {
35903
35905
  const buttonName = controller.controlHostProps.name;
35904
35906
  const parentController = controller.parentUIStateController;
@@ -35924,7 +35926,9 @@ const useUIStateController = (
35924
35926
  }
35925
35927
  // Trigger uiAction/command side effects without changing UI state.
35926
35928
  const currentUIState = controller.uiState;
35927
- writeBoundSignal(currentUIState);
35929
+ if (!skipBoundSignal) {
35930
+ writeBoundSignal(currentUIState);
35931
+ }
35928
35932
  s.uiActionInternal?.(currentUIState, e);
35929
35933
  if (s.uiAction) {
35930
35934
  s.uiAction(currentUIState, e);
@@ -36146,7 +36150,15 @@ const useUIStateController = (
36146
36150
  // sync, but do NOT fire the command and do NOT notify the parent —
36147
36151
  // both would cause an infinite loop when a parent cascades state
36148
36152
  // down to its children (child command would re-trigger the cascade).
36149
- controller.onUIAction(e, { skipCommand: true });
36153
+ // A control following what it was given (state_prop_change) does
36154
+ // not write its bound signal either: the signal is what it
36155
+ // follows. The one write that would change it is an emptied
36156
+ // signal refilled with the suggestion the control fell back on —
36157
+ // a state the app just took back, put back by the control.
36158
+ controller.onUIAction(e, {
36159
+ skipCommand: true,
36160
+ skipBoundSignal: e.type === "state_prop_change",
36161
+ });
36150
36162
  }
36151
36163
  if (
36152
36164
  e.type === "facade_propagate_up" ||
@@ -73078,8 +73090,11 @@ const Spin = ({
73078
73090
  // elsewhere on the page — and the control follows it. A control seeded from a
73079
73091
  // signal only writes back into it (see resolveInputProps), which is enough
73080
73092
  // for a field one only ever types into and not for a value that is also moved
73081
- // from outside. Undefined is not a value: the signal has nothing to say, so
73082
- // the control goes back to what it started on.
73093
+ // from outside. A signal holding nothing is left alone: the control goes back
73094
+ // to the suggestion it started on by itself (see resolveValueState), and
73095
+ // asking it to reset would be an act of its own, written into the signal —
73096
+ // the signal could then never hold nothing while a spin is bound to it, and a
73097
+ // day the app took back would come back as today.
73083
73098
  const signalValue = signalProp ? signalProp.value : undefined;
73084
73099
  // The value as of the render this effect belongs to, and not one the closure
73085
73100
  // captured a while ago: a step writes the signal, the signal brings us back
@@ -73093,7 +73108,6 @@ const Spin = ({
73093
73108
  return;
73094
73109
  }
73095
73110
  if (signalValue === undefined) {
73096
- dispatchRequestResetUIState(controlEl);
73097
73111
  return;
73098
73112
  }
73099
73113
  if (signalValue !== valueRef.current) {