Public: anyone can read this; the crew can change it.

`.break` and `.tok`'s nowrap are base.ts text utilities, and neither stays in content.ts #4786

opened this

Merged 40d 16h ago, live in production

.break and .nowrap are now text utilities in base.ts, and content.ts no longer has .break or .tok. src/web/style/base.ts: gains .nowrap { white-space: nowrap; } and .break { overflow-wrap: anywhere; }, both beside .truncate. The 30 or so pages that use .break are unchanged.

Notes

opened this

.break and .nowrap are now text utilities in base.ts, and content.ts no longer has .break or .tok.

  • src/web/style/base.ts: gains .nowrap { white-space: nowrap; } and .break { overflow-wrap: anywhere; }, both beside .truncate. The 30 or so pages that use .break are unchanged. It now sits in @layer utilities instead of content's layer, which only changes anything where another rule also sets overflow-wrap.
  • src/web/style/content.ts: the .break and .tok rules are removed.
  • src/web/ui.ts: tokenCount() draws class="num nowrap" instead of class="tok", so counts also pick up tabular figures from .num.
  • docs/DESIGN.md §5d: .break and .nowrap are listed under base.ts, and .break and .tok are no longer listed under content.ts.
  • test/tokens.test.ts: a new "the markup" suite checks that tokenCount's markup is class="num nowrap" and never class="tok", that the stylesheet has no .tok rule, and that it defines .break and .nowrap once each. This file is outside the ones the issue names, but it had to change: three existing page assertions matched the old <span class="tok" markup, so those tests were wrong rather than the code, and they now match the new class.

bun scripts/design-lint.ts reported nothing added outside the system, and no lint counts fell, so docs/design/baseline.json is unchanged. bun test passes for test/tokens.test.ts, test/design-lint.test.ts and test/web-ui.test.ts, and bun x tsc --noEmit is clean.

To try it, open any file in the preview: the ~N tok after the byte size should still stay on one line.

🤖 Generated with Claude Code

Closes #4747

2 earlier comments
commented

.break and .nowrap are now text utilities in base.ts, and content.ts no longer has .break or .tok.

  • src/web/style/base.ts: gains .nowrap { white-space: nowrap; } and .break { overflow-wrap: anywhere; }, both beside .truncate. The 30 or so pages that use .break are unchanged. It now sits in @layer utilities instead of content's layer, which only changes anything where another rule also sets overflow-wrap.
  • src/web/style/content.ts: the .break and .tok rules are removed.
  • src/web/ui.ts: tokenCount() draws class="num nowrap" instead of class="tok", so counts also pick up tabular figures from .num.
  • docs/DESIGN.md §5d: .break and .nowrap are listed under base.ts, and .break and .tok are no longer listed under content.ts.
  • test/tokens.test.ts: a new "the markup" suite checks that tokenCount's markup is class="num nowrap" and never class="tok", that the stylesheet has no .tok rule, and that it defines .break and .nowrap once each. This file is outside the ones the issue names, but it had to change: three existing page assertions matched the old <span class="tok" markup, so those tests were wrong rather than the code, and they now match the new class.

bun scripts/design-lint.ts reported nothing added outside the system, and no lint counts fell, so docs/design/baseline.json is unchanged. bun test passes for test/tokens.test.ts, test/design-lint.test.ts and test/web-ui.test.ts, and bun x tsc --noEmit is clean.

To try it, open any file in the preview: the ~N tok after the byte size should still stay on one line.

🤖 Generated with Claude Code

commented

.break and .nowrap are now text utilities in base.ts, and content.ts no longer has .break or .tok. This branch has main merged in.

  • src/web/style/base.ts: gains .nowrap { white-space: nowrap; } and .break { overflow-wrap: anywhere; }, both beside .truncate. The pages that use .break are unchanged. It now sits in @layer utilities instead of content's layer, which only changes anything where another rule also sets overflow-wrap.
  • src/web/style/content.ts: the .break and .tok rules are removed.
  • src/web/ui.ts: tokenCount() draws class="num nowrap" instead of class="tok", so counts also pick up tabular figures from .num.
  • docs/DESIGN.md §5d: .break and .nowrap are listed under base.ts, and .break and .tok are no longer listed under content.ts.
  • Merge conflict: the only conflict was content.ts's class list in §5d. The resolution keeps main's removal of .mirror-form, .origin-mark, .origin-name and .origin-row, and this branch's removal of .break and .tok.
  • test/tokens.test.ts: a new "the markup" suite checks that tokenCount's markup is class="num nowrap" and never class="tok", that the stylesheet has no .tok rule, and that it defines .break and .nowrap once each. This file is outside the ones the issue names, but it had to change: three existing page assertions matched the old <span class="tok" markup, so those tests were wrong rather than the code, and they now match the new class.

After the merge, the tests in test/tokens.test.ts, test/design-lint.test.ts and test/web-ui.test.ts pass, and bun x tsc --noEmit is clean. bun scripts/design-lint.ts reported nothing added outside the system and no lint counts fell, so docs/design/baseline.json is unchanged.

To try it, open any file in the preview: the ~N tok after the byte size should still stay on one line.

🤖 Generated with Claude Code

commented

.break and .nowrap are now text utilities in base.ts, and content.ts no longer has .break or .tok. This branch has the latest main merged in.

  • src/web/style/base.ts: gains .nowrap { white-space: nowrap; } and .break { overflow-wrap: anywhere; }, both beside .truncate. The pages that use .break are unchanged. It now sits in @layer utilities instead of content's layer, which only changes anything where another rule also sets overflow-wrap.
  • src/web/style/content.ts: the .break and .tok rules are removed.
  • src/web/ui.ts: tokenCount() draws class="num nowrap" instead of class="tok", so counts also pick up tabular figures from .num.
  • docs/DESIGN.md §5d: .break and .nowrap are listed under base.ts, and .break and .tok are no longer listed under content.ts.
  • Merge conflicts: both merges with main conflicted only on content.ts's class list in §5d. The resolution keeps main's removals (.mirror-form, the three .origin-* classes, and now .sys-pair) as well as this branch's removal of .break and .tok.
  • test/tokens.test.ts: a new "the markup" suite checks that tokenCount's markup is class="num nowrap" and never class="tok", that the stylesheet has no .tok rule, and that it defines .break and .nowrap once each. This file is outside the ones the issue names, but it had to change: three existing page assertions matched the old <span class="tok" markup, so those tests were wrong rather than the code, and they now match the new class.

After this merge, the tests in test/tokens.test.ts, test/design-lint.test.ts and test/web-ui.test.ts pass, and bun x tsc --noEmit is clean. bun scripts/design-lint.ts reported nothing added outside the system and no lint counts fell, so docs/design/baseline.json is unchanged.

To try it, open any file in the preview: the ~N tok after the byte size should still stay on one line.

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs