@opendata-ai/openchart-core 6.19.1 → 6.19.3
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
|
@@ -104,7 +104,7 @@ describe('computeChrome', () => {
|
|
|
104
104
|
const chrome: Chrome = { title: 'Title' };
|
|
105
105
|
const result = computeChrome(chrome, theme, 600);
|
|
106
106
|
|
|
107
|
-
const expectedMaxWidth = 600 - theme.spacing.padding * 2;
|
|
107
|
+
const expectedMaxWidth = 600 - theme.spacing.padding * 2 - 5;
|
|
108
108
|
expect(result.title!.maxWidth).toBe(expectedMaxWidth);
|
|
109
109
|
});
|
|
110
110
|
|
package/src/layout/chrome.ts
CHANGED
|
@@ -182,7 +182,10 @@ export function computeChrome(
|
|
|
182
182
|
|
|
183
183
|
const pad = padding ?? theme.spacing.padding;
|
|
184
184
|
const chromeGap = theme.spacing.chromeGap;
|
|
185
|
-
|
|
185
|
+
// Subtract a small buffer beyond padding so the heuristic char-width
|
|
186
|
+
// estimate triggers word-wrap before the real font overflows the container.
|
|
187
|
+
const WRAP_SAFETY_BUFFER = 5;
|
|
188
|
+
const maxWidth = width - pad * 2 - WRAP_SAFETY_BUFFER;
|
|
186
189
|
const fontFamily = theme.fonts.family;
|
|
187
190
|
|
|
188
191
|
// Track vertical cursor for top elements
|