跳到主要內容

Sample contract · AUP cross-device · ARC 2.0.0-beta.28

`editor` primitive

Editor can render on document as a local textarea; do not promise a writable IDE or AFS write-back.

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

FieldValue
Primitive nameeditor
LayerAUP cross-device primitive (AUP_PRIMITIVES)
Public statusexperimental
Document capabilitynative (renderer present; public sample is local-only)
Shared degradation chaineditor → input → text (when unsupported)
Author entryAUP tree / DSL · generic Markdown ::editor{…}
Document renderer / notesrenderer/primitives/editor.ts (textarea; readOnly only when boolean true in AUP props)
Showcase evidenceComposition 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

FieldValue
PurposeHonest document-target editor control (local textarea only)
BoundariesNo LSP, no multiplayer, no AFS write, no IDE product promise
Author entry::editor{…} generic directive
SurfaceWeb Device document
Public statusexperimental
Fallback / failureWhen unsupported: chain to input → text; empty value → empty textarea
VerificationRoutes 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:

markdown
::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):

json
{
  "id": "snippet",
  "type": "editor",
  "props": {
    "label": "Example",
    "language": "json",
    "readOnly": true,
    "value": "{ \"ok\": true }\n"
  }
}

Failure and limits

SituationExpected result
Typing in the document sampleLocal browser state only; no document/AFS write
Expecting LSP / multiplayerOut of contract
Unsupported targetDegrades via editor → input → text
MD readOnly="true" stringNot guaranteed to equal AUP boolean true

Verification evidence

ItemValue
Baseline2026-08-09 · arc --version → 2.0.0-beta.28
Capability rowdocs/aup/capability-matrix.md (internal, non-routed) · editor
Implementationrenderer/primitives/editor.ts; caps device-caps.ts; chain degradation.ts
Public routes/en/docs/aup/primitives/editor/ · /zh/docs/aup/primitives/editor/
Local runarc service start --blocklet blocklets/arcblock --port 4900 · open routes; type stays local
AcceptTextarea renders with seed value; no network write; experimental status visible

Evidence anchors

ItemValue
Registrypackages/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
Internal matrixdocs/aup/capability-matrix.md (internal, non-routed)
Taxonomy hubPrimitive taxonomy and evidence
Sample contract rulesLive examples: scope and contract

Nearby pages