@opendata-ai/openchart-core 6.4.1 → 6.5.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 +102 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -764
- package/package.json +3 -2
- package/src/styles/animation.css +117 -0
- package/src/styles/base.css +53 -0
- package/src/styles/chrome.css +36 -0
- package/src/styles/dark.css +20 -0
- package/src/styles/graph.css +106 -0
- package/src/styles/index.css +22 -0
- package/src/styles/keyframes.css +120 -0
- package/src/styles/legend.css +16 -0
- package/src/styles/reduced-motion.css +44 -0
- package/src/styles/table-animation.css +91 -0
- package/src/styles/table.css +380 -0
- package/src/styles/tokens.css +93 -0
- package/src/styles/tooltip.css +88 -0
- package/src/types/index.ts +6 -0
- package/src/types/layout.ts +46 -0
- package/src/types/spec.ts +69 -0
- package/src/styles/viz.css +0 -764
package/dist/index.d.ts
CHANGED
|
@@ -638,6 +638,53 @@ interface SeriesStyle {
|
|
|
638
638
|
/** Opacity override (0-1). */
|
|
639
639
|
opacity?: number;
|
|
640
640
|
}
|
|
641
|
+
/**
|
|
642
|
+
* Named easing presets for entrance animations.
|
|
643
|
+
* Uses CSS linear() curves. Named 'ease' (not 'easing') to match Vega convention.
|
|
644
|
+
*/
|
|
645
|
+
type AnimationEase = 'smooth' | 'snappy';
|
|
646
|
+
/** Stagger configuration for sequential element reveal. */
|
|
647
|
+
interface AnimationStagger {
|
|
648
|
+
/** Delay between each element in ms. Default: 80 */
|
|
649
|
+
delay?: number;
|
|
650
|
+
/** Ordering strategy. Default: 'index' (DOM order) */
|
|
651
|
+
order?: 'index' | 'value' | 'reverse';
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Animation phase config. Follows Vega's enter/update/exit model.
|
|
655
|
+
* Each phase can be true (use defaults) or a config object.
|
|
656
|
+
*/
|
|
657
|
+
interface AnimationPhaseConfig {
|
|
658
|
+
/** Duration in ms. Default: 500 for enter. */
|
|
659
|
+
duration?: number;
|
|
660
|
+
/** Easing preset. Default: 'smooth'. */
|
|
661
|
+
ease?: AnimationEase;
|
|
662
|
+
/** Stagger config. true = defaults, false = no stagger. Default: true for enter. */
|
|
663
|
+
stagger?: AnimationStagger | boolean;
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Full animation config object. Structured as enter/update/exit phases
|
|
667
|
+
* following Vega's encoding set model.
|
|
668
|
+
*
|
|
669
|
+
* v1 implements enter only. update and exit reserved for v2.
|
|
670
|
+
*/
|
|
671
|
+
interface AnimationConfig {
|
|
672
|
+
/** Entrance animation when chart first renders. */
|
|
673
|
+
enter?: AnimationPhaseConfig | boolean;
|
|
674
|
+
/** Transition animation when data updates. Reserved for v2. */
|
|
675
|
+
update?: AnimationPhaseConfig | boolean;
|
|
676
|
+
/** Exit animation when marks are removed. Reserved for v2. */
|
|
677
|
+
exit?: AnimationPhaseConfig | boolean;
|
|
678
|
+
/** Delay before annotations animate in (ms after marks). Default: 200. */
|
|
679
|
+
annotationDelay?: number;
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Animation spec property.
|
|
683
|
+
* - true: enable entrance animation with sensible defaults
|
|
684
|
+
* - false/omitted: no animation (current behavior)
|
|
685
|
+
* - AnimationConfig: full control via enter/update/exit phases
|
|
686
|
+
*/
|
|
687
|
+
type AnimationSpec = boolean | AnimationConfig;
|
|
641
688
|
/**
|
|
642
689
|
* Breakpoint-conditional overrides for chart specs.
|
|
643
690
|
*
|
|
@@ -654,6 +701,8 @@ interface ChartSpecOverride {
|
|
|
654
701
|
legend?: LegendConfig;
|
|
655
702
|
/** Override annotations at this breakpoint. */
|
|
656
703
|
annotations?: Annotation[];
|
|
704
|
+
/** Override animation at this breakpoint. */
|
|
705
|
+
animation?: AnimationSpec;
|
|
657
706
|
}
|
|
658
707
|
/**
|
|
659
708
|
* Chart specification: the primary input for standard chart types.
|
|
@@ -699,6 +748,13 @@ interface ChartSpec {
|
|
|
699
748
|
* are shallow-merged into the spec before layout computation.
|
|
700
749
|
*/
|
|
701
750
|
overrides?: Partial<Record<Breakpoint, ChartSpecOverride>>;
|
|
751
|
+
/**
|
|
752
|
+
* Animation configuration.
|
|
753
|
+
* - true: enable entrance animation with sensible defaults
|
|
754
|
+
* - false/omitted: no animation (current behavior)
|
|
755
|
+
* - AnimationConfig: full control via enter/update/exit phases
|
|
756
|
+
*/
|
|
757
|
+
animation?: AnimationSpec;
|
|
702
758
|
}
|
|
703
759
|
/**
|
|
704
760
|
* Table specification: input for data table visualizations.
|
|
@@ -733,6 +789,8 @@ interface TableSpec {
|
|
|
733
789
|
compact?: boolean;
|
|
734
790
|
/** Whether the table adapts to container width. Defaults to true. */
|
|
735
791
|
responsive?: boolean;
|
|
792
|
+
/** Animation configuration for entrance animations. */
|
|
793
|
+
animation?: AnimationSpec;
|
|
736
794
|
}
|
|
737
795
|
/** Graph node: must have an id, plus arbitrary data fields. */
|
|
738
796
|
interface GraphNode {
|
|
@@ -834,6 +892,8 @@ interface LayerSpec {
|
|
|
834
892
|
resolve?: ResolveConfig;
|
|
835
893
|
/** Hidden series names. */
|
|
836
894
|
hiddenSeries?: string[];
|
|
895
|
+
/** Animation configuration. */
|
|
896
|
+
animation?: AnimationSpec;
|
|
837
897
|
}
|
|
838
898
|
/**
|
|
839
899
|
* Top-level visualization spec: union discriminated by structural shape.
|
|
@@ -1518,6 +1578,8 @@ interface LineMark {
|
|
|
1518
1578
|
label?: ResolvedLabel;
|
|
1519
1579
|
/** Accessibility attributes. */
|
|
1520
1580
|
aria: MarkAria;
|
|
1581
|
+
/** Index for stagger animation ordering. */
|
|
1582
|
+
animationIndex?: number;
|
|
1521
1583
|
}
|
|
1522
1584
|
/**
|
|
1523
1585
|
* Area mark: a filled region bounded by a top line and a baseline.
|
|
@@ -1557,6 +1619,8 @@ interface AreaMark {
|
|
|
1557
1619
|
}>;
|
|
1558
1620
|
/** Accessibility attributes. */
|
|
1559
1621
|
aria: MarkAria;
|
|
1622
|
+
/** Index for stagger animation ordering. */
|
|
1623
|
+
animationIndex?: number;
|
|
1560
1624
|
}
|
|
1561
1625
|
/**
|
|
1562
1626
|
* Rect mark: a rectangle.
|
|
@@ -1586,6 +1650,14 @@ interface RectMark {
|
|
|
1586
1650
|
label?: ResolvedLabel;
|
|
1587
1651
|
/** Accessibility attributes. */
|
|
1588
1652
|
aria: MarkAria;
|
|
1653
|
+
/** Index for stagger animation ordering. */
|
|
1654
|
+
animationIndex?: number;
|
|
1655
|
+
/** Bar orientation for animation direction. Set by the engine based on encoding. */
|
|
1656
|
+
orient?: 'horizontal' | 'vertical';
|
|
1657
|
+
/** Stacking group key (e.g. category name). Segments sharing this key animate together. */
|
|
1658
|
+
stackGroup?: string;
|
|
1659
|
+
/** Position of this segment within its stack group (0, 1, 2...). Set by engine for stacked bars. */
|
|
1660
|
+
stackPos?: number;
|
|
1589
1661
|
}
|
|
1590
1662
|
/**
|
|
1591
1663
|
* Arc mark: a pie/donut slice.
|
|
@@ -1619,6 +1691,8 @@ interface ArcMark {
|
|
|
1619
1691
|
label?: ResolvedLabel;
|
|
1620
1692
|
/** Accessibility attributes. */
|
|
1621
1693
|
aria: MarkAria;
|
|
1694
|
+
/** Index for stagger animation ordering. */
|
|
1695
|
+
animationIndex?: number;
|
|
1622
1696
|
}
|
|
1623
1697
|
/**
|
|
1624
1698
|
* Point mark: a circle or dot.
|
|
@@ -1646,6 +1720,8 @@ interface PointMark {
|
|
|
1646
1720
|
label?: ResolvedLabel;
|
|
1647
1721
|
/** Accessibility attributes. */
|
|
1648
1722
|
aria: MarkAria;
|
|
1723
|
+
/** Index for stagger animation ordering. */
|
|
1724
|
+
animationIndex?: number;
|
|
1649
1725
|
}
|
|
1650
1726
|
/**
|
|
1651
1727
|
* Text mark: data-positioned text label.
|
|
@@ -1677,6 +1753,8 @@ interface TextMarkLayout {
|
|
|
1677
1753
|
label?: ResolvedLabel;
|
|
1678
1754
|
/** Accessibility attributes. */
|
|
1679
1755
|
aria: MarkAria;
|
|
1756
|
+
/** Index for stagger animation ordering. */
|
|
1757
|
+
animationIndex?: number;
|
|
1680
1758
|
}
|
|
1681
1759
|
/**
|
|
1682
1760
|
* Rule mark: a line segment between two points.
|
|
@@ -1704,6 +1782,8 @@ interface RuleMarkLayout {
|
|
|
1704
1782
|
data: Record<string, unknown>;
|
|
1705
1783
|
/** Accessibility attributes. */
|
|
1706
1784
|
aria: MarkAria;
|
|
1785
|
+
/** Index for stagger animation ordering. */
|
|
1786
|
+
animationIndex?: number;
|
|
1707
1787
|
}
|
|
1708
1788
|
/**
|
|
1709
1789
|
* Tick mark: a short line segment at a data coordinate.
|
|
@@ -1729,6 +1809,8 @@ interface TickMarkLayout {
|
|
|
1729
1809
|
data: Record<string, unknown>;
|
|
1730
1810
|
/** Accessibility attributes. */
|
|
1731
1811
|
aria: MarkAria;
|
|
1812
|
+
/** Index for stagger animation ordering. */
|
|
1813
|
+
animationIndex?: number;
|
|
1732
1814
|
}
|
|
1733
1815
|
/** Discriminated union of all mark types. */
|
|
1734
1816
|
type Mark = LineMark | AreaMark | RectMark | ArcMark | PointMark | TextMarkLayout | RuleMarkLayout | TickMarkLayout;
|
|
@@ -1846,6 +1928,21 @@ interface A11yMetadata {
|
|
|
1846
1928
|
/** Whether the visualization is keyboard-navigable. */
|
|
1847
1929
|
keyboardNavigable: boolean;
|
|
1848
1930
|
}
|
|
1931
|
+
/** Resolved entrance animation config with all defaults applied. */
|
|
1932
|
+
interface ResolvedAnimation {
|
|
1933
|
+
/** Whether entrance animation is enabled. */
|
|
1934
|
+
enabled: boolean;
|
|
1935
|
+
/** Duration in ms. */
|
|
1936
|
+
duration: number;
|
|
1937
|
+
/** Easing preset name. */
|
|
1938
|
+
ease: AnimationEase;
|
|
1939
|
+
/** Stagger delay between elements in ms. */
|
|
1940
|
+
staggerDelay: number;
|
|
1941
|
+
/** Stagger ordering. */
|
|
1942
|
+
staggerOrder: 'index' | 'value' | 'reverse';
|
|
1943
|
+
/** Delay before annotations animate in (ms after marks). */
|
|
1944
|
+
annotationDelay: number;
|
|
1945
|
+
}
|
|
1849
1946
|
/**
|
|
1850
1947
|
* ChartLayout: the complete engine output for chart visualizations.
|
|
1851
1948
|
*
|
|
@@ -1881,6 +1978,8 @@ interface ChartLayout {
|
|
|
1881
1978
|
width: number;
|
|
1882
1979
|
height: number;
|
|
1883
1980
|
};
|
|
1981
|
+
/** Resolved animation config. Present only when animation is enabled. */
|
|
1982
|
+
animation?: ResolvedAnimation;
|
|
1884
1983
|
}
|
|
1885
1984
|
/** A resolved column definition with computed properties. */
|
|
1886
1985
|
interface ResolvedColumn {
|
|
@@ -2039,6 +2138,8 @@ interface TableLayout {
|
|
|
2039
2138
|
};
|
|
2040
2139
|
/** The resolved theme. */
|
|
2041
2140
|
theme: ResolvedTheme;
|
|
2141
|
+
/** Resolved animation config. Present only when animation is enabled. */
|
|
2142
|
+
animation?: ResolvedAnimation;
|
|
2042
2143
|
}
|
|
2043
2144
|
/** A resolved graph node with computed position and visual properties. */
|
|
2044
2145
|
interface GraphNodeLayout {
|
|
@@ -2685,4 +2786,4 @@ declare function scatterChart(data: DataRow[], x: FieldRef, y: FieldRef, options
|
|
|
2685
2786
|
*/
|
|
2686
2787
|
declare function dataTable(data: DataRow[], options?: TableBuilderOptions): TableSpec;
|
|
2687
2788
|
|
|
2688
|
-
export { type A11yMetadata, type AggregateOp, type Annotation, type AnnotationAnchor, type AnnotationOffset, type AnnotationPosition, type ArcMark, type AreaMark, type AxisConfig, type AxisLabelDensity, type AxisLayout, type AxisTick, BRAND_FONT_SIZE, BRAND_MIN_WIDTH, BRAND_RESERVE_WIDTH, type BarColumnConfig, type BarTableCell, type BinParams, type BinTransform, type Breakpoint, CATEGORICAL_PALETTE, CHART_ENCODING_RULES, CHART_TYPES, type CalculateExpression, type CalculateTransform, type CategoricalPalette, type CategoryColorsConfig, type CategoryTableCell, type CellStyle, type ChannelRule, type ChartBuilderOptions, type ChartEventHandlers, type ChartLayout, type ChartSpec, type ChartSpecOverride, type ChartSpecWithoutData, type ChartType, type Chrome, type ChromeDefaults, type ChromeKey, type ChromeMode, type ChromeText, type ChromeTextStyle, type ColorBlindnessType, type ColumnConfig, type CompileOptions, type CompileTableOptions, type Condition, type ConditionalValueDef, DEFAULT_THEME, DIVERGING_PALETTES, type DarkMode, type DataRow, type DateGranularity, type DivergingPalette, EXTENDED_OFFSET_STRATEGIES, type ElementEdit, type ElementRef, type Encoding, type EncodingChannel, type EncodingRule, type FieldPredicate, type FieldRef, type FieldType, type FilterPredicate, type FilterTransform, type FlagTableCell, GRAPH_ENCODING_RULES, type GraphChannelRule, type GraphEdge, type GraphEdgeLayout, type GraphEncoding, type GraphEncodingChannel, type GraphLayout, type GraphLayoutConfig, type GraphNode, type GraphNodeLayout, type GraphSpec, type GraphSpecWithoutData, type Gridline, type HeatmapColumnConfig, type HeatmapTableCell, type HeightClass, type ImageColumnConfig, type ImageTableCell, type LabelCandidate, type LabelConfig, type LabelDensity, type LabelMode, type LabelPriority, type LayerSpec, type LayoutStrategy, type LegendConfig, type LegendEntry, type LegendLayout, type LegendPosition, type LineMark, type LogicalAnd, type LogicalNot, type LogicalOr, MARK_DISPLAY_NAMES, MARK_ENCODING_RULES, MARK_TYPES, type Margins, type Mark, type MarkAria, type MarkDef, type MarkEvent, type MarkType, type MeasureTextFn, type NodeOverride, OFFSET_STRATEGIES, type OffsetStrategy, type PaginationState, type Point, type PointMark, type RangeAnnotation, type Rect, type RectMark, type RefLineAnnotation, type ResolveConfig, type ResolveMode, type ResolvedAnnotation, type ResolvedChrome, type ResolvedChromeElement, type ResolvedColumn, type ResolvedLabel, type ResolvedTheme, type RuleMarkLayout, SEQUENTIAL_PALETTES, type ScaleConfig, type ScaleType, type SequentialPalette, type SeriesStyle, type SortState, type SparklineColumnConfig, type SparklineData, type SparklineTableCell, type StoredVizSpec, type TableBuilderOptions, type TableCell, type TableCellBase, type TableLayout, type TableRow, type TableSpec, type TableSpecWithoutData, type TextAnnotation, type TextMarkLayout, type TextStyle, type TextTableCell, type Theme, type ThemeChromeDefaults, type ThemeColors, type ThemeConfig, type ThemeFontSizes, type ThemeFontWeights, type ThemeFonts, type ThemeSpacing, type TickMarkLayout, type TimeUnit, type TimeUnitTransform, type TooltipContent, type TooltipField, type Transform, type VizSpec, abbreviateNumber, adaptColorForDarkMode, adaptTheme, areaChart, barChart, buildD3Formatter, buildTemporalFormatter, checkPaletteDistinguishability, columnChart, computeChrome, computeLabelBounds, contrastRatio, dataTable, detectCollision, donutChart, dotChart, elementRef, estimateTextWidth, findAccessibleColor, formatDate, formatNumber, generateAltText, generateAriaLabels, generateDataTable, getBreakpoint, getHeightClass, getLayoutStrategy, inferFieldType, isChartSpec, isConditionalDef, isEncodingChannel, isGraphSpec, isLayerSpec, isRangeAnnotation, isRefLineAnnotation, isTableSpec, isTextAnnotation, lineChart, meetsAA, pieChart, resolveCollisions, resolveMarkDef, resolveMarkType, resolveTheme, scatterChart, simulateColorBlindness };
|
|
2789
|
+
export { type A11yMetadata, type AggregateOp, type AnimationConfig, type AnimationEase, type AnimationPhaseConfig, type AnimationSpec, type AnimationStagger, type Annotation, type AnnotationAnchor, type AnnotationOffset, type AnnotationPosition, type ArcMark, type AreaMark, type AxisConfig, type AxisLabelDensity, type AxisLayout, type AxisTick, BRAND_FONT_SIZE, BRAND_MIN_WIDTH, BRAND_RESERVE_WIDTH, type BarColumnConfig, type BarTableCell, type BinParams, type BinTransform, type Breakpoint, CATEGORICAL_PALETTE, CHART_ENCODING_RULES, CHART_TYPES, type CalculateExpression, type CalculateTransform, type CategoricalPalette, type CategoryColorsConfig, type CategoryTableCell, type CellStyle, type ChannelRule, type ChartBuilderOptions, type ChartEventHandlers, type ChartLayout, type ChartSpec, type ChartSpecOverride, type ChartSpecWithoutData, type ChartType, type Chrome, type ChromeDefaults, type ChromeKey, type ChromeMode, type ChromeText, type ChromeTextStyle, type ColorBlindnessType, type ColumnConfig, type CompileOptions, type CompileTableOptions, type Condition, type ConditionalValueDef, DEFAULT_THEME, DIVERGING_PALETTES, type DarkMode, type DataRow, type DateGranularity, type DivergingPalette, EXTENDED_OFFSET_STRATEGIES, type ElementEdit, type ElementRef, type Encoding, type EncodingChannel, type EncodingRule, type FieldPredicate, type FieldRef, type FieldType, type FilterPredicate, type FilterTransform, type FlagTableCell, GRAPH_ENCODING_RULES, type GraphChannelRule, type GraphEdge, type GraphEdgeLayout, type GraphEncoding, type GraphEncodingChannel, type GraphLayout, type GraphLayoutConfig, type GraphNode, type GraphNodeLayout, type GraphSpec, type GraphSpecWithoutData, type Gridline, type HeatmapColumnConfig, type HeatmapTableCell, type HeightClass, type ImageColumnConfig, type ImageTableCell, type LabelCandidate, type LabelConfig, type LabelDensity, type LabelMode, type LabelPriority, type LayerSpec, type LayoutStrategy, type LegendConfig, type LegendEntry, type LegendLayout, type LegendPosition, type LineMark, type LogicalAnd, type LogicalNot, type LogicalOr, MARK_DISPLAY_NAMES, MARK_ENCODING_RULES, MARK_TYPES, type Margins, type Mark, type MarkAria, type MarkDef, type MarkEvent, type MarkType, type MeasureTextFn, type NodeOverride, OFFSET_STRATEGIES, type OffsetStrategy, type PaginationState, type Point, type PointMark, type RangeAnnotation, type Rect, type RectMark, type RefLineAnnotation, type ResolveConfig, type ResolveMode, type ResolvedAnimation, type ResolvedAnnotation, type ResolvedChrome, type ResolvedChromeElement, type ResolvedColumn, type ResolvedLabel, type ResolvedTheme, type RuleMarkLayout, SEQUENTIAL_PALETTES, type ScaleConfig, type ScaleType, type SequentialPalette, type SeriesStyle, type SortState, type SparklineColumnConfig, type SparklineData, type SparklineTableCell, type StoredVizSpec, type TableBuilderOptions, type TableCell, type TableCellBase, type TableLayout, type TableRow, type TableSpec, type TableSpecWithoutData, type TextAnnotation, type TextMarkLayout, type TextStyle, type TextTableCell, type Theme, type ThemeChromeDefaults, type ThemeColors, type ThemeConfig, type ThemeFontSizes, type ThemeFontWeights, type ThemeFonts, type ThemeSpacing, type TickMarkLayout, type TimeUnit, type TimeUnitTransform, type TooltipContent, type TooltipField, type Transform, type VizSpec, abbreviateNumber, adaptColorForDarkMode, adaptTheme, areaChart, barChart, buildD3Formatter, buildTemporalFormatter, checkPaletteDistinguishability, columnChart, computeChrome, computeLabelBounds, contrastRatio, dataTable, detectCollision, donutChart, dotChart, elementRef, estimateTextWidth, findAccessibleColor, formatDate, formatNumber, generateAltText, generateAriaLabels, generateDataTable, getBreakpoint, getHeightClass, getLayoutStrategy, inferFieldType, isChartSpec, isConditionalDef, isEncodingChannel, isGraphSpec, isLayerSpec, isRangeAnnotation, isRefLineAnnotation, isTableSpec, isTextAnnotation, lineChart, meetsAA, pieChart, resolveCollisions, resolveMarkDef, resolveMarkType, resolveTheme, scatterChart, simulateColorBlindness };
|