@@ -146,7 +145,7 @@ export function Rules({go}: PageProps) {
r.note
]}
/>
-
+
fallback : {config.fallback.target}
{t('rule.editFallback', {source: config.fallback.source})}
@@ -166,17 +165,6 @@ export function Rules({go}: PageProps) {
[t('ui.generation'), config.generation_id]
]}
/>
-
-
- go('config', 'src=' + cur.source.split(':')[0] + '&line=' + cur.source.split(':')[1])}
- isDisabled={!cur.editable}
- secondary
- >
- {t('ui.openSource')}
-
-
-
>
) : (
{t('rule.pick')}
diff --git a/src/features/settings/Settings.tsx b/src/features/settings/Settings.tsx
index 0c83ee51..4e0e8f8f 100644
--- a/src/features/settings/Settings.tsx
+++ b/src/features/settings/Settings.tsx
@@ -1,10 +1,9 @@
import {createContext, useContext, useEffect, useRef, useState} from 'react';
-import {Button as RButton, Input, Label, Text, TextField} from 'react-aria-components';
import {LANGS, useT, type Lang, type Params} from '../../i18n';
import type {Key} from '../../i18n/messages';
import {ApiError, createApi} from '../../api/client';
-import {Button, Kv, LabeledSelect, MenuButton, Segmented} from '../../ui/ui';
-import {normalizeApi, readSettings, writeSettings, type BackendKind, type PaletteId, type Scheme, type Wordmark} from './settings';
+import {Button, Kv, LabeledSelect, MenuButton, TextField} from '../../ui/ui';
+import {normalizeApi, readSettings, writeSettings, type PaletteId, type Scheme, type Wordmark} from './settings';
type Appearance = {
scheme: Scheme;
@@ -30,7 +29,6 @@ export function Settings() {
const [saved] = useState(readSettings);
const [api, setApi] = useState(saved.api ?? '');
const [token, setToken] = useState(saved.token);
- const [backend, setBackend] = useState(saved.backend);
const [showToken, setShowToken] = useState(false);
const [invalid, setInvalid] = useState(false);
const [result, setResult] = useState
(null);
@@ -60,7 +58,7 @@ export function Settings() {
const base = validate(api);
if (base === null) return;
try {
- writeSettings({api: base, token, backend});
+ writeSettings({api: base, token});
} catch {
setResult({key: 'settings.saveError', error: true});
return;
@@ -81,23 +79,11 @@ export function Settings() {
const timer = setTimeout(() => controller.abort(new DOMException('Connection timeout', 'TimeoutError')), 5000);
setPending(true);
try {
- if (backend === 'native') {
- const discovery = await createApi(base, token).discovery(controller.signal);
- if (!discovery || !Number.isInteger(discovery.api_major) || discovery.api_major < 1) {
- throw new ApiError(200, 'invalid_discovery', 'Missing API version');
- }
- if (request.current === controller) setResult({key: 'settings.reachable', params: {version: discovery.api_major}});
- } else {
- const headers: Record = {Accept: 'application/json'};
- if (token) headers.Authorization = 'Bearer ' + token;
- const response = await fetch(base + '/version', {headers, signal: controller.signal, cache: 'no-store'});
- if (!response.ok) throw new ApiError(response.status, 'http_error', 'Clash request failed');
- const data: unknown = await response.json();
- if (!data || typeof data !== 'object' || !('version' in data) || typeof data.version !== 'string' || !data.version.trim()) {
- throw new ApiError(200, 'invalid_discovery', 'Missing Clash version');
- }
- if (request.current === controller) setResult({key: 'settings.clashReachable', params: {version: data.version}});
+ const discovery = await createApi(base, token).discovery(controller.signal);
+ if (!discovery || !Number.isInteger(discovery.api_major) || discovery.api_major < 1) {
+ throw new ApiError(200, 'invalid_discovery', 'Missing API version');
}
+ if (request.current === controller) setResult({key: 'settings.reachable', params: {version: discovery.api_major}});
} catch (error) {
if (request.current !== controller) return;
let failure: Result;
@@ -136,26 +122,12 @@ export function Settings() {
save();
}}
>
-
-
{t('settings.kind')}
-
-
- {
- setBackend(value as BackendKind);
- resetProbe();
- }}
- />
-
-
- {t('settings.api')}
-
-
-
-
- {t('settings.apiHelp')}
-
- {invalid && (
-
- {t('settings.invalidUrl')}
-
- )}
-
+ />
setShowToken(value => !value)}>{t(showToken ? 'settings.hideToken' : 'settings.showToken')}}
name="token"
type={showToken ? 'text' : 'password'}
value={token}
@@ -188,22 +150,14 @@ export function Settings() {
setToken(value);
resetProbe();
}}
- >
- {t('settings.token')}
-
-
-
-
- setShowToken(value => !value)}>{t(showToken ? 'settings.hideToken' : 'settings.showToken')}
-
-
+ />
void testConnection()} isDisabled={pending}>
{t('settings.test')}
-
+
{t('settings.save')}
-
+
{t('settings.saveHelp')}
{pending && {t('settings.testing')}
}
diff --git a/src/features/settings/messages.ts b/src/features/settings/messages.ts
index e6c40291..6c9ee44f 100644
--- a/src/features/settings/messages.ts
+++ b/src/features/settings/messages.ts
@@ -4,9 +4,6 @@ export const messages = defineMessages({
'zh-TW': {
'nav.settings': '設定',
'settings.backend': '後端',
- 'settings.kind': '後端種類',
- 'settings.native': '原生',
- 'settings.clash': 'Clash 相容',
'settings.api': '伺服器網址',
'settings.apiHelp': '填寫伺服器根網址或反向代理前綴,不是 /api/v1;留空或填入 mock 可使用內建示範資料。',
'settings.invalidUrl': '請輸入 http(s)://主機[:連接埠][/前綴] 或 mock。網址不可含帳密、查詢參數或片段。',
@@ -21,12 +18,11 @@ export const messages = defineMessages({
'settings.firstRun': '尚未設定後端;現在顯示的是內建示範資料',
'settings.demo': '目前使用內建示範資料,未連線至外部後端。',
'settings.reachable': '連線成功,API v{version}',
- 'settings.clashReachable': '連線成功,Clash {version}',
'settings.network': '網路連線失敗:請確認後端網址與服務狀態。',
'settings.cors': '網路或跨網域請求失敗:請確認後端可連線並允許此來源。',
'settings.unauthorized': '需要 token:請填寫有效的 token 後重試。',
'settings.nonJson': '後端未回傳有效的 JSON:請確認伺服器根網址或反向代理前綴。',
- 'settings.invalidResponse': '回應缺少版本資訊:請確認後端種類與伺服器網址。',
+ 'settings.invalidResponse': '回應缺少 API 版本資訊:請確認伺服器網址。',
'settings.httpError': '後端回傳 HTTP {status}:請檢查授權與後端設定。',
'settings.timeout': '連線測試逾時(5 秒):請確認後端網址與網路。',
'settings.appearance': '外觀',
@@ -38,9 +34,6 @@ export const messages = defineMessages({
'zh-CN': {
'nav.settings': '设置',
'settings.backend': '后端',
- 'settings.kind': '后端类型',
- 'settings.native': '原生',
- 'settings.clash': 'Clash 兼容',
'settings.api': '服务器地址',
'settings.apiHelp': '填写服务器根地址或反向代理前缀,不是 /api/v1;留空或填写 mock 可使用内置演示数据。',
'settings.invalidUrl': '请输入 http(s)://主机[:端口][/前缀] 或 mock。地址不能包含账号密码、查询参数或片段。',
@@ -55,12 +48,11 @@ export const messages = defineMessages({
'settings.firstRun': '尚未设置后端;当前显示的是内置演示数据',
'settings.demo': '当前使用内置演示数据,未连接外部后端。',
'settings.reachable': '连接成功,API v{version}',
- 'settings.clashReachable': '连接成功,Clash {version}',
'settings.network': '网络连接失败:请检查后端地址与服务状态。',
'settings.cors': '网络或跨域请求失败:请确认后端可连接并允许此来源。',
'settings.unauthorized': '需要 token:请填写有效的 token 后重试。',
'settings.nonJson': '后端未返回有效的 JSON:请检查服务器根地址或反向代理前缀。',
- 'settings.invalidResponse': '响应缺少版本信息:请检查后端类型与服务器地址。',
+ 'settings.invalidResponse': '响应缺少 API 版本信息:请检查服务器地址。',
'settings.httpError': '后端返回 HTTP {status}:请检查授权与后端设置。',
'settings.timeout': '连接测试超时(5 秒):请检查后端地址与网络。',
'settings.appearance': '外观',
@@ -72,9 +64,6 @@ export const messages = defineMessages({
en: {
'nav.settings': 'Settings',
'settings.backend': 'Backend',
- 'settings.kind': 'Backend kind',
- 'settings.native': 'Native',
- 'settings.clash': 'Clash compatible',
'settings.api': 'Server URL',
'settings.apiHelp': 'Server root or reverse-proxy prefix, not /api/v1. Leave empty or enter mock for built-in demo data.',
'settings.invalidUrl': 'Enter http(s)://host[:port][/prefix] without credentials, a query, or a fragment, or enter mock.',
@@ -89,12 +78,11 @@ export const messages = defineMessages({
'settings.firstRun': 'No backend configured; showing built-in demo data',
'settings.demo': 'Using built-in demo data; no external backend was contacted.',
'settings.reachable': 'Connected, API v{version}',
- 'settings.clashReachable': 'Connected, Clash {version}',
'settings.network': 'Network connection failed. Check the backend URL and service.',
'settings.cors': 'Network or CORS request failed. Check that the backend is reachable and allows this origin.',
'settings.unauthorized': 'Token required. Enter a valid token and retry.',
'settings.nonJson': 'The backend did not return valid JSON. Check the server root or reverse-proxy prefix.',
- 'settings.invalidResponse': 'The response has no version information. Check the backend kind and server URL.',
+ 'settings.invalidResponse': 'The response has no API version information. Check the server URL.',
'settings.httpError': 'The backend returned HTTP {status}. Check authorization and backend settings.',
'settings.timeout': 'Connection test timed out after 5 seconds. Check the backend URL and network.',
'settings.appearance': 'Appearance',
diff --git a/src/features/settings/settings.test.ts b/src/features/settings/settings.test.ts
index 244d8ad2..677ccef2 100644
--- a/src/features/settings/settings.test.ts
+++ b/src/features/settings/settings.test.ts
@@ -34,30 +34,27 @@ it('preserves preferences across backend writes and validates before changing st
const values = new Map();
const storage = {getItem: (key: string) => values.get(key) ?? null, setItem: (key: string, value: string) => values.set(key, value)};
writeSettings({lang: 'en', scheme: 'dark', palette: 'nord/nord', wordmark: 'plain'}, storage);
- writeSettings({api: ' https://honk.example/proxy/ ', token: 'secret', backend: 'clash'}, storage);
+ writeSettings({api: ' https://honk.example/proxy/ ', token: 'secret'}, storage);
expect(readSettings(storage)).toEqual({
api: 'https://honk.example/proxy',
token: 'secret',
- backend: 'clash',
lang: 'en',
scheme: 'dark',
palette: 'nord/nord',
wordmark: 'plain'
});
const before = new Map(values);
- expect(() => writeSettings({token: 'replacement', api: '/invalid', backend: 'native'}, storage)).toThrow();
+ expect(() => writeSettings({token: 'replacement', api: '/invalid'}, storage)).toThrow();
expect(values).toEqual(before);
- writeSettings({api: 'mock', token: '', backend: 'native'}, storage);
+ writeSettings({api: 'mock', token: ''}, storage);
expect(readSettings(storage)).toEqual({
api: 'mock',
token: '',
- backend: 'native',
lang: 'en',
scheme: 'dark',
palette: 'nord/nord',
wordmark: 'plain'
});
- expect([...values.keys()].sort()).toEqual(['doona-api', 'doona-api-token', 'doona-backend', 'doona-lang', 'doona-palette', 'doona-scheme', 'doona-wordmark']);
});
it('keeps demo navigation usable when storage is unavailable', () => {
@@ -67,7 +64,6 @@ it('keeps demo navigation usable when storage is unavailable', () => {
}
});
expect(settings.api).toBeNull();
- expect(settings.backend).toBe('native');
expect(shouldOpenSettings(settings.api, '#/')).toBe(true);
});
diff --git a/src/features/settings/settings.ts b/src/features/settings/settings.ts
index 8f01d21d..be296ce4 100644
--- a/src/features/settings/settings.ts
+++ b/src/features/settings/settings.ts
@@ -1,4 +1,3 @@
-export type BackendKind = 'native' | 'clash';
export type Scheme = 'system' | 'light' | 'dark';
export type Wordmark = 'gradient' | 'plain';
export type PaletteId =
@@ -16,7 +15,6 @@ export type PaletteId =
export type Settings = {
api: string | null;
token: string;
- backend: BackendKind;
lang: 'zh-TW' | 'zh-CN' | 'en';
scheme: Scheme;
palette: PaletteId;
@@ -26,7 +24,6 @@ export type Settings = {
const keys = {
api: 'doona-api',
token: 'doona-api-token',
- backend: 'doona-backend',
lang: 'doona-lang',
scheme: 'doona-scheme',
palette: 'doona-palette',
@@ -57,7 +54,6 @@ export function readSettings(storage?: Pick): Settings {
return {
api: read(keys.api),
token: read(keys.token) ?? '',
- backend: read(keys.backend) === 'clash' ? 'clash' : 'native',
lang: lang === 'zh-CN' || lang === 'en' ? lang : 'zh-TW',
scheme: scheme === 'light' || scheme === 'dark' ? scheme : 'system',
palette: palette?.includes('/') ? (palette as PaletteId) : 'rose-pine/moon',
diff --git a/src/i18n/messages.ts b/src/i18n/messages.ts
index d632773a..6fd3d81c 100644
--- a/src/i18n/messages.ts
+++ b/src/i18n/messages.ts
@@ -10,7 +10,6 @@ import {messages as policies} from '../features/policies/messages';
import {messages as rules} from '../features/rules/messages';
import {messages as dns} from '../features/dns/messages';
import {messages as events} from '../features/events/messages';
-import {messages as clashCompat} from '../features/clash-compat/messages';
import {messages as settings} from '../features/settings/messages';
type Intersection = (U extends unknown ? (value: U) => void : never) extends (value: infer I) => void ? I : never;
@@ -19,6 +18,6 @@ function merge>[]>(...modules: T)
[L in Lang]: Intersection;
};
}
-export const modules = [shell, ui, activity, overview, connections, flows, clients, policies, rules, dns, events, clashCompat, settings] as const;
+export const modules = [shell, ui, activity, overview, connections, flows, clients, policies, rules, dns, events, settings] as const;
export const table = merge(...modules);
export type Key = keyof (typeof table)['zh-TW'];
diff --git a/src/shell/Shell.tsx b/src/shell/Shell.tsx
index 1f57cca6..4f424190 100644
--- a/src/shell/Shell.tsx
+++ b/src/shell/Shell.tsx
@@ -1,20 +1,6 @@
// Rosé Pine shell: same frame as the S2 panel (top bar, side nav, rounded main), plain CSS and react-aria-components.
import {Suspense, useEffect, useLayoutEffect, useState, type ReactNode} from 'react';
-import {
- I18nProvider,
- Button as RButton,
- Dialog,
- Modal,
- ModalOverlay,
- SearchField,
- Input,
- ListBox,
- ListBoxItem,
- ListBoxSection,
- Header,
- Link as RLink,
- Separator
-} from 'react-aria-components';
+import {I18nProvider, ListBox, ListBoxItem, ListBoxSection, Header, Link as RLink, Separator} from 'react-aria-components';
import Close from '../ui/icons/Close';
import Search from '../ui/icons/Search';
import Refresh from '../ui/icons/Refresh';
@@ -24,7 +10,7 @@ import Lighten from '../ui/icons/Lighten';
import logo from '../logo.svg';
import GitHub from '../ui/icons/GitHub';
import {LangContext, LANGS, LOCALE, readLang, useT, type Lang, type Translator} from '../i18n';
-import {Button, MenuButton, Toasts, LabeledSelect, useSlider, withCrossfade} from '../ui/ui';
+import {Button, MenuButton, ModalDialog, TextField, Toasts, LabeledSelect, useSlider, withCrossfade} from '../ui/ui';
import Color from '../ui/icons/Color';
import type {PageProps} from '../features/types';
import {useRoute} from './route';
@@ -32,7 +18,7 @@ import {refetchAll, useCapabilities, useConnections, useGroups, useNodes, useVer
import {chainLabel, connectionRows} from '../api/selectors';
import {features, navAvailable} from './registry';
import {SettingsContext} from '../features/settings/Settings';
-import {readSettings, type BackendKind, type PaletteId, type Scheme, type Wordmark} from '../features/settings/settings';
+import {readSettings, type PaletteId, type Scheme, type Wordmark} from '../features/settings/settings';
// Each entry pairs the light variant with a dark one; the description names both with their official variant names.
const palettes = (t: Translator): Array<{title: string; items: Array<{id: PaletteId; label: string; desc?: string}>}> => [
@@ -162,7 +148,7 @@ function SchemeIcon({dark}: {dark: boolean}) {
);
}
-function SearchDialog({onClose, go, backend}: {onClose: () => void; go: PageProps['go']; backend: BackendKind}) {
+function SearchDialog({onClose, go}: {onClose: () => void; go: PageProps['go']}) {
const t = useT();
const [q, setQ] = useState('');
const connections = useConnections();
@@ -178,7 +164,7 @@ function SearchDialog({onClose, go, backend}: {onClose: () => void; go: PageProp
nodes: (nodes.data ?? []).filter(n => n.name.toLowerCase().includes(needle)).slice(0, limit),
groups: (groups.data ?? []).filter(g => g.name.toLowerCase().includes(needle)).slice(0, limit),
pages: features
- .filter(feature => feature.nav && navAvailable(feature.path, capabilities.data, backend) && t(feature.nav.titleKey).toLowerCase().includes(needle))
+ .filter(feature => feature.nav && navAvailable(feature.path, capabilities.data) && t(feature.nav.titleKey).toLowerCase().includes(needle))
.slice(0, limit)
};
const error = connections.error ?? nodes.error ?? groups.error ?? capabilities.error;
@@ -189,75 +175,65 @@ function SearchDialog({onClose, go, backend}: {onClose: () => void; go: PageProp
onClose();
};
return (
- {
if (!o) onClose();
}}
- isDismissable
>
-
-
-
-
-
- {/* eslint-disable-next-line jsx-a11y/no-autofocus -- focus moves into the dialog the user just opened */}
-
-
-
-
-
-
-
- {error && {error.message}
}
- {hits.conns.length + hits.nodes.length + hits.groups.length + hits.pages.length === 0 && {t('search.none')}
}
- pick(String(k))}>
- {hits.conns.length > 0 && (
-
-
- {hits.conns.map(c => (
-
- {c.domain || c.dst || c.src || c.id}
- {chainLabel(c)}
-
- ))}
-
- )}
- {hits.nodes.length > 0 && (
-
-
- {hits.nodes.map(n => (
-
- {n.name}
-
- ))}
-
- )}
- {hits.groups.length > 0 && (
-
-
- {hits.groups.map(g => (
-
- {g.name}
-
- ))}
-
- )}
- {hits.pages.length > 0 && (
-
-
- {hits.pages.map(page => (
-
- {t(page.nav!.titleKey)}
-
- ))}
-
- )}
-
-
-
-
+
+
+
+ {/* eslint-disable-next-line jsx-a11y/no-autofocus -- focus moves into the dialog the user just opened */}
+
+ {error && {error.message}
}
+ {hits.conns.length + hits.nodes.length + hits.groups.length + hits.pages.length === 0 && {t('search.none')}
}
+ pick(String(k))}>
+ {hits.conns.length > 0 && (
+
+
+ {hits.conns.map(c => (
+
+ {c.domain || c.dst || c.src || c.id}
+ {chainLabel(c)}
+
+ ))}
+
+ )}
+ {hits.nodes.length > 0 && (
+
+
+ {hits.nodes.map(n => (
+
+ {n.name}
+
+ ))}
+
+ )}
+ {hits.groups.length > 0 && (
+
+
+ {hits.groups.map(g => (
+
+ {g.name}
+
+ ))}
+
+ )}
+ {hits.pages.length > 0 && (
+
+
+ {hits.pages.map(page => (
+
+ {t(page.nav!.titleKey)}
+
+ ))}
+
+ )}
+
+
);
}
@@ -297,18 +273,8 @@ export function Shell() {
return (
- setSearchOpen(true)}
- mac={mac}
- />
- {searchOpen && setSearchOpen(false)} go={go} backend={settings.backend} />}
+ setSearchOpen(true)} mac={mac} />
+ {searchOpen && setSearchOpen(false)} go={go} />}
@@ -333,7 +299,6 @@ function Frame({
lang,
pickLang,
ap,
- backend,
route,
query,
go,
@@ -343,7 +308,6 @@ function Frame({
lang: Lang;
pickLang: (l: Lang) => void;
ap: ReturnType;
- backend: BackendKind;
route: string;
query: string;
go: PageProps['go'];
@@ -355,7 +319,7 @@ function Frame({
const capabilities = useCapabilities();
const version = useVersion();
const nav = navGroups.map(
- group => [group, features.filter(feature => feature.nav?.group === group && navAvailable(feature.path, capabilities.data, backend))] as const
+ group => [group, features.filter(feature => feature.nav?.group === group && navAvailable(feature.path, capabilities.data))] as const
);
const [navRef, navPos] = useSlider(route, '[aria-current="page"]');
const [spinning, setSpinning] = useState(false);
@@ -370,11 +334,11 @@ function Frame({
doona
-
+
{t('search')}
{mac ? t('shell.macShortcut') : t('shell.shortcut')}
-
+
@@ -450,22 +414,21 @@ function Frame({
{t(g)}
{items.map(
- ({id, path, nav, compat}) =>
+ ({id, path, nav}) =>
nav && (
{t(nav.titleKey)}
- {compat && {t('nav.compat')} }
)
)}
))}
- window.open('https://github.com/daeuniverse/honk', '_blank')} aria-label={t('github')}>
+ window.open('https://github.com/daeuniverse/honk', '_blank')} label={t('github')}>
{version.data && !version.loading ? `${version.data.engine.name} ${version.data.engine.version}` : '—'}
-
+
@@ -478,13 +441,12 @@ function Frame({
onChange={k => go(k)}
items={nav
.flatMap(([, items]) => items)
- .flatMap(({path, nav, compat}) =>
+ .flatMap(({path, nav}) =>
nav
? [
{
id: path,
- label: t(nav.titleKey),
- icon: compat ? {t('nav.compat')} : undefined
+ label: t(nav.titleKey)
}
]
: []
@@ -494,22 +456,18 @@ function Frame({
- {feature.requires.backend && feature.requires.backend !== backend ? (
- {t('shell.backendRequired')}
- ) : (
-
-
- {t('ui.loading')}
-
-
- }
- >
-
-
- )}
+
+
+ {t('ui.loading')}
+
+
+ }
+ >
+
+
diff --git a/src/shell/messages.ts b/src/shell/messages.ts
index 40db9381..df13de74 100644
--- a/src/shell/messages.ts
+++ b/src/shell/messages.ts
@@ -6,7 +6,6 @@ export const messages = defineMessages({
'conn.rule': '規則',
'conn.recomputed': '重算',
'nav.routingTrace': '路由追蹤',
- 'nav.compat': '示範',
'lifecycle.starting': '啟動中',
'lifecycle.running': '運行中',
'lifecycle.reloading': '重載中',
@@ -20,9 +19,6 @@ export const messages = defineMessages({
'nav.clients': '客戶端',
'nav.policies': '策略',
'nav.dns': 'DNS',
- 'nav.resources': '資源',
- 'nav.config': '配置',
- 'nav.validate': '校驗',
'nav.events': '事件',
'nav.flows': '流程',
'grp.status': '狀態',
@@ -46,7 +42,6 @@ export const messages = defineMessages({
'search.none': '沒有符合的項目',
'search.groups': '群組',
'search.pages': '頁面',
- 'shell.backendRequired': '此示範頁面僅適用於 Clash 相容模式。',
'conn.state.observed': '觀測中',
'conn.state.routing': '路由中',
'conn.state.dialing': '撥號中',
@@ -84,7 +79,6 @@ export const messages = defineMessages({
'conn.rule': '规则',
'conn.recomputed': '重算',
'nav.routingTrace': '路由追踪',
- 'nav.compat': '演示',
'lifecycle.starting': '启动中',
'lifecycle.running': '运行中',
'lifecycle.reloading': '重载中',
@@ -98,9 +92,6 @@ export const messages = defineMessages({
'nav.clients': '客户端',
'nav.policies': '策略',
'nav.dns': 'DNS',
- 'nav.resources': '资源',
- 'nav.config': '配置',
- 'nav.validate': '校验',
'nav.events': '事件',
'nav.flows': '流程',
'grp.status': '状态',
@@ -124,7 +115,6 @@ export const messages = defineMessages({
'search.none': '没有符合的项目',
'search.groups': '组',
'search.pages': '页面',
- 'shell.backendRequired': '此演示页面仅适用于 Clash 兼容模式。',
'conn.state.observed': '观测中',
'conn.state.routing': '路由中',
'conn.state.dialing': '拨号中',
@@ -162,7 +152,6 @@ export const messages = defineMessages({
'conn.rule': 'Rule',
'conn.recomputed': 'Recomputed',
'nav.routingTrace': 'Routing trace',
- 'nav.compat': 'Demo',
'lifecycle.starting': 'Starting',
'lifecycle.running': 'Running',
'lifecycle.reloading': 'Reloading',
@@ -176,9 +165,6 @@ export const messages = defineMessages({
'nav.clients': 'Clients',
'nav.policies': 'Policies',
'nav.dns': 'DNS',
- 'nav.resources': 'Resources',
- 'nav.config': 'Config',
- 'nav.validate': 'Validate',
'nav.events': 'Events',
'nav.flows': 'Flows',
'grp.status': 'Status',
@@ -202,7 +188,6 @@ export const messages = defineMessages({
'search.none': 'No matches',
'search.groups': 'Groups',
'search.pages': 'Pages',
- 'shell.backendRequired': 'This demo page is only available in Clash-compatible mode.',
'conn.state.observed': 'Observed',
'conn.state.routing': 'Routing',
'conn.state.dialing': 'Dialing',
diff --git a/src/shell/registry.test.ts b/src/shell/registry.test.ts
index bb34ce25..b178be8f 100644
--- a/src/shell/registry.test.ts
+++ b/src/shell/registry.test.ts
@@ -13,18 +13,8 @@ it('gates explicit resource absence but accepts either DNS resource', async () =
expect(base.resources.traffic_history.available).toBe(false);
await expect(createMockApi().runtimeOutbounds()).rejects.toMatchObject({status: 404});
await expect(createMockApi().trafficHistory()).rejects.toMatchObject({status: 404});
- expect(['flows', 'rules', 'events'].map(route => navAvailable(route, base, 'native'))).toEqual([false, false, false]);
- expect(navAvailable('flows', undefined, 'native')).toBe(true);
- expect(navAvailable('flows', capabilities, 'native')).toBe(true);
- expect(navAvailable('dns', {...capabilitiesBase, resources: {...base.resources, dns_query: {...base.resources.dns_query, available: false}}}, 'native')).toBe(
- true
- );
-});
-
-it('gates backend requirements even before capabilities arrive', () => {
- for (const route of ['resources', 'config', 'validate']) {
- expect(navAvailable(route, undefined, 'native')).toBe(false);
- expect(navAvailable(route, capabilities, 'native')).toBe(false);
- expect(navAvailable(route, capabilitiesBase, 'clash')).toBe(true);
- }
+ expect(['flows', 'rules', 'events'].map(route => navAvailable(route, base))).toEqual([false, false, false]);
+ expect(navAvailable('flows', undefined)).toBe(true);
+ expect(navAvailable('flows', capabilities)).toBe(true);
+ expect(navAvailable('dns', {...capabilitiesBase, resources: {...base.resources, dns_query: {...base.resources.dns_query, available: false}}})).toBe(true);
});
diff --git a/src/shell/registry.ts b/src/shell/registry.ts
index c364c78e..eb730498 100644
--- a/src/shell/registry.ts
+++ b/src/shell/registry.ts
@@ -10,12 +10,8 @@ import DeviceAll from '../ui/icons/DeviceAll';
import Share from '../ui/icons/Share';
import ListBulleted from '../ui/icons/ListBulleted';
import GlobeGrid from '../ui/icons/GlobeGrid';
-import Data from '../ui/icons/Data';
-import FileText from '../ui/icons/FileText';
import History from '../ui/icons/History';
-import CheckmarkCircle from '../ui/icons/CheckmarkCircle';
import {Settings} from '../features/settings/Settings';
-import type {BackendKind} from '../features/settings/settings';
import SettingsIcon from '../ui/icons/Settings';
const Overview = lazy(() => import('../features/overview/Overview').then(m => ({default: m.Overview})));
@@ -26,17 +22,13 @@ const Policies = lazy(() => import('../features/policies/Policies').then(m => ({
const Rules = lazy(() => import('../features/rules/Rules').then(m => ({default: m.Rules})));
const Dns = lazy(() => import('../features/dns/Dns').then(m => ({default: m.Dns})));
const Events = lazy(() => import('../features/events/Events').then(m => ({default: m.Events})));
-const Resources = lazy(() => import('../features/clash-compat/Resources').then(m => ({default: m.Resources})));
-const ConfigPage = lazy(() => import('../features/clash-compat/ConfigPage').then(m => ({default: m.ConfigPage})));
-const Validate = lazy(() => import('../features/clash-compat/Validate').then(m => ({default: m.Validate})));
type Feature = {
id: string;
path: string;
nav: {group: Key; titleKey: Key; Icon: typeof Home} | null;
- Page: ComponentType
;
- requires: {resources?: Array; backend?: BackendKind};
- compat?: true;
+ Page: ComponentType;
+ requires: {resources?: Array};
};
export const features: Feature[] = [
@@ -60,37 +52,12 @@ export const features: Feature[] = [
requires: {resources: ['routing_trace']}
},
{id: 'dns', path: 'dns', nav: {group: 'grp.proxy', titleKey: 'nav.dns', Icon: GlobeGrid}, Page: Dns, requires: {resources: ['dns_query', 'dns_cache']}},
- {
- id: 'resources',
- path: 'resources',
- nav: {group: 'grp.system', titleKey: 'nav.resources', Icon: Data},
- Page: Resources,
- requires: {backend: 'clash'},
- compat: true
- },
- {
- id: 'config',
- path: 'config',
- nav: {group: 'grp.system', titleKey: 'nav.config', Icon: FileText},
- Page: ConfigPage,
- requires: {backend: 'clash'},
- compat: true
- },
- {
- id: 'validate',
- path: 'validate',
- nav: {group: 'grp.system', titleKey: 'nav.validate', Icon: CheckmarkCircle},
- Page: Validate,
- requires: {backend: 'clash'},
- compat: true
- },
{id: 'events', path: 'events', nav: {group: 'grp.system', titleKey: 'nav.events', Icon: History}, Page: Events, requires: {resources: ['events']}},
{id: 'settings', path: 'settings', nav: {group: 'grp.system', titleKey: 'nav.settings', Icon: SettingsIcon}, Page: Settings, requires: {}}
];
-export function navAvailable(path: string, capabilities: Capabilities | undefined, backend: BackendKind): boolean {
+export function navAvailable(path: string, capabilities: Capabilities | undefined): boolean {
const requires = features.find(feature => feature.path === path)?.requires;
- if (requires?.backend && requires.backend !== backend) return false;
const resources = requires?.resources;
return !capabilities || !resources || resources.some(key => capabilities.resources[key].available !== false);
}
diff --git a/src/ui/Charts.tsx b/src/ui/Charts.tsx
index 6451d250..afcbfc61 100644
--- a/src/ui/Charts.tsx
+++ b/src/ui/Charts.tsx
@@ -1,7 +1,6 @@
// Recharts drawn with the Rosé Pine variables (read from the document so they follow the theme switch).
import {lazy, Suspense, useId, useMemo, useSyncExternalStore} from 'react';
import type {ComponentProps} from 'react';
-import type {SankeyProps} from 'recharts';
import {formatNumber, useT, type Translator} from '../i18n';
export type Series = {label: string; color: string; values: Array};
@@ -249,34 +248,3 @@ const LazyDonut = lazy(() =>
}
}))
);
-
-const LazySankey = lazy(() =>
- import('recharts').then(({Sankey: RSankey, ResponsiveContainer, Tooltip}) => ({
- default: function Sankey({
- height = 280,
- formatTooltip,
- ...props
- }: Omit & {height?: number; formatTooltip: (label: string, count: number) => string}) {
- const p = usePalette();
- return (
-
-
-
- active && payload?.length ? {formatTooltip(String(payload[0].name ?? ''), Number(payload[0].value))}
: null
- }
- />
-
-
- );
- }
- }))
-);
-
-export function Sankey(props: ComponentProps) {
- return (
- }>
-
-
- );
-}
diff --git a/src/ui/messages.ts b/src/ui/messages.ts
index 67b7e07e..858d72ca 100644
--- a/src/ui/messages.ts
+++ b/src/ui/messages.ts
@@ -34,7 +34,6 @@ export const messages = defineMessages({
'ui.error': '錯誤',
'ui.warning': '警告',
'ui.notice': '提示',
- 'ui.position': '位置',
'ui.revision': '配置修訂',
'ui.generation': '世代 ID',
'ui.config': '配置',
@@ -42,7 +41,6 @@ export const messages = defineMessages({
'ui.elapsed': '耗時',
'ui.cache': '快取',
'ui.readonly': '唯讀',
- 'ui.openSource': '開啟來源',
'ui.rule': '規則',
'ui.valuePair': '{label}:{value}',
'ui.share': '{bytes},{percent}%',
@@ -50,9 +48,6 @@ export const messages = defineMessages({
'ui.udp': 'UDP',
'ui.latency': '{n} ms',
'ui.microseconds': '{n} μs',
- 'ui.diskRevision': '磁碟 r{n}',
- 'ui.activeRevision': '執行中 r{n}',
- 'ui.needRestart': '需重啟',
'unit.mbps': '{n} MB/s',
'unit.kbps': '{n} KB/s',
'ui.udpLatency': 'UDP {n} ms',
@@ -93,7 +88,6 @@ export const messages = defineMessages({
'ui.error': '错误',
'ui.warning': '警告',
'ui.notice': '提示',
- 'ui.position': '位置',
'ui.revision': '配置修订',
'ui.generation': '世代 ID',
'ui.config': '配置',
@@ -101,7 +95,6 @@ export const messages = defineMessages({
'ui.elapsed': '耗时',
'ui.cache': '缓存',
'ui.readonly': '只读',
- 'ui.openSource': '打开来源',
'ui.rule': '规则',
'ui.valuePair': '{label}:{value}',
'ui.share': '{bytes},{percent}%',
@@ -109,9 +102,6 @@ export const messages = defineMessages({
'ui.udp': 'UDP',
'ui.latency': '{n} ms',
'ui.microseconds': '{n} μs',
- 'ui.diskRevision': '磁盘 r{n}',
- 'ui.activeRevision': '运行中 r{n}',
- 'ui.needRestart': '需重启',
'unit.mbps': '{n} MB/s',
'unit.kbps': '{n} KB/s',
'ui.udpLatency': 'UDP {n} ms',
@@ -152,7 +142,6 @@ export const messages = defineMessages({
'ui.error': 'Error',
'ui.warning': 'Warning',
'ui.notice': 'Notice',
- 'ui.position': 'Position',
'ui.revision': 'Config revision',
'ui.generation': 'Generation ID',
'ui.config': 'Config',
@@ -160,7 +149,6 @@ export const messages = defineMessages({
'ui.elapsed': 'Elapsed',
'ui.cache': 'Cache',
'ui.readonly': 'Read-only',
- 'ui.openSource': 'Open source',
'ui.rule': 'Rule',
'ui.valuePair': '{label}: {value}',
'ui.share': '{bytes}, {percent}%',
@@ -168,9 +156,6 @@ export const messages = defineMessages({
'ui.udp': 'UDP',
'ui.latency': '{n} ms',
'ui.microseconds': '{n} μs',
- 'ui.diskRevision': 'Disk r{n}',
- 'ui.activeRevision': 'Running r{n}',
- 'ui.needRestart': 'Restart required',
'unit.mbps': '{n} MB/s',
'unit.kbps': '{n} KB/s',
'ui.udpLatency': 'UDP {n} ms',
diff --git a/src/ui/theme.css b/src/ui/theme.css
index 8c235ccd..8cdafc6f 100644
--- a/src/ui/theme.css
+++ b/src/ui/theme.css
@@ -313,11 +313,11 @@
--rp-on-accent: #ffffff;
--rp-on-text: #141414;
--rp-line: #303030;
- --rp-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
+ --rp-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 1px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px rgba(0, 0, 0, 0.02);
}
/* Arco Design (ByteDance): tokens from @arco-design/web-react's arco.css, light body and body[arco-theme=dark]. */
:root[data-family='arco'] {
- --rp-base: #f2f3f5;
+ --rp-base: #ffffff;
--rp-surface: #ffffff;
--rp-overlay: #f2f3f5;
--rp-muted: #c9cdd4;
@@ -329,12 +329,12 @@
--rp-pine: #165dff;
--rp-foam: #00b42a;
--rp-iris: #722ed1;
- --rp-c1: #165dff;
- --rp-c2: #00b42a;
- --rp-c3: #722ed1;
+ --rp-c1: #4080ff;
+ --rp-c2: #4cd263;
+ --rp-c3: #a871e3;
--rp-c4: #ff7d00;
--rp-c5: #14c9c9;
- --rp-c6: #f5319d;
+ --rp-c6: #f979b7;
--rp-c7: #f7ba1e;
--rp-c8: #9fdb1d;
--rp-hl-low: #f2f3f5;
@@ -358,25 +358,25 @@
--rp-pine: #3c7eff;
--rp-foam: #27c346;
--rp-iris: #8e51da;
- --rp-c1: #3c7eff;
- --rp-c2: #27c346;
- --rp-c3: #8e51da;
+ --rp-c1: #306fff;
+ --rp-c2: #129a37;
+ --rp-c3: #5a25b0;
--rp-c4: #ff9626;
--rp-c5: #3fd4cf;
- --rp-c6: #f756a9;
+ --rp-c6: #cb2b88;
--rp-c7: #f9cc44;
--rp-c8: #b8e24b;
--rp-hl-low: rgba(255, 255, 255, 0.08);
--rp-hl-med: #333335;
--rp-hl-high: rgba(255, 255, 255, 0.16);
- --rp-on-accent: #ffffff;
+ --rp-on-accent: rgba(255, 255, 255, 0.9);
--rp-on-text: #17171a;
--rp-line: #333335;
- --rp-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
+ --rp-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
/* Semi Design (ByteDance): @douyinfe/semi-theme-default palette step 5 and its semantic bg/text/fill/border tokens. */
:root[data-family='semi'] {
- --rp-base: #f9f9f9;
+ --rp-base: #ffffff;
--rp-surface: #ffffff;
--rp-overlay: rgba(46, 50, 56, 0.05);
--rp-muted: rgba(28, 31, 35, 0.35);
@@ -388,14 +388,14 @@
--rp-pine: #0064fa;
--rp-foam: #3bb346;
--rp-iris: #6a3ac7;
- --rp-c1: #0064fa;
- --rp-c2: #00b3a1;
- --rp-c3: #6a3ac7;
- --rp-c4: #fc8800;
- --rp-c5: #3bb346;
- --rp-c6: #e91e63;
- --rp-c7: #fac800;
- --rp-c8: #05a4b6;
+ --rp-c1: #4a9cf7;
+ --rp-c2: #33b0ab;
+ --rp-c3: #b171f9;
+ --rp-c4: #f58700;
+ --rp-c5: #83b023;
+ --rp-c6: #fe8090;
+ --rp-c7: #f3cc35;
+ --rp-c8: #30a7ce;
--rp-hl-low: rgba(28, 31, 35, 0.08);
--rp-hl-med: rgba(46, 50, 56, 0.09);
--rp-hl-high: rgba(46, 50, 56, 0.13);
@@ -417,21 +417,21 @@
--rp-pine: #54a9ff;
--rp-foam: #5dc264;
--rp-iris: #8865d4;
- --rp-c1: #54a9ff;
- --rp-c2: #33c2b0;
- --rp-c3: #8865d4;
- --rp-c4: #ffae43;
- --rp-c5: #5dc264;
- --rp-c6: #ef5686;
- --rp-c7: #fdde43;
- --rp-c8: #38bbc6;
+ --rp-c1: #107df8;
+ --rp-c2: #0bb3a7;
+ --rp-c3: #7142c5;
+ --rp-c4: #faad3f;
+ --rp-c5: #9acf0d;
+ --rp-c6: #c31e57;
+ --rp-c7: #f8ca10;
+ --rp-c8: #10a2b4;
--rp-hl-low: rgba(255, 255, 255, 0.08);
--rp-hl-med: rgba(255, 255, 255, 0.16);
--rp-hl-high: rgba(255, 255, 255, 0.2);
- --rp-on-accent: #ffffff;
+ --rp-on-accent: #e4e7f5;
--rp-on-text: #16161a;
--rp-line: rgba(255, 255, 255, 0.08);
- --rp-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.5);
+ --rp-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), 0 4px 14px rgba(0, 0, 0, 0.25);
}
/* Glass. The recipe follows what the convincing implementations share (macOS vibrancy, Windows Acrylic, the
glassmorphism generators): a THIN tint so the backdrop shows through, a LARGE blur plus saturation so it still reads,
@@ -592,7 +592,6 @@
/* The material. ::before carries the grain, ::after the gradient rim (a 1px ring cut out with a mask). */
:root[data-family='glass'] .rp-card,
:root[data-family='glass'] .rp-table,
-:root[data-family='glass'] .rp-frame,
:root[data-family='glass'] .rp-popover,
:root[data-family='glass'] .rp-dialog,
:root[data-family='glass'] .rp-toast {
@@ -606,8 +605,7 @@
:root[data-family='glass'] .rp-card::before,
:root[data-family='glass'] .rp-popover::before,
:root[data-family='glass'] .rp-dialog::before,
-:root[data-family='glass'] .rp-table::before,
-:root[data-family='glass'] .rp-frame::before {
+:root[data-family='glass'] .rp-table::before {
content: '';
position: absolute;
inset: 0;
@@ -622,7 +620,6 @@
:root[data-family='glass'] .rp-popover::after,
:root[data-family='glass'] .rp-dialog::after,
:root[data-family='glass'] .rp-table::after,
-:root[data-family='glass'] .rp-frame::after,
:root[data-family='glass'] .rp-toast::after {
content: '';
position: absolute;
@@ -652,9 +649,6 @@
:root[data-family='glass'] .rp-table [role='columnheader'] {
background: transparent;
}
-:root[data-family='glass'] .rp-frame .head {
- background: transparent;
-}
:root[data-family='glass'] .rp-table [role='row'][data-hovered]:not([data-selected]) {
background: rgba(255, 255, 255, 0.18);
}
@@ -1105,31 +1099,11 @@ input {
flex-wrap: wrap;
min-width: 0;
}
-.rp-title {
- font-size: 16px;
- line-height: 20px;
- font-weight: 700;
-}
.rp-label {
font-size: 12px;
line-height: 16px;
color: var(--rp-subtle);
}
-.rp-quick {
- display: grid;
- grid-template-columns: 1fr;
- gap: 12px;
-}
-@media (min-width: 640px) {
- .rp-quick {
- grid-template-columns: repeat(2, minmax(0, 1fr));
- }
-}
-@media (min-width: 1280px) {
- .rp-quick {
- grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 1fr));
- }
-}
.rp-strip {
display: grid;
grid-template-columns: 1fr;
@@ -1297,7 +1271,7 @@ input {
.rp-btn {
display: inline-flex;
align-items: center;
- gap: 6px;
+ gap: 8px;
height: 32px;
padding: 0 12px;
border-radius: 8px;
@@ -1339,7 +1313,7 @@ input {
.rp-btn.negative,
.rp-btn.secondary {
border-radius: 999px;
- padding: 0 14px;
+ padding: 0 12px;
}
.rp-btn.secondary {
background: transparent;
@@ -1354,7 +1328,7 @@ input {
.rp-btn.sm.primary,
.rp-btn.sm.negative,
.rp-btn.sm.secondary {
- padding: 0 10px;
+ padding: 0 8px;
}
.rp-btn.icon {
width: 32px;
@@ -1380,7 +1354,7 @@ input {
.rp-seg .rp-btn {
flex: 0 1 auto;
min-width: 0;
- padding: 0 10px;
+ padding: 0 8px;
}
.rp-seg .rp-btn {
height: 28px;
@@ -1551,6 +1525,13 @@ input {
.rp-light.info {
--dot: var(--rp-iris);
}
+.rp-light.neutral {
+ --dot: var(--rp-subtle);
+}
+.rp-light.muted {
+ color: var(--rp-muted);
+ opacity: 0.6;
+}
.rp-bar {
display: flex;
flex-direction: column;
@@ -1560,6 +1541,7 @@ input {
}
.rp-bar .top {
display: flex;
+ align-items: center;
justify-content: space-between;
gap: 12px;
font-size: 14px;
@@ -1598,28 +1580,6 @@ input {
min-height: 28px;
color: var(--rp-subtle);
}
-.rp-issue {
- display: flex;
- align-items: center;
- gap: 8px;
- height: 32px;
-}
-.rp-issue + .rp-issue,
-.rp-issues > div + div {
- border-top: 1px solid var(--rp-hl-med);
-}
-.rp-issue .lvl {
- width: 80px;
- flex-shrink: 0;
-}
-.rp-issue .txt {
- font-size: 14px;
- line-height: 20px;
- min-width: 0;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
.rp-hr {
height: 0;
border: 0;
@@ -1644,6 +1604,7 @@ input {
width: 10px;
height: 10px;
border-radius: 3px;
+ background: var(--rp-c1);
}
.rp-legend b {
color: var(--rp-text);
@@ -1713,7 +1674,7 @@ input {
align-items: center;
gap: 4px;
height: 24px;
- padding: 0 6px;
+ padding: 0 8px;
border-radius: 8px;
background: transparent;
border: 0;
@@ -1747,6 +1708,8 @@ input {
}
.rp-input {
display: flex;
+ min-width: 0;
+ max-width: 100%;
align-items: center;
gap: 8px;
height: 32px;
@@ -1779,6 +1742,7 @@ input {
}
.rp-input input {
flex: 1;
+ min-width: 0;
border: 0;
outline: 0;
background: transparent;
@@ -1877,23 +1841,6 @@ input {
line-height: 20px;
overflow-wrap: anywhere;
}
-.rp-count {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- box-sizing: border-box;
- min-width: 18px;
- height: 18px;
- padding: 0 4px;
- border-radius: 9px;
- background: var(--rp-love);
- color: var(--rp-on-accent);
- font-size: 11px;
- line-height: 18px;
- font-weight: 600;
- font-variant-numeric: tabular-nums;
- margin-left: 2px;
-}
.rp-badge {
display: inline-flex;
align-items: center;
@@ -1967,7 +1914,7 @@ input {
gap: 2px;
height: 56px;
padding: 8px 12px;
- border-radius: 10px;
+ border-radius: 8px;
border: 2px solid transparent;
background: var(--rp-overlay);
color: var(--rp-text);
@@ -1983,8 +1930,7 @@ button.rp-node {
button.rp-node:hover {
background: var(--rp-hl-med);
}
-button.rp-node[data-focus-visible],
-.rp-frame:has(> .body:focus-visible) {
+button.rp-node[data-focus-visible] {
outline: 2px solid var(--rp-pine);
outline-offset: 2px;
}
@@ -1995,7 +1941,7 @@ button.rp-node[data-focus-visible],
}
.rp-node .top {
display: flex;
- align-items: baseline;
+ align-items: center;
justify-content: space-between;
gap: 8px;
min-width: 0;
@@ -2020,10 +1966,6 @@ button.rp-node[data-focus-visible],
.rp-node .ms.err {
color: var(--rp-love);
}
-.rp-node .ms.nested {
- color: var(--rp-subtle);
- font-weight: 500;
-}
.rp-node .s {
display: flex;
justify-content: space-between;
@@ -2039,22 +1981,12 @@ button.rp-node[data-focus-visible],
color: var(--rp-pine);
font-weight: 600;
}
-/* Large groups: filter row plus a virtualised grid that scrolls inside the card. */
-.rp-nodeset {
- display: flex;
- flex-direction: column;
- gap: 12px;
- min-width: 0;
-}
-.rp-filter {
- width: 240px;
-}
.rp-nodegrid {
height: 376px;
overflow: auto;
outline: none;
scrollbar-width: thin;
- border-radius: 10px;
+ border-radius: 8px;
}
.rp-nodegrid .rp-node {
cursor: pointer;
@@ -2141,20 +2073,6 @@ button.rp-node[data-focus-visible],
.rp-field .rp-input {
height: 32px;
}
-.rp-field textarea {
- width: 100%;
- min-height: 320px;
- padding: 12px;
- border: 1px solid var(--rp-hl-high);
- border-radius: 8px;
- background: var(--rp-base);
- color: var(--rp-text);
- font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
- font-size: 13px;
- line-height: 20px;
- resize: vertical;
- box-sizing: border-box;
-}
.rp-selectbtn {
display: inline-flex;
align-items: center;
@@ -2178,6 +2096,7 @@ button.rp-node[data-focus-visible],
}
.rp-table {
width: 100%;
+ height: 442px;
border: 1px solid var(--rp-hl-med);
border-radius: 8px;
background: var(--rp-surface);
@@ -2238,77 +2157,40 @@ button.rp-node[data-focus-visible],
.rp-table .end {
text-align: end;
}
-.rp-frame {
- border: 1px solid var(--rp-hl-med);
- border-radius: 10px;
- overflow: hidden;
- background: var(--rp-surface);
+/* Virtualized tables use divs; only their layout differs from native cells. */
+.rp-table > div[role='grid'] {
+ height: 100%;
+ overflow: auto;
+ scrollbar-width: thin;
+ outline: none;
}
-.rp-frame .head {
+.rp-table div[role='row'],
+.rp-table div[role='columnheader'],
+.rp-table div[role='rowgroup'] {
+ height: 100%;
+}
+.rp-table div[role='columnheader'] {
+ position: static;
+}
+.rp-table div[role='rowheader'],
+.rp-table div[role='gridcell'] {
display: flex;
align-items: center;
- justify-content: space-between;
- gap: 12px;
- min-height: 40px;
- padding: 0 16px;
- border-bottom: 1px solid var(--rp-hl-med);
- font-size: 12px;
- line-height: 16px;
- color: var(--rp-subtle);
+ max-width: none;
}
-.rp-frame .body {
- overflow: auto;
- padding: 12px 0;
- scrollbar-width: thin;
-}
-.rp-line {
- display: grid;
- grid-template-columns: 56px max-content;
- font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
- font-size: 13px;
- line-height: 24px;
- white-space: pre;
- padding-right: 16px;
-}
-.rp-line .n {
- text-align: end;
- padding-right: 16px;
- color: var(--rp-muted);
- user-select: none;
-}
-.rp-line.err {
- background: color-mix(in srgb, var(--rp-love) 16%, transparent);
+.rp-table .cell {
+ width: 100%;
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
}
.rp-kw {
color: var(--rp-love);
}
-.rp-arg {
- color: var(--rp-pine);
-}
-.rp-str {
- color: var(--rp-gold);
-}
-.rp-cmt {
- color: var(--rp-muted);
-}
.rp-out {
color: var(--rp-pine);
font-weight: 600;
}
-.rp-lv {
- display: inline-block;
- width: 6ch;
- font-weight: 600;
-}
-.rp-lv-info {
- color: var(--rp-foam);
-}
-.rp-lv-warn {
- color: var(--rp-gold);
-}
-.rp-lv-err {
- color: var(--rp-love);
-}
.rp-alert {
display: flex;
flex-direction: column;
@@ -2317,60 +2199,10 @@ button.rp-node[data-focus-visible],
border-radius: 10px;
border: 1px solid var(--rp-love);
}
-.rp-alert .h {
- font-weight: 600;
-}
.rp-p {
margin: 0;
line-height: 20px;
}
-.rp-diff {
- display: grid;
- grid-template-columns: minmax(0, 1fr) auto auto;
- align-items: center;
- gap: 12px;
- min-height: 24px;
-}
-.rp-diff .v {
- color: var(--rp-subtle);
- white-space: nowrap;
-}
-.rp-diff .rp-code {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-.rp-alert .b {
- font-size: 13px;
- line-height: 20px;
- color: var(--rp-subtle);
-}
-.rp-tabs {
- display: flex;
- flex-direction: column;
- gap: 24px;
-}
-.rp-tablist {
- display: flex;
- gap: 24px;
- border-bottom: 1px solid var(--rp-hl-med);
-}
-.rp-tab {
- padding: 8px 0;
- margin-bottom: -1px;
- border-bottom: 2px solid transparent;
- color: var(--rp-subtle);
- cursor: pointer;
- outline: none;
- font-weight: 500;
-}
-.rp-tab[data-selected] {
- color: var(--rp-pine);
- border-bottom-color: var(--rp-pine);
-}
-.rp-tab[data-hovered] {
- color: var(--rp-text);
-}
.rp-dialog .foot {
display: flex;
justify-content: flex-end;
@@ -2391,17 +2223,6 @@ button.rp-node[data-focus-visible],
flex-direction: column;
gap: 12px;
}
-.rp-fb {
- display: flex;
- align-items: center;
- gap: 16px;
- font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
- font-size: 13px;
- padding: 0 16px;
- min-height: 40px;
- background: var(--rp-base);
- border-radius: 8px;
-}
.rp-cards {
display: grid;
grid-template-columns: 1fr;
@@ -2437,7 +2258,8 @@ button.rp-node[data-focus-visible],
}
.rp-group-btns {
display: flex;
- gap: 4px;
+ align-items: center;
+ gap: 8px;
flex-wrap: wrap;
}
.rp-table .rp-group-btns {
@@ -2467,7 +2289,6 @@ button.rp-node[data-focus-visible],
.rp-select,
.rp-selectbtn,
.rp-search,
-.rp-tab,
.rp-input,
.rp-version,
.rp-brand,
@@ -2490,9 +2311,8 @@ button.rp-node[data-focus-visible],
.rp-bar .fill {
transition: width 200ms var(--rp-ease-out);
}
-/* Segmented control and tabs: the selection slides between items (200ms, ease-out). */
-.rp-seg,
-.rp-tabhead {
+/* Segmented control: the selection slides between items (200ms, ease-out). */
+.rp-seg {
position: relative;
}
.rp-slider {
@@ -2517,17 +2337,6 @@ button.rp-node[data-focus-visible],
background: transparent;
border-color: transparent;
}
-.rp-tabhead .rp-slider {
- top: auto;
- bottom: 0;
- height: 2px;
- border: 0;
- border-radius: 1px;
- background: var(--rp-pine);
-}
-.rp-tab[data-selected] {
- border-bottom-color: transparent;
-}
/* Popovers, menus, tooltips: fade and drift 4px from the trigger side. */
.rp-popover,
.rp-tip {
@@ -2847,32 +2656,6 @@ button.rp-node:hover {
font-family: monospace;
}
-.rp-trace-form {
- display: grid;
- grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
- gap: 16px;
-}
-.rp-trace-result.matched {
- --dot: #28a745;
-}
-.rp-trace-result.not_matched {
- --dot: var(--rp-subtle);
-}
-.rp-trace-result.skipped {
- --dot: var(--rp-muted);
- color: var(--rp-muted);
- opacity: 0.6;
-}
-.rp-trace-result.indeterminate {
- --dot: var(--rp-gold);
-}
-.rp-nav-compat {
- margin-inline-start: auto;
-}
-.rp-il .ic:has(> .rp-nav-compat) {
- order: 1;
-}
-
.rp-provenance {
margin-inline-start: 4px;
padding: 1px 4px;
@@ -2885,6 +2668,7 @@ button.rp-node:hover {
.rp-rule {
display: flex;
align-items: center;
+ gap: 8px;
min-width: 0;
}
.rp-rule > span {
@@ -2896,71 +2680,76 @@ button.rp-node:hover {
flex-shrink: 0;
}
-/* Virtualized table elements are divs; retain the native table's cell geometry. */
-.rp-connection-grid {
- height: 100%;
- overflow: auto;
- scrollbar-width: thin;
- outline: none;
-}
-.rp-connection-grid [role='row'],
-.rp-connection-grid [role='columnheader'] {
- height: 100%;
-}
-.rp-connection-grid [role='columnheader'] {
- position: static;
-}
-.rp-connection-grid [role='rowheader'],
-.rp-connection-grid [role='gridcell'] {
- display: flex;
- align-items: center;
- max-width: none;
-}
-.rp-connection-cell {
- width: 100%;
- min-width: 0;
- overflow: hidden;
- text-overflow: ellipsis;
-}
-.rp-connection-grid [role='rowgroup'] {
- height: 100%;
-}
-.rp-settings-secret {
- display: flex;
- align-items: center;
- gap: 12px;
-}
-.rp-settings-secret > .rp-input {
- flex: 1;
- min-width: 0;
-}
-.rp-settings-secret input {
- min-width: 0;
-}
-
-.rp-sankey-node {
- cursor: pointer;
- outline: none;
-}
-.rp-sankey-node:is(:focus-visible, [aria-pressed='true']) > rect {
- stroke: var(--rp-text);
- stroke-width: 2;
-}
-.rp-sankey-label {
- color: var(--rp-text);
- line-height: 20px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
.rp-flow-filter .rp-btn {
background: var(--rp-hl-low);
border-color: var(--rp-hl-high);
}
-.rp-quick-native {
- grid-template-columns: minmax(0, 1fr);
-}
.rp-spin svg {
animation-iteration-count: infinite;
}
+
+.rp-flow-columns {
+ position: relative;
+ display: grid;
+ grid-template-columns: repeat(4, minmax(0, 1fr));
+ gap: 24px 48px;
+}
+.rp-flow-ribbons {
+ position: absolute;
+ inset: 0;
+ width: 100%;
+ height: 100%;
+ pointer-events: none;
+}
+.rp-flow-stage {
+ position: relative;
+ min-width: 0;
+}
+.rp-flow-stage > .rp-label {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ margin: 0;
+ padding: 0 10px;
+ font-weight: 500;
+}
+.rp-flow-stage .rp-count {
+ background: var(--rp-hl-med);
+ color: var(--rp-subtle);
+}
+.rp-flow-row {
+ width: 100%;
+ min-width: 0;
+ padding: 6px 8px;
+ border: 2px solid transparent;
+ border-radius: 10px;
+ background: transparent;
+ color: var(--rp-text);
+ text-align: start;
+ font: inherit;
+ cursor: pointer;
+}
+.rp-flow-row[data-hovered] {
+ background: var(--rp-hl-low);
+}
+.rp-flow-row[data-selected] {
+ border-color: var(--rp-pine);
+ background: color-mix(in srgb, var(--rp-pine) 10%, var(--rp-overlay));
+}
+.rp-flow-row[data-focus-visible] {
+ outline: 2px solid var(--rp-pine);
+ outline-offset: 2px;
+}
+.rp-flow-row[data-unknown] .l {
+ color: var(--rp-muted);
+}
+@media (max-width: 900px) {
+ .rp-flow-columns {
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ column-gap: 24px;
+ }
+ .rp-flow-ribbons {
+ display: none;
+ }
+}
diff --git a/src/ui/ui.tsx b/src/ui/ui.tsx
index 5bcf6085..8637ad88 100644
--- a/src/ui/ui.tsx
+++ b/src/ui/ui.tsx
@@ -1,5 +1,5 @@
// Small control kit on react-aria-components, styled by theme.css with the Rosé Pine variables.
-import {useLayoutEffect, useRef, useState, type CSSProperties, type ReactNode, type RefObject} from 'react';
+import {useId, useLayoutEffect, useRef, useState, type ComponentProps, type CSSProperties, type ReactNode, type RefObject} from 'react';
import {flushSync} from 'react-dom';
import {
Button as RButton,
@@ -26,6 +26,7 @@ import Checkmark from './icons/Checkmark';
import CheckmarkCircle from './icons/CheckmarkCircle';
import AlertTriangle from './icons/AlertTriangle';
import InfoCircle from './icons/InfoCircle';
+import Search from './icons/Search';
import {useT} from '../i18n';
const cx = (...c: Array) => c.filter(Boolean).join(' ');
@@ -85,7 +86,10 @@ export function Button({
negative,
label,
isDisabled,
- tip
+ tip,
+ type,
+ appearance,
+ className
}: {
children?: ReactNode;
onPress?: () => void;
@@ -99,22 +103,27 @@ export function Button({
label?: string;
isDisabled?: boolean;
tip?: string;
+ type?: 'button' | 'submit' | 'reset';
+ appearance?: 'search' | 'version' | 'select';
+ className?: string;
}) {
const btn = (
{children}
@@ -266,10 +275,10 @@ export function InlineSelect({items, value, onChange, label}: {items: Item[]; va
);
}
-export function Light({tone, children, small}: {tone: 'ok' | 'warn' | 'err' | 'info'; children: ReactNode; small?: boolean}) {
+export function Light({tone, children, small}: {tone: 'ok' | 'warn' | 'err' | 'info' | 'neutral' | 'muted'; children: ReactNode; small?: boolean}) {
return {children} ;
}
-export function Bar({label, value, pct, color, icon}: {label: string; value: string; pct: number; color: string; icon?: ReactNode}) {
+export function Bar({label, value, pct, color, icon}: {label: ReactNode; value: string; pct: number; color: string; icon?: ReactNode}) {
return (
@@ -279,7 +288,7 @@ export function Bar({label, value, pct, color, icon}: {label: string; value: str
{value}
-
@@ -291,7 +300,8 @@ import {useEffect, type ReactElement} from 'react';
import {
Switch as RSwitch,
TextField as RTextField,
- TextArea as RTextArea,
+ SearchField as RSearchField,
+ Text,
Label,
Input as RInput,
Table,
@@ -305,10 +315,6 @@ import {
ModalOverlay,
Dialog,
Heading,
- Tabs as RTabs,
- TabList as RTabList,
- Tab as RTab,
- TabPanel as RTabPanel,
type Selection,
type SortDescriptor
} from 'react-aria-components';
@@ -333,30 +339,70 @@ export function Switch({
}
export function TextField({
label,
- value,
- onChange,
- defaultValue,
- width
-}: {
- label: string;
- value?: string;
- onChange?: (v: string) => void;
- defaultValue?: string;
- width?: number;
-}) {
- return (
-
- {label}
-
-
-
-
+ width,
+ search,
+ large,
+ side,
+ className,
+ placeholder,
+ description,
+ error,
+ action,
+ autoComplete,
+ spellCheck,
+ ...props
+}: Pick
, 'value' | 'onChange' | 'defaultValue' | 'name' | 'type' | 'isInvalid' | 'validationBehavior' | 'autoFocus'> &
+ Pick, 'autoComplete' | 'spellCheck'> & {
+ label: string;
+ width?: number;
+ search?: boolean;
+ large?: boolean;
+ side?: boolean;
+ className?: string;
+ placeholder?: string;
+ description?: string;
+ error?: string;
+ action?: ReactNode;
+ }) {
+ const t = useT();
+ const errorId = useId();
+ if (search) {
+ return (
+
+
+
+
+
+
+
+ );
+ }
+ const input = (
+
+
+
);
-}
-export function TextArea({label, value, onChange}: {label: string; value: string; onChange: (v: string) => void}) {
return (
-
-
+
+ {label}
+ {action ? (
+
+ {input}
+ {action}
+
+ ) : (
+ input
+ )}
+ {description && (
+
+ {description}
+
+ )}
+ {error && (
+
+ {error}
+
+ )}
);
}
@@ -418,8 +464,8 @@ export function LabeledSelect({
);
}
-export function Badge({children, tone}: {children: ReactNode; tone?: 'warn'}) {
- return {children} ;
+export function Badge({children, tone, className}: {children: ReactNode; tone?: 'warn'; className?: string}) {
+ return {children} ;
}
export function Kv({items, inline}: {items: Array<[string, string]>; inline?: boolean}) {
return (
@@ -433,8 +479,7 @@ export function Kv({items, inline}: {items: Array<[string, string]>; inline?: bo
);
}
-// Node tile: name and the TCP latency up front, coloured by health; UDP and IPv6 underneath.
-// With onPress it is a toggle (selector groups); without, a static member that may be the group's current pick.
+// Virtual collections render the same tile body inside their own selectable item.
export type NodeTileProps = {
name: string;
icon?: ReactNode;
@@ -442,14 +487,34 @@ export type NodeTileProps = {
udp?: number;
v6?: boolean;
alive?: boolean;
+ unavailable?: boolean;
+ description?: string;
nested?: boolean;
selected?: boolean;
cur?: boolean;
onPress?: () => void;
+ isDisabled?: boolean;
+ bodyOnly?: boolean;
labels: {timeout: string; nested: string; cur: string};
};
export const latencyTone = (ms: number) => (ms < 100 ? 'ok' : ms < 180 ? 'warn' : 'err');
-export function NodeTile({name, icon, tcp, udp, v6, alive = true, nested, selected, cur, onPress, labels}: NodeTileProps) {
+export function NodeTile({
+ name,
+ icon,
+ tcp,
+ udp,
+ v6,
+ alive = true,
+ unavailable = !alive || tcp == null,
+ description,
+ nested,
+ selected,
+ cur,
+ onPress,
+ isDisabled,
+ bodyOnly,
+ labels
+}: NodeTileProps) {
const t = useT();
const body = (
<>
@@ -459,22 +524,23 @@ export function NodeTile({name, icon, tcp, udp, v6, alive = true, nested, select
{name}
{nested ? (
-
>
);
+ if (bodyOnly) return body;
if (onPress) {
return (
-