time 是 AUP 跨设备 primitive,不是 Web Device 的 layout 组件,也不是 Web-only widget。它属于 AUP_PRIMITIVES 中的 18 个名称之一,并出现在每个 target 的 DeviceCaps.primitives map 中(取值为 native、webview、partial 或 unsupported)。
合同
| 字段 | 值 |
|---|---|
| Primitive 名称 | time |
| 层级 | AUP 跨设备 primitive(AUP_PRIMITIVES) |
| 公共状态 | experimental |
| Document 能力 | partial |
| 共享 degradation chain | time → text(unsupported 时) |
| 作者入口 | AUP tree / DSL · 通用 Markdown ::time{…} |
| Document renderer / 备注 | renderer/primitives/time.ts(<time> 元素;clock 模式在渲染时快照) |
| Showcase 证据 | blocklets/showcase-dsl/.aup/pages/time.aup |
何时使用
在支持的 target 上需要语义时间值(格式化展示、clock、countdown)时。
何时不要使用
不要在静态 document target 上声称滴答的 live 时钟。Document 是 partial:仅静态快照。
Sample 合同
| 字段 | 值 |
|---|---|
| 目的 | document 上静态 <time> 呈现(display 模式) |
| 边界 | 不在 document 上承诺 live 时钟;无 picker session |
| 作者入口 | ::time{…} |
| 表面 | Web Device document(partial) |
| 公共状态 | experimental |
| Fallback / 失败 | 缺 value → 空展示;unsupported → text chain;clock 模式为预渲染快照 |
| 验证 | 下方路由 · arc --version = 2.0.0-beta.28 |
Document sample(display 模式)
源码:
::time{id="docs-prim-time-display" mode="display" value="2026-02-21T14:30:00Z"}渲染:
交互 clock/countdown 请在 Showcase time 验收,不要当作 docs live ticker。
失败与限制
| 情形 | 预期结果 |
|---|---|
document 上 mode="clock" | 预渲染/请求时快照——不是连续客户端 ticker |
display 模式缺 value | 空时间文本 |
| unsupported target | chain 到 text |
| 当作日期选择器 | 超出合同 |
验证证据
| 项 | 值 |
|---|---|
| 基线 | 2026-08-09 · arc --version → 2.0.0-beta.28 |
| 能力行 | docs/aup/capability-matrix.md(内部,不对外路由)· time |
| 实现 | renderer/primitives/time.ts;caps partial 见 device-caps.ts |
| 公开路由 | /en/docs/aup/primitives/time/ · /zh/docs/aup/primitives/time/ |
| 本地运行 | arc service start --blocklet blocklets/arcblock --port 4900 · 打开路由;确认静态 <time> 文本 |
| 接受标准 | display sample 显示格式化时间;页面声明 partial / 无 live 时钟 |
证据锚点
| 项 | 值 |
|---|---|
| 注册表 | 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 示例:范围与合同 |