@opendata-ai/openchart-core 8.4.0 → 8.5.0

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/dist/index.d.ts CHANGED
@@ -7,7 +7,8 @@
7
7
  * - full: > 700px (desktop, full-width)
8
8
  *
9
9
  * Height classes:
10
- * - cramped: < 200px (dashboard widgets, thumbnails)
10
+ * - minimal: < 100px (sparklines, chrome-less thumbnails)
11
+ * - cramped: 100-199px (dashboard widgets with a compact title)
11
12
  * - short: 200-350px (embedded panels, short containers)
12
13
  * - normal: > 350px (standard containers)
13
14
  */
@@ -21,8 +22,9 @@ declare const BREAKPOINT_MEDIUM_MAX = 700;
21
22
  */
22
23
  declare function getBreakpoint(width: number): Breakpoint;
23
24
  /** Height classification based on container height. */
24
- type HeightClass = 'cramped' | 'short' | 'normal';
25
+ type HeightClass = 'minimal' | 'cramped' | 'short' | 'normal';
25
26
  /** Height class thresholds in pixels. */
27
+ declare const HEIGHT_MINIMAL_MAX = 100;
26
28
  declare const HEIGHT_CRAMPED_MAX = 200;
27
29
  declare const HEIGHT_SHORT_MAX = 350;
28
30
  /**
@@ -1155,6 +1157,12 @@ interface CategoricalLegendLayout extends BaseLegendLayout {
1155
1157
  entryPositions?: LegendEntryPosition[];
1156
1158
  /** Row advance used to build entryPositions (single source of truth). */
1157
1159
  rowHeight?: number;
1160
+ /**
1161
+ * Detached "no data" swatch, drawn after the last entry. Only maps set it,
1162
+ * and only when the geography actually has unjoined features -- their hatch
1163
+ * needs a key like every other fill on the map.
1164
+ */
1165
+ noData?: ContinuousLegendNoData;
1158
1166
  }
1159
1167
  /** A color stop in a gradient legend. */
1160
1168
  interface GradientColorStop {
@@ -1245,6 +1253,11 @@ interface ContinuousLegendNoData {
1245
1253
  size: number;
1246
1254
  /** Swatch fill (the same neutral the unmatched features carry). */
1247
1255
  fill: string;
1256
+ /**
1257
+ * Hatch fill matching the no-data features on a map. When present the
1258
+ * renderer resolves it to a `url(#pattern)` and ignores `fill`.
1259
+ */
1260
+ pattern?: ResolvedFillPattern;
1248
1261
  /** Label text, e.g. "No data". */
1249
1262
  label: string;
1250
1263
  /** Label x (pixel coordinates); baseline y is the legend's `labelY`. */
@@ -2186,6 +2199,16 @@ interface GeoMapFeatureMark {
2186
2199
  * `data-bin-index` so hovering a legend swatch can dim everything else.
2187
2200
  */
2188
2201
  binIndex?: number;
2202
+ /**
2203
+ * True when a color encoding is present but the join left this feature
2204
+ * without a value. A value of exactly 0 is data, not a hole.
2205
+ */
2206
+ noData?: boolean;
2207
+ /**
2208
+ * Hatch fill for no-data features. A neutral solid is indistinguishable from
2209
+ * the middle class of a diverging ramp, so holes get a texture instead.
2210
+ */
2211
+ pattern?: ResolvedFillPattern;
2189
2212
  }
2190
2213
  /** A resolved map point mark with projected coordinates and visual properties. */
2191
2214
  interface GeoMapPointMark {
@@ -2594,6 +2617,12 @@ interface ColumnConfig {
2594
2617
  * (1 for the first column).
2595
2618
  */
2596
2619
  priority?: 1 | 2 | 3;
2620
+ /**
2621
+ * Whether the total row sums this column. Defaults to true for
2622
+ * quantitative columns with a summable cell type (text/bar/heatmap); set
2623
+ * `false` to leave the total row blank for this column instead.
2624
+ */
2625
+ total?: boolean;
2597
2626
  /** Heatmap: color the cell background based on numeric value. */
2598
2627
  heatmap?: HeatmapColumnConfig;
2599
2628
  /** Inline bar: render a proportional bar in the cell. */
@@ -4812,6 +4841,44 @@ interface GraphSpec {
4812
4841
  };
4813
4842
  /** Whether to show the OpenData watermark. Defaults to true. */
4814
4843
  watermark?: boolean;
4844
+ /**
4845
+ * Render in two or three dimensions. Defaults to `2` (the Canvas renderer).
4846
+ *
4847
+ * `3` renders with WebGL. The 3D renderer ships on its own subpath so
4848
+ * three.js never enters the default bundle, and it must be imported before
4849
+ * the graph mounts:
4850
+ *
4851
+ * ```ts
4852
+ * import '@opendata-ai/openchart-vanilla/graph-3d';
4853
+ * ```
4854
+ *
4855
+ * (Framework hosts import their own package's mirror of the subpath:
4856
+ * `@opendata-ai/openchart-react/graph-3d`,
4857
+ * `@opendata-ai/openchart-vue/graph-3d`,
4858
+ * `@opendata-ai/openchart-svelte/graph-3d`.) Mounting a `dimensions: 3` spec
4859
+ * without that import throws.
4860
+ *
4861
+ * 3D differs from 2D in these ways:
4862
+ * - Labels use a fixed budget re-ranked by camera distance, not the 2D
4863
+ * priority declutter, so distant labels drop out.
4864
+ * - The simulation runs on the main thread (no worker, no wall-clock warmup
4865
+ * budget).
4866
+ * - Keyboard navigation, SVG export, `interaction.cursorRepulsion` and
4867
+ * `interaction.springyDrag` are unsupported. Each warns and is ignored.
4868
+ * (`layout.type` of `'radial'` or `'hierarchical'` is rejected by spec
4869
+ * validation in both dimensions, so it never reaches either renderer.)
4870
+ * - `getCamera()` returns a pose rather than a zoom transform: `x`/`y` are
4871
+ * the look-at point in world units, alongside `position` and `target`. In
4872
+ * 2D they are the zoom transform's translate in pixels. `onCameraChange`
4873
+ * carries the same payload, so persisted camera state has to be keyed on
4874
+ * the dimension it came from. Both are typed `GraphCamera` (vanilla), whose
4875
+ * `position`/`target` are optional because only 3D sets them.
4876
+ * - A structural `update()` reheats the whole layout globally, so settled
4877
+ * nodes drift; 2D applies a local impulse instead.
4878
+ * - Above 2000 nodes the spec warns and falls back to 2D.
4879
+ * - `nodeOverrides[*].stroke` and `strokeWidth` are ignored (no ring).
4880
+ */
4881
+ dimensions?: 2 | 3;
4815
4882
  }
4816
4883
  /**
4817
4884
  * Resolution strategy for shared resources across layers.
@@ -6100,8 +6167,13 @@ declare function footnoteBandHeight(count: number, theme: ResolvedTheme): number
6100
6167
  * are shifted down by this amount so the chrome stacks BELOW the legend
6101
6168
  * rather than colliding with it. The returned `bottomHeight` includes this
6102
6169
  * reservation, so callers should not double-reserve it in margin math.
6170
+ * @param crampedTitle - Shrinks the default (non-explicit) title font size by
6171
+ * `CRAMPED_TITLE_SCALE` on top of the width-based scaling. Set by callers for the
6172
+ * 100-199px cramped height range: at that height a full-size compact title
6173
+ * can push `chrome.topHeight` past the min-chart-height guardrail, which
6174
+ * would strip the title back out via the hidden-chrome fallback.
6103
6175
  */
6104
- declare function computeChrome(chrome: Chrome | undefined, theme: ResolvedTheme, width: number, measureText?: MeasureTextFn, chromeMode?: ChromeMode, padding?: number, watermark?: boolean, bottomLegendHeight?: number): ResolvedChrome;
6176
+ declare function computeChrome(chrome: Chrome | undefined, theme: ResolvedTheme, width: number, measureText?: MeasureTextFn, chromeMode?: ChromeMode, padding?: number, watermark?: boolean, bottomLegendHeight?: number, crampedTitle?: boolean): ResolvedChrome;
6105
6177
 
6106
6178
  /**
6107
6179
  * Text measurement for environments without a DOM.
@@ -6775,4 +6847,4 @@ declare const CSS_TOKEN_ROOT_SELECTORS: readonly string[];
6775
6847
  declare const CSS_TOKENS: readonly CssTokenDef[];
6776
6848
  declare function cssTokenDefault(name: string, mode: 'light' | 'dark'): string;
6777
6849
 
6778
- export { type A11yConfig, type A11yMetadata, ACHROMATIC_RAMP, AXIS_TITLE_GAP, AXIS_TITLE_OFFSET_COMPACT, AXIS_TITLE_OFFSET_DEFAULT, AXIS_TITLE_TRAILING_PAD, type AggregateOp, type AggregateTransform, type AnimationConfig, type AnimationEase, type AnimationPhaseConfig, type AnimationSpec, type AnimationStagger, type Annotation, type AnnotationAnchor, type AnnotationFootnote, type AnnotationOffset, type AnnotationPosition, type ArcEncoding, type ArcMark, type AreaEncoding, type AreaMark, type AxisConfig, type AxisLabelDensity, type AxisLayout, type AxisTick, BRAND_FONT_SIZE, BRAND_MIN_WIDTH, BRAND_RESERVE_WIDTH, BREAKPOINT_COMPACT_MAX, BREAKPOINT_MEDIUM_MAX, type BarColumnConfig, type BarEncoding, type BarListEncoding, type BarListLayout, type BarListRowMark, type BarListSpec, type BarListSpecWithoutData, type BarTableCell, type BaseLegendLayout, type BeeswarmEncoding, type BinParams, type BinTransform, type Breakpoint, CATEGORICAL_EXTENDED_PALETTE, CATEGORICAL_FILL_PALETTE, CATEGORICAL_FILL_PALETTE_DARK, CATEGORICAL_PALETTE, CATEGORICAL_PALETTE_DARK, COMPACT_MAX_X_TICKS, COMPACT_WIDTH, CSS_TOKENS, CSS_TOKEN_ROOT_SELECTORS, type CalculateExpression, type CalculateTransform, type CalendarEncoding, type CategoricalLegendLayout, type CategoricalPalette, type CategoryColorsConfig, type CategoryTableCell, type CellStyle, type ChannelRule, type ChartBuilderOptions, type ChartEventHandlers, type ChartLayout, type ChartSpec, type ChartSpecOverride, type ChartSpecWithoutData, type Chrome, type ChromeDefaults, type ChromeEconomy, type ChromeKey, type ChromeMode, type ChromeText, type ChromeTextStyle, type ChromeThemeOverride, type CircleEncoding, type ColorBlindnessType, type ColumnConfig, type CompileOptions, type CompileTableOptions, type CompileWarning, type Condition, type ConditionalValueDef, type ConnectorConfig, type ConnectorType, type ContinuousLegendBin, type ContinuousLegendLayout, type ContinuousLegendTick, type CssTokenDef, DEFAULT_THEME, DIVERGING_PALETTES, type DarkMode, type DataRow, type DateGranularity, type DeltaColumnConfig, type DeltaTableCell, type Display, type DivergingPalette, EXTENDED_OFFSET_STRATEGIES, type ElementEdit, type ElementRef, type Encoding, type EncodingChannel, type EncodingRule, type EndpointLabelContent, type EndpointLabelEntry, type EndpointLabelsConfig, type EndpointLabelsLayout, FOOTNOTE_LINE_HEIGHT, type FacetChannel, type FacetLayout, type FacetPanelLayout, type FieldFormatContext, type FieldPredicate, type FieldRef, type FieldType, type FillPatternType, type FilterPredicate, type FilterTransform, type FlagTableCell, type FoldTransform, GRAPH_ENCODING_RULES, type GeoMapBorders, type GeoMapEncoding, type GeoMapFeatureMark, type GeoMapFocus, type GeoMapFocusLayout, type GeoMapGeo, type GeoMapLayout, type GeoMapPointMark, type GeoMapPointsLayer, type GeoMapProjection, type GeoMapSpec, type GeoMapSpecWithoutData, type GradientColorStop, type GradientDef, type GradientLegendLayout, type GradientStop, type GraphAnimationConfig, type GraphAnimationSpec, type GraphChannelRule, type GraphEdge, type GraphEdgeLayout, type GraphEncoding, type GraphEncodingChannel, type GraphInteractionConfig, type GraphLayout, type GraphLayoutConfig, type GraphNode, type GraphNodeLayout, type GraphSpec, type GraphSpecWithoutData, type Gridline, HEIGHT_CRAMPED_MAX, HEIGHT_NO_GRID_MAX, HEIGHT_SHORT_MAX, HPAD_COMPACT_FRACTION, HPAD_COMPACT_MIN, type HeatmapColumnConfig, type HeatmapTableCell, type HeightClass, type ImageColumnConfig, type ImageTableCell, LABEL_GAP_COMPACT, LABEL_GAP_DEFAULT, LABEL_GAP_NARROW_MAX, type LabelCandidate, type LabelConfig, type LabelDensity, type LabelMode, type LabelPriority, type LabelSpec, type LayerSpec, type LayoutStrategy, type LegendChannel, type LegendConfig, type LegendEntry, type LegendEntryPosition, type LegendLayout, type LegendPosition, type LineEncoding, type LineMark, type LinearGradient, type LogicalAnd, type LogicalNot, type LogicalOr, type LollipopEncoding, MARK_DISPLAY_NAMES, MARK_ENCODING_RULES, MARK_TYPES, MAX_LEFT_LABEL_FRACTION_COMPACT, MAX_LEFT_LABEL_FRACTION_DEFAULT, MAX_LEFT_LABEL_FRACTION_MEDIUM, MAX_LEFT_LABEL_FRACTION_MEDIUM_MAX, MAX_SR_TABLE_ROWS, type Margins, type Mark, type MarkAria, type MarkDef, type MarkEvent, type MarkType, type MeasureTextFn, type Metric, NARROW_VIEWPORT_MAX, type NeutralRamp, type NodeOverride, type NumberFormatter, OFFSET_STRATEGIES, type OffsetStrategy, type PaginationState, type ParliamentEncoding, type Point, type PointEncoding, type PointMark, type RadialGradient, type RangeAnnotation, type RangeEncoding, type Rect, type RectEncoding, type RectMark, type RefLineAnnotation, type RelativeTimeRef, type ResolveConfig, type ResolveMode, type ResolvedAnimation, type ResolvedAnimationPhase, type ResolvedAnnotation, type ResolvedChrome, type ResolvedChromeElement, type ResolvedChromeRule, type ResolvedColumn, type ResolvedFillPattern, type ResolvedLabel, type ResolvedMetricBar, type ResolvedMetricCell, type ResolvedSeriesSearch, type ResolvedTheme, type ResolvedThemeColors, type ResolvedYouDrawIt, type ResponsiveConfig, type RuleMarkLayout, SEQUENTIAL_PALETTES, SUPPORTED_SCHEME_NAMES, type SankeyEncoding, type SankeyLayout, type SankeyLinkColor, type SankeyLinkMark, type SankeyNodeAlign, type SankeyNodeMark, type SankeySpec, type SankeySpecWithoutData, type ScaleConfig, type ScaleInvert, type ScaleType, type SequentialPalette, type SeriesSearchConfig, type SeriesStrategy, type SeriesStyle, type SizeLegendCircle, type SizeLegendLayout, type SortByField, type SortState, type SparklineColumnConfig, type SparklineData, type SparklineTableCell, type StoredVizSpec, TICK_LABEL_OFFSET, TICK_LINE_HEIGHT_FACTOR, TOP_PAD_EXTRA_NARROW, TOP_PAD_NARROW_MAX, type TableBuilderOptions, type TableCell, type TableCellBase, type TableDensity, type TableLayout, type TableRow, type TableSpec, type TableSpecWithoutData, type TableTotalRow, type TextAnnotation, type TextEncoding, type TextMarkLayout, type TextStyle, type TextTableCell, type Theme, type ThemeChromeDefaults, type ThemeColors, type ThemeConfig, type ThemeFontSizes, type ThemeFontWeights, type ThemeFonts, type ThemeRule, type ThemeSpacing, type TickEncoding, type TickMarkLayout, type TileMapBuilderOptions, type TileMapEncoding, type TileMapLayout, type TileMapPalette, type TileMapSpec, type TileMapSpecWithoutData, type TileMapTileMark, type TimeUnit, type TimeUnitTransform, type TokenValue, type TooltipContent, type TooltipField, type Transform, type UpdatePhaseConfig, type ValueDef, type VizSpec, type WaffleEncoding, type WindowFieldDef, type WindowOp, type WindowSortField, type WindowTransform, type XAxisExtentInput, X_AXIS_BAND_HEIGHT, X_AXIS_ROTATED_EXTENT_CAP, X_AXIS_TITLE_BAND, X_AXIS_TITLE_BAND_ROTATED, type YouDrawItConfig, type YouDrawItSample, type YouDrawItYInvert, abbreviateNumber, adaptColorForDarkMode, adaptForLightLineStroke, adaptTheme, areaChart, axisTitleOffset, barChart, broadsheet, buildCompactStepFormatter, buildD3Formatter, buildTemporalFormatter, checkPaletteDistinguishability, columnChart, computeChrome, computeFieldFormatContext, computeLabelBounds, computeXAxisExtentFromLabels, contrastRatio, cssTokenDefault, dataTable, deepMergeSpec, defaultNumberFormatter, deriveNeutralRamp, detectCollision, donutChart, dotChart, editorial, elementRef, essay, estimateTextWidth, findAccessibleColor, footnoteBandHeight, formatCurrency, formatDate, formatNumber, formatOrdinal, formatPercent, generateAltText, generateAriaLabels, generateDataTable, getAxisTitleOffset, getBreakpoint, getHeightClass, getLayoutStrategy, getRepresentativeColor, heuristicMeasure, inferFieldType, isAxislessMark, isBarListSpec, isChartSpec, isConditionalDef, isEncodingChannel, isGeoMapSpec, isGradientDef, isGraphSpec, isLayerSpec, isOpaqueColor, isRangeAnnotation, isRefLineAnnotation, isSankeySpec, isTableSpec, isTextAnnotation, isTileMapSpec, isValueDef, isYearContext, lineChart, maxRotatedLabelWidth, meetsAA, overlapArea, pickLabelColor, pieChart, resolveChromeEconomy, resolveCollisions, resolveMarkDef, resolveMarkType, resolveMeasurer, resolveNumberFormatter, resolveSchemeName, resolveTheme, scatterChart, simulateColorBlindness, terminal, textAscent, tileMap, truncateRotatedLabel, truncateToWidth, wire, wrapText };
6850
+ export { type A11yConfig, type A11yMetadata, ACHROMATIC_RAMP, AXIS_TITLE_GAP, AXIS_TITLE_OFFSET_COMPACT, AXIS_TITLE_OFFSET_DEFAULT, AXIS_TITLE_TRAILING_PAD, type AggregateOp, type AggregateTransform, type AnimationConfig, type AnimationEase, type AnimationPhaseConfig, type AnimationSpec, type AnimationStagger, type Annotation, type AnnotationAnchor, type AnnotationFootnote, type AnnotationOffset, type AnnotationPosition, type ArcEncoding, type ArcMark, type AreaEncoding, type AreaMark, type AxisConfig, type AxisLabelDensity, type AxisLayout, type AxisTick, BRAND_FONT_SIZE, BRAND_MIN_WIDTH, BRAND_RESERVE_WIDTH, BREAKPOINT_COMPACT_MAX, BREAKPOINT_MEDIUM_MAX, type BarColumnConfig, type BarEncoding, type BarListEncoding, type BarListLayout, type BarListRowMark, type BarListSpec, type BarListSpecWithoutData, type BarTableCell, type BaseLegendLayout, type BeeswarmEncoding, type BinParams, type BinTransform, type Breakpoint, CATEGORICAL_EXTENDED_PALETTE, CATEGORICAL_FILL_PALETTE, CATEGORICAL_FILL_PALETTE_DARK, CATEGORICAL_PALETTE, CATEGORICAL_PALETTE_DARK, COMPACT_MAX_X_TICKS, COMPACT_WIDTH, CSS_TOKENS, CSS_TOKEN_ROOT_SELECTORS, type CalculateExpression, type CalculateTransform, type CalendarEncoding, type CategoricalLegendLayout, type CategoricalPalette, type CategoryColorsConfig, type CategoryTableCell, type CellStyle, type ChannelRule, type ChartBuilderOptions, type ChartEventHandlers, type ChartLayout, type ChartSpec, type ChartSpecOverride, type ChartSpecWithoutData, type Chrome, type ChromeDefaults, type ChromeEconomy, type ChromeKey, type ChromeMode, type ChromeText, type ChromeTextStyle, type ChromeThemeOverride, type CircleEncoding, type ColorBlindnessType, type ColumnConfig, type CompileOptions, type CompileTableOptions, type CompileWarning, type Condition, type ConditionalValueDef, type ConnectorConfig, type ConnectorType, type ContinuousLegendBin, type ContinuousLegendLayout, type ContinuousLegendTick, type CssTokenDef, DEFAULT_THEME, DIVERGING_PALETTES, type DarkMode, type DataRow, type DateGranularity, type DeltaColumnConfig, type DeltaTableCell, type Display, type DivergingPalette, EXTENDED_OFFSET_STRATEGIES, type ElementEdit, type ElementRef, type Encoding, type EncodingChannel, type EncodingRule, type EndpointLabelContent, type EndpointLabelEntry, type EndpointLabelsConfig, type EndpointLabelsLayout, FOOTNOTE_LINE_HEIGHT, type FacetChannel, type FacetLayout, type FacetPanelLayout, type FieldFormatContext, type FieldPredicate, type FieldRef, type FieldType, type FillPatternType, type FilterPredicate, type FilterTransform, type FlagTableCell, type FoldTransform, GRAPH_ENCODING_RULES, type GeoMapBorders, type GeoMapEncoding, type GeoMapFeatureMark, type GeoMapFocus, type GeoMapFocusLayout, type GeoMapGeo, type GeoMapLayout, type GeoMapPointMark, type GeoMapPointsLayer, type GeoMapProjection, type GeoMapSpec, type GeoMapSpecWithoutData, type GradientColorStop, type GradientDef, type GradientLegendLayout, type GradientStop, type GraphAnimationConfig, type GraphAnimationSpec, type GraphChannelRule, type GraphEdge, type GraphEdgeLayout, type GraphEncoding, type GraphEncodingChannel, type GraphInteractionConfig, type GraphLayout, type GraphLayoutConfig, type GraphNode, type GraphNodeLayout, type GraphSpec, type GraphSpecWithoutData, type Gridline, HEIGHT_CRAMPED_MAX, HEIGHT_MINIMAL_MAX, HEIGHT_NO_GRID_MAX, HEIGHT_SHORT_MAX, HPAD_COMPACT_FRACTION, HPAD_COMPACT_MIN, type HeatmapColumnConfig, type HeatmapTableCell, type HeightClass, type ImageColumnConfig, type ImageTableCell, LABEL_GAP_COMPACT, LABEL_GAP_DEFAULT, LABEL_GAP_NARROW_MAX, type LabelCandidate, type LabelConfig, type LabelDensity, type LabelMode, type LabelPriority, type LabelSpec, type LayerSpec, type LayoutStrategy, type LegendChannel, type LegendConfig, type LegendEntry, type LegendEntryPosition, type LegendLayout, type LegendPosition, type LineEncoding, type LineMark, type LinearGradient, type LogicalAnd, type LogicalNot, type LogicalOr, type LollipopEncoding, MARK_DISPLAY_NAMES, MARK_ENCODING_RULES, MARK_TYPES, MAX_LEFT_LABEL_FRACTION_COMPACT, MAX_LEFT_LABEL_FRACTION_DEFAULT, MAX_LEFT_LABEL_FRACTION_MEDIUM, MAX_LEFT_LABEL_FRACTION_MEDIUM_MAX, MAX_SR_TABLE_ROWS, type Margins, type Mark, type MarkAria, type MarkDef, type MarkEvent, type MarkType, type MeasureTextFn, type Metric, NARROW_VIEWPORT_MAX, type NeutralRamp, type NodeOverride, type NumberFormatter, OFFSET_STRATEGIES, type OffsetStrategy, type PaginationState, type ParliamentEncoding, type Point, type PointEncoding, type PointMark, type RadialGradient, type RangeAnnotation, type RangeEncoding, type Rect, type RectEncoding, type RectMark, type RefLineAnnotation, type RelativeTimeRef, type ResolveConfig, type ResolveMode, type ResolvedAnimation, type ResolvedAnimationPhase, type ResolvedAnnotation, type ResolvedChrome, type ResolvedChromeElement, type ResolvedChromeRule, type ResolvedColumn, type ResolvedFillPattern, type ResolvedLabel, type ResolvedMetricBar, type ResolvedMetricCell, type ResolvedSeriesSearch, type ResolvedTheme, type ResolvedThemeColors, type ResolvedYouDrawIt, type ResponsiveConfig, type RuleMarkLayout, SEQUENTIAL_PALETTES, SUPPORTED_SCHEME_NAMES, type SankeyEncoding, type SankeyLayout, type SankeyLinkColor, type SankeyLinkMark, type SankeyNodeAlign, type SankeyNodeMark, type SankeySpec, type SankeySpecWithoutData, type ScaleConfig, type ScaleInvert, type ScaleType, type SequentialPalette, type SeriesSearchConfig, type SeriesStrategy, type SeriesStyle, type SizeLegendCircle, type SizeLegendLayout, type SortByField, type SortState, type SparklineColumnConfig, type SparklineData, type SparklineTableCell, type StoredVizSpec, TICK_LABEL_OFFSET, TICK_LINE_HEIGHT_FACTOR, TOP_PAD_EXTRA_NARROW, TOP_PAD_NARROW_MAX, type TableBuilderOptions, type TableCell, type TableCellBase, type TableDensity, type TableLayout, type TableRow, type TableSpec, type TableSpecWithoutData, type TableTotalRow, type TextAnnotation, type TextEncoding, type TextMarkLayout, type TextStyle, type TextTableCell, type Theme, type ThemeChromeDefaults, type ThemeColors, type ThemeConfig, type ThemeFontSizes, type ThemeFontWeights, type ThemeFonts, type ThemeRule, type ThemeSpacing, type TickEncoding, type TickMarkLayout, type TileMapBuilderOptions, type TileMapEncoding, type TileMapLayout, type TileMapPalette, type TileMapSpec, type TileMapSpecWithoutData, type TileMapTileMark, type TimeUnit, type TimeUnitTransform, type TokenValue, type TooltipContent, type TooltipField, type Transform, type UpdatePhaseConfig, type ValueDef, type VizSpec, type WaffleEncoding, type WindowFieldDef, type WindowOp, type WindowSortField, type WindowTransform, type XAxisExtentInput, X_AXIS_BAND_HEIGHT, X_AXIS_ROTATED_EXTENT_CAP, X_AXIS_TITLE_BAND, X_AXIS_TITLE_BAND_ROTATED, type YouDrawItConfig, type YouDrawItSample, type YouDrawItYInvert, abbreviateNumber, adaptColorForDarkMode, adaptForLightLineStroke, adaptTheme, areaChart, axisTitleOffset, barChart, broadsheet, buildCompactStepFormatter, buildD3Formatter, buildTemporalFormatter, checkPaletteDistinguishability, columnChart, computeChrome, computeFieldFormatContext, computeLabelBounds, computeXAxisExtentFromLabels, contrastRatio, cssTokenDefault, dataTable, deepMergeSpec, defaultNumberFormatter, deriveNeutralRamp, detectCollision, donutChart, dotChart, editorial, elementRef, essay, estimateTextWidth, findAccessibleColor, footnoteBandHeight, formatCurrency, formatDate, formatNumber, formatOrdinal, formatPercent, generateAltText, generateAriaLabels, generateDataTable, getAxisTitleOffset, getBreakpoint, getHeightClass, getLayoutStrategy, getRepresentativeColor, heuristicMeasure, inferFieldType, isAxislessMark, isBarListSpec, isChartSpec, isConditionalDef, isEncodingChannel, isGeoMapSpec, isGradientDef, isGraphSpec, isLayerSpec, isOpaqueColor, isRangeAnnotation, isRefLineAnnotation, isSankeySpec, isTableSpec, isTextAnnotation, isTileMapSpec, isValueDef, isYearContext, lineChart, maxRotatedLabelWidth, meetsAA, overlapArea, pickLabelColor, pieChart, resolveChromeEconomy, resolveCollisions, resolveMarkDef, resolveMarkType, resolveMeasurer, resolveNumberFormatter, resolveSchemeName, resolveTheme, scatterChart, simulateColorBlindness, terminal, textAscent, tileMap, truncateRotatedLabel, truncateToWidth, wire, wrapText };
package/dist/index.js CHANGED
@@ -1231,9 +1231,11 @@ function getBreakpoint(width) {
1231
1231
  if (width <= BREAKPOINT_MEDIUM_MAX) return "medium";
1232
1232
  return "full";
1233
1233
  }
1234
+ var HEIGHT_MINIMAL_MAX = 100;
1234
1235
  var HEIGHT_CRAMPED_MAX = 200;
1235
1236
  var HEIGHT_SHORT_MAX = 350;
1236
1237
  function getHeightClass(height) {
1238
+ if (height < HEIGHT_MINIMAL_MAX) return "minimal";
1237
1239
  if (height < HEIGHT_CRAMPED_MAX) return "cramped";
1238
1240
  if (height <= HEIGHT_SHORT_MAX) return "short";
1239
1241
  return "normal";
@@ -1271,10 +1273,10 @@ function getWidthStrategy(breakpoint) {
1271
1273
  }
1272
1274
  function applyHeightConstraints(strategy, heightClass) {
1273
1275
  if (heightClass === "normal") return strategy;
1274
- if (heightClass === "cramped") {
1276
+ if (heightClass === "minimal" || heightClass === "cramped") {
1275
1277
  return {
1276
1278
  ...strategy,
1277
- chromeMode: "hidden",
1279
+ chromeMode: heightClass === "minimal" ? "hidden" : "compact",
1278
1280
  legendMaxHeight: 0,
1279
1281
  labelMode: "none",
1280
1282
  annotationPosition: "tooltip-only"
@@ -1974,10 +1976,11 @@ function scaleFontSize(baseFontSize, width) {
1974
1976
  const t = (width - 250) / 250;
1975
1977
  return Math.max(Math.round(baseFontSize * (0.72 + t * 0.28)), 10);
1976
1978
  }
1977
- function buildTextStyle(defaults, fontFamily, textColor, width, overrides) {
1979
+ var CRAMPED_TITLE_SCALE = 0.65;
1980
+ function buildTextStyle(defaults, fontFamily, textColor, width, overrides, extraScale = 1) {
1978
1981
  const hasExplicitSize = overrides?.fontSize !== void 0;
1979
1982
  const baseFontSize = overrides?.fontSize ?? defaults.fontSize;
1980
- const fontSize = hasExplicitSize ? baseFontSize : scaleFontSize(baseFontSize, width);
1983
+ const fontSize = hasExplicitSize ? baseFontSize : Math.max(Math.round(scaleFontSize(baseFontSize, width) * extraScale), 10);
1981
1984
  return {
1982
1985
  fontFamily: overrides?.fontFamily ?? fontFamily,
1983
1986
  fontSize,
@@ -2037,7 +2040,7 @@ function footnoteBandHeight(count, theme) {
2037
2040
  if (count <= 0) return 0;
2038
2041
  return count * theme.fonts.sizes.small * FOOTNOTE_LINE_HEIGHT + FOOTNOTE_BAND_GAP;
2039
2042
  }
2040
- function computeChrome(chrome, theme, width, measureText, chromeMode = "full", padding, watermark = true, bottomLegendHeight = 0) {
2043
+ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", padding, watermark = true, bottomLegendHeight = 0, crampedTitle = false) {
2041
2044
  if (!chrome || chromeMode === "hidden") {
2042
2045
  if (watermark && width >= BRAND_MIN_WIDTH) {
2043
2046
  const hiddenPad = padding ?? theme.spacing.padding;
@@ -2101,7 +2104,8 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
2101
2104
  fontFamily,
2102
2105
  theme.chrome.title.color,
2103
2106
  width,
2104
- titleNorm.style
2107
+ titleNorm.style,
2108
+ crampedTitle ? CRAMPED_TITLE_SCALE : 1
2105
2109
  );
2106
2110
  const maxLines = titleNorm.style?.maxLines;
2107
2111
  const lineCount = estimateLineCount(titleNorm.text, style, maxWidth, measureText, maxLines);
@@ -3070,6 +3074,7 @@ export {
3070
3074
  FOOTNOTE_LINE_HEIGHT,
3071
3075
  GRAPH_ENCODING_RULES,
3072
3076
  HEIGHT_CRAMPED_MAX,
3077
+ HEIGHT_MINIMAL_MAX,
3073
3078
  HEIGHT_NO_GRID_MAX,
3074
3079
  HEIGHT_SHORT_MAX,
3075
3080
  HPAD_COMPACT_FRACTION,