@opentf/afw-docs 0.0.0-stage → 0.30.0
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/build/blog-posts-plugin.js +141 -0
- package/build/docs-nav-plugin.js +196 -0
- package/build/feed.js +147 -0
- package/build/frontmatter.js +45 -0
- package/build/host.js +54 -0
- package/build/index.js +12 -0
- package/build/last-updated-plugin.js +99 -0
- package/build/last-updated.js +40 -0
- package/build/llms.js +176 -0
- package/build/reading-time.js +16 -0
- package/build/search.js +27 -0
- package/components/BlogLayout.jsx +90 -0
- package/components/Breadcrumbs.jsx +71 -0
- package/components/Callout.jsx +29 -0
- package/components/Card.jsx +21 -0
- package/components/Cards.jsx +11 -0
- package/components/CodeBlock.jsx +39 -0
- package/components/DocsLayout.jsx +106 -0
- package/components/Footer.jsx +25 -0
- package/components/LastUpdated.jsx +22 -0
- package/components/NavIcon.jsx +34 -0
- package/components/Navbar.jsx +64 -0
- package/components/NavbarLink.jsx +40 -0
- package/components/Pagination.jsx +49 -0
- package/components/PostBanner.jsx +25 -0
- package/components/PostCard.jsx +19 -0
- package/components/PostList.jsx +17 -0
- package/components/PostMeta.jsx +28 -0
- package/components/ReadingTime.jsx +6 -0
- package/components/Search.jsx +191 -0
- package/components/SearchTrigger.jsx +32 -0
- package/components/Sidebar.jsx +199 -0
- package/components/SidebarNode.jsx +143 -0
- package/components/SidebarToggle.jsx +47 -0
- package/components/Steps.jsx +14 -0
- package/components/Table.jsx +10 -0
- package/components/Tabs.jsx +77 -0
- package/components/ThemeToggle.jsx +164 -0
- package/components/Toc.jsx +79 -0
- package/components/Tooltip.jsx +19 -0
- package/components/format.js +21 -0
- package/components/post-dates.js +21 -0
- package/components/sidebar-collapse.js +38 -0
- package/config.js +77 -0
- package/index.js +67 -0
- package/nav-virtual.js +18 -0
- package/package.json +75 -4
- package/posts-virtual.js +17 -0
- package/search.js +285 -0
- package/theme/index.css +1749 -0
- package/types/config.d.ts +37 -0
- package/types/index.d.ts +66 -0
- package/types/nav.d.ts +9 -0
- package/types/posts.d.ts +17 -0
- package/types/search.d.ts +28 -0
- package/types/updated.d.ts +4 -0
- package/updated-virtual.js +10 -0
- package/README.md +0 -3
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// "On this page" table of contents. Built from the rendered content headings (so it
|
|
2
|
+
// works for both MDX and JSX pages), with scroll-spy highlighting via
|
|
3
|
+
// IntersectionObserver. Rebuilds on route change.
|
|
4
|
+
//
|
|
5
|
+
// The MDX front-end already emits stable heading ids (slugs); we read them from the
|
|
6
|
+
// DOM after mount. (SSG output ships the heading anchors statically; this nav chrome
|
|
7
|
+
// activates once the client bundle mounts.)
|
|
8
|
+
|
|
9
|
+
import { onMount, router } from "@opentf/afw";
|
|
10
|
+
|
|
11
|
+
export default function Toc() {
|
|
12
|
+
let items = $state([]);
|
|
13
|
+
let activeId = $state("");
|
|
14
|
+
let observer = null;
|
|
15
|
+
|
|
16
|
+
const build = () => {
|
|
17
|
+
if (typeof document === "undefined") return;
|
|
18
|
+
const root = document.getElementById("afw-content");
|
|
19
|
+
if (!root) return;
|
|
20
|
+
const hs = Array.from(root.querySelectorAll("h2[id], h3[id]"));
|
|
21
|
+
items = hs.map((h) => ({
|
|
22
|
+
id: h.id,
|
|
23
|
+
text: h.textContent || "",
|
|
24
|
+
sub: h.tagName === "H3",
|
|
25
|
+
}));
|
|
26
|
+
if (observer) observer.disconnect();
|
|
27
|
+
observer = new IntersectionObserver(
|
|
28
|
+
(entries) => {
|
|
29
|
+
for (const e of entries) if (e.isIntersecting) activeId = e.target.id;
|
|
30
|
+
},
|
|
31
|
+
{ rootMargin: "-10% 0px -80% 0px", threshold: 0 },
|
|
32
|
+
);
|
|
33
|
+
for (const h of hs) observer.observe(h);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
onMount(() => {
|
|
37
|
+
build();
|
|
38
|
+
return () => observer && observer.disconnect();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// Rebuild when the route changes (content swaps under the same layout). Effects run at
|
|
42
|
+
// construction — before `onMount` — so the first run would schedule a second, redundant
|
|
43
|
+
// build of the same headings: on first paint the outline was built once by `onMount` and
|
|
44
|
+
// then torn down and rebuilt a frame later, a visible flicker on every docs page. Skip that
|
|
45
|
+
// run and let `onMount` do the initial build.
|
|
46
|
+
let routed = false;
|
|
47
|
+
$effect(() => {
|
|
48
|
+
router.pathname;
|
|
49
|
+
if (!routed) {
|
|
50
|
+
routed = true;
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (typeof requestAnimationFrame !== "undefined") requestAnimationFrame(build);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<nav class="afwd-toc" aria-label="On this page">
|
|
58
|
+
{() =>
|
|
59
|
+
items.length > 0 ? (
|
|
60
|
+
<div class="afwd-toc-inner">
|
|
61
|
+
<div class="afwd-toc-heading">On this page</div>
|
|
62
|
+
<ul class="afwd-toc-list">
|
|
63
|
+
{items.map((h) => (
|
|
64
|
+
<li class={h.sub ? "afwd-toc-item afwd-toc-sub" : "afwd-toc-item"}>
|
|
65
|
+
<a
|
|
66
|
+
href={"#" + h.id}
|
|
67
|
+
class={activeId === h.id ? "afwd-toc-link afwd-active" : "afwd-toc-link"}
|
|
68
|
+
>
|
|
69
|
+
{h.text}
|
|
70
|
+
</a>
|
|
71
|
+
</li>
|
|
72
|
+
))}
|
|
73
|
+
</ul>
|
|
74
|
+
</div>
|
|
75
|
+
) : null
|
|
76
|
+
}
|
|
77
|
+
</nav>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// A small hover/focus tooltip. CSS-driven (no JS state) — wrap any element and pass
|
|
2
|
+
// `text`; the bubble shows on hover or keyboard focus of the wrapped content.
|
|
3
|
+
//
|
|
4
|
+
// <Tooltip text="Change theme"><button>…</button></Tooltip>
|
|
5
|
+
//
|
|
6
|
+
// `placement` is "bottom" (default) or "top". The bubble is aria-hidden decorative
|
|
7
|
+
// chrome; give the wrapped control its own `aria-label` for assistive tech.
|
|
8
|
+
|
|
9
|
+
export default function Tooltip(props) {
|
|
10
|
+
const placement = props.placement === "top" ? "afwd-tooltip-top" : "afwd-tooltip-bottom";
|
|
11
|
+
return (
|
|
12
|
+
<span class={`afwd-tooltip ${placement}`}>
|
|
13
|
+
{props.children}
|
|
14
|
+
<span class="afwd-tooltip-bubble" role="tooltip" aria-hidden="true">
|
|
15
|
+
{props.text}
|
|
16
|
+
</span>
|
|
17
|
+
</span>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Small shared formatting helpers for the docs/blog components.
|
|
2
|
+
|
|
3
|
+
const DATE_OPTIONS = { year: "numeric", month: "long", day: "numeric" };
|
|
4
|
+
|
|
5
|
+
// `2026-06-24` (or any Date-parseable value) → `June 24, 2026`. Date-only values are
|
|
6
|
+
// calendar dates, not instants, so they format in UTC and no viewer time zone can
|
|
7
|
+
// shift them to another day; timestamps render in the viewer's zone. Anything the
|
|
8
|
+
// Date constructor can't parse falls back to the raw value so it still renders.
|
|
9
|
+
// Uses `Date` rather than Temporal, which Safari does not ship.
|
|
10
|
+
export function formatDate(value) {
|
|
11
|
+
if (!value) return "";
|
|
12
|
+
if (typeof value === "string" && /^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
13
|
+
const day = new Date(`${value}T00:00:00Z`);
|
|
14
|
+
// Some engines roll an impossible day over (2026-02-30 → March 2); keep it raw.
|
|
15
|
+
if (Number.isNaN(day.getTime()) || day.toISOString().slice(0, 10) !== value) return value;
|
|
16
|
+
return day.toLocaleDateString("en-US", { ...DATE_OPTIONS, timeZone: "UTC" });
|
|
17
|
+
}
|
|
18
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
19
|
+
if (Number.isNaN(date.getTime())) return String(value);
|
|
20
|
+
return date.toLocaleDateString("en-US", DATE_OPTIONS);
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Date rules shared by the blog components.
|
|
2
|
+
|
|
3
|
+
/** The UTC calendar day of a date value as `YYYY-MM-DD`, or `null` when invalid. */
|
|
4
|
+
function utcDay(value) {
|
|
5
|
+
const date = new Date(value);
|
|
6
|
+
return Number.isNaN(date.getTime()) ? null : date.toISOString().slice(0, 10);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* True when a post was edited on a later calendar day than it was published, so a
|
|
11
|
+
* "Last updated" line adds information. An update on the publish day, or one dated
|
|
12
|
+
* before publication (a stale git timestamp, a backdated post), shows nothing.
|
|
13
|
+
* Days compare in UTC because a frontmatter `date: 2026-10-03` parses as UTC midnight.
|
|
14
|
+
* Without a valid publish date, any valid update is shown.
|
|
15
|
+
*/
|
|
16
|
+
export function editedAfterPublish(updated, published) {
|
|
17
|
+
const updatedDay = updated ? utcDay(updated) : null;
|
|
18
|
+
if (!updatedDay) return false;
|
|
19
|
+
const publishedDay = published ? utcDay(published) : null;
|
|
20
|
+
return !publishedDay || updatedDay > publishedDay;
|
|
21
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Shared "collapse all / expand all" state for the docs sidebar tree.
|
|
2
|
+
//
|
|
3
|
+
// The button lives in <Sidebar>, but the open/closed state lives in each <SidebarNode>,
|
|
4
|
+
// so the two are coupled through this module-scope signal rather than by prop-drilling
|
|
5
|
+
// through a recursive tree (the same decoupling the drawer uses for the navbar burger).
|
|
6
|
+
// Every group node runs an effect on `collapseAll.command`; the button flips it.
|
|
7
|
+
//
|
|
8
|
+
// State is per-session only, like the per-node default — a reload starts over. It does
|
|
9
|
+
// persist across SPA navigation, so a collapsed tree stays collapsed while you read
|
|
10
|
+
// (except the branch holding the active route, which SidebarNode always keeps open).
|
|
11
|
+
|
|
12
|
+
import { signal } from "@opentf/afw";
|
|
13
|
+
|
|
14
|
+
// `{ expanded, seq }`. `seq` makes every press a distinct value so the effect re-runs:
|
|
15
|
+
// expanding one group by hand and pressing "collapse all" again must re-collapse it.
|
|
16
|
+
const command = signal(null);
|
|
17
|
+
let seq = 0;
|
|
18
|
+
|
|
19
|
+
export const collapseAll = {
|
|
20
|
+
/** The last command, or `null` when the tree is still at its derived default. */
|
|
21
|
+
get command() {
|
|
22
|
+
return command.value;
|
|
23
|
+
},
|
|
24
|
+
/** True while "collapse all" is in effect — drives the button's icon and label. */
|
|
25
|
+
get collapsed() {
|
|
26
|
+
const c = command.value;
|
|
27
|
+
return !!c && !c.expanded;
|
|
28
|
+
},
|
|
29
|
+
/** Broadcast `expanded` to every group node. */
|
|
30
|
+
set(expanded) {
|
|
31
|
+
command.value = { expanded, seq: (seq += 1) };
|
|
32
|
+
},
|
|
33
|
+
/** Drop the command; nodes fall back to their derived default. For tests. */
|
|
34
|
+
reset() {
|
|
35
|
+
command.value = null;
|
|
36
|
+
seq = 0;
|
|
37
|
+
},
|
|
38
|
+
};
|
package/config.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Site/docs configuration helper.
|
|
2
|
+
//
|
|
3
|
+
// `defineDocsConfig` is an identity function: it returns the config untouched, but
|
|
4
|
+
// gives authors editor type-hints (via the JSDoc typedef) and a stable import the
|
|
5
|
+
// toolchain can recognise. Used in `afw.config.js`:
|
|
6
|
+
//
|
|
7
|
+
// import { defineDocsConfig } from "@opentf/afw-docs/config";
|
|
8
|
+
// export default defineDocsConfig({ site: { url }, docs: { … } });
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @typedef {Object} DocsNavLink
|
|
12
|
+
* @property {string} label
|
|
13
|
+
* @property {string} href
|
|
14
|
+
* @property {string} [icon] NavIcon name shown before the label (e.g. "book").
|
|
15
|
+
* @property {boolean} [external] Render as a plain target=_blank anchor (no SPA nav).
|
|
16
|
+
*
|
|
17
|
+
* @typedef {Object} DocsFooter
|
|
18
|
+
* @property {string} [text]
|
|
19
|
+
* @property {DocsNavLink[]} [links]
|
|
20
|
+
*
|
|
21
|
+
* @typedef {Object} DocsConfig
|
|
22
|
+
* @property {string} [title] Site/product name shown in the navbar.
|
|
23
|
+
* @property {string} [description] One-line site summary. Used for the `llms.txt`
|
|
24
|
+
* summary line; when unset it falls back to the site's
|
|
25
|
+
* resolved `<meta name="description">`.
|
|
26
|
+
* @property {string} [version] Version badge shown next to the brand (e.g. "v0.4.0").
|
|
27
|
+
* @property {string} [logo] URL of the navbar logo image.
|
|
28
|
+
* @property {string} [homeUrl] Where the navbar brand links to (default "/").
|
|
29
|
+
* @property {string} [github] GitHub URL (shown in the navbar).
|
|
30
|
+
* @property {string} [repoUrl] Source repository URL. When set (with `lastUpdated`),
|
|
31
|
+
* each docs page gets an "Edit this page" link to its file on
|
|
32
|
+
* GitHub (`<repoUrl>/edit/main/<path>`).
|
|
33
|
+
* @property {string} [dir] Docs content folder under app/ (default "docs"). Any
|
|
34
|
+
* other top-level folder with a `DocsLayout` is its own section
|
|
35
|
+
* (e.g. `app/api` → `/api`) — no extra config needed.
|
|
36
|
+
* @property {DocsNavLink[]} [nav] Top-level navbar links.
|
|
37
|
+
* @property {DocsFooter} [footer] Footer content.
|
|
38
|
+
* @property {{ provider?: string }} [search] Search provider (Phase 2: "afw").
|
|
39
|
+
* @property {boolean} [lastUpdated] Show a "Last updated" line per docs page (from the
|
|
40
|
+
* file's last git commit, or a `lastUpdated` frontmatter
|
|
41
|
+
* override; `lastUpdated: false` in frontmatter hides a page).
|
|
42
|
+
*
|
|
43
|
+
* @typedef {Object} BlogConfig
|
|
44
|
+
* @property {string} [dir] Blog content folder under app/ (default "blog"). Each
|
|
45
|
+
* `<dir>/<slug>/page.mdx` is a post; its frontmatter
|
|
46
|
+
* (title, description, date, author, tags) feeds the
|
|
47
|
+
* generated `@opentf/afw-docs/posts` list.
|
|
48
|
+
* @property {string} [title] Feed title (default `"<docs.title> Blog"`).
|
|
49
|
+
* @property {string} [description] Feed description (default the title). RSS and Atom
|
|
50
|
+
* feeds (`<dir>/rss.xml`, `<dir>/atom.xml`) are generated
|
|
51
|
+
* by the release output hook; production docs/blog builds require
|
|
52
|
+
* `site.url` or `--base-url` so feed URLs are absolute.
|
|
53
|
+
* @property {boolean} [lastUpdated] Show a "Last updated" line on a post when it was
|
|
54
|
+
* edited after its publish date (from git / frontmatter).
|
|
55
|
+
*
|
|
56
|
+
* @typedef {Object.<string, string | { target: string }>} ProxyConfig
|
|
57
|
+
* Dev-only request forwarding. Maps a path prefix to a target origin string (or
|
|
58
|
+
* `{ target }`). Keys match longest-prefix-first.
|
|
59
|
+
*
|
|
60
|
+
* @typedef {Object} SiteConfig
|
|
61
|
+
* @property {{ url?: string }} [site] Canonical site origin (required for production
|
|
62
|
+
* docs/blog builds unless `--base-url` is passed).
|
|
63
|
+
* @property {DocsConfig} [docs] Documentation generator config.
|
|
64
|
+
* @property {BlogConfig} [blog] Blog generator config.
|
|
65
|
+
* @property {ProxyConfig} [proxy] Retired dev-server forwarding. The esdev toolchain does
|
|
66
|
+
* not read it; kept so existing configs still type-check.
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @param {SiteConfig} config
|
|
71
|
+
* @returns {SiteConfig}
|
|
72
|
+
*/
|
|
73
|
+
export function defineDocsConfig(config) {
|
|
74
|
+
return config;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export default defineDocsConfig;
|
package/index.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Public barrel for @opentf/afw-docs.
|
|
2
|
+
//
|
|
3
|
+
// Components are shipped as JSX source and compiled by the consuming app's pipeline
|
|
4
|
+
// (the `@opentf/afw` Link.jsx model) — each becomes a `web-*` Custom Element with
|
|
5
|
+
// CSR + SSG renderers for free. afwc compiles JSX tags to element *strings*
|
|
6
|
+
// (`afw-callout`), so the JS import of a component would be tree-shaken; the bare
|
|
7
|
+
// `import "./components/X.jsx"` retains its `customElements.define` side effect
|
|
8
|
+
// (the compiled modules are marked side-effectful), and the re-export lets authors
|
|
9
|
+
// pull a component in by name (`import { Callout } from "@opentf/afw-docs"`).
|
|
10
|
+
|
|
11
|
+
import "./components/DocsLayout.jsx";
|
|
12
|
+
import "./components/Navbar.jsx";
|
|
13
|
+
import "./components/Sidebar.jsx";
|
|
14
|
+
import "./components/SidebarNode.jsx";
|
|
15
|
+
import "./components/Toc.jsx";
|
|
16
|
+
import "./components/Footer.jsx";
|
|
17
|
+
import "./components/Breadcrumbs.jsx";
|
|
18
|
+
import "./components/Pagination.jsx";
|
|
19
|
+
import "./components/LastUpdated.jsx";
|
|
20
|
+
import "./components/ThemeToggle.jsx";
|
|
21
|
+
import "./components/SearchTrigger.jsx";
|
|
22
|
+
import "./components/Search.jsx";
|
|
23
|
+
import "./components/Callout.jsx";
|
|
24
|
+
import "./components/CodeBlock.jsx";
|
|
25
|
+
import "./components/Tabs.jsx";
|
|
26
|
+
import "./components/Steps.jsx";
|
|
27
|
+
import "./components/Table.jsx";
|
|
28
|
+
import "./components/Cards.jsx";
|
|
29
|
+
import "./components/Card.jsx";
|
|
30
|
+
import "./components/Tooltip.jsx";
|
|
31
|
+
import "./components/BlogLayout.jsx";
|
|
32
|
+
import "./components/PostList.jsx";
|
|
33
|
+
import "./components/PostCard.jsx";
|
|
34
|
+
import "./components/PostBanner.jsx";
|
|
35
|
+
import "./components/PostMeta.jsx";
|
|
36
|
+
import "./components/ReadingTime.jsx";
|
|
37
|
+
|
|
38
|
+
export { createSearch } from "./search.js";
|
|
39
|
+
|
|
40
|
+
export { default as DocsLayout } from "./components/DocsLayout.jsx";
|
|
41
|
+
export { default as Navbar } from "./components/Navbar.jsx";
|
|
42
|
+
export { default as NavbarLink } from "./components/NavbarLink.jsx";
|
|
43
|
+
export { default as SidebarToggle } from "./components/SidebarToggle.jsx";
|
|
44
|
+
export { default as NavIcon } from "./components/NavIcon.jsx";
|
|
45
|
+
export { default as Sidebar } from "./components/Sidebar.jsx";
|
|
46
|
+
export { default as Toc } from "./components/Toc.jsx";
|
|
47
|
+
export { default as Footer } from "./components/Footer.jsx";
|
|
48
|
+
export { default as Breadcrumbs } from "./components/Breadcrumbs.jsx";
|
|
49
|
+
export { default as Pagination } from "./components/Pagination.jsx";
|
|
50
|
+
export { default as LastUpdated } from "./components/LastUpdated.jsx";
|
|
51
|
+
export { default as ThemeToggle } from "./components/ThemeToggle.jsx";
|
|
52
|
+
export { default as SearchTrigger } from "./components/SearchTrigger.jsx";
|
|
53
|
+
export { default as Search } from "./components/Search.jsx";
|
|
54
|
+
export { default as Callout } from "./components/Callout.jsx";
|
|
55
|
+
export { default as CodeBlock } from "./components/CodeBlock.jsx";
|
|
56
|
+
export { default as Tabs } from "./components/Tabs.jsx";
|
|
57
|
+
export { default as Steps } from "./components/Steps.jsx";
|
|
58
|
+
export { default as Table } from "./components/Table.jsx";
|
|
59
|
+
export { default as Cards } from "./components/Cards.jsx";
|
|
60
|
+
export { default as Card } from "./components/Card.jsx";
|
|
61
|
+
export { default as Tooltip } from "./components/Tooltip.jsx";
|
|
62
|
+
export { default as BlogLayout } from "./components/BlogLayout.jsx";
|
|
63
|
+
export { default as PostList } from "./components/PostList.jsx";
|
|
64
|
+
export { default as PostCard } from "./components/PostCard.jsx";
|
|
65
|
+
export { default as PostBanner } from "./components/PostBanner.jsx";
|
|
66
|
+
export { default as PostMeta } from "./components/PostMeta.jsx";
|
|
67
|
+
export { default as ReadingTime } from "./components/ReadingTime.jsx";
|
package/nav-virtual.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Fallback for `@opentf/afw-docs/nav`.
|
|
2
|
+
//
|
|
3
|
+
// When `docsNavPlugin` is active (the toolchain registers it whenever the project
|
|
4
|
+
// has a `docs` config), it intercepts this specifier and replaces it with a
|
|
5
|
+
// build-time-generated module exporting the real navigation. This file is only loaded
|
|
6
|
+
// when the plugin is NOT active (e.g. an editor, or a non-docs build).
|
|
7
|
+
//
|
|
8
|
+
// Shape: a section map `{ [base]: tree }` (e.g. `{ "/docs": [...], "/api": [...] }`);
|
|
9
|
+
// empty here.
|
|
10
|
+
|
|
11
|
+
if (typeof console !== "undefined") {
|
|
12
|
+
console.warn(
|
|
13
|
+
"[@opentf/afw-docs] navigation requested but docsNavPlugin is not active — " +
|
|
14
|
+
"did you add a `docs` block to afw.config.js? Returning an empty nav.",
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,77 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentf/afw-docs",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.30.0",
|
|
4
|
+
"description": "Documentation-site generator for AFW — themed shell components (sidebar, TOC, callouts, tabs), a build-time nav generator, and a default light/dark theme.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./types/index.d.ts",
|
|
9
|
+
"default": "./index.js"
|
|
10
|
+
},
|
|
11
|
+
"./theme": "./theme/index.css",
|
|
12
|
+
"./config": {
|
|
13
|
+
"types": "./types/config.d.ts",
|
|
14
|
+
"default": "./config.js"
|
|
15
|
+
},
|
|
16
|
+
"./nav": {
|
|
17
|
+
"types": "./types/nav.d.ts",
|
|
18
|
+
"default": "./nav-virtual.js"
|
|
19
|
+
},
|
|
20
|
+
"./posts": {
|
|
21
|
+
"types": "./types/posts.d.ts",
|
|
22
|
+
"default": "./posts-virtual.js"
|
|
23
|
+
},
|
|
24
|
+
"./updated": {
|
|
25
|
+
"types": "./types/updated.d.ts",
|
|
26
|
+
"default": "./updated-virtual.js"
|
|
27
|
+
},
|
|
28
|
+
"./build": "./build/index.js",
|
|
29
|
+
"./search": {
|
|
30
|
+
"types": "./types/search.d.ts",
|
|
31
|
+
"default": "./search.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"index.js",
|
|
36
|
+
"types",
|
|
37
|
+
"search.js",
|
|
38
|
+
"config.js",
|
|
39
|
+
"nav-virtual.js",
|
|
40
|
+
"posts-virtual.js",
|
|
41
|
+
"updated-virtual.js",
|
|
42
|
+
"components",
|
|
43
|
+
"theme",
|
|
44
|
+
"build",
|
|
45
|
+
"!**/*.test.js"
|
|
46
|
+
],
|
|
47
|
+
"keywords": [
|
|
48
|
+
"opentf",
|
|
49
|
+
"documentation",
|
|
50
|
+
"docs",
|
|
51
|
+
"mdx",
|
|
52
|
+
"static-site-generator",
|
|
53
|
+
"ssg"
|
|
54
|
+
],
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "https://github.com/Open-Tech-Foundation/afw.git",
|
|
58
|
+
"directory": "packages/afw-docs"
|
|
59
|
+
},
|
|
60
|
+
"homepage": "https://github.com/Open-Tech-Foundation/afw#readme",
|
|
61
|
+
"bugs": "https://github.com/Open-Tech-Foundation/afw/issues",
|
|
62
|
+
"license": "MIT",
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"@opentf/afw": "0.32.0"
|
|
65
|
+
},
|
|
66
|
+
"publishConfig": {
|
|
67
|
+
"access": "public"
|
|
68
|
+
},
|
|
69
|
+
"dependencies": {
|
|
70
|
+
"@opentf/afw-compiler": "0.20.0"
|
|
71
|
+
},
|
|
72
|
+
"devDependencies": {
|
|
73
|
+
"@opentf/afw": "0.32.0",
|
|
74
|
+
"@opentf/afw-test": "1.27.0"
|
|
75
|
+
},
|
|
76
|
+
"types": "./types/index.d.ts"
|
|
77
|
+
}
|
package/posts-virtual.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Fallback for `@opentf/afw-docs/posts`.
|
|
2
|
+
//
|
|
3
|
+
// When `blogPostsPlugin` is active (the toolchain registers it whenever the project
|
|
4
|
+
// has a `blog` config), it intercepts this specifier and replaces it with a
|
|
5
|
+
// build-time-generated module exporting the post list. This file is only loaded when
|
|
6
|
+
// the plugin is NOT active (e.g. an editor, or a project without a blog), in which
|
|
7
|
+
// case the list is simply empty.
|
|
8
|
+
|
|
9
|
+
if (typeof console !== "undefined") {
|
|
10
|
+
console.warn(
|
|
11
|
+
"[@opentf/afw-docs] posts requested but blogPostsPlugin is not active — " +
|
|
12
|
+
"did you add a `blog` block to afw.config.js? Returning an empty list.",
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const posts = [];
|
|
17
|
+
export default posts;
|