@zmzai/theme 0.2.7 → 0.2.9
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/package.json +1 -1
- package/src/brand/logo/favicon.png +0 -0
- package/src/components/icon/Icon.tsx +1 -0
- package/src/components/index.ts +1 -0
- package/src/components/navbar/Navbar.tsx +76 -0
- package/src/components/navbar/index.ts +1 -0
- package/src/tokens/fonts.css +28 -5
- package/src/tokens/theme.css +4 -2
package/package.json
CHANGED
|
Binary file
|
|
@@ -16,6 +16,7 @@ const paths: Record<string, { d: string; fill?: boolean }> = {
|
|
|
16
16
|
"arrow-down": { d: "M8 3.5v8M5 8.5L8 11.5 11 8.5" },
|
|
17
17
|
"arrow-right": { d: "M3 8h9.5M8.5 4.5L12 8l-3.5 3.5" },
|
|
18
18
|
"chevron-right": { d: "M6 4l4 4-4 4" },
|
|
19
|
+
"chevron-left": { d: "M10 4l-4 4 4 4" },
|
|
19
20
|
"chevron-down": { d: "M4 6l4 4 4-4" },
|
|
20
21
|
refresh: { d: "M13 8a5 5 0 1 1-1.5-3.6M13 3.5v2.8h-2.8" },
|
|
21
22
|
retry: { d: "M13 8a5 5 0 1 1-1.5-3.6M13 3.5v2.8h-2.8" },
|
package/src/components/index.ts
CHANGED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { type ReactNode } from "react";
|
|
4
|
+
import { cn } from "../../utils/cn";
|
|
5
|
+
import { Logo } from "../../brand/logo";
|
|
6
|
+
import { Wordmark } from "../../brand/wordmark";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* navItemClass — 导航项统一样式(全域导航一致)。
|
|
10
|
+
*
|
|
11
|
+
* active 时深墨 pill 高亮(bg-ink text-white),其余 hover 浮现。
|
|
12
|
+
* 链接本身由调用方渲染(Next.js 用 next/link,保持 SPA 导航),
|
|
13
|
+
* 只要都套这个 className,任何站点的导航观感就完全一致。
|
|
14
|
+
*/
|
|
15
|
+
export function navItemClass(active: boolean): string {
|
|
16
|
+
return cn(
|
|
17
|
+
"inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-sm font-medium transition-colors",
|
|
18
|
+
active
|
|
19
|
+
? "bg-ink text-white"
|
|
20
|
+
: "text-ink-2 hover:bg-surface-2 hover:text-ink"
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface NavbarProps {
|
|
25
|
+
/** Wordmark 后缀,如 "agent" / "relay"(品牌区自动 Logo + Wordmark) */
|
|
26
|
+
sublabel?: string;
|
|
27
|
+
/** 品牌区自定义(默认 Logo + Wordmark);传了则忽略 sublabel */
|
|
28
|
+
brand?: ReactNode;
|
|
29
|
+
/** 中间导航区(建议用 next/link 包 navItemClass(active)) */
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
/** 右侧操作区(用户信息 / 退出 / 入口按钮等) */
|
|
32
|
+
actions?: ReactNode;
|
|
33
|
+
/** 品牌区右侧的附属徽章(如域名 a.zmzai.cloud) */
|
|
34
|
+
badge?: ReactNode;
|
|
35
|
+
className?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Navbar — 全域统一顶栏。
|
|
40
|
+
*
|
|
41
|
+
* 左:品牌区(Logo + Wordmark);中:导航;右:操作区。
|
|
42
|
+
* 固定高度 3.5rem,paper 底色 + 模糊,底部细线。
|
|
43
|
+
* 各站(agent / relay / auth / hub)都消费这一个组件,保证导航一致。
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* <Navbar sublabel="agent" badge={<span>a.zmzai.cloud</span>} actions={<LogoutButton />}>
|
|
47
|
+
* <Link href="/fw" className={navItemClass(pathname === "/fw")}>新任务</Link>
|
|
48
|
+
* <Link href="/audit" className={navItemClass(pathname === "/audit")}>运行审计</Link>
|
|
49
|
+
* </Navbar>
|
|
50
|
+
*/
|
|
51
|
+
export function Navbar({ sublabel, brand, children, actions, badge, className }: NavbarProps) {
|
|
52
|
+
return (
|
|
53
|
+
<header
|
|
54
|
+
className={cn(
|
|
55
|
+
"sticky top-0 z-40 flex h-14 items-center justify-between gap-4 border-b border-line bg-paper/80 px-5 backdrop-blur-md",
|
|
56
|
+
className
|
|
57
|
+
)}
|
|
58
|
+
>
|
|
59
|
+
<div className="flex min-w-0 items-center gap-2.5">
|
|
60
|
+
{brand ?? (
|
|
61
|
+
<span className="inline-flex items-center gap-2">
|
|
62
|
+
<Logo size={22} />
|
|
63
|
+
<Wordmark size={16} sublabel={sublabel} />
|
|
64
|
+
</span>
|
|
65
|
+
)}
|
|
66
|
+
{badge}
|
|
67
|
+
</div>
|
|
68
|
+
{children ? (
|
|
69
|
+
<nav className="flex min-w-0 items-center gap-1 overflow-x-auto" aria-label="主导航">
|
|
70
|
+
{children}
|
|
71
|
+
</nav>
|
|
72
|
+
) : null}
|
|
73
|
+
{actions ? <div className="flex shrink-0 items-center gap-2.5">{actions}</div> : null}
|
|
74
|
+
</header>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Navbar";
|
package/src/tokens/fonts.css
CHANGED
|
@@ -1,17 +1,40 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @zmzai/theme — Font Faces(v0.2.
|
|
2
|
+
* @zmzai/theme — Font Faces(v0.2.9 修正字体)
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* MiSans(无衬线正文,现代感主字体)+ JetBrains Mono(等宽)。
|
|
5
|
+
* Noto Serif SC 保留为 serif 栈 fallback(标题/杂志元素可选)。
|
|
6
|
+
* MiSans 通过 jsDelivr gh CDN 加载 woff2;Noto Serif SC 走 @fontsource。
|
|
6
7
|
* font-display: swap 保证加载期间用 fallback,加载完无缝切换。
|
|
7
8
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
9
|
+
* ⚠️ v0.2.0~0.2.8 的坑:Noto Serif SC 在 next/font 里只声明 latin 子集,
|
|
10
|
+
* 中文没有字形 → 全局中文 fallback 到系统宋体(Songti SC),观感陈旧。
|
|
11
|
+
* 0.2.9 起 --font-sans/--font-serif 默认指 MiSans(无衬线,中文齐全)。
|
|
10
12
|
*
|
|
11
13
|
* Import in your app's globals.css:
|
|
12
14
|
* @import "@zmzai/theme/fonts";
|
|
13
15
|
*/
|
|
14
16
|
|
|
17
|
+
@font-face {
|
|
18
|
+
font-family: 'MiSans';
|
|
19
|
+
src: url('https://cdn.jsdelivr.net/gh/dsrkafuu/misans@main/raw/Normal/woff2/MiSans-Regular.woff2') format('woff2');
|
|
20
|
+
font-weight: 400; font-style: normal; font-display: swap;
|
|
21
|
+
}
|
|
22
|
+
@font-face {
|
|
23
|
+
font-family: 'MiSans';
|
|
24
|
+
src: url('https://cdn.jsdelivr.net/gh/dsrkafuu/misans@main/raw/Normal/woff2/MiSans-Medium.woff2') format('woff2');
|
|
25
|
+
font-weight: 500; font-style: normal; font-display: swap;
|
|
26
|
+
}
|
|
27
|
+
@font-face {
|
|
28
|
+
font-family: 'MiSans';
|
|
29
|
+
src: url('https://cdn.jsdelivr.net/gh/dsrkafuu/misans@main/raw/Normal/woff2/MiSans-Semibold.woff2') format('woff2');
|
|
30
|
+
font-weight: 600; font-style: normal; font-display: swap;
|
|
31
|
+
}
|
|
32
|
+
@font-face {
|
|
33
|
+
font-family: 'MiSans';
|
|
34
|
+
src: url('https://cdn.jsdelivr.net/gh/dsrkafuu/misans@main/raw/Normal/woff2/MiSans-Bold.woff2') format('woff2');
|
|
35
|
+
font-weight: 700; font-style: normal; font-display: swap;
|
|
36
|
+
}
|
|
37
|
+
|
|
15
38
|
@font-face {
|
|
16
39
|
font-family: 'Noto Serif SC';
|
|
17
40
|
src: url('https://cdn.jsdelivr.net/npm/@fontsource/noto-serif-sc/files/noto-serif-sc-chinese-simplified-400-normal.woff2') format('woff2');
|
package/src/tokens/theme.css
CHANGED
|
@@ -36,8 +36,10 @@
|
|
|
36
36
|
--color-dark-line: #27272A;
|
|
37
37
|
|
|
38
38
|
/* ===== Fonts =====
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
无衬线主字体(MiSans,中文现代感)+ Noto Serif SC 标题衬线 + JetBrains Mono 等宽。
|
|
40
|
+
v0.2.0~0.2.8 曾以 Noto Serif SC 为 sans,但 next/font 只加载 latin 子集、
|
|
41
|
+
中文 fallback 系统宋体观感陈旧——0.2.9 改回 MiSans。 */
|
|
42
|
+
--font-sans: "MiSans", "Noto Serif SC", "Source Han Serif SC", "PingFang SC", "Microsoft YaHei", sans-serif;
|
|
41
43
|
--font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
|
|
42
44
|
--font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;
|
|
43
45
|
|