@jsenv/navi 0.12.28 → 0.12.30

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.
@@ -7704,6 +7704,10 @@ const createRoute = (urlPatternInput) => {
7704
7704
  wildcardIndex++;
7705
7705
  return replacement;
7706
7706
  });
7707
+ // we did not replace anything, or not enough to remove the last "*"
7708
+ if (relativeUrl.endsWith("*")) {
7709
+ relativeUrl = relativeUrl.slice(0, -1);
7710
+ }
7707
7711
  }
7708
7712
 
7709
7713
  // Add remaining parameters as search params
@@ -9674,26 +9678,16 @@ const useUITransitionContentId = value => {
9674
9678
  }, []);
9675
9679
  };
9676
9680
 
9677
- const renderSignal = signal(null);
9678
- const forceRender = () => {
9679
- renderSignal.value = {}; // force re-render
9680
- };
9681
+ // import { signal } from "@preact/signals";
9682
+
9681
9683
 
9682
9684
  const useForceRender = () => {
9683
- // eslint-disable-next-line no-unused-expressions
9684
- renderSignal.value;
9685
- return forceRender;
9685
+ const [, setState] = useState(null);
9686
+ return () => {
9687
+ setState({});
9688
+ };
9686
9689
  };
9687
9690
 
9688
- // import { useState } from "preact/hooks";
9689
-
9690
- // export const useForceRender = () => {
9691
- // const [, setState] = useState(null);
9692
- // return () => {
9693
- // setState({});
9694
- // };
9695
- // };
9696
-
9697
9691
  /**
9698
9692
  *
9699
9693
  * . Refactor les actions pour qu'elles utilisent use. Ce qui va ouvrir la voie pour
@@ -9712,9 +9706,14 @@ const useForceRender = () => {
9712
9706
  *
9713
9707
  */
9714
9708
 
9709
+ const debug$1 = (...args) => {
9710
+ return;
9711
+ };
9715
9712
  const RootElement = () => {
9716
9713
  return jsx(Route.Slot, {});
9717
9714
  };
9715
+ const SlotContext = createContext(null);
9716
+ const RouteInfoContext = createContext(null);
9718
9717
  const Routes = ({
9719
9718
  element = RootElement,
9720
9719
  children
@@ -9724,8 +9723,6 @@ const Routes = ({
9724
9723
  children: children
9725
9724
  });
9726
9725
  };
9727
- const SlotContext = createContext(null);
9728
- const RouteInfoContext = createContext(null);
9729
9726
  const useActiveRouteInfo = () => useContext(RouteInfoContext);
9730
9727
  const Route = ({
9731
9728
  element,
@@ -9813,8 +9810,13 @@ const initRouteObserver = ({
9813
9810
  onActiveInfoChange,
9814
9811
  registerChildRouteFromContext
9815
9812
  }) => {
9816
- getElementSignature(element);
9817
- const candidateElementIds = Array.from(candidateSet, c => getElementSignature(c.ActiveElement)).join(", ");
9813
+ const [teardown, addTeardown] = createPubSub();
9814
+ const elementId = getElementSignature(element);
9815
+ const candidateElementIds = Array.from(candidateSet, c => getElementSignature(c.ActiveElement));
9816
+ if (candidateElementIds.length === 0) ; else {
9817
+ debug$1(`initRouteObserver ${elementId}, child candidates:
9818
+ - ${candidateElementIds.join("\n - ")}`);
9819
+ }
9818
9820
  const [publishCompositeStatus, subscribeCompositeStatus] = createPubSub();
9819
9821
  const compositeRoute = {
9820
9822
  urlPattern: `composite(${candidateElementIds})`,
@@ -9907,23 +9909,29 @@ const initRouteObserver = ({
9907
9909
  publishCompositeStatus();
9908
9910
  };
9909
9911
  if (route) {
9910
- route.subscribeStatus(onChange);
9912
+ addTeardown(route.subscribeStatus(onChange));
9911
9913
  }
9912
9914
  for (const candidate of candidateSet) {
9913
- candidate.route.subscribeStatus(onChange);
9915
+ addTeardown(candidate.route.subscribeStatus(onChange));
9914
9916
  }
9915
9917
  if (registerChildRouteFromContext) {
9916
9918
  registerChildRouteFromContext(ActiveElement, compositeRoute, fallback, meta);
9917
9919
  }
9918
9920
  updateActiveInfo();
9921
+ return () => {
9922
+ teardown();
9923
+ };
9919
9924
  };
9920
9925
  const RouteSlot = () => {
9921
9926
  const SlotElement = useContext(SlotContext);
9922
- if (!SlotElement) {
9927
+ if (SlotElement === undefined) {
9923
9928
  return jsx("p", {
9924
9929
  children: "RouteSlot must be used inside a Route"
9925
9930
  });
9926
9931
  }
9932
+ if (SlotElement === null) {
9933
+ return null;
9934
+ }
9927
9935
  return jsx(SlotElement, {});
9928
9936
  };
9929
9937
  Route.Slot = RouteSlot;
@@ -11043,6 +11051,10 @@ const initPseudoStyles = (
11043
11051
  const currentState = {};
11044
11052
  for (const pseudoClass of pseudoClasses) {
11045
11053
  const pseudoClassDefinition = PSEUDO_CLASSES[pseudoClass];
11054
+ if (!pseudoClassDefinition) {
11055
+ console.warn(`Unknown pseudo class: ${pseudoClass}`);
11056
+ continue;
11057
+ }
11046
11058
  let currentValue;
11047
11059
  if (
11048
11060
  pseudoState &&