@fasl-work/caos-app-shell 0.6.2 → 0.6.3
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.ts +15 -0
- package/dist/index.js +4 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -68,6 +68,21 @@ interface ShellConfig {
|
|
|
68
68
|
es: string;
|
|
69
69
|
};
|
|
70
70
|
};
|
|
71
|
+
/**
|
|
72
|
+
* Routes whose surface IS the viewport (ADR-0071 rule 1): on these the shell adds
|
|
73
|
+
* `.app-shell.fixed`, which sizes the page to 100dvh and lets flex distribute the
|
|
74
|
+
* height, so the ONE container that owns long content scrolls and the document
|
|
75
|
+
* never does. A doc route is not listed and keeps the document scroll. Matching is
|
|
76
|
+
* exact, or by prefix for a non-root path (`/lab` matches `/lab/case-1`).
|
|
77
|
+
*
|
|
78
|
+
* The stylesheet has carried `.app-shell.fixed` with the note "apps that fill the
|
|
79
|
+
* viewport add it" since the containment fix, and no app could: this component
|
|
80
|
+
* rendered a fixed class string. Measured on Porvenir before this field existed:
|
|
81
|
+
* every tab of the App route scrolled the document by 200 to 770px.
|
|
82
|
+
*/
|
|
83
|
+
fixedRoutes?: string[];
|
|
84
|
+
/** Every route fixed: a single-surface app (a hub, a one-page tool). */
|
|
85
|
+
fixed?: boolean;
|
|
71
86
|
}
|
|
72
87
|
/** The shared CAOS/Faena app shell: sticky header (brand + nav + icon-links + lang/theme) + footer.
|
|
73
88
|
* Wrap your <Routes> (or single landing) in it, inside a Router. */
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext, useState, useRef, useEffect, useCallback, useId, useContext } from 'react';
|
|
2
|
-
import { NavLink } from 'react-router';
|
|
2
|
+
import { useLocation, NavLink } from 'react-router';
|
|
3
3
|
import { Sun, Moon, Languages, Boxes, Github, Globe, Briefcase, Info } from 'lucide-react';
|
|
4
4
|
import { create } from 'zustand';
|
|
5
5
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
@@ -254,7 +254,9 @@ function AppShell({ config, children }) {
|
|
|
254
254
|
const portfolio = config.links.portfolio ?? PORTFOLIO;
|
|
255
255
|
const [archOpen, setArchOpen] = useState(false);
|
|
256
256
|
const archLabel = lang === "es" ? "Arquitectura / C\xF3mo funciona" : "Architecture / How it works";
|
|
257
|
-
|
|
257
|
+
const { pathname } = useLocation();
|
|
258
|
+
const fixed = config.fixed === true || (config.fixedRoutes ?? []).some((p) => p === pathname || p !== "/" && pathname.startsWith(p.replace(/\/$/, "") + "/"));
|
|
259
|
+
return /* @__PURE__ */ jsxs("div", { className: fixed ? "app-shell fixed" : "app-shell", children: [
|
|
258
260
|
/* @__PURE__ */ jsx("header", { className: "site-header", children: /* @__PURE__ */ jsxs("div", { className: "header-inner", children: [
|
|
259
261
|
/* @__PURE__ */ jsxs(NavLink, { to: "/", className: "brand", "aria-label": config.product.name, children: [
|
|
260
262
|
/* @__PURE__ */ jsx("span", { className: "brand-mark", children: config.product.mark ?? /* @__PURE__ */ jsx(Boxes, { size: 18, "aria-hidden": "true" }) }),
|
package/package.json
CHANGED