@@ -11,39 +11,42 @@ export default {
11
11
const conf = {
12
12
component : 'cc-tile-metrics' ,
13
13
// language=CSS
14
- css : `cc-tile-metrics {
15
- margin-bottom: 1em;
16
- }` ,
14
+ css : `
15
+ cc-tile-metrics {
16
+ margin-bottom: 1em;
17
+ }
18
+
19
+ cc-tile-metrics:nth-of-type(1) {
20
+ max-width: 23.75em
21
+ }
22
+
23
+ cc-tile-metrics:nth-of-type(2) {
24
+ max-width: 33.75em
25
+ }
26
+ ` ,
17
27
} ;
18
28
19
29
/**
20
30
* @typedef {import('./cc-tile-metrics.js').CcTileMetrics } CcTileMetrics
21
31
* @typedef {import('./cc-tile-metrics.types.js').TileMetricsMetricsStateLoaded } TileMetricsStateLoaded
22
- * @typedef {import('./cc-tile-metrics.types.js').TileMetricsMetricsStateEmpty } TileMetricsStateEmpty
23
- * @typedef {import('./cc-tile-metrics.types.js').TileMetricsMetricsStateLoading } TileMetricsStateLoading
24
- * @typedef {import('./cc-tile-metrics.types.js').TileMetricsMetricsStateError } TileMetricsStateError
25
- * @typedef {import('./cc-tile-metrics.types.js').TileMetricsGrafanaLinkStateLoaded } TileMetricsGrafanaLinkStateLoaded
26
- * @typedef {import('./cc-tile-metrics.types.js').TileMetricsGrafanaLinkStateLoading } TileMetricsGrafanaLinkStateLoading
27
32
* @typedef {import('./cc-tile-metrics.types.js').Metric } Metric
28
33
*/
29
34
30
- /** @type {{ grafanaLinkState: TileMetricsGrafanaLinkStateLoaded, metricsLink: string, style?: string }[] } */
35
+ /** @type {Array<Partial<CcTileMetrics>> } */
31
36
const baseItems = [
32
37
{
33
38
grafanaLinkState : {
34
39
type : 'loaded' ,
35
40
link : 'https://grafana.example.com/small' ,
36
41
} ,
37
- metricsLink : 'https://metrics.example.com/small' ,
38
- style : 'max-width: 23.75em' ,
42
+ metricsLink : 'https://metrics.example.com' ,
39
43
} ,
40
44
{
41
45
grafanaLinkState : {
42
46
type : 'loaded' ,
43
47
link : 'https://grafana.example.com/medium' ,
44
48
} ,
45
49
metricsLink : 'https://metrics.example.com/medium' ,
46
- style : 'max-width: 33.75em' ,
47
50
} ,
48
51
{
49
52
grafanaLinkState : {
@@ -89,9 +92,9 @@ function addTimestamp(array) {
89
92
}
90
93
91
94
export const defaultStory = makeStory ( conf , {
95
+ /** @type {Array<Partial<CcTileMetrics>> } */
92
96
items : baseItems . map ( ( item ) => ( {
93
97
...item ,
94
- /** @type {TileMetricsStateLoaded } */
95
98
metricsState : {
96
99
type : 'loaded' ,
97
100
metricsData : {
@@ -103,7 +106,7 @@ export const defaultStory = makeStory(conf, {
103
106
} ) ;
104
107
105
108
export const loading = makeStory ( conf , {
106
- /** @type {{ metricsState: TileMetricsStateLoading, grafanaLinkState: TileMetricsGrafanaLinkStateLoading, style?: string }[] } */
109
+ /** @type {Array<Partial<CcTileMetrics>> } */
107
110
items : baseItems . map ( ( item ) => ( {
108
111
...item ,
109
112
metricsState : { type : 'loading' } ,
@@ -112,19 +115,19 @@ export const loading = makeStory(conf, {
112
115
} ) ;
113
116
114
117
export const empty = makeStory ( conf , {
115
- /** @type {{ metricsState: TileMetricsStateEmpty, style?: string }[] } */
118
+ /** @type {Array<Partial<CcTileMetrics>> } */
116
119
items : baseItems . map ( ( item ) => ( { ...item , metricsState : { type : 'empty' } } ) ) ,
117
120
} ) ;
118
121
119
122
export const error = makeStory ( conf , {
120
- /** @type {{ metricsState: TileMetricsStateError, style?: string }[] } */
123
+ /** @type {Array<Partial<CcTileMetrics>> } */
121
124
items : baseItems . map ( ( item ) => ( { ...item , metricsState : { type : 'error' } } ) ) ,
122
125
} ) ;
123
126
124
127
export const dataLoadedWithHighValues = makeStory ( conf , {
128
+ /** @type {Array<Partial<CcTileMetrics>> } */
125
129
items : baseItems . map ( ( item ) => ( {
126
130
...item ,
127
- /** @type {TileMetricsStateLoaded } */
128
131
metricsState : {
129
132
type : 'loaded' ,
130
133
metricsData : {
@@ -136,9 +139,9 @@ export const dataLoadedWithHighValues = makeStory(conf, {
136
139
} ) ;
137
140
138
141
export const peaks = makeStory ( conf , {
142
+ /** @type {Array<Partial<CcTileMetrics>> } */
139
143
items : baseItems . map ( ( item ) => ( {
140
144
...item ,
141
- /** @type {TileMetricsStateLoaded } */
142
145
metricsState : {
143
146
type : 'loaded' ,
144
147
metricsData : {
@@ -156,9 +159,9 @@ export const peaks = makeStory(conf, {
156
159
} ) ;
157
160
158
161
export const linearIncrease = makeStory ( conf , {
162
+ /** @type {Array<Partial<CcTileMetrics>> } */
159
163
items : baseItems . map ( ( item ) => ( {
160
164
...item ,
161
- /** @type {TileMetricsStateLoaded } */
162
165
metricsState : {
163
166
type : 'loaded' ,
164
167
metricsData : {
@@ -170,9 +173,9 @@ export const linearIncrease = makeStory(conf, {
170
173
} ) ;
171
174
172
175
export const scaleUp = makeStory ( conf , {
176
+ /** @type {Array<Partial<CcTileMetrics>> } */
173
177
items : baseItems . map ( ( item ) => ( {
174
178
...item ,
175
- /** @type {TileMetricsStateLoaded } */
176
179
metricsState : {
177
180
type : 'loaded' ,
178
181
metricsData : {
@@ -184,9 +187,9 @@ export const scaleUp = makeStory(conf, {
184
187
} ) ;
185
188
186
189
export const scaleDown = makeStory ( conf , {
190
+ /** @type {Array<Partial<CcTileMetrics>> } */
187
191
items : baseItems . map ( ( item ) => ( {
188
192
...item ,
189
- /** @type {TileMetricsStateLoaded } */
190
193
metricsState : {
191
194
type : 'loaded' ,
192
195
metricsData : {
@@ -198,9 +201,9 @@ export const scaleDown = makeStory(conf, {
198
201
} ) ;
199
202
200
203
export const multipleScaleUp = makeStory ( conf , {
204
+ /** @type {Array<Partial<CcTileMetrics>> } */
201
205
items : baseItems . map ( ( item ) => ( {
202
206
...item ,
203
- /** @type {TileMetricsStateLoaded } */
204
207
metricsState : {
205
208
type : 'loaded' ,
206
209
metricsData : {
@@ -216,9 +219,9 @@ export const multipleScaleUp = makeStory(conf, {
216
219
} ) ;
217
220
218
221
export const multipleScaleDown = makeStory ( conf , {
222
+ /** @type {Array<Partial<CcTileMetrics>> } */
219
223
items : baseItems . map ( ( item ) => ( {
220
224
...item ,
221
- /** @type {TileMetricsStateLoaded } */
222
225
metricsState : {
223
226
type : 'loaded' ,
224
227
metricsData : {
@@ -238,9 +241,9 @@ export const multipleScaleDown = makeStory(conf, {
238
241
} ) ;
239
242
240
243
export const bigScaleUp = makeStory ( conf , {
244
+ /** @type {Array<Partial<CcTileMetrics>> } */
241
245
items : baseItems . map ( ( item ) => ( {
242
246
...item ,
243
- /** @type {TileMetricsStateLoaded } */
244
247
metricsState : {
245
248
type : 'loaded' ,
246
249
metricsData : {
@@ -252,9 +255,9 @@ export const bigScaleUp = makeStory(conf, {
252
255
} ) ;
253
256
254
257
export const bigScaleDown = makeStory ( conf , {
258
+ /** @type {Array<Partial<CcTileMetrics>> } */
255
259
items : baseItems . map ( ( item ) => ( {
256
260
...item ,
257
- /** @type {TileMetricsStateLoaded } */
258
261
metricsState : {
259
262
type : 'loaded' ,
260
263
metricsData : {
@@ -266,9 +269,9 @@ export const bigScaleDown = makeStory(conf, {
266
269
} ) ;
267
270
268
271
export const appDown = makeStory ( conf , {
272
+ /** @type {Array<Partial<CcTileMetrics>> } */
269
273
items : baseItems . map ( ( item ) => ( {
270
274
...item ,
271
- /** @type {TileMetricsStateLoaded } */
272
275
metricsState : {
273
276
type : 'loaded' ,
274
277
metricsData : {
@@ -280,6 +283,7 @@ export const appDown = makeStory(conf, {
280
283
} ) ;
281
284
282
285
export const simulationsWithData = makeStory ( conf , {
286
+ /** @type {Array<Partial<CcTileMetrics>> } */
283
287
items : baseItems . map ( ( baseItem ) => ( {
284
288
...baseItem ,
285
289
metricsState : { type : 'loading' } ,
0 commit comments