dudu MVP:五端语音输入法初始提交
- server:Go 网关(WS 流式识别中继/计费配额/微信登录支付 mock/反馈/埋点),gummy provider 已真实联调 - desktop:Tauri 2(全局快捷键 push-to-talk/浮层/托盘/设置/登录购买/反馈/首启引导) - android:Compose 主 App + IME(键盘内录音直传) - ios:App + 键盘扩展(1A spike 实证键盘内不可录音,走 deep link 听写) - design/design-pipeline:设计系统 + token 导出 iOS/Android 主题 - doc:前后端设计文档(HTML);web:官网宣传页;todo:任务看板 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
/** 文本输入框 — 桌面 36px / 移动 44px。 */
|
||||
export interface InputProps {
|
||||
/** md=36px 桌面 / lg=44px 移动 @default 'md' */
|
||||
size?: 'md' | 'lg';
|
||||
placeholder?: string;
|
||||
value?: string;
|
||||
disabled?: boolean;
|
||||
onChange?: (e: any) => void;
|
||||
style?: any;
|
||||
}
|
||||
export declare function Input(props: InputProps): any;
|
||||
@@ -0,0 +1,26 @@
|
||||
const ddInputCss = `
|
||||
.dd-input {
|
||||
display: block; width: 100%; box-sizing: border-box;
|
||||
height: var(--control-md); padding: 0 12px;
|
||||
font-family: var(--font-sans); font-size: var(--text-base); color: var(--text-1);
|
||||
background: var(--surface-card); border: 1px solid var(--border-2);
|
||||
border-radius: var(--radius-sm);
|
||||
transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
|
||||
}
|
||||
.dd-input::placeholder { color: var(--text-3); }
|
||||
.dd-input:hover { border-color: var(--gray-400); }
|
||||
.dd-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
|
||||
.dd-input[disabled] { opacity: 0.45; pointer-events: none; }
|
||||
.dd-input--lg { height: var(--control-lg); font-size: var(--text-md); border-radius: var(--radius-sm); }
|
||||
`;
|
||||
|
||||
if (typeof document !== 'undefined' && !document.getElementById('dd-input-css')) {
|
||||
const s = document.createElement('style');
|
||||
s.id = 'dd-input-css';
|
||||
s.textContent = ddInputCss;
|
||||
document.head.appendChild(s);
|
||||
}
|
||||
|
||||
export function Input({ size = 'md', style, ...rest }) {
|
||||
return <input className={`dd-input${size === 'lg' ? ' dd-input--lg' : ''}`} style={style} {...rest} />;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
Standard text field. Focus = accent border + soft ring.
|
||||
|
||||
```jsx
|
||||
const { Input } = window.DuduDesignSystem_2e0172;
|
||||
<Input placeholder="说点什么…" />
|
||||
<Input size="lg" placeholder="移动端 44px" />
|
||||
```
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
/** 设置行 — 左标签(可带说明)+ 右控件,1px 分隔线;设置窗口/移动端「我的」的基本骨架。 */
|
||||
export interface SettingRowProps {
|
||||
label: string;
|
||||
/** 12px 灰色辅助说明 */
|
||||
description?: string;
|
||||
/** 右侧控件:Switch / HotkeyCombo / Button / 文本 */
|
||||
children?: any;
|
||||
}
|
||||
export declare function SettingRow(props: SettingRowProps): any;
|
||||
@@ -0,0 +1,30 @@
|
||||
const ddSettingRowCss = `
|
||||
.dd-setrow {
|
||||
display: flex; align-items: center; justify-content: space-between; gap: 16px;
|
||||
padding: 12px 0; border-bottom: 1px solid var(--border-1);
|
||||
font-family: var(--font-sans); font-size: var(--text-base);
|
||||
}
|
||||
.dd-setrow:last-child { border-bottom: none; }
|
||||
.dd-setrow__label { color: var(--text-1); }
|
||||
.dd-setrow__desc { font-size: var(--text-xs); color: var(--text-3); margin-top: 2px; }
|
||||
.dd-setrow__control { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: var(--text-sm); }
|
||||
`;
|
||||
|
||||
if (typeof document !== 'undefined' && !document.getElementById('dd-setrow-css')) {
|
||||
const s = document.createElement('style');
|
||||
s.id = 'dd-setrow-css';
|
||||
s.textContent = ddSettingRowCss;
|
||||
document.head.appendChild(s);
|
||||
}
|
||||
|
||||
export function SettingRow({ label, description, children, ...rest }) {
|
||||
return (
|
||||
<div className="dd-setrow" {...rest}>
|
||||
<div>
|
||||
<div className="dd-setrow__label">{label}</div>
|
||||
{description ? <div className="dd-setrow__desc">{description}</div> : null}
|
||||
</div>
|
||||
<div className="dd-setrow__control">{children}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
Label-left / control-right list row, the skeleton of every settings surface.
|
||||
|
||||
```jsx
|
||||
const { SettingRow, Switch, HotkeyCombo } = window.DuduDesignSystem_2e0172;
|
||||
<SettingRow label="说话快捷键" description="按住说话,松开完成">
|
||||
<HotkeyCombo keys={['⌘','⇧','Space']} />
|
||||
</SettingRow>
|
||||
<SettingRow label="开机自启"><Switch checked /></SettingRow>
|
||||
```
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/** 开关 — 设置项的布尔控件(开机自启、启用快捷键…)。 */
|
||||
export interface SwitchProps {
|
||||
checked?: boolean;
|
||||
onChange?: (next: boolean) => void;
|
||||
disabled?: boolean;
|
||||
}
|
||||
export declare function Switch(props: SwitchProps): any;
|
||||
@@ -0,0 +1,33 @@
|
||||
const ddSwitchCss = `
|
||||
.dd-switch {
|
||||
position: relative; display: inline-block; width: 40px; height: 24px;
|
||||
border-radius: var(--radius-full); background: var(--surface-3);
|
||||
border: none; cursor: pointer; padding: 0; flex: none;
|
||||
transition: background var(--dur-base) var(--ease-out);
|
||||
}
|
||||
.dd-switch::after {
|
||||
content: ''; position: absolute; top: 3px; left: 3px;
|
||||
width: 18px; height: 18px; border-radius: 50%;
|
||||
background: #fff; box-shadow: 0 1px 3px rgba(17,19,26,0.25);
|
||||
transition: transform var(--dur-base) var(--ease-out);
|
||||
}
|
||||
.dd-switch[aria-checked="true"] { background: var(--accent); }
|
||||
.dd-switch[aria-checked="true"]::after { transform: translateX(16px); }
|
||||
.dd-switch:focus-visible { outline: none; box-shadow: var(--focus-ring); }
|
||||
.dd-switch[disabled] { opacity: 0.45; pointer-events: none; }
|
||||
`;
|
||||
|
||||
if (typeof document !== 'undefined' && !document.getElementById('dd-switch-css')) {
|
||||
const s = document.createElement('style');
|
||||
s.id = 'dd-switch-css';
|
||||
s.textContent = ddSwitchCss;
|
||||
document.head.appendChild(s);
|
||||
}
|
||||
|
||||
export function Switch({ checked = false, onChange, disabled = false, ...rest }) {
|
||||
return (
|
||||
<button type="button" role="switch" className="dd-switch"
|
||||
aria-checked={checked ? 'true' : 'false'} disabled={disabled}
|
||||
onClick={() => onChange && onChange(!checked)} {...rest}></button>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
Boolean toggle for settings rows. 40×24, accent when on, no bounce.
|
||||
|
||||
```jsx
|
||||
const { Switch } = window.DuduDesignSystem_2e0172;
|
||||
<Switch checked={autoStart} onChange={setAutoStart} />
|
||||
```
|
||||
@@ -0,0 +1,42 @@
|
||||
<!-- @dsCard group="Components" viewport="700x300" name="Forms 表单" subtitle="Input · Switch · SettingRow" -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="../../styles.css">
|
||||
<script src="https://unpkg.com/react@18.3.1/umd/react.development.js" integrity="sha384-hD6/rw4ppMLGNu3tX5cjIb+uRZ7UkRJ6BPkLpg4hAu/6onKUg4lLsHAs9EBPT82L" crossorigin="anonymous"></script>
|
||||
<script src="https://unpkg.com/react-dom@18.3.1/umd/react-dom.development.js" integrity="sha384-u6aeetuaXnQ38mYT8rp6sbXaQe3NL9t+IBXmnYxwkUI2Hw4bsp2Wvmx4yRQF1uAm" crossorigin="anonymous"></script>
|
||||
<script src="https://unpkg.com/@babel/standalone@7.29.0/babel.min.js" integrity="sha384-m08KidiNqLdpJqLq95G/LEi8Qvjl/xUYll3QILypMoQ65QorJ9Lvtp2RXYGBFj1y" crossorigin="anonymous"></script>
|
||||
<script src="../../_ds_bundle.js"></script>
|
||||
<style>
|
||||
body { margin: 0; font-family: var(--font-sans); display: grid; grid-template-columns: 1fr 1fr; }
|
||||
.pane { padding: 20px 22px; background: var(--bg-app); color: var(--text-1); min-height: 300px; box-sizing: border-box; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="pane" id="light"></div>
|
||||
<div class="pane" id="dark" data-theme="dark"></div>
|
||||
<script type="text/babel">
|
||||
const { Input, Switch, SettingRow, HotkeyCombo, Card } = window.DuduDesignSystem_2e0172;
|
||||
function Demo() {
|
||||
const [auto, setAuto] = React.useState(true);
|
||||
const [hotkey, setHotkey] = React.useState(true);
|
||||
return (
|
||||
<div style={{ display: 'grid', gap: 14 }}>
|
||||
<Input placeholder="说点什么…" />
|
||||
<Card padding="4px 16px">
|
||||
<SettingRow label="说话快捷键" description="按住说话,松开完成">
|
||||
<HotkeyCombo keys={['⌘', '⇧', 'Space']} />
|
||||
</SettingRow>
|
||||
<SettingRow label="麦克风">MacBook Pro 麦克风 ▾</SettingRow>
|
||||
<SettingRow label="开机自启"><Switch checked={auto} onChange={setAuto} /></SettingRow>
|
||||
<SettingRow label="启用快捷键"><Switch checked={hotkey} onChange={setHotkey} /></SettingRow>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
ReactDOM.createRoot(document.getElementById('light')).render(<Demo />);
|
||||
ReactDOM.createRoot(document.getElementById('dark')).render(<Demo />);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user