@utrecht/root-css 3.1.0 → 3.1.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @utrecht/root-css
2
2
 
3
+ ## 3.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 2ad7d66: Fix regression in fluid font-size: never set `font-size` on `:root`.
8
+
3
9
  ## 3.1.0
4
10
 
5
11
  ### Minor Changes
@@ -10,7 +10,6 @@
10
10
  block-size: 100%;
11
11
  color: var(--utrecht-root-color, CanvasText);
12
12
  font-family: var(--utrecht-root-font-family);
13
- font-size: var(--utrecht-root-font-size, var(--utrecht-body-font-size));
14
13
  font-size-adjust: var(--utrecht-root-font-size-adjust, 0.5);
15
14
  font-weight: var(--utrecht-root-font-weight, var(--utrecht-body-font-weight));
16
15
  -webkit-hyphens: auto;
@@ -18,7 +17,6 @@
18
17
  -ms-hyphens: auto;
19
18
  hyphens: auto;
20
19
  inline-size: 100%;
21
- line-height: var(--utrecht-root-line-height, var(--utrecht-body-line-height));
22
20
  overflow-block: auto;
23
21
  overflow-inline: auto;
24
22
  position: relative;
@@ -34,6 +32,11 @@
34
32
  }
35
33
  }
36
34
 
35
+ :root > :where(*) {
36
+ font-size: var(--utrecht-root-font-size, var(--utrecht-body-font-size));
37
+ line-height: var(--utrecht-root-line-height, var(--utrecht-body-line-height));
38
+ }
39
+
37
40
  :where(:focus-visible) {
38
41
  --_utrecht-focus-ring-box-shadow: 0 0 0 var(--utrecht-focus-outline-width, 0)
39
42
  var(--utrecht-focus-inverse-outline-color, transparent);
@@ -1 +1 @@
1
- :root{-webkit-font-smoothing:auto!important;-moz-osx-font-smoothing:auto!important;background-color:var(--utrecht-root-background-color,Canvas);block-size:100%;color:var(--utrecht-root-color,CanvasText);font-family:var(--utrecht-root-font-family);font-size:var(--utrecht-root-font-size,var(--utrecht-body-font-size));font-size-adjust:var(--utrecht-root-font-size-adjust,.5);font-weight:var(--utrecht-root-font-weight,var(--utrecht-body-font-weight));-webkit-hyphens:auto;-moz-hyphens:auto;-ms-hyphens:auto;hyphens:auto;inline-size:100%;line-height:var(--utrecht-root-line-height,var(--utrecht-body-line-height));overflow-block:auto;overflow-inline:auto;position:relative;text-rendering:optimizeLegibility;-moz-text-size-adjust:none;-webkit-text-size-adjust:none;text-size-adjust:none;word-break:break-word}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}:where(:focus-visible){--_utrecht-focus-ring-box-shadow:0 0 0 var(--utrecht-focus-outline-width,0) var(--utrecht-focus-inverse-outline-color,transparent);box-shadow:var(--_utrecht-focus-ring-box-shadow);outline-color:var(--utrecht-focus-outline-color,revert);outline-offset:var(--utrecht-focus-outline-offset,revert);outline-style:var(--utrecht-focus-outline-style,revert);outline-width:var(--utrecht-focus-outline-width,revert);z-index:1}
1
+ :root{-webkit-font-smoothing:auto!important;-moz-osx-font-smoothing:auto!important;background-color:var(--utrecht-root-background-color,Canvas);block-size:100%;color:var(--utrecht-root-color,CanvasText);font-family:var(--utrecht-root-font-family);font-size-adjust:var(--utrecht-root-font-size-adjust,.5);font-weight:var(--utrecht-root-font-weight,var(--utrecht-body-font-weight));-webkit-hyphens:auto;-moz-hyphens:auto;-ms-hyphens:auto;hyphens:auto;inline-size:100%;overflow-block:auto;overflow-inline:auto;position:relative;text-rendering:optimizeLegibility;-moz-text-size-adjust:none;-webkit-text-size-adjust:none;text-size-adjust:none;word-break:break-word}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}:root>:where(*){font-size:var(--utrecht-root-font-size,var(--utrecht-body-font-size));line-height:var(--utrecht-root-line-height,var(--utrecht-body-line-height))}:where(:focus-visible){--_utrecht-focus-ring-box-shadow:0 0 0 var(--utrecht-focus-outline-width,0) var(--utrecht-focus-inverse-outline-color,transparent);box-shadow:var(--_utrecht-focus-ring-box-shadow);outline-color:var(--utrecht-focus-outline-color,revert);outline-offset:var(--utrecht-focus-outline-offset,revert);outline-style:var(--utrecht-focus-outline-style,revert);outline-width:var(--utrecht-focus-outline-width,revert);z-index:1}
@@ -1 +1 @@
1
- export default ":root{-webkit-font-smoothing:auto!important;-moz-osx-font-smoothing:auto!important;background-color:var(--utrecht-root-background-color,Canvas);block-size:100%;color:var(--utrecht-root-color,CanvasText);font-family:var(--utrecht-root-font-family);font-size:var(--utrecht-root-font-size,var(--utrecht-body-font-size));font-size-adjust:var(--utrecht-root-font-size-adjust,.5);font-weight:var(--utrecht-root-font-weight,var(--utrecht-body-font-weight));-webkit-hyphens:auto;-moz-hyphens:auto;-ms-hyphens:auto;hyphens:auto;inline-size:100%;line-height:var(--utrecht-root-line-height,var(--utrecht-body-line-height));overflow-block:auto;overflow-inline:auto;position:relative;text-rendering:optimizeLegibility;-moz-text-size-adjust:none;-webkit-text-size-adjust:none;text-size-adjust:none;word-break:break-word}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}:where(:focus-visible){--_utrecht-focus-ring-box-shadow:0 0 0 var(--utrecht-focus-outline-width,0) var(--utrecht-focus-inverse-outline-color,transparent);box-shadow:var(--_utrecht-focus-ring-box-shadow);outline-color:var(--utrecht-focus-outline-color,revert);outline-offset:var(--utrecht-focus-outline-offset,revert);outline-style:var(--utrecht-focus-outline-style,revert);outline-width:var(--utrecht-focus-outline-width,revert);z-index:1}";
1
+ export default ":root{-webkit-font-smoothing:auto!important;-moz-osx-font-smoothing:auto!important;background-color:var(--utrecht-root-background-color,Canvas);block-size:100%;color:var(--utrecht-root-color,CanvasText);font-family:var(--utrecht-root-font-family);font-size-adjust:var(--utrecht-root-font-size-adjust,.5);font-weight:var(--utrecht-root-font-weight,var(--utrecht-body-font-weight));-webkit-hyphens:auto;-moz-hyphens:auto;-ms-hyphens:auto;hyphens:auto;inline-size:100%;overflow-block:auto;overflow-inline:auto;position:relative;text-rendering:optimizeLegibility;-moz-text-size-adjust:none;-webkit-text-size-adjust:none;text-size-adjust:none;word-break:break-word}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}:root>:where(*){font-size:var(--utrecht-root-font-size,var(--utrecht-body-font-size));line-height:var(--utrecht-root-line-height,var(--utrecht-body-line-height))}:where(:focus-visible){--_utrecht-focus-ring-box-shadow:0 0 0 var(--utrecht-focus-outline-width,0) var(--utrecht-focus-inverse-outline-color,transparent);box-shadow:var(--_utrecht-focus-ring-box-shadow);outline-color:var(--utrecht-focus-outline-color,revert);outline-offset:var(--utrecht-focus-outline-offset,revert);outline-style:var(--utrecht-focus-outline-style,revert);outline-width:var(--utrecht-focus-outline-width,revert);z-index:1}";
package/dist/index.css CHANGED
@@ -10,7 +10,6 @@
10
10
  block-size: 100%;
11
11
  color: var(--utrecht-root-color, CanvasText);
12
12
  font-family: var(--utrecht-root-font-family);
13
- font-size: var(--utrecht-root-font-size, var(--utrecht-body-font-size));
14
13
  font-size-adjust: var(--utrecht-root-font-size-adjust, 0.5);
15
14
  font-weight: var(--utrecht-root-font-weight, var(--utrecht-body-font-weight));
16
15
  -webkit-hyphens: auto;
@@ -18,7 +17,6 @@
18
17
  -ms-hyphens: auto;
19
18
  hyphens: auto;
20
19
  inline-size: 100%;
21
- line-height: var(--utrecht-root-line-height, var(--utrecht-body-line-height));
22
20
  overflow-block: auto;
23
21
  overflow-inline: auto;
24
22
  position: relative;
@@ -45,4 +43,9 @@
45
43
  }
46
44
  :where(.utrecht-root) :where(:not(:root):fullscreen)::backdrop {
47
45
  background-color: var(--utrecht-root-background-color, Canvas);
46
+ }
47
+ .utrecht-root:where(:root) > *,
48
+ .utrecht-root:where(:not(:root)) {
49
+ font-size: var(--utrecht-root-font-size, var(--utrecht-body-font-size));
50
+ line-height: var(--utrecht-root-line-height, var(--utrecht-body-line-height));
48
51
  }
@@ -1 +1 @@
1
- .utrecht-root{-webkit-font-smoothing:auto!important;-moz-osx-font-smoothing:auto!important;background-color:var(--utrecht-root-background-color,Canvas);block-size:100%;color:var(--utrecht-root-color,CanvasText);font-family:var(--utrecht-root-font-family);font-size:var(--utrecht-root-font-size,var(--utrecht-body-font-size));font-size-adjust:var(--utrecht-root-font-size-adjust,.5);font-weight:var(--utrecht-root-font-weight,var(--utrecht-body-font-weight));-webkit-hyphens:auto;-moz-hyphens:auto;-ms-hyphens:auto;hyphens:auto;inline-size:100%;line-height:var(--utrecht-root-line-height,var(--utrecht-body-line-height));overflow-block:auto;overflow-inline:auto;position:relative;text-rendering:optimizeLegibility;-moz-text-size-adjust:none;-webkit-text-size-adjust:none;text-size-adjust:none;word-break:break-word}@media (prefers-reduced-motion:no-preference){.utrecht-root{scroll-behavior:smooth}}:where(.utrecht-root) :where(:focus-visible){--_utrecht-focus-ring-box-shadow:0 0 0 var(--utrecht-focus-outline-width,0) var(--utrecht-focus-inverse-outline-color,transparent);box-shadow:var(--_utrecht-focus-ring-box-shadow);outline-color:var(--utrecht-focus-outline-color,revert);outline-offset:var(--utrecht-focus-outline-offset,revert);outline-style:var(--utrecht-focus-outline-style,revert);outline-width:var(--utrecht-focus-outline-width,revert);z-index:1}:where(.utrecht-root) :where(:not(:root):fullscreen)::backdrop{background-color:var(--utrecht-root-background-color,Canvas)}
1
+ .utrecht-root{-webkit-font-smoothing:auto!important;-moz-osx-font-smoothing:auto!important;background-color:var(--utrecht-root-background-color,Canvas);block-size:100%;color:var(--utrecht-root-color,CanvasText);font-family:var(--utrecht-root-font-family);font-size-adjust:var(--utrecht-root-font-size-adjust,.5);font-weight:var(--utrecht-root-font-weight,var(--utrecht-body-font-weight));-webkit-hyphens:auto;-moz-hyphens:auto;-ms-hyphens:auto;hyphens:auto;inline-size:100%;overflow-block:auto;overflow-inline:auto;position:relative;text-rendering:optimizeLegibility;-moz-text-size-adjust:none;-webkit-text-size-adjust:none;text-size-adjust:none;word-break:break-word}@media (prefers-reduced-motion:no-preference){.utrecht-root{scroll-behavior:smooth}}:where(.utrecht-root) :where(:focus-visible){--_utrecht-focus-ring-box-shadow:0 0 0 var(--utrecht-focus-outline-width,0) var(--utrecht-focus-inverse-outline-color,transparent);box-shadow:var(--_utrecht-focus-ring-box-shadow);outline-color:var(--utrecht-focus-outline-color,revert);outline-offset:var(--utrecht-focus-outline-offset,revert);outline-style:var(--utrecht-focus-outline-style,revert);outline-width:var(--utrecht-focus-outline-width,revert);z-index:1}:where(.utrecht-root) :where(:not(:root):fullscreen)::backdrop{background-color:var(--utrecht-root-background-color,Canvas)}.utrecht-root:where(:not(:root)),.utrecht-root:where(:root)>*{font-size:var(--utrecht-root-font-size,var(--utrecht-body-font-size));line-height:var(--utrecht-root-line-height,var(--utrecht-body-line-height))}
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export default ".utrecht-root{-webkit-font-smoothing:auto!important;-moz-osx-font-smoothing:auto!important;background-color:var(--utrecht-root-background-color,Canvas);block-size:100%;color:var(--utrecht-root-color,CanvasText);font-family:var(--utrecht-root-font-family);font-size:var(--utrecht-root-font-size,var(--utrecht-body-font-size));font-size-adjust:var(--utrecht-root-font-size-adjust,.5);font-weight:var(--utrecht-root-font-weight,var(--utrecht-body-font-weight));-webkit-hyphens:auto;-moz-hyphens:auto;-ms-hyphens:auto;hyphens:auto;inline-size:100%;line-height:var(--utrecht-root-line-height,var(--utrecht-body-line-height));overflow-block:auto;overflow-inline:auto;position:relative;text-rendering:optimizeLegibility;-moz-text-size-adjust:none;-webkit-text-size-adjust:none;text-size-adjust:none;word-break:break-word}@media (prefers-reduced-motion:no-preference){.utrecht-root{scroll-behavior:smooth}}:where(.utrecht-root) :where(:focus-visible){--_utrecht-focus-ring-box-shadow:0 0 0 var(--utrecht-focus-outline-width,0) var(--utrecht-focus-inverse-outline-color,transparent);box-shadow:var(--_utrecht-focus-ring-box-shadow);outline-color:var(--utrecht-focus-outline-color,revert);outline-offset:var(--utrecht-focus-outline-offset,revert);outline-style:var(--utrecht-focus-outline-style,revert);outline-width:var(--utrecht-focus-outline-width,revert);z-index:1}:where(.utrecht-root) :where(:not(:root):fullscreen)::backdrop{background-color:var(--utrecht-root-background-color,Canvas)}";
1
+ export default ".utrecht-root{-webkit-font-smoothing:auto!important;-moz-osx-font-smoothing:auto!important;background-color:var(--utrecht-root-background-color,Canvas);block-size:100%;color:var(--utrecht-root-color,CanvasText);font-family:var(--utrecht-root-font-family);font-size-adjust:var(--utrecht-root-font-size-adjust,.5);font-weight:var(--utrecht-root-font-weight,var(--utrecht-body-font-weight));-webkit-hyphens:auto;-moz-hyphens:auto;-ms-hyphens:auto;hyphens:auto;inline-size:100%;overflow-block:auto;overflow-inline:auto;position:relative;text-rendering:optimizeLegibility;-moz-text-size-adjust:none;-webkit-text-size-adjust:none;text-size-adjust:none;word-break:break-word}@media (prefers-reduced-motion:no-preference){.utrecht-root{scroll-behavior:smooth}}:where(.utrecht-root) :where(:focus-visible){--_utrecht-focus-ring-box-shadow:0 0 0 var(--utrecht-focus-outline-width,0) var(--utrecht-focus-inverse-outline-color,transparent);box-shadow:var(--_utrecht-focus-ring-box-shadow);outline-color:var(--utrecht-focus-outline-color,revert);outline-offset:var(--utrecht-focus-outline-offset,revert);outline-style:var(--utrecht-focus-outline-style,revert);outline-width:var(--utrecht-focus-outline-width,revert);z-index:1}:where(.utrecht-root) :where(:not(:root):fullscreen)::backdrop{background-color:var(--utrecht-root-background-color,Canvas)}.utrecht-root:where(:not(:root)),.utrecht-root:where(:root)>*{font-size:var(--utrecht-root-font-size,var(--utrecht-body-font-size));line-height:var(--utrecht-root-line-height,var(--utrecht-body-line-height))}";
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.1.0",
2
+ "version": "3.1.1",
3
3
  "author": "Community for NL Design System",
4
4
  "description": "Root component for the Municipality of Utrecht based on the NL Design System architecture",
5
5
  "license": "EUPL-1.2",
package/src/_mixin.scss CHANGED
@@ -24,6 +24,7 @@
24
24
  * outside the normal document flow (`absolute`, `fixed` and `sticky`)
25
25
  * are positioned relative to the root component.
26
26
  * - ensure text content fits at 400% zoom by enabling hypenation.
27
+ * - do not influence the `rem` unit by avoiding `font-size` on the root element.
27
28
  */
28
29
  @include reset-font-smoothing;
29
30
 
@@ -32,7 +33,6 @@
32
33
  block-size: 100%;
33
34
  color: var(--utrecht-root-color, CanvasText);
34
35
  font-family: var(--utrecht-root-font-family);
35
- font-size: var(--utrecht-root-font-size, var(--utrecht-body-font-size));
36
36
  font-size-adjust: var(--utrecht-root-font-size-adjust, 0.5);
37
37
  font-weight: var(--utrecht-root-font-weight, var(--utrecht-body-font-weight));
38
38
  -webkit-hyphens: auto;
@@ -40,7 +40,6 @@
40
40
  -ms-hyphens: auto;
41
41
  hyphens: auto;
42
42
  inline-size: 100%;
43
- line-height: var(--utrecht-root-line-height, var(--utrecht-body-line-height));
44
43
  overflow-block: auto;
45
44
  overflow-inline: auto;
46
45
  position: relative;
@@ -55,10 +54,38 @@
55
54
  }
56
55
  }
57
56
 
57
+ /**
58
+ * The focus indicator should be applied to all elements that have the `:focus-visible` state.
59
+ */
58
60
  @mixin utrecht-root__focus-indicator {
59
61
  @include utrecht-focus-ring;
60
62
  }
61
63
 
64
+ /**
65
+ * Avoid setting `font-size` on `:root` if you want to keep `1rem` at `16px` for most users.
66
+ * Set `line-height` on the same element as `font-size`, to support font-relative line heights,
67
+ * even though they are discouraged.
68
+ */
69
+ @mixin utrecht-root__font-size-container {
70
+ font-size: var(--utrecht-root-font-size, var(--utrecht-body-font-size));
71
+ line-height: var(--utrecht-root-line-height, var(--utrecht-body-line-height));
72
+ }
73
+
74
+ /**
75
+ * Ensure enough contrast with `var(--utrecht-root-color)`, by overriding the
76
+ * browser black default background color of full screen elements.
77
+ *
78
+ * You can test this by opening any element inside the Root component with the
79
+ * following JavaScript, for example the Heading 1:
80
+ *
81
+ * document.querySelector('h1').requestFullscreen()
82
+ *
83
+ * In dark mode there might be enough contrast, but dark text on a black background
84
+ * would become unreadable in full screen.
85
+ *
86
+ * Use `:where()` so this background color can be overriden by a CSS selector
87
+ * with a higher specificity than (0,0,1).
88
+ */
62
89
  @mixin utrecht-root__fullscreen-backdrop {
63
90
  :where(&) :where(:not(:root):fullscreen)::backdrop {
64
91
  background-color: var(--utrecht-root-background-color, Canvas);
@@ -12,6 +12,11 @@
12
12
  @include utrecht-root;
13
13
  }
14
14
 
15
+ body,
16
+ head {
17
+ @include utrecht-root__font-size-container;
18
+ }
19
+
15
20
  @include utrecht-focus-ring-default;
16
21
  }
17
22
 
@@ -24,5 +29,9 @@
24
29
  @include utrecht-root;
25
30
  }
26
31
 
32
+ :root > :where(*) {
33
+ @include utrecht-root__font-size-container;
34
+ }
35
+
27
36
  @include utrecht-focus-ring-default;
28
37
  }
package/src/index.scss CHANGED
@@ -12,3 +12,18 @@
12
12
  @include utrecht-focus-ring-default-container;
13
13
  @include utrecht-root__fullscreen-backdrop;
14
14
  }
15
+
16
+ /**
17
+ * Avoid influencing the `rem` unit. We do this by specifically excluding
18
+ * `font-size` on the `:root` element, which is typically the `html` element.
19
+ * Instead apply the `font-size` on the children of the `html` element: `head` and `body`.
20
+ * Any other element that has this class name can have `font-size` directly,
21
+ * that wouldn't cause the undesired side effect.
22
+ *
23
+ * Use the `:where` selector so any CSS selector with a specificity higher than (0,1,0)
24
+ * can override this `font-size`.
25
+ */
26
+ .utrecht-root:where(:root) > *,
27
+ .utrecht-root:where(:not(:root)) {
28
+ @include utrecht-root__font-size-container;
29
+ }