跳到主要内容

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

`view` primitive

用可移植容器 primitive 表达结构、tabs 与 steps,不要把它当成 layout.aup 的站点 section。

view 是 AUP 跨设备 primitive,不是 Web Device 的 layout 组件,也不是 Web-only widget。它属于 AUP_PRIMITIVES 中的 18 个名称之一,并出现在每个 target 的 DeviceCaps.primitives map 中(取值为 native、webview、partial 或 unsupported)。

合同

字段值
Primitive 名称view
层级AUP 跨设备 primitive(AUP_PRIMITIVES)
公共状态released
Document 能力native
共享 degradation chain无(document 报告 native)
作者入口AUP tree · DSL · Markdown 容器指令(::::view、steps)
Document renderer / 备注renderer/primitives/view.ts(tabs / steps / card 模式)
Showcase 证据跨 Showcase 页组合;document 上 tabs 路径已验证

何时使用

需要语义容器、面板分组、mode=tabs 或 mode=steps,并希望其他设备也能解释时。

何时不要使用

不要把 view 当成 Web Device layout.aup 里 portal-header、content-card 等站点组件的替代。

Sample 合同

字段值
目的document target 上的静态 tabs chrome
边界无 session patch、无 exec、非 layout 组件 API
作者入口通用容器指令 ::::view
表面Web Device document
公共状态document 上 released
Fallback / 失败缺少 label 时无 tablist 可访问名;fence 深度错误会丢面板
验证下方路由 · arc --version = 2.0.0-beta.28

Document sample(tabs)

这是 document target 上未绑定的 view,mode="tabs"。切换 tab 只改变浏览器中可见面板,不会打开 AUP session,也不会写入内容。

源码:

markdown
::::view{id="docs-prim-view-tabs" mode="tabs" label="Package manager"}
:::view{label="pnpm"}
Install with `pnpm install`.
:::

:::view{label="npm"}
Install with `npm install`.
:::
::::

渲染:

Install with pnpm install.

Install with npm install.

外层 fence 的冒号数必须多于内层。合同同 Live 示例:范围与合同。

失败与限制

情形预期结果
叶节点 ::view 无正文空面板 / 无正文
外层 fence 冒号过少结构解析错误;面板可能丢失
tabs 容器无 labeltabs 仍渲染;tablist 可访问名缺失
把 tabs 当成 layout .web 组件错误表面——layout 组件走 layout.aup

Document sample(view 的 steps 模式)

通用 view 容器也支持 mode="steps"。Markdown 原生教程路径是 ::::steps / :::step(见 steps);二者最终都落到 document 的 view 渲染。

源码:

markdown
::::view{id="docs-prim-view-steps" mode="steps" label="Two checks"}
:::view{title="Check the surface"}
Confirm you are on the document target, not a layout section.
:::

:::view{title="Check the fence depth"}
Outer containers need more colons than nested ones.
:::
::::

渲染:

  1. Check the surface

    Confirm you are on the document target, not a layout section.

  2. Check the fence depth

    Outer containers need more colons than nested ones.

验证证据

项值
基线2026-08-09 · arc --version → 2.0.0-beta.28
能力行docs/aup/capability-matrix.md(内部,不对外路由)· view
实现providers/runtime/web-device/src/content-reader.ts(通用容器);renderer/primitives/view.ts(tabs / steps)
公开路由/en/docs/aup/primitives/view/ · /zh/docs/aup/primitives/view/
本地运行arc service start --blocklet blocklets/arcblock --port 4900,打开上述路由(桌面 + ~390px)
接受标准源码 fence 与渲染的 tabs/steps 一致;切换 tab 无网络写入;fence 错误不导致整页崩溃

证据锚点

项值
注册表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 示例:范围与合同

相关页面