@pioneer-code/pioneer-charts 22.2.5 → 22.2.7

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/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "type": "git",
23
23
  "url": "git+https://github.com/PioneerCode/pioneer-charts.git"
24
24
  },
25
- "version": "22.2.5",
25
+ "version": "22.2.7",
26
26
  "license": "MIT",
27
27
  "peerDependencies": {
28
28
  "@angular/common": "^22.1.0",
@@ -1,7 +1,9 @@
1
1
  // `!default` lets a consumer override any of these by configuring the entry point module (see
2
2
  // pioneer-charts.scss's `@forward` of this file) via `@use "@pioneer-code/pioneer-charts/scss/pioneer-charts"
3
3
  // with (...)`. These are the only Sass variables that actually drive rendered output in the
4
- // library (tooltip background/text, grid line color, plot-line-area styling) - a `$theme-colors`
4
+ // library (tooltip background/text, grid line color, plot-line-area styling); for the axis, grid
5
+ // and fan-out colors they're the fallback behind a `--pcac-*-color` custom property (see
6
+ // pioneer-charts.scss) that a chart's config or a stylesheet may set. A `$theme-colors`
5
7
  // Bootstrap-style map used to live here too, but nothing in the library ever read it (a leftover
6
8
  // from an abandoned Bootstrap integration, alongside the orphaned `bootstrap` devDependency and
7
9
  // footer.scss bug already removed elsewhere), so it was removed rather than wired up.
@@ -25,8 +25,12 @@
25
25
  border-radius: 2px;
26
26
  }
27
27
 
28
+ // Each color below is `var(--pcac-*-color, <theme color>)`. A builder sets the property on a
29
+ // part's group only when the chart's config gives that color (`PcacAxisConfig`'s `*Color` fields,
30
+ // `PcacPointFanOutConfig.spokeColor` / `anchorColor`), so a chart without one looks as before. A
31
+ // stylesheet can set the same property on any ancestor; a config value, on the group itself, wins.
28
32
  .pcac-grid-rule line {
29
- stroke: imports.$gray-200;
33
+ stroke: var(--pcac-grid-color, #{imports.$gray-200});
30
34
  }
31
35
 
32
36
  .pcac-x-axis,
@@ -40,11 +44,14 @@
40
44
  // Tick marks and the axis line are hidden by default (above) and always have been, so they
41
45
  // only appear on a chart that asks for them - `PcacAxisConfig.tickSize` for the marks,
42
46
  // `showLine` for the line - via a class the axis builder adds for that axis. Nothing changes
43
- // for charts that don't. Both share one color so a mark reads as part of its axis rather than a
44
- // separate, fainter element.
45
- &.pcac-axis-tick-marks .tick line,
47
+ // for charts that don't. Both share one default color so a mark reads as part of its axis
48
+ // rather than a separate, fainter element, but each has its own override.
49
+ &.pcac-axis-tick-marks .tick line {
50
+ stroke: var(--pcac-axis-tick-color, #{imports.$gray-900});
51
+ }
52
+
46
53
  &.pcac-axis-line .domain {
47
- stroke: imports.$gray-900;
54
+ stroke: var(--pcac-axis-line-color, #{imports.$gray-900});
48
55
  }
49
56
 
50
57
  // The axis `label` (its title). `PcacChart.AXIS_LABEL_SPACE` reserves room for this size plus
@@ -52,12 +59,22 @@
52
59
  .pcac-axis-label {
53
60
  font-size: 12px;
54
61
  font-weight: 600;
55
- fill: imports.$gray-700;
62
+ fill: var(--pcac-axis-label-color, #{imports.$gray-700});
56
63
  }
57
64
 
58
65
  // Min / mid / max `subLabels`; `PcacChart.AXIS_SUB_LABEL_SPACE` is sized to this.
59
66
  .pcac-axis-sub-label {
60
67
  font-size: 11px;
61
- fill: imports.$gray-600;
68
+ fill: var(--pcac-axis-sub-label-color, #{imports.$gray-600});
62
69
  }
63
- }
70
+ }
71
+
72
+ // Tick labels. d3-axis fills them `currentColor` by attribute; any stylesheet rule outranks
73
+ // that, so the fallback is the same value and a chart without `tickLabelColor` looks as before.
74
+ // Wrapped in `:where()` (specificity 0,0,1) rather than nested in the axis block above (0,2,1)
75
+ // so this rule still loses to a consumer's own `svg text { fill }` or `.dark-panel text { fill }`,
76
+ // as the bare attribute always did - the theme never styled tick labels before this rule, so it
77
+ // mustn't start beating CSS that consumers wrote against that.
78
+ :where(.pcac-x-axis, .pcac-y-axis) :where(.tick) text {
79
+ fill: var(--pcac-axis-tick-label-color, currentColor);
80
+ }
@@ -12,14 +12,15 @@
12
12
 
13
13
  // The plot chart's `pointFanOut` anchors (see PcacPointFanOutConfig.showAnchor): a spoke from
14
14
  // the shared coordinate to each fanned-out point, and a dot on the coordinate itself. Quiet
15
- // grays, like the grid, so they read as guides rather than data.
15
+ // grays, like the grid, so they read as guides rather than data. `spokeColor` / `anchorColor`
16
+ // override them through the custom properties, as the theme's axis colors do (pioneer-charts.scss).
16
17
  .fan-out-spoke {
17
- stroke: imports.$gray-400;
18
+ stroke: var(--pcac-fan-out-spoke-color, #{imports.$gray-400});
18
19
  stroke-width: 1px;
19
20
  }
20
21
 
21
22
  .fan-out-anchor {
22
- fill: imports.$gray-600;
23
+ fill: var(--pcac-fan-out-anchor-color, #{imports.$gray-600});
23
24
  }
24
25
 
25
26
  .effects-canvas {
@@ -15,7 +15,7 @@
15
15
  }
16
16
 
17
17
  .pcac-grid-rule line {
18
- stroke: #e9ecef;
18
+ stroke: var(--pcac-grid-color, #e9ecef);
19
19
  }
20
20
 
21
21
  .pcac-x-axis path,
@@ -24,19 +24,26 @@
24
24
  .pcac-y-axis line {
25
25
  stroke: none;
26
26
  }
27
- .pcac-x-axis.pcac-axis-tick-marks .tick line, .pcac-x-axis.pcac-axis-line .domain,
28
- .pcac-y-axis.pcac-axis-tick-marks .tick line,
27
+ .pcac-x-axis.pcac-axis-tick-marks .tick line,
28
+ .pcac-y-axis.pcac-axis-tick-marks .tick line {
29
+ stroke: var(--pcac-axis-tick-color, #212529);
30
+ }
31
+ .pcac-x-axis.pcac-axis-line .domain,
29
32
  .pcac-y-axis.pcac-axis-line .domain {
30
- stroke: #212529;
33
+ stroke: var(--pcac-axis-line-color, #212529);
31
34
  }
32
35
  .pcac-x-axis .pcac-axis-label,
33
36
  .pcac-y-axis .pcac-axis-label {
34
37
  font-size: 12px;
35
38
  font-weight: 600;
36
- fill: #495057;
39
+ fill: var(--pcac-axis-label-color, #495057);
37
40
  }
38
41
  .pcac-x-axis .pcac-axis-sub-label,
39
42
  .pcac-y-axis .pcac-axis-sub-label {
40
43
  font-size: 11px;
41
- fill: #6c757d;
44
+ fill: var(--pcac-axis-sub-label-color, #6c757d);
45
+ }
46
+
47
+ :where(.pcac-x-axis, .pcac-y-axis) :where(.tick) text {
48
+ fill: var(--pcac-axis-tick-label-color, currentColor);
42
49
  }
@@ -1 +1 @@
1
- .pcac-d3-tooltip{position:absolute;pointer-events:none;display:none;z-index:1000}.pcac-d3-tooltip-default{text-align:center;font-size:14px;padding:.5rem;background-color:rgba(52,58,64,.85);color:#fff;border-radius:2px}.pcac-grid-rule line{stroke:#e9ecef}.pcac-x-axis path,.pcac-x-axis line,.pcac-y-axis path,.pcac-y-axis line{stroke:none}.pcac-x-axis.pcac-axis-tick-marks .tick line,.pcac-x-axis.pcac-axis-line .domain,.pcac-y-axis.pcac-axis-tick-marks .tick line,.pcac-y-axis.pcac-axis-line .domain{stroke:#212529}.pcac-x-axis .pcac-axis-label,.pcac-y-axis .pcac-axis-label{font-size:12px;font-weight:600;fill:#495057}.pcac-x-axis .pcac-axis-sub-label,.pcac-y-axis .pcac-axis-sub-label{font-size:11px;fill:#6c757d}
1
+ .pcac-d3-tooltip{position:absolute;pointer-events:none;display:none;z-index:1000}.pcac-d3-tooltip-default{text-align:center;font-size:14px;padding:.5rem;background-color:rgba(52,58,64,.85);color:#fff;border-radius:2px}.pcac-grid-rule line{stroke:var(--pcac-grid-color, #e9ecef)}.pcac-x-axis path,.pcac-x-axis line,.pcac-y-axis path,.pcac-y-axis line{stroke:none}.pcac-x-axis.pcac-axis-tick-marks .tick line,.pcac-y-axis.pcac-axis-tick-marks .tick line{stroke:var(--pcac-axis-tick-color, #212529)}.pcac-x-axis.pcac-axis-line .domain,.pcac-y-axis.pcac-axis-line .domain{stroke:var(--pcac-axis-line-color, #212529)}.pcac-x-axis .pcac-axis-label,.pcac-y-axis .pcac-axis-label{font-size:12px;font-weight:600;fill:var(--pcac-axis-label-color, #495057)}.pcac-x-axis .pcac-axis-sub-label,.pcac-y-axis .pcac-axis-sub-label{font-size:11px;fill:var(--pcac-axis-sub-label-color, #6c757d)}:where(.pcac-x-axis,.pcac-y-axis) :where(.tick) text{fill:var(--pcac-axis-tick-label-color, currentColor)}
@@ -48,6 +48,11 @@ declare class PcacAxisSubLabels {
48
48
  * Every field is optional so an object-literal / JSON config can give just the ones it cares
49
49
  * about (or omit the axis entirely); the initializers apply to anything built with `new`, and
50
50
  * `resolveAxisConfig()` fills the rest in for builders.
51
+ *
52
+ * The `*Color` fields each color one part of this axis, with any CSS color. Unset, the part keeps
53
+ * the theme's color. A color never turns a part on - it only shows once the part is drawn. Each
54
+ * is applied to the axis as the CSS custom property named on the field, so a stylesheet can set
55
+ * the same property on any ancestor instead; a config value wins.
51
56
  */
52
57
  declare class PcacAxisConfig {
53
58
  /**
@@ -65,6 +70,11 @@ declare class PcacAxisConfig {
65
70
  * default.
66
71
  */
67
72
  showGrid?: boolean;
73
+ /**
74
+ * Grid line color (`--pcac-grid-color`), shown while this axis's grid is drawn - see `showGrid`.
75
+ * Theme default `$gray-200`.
76
+ */
77
+ gridColor?: string;
68
78
  /**
69
79
  * Requested number of ticks (D3's `ticks()` hint, so the actual count can differ slightly) -
70
80
  * also the number of grid lines for this axis. Ignored by a category (band) axis, which has one
@@ -82,12 +92,26 @@ declare class PcacAxisConfig {
82
92
  * (`.pcac-axis-tick-marks .tick line`, `$gray-900`, the same as the axis line).
83
93
  */
84
94
  tickSize?: number;
95
+ /**
96
+ * Tick mark color (`--pcac-axis-tick-color`), shown once `tickSize` has turned the marks on.
97
+ * Theme default `$gray-900`.
98
+ */
99
+ tickColor?: string;
100
+ /**
101
+ * Tick label color (`--pcac-axis-tick-label-color`) - the values along the axis. Default is the
102
+ * page's text color (`currentColor`), as d3-axis has always drawn them.
103
+ */
104
+ tickLabelColor?: string;
85
105
  /**
86
106
  * Draw a solid line along the axis itself (the full length of the axis, with D3's short
87
107
  * end-caps). Off by default, as the theme has always hidden it. Color comes from the theme
88
108
  * (`.pcac-axis-line .domain`, `$gray-900`).
89
109
  */
90
110
  showLine?: boolean;
111
+ /**
112
+ * Axis line color (`--pcac-axis-line-color`), shown with `showLine` on. Theme default `$gray-900`.
113
+ */
114
+ lineColor?: string;
91
115
  /**
92
116
  * A title for the whole axis (e.g. "Revenue ($)"), drawn centered along it just inside the
93
117
  * chart's edge: below the tick labels for the x axis, rotated to read bottom-to-top left of
@@ -96,6 +120,8 @@ declare class PcacAxisConfig {
96
120
  * by the theme's `.pcac-axis-label` rule.
97
121
  */
98
122
  label?: string;
123
+ /** `label` color (`--pcac-axis-label-color`). Theme default `$gray-700`. */
124
+ labelColor?: string;
99
125
  /**
100
126
  * Min / mid / max sub labels (e.g. "Low" / "Medium" / "High") in their own row just outside the
101
127
  * tick labels, and inside the `label` if there is one: `min` left-aligned at the axis's start,
@@ -105,6 +131,8 @@ declare class PcacAxisConfig {
105
131
  * hidden axis. Styled by the theme's `.pcac-axis-sub-label` rule.
106
132
  */
107
133
  subLabels?: PcacAxisSubLabels;
134
+ /** `subLabels` color, all three (`--pcac-axis-sub-label-color`). Theme default `$gray-600`. */
135
+ subLabelColor?: string;
108
136
  /**
109
137
  * How the values along this axis are interpreted and shown - the tick labels, and the value
110
138
  * (`yAxis`) or key (`xAxis`) in the default tooltip. On the line/area/plot charts the x axis's
@@ -137,10 +165,12 @@ interface PcacChartMargin {
137
165
  }
138
166
  /**
139
167
  * `PcacAxisConfig` with every default applied - what builders work with, so they never have to
140
- * null-check. `tickSize`, `label` and `subLabels` stay optional: "not set" is itself the meaningful
141
- * default (no marks, no labels).
168
+ * null-check. `tickSize`, `label`, `subLabels` and the `*Color` fields stay optional: "not set"
169
+ * is itself the meaningful default (no marks, no labels, the theme's colors). The color fields
170
+ * are picked up by name, so a new one needs only its declaration on the class.
142
171
  */
143
- type PcacResolvedAxisConfig = Required<Omit<PcacAxisConfig, 'tickSize' | 'label' | 'subLabels'>> & Pick<PcacAxisConfig, 'tickSize' | 'label' | 'subLabels'>;
172
+ type PcacOptionalAxisFields = 'tickSize' | 'label' | 'subLabels' | Extract<keyof PcacAxisConfig, `${string}Color`>;
173
+ type PcacResolvedAxisConfig = Required<Omit<PcacAxisConfig, PcacOptionalAxisFields>> & Pick<PcacAxisConfig, PcacOptionalAxisFields>;
144
174
  /** True if `axis` has at least one sub label to draw (an empty `subLabels` object counts as none). */
145
175
  declare function hasAxisSubLabels(axis: PcacAxisConfig | undefined): boolean;
146
176
  /**
@@ -235,7 +265,8 @@ interface IPcacAxisBuilderConfig<XDomain extends AxisDomain = AxisDomain, YDomai
235
265
  * D3's default 6px outer end-caps (`tickSizeOuter`), so it reads as a bracket rather than a
236
266
  * bare rule; that's D3's standard look and is left as-is. `label` and `subLabels` are drawn
237
267
  * inside the axis group (so they're raised and non-interactive along with it) - see `drawLabels`.
238
- * `format` picks the tick label format; `None` leaves D3's default.
268
+ * `format` picks the tick label format; `None` leaves D3's default. The `*Color` fields are
269
+ * applied by `applyColors`.
239
270
  */
240
271
  xAxis: PcacResolvedAxisConfig;
241
272
  yAxis: PcacResolvedAxisConfig;
@@ -288,6 +319,12 @@ interface IPcacGridBuilderConfig<XDomain extends AxisDomain = AxisDomain, YDomai
288
319
  * and gets one line per category.
289
320
  */
290
321
  numberOfTicks: number;
322
+ /**
323
+ * Line color (`PcacAxisConfig.gridColor`), set on the grid group as `--pcac-grid-color` for the
324
+ * theme's `.pcac-grid-rule line` rule to read; unset means the theme's color. See the axis
325
+ * builder's `applyColors` for why a custom property.
326
+ */
327
+ color?: string;
291
328
  }
292
329
  declare class PcacGridBuilder {
293
330
  /**
@@ -910,20 +947,29 @@ declare class PcacLineAreaChartConfig extends PcacAxisChartConfig {
910
947
  declare class PcacPointFanOutConfig {
911
948
  /**
912
949
  * Ring radius in px, the same for every group. When not set, each group gets the smallest
913
- * radius at which its neighbours sit `gap` px apart - so a pair barely moves while a group of
950
+ * radius at which its neighbors sit `gap` px apart - so a pair barely moves while a group of
914
951
  * five spreads as far as it has to.
915
952
  */
916
953
  radius?: number;
917
954
  /**
918
- * Space between neighbouring points on the ring, in px, when `radius` is not set. Measured
955
+ * Space between neighboring points on the ring, in px, when `radius` is not set. Measured
919
956
  * between their image boxes (or hovered dots), not their centers.
920
957
  */
921
958
  gap: number;
922
959
  /**
923
960
  * Draw a dot at the shared coordinate - the value the group's points actually have - with a
924
- * spoke out to each of them. Styled by the theme's `.fan-out-anchor` / `.fan-out-spoke` rules.
961
+ * spoke out to each of them. Styled by the theme's `.fan-out-anchor` / `.fan-out-spoke` rules,
962
+ * whose colors `anchorColor` / `spokeColor` override.
925
963
  */
926
964
  showAnchor: boolean;
965
+ /**
966
+ * Spoke color, any CSS color; theme default `$gray-400`. Applied as `--pcac-fan-out-spoke-color`
967
+ * on the chart's `.fan-outs` group, so a stylesheet can set it on an ancestor instead (a config
968
+ * value wins). Needs `showAnchor`.
969
+ */
970
+ spokeColor?: string;
971
+ /** Anchor dot color, likewise (`--pcac-fan-out-anchor-color`); theme default `$gray-600`. */
972
+ anchorColor?: string;
927
973
  }
928
974
  declare class PcacPlotChartConfig extends PcacLineAreaChartConfig {
929
975
  /**