@opendata-ai/openchart-core 8.4.0 → 8.4.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/dist/index.d.ts +38 -4
- package/dist/index.js +11 -6
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
- package/schema/table.schema.json +4 -0
- package/schema/vizspec.schema.json +4 -0
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* - full: > 700px (desktop, full-width)
|
|
8
8
|
*
|
|
9
9
|
* Height classes:
|
|
10
|
-
* -
|
|
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. */
|
|
@@ -6100,8 +6129,13 @@ declare function footnoteBandHeight(count: number, theme: ResolvedTheme): number
|
|
|
6100
6129
|
* are shifted down by this amount so the chrome stacks BELOW the legend
|
|
6101
6130
|
* rather than colliding with it. The returned `bottomHeight` includes this
|
|
6102
6131
|
* reservation, so callers should not double-reserve it in margin math.
|
|
6132
|
+
* @param crampedTitle - Shrinks the default (non-explicit) title font size by
|
|
6133
|
+
* `CRAMPED_TITLE_SCALE` on top of the width-based scaling. Set by callers for the
|
|
6134
|
+
* 100-199px cramped height range: at that height a full-size compact title
|
|
6135
|
+
* can push `chrome.topHeight` past the min-chart-height guardrail, which
|
|
6136
|
+
* would strip the title back out via the hidden-chrome fallback.
|
|
6103
6137
|
*/
|
|
6104
|
-
declare function computeChrome(chrome: Chrome | undefined, theme: ResolvedTheme, width: number, measureText?: MeasureTextFn, chromeMode?: ChromeMode, padding?: number, watermark?: boolean, bottomLegendHeight?: number): ResolvedChrome;
|
|
6138
|
+
declare function computeChrome(chrome: Chrome | undefined, theme: ResolvedTheme, width: number, measureText?: MeasureTextFn, chromeMode?: ChromeMode, padding?: number, watermark?: boolean, bottomLegendHeight?: number, crampedTitle?: boolean): ResolvedChrome;
|
|
6105
6139
|
|
|
6106
6140
|
/**
|
|
6107
6141
|
* Text measurement for environments without a DOM.
|
|
@@ -6775,4 +6809,4 @@ declare const CSS_TOKEN_ROOT_SELECTORS: readonly string[];
|
|
|
6775
6809
|
declare const CSS_TOKENS: readonly CssTokenDef[];
|
|
6776
6810
|
declare function cssTokenDefault(name: string, mode: 'light' | 'dark'): string;
|
|
6777
6811
|
|
|
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 };
|
|
6812
|
+
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
|
-
|
|
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,
|