input 是 AUP 跨设备 primitive,不是 Web Device 的 layout 组件,也不是 Web-only widget。它属于 AUP_PRIMITIVES 中的 18 个名称之一,并出现在每个 target 的 DeviceCaps.primitives map 中(取值为 native、webview、partial 或 unsupported)。
合同
| 字段 | 值 |
|---|---|
| Primitive 名称 | input |
| 层级 | AUP 跨设备 primitive(AUP_PRIMITIVES) |
| 公共状态 | released |
| Document 能力 | native |
| 共享 degradation chain | 无(document 报告 native) |
| 作者入口 | AUP tree · Markdown ::input{…}(通用指令 → type) |
| Document renderer / 备注 | renderer/primitives/input.ts;content-reader id 提升(arc#3321) |
| Showcase 证据 | form-* Showcase 页;document 路径在 live-example-contract 已验证 |
何时使用
需要作为语义节点的表单控件(text、select、checkbox 等)时。
何时不要使用
不要在公开 docs 页放入 bind、多字段表单或 session 写入。每个字段给出显式 id。
Sample 合同
| 字段 | 值 |
|---|---|
| 目的 | document target 上未绑定的 input |
| 边界 | 无 bind、session patch、AFS 写入、exec 或多字段表单产品承诺 |
| 作者入口 | ::input{…} |
| 表面 | Web Device document |
| 公共状态 | released |
| Fallback / 失败 | 缺 id → 同页字段 DOM id 不稳定;未知 type 可能降级呈现 |
| 验证 | 下方路由 · arc --version = 2.0.0-beta.28 |
Document sample(未绑定文本输入)
该字段是未绑定的 AUP input。输入只改变浏览器表单控件,不会写入文档、manifest、AFS 记录或 session 设置。
源码:
::input{id="docs-prim-input-name" type="text" label="Name" placeholder="Type only in this example" value="Ada"}渲染:
附加控件(checkbox)
源码:
::input{id="docs-prim-input-ack" type="checkbox" label="I understand this stays local"}渲染:
完整共享合同:Live 示例:范围与合同。
失败与限制
| 情形 | 预期结果 |
|---|---|
::input 无 id | 字段仍渲染;同页 DOM id 不稳定 |
此处 Markdown 中的 bind / session 字段 | 不在本合同内;不要在 docs 页发明 |
| 带提交的多字段 live 表单 | 超出公开 docs 合同 |
| 窄屏 | 标签、控件与 placeholder 仍可读 |
验证证据
| 项 | 值 |
|---|---|
| 基线 | 2026-08-09 · arc --version → 2.0.0-beta.28 |
| 能力行 | docs/aup/capability-matrix.md(内部,不对外路由)· input · ::input |
| 实现 | content-reader.ts(id 提升);renderer/primitives/input.ts |
| 公开路由 | /en/docs/aup/primitives/input/ · /zh/docs/aup/primitives/input/ |
| 本地运行 | arc service start --blocklet blocklets/arcblock --port 4900 · 在字段中输入;刷新可能仅恢复浏览器表单状态 |
| 接受标准 | 源码与控件一致;输入保持本地;变更无网络写入 |
证据锚点
| 项 | 值 |
|---|---|
| 注册表 | packages/aup/src/aup-types.ts · AUP_PRIMITIVES |
| Document caps | providers/runtime/web-device/src/device-caps.ts · DEVICE_CAPS_DOCUMENT |
| Degradation | packages/aup/src/degradation.ts · DEGRADATION_CHAINS |
| 内部矩阵 | docs/aup/capability-matrix.md(内部,不对外路由) |
| Taxonomy hub | Primitive 类型分类与证据 |
| Sample 合同规则 | Live 示例:范围与合同 |