- Web Design
- Pretext.js
Pretext.js: Pure JS Text Measurement & Layout - No DOM Reflow, Zero Dependencies
はじめに
Pretext.js: High-performance JavaScript/TypeScript library for accurate text measurement without DOM reads. Blazing fast, TypeScript-native, multilingual support for virtual scrolls & chats.
Pretext.js's 概要
Pretext.js is a pure JavaScript and TypeScript-first library for fast text measurement and layout without touching the DOM. It eliminates forced synchronous reflows by using Canvas for one-time glyph measurements via prepare(), followed by instant pure arithmetic layouts with layout(). Achieving ~2ms for 1,000 blocks, it supports 12+ writing systems including CJK, Arabic, Hebrew, Thai, Hindi, and Korean. Zero runtime dependencies, real font metrics, reusable handles for multiple widths. Perfect for virtual scrolling, AI chat bubbles, multilingual feeds, and performance-critical text-heavy UIs. 14k+ GitHub stars.
Pretext.js's 特徴
Zero DOM reads after prepare()
Real font metrics via Canvas measureText()
Multilingual support for 12+ writing systems
TypeScript-first with full types
Reusable prepared handles for multiple container widths
Zero runtime dependencies
Pure arithmetic layout for instant results
Accurate line breaking and bidirectional text
Pretext.js's Q&A
Pretext.js's 価格
Free open-source library published on npm with zero runtime dependencies. No paid tiers or subscriptions mentioned.
Pretext.js's アナリティクス
ウェブサイト概要
主なパフォーマンス指標 pretextjs.dev
直帰率
0.00%
ページ / 訪問
0.00
総訪問者数
0
現地滞在時間
0m 0s
グローバルランク
#0
国別ランク
#0
トップ
国別トラフィック分布
総来場者数
過去3ヶ月の月間ビジター統計
トラフィック・ソース
トラフィック・ソースの分布