@nswds/app 6.0.6 → 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.cjs +16 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +16 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -14489,7 +14489,7 @@ function FormatToggle({ format, setFormat }) {
|
|
|
14489
14489
|
|
|
14490
14490
|
// package.json
|
|
14491
14491
|
var package_default = {
|
|
14492
|
-
version: "6.0.
|
|
14492
|
+
version: "6.0.7"};
|
|
14493
14493
|
var SluggerContext = React5__namespace.default.createContext(null);
|
|
14494
14494
|
function flattenText(nodes) {
|
|
14495
14495
|
if (nodes == null || typeof nodes === "boolean") return "";
|
|
@@ -20517,16 +20517,22 @@ var TocContext = React5.createContext({
|
|
|
20517
20517
|
setToc: () => {
|
|
20518
20518
|
}
|
|
20519
20519
|
});
|
|
20520
|
-
function InnerTocProvider({ children }) {
|
|
20521
|
-
const [toc, setToc] = React5.useState(true);
|
|
20522
|
-
const handleSetToc = (value) => {
|
|
20523
|
-
setToc(value);
|
|
20524
|
-
};
|
|
20525
|
-
return /* @__PURE__ */ jsxRuntime.jsx(TocContext.Provider, { value: { toc, setToc: handleSetToc }, children });
|
|
20526
|
-
}
|
|
20527
20520
|
function TocProvider({ children }) {
|
|
20528
|
-
|
|
20529
|
-
|
|
20521
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TocStateProvider, { pathname: navigation.usePathname(), children });
|
|
20522
|
+
}
|
|
20523
|
+
function TocStateProvider({ pathname, children }) {
|
|
20524
|
+
const [state, setState] = React5.useState({ pathname, toc: true });
|
|
20525
|
+
if (state.pathname !== pathname) setState({ pathname, toc: true });
|
|
20526
|
+
const toc = state.pathname === pathname ? state.toc : true;
|
|
20527
|
+
const setToc = React5.useCallback(
|
|
20528
|
+
(value2) => setState((current) => {
|
|
20529
|
+
const previous = current.pathname === pathname ? current.toc : true;
|
|
20530
|
+
return { pathname, toc: typeof value2 === "function" ? value2(previous) : value2 };
|
|
20531
|
+
}),
|
|
20532
|
+
[pathname]
|
|
20533
|
+
);
|
|
20534
|
+
const value = React5.useMemo(() => ({ toc, setToc }), [toc, setToc]);
|
|
20535
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TocContext.Provider, { value, children });
|
|
20530
20536
|
}
|
|
20531
20537
|
function useToc() {
|
|
20532
20538
|
return React5.useContext(TocContext);
|