@canonical/styles 0.4.1-experimental.0 → 0.6.0-experimental.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@canonical/styles",
3
3
  "description": "Canonical's base styles",
4
- "version": "0.4.1-experimental.0",
4
+ "version": "0.6.0-experimental.0",
5
5
  "main": "src/index.css",
6
6
  "files": [
7
7
  "src"
@@ -32,5 +32,5 @@
32
32
  "dependencies": {
33
33
  "normalize.css": "^8.0.1"
34
34
  },
35
- "gitHead": "abed75744c71475f148c18543f2a09bca0cb1caa"
35
+ "gitHead": "08cae3a8ec07cc810e52fbd65bb052ff4d171dea"
36
36
  }
package/src/index.css CHANGED
@@ -1,13 +1,15 @@
1
+ /* Load external files first */
2
+ @import url("./font-faces.css");
3
+
1
4
  /* Reset */
2
5
  @import url("normalize.css");
3
6
 
4
7
  /* Values and settings */
5
8
  @import url("./tokens.css");
6
- @import url("./font-faces.css");
7
9
 
8
10
  /* Foundations styling */
11
+ @import url("@canonical/typography");
9
12
  @import url("./typography.css");
10
- @import url("./intents.css");
11
13
 
12
- /* Debugging utilities */
13
- @import url("./baseline-grid.css");
14
+ /* Intents */
15
+ @import url("./intents.css");
@@ -12,58 +12,13 @@ TODO
12
12
  --font-family-mono: "Ubuntu Mono variable", "Ubuntu Mono", Consolas, Monaco,
13
13
  Courier, monospace;
14
14
  --text-max-width: 40em;
15
+ }
15
16
 
16
- --font-size-default: 1rem;
17
- --font-size-default-scaled: 1.125rem;
18
-
19
- --font-size-h1: 2.5rem;
20
- --font-size-h2: var(--font-size-h1);
21
- --font-size-h3: 1.5rem;
22
- --font-size-h4: var(--font-size-h3);
23
-
24
- --font-weight-bold: 550;
25
- --font-weight-regular: 400;
26
- --font-weight-thin: 300;
27
- --font-weight-display-heading: 100;
28
- --font-weight-h2: 180; /* custom font weight for h2 */
29
- --font-weight-h4: 275; /* custom font weight for h4 */
30
-
31
- --sp-unit: 0.5rem;
32
- --spv-x-small: calc(0.5 * var(--sp-unit));
33
- --spv-small: var(--sp-unit);
34
- --spv-medium: calc(1.5 * var(--sp-unit));
35
- --spv-large: calc(2 * var(--sp-unit));
36
- --spv-x-large: calc(3 * var(--sp-unit));
37
- --spv-strip-shallow: calc(3 * var(--sp-unit));
38
- --spv-strip-regular: calc(8 * var(--sp-unit));
39
- --spv-strip-deep: calc(16 * var(--sp-unit));
40
-
41
- --sp-after-display: var(--spv-x-large);
42
- --sp-after-h1: var(--spv-x-large);
43
- --sp-after-h2: var(--sp-after-h1);
44
- --sp-after-h3: var(--spv-x-large);
45
- --sp-after-h4: var(--sp-after-h3);
46
- --sp-after-p: var(--spv-x-large);
47
- --sp-after-p-small-caps: var(--spv-large);
48
- --sp-after-p-dense: var(--spv-large);
49
- --sp-after-default-text: var(--sp-unit);
50
- --sp-after-small: var(--spv-large);
51
- --sp-after-small-dense: var(--spv-large);
52
- --sp-after-x-small: var(--spv-large);
53
-
54
- --line-height-default: calc(3 * var(--sp-unit));
55
- --line-height-h1: calc(6 * var(--sp-unit));
56
- --line-height-h2: var(--line-height-h1);
57
- --line-height-h3: calc(4 * var(--sp-unit));
58
- --line-height-h4: var(--line-height-h3);
59
-
60
- --nudge-p: 0.375rem;
61
- --nudge-h1: 0.55rem;
62
- --nudge-h2: var(--nudge-h1);
63
- --nudge-h3: 0.45rem;
64
- --nudge-h4: var(--nudge-h3);
65
- --nudge-h5: var(--nudge-p);
66
- --nudge-h6: var(--nudge-p);
17
+ :root {
18
+ --baseline-height: .5rem;
19
+ --ascender: 830;
20
+ --descender: -170;
21
+ --units-per-em: 1000;
67
22
  }
68
23
 
69
24
  html {
@@ -71,112 +26,63 @@ html {
71
26
  font-family: var(--font-family-sans);
72
27
  -moz-osx-font-smoothing: grayscale;
73
28
  -webkit-font-smoothing: antialiased;
74
- font-weight: var(--font-weight-regular);
75
- font-size: var(--font-size-default);
29
+ font-weight: 400;
30
+ font-size: 1rem;
76
31
  line-height: var(--line-height-default);
77
32
  text-wrap: pretty;
78
33
  }
79
34
 
80
35
  /* FIXME: we would need to add many more selectors here, everything that is a heading (in components) */
36
+ p,
81
37
  h1,
82
38
  h2,
83
39
  h3,
84
40
  h4,
85
41
  h5,
86
- h6,
87
- .heading-1,
88
- .heading-2,
89
- .heading-3,
90
- .heading-4,
91
- .heading-5,
92
- .heading-6 {
93
- font-style: normal;
94
- margin-top: 0;
42
+ h6 {
95
43
  max-width: var(--text-max-width);
44
+ font-weight: var(--font-weight);
96
45
  }
97
46
 
98
- h1,
99
- .heading-1 {
100
- font-size: var(--font-size-h1);
101
- font-weight: var(--font-weight-bold);
102
- line-height: var(--line-height-h1);
103
- padding-top: var(--nudge-h1);
104
- margin-bottom: calc(var(--sp-after-h1) - var(--nudge-h1));
47
+ p {
48
+ --font-size: 1rem;
49
+ --line-height-multiplier: 3;
50
+ --space-after: 3;
51
+ --font-weight: 400;
105
52
  }
106
53
 
107
- h2,
108
- .heading-2 {
109
- font-size: var(--font-size-h2);
110
- font-weight: var(--font-weight-h2);
111
- line-height: var(--line-height-h2);
112
- padding-top: var(--nudge-h2);
113
- margin-bottom: calc(var(--sp-after-h2) - var(--nudge-h2));
54
+ h1 {
55
+ --line-height-multiplier: 6;
56
+ --font-size: 2.5rem;
57
+ --space-after: 3;
58
+ --font-weight: 550;
114
59
  }
115
60
 
116
- h3,
117
- .heading-3 {
118
- font-size: var(--font-size-h3);
119
- font-weight: var(--font-weight-bold);
120
- line-height: var(--line-height-h3);
121
- padding-top: var(--nudge-h3);
122
- margin-bottom: calc(var(--sp-after-h3) - var(--nudge-h3));
61
+ h2 {
62
+ --line-height-multiplier: 6;
63
+ --font-size: 2.5rem;
64
+ --space-after: 3;
65
+ --font-weight: 180;
123
66
  }
124
67
 
125
- h4,
126
- .heading-4 {
127
- font-size: var(--font-size-h4);
128
- font-weight: var(--font-weight-h4);
129
- line-height: var(--line-height-h4);
130
- padding-top: var(--nudge-h4);
131
- margin-bottom: calc(var(--sp-after-h4) - var(--nudge-h4));
68
+ h3 {
69
+ --line-height-multiplier: 4;
70
+ --font-size: 1.5rem;
71
+ --space-after: 3;
72
+ --font-weight: 550;
132
73
  }
133
74
 
134
- h5,
135
- .heading-5 {
136
- font-size: var(--font-size-default);
137
- font-weight: var(--font-weight-bold);
138
- line-height: var(--line-height-default);
139
- padding-top: var(--nudge-h5);
140
- margin-bottom: calc(var(--sp-after-p) - var(--nudge-h5));
141
- }
142
-
143
- h6,
144
- .heading-6 {
145
- font-size: var(--font-size-default);
146
- font-style: italic;
147
- font-weight: var(--font-weight-regular);
148
- line-height: var(--line-height-default);
149
- padding-top: var(--nudge-h6);
150
- margin-bottom: calc(var(--sp-after-p) - var(--nudge-h6));
151
- }
152
-
153
- /*
154
- Canonical specific:
155
- consecutive headings of the same size should collapse margin between them
156
- */
157
- h1,
158
- h2,
159
- .heading-1,
160
- .heading-2 {
161
- & + & {
162
- margin-top: calc(-1 * var(--sp-after-h1));
163
- }
164
- }
165
-
166
- h3,
167
- h4,
168
- .heading-3,
169
- .heading-4 {
170
- & + & {
171
- margin-top: calc(-1 * var(--sp-after-h3));
172
- }
75
+ h4 {
76
+ --line-height-multiplier: 4;
77
+ --font-size: 1.5rem;
78
+ --space-after: 3;
79
+ --font-weight: 275;
173
80
  }
174
81
 
175
82
  h5,
176
- h6,
177
- .heading-5,
178
- .heading-6 {
179
- & + & {
180
- margin-top: calc(-1 * var(--sp-after-p));
181
- }
83
+ h6 {
84
+ --line-height-multiplier: 3;
85
+ --font-size: 1rem;
86
+ --space-after: 2;
87
+ --font-weight: 400;
182
88
  }
@@ -1,24 +0,0 @@
1
- .show-baseline-grid {
2
- --color-baseline-grid: rgba(255, 0, 0, 0.2);
3
- position: relative;
4
-
5
- &::after {
6
- background: linear-gradient(
7
- to top,
8
- var(--color-baseline-grid),
9
- var(--color-baseline-grid) 1px,
10
- transparent 1px,
11
- transparent
12
- );
13
- background-size: 100% var(--sp-unit);
14
- bottom: 0;
15
- content: "";
16
- display: block;
17
- left: 0;
18
- pointer-events: none;
19
- position: absolute;
20
- right: 0;
21
- top: 0;
22
- z-index: 200;
23
- }
24
- }