跳到主要内容

Sample 合同 · AUP 跨设备 · ARC 2.0.0-beta.28

`input` primitive

在 document 上编写未绑定表单控件;不要在 docs 页放入 bind 与写入路径。

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 设置。

源码:

markdown
::input{id="docs-prim-input-name" type="text" label="Name" placeholder="Type only in this example" value="Ada"}

渲染:

附加控件(checkbox)

源码:

markdown
::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 capsproviders/runtime/web-device/src/device-caps.ts · DEVICE_CAPS_DOCUMENT
Degradationpackages/aup/src/degradation.ts · DEGRADATION_CHAINS
内部矩阵docs/aup/capability-matrix.md(内部,不对外路由)
Taxonomy hubPrimitive 类型分类与证据
Sample 合同规则Live 示例:范围与合同

相关页面