@opendata-ai/openchart-core 9.7.0 → 9.7.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 +6 -6
- package/dist/index.js +51 -31
- package/dist/index.js.map +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
- package/schema/chart.schema.json +5 -5
- package/schema/table.schema.json +5 -5
- package/schema/vizspec.schema.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -451,7 +451,7 @@ interface ChromeDefaults {
|
|
|
451
451
|
/** Font family override for this chrome element. */
|
|
452
452
|
fontFamily?: string;
|
|
453
453
|
/** Horizontal alignment of this chrome element. */
|
|
454
|
-
|
|
454
|
+
align?: ChromeAlign;
|
|
455
455
|
/** Display prefix, separate from the authored text. */
|
|
456
456
|
prefix?: string;
|
|
457
457
|
/** Font size in pixels. */
|
|
@@ -4418,7 +4418,7 @@ type Annotation = TextAnnotation | RangeAnnotation | RefLineAnnotation;
|
|
|
4418
4418
|
*/
|
|
4419
4419
|
type DarkMode = 'auto' | 'force' | 'off';
|
|
4420
4420
|
/** Horizontal alignment of a chrome text element. */
|
|
4421
|
-
type
|
|
4421
|
+
type ChromeAlign = 'left' | 'center' | 'right';
|
|
4422
4422
|
/** Placement of a theme logo relative to the visualization. */
|
|
4423
4423
|
type LogoPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
4424
4424
|
/** Theme logo source, size and placement. */
|
|
@@ -4427,7 +4427,7 @@ interface ThemeLogo {
|
|
|
4427
4427
|
src: string;
|
|
4428
4428
|
/** Display height in pixels. */
|
|
4429
4429
|
height: number;
|
|
4430
|
-
/** Display width in pixels; omitted
|
|
4430
|
+
/** 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
4431
|
width?: number;
|
|
4432
4432
|
/** Logo placement. Defaults to bottom-right. */
|
|
4433
4433
|
position?: LogoPosition;
|
|
@@ -4441,8 +4441,8 @@ interface ChromeThemeOverride {
|
|
|
4441
4441
|
/** Font family override for this chrome element. */
|
|
4442
4442
|
fontFamily?: string;
|
|
4443
4443
|
/** Horizontal alignment of this chrome element. */
|
|
4444
|
-
|
|
4445
|
-
/** Text prepended for display while preserving the authored text. */
|
|
4444
|
+
align?: ChromeAlign;
|
|
4445
|
+
/** Text prepended for display while preserving the authored text. Applies to any chrome element. */
|
|
4446
4446
|
prefix?: string;
|
|
4447
4447
|
/** Text color. Accepts a TokenValue for light/dark pairs. */
|
|
4448
4448
|
color?: TokenValue;
|
|
@@ -9486,4 +9486,4 @@ declare const CSS_TOKEN_ROOT_SELECTORS: readonly string[];
|
|
|
9486
9486
|
declare const CSS_TOKENS: readonly CssTokenDef[];
|
|
9487
9487
|
declare function cssTokenDefault(name: string, mode: 'light' | 'dark'): string;
|
|
9488
9488
|
|
|
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 };
|
|
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 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
|
@@ -2420,6 +2420,27 @@ function matchLocale(tag) {
|
|
|
2420
2420
|
return Object.hasOwn(aliases, lower) ? aliases[lower] : null;
|
|
2421
2421
|
}
|
|
2422
2422
|
|
|
2423
|
+
// src/theme/ramps.ts
|
|
2424
|
+
function isRampStop(stop) {
|
|
2425
|
+
if (typeof stop === "string") return true;
|
|
2426
|
+
if (!stop || typeof stop !== "object") return false;
|
|
2427
|
+
const pair = stop;
|
|
2428
|
+
return typeof pair.light === "string" && typeof pair.dark === "string";
|
|
2429
|
+
}
|
|
2430
|
+
function sanitizeRamps(kind, ramps, warn) {
|
|
2431
|
+
const clean2 = {};
|
|
2432
|
+
for (const [name, stops] of Object.entries(ramps)) {
|
|
2433
|
+
const usable = Array.isArray(stops) ? stops.filter(isRampStop) : [];
|
|
2434
|
+
if (warn && (!Array.isArray(stops) || usable.length !== stops.length)) {
|
|
2435
|
+
console.warn(
|
|
2436
|
+
`[openchart] colors.${kind}.${name}: ramps must be arrays of color strings or { light, dark } pairs; ignoring invalid ${Array.isArray(stops) ? "stops" : "ramp"}.`
|
|
2437
|
+
);
|
|
2438
|
+
}
|
|
2439
|
+
if (usable.length > 0) clean2[name] = usable;
|
|
2440
|
+
}
|
|
2441
|
+
return clean2;
|
|
2442
|
+
}
|
|
2443
|
+
|
|
2423
2444
|
// src/theme/resolve.ts
|
|
2424
2445
|
function resolveTokenLight(v) {
|
|
2425
2446
|
return typeof v === "string" ? v : v.light;
|
|
@@ -2437,21 +2458,16 @@ function themeConfigToPartial(config, base2) {
|
|
|
2437
2458
|
colors.categorical = config.colors.categorical.map(resolveTokenLight);
|
|
2438
2459
|
if (config.colors.categoricalFill)
|
|
2439
2460
|
colors.categoricalFill = config.colors.categoricalFill.map(resolveTokenLight);
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
Object.entries(config.colors.diverging).map(([name, stops]) => [
|
|
2451
|
-
name,
|
|
2452
|
-
stops.map(resolveTokenLight)
|
|
2453
|
-
])
|
|
2454
|
-
);
|
|
2461
|
+
for (const kind of ["sequential", "diverging"]) {
|
|
2462
|
+
const authored = config.colors[kind];
|
|
2463
|
+
if (authored && typeof authored === "object") {
|
|
2464
|
+
colors[kind] = Object.fromEntries(
|
|
2465
|
+
Object.entries(sanitizeRamps(kind, authored, true)).map(([name, stops]) => [
|
|
2466
|
+
name,
|
|
2467
|
+
stops.map(resolveTokenLight)
|
|
2468
|
+
])
|
|
2469
|
+
);
|
|
2470
|
+
}
|
|
2455
2471
|
}
|
|
2456
2472
|
if (config.colors.background) colors.background = resolveTokenLight(config.colors.background);
|
|
2457
2473
|
if (config.colors.text) colors.text = resolveTokenLight(config.colors.text);
|
|
@@ -2537,7 +2553,7 @@ function themeConfigToPartial(config, base2) {
|
|
|
2537
2553
|
if (obj.fontWeight !== void 0) override.fontWeight = obj.fontWeight;
|
|
2538
2554
|
if (obj.lineHeight !== void 0) override.lineHeight = obj.lineHeight;
|
|
2539
2555
|
if (obj.fontFamily !== void 0) override.fontFamily = obj.fontFamily;
|
|
2540
|
-
if (obj.
|
|
2556
|
+
if (obj.align !== void 0) override.align = obj.align;
|
|
2541
2557
|
if (obj.prefix !== void 0) override.prefix = obj.prefix;
|
|
2542
2558
|
chrome[element] = override;
|
|
2543
2559
|
}
|
|
@@ -2616,9 +2632,9 @@ function collectRampPairs(config) {
|
|
|
2616
2632
|
const result = {};
|
|
2617
2633
|
for (const kind of ["sequential", "diverging"]) {
|
|
2618
2634
|
const ramps = config.colors[kind];
|
|
2619
|
-
if (ramps) {
|
|
2635
|
+
if (ramps && typeof ramps === "object") {
|
|
2620
2636
|
result[kind] = Object.fromEntries(
|
|
2621
|
-
Object.entries(ramps).map(([name, stops]) => [
|
|
2637
|
+
Object.entries(sanitizeRamps(kind, ramps, false)).map(([name, stops]) => [
|
|
2622
2638
|
name,
|
|
2623
2639
|
stops.map((stop) => typeof stop === "string" ? void 0 : stop)
|
|
2624
2640
|
])
|
|
@@ -2794,7 +2810,7 @@ function resolveChromeLogo(logo, width, padding) {
|
|
|
2794
2810
|
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
2811
|
return void 0;
|
|
2796
2812
|
const intrinsic = readLogoSize(logo.src);
|
|
2797
|
-
const logoWidth = intrinsic ? logo.height * intrinsic.width / intrinsic.height : logo.
|
|
2813
|
+
const logoWidth = logo.width ?? (intrinsic ? logo.height * intrinsic.width / intrinsic.height : logo.height);
|
|
2798
2814
|
const availableWidth = width - padding * 2;
|
|
2799
2815
|
if (!Number.isFinite(logoWidth) || logoWidth <= 0 || availableWidth <= 0) return void 0;
|
|
2800
2816
|
const scale2 = Math.min(1, availableWidth / logoWidth);
|
|
@@ -2875,7 +2891,7 @@ function buildTextStyle(defaults, fontFamily, textColor, width, overrides, extra
|
|
|
2875
2891
|
fontWeight: overrides?.fontWeight ?? defaults.fontWeight,
|
|
2876
2892
|
fill: overrides?.color ?? textColor ?? defaults.color,
|
|
2877
2893
|
lineHeight: defaults.lineHeight,
|
|
2878
|
-
textAnchor: defaults.
|
|
2894
|
+
textAnchor: defaults.align === "center" ? "middle" : defaults.align === "right" ? "end" : "start"
|
|
2879
2895
|
};
|
|
2880
2896
|
}
|
|
2881
2897
|
function estimateLineCount(text, style, maxWidth, measureText, maxLines) {
|
|
@@ -2996,10 +3012,10 @@ function computeChrome(chrome, theme, width, measureTextFn, chromeMode = "full",
|
|
|
2996
3012
|
let ruleElement;
|
|
2997
3013
|
if (theme.rule && (eyebrowNorm || titleNormPeek || subtitleNormPeek)) {
|
|
2998
3014
|
const { x, textAnchor } = alignChromeText(
|
|
2999
|
-
theme.chrome.title.
|
|
3015
|
+
theme.chrome.title.align,
|
|
3000
3016
|
topWidth,
|
|
3001
3017
|
pad,
|
|
3002
|
-
theme.chrome.title.
|
|
3018
|
+
theme.chrome.title.align ? titleNormPeek?.offset?.dx : 0
|
|
3003
3019
|
);
|
|
3004
3020
|
ruleElement = {
|
|
3005
3021
|
x: x - (textAnchor === "middle" ? theme.rule.width / 2 : textAnchor === "end" ? theme.rule.width : 0),
|
|
@@ -3031,7 +3047,7 @@ function computeChrome(chrome, theme, width, measureTextFn, chromeMode = "full",
|
|
|
3031
3047
|
text: eyebrowNorm.text,
|
|
3032
3048
|
...prefix,
|
|
3033
3049
|
...eyebrowNorm.href ? { href: eyebrowNorm.href } : {},
|
|
3034
|
-
x: alignChromeText(theme.chrome.eyebrow.
|
|
3050
|
+
x: alignChromeText(theme.chrome.eyebrow.align, topWidth, pad, eyebrowNorm.offset?.dx).x,
|
|
3035
3051
|
y: topY + (eyebrowNorm.offset?.dy ?? 0),
|
|
3036
3052
|
maxWidth: topMaxWidth,
|
|
3037
3053
|
...maxLines != null ? { maxLines } : {},
|
|
@@ -3063,7 +3079,7 @@ function computeChrome(chrome, theme, width, measureTextFn, chromeMode = "full",
|
|
|
3063
3079
|
text: titleNorm.text,
|
|
3064
3080
|
...prefix,
|
|
3065
3081
|
...titleNorm.href ? { href: titleNorm.href } : {},
|
|
3066
|
-
x: alignChromeText(theme.chrome.title.
|
|
3082
|
+
x: alignChromeText(theme.chrome.title.align, topWidth, pad, titleNorm.offset?.dx).x,
|
|
3067
3083
|
y: topY + (titleNorm.offset?.dy ?? 0),
|
|
3068
3084
|
maxWidth: topMaxWidth,
|
|
3069
3085
|
...maxLines != null ? { maxLines } : {},
|
|
@@ -3094,7 +3110,7 @@ function computeChrome(chrome, theme, width, measureTextFn, chromeMode = "full",
|
|
|
3094
3110
|
text: subtitleNorm.text,
|
|
3095
3111
|
...prefix,
|
|
3096
3112
|
...subtitleNorm.href ? { href: subtitleNorm.href } : {},
|
|
3097
|
-
x: alignChromeText(theme.chrome.subtitle.
|
|
3113
|
+
x: alignChromeText(theme.chrome.subtitle.align, topWidth, pad, subtitleNorm.offset?.dx).x,
|
|
3098
3114
|
y: topY + (subtitleNorm.offset?.dy ?? 0),
|
|
3099
3115
|
maxWidth: topMaxWidth,
|
|
3100
3116
|
...maxLines != null ? { maxLines } : {},
|
|
@@ -3212,7 +3228,7 @@ function computeChrome(chrome, theme, width, measureTextFn, chromeMode = "full",
|
|
|
3212
3228
|
text: norm.text,
|
|
3213
3229
|
...prefix,
|
|
3214
3230
|
...norm.href ? { href: norm.href } : {},
|
|
3215
|
-
x: alignChromeText(theme.chrome[key].
|
|
3231
|
+
x: alignChromeText(theme.chrome[key].align, width, pad, norm.offset?.dx).x,
|
|
3216
3232
|
y: itemY,
|
|
3217
3233
|
maxWidth: available,
|
|
3218
3234
|
...norm.style?.maxLines != null ? { maxLines: norm.style.maxLines } : {},
|
|
@@ -3233,7 +3249,7 @@ function computeChrome(chrome, theme, width, measureTextFn, chromeMode = "full",
|
|
|
3233
3249
|
const inlineHeight = Math.max(inline.height, (brand?.y ?? startY) - startY + rowHeight);
|
|
3234
3250
|
const stackedHeight = full.height + (items.length ? chromeGap : 0) + rowHeight + Math.max(0, brandNorm?.offset?.dy ?? 0);
|
|
3235
3251
|
const allLeft = items.every(
|
|
3236
|
-
({ key }) => !theme.chrome[key].
|
|
3252
|
+
({ key }) => !theme.chrome[key].align || theme.chrome[key].align === "left"
|
|
3237
3253
|
);
|
|
3238
3254
|
const hasAttribution = !!brand || !!rightLogo.logo;
|
|
3239
3255
|
const stacked = items.length > 0 && (!allLeft || rightLogo.ownRow || hasAttribution && (inlineWidth < 40 || stackedHeight < inlineHeight));
|
|
@@ -3982,9 +3998,10 @@ function localeTag(locale) {
|
|
|
3982
3998
|
if (locale === void 0 || locale === "en-US" || typeof locale !== "string") return "en-US";
|
|
3983
3999
|
const cached = LOCALE_TAGS.get(locale);
|
|
3984
4000
|
if (cached) return cached;
|
|
3985
|
-
const
|
|
3986
|
-
|
|
3987
|
-
|
|
4001
|
+
const matched = matchLocale(locale);
|
|
4002
|
+
if (!matched) return "en-US";
|
|
4003
|
+
LOCALE_TAGS.set(locale, matched);
|
|
4004
|
+
return matched;
|
|
3988
4005
|
}
|
|
3989
4006
|
function getNumberLocale(locale) {
|
|
3990
4007
|
if (locale === void 0 || locale === "en-US") return DEFAULT_NUMBER_LOCALE;
|
|
@@ -4058,7 +4075,10 @@ function formatNumber(value, locale) {
|
|
|
4058
4075
|
return numberFormatter(FORMAT_DECIMAL, ",.2f", locale)(value);
|
|
4059
4076
|
}
|
|
4060
4077
|
function formatRawNumber(value, locale) {
|
|
4061
|
-
|
|
4078
|
+
const tag = localeTag(locale);
|
|
4079
|
+
const { decimal, minus } = LOCALE_DEFINITIONS[tag].number;
|
|
4080
|
+
const text = String(value).replace(".", decimal);
|
|
4081
|
+
return tag !== "en-US" && text.startsWith("-") ? minus + text.slice(1) : text;
|
|
4062
4082
|
}
|
|
4063
4083
|
var UNIT_TABLE = [
|
|
4064
4084
|
{ threshold: 1e12, suffix: "T", divisor: 1e12 },
|