chartist 2.0.0-rc.2 → 2.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.
@@ -52,26 +52,48 @@
52
52
  }
53
53
  }
54
54
 
55
+ // The dark defaults follow the element's `color-scheme` through light-dark().
56
+ // A var() whose fallback a browser doesn't know computes to `unset`, so they
57
+ // sit in @supports and the plain declaration stays for older browsers.
55
58
  @mixin ct-chart-label(
56
59
  $ct-text-color: $ct-text-color,
57
60
  $ct-text-size: $ct-text-size,
58
- $ct-text-line-height: $ct-text-line-height
61
+ $ct-text-line-height: $ct-text-line-height,
62
+ $ct-text-color-dark: $ct-text-color-dark
59
63
  ) {
60
64
  fill: var(--ct-label-color, #{$ct-text-color});
61
65
  color: var(--ct-label-color, #{$ct-text-color});
62
66
  font-size: var(--ct-label-size, #{$ct-text-size});
63
67
  line-height: $ct-text-line-height;
68
+
69
+ @if $ct-text-color-dark {
70
+ @supports (color: light-dark(#000, #fff)) {
71
+ $color: light-dark(#{$ct-text-color}, #{$ct-text-color-dark});
72
+ fill: var(--ct-label-color, #{$color});
73
+ color: var(--ct-label-color, #{$color});
74
+ }
75
+ }
64
76
  }
65
77
 
66
78
  @mixin ct-chart-grid(
67
79
  $ct-grid-color: $ct-grid-color,
68
80
  $ct-grid-width: $ct-grid-width,
69
- $ct-grid-dasharray: $ct-grid-dasharray
81
+ $ct-grid-dasharray: $ct-grid-dasharray,
82
+ $ct-grid-color-dark: $ct-grid-color-dark
70
83
  ) {
71
84
  stroke: var(--ct-grid-color, #{$ct-grid-color});
72
85
  stroke-width: var(--ct-grid-width, #{$ct-grid-width});
73
86
  // Always emitted, so the property works; `none` is the initial value.
74
87
  stroke-dasharray: var(--ct-grid-dasharray, #{ct-or-none($ct-grid-dasharray)});
88
+
89
+ @if $ct-grid-color-dark {
90
+ @supports (color: light-dark(#000, #fff)) {
91
+ stroke: var(
92
+ --ct-grid-color,
93
+ light-dark(#{$ct-grid-color}, #{$ct-grid-color-dark})
94
+ );
95
+ }
96
+ }
75
97
  }
76
98
 
77
99
  @mixin ct-chart-point(
@@ -106,6 +128,54 @@
106
128
  stroke-width: var(--ct-donut-width, #{$ct-donut-width});
107
129
  }
108
130
 
131
+ // A series class on the element or a series group around it wins over the default color.
132
+ @mixin ct-chart-target-line(
133
+ $ct-target-line-color: $ct-target-line-color,
134
+ $ct-target-line-width: $ct-target-line-width,
135
+ $ct-target-line-dasharray: $ct-target-line-dasharray
136
+ ) {
137
+ fill: none;
138
+ stroke: var(
139
+ --ct-color,
140
+ var(--ct-target-line-color, #{$ct-target-line-color})
141
+ );
142
+ stroke-width: var(--ct-target-line-width, #{$ct-target-line-width});
143
+ stroke-dasharray: var(
144
+ --ct-target-line-dasharray,
145
+ #{ct-or-none($ct-target-line-dasharray)}
146
+ );
147
+ }
148
+
149
+ @mixin ct-chart-target-label(
150
+ $ct-target-line-color: $ct-target-line-color,
151
+ $ct-text-size: $ct-text-size
152
+ ) {
153
+ fill: var(--ct-color, var(--ct-target-line-color, #{$ct-target-line-color}));
154
+ font-size: var(--ct-label-size, #{$ct-text-size});
155
+ }
156
+
157
+ @mixin ct-chart-band-area(
158
+ $ct-band-color: $ct-band-color,
159
+ $ct-band-opacity: $ct-band-opacity
160
+ ) {
161
+ stroke: none;
162
+ fill: var(--ct-color, var(--ct-band-color, #{$ct-band-color}));
163
+ fill-opacity: var(--ct-band-opacity, #{$ct-band-opacity});
164
+ }
165
+
166
+ @mixin ct-chart-trend-line(
167
+ $ct-trend-line-width: $ct-trend-line-width,
168
+ $ct-trend-line-dasharray: $ct-trend-line-dasharray
169
+ ) {
170
+ fill: none;
171
+ stroke: var(--ct-color);
172
+ stroke-width: var(--ct-trend-line-width, #{$ct-trend-line-width});
173
+ stroke-dasharray: var(
174
+ --ct-trend-line-dasharray,
175
+ #{ct-or-none($ct-trend-line-dasharray)}
176
+ );
177
+ }
178
+
109
179
  // Sets the series color as `--ct-color`, which the series' elements use.
110
180
  @mixin ct-chart-series-color($color) {
111
181
  --ct-color: #{$color};
@@ -113,12 +183,16 @@
113
183
  .#{$ct-class-point},
114
184
  .#{$ct-class-line},
115
185
  .#{$ct-class-bar},
116
- .#{$ct-class-slice-donut} {
186
+ .#{$ct-class-slice-donut},
187
+ .#{$ct-class-trend-line},
188
+ .#{$ct-class-target-line} {
117
189
  stroke: var(--ct-color);
118
190
  }
119
191
 
120
192
  .#{$ct-class-slice-pie},
121
- .#{$ct-class-area} {
193
+ .#{$ct-class-area},
194
+ .#{$ct-class-target-label},
195
+ .#{$ct-class-band-area} {
122
196
  fill: var(--ct-color);
123
197
  }
124
198
  }
@@ -127,7 +201,9 @@
127
201
  $ct-container-ratio: $ct-container-ratio,
128
202
  $ct-text-color: $ct-text-color,
129
203
  $ct-text-size: $ct-text-size,
204
+ $ct-text-color-dark: $ct-text-color-dark,
130
205
  $ct-grid-color: $ct-grid-color,
206
+ $ct-grid-color-dark: $ct-grid-color-dark,
131
207
  $ct-grid-width: $ct-grid-width,
132
208
  $ct-grid-dasharray: $ct-grid-dasharray,
133
209
  $ct-point-size: $ct-point-size,
@@ -139,7 +215,11 @@
139
215
  $ct-series-colors: $ct-series-colors
140
216
  ) {
141
217
  .#{$ct-class-label} {
142
- @include ct-chart-label($ct-text-color, $ct-text-size);
218
+ @include ct-chart-label(
219
+ $ct-text-color,
220
+ $ct-text-size,
221
+ $ct-text-color-dark: $ct-text-color-dark
222
+ );
143
223
  }
144
224
 
145
225
  .#{$ct-class-chart-line} .#{$ct-class-label},
@@ -201,7 +281,12 @@
201
281
  }
202
282
 
203
283
  .#{$ct-class-grid} {
204
- @include ct-chart-grid($ct-grid-color, $ct-grid-width, $ct-grid-dasharray);
284
+ @include ct-chart-grid(
285
+ $ct-grid-color,
286
+ $ct-grid-width,
287
+ $ct-grid-dasharray,
288
+ $ct-grid-color-dark
289
+ );
205
290
  }
206
291
 
207
292
  .#{$ct-class-grid-background} {
@@ -228,6 +313,22 @@
228
313
  @include ct-chart-donut($ct-donut-width);
229
314
  }
230
315
 
316
+ .#{$ct-class-target-line} {
317
+ @include ct-chart-target-line();
318
+ }
319
+
320
+ .#{$ct-class-target-label} {
321
+ @include ct-chart-target-label($ct-target-line-color, $ct-text-size);
322
+ }
323
+
324
+ .#{$ct-class-band-area} {
325
+ @include ct-chart-band-area();
326
+ }
327
+
328
+ .#{$ct-class-trend-line} {
329
+ @include ct-chart-trend-line();
330
+ }
331
+
231
332
  @if $ct-include-colored-series {
232
333
  $colors: length($ct-series-colors);
233
334
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "chartist",
3
3
  "type": "module",
4
- "version": "2.0.0-rc.2",
4
+ "version": "2.0.0",
5
5
  "description": "Simple, responsive charts",
6
6
  "author": "Gion Kunz",
7
7
  "homepage": "https://chartist.dev",
@@ -70,6 +70,17 @@
70
70
  },
71
71
  "default": "./dist/compat.js"
72
72
  },
73
+ "./live": {
74
+ "import": {
75
+ "types": "./dist/live.d.ts",
76
+ "default": "./dist/live.js"
77
+ },
78
+ "require": {
79
+ "types": "./dist/live.d.cts",
80
+ "default": "./dist/live.cjs"
81
+ },
82
+ "default": "./dist/live.js"
83
+ },
73
84
  "./styles.css": "./dist/index.css",
74
85
  "./themes/*": "./dist/themes/*",
75
86
  "./scss/*": "./dist/scss/*",