editor is an AUP cross-device primitive, not a Web Device layout component and not a Web-only widget. It is one of the 18 names in AUP_PRIMITIVES and appears in every target's DeviceCaps.primitives map as native, webview, partial, or unsupported.
Contract
| Field | Value |
|---|---|
| Primitive name | editor |
| Layer | AUP cross-device primitive (AUP_PRIMITIVES) |
| Public status | experimental |
| Document capability | native (renderer present; public sample is local-only) |
| Shared degradation chain | editor → input → text (when unsupported) |
| Author entry | AUP tree / DSL · generic Markdown ::editor{…} |
| Document renderer / notes | renderer/primitives/editor.ts (textarea; readOnly only when boolean true in AUP props) |
| Showcase evidence | Composition pages using editor nodes |
When to use
Code or long-form edit surfaces on targets that implement editor.
When not to use
Do not claim collaborative editing, LSP, multiplayer, or write-back from a docs page.
Sample contract
| Field | Value |
|---|---|
| Purpose | Honest document-target editor control (local textarea only) |
| Boundaries | No LSP, no multiplayer, no AFS write, no IDE product promise |
| Author entry | ::editor{…} generic directive |
| Surface | Web Device document |
| Public status | experimental |
| Fallback / failure | When unsupported: chain to input → text; empty value → empty textarea |
| Verification | Routes below · arc --version = 2.0.0-beta.28 |
Document sample (local textarea)
Document registers an editor renderer. The sample below is an unbound control: typing changes only the browser textarea. Markdown attributes are strings — do not assume readOnly=true from MD attributes sets boolean true the way AUP JSON does. Prefer AUP JSON/DSL when you need a strict read-only prop.
Source:
::editor{id="docs-prim-editor" language="json" label="Example snippet" value="{ \"ok\": true }"}Rendered:
::editor{id="docs-prim-editor" language="json" label="Example snippet" value="{ "ok": true }"}
AUP JSON shape (interactive / when you need boolean readOnly):
{
"id": "snippet",
"type": "editor",
"props": {
"label": "Example",
"language": "json",
"readOnly": true,
"value": "{ \"ok\": true }\n"
}
}Failure and limits
| Situation | Expected result |
|---|---|
| Typing in the document sample | Local browser state only; no document/AFS write |
| Expecting LSP / multiplayer | Out of contract |
| Unsupported target | Degrades via editor → input → text |
MD readOnly="true" string | Not guaranteed to equal AUP boolean true |
Verification evidence
| Item | Value |
|---|---|
| Baseline | 2026-08-09 · arc --version → 2.0.0-beta.28 |
| Capability row | docs/aup/capability-matrix.md (internal, non-routed) · editor |
| Implementation | renderer/primitives/editor.ts; caps device-caps.ts; chain degradation.ts |
| Public routes | /en/docs/aup/primitives/editor/ · /zh/docs/aup/primitives/editor/ |
| Local run | arc service start --blocklet blocklets/arcblock --port 4900 · open routes; type stays local |
| Accept | Textarea renders with seed value; no network write; experimental status visible |
Evidence anchors
| Item | Value |
|---|---|
| Registry | 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 |
| Internal matrix | docs/aup/capability-matrix.md (internal, non-routed) |
| Taxonomy hub | Primitive taxonomy and evidence |
| Sample contract rules | Live examples: scope and contract |