@nexdom/uimed-vue 2.0.0-beta.30 → 2.0.0-beta.31

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/AGENTS.md CHANGED
@@ -26,7 +26,7 @@ Peer dependencies (`@mdi/font`, `@nexdom/shared`, `resize-observer-polyfill`, `s
26
26
 
27
27
  ### Setup
28
28
 
29
- Add the Vite plugin, which compiles the components' styles with the library's font and Sass settings (without it, components lose the Unimed Slab font):
29
+ Add the Vite plugin, which compiles the components' styles with the library's font and Sass settings, and loads the icon font with `font-display`, so it doesn't block rendering while it loads. Without it, components lose the Unimed Slab font:
30
30
 
31
31
  ```ts
32
32
  // vite.config.ts
package/dist/plugins.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { Plugin, UserConfig } from "vite-plus";
2
2
  //#region src/plugins.d.ts
3
3
  /**
4
- * Vite plugin that compiles the components' styles with the library's font and Sass settings.
4
+ * Vite plugin that compiles the components' styles with the library's font and Sass settings, and
5
+ * loads the icon font with `font-display: swap`, so it doesn't block rendering while it loads.
5
6
  * Required: without it, the components lose the Unimed Slab font. Needs `sass-embedded`, a peer
6
7
  * dependency.
7
8
  *
package/dist/plugins.js CHANGED
@@ -10,8 +10,13 @@ const vuetifyStylesheets = "/node_modules/vuetify/lib/";
10
10
  * Vite doesn't compile. The URL still serves the compiled stylesheet, which Vite loads separately
11
11
  */
12
12
  const uncompiledStylesheetQuery = /[?&](?:raw|url)\b/;
13
+ /** Matches the ids of the icon font's stylesheet, with or without a query and Windows separators */
14
+ const iconFontStylesheet = /[\\/]node_modules[\\/]@mdi[\\/]font[\\/]css[\\/]materialdesignicons\.css(?:\?|$)/;
15
+ /** Start of the icon font's `@font-face` rule, the only one in its stylesheet */
16
+ const iconFontFace = "@font-face {";
13
17
  /**
14
- * Vite plugin that compiles the components' styles with the library's font and Sass settings.
18
+ * Vite plugin that compiles the components' styles with the library's font and Sass settings, and
19
+ * loads the icon font with `font-display: swap`, so it doesn't block rendering while it loads.
15
20
  * Required: without it, the components lose the Unimed Slab font. Needs `sass-embedded`, a peer
16
21
  * dependency.
17
22
  *
@@ -55,6 +60,18 @@ function vitePluginUimed() {
55
60
  compiler = void 0;
56
61
  await (await current)?.dispose();
57
62
  }
63
+ }, {
64
+ name: "uimed:icon-font",
65
+ enforce: "pre",
66
+ transform: {
67
+ filter: { id: {
68
+ include: iconFontStylesheet,
69
+ exclude: uncompiledStylesheetQuery
70
+ } },
71
+ handler(code) {
72
+ return code.replace(iconFontFace, `${iconFontFace} font-display: swap;`);
73
+ }
74
+ }
58
75
  }];
59
76
  }
60
77
  /**
@@ -1,4 +1,5 @@
1
1
  @font-face {
2
2
  font-family: "Unimed Slab";
3
3
  src: url("./UnimedSlab-Regular.woff2");
4
+ font-display: swap;
4
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexdom/uimed-vue",
3
- "version": "2.0.0-beta.30",
3
+ "version": "2.0.0-beta.31",
4
4
  "description": "A ui framework for NEXDOM applications.",
5
5
  "keywords": [
6
6
  "lib",