@gunkin/uiify 0.0.15-alpha → 0.0.17-alpha
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/README.md +59 -1
- package/agents/components.md +1 -0
- package/agents/index.md +7 -1
- package/agents/reference/components/table-of-contents.md +185 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/table-of-contents/TableOfContents.d.ts +22 -0
- package/dist/components/table-of-contents/TableOfContents.d.ts.map +1 -0
- package/dist/components/table-of-contents/TableOfContents.js +142 -0
- package/dist/components/table-of-contents/TableOfContents.js.map +1 -0
- package/dist/components/table-of-contents/client/TableOfContentsClient.d.ts +18 -0
- package/dist/components/table-of-contents/client/TableOfContentsClient.d.ts.map +1 -0
- package/dist/components/table-of-contents/client/TableOfContentsClient.js +140 -0
- package/dist/components/table-of-contents/client/TableOfContentsClient.js.map +1 -0
- package/dist/components/table-of-contents/client/TableOfContentsClientParts.d.ts +7 -0
- package/dist/components/table-of-contents/client/TableOfContentsClientParts.d.ts.map +1 -0
- package/dist/components/table-of-contents/client/TableOfContentsClientParts.js +48 -0
- package/dist/components/table-of-contents/client/TableOfContentsClientParts.js.map +1 -0
- package/dist/components/table-of-contents/client/index.d.ts +5 -0
- package/dist/components/table-of-contents/client/index.d.ts.map +1 -0
- package/dist/components/table-of-contents/client/index.js +23 -0
- package/dist/components/table-of-contents/client/index.js.map +1 -0
- package/dist/components/table-of-contents/client/table-of-contents-context.d.ts +3 -0
- package/dist/components/table-of-contents/client/table-of-contents-context.d.ts.map +1 -0
- package/dist/components/table-of-contents/client/table-of-contents-context.js +7 -0
- package/dist/components/table-of-contents/client/table-of-contents-context.js.map +1 -0
- package/dist/components/table-of-contents/client/table-of-contents-interactions.d.ts +3 -0
- package/dist/components/table-of-contents/client/table-of-contents-interactions.d.ts.map +1 -0
- package/dist/components/table-of-contents/client/table-of-contents-interactions.js +144 -0
- package/dist/components/table-of-contents/client/table-of-contents-interactions.js.map +1 -0
- package/dist/components/table-of-contents/client/table-of-contents-pointer.d.ts +3 -0
- package/dist/components/table-of-contents/client/table-of-contents-pointer.d.ts.map +1 -0
- package/dist/components/table-of-contents/client/table-of-contents-pointer.js +94 -0
- package/dist/components/table-of-contents/client/table-of-contents-pointer.js.map +1 -0
- package/dist/components/table-of-contents/client.d.ts +1 -0
- package/dist/components/table-of-contents/client.js +1 -0
- package/dist/components/table-of-contents/index.d.ts +3 -0
- package/dist/components/table-of-contents/index.d.ts.map +1 -0
- package/dist/components/table-of-contents/index.js +21 -0
- package/dist/components/table-of-contents/index.js.map +1 -0
- package/dist/components/table-of-contents/scrollspy-selection.d.ts +4 -0
- package/dist/components/table-of-contents/scrollspy-selection.d.ts.map +1 -0
- package/dist/components/table-of-contents/scrollspy-selection.js +31 -0
- package/dist/components/table-of-contents/scrollspy-selection.js.map +1 -0
- package/dist/components/table-of-contents/scrollspy.d.ts +4 -0
- package/dist/components/table-of-contents/scrollspy.d.ts.map +1 -0
- package/dist/components/table-of-contents/scrollspy.js +178 -0
- package/dist/components/table-of-contents/scrollspy.js.map +1 -0
- package/dist/components/table-of-contents/types.d.ts +123 -0
- package/dist/components/table-of-contents/types.d.ts.map +1 -0
- package/dist/components/table-of-contents/types.js +1 -0
- package/dist/components/table-of-contents/types.js.map +1 -0
- package/dist/components/table-of-contents.d.ts +1 -0
- package/dist/components/table-of-contents.js +1 -0
- package/dist/styles/index.css +1 -1
- package/package.json +3 -2
- package/skills/uiify/SKILL.md +145 -0
- package/skills/uiify/references/compositions/card-rhythm.md +16 -0
- package/skills/uiify/references/compositions/destructive-confirmation.md +17 -0
- package/skills/uiify/references/compositions/form-grouping.md +16 -0
- package/skills/uiify/references/compositions/hero-actions.md +16 -0
- package/skills/uiify/references/compositions/page-frame.md +16 -0
- package/skills/uiify/references/compositions/pricing-actions.md +15 -0
- package/skills/uiify/references/compositions/save-feedback.md +15 -0
- package/skills/uiify/references/compositions/table-controls.md +16 -0
- package/skills/uiify/references/elements/alert-modal.md +15 -0
- package/skills/uiify/references/elements/avatar.md +18 -0
- package/skills/uiify/references/elements/badge.md +18 -0
- package/skills/uiify/references/elements/bar-chart.md +29 -0
- package/skills/uiify/references/elements/button.md +14 -0
- package/skills/uiify/references/elements/card.md +14 -0
- package/skills/uiify/references/elements/code-block.md +21 -0
- package/skills/uiify/references/elements/command-palette.md +22 -0
- package/skills/uiify/references/elements/cookie-banner.md +23 -0
- package/skills/uiify/references/elements/date-picker.md +19 -0
- package/skills/uiify/references/elements/divider.md +18 -0
- package/skills/uiify/references/elements/empty-state.md +22 -0
- package/skills/uiify/references/elements/feature-grid.md +14 -0
- package/skills/uiify/references/elements/field.md +14 -0
- package/skills/uiify/references/elements/footer.md +14 -0
- package/skills/uiify/references/elements/form.md +14 -0
- package/skills/uiify/references/elements/header.md +14 -0
- package/skills/uiify/references/elements/hero.md +14 -0
- package/skills/uiify/references/elements/image-gallery.md +20 -0
- package/skills/uiify/references/elements/inline-alert.md +18 -0
- package/skills/uiify/references/elements/input.md +14 -0
- package/skills/uiify/references/elements/logo-wall.md +20 -0
- package/skills/uiify/references/elements/pagination.md +14 -0
- package/skills/uiify/references/elements/password-input.md +19 -0
- package/skills/uiify/references/elements/pricing-table.md +13 -0
- package/skills/uiify/references/elements/progress-bar.md +19 -0
- package/skills/uiify/references/elements/search-input.md +14 -0
- package/skills/uiify/references/elements/select.md +14 -0
- package/skills/uiify/references/elements/sidebar.md +20 -0
- package/skills/uiify/references/elements/stats-bar.md +21 -0
- package/skills/uiify/references/elements/stepper.md +20 -0
- package/skills/uiify/references/elements/switch.md +14 -0
- package/skills/uiify/references/elements/table.md +14 -0
- package/skills/uiify/references/elements/testimonial.md +21 -0
- package/skills/uiify/references/elements/textarea.md +14 -0
- package/skills/uiify/references/elements/timeline.md +20 -0
- package/skills/uiify/references/elements/toast.md +13 -0
- package/skills/uiify/references/laws/accessibility.md +11 -0
- package/skills/uiify/references/laws/error-prevention.md +12 -0
- package/skills/uiify/references/laws/feedback.md +9 -0
- package/skills/uiify/references/laws/proximity.md +10 -0
- package/skills/uiify/references/laws/readability.md +9 -0
- package/skills/uiify/references/laws/von-restorff.md +9 -0
- package/skills/uiify/scripts/lint.mjs +56 -0
- package/skills/uiify/scripts/static.mjs +95 -0
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Native-first, accessible React 19 components that work before hydration.
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm install @gunkin/uiify
|
|
10
|
+
npm install @gunkin/uiify react react-dom
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Use
|
|
@@ -44,6 +44,64 @@ For @gunkin/uiify, read node_modules/@gunkin/uiify/agents/index.md
|
|
|
44
44
|
|
|
45
45
|
In a monorepo with hoisted dependencies, point to the nearest `node_modules/@gunkin/uiify`.
|
|
46
46
|
|
|
47
|
+
### `/uiify` page-building skill
|
|
48
|
+
|
|
49
|
+
The package also includes the `/uiify` AI skill. Invoke it explicitly when creating or improving a
|
|
50
|
+
web page with UIify. It adds component and UX knowledge to your request while preserving the agent's
|
|
51
|
+
normal workflow: no staged approvals, routine questions or special status output. It follows the
|
|
52
|
+
requested framework route and existing workspace conventions, reads version-matched component
|
|
53
|
+
references and supports custom UI for components UIify does not provide. Existing design decisions
|
|
54
|
+
are reused; invoking the skill does not require creating `DESIGN.md`.
|
|
55
|
+
|
|
56
|
+
The skill ships a compact index plus individually retrievable element, UX-law and composition
|
|
57
|
+
references under `skills/uiify/references/`. During planning it reads recipes for the requested
|
|
58
|
+
elements and relationships between them, then reads the public component docs for matched UIify
|
|
59
|
+
components. It does not load the whole catalog into the prompt. The private harness catalog is the
|
|
60
|
+
source for reviewed knowledge; the package contains only its curated public projection. Knowledge
|
|
61
|
+
is delivered as files, so this workflow does not require an MCP server.
|
|
62
|
+
|
|
63
|
+
Install the skill into the directory your agent reads:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Cross-tool Agent Skills location (Codex, Copilot, Cursor, and compatible tools)
|
|
67
|
+
mkdir -p .agents/skills/uiify
|
|
68
|
+
cp -R node_modules/@gunkin/uiify/skills/uiify/. .agents/skills/uiify/
|
|
69
|
+
|
|
70
|
+
# For Claude Code, use this location instead
|
|
71
|
+
mkdir -p .claude/skills/uiify
|
|
72
|
+
cp -R node_modules/@gunkin/uiify/skills/uiify/. .claude/skills/uiify/
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Claude Code uses `/uiify <page brief>`; other agents use their documented explicit skill invocation.
|
|
76
|
+
No special execution flag is needed. The repository's manual smoke harness exercises Claude Code
|
|
77
|
+
only; activation syntax and token measurements do not establish behavior for other clients.
|
|
78
|
+
|
|
79
|
+
For verification, the skill reuses project tooling. If missing Playwright or axe-core tooling or
|
|
80
|
+
browser binaries are needed, the agent briefly explains what it will install and why before
|
|
81
|
+
installation. This is a notice, not a routine confirmation question. Installation follows project
|
|
82
|
+
rules, uses development dependencies and includes only what is needed. Unavailable checks are
|
|
83
|
+
reported as not run.
|
|
84
|
+
|
|
85
|
+
### Keeping the skill current when developing UIify
|
|
86
|
+
|
|
87
|
+
When changing a UIify component, update its public component reference and example when its API or
|
|
88
|
+
usage changes, and update the harness catalog when its coverage or gap status changes. Then run
|
|
89
|
+
`npm run checks:fix` from the repository root. This regenerates the consumer AI docs and `/uiify`
|
|
90
|
+
skill, then checks their tests and freshness. Review and commit generated changes with the component
|
|
91
|
+
change. `npm run check:ai-harness` runs the focused tests and freshness checks without rewriting files.
|
|
92
|
+
|
|
93
|
+
For new design knowledge, inspect the component API and examples; record sourced evidence in the
|
|
94
|
+
private catalog; write a concise `release_body`; review the public projection for privacy and
|
|
95
|
+
usefulness; regenerate the skill; and run package-link and hygiene tests. Private evidence and owner
|
|
96
|
+
rationale stay in the harness source; changing private notes alone does not change what consumers
|
|
97
|
+
receive.
|
|
98
|
+
|
|
99
|
+
The optional paid eval runner records each agent and judge call separately. An unknown cost reserves
|
|
100
|
+
that call's configured cap and blocks later paid calls. `results.json` is atomically checkpointed
|
|
101
|
+
before and after calls and throughout page verification; an existing non-empty output directory is
|
|
102
|
+
not reused. This protects recorded progress but does not measure whether one skill produces better
|
|
103
|
+
designs than another.
|
|
104
|
+
|
|
47
105
|
Documentation: https://uiify.gunkin.dev/
|
|
48
106
|
|
|
49
107
|
MIT © Anton Gunkin
|
package/agents/components.md
CHANGED
|
@@ -67,6 +67,7 @@ its exports, props and shapes; exact types are in the `.d.ts` file listed in the
|
|
|
67
67
|
| [otp-input](./reference/components/otp-input.md) | `@gunkin/uiify/components/otp-input` | 2 | none | `input` | `dist/components/otp-input.d.ts` | |
|
|
68
68
|
| [color-picker](./reference/components/color-picker.md) | `@gunkin/uiify/components/color-picker` | 1 | S1 | `input[type=color]` | `dist/components/color-picker.d.ts` | |
|
|
69
69
|
| [virtual-scroll](./reference/components/virtual-scroll.md) | `@gunkin/uiify/components/virtual-scroll` | 2 | none | `div[overflow]` | `dist/components/virtual-scroll.d.ts` | |
|
|
70
|
+
| [table-of-contents](./reference/components/table-of-contents.md) | `@gunkin/uiify/components/table-of-contents` | 2 | S1 | `nav + button[popovertarget] + [popover] + a[href]` | `dist/components/table-of-contents.d.ts` | Base entry is a server-pure native navigation shell; /client adds enhancements. Native links and popover invocation/dismissal work without JavaScript. |
|
|
70
71
|
|
|
71
72
|
## Elements
|
|
72
73
|
|
package/agents/index.md
CHANGED
|
@@ -74,7 +74,7 @@ export function BillingLink() {
|
|
|
74
74
|
}
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
Native server parts do not share React context. Each part names its root with an id you choose:
|
|
78
78
|
|
|
79
79
|
```tsx
|
|
80
80
|
import { Field } from "@gunkin/uiify/components/field";
|
|
@@ -171,3 +171,9 @@ Check a component's tier in `components.md` before importing it into a Server Co
|
|
|
171
171
|
|
|
172
172
|
Some components also have sub-entries such as `@gunkin/uiify/components/modal/client` for
|
|
173
173
|
controlled state. They are listed under **Sub-entries** in the component's reference file.
|
|
174
|
+
|
|
175
|
+
TableOfContents has a server-pure base entry for native popover buttons and fragment links.
|
|
176
|
+
Import `@gunkin/uiify/components/table-of-contents/client` for scrollspy, hover opening,
|
|
177
|
+
pinning and controlled `value`/`open`. Provide unique `Content.id` and matching `Trigger.target`,
|
|
178
|
+
label the navigation and trigger, and match each `Indicator.value` to a target heading ID.
|
|
179
|
+
The client Root owns context for its parts. A permanent list omits Trigger and Content.
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
<!-- Generated from the package source. Do not edit by hand. -->
|
|
2
|
+
# table-of-contents
|
|
3
|
+
|
|
4
|
+
- Import: `@gunkin/uiify/components/table-of-contents`
|
|
5
|
+
- Tier 2 (Client component — pre-hydration SSR); state source S1; native element `nav + button[popovertarget] + [popover] + a[href]`
|
|
6
|
+
- Without JavaScript: pre-hydration-only
|
|
7
|
+
- Types file: `dist/components/table-of-contents.d.ts`
|
|
8
|
+
- Note: Base entry is a server-pure native navigation shell; /client adds enhancements. Native links and popover invocation/dismissal work without JavaScript.
|
|
9
|
+
|
|
10
|
+
## Exports
|
|
11
|
+
|
|
12
|
+
- Runtime: `TableOfContents`, `TableOfContentsRoot`, `TableOfContentsTrigger`, `TableOfContentsRail`, `TableOfContentsIndicator`, `TableOfContentsContent`, `TableOfContentsList`, `TableOfContentsLink`
|
|
13
|
+
- Types: `TableOfContentsLevel`, `TableOfContentsRootOwnProps`, `TableOfContentsRootProps`, `TableOfContentsTriggerOwnProps`, `TableOfContentsTriggerProps`, `TableOfContentsRailOwnProps`, `TableOfContentsRailProps`, `TableOfContentsIndicatorOwnProps`, `TableOfContentsIndicatorProps`, `TableOfContentsContentOwnProps`, `TableOfContentsContentProps`, `TableOfContentsListOwnProps`, `TableOfContentsListProps`, `TableOfContentsLinkOwnProps`, `TableOfContentsLinkProps`
|
|
14
|
+
|
|
15
|
+
## Values
|
|
16
|
+
|
|
17
|
+
- `TableOfContentsLevel`: `1 | 2 | 3 | 4 | 5 | 6`
|
|
18
|
+
|
|
19
|
+
## Props and shapes
|
|
20
|
+
|
|
21
|
+
### TableOfContentsRootOwnProps
|
|
22
|
+
|
|
23
|
+
| Member | Type | Required | Description |
|
|
24
|
+
| --- | --- | --- | --- |
|
|
25
|
+
| `children` | `ReactNode` | no | |
|
|
26
|
+
|
|
27
|
+
### TableOfContentsTriggerOwnProps
|
|
28
|
+
|
|
29
|
+
| Member | Type | Required | Description |
|
|
30
|
+
| --- | --- | --- | --- |
|
|
31
|
+
| `children` | `ReactNode` | no | |
|
|
32
|
+
| `target` | `string` | yes | |
|
|
33
|
+
|
|
34
|
+
### TableOfContentsRailOwnProps
|
|
35
|
+
|
|
36
|
+
| Member | Type | Required | Description |
|
|
37
|
+
| --- | --- | --- | --- |
|
|
38
|
+
| `children` | `ReactNode` | no | |
|
|
39
|
+
|
|
40
|
+
### TableOfContentsIndicatorOwnProps
|
|
41
|
+
|
|
42
|
+
| Member | Type | Required | Description |
|
|
43
|
+
| --- | --- | --- | --- |
|
|
44
|
+
| `ref` | `Ref<HTMLElement>` | no | |
|
|
45
|
+
| `style` | `CSSProperties` | no | |
|
|
46
|
+
| `children` | `ReactNode` | no | |
|
|
47
|
+
| `value` | `string` | yes | Stable target ID matching a Link fragment. |
|
|
48
|
+
| `level` | `TableOfContentsLevel` | no | |
|
|
49
|
+
| `selected` | `boolean` | no | |
|
|
50
|
+
|
|
51
|
+
### TableOfContentsContentOwnProps
|
|
52
|
+
|
|
53
|
+
| Member | Type | Required | Description |
|
|
54
|
+
| --- | --- | --- | --- |
|
|
55
|
+
| `children` | `ReactNode` | no | |
|
|
56
|
+
| `id` | `string` | yes | |
|
|
57
|
+
| `side` | `AnchorSide` | no | |
|
|
58
|
+
| `align` | `AnchorAlign` | no | |
|
|
59
|
+
|
|
60
|
+
### TableOfContentsListOwnProps
|
|
61
|
+
|
|
62
|
+
| Member | Type | Required | Description |
|
|
63
|
+
| --- | --- | --- | --- |
|
|
64
|
+
| `children` | `ReactNode` | no | |
|
|
65
|
+
|
|
66
|
+
### TableOfContentsLinkOwnProps
|
|
67
|
+
|
|
68
|
+
| Member | Type | Required | Description |
|
|
69
|
+
| --- | --- | --- | --- |
|
|
70
|
+
| `style` | `CSSProperties` | no | |
|
|
71
|
+
| `"aria-current"` | `AriaAttributes["aria-current"]` | no | |
|
|
72
|
+
| `children` | `ReactNode` | no | |
|
|
73
|
+
| `href` | `string` | yes | Native same-page anchor; external URLs are not tracked by scrollspy. |
|
|
74
|
+
| `level` | `TableOfContentsLevel` | no | |
|
|
75
|
+
| `selected` | `boolean` | no | |
|
|
76
|
+
|
|
77
|
+
### TableOfContentsTargetSnapshot
|
|
78
|
+
|
|
79
|
+
| Member | Type | Required | Description |
|
|
80
|
+
| --- | --- | --- | --- |
|
|
81
|
+
| `value` | `string` | yes | |
|
|
82
|
+
| `start` | `number` | yes | |
|
|
83
|
+
| `visible` | `boolean` | yes | |
|
|
84
|
+
|
|
85
|
+
### TableOfContentsScrollSnapshot
|
|
86
|
+
|
|
87
|
+
| Member | Type | Required | Description |
|
|
88
|
+
| --- | --- | --- | --- |
|
|
89
|
+
| `targets` | `readonly TableOfContentsTargetSnapshot[]` | yes | |
|
|
90
|
+
| `viewportStart` | `number` | yes | |
|
|
91
|
+
| `viewportEnd` | `number` | yes | |
|
|
92
|
+
| `offset` | `number` | yes | |
|
|
93
|
+
| `contentEnd` | `number \| null` | yes | |
|
|
94
|
+
|
|
95
|
+
### TableOfContentsObserverOptions
|
|
96
|
+
|
|
97
|
+
| Member | Type | Required | Description |
|
|
98
|
+
| --- | --- | --- | --- |
|
|
99
|
+
| `root` | `HTMLElement` | yes | |
|
|
100
|
+
| `scrollTarget` | `string \| undefined` | no | |
|
|
101
|
+
| `contentTarget` | `string \| undefined` | no | |
|
|
102
|
+
| `offset` | `number` | yes | |
|
|
103
|
+
| `onValueChange` | `(value: string \| null) => void` | yes | |
|
|
104
|
+
|
|
105
|
+
### TableOfContentsObserver
|
|
106
|
+
|
|
107
|
+
| Member | Type | Required | Description |
|
|
108
|
+
| --- | --- | --- | --- |
|
|
109
|
+
| `refresh` | `() => void` | yes | |
|
|
110
|
+
| `destroy` | `() => void` | yes | |
|
|
111
|
+
|
|
112
|
+
### TableOfContentsClientRootOwnProps
|
|
113
|
+
|
|
114
|
+
Extends: `TableOfContentsRootOwnProps`
|
|
115
|
+
|
|
116
|
+
| Member | Type | Required | Description |
|
|
117
|
+
| --- | --- | --- | --- |
|
|
118
|
+
| `ref` | `Ref<HTMLElement>` | no | |
|
|
119
|
+
| `className` | `string` | no | |
|
|
120
|
+
| `style` | `CSSProperties` | no | |
|
|
121
|
+
| `onClick` | `MouseEventHandler<HTMLElement>` | no | |
|
|
122
|
+
| `scrollSpy` | `boolean` | no | |
|
|
123
|
+
| `scrollTarget` | `string` | no | Scroll-container element ID; omitted tracks the owning window. |
|
|
124
|
+
| `contentTarget` | `string` | no | Content element ID used for target scope and end-of-content selection. |
|
|
125
|
+
| `offset` | `number` | no | |
|
|
126
|
+
| `value` | `string \| null` | no | |
|
|
127
|
+
| `defaultValue` | `string \| null` | no | |
|
|
128
|
+
| `onValueChange` | `(value: string \| null) => void` | no | |
|
|
129
|
+
| `open` | `boolean` | no | |
|
|
130
|
+
| `defaultOpen` | `boolean` | no | Applied after hydration; the native SSR surface starts closed. |
|
|
131
|
+
| `onOpenChange` | `(open: boolean) => void` | no | |
|
|
132
|
+
| `openOnHover` | `boolean` | no | |
|
|
133
|
+
| `openDelay` | `number` | no | |
|
|
134
|
+
| `closeDelay` | `number` | no | |
|
|
135
|
+
|
|
136
|
+
### TableOfContentsClientContextValue
|
|
137
|
+
|
|
138
|
+
| Member | Type | Required | Description |
|
|
139
|
+
| --- | --- | --- | --- |
|
|
140
|
+
| `value` | `string \| null` | yes | |
|
|
141
|
+
| `open` | `boolean` | yes | |
|
|
142
|
+
| `documentUrl` | `string \| undefined` | yes | |
|
|
143
|
+
|
|
144
|
+
### TableOfContentsInteractionOptions
|
|
145
|
+
|
|
146
|
+
| Member | Type | Required | Description |
|
|
147
|
+
| --- | --- | --- | --- |
|
|
148
|
+
| `root` | `HTMLElement` | yes | |
|
|
149
|
+
| `getOpen` | `() => boolean` | yes | |
|
|
150
|
+
| `requestOpen` | `(open: boolean) => void` | yes | |
|
|
151
|
+
| `controlled` | `boolean` | yes | |
|
|
152
|
+
| `openOnHover` | `boolean` | yes | |
|
|
153
|
+
| `openDelay` | `number` | yes | |
|
|
154
|
+
| `closeDelay` | `number` | yes | |
|
|
155
|
+
|
|
156
|
+
### TableOfContentsInteractions
|
|
157
|
+
|
|
158
|
+
| Member | Type | Required | Description |
|
|
159
|
+
| --- | --- | --- | --- |
|
|
160
|
+
| `click` | `(event: MouseEvent) => void` | yes | |
|
|
161
|
+
| `destroy` | `() => void` | yes | |
|
|
162
|
+
|
|
163
|
+
### TableOfContentsPointerOptions
|
|
164
|
+
|
|
165
|
+
| Member | Type | Required | Description |
|
|
166
|
+
| --- | --- | --- | --- |
|
|
167
|
+
| `root` | `HTMLElement` | yes | |
|
|
168
|
+
|
|
169
|
+
## Other types
|
|
170
|
+
|
|
171
|
+
- `TableOfContentsRootProps<TAs>`: `RenderableProps<TAs, TableOfContentsRootOwnProps, Record<string, never>, HTMLElement>`
|
|
172
|
+
- `TableOfContentsTriggerProps<TAs>`: `NativeButtonProps<TAs, TableOfContentsTriggerOwnProps>`
|
|
173
|
+
- `TableOfContentsRailProps<TAs>`: `RenderableProps<TAs, TableOfContentsRailOwnProps, Record<string, never>, HTMLElement>`
|
|
174
|
+
- `TableOfContentsIndicatorProps<TAs>`: `RenderableProps<TAs, TableOfContentsIndicatorOwnProps, { selected: boolean }, HTMLElement>`
|
|
175
|
+
- `TableOfContentsContentProps<TAs>`: `RenderableProps<TAs, TableOfContentsContentOwnProps, Record<string, never>, HTMLElement>`
|
|
176
|
+
- `TableOfContentsListProps<TAs>`: `RenderableProps<TAs, TableOfContentsListOwnProps, Record<string, never>, HTMLElement>`
|
|
177
|
+
- `TableOfContentsLinkProps<TAs>`: `RenderableProps<TAs, TableOfContentsLinkOwnProps, { selected: boolean }, HTMLAnchorElement>`
|
|
178
|
+
- `TableOfContentsClientRootProps<TAs>`: `RenderableProps<TAs, TableOfContentsClientRootOwnProps, { value: string | null; open: boolean }, HTMLElement>`
|
|
179
|
+
|
|
180
|
+
## Sub-entries
|
|
181
|
+
|
|
182
|
+
### `@gunkin/uiify/components/table-of-contents/client`
|
|
183
|
+
|
|
184
|
+
- Runtime: `TableOfContents`, `TableOfContentsRoot`, `TableOfContentsTrigger`, `TableOfContentsContent`, `TableOfContentsLink`, `TableOfContentsIndicator`, `TableOfContentsRail`, `TableOfContentsList`
|
|
185
|
+
- Types: `TableOfContentsClientRootOwnProps`, `TableOfContentsClientRootProps`, `TableOfContentsLevel`, `TableOfContentsTriggerProps`, `TableOfContentsRailProps`, `TableOfContentsContentProps`, `TableOfContentsListProps`, `TableOfContentsLinkProps`, `TableOfContentsIndicatorProps`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAE1C,cAAc,8BAA8B,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["// @gunkin/uiify/components — root barrel export.\n// Each component task appends one line here:\n// export * from \"./<name>/index.js\";\n\nexport * from \"./button/index.js\";\nexport * from \"./checkbox/index.js\";\nexport * from \"./modal/index.js\";\nexport * from \"./dropdown-menu/index.js\";\nexport * from \"./hover-card/index.js\";\nexport * from \"./input/index.js\";\nexport * from \"./popup/index.js\";\nexport * from \"./radio-group/index.js\";\nexport * from \"./slider/index.js\";\nexport * from \"./switch/index.js\";\nexport * from \"./tabs/index.js\";\nexport * from \"./textarea/index.js\";\nexport * from \"./toggle-group/index.js\";\nexport * from \"./toolbar/index.js\";\nexport * from \"./toggle/index.js\";\nexport * from \"./tooltip/index.js\";\nexport * from \"./accordion/index.js\";\nexport * from \"./alert-modal/index.js\";\nexport * from \"./combobox/index.js\";\nexport * from \"./toast/index.js\";\nexport * from \"./select/index.js\";\nexport * from \"./spinner/index.js\";\nexport * from \"./skeleton/index.js\";\nexport * from \"./collapsible/index.js\";\nexport * from \"./breadcrumb/index.js\";\nexport * from \"./pagination/index.js\";\nexport * from \"./table/index.js\";\nexport * from \"./number-field/index.js\";\nexport * from \"./otp-input/index.js\";\nexport * from \"./segmented-control/index.js\";\nexport * from \"./rating/index.js\";\nexport * from \"./field/index.js\";\nexport * from \"./form/index.js\";\nexport * from \"./tags-input/index.js\";\nexport * from \"./file-upload/index.js\";\nexport * from \"./color-picker/index.js\";\nexport * from \"./carousel/index.js\";\nexport * from \"./candle-chart/index.js\";\nexport * from \"./line-chart/index.js\";\nexport * from \"./drawer/index.js\";\nexport * from \"./context-menu/index.js\";\nexport * from \"./header/index.js\";\nexport * from \"./virtual-scroll/index.js\";\n"],"mappings":"AAIA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["// @gunkin/uiify/components — root barrel export.\n// Each component task appends one line here:\n// export * from \"./<name>/index.js\";\n\nexport * from \"./button/index.js\";\nexport * from \"./checkbox/index.js\";\nexport * from \"./modal/index.js\";\nexport * from \"./dropdown-menu/index.js\";\nexport * from \"./hover-card/index.js\";\nexport * from \"./input/index.js\";\nexport * from \"./popup/index.js\";\nexport * from \"./radio-group/index.js\";\nexport * from \"./slider/index.js\";\nexport * from \"./switch/index.js\";\nexport * from \"./tabs/index.js\";\nexport * from \"./textarea/index.js\";\nexport * from \"./toggle-group/index.js\";\nexport * from \"./toolbar/index.js\";\nexport * from \"./toggle/index.js\";\nexport * from \"./tooltip/index.js\";\nexport * from \"./accordion/index.js\";\nexport * from \"./alert-modal/index.js\";\nexport * from \"./combobox/index.js\";\nexport * from \"./toast/index.js\";\nexport * from \"./select/index.js\";\nexport * from \"./spinner/index.js\";\nexport * from \"./skeleton/index.js\";\nexport * from \"./collapsible/index.js\";\nexport * from \"./breadcrumb/index.js\";\nexport * from \"./pagination/index.js\";\nexport * from \"./table/index.js\";\nexport * from \"./number-field/index.js\";\nexport * from \"./otp-input/index.js\";\nexport * from \"./segmented-control/index.js\";\nexport * from \"./rating/index.js\";\nexport * from \"./field/index.js\";\nexport * from \"./form/index.js\";\nexport * from \"./tags-input/index.js\";\nexport * from \"./file-upload/index.js\";\nexport * from \"./color-picker/index.js\";\nexport * from \"./carousel/index.js\";\nexport * from \"./candle-chart/index.js\";\nexport * from \"./line-chart/index.js\";\nexport * from \"./drawer/index.js\";\nexport * from \"./context-menu/index.js\";\nexport * from \"./header/index.js\";\nexport * from \"./virtual-scroll/index.js\";\n\nexport * from \"./table-of-contents/index.js\";\n"],"mappings":"AAIA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ElementType, ReactElement } from "react";
|
|
2
|
+
import type { TableOfContentsRootProps, TableOfContentsTriggerProps, TableOfContentsRailProps, TableOfContentsIndicatorProps, TableOfContentsContentProps, TableOfContentsListProps, TableOfContentsLinkProps } from "./types.js";
|
|
3
|
+
export declare function TableOfContentsRoot<TAs extends ElementType = "nav">(props: TableOfContentsRootProps<TAs>): ReactElement | null;
|
|
4
|
+
export declare function TableOfContentsTrigger<TAs extends ElementType = "button">(props: TableOfContentsTriggerProps<TAs>): ReactElement;
|
|
5
|
+
export declare namespace TableOfContentsTrigger {
|
|
6
|
+
var displayName: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function TableOfContentsRail<TAs extends ElementType = "span">(props: TableOfContentsRailProps<TAs>): ReactElement | null;
|
|
9
|
+
export declare function TableOfContentsIndicator<TAs extends ElementType = "span">(props: TableOfContentsIndicatorProps<TAs>): ReactElement | null;
|
|
10
|
+
export declare function TableOfContentsContent<TAs extends ElementType = "div">(props: TableOfContentsContentProps<TAs>): ReactElement | null;
|
|
11
|
+
export declare function TableOfContentsList<TAs extends ElementType = "div">(props: TableOfContentsListProps<TAs>): ReactElement | null;
|
|
12
|
+
export declare function TableOfContentsLink<TAs extends ElementType = "a">(props: TableOfContentsLinkProps<TAs>): ReactElement | null;
|
|
13
|
+
export declare const TableOfContents: {
|
|
14
|
+
Root: typeof TableOfContentsRoot;
|
|
15
|
+
Trigger: typeof TableOfContentsTrigger;
|
|
16
|
+
Rail: typeof TableOfContentsRail;
|
|
17
|
+
Indicator: typeof TableOfContentsIndicator;
|
|
18
|
+
Content: typeof TableOfContentsContent;
|
|
19
|
+
List: typeof TableOfContentsList;
|
|
20
|
+
Link: typeof TableOfContentsLink;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=TableOfContents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableOfContents.d.ts","sourceRoot":"","sources":["../../../src/components/table-of-contents/TableOfContents.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAiB,WAAW,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAMtE,OAAO,KAAK,EACV,wBAAwB,EACxB,2BAA2B,EAC3B,wBAAwB,EACxB,6BAA6B,EAC7B,2BAA2B,EAC3B,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,YAAY,CAAC;AAMpB,wBAAgB,mBAAmB,CAAC,GAAG,SAAS,WAAW,GAAG,KAAK,EACjE,KAAK,EAAE,wBAAwB,CAAC,GAAG,CAAC,GACnC,YAAY,GAAG,IAAI,CASrB;AACD,wBAAgB,sBAAsB,CAAC,GAAG,SAAS,WAAW,GAAG,QAAQ,EACvE,KAAK,EAAE,2BAA2B,CAAC,GAAG,CAAC,GACtC,YAAY,CAUd;yBAZe,sBAAsB;;;AAatC,wBAAgB,mBAAmB,CAAC,GAAG,SAAS,WAAW,GAAG,MAAM,EAClE,KAAK,EAAE,wBAAwB,CAAC,GAAG,CAAC,GACnC,YAAY,GAAG,IAAI,CASrB;AACD,wBAAgB,wBAAwB,CAAC,GAAG,SAAS,WAAW,GAAG,MAAM,EACvE,KAAK,EAAE,6BAA6B,CAAC,GAAG,CAAC,GACxC,YAAY,GAAG,IAAI,CAuBrB;AACD,wBAAgB,sBAAsB,CAAC,GAAG,SAAS,WAAW,GAAG,KAAK,EACpE,KAAK,EAAE,2BAA2B,CAAC,GAAG,CAAC,GACtC,YAAY,GAAG,IAAI,CAsBrB;AACD,wBAAgB,mBAAmB,CAAC,GAAG,SAAS,WAAW,GAAG,KAAK,EACjE,KAAK,EAAE,wBAAwB,CAAC,GAAG,CAAC,GACnC,YAAY,GAAG,IAAI,CASrB;AACD,wBAAgB,mBAAmB,CAAC,GAAG,SAAS,WAAW,GAAG,GAAG,EAC/D,KAAK,EAAE,wBAAwB,CAAC,GAAG,CAAC,GACnC,YAAY,GAAG,IAAI,CAuBrB;AAED,eAAO,MAAM,eAAe;;;;;;;;CAQ3B,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
import { useRenderElement } from "../../core/render.js";
|
|
3
|
+
import {
|
|
4
|
+
createAnchorPositionerProps,
|
|
5
|
+
createAnchorTriggerProps
|
|
6
|
+
} from "../../core/anchor-position/props.js";
|
|
7
|
+
function anchorFor(target) {
|
|
8
|
+
return `--uiify-toc-${Array.from(target, (c) => c.codePointAt(0)?.toString(16)).join("-")}`;
|
|
9
|
+
}
|
|
10
|
+
function TableOfContentsRoot(props) {
|
|
11
|
+
const { as, render, ...rest } = props;
|
|
12
|
+
return useRenderElement({
|
|
13
|
+
as,
|
|
14
|
+
render,
|
|
15
|
+
defaultTag: "nav",
|
|
16
|
+
props: { ...rest, "data-uiify-table-of-contents": "" },
|
|
17
|
+
state: {}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function TableOfContentsTrigger(props) {
|
|
21
|
+
const { as, target, ...rest } = props;
|
|
22
|
+
return createElement(as ?? "button", {
|
|
23
|
+
...rest,
|
|
24
|
+
...createAnchorTriggerProps(anchorFor(target)),
|
|
25
|
+
"data-part": "trigger",
|
|
26
|
+
type: "button",
|
|
27
|
+
popoverTarget: target,
|
|
28
|
+
popoverTargetAction: "toggle"
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function TableOfContentsRail(props) {
|
|
32
|
+
const { as, render, ...rest } = props;
|
|
33
|
+
return useRenderElement({
|
|
34
|
+
as,
|
|
35
|
+
render,
|
|
36
|
+
defaultTag: "span",
|
|
37
|
+
props: { ...rest, "aria-hidden": true, "data-part": "rail" },
|
|
38
|
+
state: {}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function TableOfContentsIndicator(props) {
|
|
42
|
+
const {
|
|
43
|
+
as,
|
|
44
|
+
render,
|
|
45
|
+
value: _value,
|
|
46
|
+
level = 2,
|
|
47
|
+
selected = false,
|
|
48
|
+
style,
|
|
49
|
+
...rest
|
|
50
|
+
} = props;
|
|
51
|
+
return useRenderElement({
|
|
52
|
+
as,
|
|
53
|
+
render,
|
|
54
|
+
defaultTag: "span",
|
|
55
|
+
props: {
|
|
56
|
+
...rest,
|
|
57
|
+
style: { ...style, "--uiify-toc-level": level },
|
|
58
|
+
"aria-hidden": true,
|
|
59
|
+
"data-part": "indicator",
|
|
60
|
+
"data-selected": selected ? "" : void 0
|
|
61
|
+
},
|
|
62
|
+
state: { selected }
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function TableOfContentsContent(props) {
|
|
66
|
+
const {
|
|
67
|
+
as,
|
|
68
|
+
render,
|
|
69
|
+
side = "left",
|
|
70
|
+
align = "start",
|
|
71
|
+
id,
|
|
72
|
+
...rest
|
|
73
|
+
} = props;
|
|
74
|
+
return useRenderElement({
|
|
75
|
+
as,
|
|
76
|
+
render,
|
|
77
|
+
defaultTag: "div",
|
|
78
|
+
props: {
|
|
79
|
+
...rest,
|
|
80
|
+
...createAnchorPositionerProps({ anchorName: anchorFor(id), side, align }),
|
|
81
|
+
id,
|
|
82
|
+
popover: "auto",
|
|
83
|
+
"data-part": "content"
|
|
84
|
+
},
|
|
85
|
+
state: {}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function TableOfContentsList(props) {
|
|
89
|
+
const { as, render, ...rest } = props;
|
|
90
|
+
return useRenderElement({
|
|
91
|
+
as,
|
|
92
|
+
render,
|
|
93
|
+
defaultTag: "div",
|
|
94
|
+
props: { ...rest, "data-part": "list" },
|
|
95
|
+
state: {}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function TableOfContentsLink(props) {
|
|
99
|
+
const {
|
|
100
|
+
as,
|
|
101
|
+
render,
|
|
102
|
+
level = 2,
|
|
103
|
+
selected,
|
|
104
|
+
style,
|
|
105
|
+
...rest
|
|
106
|
+
} = props;
|
|
107
|
+
const current = selected ?? rest["aria-current"] === "location";
|
|
108
|
+
return useRenderElement({
|
|
109
|
+
as,
|
|
110
|
+
render,
|
|
111
|
+
defaultTag: "a",
|
|
112
|
+
props: {
|
|
113
|
+
...rest,
|
|
114
|
+
style: { ...style, "--uiify-toc-level": level },
|
|
115
|
+
"data-part": "link",
|
|
116
|
+
"data-selected": current ? "" : void 0,
|
|
117
|
+
...selected === void 0 ? {} : { "aria-current": selected ? "location" : void 0 }
|
|
118
|
+
},
|
|
119
|
+
state: { selected: current }
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
const TableOfContents = {
|
|
123
|
+
Root: TableOfContentsRoot,
|
|
124
|
+
Trigger: TableOfContentsTrigger,
|
|
125
|
+
Rail: TableOfContentsRail,
|
|
126
|
+
Indicator: TableOfContentsIndicator,
|
|
127
|
+
Content: TableOfContentsContent,
|
|
128
|
+
List: TableOfContentsList,
|
|
129
|
+
Link: TableOfContentsLink
|
|
130
|
+
};
|
|
131
|
+
TableOfContentsTrigger.displayName = "TableOfContentsTrigger";
|
|
132
|
+
export {
|
|
133
|
+
TableOfContents,
|
|
134
|
+
TableOfContentsContent,
|
|
135
|
+
TableOfContentsIndicator,
|
|
136
|
+
TableOfContentsLink,
|
|
137
|
+
TableOfContentsList,
|
|
138
|
+
TableOfContentsRail,
|
|
139
|
+
TableOfContentsRoot,
|
|
140
|
+
TableOfContentsTrigger
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=TableOfContents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/table-of-contents/TableOfContents.tsx"],"sourcesContent":["// Informed by studying Mantine TableOfContents, Fumadocs TOC and Tocbot.\n// Independently written; see NOTICE and the clean-room research notes.\nimport { createElement } from \"react\";\nimport type { CSSProperties, ElementType, ReactElement } from \"react\";\nimport { useRenderElement } from \"../../core/render.js\";\nimport {\n createAnchorPositionerProps,\n createAnchorTriggerProps,\n} from \"../../core/anchor-position/props.js\";\nimport type {\n TableOfContentsRootProps,\n TableOfContentsTriggerProps,\n TableOfContentsRailProps,\n TableOfContentsIndicatorProps,\n TableOfContentsContentProps,\n TableOfContentsListProps,\n TableOfContentsLinkProps,\n} from \"./types.js\";\n\nfunction anchorFor(target: string): string {\n return `--uiify-toc-${Array.from(target, (c) => c.codePointAt(0)?.toString(16)).join(\"-\")}`;\n}\n\nexport function TableOfContentsRoot<TAs extends ElementType = \"nav\">(\n props: TableOfContentsRootProps<TAs>,\n): ReactElement | null {\n const { as, render, ...rest } = props as TableOfContentsRootProps<\"nav\">;\n return useRenderElement({\n as,\n render,\n defaultTag: \"nav\",\n props: { ...rest, \"data-uiify-table-of-contents\": \"\" },\n state: {},\n });\n}\nexport function TableOfContentsTrigger<TAs extends ElementType = \"button\">(\n props: TableOfContentsTriggerProps<TAs>,\n): ReactElement {\n const { as, target, ...rest } = props as TableOfContentsTriggerProps<\"button\">;\n return createElement(as ?? \"button\", {\n ...rest,\n ...createAnchorTriggerProps(anchorFor(target)),\n \"data-part\": \"trigger\",\n type: \"button\",\n popoverTarget: target,\n popoverTargetAction: \"toggle\",\n });\n}\nexport function TableOfContentsRail<TAs extends ElementType = \"span\">(\n props: TableOfContentsRailProps<TAs>,\n): ReactElement | null {\n const { as, render, ...rest } = props as TableOfContentsRailProps<\"span\">;\n return useRenderElement({\n as,\n render,\n defaultTag: \"span\",\n props: { ...rest, \"aria-hidden\": true, \"data-part\": \"rail\" },\n state: {},\n });\n}\nexport function TableOfContentsIndicator<TAs extends ElementType = \"span\">(\n props: TableOfContentsIndicatorProps<TAs>,\n): ReactElement | null {\n const {\n as,\n render,\n value: _value,\n level = 2,\n selected = false,\n style,\n ...rest\n } = props as TableOfContentsIndicatorProps<\"span\">;\n return useRenderElement({\n as,\n render,\n defaultTag: \"span\",\n props: {\n ...rest,\n style: { ...style, \"--uiify-toc-level\": level } as CSSProperties,\n \"aria-hidden\": true,\n \"data-part\": \"indicator\",\n \"data-selected\": selected ? \"\" : undefined,\n },\n state: { selected },\n });\n}\nexport function TableOfContentsContent<TAs extends ElementType = \"div\">(\n props: TableOfContentsContentProps<TAs>,\n): ReactElement | null {\n const {\n as,\n render,\n side = \"left\",\n align = \"start\",\n id,\n ...rest\n } = props as TableOfContentsContentProps<\"div\">;\n return useRenderElement({\n as,\n render,\n defaultTag: \"div\",\n props: {\n ...rest,\n ...createAnchorPositionerProps({ anchorName: anchorFor(id), side, align }),\n id,\n popover: \"auto\",\n \"data-part\": \"content\",\n },\n state: {},\n });\n}\nexport function TableOfContentsList<TAs extends ElementType = \"div\">(\n props: TableOfContentsListProps<TAs>,\n): ReactElement | null {\n const { as, render, ...rest } = props as TableOfContentsListProps<\"div\">;\n return useRenderElement({\n as,\n render,\n defaultTag: \"div\",\n props: { ...rest, \"data-part\": \"list\" },\n state: {},\n });\n}\nexport function TableOfContentsLink<TAs extends ElementType = \"a\">(\n props: TableOfContentsLinkProps<TAs>,\n): ReactElement | null {\n const {\n as,\n render,\n level = 2,\n selected,\n style,\n ...rest\n } = props as TableOfContentsLinkProps<\"a\">;\n const current = selected ?? rest[\"aria-current\"] === \"location\";\n return useRenderElement({\n as,\n render,\n defaultTag: \"a\",\n props: {\n ...rest,\n style: { ...style, \"--uiify-toc-level\": level } as CSSProperties,\n \"data-part\": \"link\",\n \"data-selected\": current ? \"\" : undefined,\n ...(selected === undefined ? {} : { \"aria-current\": selected ? \"location\" : undefined }),\n },\n state: { selected: current },\n });\n}\n\nexport const TableOfContents = {\n Root: TableOfContentsRoot,\n Trigger: TableOfContentsTrigger,\n Rail: TableOfContentsRail,\n Indicator: TableOfContentsIndicator,\n Content: TableOfContentsContent,\n List: TableOfContentsList,\n Link: TableOfContentsLink,\n};\n\nTableOfContentsTrigger.displayName = \"TableOfContentsTrigger\";\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ElementType, ReactElement } from "react";
|
|
2
|
+
import { TableOfContentsRail as NativeRail, TableOfContentsList as NativeList } from "../TableOfContents.js";
|
|
3
|
+
import { TableOfContentsClientTrigger, TableOfContentsClientContent, TableOfContentsClientLink, TableOfContentsClientIndicator } from "./TableOfContentsClientParts.js";
|
|
4
|
+
import type { TableOfContentsClientRootProps } from "../types.js";
|
|
5
|
+
export declare function TableOfContentsClientRoot<TAs extends ElementType = "nav">(props: TableOfContentsClientRootProps<TAs>): ReactElement;
|
|
6
|
+
export declare namespace TableOfContentsClientRoot {
|
|
7
|
+
var displayName: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const TableOfContents: {
|
|
10
|
+
Root: typeof TableOfContentsClientRoot;
|
|
11
|
+
Trigger: typeof TableOfContentsClientTrigger;
|
|
12
|
+
Rail: typeof NativeRail;
|
|
13
|
+
Content: typeof TableOfContentsClientContent;
|
|
14
|
+
List: typeof NativeList;
|
|
15
|
+
Link: typeof TableOfContentsClientLink;
|
|
16
|
+
Indicator: typeof TableOfContentsClientIndicator;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=TableOfContentsClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableOfContentsClient.d.ts","sourceRoot":"","sources":["../../../../src/components/table-of-contents/client/TableOfContentsClient.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAiC,MAAM,OAAO,CAAC;AAMtF,OAAO,EACL,mBAAmB,IAAI,UAAU,EACjC,mBAAmB,IAAI,UAAU,EAClC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC5B,yBAAyB,EACzB,8BAA8B,EAC/B,MAAM,iCAAiC,CAAC;AAIzC,OAAO,KAAK,EAAE,8BAA8B,EAA+B,MAAM,aAAa,CAAC;AAE/F,wBAAgB,yBAAyB,CAAC,GAAG,SAAS,WAAW,GAAG,KAAK,EACvE,KAAK,EAAE,8BAA8B,CAAC,GAAG,CAAC,GACzC,YAAY,CA4Gd;yBA9Ge,yBAAyB;;;AA+GzC,eAAO,MAAM,eAAe;;;;;;;;CAQ3B,CAAC"}
|