@n1kname/components 0.11.0 → 0.12.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.
- package/package.json +1 -1
- package/src/DayStrips.astro +7 -1
- package/src/Figure.astro +34 -1
- package/src/daystrips.js +3 -2
package/package.json
CHANGED
package/src/DayStrips.astro
CHANGED
|
@@ -82,7 +82,8 @@ const { id, rows = 0, class: className, style, ...rest } = Astro.props;
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
/* A gap is cut into the strip: a hairline of card on each side keeps it apart from the days
|
|
85
|
-
around it. Too narrow for its stripes to show,
|
|
85
|
+
around it. Too narrow for its stripes to show, a gap that asks for something is drawn solid
|
|
86
|
+
in its colour, and a striped one is left as a clean cut of card. */
|
|
86
87
|
.day-strips :global(.strip .gap) {
|
|
87
88
|
box-shadow:
|
|
88
89
|
-1px 0 0 var(--c-surface),
|
|
@@ -100,6 +101,11 @@ const { id, rows = 0, class: className, style, ...rest } = Astro.props;
|
|
|
100
101
|
background: var(--mark);
|
|
101
102
|
}
|
|
102
103
|
|
|
104
|
+
.day-strips :global(.strip .gap.narrow[data-mark='stripes']) {
|
|
105
|
+
background: var(--c-surface);
|
|
106
|
+
box-shadow: none;
|
|
107
|
+
}
|
|
108
|
+
|
|
103
109
|
.day-strips :global(.ticks) {
|
|
104
110
|
position: relative;
|
|
105
111
|
height: 16px;
|
package/src/Figure.astro
CHANGED
|
@@ -29,7 +29,7 @@ const Title = level ? `h${level}` : 'p';
|
|
|
29
29
|
</div>
|
|
30
30
|
)
|
|
31
31
|
}
|
|
32
|
-
<slot
|
|
32
|
+
<div class="body"><slot /></div>
|
|
33
33
|
</div>
|
|
34
34
|
{caption && <figcaption>{caption}</figcaption>}
|
|
35
35
|
</figure>
|
|
@@ -43,6 +43,11 @@ const Title = level ? `h${level}` : 'p';
|
|
|
43
43
|
.field {
|
|
44
44
|
border: 1px solid var(--c-border);
|
|
45
45
|
border-radius: var(--radius-lg);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* The body is the container, not the field, so what's inside can respond to the room it has
|
|
49
|
+
and the field can still be a subgrid (containment would stop that). */
|
|
50
|
+
.body {
|
|
46
51
|
container-type: inline-size;
|
|
47
52
|
}
|
|
48
53
|
|
|
@@ -91,6 +96,34 @@ const Title = level ? `h${level}` : 'p';
|
|
|
91
96
|
color: var(--c-text-muted);
|
|
92
97
|
}
|
|
93
98
|
|
|
99
|
+
/* Side by side in a Grid, the cards in a row are one height and share their head's height, so
|
|
100
|
+
a subtitle on two lines in one card doesn't push its chart below the others. */
|
|
101
|
+
:global(.grid) > .figure {
|
|
102
|
+
display: grid;
|
|
103
|
+
grid-row: span 2;
|
|
104
|
+
grid-template-rows: subgrid;
|
|
105
|
+
row-gap: 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
:global(.grid) > .figure:has(> figcaption) {
|
|
109
|
+
grid-row: span 3;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
:global(.grid) > .figure > .field {
|
|
113
|
+
display: grid;
|
|
114
|
+
grid-row: span 2;
|
|
115
|
+
grid-template-rows: subgrid;
|
|
116
|
+
row-gap: 0;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
:global(.grid) > .figure .head {
|
|
120
|
+
grid-row: 1;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
:global(.grid) > .figure .body {
|
|
124
|
+
grid-row: 2;
|
|
125
|
+
}
|
|
126
|
+
|
|
94
127
|
figcaption {
|
|
95
128
|
margin-top: var(--sp-4);
|
|
96
129
|
font-size: var(--text-body-sm);
|
package/src/daystrips.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
// `states` says how each state looks: { label, mark, color, gap }. `mark` is a Legend mark:
|
|
7
7
|
// fill, stripes, or empty (not drawn on the strip, only in the tooltip and the legend). A `gap`
|
|
8
8
|
// state is drawn on top of the rest and never thinner than MIN_GAP_PX, so a one-day gap is
|
|
9
|
-
// never missed
|
|
9
|
+
// never missed. Too narrow for its stripes, a filled gap is drawn solid and a striped one as a
|
|
10
|
+
// clean cut. The colours are best the record
|
|
10
11
|
// state tokens, --c-state-complete, -waiting, -set-aside and -missing. Each stream is { label, title?, days, summary }: `days` its state per day,
|
|
11
12
|
// `summary` what a screen reader hears for its strip. Hovering shows the date and every
|
|
12
13
|
// stream whose state that day is not `quiet`.
|
|
@@ -14,7 +15,7 @@ import { esc } from './datatable.js';
|
|
|
14
15
|
|
|
15
16
|
// A one-day gap is about a pixel wide at a few years' scale; never draw one thinner than this.
|
|
16
17
|
const MIN_GAP_PX = 4;
|
|
17
|
-
// Below this, stripes are noise:
|
|
18
|
+
// Below this, stripes are noise: a striped gap is drawn as a clean cut instead.
|
|
18
19
|
const MIN_STRIPES_PX = 8;
|
|
19
20
|
const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
20
21
|
|