diff --git a/.github/workflows/verify-mobile-ui.yml b/.github/workflows/verify-mobile-ui.yml new file mode 100644 index 000000000..0e8bc871f --- /dev/null +++ b/.github/workflows/verify-mobile-ui.yml @@ -0,0 +1,48 @@ +name: Verify / Mobile UI +run-name: Verify / Mobile UI / ${{ github.ref_name }} / ${{ github.sha }} + +on: + workflow_dispatch: + push: + branches-ignore: [main] + paths: ['.github/workflows/verify-mobile-ui.yml'] + +permissions: + contents: read + +jobs: + source: + name: Freeze mobile build inputs + if: github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '[verify-mobile-ui]') + runs-on: ubuntu-24.04 + outputs: + version: ${{ steps.mobile.outputs.version }} + source_sha: ${{ github.sha }} + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 + with: {ref: '${{ github.sha }}', persist-credentials: false} + - name: Read committed mobile version + id: mobile + run: | + python3 - <<'PY' >> "$GITHUB_OUTPUT" + import json + with open("apps/mobile/app.json") as source: + version = json.load(source)["expo"]["extra"]["releaseVersion"] + print("version=" + version) + PY + - name: Check the fixed Arc source and native port mappings + run: python3 scripts/check-uiarc.py + android: + name: Verify Android package + needs: source + uses: ./.github/workflows/release-apps.yml + with: + source_sha: ${{ needs.source.outputs.source_sha }} + version: ${{ needs.source.outputs.version }} + ios: + name: Verify unsigned iOS archive + needs: source + uses: ./.github/workflows/release-ios.yml + with: + source_sha: ${{ needs.source.outputs.source_sha }} + version: ${{ needs.source.outputs.version }} diff --git a/AGENTS.md b/AGENTS.md index 2a038a9b2..09e07478a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -14,6 +14,8 @@ - 发版、版本递增、创建或推送发布 tag 前,先读 `.agents/skills/release/SKILL.md`;合并或验收通过不构成发布授权。 - 任何新功能在独立分支产生首个提交后,立即 push 并创建 PR。当前开发分支 PR 不自动触发 GitHub Actions,须运行相关本地检查;需要远端验证时手动触发对应 workflow。继续开发,不阻塞等待已启动的远端构建,异步巡查并修复失败。避免频繁本地编译,仅在定位问题或必要验收时执行最小相关验证;最终交付前核对最终 HEAD 的必要检查结果,不将 pending 视为通过。 - 只执行相关验证。安全与同步行为优先在对应 Rust 模块验证,验收须覆盖真实进程及制品。 +- Web 工作区和 Mobile 的唯一 UI 体系是 `WheatXie/uiarc-pro-reverse` 的 Arc。新增或修改界面先读 `packages/docs/design/uiarc-migration.md`。Web 使用 `packages/uiarc` 中记录来源的组件;Mobile 使用 `apps/mobile/src/components/arc` 的同源原生移植。禁止重新加入 shadcn/ui、React Native Reusables 或另一套组件库、主题和控件样式。 +- 颜色、字体、圆角、控件尺寸和动效来自固定版本的 Arc foundation。运行 `pnpm generate:ui` 生成两端 token,不手改生成文件。新增 Arc 项目使用 `scripts/vendor-uiarc.py` 获取来源并记录哈希;原生移植在 `source.json` 标注对应 Arc 项目。UI 改动必须通过 `pnpm check:ui`。 - 主分支 CI 保留核心检查;同步、恢复、调度和工具执行改动须按 `packages/docs/ci.md` 补跑相关本地专项并记录结果。CI 只用受控协议夹具,不调用真实 AI Provider 或读取模型密钥。 - e2e 测试、截图和界面验收只在用户明确要求时编写或运行,不作为默认验收、preflight 或 CI 步骤。被要求时先读 `.agents/skills/e2e/SKILL.md`,启动方式见 `packages/docs/e2e.md`。 diff --git a/apps/app/.impeccable/design.json b/apps/app/.impeccable/design.json index 8f093e832..c805a2b88 100644 --- a/apps/app/.impeccable/design.json +++ b/apps/app/.impeccable/design.json @@ -1,316 +1,43 @@ { "schemaVersion": 2, - "generatedAt": "2026-11-11T19:54:07.567418+00:00", - "title": "Design System: Vibeface Web App", - "extensions": { - "colorMeta": { - "background-light": { - "role": "neutral", - "displayName": "Background Light", - "canonical": "oklch(1 0 0)", - "tonalRamp": [ - "oklch(0.150 0.0000 0)", - "oklch(0.260 0.0000 0)", - "oklch(0.380 0.0000 0)", - "oklch(0.500 0.0000 0)", - "oklch(0.620 0.0000 0)", - "oklch(0.740 0.0000 0)", - "oklch(0.860 0.0000 0)", - "oklch(0.950 0.0000 0)" - ] - }, - "background-dark": { - "role": "neutral", - "displayName": "Background Dark", - "canonical": "oklch(0.175 0.006 270)", - "tonalRamp": [ - "oklch(0.150 0.0045 270)", - "oklch(0.260 0.0060 270)", - "oklch(0.380 0.0060 270)", - "oklch(0.500 0.0060 270)", - "oklch(0.620 0.0060 270)", - "oklch(0.740 0.0060 270)", - "oklch(0.860 0.0042 270)", - "oklch(0.950 0.0015 270)" - ] - }, - "foreground-light": { - "role": "neutral", - "displayName": "Foreground Light", - "canonical": "oklch(0.21 0.012 270)", - "tonalRamp": [ - "oklch(0.150 0.0090 270)", - "oklch(0.260 0.0120 270)", - "oklch(0.380 0.0120 270)", - "oklch(0.500 0.0120 270)", - "oklch(0.620 0.0120 270)", - "oklch(0.740 0.0120 270)", - "oklch(0.860 0.0084 270)", - "oklch(0.950 0.0030 270)" - ] - }, - "foreground-dark": { - "role": "neutral", - "displayName": "Foreground Dark", - "canonical": "oklch(0.955 0.004 270)", - "tonalRamp": [ - "oklch(0.150 0.0030 270)", - "oklch(0.260 0.0040 270)", - "oklch(0.380 0.0040 270)", - "oklch(0.500 0.0040 270)", - "oklch(0.620 0.0040 270)", - "oklch(0.740 0.0040 270)", - "oklch(0.860 0.0028 270)", - "oklch(0.950 0.0010 270)" - ] - }, - "primary-light": { - "role": "primary", - "displayName": "Primary Light", - "canonical": "oklch(0.24 0.016 270)", - "tonalRamp": [ - "oklch(0.150 0.0120 270)", - "oklch(0.260 0.0160 270)", - "oklch(0.380 0.0160 270)", - "oklch(0.500 0.0160 270)", - "oklch(0.620 0.0160 270)", - "oklch(0.740 0.0160 270)", - "oklch(0.860 0.0112 270)", - "oklch(0.950 0.0040 270)" - ] - }, - "primary-foreground-light": { - "role": "primary", - "displayName": "Primary Foreground Light", - "canonical": "oklch(0.985 0.002 270)", - "tonalRamp": [ - "oklch(0.150 0.0015 270)", - "oklch(0.260 0.0020 270)", - "oklch(0.380 0.0020 270)", - "oklch(0.500 0.0020 270)", - "oklch(0.620 0.0020 270)", - "oklch(0.740 0.0020 270)", - "oklch(0.860 0.0014 270)", - "oklch(0.950 0.0005 270)" - ] - }, - "primary-dark": { - "role": "primary", - "displayName": "Primary Dark", - "canonical": "oklch(0.94 0.005 270)", - "tonalRamp": [ - "oklch(0.150 0.0037 270)", - "oklch(0.260 0.0050 270)", - "oklch(0.380 0.0050 270)", - "oklch(0.500 0.0050 270)", - "oklch(0.620 0.0050 270)", - "oklch(0.740 0.0050 270)", - "oklch(0.860 0.0035 270)", - "oklch(0.950 0.0013 270)" - ] - }, - "brand-light": { - "role": "accent", - "displayName": "Brand Light", - "canonical": "oklch(0.53 0.2 280)", - "tonalRamp": [ - "oklch(0.150 0.1500 280)", - "oklch(0.260 0.2000 280)", - "oklch(0.380 0.2000 280)", - "oklch(0.500 0.2000 280)", - "oklch(0.620 0.2000 280)", - "oklch(0.740 0.2000 280)", - "oklch(0.860 0.1400 280)", - "oklch(0.950 0.0500 280)" - ] - }, - "brand-dark": { - "role": "accent", - "displayName": "Brand Dark", - "canonical": "oklch(0.72 0.15 280)", - "tonalRamp": [ - "oklch(0.150 0.1125 280)", - "oklch(0.260 0.1500 280)", - "oklch(0.380 0.1500 280)", - "oklch(0.500 0.1500 280)", - "oklch(0.620 0.1500 280)", - "oklch(0.740 0.1500 280)", - "oklch(0.860 0.1050 280)", - "oklch(0.950 0.0375 280)" - ] - }, - "muted-light": { - "role": "neutral", - "displayName": "Muted Light", - "canonical": "oklch(0.965 0.004 270)", - "tonalRamp": [ - "oklch(0.150 0.0030 270)", - "oklch(0.260 0.0040 270)", - "oklch(0.380 0.0040 270)", - "oklch(0.500 0.0040 270)", - "oklch(0.620 0.0040 270)", - "oklch(0.740 0.0040 270)", - "oklch(0.860 0.0028 270)", - "oklch(0.950 0.0010 270)" - ] - }, - "muted-dark": { - "role": "neutral", - "displayName": "Muted Dark", - "canonical": "oklch(0.245 0.008 270)", - "tonalRamp": [ - "oklch(0.150 0.0060 270)", - "oklch(0.260 0.0080 270)", - "oklch(0.380 0.0080 270)", - "oklch(0.500 0.0080 270)", - "oklch(0.620 0.0080 270)", - "oklch(0.740 0.0080 270)", - "oklch(0.860 0.0056 270)", - "oklch(0.950 0.0020 270)" - ] - }, - "danger-light": { - "role": "accent", - "displayName": "Danger Light", - "canonical": "oklch(0.54 0.2 27)", - "tonalRamp": [ - "oklch(0.150 0.1500 27)", - "oklch(0.260 0.2000 27)", - "oklch(0.380 0.2000 27)", - "oklch(0.500 0.2000 27)", - "oklch(0.620 0.2000 27)", - "oklch(0.740 0.2000 27)", - "oklch(0.860 0.1400 27)", - "oklch(0.950 0.0500 27)" - ] - }, - "danger-dark": { - "role": "accent", - "displayName": "Danger Dark", - "canonical": "oklch(0.72 0.17 25)", - "tonalRamp": [ - "oklch(0.150 0.1275 25)", - "oklch(0.260 0.1700 25)", - "oklch(0.380 0.1700 25)", - "oklch(0.500 0.1700 25)", - "oklch(0.620 0.1700 25)", - "oklch(0.740 0.1700 25)", - "oklch(0.860 0.1190 25)", - "oklch(0.950 0.0425 25)" - ] - }, - "primary-foreground-dark": { - "role": "neutral", - "displayName": "Primary Foreground Dark", - "canonical": "oklch(0.2 0.01 270)", - "tonalRamp": [ - "oklch(0.15 0.01 270)", - "oklch(0.26 0.01 270)", - "oklch(0.38 0.01 270)", - "oklch(0.5 0.01 270)", - "oklch(0.62 0.01 270)", - "oklch(0.74 0.01 270)", - "oklch(0.86 0.01 270)", - "oklch(0.95 0.01 270)" - ] - } - }, - "shadows": [ - { - "name": "elevation-xs", - "value": "var(--elevation-xs)", - "purpose": "Existing small surface elevation; resolves to no shadow in dark mode." - } - ], - "motion": [ - { - "name": "ease-out", - "value": "cubic-bezier(0.23, 1, 0.32, 1)", - "purpose": "Existing shared easing." - } + "title": "Vibeface Web Arc interface", + "authority": { + "repository": "https://github.com/WheatXie/uiarc-pro-reverse", + "commit": "859606819c68787b2dccb54adcb9b08bd3272d5d", + "foundation": "packages/uiarc/src/foundation.css", + "theme": "packages/theme/theme.css", + "compositions": "apps/app/src/components/arc/source.json", + "pathsRelativeTo": "repository root" + }, + "mode": "operate", + "typography": { + "body": "Inter", + "display": "Geist", + "mono": "Geist Mono", + "weights": [ + 400, + 500 ], - "breakpoints": [ - { - "name": "md", - "value": "768px" - } - ] + "scale": "Arc --text-*" + }, + "colors": "Arc semantic roles only; values derive from pinned foundation", + "radii": "Arc control, panel, surface and pill tokens", + "navigation": { + "desktop": "sidebar rail", + "narrow": "drawer and existing messages/tasks/settings tabs" }, - "components": [ - { - "name": "Default button", - "kind": "button", - "refersTo": "button-primary", - "description": "Default neutral primary action.", - "html": "", - "css": ".ds-button{font-family:\"Geist Variable\",system-ui,sans-serif;font-size:15px;line-height:24px;display:inline-flex;align-items:center;justify-content:center;min-height:36px;padding:0 12px;border:1px solid transparent;border-radius:10px;background:var(--primary);color:var(--primary-foreground);font-weight:500;transition:background-color 150ms cubic-bezier(.23,1,.32,1)}.ds-button:hover{background:color-mix(in oklch,var(--primary) 88%,transparent)}.ds-button:focus-visible{outline:2px solid var(--ring);outline-offset:2px}.ds-button:active{transform:scale(.97)}.ds-button:disabled{opacity:.5}" - }, - { - "name": "Outline button", - "kind": "button", - "description": "Secondary action using existing semantic tokens.", - "html": "", - "css": ".ds-button{font-family:\"Geist Variable\",system-ui,sans-serif;font-size:15px;line-height:24px;display:inline-flex;align-items:center;justify-content:center;min-height:36px;padding:0 12px;border:1px solid transparent;border-radius:10px;background:var(--primary);color:var(--primary-foreground);font-weight:500;transition:background-color 150ms cubic-bezier(.23,1,.32,1)}.ds-button:hover{background:color-mix(in oklch,var(--primary) 88%,transparent)}.ds-button:focus-visible{outline:2px solid var(--ring);outline-offset:2px}.ds-button:active{transform:scale(.97)}.ds-button:disabled{opacity:.5}.ds-outline{background:var(--background);color:var(--foreground);border-color:var(--border)}.ds-outline:hover{background:var(--muted)}" - }, - { - "name": "Ghost button", - "kind": "button", - "description": "Secondary action using existing semantic tokens.", - "html": "", - "css": ".ds-button{font-family:\"Geist Variable\",system-ui,sans-serif;font-size:15px;line-height:24px;display:inline-flex;align-items:center;justify-content:center;min-height:36px;padding:0 12px;border:1px solid transparent;border-radius:10px;background:var(--primary);color:var(--primary-foreground);font-weight:500;transition:background-color 150ms cubic-bezier(.23,1,.32,1)}.ds-button:hover{background:color-mix(in oklch,var(--primary) 88%,transparent)}.ds-button:focus-visible{outline:2px solid var(--ring);outline-offset:2px}.ds-button:active{transform:scale(.97)}.ds-button:disabled{opacity:.5}.ds-ghost{background:transparent;color:var(--foreground);border-color:transparent}.ds-ghost:hover{background:var(--muted)}" - }, - { - "name": "Input", - "kind": "input", - "description": "Single-line field.", - "html": "", - "css": ".ds-input{font-family:\"Geist Variable\",system-ui,sans-serif;font-size:15px;line-height:24px;min-height:36px;padding:4px 12px;border:1px solid var(--input);border-radius:10px;background:transparent;color:var(--foreground)}.ds-input::placeholder{color:var(--muted-foreground)}.ds-input:focus-visible{outline:2px solid var(--ring);outline-offset:2px}.ds-input:disabled{opacity:.5}" - }, - { - "name": "Navigation row", - "kind": "nav", - "description": "Workspace navigation row.", - "html": "", - "css": ".ds-nav{font-family:\"Geist Variable\",system-ui,sans-serif;font-size:15px;line-height:24px;display:flex;align-items:center;min-height:44px;padding:0 12px;border-radius:8px;color:var(--foreground);text-decoration:none}.ds-nav[aria-current=page],.ds-nav:hover,.ds-nav:active{background:var(--muted)}.ds-nav:focus-visible{outline:2px solid var(--ring)}" - }, - { - "name": "List group", - "kind": "card", - "refersTo": "card", - "description": "Grouped settings rows; avoid nested cards.", - "html": "
设备设置
", - "css": ".ds-card{font-family:\"Geist Variable\",system-ui,sans-serif;font-size:15px;line-height:24px;border:1px solid var(--border);border-radius:14px;padding:16px;background:var(--card);color:var(--foreground)}" - }, - { - "name": "Status chip", - "kind": "chip", - "description": "Labeled status; color supplements the words.", - "html": "等待确认", - "css": ".ds-chip{display:inline-flex;padding:2px 8px;border-radius:8px;background:var(--warning-soft);color:var(--warning);font-size:13px;line-height:20px}" - } + "states": [ + "loading", + "empty", + "offline", + "streaming", + "waiting", + "recovery", + "failed", + "unknown result", + "disabled", + "keyboard focus", + "long text" ], - "narrative": { - "northStar": "Quiet personal workspace", - "overview": "**Creative North Star: \"Quiet personal workspace\"**\n\nThis description records the incumbent interface; the source tokens below define the system.\n\nThe web app is an Operate surface. It keeps attention on the current conversation or task while the sidebar provides stable orientation. Geist, cool neutral surfaces, and a restrained violet brand accent make state changes legible without turning the workspace into a dashboard of competing signals.\n\n**Key Characteristics:** calm, task-first, state-explicit, keyboard-friendly, responsive.", - "keyCharacteristics": [ - "calm", - "task-first", - "state-explicit", - "keyboard-friendly", - "responsive" - ], - "rules": [], - "dos": [ - "Do keep the primary task visible in the middle column.", - "Do make recovery, waiting, and offline states explicit in words.", - "Do reuse `packages/theme/theme.css` and the existing UI primitives.", - "Do preserve keyboard order and 44px mobile hit areas.", - "Do keep task metrics contextual to the task overview; the existing 28px metric masthead is not a conversation pattern.", - "Do retain the existing Bot identity halo and task overview gradient as incumbent patterns; additions require a surface-specific reason." - ], - "donts": [ - "Don't use color alone for status.", - "Don't create one-off spacing or component variants when an existing primitive fits." - ] - } + "verification": "source provenance guard, TypeScript, behavior tests, real production build; browser acceptance only on explicit request" } diff --git a/apps/app/.impeccable/surfaces/workspace.md b/apps/app/.impeccable/surfaces/workspace.md index c40bc17c5..afa738aa3 100644 --- a/apps/app/.impeccable/surfaces/workspace.md +++ b/apps/app/.impeccable/surfaces/workspace.md @@ -1,38 +1,13 @@ -# Web 工作区 +# Web workspace -## Mode +Mode: operate. The person reads the current Bot, task or channel, reviews states that need attention, and performs the next action. -Operate +Arc at `859606819c68787b2dccb54adcb9b08bd3272d5d` is the only UI authority. `src/components/arc/source.json` maps product compositions to pinned items. `packages/theme/theme.css` derives semantic colors, typography, radii and motion from foundation. The theme attribute is `data-theme`; Inter is the body face, Geist the display face and Geist Mono the code face. -## Job +The desktop sidebar rail lists real channels and Bots. Narrow screens retain messages, tasks and settings tabs and use an Arc navigation drawer. Conversation and task inspectors have separate scroll areas. Task overview uses real counts and record grouping, with no decorative hero. Settings and devices group related rows and actual controls. Joining and recovery preserve code checks and consequences. -让个人快速看懂当前 Bot/任务状态,并完成下一步操作。 +Preserve product copy, route ownership, keyboard actions, async status, retained drafts, attachment validation and verified download. Preserve unknown results until reconciliation. Do not replace operations with showcase activity or computed fake progress. Every region must represent loading, empty, offline, waiting, recovery, failure, disabled state and long values. -## Reading order +Arc controls own their appearance. Product CSS Modules own layout and domain presentation. Arc foundation owns keyboard focus; all motion respects reduced-motion preferences. Native video capture and hidden attachment picking remain browser accommodations. -1. 当前上下文(Bot、任务或频道) -2. 需要注意的等待、错误或恢复状态 -3. 对话/任务内容 -4. 一个明确的下一步动作 - -## Preserve - -- 侧栏导航、键盘顺序、消息与任务的独立上下文 -- 未知写入结果先对账的文案和状态 -- 现有主题、Bot face、焦点环和响应式断点 - -## Quieting and layout decisions - -- 让标题、上下文和动作共享同一中列对齐线。 -- 使用邻近关系和分隔线表达列表分组,避免增加嵌套卡片。 -- 保留等待、恢复、离线的颜色,但始终配合文字或图标。 -- 页面只保留一个主任务路径;辅助动作进入现有 header action slot。 -- 宽屏使用侧栏,窄屏使用返回和抽屉;不引入新的导航模式。 - -## Required states - -loading, empty, offline, waiting, recovery, failed, keyboard focus, narrow viewport, long text. - -## Acceptance evidence - -浏览器渲染检查需覆盖宽屏、窄屏、深色模式、键盘焦点、长文本和待处理状态。 +Verification uses source audit, TypeScript, existing behavior tests and a real production build. Project policy reserves screenshots, e2e and browser acceptance for an explicit user request; no visual acceptance is implied by source review or compilation. diff --git a/apps/app/DESIGN.md b/apps/app/DESIGN.md index a631505b0..fb34ebd77 100644 --- a/apps/app/DESIGN.md +++ b/apps/app/DESIGN.md @@ -1,108 +1,19 @@ ---- -name: Vibeface Web App -description: A focused workspace for conversations, tasks, devices, and recovery. -colors: - background-light: "oklch(1 0 0)" - background-dark: "oklch(0.175 0.006 270)" - foreground-light: "oklch(0.21 0.012 270)" - foreground-dark: "oklch(0.955 0.004 270)" - primary-light: "oklch(0.24 0.016 270)" - primary-foreground-light: "oklch(0.985 0.002 270)" - primary-dark: "oklch(0.94 0.005 270)" - primary-foreground-dark: "oklch(0.2 0.01 270)" - brand-light: "oklch(0.53 0.2 280)" - brand-dark: "oklch(0.72 0.15 280)" - muted-light: "oklch(0.965 0.004 270)" - muted-dark: "oklch(0.245 0.008 270)" - danger-light: "oklch(0.54 0.2 27)" - danger-dark: "oklch(0.72 0.17 25)" -typography: - title: - fontSize: "20px" - fontWeight: 600 - lineHeight: "28px" - heading: - fontSize: "16px" - lineHeight: "24px" - task-metric: - fontSize: "28px" - badge: - fontSize: "11px" - body: - fontFamily: "Geist Variable, -apple-system, BlinkMacSystemFont, PingFang SC, Hiragino Sans GB, Microsoft YaHei, system-ui, sans-serif" - fontSize: "15px" - lineHeight: "24px" - meta: - fontFamily: "Geist Variable, -apple-system, BlinkMacSystemFont, PingFang SC, Hiragino Sans GB, Microsoft YaHei, system-ui, sans-serif" - fontSize: "13px" - lineHeight: "20px" -rounded: - base: "0.625rem" - control: "0.625rem" - inline-code: "4px" - xl: "0.875rem" -spacing: - unit: "4px" - page: "16px" -components: - button-primary: - backgroundColor: "{colors.primary-light}" - textColor: "{colors.primary-foreground-light}" - rounded: "{rounded.control}" - card: - backgroundColor: "{colors.background-light}" - rounded: "{rounded.xl}" ---- +# Vibeface Web design -# Design System: Vibeface Web App +The Web interface uses [Arc](https://github.com/WheatXie/uiarc-pro-reverse) at commit `859606819c68787b2dccb54adcb9b08bd3272d5d`. The pinned components and their hashes live in `packages/uiarc`. `packages/theme/theme.css` imports Arc foundation and exposes its semantic tokens. Do not add another component library or palette. -## Overview +Arc controls are imported directly from `@vibeface/uiarc//.tsx`. Product compositions live in `src/components/arc`. Their [source map](src/components/arc/source.json) records the upstream items they adapt. They bind actual route, conversation, device, recovery and task data. Demo people, model catalogs, messages and simulated progress must not enter product state. -**Creative North Star: "Quiet personal workspace"** +The interface uses Inter for body text and controls, Geist for display headings, and Geist Mono for code. Sizes come from the Arc scale, with 16px body text and 14px secondary text. Weights are 400 and 500. Controls use Arc's 18px radius; grouped panels use 26px and standalone surfaces use 34px. Components own their appearance through their pinned CSS Modules. App CSS owns arrangement, safe areas and product content. -This description records the incumbent interface; the source tokens below define the system. +Theme selection writes `data-theme="light"` or `data-theme="dark"` on `html`; the neutral accent is the default. Colors use background, surface, surface-raised, surface-muted, foreground, text-secondary, text-muted, border and status tokens. Accent identifies selected state or progress. Status color accompanies a label or an accessible icon. Arc foundation supplies keyboard focus treatment. -The web app is an Operate surface. It keeps attention on the current conversation or task while the sidebar provides stable orientation. Geist, cool neutral surfaces, and a restrained violet brand accent make state changes legible without turning the workspace into a dashboard of competing signals. +The desktop shell has an Arc sidebar rail with real channels, Bots, task attention and connection state. Narrow screens use an Arc drawer and preserve the existing messages, tasks and settings tabs. One workspace page container supplies the gutters. Conversation and task inspectors retain independent scrolling and readable long names. -**Key Characteristics:** calm, task-first, state-explicit, keyboard-friendly, responsive. +Conversation presentation derives from ai-chat, chat-thread and ai-composer. The composer keeps attachment selection and validation, Enter submission, Shift+Enter, stop, retained drafts and disabled explanations. A thread follows new content while at its end, preserves the visible history anchor while reading, and provides unread and latest-message navigation. Delivery uncertainty remains explicit. -## Colors +Task views use agent-run record grouping and agent-approvals decision structure. Task counts are actual records, never simulated progress. Unknown outcomes require reconciliation before another operation. Device and security forms use settings-page and security-settings grouping, with Arc fields, switches, checkboxes, select controls and drawers. Joining and recovery use Arc stepper, alerts and fields while retaining security-code verification and recovery consequences. -The shared source of truth is `packages/theme/theme.css`. Light mode uses white surfaces and cool near-black text; dark mode separates page, card, popover, and sidebar by tonal steps. Default buttons use the neutral `primary`/`primary-foreground` pair. Violet marks focus, selection, and brand identity; conversation send controls may use the current Bot tint. Success, warning, danger, and info colors communicate state and must be paired with text or icon labels. +Feedback has explicit loading, empty, error, offline, waiting, disabled and success states. Inline errors stay beside their action. Background notices preserve their action link and dismissal. Long identifiers can expand; filenames preserve their extension. Reduced motion and native safe-area handling apply throughout. -## Typography - -Geist Variable is the UI voice. The 15/24 body scale supports dense task reading; 13/20 metadata recedes without becoming inaccessible. Headings use tight tracking and balanced wrapping. Geist Mono is reserved for code, IDs, logs, and measurements. - -## Layout - -The workspace uses a persistent sidebar at wide widths and a single content column capped by `--page-width` (48rem). Header, page content, and task panels share the same alignment. Mobile collapses navigation and preserves 44px touch targets. Use `gap` and the existing 4px rhythm; keep generous separation between sections and tighter spacing within a control group. - -## Elevation & Depth - -Depth is tonal first. Light mode uses subtle `elevation-xs`/`elevation-sm` on interactive cards; dark mode uses surface contrast and outlines, reserving a larger shadow for floating layers. Do not stack a border and a broad shadow on ordinary cards. - -## Shapes - -The base radius is 10px, with 14px cards and 20px sheets where the component already establishes that language. Pills appear on compact status controls and the existing conversation starter suggestions. Focus is an inset or 2px ring derived from `--ring`. - -## Components - -- **Sidebar and navigation rows:** stable 40px desktop rows, 44px mobile rows, active state plus icon/label. -- **Interactive rows:** shared `interactive-row` utility for hover, focus, and pressed feedback. -- **Cards and list groups:** `bg-card`, border, and small elevation; list groups use dividers rather than nested cards. -- **Buttons and fields:** existing UI primitives provide variants, focus treatment, and mobile sizing. -- **EmptyState:** icon, concise heading, optional explanation, and one recovery action. -- **Task overview:** the existing masthead uses three metrics, a gradient, and soft blur. Review its populated and empty states before changing or extending it. -- **BotFace and status marks:** identity and state are reinforced by text or icons; color is never the only signal. - -## Do's and Don'ts - -- Do keep the primary task visible in the middle column. -- Do make recovery, waiting, and offline states explicit in words. -- Do reuse `packages/theme/theme.css` and the existing UI primitives. -- Do preserve keyboard order and 44px mobile hit areas. -- Do keep task metrics contextual to the task overview; the existing 28px metric masthead is not a conversation pattern. -- Do retain the existing Bot identity halo and task overview gradient as incumbent patterns; additions require a surface-specific reason. -- Don't use color alone for status. -- Don't create one-off spacing or component variants when an existing primitive fits. +Run `python3 scripts/check-uiarc.py`, the Web TypeScript check, existing behavior tests and the production build for changes to this system. Project policy reserves browser acceptance, screenshots and e2e runs for an explicit user request. Compilation does not establish visual acceptance. diff --git a/apps/app/MIGRATION.md b/apps/app/MIGRATION.md new file mode 100644 index 000000000..aebf8e9ee --- /dev/null +++ b/apps/app/MIGRATION.md @@ -0,0 +1,23 @@ +# Web Arc migration + +Authority: [WheatXie/uiarc-pro-reverse](https://github.com/WheatXie/uiarc-pro-reverse), commit `859606819c68787b2dccb54adcb9b08bd3272d5d`. Exact controls live in `packages/uiarc`; adapted product compositions are recorded in [source.json](src/components/arc/source.json). + +| Product region | Arc source | Integration | +| --- | --- | --- | +| Actions and navigation actions | button | Direct Arc variants and sizes; real anchors use the same CSS Module and retain href behavior | +| Submitted fields | input, textarea, select, checkbox | Real names, values, required state, handlers and validation; select keys round trip through a private prefix, including empty values | +| Immediate settings | switch, segmented-control | Real settings callbacks; no simulated saving | +| Desktop navigation and mobile drawer | sidebar, drawer | Real routes, Bots, channels, unread and waiting counts, connection, new Bot, messages/tasks/settings tabs | +| Messages and scroll history | ai-chat, chat-thread | Real transcript, streaming, delivery states, history anchors, unread and latest navigation | +| Composer | ai-composer, textarea, button, badge | Retained draft, attachment limits, Enter/Shift+Enter, stop and send callbacks | +| Work and task detail | agent-run, drawer, badge | Real state, revision, stop/continue, stale records, unknown outcome reconciliation and independent scrolling | +| Decisions | agent-approvals, alert, button | Existing allow, reject, answer, ignore, retry and confirmation actions | +| Devices and settings | settings-page, security-settings | Real directory, AI providers, folders, permissions, diagnostics, notifications and consequences | +| Joining and recovery | stepper, input, button, alert | Real invitation, safety code, scan video, passwords, recovery files and explicit decisions | +| Feedback | empty-state, skeleton, alert, badge | Real loading, empty, offline, disabled and failure states with nearby actions | + +The prior components/ui implementations, component registry configuration, CVA, shadcn, the umbrella Radix package and the previous animation stylesheet were removed. Arc's own scoped Radix dependencies remain inside its pinned controls. + +The task overview now uses a compact status summary and record grouping. Its old promotional heading, decorative glow and nested metric tiles were removed. Bot face artwork remains product data; it follows Arc's theme attribute. Controls no longer take a Bot-specific palette. + +Behavior verification uses existing product tests and the TypeScript compiler. The production build requires the real secure WebAssembly output built from the current source. Browser acceptance, screenshots and e2e are excluded unless the user explicitly requests them. CSS source inspection covers width constraints, min-width, wrapping, safe areas and reduced motion; it does not establish visual acceptance. diff --git a/apps/app/PRODUCT.md b/apps/app/PRODUCT.md index 3a685ac6c..fb8aa71d7 100644 --- a/apps/app/PRODUCT.md +++ b/apps/app/PRODUCT.md @@ -1,46 +1,17 @@ -# Product +# Vibeface Web product -## Platform +Vibeface gives one person a workspace for directing Bot work, reviewing outcomes, and managing their own connected devices. Accounts, devices, events, attachments, routes and commands stay within that person's network. -web +The Web app supports Bot conversations, task conversations, channels, decisions, device joining, recovery, AI configuration, notifications, diagnostics and file-transfer experiments. Shared product state and operations come from `@vibeface/client`. The UI must preserve their identities, revisions and delivery outcomes. -## Users +The three narrow-screen tabs are messages, tasks and settings. A wide-screen sidebar lists real channels and Bots, with task attention and connection status. Route and back-navigation behavior remains part of the product contract. -Individuals managing their own Bot conversations, tasks, devices, and recovery state. +Conversation sends retain their draft until the recorded outcome allows it to clear. Attachment download verifies the referenced size and SHA-256. A lost write response is an unknown result; the person must reconcile it before retrying. Reconnecting or refreshing history must not replay a side effect. Task stop, approval, retry and continuation actions use the existing operations and their original identifiers. -## Product Purpose +Devices belong to the person, with explicit management rights. Removing a device, withdrawing a manager or leaving a browser retains its consequence text and confirmation. The only manager cannot leave before another management device is available. Joining verifies the safety code. Recovery retains the original password, file, lost-device and waiting-state rules. -Vibeface gives one person a safe workspace for directing Bot work, reviewing outcomes, and keeping connected devices under personal control. Success means the person can understand what is waiting, act on it, and recover from uncertain delivery without repeating a side effect. +[Arc](https://github.com/WheatXie/uiarc-pro-reverse), pinned at `859606819c68787b2dccb54adcb9b08bd3272d5d`, is the only interface system. Product compositions adapt its sidebar, conversation, agent, settings and security items to real state. They do not introduce demo activity. See [DESIGN.md](DESIGN.md) and [MIGRATION.md](MIGRATION.md) for the source mapping and verification boundaries. -## Positioning - -The workspace separates Bot conversations from device identity and delivery state while keeping their causal context visible. - -## Operating Context - -People use the web app as a desktop or mobile browser workspace. The sidebar, inbox, task views, device views, and conversation screens are the primary operating surfaces. - -## Capabilities and Constraints - -The app supports Bot conversations, tasks, channels, inbox decisions, device joining, recovery, settings, and local/offline state. Account, device, event, attachment, route, and command data stays within the person's network. Unknown write results must be reconciled before retrying. - -## Brand Commitments - -The product name is Vibeface. Existing Bot faces and the shared cool-neutral/violet theme are retained. - -## Evidence on Hand - -Routes and components under `apps/app/src/`, shared semantic tokens in `packages/theme/theme.css`, and existing accessibility and reduced-motion handling. - -## Product Principles - -- Make the current task and its state easy to understand. -- Keep personal network and device boundaries explicit. -- Never imply a write succeeded when its result is unknown. -- Prefer one clear recovery action over decorative complexity. - -## Accessibility & Inclusion - -Keyboard focus, reduced motion, safe areas, readable metadata, visible labels, and touch-sized controls are product requirements. +The experience must account for loading, empty results, offline records, waiting decisions, unknown outcomes, long text, reduced motion and keyboard use. Product copy names the consequence and next action. UI implementation details do not belong in the person's workflow. diff --git a/apps/app/components.json b/apps/app/components.json deleted file mode 100644 index f7f12bf48..000000000 --- a/apps/app/components.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "$schema": "https://ui.shadcn.com/schema.json", - "style": "radix-nova", - "rsc": false, - "tsx": true, - "tailwind": { - "config": "", - "css": "src/styles.css", - "baseColor": "neutral", - "cssVariables": true, - "prefix": "" - }, - "iconLibrary": "lucide", - "rtl": false, - "aliases": { - "components": "#components", - "utils": "@/lib/utils", - "ui": "#components/ui", - "lib": "@/lib", - "hooks": "#hooks" - }, - "menuColor": "default", - "menuAccent": "subtle", - "registries": {} -} diff --git a/apps/app/package.json b/apps/app/package.json index 0bb87c546..e4439b09c 100644 --- a/apps/app/package.json +++ b/apps/app/package.json @@ -17,21 +17,17 @@ "dependencies": { "@fontsource-variable/geist": "^5.3.0", "@fontsource-variable/geist-mono": "^5.3.0", - "@shadcn/react": "^0.3.1", "@tanstack/react-router": "1.170.45", "@tanstack/react-start": "1.169.3", "@vibeface/client": "workspace:*", "@vibeface/theme": "workspace:*", - "class-variance-authority": "^0.7.1", - "cn": "^0.5.0", "lucide-react": "^1.58.0", "markdown-it": "^14.3.3", "qrcode-generator": "2.0.4", - "radix-ui": "^1.8.1", - "react": "^19.2.0", - "react-dom": "^19.2.0", - "shadcn": "^4.22.0", - "tw-animate-css": "^1.4.0" + "react": "19.3.1", + "react-dom": "19.3.1", + "@vibeface/uiarc": "workspace:*", + "@fontsource-variable/inter": "^5.2.8" }, "devDependencies": { "@tailwindcss/vite": "^4.3.3", diff --git a/apps/app/src/components/app/bot-face.tsx b/apps/app/src/components/app/bot-face.tsx index fcbc20b6e..f388ae398 100644 --- a/apps/app/src/components/app/bot-face.tsx +++ b/apps/app/src/components/app/bot-face.tsx @@ -1,13 +1,13 @@ "use client" -import { useEffect, useId, useMemo, useRef, useState, useSyncExternalStore } from "react" -import { colors, faceOf, HALO, oklch, pose, thinkingDots, type Mood } from "@vibeface/client/avatar/face.ts" -import { ASLEEP, faceMotion, type Frame } from "@vibeface/client/avatar/motion.ts" +import { cn } from "@/lib/utils" +import { colors,faceOf,HALO,pose,thinkingDots,type Mood } from "@vibeface/client/avatar/face.ts" import { moodOf } from "@vibeface/client/avatar/mood.ts" +import { ASLEEP,faceMotion,type Frame } from "@vibeface/client/avatar/motion.ts" import type { useWorkspace } from "@vibeface/client/workspace/context.tsx" import { questionOpen } from "@vibeface/client/workspace/questions.ts" import type { BotRecord } from "@vibeface/client/workspace/types.ts" -import { cn } from "@/lib/utils" +import { useEffect,useId,useMemo,useRef,useState,useSyncExternalStore } from "react" /** * One clock for every face in view. It stops while the tab is hidden or the system asks for reduced motion; a face @@ -32,18 +32,10 @@ const followReduced = (change: () => void) => { } const followDark = (change: () => void) => { const observer = new MutationObserver(change) - observer.observe(document.documentElement, { attributes: true, attributeFilter: ["class"] }) + observer.observe(document.documentElement, { attributes: true, attributeFilter: ["data-theme"] }) return () => observer.disconnect() } -export const useDark = () => useSyncExternalStore(followDark, () => document.documentElement.classList.contains("dark"), () => false) - -/** A bot's face hue as a solid fill with legible ink on it, a soft edge for outlines, and a bright glow that stays that hue when faded, so its chat's accents read as that bot's. Same numbers as the phone app. */ -export function botTint(hue: number, dark: boolean) { - const glow = oklch(0.74, 0.14, hue) - return dark - ? { fill: oklch(0.78, 0.09, hue), ink: oklch(0.2, 0.03, hue), edge: oklch(0.42, 0.05, hue), glow } - : { fill: oklch(0.45, 0.1, hue), ink: "#fff", edge: oklch(0.86, 0.04, hue), glow } -} +export const useDark = () => useSyncExternalStore(followDark, () => document.documentElement.dataset.theme === "dark", () => false) function apply(frame: Frame, parts: { g: SVGGElement; ring: SVGPathElement; body: SVGPathElement; grey: SVGPathElement; left: SVGPathElement; right: SVGPathElement; dots: SVGCircleElement[] }) { parts.g.setAttribute("transform", transformOf(frame)) @@ -62,8 +54,8 @@ const transformOf = (frame: Frame) => `translate(${50 + frame.dx} ${50 + frame.d /** Who a face belongs to: its id gives what `avatar` leaves out. */ type FaceBot = Pick -/** A bot's face, picked by its id and avatar and moving with its mood. Hidden from screen readers: the name next to it says who, and lists say the mood. `halo`: a still glow in the bot's tint behind the face, 1.8 times its size. `still` draws one frame and leaves the clock, for previews. */ -export function BotFace({ bot, mood, size, halo, still, className }: { bot: FaceBot; mood: Mood; size: number; halo?: string; still?: boolean; className?: string }) { +/** A bot's identity artwork follows its mood. `still` draws one frame for previews. */ +export function BotFace({ bot, mood, size, still, className }: { bot: FaceBot; mood: Mood; size: number; still?: boolean; className?: string }) { const dark = useDark() const reduced = useSyncExternalStore(followReduced, () => reducedQuery?.matches ?? false, () => false) const { bot_id: botId, avatar } = bot @@ -100,12 +92,7 @@ export function BotFace({ bot, mood, size, halo, still, className }: { bot: Face )} - {halo ? - - - : null} - {halo ? : null} diff --git a/apps/app/src/components/app/kit.tsx b/apps/app/src/components/app/kit.tsx deleted file mode 100644 index 8deb0ec2a..000000000 --- a/apps/app/src/components/app/kit.tsx +++ /dev/null @@ -1,438 +0,0 @@ -"use client" - -import { createContext, useCallback, useContext, useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore, type ComponentProps, type CSSProperties, type KeyboardEvent, type ReactNode, type Ref } from "react" -import { createPortal } from "react-dom" -import { ChevronDown, ChevronRight, CircleAlert, CircleCheck, Eye, EyeOff, Info, LoaderCircle, TriangleAlert, Upload, X, type LucideIcon } from "lucide-react" -import { cn } from "@/lib/utils" -import { terms } from "@/lib/glossary" -import { Button } from "@/components/ui/button" -import { Input } from "@/components/ui/input" -import { messageOf } from "@vibeface/client/lib/node.ts" -import { rawError } from "@vibeface/client/lib/errors.ts" - -export type Tone = "neutral" | "success" | "warning" | "danger" | "info" - -export const toneText: Record = { - neutral: "text-muted-foreground", success: "text-success", warning: "text-warning", danger: "text-danger", info: "text-info", -} -const toneSurface: Record = { - neutral: "border-border bg-card", success: "border-success-border bg-success-soft", warning: "border-warning-border bg-warning-soft", - danger: "border-danger-border bg-danger-soft", info: "border-info-border bg-info-soft", -} -/** A card keeps the page's surface; the tone washes in from its top edge and tints the border. */ -const toneCard: Record = { - neutral: "border-border bg-card", success: "border-success-border bg-linear-to-b from-success-soft to-card to-[5rem]", - warning: "border-warning-border bg-linear-to-b from-warning-soft to-card to-[5rem]", danger: "border-danger-border bg-linear-to-b from-danger-soft to-card to-[5rem]", - info: "border-info-border bg-linear-to-b from-info-soft to-card to-[5rem]", -} -const toneChip: Record = { - neutral: "bg-muted text-muted-foreground", success: "bg-success-soft text-success ring-1 ring-success-border", warning: "bg-warning-soft text-warning ring-1 ring-warning-border", - danger: "bg-danger-soft text-danger ring-1 ring-danger-border", info: "bg-info-soft text-info ring-1 ring-info-border", -} - -/** The Vibeface "V" in its rounded tile, as on the app icon. */ -function BrandMark({ className }: { className?: string }) { - return -} - -/** `large`: the join and create pages, where it stands alone over the form. */ -export function Wordmark({ className, large = false }: { className?: string; large?: boolean }) { - return Vibeface -} - -/** The primary bot's star. Alone, its name shows on hover and to screen readers; `labeled` writes it out. */ -export function PrimaryMark({ labeled = false }: { labeled?: boolean }) { - const { label, icon: Icon } = terms.primaryBot - return labeled - ? - : -} - -/** Unread or waiting count, in the brand violet. */ -export function CountBadge({ count, label, className }: { count: number; label?: string; className?: string }) { - return {count} -} - -/** Brand for news; warning for something that needs a look. */ -export function Dot({ tone = "brand", label, className }: { tone?: "brand" | "warning"; label?: string; className?: string }) { - return -} - -/** The header's trailing slot, set by the shell. */ -export const PageActionsSlot = createContext(null) -/** Puts a page's own actions on the right of the page header, next to the shell's buttons. */ -export function PageActions({ children }: { children: ReactNode }) { - const slot = useContext(PageActionsSlot) - return slot ? createPortal(children, slot) : null -} - -export function EmptyState({ icon: Icon, title, description, action, className }: { icon: LucideIcon; title: string; description?: string; action?: ReactNode; className?: string }) { - return
- -

{title}

- {description ?

{description}

: null} - {action ?
{action}
: null} -
-} - -const stepCount = 5 -/** Progress through first-time setup, shared by the connection screen and onboarding. */ -export function Steps({ step }: { step: number }) { - return
-
-} - -/** - * The page around connecting, setup and recovery. On wider screens the card sits on a tinted page at a fixed height, - * so the brand and step bar stay put while cards of different heights follow one another. - */ -export function AuthPage({ header, children }: { header?: ReactNode; children: ReactNode }) { - return
-
-
{header}
- {children} -
-
-} - -// For an element that replaces the control just pressed: focus would otherwise fall to . -export function claimFocus(node: HTMLElement | null) { - const active = node?.ownerDocument.activeElement - if (node && (!active || active === node.ownerDocument.body)) node.focus({ preventScroll: true }) -} - -/** One step of first-time setup: a raised card under an icon title. */ -export function Panel({ icon: Icon, title, busy = false, children }: { icon: LucideIcon; title: string; busy?: boolean; children: ReactNode }) { - // A phone has no room for a frame inside the page's own margins, so there the card is only its content. - return
-

{title}

- {children} -
-} - -/** A settings section: a short caption over one card of rows, with an optional note under it. */ -export function SettingsGroup({ title, footer, children, className }: { title?: string; footer?: ReactNode; children: ReactNode; className?: string }) { - return
- {title ?

{title}

: null} -
{children}
- {footer ?

{footer}

: null} -
-} - -const rowTile: Record<"neutral" | "success" | "danger", string> = { neutral: "bg-muted text-muted-foreground", success: "bg-success-soft text-success", danger: "bg-danger-soft text-danger" } -const rowLayout = "flex min-h-14 w-full min-w-0 flex-wrap items-center gap-x-3 gap-y-2 px-4 py-2.5 text-start" - -function RowLead({ icon: Icon, label, description, tone = "neutral" }: { icon: LucideIcon; label: ReactNode; description?: ReactNode; tone?: keyof typeof rowTile }) { - return <> - - - {label} - {description ? {description} : null} - - -} - -/** One settings row: icon, label, then its value or control at the end. With `onClick` the whole row is a button; `expanded` marks one that folds out below itself. */ -/** `stacked`: on a phone the control gets its own full line under the label, lined up with it. */ -export function SettingsRow({ id, icon, label, description, tone, children, onClick, expanded, className, stacked = false, ref }: { - id?: string; icon: LucideIcon; label: ReactNode; description?: ReactNode; tone?: keyof typeof rowTile; children?: ReactNode; onClick?: () => void; expanded?: boolean; className?: string; stacked?: boolean; ref?: Ref -}) { - const end = children ? {children} : null - if (onClick) return - return
{end}
-} - -/** A row that folds out what it holds below itself, inside the same card. */ -export function SettingsDisclosure({ icon, label, value, open, children }: { icon: LucideIcon; label: ReactNode; value?: ReactNode; open?: boolean; children: ReactNode }) { - return
- - - {value ? {value} : null} - -
{children}
-
-} - -/** - * A short set of mutually exclusive options on a muted track. - * On a phone, options with icons show only the icon; pair it with `SegmentedValue` so the choice still reads in words. - * `labels` keeps the words on a phone too, for options an icon alone can't explain. - */ -export function Segmented({ label, value, options, onChange, disabled, labels = false, fill = false }: { - label: string; value: T; options: Array<{ value: T; label: string; icon?: LucideIcon }>; onChange(value: T): void; disabled?: boolean; labels?: boolean - /** On a phone, spread the options evenly across the full width. */ fill?: boolean -}) { - // WAI-ARIA radio group: one Tab stop on the checked option, arrows move and select. - const tabStop = options.some((option) => option.value === value) ? value : options[0]?.value - const move = (event: KeyboardEvent) => { - const step = ({ ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1 } as Record)[event.key] - if (disabled || (!step && event.key !== "Home" && event.key !== "End")) return - event.preventDefault() - const radios = [...event.currentTarget.querySelectorAll("[role=radio]")] - const current = radios.indexOf(event.target as HTMLElement) - const next = event.key === "Home" ? 0 : event.key === "End" ? options.length - 1 : (current + step! + options.length) % options.length - radios[next]?.focus() - if (options[next].value !== value) onChange(options[next].value) - } - // One thumb slides to the checked option; it is measured, since options differ in width and the track may wrap. - const track = useRef(null) - const [thumb, setThumb] = useState() - useLayoutEffect(() => { - const element = track.current - if (!element) return - const place = () => { - const checked = element.querySelector("[aria-checked=true]") - setThumb(checked ? { width: checked.offsetWidth, height: checked.offsetHeight, translate: `${checked.offsetLeft}px ${checked.offsetTop}px` } : undefined) - } - place() - const resize = new ResizeObserver(place) - resize.observe(element) - return () => resize.disconnect() - }, [value]) - return
button]:flex-1 max-sm:[&>button]:px-2")}> - {thumb ?
-} - -/** The chosen option of a `Segmented` in words, shown only where the control shrinks to icons. */ -export function SegmentedValue({ value, options }: { value: T; options: Array<{ value: T; label: string }> }) { - return -} - -/** Same shape as the real layout; fades in only after 300ms to avoid flicker. */ -export function Skeleton({ className }: { className?: string }) { - return