@opendata-ai/openchart-core 9.7.0 → 9.8.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
@@ -326,6 +326,8 @@ interface ThemeColors {
326
326
  hairline: string;
327
327
  /** Sequential palettes keyed by name. Each is an array of color stops from light to dark. */
328
328
  sequential: Record<string, string[]>;
329
+ /** Default sequential ramp key; resolved to the first ramp when omitted or unknown. */
330
+ defaultSequential?: string;
329
331
  /** Diverging palettes keyed by name. Each is an array of color stops with a neutral midpoint. */
330
332
  diverging: Record<string, string[]>;
331
333
  /** Background color for the visualization container. */
@@ -376,6 +378,8 @@ interface ThemeColors {
376
378
  * neutral ramp derived from the theme's own text/background pair.
377
379
  */
378
380
  interface ResolvedThemeColors extends ThemeColors {
381
+ /** Key of the default sequential ramp in the merged palette record. */
382
+ defaultSequential: string;
379
383
  /** Grays derived by mixing `text` toward `background`. */
380
384
  neutral: NeutralRamp;
381
385
  }
@@ -451,7 +455,7 @@ interface ChromeDefaults {
451
455
  /** Font family override for this chrome element. */
452
456
  fontFamily?: string;
453
457
  /** Horizontal alignment of this chrome element. */
454
- textAlign?: ChromeTextAlign;
458
+ align?: ChromeAlign;
455
459
  /** Display prefix, separate from the authored text. */
456
460
  prefix?: string;
457
461
  /** Font size in pixels. */
@@ -4418,7 +4422,7 @@ type Annotation = TextAnnotation | RangeAnnotation | RefLineAnnotation;
4418
4422
  */
4419
4423
  type DarkMode = 'auto' | 'force' | 'off';
4420
4424
  /** Horizontal alignment of a chrome text element. */
4421
- type ChromeTextAlign = 'left' | 'center' | 'right';
4425
+ type ChromeAlign = 'left' | 'center' | 'right';
4422
4426
  /** Placement of a theme logo relative to the visualization. */
4423
4427
  type LogoPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
4424
4428
  /** Theme logo source, size and placement. */
@@ -4427,7 +4431,7 @@ interface ThemeLogo {
4427
4431
  src: string;
4428
4432
  /** Display height in pixels. */
4429
4433
  height: number;
4430
- /** Display width in pixels; omitted to derive it from the source aspect ratio. */
4434
+ /** Display width in pixels. When set it is used as authored (the image letterboxes inside height x width); omitted, it derives from the source aspect ratio. */
4431
4435
  width?: number;
4432
4436
  /** Logo placement. Defaults to bottom-right. */
4433
4437
  position?: LogoPosition;
@@ -4441,8 +4445,8 @@ interface ChromeThemeOverride {
4441
4445
  /** Font family override for this chrome element. */
4442
4446
  fontFamily?: string;
4443
4447
  /** Horizontal alignment of this chrome element. */
4444
- textAlign?: ChromeTextAlign;
4445
- /** Text prepended for display while preserving the authored text. */
4448
+ align?: ChromeAlign;
4449
+ /** Text prepended for display while preserving the authored text. Applies to any chrome element. */
4446
4450
  prefix?: string;
4447
4451
  /** Text color. Accepts a TokenValue for light/dark pairs. */
4448
4452
  color?: TokenValue;
@@ -4479,6 +4483,8 @@ interface ThemeConfig {
4479
4483
  hairline?: TokenValue;
4480
4484
  /** Sequential palettes keyed by name. Each is an array of color stops. */
4481
4485
  sequential?: Record<string, TokenValue[]>;
4486
+ /** Default sequential ramp key. Unknown or omitted names use the first merged ramp. */
4487
+ defaultSequential?: string;
4482
4488
  /** Diverging palettes keyed by name. Each is an array of color stops with a neutral midpoint. */
4483
4489
  diverging?: Record<string, TokenValue[]>;
4484
4490
  /** Background color. Accepts a TokenValue for light/dark pairs. */
@@ -7485,7 +7491,7 @@ interface ReaderSliceIndexOptions {
7485
7491
  /**
7486
7492
  * Color blindness simulation and palette distinguishability checks.
7487
7493
  *
7488
- * Uses Brettel, Vienot, and Mollon (1997) simulation matrices for
7494
+ * Uses Machado, Oliveira & Fernandes (2009), severity 1.0, for
7489
7495
  * protanopia, deuteranopia, and tritanopia.
7490
7496
  *
7491
7497
  * These are approximations suitable for checking palette accessibility,
@@ -7495,15 +7501,19 @@ interface ReaderSliceIndexOptions {
7495
7501
  type ColorBlindnessType = 'protanopia' | 'deuteranopia' | 'tritanopia' | 'achromatopsia';
7496
7502
  /**
7497
7503
  * Simulate how a color appears under a given color blindness type.
7498
- * Returns a hex color string.
7504
+ * Returns a clamped sRGB hex color string. Unresolvable colors (including
7505
+ * transparent) and unsupported types return the input color unchanged.
7499
7506
  */
7500
7507
  declare function simulateColorBlindness(color: string, type: ColorBlindnessType): string;
7501
7508
  /**
7502
7509
  * Check if colors in a palette are distinguishable under a given
7503
7510
  * color blindness type.
7504
7511
  *
7505
- * Uses a minimum perceptual distance threshold in simulated space.
7506
- * Returns true if all pairs of colors are sufficiently different.
7512
+ * Uses CIE76 distance in d3-color's D50 CIELAB after simulation, with a
7513
+ * default minDistance of 15 delta E units as a screening heuristic.
7514
+ * Returns true if every pair has distance >= minDistance (also for empty or
7515
+ * single-color palettes). Unresolvable colors/palettes and unsupported types
7516
+ * return false. Non-finite or negative thresholds fall back to 15.
7507
7517
  */
7508
7518
  declare function checkPaletteDistinguishability(colors: string[], type: ColorBlindnessType, minDistance?: number): boolean;
7509
7519
 
@@ -7595,9 +7605,8 @@ declare const ACHROMATIC_RAMP: {
7595
7605
  * Construction rules (the contract; the hexes below are output, not input):
7596
7606
  * - Hue order cyan 216 -> ochre 70 -> blue 262 -> rose 350 -> green 155 ->
7597
7607
  * violet 300, so every adjacent pair including the wrap is >= 80° apart.
7598
- * - Lightness varies rather than matching: colour-vision deficiency
7599
- * collapses hue and only lightness survives, so a matched-lightness ramp
7600
- * fails the repo's own Brettel simulator on ochre/rose and blue/violet.
7608
+ * - Lightness varies rather than matching: colour-vision deficiency can
7609
+ * reduce hue separation, while differences in lightness can survive.
7601
7610
  * - Fills use equal or lower chroma and equal or higher lightness than
7602
7611
  * strokes (within sRGB rounding), while clearing 3:1 on near-white.
7603
7612
  * Cyan uses reduced chroma to remain in gamut at its darker lightness.
@@ -7608,9 +7617,11 @@ declare const ACHROMATIC_RAMP: {
7608
7617
  * the dark-mode adapter's hsl-based binary search). Each entry carries its
7609
7618
  * *measured* OKLCH so the ramp can be regenerated; do not edit hexes directly.
7610
7619
  *
7611
- * Every array here clears `checkPaletteDistinguishability` at the default
7612
- * minDistance 30 for deuteranopia and protanopia — see
7613
- * `colors/__tests__/palette-a11y.test.ts`, which is the guard on any change.
7620
+ * With Machado simulation and the heuristic CIE76 threshold of 15, light
7621
+ * strokes pass deuteranopia and dark strokes pass tritanopia; the other
7622
+ * array/deficiency combinations fail. The colors are kept for compatibility.
7623
+ * See docs/design-system.md for every nearest pair and measured distance,
7624
+ * and `colors/__tests__/palette-a11y.test.ts` for the regression checks.
7614
7625
  */
7615
7626
  declare const CATEGORICAL_PALETTE: readonly ["#0a879e", "#bf7e1f", "#4170cb", "#b2417f", "#3ca368", "#9c7bd2"];
7616
7627
  /**
@@ -7740,9 +7751,9 @@ declare const wire: ThemeConfig;
7740
7751
  * Broadsheet preset: newspaper editorial. Warm paper, a red masthead rule and
7741
7752
  * eyebrow, a bold 24px title, and a quiet palette built around one loud hue.
7742
7753
  *
7743
- * Palette (measured OKLCH; checked with the repo's Brettel CVD simulator —
7744
- * deuteranopia and protanopia both pass, nearest simulated pair 48.7 against
7745
- * a threshold of 30):
7754
+ * Palette (measured OKLCH). Machado severity 1.0, CIE76 threshold 15:
7755
+ * light strokes fail deuteranopia (nearest green/gray, 5.75) and protanopia
7756
+ * (green/gray, 8.44); light fills also fail both (5.80 and 7.74).
7746
7757
  * 1 #1d5f8a oklch(0.466 0.095 242) ink blue
7747
7758
  * 2 #e3120b oklch(0.580 0.232 29) house red — the one loud hue
7748
7759
  * 3 #7fb0d3 oklch(0.735 0.073 240) pale blue
@@ -7753,9 +7764,9 @@ declare const wire: ThemeConfig;
7753
7764
  *
7754
7765
  * Dark mode is the same page after nightfall: the newsprint gives way to an
7755
7766
  * ink-blue ground, with the same hues lifted to hold their contrast on it.
7756
- * Palette (dark; checked with the Brettel simulator, nearest simulated pair
7757
- * 31.6 under deuteranopia against a threshold of 30, every stroke at 5.8:1
7758
- * or better and every fill at 5.3:1 or better on #12181f):
7767
+ * Dark strokes fail deuteranopia (nearest green/gray, 8.55) and pass
7768
+ * protanopia (green/gray, 15.26). Dark fills fail both (nearest green/gray,
7769
+ * 9.22 under deuteranopia; pale blue/gray, 13.98 under protanopia).
7759
7770
  * 1 #5e9fd6 ink blue, lifted 2 #f4655a house red, lifted
7760
7771
  * 3 #93c2e2 pale blue 4 #e0b267 ochre
7761
7772
  * 5 #4fb093 green 6 #9aa1a8 gray, cooled
@@ -9486,4 +9497,4 @@ declare const CSS_TOKEN_ROOT_SELECTORS: readonly string[];
9486
9497
  declare const CSS_TOKENS: readonly CssTokenDef[];
9487
9498
  declare function cssTokenDefault(name: string, mode: 'light' | 'dark'): string;
9488
9499
 
9489
- export { type A11yConfig, type A11yDescriptionConfig, 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 AnimationPreset, type AnimationSpec, type AnimationStagger, type Annotation, type AnnotationAnchor, type AnnotationFootnote, type AnnotationOffset, type AnnotationPlacementTool, 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, CELL_SWEEP_BUDGET_MS, COMPACT_MAX_X_TICKS, COMPACT_WIDTH, CSS_TOKENS, CSS_TOKEN_ROOT_SELECTORS, CURVE_NAMES, 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 ChromeTextAlign, type ChromeTextStyle, type ChromeThemeOverride, type CircleEncoding, type ColorBlindnessType, type ColumnConfig, type CompileOptions, type CompileTableOptions, type CompileWarning, type CompositionRecommendation, type Condition, type ConditionalValueDef, type ConnectorConfig, type ConnectorType, type ContinuousLegendBin, type ContinuousLegendLayout, type ContinuousLegendTick, type CssTokenDef, type CurveInput, type CurveName, type CurveStop, DEFAULT_THEME, DIVERGING_PALETTES, type DarkMode, type DataRow, type DatasetBinding, type DateGranularity, type DelayAnchor, type DelayRule, type DeltaColumnConfig, type DeltaTableCell, type DensityEncoding, type DensityTransform, type DescriptionEncoding, type DesignDiagnostic, type DesignQuestion, type Display, type DivergingPalette, type DurationRule, ENTRANCE_ROLES, EXIT_CURVE, EXIT_FADE_MS, EXTENDED_OFFSET_STRATEGIES, type EditOp, type EditTransaction, type EditTransactionResult, type ElementRef, type Encoding, type EncodingChannel, type EncodingRule, type EndpointLabelContent, type EndpointLabelEntry, type EndpointLabelsConfig, type EndpointLabelsLayout, type EnterPhaseConfig, type EntranceEndContext, type EntranceRole, type EntranceRoleDef, type EntranceRoleExtent, type EntranceRoleRow, type EntranceTiming, type EntranceTimingContext, type ErrorbarEncoding, FADE_CURVE, FLUID_SPRING, FOOTNOTE_LINE_HEIGHT, type FacetChannel, type FacetLayout, type FacetPanelLayout, type FieldFormatContext, type FieldMetadata, type FieldPredicate, type FieldRef, type FieldType, type FillPatternType, type FilterPredicate, type FilterTransform, type FlagTableCell, type FoldTransform, type FrameConfig, GRAPH_ENCODING_RULES, type GeoAnchor, type GeoCallout, type GeoCalloutNoteSlot, type GeoColorKeyDescriptor, type GeoColorKeyLayout, type GeoDetailLayer, type GeoDetailLayerLayout, type GeoEntityRef, type GeoInset, type GeoLabelAffine, type GeoLabelCandidate, type GeoLabelComponent, type GeoLabelGeometry, type GeoLabelInventoryEntry, type GeoLabelOverlay, type GeoLabelVisibility, type GeoLabelsBundle, type GeoLabelsInput, 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 GeoMapZoomConfig, type GeoPlacedLabel, type GeoProjectionContext, type GeoReaderObservation, type GeoReaderSelection, type GeoTextBlock, type GeoViewLayout, type GradientColorStop, type GradientDef, type GradientLegendLayout, type GradientStop, type GraphAnimationConfig, type GraphAnimationSpec, type GraphChannelRule, type GraphEdge, type GraphEdgeLayout, type GraphEncoding, type GraphEncodingChannel, type GraphEnterPhaseConfig, type GraphInteractionConfig, type GraphLayout, type GraphLayoutConfig, type GraphNode, type GraphNodeLayout, type GraphPhaseConfig, 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 HistogramEncoding, type ImageColumnConfig, type ImageTableCell, type JoinAggregateTransform, KEYFRAMES, type KeyframeDef, type KeyframeName, type KeyframeProperty, type KeyframeStop, type KeyframeValue, LABEL_GAP_COMPACT, LABEL_GAP_DEFAULT, LINE_POINT_CASCADE_MS, 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 LogoPosition, type LollipopEncoding, MAP_FEATURE_MAX_DURATION_MS, MAP_POINT_STAGGER_FALLBACK_MS, MAP_SWEEP_BUDGET_MS, 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_SPRING_DURATION, MAX_SR_TABLE_ROWS, MAX_TOTAL_STAGGER_MS, MOTION_REST_THRESHOLD, type MapSweepTiming, type Margins, type Mark, type MarkAria, type MarkDef, type MarkEvent, type MarkFocusEvent, type MarkMetadata, type MarkType, type MeasureTextFn, type Metric, type MonotoneCurveName, type MotionPhase, type MotionSample, NARROW_VIEWPORT_MAX, type NeutralRamp, type NodeOverride, type NumberFormatter, OFFSET_STRATEGIES, type ObservationIdentity, type OffsetStrategy, type PaginationState, type ParliamentEncoding, type PlaybackConfig, type PlaybackPeriodPosition, type PlaybackTimingConfig, type Point, type PointEncoding, type PointMark, type RaceBarGeometry, type RaceBarMarkDef, type RaceBarRow, type RaceBarStatic, type RaceConfig, type RaceEncoding, type RaceFrame, type RaceGeometry, type RaceItem, type RaceLayout, type RaceLineGeometry, type RaceLineMarkDef, type RaceLineStatic, type RaceMarkDef, type RaceMarkType, type RacePlayback, type RaceSpec, type RaceSpecWithoutData, type RaceTableCell, type RaceTableColumn, type RaceTableGeometry, type RaceTableMarkDef, type RaceTableStatic, type RaceTick, type RadialGradient, type RangeAnnotation, type RangeEncoding, type ReaderBindingScope, type ReaderChangeMeta, type ReaderComparisonOperand, type ReaderComparisonResult, type ReaderComparisonScope, type ReaderDomainValue, type ReaderObservation, type ReaderPanelScope, type ReaderSelection, type ReaderSeries, type ReaderSlice, type ReaderSliceIndexOptions, type ReaderSliceMember, type ReaderSliceSelection, 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 ResolvedChromeLogo, type ResolvedChromeRule, type ResolvedColumn, type ResolvedFillPattern, type ResolvedLabel, type ResolvedMetricBar, type ResolvedMetricCell, type ResolvedSeriesSearch, type ResolvedTheme, type ResolvedThemeColors, type ResolvedYouDrawIt, type ResponsiveConfig, type RoleTiming, type RuleMarkLayout, SEQUENTIAL_PALETTES, SUPPORTED_LOCALES, SUPPORTED_SCHEME_NAMES, type SankeyEncoding, type SankeyLayout, type SankeyLinkColor, type SankeyLinkMark, type SankeyNodeAlign, type SankeyNodeMark, type SankeySpec, type SankeySpecOverride, 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 SpecPatch, type SpringConfig, type StaggerRule, type StoredVizSpec, type SupportedLocale, TICK_LABEL_OFFSET, TICK_LINE_HEIGHT_FACTOR, TOP_PAD_EXTRA_NARROW, 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 ThemeChromeDefaults, type ThemeColors, type ThemeConfig, type ThemeFontSizes, type ThemeFontWeights, type ThemeFonts, type ThemeLogo, type ThemeRule, type ThemeSpacing, type TickEncoding, type TickMarkLayout, type TileMapBuilderOptions, type TileMapEncoding, type TileMapLayout, type TileMapPalette, type TileMapSpec, type TileMapSpecWithoutData, type TileMapTileMark, type TimeTickInterval, type TimeTickStep, type TimeUnit, type TimeUnitTransform, type TokenValue, type TooltipContent, type TooltipField, type Transform, UPDATE_ENTER_START, type UpdatePhaseConfig, type UpdateTimeline, 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, anchorMs, annotationSource, applyEditTransaction, areaChart, axisTitleOffset, barChart, broadsheet, buildCompactStepFormatter, buildD3Formatter, buildTemporalFormatter, canonicalSchemeName, checkPaletteDistinguishability, clampStaggerDelay, clarity, columnChart, computeChrome, computeFieldFormatContext, computeLabelBounds, computeNoteBandHeight, computeXAxisExtentFromLabels, contrastRatio, cssTokenDefault, curveStops, curveToCSSLinear, dataTable, deepMergeSpec, defaultNumberFormatter, deriveNeutralRamp, detectCollision, donutChart, dotChart, elementRef, encodePointerToken, entranceAnchorVars, entranceEndMs, entranceRole, entranceTiming, essay, estimateTextWidth, evalCubicBezier, evalCurve, evalKeyframes, evalRoleEase, evalValueCurve, findAccessibleColor, formatCurrency, formatDate, formatNumber, formatOrdinal, formatPercent, formatRawNumber, generateAltText, generateAriaLabels, generateDataTable, getAxisTitleOffset, getBreakpoint, getHeightClass, getLayoutStrategy, getRepresentativeColor, heuristicMeasure, inferFieldType, invertCurve, invertRoleEase, isAxislessMark, isBarListSpec, isChartSpec, isConditionalDef, isEncodingChannel, isGeoMapSpec, isGradientDef, isGraphSpec, isLayerSpec, isMonotoneCurve, isOpaqueColor, isRaceSpec, isRangeAnnotation, isRefLineAnnotation, isSafeLink, isSafeLogoSource, isSankeySpec, isSupportedLocale, isTableSpec, isTextAnnotation, isTileMapSpec, isValueDef, isYearContext, jsonPointer, keyframeProperties, keyframeValueToCSS, legacyEditorial, lineChart, mapFeatureDuration, mapSweepTiming, matchLocale, maxRotatedLabelWidth, meetsAA, mergeThemeConfig, motionCSS, overlapArea, pickLabelColor, pieChart, progressTimeMs, resolveChromeEconomy, resolveCollisions, resolveMarkDef, resolveMarkType, resolveMeasurer, resolveNumberFormatter, resolveSchemeName, resolveTheme, roleBaseDuration, roleVars, sampleMotion, scatterChart, shuffledSweepDelays, simulateColorBlindness, springDuration, terminal, textAscent, tileMap, tilemapTileDelays, truncateRotatedLabel, truncateToWidth, updateTimeline, wire, wrapText };
9500
+ export { type A11yConfig, type A11yDescriptionConfig, 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 AnimationPreset, type AnimationSpec, type AnimationStagger, type Annotation, type AnnotationAnchor, type AnnotationFootnote, type AnnotationOffset, type AnnotationPlacementTool, 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, CELL_SWEEP_BUDGET_MS, COMPACT_MAX_X_TICKS, COMPACT_WIDTH, CSS_TOKENS, CSS_TOKEN_ROOT_SELECTORS, CURVE_NAMES, 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 ChromeAlign, 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 CompositionRecommendation, type Condition, type ConditionalValueDef, type ConnectorConfig, type ConnectorType, type ContinuousLegendBin, type ContinuousLegendLayout, type ContinuousLegendTick, type CssTokenDef, type CurveInput, type CurveName, type CurveStop, DEFAULT_THEME, DIVERGING_PALETTES, type DarkMode, type DataRow, type DatasetBinding, type DateGranularity, type DelayAnchor, type DelayRule, type DeltaColumnConfig, type DeltaTableCell, type DensityEncoding, type DensityTransform, type DescriptionEncoding, type DesignDiagnostic, type DesignQuestion, type Display, type DivergingPalette, type DurationRule, ENTRANCE_ROLES, EXIT_CURVE, EXIT_FADE_MS, EXTENDED_OFFSET_STRATEGIES, type EditOp, type EditTransaction, type EditTransactionResult, type ElementRef, type Encoding, type EncodingChannel, type EncodingRule, type EndpointLabelContent, type EndpointLabelEntry, type EndpointLabelsConfig, type EndpointLabelsLayout, type EnterPhaseConfig, type EntranceEndContext, type EntranceRole, type EntranceRoleDef, type EntranceRoleExtent, type EntranceRoleRow, type EntranceTiming, type EntranceTimingContext, type ErrorbarEncoding, FADE_CURVE, FLUID_SPRING, FOOTNOTE_LINE_HEIGHT, type FacetChannel, type FacetLayout, type FacetPanelLayout, type FieldFormatContext, type FieldMetadata, type FieldPredicate, type FieldRef, type FieldType, type FillPatternType, type FilterPredicate, type FilterTransform, type FlagTableCell, type FoldTransform, type FrameConfig, GRAPH_ENCODING_RULES, type GeoAnchor, type GeoCallout, type GeoCalloutNoteSlot, type GeoColorKeyDescriptor, type GeoColorKeyLayout, type GeoDetailLayer, type GeoDetailLayerLayout, type GeoEntityRef, type GeoInset, type GeoLabelAffine, type GeoLabelCandidate, type GeoLabelComponent, type GeoLabelGeometry, type GeoLabelInventoryEntry, type GeoLabelOverlay, type GeoLabelVisibility, type GeoLabelsBundle, type GeoLabelsInput, 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 GeoMapZoomConfig, type GeoPlacedLabel, type GeoProjectionContext, type GeoReaderObservation, type GeoReaderSelection, type GeoTextBlock, type GeoViewLayout, type GradientColorStop, type GradientDef, type GradientLegendLayout, type GradientStop, type GraphAnimationConfig, type GraphAnimationSpec, type GraphChannelRule, type GraphEdge, type GraphEdgeLayout, type GraphEncoding, type GraphEncodingChannel, type GraphEnterPhaseConfig, type GraphInteractionConfig, type GraphLayout, type GraphLayoutConfig, type GraphNode, type GraphNodeLayout, type GraphPhaseConfig, 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 HistogramEncoding, type ImageColumnConfig, type ImageTableCell, type JoinAggregateTransform, KEYFRAMES, type KeyframeDef, type KeyframeName, type KeyframeProperty, type KeyframeStop, type KeyframeValue, LABEL_GAP_COMPACT, LABEL_GAP_DEFAULT, LINE_POINT_CASCADE_MS, 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 LogoPosition, type LollipopEncoding, MAP_FEATURE_MAX_DURATION_MS, MAP_POINT_STAGGER_FALLBACK_MS, MAP_SWEEP_BUDGET_MS, 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_SPRING_DURATION, MAX_SR_TABLE_ROWS, MAX_TOTAL_STAGGER_MS, MOTION_REST_THRESHOLD, type MapSweepTiming, type Margins, type Mark, type MarkAria, type MarkDef, type MarkEvent, type MarkFocusEvent, type MarkMetadata, type MarkType, type MeasureTextFn, type Metric, type MonotoneCurveName, type MotionPhase, type MotionSample, NARROW_VIEWPORT_MAX, type NeutralRamp, type NodeOverride, type NumberFormatter, OFFSET_STRATEGIES, type ObservationIdentity, type OffsetStrategy, type PaginationState, type ParliamentEncoding, type PlaybackConfig, type PlaybackPeriodPosition, type PlaybackTimingConfig, type Point, type PointEncoding, type PointMark, type RaceBarGeometry, type RaceBarMarkDef, type RaceBarRow, type RaceBarStatic, type RaceConfig, type RaceEncoding, type RaceFrame, type RaceGeometry, type RaceItem, type RaceLayout, type RaceLineGeometry, type RaceLineMarkDef, type RaceLineStatic, type RaceMarkDef, type RaceMarkType, type RacePlayback, type RaceSpec, type RaceSpecWithoutData, type RaceTableCell, type RaceTableColumn, type RaceTableGeometry, type RaceTableMarkDef, type RaceTableStatic, type RaceTick, type RadialGradient, type RangeAnnotation, type RangeEncoding, type ReaderBindingScope, type ReaderChangeMeta, type ReaderComparisonOperand, type ReaderComparisonResult, type ReaderComparisonScope, type ReaderDomainValue, type ReaderObservation, type ReaderPanelScope, type ReaderSelection, type ReaderSeries, type ReaderSlice, type ReaderSliceIndexOptions, type ReaderSliceMember, type ReaderSliceSelection, 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 ResolvedChromeLogo, type ResolvedChromeRule, type ResolvedColumn, type ResolvedFillPattern, type ResolvedLabel, type ResolvedMetricBar, type ResolvedMetricCell, type ResolvedSeriesSearch, type ResolvedTheme, type ResolvedThemeColors, type ResolvedYouDrawIt, type ResponsiveConfig, type RoleTiming, type RuleMarkLayout, SEQUENTIAL_PALETTES, SUPPORTED_LOCALES, SUPPORTED_SCHEME_NAMES, type SankeyEncoding, type SankeyLayout, type SankeyLinkColor, type SankeyLinkMark, type SankeyNodeAlign, type SankeyNodeMark, type SankeySpec, type SankeySpecOverride, 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 SpecPatch, type SpringConfig, type StaggerRule, type StoredVizSpec, type SupportedLocale, TICK_LABEL_OFFSET, TICK_LINE_HEIGHT_FACTOR, TOP_PAD_EXTRA_NARROW, 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 ThemeChromeDefaults, type ThemeColors, type ThemeConfig, type ThemeFontSizes, type ThemeFontWeights, type ThemeFonts, type ThemeLogo, type ThemeRule, type ThemeSpacing, type TickEncoding, type TickMarkLayout, type TileMapBuilderOptions, type TileMapEncoding, type TileMapLayout, type TileMapPalette, type TileMapSpec, type TileMapSpecWithoutData, type TileMapTileMark, type TimeTickInterval, type TimeTickStep, type TimeUnit, type TimeUnitTransform, type TokenValue, type TooltipContent, type TooltipField, type Transform, UPDATE_ENTER_START, type UpdatePhaseConfig, type UpdateTimeline, 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, anchorMs, annotationSource, applyEditTransaction, areaChart, axisTitleOffset, barChart, broadsheet, buildCompactStepFormatter, buildD3Formatter, buildTemporalFormatter, canonicalSchemeName, checkPaletteDistinguishability, clampStaggerDelay, clarity, columnChart, computeChrome, computeFieldFormatContext, computeLabelBounds, computeNoteBandHeight, computeXAxisExtentFromLabels, contrastRatio, cssTokenDefault, curveStops, curveToCSSLinear, dataTable, deepMergeSpec, defaultNumberFormatter, deriveNeutralRamp, detectCollision, donutChart, dotChart, elementRef, encodePointerToken, entranceAnchorVars, entranceEndMs, entranceRole, entranceTiming, essay, estimateTextWidth, evalCubicBezier, evalCurve, evalKeyframes, evalRoleEase, evalValueCurve, findAccessibleColor, formatCurrency, formatDate, formatNumber, formatOrdinal, formatPercent, formatRawNumber, generateAltText, generateAriaLabels, generateDataTable, getAxisTitleOffset, getBreakpoint, getHeightClass, getLayoutStrategy, getRepresentativeColor, heuristicMeasure, inferFieldType, invertCurve, invertRoleEase, isAxislessMark, isBarListSpec, isChartSpec, isConditionalDef, isEncodingChannel, isGeoMapSpec, isGradientDef, isGraphSpec, isLayerSpec, isMonotoneCurve, isOpaqueColor, isRaceSpec, isRangeAnnotation, isRefLineAnnotation, isSafeLink, isSafeLogoSource, isSankeySpec, isSupportedLocale, isTableSpec, isTextAnnotation, isTileMapSpec, isValueDef, isYearContext, jsonPointer, keyframeProperties, keyframeValueToCSS, legacyEditorial, lineChart, mapFeatureDuration, mapSweepTiming, matchLocale, maxRotatedLabelWidth, meetsAA, mergeThemeConfig, motionCSS, overlapArea, pickLabelColor, pieChart, progressTimeMs, resolveChromeEconomy, resolveCollisions, resolveMarkDef, resolveMarkType, resolveMeasurer, resolveNumberFormatter, resolveSchemeName, resolveTheme, roleBaseDuration, roleVars, sampleMotion, scatterChart, shuffledSweepDelays, simulateColorBlindness, springDuration, terminal, textAscent, tileMap, tilemapTileDelays, truncateRotatedLabel, truncateToWidth, updateTimeline, wire, wrapText };
package/dist/index.js CHANGED
@@ -521,21 +521,21 @@ var MARK_DISPLAY_NAMES = {
521
521
  };
522
522
 
523
523
  // src/colors/colorblind.ts
524
- import { rgb } from "d3-color";
524
+ import { lab, rgb } from "d3-color";
525
525
  var PROTAN_MATRIX = [
526
- [0.567, 0.433, 0],
527
- [0.558, 0.442, 0],
528
- [0, 0.242, 0.758]
526
+ [0.152286, 1.052583, -0.204868],
527
+ [0.114503, 0.786281, 0.099216],
528
+ [-3882e-6, -0.048116, 1.051998]
529
529
  ];
530
530
  var DEUTAN_MATRIX = [
531
- [0.625, 0.375, 0],
532
- [0.7, 0.3, 0],
533
- [0, 0.3, 0.7]
531
+ [0.367322, 0.860646, -0.227968],
532
+ [0.280085, 0.672501, 0.047413],
533
+ [-0.01182, 0.04294, 0.968881]
534
534
  ];
535
535
  var TRITAN_MATRIX = [
536
- [0.95, 0.05, 0],
537
- [0, 0.433, 0.567],
538
- [0, 0.475, 0.525]
536
+ [1.255528, -0.076749, -0.178779],
537
+ [-0.078411, 0.930809, 0.147602],
538
+ [4733e-6, 0.691367, 0.3039]
539
539
  ];
540
540
  var ACHROMAT_MATRIX = [
541
541
  [0.2126, 0.7152, 0.0722],
@@ -557,8 +557,9 @@ function delinearize(v) {
557
557
  return Math.round(Math.max(0, Math.min(255, s * 255)));
558
558
  }
559
559
  function simulateColorBlindness(color, type) {
560
+ if (typeof color !== "string" || !Object.hasOwn(MATRICES, type)) return color;
560
561
  const c = rgb(color);
561
- if (c == null) return color;
562
+ if (![c.r, c.g, c.b].every(Number.isFinite)) return color;
562
563
  const lin = [linearize(c.r), linearize(c.g), linearize(c.b)];
563
564
  const m = MATRICES[type];
564
565
  const r = m[0][0] * lin[0] + m[0][1] * lin[1] + m[0][2] * lin[2];
@@ -566,18 +567,23 @@ function simulateColorBlindness(color, type) {
566
567
  const b = m[2][0] * lin[0] + m[2][1] * lin[1] + m[2][2] * lin[2];
567
568
  return rgb(delinearize(r), delinearize(g), delinearize(b)).formatHex();
568
569
  }
569
- function checkPaletteDistinguishability(colors, type, minDistance = 30) {
570
- const simulated = colors.map((c) => {
571
- const s = rgb(simulateColorBlindness(c, type));
572
- return s ? [s.r, s.g, s.b] : [0, 0, 0];
573
- });
570
+ function checkPaletteDistinguishability(colors, type, minDistance = 15) {
571
+ if (!Array.isArray(colors) || !Object.hasOwn(MATRICES, type)) return false;
572
+ const threshold = Number.isFinite(minDistance) && minDistance >= 0 ? minDistance : 15;
573
+ const simulated = [];
574
+ for (const color of colors) {
575
+ if (typeof color !== "string") return false;
576
+ const s = lab(simulateColorBlindness(color, type));
577
+ if (![s.l, s.a, s.b].every(Number.isFinite)) return false;
578
+ simulated.push(s);
579
+ }
574
580
  for (let i = 0; i < simulated.length; i++) {
575
581
  for (let j = i + 1; j < simulated.length; j++) {
576
- const dr = simulated[i][0] - simulated[j][0];
577
- const dg = simulated[i][1] - simulated[j][1];
578
- const db = simulated[i][2] - simulated[j][2];
579
- const dist = Math.sqrt(dr * dr + dg * dg + db * db);
580
- if (dist < minDistance) return false;
582
+ const dl = simulated[i].l - simulated[j].l;
583
+ const da = simulated[i].a - simulated[j].a;
584
+ const db = simulated[i].b - simulated[j].b;
585
+ const dist = Math.hypot(dl, da, db);
586
+ if (dist < threshold) return false;
581
587
  }
582
588
  }
583
589
  return true;
@@ -2280,7 +2286,7 @@ var wire = {
2280
2286
  },
2281
2287
  fonts: {
2282
2288
  family: '"JetBrains Mono", "Fira Code", "Cascadia Code", monospace',
2283
- sizes: { title: 16, subtitle: 12, body: 11, small: 10, axisTick: 10 },
2289
+ sizes: { title: 16, subtitle: 12, body: 11, small: 10, axisTick: 12 },
2284
2290
  weights: { normal: 400, medium: 500, semibold: 600, bold: 700 }
2285
2291
  },
2286
2292
  spacing: {
@@ -2358,7 +2364,7 @@ var terminal = /* @__PURE__ */ (() => ({
2358
2364
  fonts: {
2359
2365
  family: '"Inter Variable", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
2360
2366
  mono: '"JetBrains Mono", "Fira Code", "Cascadia Code", monospace',
2361
- sizes: { title: 15, subtitle: 12, body: 12, small: 10, axisTick: 10 }
2367
+ sizes: { title: 15, subtitle: 12, body: 12, small: 10, axisTick: 12 }
2362
2368
  },
2363
2369
  spacing: {
2364
2370
  padding: 12,
@@ -2420,6 +2426,27 @@ function matchLocale(tag) {
2420
2426
  return Object.hasOwn(aliases, lower) ? aliases[lower] : null;
2421
2427
  }
2422
2428
 
2429
+ // src/theme/ramps.ts
2430
+ function isRampStop(stop) {
2431
+ if (typeof stop === "string") return true;
2432
+ if (!stop || typeof stop !== "object") return false;
2433
+ const pair = stop;
2434
+ return typeof pair.light === "string" && typeof pair.dark === "string";
2435
+ }
2436
+ function sanitizeRamps(kind, ramps, warn) {
2437
+ const clean2 = {};
2438
+ for (const [name, stops] of Object.entries(ramps)) {
2439
+ const usable = Array.isArray(stops) ? stops.filter(isRampStop) : [];
2440
+ if (warn && (!Array.isArray(stops) || usable.length !== stops.length)) {
2441
+ console.warn(
2442
+ `[openchart] colors.${kind}.${name}: ramps must be arrays of color strings or { light, dark } pairs; ignoring invalid ${Array.isArray(stops) ? "stops" : "ramp"}.`
2443
+ );
2444
+ }
2445
+ if (usable.length > 0) clean2[name] = usable;
2446
+ }
2447
+ return clean2;
2448
+ }
2449
+
2423
2450
  // src/theme/resolve.ts
2424
2451
  function resolveTokenLight(v) {
2425
2452
  return typeof v === "string" ? v : v.light;
@@ -2433,25 +2460,22 @@ function themeConfigToPartial(config, base2) {
2433
2460
  if (Array.isArray(config.colors)) {
2434
2461
  colors.categorical = config.colors;
2435
2462
  } else {
2463
+ const { defaultSequential } = config.colors;
2464
+ if (typeof defaultSequential === "string") colors.defaultSequential = defaultSequential;
2436
2465
  if (config.colors.categorical)
2437
2466
  colors.categorical = config.colors.categorical.map(resolveTokenLight);
2438
2467
  if (config.colors.categoricalFill)
2439
2468
  colors.categoricalFill = config.colors.categoricalFill.map(resolveTokenLight);
2440
- if (config.colors.sequential) {
2441
- colors.sequential = Object.fromEntries(
2442
- Object.entries(config.colors.sequential).map(([name, stops]) => [
2443
- name,
2444
- stops.map(resolveTokenLight)
2445
- ])
2446
- );
2447
- }
2448
- if (config.colors.diverging) {
2449
- colors.diverging = Object.fromEntries(
2450
- Object.entries(config.colors.diverging).map(([name, stops]) => [
2451
- name,
2452
- stops.map(resolveTokenLight)
2453
- ])
2454
- );
2469
+ for (const kind of ["sequential", "diverging"]) {
2470
+ const authored = config.colors[kind];
2471
+ if (authored && typeof authored === "object") {
2472
+ colors[kind] = Object.fromEntries(
2473
+ Object.entries(sanitizeRamps(kind, authored, true)).map(([name, stops]) => [
2474
+ name,
2475
+ stops.map(resolveTokenLight)
2476
+ ])
2477
+ );
2478
+ }
2455
2479
  }
2456
2480
  if (config.colors.background) colors.background = resolveTokenLight(config.colors.background);
2457
2481
  if (config.colors.text) colors.text = resolveTokenLight(config.colors.text);
@@ -2537,7 +2561,7 @@ function themeConfigToPartial(config, base2) {
2537
2561
  if (obj.fontWeight !== void 0) override.fontWeight = obj.fontWeight;
2538
2562
  if (obj.lineHeight !== void 0) override.lineHeight = obj.lineHeight;
2539
2563
  if (obj.fontFamily !== void 0) override.fontFamily = obj.fontFamily;
2540
- if (obj.textAlign !== void 0) override.textAlign = obj.textAlign;
2564
+ if (obj.align !== void 0) override.align = obj.align;
2541
2565
  if (obj.prefix !== void 0) override.prefix = obj.prefix;
2542
2566
  chrome[element] = override;
2543
2567
  }
@@ -2616,9 +2640,9 @@ function collectRampPairs(config) {
2616
2640
  const result = {};
2617
2641
  for (const kind of ["sequential", "diverging"]) {
2618
2642
  const ramps = config.colors[kind];
2619
- if (ramps) {
2643
+ if (ramps && typeof ramps === "object") {
2620
2644
  result[kind] = Object.fromEntries(
2621
- Object.entries(ramps).map(([name, stops]) => [
2645
+ Object.entries(sanitizeRamps(kind, ramps, false)).map(([name, stops]) => [
2622
2646
  name,
2623
2647
  stops.map((stop) => typeof stop === "string" ? void 0 : stop)
2624
2648
  ])
@@ -2726,12 +2750,14 @@ function resolveTheme(userTheme, base2 = DEFAULT_THEME) {
2726
2750
  const neutral = deriveNeutralRamp(merged.colors.text, merged.colors.background, dark);
2727
2751
  const authoredColors = userTheme?.colors && !Array.isArray(userTheme.colors) ? userTheme.colors : {};
2728
2752
  const rampPairs = userTheme ? collectRampPairs(userTheme) : void 0;
2753
+ const { sequential, defaultSequential } = merged.colors;
2729
2754
  return {
2730
2755
  ...merged,
2731
2756
  _authored: userTheme,
2732
2757
  colors: {
2733
2758
  ...merged.colors,
2734
2759
  neutral,
2760
+ defaultSequential: typeof defaultSequential === "string" && Object.hasOwn(sequential, defaultSequential) ? defaultSequential : Object.keys(sequential)[0] ?? "",
2735
2761
  annotationMarkerFill: authoredColors.annotationMarkerFill === void 0 ? neutral.surface : merged.colors.annotationMarkerFill,
2736
2762
  annotationPlate: authoredColors.annotationPlate === void 0 ? neutral.surface : merged.colors.annotationPlate
2737
2763
  },
@@ -2794,7 +2820,7 @@ function resolveChromeLogo(logo, width, padding) {
2794
2820
  if (!logo || typeof logo !== "object" || Array.isArray(logo) || typeof logo.src !== "string" || !isSafeLogoSource(logo.src) || !Number.isFinite(logo.height) || logo.height <= 0 || logo.width !== void 0 && (!Number.isFinite(logo.width) || logo.width <= 0))
2795
2821
  return void 0;
2796
2822
  const intrinsic = readLogoSize(logo.src);
2797
- const logoWidth = intrinsic ? logo.height * intrinsic.width / intrinsic.height : logo.width ?? logo.height;
2823
+ const logoWidth = logo.width ?? (intrinsic ? logo.height * intrinsic.width / intrinsic.height : logo.height);
2798
2824
  const availableWidth = width - padding * 2;
2799
2825
  if (!Number.isFinite(logoWidth) || logoWidth <= 0 || availableWidth <= 0) return void 0;
2800
2826
  const scale2 = Math.min(1, availableWidth / logoWidth);
@@ -2875,7 +2901,7 @@ function buildTextStyle(defaults, fontFamily, textColor, width, overrides, extra
2875
2901
  fontWeight: overrides?.fontWeight ?? defaults.fontWeight,
2876
2902
  fill: overrides?.color ?? textColor ?? defaults.color,
2877
2903
  lineHeight: defaults.lineHeight,
2878
- textAnchor: defaults.textAlign === "center" ? "middle" : defaults.textAlign === "right" ? "end" : "start"
2904
+ textAnchor: defaults.align === "center" ? "middle" : defaults.align === "right" ? "end" : "start"
2879
2905
  };
2880
2906
  }
2881
2907
  function estimateLineCount(text, style, maxWidth, measureText, maxLines) {
@@ -2996,10 +3022,10 @@ function computeChrome(chrome, theme, width, measureTextFn, chromeMode = "full",
2996
3022
  let ruleElement;
2997
3023
  if (theme.rule && (eyebrowNorm || titleNormPeek || subtitleNormPeek)) {
2998
3024
  const { x, textAnchor } = alignChromeText(
2999
- theme.chrome.title.textAlign,
3025
+ theme.chrome.title.align,
3000
3026
  topWidth,
3001
3027
  pad,
3002
- theme.chrome.title.textAlign ? titleNormPeek?.offset?.dx : 0
3028
+ theme.chrome.title.align ? titleNormPeek?.offset?.dx : 0
3003
3029
  );
3004
3030
  ruleElement = {
3005
3031
  x: x - (textAnchor === "middle" ? theme.rule.width / 2 : textAnchor === "end" ? theme.rule.width : 0),
@@ -3031,7 +3057,7 @@ function computeChrome(chrome, theme, width, measureTextFn, chromeMode = "full",
3031
3057
  text: eyebrowNorm.text,
3032
3058
  ...prefix,
3033
3059
  ...eyebrowNorm.href ? { href: eyebrowNorm.href } : {},
3034
- x: alignChromeText(theme.chrome.eyebrow.textAlign, topWidth, pad, eyebrowNorm.offset?.dx).x,
3060
+ x: alignChromeText(theme.chrome.eyebrow.align, topWidth, pad, eyebrowNorm.offset?.dx).x,
3035
3061
  y: topY + (eyebrowNorm.offset?.dy ?? 0),
3036
3062
  maxWidth: topMaxWidth,
3037
3063
  ...maxLines != null ? { maxLines } : {},
@@ -3063,7 +3089,7 @@ function computeChrome(chrome, theme, width, measureTextFn, chromeMode = "full",
3063
3089
  text: titleNorm.text,
3064
3090
  ...prefix,
3065
3091
  ...titleNorm.href ? { href: titleNorm.href } : {},
3066
- x: alignChromeText(theme.chrome.title.textAlign, topWidth, pad, titleNorm.offset?.dx).x,
3092
+ x: alignChromeText(theme.chrome.title.align, topWidth, pad, titleNorm.offset?.dx).x,
3067
3093
  y: topY + (titleNorm.offset?.dy ?? 0),
3068
3094
  maxWidth: topMaxWidth,
3069
3095
  ...maxLines != null ? { maxLines } : {},
@@ -3094,7 +3120,7 @@ function computeChrome(chrome, theme, width, measureTextFn, chromeMode = "full",
3094
3120
  text: subtitleNorm.text,
3095
3121
  ...prefix,
3096
3122
  ...subtitleNorm.href ? { href: subtitleNorm.href } : {},
3097
- x: alignChromeText(theme.chrome.subtitle.textAlign, topWidth, pad, subtitleNorm.offset?.dx).x,
3123
+ x: alignChromeText(theme.chrome.subtitle.align, topWidth, pad, subtitleNorm.offset?.dx).x,
3098
3124
  y: topY + (subtitleNorm.offset?.dy ?? 0),
3099
3125
  maxWidth: topMaxWidth,
3100
3126
  ...maxLines != null ? { maxLines } : {},
@@ -3212,7 +3238,7 @@ function computeChrome(chrome, theme, width, measureTextFn, chromeMode = "full",
3212
3238
  text: norm.text,
3213
3239
  ...prefix,
3214
3240
  ...norm.href ? { href: norm.href } : {},
3215
- x: alignChromeText(theme.chrome[key].textAlign, width, pad, norm.offset?.dx).x,
3241
+ x: alignChromeText(theme.chrome[key].align, width, pad, norm.offset?.dx).x,
3216
3242
  y: itemY,
3217
3243
  maxWidth: available,
3218
3244
  ...norm.style?.maxLines != null ? { maxLines: norm.style.maxLines } : {},
@@ -3233,7 +3259,7 @@ function computeChrome(chrome, theme, width, measureTextFn, chromeMode = "full",
3233
3259
  const inlineHeight = Math.max(inline.height, (brand?.y ?? startY) - startY + rowHeight);
3234
3260
  const stackedHeight = full.height + (items.length ? chromeGap : 0) + rowHeight + Math.max(0, brandNorm?.offset?.dy ?? 0);
3235
3261
  const allLeft = items.every(
3236
- ({ key }) => !theme.chrome[key].textAlign || theme.chrome[key].textAlign === "left"
3262
+ ({ key }) => !theme.chrome[key].align || theme.chrome[key].align === "left"
3237
3263
  );
3238
3264
  const hasAttribution = !!brand || !!rightLogo.logo;
3239
3265
  const stacked = items.length > 0 && (!allLeft || rightLogo.ownRow || hasAttribution && (inlineWidth < 40 || stackedHeight < inlineHeight));
@@ -3982,9 +4008,10 @@ function localeTag(locale) {
3982
4008
  if (locale === void 0 || locale === "en-US" || typeof locale !== "string") return "en-US";
3983
4009
  const cached = LOCALE_TAGS.get(locale);
3984
4010
  if (cached) return cached;
3985
- const tag = matchLocale(locale) ?? "en-US";
3986
- LOCALE_TAGS.set(locale, tag);
3987
- return tag;
4011
+ const matched = matchLocale(locale);
4012
+ if (!matched) return "en-US";
4013
+ LOCALE_TAGS.set(locale, matched);
4014
+ return matched;
3988
4015
  }
3989
4016
  function getNumberLocale(locale) {
3990
4017
  if (locale === void 0 || locale === "en-US") return DEFAULT_NUMBER_LOCALE;
@@ -4058,7 +4085,10 @@ function formatNumber(value, locale) {
4058
4085
  return numberFormatter(FORMAT_DECIMAL, ",.2f", locale)(value);
4059
4086
  }
4060
4087
  function formatRawNumber(value, locale) {
4061
- return String(value).replace(".", LOCALE_DEFINITIONS[localeTag(locale)].number.decimal);
4088
+ const tag = localeTag(locale);
4089
+ const { decimal, minus } = LOCALE_DEFINITIONS[tag].number;
4090
+ const text = String(value).replace(".", decimal);
4091
+ return tag !== "en-US" && text.startsWith("-") ? minus + text.slice(1) : text;
4062
4092
  }
4063
4093
  var UNIT_TABLE = [
4064
4094
  { threshold: 1e12, suffix: "T", divisor: 1e12 },