@emoo-ai/brand 0.0.0-stage → 0.1.0-alpha.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 emoo-ai
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 CHANGED
@@ -1,3 +1,21 @@
1
- # Temporary Holding Version
1
+ # @emoo-ai/brand
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 框架无关的 emoo 品牌唯一真源:预编译 tokens CSS 与纯函数颜色运行时,零运行时依赖。
4
+
5
+ ## 入口
6
+
7
+ - `@emoo-ai/brand` / `@emoo-ai/brand/tokens.css`:预编译纯 CSS,只有 `:where(:root)` / `:where(:root.dark)` token 声明。
8
+ - `@emoo-ai/brand/colors`:混色、RGB、主色 20 项变量派生与头像 tint 的纯函数运行时(附类型声明)。
9
+ - `@emoo-ai/brand/manifest.json`:精确版本与源码/制品 SHA-256,用于核对产物一致性。
10
+
11
+ 没有 Vue/React/Element Plus 的运行依赖或 peer;安装 CSS 产物不需要 Sass。
12
+
13
+ 本包以编译产物方式发布,源码不随包;`manifest.json` 的哈希可核验 dist 与声明的源码输入一致。
14
+
15
+ ## 换肤
16
+
17
+ `--emoo-color-primary`、`--emoo-btn-solid-bg/color`、表面、文字、圆角等是独立语义:主色不是所有主按钮的背景色。暗色在 html 上挂 `.dark`,不承诺嵌套局部主题。
18
+
19
+ 默认主色色阶与 RGB 沿用既有数值。只覆盖主色本体不会自动重算 RGB/静态色阶;白标应提供相应 `--emoo-color-primary-rgb/light-*/dark-*` 配套值,或用 `colors` 入口的 `primaryColorVars()` 由宿主计算。
20
+
21
+ 本包不引用 `--el-*`、`--v-*`、宿主选择器或外部资源;Element Plus / shadcn 等框架的变量映射在各自的适配包内,不在本包。
@@ -0,0 +1,16 @@
1
+ export declare const PRESET_COLORS: {
2
+ readonly default: "#7429ec";
3
+ readonly green: "#67C23A";
4
+ readonly orange: "#E6A23C";
5
+ readonly red: "#F56C6C";
6
+ readonly purple: "#722ED1";
7
+ };
8
+ export type BrandPresetKey = keyof typeof PRESET_COLORS;
9
+ export declare function mixColor(color1: string, color2: string, weight: number): string;
10
+ export declare function hexToRgbString(color: string): string;
11
+ export type PrimaryColorVarName = '--emoo-color-primary' | '--emoo-color-primary-rgb' | `--emoo-color-primary-light-${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}` | `--emoo-color-primary-dark-${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}`;
12
+ export type PrimaryColorVars = Readonly<Record<PrimaryColorVarName, string>>;
13
+ export declare function primaryColorVars(primary: string, isDark?: boolean): PrimaryColorVars;
14
+ export declare const AVATAR_TINT_PALETTE: readonly ["#7429ec", "#0ea5e9", "#ec4899", "#f5b04c", "#10b981", "#8b5cf6", "#14b8a6", "#f97316"];
15
+ export type AvatarTintColor = (typeof AVATAR_TINT_PALETTE)[number];
16
+ export declare const avatarTintOf: (name: string) => AvatarTintColor;
package/dist/colors.js ADDED
@@ -0,0 +1,56 @@
1
+ export const PRESET_COLORS = {
2
+ default: '#7429ec',
3
+ green: '#67C23A',
4
+ orange: '#E6A23C',
5
+ red: '#F56C6C',
6
+ purple: '#722ED1',
7
+ };
8
+ const HEX = /^#?[0-9a-fA-F]{6}$/;
9
+ function normalizeHex(color) {
10
+ if (typeof color !== 'string' || !HEX.test(color)) {
11
+ throw new TypeError(`emoo brand: 颜色必须是六位 hex,当前 ${JSON.stringify(color)}`);
12
+ }
13
+ return color.replace('#', '');
14
+ }
15
+ const channelOf = (hex, index) => parseInt(hex.substring(index * 2, index * 2 + 2), 16);
16
+ export function mixColor(color1, color2, weight) {
17
+ const a = normalizeHex(color1);
18
+ const b = normalizeHex(color2);
19
+ if (!Number.isFinite(weight))
20
+ throw new TypeError('emoo brand: weight 必须是有限数字');
21
+ let result = '#';
22
+ for (let i = 0; i < 3; i++) {
23
+ result += Math.round(channelOf(a, i) * weight + channelOf(b, i) * (1 - weight))
24
+ .toString(16)
25
+ .padStart(2, '0');
26
+ }
27
+ return result;
28
+ }
29
+ export function hexToRgbString(color) {
30
+ const hex = normalizeHex(color);
31
+ return `${channelOf(hex, 0)}, ${channelOf(hex, 1)}, ${channelOf(hex, 2)}`;
32
+ }
33
+ export function primaryColorVars(primary, isDark = false) {
34
+ const hex = normalizeHex(primary || PRESET_COLORS.default);
35
+ const lightBase = isDark ? '#141414' : '#ffffff';
36
+ const darkBase = isDark ? '#ffffff' : '#000000';
37
+ const vars = {
38
+ '--emoo-color-primary': `#${hex}`,
39
+ '--emoo-color-primary-rgb': hexToRgbString(hex),
40
+ };
41
+ for (let n = 1; n <= 9; n++) {
42
+ vars[`--emoo-color-primary-light-${n}`] = mixColor(lightBase, hex, n / 10);
43
+ vars[`--emoo-color-primary-dark-${n}`] = mixColor(darkBase, hex, n / 10);
44
+ }
45
+ return vars;
46
+ }
47
+ export const AVATAR_TINT_PALETTE = [
48
+ '#7429ec', '#0ea5e9', '#ec4899', '#f5b04c',
49
+ '#10b981', '#8b5cf6', '#14b8a6', '#f97316',
50
+ ];
51
+ export const avatarTintOf = (name) => {
52
+ let sum = 0;
53
+ for (const ch of name)
54
+ sum += ch.charCodeAt(0);
55
+ return AVATAR_TINT_PALETTE[sum % AVATAR_TINT_PALETTE.length];
56
+ };
@@ -0,0 +1,19 @@
1
+ {
2
+ "schemaVersion": 3,
3
+ "package": "@emoo-ai/brand",
4
+ "version": "0.1.0-alpha.1",
5
+ "source": {
6
+ "sha256": "207176b16e687966ef664847fd2ca227530570d0149c334ede5b2e87a589ebd6"
7
+ },
8
+ "files": {
9
+ "tokens.css": {
10
+ "sha256": "48b6ffc7e635afb11eb2c4e90d0f834a69675bf6caa333afc0d10b37c1149f2c"
11
+ },
12
+ "colors.js": {
13
+ "sha256": "a2d8ce386855074667695cced5e1d97ab2e4f4b9afc467b23e60d39b517bade4"
14
+ },
15
+ "colors.d.ts": {
16
+ "sha256": "6591f2d23bcb488bb7f545b15e401a71f031086351f91b411bb645c332487a94"
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,144 @@
1
+ :where(:root) {
2
+ --emoo-color-primary: #7429ec;
3
+ --emoo-color-primary-rgb: 116, 41, 236;
4
+ --emoo-color-primary-light-3: #9e69f2;
5
+ --emoo-color-primary-light-4: #ac7ff4;
6
+ --emoo-color-primary-light-5: #ba94f6;
7
+ --emoo-color-primary-light-7: #d5bff9;
8
+ --emoo-color-primary-light-8: #e3d4fb;
9
+ --emoo-color-primary-light-9: #f1eafd;
10
+ --emoo-color-primary-dark-2: #5d21bd;
11
+ --emoo-border-color-light: #e4e7ed;
12
+ --emoo-color-on-danger: #ffffff;
13
+ --emoo-text-color-head: rgb(0, 0, 0, 0.9);
14
+ --emoo-text-color-normal: rgba(0, 0, 0, 0.7);
15
+ --emoo-bg-color-block: rgba(0, 0, 0, 0.03);
16
+ --emoo-bg-color: #fff;
17
+ --emoo-border-color: var(--emoo-border-color-light);
18
+ --emoo-bg-chat-page: #f6f6f6;
19
+ --emoo-bg-color-chat: #fff;
20
+ --emoo-bg-color-hover: #f6f6f6;
21
+ --emoo-bg-color-user-message: #e6e8eb;
22
+ --emoo-bg-color-card: #ffffff;
23
+ --emoo-card-solid-bg: #ffffff;
24
+ --emoo-card-glass-flow-a: #ffffff;
25
+ --emoo-card-glass-flow-b: #ffffff;
26
+ --emoo-card-border-color: rgba(19, 19, 26, 0.07);
27
+ --emoo-card-top-line: rgba(19, 19, 26, 0.1);
28
+ --emoo-glow-color: color-mix(in srgb, var(--emoo-color-primary) 10%, transparent);
29
+ --emoo-shadow-card: 0 1px 2px rgba(19, 19, 26, 0.05), 0 24px 64px -28px rgba(19, 19, 26, 0.16);
30
+ --emoo-hairline-color: rgba(19, 19, 26, 0.055);
31
+ --emoo-hover-bg: rgba(19, 19, 26, 0.06);
32
+ --emoo-hover-ring-color: rgba(19, 19, 26, 0.07);
33
+ --emoo-hover-lift-shadow: rgba(19, 19, 26, 0.12);
34
+ --emoo-selected-bg: color-mix(in srgb, var(--emoo-color-primary) 7%, transparent);
35
+ --emoo-track-bg: rgba(19, 19, 26, 0.07);
36
+ --emoo-ghost-bg: rgba(19, 19, 26, 0.04);
37
+ --emoo-ghost-border-color: rgba(19, 19, 26, 0.09);
38
+ --emoo-btn-solid-bg: #17171b;
39
+ --emoo-btn-solid-color: #ffffff;
40
+ --emoo-seg-active-bg: #ffffff;
41
+ --emoo-text-color-secondary: #54545e;
42
+ --emoo-text-color-tertiary: #8b8b95;
43
+ --emoo-color-ok: #0e9f6e;
44
+ --emoo-color-ok-bg: rgba(14, 159, 110, 0.1);
45
+ --emoo-color-warn: #c07f1a;
46
+ --emoo-color-warn-bg: rgba(214, 148, 40, 0.12);
47
+ --emoo-color-danger: #e0444f;
48
+ --emoo-color-danger-rgb: 224, 68, 79;
49
+ --emoo-color-danger-bg: rgba(224, 68, 79, 0.09);
50
+ --emoo-color-sync: #1d8fd1;
51
+ --emoo-color-sync-bg: rgba(58, 157, 222, 0.1);
52
+ --emoo-color-neutral-bg: rgba(84, 84, 94, 0.08);
53
+ --emoo-gradient-brand: linear-gradient(135deg, var(--emoo-color-primary), color-mix(in srgb, var(--emoo-color-primary) 55%, #fff));
54
+ --emoo-flow-color: color-mix(in srgb, var(--emoo-color-primary) 22%, transparent);
55
+ --emoo-motion-flow: 1.8s;
56
+ --emoo-radius-xs: 4px;
57
+ --emoo-radius-sm: 6px;
58
+ --emoo-radius-base: 8px;
59
+ --emoo-radius-lg: 12px;
60
+ --emoo-radius-card: 16px;
61
+ --emoo-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
62
+ 'Noto Sans', 'PingFang SC', 'Microsoft YaHei', sans-serif;
63
+ --emoo-font-size-stat: 17px;
64
+ --emoo-font-size-lead: 17px;
65
+ --emoo-font-size-display: 20px;
66
+ --emoo-font-size-title: 15px;
67
+ --emoo-font-size-body: 13.5px;
68
+ --emoo-font-size-nav: 14px;
69
+ --emoo-font-size-secondary: 12.5px;
70
+ --emoo-font-size-caption: 12px;
71
+ --emoo-font-size-mini: 11.5px;
72
+ --emoo-font-size-micro: 10.5px;
73
+ --emoo-space-1: 4px;
74
+ --emoo-space-2: 8px;
75
+ --emoo-space-2-5: 10px;
76
+ --emoo-space-3: 12px;
77
+ --emoo-space-3-5: 14px;
78
+ --emoo-space-4: 16px;
79
+ --emoo-space-5: 20px;
80
+ --emoo-space-6: 24px;
81
+ --emoo-space-8: 32px;
82
+ --emoo-icon-size-12: 12px;
83
+ --emoo-icon-size-16: 16px;
84
+ --emoo-icon-size-20: 20px;
85
+ --emoo-icon-size-24: 24px;
86
+ --emoo-icon-size-32: 32px;
87
+ --emoo-motion-fast: 120ms;
88
+ --emoo-motion-base: 160ms;
89
+ --emoo-motion-slow: 240ms;
90
+ --emoo-ease: cubic-bezier(0.3, 0.1, 0.3, 1);
91
+ }
92
+
93
+ :where(:root.dark) {
94
+ --emoo-color-primary: #7429ec;
95
+ --emoo-color-primary-rgb: 116, 41, 236;
96
+ --emoo-color-primary-light-3: #5723ab;
97
+ --emoo-color-primary-light-4: #4e2196;
98
+ --emoo-color-primary-light-5: #441f80;
99
+ --emoo-color-primary-light-7: #311a55;
100
+ --emoo-color-primary-light-8: #27183f;
101
+ --emoo-color-primary-light-9: #1e162a;
102
+ --emoo-color-primary-dark-2: #9054f0;
103
+ --emoo-border-color-light: #414243;
104
+ --emoo-text-color-head: #ffffff;
105
+ --emoo-text-color-normal: rgba(255, 255, 255, 0.7);
106
+ --emoo-bg-color-block: rgba(255, 255, 255, 0.1);
107
+ --emoo-bg-color: #141414;
108
+ --emoo-border-color: var(--emoo-border-color-light);
109
+ --emoo-bg-chat-page: rgba(255, 255, 255, 0.03);
110
+ --emoo-bg-color-chat: #141414;
111
+ --emoo-bg-color-hover: rgba(255, 255, 255, 0.08);
112
+ --emoo-bg-color-user-message: rgba(255, 255, 255, 0.08);
113
+ --emoo-bg-color-card: rgba(22, 23, 28, 0.72);
114
+ --emoo-card-solid-bg: #16171c;
115
+ --emoo-card-glass-flow-a: color-mix(in srgb, var(--emoo-card-solid-bg) 72%, var(--emoo-color-primary));
116
+ --emoo-card-glass-flow-b: color-mix(in srgb, var(--emoo-card-solid-bg) 72%, var(--emoo-color-primary-dark-2));
117
+ --emoo-card-border-color: rgba(255, 255, 255, 0.08);
118
+ --emoo-card-top-line: rgba(255, 255, 255, 0.13);
119
+ --emoo-glow-color: color-mix(in srgb, var(--emoo-color-primary) 18%, transparent);
120
+ --emoo-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.45), 0 24px 64px -24px rgba(0, 0, 0, 0.65);
121
+ --emoo-hairline-color: rgba(255, 255, 255, 0.055);
122
+ --emoo-hover-bg: rgba(255, 255, 255, 0.07);
123
+ --emoo-hover-ring-color: rgba(255, 255, 255, 0.1);
124
+ --emoo-hover-lift-shadow: rgba(0, 0, 0, 0.55);
125
+ --emoo-selected-bg: color-mix(in srgb, var(--emoo-color-primary) 14%, transparent);
126
+ --emoo-track-bg: rgba(255, 255, 255, 0.08);
127
+ --emoo-ghost-bg: rgba(255, 255, 255, 0.05);
128
+ --emoo-ghost-border-color: rgba(255, 255, 255, 0.09);
129
+ --emoo-btn-solid-bg: #f4f4f6;
130
+ --emoo-btn-solid-color: #0b0b0e;
131
+ --emoo-seg-active-bg: #1b1c21;
132
+ --emoo-text-color-secondary: #a6a6b0;
133
+ --emoo-text-color-tertiary: #64646f;
134
+ --emoo-color-ok: #46d19a;
135
+ --emoo-color-ok-bg: rgba(70, 209, 154, 0.12);
136
+ --emoo-color-warn: #f0a94b;
137
+ --emoo-color-warn-bg: rgba(240, 169, 75, 0.13);
138
+ --emoo-color-danger: #f0616b;
139
+ --emoo-color-danger-rgb: 240, 97, 107;
140
+ --emoo-color-danger-bg: rgba(240, 97, 107, 0.12);
141
+ --emoo-color-sync: #58b6f0;
142
+ --emoo-color-sync-bg: rgba(88, 182, 240, 0.12);
143
+ --emoo-color-neutral-bg: rgba(166, 166, 176, 0.13);
144
+ }
package/package.json CHANGED
@@ -1,6 +1,33 @@
1
1
  {
2
2
  "name": "@emoo-ai/brand",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0-alpha.1",
4
+ "license": "MIT",
5
+ "publishConfig": {
6
+ "registry": "https://registry.npmjs.org/",
7
+ "@emoo-ai:registry": "https://registry.npmjs.org/"
8
+ },
9
+ "description": "emoo 框架无关品牌 tokens:亮暗主题、颜色、字体、间距与动效。",
10
+ "type": "module",
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "exports": {
15
+ ".": "./dist/tokens.css",
16
+ "./tokens.css": "./dist/tokens.css",
17
+ "./colors": {
18
+ "types": "./dist/colors.d.ts",
19
+ "default": "./dist/colors.js"
20
+ },
21
+ "./manifest.json": "./dist/manifest.json"
22
+ },
23
+ "sideEffects": [
24
+ "**/*.css"
25
+ ],
26
+ "scripts": {
27
+ "build": "node scripts/build.mjs",
28
+ "check": "node scripts/build.mjs --check"
29
+ },
30
+ "devDependencies": {
31
+ "sass": "1.105.1"
32
+ }
33
+ }