shelving 1.215.2 → 1.216.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shelving",
3
- "version": "1.215.2",
3
+ "version": "1.216.1",
4
4
  "author": "Dave Houlbrooke <dave@shax.com>",
5
5
  "repository": {
6
6
  "type": "git",
package/ui/README.md CHANGED
@@ -21,7 +21,7 @@ A few conventions run through every component (see also the React Components sec
21
21
 
22
22
  | Folder | What's inside |
23
23
  |---|---|
24
- | [block](/ui/block) | Block-level content — `Card`, `Section`, `Heading`, `Table`, `List`, `Prose`, `Figure`, `Flex` |
24
+ | [block](/ui/block) | Block-level content — `Card`, `Section`, `Title`, `Heading`, `Table`, `List`, `Prose`, `Figure`, `Flex` |
25
25
  | [inline](/ui/inline) | Inline content — `Code`, `Strong`, `Emphasis`, `Link`, `Mark`, `Small` |
26
26
  | [misc](/ui/misc) | Cross-cutting pieces — `Markup`, `Tag`, `Status`, `Loading`, `Color`, `Catcher`, `Mapper` |
27
27
 
@@ -57,14 +57,14 @@ A few conventions run through every component (see also the React Components sec
57
57
  A minimal single-screen app:
58
58
 
59
59
  ```tsx
60
- import { App, CenteredLayout, Section, Heading, Paragraph } from "shelving/ui";
60
+ import { App, CenteredLayout, Section, Title, Paragraph } from "shelving/ui";
61
61
 
62
62
  function HelloApp() {
63
63
  return (
64
64
  <App app="My app">
65
65
  <CenteredLayout>
66
66
  <Section narrow>
67
- <Heading>Hello</Heading>
67
+ <Title>Hello</Title>
68
68
  <Paragraph>Welcome to the app.</Paragraph>
69
69
  </Section>
70
70
  </CenteredLayout>
@@ -12,7 +12,7 @@ export interface CardProps extends ClickableProps {
12
12
  * - When `href` or `onClick` is set the card becomes navigable: a stretched overlay `<a>` / `<button>` covers the entire card while the children render normally inside.
13
13
  * - Real interactive elements inside the card (e.g. inline `<a>` links) stay clickable thanks to `position: relative; z-index: 2` rules in the stylesheet.
14
14
  *
15
- * @example <Card><Heading>Static</Heading></Card>
16
- * @example <Card href="/foo" title="Open foo"><Heading>Clickable</Heading></Card>
15
+ * @example <Card><Subheading>Static</Subheading></Card>
16
+ * @example <Card href="/foo" title="Open foo"><Subheading>Clickable</Subheading></Card>
17
17
  */
18
18
  export declare function Card({ children, href, onClick, title, ...props }: CardProps): ReactElement;
package/ui/block/Card.js CHANGED
@@ -7,8 +7,8 @@ import CARD_CSS from "./Card.module.css";
7
7
  * - When `href` or `onClick` is set the card becomes navigable: a stretched overlay `<a>` / `<button>` covers the entire card while the children render normally inside.
8
8
  * - Real interactive elements inside the card (e.g. inline `<a>` links) stay clickable thanks to `position: relative; z-index: 2` rules in the stylesheet.
9
9
  *
10
- * @example <Card><Heading>Static</Heading></Card>
11
- * @example <Card href="/foo" title="Open foo"><Heading>Clickable</Heading></Card>
10
+ * @example <Card><Subheading>Static</Subheading></Card>
11
+ * @example <Card href="/foo" title="Open foo"><Subheading>Clickable</Subheading></Card>
12
12
  */
13
13
  export function Card({ children, href, onClick, title = "Open", ...props }) {
14
14
  const overlay = (href || onClick) && _jsx(Clickable, { title: title, href: href, onClick: onClick, ...props, className: CARD_CSS.overlay });
package/ui/block/Card.tsx CHANGED
@@ -18,8 +18,8 @@ export interface CardProps extends ClickableProps {
18
18
  * - When `href` or `onClick` is set the card becomes navigable: a stretched overlay `<a>` / `<button>` covers the entire card while the children render normally inside.
19
19
  * - Real interactive elements inside the card (e.g. inline `<a>` links) stay clickable thanks to `position: relative; z-index: 2` rules in the stylesheet.
20
20
  *
21
- * @example <Card><Heading>Static</Heading></Card>
22
- * @example <Card href="/foo" title="Open foo"><Heading>Clickable</Heading></Card>
21
+ * @example <Card><Subheading>Static</Subheading></Card>
22
+ * @example <Card href="/foo" title="Open foo"><Subheading>Clickable</Subheading></Card>
23
23
  */
24
24
  export function Card({ children, href, onClick, title = "Open", ...props }: CardProps): ReactElement {
25
25
  const overlay = (href || onClick) && <Clickable title={title} href={href} onClick={onClick} {...props} className={CARD_CSS.overlay} />;
@@ -1,6 +1,16 @@
1
- import type { ReactNode } from "react";
1
+ import type { ReactElement, ReactNode } from "react";
2
+ /** Props shared by `Title`, `Heading`, and `Subheading`. */
2
3
  export interface HeadingProps {
4
+ /**
5
+ * Heading level (`1`–`6`) — sets the rendered `<h1>`–`<h6>` tag.
6
+ * Avoid overriding this in practice: pick the component that matches the level — `Title` (`<h1>`), `Heading` (`<h2>`), or `Subheading` (`<h3>`) — so the visual size and the document outline stay in step.
7
+ */
3
8
  level?: "1" | "2" | "3" | "4" | "5" | "6" | 1 | 2 | 3 | 4 | 5 | 6;
9
+ /** Heading content. */
4
10
  children: ReactNode;
5
11
  }
6
- export declare function Heading({ level, children, ...variants }: HeadingProps): import("react/jsx-runtime").JSX.Element;
12
+ /**
13
+ * Section heading — renders an `<h2>`.
14
+ * - Sits between `Title` (`<h1>`) and `Subheading` (`<h3>`) in the heading hierarchy.
15
+ */
16
+ export declare function Heading({ level, children, ...variants }: HeadingProps): ReactElement;
@@ -1,7 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { getModuleClass } from "../util/css.js";
3
3
  import styles from "./Heading.module.css";
4
- export function Heading({ level = "1", children, ...variants }) {
4
+ /**
5
+ * Section heading — renders an `<h2>`.
6
+ * - Sits between `Title` (`<h1>`) and `Subheading` (`<h3>`) in the heading hierarchy.
7
+ */
8
+ export function Heading({ level = "2", children, ...variants }) {
5
9
  const Element = `h${level}`;
6
10
  return _jsx(Element, { className: getModuleClass(styles, "heading", variants), children: children });
7
11
  }
@@ -1,22 +1,19 @@
1
1
  .heading,
2
- .prose h1 {
2
+ .prose h2 {
3
3
  /* Box */
4
4
  display: block;
5
5
  inline-size: 100%;
6
6
  margin-inline: 0;
7
- margin-block: var(--heading-spacing, var(--space-normal));
7
+ /* `em` top margin scales with font-size, so larger headings get proportionally more space above them. */
8
+ margin-block-start: var(--heading-spacing-before, 1.5em);
9
+ margin-block-end: var(--heading-spacing, var(--space-normal));
8
10
 
9
11
  /* Style */
10
12
  font-family: var(--heading-font, var(--font-body));
11
13
  font-weight: var(--heading-weight, var(--weight-strong));
12
14
  line-height: var(--heading-leading, var(--leading));
13
15
  color: var(--heading-color, var(--color-text));
14
-
15
- /*
16
- * Default font-size — applies to h1 (the `<Heading>` default) and to `.prose h1`.
17
- * Per-level rules below override for `<Heading level="2-6">` cases.
18
- */
19
- font-size: var(--heading-font-size, var(--size-xxxlarge));
16
+ font-size: var(--heading-font-size, var(--size-xxlarge));
20
17
 
21
18
  /* Psuedo-classes */
22
19
  &:first-child {
@@ -26,14 +23,3 @@
26
23
  margin-block-end: 0;
27
24
  }
28
25
  }
29
-
30
- /* Per-level font-size scaling — `<Heading level="N">` sizes itself by its tag. */
31
- .heading:is(h2) {
32
- font-size: var(--heading-font-size, var(--size-xxlarge));
33
- }
34
- .heading:is(h3) {
35
- font-size: var(--heading-font-size, var(--size-xlarge));
36
- }
37
- .heading:is(h4, h5, h6) {
38
- font-size: var(--heading-font-size, var(--size-large));
39
- }
@@ -1,13 +1,23 @@
1
- import type { ReactNode } from "react";
1
+ import type { ReactElement, ReactNode } from "react";
2
2
  import { getModuleClass } from "../util/css.js";
3
3
  import styles from "./Heading.module.css";
4
4
 
5
+ /** Props shared by `Title`, `Heading`, and `Subheading`. */
5
6
  export interface HeadingProps {
7
+ /**
8
+ * Heading level (`1`–`6`) — sets the rendered `<h1>`–`<h6>` tag.
9
+ * Avoid overriding this in practice: pick the component that matches the level — `Title` (`<h1>`), `Heading` (`<h2>`), or `Subheading` (`<h3>`) — so the visual size and the document outline stay in step.
10
+ */
6
11
  level?: "1" | "2" | "3" | "4" | "5" | "6" | 1 | 2 | 3 | 4 | 5 | 6;
12
+ /** Heading content. */
7
13
  children: ReactNode;
8
14
  }
9
15
 
10
- export function Heading({ level = "1", children, ...variants }: HeadingProps) {
16
+ /**
17
+ * Section heading — renders an `<h2>`.
18
+ * - Sits between `Title` (`<h1>`) and `Subheading` (`<h3>`) in the heading hierarchy.
19
+ */
20
+ export function Heading({ level = "2", children, ...variants }: HeadingProps): ReactElement {
11
21
  const Element: `h${typeof level}` = `h${level}`;
12
22
  return <Element className={getModuleClass(styles, "heading", variants)}>{children}</Element>;
13
23
  }
@@ -31,10 +31,10 @@ Some block components ship multiple pieces intended to compose:
31
31
  ### Content card with a heading
32
32
 
33
33
  ```tsx
34
- import { Card, Heading, Paragraph } from "shelving/ui";
34
+ import { Card, Paragraph, Subheading } from "shelving/ui";
35
35
 
36
36
  <Card href="/products/42" title="Open product">
37
- <Heading level={2}>Widget Pro</Heading>
37
+ <Subheading>Widget Pro</Subheading>
38
38
  <Paragraph>The best widget on the market.</Paragraph>
39
39
  </Card>
40
40
  ```
@@ -56,7 +56,7 @@ import { Section, Heading, Definitions, Definition } from "shelving/ui";
56
56
  </Section>
57
57
  ```
58
58
 
59
- `<Subheading>` uses the same `level` prop as `<Heading>` but applies secondary typography styles use it for in-section labels and panel titles.
59
+ `<Title>`, `<Heading>`, and `<Subheading>` render `<h1>`, `<h2>`, and `<h3>` respectively — pick the component that matches the level rather than overriding it with the `level` prop. Use `<Subheading>` for card titles, in-section labels, and panel titles.
60
60
 
61
61
  ### Prose content from a renderer
62
62
 
@@ -73,12 +73,12 @@ Wrap `<Markup>` (or any component that emits raw HTML elements) in `<Prose>` to
73
73
  ### Flex row of cards
74
74
 
75
75
  ```tsx
76
- import { Flex, Card, Heading } from "shelving/ui";
76
+ import { Card, Flex, Subheading } from "shelving/ui";
77
77
 
78
78
  <Flex wrap>
79
79
  {products.map(p => (
80
80
  <Card key={p.id} href={`/products/${p.id}`}>
81
- <Heading level={3}>{p.name}</Heading>
81
+ <Subheading>{p.name}</Subheading>
82
82
  </Card>
83
83
  ))}
84
84
  </Flex>
@@ -1,3 +1,9 @@
1
+ import type { ReactElement } from "react";
1
2
  import type { HeadingProps } from "./Heading.js";
3
+ /** Props for `Subheading` — identical to `HeadingProps`. */
2
4
  export type SubheadingProps = HeadingProps;
3
- export declare function Subheading({ level, children, ...variants }: SubheadingProps): import("react/jsx-runtime").JSX.Element;
5
+ /**
6
+ * Subsection heading — renders an `<h3>`.
7
+ * - Only marginally larger than body text; its bold weight is the main differentiator.
8
+ */
9
+ export declare function Subheading({ level, children, ...variants }: SubheadingProps): ReactElement;
@@ -1,7 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { getModuleClass } from "../util/css.js";
3
3
  import styles from "./Subheading.module.css";
4
- export function Subheading({ level = "2", children, ...variants }) {
4
+ /**
5
+ * Subsection heading — renders an `<h3>`.
6
+ * - Only marginally larger than body text; its bold weight is the main differentiator.
7
+ */
8
+ export function Subheading({ level = "3", children, ...variants }) {
5
9
  const Element = `h${level}`;
6
10
  return _jsx(Element, { className: getModuleClass(styles, "subheading", variants), children: children });
7
11
  }
@@ -1,22 +1,19 @@
1
1
  .subheading,
2
- .prose :is(h2, h3, h4, h5, h6) {
2
+ .prose :is(h3, h4, h5, h6) {
3
3
  /* Box */
4
4
  display: block;
5
5
  inline-size: 100%;
6
6
  margin-inline: 0;
7
- margin-block: var(--subheading-spacing, var(--space-normal));
7
+ /* `em` top margin scales with font-size, so larger headings get proportionally more space above them. */
8
+ margin-block-start: var(--subheading-spacing-before, 1.5em);
9
+ margin-block-end: var(--subheading-spacing, var(--space-normal));
8
10
 
9
11
  /* Style */
10
12
  font-family: var(--subheading-font, var(--font-body));
11
13
  font-weight: var(--subheading-weight, var(--weight-strong));
12
14
  line-height: var(--subheading-leading, var(--leading));
13
15
  color: var(--subheading-color, var(--color-text));
14
-
15
- /*
16
- * Default font-size — applies to h2 (the `<Subheading>` default).
17
- * Per-level rules below override for `<Subheading level="3-6">` cases and for `.prose` headings.
18
- */
19
- font-size: var(--subheading-font-size, var(--size-xxlarge));
16
+ font-size: var(--subheading-font-size, var(--size-large));
20
17
 
21
18
  /* Psuedo-classes */
22
19
  &:first-child {
@@ -26,13 +23,3 @@
26
23
  margin-block-end: 0;
27
24
  }
28
25
  }
29
-
30
- /* Per-level font-size scaling — `<Subheading level="N">` (and prose headings) size by tag. */
31
- .subheading:is(h3),
32
- .prose h3 {
33
- font-size: var(--subheading-font-size, var(--size-xlarge));
34
- }
35
- .subheading:is(h4, h5, h6),
36
- .prose :is(h4, h5, h6) {
37
- font-size: var(--subheading-font-size, var(--size-large));
38
- }
@@ -1,10 +1,16 @@
1
+ import type { ReactElement } from "react";
1
2
  import { getModuleClass } from "../util/css.js";
2
3
  import type { HeadingProps } from "./Heading.js";
3
4
  import styles from "./Subheading.module.css";
4
5
 
6
+ /** Props for `Subheading` — identical to `HeadingProps`. */
5
7
  export type SubheadingProps = HeadingProps;
6
8
 
7
- export function Subheading({ level = "2", children, ...variants }: SubheadingProps) {
9
+ /**
10
+ * Subsection heading — renders an `<h3>`.
11
+ * - Only marginally larger than body text; its bold weight is the main differentiator.
12
+ */
13
+ export function Subheading({ level = "3", children, ...variants }: SubheadingProps): ReactElement {
8
14
  const Element: `h${typeof level}` = `h${level}`;
9
15
  return <Element className={getModuleClass(styles, "subheading", variants)}>{children}</Element>;
10
16
  }
@@ -0,0 +1,9 @@
1
+ import type { ReactElement } from "react";
2
+ import type { HeadingProps } from "./Heading.js";
3
+ /** Props for `Title` — identical to `HeadingProps`. */
4
+ export type TitleProps = HeadingProps;
5
+ /**
6
+ * Page title — renders an `<h1>`.
7
+ * - The most prominent heading on a page; there should normally be exactly one.
8
+ */
9
+ export declare function Title({ level, children, ...variants }: TitleProps): ReactElement;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { getModuleClass } from "../util/css.js";
3
+ import styles from "./Title.module.css";
4
+ /**
5
+ * Page title — renders an `<h1>`.
6
+ * - The most prominent heading on a page; there should normally be exactly one.
7
+ */
8
+ export function Title({ level = "1", children, ...variants }) {
9
+ const Element = `h${level}`;
10
+ return _jsx(Element, { className: getModuleClass(styles, "title", variants), children: children });
11
+ }
@@ -0,0 +1,25 @@
1
+ .title,
2
+ .prose h1 {
3
+ /* Box */
4
+ display: block;
5
+ inline-size: 100%;
6
+ margin-inline: 0;
7
+ /* `em` top margin scales with font-size, so larger headings get proportionally more space above them. */
8
+ margin-block-start: var(--title-spacing-before, 1.5em);
9
+ margin-block-end: var(--title-spacing, var(--space-normal));
10
+
11
+ /* Style */
12
+ font-family: var(--title-font, var(--font-body));
13
+ font-weight: var(--title-weight, var(--weight-strong));
14
+ line-height: var(--title-leading, var(--leading));
15
+ color: var(--title-color, var(--color-text));
16
+ font-size: var(--title-font-size, var(--size-xxxlarge));
17
+
18
+ /* Psuedo-classes */
19
+ &:first-child {
20
+ margin-block-start: 0;
21
+ }
22
+ &:last-child {
23
+ margin-block-end: 0;
24
+ }
25
+ }
@@ -0,0 +1,16 @@
1
+ import type { ReactElement } from "react";
2
+ import { getModuleClass } from "../util/css.js";
3
+ import type { HeadingProps } from "./Heading.js";
4
+ import styles from "./Title.module.css";
5
+
6
+ /** Props for `Title` — identical to `HeadingProps`. */
7
+ export type TitleProps = HeadingProps;
8
+
9
+ /**
10
+ * Page title — renders an `<h1>`.
11
+ * - The most prominent heading on a page; there should normally be exactly one.
12
+ */
13
+ export function Title({ level = "1", children, ...variants }: TitleProps): ReactElement {
14
+ const Element: `h${typeof level}` = `h${level}`;
15
+ return <Element className={getModuleClass(styles, "title", variants)}>{children}</Element>;
16
+ }
@@ -15,4 +15,5 @@ export * from "./Prose.js";
15
15
  export * from "./Section.js";
16
16
  export * from "./Subheading.js";
17
17
  export * from "./Table.js";
18
+ export * from "./Title.js";
18
19
  export * from "./Video.js";
package/ui/block/index.js CHANGED
@@ -15,4 +15,5 @@ export * from "./Prose.js";
15
15
  export * from "./Section.js";
16
16
  export * from "./Subheading.js";
17
17
  export * from "./Table.js";
18
+ export * from "./Title.js";
18
19
  export * from "./Video.js";
package/ui/block/index.ts CHANGED
@@ -15,4 +15,5 @@ export * from "./Prose.js";
15
15
  export * from "./Section.js";
16
16
  export * from "./Subheading.js";
17
17
  export * from "./Table.js";
18
+ export * from "./Title.js";
18
19
  export * from "./Video.js";
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { joinPath } from "../../util/path.js";
3
3
  import { Card } from "../block/Card.js";
4
- import { Heading } from "../block/Heading.js";
5
4
  import { Prose } from "../block/Prose.js";
5
+ import { Subheading } from "../block/Subheading.js";
6
6
  import { Markup } from "../misc/Markup.js";
7
7
  /** Card renderer for a `tree-directory` element. */
8
8
  export function DirectoryCard({ path, name, title, content }) {
9
9
  const href = joinPath(path, name);
10
- return (_jsxs(Card, { href: href, children: [_jsx(Heading, { level: "3", children: title ?? name }), content && (_jsx(Prose, { children: _jsx(Markup, { children: content }) }))] }));
10
+ return (_jsxs(Card, { href: href, children: [_jsx(Subheading, { children: title ?? name }), content && (_jsx(Prose, { children: _jsx(Markup, { children: content }) }))] }));
11
11
  }
@@ -2,8 +2,8 @@ import type { ReactNode } from "react";
2
2
  import type { DirectoryElementProps } from "../../util/element.js";
3
3
  import { type AbsolutePath, joinPath } from "../../util/path.js";
4
4
  import { Card } from "../block/Card.js";
5
- import { Heading } from "../block/Heading.js";
6
5
  import { Prose } from "../block/Prose.js";
6
+ import { Subheading } from "../block/Subheading.js";
7
7
  import { Markup } from "../misc/Markup.js";
8
8
 
9
9
  interface DirectoryCardProps extends DirectoryElementProps {
@@ -15,7 +15,7 @@ export function DirectoryCard({ path, name, title, content }: DirectoryCardProps
15
15
  const href = joinPath(path, name);
16
16
  return (
17
17
  <Card href={href}>
18
- <Heading level="3">{title ?? name}</Heading>
18
+ <Subheading>{title ?? name}</Subheading>
19
19
  {content && (
20
20
  <Prose>
21
21
  <Markup>{content}</Markup>
@@ -2,14 +2,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { joinPath } from "../../util/path.js";
3
3
  import { Card } from "../block/Card.js";
4
4
  import { Flex } from "../block/Flex.js";
5
- import { Heading } from "../block/Heading.js";
6
5
  import { Preformatted } from "../block/Preformatted.js";
7
6
  import { Prose } from "../block/Prose.js";
7
+ import { Subheading } from "../block/Subheading.js";
8
8
  import { Code } from "../inline/Code.js";
9
9
  import { Markup } from "../misc/Markup.js";
10
10
  import { DocumentationKind } from "./DocumentationKind.js";
11
11
  /** Card renderer for a `tree-documentation` element. */
12
12
  export function DocumentationCard({ path, title, name, kind, content, signatures }) {
13
13
  const href = joinPath(path, name);
14
- return (_jsxs(Card, { href: href, children: [_jsx(Heading, { level: "3", children: _jsxs(Flex, { left: true, children: [_jsx(Code, { children: title ?? name }), kind && _jsx(DocumentationKind, { kind: kind })] }) }), signatures?.map(sig => (_jsx(Preformatted, { children: sig }, sig))), content && (_jsx(Prose, { children: _jsx(Markup, { children: content }) }))] }));
14
+ return (_jsxs(Card, { href: href, children: [_jsx(Subheading, { children: _jsxs(Flex, { left: true, children: [_jsx(Code, { children: title ?? name }), kind && _jsx(DocumentationKind, { kind: kind })] }) }), signatures?.map(sig => (_jsx(Preformatted, { children: sig }, sig))), content && (_jsx(Prose, { children: _jsx(Markup, { children: content }) }))] }));
15
15
  }
@@ -3,9 +3,9 @@ import type { DocumentationElementProps } from "../../util/element.js";
3
3
  import { type AbsolutePath, joinPath } from "../../util/path.js";
4
4
  import { Card } from "../block/Card.js";
5
5
  import { Flex } from "../block/Flex.js";
6
- import { Heading } from "../block/Heading.js";
7
6
  import { Preformatted } from "../block/Preformatted.js";
8
7
  import { Prose } from "../block/Prose.js";
8
+ import { Subheading } from "../block/Subheading.js";
9
9
  import { Code } from "../inline/Code.js";
10
10
  import { Markup } from "../misc/Markup.js";
11
11
  import { DocumentationKind } from "./DocumentationKind.js";
@@ -19,12 +19,12 @@ export function DocumentationCard({ path, title, name, kind, content, signatures
19
19
  const href = joinPath(path, name);
20
20
  return (
21
21
  <Card href={href}>
22
- <Heading level="3">
22
+ <Subheading>
23
23
  <Flex left>
24
24
  <Code>{title ?? name}</Code>
25
25
  {kind && <DocumentationKind kind={kind} />}
26
26
  </Flex>
27
- </Heading>
27
+ </Subheading>
28
28
  {signatures?.map(sig => (
29
29
  <Preformatted key={sig}>{sig}</Preformatted>
30
30
  ))}
@@ -1,9 +1,11 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Definition, Definitions } from "../block/Definitions.js";
3
+ import { Flex } from "../block/Flex.js";
3
4
  import { Heading } from "../block/Heading.js";
4
5
  import { Preformatted } from "../block/Preformatted.js";
5
6
  import { Prose } from "../block/Prose.js";
6
7
  import { Section } from "../block/Section.js";
8
+ import { Title } from "../block/Title.js";
7
9
  import { Code } from "../inline/Code.js";
8
10
  import { Markup } from "../misc/Markup.js";
9
11
  import { requireMeta } from "../misc/MetaContext.js";
@@ -19,5 +21,5 @@ const DEFAULT_TYPE = "unknown";
19
21
  export function DocumentationPage({ title, name, kind, description, content, signatures, params, returns, throws, examples, children, }) {
20
22
  const { url } = requireMeta();
21
23
  const path = (url?.pathname ?? "/");
22
- return (_jsxs(Page, { title: title ?? name, description: description, children: [kind && _jsx(DocumentationKind, { kind: kind }), signatures?.map(sig => (_jsx(Preformatted, { children: sig }, sig))), content && (_jsx(Prose, { children: _jsx(Markup, { children: content }) })), params?.length && (_jsxs(Section, { children: [_jsx(Heading, { level: "2", children: "Parameters" }), _jsx(Definitions, { row: true, children: params.map(({ name, type = DEFAULT_TYPE, description = "", optional }) => (_jsx(Definition, { term: _jsxs(_Fragment, { children: [_jsx(Code, { children: name }), ": ", _jsx(Code, { children: type }), optional && _jsx(_Fragment, { children: " (optional)" })] }), children: description }, `${name}-${type}-${description}`))) })] })), returns?.length && (_jsxs(Section, { children: [_jsx(Heading, { level: "2", children: "Returns" }), _jsx(Definitions, { row: true, children: returns.map(({ type = DEFAULT_TYPE, description = "" }) => (_jsx(Definition, { term: _jsx(Code, { children: type }), children: description }, `${type}-${description}`))) })] })), throws?.length && (_jsxs(Section, { children: [_jsx(Heading, { level: "2", children: "Throws" }), _jsx(Definitions, { row: true, children: throws.map(({ type = DEFAULT_TYPE, description = "" }) => (_jsx(Definition, { term: _jsx(Code, { children: type }), children: description }, `${type}-${description}`))) })] })), examples?.length && (_jsxs(Section, { children: [_jsx(Heading, { level: "2", children: "Examples" }), examples.map(({ description }) => (_jsx(Preformatted, { children: description }, description)))] })), _jsx(TreeCards, { path: path, children: children })] }));
24
+ return (_jsxs(Page, { title: title ?? name, description: description, children: [_jsx(Title, { children: _jsxs(Flex, { left: true, children: [title ?? name, kind && _jsx(DocumentationKind, { kind: kind })] }) }), signatures?.map(sig => (_jsx(Preformatted, { children: sig }, sig))), content && (_jsx(Prose, { children: _jsx(Markup, { children: content }) })), params?.length && (_jsxs(Section, { children: [_jsx(Heading, { children: "Parameters" }), _jsx(Definitions, { row: true, children: params.map(({ name, type = DEFAULT_TYPE, description = "", optional }) => (_jsx(Definition, { term: _jsxs(_Fragment, { children: [_jsx(Code, { children: name }), ": ", _jsx(Code, { children: type }), optional && _jsx(_Fragment, { children: " (optional)" })] }), children: description }, `${name}-${type}-${description}`))) })] })), returns?.length && (_jsxs(Section, { children: [_jsx(Heading, { children: "Returns" }), _jsx(Definitions, { row: true, children: returns.map(({ type = DEFAULT_TYPE, description = "" }) => (_jsx(Definition, { term: _jsx(Code, { children: type }), children: description }, `${type}-${description}`))) })] })), throws?.length && (_jsxs(Section, { children: [_jsx(Heading, { children: "Throws" }), _jsx(Definitions, { row: true, children: throws.map(({ type = DEFAULT_TYPE, description = "" }) => (_jsx(Definition, { term: _jsx(Code, { children: type }), children: description }, `${type}-${description}`))) })] })), examples?.length && (_jsxs(Section, { children: [_jsx(Heading, { children: "Examples" }), examples.map(({ description }) => (_jsx(Preformatted, { children: description }, description)))] })), _jsx(TreeCards, { path: path, children: children })] }));
23
25
  }
@@ -2,10 +2,12 @@ import type { ReactNode } from "react";
2
2
  import type { DocumentationElementProps } from "../../util/element.js";
3
3
  import type { AbsolutePath } from "../../util/path.js";
4
4
  import { Definition, Definitions } from "../block/Definitions.js";
5
+ import { Flex } from "../block/Flex.js";
5
6
  import { Heading } from "../block/Heading.js";
6
7
  import { Preformatted } from "../block/Preformatted.js";
7
8
  import { Prose } from "../block/Prose.js";
8
9
  import { Section } from "../block/Section.js";
10
+ import { Title } from "../block/Title.js";
9
11
  import { Code } from "../inline/Code.js";
10
12
  import { Markup } from "../misc/Markup.js";
11
13
  import { requireMeta } from "../misc/MetaContext.js";
@@ -37,7 +39,12 @@ export function DocumentationPage({
37
39
  const path = (url?.pathname ?? "/") as AbsolutePath;
38
40
  return (
39
41
  <Page title={title ?? name} description={description}>
40
- {kind && <DocumentationKind kind={kind} />}
42
+ <Title>
43
+ <Flex left>
44
+ {title ?? name}
45
+ {kind && <DocumentationKind kind={kind} />}
46
+ </Flex>
47
+ </Title>
41
48
  {signatures?.map(sig => (
42
49
  <Preformatted key={sig}>{sig}</Preformatted>
43
50
  ))}
@@ -48,7 +55,7 @@ export function DocumentationPage({
48
55
  )}
49
56
  {params?.length && (
50
57
  <Section>
51
- <Heading level="2">Parameters</Heading>
58
+ <Heading>Parameters</Heading>
52
59
  <Definitions row>
53
60
  {params.map(({ name, type = DEFAULT_TYPE, description = "", optional }) => (
54
61
  <Definition
@@ -68,7 +75,7 @@ export function DocumentationPage({
68
75
  )}
69
76
  {returns?.length && (
70
77
  <Section>
71
- <Heading level="2">Returns</Heading>
78
+ <Heading>Returns</Heading>
72
79
  <Definitions row>
73
80
  {returns.map(({ type = DEFAULT_TYPE, description = "" }) => (
74
81
  <Definition key={`${type}-${description}`} term={<Code>{type}</Code>}>
@@ -80,7 +87,7 @@ export function DocumentationPage({
80
87
  )}
81
88
  {throws?.length && (
82
89
  <Section>
83
- <Heading level="2">Throws</Heading>
90
+ <Heading>Throws</Heading>
84
91
  <Definitions row>
85
92
  {throws.map(({ type = DEFAULT_TYPE, description = "" }) => (
86
93
  <Definition key={`${type}-${description}`} term={<Code>{type}</Code>}>
@@ -92,7 +99,7 @@ export function DocumentationPage({
92
99
  )}
93
100
  {examples?.length && (
94
101
  <Section>
95
- <Heading level="2">Examples</Heading>
102
+ <Heading>Examples</Heading>
96
103
  {examples.map(({ description }) => (
97
104
  <Preformatted key={description}>{description}</Preformatted>
98
105
  ))}
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { joinPath } from "../../util/path.js";
3
3
  import { Card } from "../block/Card.js";
4
- import { Heading } from "../block/Heading.js";
5
4
  import { Prose } from "../block/Prose.js";
5
+ import { Subheading } from "../block/Subheading.js";
6
6
  import { Markup } from "../misc/Markup.js";
7
7
  /** Card renderer for a `tree-file` element. */
8
8
  export function FileCard({ path, name, title, content }) {
9
9
  const href = joinPath(path, name);
10
- return (_jsxs(Card, { href: href, children: [_jsx(Heading, { level: "3", children: title ?? name }), content && (_jsx(Prose, { children: _jsx(Markup, { children: content }) }))] }));
10
+ return (_jsxs(Card, { href: href, children: [_jsx(Subheading, { children: title ?? name }), content && (_jsx(Prose, { children: _jsx(Markup, { children: content }) }))] }));
11
11
  }
@@ -2,8 +2,8 @@ import type { ReactNode } from "react";
2
2
  import type { FileElementProps } from "../../util/element.js";
3
3
  import { type AbsolutePath, joinPath } from "../../util/path.js";
4
4
  import { Card } from "../block/Card.js";
5
- import { Heading } from "../block/Heading.js";
6
5
  import { Prose } from "../block/Prose.js";
6
+ import { Subheading } from "../block/Subheading.js";
7
7
  import { Markup } from "../misc/Markup.js";
8
8
 
9
9
  interface FileCardProps extends FileElementProps {
@@ -15,7 +15,7 @@ export function FileCard({ path, name, title, content }: FileCardProps): ReactNo
15
15
  const href = joinPath(path, name);
16
16
  return (
17
17
  <Card href={href}>
18
- <Heading level="3">{title ?? name}</Heading>
18
+ <Subheading>{title ?? name}</Subheading>
19
19
  {content && (
20
20
  <Prose>
21
21
  <Markup>{content}</Markup>
@@ -9,7 +9,7 @@
9
9
 
10
10
  /* Typography */
11
11
  font-family: var(--menu-font, var(--font-body));
12
- font-size: var(--menu-size, var(--size-small));
12
+ font-size: var(--menu-size, var(--size-normal));
13
13
  line-height: var(--menu-leading, var(--leading-normal));
14
14
  color: var(--menu-color-text, var(--color-quiet));
15
15
  }