@nswds/app 6.0.5 → 6.0.7

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/index.d.cts CHANGED
@@ -5877,7 +5877,7 @@ declare function createFormStore<FD extends Record<string, unknown>>(opts: {
5877
5877
  persist: {
5878
5878
  setOptions: (options: Partial<zustand_middleware.PersistOptions<FormStore<FD>, unknown, unknown>>) => void;
5879
5879
  clearStorage: () => void;
5880
- rehydrate: () => Promise<void> | void;
5880
+ rehydrate: () => Promise<void>;
5881
5881
  hasHydrated: () => boolean;
5882
5882
  onHydrate: (fn: (state: FormStore<FD>) => void) => () => void;
5883
5883
  onFinishHydration: (fn: (state: FormStore<FD>) => void) => () => void;
@@ -5987,6 +5987,12 @@ declare function ThemeSelector(props: ThemeSelectorProps): react.JSX.Element;
5987
5987
  declare function ThemeSwitcher(): react.JSX.Element;
5988
5988
 
5989
5989
  declare const TocContext: react.Context<TocContextType>;
5990
+ /**
5991
+ * Turns the table of contents back on for each page. It must not do that with
5992
+ * `key={pathname}`: a key remounts everything below it, and this provider wraps
5993
+ * the whole app, so every client-side navigation would throw away and rebuild
5994
+ * every layout and page, along with their state.
5995
+ */
5990
5996
  declare function TocProvider({ children }: {
5991
5997
  children: ReactNode;
5992
5998
  }): react.JSX.Element;
package/dist/index.d.ts CHANGED
@@ -5877,7 +5877,7 @@ declare function createFormStore<FD extends Record<string, unknown>>(opts: {
5877
5877
  persist: {
5878
5878
  setOptions: (options: Partial<zustand_middleware.PersistOptions<FormStore<FD>, unknown, unknown>>) => void;
5879
5879
  clearStorage: () => void;
5880
- rehydrate: () => Promise<void> | void;
5880
+ rehydrate: () => Promise<void>;
5881
5881
  hasHydrated: () => boolean;
5882
5882
  onHydrate: (fn: (state: FormStore<FD>) => void) => () => void;
5883
5883
  onFinishHydration: (fn: (state: FormStore<FD>) => void) => () => void;
@@ -5987,6 +5987,12 @@ declare function ThemeSelector(props: ThemeSelectorProps): react.JSX.Element;
5987
5987
  declare function ThemeSwitcher(): react.JSX.Element;
5988
5988
 
5989
5989
  declare const TocContext: react.Context<TocContextType>;
5990
+ /**
5991
+ * Turns the table of contents back on for each page. It must not do that with
5992
+ * `key={pathname}`: a key remounts everything below it, and this provider wraps
5993
+ * the whole app, so every client-side navigation would throw away and rebuild
5994
+ * every layout and page, along with their state.
5995
+ */
5990
5996
  declare function TocProvider({ children }: {
5991
5997
  children: ReactNode;
5992
5998
  }): react.JSX.Element;
package/dist/index.js CHANGED
@@ -6546,7 +6546,7 @@ var BarChart = React5__default.forwardRef((props, forwardedRef) => {
6546
6546
  wrapperStyle: { outline: "none" },
6547
6547
  isAnimationActive: true,
6548
6548
  animationDuration: 100,
6549
- cursor: { fill: "#d1d5db", opacity: "0.15" },
6549
+ cursor: { fill: "#d1d5db", opacity: "0.15", stroke: "none" },
6550
6550
  offset: 20,
6551
6551
  position: {
6552
6552
  y: layout === "horizontal" ? 0 : void 0,
@@ -14436,7 +14436,7 @@ function FormatToggle({ format, setFormat }) {
14436
14436
 
14437
14437
  // package.json
14438
14438
  var package_default = {
14439
- version: "6.0.5"};
14439
+ version: "6.0.7"};
14440
14440
  var SluggerContext = React5__default.createContext(null);
14441
14441
  function flattenText(nodes) {
14442
14442
  if (nodes == null || typeof nodes === "boolean") return "";
@@ -20464,16 +20464,22 @@ var TocContext = createContext({
20464
20464
  setToc: () => {
20465
20465
  }
20466
20466
  });
20467
- function InnerTocProvider({ children }) {
20468
- const [toc, setToc] = useState(true);
20469
- const handleSetToc = (value) => {
20470
- setToc(value);
20471
- };
20472
- return /* @__PURE__ */ jsx(TocContext.Provider, { value: { toc, setToc: handleSetToc }, children });
20473
- }
20474
20467
  function TocProvider({ children }) {
20475
- const pathname = usePathname();
20476
- return /* @__PURE__ */ jsx(InnerTocProvider, { children }, pathname);
20468
+ return /* @__PURE__ */ jsx(TocStateProvider, { pathname: usePathname(), children });
20469
+ }
20470
+ function TocStateProvider({ pathname, children }) {
20471
+ const [state, setState] = useState({ pathname, toc: true });
20472
+ if (state.pathname !== pathname) setState({ pathname, toc: true });
20473
+ const toc = state.pathname === pathname ? state.toc : true;
20474
+ const setToc = useCallback(
20475
+ (value2) => setState((current) => {
20476
+ const previous = current.pathname === pathname ? current.toc : true;
20477
+ return { pathname, toc: typeof value2 === "function" ? value2(previous) : value2 };
20478
+ }),
20479
+ [pathname]
20480
+ );
20481
+ const value = useMemo(() => ({ toc, setToc }), [toc, setToc]);
20482
+ return /* @__PURE__ */ jsx(TocContext.Provider, { value, children });
20477
20483
  }
20478
20484
  function useToc() {
20479
20485
  return useContext(TocContext);