@spunto/design-system 0.7.0 → 0.7.2

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.2",
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
  })
@@ -167,12 +179,16 @@ const Terminal = forwardRef<TerminalHandle, TerminalProps>(function Terminal(
167
179
  ref={outerRef}
168
180
  data-slot="terminal"
169
181
  className={cn(
182
+ // No border-radius by default: this is a minimal primitive, so it
183
+ // doesn't impose a corner style — square edges drop cleanly into any
184
+ // container (a panel, a card, edge-to-edge). Consumers add `rounded-*`
185
+ // via className when they want it.
170
186
  // `[contain:inline-size]` stops this box's (fit-driven, ever-changing)
171
187
  // content width from feeding back into an ancestor's shrink-to-fit
172
188
  // sizing — without it, a parent with `flex-basis: auto` re-measures
173
189
  // this element's content each time fit() grows it, which re-fires the
174
190
  // ResizeObserver below and runs away (confirmed: unbounded growth).
175
- "h-full w-full min-h-0 min-w-0 overflow-hidden rounded-lg border border-border p-2 [contain:inline-size]",
191
+ "h-full w-full min-h-0 min-w-0 overflow-hidden border border-border p-2 [contain:inline-size]",
176
192
  className
177
193
  )}
178
194
  style={{ backgroundColor: terminalTheme.background }}