@wrksz/docs 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +157 -2
- package/dist/agents.d.ts +30 -0
- package/dist/agents.js +70 -0
- package/dist/components/agent-logos.js +90 -0
- package/dist/components/agent-prompt.d.ts +29 -0
- package/dist/components/agent-prompt.js +100 -0
- package/dist/components/badge.d.ts +16 -0
- package/dist/components/badge.js +26 -0
- package/dist/components/brand.js +30 -0
- package/dist/components/callout.d.ts +24 -0
- package/dist/components/callout.js +58 -0
- package/dist/components/cards.d.ts +26 -0
- package/dist/components/cards.js +48 -0
- package/dist/components/code-body.js +18 -0
- package/dist/components/code-group.d.ts +20 -0
- package/dist/components/code-group.js +41 -0
- package/dist/components/code-tabs.d.ts +30 -0
- package/dist/components/code-tabs.js +49 -0
- package/dist/components/content-tabs.d.ts +14 -0
- package/dist/components/content-tabs.js +27 -0
- package/dist/components/copy-code.js +41 -0
- package/dist/components/deferred-analytics.js +5 -0
- package/dist/components/details.d.ts +20 -0
- package/dist/components/details.js +29 -0
- package/dist/components/heading-link.js +23 -0
- package/dist/components/heading.d.ts +5 -0
- package/dist/components/heading.js +22 -0
- package/dist/components/icons.js +362 -0
- package/dist/components/image.d.ts +27 -0
- package/dist/components/image.js +204 -0
- package/dist/components/inline-text.js +14 -0
- package/dist/components/install.d.ts +22 -0
- package/dist/components/install.js +62 -0
- package/dist/components/mdx-tabs.d.ts +22 -0
- package/dist/components/mdx-tabs.js +30 -0
- package/dist/components/practice.d.ts +41 -0
- package/dist/components/practice.js +99 -0
- package/dist/components/props.d.ts +37 -0
- package/dist/components/props.js +70 -0
- package/dist/components/status.js +35 -0
- package/dist/components/steps.d.ts +18 -0
- package/dist/components/steps.js +23 -0
- package/dist/components/theme-switch.js +31 -0
- package/dist/components/ui/kbd.js +410 -0
- package/dist/components/ui/scroll-area.js +169 -0
- package/dist/components/ui/table.d.ts +33 -0
- package/dist/components/ui/table.js +103 -0
- package/dist/components/ui/tabs.js +69 -0
- package/dist/components/ui/toast.js +629 -0
- package/dist/components/ui/tooltip.js +31 -0
- package/dist/components/wrksz-mark.js +12 -0
- package/dist/docs/index.d.ts +8 -0
- package/dist/docs/index.js +8 -0
- package/dist/docs/layout.d.ts +6 -0
- package/dist/docs/layout.js +10 -0
- package/dist/docs/page-actions.d.ts +36 -0
- package/dist/docs/page-actions.js +136 -0
- package/dist/docs/page-footer.d.ts +14 -0
- package/dist/docs/page-footer.js +68 -0
- package/dist/docs/page-header.d.ts +13 -0
- package/dist/docs/page-header.js +57 -0
- package/dist/docs/page.d.ts +16 -0
- package/dist/docs/page.js +38 -0
- package/dist/docs/reading.js +64 -0
- package/dist/docs/shell.js +101 -0
- package/dist/docs/sidebar.js +161 -0
- package/dist/docs/toc-bar.d.ts +12 -0
- package/dist/docs/toc-bar.js +132 -0
- package/dist/docs/toc.d.ts +11 -0
- package/dist/docs/toc.js +127 -0
- package/dist/fonts/Inter-Italic.woff2 +0 -0
- package/dist/fonts/Inter-LICENSE.txt +92 -0
- package/dist/fonts/Inter.woff2 +0 -0
- package/dist/fonts/IoskeleyMono-Bold.woff2 +0 -0
- package/dist/fonts/IoskeleyMono-Italic.woff2 +0 -0
- package/dist/fonts/IoskeleyMono-LICENSE.txt +92 -0
- package/dist/fonts/IoskeleyMono-Regular.woff2 +0 -0
- package/dist/fonts.d.ts +1 -0
- package/dist/fonts.js +38 -0
- package/dist/home/features.d.ts +39 -0
- package/dist/home/features.js +75 -0
- package/dist/home/footer.d.ts +4 -0
- package/dist/home/footer.js +79 -0
- package/dist/home/hero-content.js +102 -0
- package/dist/home/hero-install.js +128 -0
- package/dist/home/hero-stage.d.ts +4 -0
- package/dist/home/hero-stage.js +9 -0
- package/dist/home/hero.d.ts +6 -0
- package/dist/home/hero.js +16 -0
- package/dist/home/home-header.d.ts +1 -0
- package/dist/home/home-header.js +173 -0
- package/dist/home/index.d.ts +7 -0
- package/dist/home/index.js +7 -0
- package/dist/home/layout.d.ts +6 -0
- package/dist/home/layout.js +15 -0
- package/dist/home/reveal.js +31 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/lib/clipboard.js +55 -0
- package/dist/lib/cn.js +1 -0
- package/dist/lib/format.js +9 -0
- package/dist/lib/package-manager-script.js +12 -0
- package/dist/lib/package-manager.js +54 -0
- package/dist/lib/theme-config.js +10 -0
- package/dist/llms.d.ts +34 -0
- package/dist/llms.js +111 -0
- package/dist/next.d.ts +18 -0
- package/dist/next.js +45 -0
- package/dist/node_modules/.pnpm/@types_mdast@4.0.4/node_modules/@types/mdast/index.d.ts +930 -0
- package/dist/node_modules/.pnpm/@types_mdx@2.0.14/node_modules/@types/mdx/types.d.ts +81 -0
- package/dist/node_modules/.pnpm/@types_unist@3.0.3/node_modules/@types/unist/index.d.ts +80 -0
- package/dist/registry.d.ts +61 -0
- package/dist/registry.js +113 -0
- package/dist/root.d.ts +9 -0
- package/dist/root.js +34 -0
- package/dist/search.d.ts +5 -0
- package/dist/search.js +43 -0
- package/dist/seo/index.d.ts +6 -0
- package/dist/seo/index.js +6 -0
- package/dist/seo/json-ld.d.ts +17 -0
- package/dist/seo/json-ld.js +88 -0
- package/dist/seo/metadata.d.ts +21 -0
- package/dist/seo/metadata.js +75 -0
- package/dist/seo/robots.d.ts +14 -0
- package/dist/seo/robots.js +18 -0
- package/dist/seo/sitemap.d.ts +16 -0
- package/dist/seo/sitemap.js +26 -0
- package/dist/seo/url.d.ts +6 -0
- package/dist/seo/url.js +11 -0
- package/dist/server.js +63 -0
- package/dist/site-context.js +17 -0
- package/dist/site.d.ts +41 -0
- package/dist/site.js +13 -0
- package/dist/source/compile.d.ts +6 -0
- package/dist/source/compile.js +32 -0
- package/dist/source/errors.d.ts +4 -0
- package/dist/source/errors.js +10 -0
- package/dist/source/frontmatter.d.ts +13 -0
- package/dist/source/frontmatter.js +102 -0
- package/dist/source/highlight.js +102 -0
- package/dist/source/index.d.ts +36 -0
- package/dist/source/index.js +102 -0
- package/dist/source/markdown.d.ts +48 -0
- package/dist/source/markdown.js +393 -0
- package/dist/source/prompt.js +33 -0
- package/dist/source/scan.d.ts +8 -0
- package/dist/source/scan.js +64 -0
- package/dist/source/toc.d.ts +5 -0
- package/dist/source/toc.js +28 -0
- package/dist/source/tree.d.ts +29 -0
- package/dist/source/tree.js +91 -0
- package/dist/styles.css +879 -0
- package/dist/typography.d.ts +101 -0
- package/dist/typography.js +232 -0
- package/package.json +84 -4
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import Link from "next/link";
|
|
3
|
+
import { usePathname } from "next/navigation";
|
|
4
|
+
import { Brand } from "../components/brand.js";
|
|
5
|
+
import { ArrowUpRightIcon, GitHubIcon, SearchIcon } from "../components/icons.js";
|
|
6
|
+
import { Status } from "../components/status.js";
|
|
7
|
+
import { ThemeSwitch } from "../components/theme-switch.js";
|
|
8
|
+
import { useSearch } from "../search.js";
|
|
9
|
+
import { githubUrl } from "../site.js";
|
|
10
|
+
import { useSite } from "../site-context.js";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
// src/docs/sidebar.tsx
|
|
13
|
+
/**
|
|
14
|
+
* Rows sit flush with no gap between them, so the pointer never falls between two links.
|
|
15
|
+
* The link is the hit area; a pixel of padding on each side keeps the drawn rows apart.
|
|
16
|
+
*/
|
|
17
|
+
const HIT = "group block py-px outline-none";
|
|
18
|
+
const ROW = "flex h-8 w-full items-center gap-2 rounded-lg px-2 text-sm transition-[color,background-color,box-shadow] duration-150 group-focus-visible:ring-2 group-focus-visible:ring-fd-ring";
|
|
19
|
+
const IDLE = "text-fd-foreground/70 group-hover:bg-fd-accent group-hover:text-fd-foreground";
|
|
20
|
+
const CURRENT = "docs-current text-fd-foreground";
|
|
21
|
+
const ICON_BUTTON = "flex size-8 items-center justify-center rounded-lg text-fd-foreground/70 outline-none transition-[color,background-color,scale] duration-150 hover:bg-fd-accent hover:text-fd-foreground focus-visible:ring-2 focus-visible:ring-fd-ring active:scale-[0.96]";
|
|
22
|
+
function PageRow({ href, current, onNavigate, children }) {
|
|
23
|
+
return /* @__PURE__ */ jsx(Link, {
|
|
24
|
+
href,
|
|
25
|
+
onClick: onNavigate,
|
|
26
|
+
"aria-current": current ? "page" : void 0,
|
|
27
|
+
className: HIT,
|
|
28
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
29
|
+
className: `${ROW} ${current ? CURRENT : IDLE}`,
|
|
30
|
+
children
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function Nodes({ nodes, pathname, onNavigate }) {
|
|
35
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
36
|
+
className: "flex flex-col",
|
|
37
|
+
children: nodes.map((node, index) => {
|
|
38
|
+
if (node.type === "section") return /* @__PURE__ */ jsx("li", {
|
|
39
|
+
className: index > 0 ? "pt-6" : "",
|
|
40
|
+
children: /* @__PURE__ */ jsx("h2", {
|
|
41
|
+
className: "px-2 pb-1.5 text-xs font-medium text-fd-muted-foreground",
|
|
42
|
+
children: node.title
|
|
43
|
+
})
|
|
44
|
+
}, `section-${node.title}`);
|
|
45
|
+
if (node.type === "link") return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", {
|
|
46
|
+
href: node.href,
|
|
47
|
+
target: "_blank",
|
|
48
|
+
rel: "noreferrer noopener",
|
|
49
|
+
className: HIT,
|
|
50
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
51
|
+
className: `${ROW} ${IDLE}`,
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ jsx("span", {
|
|
54
|
+
className: "truncate",
|
|
55
|
+
children: node.title
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ jsx(Status, {
|
|
58
|
+
...node.status ? { status: node.status } : {},
|
|
59
|
+
iconOnly: true,
|
|
60
|
+
className: "ms-auto"
|
|
61
|
+
}),
|
|
62
|
+
/* @__PURE__ */ jsx(ArrowUpRightIcon, { className: `size-3 shrink-0 text-fd-muted-foreground ${node.status ? "" : "ms-auto"}` })
|
|
63
|
+
]
|
|
64
|
+
})
|
|
65
|
+
}) }, node.href);
|
|
66
|
+
if (node.type === "folder") return /* @__PURE__ */ jsxs("li", {
|
|
67
|
+
className: "flex flex-col",
|
|
68
|
+
children: [node.url ? /* @__PURE__ */ jsxs(PageRow, {
|
|
69
|
+
href: node.url,
|
|
70
|
+
current: pathname === node.url,
|
|
71
|
+
onNavigate,
|
|
72
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
73
|
+
className: "truncate",
|
|
74
|
+
children: node.title
|
|
75
|
+
}), /* @__PURE__ */ jsx(Status, {
|
|
76
|
+
...node.status ? { status: node.status } : {},
|
|
77
|
+
iconOnly: true,
|
|
78
|
+
className: "ms-auto"
|
|
79
|
+
})]
|
|
80
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
81
|
+
className: "block py-px",
|
|
82
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
83
|
+
className: `${ROW} text-fd-foreground/70`,
|
|
84
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
85
|
+
className: "truncate",
|
|
86
|
+
children: node.title
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
90
|
+
className: "ms-4 border-s border-fd-border ps-2",
|
|
91
|
+
children: /* @__PURE__ */ jsx(Nodes, {
|
|
92
|
+
nodes: node.children,
|
|
93
|
+
pathname,
|
|
94
|
+
onNavigate
|
|
95
|
+
})
|
|
96
|
+
})]
|
|
97
|
+
}, `folder-${node.title}`);
|
|
98
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(PageRow, {
|
|
99
|
+
href: node.url,
|
|
100
|
+
current: pathname === node.url,
|
|
101
|
+
onNavigate,
|
|
102
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
103
|
+
className: "truncate",
|
|
104
|
+
children: node.title
|
|
105
|
+
}), /* @__PURE__ */ jsx(Status, {
|
|
106
|
+
...node.status ? { status: node.status } : {},
|
|
107
|
+
iconOnly: true,
|
|
108
|
+
className: "ms-auto"
|
|
109
|
+
})]
|
|
110
|
+
}) }, node.url);
|
|
111
|
+
})
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function Sidebar({ tree, onNavigate }) {
|
|
115
|
+
const site = useSite();
|
|
116
|
+
const pathname = usePathname();
|
|
117
|
+
const { setOpen } = useSearch();
|
|
118
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
119
|
+
className: "flex h-full flex-col",
|
|
120
|
+
children: [
|
|
121
|
+
/* @__PURE__ */ jsxs("div", {
|
|
122
|
+
className: "flex h-14 shrink-0 items-center justify-between px-3",
|
|
123
|
+
children: [/* @__PURE__ */ jsx(Link, {
|
|
124
|
+
href: "/",
|
|
125
|
+
onClick: onNavigate,
|
|
126
|
+
"aria-label": `${site.name} home`,
|
|
127
|
+
className: "flex h-8 items-center rounded-lg px-2 text-[0.9375rem] outline-none focus-visible:ring-2 focus-visible:ring-fd-ring",
|
|
128
|
+
children: /* @__PURE__ */ jsx(Brand, {})
|
|
129
|
+
}), onNavigate ? null : /* @__PURE__ */ jsx("button", {
|
|
130
|
+
type: "button",
|
|
131
|
+
"aria-label": "Search the docs",
|
|
132
|
+
"aria-keyshortcuts": "Meta+K Control+K",
|
|
133
|
+
onClick: () => setOpen(true),
|
|
134
|
+
className: ICON_BUTTON,
|
|
135
|
+
children: /* @__PURE__ */ jsx(SearchIcon, { className: "size-4" })
|
|
136
|
+
})]
|
|
137
|
+
}),
|
|
138
|
+
/* @__PURE__ */ jsx("nav", {
|
|
139
|
+
"aria-label": "Documentation",
|
|
140
|
+
className: "docs-scroll min-h-0 flex-1 overflow-y-auto px-3 pt-4 pb-6",
|
|
141
|
+
children: /* @__PURE__ */ jsx(Nodes, {
|
|
142
|
+
nodes: tree,
|
|
143
|
+
pathname,
|
|
144
|
+
...onNavigate ? { onNavigate } : {}
|
|
145
|
+
})
|
|
146
|
+
}),
|
|
147
|
+
/* @__PURE__ */ jsxs("div", {
|
|
148
|
+
className: "flex shrink-0 items-center justify-between px-3 pt-2 pb-4",
|
|
149
|
+
children: [/* @__PURE__ */ jsx("a", {
|
|
150
|
+
href: githubUrl(site),
|
|
151
|
+
target: "_blank",
|
|
152
|
+
rel: "noreferrer noopener",
|
|
153
|
+
"aria-label": "GitHub",
|
|
154
|
+
className: ICON_BUTTON,
|
|
155
|
+
children: /* @__PURE__ */ jsx(GitHubIcon, { className: "size-4" })
|
|
156
|
+
}), /* @__PURE__ */ jsx(ThemeSwitch, {})]
|
|
157
|
+
})
|
|
158
|
+
]
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
export { Sidebar };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TocEntry } from "../source/toc.js";
|
|
2
|
+
import "../source/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* The table of contents for screens too narrow for its column: a card stuck to the top of
|
|
5
|
+
* the page with the reading progress and the section being read, which opens a plain list
|
|
6
|
+
* of sections styled like the sidebar.
|
|
7
|
+
*/
|
|
8
|
+
export declare function TocBar({ toc, label, className }: {
|
|
9
|
+
toc: TocEntry[];
|
|
10
|
+
label?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useId, useRef, useState } from "react";
|
|
3
|
+
import { ChevronDownIcon } from "../components/icons.js";
|
|
4
|
+
import { cn } from "../lib/cn.js";
|
|
5
|
+
import { currentSection, jumpTo, watchReading } from "./reading.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/docs/toc-bar.tsx
|
|
8
|
+
const INDENT = 12;
|
|
9
|
+
/** Same hit area as the sidebar: flush links, a pixel of padding keeps the rows apart. */
|
|
10
|
+
const HIT = "group block py-px outline-none";
|
|
11
|
+
const ROW = "block h-8 w-full truncate rounded-lg pe-2 text-sm leading-8 transition-[color,background-color,box-shadow] duration-150 group-focus-visible:ring-2 group-focus-visible:ring-fd-ring";
|
|
12
|
+
/** Reading progress drawn on the icon grid: 16px, a 1.5px stroke with round ends. */
|
|
13
|
+
function ProgressRing({ ringRef }) {
|
|
14
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
15
|
+
viewBox: "0 0 16 16",
|
|
16
|
+
fill: "none",
|
|
17
|
+
"aria-hidden": true,
|
|
18
|
+
className: "size-4 shrink-0 -rotate-90",
|
|
19
|
+
children: [/* @__PURE__ */ jsx("circle", {
|
|
20
|
+
cx: "8",
|
|
21
|
+
cy: "8",
|
|
22
|
+
r: "5.75",
|
|
23
|
+
stroke: "var(--color-fd-border)",
|
|
24
|
+
strokeWidth: "1.5"
|
|
25
|
+
}), /* @__PURE__ */ jsx("circle", {
|
|
26
|
+
ref: ringRef,
|
|
27
|
+
cx: "8",
|
|
28
|
+
cy: "8",
|
|
29
|
+
r: "5.75",
|
|
30
|
+
pathLength: 1,
|
|
31
|
+
strokeDasharray: "1",
|
|
32
|
+
strokeDashoffset: "1",
|
|
33
|
+
stroke: "var(--color-fd-foreground)",
|
|
34
|
+
strokeWidth: "1.5",
|
|
35
|
+
strokeLinecap: "round"
|
|
36
|
+
})]
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The table of contents for screens too narrow for its column: a card stuck to the top of
|
|
41
|
+
* the page with the reading progress and the section being read, which opens a plain list
|
|
42
|
+
* of sections styled like the sidebar.
|
|
43
|
+
*/
|
|
44
|
+
function TocBar({ toc, label = "On this page", className }) {
|
|
45
|
+
const barRef = useRef(null);
|
|
46
|
+
const ringRef = useRef(null);
|
|
47
|
+
const [current, setCurrent] = useState(-1);
|
|
48
|
+
const [open, setOpen] = useState(false);
|
|
49
|
+
const panel = useId();
|
|
50
|
+
const min = Math.min(...toc.map((entry) => entry.depth));
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
const bar = barRef.current;
|
|
53
|
+
if (!bar) return;
|
|
54
|
+
return watchReading(bar, toc, (reading) => {
|
|
55
|
+
const ring = ringRef.current;
|
|
56
|
+
if (ring) {
|
|
57
|
+
ring.style.strokeDashoffset = String(1 - reading.progress);
|
|
58
|
+
ring.style.opacity = reading.progress > .005 ? "1" : "0";
|
|
59
|
+
}
|
|
60
|
+
setCurrent(currentSection(reading));
|
|
61
|
+
});
|
|
62
|
+
}, [toc]);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (!open) return;
|
|
65
|
+
const onKey = (event) => {
|
|
66
|
+
if (event.key === "Escape") setOpen(false);
|
|
67
|
+
};
|
|
68
|
+
const onPointer = (event) => {
|
|
69
|
+
if (!barRef.current?.contains(event.target)) setOpen(false);
|
|
70
|
+
};
|
|
71
|
+
document.addEventListener("keydown", onKey);
|
|
72
|
+
document.addEventListener("pointerdown", onPointer);
|
|
73
|
+
return () => {
|
|
74
|
+
document.removeEventListener("keydown", onKey);
|
|
75
|
+
document.removeEventListener("pointerdown", onPointer);
|
|
76
|
+
};
|
|
77
|
+
}, [open]);
|
|
78
|
+
if (!toc.length) return null;
|
|
79
|
+
const title = toc[current]?.title;
|
|
80
|
+
return /* @__PURE__ */ jsx("div", {
|
|
81
|
+
ref: barRef,
|
|
82
|
+
"data-open": open ? "" : void 0,
|
|
83
|
+
className: cn("z-10 h-11", className),
|
|
84
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
85
|
+
className: "docs-current absolute inset-x-0 top-0 rounded-xl",
|
|
86
|
+
children: [/* @__PURE__ */ jsxs("button", {
|
|
87
|
+
type: "button",
|
|
88
|
+
"aria-expanded": open,
|
|
89
|
+
"aria-controls": panel,
|
|
90
|
+
"aria-label": title ? `${label}: ${title}` : label,
|
|
91
|
+
onClick: () => setOpen((value) => !value),
|
|
92
|
+
className: "flex h-11 w-full items-center gap-2.5 rounded-xl px-3.5 text-left text-sm outline-none focus-visible:ring-2 focus-visible:ring-fd-ring",
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ jsx(ProgressRing, { ringRef }),
|
|
95
|
+
/* @__PURE__ */ jsx("span", {
|
|
96
|
+
className: cn("docs-toc-title min-w-0 truncate", title ? "text-fd-foreground" : "text-fd-muted-foreground"),
|
|
97
|
+
children: title ?? label
|
|
98
|
+
}, title ?? ""),
|
|
99
|
+
/* @__PURE__ */ jsx(ChevronDownIcon, { className: "ms-auto size-4 shrink-0 text-fd-muted-foreground transition-transform duration-200 ease-[cubic-bezier(0.2,0,0,1)] in-data-open:rotate-180" })
|
|
100
|
+
]
|
|
101
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
102
|
+
id: panel,
|
|
103
|
+
inert: !open,
|
|
104
|
+
className: "grid grid-rows-[0fr] transition-[grid-template-rows] duration-300 ease-[cubic-bezier(0.2,0,0,1)] in-data-open:grid-rows-[1fr] motion-reduce:transition-none",
|
|
105
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
106
|
+
className: "min-h-0 overflow-hidden",
|
|
107
|
+
children: /* @__PURE__ */ jsx("nav", {
|
|
108
|
+
"aria-label": label,
|
|
109
|
+
className: "border-t border-fd-border",
|
|
110
|
+
children: /* @__PURE__ */ jsx("ol", {
|
|
111
|
+
className: "docs-scroll flex max-h-[60svh] flex-col overflow-y-auto overscroll-contain p-1.5",
|
|
112
|
+
children: toc.map((entry, index) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", {
|
|
113
|
+
href: `#${entry.id}`,
|
|
114
|
+
onClick: (event) => {
|
|
115
|
+
if (jumpTo(event, entry.id)) setOpen(false);
|
|
116
|
+
},
|
|
117
|
+
"aria-current": index === current ? "location" : void 0,
|
|
118
|
+
className: HIT,
|
|
119
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
120
|
+
style: { paddingInlineStart: 8 + (entry.depth - min) * INDENT },
|
|
121
|
+
className: cn(ROW, index === current ? "bg-fd-accent text-fd-foreground" : "text-fd-foreground/70 group-hover:bg-fd-accent group-hover:text-fd-foreground"),
|
|
122
|
+
children: entry.title
|
|
123
|
+
})
|
|
124
|
+
}) }, entry.id))
|
|
125
|
+
})
|
|
126
|
+
})
|
|
127
|
+
})
|
|
128
|
+
})]
|
|
129
|
+
})
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
export { TocBar };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TocEntry } from "../source/toc.js";
|
|
2
|
+
import "../source/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* The contents column: headings on a single guide line, like the sidebar's nested pages,
|
|
5
|
+
* with a thumb that slides along the line over the part of the page on screen.
|
|
6
|
+
*/
|
|
7
|
+
export declare function TableOfContents({ toc, label, className }: {
|
|
8
|
+
toc: TocEntry[];
|
|
9
|
+
label?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
}): import("react").JSX.Element | null;
|
package/dist/docs/toc.js
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
import { jumpTo, watchReading } from "./reading.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
// src/docs/toc.tsx
|
|
7
|
+
/** Text indent per heading level below the top one, in pixels. */
|
|
8
|
+
const INDENT = 12;
|
|
9
|
+
/** Share of an item's height the thumb has to cover before the item counts as read. */
|
|
10
|
+
const COVER = .5;
|
|
11
|
+
/**
|
|
12
|
+
* Projects the visible part of the page onto the list. A point a third of the way through
|
|
13
|
+
* a section lands a third of the way down that section's item, so the thumb moves with the
|
|
14
|
+
* scroll pixel by pixel instead of jumping between items, and the end of a page fills the
|
|
15
|
+
* last items however short their sections are.
|
|
16
|
+
*/
|
|
17
|
+
function project(reading, items) {
|
|
18
|
+
const at = (y) => {
|
|
19
|
+
if (y <= (reading.starts[0] ?? reading.end)) return items[0]?.top ?? 0;
|
|
20
|
+
for (let index = 0; index < reading.starts.length; index++) {
|
|
21
|
+
const start = reading.starts[index] ?? 0;
|
|
22
|
+
const stop = reading.starts[index + 1] ?? reading.end;
|
|
23
|
+
if (y < stop) {
|
|
24
|
+
const share = stop > start ? (y - start) / (stop - start) : 1;
|
|
25
|
+
const item = items[index];
|
|
26
|
+
return item ? item.top + share * (item.bottom - item.top) : 0;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return items.at(-1)?.bottom ?? 0;
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
top: at(reading.top),
|
|
33
|
+
bottom: at(reading.bottom)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function covered(thumb, items) {
|
|
37
|
+
let from = -1;
|
|
38
|
+
let to = -1;
|
|
39
|
+
items.forEach((item, index) => {
|
|
40
|
+
if (Math.min(item.bottom, thumb.bottom) - Math.max(item.top, thumb.top) >= (item.bottom - item.top) * COVER) {
|
|
41
|
+
if (from < 0) from = index;
|
|
42
|
+
to = index;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
return from < 0 ? null : {
|
|
46
|
+
from,
|
|
47
|
+
to
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The contents column: headings on a single guide line, like the sidebar's nested pages,
|
|
52
|
+
* with a thumb that slides along the line over the part of the page on screen.
|
|
53
|
+
*/
|
|
54
|
+
function TableOfContents({ toc, label = "On this page", className }) {
|
|
55
|
+
const scrollerRef = useRef(null);
|
|
56
|
+
const listRef = useRef(null);
|
|
57
|
+
const thumbRef = useRef(null);
|
|
58
|
+
const [range, setRange] = useState(null);
|
|
59
|
+
const min = Math.min(...toc.map((entry) => entry.depth));
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
const list = listRef.current;
|
|
62
|
+
const scroller = scrollerRef.current;
|
|
63
|
+
if (!list) return;
|
|
64
|
+
let last = "";
|
|
65
|
+
return watchReading(list, toc, (reading) => {
|
|
66
|
+
const thumb = thumbRef.current;
|
|
67
|
+
if (!thumb) return;
|
|
68
|
+
const items = Array.from(list.children, (item) => {
|
|
69
|
+
const element = item;
|
|
70
|
+
return {
|
|
71
|
+
top: element.offsetTop,
|
|
72
|
+
bottom: element.offsetTop + element.offsetHeight
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
const span = project(reading, items);
|
|
76
|
+
const height = Math.max(0, span.bottom - span.top);
|
|
77
|
+
thumb.style.transform = `translateY(${span.top}px)`;
|
|
78
|
+
thumb.style.height = `${height}px`;
|
|
79
|
+
thumb.style.opacity = height > .5 ? "1" : "0";
|
|
80
|
+
const next = height > .5 ? covered(span, items) : null;
|
|
81
|
+
const key = next ? `${next.from}:${next.to}` : "";
|
|
82
|
+
if (key !== last) {
|
|
83
|
+
last = key;
|
|
84
|
+
setRange(next);
|
|
85
|
+
}
|
|
86
|
+
if (scroller && scroller.scrollHeight > scroller.clientHeight) {
|
|
87
|
+
if (span.top < scroller.scrollTop + 8) scroller.scrollTop = span.top - 8;
|
|
88
|
+
else if (span.top > scroller.scrollTop + scroller.clientHeight - 32) scroller.scrollTop = span.top - scroller.clientHeight + 32;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}, [toc]);
|
|
92
|
+
if (!toc.length) return null;
|
|
93
|
+
return /* @__PURE__ */ jsxs("nav", {
|
|
94
|
+
"aria-label": label,
|
|
95
|
+
className: cn("flex min-h-0 flex-col", className),
|
|
96
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
97
|
+
className: "pb-3 text-xs font-medium text-fd-muted-foreground",
|
|
98
|
+
children: label
|
|
99
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
100
|
+
ref: scrollerRef,
|
|
101
|
+
className: "docs-scroll min-h-0 overflow-y-auto overscroll-contain",
|
|
102
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
103
|
+
className: "relative border-s border-fd-border",
|
|
104
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
105
|
+
ref: thumbRef,
|
|
106
|
+
"aria-hidden": true,
|
|
107
|
+
className: "docs-toc-thumb absolute top-0 -left-px w-0.5 rounded-full bg-fd-foreground"
|
|
108
|
+
}), /* @__PURE__ */ jsx("ol", {
|
|
109
|
+
ref: listRef,
|
|
110
|
+
className: "flex flex-col",
|
|
111
|
+
children: toc.map((entry, index) => {
|
|
112
|
+
const active = range !== null && index >= range.from && index <= range.to;
|
|
113
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", {
|
|
114
|
+
href: `#${entry.id}`,
|
|
115
|
+
onClick: (event) => jumpTo(event, entry.id),
|
|
116
|
+
"aria-current": active ? "location" : void 0,
|
|
117
|
+
style: { paddingInlineStart: 12 + (entry.depth - min) * INDENT },
|
|
118
|
+
className: cn("block rounded-sm py-1 text-sm leading-5 text-pretty outline-none transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-fd-ring", active ? "text-fd-foreground" : "text-fd-muted-foreground hover:text-fd-foreground"),
|
|
119
|
+
children: entry.title
|
|
120
|
+
}) }, entry.id);
|
|
121
|
+
})
|
|
122
|
+
})]
|
|
123
|
+
})
|
|
124
|
+
})]
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
export { TableOfContents };
|
|
Binary file
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
-----------------------------------------------------------
|
|
8
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
9
|
+
-----------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
PREAMBLE
|
|
12
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
13
|
+
development of collaborative font projects, to support the font creation
|
|
14
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
15
|
+
open framework in which fonts may be shared and improved in partnership
|
|
16
|
+
with others.
|
|
17
|
+
|
|
18
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
19
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
20
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
21
|
+
redistributed and/or sold with any software provided that any reserved
|
|
22
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
23
|
+
however, cannot be released under any other type of license. The
|
|
24
|
+
requirement for fonts to remain under this license does not apply
|
|
25
|
+
to any document created using the fonts or their derivatives.
|
|
26
|
+
|
|
27
|
+
DEFINITIONS
|
|
28
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
29
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
30
|
+
include source files, build scripts and documentation.
|
|
31
|
+
|
|
32
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
33
|
+
copyright statement(s).
|
|
34
|
+
|
|
35
|
+
"Original Version" refers to the collection of Font Software components as
|
|
36
|
+
distributed by the Copyright Holder(s).
|
|
37
|
+
|
|
38
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
39
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
40
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
41
|
+
new environment.
|
|
42
|
+
|
|
43
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
44
|
+
writer or other person who contributed to the Font Software.
|
|
45
|
+
|
|
46
|
+
PERMISSION AND CONDITIONS
|
|
47
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
48
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
49
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
50
|
+
Software, subject to the following conditions:
|
|
51
|
+
|
|
52
|
+
1) Neither the Font Software nor any of its individual components,
|
|
53
|
+
in Original or Modified Versions, may be sold by itself.
|
|
54
|
+
|
|
55
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
56
|
+
redistributed and/or sold with any software, provided that each copy
|
|
57
|
+
contains the above copyright notice and this license. These can be
|
|
58
|
+
included either as stand-alone text files, human-readable headers or
|
|
59
|
+
in the appropriate machine-readable metadata fields within text or
|
|
60
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
61
|
+
|
|
62
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
63
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
64
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
65
|
+
presented to the users.
|
|
66
|
+
|
|
67
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
68
|
+
Software shall not be used to promote, endorse or advertise any
|
|
69
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
70
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
71
|
+
permission.
|
|
72
|
+
|
|
73
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
74
|
+
must be distributed entirely under this license, and must not be
|
|
75
|
+
distributed under any other license. The requirement for fonts to
|
|
76
|
+
remain under this license does not apply to any document created
|
|
77
|
+
using the Font Software.
|
|
78
|
+
|
|
79
|
+
TERMINATION
|
|
80
|
+
This license becomes null and void if any of the above conditions are
|
|
81
|
+
not met.
|
|
82
|
+
|
|
83
|
+
DISCLAIMER
|
|
84
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
85
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
86
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
87
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
88
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
89
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
90
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
91
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
92
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
Copyright (c) 2025, Ahmed Hatem (https://github.com/ahatem)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
|
|
11
|
+
PREAMBLE
|
|
12
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
13
|
+
development of collaborative font projects, to support the font creation
|
|
14
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
15
|
+
open framework in which fonts may be shared and improved in partnership
|
|
16
|
+
with others.
|
|
17
|
+
|
|
18
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
19
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
20
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
21
|
+
redistributed and/or sold with any software provided that any reserved
|
|
22
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
23
|
+
however, cannot be released under any other type of license. The
|
|
24
|
+
requirement for fonts to remain under this license does not apply
|
|
25
|
+
to any document created using the fonts or their derivatives.
|
|
26
|
+
|
|
27
|
+
DEFINITIONS
|
|
28
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
29
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
30
|
+
include source files, build scripts and documentation.
|
|
31
|
+
|
|
32
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
33
|
+
copyright statement(s).
|
|
34
|
+
|
|
35
|
+
"Original Version" refers to the collection of Font Software components as
|
|
36
|
+
distributed by the Copyright Holder(s).
|
|
37
|
+
|
|
38
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
39
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
40
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
41
|
+
new environment.
|
|
42
|
+
|
|
43
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
44
|
+
writer or other person who contributed to the Font Software.
|
|
45
|
+
|
|
46
|
+
PERMISSION & CONDITIONS
|
|
47
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
48
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
49
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
50
|
+
Software, subject to the following conditions:
|
|
51
|
+
|
|
52
|
+
1. Neither the Font Software nor any of its individual components,
|
|
53
|
+
in Original or Modified Versions, may be sold by itself.
|
|
54
|
+
|
|
55
|
+
1. Original or Modified Versions of the Font Software may be bundled,
|
|
56
|
+
redistributed and/or sold with any software, provided that each copy
|
|
57
|
+
contains the above copyright notice and this license. These can be
|
|
58
|
+
included either as stand-alone text files, human-readable headers or
|
|
59
|
+
in the appropriate machine-readable metadata fields within text or
|
|
60
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
61
|
+
|
|
62
|
+
1. No Modified Version of the Font Software may use the Reserved Font
|
|
63
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
64
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
65
|
+
presented to the users.
|
|
66
|
+
|
|
67
|
+
1. The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
68
|
+
Software shall not be used to promote, endorse or advertise any
|
|
69
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
70
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
71
|
+
permission.
|
|
72
|
+
|
|
73
|
+
1. The Font Software, modified or unmodified, in part or in whole,
|
|
74
|
+
must be distributed entirely under this license, and must not be
|
|
75
|
+
distributed under any other license. The requirement for fonts to
|
|
76
|
+
remain under this license does not apply to any document created
|
|
77
|
+
using the Font Software.
|
|
78
|
+
|
|
79
|
+
TERMINATION
|
|
80
|
+
This license becomes null and void if any of the above conditions are
|
|
81
|
+
not met.
|
|
82
|
+
|
|
83
|
+
DISCLAIMER
|
|
84
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
85
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
86
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
87
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
88
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
89
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
90
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
91
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
92
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
package/dist/fonts.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fontVariables: string;
|