glasscn-core 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jin Tang
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,79 @@
1
+ # glasscn-core
2
+
3
+ shadcn/ui 的 Liquid Glass 主题层。暗色优先,纯 CSS,零运行时,不承担任何业务逻辑。
4
+
5
+ 挂在 shadcn 组件的 `data-slot` 属性上,把现有组件就地变成玻璃——不用重新
6
+ `shadcn add`,不用改一行 tsx。
7
+
8
+ > 完整文档、设计决策与在线预览见
9
+ > **[GitHub 仓库](https://github.com/jint2020/shadcn-glasscn)** ·
10
+ > **[在线预览](https://jint2020.github.io/shadcn-glasscn/)**
11
+
12
+ ## 安装
13
+
14
+ ```bash
15
+ npm i glasscn-core
16
+ ```
17
+
18
+ 需要 Tailwind CSS v4(peer dependency)。
19
+
20
+ ## 用法(零侵入)
21
+
22
+ 在你的 CSS 里,紧跟 shadcn 的变量之后引入:
23
+
24
+ ```css
25
+ @import "tailwindcss";
26
+ /* ... 你原有的 shadcn :root / .dark 变量 ... */
27
+ @import "glasscn-core"; /* ← 加这一行 */
28
+ @import "glasscn-core/palettes/switchable.css"; /* 想运行时切调色再加 */
29
+ ```
30
+
31
+ ```html
32
+ <body class="glass-backdrop">
33
+ ```
34
+
35
+ 顺序很重要:`glasscn-core` 要在 shadcn 变量之后,才能接管 `--card` / `--popover`
36
+ 等表面 token。
37
+
38
+ ## 降级层已内置(别自己删)
39
+
40
+ `backdrop-filter` 一旦不生效,半透明面板会变成"几乎看不见的框",文字直接压在动画背景上——
41
+ 不可读。所以降级不是锦上添花,是能不能上生产的分界线。主入口 `glasscn-core` 已经
42
+ 包含 `primitives/fallback.css`,覆盖 `@supports not (backdrop-filter)`、
43
+ `prefers-reduced-transparency`、`prefers-contrast`、`prefers-reduced-motion`、
44
+ 打印、性能降级六种情况。
45
+
46
+ ## 六套调色
47
+
48
+ ```ts
49
+ document.documentElement.dataset.glassPalette = "ocean-frost"
50
+ ```
51
+
52
+ `ember-slate`(默认)· `ocean-frost` · `soft-bloom` · `warm-sunset` ·
53
+ `emerald-mist` · `liquid-light`(唯一浅色)。
54
+
55
+ **六套里玻璃填充完全一致**,换的只是背后的光斑和强调色——玻璃永远是
56
+ `rgba(255,255,255,N)` 白色中性。这是这套设计的核心规则。
57
+
58
+ ## 按需引入
59
+
60
+ Tailwind v4 只输出实际用到的 `@utility`,工具类天然 tree-shake。CSS 层也按目录拆分:
61
+
62
+ ```css
63
+ @import "glasscn-core/headless"; /* 只要工具类,不自动接管 shadcn */
64
+ @import "glasscn-core/tokens/primitives.css"; /* 只要材质变量 */
65
+ @import "glasscn-core/primitives/surface.css";
66
+ ```
67
+
68
+ ## 不想装 npm?用 shadcn registry
69
+
70
+ 同一套主题也能通过 shadcn registry 分发,不走 npm 依赖:
71
+
72
+ ```bash
73
+ shadcn registry add @glasscn=https://jint2020.github.io/shadcn-glasscn/r/{name}.json
74
+ shadcn add @glasscn/glass-theme
75
+ ```
76
+
77
+ ## License
78
+
79
+ MIT
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "glasscn-core",
3
+ "version": "0.2.0",
4
+ "description": "Liquid Glass theme layer for shadcn/ui — dark-first glassmorphism, pure CSS, zero runtime.",
5
+ "type": "module",
6
+ "sideEffects": [
7
+ "*.css"
8
+ ],
9
+ "files": [
10
+ "src"
11
+ ],
12
+ "exports": {
13
+ ".": "./src/index.css",
14
+ "./headless": "./src/headless.css",
15
+ "./headless.css": "./src/headless.css",
16
+ "./tokens/*.css": "./src/tokens/*.css",
17
+ "./tokens/*": "./src/tokens/*.css",
18
+ "./primitives/*.css": "./src/primitives/*.css",
19
+ "./primitives/*": "./src/primitives/*.css",
20
+ "./bridge/*.css": "./src/bridge/*.css",
21
+ "./bridge/*": "./src/bridge/*.css",
22
+ "./package.json": "./package.json",
23
+ "./palettes/*.css": "./src/palettes/*.css",
24
+ "./palettes/*": "./src/palettes/*.css"
25
+ },
26
+ "keywords": [
27
+ "shadcn",
28
+ "shadcn-ui",
29
+ "tailwindcss",
30
+ "glassmorphism",
31
+ "liquid-glass",
32
+ "theme",
33
+ "css",
34
+ "dark"
35
+ ],
36
+ "license": "MIT",
37
+ "publishConfig": {
38
+ "registry": "https://registry.npmjs.org",
39
+ "access": "public"
40
+ },
41
+ "peerDependencies": {
42
+ "tailwindcss": "^4.0.0"
43
+ },
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "git+https://github.com/jint2020/shadcn-glasscn.git",
47
+ "directory": "packages/core"
48
+ },
49
+ "homepage": "https://jint2020.github.io/shadcn-glasscn",
50
+ "bugs": {
51
+ "url": "https://github.com/jint2020/shadcn-glasscn/issues"
52
+ }
53
+ }