# Views

## Meaning

A View is a coherent semantic interaction composed from Parts. It describes experience meaning without describing framework pages, visual component trees, layout, styling, route handlers, or generated files.

## Canonical shape

A View may define:

- required Group membership;
- optional semantic role (`list`, `detail`, `form`, `dashboard`, `wizard`, or `search`);
- description;
- named `context` values;
- named tagged `parts`;
- named local `presentations`.

Example:

```yaml
views:
  orders.OrderDetails:
    group:
      $ref: "#/groups/orders"

    context:
      orderId:
        $ref: "#/properties/primitives/orders.OrderId"

    parts:
      details:
        kind: present
        source:
          port:
            $ref: "#/operations/orders.GetOrder"
            direction: output
            index: 0

    presentations:
      web:
        surface:
          $ref: "#/surfaces/web"
        layout: master-detail
        peers:
          - $ref: "#/views/orders.OrderList"
```

## View context

View context contains named reusable semantic values whose types are canonical `ValueRef`s.

A Part refers to context through a typed `ViewContextRef`:

```yaml
$ref: "#/views/orders.OrderDetails"
context: orderId
```

Runtime validation requires the referenced View and context name to exist. Interaction Part bindings are restricted to context owned by the same View.

## Parts

Parts are a closed tagged union of:

- `present` — reads Operation output meaning;
- `collect` — supplies Operation input meaning from collected values and/or View context;
- `invoke` — invokes an Operation using View context for required inputs.

See `parts.md` for the canonical shapes and validation rules.

## Local presentations

A View owns a named map of lightweight Presentation bindings. Each binding contains a Surface reference and may include portable layout intent:

```yaml
presentations:
  mobile:
    surface:
      $ref: "#/surfaces/mobile"
    layout: flow
```

`layout` is `flow` or `master-detail`. A `master-detail` binding requires at least one `peers` View reference; peers are invalid for other layouts. Presentation is not a root declaration and has no independent identity outside its owning View.

## Navigation

The previous Event-driven `ViewTransition` model remains removed. Portable navigation is now Application-owned: destinations reference Views and transitions connect destination names. URLs, route strings, framework pages and stack operations remain pack-owned.

## Boundaries

A View does not own transport endpoints, URLs, route strings, CLI commands, framework pages, component trees, layout, or styling.

Surface remains a reusable root declaration. View-local Presentation binds a View to a Surface without becoming a second root registry.
