@jiakun-zhao/unocss-preset 0.0.3

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright © 2025 Jiakun Zhao
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # @jiakun-zhao/unocss-preset
2
+
3
+ ![NPM Version](https://img.shields.io/npm/v/@jiakun-zhao/unocss-preset?labelColor=%23000&color=%23954)
4
+ ![NPM Version](https://img.shields.io/npm/l/@jiakun-zhao/unocss-preset?labelColor=%23000&color=%23954)
5
+
@@ -0,0 +1,7 @@
1
+ import { Preset, PresetMiniTheme } from "unocss";
2
+
3
+ //#region src/index.d.ts
4
+ declare function neutralColor(light: number, dark: number, s?: number): string;
5
+ declare function export_default(): Preset<PresetMiniTheme>;
6
+ //#endregion
7
+ export { export_default as default, neutralColor };
package/dist/index.mjs ADDED
@@ -0,0 +1,91 @@
1
+ import { resolvePath } from "mlly";
2
+
3
+ //#region package.json
4
+ var name = "@jiakun-zhao/unocss-preset";
5
+ var dependencies = {
6
+ "@fontsource-variable/geist": "^5.2.8",
7
+ "@fontsource-variable/geist-mono": "^5.2.7",
8
+ "mlly": "^1.8.0"
9
+ };
10
+
11
+ //#endregion
12
+ //#region src/index.ts
13
+ function neutralColor(light, dark, s = 0) {
14
+ return `hsl(0 ${s}% calc( ${light}% + var(--theme-mode) * (${dark}% - ${light}% )))`;
15
+ }
16
+ function src_default() {
17
+ return {
18
+ name,
19
+ blocklist: [
20
+ "resize",
21
+ "container",
22
+ "contents"
23
+ ],
24
+ rules: [
25
+ [/^(?:pos|position)-?(\d+)$/, ([_, m]) => ({
26
+ top: m,
27
+ bottom: m,
28
+ right: m,
29
+ left: m
30
+ })],
31
+ [/^(?:pos|position)-x-(\d+)$/, ([_, m]) => ({
32
+ right: m,
33
+ left: m
34
+ })],
35
+ [/^(?:pos|position)-y-(\d+)$/, ([_, m]) => ({
36
+ top: m,
37
+ bottom: m
38
+ })]
39
+ ],
40
+ shortcuts: [{
41
+ "pb-safe": "pb-[env(safe-area-inset-bottom)]",
42
+ "theme-light": "[--theme-mode:0]",
43
+ "theme-dark": "[--theme-mode:1]",
44
+ "theme-auto": "theme-light dark:theme-dark",
45
+ "no-tap-highlight": "[-webkit-tap-highlight-color:transparent]"
46
+ }, {
47
+ "bland-card": "bg-bland-card b-1 b-solid b-bland-card rd-bland-card",
48
+ "bland-btn-reset": "rd-bland-card h-bland-form font-600 px-3",
49
+ "bland-btn": "bland-btn-reset bg-bland-invert hover:bg-bland-invert:80 text-bland-invert",
50
+ "bland-btn-secondary": "bland-btn-reset bg-bland-neutral hover:bg-bland-neutral:80",
51
+ "bland-btn-destructive": "bland-btn-reset bg-bland-destructive hover:bg-bland-destructive:80 text-white",
52
+ "bland-btn-outline": "bland-btn-reset bg-transparent hover:bg-bland-neutral b-2 b-solid b-bland-card",
53
+ "bland-btn-ghost": "bland-btn-reset bg-transparent hover:bg-bland-neutral"
54
+ }],
55
+ theme: {
56
+ animation: { keyframes: { "slide-enter": "{0%{transform:translateY(10px);opacity:0}to{transform:translateY(0);opacity:1}}" } },
57
+ fontFamily: {
58
+ mono: "\"Geist Mono Variable\",\"DM Mono\",\"IBM Plex Mono\",ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace",
59
+ sans: "\"Geist Variable\",ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Arial,Noto Sans,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",Segoe UI Symbol,\"Noto Color Emoji\""
60
+ },
61
+ textColor: { bland: {
62
+ DEFAULT: neutralColor(0, 100),
63
+ invert: neutralColor(100, 0),
64
+ neutral: neutralColor(92, 16)
65
+ } },
66
+ backgroundColor: { bland: {
67
+ DEFAULT: neutralColor(100, 0),
68
+ invert: neutralColor(0, 100),
69
+ neutral: neutralColor(92, 16),
70
+ card: neutralColor(98, 6),
71
+ destructive: neutralColor(45, 30, 75)
72
+ } },
73
+ borderColor: { bland: { card: { DEFAULT: neutralColor(92, 16) } } },
74
+ borderRadius: { "bland-card": "7px" },
75
+ height: { "bland-form": "2.3rem" },
76
+ zIndex: {
77
+ max: "2147483647",
78
+ min: "-2147483647"
79
+ }
80
+ },
81
+ preflights: [{ async getCSS() {
82
+ const fonts = Object.keys(dependencies).filter((it) => it.startsWith("@fontsource"));
83
+ const paths = await Promise.all(fonts.map((it) => resolvePath(it)));
84
+ paths.push(await resolvePath(`${name}/reset.css`));
85
+ return paths.map((path) => `@import url(${JSON.stringify(path)});`).join("");
86
+ } }]
87
+ };
88
+ }
89
+
90
+ //#endregion
91
+ export { src_default as default, neutralColor };
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@jiakun-zhao/unocss-preset",
3
+ "type": "module",
4
+ "version": "0.0.3",
5
+ "description": "",
6
+ "author": "Jiakun Zhao <hi@zhaojiakun.com>",
7
+ "license": "MIT",
8
+ "homepage": "https://github.com/jiakun-zhao/unocss-preset#readme",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/jiakun-zhao/unocss-preset.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/jiakun-zhao/unocss-preset/issues"
15
+ },
16
+ "exports": {
17
+ ".": {
18
+ "import": "./dist/index.mjs",
19
+ "types": "./dist/index.d.mts"
20
+ },
21
+ "./reset.css": "./reset.css"
22
+ },
23
+ "main": "./dist/index.mjs",
24
+ "module": "./dist/index.mjs",
25
+ "types": "./dist/index.d.mts",
26
+ "files": [
27
+ "dist",
28
+ "reset.css"
29
+ ],
30
+ "peerDependencies": {
31
+ "unocss": "^66.5.12"
32
+ },
33
+ "dependencies": {
34
+ "@fontsource-variable/geist": "^5.2.8",
35
+ "@fontsource-variable/geist-mono": "^5.2.7",
36
+ "mlly": "^1.8.0"
37
+ },
38
+ "devDependencies": {
39
+ "@jiakun-zhao/eslint-config": "^4.1.8",
40
+ "@types/node": "^25.0.3",
41
+ "bumpp": "^10.3.2",
42
+ "eslint": "^9.39.2",
43
+ "lightningcss": "^1.30.2",
44
+ "tsdown": "^0.18.4",
45
+ "typescript": "^5.9.3",
46
+ "unocss": "^66.5.12",
47
+ "vite": "^7.3.0"
48
+ },
49
+ "scripts": {
50
+ "build": "tsdown",
51
+ "release": "bumpp && pnpm publish && pnpm dlx cnpm sync @jiakun-zhao/unocss-preset"
52
+ }
53
+ }
package/reset.css ADDED
@@ -0,0 +1,65 @@
1
+ *,
2
+ *::before,
3
+ *::after {
4
+ box-sizing: border-box;
5
+
6
+ }
7
+
8
+ :root {
9
+ font-size: 0.954rem;
10
+ }
11
+
12
+ ::selection {
13
+ color: #fff;
14
+ background-color: #954;
15
+ }
16
+
17
+ body {
18
+ margin: 0;
19
+ min-height: 100vh;
20
+ }
21
+
22
+ @supports (-webkit-font-smoothing: antialiased) {
23
+ body {
24
+ -webkit-font-smoothing: antialiased;
25
+ }
26
+ }
27
+
28
+ button,
29
+ textarea,
30
+ input,
31
+ select {
32
+ appearance: none;
33
+ background: none;
34
+ border: none;
35
+ outline: none;
36
+ color: inherit;
37
+ font-family: inherit;
38
+ font-size: inherit;
39
+ }
40
+
41
+ button,
42
+ input[type="button"],
43
+ input[type="submit"],
44
+ input[type="reset"] {
45
+ cursor: pointer;
46
+ }
47
+
48
+ button,
49
+ a {
50
+ -webkit-tap-highlight-color: transparent;
51
+ }
52
+
53
+ a {
54
+ color: inherit;
55
+ }
56
+
57
+ img,
58
+ picture {
59
+ max-width: 100%;
60
+ display: block;
61
+ }
62
+
63
+ p {
64
+ text-wrap: pretty;
65
+ }