diff --git a/README.md b/README.md index 8d9329e3d..76f4bf023 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,18 @@ export default config; The package ships Base Nova tokens, fonts, preflight, animations, and compiled theme CSS. Consumer Tailwind/Sass config is neither required nor read. +## Container width + +The navbar, docs content, footer, OpenAPI layout, and large dialogs share a `90rem` maximum width by default. Set one theme option to use a narrower or wider constant: + +```ts +themes: [ + ["@aeei/docusaurus-theme", { containerMaxWidth: "80rem" }], +], +``` + +Positive `px`/`rem` strings are accepted. Numbers are interpreted as pixels. + ## Search Search is disabled by default. @@ -172,7 +184,7 @@ Requirements: Consumers then install a pinned release: ```bash -npm install @aeei/docusaurus-theme@0.1.10 +npm install @aeei/docusaurus-theme@0.1.11 ``` This repository does not publish automatically from an unapproved working tree. diff --git a/UPSTREAM.md b/UPSTREAM.md index 5a2051d51..add3864cf 100644 --- a/UPSTREAM.md +++ b/UPSTREAM.md @@ -37,4 +37,4 @@ This repository is a maintained fork of [`PaloAltoNetworks/docusaurus-openapi-do - Last integrated upstream release: `v5.1.3` - Upstream baseline commit: `d5af4f22e951712e084df8b7c513a1708e56d372` -- Current AEEI theme release: `0.1.10` +- Current AEEI theme release: `0.1.11` diff --git a/demo/customMdGenerators.ts b/demo/customMdGenerators.ts index 004988eb3..74fc30d9e 100644 --- a/demo/customMdGenerators.ts +++ b/demo/customMdGenerators.ts @@ -48,7 +48,7 @@ export function myCustomApiMdGenerator({ `import RequestSchema from "@theme/RequestSchema";\n`, `import StatusCodes from "@theme/StatusCodes";\n`, `import OperationTabs from "@theme/OperationTabs";\n`, - `import TabItem from "@theme/TabItem";\n`, + `import TabItem from "@theme/ApiTabItem";\n`, `import Heading from "@theme/Heading";\n`, `import Translate from "@docusaurus/Translate";\n\n`, createHeading(title), diff --git a/demo/docs/intro.mdx b/demo/docs/intro.mdx index 6dee428cf..96793eaf9 100644 --- a/demo/docs/intro.mdx +++ b/demo/docs/intro.mdx @@ -239,6 +239,8 @@ The `docusaurus-plugin-openapi-docs` plugin can be configured with the following > You may optionally configure a `sidebarOptions`. In doing so, an individual `sidebar.js` slice with the configured options will be generated within the respective `outputDir`. +### versions + `versions` can be configured with the following options: | Name | Type | Default | Description | diff --git a/demo/docusaurus.config.ts b/demo/docusaurus.config.ts index 15baf699a..f920991cf 100644 --- a/demo/docusaurus.config.ts +++ b/demo/docusaurus.config.ts @@ -63,6 +63,7 @@ const config: Config = { respectPrefersColorScheme: true, }, navbar: { + title: "OpenAPI Docs", logo: { alt: "OpenAPI Docs", src: "img/docusaurus-openapi-docs-logo.svg", @@ -96,15 +97,13 @@ const config: Config = { { type: "custom-PalettePicker", position: "right" }, { href: "https://medium.com/palo-alto-networks-developer-blog", + label: "Blog", position: "right", - className: "header-medium-link", - "aria-label": "Palo Alto Networks Developer Blog", }, { href: "https://github.com/PaloAltoNetworks/docusaurus-openapi-docs", + label: "GitHub", position: "right", - className: "header-github-link", - "aria-label": "GitHub repository", }, ], }, @@ -262,11 +261,6 @@ const config: Config = { logoClass: "rust", }, ], - algolia: { - apiKey: "441074cace987cbf4640c039ebed303c", - appId: "J0EABTYI1A", - indexName: "docusaurus-openapi", - }, announcementBar: { id: "announcementBar_2", content: "v5.0.0 is now available! Requires Docusaurus 3.10.0+", @@ -387,7 +381,6 @@ const config: Config = { } satisfies Plugin.PluginOptions, }, ], - // FOUC prevention: restore saved palette before React hydrates function paletteScript() { return { name: "palette-fouc-script", @@ -404,12 +397,12 @@ const config: Config = { }; }, ], - themes: ["docusaurus-theme-openapi-docs"], - stylesheets: [ - { - href: "https://use.fontawesome.com/releases/v5.11.0/css/all.css", - type: "text/css", - }, + themes: [ + "docusaurus-theme-openapi-docs", + [ + "@aeei/docusaurus-theme", + { search: "local", copyPage: true, containerMaxWidth: "90rem" }, + ], ], }; diff --git a/demo/package.json b/demo/package.json index f96b58fc9..913b87c26 100644 --- a/demo/package.json +++ b/demo/package.json @@ -16,7 +16,7 @@ "clean-api-docs": "docusaurus clean-api-docs", "gen-api-docs:version": "docusaurus gen-api-docs:version", "clean-api-docs:version": "docusaurus clean-api-docs:version", - "gen-all": "docusaurus gen-api-docs all --all-versions", + "gen-all": "docusaurus clean-api-docs all --all-versions && docusaurus gen-api-docs all --all-versions", "clean-all": "docusaurus clean-api-docs all --all-versions", "re-gen": "yarn clean-all-versions && yarn gen-all-versions" }, @@ -25,9 +25,11 @@ "@docusaurus/faster": "3.10.2", "@docusaurus/plugin-google-gtag": "3.10.2", "@docusaurus/preset-classic": "3.10.2", + "@aeei/docusaurus-theme": "*", "clsx": "^2.1.1", "docusaurus-plugin-openapi-docs": "*", "docusaurus-theme-openapi-docs": "*", + "lucide-react": "^0.468.0", "prism-react-renderer": "^2.3.0", "react": "^19.0.0", "react-dom": "^19.0.0" diff --git a/demo/src/components/PalettePicker/index.tsx b/demo/src/components/PalettePicker/index.tsx index ee31f2361..f21262e66 100644 --- a/demo/src/components/PalettePicker/index.tsx +++ b/demo/src/components/PalettePicker/index.tsx @@ -1,16 +1,17 @@ -/* ============================================================================ - * PalettePicker — runtime color palette switcher for the navbar. - * - * Desktop: pill button in the top bar that opens a dropdown. - * Mobile: section rendered inside the hamburger drawer (mobile={true}). - * - * Dynamically injects /themes/.css into and persists - * the choice in localStorage under 'openapi-demo-palette'. - * ========================================================================== */ +import React, { useEffect, useState } from "react"; -import React, { useEffect, useRef, useState } from "react"; +import { ChevronDown } from "lucide-react"; -import styles from "./styles.module.css"; +import { Button } from "@aeei/docusaurus-theme/lib-theme/theme/components/ui/button"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuGroup, + DropdownMenuLabel, + DropdownMenuRadioGroup, + DropdownMenuRadioItem, + DropdownMenuTrigger, +} from "@aeei/docusaurus-theme/lib-theme/theme/components/ui/dropdown-menu"; const THEMES = [ { id: "evergreen", label: "Evergreen", color: "#2e8555" }, @@ -27,6 +28,10 @@ type ThemeId = (typeof THEMES)[number]["id"]; const STORAGE_KEY = "openapi-demo-palette"; const DEFAULT_PALETTE: ThemeId = "evergreen"; +function isThemeId(value: string | null): value is ThemeId { + return THEMES.some((theme) => theme.id === value); +} + function applyPalette(id: ThemeId): void { let link = document.getElementById( "openapi-palette-link" @@ -41,204 +46,71 @@ function applyPalette(id: ThemeId): void { localStorage.setItem(STORAGE_KEY, id); } -function MobileSection({ - active, - onSelect, - current, -}: { - active: ThemeId; - onSelect: (id: ThemeId) => void; - current: (typeof THEMES)[number]; -}) { - const [expanded, setExpanded] = useState(false); - +function PaletteSwatch({ color }: { color: string }) { return ( -
- - - {expanded && ( -
- {THEMES.map((theme) => ( - - ))} -
- )} -
+