@nexdom/uimed-vue 2.0.0-beta.20 → 2.0.0-beta.21

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
@@ -22,11 +22,11 @@ pnpm add @nexdom/uimed-vue
22
22
  yarn add @nexdom/uimed-vue
23
23
  ```
24
24
 
25
- Peer dependencies (`@fontsource/roboto`, `@mdi/font`, `@nexdom/shared`, `resize-observer-polyfill`, `vite-plugin-vuetify`, `vite-plus`, `vue`, `vue-router`, `vuetify`) must be installed alongside it — most package managers install these automatically, but confirm versions match what's declared in `package.json`'s `peerDependencies`.
25
+ Peer dependencies (`@mdi/font`, `@nexdom/shared`, `resize-observer-polyfill`, `sass-embedded`, `vite-plus`, `vue`, `vue-component-type-helpers`, `vue-router`, `vuetify`) must be installed alongside it — most package managers install these automatically, but confirm versions match what's declared in `package.json`'s `peerDependencies`.
26
26
 
27
27
  ### Setup
28
28
 
29
- Add the Vite plugin:
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):
30
30
 
31
31
  ```ts
32
32
  // vite.config.ts
@@ -166,6 +166,7 @@ Use an existing composable (e.g. `use-toast`) as the reference, and deliver in t
166
166
  - `docs` must not mention Vuetify
167
167
  - A new component/composable must be listed in its guide page (`docs/guide/…`), its API page (`docs/api/…`), both sidebars in `docs/.vitepress/config.ts`, the guide index table (`docs/guide/index.md`) and the API index list (`docs/api/index.md`).
168
168
  - Never write CSS or `<style>` blocks, and expose styling to consumers only through props.
169
+ - Adjustments that Vuetify exposes as Sass variables (e.g. a font family or a line height) go in `src/styles/settings.scss`, which `vitePluginUimed()` compiles into Vuetify's stylesheets in the apps. That file only configures variables: still no CSS rules.
169
170
  - Don't add spacing to Vuetify components: no padding or margin utility classes (`pa-*`, `pt-6`, `px-4`, `ma-2`, ...) and no spacing props overriding the defaults. Vuetify already applies Material Design 3 spacing, and overriding it breaks what it handles on its own, such as button paddings and the scrollbar of scrollable content. If the default spacing looks wrong, stop and ask instead of adjusting it.
170
171
  - Prefer a Vuetify component's own props to building its parts by hand (e.g. `title`/`text` on `v-card` instead of `v-card-item` > `v-card-title` > `v-card-text`). A non-spacing utility class is acceptable only when no prop covers the need (e.g. `text-wrap` on a card title), with a comment saying why.
171
172
  - Keep components thin: a component wires props, slots and events to Vuetify. Logic beyond that (focus management, queues, DOM lookups, comparisons) goes into an internal composable with its own unit tests.
package/dist/index.js CHANGED
@@ -26,10 +26,7 @@ function createUimed() {
26
26
  error: "#D92D20",
27
27
  info: "#9ACBE5"
28
28
  },
29
- variables: {
30
- "border-color": "#D0D5DD",
31
- "font-body": "\"Unimed Slab\", sans-serif"
32
- }
29
+ variables: { "border-color": "#D0D5DD" }
33
30
  } }
34
31
  }
35
32
  });
package/dist/plugins.d.ts CHANGED
@@ -1,10 +1,21 @@
1
- import vitePluginVuetify from "vite-plugin-vuetify";
2
- import { UserConfig } from "vite-plus";
1
+ import { Plugin, UserConfig } from "vite-plus";
3
2
  //#region src/plugins.d.ts
4
3
  /**
5
- * Vite plugin for UIMed.
4
+ * Vite plugin that compiles the components' styles with the library's font and Sass settings.
5
+ * Required: without it, the components lose the Unimed Slab font. Needs `sass-embedded`, a peer
6
+ * dependency.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * // vite.config.ts
11
+ * import { vitePluginUimed } from "@nexdom/uimed-vue/plugins";
12
+ *
13
+ * export default defineConfig({
14
+ * plugins: [vue(), vitePluginUimed()],
15
+ * });
16
+ * ```
6
17
  */
7
- export declare function vitePluginUimed(): ReturnType<typeof vitePluginVuetify>;
18
+ export declare function vitePluginUimed(): Plugin[];
8
19
  /**
9
20
  * Vitest Server plugin for UIMed.
10
21
  */
package/dist/plugins.js CHANGED
@@ -1,10 +1,61 @@
1
- import vitePluginVuetify from "vite-plugin-vuetify";
1
+ import { existsSync } from "node:fs";
2
+ import { pathToFileURL } from "node:url";
2
3
  //#region src/plugins.ts
4
+ /** Matches the ids of CSS files, with or without a query */
5
+ const stylesheet = /\.css(?:\?|$)/;
6
+ /** Path of Vuetify's stylesheets folder, inside the `node_modules` folder where it's installed */
7
+ const vuetifyStylesheets = "/node_modules/vuetify/lib/";
3
8
  /**
4
- * Vite plugin for UIMed.
9
+ * Matches the queries that import a stylesheet's file as is (`?raw`) or its URL (`?url`), which
10
+ * Vite doesn't compile. The URL still serves the compiled stylesheet, which Vite loads separately
11
+ */
12
+ const uncompiledStylesheetQuery = /[?&](?:raw|url)\b/;
13
+ /**
14
+ * Vite plugin that compiles the components' styles with the library's font and Sass settings.
15
+ * Required: without it, the components lose the Unimed Slab font. Needs `sass-embedded`, a peer
16
+ * dependency.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * // vite.config.ts
21
+ * import { vitePluginUimed } from "@nexdom/uimed-vue/plugins";
22
+ *
23
+ * export default defineConfig({
24
+ * plugins: [vue(), vitePluginUimed()],
25
+ * });
26
+ * ```
5
27
  */
6
28
  function vitePluginUimed() {
7
- return vitePluginVuetify({ autoImport: false });
29
+ const settings = new URL("./styles/settings.scss", import.meta.url);
30
+ let compiler;
31
+ return [{
32
+ name: "uimed:vuetify-styles",
33
+ enforce: "pre",
34
+ load: {
35
+ filter: { id: {
36
+ include: stylesheet,
37
+ exclude: uncompiledStylesheetQuery
38
+ } },
39
+ async handler(id) {
40
+ const file = id.split("?")[0].replaceAll("\\", "/");
41
+ const folder = file.lastIndexOf(vuetifyStylesheets);
42
+ if (folder === -1) return null;
43
+ const nodeModules = `${file.slice(0, folder)}/node_modules`;
44
+ const source = [".sass", ".scss"].map((extension) => `${file.slice(0, -4)}${extension}`).find((path) => existsSync(path));
45
+ if (!source) return null;
46
+ compiler ??= import("sass-embedded").then((sass) => sass.initAsyncCompiler());
47
+ const sass = await compiler;
48
+ const entry = `@use "${settings.href}";\n@use "${pathToFileURL(source).href}";`;
49
+ const { css } = await sass.compileStringAsync(entry, { loadPaths: [nodeModules] });
50
+ return css;
51
+ }
52
+ },
53
+ async closeBundle() {
54
+ const current = compiler;
55
+ compiler = void 0;
56
+ await (await current)?.dispose();
57
+ }
58
+ }];
8
59
  }
9
60
  /**
10
61
  * Vitest Server plugin for UIMed.
@@ -0,0 +1,6 @@
1
+ @use "vuetify/settings" with (
2
+ $body-font-family: var(--v-font-body, "Unimed Slab", sans-serif),
3
+ // Unimed Slab's ascent and descent take 1.26em, more than the subtitles' default 1rem line
4
+ // height, which clipped its descenders and accented capitals
5
+ $list-item-subtitle-line-height: normal
6
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexdom/uimed-vue",
3
- "version": "2.0.0-beta.20",
3
+ "version": "2.0.0-beta.21",
4
4
  "description": "A ui framework for NEXDOM applications.",
5
5
  "keywords": [
6
6
  "lib",
@@ -75,7 +75,6 @@
75
75
  "sass-embedded": "^1.103.1",
76
76
  "stryker-vue-ignorer": "github:davidlandais/stryker-vue-ignorer",
77
77
  "typescript": "^6.0.3",
78
- "vite-plugin-vuetify": "^2.1.3",
79
78
  "vite-plus": "^1.0.0",
80
79
  "vitepress": "2.0.0-alpha.19",
81
80
  "vitepress-plugin-group-icons": "^1.7.6",
@@ -90,7 +89,7 @@
90
89
  "@mdi/font": "^7.4.47",
91
90
  "@nexdom/shared": "^2.1.1",
92
91
  "resize-observer-polyfill": "^1.5.1",
93
- "vite-plugin-vuetify": "^2.1.3",
92
+ "sass-embedded": "^1.103.1",
94
93
  "vite-plus": "^1.0.0",
95
94
  "vue": "^3.5.40",
96
95
  "vue-component-type-helpers": "^3.3.11",