@nexxtmove/ui 1.2.9 → 1.3.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nexxtmove/ui",
3
3
  "type": "module",
4
- "version": "1.2.9",
4
+ "version": "1.3.0",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -25,7 +25,8 @@
25
25
  "@vueuse/core": "^14.4.0",
26
26
  "date-fns": "^4.4.0",
27
27
  "date-fns-tz": "^3.2.0",
28
- "reka-ui": "^2.10.3"
28
+ "reka-ui": "^2.10.3",
29
+ "vite-svg-loader": "^5.1.1"
29
30
  },
30
31
  "peerDependencies": {
31
32
  "tailwindcss": "^4.0.0",
@@ -47,6 +48,8 @@
47
48
  "@types/react": "^19.2.18",
48
49
  "@types/react-dom": "^19.2.4",
49
50
  "@vitejs/plugin-vue": "^6.0.8",
51
+ "@vitest/browser": "^4.1.11",
52
+ "@vitest/browser-playwright": "^4.1.11",
50
53
  "@vitest/coverage-v8": "^4.1.10",
51
54
  "@vue/eslint-config-typescript": "^14.9.0",
52
55
  "@vue/test-utils": "^2.4.11",
@@ -60,6 +63,7 @@
60
63
  "flag-icons": "^7.5.0",
61
64
  "globals": "^17.11.0",
62
65
  "jsdom": "^29.1.1",
66
+ "playwright": "^1.62.1",
63
67
  "prettier": "^3.9.6",
64
68
  "prettier-plugin-tailwindcss": "^0.8.1",
65
69
  "react": "^19.2.8",
@@ -69,7 +73,6 @@
69
73
  "typescript-eslint": "^8.67.0",
70
74
  "vite": "^8.2.1",
71
75
  "vite-plugin-dts": "^5.0.3",
72
- "vite-svg-loader": "^5.1.1",
73
76
  "vitest": "^4.1.10"
74
77
  },
75
78
  "engines": {
@@ -81,6 +84,7 @@
81
84
  "build": "vite build",
82
85
  "format": "prettier --write .",
83
86
  "generate:index": "node --experimental-strip-types ./scripts/generate-index.ts",
87
+ "version": "node --experimental-strip-types ./scripts/changelog.ts && git add CHANGELOG.md",
84
88
  "lint": "eslint .",
85
89
  "lint:fix": "eslint . --fix",
86
90
  "storybook": "storybook dev -p 6006 --no-open",
package/src/nuxt.ts CHANGED
@@ -41,7 +41,19 @@ const module: NuxtModule<ModuleOptions> = defineNuxtModule<ModuleOptions>({
41
41
  // Anchored to dist/nuxt.js at runtime; ../src resolves to the shipped source files
42
42
  const { resolve } = createResolver(import.meta.url)
43
43
 
44
- addVitePlugin(svgLoader())
44
+ // `defaultImport: 'url'` so a plain `import logo from './logo.svg'` in the
45
+ // consumer's own source yields a URL string, which is what an `<img :src>`
46
+ // needs. Without it vite-svg-loader defaults to returning a Vue component
47
+ // and those bindings render as "[object Object]". Consumers that want the
48
+ // component form ask for it explicitly with `?component`, which is
49
+ // unaffected by this setting.
50
+ //
51
+ // This plugin only ever sees the consumer's source. The library's own SVG
52
+ // imports — SocialMediaType.vue and Icon/customIcons.ts, which do rely on
53
+ // the component form — are resolved by this repo's vite.config.ts at build
54
+ // time and are already compiled into dist/index.js before a consumer sees
55
+ // them.
56
+ addVitePlugin(svgLoader({ defaultImport: 'url' }))
45
57
 
46
58
  nuxt.hook('vite:extendConfig', (config: UserConfig) => {
47
59
  config.resolve ??= {}
@@ -61,6 +73,43 @@ const module: NuxtModule<ModuleOptions> = defineNuxtModule<ModuleOptions>({
61
73
  })
62
74
  }
63
75
 
76
+ // Large assets (video, photography) are emitted to dist/assets/ rather than
77
+ // base64-inlined, and dist/index.js references them as
78
+ // `new URL("assets/<file>", import.meta.url)`. Nuxt does not run Vite's
79
+ // asset-import-meta-url transform over a prebuilt dependency, so that
80
+ // reference survives verbatim into the client chunk and resolves relative
81
+ // to it — i.e. to `<buildAssetsDir>/assets/<file>`. Nothing is emitted
82
+ // there, so without this the assets 404 in both dev and production.
83
+ //
84
+ // Serving dist/assets/ at exactly that prefix makes the existing references
85
+ // resolve. buildAssetsDir is read from the app rather than hardcoded to
86
+ // '/_nuxt/', since an app may move it.
87
+ const assetsDir = resolve('./assets')
88
+
89
+ if (existsSync(assetsDir)) {
90
+ const baseURL = `/${[nuxt.options.app.buildAssetsDir, 'assets']
91
+ .join('/')
92
+ .replace(/\/+/g, '/')
93
+ .replace(/^\/|\/$/g, '')}/`
94
+
95
+ nuxt.options.nitro.publicAssets ??= []
96
+ nuxt.options.nitro.publicAssets.push({
97
+ dir: assetsDir,
98
+ baseURL,
99
+ // Content-hashed filenames, so they are safe to cache indefinitely.
100
+ maxAge: 60 * 60 * 24 * 365,
101
+ })
102
+
103
+ // Dev is served by Vite, not Nitro, and dist/assets sits outside the
104
+ // app root — without this the same URLs 403 instead of resolving.
105
+ nuxt.hook('vite:extendConfig', (config: UserConfig) => {
106
+ config.server ??= {}
107
+ config.server.fs ??= {}
108
+ config.server.fs.allow ??= []
109
+ config.server.fs.allow.push(assetsDir)
110
+ })
111
+ }
112
+
64
113
  if (options.addCSS) {
65
114
  // Tailwind scans the shipped source for class names only — this does not
66
115
  // involve the consumer's type-checker. The .ts files are scanned too