@canonical/styles 0.47.0 → 0.49.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/README.md CHANGED
@@ -61,6 +61,45 @@ systems out of each other's way, and bridges the theme signal between them. A te
61
61
  binds its copy to the files here so the two cannot drift. Nothing about that arrangement changes this
62
62
  package or the markup of a page that does not need it.
63
63
 
64
+ ## Webpack and Next.js
65
+
66
+ The fonts are opt-in: `@canonical/styles/fonts` declares the Ubuntu Sans faces, and each `src` names its
67
+ file with a bare package specifier into `@canonical/ds-assets`:
68
+
69
+ ```css
70
+ @import url("@canonical/styles/fonts");
71
+ ```
72
+
73
+ Vite, Bun and Turbopack resolve that specifier from `node_modules`. In a webpack build, css-loader reads
74
+ the `url()` as relative, so Next.js stops with `Can't resolve './@canonical/ds-assets/fonts/ubuntu-sans/UbuntuSans[wdth,wght].woff2'`.
75
+
76
+ A `NormalModuleReplacementPlugin` in `next.config.js` strips the leading `./`, which hands the request back
77
+ to the module resolver as the package path it is:
78
+
79
+ ```js
80
+ /** @type {import('next').NextConfig} */
81
+ const nextConfig = {
82
+ webpack(config, { webpack }) {
83
+ config.plugins.push(
84
+ new webpack.NormalModuleReplacementPlugin(
85
+ /^\.\/@canonical\/ds-assets\//,
86
+ (resource) => {
87
+ resource.request = resource.request.replace(/^\.\//, "");
88
+ },
89
+ ),
90
+ );
91
+ return config;
92
+ },
93
+ };
94
+
95
+ module.exports = nextConfig;
96
+ ```
97
+
98
+ The webpack build then copies both `.woff2` files into `.next/static/media`. On Next.js 15, `next build`
99
+ uses webpack by default. On Next.js 16, Turbopack is the default for both `next dev` and `next build`; use
100
+ `next build --webpack` (or `next dev --webpack`) if you need to keep the webpack plugin. Turbopack resolves
101
+ the bare specifier without the plugin or a different import.
102
+
64
103
  ## Entry points
65
104
 
66
105
  Five. `@canonical/styles` is the one an ordinary page wants: the whole stylesheet, in the order
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@canonical/styles",
3
3
  "description": "Canonical Design System global stylesheet. The reset, typography, and design tokens, in named cascade layers.",
4
- "version": "0.47.0",
4
+ "version": "0.49.0",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": "./src/index.css",
@@ -40,13 +40,13 @@
40
40
  "check:webarchitect": "webarchitect assets"
41
41
  },
42
42
  "devDependencies": {
43
- "@biomejs/biome": "2.5.15",
44
- "@canonical/biome-config": "0.43.0",
45
- "@canonical/webarchitect": "0.44.0"
43
+ "@biomejs/biome": "2.6.9",
44
+ "@canonical/biome-config": "0.47.0",
45
+ "@canonical/webarchitect": "0.46.0"
46
46
  },
47
47
  "dependencies": {
48
- "@canonical/design-tokens": "0.44.0",
49
- "@canonical/styles-typography": "^0.47.0"
48
+ "@canonical/design-tokens": "0.46.0",
49
+ "@canonical/styles-typography": "^0.49.0"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@canonical/ds-assets": ">=0.18.0"
@@ -56,5 +56,5 @@
56
56
  "optional": true
57
57
  }
58
58
  },
59
- "gitHead": "f846e7e21001a0fcbc4cd9f28c14a55cea7f4974"
59
+ "gitHead": "9b71099ded16351ee14432246e3d8190f48767ed"
60
60
  }
package/src/index.css CHANGED
@@ -96,6 +96,8 @@
96
96
  @import url("@canonical/design-tokens/dist/modifiers.criticality.css");
97
97
  @import url("@canonical/design-tokens/dist/modifiers.emphasis.css");
98
98
  @import url("@canonical/design-tokens/dist/modifiers.importance.css");
99
+ @import url("@canonical/design-tokens/dist/modifiers.spacing.css");
100
+ @import url("@canonical/design-tokens/dist/modifiers.lifecycle.css");
99
101
  /* TEMP shims (remove once generated upstream):
100
102
  - states: writes the explicit per-state colour tokens into the modifier
101
103
  channel (the generated modifiers only expose root), so hover/active/
package/src/tokens.css CHANGED
@@ -87,6 +87,8 @@
87
87
  @import url("@canonical/design-tokens/dist/modifiers.criticality.css");
88
88
  @import url("@canonical/design-tokens/dist/modifiers.emphasis.css");
89
89
  @import url("@canonical/design-tokens/dist/modifiers.importance.css");
90
+ @import url("@canonical/design-tokens/dist/modifiers.spacing.css");
91
+ @import url("@canonical/design-tokens/dist/modifiers.lifecycle.css");
90
92
  /* TEMP shims (remove once generated upstream):
91
93
  - states: writes the explicit per-state colour tokens into the modifier
92
94
  channel (the generated modifiers only expose root), so hover/active/