@opendata-ai/openchart-core 8.0.0-rc.8 → 8.0.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.
Files changed (82) hide show
  1. package/dist/index.d.ts +461 -56
  2. package/dist/index.js +62 -24
  3. package/dist/index.js.map +1 -1
  4. package/dist/styles.css +1 -1
  5. package/dist/styles.css.map +1 -1
  6. package/package.json +1 -2
  7. package/schema/chart.schema.json +373 -67
  8. package/schema/table.schema.json +35 -1
  9. package/schema/vizspec.schema.json +950 -152
  10. package/src/accessibility/__tests__/alt-text.test.ts +0 -110
  11. package/src/accessibility/__tests__/aria.test.ts +0 -125
  12. package/src/accessibility/alt-text.ts +0 -155
  13. package/src/accessibility/aria.ts +0 -75
  14. package/src/accessibility/index.ts +0 -6
  15. package/src/colors/__tests__/colorblind.test.ts +0 -75
  16. package/src/colors/__tests__/contrast.test.ts +0 -119
  17. package/src/colors/__tests__/palettes.test.ts +0 -74
  18. package/src/colors/colorblind.ts +0 -131
  19. package/src/colors/contrast.ts +0 -143
  20. package/src/colors/index.ts +0 -36
  21. package/src/colors/palettes.ts +0 -206
  22. package/src/helpers/__tests__/deep-merge.test.ts +0 -54
  23. package/src/helpers/__tests__/spec-builders.test.ts +0 -338
  24. package/src/helpers/deep-merge.ts +0 -29
  25. package/src/helpers/spec-builders.ts +0 -479
  26. package/src/index.ts +0 -215
  27. package/src/labels/__tests__/collision.test.ts +0 -310
  28. package/src/labels/collision.ts +0 -249
  29. package/src/labels/index.ts +0 -13
  30. package/src/layout/__tests__/chrome.test.ts +0 -208
  31. package/src/layout/__tests__/text-measure.test.ts +0 -57
  32. package/src/layout/chrome.ts +0 -470
  33. package/src/layout/index.ts +0 -18
  34. package/src/layout/text-measure.ts +0 -404
  35. package/src/layout/text-wrap.ts +0 -93
  36. package/src/locale/__tests__/format.test.ts +0 -606
  37. package/src/locale/format.ts +0 -459
  38. package/src/locale/index.ts +0 -21
  39. package/src/responsive/__tests__/breakpoints.test.ts +0 -146
  40. package/src/responsive/__tests__/metrics.test.ts +0 -52
  41. package/src/responsive/breakpoints.ts +0 -172
  42. package/src/responsive/index.ts +0 -53
  43. package/src/responsive/metrics.ts +0 -299
  44. package/src/schema/__tests__/generated-artifacts.test.ts +0 -42
  45. package/src/schema/__tests__/schema.test.ts +0 -179
  46. package/src/styles/__tests__/reduced-motion-selectors.test.ts +0 -28
  47. package/src/styles/animation.css +0 -208
  48. package/src/styles/base.css +0 -102
  49. package/src/styles/chrome.css +0 -174
  50. package/src/styles/dark.css +0 -44
  51. package/src/styles/graph.css +0 -135
  52. package/src/styles/index.css +0 -28
  53. package/src/styles/keyframes.css +0 -151
  54. package/src/styles/legend.css +0 -18
  55. package/src/styles/reduced-motion.css +0 -67
  56. package/src/styles/series-search.css +0 -153
  57. package/src/styles/sparkline.css +0 -16
  58. package/src/styles/table-animation.css +0 -93
  59. package/src/styles/table.css +0 -398
  60. package/src/styles/token-definitions.ts +0 -199
  61. package/src/styles/tokens.css +0 -156
  62. package/src/styles/tooltip.css +0 -126
  63. package/src/styles/you-draw-it.css +0 -126
  64. package/src/theme/__tests__/dark-mode.test.ts +0 -232
  65. package/src/theme/__tests__/defaults.test.ts +0 -73
  66. package/src/theme/__tests__/resolve.test.ts +0 -277
  67. package/src/theme/dark-mode.ts +0 -258
  68. package/src/theme/defaults.ts +0 -110
  69. package/src/theme/index.ts +0 -8
  70. package/src/theme/presets.ts +0 -64
  71. package/src/theme/resolve.ts +0 -312
  72. package/src/types/__tests__/encoding.test.ts +0 -368
  73. package/src/types/__tests__/gradient.test.ts +0 -95
  74. package/src/types/__tests__/spec.test.ts +0 -499
  75. package/src/types/encoding.ts +0 -280
  76. package/src/types/events.ts +0 -154
  77. package/src/types/index.ts +0 -289
  78. package/src/types/layout.ts +0 -2001
  79. package/src/types/schema-roots.ts +0 -32
  80. package/src/types/spec.ts +0 -2906
  81. package/src/types/table.ts +0 -108
  82. package/src/types/theme.ts +0 -209
@@ -1,479 +0,0 @@
1
- /**
2
- * Spec construction helpers: typed builder functions for common chart types.
3
- *
4
- * These builders reduce boilerplate when creating specs programmatically.
5
- * They accept field names as strings (simple case) or full EncodingChannel
6
- * objects (when you need to customize type, aggregate, axis, or scale).
7
- *
8
- * Type inference: when a string field name is provided, the builder samples
9
- * data values to infer the encoding type (quantitative, temporal, nominal).
10
- */
11
-
12
- import type {
13
- AnimationSpec,
14
- Annotation,
15
- ChartSpec,
16
- Chrome,
17
- DarkMode,
18
- DataRow,
19
- Encoding,
20
- EncodingChannel,
21
- FieldType,
22
- LegendConfig,
23
- MarkDef,
24
- MarkType,
25
- TableSpec,
26
- ThemeConfig,
27
- TileMapEncoding,
28
- TileMapPalette,
29
- TileMapSpec,
30
- } from '../types/spec';
31
- import type { ColumnConfig } from '../types/table';
32
-
33
- // ---------------------------------------------------------------------------
34
- // Types
35
- // ---------------------------------------------------------------------------
36
-
37
- /** A field reference: either a plain string (field name) or a full EncodingChannel. */
38
- export type FieldRef = string | EncodingChannel;
39
-
40
- /** Common options shared by all chart builder functions. */
41
- export interface ChartBuilderOptions {
42
- /** Color encoding: field name or full channel config for series differentiation. */
43
- color?: FieldRef;
44
- /** Size encoding: field name or full channel config. */
45
- size?: FieldRef;
46
- /** Editorial chrome (title, subtitle, source, etc.). */
47
- chrome?: Chrome;
48
- /** Data annotations. */
49
- annotations?: Annotation[];
50
- /** Whether the chart adapts to container width. Defaults to true. */
51
- responsive?: boolean;
52
- /** Theme configuration overrides. */
53
- theme?: ThemeConfig;
54
- /** Dark mode behavior. */
55
- darkMode?: DarkMode;
56
- }
57
-
58
- /** Options for the dataTable builder. */
59
- export interface TableBuilderOptions {
60
- /** Column definitions. Auto-generated from data keys if omitted. */
61
- columns?: ColumnConfig[];
62
- /** Field to use as a unique row identifier. */
63
- rowKey?: string;
64
- /** Editorial chrome. */
65
- chrome?: Chrome;
66
- /** Theme configuration overrides. */
67
- theme?: ThemeConfig;
68
- /** Dark mode behavior. */
69
- darkMode?: DarkMode;
70
- /** Enable client-side search/filter. */
71
- search?: boolean;
72
- /** Pagination configuration. */
73
- pagination?: boolean | { pageSize: number };
74
- /** Stick the first column during horizontal scroll. */
75
- stickyFirstColumn?: boolean;
76
- /** Compact mode. */
77
- compact?: boolean;
78
- /** Whether the table adapts to container width. */
79
- responsive?: boolean;
80
- }
81
-
82
- // ---------------------------------------------------------------------------
83
- // Type inference
84
- // ---------------------------------------------------------------------------
85
-
86
- /** ISO 8601 date patterns we recognize for temporal inference. */
87
- const ISO_DATE_RE = /^\d{4}(-\d{2}(-\d{2}(T\d{2}(:\d{2}(:\d{2})?)?)?)?)?$/;
88
-
89
- /**
90
- * Infer the encoding field type from data values.
91
- *
92
- * Samples up to 20 values from the data array for the given field.
93
- * - If all sampled values are numbers (or null/undefined), returns "quantitative".
94
- * - If all sampled string values match ISO date patterns, returns "temporal".
95
- * - Otherwise returns "nominal".
96
- */
97
- export function inferFieldType(data: DataRow[], field: string): FieldType {
98
- const sampleSize = Math.min(data.length, 20);
99
- let hasNumber = false;
100
- let hasDateString = false;
101
- let hasOtherString = false;
102
-
103
- for (let i = 0; i < sampleSize; i++) {
104
- const value = data[i][field];
105
-
106
- // Skip null/undefined
107
- if (value == null) continue;
108
-
109
- if (typeof value === 'number') {
110
- hasNumber = true;
111
- } else if (typeof value === 'string') {
112
- if (ISO_DATE_RE.test(value) && !Number.isNaN(Date.parse(value))) {
113
- hasDateString = true;
114
- } else {
115
- hasOtherString = true;
116
- }
117
- } else if (value instanceof Date) {
118
- hasDateString = true;
119
- } else {
120
- hasOtherString = true;
121
- }
122
- }
123
-
124
- // Numbers-only: quantitative
125
- if (hasNumber && !hasDateString && !hasOtherString) return 'quantitative';
126
- // Date strings/Date objects only: temporal
127
- if (hasDateString && !hasNumber && !hasOtherString) return 'temporal';
128
- // Everything else: nominal
129
- return 'nominal';
130
- }
131
-
132
- // ---------------------------------------------------------------------------
133
- // Internal helpers
134
- // ---------------------------------------------------------------------------
135
-
136
- /**
137
- * Resolve a FieldRef into a full EncodingChannel.
138
- * If the ref is a string, infer the type from data.
139
- */
140
- function resolveField(ref: FieldRef, data: DataRow[]): EncodingChannel {
141
- if (typeof ref === 'string') {
142
- return { field: ref, type: inferFieldType(data, ref) };
143
- }
144
- return ref;
145
- }
146
-
147
- /** Build the encoding object from resolved channels. */
148
- function buildEncoding(
149
- channels: { x?: EncodingChannel; y?: EncodingChannel },
150
- options?: ChartBuilderOptions,
151
- data?: DataRow[],
152
- ): Encoding {
153
- const encoding: Encoding = { ...channels };
154
- if (options?.color && data) {
155
- encoding.color = resolveField(options.color, data);
156
- }
157
- if (options?.size && data) {
158
- encoding.size = resolveField(options.size, data);
159
- }
160
- return encoding;
161
- }
162
-
163
- /** Build a ChartSpec from the resolved pieces. */
164
- function buildChartSpec(
165
- mark: MarkType | MarkDef,
166
- data: DataRow[],
167
- encoding: Encoding,
168
- options?: ChartBuilderOptions,
169
- ): ChartSpec {
170
- // Cast needed because the generic discriminated union can't be constructed
171
- // from a runtime MarkType variable — the caller always pairs mark+encoding correctly.
172
- const spec = { mark, data, encoding } as ChartSpec;
173
- if (options?.chrome) spec.chrome = options.chrome;
174
- if (options?.annotations) spec.annotations = options.annotations;
175
- if (options?.responsive !== undefined) spec.responsive = options.responsive;
176
- if (options?.theme) spec.theme = options.theme;
177
- if (options?.darkMode) spec.darkMode = options.darkMode;
178
- return spec;
179
- }
180
-
181
- // ---------------------------------------------------------------------------
182
- // Builder functions
183
- // ---------------------------------------------------------------------------
184
-
185
- /**
186
- * Create a line chart spec.
187
- *
188
- * @param data - Array of data rows.
189
- * @param x - X-axis field (typically temporal or ordinal).
190
- * @param y - Y-axis field (typically quantitative).
191
- * @param options - Optional color, size, chrome, annotations, theme, etc.
192
- */
193
- export function lineChart(
194
- data: DataRow[],
195
- x: FieldRef,
196
- y: FieldRef,
197
- options?: ChartBuilderOptions,
198
- ): ChartSpec {
199
- const xChannel = resolveField(x, data);
200
- const yChannel = resolveField(y, data);
201
- const encoding = buildEncoding({ x: xChannel, y: yChannel }, options, data);
202
- return buildChartSpec('line', data, encoding, options);
203
- }
204
-
205
- /**
206
- * Create a bar chart spec (horizontal bars).
207
- *
208
- * Convention: category goes on y-axis, value on x-axis.
209
- * The `category` param maps to y, `value` maps to x.
210
- *
211
- * @param data - Array of data rows.
212
- * @param category - Category field (y-axis, nominal/ordinal).
213
- * @param value - Value field (x-axis, quantitative).
214
- * @param options - Optional color, size, chrome, annotations, theme, etc.
215
- */
216
- export function barChart(
217
- data: DataRow[],
218
- category: FieldRef,
219
- value: FieldRef,
220
- options?: ChartBuilderOptions,
221
- ): ChartSpec {
222
- const categoryChannel = resolveField(category, data);
223
- const valueChannel = resolveField(value, data);
224
-
225
- // Bar charts: category on y, value on x
226
- const encoding = buildEncoding({ x: valueChannel, y: categoryChannel }, options, data);
227
- return buildChartSpec('bar', data, encoding, options);
228
- }
229
-
230
- /**
231
- * Create a column chart spec (vertical columns).
232
- *
233
- * @param data - Array of data rows.
234
- * @param x - X-axis field (category or temporal).
235
- * @param y - Y-axis field (quantitative value).
236
- * @param options - Optional color, size, chrome, annotations, theme, etc.
237
- */
238
- export function columnChart(
239
- data: DataRow[],
240
- x: FieldRef,
241
- y: FieldRef,
242
- options?: ChartBuilderOptions,
243
- ): ChartSpec {
244
- const xChannel = resolveField(x, data);
245
- const yChannel = resolveField(y, data);
246
- const encoding = buildEncoding({ x: xChannel, y: yChannel }, options, data);
247
- return buildChartSpec({ type: 'bar' } as MarkDef, data, encoding, options);
248
- }
249
-
250
- /**
251
- * Create a pie chart spec.
252
- *
253
- * Convention: category maps to the color channel, value maps to theta.
254
- * Pie charts have no x-axis.
255
- *
256
- * @param data - Array of data rows.
257
- * @param category - Category field (color channel, nominal).
258
- * @param value - Value field (theta channel, quantitative).
259
- * @param options - Optional chrome, annotations, theme, etc.
260
- * Note: color option is ignored since category is used for color.
261
- */
262
- export function pieChart(
263
- data: DataRow[],
264
- category: FieldRef,
265
- value: FieldRef,
266
- options?: ChartBuilderOptions,
267
- ): ChartSpec {
268
- const categoryChannel = resolveField(category, data);
269
- const valueChannel = resolveField(value, data);
270
-
271
- // Pie charts: value on theta (canonical in v8), category on color (no x-axis)
272
- const encoding: Encoding = {
273
- theta: valueChannel,
274
- color: categoryChannel,
275
- };
276
- if (options?.size && data) {
277
- encoding.size = resolveField(options.size, data);
278
- }
279
-
280
- return buildChartSpec('arc', data, encoding, options);
281
- }
282
-
283
- /**
284
- * Create an area chart spec.
285
- *
286
- * @param data - Array of data rows.
287
- * @param x - X-axis field (typically temporal or ordinal).
288
- * @param y - Y-axis field (typically quantitative).
289
- * @param options - Optional color, size, chrome, annotations, theme, etc.
290
- */
291
- export function areaChart(
292
- data: DataRow[],
293
- x: FieldRef,
294
- y: FieldRef,
295
- options?: ChartBuilderOptions,
296
- ): ChartSpec {
297
- const xChannel = resolveField(x, data);
298
- const yChannel = resolveField(y, data);
299
- const encoding = buildEncoding({ x: xChannel, y: yChannel }, options, data);
300
- return buildChartSpec('area', data, encoding, options);
301
- }
302
-
303
- /**
304
- * Create a donut chart spec.
305
- *
306
- * Convention: category maps to the color channel, value maps to theta.
307
- * Donut charts have no x-axis.
308
- *
309
- * @param data - Array of data rows.
310
- * @param category - Category field (color channel, nominal).
311
- * @param value - Value field (theta channel, quantitative).
312
- * @param options - Optional chrome, annotations, theme, etc.
313
- * Note: color option is ignored since category is used for color.
314
- */
315
- export function donutChart(
316
- data: DataRow[],
317
- category: FieldRef,
318
- value: FieldRef,
319
- options?: ChartBuilderOptions,
320
- ): ChartSpec {
321
- const categoryChannel = resolveField(category, data);
322
- const valueChannel = resolveField(value, data);
323
-
324
- const encoding: Encoding = {
325
- theta: valueChannel,
326
- color: categoryChannel,
327
- };
328
- if (options?.size && data) {
329
- encoding.size = resolveField(options.size, data);
330
- }
331
-
332
- return buildChartSpec({ type: 'arc', innerRadius: 40 } as MarkDef, data, encoding, options);
333
- }
334
-
335
- /**
336
- * Create a dot chart spec (strip plot / dot plot).
337
- *
338
- * @param data - Array of data rows.
339
- * @param x - X-axis field (quantitative or temporal).
340
- * @param y - Y-axis field (nominal/categorical grouping).
341
- * @param options - Optional color, size, chrome, annotations, theme, etc.
342
- */
343
- export function dotChart(
344
- data: DataRow[],
345
- x: FieldRef,
346
- y: FieldRef,
347
- options?: ChartBuilderOptions,
348
- ): ChartSpec {
349
- const xChannel = resolveField(x, data);
350
- const yChannel = resolveField(y, data);
351
- const encoding = buildEncoding({ x: xChannel, y: yChannel }, options, data);
352
- return buildChartSpec('circle', data, encoding, options);
353
- }
354
-
355
- /**
356
- * Create a scatter chart spec.
357
- *
358
- * @param data - Array of data rows.
359
- * @param x - X-axis field (quantitative).
360
- * @param y - Y-axis field (quantitative).
361
- * @param options - Optional color, size, chrome, annotations, theme, etc.
362
- */
363
- export function scatterChart(
364
- data: DataRow[],
365
- x: FieldRef,
366
- y: FieldRef,
367
- options?: ChartBuilderOptions,
368
- ): ChartSpec {
369
- const xChannel = resolveField(x, data);
370
- const yChannel = resolveField(y, data);
371
- const encoding = buildEncoding({ x: xChannel, y: yChannel }, options, data);
372
- return buildChartSpec('point', data, encoding, options);
373
- }
374
-
375
- /**
376
- * Create a data table spec.
377
- *
378
- * If no columns are specified, auto-generates column configs from the
379
- * keys of the first data row.
380
- *
381
- * @param data - Array of data rows.
382
- * @param options - Column definitions, chrome, pagination, search, etc.
383
- */
384
- export function dataTable(data: DataRow[], options?: TableBuilderOptions): TableSpec {
385
- // Auto-generate columns from data keys if not provided
386
- let columns = options?.columns;
387
- if (!columns && data.length > 0) {
388
- columns = Object.keys(data[0]).map((key): ColumnConfig => {
389
- // Infer alignment from data type
390
- const fieldType = inferFieldType(data, key);
391
- const align = fieldType === 'quantitative' ? ('right' as const) : ('left' as const);
392
-
393
- return {
394
- key,
395
- label: key,
396
- align,
397
- };
398
- });
399
- }
400
-
401
- const spec: TableSpec = {
402
- type: 'table',
403
- data,
404
- columns: columns ?? [],
405
- };
406
-
407
- if (options?.rowKey) spec.rowKey = options.rowKey;
408
- if (options?.chrome) spec.chrome = options.chrome;
409
- if (options?.theme) spec.theme = options.theme;
410
- if (options?.darkMode) spec.darkMode = options.darkMode;
411
- if (options?.search !== undefined) spec.search = options.search;
412
- if (options?.pagination !== undefined) spec.pagination = options.pagination;
413
- if (options?.stickyFirstColumn !== undefined) spec.stickyFirstColumn = options.stickyFirstColumn;
414
- if (options?.compact !== undefined) spec.compact = options.compact;
415
- if (options?.responsive !== undefined) spec.responsive = options.responsive;
416
-
417
- return spec;
418
- }
419
-
420
- // ---------------------------------------------------------------------------
421
- // Tile map builder
422
- // ---------------------------------------------------------------------------
423
-
424
- /** Options for the tileMap convenience builder. */
425
- export interface TileMapBuilderOptions {
426
- /** Encoding channels (required when data is DataRow[]). */
427
- encoding?: TileMapEncoding;
428
- /** Sequential color palette name (quantitative mode only). */
429
- palette?: TileMapPalette;
430
- /** Custom category-to-color mapping. Forces categorical mode. */
431
- colors?: Record<string, string>;
432
- /** Editorial chrome. */
433
- chrome?: Chrome;
434
- /** Legend display configuration. */
435
- legend?: LegendConfig;
436
- /** Theme overrides. */
437
- theme?: ThemeConfig;
438
- /** Dark mode setting. */
439
- darkMode?: DarkMode;
440
- /** Whether to show the watermark. */
441
- watermark?: boolean;
442
- /** Animation configuration. */
443
- animation?: AnimationSpec;
444
- /** d3-format string for value formatting. */
445
- valueFormat?: string;
446
- }
447
-
448
- /**
449
- * Build a TileMapSpec from a state-to-value record or tabular data.
450
- *
451
- * @example Record map (simplest):
452
- * ```ts
453
- * tileMap({ CA: 4.4, TX: 17.6, NY: 4.5 })
454
- * ```
455
- *
456
- * @example Tabular data with encoding:
457
- * ```ts
458
- * tileMap(data, { encoding: { state: { field: 'code' }, value: { field: 'rate' } } })
459
- * ```
460
- */
461
- export function tileMap(
462
- data: Record<string, number | string | null> | DataRow[],
463
- options?: TileMapBuilderOptions,
464
- ): TileMapSpec {
465
- return {
466
- type: 'tilemap' as const,
467
- data,
468
- ...(options?.encoding && { encoding: options.encoding }),
469
- ...(options?.palette && { palette: options.palette }),
470
- ...(options?.colors && { colors: options.colors }),
471
- ...(options?.chrome && { chrome: options.chrome }),
472
- ...(options?.legend && { legend: options.legend }),
473
- ...(options?.theme && { theme: options.theme }),
474
- ...(options?.darkMode && { darkMode: options.darkMode }),
475
- ...(options?.watermark !== undefined && { watermark: options.watermark }),
476
- ...(options?.animation && { animation: options.animation }),
477
- ...(options?.valueFormat && { valueFormat: options.valueFormat }),
478
- };
479
- }
package/src/index.ts DELETED
@@ -1,215 +0,0 @@
1
- /**
2
- * @opendata-ai/openchart-core
3
- *
4
- * Core types, theme engine, color system, accessibility, and locale utilities
5
- * for the openchart library.
6
- *
7
- * This package has no DOM dependencies and runs in any JavaScript environment.
8
- */
9
-
10
- // ---------------------------------------------------------------------------
11
- // Type system (specs, layouts, marks, encoding, theme types)
12
- // ---------------------------------------------------------------------------
13
-
14
- export * from './types/index';
15
-
16
- // ---------------------------------------------------------------------------
17
- // Colors: palette collections, contrast utilities, color-blindness simulation
18
- //
19
- // Individual named palettes (SEQUENTIAL_BLUE, DIVERGING_RED_BLUE, etc.) are
20
- // available via the SEQUENTIAL_PALETTES and DIVERGING_PALETTES collections.
21
- // ---------------------------------------------------------------------------
22
-
23
- export type {
24
- CategoricalPalette,
25
- ColorBlindnessType,
26
- DivergingPalette,
27
- SequentialPalette,
28
- } from './colors/index';
29
- export {
30
- ACHROMATIC_RAMP,
31
- CATEGORICAL_PALETTE,
32
- checkPaletteDistinguishability,
33
- contrastRatio,
34
- DIVERGING_PALETTES,
35
- findAccessibleColor,
36
- isOpaqueColor,
37
- meetsAA,
38
- pickLabelColor,
39
- resolveSchemeName,
40
- SEQUENTIAL_PALETTES,
41
- SUPPORTED_SCHEME_NAMES,
42
- simulateColorBlindness,
43
- } from './colors/index';
44
-
45
- // ---------------------------------------------------------------------------
46
- // Theme: defaults, resolution, dark-mode adaptation
47
- // ---------------------------------------------------------------------------
48
-
49
- export {
50
- adaptColorForDarkMode,
51
- adaptForLightLineStroke,
52
- adaptTheme,
53
- DEFAULT_THEME,
54
- editorial,
55
- essay,
56
- resolveTheme,
57
- wire,
58
- } from './theme/index';
59
-
60
- // ---------------------------------------------------------------------------
61
- // Layout: text measurement, chrome computation
62
- // ---------------------------------------------------------------------------
63
-
64
- export {
65
- BRAND_FONT_SIZE,
66
- BRAND_MIN_WIDTH,
67
- BRAND_RESERVE_WIDTH,
68
- COMPACT_WIDTH,
69
- computeChrome,
70
- estimateTextWidth,
71
- FOOTNOTE_LINE_HEIGHT,
72
- footnoteBandHeight,
73
- heuristicMeasure,
74
- resolveMeasurer,
75
- textAscent,
76
- wrapText,
77
- } from './layout/index';
78
-
79
- // ---------------------------------------------------------------------------
80
- // Responsive: breakpoints and layout strategies
81
- // ---------------------------------------------------------------------------
82
-
83
- export type {
84
- AnnotationPosition,
85
- AxisLabelDensity,
86
- Breakpoint,
87
- ChromeMode,
88
- HeightClass,
89
- LabelMode,
90
- LayoutStrategy,
91
- LegendPosition,
92
- XAxisExtentInput,
93
- } from './responsive/index';
94
- export {
95
- AXIS_TITLE_GAP,
96
- AXIS_TITLE_OFFSET_COMPACT,
97
- AXIS_TITLE_OFFSET_DEFAULT,
98
- AXIS_TITLE_TRAILING_PAD,
99
- axisTitleOffset,
100
- BREAKPOINT_COMPACT_MAX,
101
- BREAKPOINT_MEDIUM_MAX,
102
- computeXAxisExtentFromLabels,
103
- getAxisTitleOffset,
104
- getBreakpoint,
105
- getHeightClass,
106
- getLayoutStrategy,
107
- HEIGHT_CRAMPED_MAX,
108
- HEIGHT_SHORT_MAX,
109
- HPAD_COMPACT_FRACTION,
110
- HPAD_COMPACT_MIN,
111
- LABEL_GAP_COMPACT,
112
- LABEL_GAP_DEFAULT,
113
- LABEL_GAP_NARROW_MAX,
114
- MAX_LEFT_LABEL_FRACTION_COMPACT,
115
- MAX_LEFT_LABEL_FRACTION_DEFAULT,
116
- MAX_LEFT_LABEL_FRACTION_MEDIUM,
117
- MAX_LEFT_LABEL_FRACTION_MEDIUM_MAX,
118
- maxRotatedLabelWidth,
119
- NARROW_VIEWPORT_MAX,
120
- TICK_LABEL_OFFSET,
121
- TICK_LINE_HEIGHT_FACTOR,
122
- TOP_PAD_EXTRA_NARROW,
123
- TOP_PAD_NARROW_MAX,
124
- truncateRotatedLabel,
125
- X_AXIS_BAND_HEIGHT,
126
- X_AXIS_ROTATED_EXTENT_CAP,
127
- X_AXIS_TITLE_BAND,
128
- X_AXIS_TITLE_BAND_ROTATED,
129
- } from './responsive/index';
130
-
131
- // ---------------------------------------------------------------------------
132
- // Labels: collision detection and resolution
133
- // ---------------------------------------------------------------------------
134
-
135
- export type {
136
- LabelCandidate,
137
- LabelPriority,
138
- OffsetStrategy,
139
- } from './labels/index';
140
- export {
141
- computeLabelBounds,
142
- detectCollision,
143
- EXTENDED_OFFSET_STRATEGIES,
144
- OFFSET_STRATEGIES,
145
- overlapArea,
146
- resolveCollisions,
147
- } from './labels/index';
148
-
149
- // ---------------------------------------------------------------------------
150
- // Locale: number and date formatting
151
- // ---------------------------------------------------------------------------
152
-
153
- export type { DateGranularity, FieldFormatContext, NumberFormatter } from './locale/index';
154
- export {
155
- abbreviateNumber,
156
- buildCompactStepFormatter,
157
- buildD3Formatter,
158
- buildTemporalFormatter,
159
- computeFieldFormatContext,
160
- defaultNumberFormatter,
161
- formatCurrency,
162
- formatDate,
163
- formatNumber,
164
- formatOrdinal,
165
- formatPercent,
166
- isYearContext,
167
- resolveNumberFormatter,
168
- } from './locale/index';
169
-
170
- // ---------------------------------------------------------------------------
171
- // Accessibility: alt text and ARIA label generation
172
- // ---------------------------------------------------------------------------
173
-
174
- export {
175
- generateAltText,
176
- generateAriaLabels,
177
- generateDataTable,
178
- } from './accessibility/index';
179
-
180
- // ---------------------------------------------------------------------------
181
- // Helpers: spec construction builders
182
- // ---------------------------------------------------------------------------
183
-
184
- export type {
185
- ChartBuilderOptions,
186
- FieldRef,
187
- TableBuilderOptions,
188
- TileMapBuilderOptions,
189
- } from './helpers/spec-builders';
190
- export {
191
- areaChart,
192
- barChart,
193
- columnChart,
194
- dataTable,
195
- donutChart,
196
- dotChart,
197
- inferFieldType,
198
- lineChart,
199
- pieChart,
200
- scatterChart,
201
- tileMap,
202
- } from './helpers/spec-builders';
203
-
204
- // ---------------------------------------------------------------------------
205
- // Helpers: deep-merge for spec patches (used by vanilla/story)
206
- // ---------------------------------------------------------------------------
207
-
208
- export { deepMergeSpec } from './helpers/deep-merge';
209
-
210
- // ---------------------------------------------------------------------------
211
- // CSS token definitions (single source of truth for tokens.css / dark.css)
212
- // ---------------------------------------------------------------------------
213
-
214
- export type { CssTokenDef } from './styles/token-definitions';
215
- export { CSS_TOKEN_ROOT_SELECTORS, CSS_TOKENS, cssTokenDefault } from './styles/token-definitions';