feat(registry): add Pretext batch release#23
Merged
Conversation
Add @chenglou/pretext as a dependency and create the shared pretext registry lib item with React hooks: - usePretext / usePretextWithSegments — prepare text once, cache handle - usePretextLayout — pure-arithmetic layout on every resize - usePretextLines — full line data for custom rendering - useShrinkwrap — binary-search tightest width for same line count - useBalancedWidth — find width where lines are roughly equal
Pretext-powered message bubbles that find the tightest width for the same line count — eliminates the dead space CSS fit-content leaves. - ChatBubble — single message with sent/received variants - ChatThread — vertical message list with timestamps - Shrinkwrap comparison demo (CSS vs Pretext side-by-side) - Client-only rendering (Pretext needs Canvas for measurement) - MDX docs page, card preview, sidebar nav entry
Drop-in text wrapper that balances line widths using Pretext's walkLineRanges binary search. Deterministic, works on any length, and more consistent than CSS text-wrap: balance. - BalancedText — polymorphic element with font/maxWidth props - Side-by-side demo (unbalanced vs balanced for headings and body) - MDX docs page, card preview, sidebar nav entry
Filter out internal lib items like 'pretext' from the DependencyBadges display. These are installed automatically as transitive deps — showing both 'pretext' and '@chenglou/pretext' was redundant and confusing.
…ranges Paragraph text with highlighted ranges that wrap correctly across line breaks. Pretext measures exact character positions per line so highlight backgrounds sit perfectly — no DOM measurement. - TextHighlight — renders text with colored highlight ranges - Supports labels, multiple colors, and multi-line wrapping - MDX docs page, card preview, sidebar nav entry
- Ship pretext hooks as a public documented registry item with interactive demo (slider showing live line count / shrinkwrap / balanced) - Add masonry-grid component with Pretext height prediction - Make all Pretext hooks SSR-safe (return null during server render, lazy-require @chenglou/pretext only in browser) - Update balanced-text and chat-bubble for nullable hook returns - MDX docs pages, card previews, sidebar nav entries for both
…t components - Add PretextTestimonialMasonry — masonry testimonial layout with Pretext height prediction, wraps existing TestimonialCard - Rename all Pretext component titles to 'Pretext <Name>' pattern across registry.json, MDX frontmatter, and sidebar nav - Separate component avoids adding @chenglou/pretext as a dep to the existing testimonial item
Drop Pretext dependency from text-highlight — inline <mark> elements wrap correctly across line breaks natively. No JS measurement needed. - Server-compatible (works in RSC and SSR) - Simpler implementation, zero dependencies - Fixes misaligned highlights caused by Pretext whitespace normalization - Remove unused font/lineHeight/maxWidth props
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a focused Pretext batch to jalco-ui built around Cheng Lou's
@chenglou/pretext.New registry items
pretext— public hooks for DOM-free text measurementchat-bubble— Pretext shrinkwrap message bubblesbalanced-text— deterministic balanced line widthsmasonry-grid— text-aware masonry with height predictionAlso included
2026.04.0release entry: PretextWhy
I wanted jalco-ui to lean into developer-facing, technically interesting UI primitives instead of generic library filler. Pretext felt like the perfect fit — it unlocks text-layout behaviors that are hard or impossible to do cleanly with normal DOM measurement.
Verified
pnpm previews:generatepnpm registry:buildpnpm buildNotes
I originally explored a couple of extra experiments (
text-highlight,pretext-testimonial) during the branch and removed them before landing because they didn’t clear the quality bar.