Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/agents/create-projection.md
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,10 @@ animated from the same view if time allows. The starter does this:
(old struck through, then new).
- Draw no summary line in any mode: the host's summary bar, along the bottom
of the view, counts each kind with its changes. Name the kinds in your
domain's words with `nouns` in `src/view.tsx`'s `options` (`false` leaves
out structure, such as containment drawn as boundaries), and state what
domain's words with `nouns` in `src/view.tsx`'s `options` (`false` hides a
kind's count, such as containment drawn as boundaries;
`{noun, distinct: item => key}` counts items that share a key once, such as
a tool's several schemas), and state what
counts can't say (`2 breaking changes`, `1 newly enforced`) as `facts`
computed from the document, each with the IDs it filters to.
- Say every change in words too (`ChangeFooter`, `sr-only` text), and let the
Expand Down
14 changes: 10 additions & 4 deletions docs/guides/renderer-kit-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,16 @@ not have to reinvent change emphasis, legends, summary bars, or styling rules:
`summary` automatically (`rendererSummary`), renderers never draw their own
summary or statistics row—just name your kinds and provide any domain facts:
- **Kinds:** pass `nouns` in view `options` or `mountRenderer`
(`MountOptions.nouns`: `{kind: {singular, plural}}`, `false` to omit
structural kinds like `contains`, or `relationships:kind` for a single
collection; listed kinds come first in order, and kinds with identical names
merge into one figure). When wording depends on document contents (such as
(`MountOptions.nouns`: `{kind: {singular, plural}}`, `false` to hide a
kind's count (structural kinds like `contains`), or `relationships:kind` for
a single collection; listed kinds come first in order, and kinds with
identical names merge into one figure). To count a kind's items by a key, so
items that share one count once, give it a `SummaryKindCount`:
`{'tool-schema': {noun: {singular: 'tool', plural: 'tools'}, distinct: item => item.data?.name}}`
counts distinct names on After, with names that arrived (`added`), left
(`removed`) or stayed with changed items (`modified`). The host counts kinds
itself, so the kit sends such a kind as a fact in its place, filtering to
the items it counts. When wording depends on document contents (such as
workspaces in the dependency graph), call
`useSummaryNouns(props.declareNouns, nouns)`. Unnamed kinds fall back to
`humanizeKind`.
Expand Down
19 changes: 10 additions & 9 deletions docs/reference/renderer-kit.md
Original file line number Diff line number Diff line change
Expand Up @@ -2483,7 +2483,7 @@ A renderer's legend: an optional title and its items; no items clears it.
### `rendererSummary`

```ts
rendererSummary(init: RendererEnvironment & { "focus"?: RendererFocus; "projection": RendererProjection } & { "after": Extraction; "before": Extraction; "comparison": Comparison; "comparisonMode"?: "animated" | "diff" | "side-by-side" | "swipe"; "mode": "comparison" } | RendererEnvironment & { "focus"?: RendererFocus; "projection": RendererProjection } & { "extraction": Extraction; "mode": "extraction" }, nouns?: Readonly<Record<string, SummaryNoun | false>> | undefined | { (kind: string, collection: "entities" | "relationships"): SummaryNoun | false | undefined }, facts?: Array<SummaryFactItem>): RendererSummary
rendererSummary(init: RendererEnvironment & { "focus"?: RendererFocus; "projection": RendererProjection } & { "after": Extraction; "before": Extraction; "comparison": Comparison; "comparisonMode"?: "animated" | "diff" | "side-by-side" | "swipe"; "mode": "comparison" } | RendererEnvironment & { "focus"?: RendererFocus; "projection": RendererProjection } & { "extraction": Extraction; "mode": "extraction" }, nouns?: Readonly<Record<string, SummaryKindCount | SummaryNoun | false>> | undefined | { (kind: string, collection: "entities" | "relationships"): SummaryKindCount | SummaryNoun | false | undefined }, facts?: Array<SummaryFactItem>): RendererSummary
```

The summary a kit renderer posts for a document: a figure per extraction kind with its counts, worded with the
Expand Down Expand Up @@ -3272,10 +3272,11 @@ A noun of the renderer's domain, for one item and for any other count: `{singula
### `SummaryNouns`

```ts
type SummaryNouns = Readonly<Record<string, SummaryNoun | false>> | { (kind: string, collection: "entities" | "relationships"): SummaryNoun | false | undefined }
type SummaryNouns = Readonly<Record<string, SummaryKindCount | SummaryNoun | false>> | { (kind: string, collection: "entities" | "relationships"): SummaryKindCount | SummaryNoun | false | undefined }
```

A renderer's words for kinds: a noun per kind, or `false` to leave a kind out of the summary. A key may name one
A renderer's words for kinds: a noun per kind, `false` to hide a kind's count (leave it out of the summary), or a
`SummaryKindCount` to count a kind's items by a key, so items that share one count once. A key may name one
collection's kind (`relationships:index`), which wins over the bare kind. As an object, the kinds it lists come
first, in its order; as a function (given the kind and its collection), `undefined` keeps the host's words.

Expand Down Expand Up @@ -3607,7 +3608,7 @@ A span of progress, centred on `time` and reaching `radius` either side: `[time
### `withDefinitionNouns`

```ts
withDefinitionNouns(items: Array<SummaryCountItem>, kinds: Record<string, RendererKind> | undefined): Array<SummaryCountItem>
withDefinitionNouns<T extends SummaryCountItem | SummaryFactItem>(items: Array<T>, kinds: Record<string, RendererKind> | undefined): Array<T>
```

Count figures worded with the definition's nouns (`presentation.kinds.<kind>.noun`, sent as
Expand Down Expand Up @@ -4042,7 +4043,7 @@ Everything but the renderer props is optional; the defaults draw every entity as
| `compound` | `"compound"?: Array<string> \| false \| true` | Group containment-only entities into boundaries: `true` for modules (architecture), or the kinds that may become boundaries. |
| `controls` | `"controls": Record<string, false \| number \| string \| true>` | The value of every declared control (from `MountOptions.controls` or `declareControls`), defaults filled in. The host draws the controls and sends their values; renderers draw no settings controls of their own. |
| `declareControls` | `"declareControls": { (controls: Array<ControlBase & { "choices": Array<{ "label": string; "value": string }>; "default": string; "type": "choice" } \| ControlBase & { "default": false \| true; "type": "toggle" } \| ControlBase & { "default": number; "max": number; "min": number; "step": number; "type": "range"; "unit"?: string } \| ControlBase & { "icon"?: "collapse" \| "download" \| "expand" \| "filter" \| "fit" \| "next" \| "previous" \| "reset" \| "search" \| "settings" \| "zoom-in" \| "zoom-out"; "type": "action" }>): void }` | Replaces the declared controls, for controls that depend on the document (for example a filter listing its kinds). Repeated identical declarations are ignored. |
| `declareNouns` | `"declareNouns": { (nouns: Readonly<Record<string, SummaryNoun \| false>> \| undefined \| { (kind: string, collection: "entities" \| "relationships"): SummaryNoun \| false \| undefined }): void }` | Names the document's kinds in the host's summary bar, replacing `MountOptions.nouns` (see `useSummaryNouns`). The shell counts every kind and posts the summary itself; without nouns, the host words kinds from their names. |
| `declareNouns` | `"declareNouns": { (nouns: Readonly<Record<string, SummaryKindCount \| SummaryNoun \| false>> \| undefined \| { (kind: string, collection: "entities" \| "relationships"): SummaryKindCount \| SummaryNoun \| false \| undefined }): void }` | Names the document's kinds in the host's summary bar, replacing `MountOptions.nouns` (see `useSummaryNouns`). The shell counts every kind and posts the summary itself; without nouns, the host words kinds from their names. |
| `describeStatus` | `"describeStatus"?: undefined \| { (node: TransitionNode): Array<StatusPart> \| undefined }` | The domain's wording of a row's change in its status footer and accessible name (see `StatusPart`). |
| `detail` | `"detail"?: undefined \| { (entity: Entity): string \| undefined }` | A short code identifier drawn in monospace at the right of a card's kind line, such as a package version. When it differs between revisions, the two crossfade with the card's own step. |
| `diff` | `"diff": false \| true` | Whether the host presents this comparison in `diff` mode: one static frame showing both subjects, with no progress (`progress` stays 1 and `schedule` is empty). Draw the renderer's own static comparison; `highlighting` is the host's change emphasis for it (1 unless the host turned highlighting off). |
Expand Down Expand Up @@ -4204,7 +4205,7 @@ How `mountRenderer` connects a renderer component to its host.
| `facts` | `"facts"?: SummaryFacts` | The renderer's domain facts for the host's summary bar (`SummaryFacts`), computed from the document and the control values whenever either changes, and posted after the kind counts. A renderer draws no summary line of its own: what it would count goes here. |
| `interactions` | `"interactions"?: false` | Hover, anchors, scroll mirroring, the host's filter and annotation badges through `connectInteractions` over elements carrying `data-entity-id` (default on). `false` opts out and declares none of the interaction capabilities. |
| `name` | `"name": string` | Bundle name, used for `data-renderer` on the root element. |
| `nouns` | `"nouns"?: Readonly<Record<string, SummaryNoun \| false>> \| { (kind: string, collection: "entities" \| "relationships"): SummaryNoun \| false \| undefined }` | The renderer's words for extraction kinds in the host's summary bar (`SummaryNouns`), for every document; see `declareNouns` for words that depend on the document. |
| `nouns` | `"nouns"?: Readonly<Record<string, SummaryKindCount \| SummaryNoun \| false>> \| { (kind: string, collection: "entities" \| "relationships"): SummaryKindCount \| SummaryNoun \| false \| undefined }` | The renderer's words for extraction kinds in the host's summary bar (`SummaryNouns`), for every document; see `declareNouns` for words that depend on the document. |
| `scope` | `"scope"?: { "context"?: { (all: ComparisonModel<Extraction>, changes: ReadonlySet<string>, renderer: string): Iterable<string, any, any> }; "layout": "subset"; "parts"?: "fold" \| "omit" \| "whole" } \| { "layout": "fold" }` | How the Changes scope reaches the renderer. `fold` (the default): `model` holds every item and the renderer folds what `scope` leaves out, as a list does. `subset`: `model` holds only what the scope shows (`scopedModel`), with the shown entities' `parts` left out, kept whole or folded, so a canvas lays out only that; `scope.all` holds every item. A subset renderer that needs more to place a change than its relationships' endpoints and containers (a package's path from the workspace, a selector's probe and hook) returns those items' row IDs from `context`, given every item, the changes in scope and its renderer name; they show as context. |
| `steps` | `"steps"?: "manual" \| "schedule"` | `schedule` (default) reports the end of each scheduled step to the host; `manual` leaves it to the component through `reportSteps`. |

Expand Down Expand Up @@ -4343,7 +4344,7 @@ Everything a kit renderer component receives for one host state.
| `comparisonMode` | `"comparisonMode": "animated" \| "diff" \| "side-by-side" \| "swipe" \| undefined` | The comparison mode the host announced in `init`, if any. |
| `controls` | `"controls": Record<string, false \| number \| string \| true>` | The value of every declared control (from `MountOptions.controls` or `declareControls`), defaults filled in. The host draws the controls and sends their values; renderers draw no settings controls of their own. |
| `declareControls` | `"declareControls": { (controls: Array<ControlBase & { "choices": Array<{ "label": string; "value": string }>; "default": string; "type": "choice" } \| ControlBase & { "default": false \| true; "type": "toggle" } \| ControlBase & { "default": number; "max": number; "min": number; "step": number; "type": "range"; "unit"?: string } \| ControlBase & { "icon"?: "collapse" \| "download" \| "expand" \| "filter" \| "fit" \| "next" \| "previous" \| "reset" \| "search" \| "settings" \| "zoom-in" \| "zoom-out"; "type": "action" }>): void }` | Replaces the declared controls, for controls that depend on the document (for example a filter listing its kinds). Repeated identical declarations are ignored. |
| `declareNouns` | `"declareNouns": { (nouns: Readonly<Record<string, SummaryNoun \| false>> \| undefined \| { (kind: string, collection: "entities" \| "relationships"): SummaryNoun \| false \| undefined }): void }` | Names the document's kinds in the host's summary bar, replacing `MountOptions.nouns` (see `useSummaryNouns`). The shell counts every kind and posts the summary itself; without nouns, the host words kinds from their names. |
| `declareNouns` | `"declareNouns": { (nouns: Readonly<Record<string, SummaryKindCount \| SummaryNoun \| false>> \| undefined \| { (kind: string, collection: "entities" \| "relationships"): SummaryKindCount \| SummaryNoun \| false \| undefined }): void }` | Names the document's kinds in the host's summary bar, replacing `MountOptions.nouns` (see `useSummaryNouns`). The shell counts every kind and posts the summary itself; without nouns, the host words kinds from their names. |
| `diff` | `"diff": false \| true` | Whether the host presents this comparison in `diff` mode: one static frame showing both subjects, with no progress (`progress` stays 1 and `schedule` is empty). Draw the renderer's own static comparison; `highlighting` is the host's change emphasis for it (1 unless the host turned highlighting off). |
| `direction` | `"direction": -1 \| 1` | The host's playback direction (`ProgressPayload.direction`): 1 toward After, -1 back toward Before. Always 1 for an extraction and in diff mode. `schedule` is already ordered for the direction the transition presents. |
| `emphasis` | `"emphasis": EmphasisOf` | A change's emphasis now: 0 until its comparison step begins, then the host's highlighting; in a held pane, the host's highlighting (see `stepEmphasis`). Pass the row ID as the second argument when the object passed has none. |
Expand Down Expand Up @@ -4769,11 +4770,11 @@ zoom multiple of the new fit.
### `useSummaryNouns`

```ts
useSummaryNouns(declare: { (nouns: Readonly<Record<string, SummaryNoun | false>> | undefined | { (kind: string, collection: "entities" | "relationships"): SummaryNoun | false | undefined }): void }, nouns: Readonly<Record<string, SummaryNoun | false>> | undefined | { (kind: string, collection: "entities" | "relationships"): SummaryNoun | false | undefined }): void
useSummaryNouns(declare: { (nouns: Readonly<Record<string, SummaryKindCount | SummaryNoun | false>> | undefined | { (kind: string, collection: "entities" | "relationships"): SummaryKindCount | SummaryNoun | false | undefined }): void }, nouns: Readonly<Record<string, SummaryKindCount | SummaryNoun | false>> | undefined | { (kind: string, collection: "entities" | "relationships"): SummaryKindCount | SummaryNoun | false | undefined }): void
```

Names the renderer's kinds in the host's summary bar (`RendererProps.declareNouns`): `{package: {singular:
'workspace', plural: 'workspaces'}}`, `false` to leave a kind out. The kinds an object lists come first, in its
'workspace', plural: 'workspaces'}}`, `false` to leave a kind out, `{noun, distinct}` to count it by key. The kinds an object lists come first, in its
order. Pass a stable value (memoize a function); `undefined` returns to `MountOptions.nouns`.

### `useTableProps`
Expand Down
25 changes: 21 additions & 4 deletions docs/reference/renderer-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -1461,20 +1461,37 @@ A change count in words, for accessible names: `2 added`, `1 removed`, `3 modifi
### `summaryItems`

```ts
summaryItems(subject: { "after": Extraction; "before": Extraction; "comparison": Comparison; "mode": "comparison" } | { "extraction": Extraction; "mode": "extraction" }, nouns?: Readonly<Record<string, SummaryNoun | false>> | undefined | { (kind: string, collection: "entities" | "relationships"): SummaryNoun | false | undefined }): Array<SummaryCountItem>
summaryItems(subject: { "after": Extraction; "before": Extraction; "comparison": Comparison; "mode": "comparison" } | { "extraction": Extraction; "mode": "extraction" }, nouns?: Readonly<Record<string, SummaryKindCount | SummaryNoun | false>> | undefined | { (kind: string, collection: "entities" | "relationships"): SummaryKindCount | SummaryNoun | false | undefined }): Array<SummaryCountItem | SummaryFactItem>
```

A subject's summary, as a renderer posts it: a count figure (`type: 'count'`) per kind and collection (`summaryCounts`), worded with `nouns` where it gives
a noun and the host's words (`humanizeKind`) otherwise, leaving out the kinds it maps to `false`. The kinds an
a noun and the host's words (`humanizeKind`) otherwise, leaving out the kinds it maps to `false` and counting by key
the kinds it maps to a `SummaryKindCount` as a fact in the kind's place (`keyedFact`). The kinds an
object of nouns lists come first, in its order. At most `rendererLimits.summaryItems` figures.

### `SummaryKindCount`

```ts
interface SummaryKindCount
```

A kind counted by a key rather than item by item (see `SummaryNouns`): items that share a key count once, so a
tool's several schemas, say, are one tool. Its words are `noun`, or the host's. The host counts kinds itself, so a
kind counted by key is sent as a fact (`keyedFact`) in the kind's place, filtering to the items it counts.

| Member | Signature | Description |
|---|---|---|
| `distinct` | `"distinct": { (item: Entity \| Relationship): string \| undefined }` | The key an item of the kind counts by; `undefined` leaves the item out of the count. |
| `noun` | `"noun"?: SummaryNoun` | The kind's words; the host's words (`humanizeKind`) when absent. |

### `SummaryNouns`

```ts
type SummaryNouns = Readonly<Record<string, SummaryNoun | false>> | { (kind: string, collection: "entities" | "relationships"): SummaryNoun | false | undefined }
type SummaryNouns = Readonly<Record<string, SummaryKindCount | SummaryNoun | false>> | { (kind: string, collection: "entities" | "relationships"): SummaryKindCount | SummaryNoun | false | undefined }
```

A renderer's words for kinds: a noun per kind, or `false` to leave a kind out of the summary. A key may name one
A renderer's words for kinds: a noun per kind, `false` to hide a kind's count (leave it out of the summary), or a
`SummaryKindCount` to count a kind's items by a key, so items that share one count once. A key may name one
collection's kind (`relationships:index`), which wins over the bare kind. As an object, the kinds it lists come
first, in its order; as a function (given the kind and its collection), `undefined` keeps the host's words.

Expand Down
6 changes: 4 additions & 2 deletions packages/cli/templates/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,10 @@ animated from the same view if time allows. The starter does this:
(old struck through, then new).
- Draw no summary line in any mode: the host's summary bar, along the bottom
of the view, counts each kind with its changes. Name the kinds in your
domain's words with `nouns` in `src/view.tsx`'s `options` (`false` leaves
out structure, such as containment drawn as boundaries), and state what
domain's words with `nouns` in `src/view.tsx`'s `options` (`false` hides a
kind's count, such as containment drawn as boundaries;
`{noun, distinct: item => key}` counts items that share a key once, such as
a tool's several schemas), and state what
counts can't say (`2 breaking changes`, `1 newly enforced`) as `facts`
computed from the document, each with the IDs it filters to.
- Say every change in words too (`ChangeFooter`, `sr-only` text), and let the
Expand Down
Loading
Loading