@spunto/design-system 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spunto/design-system",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Spunto's shared design system — warm/flame tokens, color constants, and UI primitives.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -110,6 +110,18 @@ const Terminal = forwardRef<TerminalHandle, TerminalProps>(function Terminal(
110
110
  async function init() {
111
111
  const { Terminal: XTermCtor } = await import("@xterm/xterm")
112
112
  const { FitAddon } = await import("@xterm/addon-fit")
113
+ // xterm measures glyph/cell width once, at construction, using whatever
114
+ // font is *actually available* right then. The design system's styles.css
115
+ // declares JetBrains Mono via @font-face (and apps preload it), but a
116
+ // @font-face only downloads lazily on first use — so the terminal can
117
+ // still mount before the file has arrived, measure with a fallback font,
118
+ // then paint JetBrains Mono into cells sized for that fallback once it
119
+ // loads ("same font family, wrong spacing"). Awaiting the load closes
120
+ // that race regardless of how/whether the host app preloads.
121
+ await Promise.all([
122
+ document.fonts.load(`400 ${fontSize}px "JetBrains Mono"`),
123
+ document.fonts.load(`500 ${fontSize}px "JetBrains Mono"`),
124
+ ]).catch(() => {})
113
125
  if (disposed || !mountRef.current) return
114
126
 
115
127
  const term = new XTermCtor({
@@ -118,7 +130,7 @@ const Terminal = forwardRef<TerminalHandle, TerminalProps>(function Terminal(
118
130
  cursorStyle: "block",
119
131
  fontFamily: '"JetBrains Mono", "Fira Code", "Cascadia Code", monospace',
120
132
  fontSize,
121
- lineHeight: 1.4,
133
+ lineHeight: 1.2,
122
134
  scrollback,
123
135
  theme: terminalTheme,
124
136
  })