Repository navigation
docs(useTruncation): add hook docs and a live example - #10744
qq2514568380 wants to merge 1 commit into
Conversation
Document useTruncation with a HookDoc, and add a Table example that shows a Tooltip only when the hook reports the text is cut off. One column clamps to two lines so the multi-line path is covered. Refresh the reviewed ShadCN route lock for the new hook page and example. Refs meta#9561
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Hi @qq2514568380! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
AI review status for this pull request.
|
|
Closing as a duplicate of #10555, which was opened earlier for the same issue. |
daa13ff to
d34c08c
Compare
|
(Posted by Cindy's agent.) Welcome, @qq2514568380, and thank you for your first contribution to Astryx! Spotting that #10555 already covered |
Reader impact
useTruncationis a public hook with no docsite page and no runnable example, so a developer who needs truncation detection on their own clipped element has nothing to open. After this change the hook has a page that states what it measures and when to reach for it, plus a live Table example they can run.Source of truth
packages/core/src/Text/useTruncation.ts(UseTruncationOptions,UseTruncationReturn)architecture:knowledge-contractsINV28 — every public hook has a minimal, runnable example that names it inexampleForpackages/core/src/hooks/useClipboard.doc.mjsandpackages/core/src/hooks/useStreamingText.doc.mjsfor the HookDoc shapepackages/cli/assets/templates/blocks/components/Text/TextTruncation.doc.mjsfor the block descriptor shapeCorrection
The hook had no HookDoc, so it had no docsite page. It also had no block naming it in
exampleFor, so its Examples section was empty. This adds:packages/core/src/Text/useTruncation.doc.mjs— usage, params, returns, import path (@astryxdesign/core/Text) and best practices, including when to preferText/HeadingmaxLinesinstead.packages/cli/assets/templates/blocks/components/Text/useTruncationHookUsage.tsxand.doc.mjs— a narrow Table column of long file paths. Each cell calls the hook; the Tooltip renders only whileisTruncatedis true. A short path and a roomy Owner column show no tooltip, and the Details column clamps to two lines to cover the multi-line path.No runtime or API change: the hook source and its exports are untouched.
Evidence
pnpm -F @astryxdesign/docsite build— passed (Next build, template gallery and function-size checks passed).pnpm -F @astryxdesign/docsite exec vitest run src/__tests__/example-coverage.test.ts— 5 passed;useTruncationno longer appears in the "no hook doc" or "no example block" lists.pnpm check:knowledge— passed.pnpm check:sync— passed.pnpm build— passed.Two pre-existing docsite tests fail in this snapshot for reasons unrelated to this change:
data-extraction.test.tsfinds nodashboard*templates, andtemplate-preview-coverage.test.tsreportsincident-console,messaging-shell, andtheme-showcasemissing preview components. Both fail on the same files with or without this change.Scope
internal/shadcn-registry/routes.lock.json.The route-lock refresh also records
template-blank, which the current generator emits but the lock onmaindid not contain. I kept it because the lock is generated and checked as a whole; it is not related touseTruncation.Testing
Closes #9561