@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,481 @@
1
+ // ============================================================================
2
+ // Blueprint Chart — Standalone Chart Styles
3
+ // ============================================================================
4
+ //
5
+ // All visual properties use CSS custom properties so consumers can theme
6
+ // charts without touching this file. Default values produce the canonical
7
+ // "Blueprint" look and feel.
8
+ //
9
+ // Class names match the DOM generated by the lib's TypeScript renderers.
10
+ // Do NOT rename classes here — they are referenced by name throughout the
11
+ // chart codebase (frame.ts, canvas.ts, legend.ts, chart-type files, plugins).
12
+ //
13
+ // This file is standalone: no Bootstrap or editor dependency.
14
+ // ============================================================================
15
+
16
+ // ---------------------------------------------------------------------------
17
+ // Frame
18
+ // ---------------------------------------------------------------------------
19
+
20
+ .bc-frame {
21
+ --bc-frame-font-family: system-ui, -apple-system, sans-serif;
22
+ --bc-frame-padding: 0;
23
+ --bc-frame-bg: var(--bs-card-bg, #fff);
24
+
25
+ font-family: var(--bc-frame-font-family);
26
+ background: var(--bc-frame-bg);
27
+ }
28
+
29
+ // Constrained-height mode: when the frame's container has a definite height
30
+ // (fixed or aspect-ratio).
31
+ //
32
+ // The body (SVG container) is positioned absolutely over the full frame so
33
+ // its dimensions never change between scenes. Header and footer float on
34
+ // top via z-index with flex layout pushing footer to the bottom.
35
+ // The chart content inside the SVG uses extra margins (set by createCanvas
36
+ // from data-header-h / data-footer-h) to avoid overlapping header/footer.
37
+ // When the header height changes, only the chart margins change — smoothly
38
+ // animated by D3 transitions. The SVG itself is perfectly stable.
39
+ .bc-frame--constrained {
40
+ flex: 1;
41
+ position: relative;
42
+ min-height: 0;
43
+ overflow: hidden;
44
+
45
+ .bc-frame-header {
46
+ position: relative;
47
+ z-index: 1;
48
+ // Opaque background so the header covers SVG content behind it.
49
+ // Uses the card/container background or white as fallback.
50
+ background: var(--bc-frame-header-bg, var(--bs-card-bg, #fff));
51
+ }
52
+
53
+ .bc-frame-body {
54
+ position: absolute;
55
+ inset: 0;
56
+ z-index: 0;
57
+ overflow: hidden;
58
+ }
59
+
60
+ .bc-frame-note {
61
+ position: absolute;
62
+ bottom: var(--bc-footer-h, 0);
63
+ left: 0;
64
+ right: 0;
65
+ z-index: 1;
66
+ }
67
+
68
+ .bc-frame-footer {
69
+ position: absolute;
70
+ bottom: 0;
71
+ left: 0;
72
+ right: 0;
73
+ z-index: 1;
74
+ }
75
+ }
76
+
77
+ // -- Header elements --------------------------------------------------------
78
+
79
+ .bc-frame-header {
80
+ padding: var(--bc-frame-padding) var(--bc-frame-padding) var(--bc-frame-header-padding-bottom, var(--bc-frame-padding));
81
+ background: var(--bc-frame-header-bg, transparent);
82
+ border-bottom: var(--bc-frame-header-border-bottom, none);
83
+ margin-bottom: var(--bc-frame-header-margin-bottom, 0);
84
+ }
85
+
86
+ .bc-frame-title {
87
+ --bc-frame-title-color: var(--bc-text-color, #333);
88
+ --bc-frame-title-font-size: 1.25rem;
89
+ --bc-frame-title-font-weight: bold;
90
+
91
+ color: var(--bc-frame-title-color);
92
+ font-size: var(--bc-frame-title-font-size);
93
+ font-weight: var(--bc-frame-title-font-weight);
94
+ margin: 0;
95
+ }
96
+
97
+ .bc-frame-description {
98
+ --bc-frame-description-color: var(--bc-text-color, #555);
99
+ --bc-frame-description-font-size: 0.875rem;
100
+
101
+ color: var(--bc-frame-description-color);
102
+ font-size: var(--bc-frame-description-font-size);
103
+ margin: 0.25rem 0 0;
104
+ }
105
+
106
+ // -- Body -------------------------------------------------------------------
107
+
108
+ .bc-frame-body {
109
+ padding: 0 var(--bc-frame-padding);
110
+ }
111
+
112
+ // -- Note -------------------------------------------------------------------
113
+
114
+ .bc-frame-note {
115
+ --bc-frame-note-color: var(--bc-text-color, #888);
116
+ --bc-frame-note-font-size: 0.75rem;
117
+
118
+ font-style: italic;
119
+ color: var(--bc-frame-note-color);
120
+ font-size: var(--bc-frame-note-font-size);
121
+ margin: 0;
122
+ padding: 0 var(--bc-frame-padding) var(--bc-frame-padding);
123
+ }
124
+
125
+ // -- Footer -----------------------------------------------------------------
126
+
127
+ .bc-frame-footer {
128
+ --bc-frame-footer-gap: 0.25rem 1rem;
129
+
130
+ gap: var(--bc-frame-footer-gap);
131
+ padding: var(--bc-frame-footer-padding-top, var(--bc-frame-padding)) var(--bc-frame-padding) var(--bc-frame-padding);
132
+ background: var(--bc-frame-footer-bg, transparent);
133
+ border-top: var(--bc-frame-footer-border-top, none);
134
+ }
135
+
136
+ .bc-frame-footer-left {
137
+ --bc-frame-footer-left-gap: 0.25rem 0.75rem;
138
+ --bc-frame-footer-separator-color: var(--bc-text-color, #888);
139
+
140
+ display: flex;
141
+ align-items: baseline;
142
+ flex-wrap: wrap;
143
+ gap: var(--bc-frame-footer-left-gap);
144
+
145
+ > :not(:first-child)::before {
146
+ content: "\00B7"; // middle dot
147
+ margin-right: 0.5rem;
148
+ color: var(--bc-frame-footer-separator-color);
149
+ }
150
+ }
151
+
152
+ .bc-frame-footer-right {
153
+ display: flex;
154
+ align-items: center;
155
+ }
156
+
157
+ // -- Byline & Source --------------------------------------------------------
158
+
159
+ .bc-frame-byline,
160
+ .bc-frame-source {
161
+ --bc-frame-meta-color: var(--bc-text-color, #888);
162
+ --bc-frame-meta-font-size: 0.75rem;
163
+
164
+ color: var(--bc-frame-meta-color);
165
+ font-size: var(--bc-frame-meta-font-size);
166
+ }
167
+
168
+ .bc-frame-source-prefix {
169
+ // Inherits color/size from .bc-frame-source.
170
+ }
171
+
172
+ .bc-frame-source-link {
173
+ --bc-frame-source-link-color: inherit;
174
+
175
+ color: var(--bc-frame-source-link-color);
176
+ text-decoration: underline;
177
+ }
178
+
179
+ // -- Credit -----------------------------------------------------------------
180
+
181
+ .bc-frame-credit {
182
+ --bc-frame-credit-color: var(--bc-text-color, #666);
183
+ --bc-frame-credit-font-size: 0.75rem;
184
+ --bc-frame-credit-font-weight: 600;
185
+
186
+ color: var(--bc-frame-credit-color);
187
+ font-size: var(--bc-frame-credit-font-size);
188
+ font-weight: var(--bc-frame-credit-font-weight);
189
+ display: inline-flex;
190
+ align-items: center;
191
+ }
192
+
193
+ // ---------------------------------------------------------------------------
194
+ // Axes
195
+ // ---------------------------------------------------------------------------
196
+
197
+ .bc-axis {
198
+ --bc-axis-tick-color: var(--bc-axis-color, #333);
199
+ --bc-axis-tick-font-size: 10px;
200
+ --bc-axis-domain-color: var(--bc-axis-color, #333);
201
+
202
+ // D3 axis generates .domain and .tick elements; style them here.
203
+ .domain {
204
+ stroke: var(--bc-axis-domain-color);
205
+ }
206
+
207
+ .tick text {
208
+ fill: var(--bc-axis-tick-color);
209
+ font-size: var(--bc-axis-tick-font-size);
210
+ }
211
+
212
+ .tick line {
213
+ stroke: var(--bc-axis-tick-color);
214
+ }
215
+ }
216
+
217
+ .bc-axis-vertical {
218
+ // Direction-specific overrides can be placed here.
219
+ }
220
+
221
+ .bc-axis-horizontal {
222
+ // Direction-specific overrides can be placed here.
223
+ }
224
+
225
+ // ---------------------------------------------------------------------------
226
+ // Grid lines
227
+ // ---------------------------------------------------------------------------
228
+
229
+ // Grid lines live inside .bc-axis .tick, so we need enough specificity
230
+ // to beat the `.bc-axis .tick line` selector (0-2-1).
231
+ .bc-axis .tick line.bc-grid-line {
232
+ --bc-grid-line-color: var(--bc-grid-color, #e0e0e0);
233
+ --bc-grid-line-width: 1;
234
+ --bc-grid-line-opacity: 1;
235
+
236
+ stroke: var(--bc-grid-line-color);
237
+ stroke-width: var(--bc-grid-line-width);
238
+ opacity: var(--bc-grid-line-opacity);
239
+ }
240
+
241
+ // ---------------------------------------------------------------------------
242
+ // Zero baseline
243
+ // ---------------------------------------------------------------------------
244
+
245
+ .bc-zero-baseline {
246
+ --bc-zero-baseline-color: #666;
247
+ --bc-zero-baseline-width: 1;
248
+
249
+ stroke: var(--bc-zero-baseline-color);
250
+ stroke-width: var(--bc-zero-baseline-width);
251
+ }
252
+
253
+ // ---------------------------------------------------------------------------
254
+ // Legend
255
+ // ---------------------------------------------------------------------------
256
+
257
+ .bc-legend {
258
+ // Container <g>; positioning handled by legend.ts.
259
+ }
260
+
261
+ .bc-legend-item {
262
+ --bc-legend-item-font-size: 12px;
263
+ --bc-legend-item-text-color: var(--bc-text-color, #555);
264
+
265
+ cursor: default;
266
+
267
+ text {
268
+ fill: var(--bc-legend-item-text-color);
269
+ font-size: var(--bc-legend-item-font-size);
270
+ }
271
+ }
272
+
273
+ // ---------------------------------------------------------------------------
274
+ // Bar charts
275
+ // ---------------------------------------------------------------------------
276
+
277
+ .bc-bar {
278
+ // Fill is set via D3 .attr('fill') from data-bound colors/highlights.
279
+ // Do NOT set fill in CSS — CSS rules override SVG attributes.
280
+ }
281
+
282
+ .bc-bar-multi {
283
+ // Same as .bc-bar — fill is data-driven.
284
+ // Additional class for multi-series bars.
285
+ }
286
+
287
+ // ---------------------------------------------------------------------------
288
+ // Line charts
289
+ // ---------------------------------------------------------------------------
290
+
291
+ .bc-line {
292
+ --bc-line-stroke-width: 2;
293
+
294
+ fill: none;
295
+ stroke-width: var(--bc-line-stroke-width);
296
+ // stroke is set inline from data-bound color.
297
+ }
298
+
299
+ .bc-area {
300
+ // fill + opacity are set inline by D3.
301
+ }
302
+
303
+ .bc-dot {
304
+ --bc-dot-radius: 3;
305
+
306
+ // fill is set inline from data-bound color.
307
+ // r is set inline but we provide a CSS default for reference.
308
+ }
309
+
310
+ // ---------------------------------------------------------------------------
311
+ // Symbols (line-symbols.ts)
312
+ // ---------------------------------------------------------------------------
313
+
314
+ .bc-symbols {
315
+ // Container group; per-series data-series attribute set inline.
316
+ }
317
+
318
+ .bc-symbol {
319
+ // Shape + fill set inline by D3.
320
+ }
321
+
322
+ // ---------------------------------------------------------------------------
323
+ // Area fills (line-multi)
324
+ // ---------------------------------------------------------------------------
325
+
326
+ .bc-area-fills {
327
+ // Container group for area fill paths.
328
+ }
329
+
330
+ .bc-area-fill {
331
+ // fill + opacity set inline by D3.
332
+ }
333
+
334
+ .bc-area-fill-negative {
335
+ // Inherits from .bc-area-fill; same inline approach.
336
+ }
337
+
338
+ // ---------------------------------------------------------------------------
339
+ // Value labels
340
+ // ---------------------------------------------------------------------------
341
+
342
+ .bc-value-labels {
343
+ // Wrapper group (if used).
344
+ }
345
+
346
+ .bc-value-label-group {
347
+ // Group for animated value-label transitions.
348
+ }
349
+
350
+ .bc-value-label {
351
+ --bc-value-label-font-size: 11px;
352
+
353
+ font-size: var(--bc-value-label-font-size);
354
+ // fill is set via D3 .attr('fill') — uses contrastTextColor for inside-bar labels.
355
+ // Do NOT set fill in CSS — it would break contrast-based readability.
356
+ }
357
+
358
+ // ---------------------------------------------------------------------------
359
+ // Direct labels (line-multi, bar-multi)
360
+ // ---------------------------------------------------------------------------
361
+
362
+ .bc-direct-label {
363
+ --bc-direct-label-font-size: 12px;
364
+ --bc-direct-label-font-weight: 600;
365
+
366
+ font-size: var(--bc-direct-label-font-size);
367
+ font-weight: var(--bc-direct-label-font-weight);
368
+ }
369
+
370
+ // ---------------------------------------------------------------------------
371
+ // Tooltip
372
+ // ---------------------------------------------------------------------------
373
+
374
+ .bc-tooltip {
375
+ --bc-tooltip-bg: var(--bs-body-bg, #fff);
376
+ --bc-tooltip-color: var(--bs-body-color, #212529);
377
+ --bc-tooltip-border-color: var(--bs-border-color, #dee2e6);
378
+ --bc-tooltip-border-radius: 4px;
379
+ --bc-tooltip-padding: 6px 10px;
380
+ --bc-tooltip-font-size: 13px;
381
+ --bc-tooltip-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
382
+
383
+ position: absolute;
384
+ pointer-events: none;
385
+ background: var(--bc-tooltip-bg);
386
+ color: var(--bc-tooltip-color);
387
+ border: 1px solid var(--bc-tooltip-border-color);
388
+ border-radius: var(--bc-tooltip-border-radius);
389
+ padding: var(--bc-tooltip-padding);
390
+ font-size: var(--bc-tooltip-font-size);
391
+ box-shadow: var(--bc-tooltip-shadow);
392
+ z-index: 9999;
393
+ display: none;
394
+ }
395
+
396
+ // ---------------------------------------------------------------------------
397
+ // Crosshair
398
+ // ---------------------------------------------------------------------------
399
+
400
+ .bc-crosshair {
401
+ --bc-crosshair-color: #999;
402
+ --bc-crosshair-width: 1;
403
+
404
+ stroke: var(--bc-crosshair-color);
405
+ stroke-width: var(--bc-crosshair-width);
406
+ // stroke-dasharray is set via inline style by the crosshair/proximity plugins
407
+ // so that crosshairStyle ("solid", "dashed", "dotted") takes effect.
408
+ pointer-events: none;
409
+ }
410
+
411
+ .bc-crosshair-v {
412
+ // Inherits from .bc-crosshair.
413
+ }
414
+
415
+ .bc-crosshair-h {
416
+ // Inherits from .bc-crosshair.
417
+ }
418
+
419
+ // ---------------------------------------------------------------------------
420
+ // Arc labels (pie / donut)
421
+ // ---------------------------------------------------------------------------
422
+
423
+ .bc-arc-labels {
424
+ // Container group for outside arc labels.
425
+ }
426
+
427
+ .bc-arc-label-line {
428
+ --bc-arc-label-line-color: #999;
429
+ --bc-arc-label-line-width: 1;
430
+
431
+ fill: none;
432
+ stroke: var(--bc-arc-label-line-color);
433
+ stroke-width: var(--bc-arc-label-line-width);
434
+ }
435
+
436
+ .bc-arc-direct-label {
437
+ // font-size set inline from opts.fontSize.
438
+ // fill set inline per-tspan from readableColor / data color.
439
+ }
440
+
441
+ .bc-arc-labels-inside {
442
+ // Container group for inside arc labels.
443
+ }
444
+
445
+ .bc-arc-inside-label {
446
+ // font-size set inline from opts.fontSize.
447
+ // fill set inline from contrastTextColor.
448
+ }
449
+
450
+ // ---------------------------------------------------------------------------
451
+ // Annotations
452
+ // ---------------------------------------------------------------------------
453
+
454
+ .bc-annotations {
455
+ // Container group for point / free annotations.
456
+ }
457
+
458
+ .bc-annotations-range {
459
+ // Container group for range annotations (inserted first for z-order).
460
+ }
461
+
462
+ // ---------------------------------------------------------------------------
463
+ // Error state (runtime embed)
464
+ // ---------------------------------------------------------------------------
465
+
466
+ // ---------------------------------------------------------------------------
467
+ // Themes
468
+ // ---------------------------------------------------------------------------
469
+
470
+ @import "themes/blueprint";
471
+ @import "themes/blueprint-framed";
472
+
473
+ // ---------------------------------------------------------------------------
474
+ // Error state (runtime embed)
475
+ // ---------------------------------------------------------------------------
476
+
477
+ .blueprint-chart-error {
478
+ color: red;
479
+ padding: 1em;
480
+ border: 1px solid red;
481
+ }