@canonical/styles 0.36.0 → 0.38.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.
@@ -41,158 +41,165 @@
41
41
  * (label→input 8px, between-fields 40px), and space-xs (label→description 4px)
42
42
  * added, replacing the earlier graded 16/24 rungs. The values stay whole
43
43
  * baseline multiples, so vertical rhythm holds.
44
+ *
45
+ * Layer: ds.modifiers, beside the generated modifier families this one composes
46
+ * with. Every rule here declares custom properties only — the density channel —
47
+ * which act where a component reads them. The context and density classes may
48
+ * sit on the document element or on any ancestor of the components that read
49
+ * them, because a custom property inherits.
44
50
  */
45
51
 
46
- /* ── Context family: the comfortable/dense PAIR per surface ──────────────────
47
- * The internal pair-vars are namespaced `--density-*-comfy/-dense` — they ship on
48
- * the global @canonical/styles surface, so a bare name like `--lh-comfy` would be
49
- * an easy collision with an app-level variable. The pre-namespace names are kept
50
- * as back-compat ALIASES (an app or an older ds-global-form that read `--lh-comfy`
51
- * directly still resolves) — same computed values, no output change. Read the
52
- * namespaced name in new code; the aliases exist only for the transition. */
53
- .app {
54
- --density-lh-comfy: calc(var(--baseline-height) * 8); /* 32px */
55
- --density-lh-dense: calc(var(--baseline-height) * 6); /* 24px */
56
- --density-pad-inline-comfy: calc(var(--baseline-height) * 4); /* 16px */
57
- --density-pad-inline-dense: calc(var(--baseline-height) * 2); /* 8px */
58
- --density-space-lg-comfy: calc(var(--baseline-height) * 10); /* 40px */
59
- --density-space-lg-dense: calc(var(--baseline-height) * 8); /* 32px */
60
- --density-space-md-comfy: calc(var(--baseline-height) * 2); /* 8px */
61
- --density-space-md-dense: calc(var(--baseline-height) * 1); /* 4px */
62
- --density-space-sm-comfy: calc(var(--baseline-height) * 2); /* 8px */
63
- --density-space-sm-dense: calc(var(--baseline-height) * 1); /* 4px */
64
- --density-space-xs-comfy: calc(var(--baseline-height) * 1); /* 4px */
65
- --density-space-xs-dense: calc(var(--baseline-height) * 1); /* 4px */
52
+ @layer ds.modifiers {
53
+ /* ── Context family: the comfortable/dense PAIR per surface ──────────────────
54
+ * The internal pair-vars are namespaced `--density-*-comfy/-dense` — they ship on
55
+ * the global @canonical/styles surface, so a bare name like `--lh-comfy` would be
56
+ * an easy collision with an app-level variable. The pre-namespace names are kept
57
+ * as back-compat ALIASES (an app or an older ds-global-form that read `--lh-comfy`
58
+ * directly still resolves) — same computed values, no output change. Read the
59
+ * namespaced name in new code; the aliases exist only for the transition. */
60
+ .app {
61
+ --density-lh-comfy: calc(var(--baseline-height) * 8); /* 32px */
62
+ --density-lh-dense: calc(var(--baseline-height) * 6); /* 24px */
63
+ --density-pad-inline-comfy: calc(var(--baseline-height) * 4); /* 16px */
64
+ --density-pad-inline-dense: calc(var(--baseline-height) * 2); /* 8px */
65
+ --density-space-lg-comfy: calc(var(--baseline-height) * 10); /* 40px */
66
+ --density-space-lg-dense: calc(var(--baseline-height) * 8); /* 32px */
67
+ --density-space-md-comfy: calc(var(--baseline-height) * 2); /* 8px */
68
+ --density-space-md-dense: calc(var(--baseline-height) * 1); /* 4px */
69
+ --density-space-sm-comfy: calc(var(--baseline-height) * 2); /* 8px */
70
+ --density-space-sm-dense: calc(var(--baseline-height) * 1); /* 4px */
71
+ --density-space-xs-comfy: calc(var(--baseline-height) * 1); /* 4px */
72
+ --density-space-xs-dense: calc(var(--baseline-height) * 1); /* 4px */
66
73
 
67
- /* Back-compat aliases (pre-namespace names). Remove once no consumer reads them. */
68
- --lh-comfy: var(--density-lh-comfy);
69
- --lh-dense: var(--density-lh-dense);
70
- --pad-inline-comfy: var(--density-pad-inline-comfy);
71
- --pad-inline-dense: var(--density-pad-inline-dense);
72
- --space-lg-comfy: var(--density-space-lg-comfy);
73
- --space-lg-dense: var(--density-space-lg-dense);
74
- --space-md-comfy: var(--density-space-md-comfy);
75
- --space-md-dense: var(--density-space-md-dense);
76
- --space-sm-comfy: var(--density-space-sm-comfy);
77
- --space-sm-dense: var(--density-space-sm-dense);
78
- }
79
- .site,
80
- .docs {
81
- --density-lh-comfy: calc(var(--baseline-height) * 9); /* 36px */
82
- --density-lh-dense: calc(var(--baseline-height) * 7); /* 28px */
83
- --density-pad-inline-comfy: calc(var(--baseline-height) * 4); /* 16px */
84
- --density-pad-inline-dense: calc(var(--baseline-height) * 3); /* 12px */
85
- --density-space-lg-comfy: calc(var(--baseline-height) * 11); /* 44px */
86
- --density-space-lg-dense: calc(var(--baseline-height) * 9); /* 36px */
87
- --density-space-md-comfy: calc(var(--baseline-height) * 2); /* 8px */
88
- --density-space-md-dense: calc(var(--baseline-height) * 2); /* 8px */
89
- --density-space-sm-comfy: calc(var(--baseline-height) * 2); /* 8px */
90
- --density-space-sm-dense: calc(var(--baseline-height) * 2); /* 8px */
91
- --density-space-xs-comfy: calc(var(--baseline-height) * 1); /* 4px */
92
- --density-space-xs-dense: calc(var(--baseline-height) * 1); /* 4px */
74
+ /* Back-compat aliases (pre-namespace names). Remove once no consumer reads them. */
75
+ --lh-comfy: var(--density-lh-comfy);
76
+ --lh-dense: var(--density-lh-dense);
77
+ --pad-inline-comfy: var(--density-pad-inline-comfy);
78
+ --pad-inline-dense: var(--density-pad-inline-dense);
79
+ --space-lg-comfy: var(--density-space-lg-comfy);
80
+ --space-lg-dense: var(--density-space-lg-dense);
81
+ --space-md-comfy: var(--density-space-md-comfy);
82
+ --space-md-dense: var(--density-space-md-dense);
83
+ --space-sm-comfy: var(--density-space-sm-comfy);
84
+ --space-sm-dense: var(--density-space-sm-dense);
85
+ }
86
+ .site,
87
+ .docs {
88
+ --density-lh-comfy: calc(var(--baseline-height) * 9); /* 36px */
89
+ --density-lh-dense: calc(var(--baseline-height) * 7); /* 28px */
90
+ --density-pad-inline-comfy: calc(var(--baseline-height) * 4); /* 16px */
91
+ --density-pad-inline-dense: calc(var(--baseline-height) * 3); /* 12px */
92
+ --density-space-lg-comfy: calc(var(--baseline-height) * 11); /* 44px */
93
+ --density-space-lg-dense: calc(var(--baseline-height) * 9); /* 36px */
94
+ --density-space-md-comfy: calc(var(--baseline-height) * 2); /* 8px */
95
+ --density-space-md-dense: calc(var(--baseline-height) * 2); /* 8px */
96
+ --density-space-sm-comfy: calc(var(--baseline-height) * 2); /* 8px */
97
+ --density-space-sm-dense: calc(var(--baseline-height) * 2); /* 8px */
98
+ --density-space-xs-comfy: calc(var(--baseline-height) * 1); /* 4px */
99
+ --density-space-xs-dense: calc(var(--baseline-height) * 1); /* 4px */
93
100
 
94
- /* Back-compat aliases (pre-namespace names). Remove once no consumer reads them. */
95
- --lh-comfy: var(--density-lh-comfy);
96
- --lh-dense: var(--density-lh-dense);
97
- --pad-inline-comfy: var(--density-pad-inline-comfy);
98
- --pad-inline-dense: var(--density-pad-inline-dense);
99
- --space-lg-comfy: var(--density-space-lg-comfy);
100
- --space-lg-dense: var(--density-space-lg-dense);
101
- --space-md-comfy: var(--density-space-md-comfy);
102
- --space-md-dense: var(--density-space-md-dense);
103
- --space-sm-comfy: var(--density-space-sm-comfy);
104
- --space-sm-dense: var(--density-space-sm-dense);
105
- }
101
+ /* Back-compat aliases (pre-namespace names). Remove once no consumer reads them. */
102
+ --lh-comfy: var(--density-lh-comfy);
103
+ --lh-dense: var(--density-lh-dense);
104
+ --pad-inline-comfy: var(--density-pad-inline-comfy);
105
+ --pad-inline-dense: var(--density-pad-inline-dense);
106
+ --space-lg-comfy: var(--density-space-lg-comfy);
107
+ --space-lg-dense: var(--density-space-lg-dense);
108
+ --space-md-comfy: var(--density-space-md-comfy);
109
+ --space-md-dense: var(--density-space-md-dense);
110
+ --space-sm-comfy: var(--density-space-sm-comfy);
111
+ --space-sm-dense: var(--density-space-sm-dense);
112
+ }
106
113
 
107
- /* ── Density family: pick within the context pair ────────────────────────────
108
- * Each density tier resolves every GENERIC primitive from the context's
109
- * *-comfy / *-dense pair. Fallbacks cover the app-comfortable defaults when no
110
- * context class is present (a plain `.comfortable` still works). */
111
- .comfortable {
112
- --density-line-height: var(
113
- --density-lh-comfy,
114
- calc(var(--baseline-height) * 8)
115
- );
116
- --density-padding-inline: var(
117
- --density-pad-inline-comfy,
118
- calc(var(--baseline-height) * 4)
119
- );
120
- --density-space-lg: var(
121
- --density-space-lg-comfy,
122
- calc(var(--baseline-height) * 10)
123
- );
124
- --density-space-md: var(
125
- --density-space-md-comfy,
126
- calc(var(--baseline-height) * 2)
127
- );
128
- --density-space-sm: var(
129
- --density-space-sm-comfy,
130
- calc(var(--baseline-height) * 2)
131
- );
132
- --density-space-xs: var(
133
- --density-space-xs-comfy,
134
- calc(var(--baseline-height) * 1)
135
- );
136
- }
137
- .dense {
138
- --density-line-height: var(
139
- --density-lh-dense,
140
- calc(var(--baseline-height) * 6)
141
- );
142
- --density-padding-inline: var(
143
- --density-pad-inline-dense,
144
- calc(var(--baseline-height) * 2)
145
- );
146
- --density-space-lg: var(
147
- --density-space-lg-dense,
148
- calc(var(--baseline-height) * 8)
149
- );
150
- --density-space-md: var(
151
- --density-space-md-dense,
152
- calc(var(--baseline-height) * 1)
153
- );
154
- --density-space-sm: var(
155
- --density-space-sm-dense,
156
- calc(var(--baseline-height) * 1)
157
- );
158
- --density-space-xs: var(
159
- --density-space-xs-dense,
160
- calc(var(--baseline-height) * 1)
161
- );
162
- }
114
+ /* ── Density family: pick within the context pair ────────────────────────────
115
+ * Each density tier resolves every GENERIC primitive from the context's
116
+ * *-comfy / *-dense pair. Fallbacks cover the app-comfortable defaults when no
117
+ * context class is present (a plain `.comfortable` still works). */
118
+ .comfortable {
119
+ --density-line-height: var(
120
+ --density-lh-comfy,
121
+ calc(var(--baseline-height) * 8)
122
+ );
123
+ --density-padding-inline: var(
124
+ --density-pad-inline-comfy,
125
+ calc(var(--baseline-height) * 4)
126
+ );
127
+ --density-space-lg: var(
128
+ --density-space-lg-comfy,
129
+ calc(var(--baseline-height) * 10)
130
+ );
131
+ --density-space-md: var(
132
+ --density-space-md-comfy,
133
+ calc(var(--baseline-height) * 2)
134
+ );
135
+ --density-space-sm: var(
136
+ --density-space-sm-comfy,
137
+ calc(var(--baseline-height) * 2)
138
+ );
139
+ --density-space-xs: var(
140
+ --density-space-xs-comfy,
141
+ calc(var(--baseline-height) * 1)
142
+ );
143
+ }
144
+ .dense {
145
+ --density-line-height: var(
146
+ --density-lh-dense,
147
+ calc(var(--baseline-height) * 6)
148
+ );
149
+ --density-padding-inline: var(
150
+ --density-pad-inline-dense,
151
+ calc(var(--baseline-height) * 2)
152
+ );
153
+ --density-space-lg: var(
154
+ --density-space-lg-dense,
155
+ calc(var(--baseline-height) * 8)
156
+ );
157
+ --density-space-md: var(
158
+ --density-space-md-dense,
159
+ calc(var(--baseline-height) * 1)
160
+ );
161
+ --density-space-sm: var(
162
+ --density-space-sm-dense,
163
+ calc(var(--baseline-height) * 1)
164
+ );
165
+ --density-space-xs: var(
166
+ --density-space-xs-dense,
167
+ calc(var(--baseline-height) * 1)
168
+ );
169
+ }
163
170
 
164
- /* ── Target baseline = round(nearest, height × 2/3) ─────────────────────────
165
- * The control text seats where line-height × 2/3 lands on the grid — the optical
166
- * centre of the box — snapped to the NEAREST grid line, not the next one up.
167
- * Nearest (not up) because up over-lifts the one cell where lh × 2/3 is
168
- * fractional: apps-comfortable is 32 × 2/3 = 21.33px, which round(up) forced a
169
- * whole step onto the 24px line (6th), a baseline too low. round(nearest) seats
170
- * it on the 20px line (5th) — Diana's F-O2 "move text 1 baseline up in
171
- * apps/comfortable" (AV-323). The exact-multiple cells are unaffected:
172
- * apps-comfy 21.33 → 20 (5th) ← the fix; was 24
173
- * apps-dense 16.00 → 16 (4th) unchanged (exact)
174
- * sites-comfy 24.00 → 24 (6th) unchanged (exact)
175
- * sites-dense 18.67 → 20 (5th) unchanged (nearest == up here)
176
- * So it's a self-correcting rule, not a per-cell offset: any future fractional
177
- * cell snaps to its nearest line too. */
178
- :where(.comfortable, .dense, .app, .site, .docs) {
179
- /* Effective line-height with the SAME fallback chain a control box uses
171
+ /* ── Target baseline = round(nearest, height × 2/3) ─────────────────────────
172
+ * The control text seats where line-height × 2/3 lands on the grid — the optical
173
+ * centre of the box — snapped to the NEAREST grid line, not the next one up.
174
+ * Nearest (not up) because up over-lifts the one cell where lh × 2/3 is
175
+ * fractional: apps-comfortable is 32 × 2/3 = 21.33px, which round(up) forced a
176
+ * whole step onto the 24px line (6th), a baseline too low. round(nearest) seats
177
+ * it on the 20px line (5th) — Diana's F-O2 "move text 1 baseline up in
178
+ * apps/comfortable" (AV-323). The exact-multiple cells are unaffected:
179
+ * apps-comfy 21.33 → 20 (5th) ← the fix; was 24
180
+ * apps-dense 16.00 → 16 (4th) unchanged (exact)
181
+ * sites-comfy 24.00 → 24 (6th) unchanged (exact)
182
+ * sites-dense 18.67 → 20 (5th) unchanged (nearest == up here)
183
+ * So it's a self-correcting rule, not a per-cell offset: any future fractional
184
+ * cell snaps to its nearest line too. */
185
+ :where(.comfortable, .dense, .app, .site, .docs) {
186
+ /* Effective line-height with the SAME fallback chain a control box uses
180
187
  (--density-line-height → context --density-lh-comfy → apps-comfy literal).
181
188
  Without this fallback, a bare context class (.app/.site/.docs applied with no
182
189
  density class — the documented "no class = comfortable" case) leaves
183
190
  --density-line-height unset, the round(calc(var(--density-line-height)…))
184
191
  becomes invalid, the target resolves to 0, and controls lose their seating. */
185
- --density-line-height-effective: var(
186
- --density-line-height,
187
- var(--density-lh-comfy, calc(var(--baseline-height) * 8))
188
- );
189
- --density-target-baseline-px: round(
190
- nearest,
191
- calc(var(--density-line-height-effective) * 2 / 3),
192
- var(--baseline-height)
193
- );
192
+ --density-line-height-effective: var(
193
+ --density-line-height,
194
+ var(--density-lh-comfy, calc(var(--baseline-height) * 8))
195
+ );
196
+ --density-target-baseline-px: round(
197
+ nearest,
198
+ calc(var(--density-line-height-effective) * 2 / 3),
199
+ var(--baseline-height)
200
+ );
194
201
 
195
- /* ── Control seat (intrinsic) ──────────────────────────────────────────────
202
+ /* ── Control seat (intrinsic) ──────────────────────────────────────────────
196
203
  * ONE seat for every control (button, input chrome, accordion header, …):
197
204
  * the text's own line box — the density cell minus one baseline of headroom
198
205
  * per side (`--control-seat-line`) — IS the control interior. The height is
@@ -219,16 +226,17 @@
219
226
  * components with different fonts still seat on the SAME grid index. The
220
227
  * border must be the control's CONSTANT nominal width (transparent where no
221
228
  * border shows), so bordered and borderless variants share one geometry. */
222
- --control-seat-line: calc(
223
- var(--density-line-height-effective) -
224
- 2 *
225
- var(--baseline-height)
226
- );
227
- /* Unclamped distance from just inside the box's top border down to the
229
+ --control-seat-line: calc(
230
+ var(--density-line-height-effective) -
231
+ 2 *
232
+ var(--baseline-height)
233
+ );
234
+ /* Unclamped distance from just inside the box's top border down to the
228
235
  target baseline, for a --control-seat-line line box. */
229
- --control-seat-basis: calc(
230
- var(--density-target-baseline-px) -
231
- (var(--control-seat-line) + 1cap) /
232
- 2
233
- );
236
+ --control-seat-basis: calc(
237
+ var(--density-target-baseline-px) -
238
+ (var(--control-seat-line) + 1cap) /
239
+ 2
240
+ );
241
+ }
234
242
  }
@@ -30,6 +30,12 @@
30
30
  * per design, the secondary label never takes the anticipation colour. Only
31
31
  * `.tertiary` leaves the text channel untouched, so the anticipation colour
32
32
  * lands on the text — exactly the Figma treatment.
33
+ *
34
+ * Layer: ds.modifiers. The generated file this one stands in for is empty and
35
+ * therefore opens no layer at all, so the layer is taken from its family: every
36
+ * other generated modifier file (anticipation, criticality, emphasis, theme,
37
+ * typography) opens `@layer ds.modifiers`, and importance belongs beside them.
38
+ * Custom properties only, so nothing here selects an element.
33
39
  */
34
40
 
35
41
  @layer ds.modifiers {
@@ -20,6 +20,13 @@
20
20
  * generated modifiers so they win.
21
21
  *
22
22
  * Remove once the generated modifiers expose state channels upstream.
23
+ *
24
+ * Layer: ds.modifiers. The file it extends is the anticipation / emphasis
25
+ * modifier family (`modifiers.anticipation.css`, `modifiers.emphasis.css`),
26
+ * both of which open `@layer ds.modifiers`, and this shim re-points the same
27
+ * modifier classes at more channels. It is not `ds.states`: that layer holds
28
+ * the generated file that DERIVES a state from a channel, and this one supplies
29
+ * the channel it derives from. Nothing here selects an element.
23
30
  */
24
31
 
25
32
  @layer ds.modifiers {
package/src/motion.css CHANGED
@@ -7,16 +7,49 @@
7
7
  *
8
8
  * Convention: ALL available custom properties are listed here so the full API
9
9
  * surface is visible in one place.
10
+ *
11
+ * Layer: ds.tokens. These are custom properties, which act only where a rule
12
+ * reads them — a token that no rule reads changes nothing, and a consumer may
13
+ * want to read them itself.
10
14
  */
11
15
 
12
- :root {
13
- /* ── Durations ──────────────────────────────────────────────────── */
14
- --motion-duration-fast: 0.165s; /* small state changes: chevrons, toggles */
15
- --motion-duration-medium: 0.25s; /* panels, disclosures */
16
- --motion-duration-slow: 0.4s; /* larger transitions, overlays */
16
+ @layer ds.tokens {
17
+ :root {
18
+ /* ── Durations ──────────────────────────────────────────────────── */
19
+ --motion-duration-fast: 0.165s; /* small state changes: chevrons, toggles */
20
+ --motion-duration-medium: 0.25s; /* panels, disclosures */
21
+ --motion-duration-slow: 0.4s; /* larger transitions, overlays */
22
+
23
+ /* ── Easings ────────────────────────────────────────────────────── */
24
+ --motion-easing-standard: ease-out; /* enter/exit default */
25
+ --motion-easing-decelerate: cubic-bezier(0, 0, 0.2, 1); /* entering */
26
+ --motion-easing-accelerate: cubic-bezier(0.4, 0, 1, 1); /* exiting */
27
+ }
17
28
 
18
- /* ── Easings ────────────────────────────────────────────────────── */
19
- --motion-easing-standard: ease-out; /* enter/exit default */
20
- --motion-easing-decelerate: cubic-bezier(0, 0, 0.2, 1); /* entering */
21
- --motion-easing-accelerate: cubic-bezier(0.4, 0, 1, 1); /* exiting */
29
+ /* ── Reduced motion ───────────────────────────────────────────────────
30
+ * A reader who asks their system for less motion gets it from the design
31
+ * system, without the application opting in (constitution I).
32
+ *
33
+ * Zeroing the duration token is the whole mechanism, and it is deliberate:
34
+ * every duration a component reads resolves through one of these three, so a
35
+ * component's own `transition:` declaration keeps its place in the cascade
36
+ * and simply resolves to no time at all. A blanket `transition: none` rule
37
+ * could not do this — it would sit in a layer below the component sheets and
38
+ * lose to every one of them.
39
+ *
40
+ * The easings are left alone: an easing over no duration has no effect.
41
+ * There is no delay token in this package; if one is added it belongs here.
42
+ * No declaration here is marked important, and none in the package is: an
43
+ * important declaration inverts the layer order and so cannot be arbitrated
44
+ * by layers at all.
45
+ *
46
+ * A component that hard-codes a duration instead of reading a token is not
47
+ * covered, and each one is being moved onto the tokens separately. */
48
+ @media (prefers-reduced-motion: reduce) {
49
+ :root {
50
+ --motion-duration-fast: 0s;
51
+ --motion-duration-medium: 0s;
52
+ --motion-duration-slow: 0s;
53
+ }
54
+ }
22
55
  }
@@ -0,0 +1,221 @@
1
+ /* @canonical/styles — Pragma's own reset
2
+ *
3
+ * ── Third-party notice ──────────────────────────────────────────────────────
4
+ *
5
+ * Portions of this file are copied and adapted from normalize.css v8.0.1
6
+ * (github.com/necolas/normalize.css), which is MIT licensed. Its notice is
7
+ * retained here, as that licence requires, because the rules below are a
8
+ * substantial portion of it:
9
+ *
10
+ * The MIT License (MIT)
11
+ *
12
+ * Copyright © Nicolas Gallagher and Jonathan Neal
13
+ *
14
+ * Permission is hereby granted, free of charge, to any person obtaining a
15
+ * copy of this software and associated documentation files (the "Software"),
16
+ * to deal in the Software without restriction, including without limitation
17
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
18
+ * and/or sell copies of the Software, and to permit persons to whom the
19
+ * Software is furnished to do so, subject to the following conditions:
20
+ *
21
+ * The above copyright notice and this permission notice shall be included in
22
+ * all copies or substantial portions of the Software.
23
+ *
24
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30
+ * DEALINGS IN THE SOFTWARE.
31
+ *
32
+ * The notice lives in this file rather than in a separate one because the
33
+ * package publishes only `src`, so this is what reaches anyone who installs it.
34
+ * The rest of the package is under the repository's own licence.
35
+ *
36
+ * ────────────────────────────────────────────────────────────────────────────
37
+ *
38
+ * This replaces the `normalize.css` dependency. Two reasons, both structural:
39
+ *
40
+ * 1. The Vanilla adapter ships a confined copy of pragma's three element-level
41
+ * layers, for a page that also runs another CSS framework and cannot let
42
+ * pragma restyle the half it has not migrated. A copy has to derive from a
43
+ * source pragma owns and can change deliberately, and a test binds the two
44
+ * so they cannot drift; a third-party file in `node_modules` is neither.
45
+ * 2. The constitution prefers writing only the styles that are used
46
+ * (principle XIII) over importing a file and stripping it afterwards.
47
+ *
48
+ * These rules style the whole page, as a reset does. Nothing about them is
49
+ * confined, nothing has to be marked, and a page that wants them confined uses
50
+ * the adapter.
51
+ *
52
+ * ── What was ported from normalize.css 8.0.1, and why ────────────────────────
53
+ *
54
+ * Every rule here was kept because dropping it changed a value measured in
55
+ * Chromium, not because normalize carries it.
56
+ *
57
+ * -webkit-text-size-adjust iOS inflates text after an orientation change,
58
+ * which would move every line off the baseline grid.
59
+ * body margin the browser's 8px would show as a page gutter.
60
+ * form control font/margin the natives pragma's form components render must
61
+ * inherit the page font and start with no margin —
62
+ * an inherited margin on `<input>` is exactly the
63
+ * field-spacing defect this programme exists to fix.
64
+ * Without it a bare `<button>` computes the
65
+ * browser's 13.33px control font.
66
+ * monospace font size a browser applies a smaller default size when the
67
+ * computed font family is the bare `monospace`
68
+ * keyword, so a `<pre>` or `<code>` renders at about
69
+ * 13px. `font-size: 1em` alone does not cancel it,
70
+ * because Blink scales the keyword size on the family
71
+ * switch itself; naming the family twice is what
72
+ * defeats it, which is why normalize carries both.
73
+ * Pragma renders both elements (the diff viewer's
74
+ * `<pre>`, the token table's `<code>`).
75
+ * sub / sup a superscript that keeps its own line box would
76
+ * grow the line it sits on, and a whole-number
77
+ * multiple of the baseline unit is what the
78
+ * typography engine guarantees.
79
+ * small the browser's `smaller` is not 80%; measured 11.67px
80
+ * against 11.2px at a 14px parent, and pragma's own
81
+ * stories render `<small>`.
82
+ * progress the browser aligns it `-0.2em`, not on the baseline.
83
+ * [type=search] and its Safari draws its own search chrome — a rounded pill
84
+ * ::-webkit-search- and an inset outline — and the components that
85
+ * decoration render a search input (the file-tree search box,
86
+ * the token table) do not declare `appearance`.
87
+ * -webkit-appearance: keeps `<button>` and the submit/reset/button input
88
+ * button on the button types stylable on iOS and Safari.
89
+ * types
90
+ * legend the form package renders `<legend>` for a field
91
+ * group's label; the browser's own inline padding
92
+ * and `display: block` are visible there.
93
+ *
94
+ * ── What was dropped, and why ────────────────────────────────────────────────
95
+ *
96
+ * Each of these was measured against the browsers pragma targets and moved no
97
+ * computed value.
98
+ *
99
+ * html line-height 1.15 superseded: the reset declares `line-height:
100
+ * normal` on the root (ds.reset).
101
+ * h1 font-size and margin the typography engine sets both on h1–h6, so the
102
+ * rule never reached the page.
103
+ * hr `box-sizing: content-box` is overridden by the
104
+ * reset's `border-box` one layer up, and `height: 0`
105
+ * under `border-box` would collapse the rule's own
106
+ * border. `overflow: visible` moves the computed
107
+ * value from `hidden`, with nothing to show for it —
108
+ * a rule has no content to overflow.
109
+ * main, details, summary, already the browser's own behaviour in every engine
110
+ * template, [hidden], a, pragma targets (constitution X: current platforms,
111
+ * img, b/strong, abbr, no legacy burden). These rules exist in normalize
112
+ * fieldset, textarea, for Internet Explorer, legacy Edge, and browsers
113
+ * [type=checkbox]/[radio], older than pragma's floor.
114
+ * button/input overflow
115
+ * text-transform, engine-specific control chrome that pragma's own
116
+ * ::-moz-focus-inner, components declare for themselves where they render
117
+ * :-moz-focusring, the control. Unmeasured on Gecko and WebKit, where
118
+ * [type=number] spinners, no browser was available; if one of them proves to
119
+ * ::-webkit-file-upload- matter it belongs in the component that renders the
120
+ * button control, under "own the box of the natives you
121
+ * render".
122
+ */
123
+
124
+ @layer normalize {
125
+ html {
126
+ /* Prevent the text inflation iOS applies after an orientation change. */
127
+ -webkit-text-size-adjust: 100%;
128
+ }
129
+
130
+ /* Remove the page gutter the browser gives the body. */
131
+ body {
132
+ margin: 0;
133
+ }
134
+
135
+ /* Change the font styles in all browsers, and remove the margin Firefox and
136
+ Safari give form controls. */
137
+ button,
138
+ input,
139
+ optgroup,
140
+ select,
141
+ textarea {
142
+ font-family: inherit;
143
+ font-size: 100%;
144
+ line-height: 1.15;
145
+ margin: 0;
146
+ }
147
+
148
+ /* Correct the odd font size a browser gives the generic monospace family.
149
+ Blink scales the keyword size when the computed family is the bare
150
+ `monospace` keyword, and a list of two defeats that; `font-size: 1em` then
151
+ resolves against the parent. The list is `ui-monospace, monospace` rather
152
+ than `monospace` twice because a minifier collapses a repeated name and
153
+ brings the bug back: Lightning CSS turns `monospace, monospace` into
154
+ `monospace`, and the measured size goes from 16px to 13px. Two different
155
+ names it leaves alone, and `ui-monospace` falls through to `monospace`
156
+ wherever it is not supported. */
157
+ pre,
158
+ code,
159
+ kbd,
160
+ samp {
161
+ font-family: ui-monospace, monospace;
162
+ font-size: 1em;
163
+ }
164
+
165
+ /* Keep sub and sup from affecting the line box, and so the baseline grid. */
166
+ sub,
167
+ sup {
168
+ font-size: 75%;
169
+ line-height: 0;
170
+ position: relative;
171
+ vertical-align: baseline;
172
+ }
173
+
174
+ sub {
175
+ bottom: -0.25em;
176
+ }
177
+
178
+ sup {
179
+ top: -0.5em;
180
+ }
181
+
182
+ /* Add the correct font size. */
183
+ small {
184
+ font-size: 80%;
185
+ }
186
+
187
+ /* Add the correct vertical alignment. */
188
+ progress {
189
+ vertical-align: baseline;
190
+ }
191
+
192
+ /* Correct the inability to style clickable types in iOS and Safari. */
193
+ button,
194
+ [type="button"],
195
+ [type="reset"],
196
+ [type="submit"] {
197
+ -webkit-appearance: button;
198
+ }
199
+
200
+ /* Correct the odd appearance and the outline style in Safari, and remove the
201
+ inner padding it adds on macOS. */
202
+ [type="search"] {
203
+ -webkit-appearance: textfield;
204
+ outline-offset: -2px;
205
+ }
206
+
207
+ [type="search"]::-webkit-search-decoration {
208
+ -webkit-appearance: none;
209
+ }
210
+
211
+ /* Correct the text wrapping, the colour inheritance and the padding on a
212
+ field group's caption. */
213
+ legend {
214
+ box-sizing: border-box;
215
+ color: inherit;
216
+ display: table;
217
+ max-width: 100%;
218
+ padding: 0;
219
+ white-space: normal;
220
+ }
221
+ }