@nexxtmove/ui 1.1.9 → 1.2.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.
Files changed (3) hide show
  1. package/dist/nuxt.js +3868 -3865
  2. package/package.json +3 -1
  3. package/src/nuxt.ts +18 -0
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "@nexxtmove/ui",
3
3
  "type": "module",
4
- "version": "1.1.9",
4
+ "version": "1.2.1",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
8
8
  "import": "./dist/index.js"
9
9
  },
10
10
  "./nuxt": "./dist/nuxt.js",
11
+ "./ui.css": "./dist/ui.css",
12
+ "./dist/ui.css": "./dist/ui.css",
11
13
  "./theme": "./tailwind/nexxtmove.tailwind.theme.css",
12
14
  "./components.json": "./src/components.json",
13
15
  "./components/*": "./src/components/*"
package/src/nuxt.ts CHANGED
@@ -7,9 +7,17 @@ import {
7
7
  } from '@nuxt/kit'
8
8
  import type { NuxtModule } from '@nuxt/schema'
9
9
  import type { UserConfig } from 'vite'
10
+ import { existsSync } from 'node:fs'
10
11
  import svgLoader from 'vite-svg-loader'
11
12
  import components from './components.json'
12
13
 
14
+ // The stylesheet may already be listed by the app itself, either as a package
15
+ // specifier or as a resolved path — adding it twice would duplicate the rules.
16
+ const CSS_SPECIFIERS = ['@nexxtmove/ui/ui.css', '@nexxtmove/ui/dist/ui.css']
17
+
18
+ const hasComponentCSS = (css: string[], resolvedPath: string) =>
19
+ css.some((entry) => entry === resolvedPath || CSS_SPECIFIERS.includes(entry))
20
+
13
21
  export interface ModuleOptions {
14
22
  /**
15
23
  * Whether to automatically add the theme CSS.
@@ -68,6 +76,16 @@ const module: NuxtModule<ModuleOptions> = defineNuxtModule<ModuleOptions>({
68
76
  write: true,
69
77
  })
70
78
  nuxt.options.css.push('#build/nexxtmove-ui.css')
79
+
80
+ // Compiled component `<style>` blocks (scoped rules, keyframes). Not
81
+ // covered by the Tailwind entry above — that only scans the .vue source
82
+ // for class names. Pushed last so it stays unlayered and wins over
83
+ // Tailwind's layers.
84
+ const componentCSS = resolve('./ui.css')
85
+
86
+ if (existsSync(componentCSS) && !hasComponentCSS(nuxt.options.css, componentCSS)) {
87
+ nuxt.options.css.push(componentCSS)
88
+ }
71
89
  }
72
90
  },
73
91
  })