@blueprint-chart/lib 0.1.2

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.
Files changed (76) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +109 -0
  3. package/dist/charts/axis/axis-service.d.ts +55 -0
  4. package/dist/charts/axis/horizontal-axis.d.ts +58 -0
  5. package/dist/charts/axis/index.d.ts +4 -0
  6. package/dist/charts/axis/vertical-axis.d.ts +12 -0
  7. package/dist/charts/canvas/canvas.d.ts +45 -0
  8. package/dist/charts/chart-helpers.d.ts +3 -0
  9. package/dist/charts/colorblind.d.ts +34 -0
  10. package/dist/charts/contrast.d.ts +33 -0
  11. package/dist/charts/curves.d.ts +2 -0
  12. package/dist/charts/date-parse.d.ts +12 -0
  13. package/dist/charts/defaults/expectations.d.ts +2 -0
  14. package/dist/charts/defaults/helpers.d.ts +6 -0
  15. package/dist/charts/defaults/types.d.ts +61 -0
  16. package/dist/charts/format-helpers.d.ts +31 -0
  17. package/dist/charts/frame/frame.d.ts +8 -0
  18. package/dist/charts/index.d.ts +17 -0
  19. package/dist/charts/legend/legend-size.d.ts +5 -0
  20. package/dist/charts/legend/legend.d.ts +4 -0
  21. package/dist/charts/line-symbols.d.ts +9 -0
  22. package/dist/charts/motion.d.ts +45 -0
  23. package/dist/charts/palettes.d.ts +7 -0
  24. package/dist/charts/plugins/annotations/context.d.ts +17 -0
  25. package/dist/charts/plugins/annotations/direction-helpers.d.ts +14 -0
  26. package/dist/charts/plugins/annotations/free-renderer.d.ts +4 -0
  27. package/dist/charts/plugins/annotations/index.d.ts +10 -0
  28. package/dist/charts/plugins/annotations/point-renderer.d.ts +6 -0
  29. package/dist/charts/plugins/annotations/position-helpers.d.ts +2 -0
  30. package/dist/charts/plugins/annotations/range-renderer.d.ts +4 -0
  31. package/dist/charts/plugins/annotations/shared.d.ts +57 -0
  32. package/dist/charts/plugins/annotations/snapshots.d.ts +21 -0
  33. package/dist/charts/plugins/arc-labels.d.ts +53 -0
  34. package/dist/charts/plugins/crosshair.d.ts +10 -0
  35. package/dist/charts/plugins/proximity.d.ts +27 -0
  36. package/dist/charts/plugins/test-helpers.d.ts +1 -0
  37. package/dist/charts/plugins/tooltip.d.ts +6 -0
  38. package/dist/charts/plugins/value-labels.d.ts +6 -0
  39. package/dist/charts/registry.d.ts +5 -0
  40. package/dist/charts/resolve.d.ts +3 -0
  41. package/dist/charts/scale-helpers.d.ts +19 -0
  42. package/dist/charts/series-helpers.d.ts +10 -0
  43. package/dist/charts/stack-helpers.d.ts +17 -0
  44. package/dist/charts/transition-cache.d.ts +8 -0
  45. package/dist/charts/types/area/area.d.ts +3 -0
  46. package/dist/charts/types/area-stacked/area-stacked.d.ts +3 -0
  47. package/dist/charts/types/bar-grouped/bar-grouped.d.ts +3 -0
  48. package/dist/charts/types/bar-horizontal/bar-horizontal.d.ts +3 -0
  49. package/dist/charts/types/bar-multi/bar-multi.d.ts +3 -0
  50. package/dist/charts/types/bar-split/bar-split.d.ts +3 -0
  51. package/dist/charts/types/bar-stacked/bar-stacked.d.ts +3 -0
  52. package/dist/charts/types/bar-vertical/bar-vertical.d.ts +3 -0
  53. package/dist/charts/types/column-stacked/column-stacked.d.ts +3 -0
  54. package/dist/charts/types/donut/donut.d.ts +4 -0
  55. package/dist/charts/types/line/line.d.ts +3 -0
  56. package/dist/charts/types/line-multi/line-multi.d.ts +3 -0
  57. package/dist/charts/types/pie/pie.d.ts +2 -0
  58. package/dist/charts/types.d.ts +269 -0
  59. package/dist/dsl/converter.d.ts +50 -0
  60. package/dist/dsl/index.d.ts +3 -0
  61. package/dist/dsl/lexer.d.ts +8 -0
  62. package/dist/dsl/parser.d.ts +2 -0
  63. package/dist/dsl/serializer.d.ts +3 -0
  64. package/dist/dsl/types.d.ts +88 -0
  65. package/dist/enums.d.ts +193 -0
  66. package/dist/index.d.ts +27 -0
  67. package/dist/index.js +7088 -0
  68. package/dist/lib/lib.iife.js +186 -0
  69. package/dist/runtime/chart-css.d.ts +1 -0
  70. package/dist/runtime/index.d.ts +4 -0
  71. package/dist/runtime/runtime.d.ts +1 -0
  72. package/dist/runtime/scenes.d.ts +19 -0
  73. package/dist/runtime/steps.d.ts +3 -0
  74. package/dist/samples.d.ts +10 -0
  75. package/package.json +73 -0
  76. package/src/charts/chart.scss +481 -0
@@ -0,0 +1,50 @@
1
+ import { PropertyNode, DataNode, SceneNode, ColorizeNode, HighlightNode, AnnotationNode, SeriesNode, AreaFillNode } from './types';
2
+ import { ColorizeConfig, HighlightConfig, AnnotationConfig, AreaFillConfig, SeriesOverride } from '../charts/types';
3
+ /**
4
+ * Convert an array of AST property nodes into a key→value map.
5
+ */
6
+ export declare function propertyMap(properties: PropertyNode[]): Map<string, string | number | boolean>;
7
+ /**
8
+ * Extract typed chart-type options from AST properties by using the registry's
9
+ * option definitions to determine the correct type for each key.
10
+ */
11
+ export declare function extractChartTypeOptions(chartType: string, properties: PropertyNode[]): Record<string, unknown>;
12
+ export declare function dataEntriesToString(data: DataNode): string;
13
+ /**
14
+ * Extract scene overrides from a SceneNode, returning structured data
15
+ * suitable for applying scene-level configuration.
16
+ */
17
+ export declare function extractSceneOverrides(scene: SceneNode, chartType: string): {
18
+ name: string | null;
19
+ chartType: string | undefined;
20
+ properties: Map<string, string | number | boolean>;
21
+ data: DataNode | null;
22
+ chartTypeOptions: Record<string, unknown>;
23
+ colorizes: SceneNode['colorizes'];
24
+ highlights: SceneNode['highlights'];
25
+ areaFills: SceneNode['areaFills'];
26
+ annotations: SceneNode['annotations'];
27
+ annotationVisibility: SceneNode['annotationVisibility'];
28
+ series: SceneNode['series'];
29
+ transforms: SceneNode['transforms'];
30
+ };
31
+ /**
32
+ * Convert AST highlight nodes to ColorizeConfig objects.
33
+ */
34
+ export declare function convertColorizes(nodes: ColorizeNode[]): ColorizeConfig[];
35
+ /**
36
+ * Convert AST highlight nodes to HighlightConfig objects.
37
+ */
38
+ export declare function convertHighlights(nodes: HighlightNode[]): HighlightConfig[];
39
+ /**
40
+ * Convert AST area-fill nodes to AreaFillConfig objects.
41
+ */
42
+ export declare function convertAreaFills(nodes: AreaFillNode[]): AreaFillConfig[];
43
+ /**
44
+ * Convert AST annotation nodes to AnnotationConfig objects.
45
+ */
46
+ export declare function convertAnnotations(nodes: AnnotationNode[]): AnnotationConfig[];
47
+ /**
48
+ * Convert AST series nodes to SeriesOverride objects.
49
+ */
50
+ export declare function convertSeriesOverrides(nodes: SeriesNode[]): SeriesOverride[];
@@ -0,0 +1,3 @@
1
+ export { parse } from './parser';
2
+ export { serialize } from './serializer';
3
+ export type { AnnotationNode, AreaFillNode, ChartNode, DataNode, ColorizeNode, HighlightNode, PropertyNode, SceneNode, SeriesNode, StepNode, TransformNode } from './types';
@@ -0,0 +1,8 @@
1
+ export interface Token {
2
+ type: TokenType;
3
+ value: string;
4
+ line: number;
5
+ column: number;
6
+ }
7
+ export type TokenType = 'keyword' | 'string' | 'number' | 'percent' | 'lbrace' | 'rbrace' | 'equals' | 'tab' | 'identifier' | 'eof';
8
+ export declare function tokenize(input: string): Token[];
@@ -0,0 +1,2 @@
1
+ import { ChartNode } from './types';
2
+ export declare function parse(input: string): ChartNode;
@@ -0,0 +1,3 @@
1
+ import { ChartNode } from './types';
2
+ export declare function serialize(ast: ChartNode): string;
3
+ export declare function compactSerialize(ast: ChartNode): string;
@@ -0,0 +1,88 @@
1
+ import { DslNodeType, AnnotationKind, AnnotationAction } from '../enums';
2
+ export interface PropertyNode {
3
+ type: DslNodeType.Property;
4
+ key: string;
5
+ value: string | number;
6
+ isPercentage: boolean;
7
+ values?: (string | number)[];
8
+ }
9
+ export interface DataNode {
10
+ type: DslNodeType.Data;
11
+ entries: PropertyNode[];
12
+ }
13
+ export interface ColorizeNode {
14
+ type: DslNodeType.Colorize;
15
+ target: string;
16
+ properties: PropertyNode[];
17
+ }
18
+ export interface HighlightNode {
19
+ type: DslNodeType.Highlight;
20
+ target: string;
21
+ }
22
+ export interface AreaFillNode {
23
+ type: DslNodeType.AreaFill;
24
+ from: string;
25
+ to: string;
26
+ properties: PropertyNode[];
27
+ }
28
+ export interface PointAnnotationNode {
29
+ type: DslNodeType.Annotation;
30
+ kind: AnnotationKind.Point;
31
+ target: string;
32
+ properties: PropertyNode[];
33
+ }
34
+ export interface RangeAnnotationNode {
35
+ type: DslNodeType.Annotation;
36
+ kind: AnnotationKind.Range;
37
+ properties: PropertyNode[];
38
+ }
39
+ export interface FreeAnnotationNode {
40
+ type: DslNodeType.Annotation;
41
+ kind: AnnotationKind.Free;
42
+ properties: PropertyNode[];
43
+ }
44
+ export type AnnotationNode = PointAnnotationNode | RangeAnnotationNode | FreeAnnotationNode;
45
+ export interface SeriesNode {
46
+ type: DslNodeType.Series;
47
+ name: string;
48
+ properties: PropertyNode[];
49
+ }
50
+ export interface AnnotationVisibilityNode {
51
+ type: DslNodeType.AnnotationVisibility;
52
+ action: AnnotationAction;
53
+ kind: AnnotationKind;
54
+ id: string;
55
+ }
56
+ export interface SceneNode {
57
+ type: DslNodeType.Scene;
58
+ name: string | null;
59
+ properties: PropertyNode[];
60
+ data: DataNode | null;
61
+ colorizes: ColorizeNode[];
62
+ highlights: HighlightNode[];
63
+ areaFills: AreaFillNode[];
64
+ annotations: AnnotationNode[];
65
+ annotationVisibility: AnnotationVisibilityNode[];
66
+ series: SeriesNode[];
67
+ transforms: TransformNode[];
68
+ }
69
+ /** @deprecated Use SceneNode instead */
70
+ export type StepNode = SceneNode;
71
+ export interface TransformNode {
72
+ type: DslNodeType.Transform;
73
+ transformType: string;
74
+ properties: PropertyNode[];
75
+ }
76
+ export interface ChartNode {
77
+ type: DslNodeType.Chart;
78
+ chartType: string;
79
+ properties: PropertyNode[];
80
+ data: DataNode | null;
81
+ colorizes: ColorizeNode[];
82
+ highlights: HighlightNode[];
83
+ areaFills: AreaFillNode[];
84
+ annotations: AnnotationNode[];
85
+ series: SeriesNode[];
86
+ scenes: SceneNode[];
87
+ transforms: TransformNode[];
88
+ }
@@ -0,0 +1,193 @@
1
+ export declare enum ChartType {
2
+ BarVertical = "bar-vertical",
3
+ BarHorizontal = "bar-horizontal",
4
+ BarMulti = "bar-multi",
5
+ ColumnStacked = "column-stacked",
6
+ BarStacked = "bar-stacked",
7
+ BarSplit = "bar-split",
8
+ BarGrouped = "bar-grouped",
9
+ Line = "line",
10
+ LineMulti = "line-multi",
11
+ Area = "area",
12
+ AreaStacked = "area-stacked",
13
+ Donut = "donut",
14
+ Pie = "pie",
15
+ VerticalBar = "vertical-bar",
16
+ HorizontalBar = "horizontal-bar"
17
+ }
18
+ export declare enum AxisDirection {
19
+ Left = "left",
20
+ Right = "right"
21
+ }
22
+ export declare enum ScaleType {
23
+ Linear = "linear",
24
+ Log = "log"
25
+ }
26
+ export declare enum GridStyle {
27
+ Solid = "solid",
28
+ Dashed = "dashed",
29
+ Dotted = "dotted",
30
+ None = "none"
31
+ }
32
+ export declare enum LabelPosition {
33
+ Auto = "auto",
34
+ Inside = "inside",
35
+ Outside = "outside",
36
+ Off = "off"
37
+ }
38
+ export declare enum LabelRotation {
39
+ Auto = "auto",
40
+ Horizontal = "horizontal",
41
+ Vertical = "vertical"
42
+ }
43
+ export declare enum TickPosition {
44
+ Above = "above",
45
+ Below = "below"
46
+ }
47
+ export declare enum FrameSizing {
48
+ Auto = "auto",
49
+ Standard = "standard",
50
+ AspectRatio = "aspect-ratio"
51
+ }
52
+ export declare enum CompassDirection {
53
+ NW = "NW",
54
+ N = "N",
55
+ NE = "NE",
56
+ E = "E",
57
+ SE = "SE",
58
+ S = "S",
59
+ SW = "SW",
60
+ W = "W",
61
+ Center = "center"
62
+ }
63
+ export declare enum AnnotationLineStyle {
64
+ Direct = "direct",
65
+ CurveLeft = "curve-left",
66
+ CurveRight = "curve-right",
67
+ Elbow = "elbow"
68
+ }
69
+ export declare enum StrokeStyle {
70
+ Solid = "solid",
71
+ Dotted = "dotted",
72
+ Dashed = "dashed"
73
+ }
74
+ export declare enum AnnotationKind {
75
+ Point = "point",
76
+ Range = "range",
77
+ Free = "free"
78
+ }
79
+ export declare enum AnnotationAction {
80
+ Hide = "hide",
81
+ Show = "show"
82
+ }
83
+ export declare enum RangeAnchor {
84
+ Start = "start",
85
+ Center = "center",
86
+ End = "end"
87
+ }
88
+ export declare enum Orientation {
89
+ Vertical = "vertical",
90
+ Horizontal = "horizontal"
91
+ }
92
+ export declare enum SymbolShape {
93
+ Circle = "circle",
94
+ Square = "square",
95
+ Diamond = "diamond",
96
+ Triangle = "triangle",
97
+ TriangleDown = "triangleDown",
98
+ Cross = "cross",
99
+ Star = "star"
100
+ }
101
+ export declare enum SymbolShowOn {
102
+ All = "all",
103
+ First = "first",
104
+ Last = "last",
105
+ FirstLast = "firstLast"
106
+ }
107
+ export declare enum SymbolStyle {
108
+ Filled = "filled",
109
+ Hollow = "hollow"
110
+ }
111
+ export declare enum SortDirection {
112
+ Ascending = "ascending",
113
+ Descending = "descending",
114
+ None = "none"
115
+ }
116
+ export declare enum SortMode {
117
+ Total = "total",
118
+ WithinGroups = "within-groups",
119
+ None = "none"
120
+ }
121
+ export declare enum LegendPosition {
122
+ Top = "top",
123
+ Bottom = "bottom",
124
+ Left = "left",
125
+ Right = "right"
126
+ }
127
+ export declare enum Anchor {
128
+ Start = "start",
129
+ Middle = "middle",
130
+ End = "end"
131
+ }
132
+ export declare enum ValueLabelPosition {
133
+ Inside = "inside",
134
+ Outside = "outside",
135
+ Auto = "auto"
136
+ }
137
+ export declare enum CrosshairDirection {
138
+ Both = "both",
139
+ Vertical = "vertical",
140
+ Horizontal = "horizontal"
141
+ }
142
+ export declare enum CrosshairStyle {
143
+ Solid = "solid",
144
+ Dashed = "dashed",
145
+ Dotted = "dotted"
146
+ }
147
+ export declare enum StackMode {
148
+ Normal = "normal",
149
+ Percent = "percent"
150
+ }
151
+ export declare enum LineStyle {
152
+ Solid = "solid",
153
+ Dashed = "dashed",
154
+ Dotted = "dotted",
155
+ None = "none"
156
+ }
157
+ export declare enum ChartOptionType {
158
+ Colors = "colors",
159
+ Boolean = "boolean",
160
+ Select = "select",
161
+ Text = "text",
162
+ NumberFormat = "numberFormat",
163
+ DateFormat = "dateFormat"
164
+ }
165
+ export declare enum DirectLabelMode {
166
+ Off = "",
167
+ Auto = "auto",
168
+ Outside = "outside",
169
+ Inside = "inside"
170
+ }
171
+ export declare enum Interpolation {
172
+ Linear = "linear",
173
+ MonotoneX = "monotoneX",
174
+ Step = "step",
175
+ StepBefore = "stepBefore",
176
+ StepAfter = "stepAfter",
177
+ Basis = "basis",
178
+ Cardinal = "cardinal",
179
+ CatmullRom = "catmullRom"
180
+ }
181
+ export declare enum DslNodeType {
182
+ Property = "property",
183
+ Data = "data",
184
+ Colorize = "colorize",
185
+ Highlight = "highlight",
186
+ AreaFill = "areafill",
187
+ Annotation = "annotation",
188
+ Series = "series",
189
+ AnnotationVisibility = "annotation-visibility",
190
+ Scene = "scene",
191
+ Transform = "transform",
192
+ Chart = "chart"
193
+ }
@@ -0,0 +1,27 @@
1
+ export { ChartType, AxisDirection, ScaleType, GridStyle, LabelPosition, LabelRotation, TickPosition, FrameSizing, CompassDirection, AnnotationLineStyle, StrokeStyle, AnnotationKind, AnnotationAction, RangeAnchor, Orientation, SymbolShape, SymbolShowOn, SymbolStyle, SortDirection, SortMode, LegendPosition, Anchor, ValueLabelPosition, CrosshairDirection, CrosshairStyle, StackMode, LineStyle, ChartOptionType, DirectLabelMode, Interpolation, DslNodeType, } from './enums';
2
+ export type { ChartData, ChartOptions, ChartRenderer, ChartOptionDef, ChartTypeOptions, ChartTypeOptionKey, ColorizeConfig, HighlightConfig, AxisOptions, FrameOptions, AreaFillConfig, AnnotationConfig, PointAnnotationConfig, RangeAnnotationConfig, FreeAnnotationConfig, AnnotationLineConfig, LineSymbolConfig, SeriesOverride, Margin, } from './charts/types';
3
+ export { createFrame } from './charts/frame/frame';
4
+ export type { FrameElements } from './charts/frame/frame';
5
+ export { createCanvas } from './charts/canvas/canvas';
6
+ export type { CanvasElements } from './charts/canvas/canvas';
7
+ export { renderVerticalAxis } from './charts/axis/vertical-axis';
8
+ export { renderHorizontalAxis } from './charts/axis/horizontal-axis';
9
+ export { renderLegend } from './charts/legend/legend';
10
+ export { registerChart, getChart, getChartOptions, listCharts } from './charts/registry';
11
+ export { parseData, buildChartOptions } from './charts/chart-helpers';
12
+ export { getChartTypeDefaults, resolveChartTypeOptions } from './charts/resolve';
13
+ export { resolveBarGapPadding, DEFAULT_BAR_GAP } from './charts/scale-helpers';
14
+ export { resolvePalette, listPalettes } from './charts/palettes';
15
+ export type { PaletteEntry } from './charts/palettes';
16
+ export { resolveSeriesColor, resolveSeriesInterpolation, isSeriesHidden } from './charts/series-helpers';
17
+ export { resolveBackgroundColor, adjustColorsForBackground, wcagContrastRatio, wcagLevel } from './charts/contrast';
18
+ export { getTransitionDuration, snapshotForFadeOut, commitFadeOut, fadeIn } from './charts/motion';
19
+ export { getCachedChart } from './charts/transition-cache';
20
+ export { getCvdFilterId, createCvdSvgFilter, simulateCvdColor, checkCvdColors } from './charts/colorblind';
21
+ export type { CvdType, CvdIssue } from './charts/colorblind';
22
+ export { parse } from './dsl/parser';
23
+ export { serialize, compactSerialize } from './dsl/serializer';
24
+ export { propertyMap, extractChartTypeOptions, dataEntriesToString, extractSceneOverrides, convertColorizes, convertHighlights, convertAreaFills, convertAnnotations, convertSeriesOverrides } from './dsl/converter';
25
+ export type { AnnotationNode, AnnotationVisibilityNode, PointAnnotationNode, RangeAnnotationNode, FreeAnnotationNode, AreaFillNode, ChartNode, DataNode, ColorizeNode, HighlightNode, PropertyNode, SceneNode, SeriesNode, StepNode, TransformNode } from './dsl/types';
26
+ export { samples } from './samples';
27
+ export type { ChartSample } from './samples';