@emoo-ai/brand 0.1.8 → 0.1.10

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/README.md CHANGED
@@ -1,11 +1,12 @@
1
1
  # @emoo-ai/brand
2
2
 
3
- 框架无关的 emoo 品牌唯一真源:预编译 tokens CSS 与纯函数颜色运行时,零运行时依赖。
3
+ 框架无关的 emoo 品牌唯一真源:预编译 tokens CSS、纯函数颜色运行时与名词图标字形,零运行时依赖。
4
4
 
5
5
  ## 入口
6
6
 
7
7
  - `@emoo-ai/brand` / `@emoo-ai/brand/tokens.css`:预编译纯 CSS,只有 `:where(:root)` / `:where(:root.dark)` token 声明。
8
8
  - `@emoo-ai/brand/colors`:混色、RGB、主色 20 项变量派生与头像 tint 的纯函数运行时(附类型声明)。
9
+ - `@emoo-ai/brand/file-icons`:名词图标家族(文件 / 文件夹 / emoo 对象,18 枚)的 SVG 字形真源 `FILE_ICON_GLYPHS` 与按文件名判定 `fileIconType(fileName)` / 取字形 `fileIconGlyph(type)`;色板 token `--emoo-file-*` / `--emoo-{doc|table|meeting|folder|folder-open}` 在 tokens.css 亮暗各一套。`ui-vue` 的 `EmooFileTypeIcon` 与 `ui-react` 的 `FileTypeIcon` 都只是它的 `<svg>` 薄壳。
9
10
  - `@emoo-ai/brand/manifest.json`:精确版本与源码/制品 SHA-256,用于核对产物一致性。
10
11
 
11
12
  没有 Vue/React/Element Plus 的运行依赖或 peer;安装 CSS 产物不需要 Sass。
@@ -0,0 +1,5 @@
1
+ export type FileIconType = 'pdf' | 'word' | 'excel' | 'csv' | 'ppt' | 'text' | 'markdown' | 'zip' | 'video' | 'audio' | 'image' | 'code' | 'unknown' | 'folder' | 'folder-open' | 'doc' | 'table' | 'meeting';
2
+ export declare const FILE_ICON_TYPES: ["pdf", "word", "excel", "csv", "ppt", "text", "markdown", "zip", "video", "audio", "image", "code", "unknown", "folder", "folder-open", "doc", "table", "meeting"];
3
+ export declare const FILE_ICON_GLYPHS: Readonly<Record<FileIconType, string>>;
4
+ export declare function fileIconType(fileName: string | null | undefined): FileIconType;
5
+ export declare function fileIconGlyph(type: string): string;
@@ -0,0 +1,50 @@
1
+ export const FILE_ICON_TYPES = [
2
+ 'pdf', 'word', 'excel', 'csv', 'ppt', 'text', 'markdown', 'zip', 'video', 'audio', 'image', 'code', 'unknown',
3
+ 'folder', 'folder-open', 'doc', 'table', 'meeting',
4
+ ];
5
+ export const FILE_ICON_GLYPHS = {
6
+ pdf: "<path fill=\"var(--emoo-file-pdf, #f1504a)\" d=\"M7 4h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3Z\"/><g fill=\"#fff\"><rect x=\"8\" y=\"7.8\" width=\"3\" height=\"3\" rx=\".6\"/><rect x=\"11.8\" y=\"8.1\" width=\"3.8\" height=\"1.1\" rx=\".55\" opacity=\".92\"/><rect x=\"11.8\" y=\"10\" width=\"3.8\" height=\"1.1\" rx=\".55\" opacity=\".92\"/><rect x=\"8\" y=\"12.4\" width=\"7.6\" height=\"1.2\" rx=\".6\" opacity=\".92\"/><rect x=\"8\" y=\"14.7\" width=\"7.6\" height=\"1.2\" rx=\".6\" opacity=\".92\"/><rect x=\"8\" y=\"17\" width=\"5\" height=\"1.2\" rx=\".6\" opacity=\".92\"/></g>",
7
+ word: "<path fill=\"var(--emoo-file-word, #3b82f6)\" d=\"M7 4h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3Z\"/><path d=\"M8 8.2 L9.9 16 L12 10.8 L14.1 16 L16 8.2\" fill=\"none\" stroke=\"#fff\" stroke-width=\"1.9\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>",
8
+ excel: "<path fill=\"var(--emoo-file-excel, #10b981)\" d=\"M7 4h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3Z\"/><g fill=\"none\" stroke=\"#fff\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"8\" y=\"8\" width=\"8\" height=\"8\" rx=\"1.2\"/><path d=\"M12 8v8M8 12h8\"/></g>",
9
+ csv: "<path fill=\"var(--emoo-file-csv, #14b8a6)\" d=\"M7 4h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3Z\"/><g fill=\"#fff\"><rect x=\"8\" y=\"8\" width=\"3.2\" height=\"1.5\" rx=\".6\"/><rect x=\"12\" y=\"8\" width=\"4\" height=\"1.5\" rx=\".6\"/><rect x=\"8\" y=\"11.2\" width=\"3.2\" height=\"1.5\" rx=\".6\"/><rect x=\"12\" y=\"11.2\" width=\"4\" height=\"1.5\" rx=\".6\"/><rect x=\"8\" y=\"14.4\" width=\"3.2\" height=\"1.5\" rx=\".6\"/><rect x=\"12\" y=\"14.4\" width=\"4\" height=\"1.5\" rx=\".6\"/></g>",
10
+ ppt: "<path fill=\"var(--emoo-file-ppt, #f97316)\" d=\"M7 4h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3Z\"/><rect x=\"7.5\" y=\"8\" width=\"9\" height=\"7\" rx=\"1.2\" fill=\"none\" stroke=\"#fff\" stroke-width=\"1.5\"/><path d=\"M10.8 10.2 L13.4 11.5 L10.8 12.8 Z\" fill=\"#fff\"/>",
11
+ text: "<path fill=\"var(--emoo-file-text, #8892a0)\" d=\"M7 4h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3Z\"/><g fill=\"#fff\"><rect x=\"8\" y=\"8\" width=\"8\" height=\"1.3\" rx=\".65\"/><rect x=\"8\" y=\"10.8\" width=\"8\" height=\"1.3\" rx=\".65\"/><rect x=\"8\" y=\"13.6\" width=\"8\" height=\"1.3\" rx=\".65\"/><rect x=\"8\" y=\"16.4\" width=\"5.5\" height=\"1.3\" rx=\".65\"/></g>",
12
+ markdown: "<path fill=\"var(--emoo-file-markdown, #6366f1)\" d=\"M7 4h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3Z\"/><g fill=\"none\" stroke=\"#fff\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M7.5 15 V9 L9.8 12 L12 9 V15\"/><path d=\"M14.6 9v5M12.9 12.2l1.7 1.8 1.7-1.8\"/></g>",
13
+ zip: "<path fill=\"var(--emoo-file-zip, #eab308)\" d=\"M7 4h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3Z\"/><rect x=\"10.9\" y=\"6.8\" width=\"2.2\" height=\"2.8\" rx=\"1\" fill=\"#fff\"/><g fill=\"#fff\" opacity=\".92\"><rect x=\"9.7\" y=\"10.4\" width=\"1.5\" height=\"1.5\" rx=\".4\"/><rect x=\"12.8\" y=\"10.4\" width=\"1.5\" height=\"1.5\" rx=\".4\"/><rect x=\"9.7\" y=\"12.7\" width=\"1.5\" height=\"1.5\" rx=\".4\"/><rect x=\"12.8\" y=\"12.7\" width=\"1.5\" height=\"1.5\" rx=\".4\"/><rect x=\"9.7\" y=\"15\" width=\"1.5\" height=\"1.5\" rx=\".4\"/><rect x=\"12.8\" y=\"15\" width=\"1.5\" height=\"1.5\" rx=\".4\"/></g>",
14
+ video: "<path fill=\"var(--emoo-file-video, #ec4899)\" d=\"M7 4h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3Z\"/><path d=\"M10 8.2 L15.5 12 L10 15.8 Z\" fill=\"#fff\" stroke=\"#fff\" stroke-width=\"1.2\" stroke-linejoin=\"round\"/>",
15
+ audio: "<path fill=\"var(--emoo-file-audio, #06b6d4)\" d=\"M7 4h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3Z\"/><g stroke=\"#fff\" stroke-width=\"1.7\" stroke-linecap=\"round\"><path d=\"M8.5 10.5v3\"/><path d=\"M11 8.5v7\"/><path d=\"M13.5 10v4\"/><path d=\"M16 11v2\"/></g>",
16
+ image: "<path fill=\"var(--emoo-file-image, #22c55e)\" d=\"M7 4h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3Z\"/><circle cx=\"14.3\" cy=\"9.3\" r=\"1.3\" fill=\"#fff\"/><path d=\"M8 15.8 L11 11.5 L13 14 L14.5 12 L16.5 15.8 Z\" fill=\"#fff\"/>",
17
+ code: "<path fill=\"var(--emoo-file-code, #64748b)\" d=\"M7 4h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3Z\"/><g fill=\"none\" stroke=\"#fff\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M9.5 9 L7 12 L9.5 15\"/><path d=\"M14.5 9 L17 12 L14.5 15\"/><path d=\"M12.8 8.2 L11.2 15.8\"/></g>",
18
+ unknown: "<path fill=\"var(--emoo-file-unknown, #94a3b8)\" d=\"M7 4h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3Z\"/><g fill=\"#fff\"><circle cx=\"8.5\" cy=\"12\" r=\"1.3\"/><circle cx=\"12\" cy=\"12\" r=\"1.3\"/><circle cx=\"15.5\" cy=\"12\" r=\"1.3\"/></g>",
19
+ folder: "<path fill=\"var(--emoo-folder, #94a3b8)\" d=\"M3 8a3 3 0 0 1 3-3h3a2 2 0 0 1 1.5.7L11.6 7H18a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3Z\"/><path fill=\"#ffffff\" fill-opacity=\".32\" d=\"M3 10h18v6a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3Z\"/>",
20
+ 'folder-open': "<path fill=\"var(--emoo-folder-open, #94a3b8)\" d=\"M3 8a3 3 0 0 1 3-3h3a2 2 0 0 1 1.5.7L11.6 7H18a3 3 0 0 1 3 3v2H3Z\"/><path fill=\"#000000\" fill-opacity=\".22\" d=\"M3 12l18-2v3L3 15Z\"/><path fill=\"var(--emoo-folder-open, #94a3b8)\" d=\"M3 15l18-2v4a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3Z\"/><path fill=\"#ffffff\" fill-opacity=\".32\" d=\"M3 15l18-2v4a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3Z\"/>",
21
+ doc: "<path fill=\"var(--emoo-doc, #8b5cf6)\" d=\"M7 4h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3Z\"/><g fill=\"#fff\"><rect x=\"8\" y=\"8\" width=\"4\" height=\"1.5\" rx=\".75\"/><rect x=\"8\" y=\"11\" width=\"8\" height=\"1.3\" rx=\".65\" opacity=\".9\"/><rect x=\"8\" y=\"13.6\" width=\"8\" height=\"1.3\" rx=\".65\" opacity=\".9\"/><rect x=\"8\" y=\"16.2\" width=\"5\" height=\"1.3\" rx=\".65\" opacity=\".9\"/></g>",
22
+ table: "<path fill=\"var(--emoo-table, #0ea5e9)\" d=\"M7 4h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3Z\"/><g fill=\"none\" stroke=\"#fff\" stroke-width=\"1.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"8\" y=\"8\" width=\"8\" height=\"8\" rx=\"1.2\"/><path d=\"M8 10.8h8M8 13.4h8M12 10.8V16\"/></g>",
23
+ meeting: "<path fill=\"var(--emoo-meeting, #a855f7)\" d=\"M7 4h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3Z\"/><path d=\"M8 8.2 h7.4 a1.6 1.6 0 0 1 1.6 1.6 v2.8 a1.6 1.6 0 0 1-1.6 1.6 h-3.6 L9.4 16 v-1.8 H8 a1.6 1.6 0 0 1-1.6-1.6 V9.8 A1.6 1.6 0 0 1 8 8.2 Z\" fill=\"#fff\"/><g fill=\"var(--emoo-meeting, #a855f7)\"><rect x=\"8.8\" y=\"10\" width=\"5.4\" height=\".95\" rx=\".45\"/><rect x=\"8.8\" y=\"11.7\" width=\"3.6\" height=\".95\" rx=\".45\"/></g>",
24
+ };
25
+ const EXT_TYPE = {
26
+ pdf: 'pdf',
27
+ doc: 'word', docx: 'word',
28
+ xls: 'excel', xlsx: 'excel',
29
+ csv: 'csv',
30
+ ppt: 'ppt', pptx: 'ppt',
31
+ txt: 'text', log: 'text', conf: 'text', ini: 'text', env: 'text', properties: 'text', toml: 'text',
32
+ md: 'markdown', markdown: 'markdown',
33
+ zip: 'zip', rar: 'zip', '7z': 'zip', tar: 'zip', gz: 'zip', bz2: 'zip', xz: 'zip',
34
+ mp4: 'video', webm: 'video', mov: 'video', m4v: 'video', mkv: 'video', avi: 'video',
35
+ mp3: 'audio', wav: 'audio', ogg: 'audio', m4a: 'audio', aac: 'audio', flac: 'audio',
36
+ jpg: 'image', jpeg: 'image', png: 'image', webp: 'image', gif: 'image', bmp: 'image', svg: 'image', avif: 'image', ico: 'image',
37
+ js: 'code', jsx: 'code', ts: 'code', tsx: 'code', vue: 'code', py: 'code', java: 'code', go: 'code', rs: 'code',
38
+ c: 'code', cpp: 'code', h: 'code', css: 'code', scss: 'code', sh: 'code', bash: 'code', sql: 'code',
39
+ html: 'code', htm: 'code', xml: 'code', json: 'code', yml: 'code', yaml: 'code',
40
+ };
41
+ const has = (record, key) => Object.prototype.hasOwnProperty.call(record, key);
42
+ export function fileIconType(fileName) {
43
+ const name = (fileName ?? '').trim();
44
+ const dot = name.lastIndexOf('.');
45
+ const ext = dot < 0 ? '' : name.slice(dot + 1).toLowerCase();
46
+ return has(EXT_TYPE, ext) ? EXT_TYPE[ext] : 'unknown';
47
+ }
48
+ export function fileIconGlyph(type) {
49
+ return has(FILE_ICON_GLYPHS, type) ? FILE_ICON_GLYPHS[type] : FILE_ICON_GLYPHS.unknown;
50
+ }
@@ -1,19 +1,25 @@
1
1
  {
2
2
  "schemaVersion": 3,
3
3
  "package": "@emoo-ai/brand",
4
- "version": "0.1.8",
4
+ "version": "0.1.10",
5
5
  "source": {
6
- "sha256": "dc274fd39c9cbf7dcf6c9957bc621b4299966241ea2324b7ccc4ae013063a1b8"
6
+ "sha256": "23e08e8c59136293f31ed51a3946c967254372ad023232bb52532ab552235046"
7
7
  },
8
8
  "files": {
9
9
  "tokens.css": {
10
- "sha256": "ef6200b95591f88a7eb0ff68c88924ae71ee4704b2423c13de2af74e57c76e1c"
10
+ "sha256": "d0c02e3d79e9b8606532987a2e6834a8be97fd86ee1e3bba4bf4f3e4e40e9279"
11
11
  },
12
12
  "colors.js": {
13
13
  "sha256": "a2d8ce386855074667695cced5e1d97ab2e4f4b9afc467b23e60d39b517bade4"
14
14
  },
15
15
  "colors.d.ts": {
16
16
  "sha256": "6591f2d23bcb488bb7f545b15e401a71f031086351f91b411bb645c332487a94"
17
+ },
18
+ "file-icons.js": {
19
+ "sha256": "e2e9f3e9b4e469a5c21ea128814eb09e4dda4ef5184a1b36b9c2ce4cda1ec95e"
20
+ },
21
+ "file-icons.d.ts": {
22
+ "sha256": "1f4bea7d8ddafc09132e35b815d51588763f1e1b1143b4f57bd1c012546b842f"
17
23
  }
18
24
  }
19
25
  }
package/dist/tokens.css CHANGED
@@ -85,6 +85,24 @@
85
85
  --emoo-icon-size-20: 20px;
86
86
  --emoo-icon-size-24: 24px;
87
87
  --emoo-icon-size-32: 32px;
88
+ --emoo-file-pdf: #f1504a;
89
+ --emoo-file-word: #3b82f6;
90
+ --emoo-file-excel: #10b981;
91
+ --emoo-file-csv: #14b8a6;
92
+ --emoo-file-ppt: #f97316;
93
+ --emoo-file-text: #8892a0;
94
+ --emoo-file-markdown: #6366f1;
95
+ --emoo-file-zip: #eab308;
96
+ --emoo-file-video: #ec4899;
97
+ --emoo-file-audio: #06b6d4;
98
+ --emoo-file-image: #22c55e;
99
+ --emoo-file-code: #64748b;
100
+ --emoo-file-unknown: #94a3b8;
101
+ --emoo-folder: #94a3b8;
102
+ --emoo-folder-open: #94a3b8;
103
+ --emoo-doc: #8b5cf6;
104
+ --emoo-table: #0ea5e9;
105
+ --emoo-meeting: #a855f7;
88
106
  --emoo-motion-fast: 120ms;
89
107
  --emoo-motion-base: 160ms;
90
108
  --emoo-motion-slow: 240ms;
@@ -143,4 +161,22 @@
143
161
  --emoo-color-sync: #58b6f0;
144
162
  --emoo-color-sync-bg: rgba(88, 182, 240, 0.12);
145
163
  --emoo-color-neutral-bg: rgba(166, 166, 176, 0.13);
164
+ --emoo-file-pdf: #f5706a;
165
+ --emoo-file-word: #6aa5f5;
166
+ --emoo-file-excel: #34d399;
167
+ --emoo-file-csv: #2dd4bf;
168
+ --emoo-file-ppt: #fb923c;
169
+ --emoo-file-text: #9aa4b3;
170
+ --emoo-file-markdown: #8b90f5;
171
+ --emoo-file-zip: #f0c63c;
172
+ --emoo-file-video: #f472b6;
173
+ --emoo-file-audio: #22d3ee;
174
+ --emoo-file-image: #4ade80;
175
+ --emoo-file-code: #8593b0;
176
+ --emoo-file-unknown: #a5aebd;
177
+ --emoo-folder: #a5aebd;
178
+ --emoo-folder-open: #a5aebd;
179
+ --emoo-doc: #a380f7;
180
+ --emoo-table: #38bdf8;
181
+ --emoo-meeting: #c084fc;
146
182
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emoo-ai/brand",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",
@@ -18,6 +18,10 @@
18
18
  "types": "./dist/colors.d.ts",
19
19
  "default": "./dist/colors.js"
20
20
  },
21
+ "./file-icons": {
22
+ "types": "./dist/file-icons.d.ts",
23
+ "default": "./dist/file-icons.js"
24
+ },
21
25
  "./manifest.json": "./dist/manifest.json"
22
26
  },
23
27
  "sideEffects": [