@canonical/styles 0.6.0-experimental.0 → 0.9.0-experimental.2

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.6.0-experimental.0",
4
+ "version": "0.9.0-experimental.2",
5
5
  "main": "src/index.css",
6
6
  "files": [
7
7
  "src"
@@ -22,15 +22,21 @@
22
22
  "scripts": {
23
23
  "check": "bun run check:biome",
24
24
  "check:fix": "bun run check:biome:fix",
25
- "check:biome": "biome check src *.json",
26
- "check:biome:fix": "biome check --write src *.json"
25
+ "check:biome": "biome check",
26
+ "check:biome:fix": "biome check --write"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@biomejs/biome": "^1.9.4",
30
- "@canonical/biome-config": "^0.4.0-experimental.0"
30
+ "@canonical/biome-config": "^0.9.0-experimental.2"
31
31
  },
32
32
  "dependencies": {
33
+ "@canonical/styles-elements": "^0.9.0-experimental.2",
34
+ "@canonical/styles-modes-canonical": "^0.9.0-experimental.2",
35
+ "@canonical/styles-modes-density": "^0.9.0-experimental.2",
36
+ "@canonical/styles-modes-intents": "^0.9.0-experimental.2",
37
+ "@canonical/styles-modes-motion": "^0.9.0-experimental.2",
38
+ "@canonical/styles-primitives-canonical": "^0.9.0-experimental.2",
33
39
  "normalize.css": "^8.0.1"
34
40
  },
35
- "gitHead": "08cae3a8ec07cc810e52fbd65bb052ff4d171dea"
41
+ "gitHead": "3b4b3637d6c340d1363bc89e973dadea8881f625"
36
42
  }
package/src/index.css CHANGED
@@ -1,15 +1,13 @@
1
- /* Load external files first */
2
- @import url("./font-faces.css");
1
+ @layer normalize, primitives, modes, elements;
3
2
 
4
3
  /* Reset */
5
4
  @import url("normalize.css");
6
-
7
- /* Values and settings */
8
- @import url("./tokens.css");
9
-
10
- /* Foundations styling */
11
- @import url("@canonical/typography");
12
- @import url("./typography.css");
13
-
14
- /* Intents */
15
- @import url("./intents.css");
5
+ /* Load external files first */
6
+ /* TODO Ideally we would load the font-faces before this */
7
+
8
+ @import url("@canonical/styles-primitives-canonical");
9
+ @import url("@canonical/styles-modes-canonical");
10
+ @import url("@canonical/styles-modes-density");
11
+ @import url("@canonical/styles-modes-motion");
12
+ @import url("@canonical/styles-modes-intents");
13
+ @import url("@canonical/styles-elements");
@@ -1,32 +0,0 @@
1
- /*
2
- TODO
3
- - add optional character subset version of the font - how to do it conditinoally?
4
- - reconsider the font-family name - "Ubuntu variable" was a workaround for backwards compatibility with previous "Ubuntu" web font, do we still need this? what would happen if we change it to "Ubuntu"?
5
- */
6
-
7
- /* Ubuntu font declarations, as per Vanilla */
8
- @font-face {
9
- font-family: "Ubuntu variable";
10
- font-stretch: 100%;
11
- font-style: normal;
12
- font-weight: 100 800;
13
- src: url("https://assets.ubuntu.com/v1/f1ea362b-Ubuntu%5Bwdth,wght%5D-latin-v0.896a.woff2")
14
- format("woff2-variations");
15
- }
16
-
17
- @font-face {
18
- font-family: "Ubuntu variable";
19
- font-stretch: 100%;
20
- font-style: italic;
21
- font-weight: 100 800;
22
- src: url("https://assets.ubuntu.com/v1/90b59210-Ubuntu-Italic%5Bwdth,wght%5D-latin-v0.896a.woff2")
23
- format("woff2-variations");
24
- }
25
-
26
- @font-face {
27
- font-family: "Ubuntu Mono variable";
28
- font-style: normal;
29
- font-weight: 100 800;
30
- src: url("https://assets.ubuntu.com/v1/d5fc1819-UbuntuMono%5Bwght%5D-latin-v0.869.woff2")
31
- format("woff2-variations");
32
- }
package/src/intents.css DELETED
@@ -1,58 +0,0 @@
1
- .positive {
2
- --intent-color: var(--color-background-positive-default);
3
- --intent-color-tinted: var(--color-background-positive-tinted-default);
4
- --intent-color-hover: var(--color-background-positive-hover);
5
- --intent-color-tinted-hover: var(--color-background-positive-tinted-hover);
6
- --intent-color-active: var(--color-background-positive-active);
7
- --intent-color-tinted-active: var(--color-background-positive-tinted-active);
8
- --intent-color-text: var(--color-background-positive-text);
9
- --intent-color-text-tinted: var(--color-text-default);
10
- --intent-color-border: var(--intent-color);
11
- --intent-color-border-hover: var(--intent-color-hover);
12
- --intent-color-border-active: var(--intent-color-active);
13
- }
14
-
15
- .negative {
16
- --intent-color: var(--color-background-negative-default);
17
- --intent-color-tinted: var(--color-background-negative-tinted-default);
18
- --intent-color-hover: var(--color-background-negative-hover);
19
- --intent-color-tinted-hover: var(--color-background-negative-tinted-hover);
20
- --intent-color-active: var(--color-background-negative-active);
21
- --intent-color-tinted-active: var(--color-background-negative-tinted-active);
22
- --intent-color-text: var(--color-background-negative-text);
23
- --intent-color-border: var(--intent-color);
24
- --intent-color-border-hover: var(--intent-color-hover);
25
- --intent-color-border-active: var(--intent-color-active);
26
- }
27
-
28
- .information {
29
- --intent-color: var(--color-background-information-default);
30
- --intent-color-tinted: var(--color-background-information-tinted-default);
31
- --intent-color-tinted-hover: var(--color-background-information-tinted-hover);
32
- --intent-color-tinted-active: var(
33
- --color-background-information-tinted-active
34
- );
35
- --intent-color-border: var(--intent-color);
36
- --intent-color-border-hover: var(--intent-color-hover);
37
- --intent-color-border-active: var(--intent-color-active);
38
- }
39
-
40
- .caution {
41
- --intent-color: var(--color-background-caution-default);
42
- --intent-color-tinted: var(--color-background-caution-tinted-default);
43
- --intent-color-tinted-hover: var(--color-background-caution-tinted-hover);
44
- --intent-color-tinted-active: var(--color-background-caution-tinted-active);
45
- --intent-color-border: var(--intent-color);
46
- --intent-color-border-hover: var(--intent-color-hover);
47
- --intent-color-border-active: var(--intent-color-active);
48
- }
49
-
50
- .neutral {
51
- --intent-color: var(--color-background-default);
52
- --intent-color-hover: var(--color-background-hover);
53
- --intent-color-active: var(--color-background-active);
54
- --intent-color-text: var(--color-text-default);
55
- --intent-color-border: var(--color-border-high-contrast);
56
- --intent-color-border-hover: var(--intent-color-border);
57
- --intent-color-border-active: var(--intent-color-border);
58
- }
package/src/tokens.css DELETED
@@ -1,107 +0,0 @@
1
- /* TODO: this should potentially be part of the theme definition, as it implements design decisions specific to the theme */
2
-
3
- /* base tokens */
4
- :root {
5
- /* color tokens */
6
- /* based on: https://docs.google.com/spreadsheets/d/1AY6BLFU-Cnj48ggHUnNVlWRxwWZ6Z-66s7jxJC1HLSU/edit?gid=1738212977#gid=1738212977 */
7
- --color-palette-white: #fff;
8
- --color-palette-black: #000;
9
- --color-palette-blue: #24598f;
10
- --color-palette-yellow: #cc7900;
11
-
12
- --color-background-default: var(--color-palette-white);
13
- --color-text-default: var(--color-palette-black);
14
- --color-background-hover: rgba(242, 242, 242, 1);
15
- --color-background-active: rgba(235, 235, 235, 1);
16
-
17
- --color-background-neutral-default: rgb(242, 242, 242);
18
- --color-background-neutral-hover: rgb(229, 229, 229);
19
- --color-background-neutral-active: rgb(222, 222, 222);
20
-
21
- --color-border-high-contrast: rgba(0, 0, 0, 0.56);
22
-
23
- --color-background-positive-default: rgba(14, 132, 32, 1);
24
- --color-background-positive-hover: rgba(12, 109, 26, 1);
25
- --color-background-positive-active: rgba(10, 95, 23, 1);
26
- --color-background-positive-text: var(--color-palette-white); /* text on positive background */
27
-
28
- --color-background-positive-tinted-default: rgba(10, 189, 37, 0.1);
29
- --color-background-positive-tinted-hover: rgba(0, 199, 30, 0.15);
30
- --color-background-positive-tinted-active: rgba(0, 199, 30, 0.18);
31
-
32
- --color-background-negative-tinted-default: rgba(199, 0, 20, 0.1);
33
- --color-background-negative-tinted-hover: rgba(199, 0, 20, 0.15);
34
- --color-background-negative-tinted-active: rgba(199, 0, 20, 0.18);
35
-
36
- --color-background-negative-default: rgba(199, 22, 43, 1);
37
- --color-background-negative-hover: rgba(176, 19, 38, 1);
38
- --color-background-negative-active: rgba(162, 18, 35, 1);
39
- --color-background-negative-text: var(--color-palette-white); /* text on positive background */
40
-
41
- --color-background-information-default: var(--color-palette-blue);
42
- --color-background-information-tinted-default: rgba(0, 99, 199, 0.1);
43
- --color-background-information-tinted-hover: rgba(0, 99, 199, 0.15);
44
- --color-background-information-tinted-active: rgba(0, 99, 199, 0.18);
45
-
46
- --color-background-caution-default: var(--color-palette-yellow);
47
- --color-background-caution-tinted-default: rgba(199, 90, 0, 0.1);
48
- --color-background-caution-tinted-hover: rgba(199, 90, 0, 0.15);
49
- --color-background-caution-tinted-active: rgba(199, 90, 0, 0.18);
50
-
51
- /* spacing tokens */
52
- --spacing-horizontal-xsmall: 0.25rem;
53
- --spacing-horizontal-small: 0.5rem;
54
- --spacing-horizontal-medium: 1.25rem;
55
- --spacing-horizontal-large: 1.5rem;
56
-
57
- --spacing-vertical-xsmall: 0.25rem;
58
- --spacing-vertical-small: 0.5rem;
59
-
60
- --spacing-input-margin-bottom: 0.5rem; /* TODO: needs baseline alignment https://github.com/canonical/vanilla-framework/blob/main/scss/_settings_spacing.scss#L122 */
61
- --spacing-input-padding-vertical: 0.5rem; /* TODO: needs to take baseline into account https://github.com/canonical/vanilla-framework/blob/main/scss/_settings_spacing.scss#L124 */
62
-
63
- --spacing-border-width: 1.5px; /* TODO: 1.5px was causing some baseline issues in Vanilla */
64
-
65
- /* font tokens */
66
- --font-size-default: 1rem;
67
- --font-size-small: 0.875rem;
68
- --font-weight-default: 400;
69
- --line-height-default: 1.5rem;
70
- --line-height-small: 1.25rem;
71
- }
72
-
73
- /* component semantic tokens */
74
- :root {
75
- --button-color-background: var(--color-background-default);
76
- --button-color-background-hover: var(--color-background-hover);
77
- --button-color-background-active: var(--color-background-active);
78
- --button-color-text: var(--color-text-default);
79
- --button-color-border: var(--color-border-high-contrast);
80
- --button-color-border-hover: var(--button-color-border);
81
- --button-color-border-active: var(--button-color-border);
82
-
83
- --button-margin-left: var(--spacing-horizontal-large);
84
- --button-margin-bottom: var(--spacing-input-margin-bottom);
85
- --button-padding-vertical: var(--spacing-input-padding-vertical);
86
- --button-padding-horizontal: var(--spacing-horizontal-large);
87
- --button-border-width: var(--spacing-border-width);
88
- --button-font-size: var(--font-size-default);
89
- --button-font-weight: var(--font-weight-default);
90
- --button-line-height: var(--line-height-default);
91
-
92
- --chip-color-background: var(--color-background-neutral-default);
93
- --chip-color-background-hover: var(--color-background-neutral-hover);
94
- --chip-color-background-active: var(--color-background-neutral-active);
95
- --chip-color-border: var(--color-border-high-contrast);
96
- --chip-color-text: var(--color-text-default);
97
-
98
- --chip-border-radius: 1rem;
99
- --chip-font-size: var(--font-size-small);
100
- --chip-font-weight: var(--font-weight-default);
101
- --chip-line-height: var(--line-height-small);
102
- --chip-border-width: var(--spacing-border-width);
103
- --chip-padding-vertical: var(--spacing-vertical-xsmall);
104
- --chip-padding-horizontal: var(--spacing-horizontal-small);
105
- --chip-margin-bottom: var(--spacing-vertical-small);
106
- --chip-margin-left: var(--spacing-horizontal-medium);
107
- }
@@ -1,88 +0,0 @@
1
- /*
2
- TODO
3
- - conditional (?) font size increase on large screens
4
- - different heading sizes/spacing on different screen sizes
5
- - how to make very opinionated styles (heading sizes in pairs, margin collapsing between them, etc) configurable/themable?
6
- */
7
-
8
- :root {
9
- --font-family-sans: "Ubuntu variable", "Ubuntu", -apple-system, "Segoe UI",
10
- "Roboto", "Oxygen", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
11
- sans-serif;
12
- --font-family-mono: "Ubuntu Mono variable", "Ubuntu Mono", Consolas, Monaco,
13
- Courier, monospace;
14
- --text-max-width: 40em;
15
- }
16
-
17
- :root {
18
- --baseline-height: .5rem;
19
- --ascender: 830;
20
- --descender: -170;
21
- --units-per-em: 1000;
22
- }
23
-
24
- html {
25
- color: #000;
26
- font-family: var(--font-family-sans);
27
- -moz-osx-font-smoothing: grayscale;
28
- -webkit-font-smoothing: antialiased;
29
- font-weight: 400;
30
- font-size: 1rem;
31
- line-height: var(--line-height-default);
32
- text-wrap: pretty;
33
- }
34
-
35
- /* FIXME: we would need to add many more selectors here, everything that is a heading (in components) */
36
- p,
37
- h1,
38
- h2,
39
- h3,
40
- h4,
41
- h5,
42
- h6 {
43
- max-width: var(--text-max-width);
44
- font-weight: var(--font-weight);
45
- }
46
-
47
- p {
48
- --font-size: 1rem;
49
- --line-height-multiplier: 3;
50
- --space-after: 3;
51
- --font-weight: 400;
52
- }
53
-
54
- h1 {
55
- --line-height-multiplier: 6;
56
- --font-size: 2.5rem;
57
- --space-after: 3;
58
- --font-weight: 550;
59
- }
60
-
61
- h2 {
62
- --line-height-multiplier: 6;
63
- --font-size: 2.5rem;
64
- --space-after: 3;
65
- --font-weight: 180;
66
- }
67
-
68
- h3 {
69
- --line-height-multiplier: 4;
70
- --font-size: 1.5rem;
71
- --space-after: 3;
72
- --font-weight: 550;
73
- }
74
-
75
- h4 {
76
- --line-height-multiplier: 4;
77
- --font-size: 1.5rem;
78
- --space-after: 3;
79
- --font-weight: 275;
80
- }
81
-
82
- h5,
83
- h6 {
84
- --line-height-multiplier: 3;
85
- --font-size: 1rem;
86
- --space-after: 2;
87
- --font-weight: 400;
88
- }