@gkucmierz/nano-ui 1.7.2 → 1.7.4

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.
@@ -0,0 +1,29 @@
1
+ //#region src/theme.js
2
+ var e = ({ storageKey: e = "nano-ui-theme", defaultTheme: t = "dark" } = {}) => {
3
+ if (typeof window > "u" || typeof document > "u") return t;
4
+ try {
5
+ let n = localStorage.getItem(e), r = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches, i = n === "light" || n === "dark" ? n : r ? "dark" : t || "light";
6
+ return i === "light" ? document.documentElement.setAttribute("data-theme", "light") : document.documentElement.removeAttribute("data-theme"), document.documentElement.style.colorScheme = i, document.documentElement.classList.add("preload"), i;
7
+ } catch {
8
+ return t;
9
+ }
10
+ };
11
+ e();
12
+ var t = (e, t) => {
13
+ try {
14
+ let n = localStorage.getItem(e), r = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches, i = n === "light" || n === "dark" ? n : r ? "dark" : t;
15
+ i === "light" ? document.documentElement.setAttribute("data-theme", "light") : document.documentElement.removeAttribute("data-theme"), document.documentElement.style.colorScheme = i, document.documentElement.classList.add("preload");
16
+ } catch {}
17
+ }, n = ({ storageKey: e = "nano-ui-theme", defaultTheme: n = "dark" } = {}) => `(${t.toString()})(${JSON.stringify(e)}, ${JSON.stringify(n)});`, r = () => [
18
+ "html { background-color: #09090b; color-scheme: dark; }",
19
+ "html[data-theme=\"light\"] { background-color: #f8fafc; color-scheme: light; }",
20
+ "html.preload, html.preload *, html.preload *::before, html.preload *::after,",
21
+ "html.theme-switching, html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after {",
22
+ " transition: none !important;",
23
+ "}"
24
+ ].join("\n"), i = ({ storageKey: e = "nano-ui-theme", defaultTheme: t = "dark" } = {}) => `<script id="nano-ui-zero-fouc">${n({
25
+ storageKey: e,
26
+ defaultTheme: t
27
+ })}<\/script>\n<style id="nano-ui-zero-fouc-style">\n${r()}\n</style>`;
28
+ //#endregion
29
+ export { e as i, n, r, i as t };
package/dist/vite.js ADDED
@@ -0,0 +1,23 @@
1
+ import { n as e, r as t } from "./theme-0SMjgn6R.js";
2
+ //#region src/vite/index.js
3
+ var n = ({ storageKey: n = "nano-ui-theme", defaultTheme: r = "dark" } = {}) => ({
4
+ name: "vite-plugin-nano-ui",
5
+ transformIndexHtml() {
6
+ return [{
7
+ tag: "script",
8
+ attrs: { id: "nano-ui-zero-fouc" },
9
+ children: e({
10
+ storageKey: n,
11
+ defaultTheme: r
12
+ }),
13
+ injectTo: "head-prepend"
14
+ }, {
15
+ tag: "style",
16
+ attrs: { id: "nano-ui-zero-fouc-style" },
17
+ children: t(),
18
+ injectTo: "head-prepend"
19
+ }];
20
+ }
21
+ }), r = n;
22
+ //#endregion
23
+ export { n as default, n as nanoUi, r as nanoThemePlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gkucmierz/nano-ui",
3
- "version": "1.7.2",
3
+ "version": "1.7.4",
4
4
  "license": "ISC",
5
5
  "author": "Grzegorz Kućmierz",
6
6
  "description": "High-performance, minimal footprint Vue 3 UI library, interactive 3D charts, and directives.",
@@ -11,6 +11,9 @@
11
11
  ".": {
12
12
  "import": "./dist/nano-ui.js"
13
13
  },
14
+ "./vite": {
15
+ "import": "./dist/vite.js"
16
+ },
14
17
  "./style.css": "./dist/nano-ui.css",
15
18
  "./nano-ui.css": "./dist/nano-ui.css",
16
19
  "./dist/*": "./dist/*"
@@ -22,14 +25,25 @@
22
25
  "dist"
23
26
  ],
24
27
  "scripts": {
25
- "dev": "vite",
26
- "prebuild": "node scripts/generate-icons.mjs",
28
+ "dev": "vite --mode app",
29
+ "prebuild": "npm run test:unit && node scripts/generate-icons.mjs",
27
30
  "build": "vite build",
28
- "prebuild:app": "node scripts/generate-icons.mjs",
29
- "build:app": "vite build -c vite.config.app.js && node scripts/prerender.mjs",
31
+ "prebuild:app": "npm run test:unit && node scripts/generate-icons.mjs",
32
+ "build:app": "vite build --mode app",
33
+ "prebuild:ssg": "npm run test:unit && node scripts/generate-icons.mjs",
34
+ "build:ssg": "vite build --mode ssg && node scripts/prerender.mjs",
35
+ "prepublishOnly": "npm run test:unit && npm run build",
36
+ "preview:app": "vite preview --outDir dist-app --port 33165",
37
+ "preview:ssg": "vite preview --outDir dist-ssg --port 33165",
38
+ "serve:ssg": "npm run build:ssg && npm run preview:ssg",
30
39
  "prerender": "node scripts/prerender.mjs",
31
40
  "icons": "node scripts/generate-icons.mjs",
32
- "test:e2e": "playwright test"
41
+ "test": "npm run test:unit",
42
+ "test:unit": "node --test tests/unit/**/*.test.js",
43
+ "test:e2e": "playwright test",
44
+ "lint": "eslint .",
45
+ "lint:verbose": "eslint . && echo '✨ ESLint: 0 errors, all clean!'",
46
+ "lint:fix": "eslint . --fix"
33
47
  },
34
48
  "peerDependencies": {
35
49
  "vue": "^3.0.0"
@@ -37,6 +51,7 @@
37
51
  "devDependencies": {
38
52
  "@playwright/test": "^1.61.1",
39
53
  "@vitejs/plugin-vue": "^6.0.5",
54
+ "eslint": "^10.1.0",
40
55
  "vite": "^8.0.12",
41
56
  "vue": "^3.4.0"
42
57
  },
@@ -67,6 +82,8 @@
67
82
  ],
68
83
  "dependencies": {
69
84
  "@gkucmierz/analytics": "^1.0.1",
85
+ "highlight.js": "^11.11.1",
86
+ "lucide-vue-next": "^0.469.0",
70
87
  "vue-router": "^5.0.6"
71
88
  }
72
89
  }