Repository navigation
docs(useOutlineFromDOM): add hook docs and an article example block - #11234
Conversation
Hook docs for `useOutlineFromDOM`, so `astryx hook useOutlineFromDOM` and `astryx search` return it, and a `useOutlineFromDOM — Article` example block: an article and an Outline built from its headings through the hook, with a button that adds a section and its linked entry.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Thanks for the useOutlineFromDOM hook doc and the article example. They describe the hook accurately and meet the hook-example requirements, but one test fixture needs updating before this can merge.
Required change
packages/cli/api/component/__fixtures__/resolutions/modules.txtline 280 still recordsOutline/Outline.doc.mjsforuseOutlineFromDOM. Now that the name opensOutline/useOutlineFromDOM.doc.mjs,packages/cli/api/component/resolution-compat.test.mjsfails. Change the line touseOutlineFromDOM useOutlineFromDOM Outline/useOutlineFromDOM.doc.mjs Outline/useOutlineFromDOM.ts, as theuseTruncationhook-doc change (#10555) did.
Optionally, the "adds a linked entry" test could also assert that the new entry links to #new-section-1. CI has not run on this commit yet: a maintainer needs to add the ci:run label so it runs.
|
/approve-spec d419b57 |
The hook name now opens its own doc, so the resolution fixture still named Outline.doc.mjs.
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Outline · Storybook | 25.2 kB (0) · 4.1 kB CSS (0) | 1,188 (0) | ✓ · ✓ · ✓ |
Package size:
- @astryxdesign/cli 4.17 MB packed (+449 B); no new dependencies
- @astryxdesign/core 7.48 MB packed (+402 B); no new dependencies
Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
|
/approve-spec 2a78033 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this commit yet, so a maintainer needs to add the ci:run label for it to run.
The useOutlineFromDOM hook doc and the article example meet the hook-example requirements, and this commit fixes both earlier points: the resolution fixture now records the hook's own doc, and the block test checks that the added entry links to #new-section-1. No changes are needed.
Claims and files checked
Claims:
- Changeset: patch releases for core and cli fit a docs-only change to both packages — verified (
.changeset/hook-doc-use-outline-from-dom.md). - Changeset:
astryx hook useOutlineFromDOMreturns the hook — verified (the CLI's hook discovery readsOutline/useOutlineFromDOM.doc.mjs). - Changeset:
astryx searchreturns the hook — verified (search lists the hook, the new block, then Outline). - Changeset: the "useOutlineFromDOM — Article" block shows an article, an Outline built from its headings through the hook, and a button that adds a section and its linked entry — verified (
useOutlineFromDOMHookUsage.tsx:19-20,:41-48,:52-58). - Description: before this change
astryx hookcannot find the hook, and it has no page or runnable example — verified (the base has no hook doc and no block that names it). - Description: after it the hook has a docs page — verified (
routes.lock.json:4305-4306; the docs preview built for this commit). - Description:
astryx hookandastryx searchreturn it — verified (as above). - Description:
astryx template useOutlineFromDOMHookUsagecopies the example — verified (the block is a template with its own same-stem doc). - Description: the hook reads
h1–h6that already have an id and text — verified (useOutlineFromDOM.ts:25-35). - Description: the hook doc sits next to the source and the block names the hook in
exampleFor— verified (useOutlineFromDOM.doc.mjs,useOutlineFromDOMHookUsage.doc.mjs:6). - Description: the article's headings are
Headingelements, the hook gives Outline its items, and Add section appends a heading that gains an entry — verified (useOutlineFromDOMHookUsage.tsx:33,:43,:52). - Description: the test links each entry to a rendered heading and adds one when the button adds a heading — verified (
use-outline-from-dom-hook-usage.test.tsx:54-66,:68-79). - Description: the scope is Outline and useOutlineFromDOM — verified (no other component changes).
- Description: documentation only, with runtime, API, visual and policy changes left out — verified (the only source change is a header comment line, and no public API changes).
- Description: no internal context in public text or artifacts — verified.
- Description: the block test runs with vitest — verified as written; CI has not run it on this commit yet.
Files:
.changeset/hook-doc-use-outline-from-dom.md— clearapps/sandbox/scripts/next-export-routes.json— clearinternal/shadcn-registry/routes.lock.json— clearpackages/cli/api/component/__fixtures__/resolutions/modules.txt— clearpackages/cli/api/template/use-outline-from-dom-hook-usage.test.tsx— clearpackages/cli/assets/templates/blocks/components/Outline/useOutlineFromDOMHookUsage.doc.mjs— clearpackages/cli/assets/templates/blocks/components/Outline/useOutlineFromDOMHookUsage.tsx— clearpackages/core/src/Outline/useOutlineFromDOM.doc.mjs— clearpackages/core/src/Outline/useOutlineFromDOM.ts— clear
Co-authored-by: popsiclelmlm <[email protected]>
|
/approve-spec d09ee76 |
There was a problem hiding this comment.
Approved pending CI: the test-node (4/5) shard stopped at its 15-minute job limit with no failing test, so a maintainer needs to re-run it before this can merge.
The useOutlineFromDOM hook doc and the article example meet the hook-example requirements, and both earlier points stay fixed: the resolution fixture records the hook's own doc, and the block test checks that the added entry links to #new-section-1. No changes are needed.
Claims and files checked
Claims:
- Changeset: patch releases for core and cli fit a docs-only change to both packages — verified (
.changeset/hook-doc-use-outline-from-dom.md). - Changeset:
astryx hook useOutlineFromDOMreturns the hook — verified (the CLI's hook discovery findsOutline/useOutlineFromDOM.doc.mjsby its file name). - Changeset:
astryx searchreturns the hook — verified (search gathers hooks through the same discovery). - Changeset: the "useOutlineFromDOM — Article" block shows an article, an Outline built from its headings through the hook, and a button that adds a section and its linked entry — verified (
useOutlineFromDOMHookUsage.tsx:19-20,:41-48,:52-58). - Description: before this change
astryx hookcannot find the hook, and it has no page or runnable example — verified (the base has no hook doc and no block that names it). - Description: after it the hook has a docs page — verified (
routes.lock.json:4305-4306; the docs build passed for this commit). - Description:
astryx hookandastryx searchreturn it — verified (as above). - Description:
astryx template useOutlineFromDOMHookUsagecopies the example — verified (the block is a template with its own same-stem doc; with a target path the command writes it). - Description: the hook reads
h1–h6that already have an id and text — verified (useOutlineFromDOM.ts:25-35). - Description: the hook doc sits next to the source and the block names the hook in
exampleFor— verified (useOutlineFromDOM.doc.mjs,useOutlineFromDOMHookUsage.doc.mjs:6). - Description: the article's headings are
Headingelements, the hook gives Outline its items, and Add section appends a heading that gains an entry — verified (useOutlineFromDOMHookUsage.tsx:33,:43,:52). - Description: the test links each entry to a rendered heading and adds one when the button adds a heading — verified (
use-outline-from-dom-hook-usage.test.tsx:55-67,:69-80; it passes in CI on this commit). - Description: the scope is Outline and useOutlineFromDOM — verified (no other component changes).
- Description: documentation only, with runtime, API, visual and policy changes left out — verified (the only source change is a header comment line, and no public API changes).
- Description: no internal context in public text or artifacts — verified.
- Description: the block test runs with vitest — verified (it passes in CI on this commit).
Files:
.changeset/hook-doc-use-outline-from-dom.md— clearapps/sandbox/scripts/next-export-routes.json— clearinternal/shadcn-registry/routes.lock.json— clearpackages/cli/api/component/__fixtures__/resolutions/modules.txt— clearpackages/cli/api/template/use-outline-from-dom-hook-usage.test.tsx— clearpackages/cli/assets/templates/blocks/components/Outline/useOutlineFromDOMHookUsage.doc.mjs— clearpackages/cli/assets/templates/blocks/components/Outline/useOutlineFromDOMHookUsage.tsx— clearpackages/core/src/Outline/useOutlineFromDOM.doc.mjs— clearpackages/core/src/Outline/useOutlineFromDOM.ts— clear
|
/approve-spec 3425c36 |
There was a problem hiding this comment.
Approved pending CI: CI has not finished on this commit because its run stopped with "CI is full", so a maintainer needs to re-run the jobs before this can merge.
The useOutlineFromDOM hook doc and the article example meet the hook-example requirements. The docs build passes with the new hook page and its example. Both earlier points stay fixed: the resolution fixture records the hook's own doc, and the block test checks that the added entry links to #new-section-1. No changes are needed.
Claims and files checked
Claims:
- Changeset: patch releases for core and cli fit a docs-only change to both packages. Verified (
.changeset/hook-doc-use-outline-from-dom.md). - Changeset:
astryx hook useOutlineFromDOMreturns the hook. Verified: the command prints its parameter, return value and best practices. - Changeset:
astryx searchreturns the hook. Verified: the results are the hook, then the new block, then Outline. - Changeset: the "useOutlineFromDOM — Article" block shows an article, an Outline built from its headings through the hook, and a button that adds a section and its linked entry. Verified (
useOutlineFromDOMHookUsage.tsx:20,:41-48,:52-58). - Description: before this change,
astryx hookcannot find the hook, and the hook has no docs page or runnable example. Verified: the base answers "No hook named", and no block names the hook. - Description: after the change, the hook has a docs page. Verified: the docs build renders the page with the example.
- Description:
astryx hookandastryx searchreturn the hook. Verified, as above. - Description:
astryx template useOutlineFromDOMHookUsagecopies the example. Verified: the command emits the block's source. - Description: the hook reads
h1–h6that already have an id and text. Verified (useOutlineFromDOM.ts:25-35). - Description: the hook doc sits next to the source, and the block names the hook in
exampleFor. Verified (useOutlineFromDOM.doc.mjs,useOutlineFromDOMHookUsage.doc.mjs:6). - Description: the article's headings are
Headingelements, the hook gives Outline its items, and Add section appends a heading that gets an entry. Verified (useOutlineFromDOMHookUsage.tsx:33,:52,:43). - Description: the test links each entry to a rendered heading and adds an entry when the button adds a heading. Verified (
use-outline-from-dom-hook-usage.test.tsx:55-80; it passes). - Description: the scope is Outline and useOutlineFromDOM. Verified: no other component changes.
- Description: the change is documentation only and names every generated artifact. Verified: both route lists match their generators.
- Description: runtime, API, visual and policy changes are left out. Verified: no public API changes, and the only source change is a header comment line.
- Description: public text and artifacts contain no internal context. Verified.
- Description: the block test runs with vitest. Verified: 2 of 2 pass.
Files:
.changeset/hook-doc-use-outline-from-dom.md: clearapps/sandbox/scripts/next-export-routes.json: clearinternal/shadcn-registry/routes.lock.json: clearpackages/cli/api/component/__fixtures__/resolutions/modules.txt: clearpackages/cli/api/template/use-outline-from-dom-hook-usage.test.tsx: clearpackages/cli/assets/templates/blocks/components/Outline/useOutlineFromDOMHookUsage.doc.mjs: clearpackages/cli/assets/templates/blocks/components/Outline/useOutlineFromDOMHookUsage.tsx: clearpackages/core/src/Outline/useOutlineFromDOM.doc.mjs: clearpackages/core/src/Outline/useOutlineFromDOM.ts: clear
Part of #11207
Reader impact
A builder cannot find
useOutlineFromDOM:astryx hookdoes not return it, and the hook has no docsite page or runnable example. After this change the hook has a page,astryx hookandastryx searchreturn it, andastryx template useOutlineFromDOMHookUsagecopies the example.Source of truth
packages/core/src/Outline/useOutlineFromDOM.tsreadsh1–h6that already have an id and text.architecture:knowledge-contractsINV28.Correction
Adds a HookDoc next to the source, and
blocks/components/Outline/useOutlineFromDOMHookUsage(exampleFor: 'useOutlineFromDOM'). The article's headings areHeadingelements. The hook givesOutlineits items. "Add section" appends a heading, and a new entry appears.Evidence
use-outline-from-dom-hook-usage.test.tsxlinks each outline entry to a rendered heading, and adds one when the button adds a heading.Scope
Components: Outline, useOutlineFromDOM
Testing
vitest run packages/cli/api/template/use-outline-from-dom-hook-usage.test.tsx