@slotted/styles 0.1.0-beta.16 → 0.1.0-beta.17

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slotted/styles",
3
- "version": "0.1.0-beta.16",
3
+ "version": "0.1.0-beta.17",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,10 +29,20 @@
29
29
  min-inline-size: 0;
30
30
  }
31
31
 
32
+ /**
33
+ * A row is the unit a reader moves and resizes by; the tracks are twelve
34
+ * times finer (`DASHBOARD_SUBROWS` in `@slotted/core/dashboard-grid`), so a
35
+ * widget sized by its content ends within a twelfth of a row's step of it.
36
+ * The tracks have no gap between them: each widget draws the gap as its
37
+ * margin below, inside its own cells, and the grid takes the last one back.
38
+ * A widget of `h` rows is `h` rows and `h - 1` gaps tall, as before.
39
+ */
32
40
  [data-ui-dashboard-grid] > [data-part-grid] {
41
+ column-gap: var(--_gap);
33
42
  display: grid;
34
- gap: var(--_gap);
35
- grid-auto-rows: var(--_row);
43
+ grid-auto-rows: calc((var(--_row) + var(--_gap)) / 12);
44
+ margin-block-end: calc(-1 * var(--_gap));
45
+ row-gap: 0;
36
46
  grid-template-columns: repeat(var(--_cols), minmax(0, 1fr));
37
47
  list-style: none;
38
48
  margin: 0;
@@ -54,7 +64,8 @@
54
64
  */
55
65
  [data-ui-dashboard-grid] :is([data-part-widget], [data-part-placeholder]) {
56
66
  grid-column: var(--_dg-x, auto) / span var(--_dg-w, 4);
57
- grid-row: var(--_dg-y, auto) / span var(--_dg-h, 2);
67
+ grid-row: var(--_dg-y, auto) / span var(--_dg-h, 24);
68
+ margin-block-end: var(--_gap);
58
69
  min-block-size: 0;
59
70
  min-inline-size: 0;
60
71
  }
@@ -82,7 +93,7 @@
82
93
  [data-ui-dashboard-grid]:not([data-size-class])
83
94
  :is([data-part-widget], [data-part-placeholder]) {
84
95
  grid-column: auto / span var(--_dg-span-medium, 3);
85
- grid-row: auto / span var(--_dg-h, 2);
96
+ grid-row: auto / span var(--_dg-h, 24);
86
97
  }
87
98
  }
88
99
 
@@ -94,7 +105,7 @@
94
105
  [data-ui-dashboard-grid]:is([data-size-class='medium'], [data-size-class='compact'])
95
106
  :is([data-part-widget], [data-part-placeholder]) {
96
107
  grid-column: auto / span var(--_dg-span-medium, 3);
97
- grid-row: auto / span var(--_dg-h, 2);
108
+ grid-row: auto / span var(--_dg-h, 24);
98
109
  }
99
110
 
100
111
  @container dashboard-grid (width < 600px) {
@@ -148,8 +159,11 @@
148
159
 
149
160
  [data-ui-dashboard-grid] [data-part-widget] > [data-ui-card] > [data-part-body] {
150
161
  /* A chart's plot takes whatever height the widget leaves it, down to a
151
- floor of one and a half rows, instead of its own size step. */
162
+ floor of one and a half rows, instead of its own size step: the
163
+ reader sizes a widget, and every step answers to that size. */
152
164
  --slotted-chart-plot-block-size: calc(var(--_row) * 1.5);
165
+ --slotted-chart-plot-block-size-sm: calc(var(--_row) * 1.5);
166
+ --slotted-chart-plot-block-size-lg: calc(var(--_row) * 1.5);
153
167
 
154
168
  display: flex;
155
169
  flex-direction: column;
@@ -168,6 +182,16 @@
168
182
  flex: 1 0 auto;
169
183
  }
170
184
 
185
+ /* A widget sized by its content is measured by it: what its body holds
186
+ keeps its own height, and the cell is that height to a twelfth of a row. */
187
+ [data-ui-dashboard-grid]
188
+ [data-part-widget][data-rows='auto']
189
+ > [data-ui-card]
190
+ > [data-part-body]
191
+ > :not([data-part-busy-indicator]) {
192
+ flex-grow: 0;
193
+ }
194
+
171
195
  /**
172
196
  * The title is the widget's name and a card header's first line: the
173
197
  * medium step, semibold, two lines and then an ellipsis. The clamp never
@@ -28,6 +28,13 @@
28
28
  --slotted-stat-card-trend-inline-size,
29
29
  calc(var(--slotted-space-12, 4rem) * 1.5)
30
30
  );
31
+ /* The trend's height when it takes the last row and the card's whole
32
+ width: one step above the sparkline's own, because a line as wide as
33
+ the card at the sparkline's height reads flat. */
34
+ --_trend-block: var(--slotted-stat-card-trend-block-size, var(--slotted-space-11, 3rem));
35
+ /* The least height of a trend beside the figure, which otherwise takes
36
+ the figure's height: the sparkline's own step. */
37
+ --_trend-floor: var(--slotted-sparkline-block-size, var(--slotted-space-9, 2rem));
31
38
 
32
39
  --_surface: var(--slotted-stat-card-background, var(--slotted-surface-raised, Canvas));
33
40
  --_edge: var(--slotted-stat-card-border-color, var(--slotted-border-subtle, ButtonBorder));
@@ -102,6 +109,8 @@
102
109
  --_region-gap: var(--slotted-stat-card-region-gap-sm, var(--slotted-space-2, 0.25rem));
103
110
  --_trend-gap: var(--slotted-stat-card-trend-gap-sm, var(--slotted-space-5, 0.75rem));
104
111
  --_trend-size: var(--slotted-stat-card-trend-inline-size-sm, var(--slotted-space-12, 4rem));
112
+ --_trend-block: var(--slotted-stat-card-trend-block-size-sm, var(--slotted-space-9, 2rem));
113
+ --_trend-floor: var(--slotted-sparkline-block-size-sm, var(--slotted-space-7, 1.25rem));
105
114
  --_value-size: var(
106
115
  --slotted-stat-card-value-font-size-sm,
107
116
  var(--slotted-font-size-2xl, 1.25rem)
@@ -135,6 +144,8 @@
135
144
  --slotted-stat-card-trend-inline-size-lg,
136
145
  calc(var(--slotted-space-12, 4rem) * 2)
137
146
  );
147
+ --_trend-block: var(--slotted-stat-card-trend-block-size-lg, var(--slotted-space-12, 4rem));
148
+ --_trend-floor: var(--slotted-sparkline-block-size-lg, var(--slotted-space-11, 3rem));
138
149
  --_value-size: var(--slotted-stat-card-value-font-size-lg, var(--slotted-font-size-4xl, 2rem));
139
150
  --_value-line: var(
140
151
  --slotted-stat-card-value-line-height-lg,
@@ -239,8 +250,8 @@
239
250
  grid-template-areas:
240
251
  'header'
241
252
  'figure'
242
- 'trend'
243
- 'message';
253
+ 'message'
254
+ 'trend';
244
255
  grid-template-columns: minmax(0, 1fr);
245
256
  grid-template-rows: auto minmax(0, 1fr) auto auto;
246
257
  }
@@ -281,7 +292,7 @@
281
292
  /* The marker's ring is the card's ground, not the page's. */
282
293
  --slotted-sparkline-ring-color: var(--_surface);
283
294
 
284
- align-self: center;
295
+ align-self: stretch;
285
296
  container-name: stat-card-trend;
286
297
  container-type: inline-size;
287
298
  grid-area: trend;
@@ -298,10 +309,32 @@
298
309
  }
299
310
  }
300
311
 
312
+ /**
313
+ * On the last row the trend reaches the card's edges: its sides and its
314
+ * bottom bleed through the inset, and the card's corners round it. A line
315
+ * drawn inside the inset ends a gutter short of each edge and reads as a
316
+ * picture placed in the card; a line that runs to the frame reads as the
317
+ * card's ground. The edge is drawn over it, out of flow. A plain card has
318
+ * no inset, so the margins are nought there.
319
+ */
301
320
  @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
302
321
  :scope[data-layout='stacked'] [data-part-trend] {
303
322
  align-self: end;
323
+ border-end-end-radius: calc(var(--_radius) - var(--_edge-width));
324
+ border-end-start-radius: calc(var(--_radius) - var(--_edge-width));
325
+ margin-block-end: calc(-1 * var(--_inset-block));
304
326
  margin-block-start: var(--slotted-space-2, 0.25rem);
327
+ margin-inline: calc(-1 * var(--_inset-inline));
328
+ overflow: clip;
329
+ /* The region is wider than the column by the two insets. */
330
+ inline-size: auto;
331
+ }
332
+ }
333
+
334
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
335
+ :scope[data-layout='stacked'] [data-part-trend] > * {
336
+ block-size: var(--_trend-block);
337
+ min-block-size: 0;
305
338
  }
306
339
  }
307
340
 
@@ -324,8 +357,8 @@
324
357
  grid-template-areas:
325
358
  'header'
326
359
  'figure'
327
- 'trend'
328
- 'message';
360
+ 'message'
361
+ 'trend';
329
362
  grid-template-columns: minmax(0, 1fr);
330
363
  grid-template-rows: auto minmax(0, 1fr) auto auto;
331
364
  }
@@ -334,7 +367,21 @@
334
367
  @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
335
368
  :scope [data-part-trend] {
336
369
  align-self: end;
370
+ border-end-end-radius: calc(var(--_radius) - var(--_edge-width));
371
+ border-end-start-radius: calc(var(--_radius) - var(--_edge-width));
372
+ margin-block-end: calc(-1 * var(--_inset-block));
337
373
  margin-block-start: var(--slotted-space-2, 0.25rem);
374
+ margin-inline: calc(-1 * var(--_inset-inline));
375
+ overflow: clip;
376
+ /* The region is wider than the column by the two insets. */
377
+ inline-size: auto;
378
+ }
379
+ }
380
+
381
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
382
+ :scope [data-part-trend] > * {
383
+ block-size: var(--_trend-block);
384
+ min-block-size: 0;
338
385
  }
339
386
  }
340
387
 
@@ -636,11 +683,27 @@
636
683
  */
637
684
  @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
638
685
  :scope [data-part-trend] {
639
- align-self: center;
640
686
  display: flex;
641
687
  }
642
688
  }
643
689
 
690
+ /**
691
+ * Beside the figure the trend is as tall as the figure — the value, the
692
+ * delta and the comparison under them — so its last point is read level
693
+ * with the number it ends at, and no gap opens above or below a line of a
694
+ * fixed height centred on a taller column. The sparkline's own step is the
695
+ * floor, for a figure with no comparison.
696
+ */
697
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
698
+ :scope [data-part-trend] > * {
699
+ block-size: auto;
700
+ /* No height of its own to give the row: the drawing would otherwise
701
+ make the figure's row taller than the figure. */
702
+ contain: size;
703
+ min-block-size: var(--_trend-floor);
704
+ }
705
+ }
706
+
644
707
  @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
645
708
  :scope[data-tone='success'] [data-part-trend] {
646
709
  --slotted-sparkline-color: var(--slotted-tone-success-text);
@@ -713,9 +776,10 @@
713
776
 
714
777
  /**
715
778
  * The binding renders a `skeleton` in place of each text part and a block
716
- * in the trend, each the height of what it stands for; the sheet only has
717
- * to keep the trend's box at the sparkline's height so the card does not
718
- * change size when the line arrives.
779
+ * in the trend. The block is the trend region's child, so the rules that
780
+ * size a sparkline there size it too: the figure's height beside the
781
+ * figure, the card's width and `--_trend-block` on the last row. The card
782
+ * does not change size when the line arrives.
719
783
  */
720
784
  /**
721
785
  * The value's box is an inline flex line, so its height is its content's.
@@ -731,31 +795,4 @@
731
795
  min-block-size: calc(var(--_value-size) * var(--_value-line));
732
796
  }
733
797
  }
734
-
735
- @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
736
- :scope[data-loading] [data-part-trend] {
737
- --slotted-skeleton-block-size: var(
738
- --slotted-sparkline-block-size,
739
- var(--slotted-space-9, 2rem)
740
- );
741
- }
742
- }
743
-
744
- @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
745
- :scope[data-loading][data-size='sm'] [data-part-trend] {
746
- --slotted-skeleton-block-size: var(
747
- --slotted-sparkline-block-size-sm,
748
- var(--slotted-space-7, 1.25rem)
749
- );
750
- }
751
- }
752
-
753
- @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
754
- :scope[data-loading][data-size='lg'] [data-part-trend] {
755
- --slotted-skeleton-block-size: var(
756
- --slotted-sparkline-block-size-lg,
757
- var(--slotted-space-11, 3rem)
758
- );
759
- }
760
- }
761
798
  }
@@ -72,6 +72,9 @@
72
72
  "--slotted-stat-card-region-gap-sm",
73
73
  "--slotted-stat-card-shadow",
74
74
  "--slotted-stat-card-shadow-elevated",
75
+ "--slotted-stat-card-trend-block-size",
76
+ "--slotted-stat-card-trend-block-size-lg",
77
+ "--slotted-stat-card-trend-block-size-sm",
75
78
  "--slotted-stat-card-trend-gap",
76
79
  "--slotted-stat-card-trend-gap-lg",
77
80
  "--slotted-stat-card-trend-gap-sm",