Skip to content

feat(registry): add Pretext batch release#23

Merged
jal-co merged 10 commits into
mainfrom
feat/pretext-batch
Apr 7, 2026
Merged

feat(registry): add Pretext batch release#23
jal-co merged 10 commits into
mainfrom
feat/pretext-batch

Conversation

@jal-co

@jal-co jal-co commented Apr 7, 2026

Copy link
Copy Markdown
Owner

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 measurement
  • chat-bubble — Pretext shrinkwrap message bubbles
  • balanced-text — deterministic balanced line widths
  • masonry-grid — text-aware masonry with height prediction

Also included

  • New 2026.04.0 release entry: Pretext
  • Docs pages, nav entries, previews, and screenshots for all new items
  • Dependency badge cleanup so internal registry lib deps don’t show redundantly

Why

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:generate
  • pnpm registry:build
  • pnpm build
  • Dark/light screenshots added for the new Pretext items

Notes

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.

jal-co added 9 commits April 7, 2026 12:02
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
@jal-co jal-co merged commit 393af2d into main Apr 7, 2026
2 checks passed
@jal-co jal-co deleted the feat/pretext-batch branch April 7, 2026 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant