diff --git a/changelog.d/facts-value-list.md b/changelog.d/facts-value-list.md index 2c3c3b316..8bf8b1210 100644 --- a/changelog.d/facts-value-list.md +++ b/changelog.d/facts-value-list.md @@ -2,4 +2,4 @@ section: kit --- -- **`Facts` and `ValueList` render key-value and value lists as plain text**. `Facts` and `Fact` display key-value pairs with muted UI-font labels ("Runs on") in an aligned column; `meta` puts a note ("and 8 run steps") beside a value, and `change` marks an added or removed row. `ValueList` renders comma-separated or stacked values as text, marking added, removed, and changed items inline with change hues, signs, and strikethrough instead of wrapping each item in a pill like `ChangePills`. `ValueMark` marks one value the same way, and `ValueChange` accepts `variant="text"` for a single value change in the same style, and `Fields` is now `Facts` with code labels. See [Layout components](docs/guides/renderer-kit-components.md#layout-components). +- **`Facts` and `ValueList` render key-value and value lists as plain text**. `Facts` and `Fact` display key-value pairs with muted UI-font labels ("Runs on") in an aligned column; `meta` puts a note ("and 8 run steps") beside a value, and `change` marks an added or removed row. `ValueList` renders comma-separated or stacked values as text, marking added, removed, and changed items inline with change hues, signs, and strikethrough instead of wrapping each item in a pill like `ChangePills`. `ValueMark` marks one value the same way, and `ValueChange` accepts `variant="text"` for a single value change in the same style, and `Fields` is now `Facts` with code labels. See [Renderer kit: type and values](docs/guides/renderer-kit-type.md#facts-and-value-lists). diff --git a/changelog.d/type-roles.md b/changelog.d/type-roles.md new file mode 100644 index 000000000..d8f48f317 --- /dev/null +++ b/changelog.d/type-roles.md @@ -0,0 +1,6 @@ +--- +section: kit +--- + +- **Type roles style text by purpose instead of size**. `Text variant` takes a role (`title`, `heading`, `kind`, `label`, `value`, `code`, `meta`, or `figure`) with its size, weight, font, and tone from the theme; without React, use the `pk-type-` class. Kit components apply them automatically (`EntityCard` names use `title`, `Group` header bands use `heading`, and `Facts` labels use `label`). The kit also adds three quiet text pieces: `Code` for inline code, `Slot` for a named placeholder in a template, and `Tag` for a category label without a border. See [Renderer kit: type and values](docs/guides/renderer-kit-type.md). +- **`EntityCard` adds header slots around its title**. Optional muted slots place `kind` above the title ("Job", "Service"), a single-line `subtitle` below it, and `aside` at the end of the first line (such as a timeout); `titleFont="code"` renders code identifiers in monospace. `Facts` placed directly inside a card align with the title. See [Layout components](docs/guides/renderer-kit-components.md#layout-components). diff --git a/docs/README.md b/docs/README.md index 86aeab4ac..787662b21 100644 --- a/docs/README.md +++ b/docs/README.md @@ -55,7 +55,8 @@ the same tasks: [explore](agents/explore.md), [install](agents/install.md), [develop a renderer](guides/develop-a-renderer.md), the [renderer kit guide](guides/renderer-kit.md) (including [graphs](guides/renderer-kit-graphs.md) and - [components](guides/renderer-kit-components.md) and + [components](guides/renderer-kit-components.md), + [type and values](guides/renderer-kit-type.md), and [change emphasis](guides/change-emphasis.md)), and the [renderer SDK guide](guides/renderer-sdk.md). When you need API details, check the [renderer kit API](reference/renderer-kit.md), the diff --git a/docs/agents/create-projection.md b/docs/agents/create-projection.md index 8cfcfc998..12970e3b7 100644 --- a/docs/agents/create-projection.md +++ b/docs/agents/create-projection.md @@ -574,7 +574,8 @@ kit already meets the checks the host holds every renderer to. The starter has no stylesheet: compose views from the kit's components (`ContentView`, `Group`, `CardGrid`, `EntityCard`, `Facts`, `ValueList`, `Fields`, `Stack`, `Inline`, `Text`, `Chip`, `Chips`) and their props (`Facts` for properties and settings, -`ValueList` for value lists with inline change marks instead of pills), +`ValueList` for value lists with inline change marks instead of pills, and +`Text variant` for type roles like `title`, `label` or `meta` instead of sizes), and for an inline style they don't cover use `token` (`token.space(2)`). For items with comparable properties (a row per item, a column per property), use the kit's `DataTable` rather than hand-built table markup: sortable headings diff --git a/docs/guides/renderer-kit-components.md b/docs/guides/renderer-kit-components.md index af2ff2dd0..57c9afe7e 100644 --- a/docs/guides/renderer-kit-components.md +++ b/docs/guides/renderer-kit-components.md @@ -312,30 +312,32 @@ accept token scale steps rather than raw lengths or colors—this is how select button, `label`, `identifier`, `children`, and worded change status. In progress modes, its leading edge picks up the change hue as `emphasis` rises while `presence` fades it in or out; in diff mode, `mark={change}` applies - standard kit change-region styling. + standard kit change-region styling. Its header gives the card one title: + `label` uses the `title` role (`titleFont="code"` for code identifiers), with + optional muted slots for `kind` above it ("Job", "Service"), a one-line + `subtitle` below it ("6 runs · fail-fast off"), and `aside` at the end of the + first line (such as a timeout). `Facts` placed directly inside a card align + with its title. - `RelationshipList` and `RelationshipItem` list a card's relationships, each a selectable unit with its own ID, `presence`, and (in diff mode) `mark` and `changeText`. -- `Facts` and `Fact` render a key-value list with muted UI-font labels ("Runs - on") in an aligned column. `meta` adds a muted note after a value ("and 8 run - steps") instead of a separate row, and `change` marks an added or removed row. - `Fields` and `Field` are the same list with `labelFont="code"` for raw data - keys. -- `ValueList` renders a list of values as text, separated by commas (or - `separator="dot"`) and wrapping between items, or stacked one per line - (`layout="stack"`). Added items appear in the added hue after `+`, removed - items are struck through in the removed hue after `−`, and changed items show - the old value (`was`) struck through, an arrow, and the new value. Marks fade - with `emphasis` (inheriting the surrounding item's when omitted) and are - announced in words. Items are unboxed by default; `display="chips"` renders - them as chips (`ChangePills`) for small or selectable sets. - `ValueChange variant="text"` renders a single value change the same way, - without pills. +- `Facts` and `Fact` (an item's facts as a key-value list) and `ValueList` (a + list of values with changes marked inline, not in pills): see + [Renderer kit: type and values](renderer-kit-type.md#facts-and-value-lists). - `Stack` and `Inline` arrange children in a vertical column or wrapping row with `gap={1…8}` steps from the spacing scale. -- `Text` renders typography using `size` (`xs`, `sm`, `md`, `lg`, `xl`), - `weight`, and `tone` (`default`, `muted`, `subtle`, or one of the kit's tones, - `quiet` and `flag`; see [Tones](#tones)). +- `Text` renders text using a [type role](#type-roles) (`variant`), or `size` + (`xs`, `sm`, `md`, `lg`, `xl`) and `weight` when no role fits, along with + `tone` (`default`, `muted`, `subtle`, or one of the kit's tones, `quiet` and + `flag`; see [Tones](#tones)). +- `Code`, `Slot`, and `Tag` are quiet text pieces; see + [Renderer kit: type and values](renderer-kit-type.md). + +## Type roles + +Text in kit components uses a type role (`title`, `heading`, `kind`, `label`, +`value`, `code`, `meta`, or `figure`) instead of a raw size; see +[Renderer kit: type and values](renderer-kit-type.md). ## Tones diff --git a/docs/guides/renderer-kit-type.md b/docs/guides/renderer-kit-type.md new file mode 100644 index 000000000..19f56096a --- /dev/null +++ b/docs/guides/renderer-kit-type.md @@ -0,0 +1,58 @@ +# Renderer kit: type and values + +Readers scan a projection in seconds, so its text hierarchy needs to be clear at +a glance. The kit's type roles and quiet text pieces keep that hierarchy +consistent across renderers; the authoring guide's +[visual craft](../agents/create-projection.md#visual-craft) rules cover when to +use each one. + +## Type roles + +A type role describes what a piece of text is and sets its size, weight, font, +and tone from the theme so cards read consistently across views. Use a role +instead of a raw size: + + +| Role | Use | Style | +|---|---|---| +| `title` | Card name | Body size, semibold | +| `heading` | Section inside a card or group header band | One step smaller, semibold | +| `kind` | Category word above a title ("Job", "Service") | Smallest step, muted | +| `label` | Key beside a value ("Runs on") | Muted, matching the value's size | +| `value` | Body text | Matches surrounding text | +| `code` | Identifier, path, version, or expression | Monospace, one pixel smaller | +| `meta` | Secondary detail ("40 min") | Smallest step, muted | +| `figure` | Count or number in a column | Tabular figures | + +Pass `Text variant="title"` (or any other role) in React, or add the +`pk-type-` class (`typeRoleClass(role)`, from the kit's main entry) to any +element without React. Kit components apply these roles themselves: an +`EntityCard` name uses `title`, `Facts` labels use `label`, and a `Group` header +band uses `heading`. Unmuted roles inherit the surrounding text color, so +removed items stay muted. + +## Facts and value lists + +`Facts` and `Fact` render a key-value list with muted UI-font labels ("Runs on") +in an aligned column. `meta` adds a muted note after a value ("and 8 run steps") +instead of a separate row, and `change` marks an added or removed row. `Fields` +and `Field` are the same list with `labelFont="code"` for raw data keys. + +`ValueList` renders a list of values as text, separated by commas (or +`separator="dot"`) and wrapping between items, or stacked one per line +(`layout="stack"`). Added items appear in the added hue after `+`, removed items +are struck through in the removed hue after `−`, and changed items show the old +value (`was`) struck through, an arrow, and the new value. Marks fade with +`emphasis` (inheriting the surrounding item's when omitted) and are announced in +words. Items are unboxed by default; `display="chips"` renders them as chips +(`ChangePills`) for small or selectable sets. `ValueMark` marks one value the +same way, and `ValueChange variant="text"` renders a single value change without +pills. + +## Quiet text pieces + +`Code` renders inline code in prose or a value (an expression, path, or version) +in monospace, inheriting the surrounding text color with no fill or border. +`Slot` renders a named placeholder in a template (`Build on os`) as muted +monospace without brackets. `Tag` renders a quiet category label (such as a +lifetime or mode) with a recessed fill and no border. diff --git a/docs/reference/renderer-kit.md b/docs/reference/renderer-kit.md index 8e1469306..8726a57f6 100644 --- a/docs/reference/renderer-kit.md +++ b/docs/reference/renderer-kit.md @@ -3768,6 +3768,25 @@ How an S turns: its middle along the axis (from `start`), radius and turn angle, | `middle` | `"middle": number` | Where the S's middle (its crossing run) is, as a distance along the axis from `start`, inside `band`. | | `radius` | `"radius": number` | The radius both turns share: `RouteOptions.radius` (default `routeRadius`), or less when the band is short. | +### `TypeRole` + +```ts +type TypeRole = "code" | "figure" | "heading" | "kind" | "label" | "meta" | "title" | "value" +``` + +The kit's type roles: what a piece of text is, each with its size, weight, font and tone from the theme, so text +in every card reads the same way. `title` names a card; `heading` a section inside one, or a group's band; `kind` +is the muted word above a title ("Job", "Service"); `label` a key beside its value; `value` the body; `code` an +identifier, path or expression; `meta` a secondary fact ("40 min"); `figure` a number set in tabular figures. + +### `typeRoleClass` + +```ts +typeRoleClass(role: "code" | "figure" | "heading" | "kind" | "label" | "meta" | "title" | "value"): string +``` + +The class that sets a type role on any element (`pk-type-`), for markup without the kit's `Text`. + ### `unitProgress` ```ts @@ -4062,6 +4081,15 @@ Chips(__0: { "children": Iterable | Promise | Promise | ReactElement | Promise | Promise | ReactElement | ReactPortal | bigint | false | null | number | string | true | undefined } | { new (props: any, context: any): Component }> | ReactPortal | bigint | false | null | number | string | true | undefined> | ReactElement | Promise | ReactElement | ReactPortal | bigint | false | null | number | string | true | undefined> | Promise | ReactElement | ReactPortal | bigint | false | null | number | string | true | undefined } | { new (props: any, context: any): Component }> | ReactPortal | bigint | false | null | number | string | true | undefined; "className"?: string }): Element +``` + +Code inside running text or a value: an expression, a path, a version. Set in the monospace font in the color of the +text around it, with no fill or edge, so it adds one treatment, not three. `Identifier` is the same for names. + ### `ContentView` ```ts @@ -4215,17 +4243,21 @@ Props of `EntityCard`: one entity's card, its selection and its change. | Member | Signature | Description | |---|---|---| +| `aside` | `"aside"?: Iterable \| Promise \| ReactElement \| Promise \| Promise \| ReactElement \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined } \| { new (props: any, context: any): Component }> \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined> \| ReactElement \| Promise \| ReactElement \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined> \| Promise \| ReactElement \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined } \| { new (props: any, context: any): Component }> \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined` | A muted fact at the end of the card's first line (the `meta` role), such as a timeout ("40 min"). | | `change` | `"change"?: { "renamed"?: false \| true \| undefined; "status": "added" \| "modified" \| "removed" \| "unchanged" }` | The row, for its change status: stated in words in the footer, in proportion to `emphasis`. | | `children` | `"children"?: Iterable \| Promise \| ReactElement \| Promise \| Promise \| ReactElement \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined } \| { new (props: any, context: any): Component }> \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined> \| ReactElement \| Promise \| ReactElement \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined> \| Promise \| ReactElement \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined } \| { new (props: any, context: any): Component }> \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined` | Relationships and fields, below the name. | | `emphasis` | `"emphasis"?: number` | The host's emphasis for this change (`props.emphasis(row)`): 0 at both endpoints and before its step. | | `holdsChanges` | `"holdsChanges"?: false \| true` | Changes are drawn inside it that no `data-change` marks (a nested renderer's frame): the card is drawn neutral (`pk-holds-changes`), so change colors never nest. | | `id` | `"id": string` | The selection ID: the card's `data-entity-id`. | | `identifier` | `"identifier"?: string` | A code name shown under the label in the monospace font, usually the entity's ID. | -| `label` | `"label": Iterable \| Promise \| ReactElement \| Promise \| Promise \| ReactElement \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined } \| { new (props: any, context: any): Component }> \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined> \| ReactElement \| Promise \| ReactElement \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined> \| Promise \| ReactElement \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined } \| { new (props: any, context: any): Component }> \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined` | The entity's name, as text or as a `ValueChange` in the diff. | +| `kind` | `"kind"?: Iterable \| Promise \| ReactElement \| Promise \| Promise \| ReactElement \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined } \| { new (props: any, context: any): Component }> \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined> \| ReactElement \| Promise \| ReactElement \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined> \| Promise \| ReactElement \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined } \| { new (props: any, context: any): Component }> \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined` | What kind of thing it is, a muted word above the name ("Job", "Matrix job", "Service"): the `kind` role. | +| `label` | `"label": Iterable \| Promise \| ReactElement \| Promise \| Promise \| ReactElement \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined } \| { new (props: any, context: any): Component }> \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined> \| ReactElement \| Promise \| ReactElement \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined> \| Promise \| ReactElement \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined } \| { new (props: any, context: any): Component }> \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined` | The entity's name, as text or as a `ValueChange` in the diff: the card's `title`, which leads it. | | `mark` | `"mark"?: "added" \| "modified" \| "removed" \| "renamed" \| "unchanged" \| { "renamed"?: false \| true \| undefined; "status": "added" \| "modified" \| "removed" \| "unchanged" }` | In diff mode: the change this card marks, filled and edged in its hue (`changeMark`). | | `onSelect` | `"onSelect": { (id: string): void }` | Selects the entity (the renderer's `onSelect`) with `id`, when the card's button is activated. | | `presence` | `"presence"?: number` | Presence 0..1 while an entity is added or removed by the playing step (`timeline.presence`); 1 by default. | | `selected` | `"selected": false \| true` | Whether the entity is the host's selection (`props.selectedId === id`): the card's button is pressed. | +| `subtitle` | `"subtitle"?: Iterable \| Promise \| ReactElement \| Promise \| Promise \| ReactElement \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined } \| { new (props: any, context: any): Component }> \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined> \| ReactElement \| Promise \| ReactElement \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined> \| Promise \| ReactElement \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined } \| { new (props: any, context: any): Component }> \| ReactPortal \| bigint \| false \| null \| number \| string \| true \| undefined` | One muted line under the name (the `meta` role): its most telling secondary facts ("6 runs · fail-fast off"). | +| `titleFont` | `"titleFont"?: "code" \| "text"` | The name's font: `code` for a name that is an identifier (a job, a function), in monospace; `text` by default. | ### `Fact` @@ -4717,6 +4749,15 @@ with the class `pk-slanted-column`), and call `useSlantedHeadings` with the tabl tall as the longest heading needs. A heading's tail runs over the columns to its right, so the table needs room on its right for the last one's: its following columns, or the space beside it. +### `Slot` + +```ts +Slot(__0: { "children": Iterable | Promise | ReactElement | Promise | Promise | ReactElement | ReactPortal | bigint | false | null | number | string | true | undefined } | { new (props: any, context: any): Component }> | ReactPortal | bigint | false | null | number | string | true | undefined> | ReactElement | Promise | ReactElement | ReactPortal | bigint | false | null | number | string | true | undefined> | Promise | ReactElement | ReactPortal | bigint | false | null | number | string | true | undefined } | { new (props: any, context: any): Component }> | ReactPortal | bigint | false | null | number | string | true | undefined; "title"?: string }): Element +``` + +A named blank in a template, such as a matrix value a run's name is spelled from (`Build on os`): its name as code, +muted, with no brackets or accent color. `title` says what fills it, for a pointer. + ### `Stack` ```ts @@ -4830,16 +4871,26 @@ What `useTableProps` reads from a kit renderer's props. | `selectedId` | `"selectedId": null \| string` | The host's selection (`RendererProps.selectedId`). | | `setControl` | `"setControl": { (id: string, value: false \| number \| string \| true): void }` | Sets a control from the content, as a heading does the sort (`RendererProps.setControl`). | +### `Tag` + +```ts +Tag(__0: { "children": Iterable | Promise | ReactElement | Promise | Promise | ReactElement | ReactPortal | bigint | false | null | number | string | true | undefined } | { new (props: any, context: any): Component }> | ReactPortal | bigint | false | null | number | string | true | undefined> | ReactElement | Promise | ReactElement | ReactPortal | bigint | false | null | number | string | true | undefined> | Promise | ReactElement | ReactPortal | bigint | false | null | number | string | true | undefined } | { new (props: any, context: any): Component }> | ReactPortal | bigint | false | null | number | string | true | undefined; "code"?: false | true; "title"?: string }): Element +``` + +A quiet categorical label (a lifetime, a kind, a mode): a recessed fill with no edge, in the `label` role. Unlike a +`Chip` it isn't selectable and carries no change of its own; use it for a word that classifies the item around it. + ### `Text` ```ts -Text(__0: { "as"?: "a" | "abbr" | "address" | "animate" | "animateMotion" | "animateTransform" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "center" | "circle" | "cite" | "clipPath" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "defs" | "del" | "desc" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "ellipse" | "em" | "embed" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "fieldset" | "figcaption" | "figure" | "filter" | "footer" | "foreignObject" | "form" | "g" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "image" | "img" | "input" | "ins" | "kbd" | "keygen" | "label" | "legend" | "li" | "line" | "linearGradient" | "link" | "main" | "map" | "mark" | "marker" | "mask" | "menu" | "menuitem" | "meta" | "metadata" | "meter" | "mpath" | "nav" | "noindex" | "noscript" | "object" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "path" | "pattern" | "picture" | "polygon" | "polyline" | "pre" | "progress" | "q" | "radialGradient" | "rect" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "search" | "section" | "select" | "set" | "slot" | "small" | "source" | "span" | "stop" | "strong" | "style" | "sub" | "summary" | "sup" | "svg" | "switch" | "symbol" | "table" | "tbody" | "td" | "template" | "text" | "textPath" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "tspan" | "u" | "ul" | "use" | "var" | "video" | "view" | "wbr" | "webview" | ComponentClass | FunctionComponent; "children": Iterable | Promise | ReactElement | Promise | Promise | ReactElement | ReactPortal | bigint | false | null | number | string | true | undefined } | { new (props: any, context: any): Component }> | ReactPortal | bigint | false | null | number | string | true | undefined> | ReactElement | Promise | ReactElement | ReactPortal | bigint | false | null | number | string | true | undefined> | Promise | ReactElement | ReactPortal | bigint | false | null | number | string | true | undefined } | { new (props: any, context: any): Component }> | ReactPortal | bigint | false | null | number | string | true | undefined; "size"?: "lg" | "md" | "sm" | "xl" | "xs"; "tone"?: "default" | "flag" | "muted" | "quiet" | "subtle"; "weight"?: "bold" | "medium" | "normal" | "semibold" }): Element +Text(__0: { "as"?: "a" | "abbr" | "address" | "animate" | "animateMotion" | "animateTransform" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "center" | "circle" | "cite" | "clipPath" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "defs" | "del" | "desc" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "ellipse" | "em" | "embed" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "fieldset" | "figcaption" | "figure" | "filter" | "footer" | "foreignObject" | "form" | "g" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "image" | "img" | "input" | "ins" | "kbd" | "keygen" | "label" | "legend" | "li" | "line" | "linearGradient" | "link" | "main" | "map" | "mark" | "marker" | "mask" | "menu" | "menuitem" | "meta" | "metadata" | "meter" | "mpath" | "nav" | "noindex" | "noscript" | "object" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "path" | "pattern" | "picture" | "polygon" | "polyline" | "pre" | "progress" | "q" | "radialGradient" | "rect" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "search" | "section" | "select" | "set" | "slot" | "small" | "source" | "span" | "stop" | "strong" | "style" | "sub" | "summary" | "sup" | "svg" | "switch" | "symbol" | "table" | "tbody" | "td" | "template" | "text" | "textPath" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "tspan" | "u" | "ul" | "use" | "var" | "video" | "view" | "wbr" | "webview" | ComponentClass | FunctionComponent; "children": Iterable | Promise | ReactElement | Promise | Promise | ReactElement | ReactPortal | bigint | false | null | number | string | true | undefined } | { new (props: any, context: any): Component }> | ReactPortal | bigint | false | null | number | string | true | undefined> | ReactElement | Promise | ReactElement | ReactPortal | bigint | false | null | number | string | true | undefined> | Promise | ReactElement | ReactPortal | bigint | false | null | number | string | true | undefined } | { new (props: any, context: any): Component }> | ReactPortal | bigint | false | null | number | string | true | undefined; "size"?: "lg" | "md" | "sm" | "xl" | "xs"; "tone"?: "default" | "flag" | "muted" | "quiet" | "subtle"; "variant"?: "code" | "figure" | "heading" | "kind" | "label" | "meta" | "title" | "value"; "weight"?: "bold" | "medium" | "normal" | "semibold" }): Element ``` -Text in the theme's type: a step of the type scale, a weight and a tone. `muted` and `subtle` are for secondary -text. The kit's tones (`Tone`) say how much the text asks for attention: `quiet` for a lesser item, `flag` for a -domain flag that isn't a change (semibold, whatever `weight` says). Change colors are never a -tone (use the kit's status components). +Text in the theme's type. Prefer a role (`variant`: `title`, `heading`, `kind`, `label`, `value`, `code`, `meta`, +`figure`; see `TypeRole`), which carries its size, weight, font and tone; `size` and `weight` are for the rare text +no role fits, and override the role's. `muted` and `subtle` are for secondary text. The kit's tones (`Tone`) say how +much the text asks for attention: `quiet` for a lesser item, `flag` for a domain flag that isn't a change (semibold, +whatever `weight` says). Change colors are never a tone (use the kit's status components). ### `useBorderWidths` diff --git a/packages/cli/templates/SKILL.md b/packages/cli/templates/SKILL.md index 31911e701..c73eeb482 100644 --- a/packages/cli/templates/SKILL.md +++ b/packages/cli/templates/SKILL.md @@ -538,7 +538,8 @@ kit already meets the checks the host holds every renderer to. The starter has no stylesheet: compose views from the kit's components (`ContentView`, `Group`, `CardGrid`, `EntityCard`, `Facts`, `ValueList`, `Fields`, `Stack`, `Inline`, `Text`, `Chip`, `Chips`) and their props (`Facts` for properties and settings, -`ValueList` for value lists with inline change marks instead of pills), +`ValueList` for value lists with inline change marks instead of pills, and +`Text variant` for type roles like `title`, `label` or `meta` instead of sizes), and for an inline style they don't cover use `token` (`token.space(2)`). For items with comparable properties (a row per item, a column per property), use the kit's `DataTable` rather than hand-built table markup: sortable headings diff --git a/packages/renderers/kit/base.css b/packages/renderers/kit/base.css index b3a480be0..afc092837 100644 --- a/packages/renderers/kit/base.css +++ b/packages/renderers/kit/base.css @@ -20,4 +20,5 @@ @import './styles/controls.css'; @import './styles/status.css'; @import './styles/text.css'; +@import './styles/type.css'; @import './styles/nesting.css'; diff --git a/packages/renderers/kit/src/index.ts b/packages/renderers/kit/src/index.ts index 1884f8e13..b958b3306 100644 --- a/packages/renderers/kit/src/index.ts +++ b/packages/renderers/kit/src/index.ts @@ -52,6 +52,7 @@ export * from './fit.js' export * from './zoom.js' export * from './palette.js' export * from './tone.js' +export * from './type-roles.js' export * from './shared-scale.js' export * from './categories.js' export * from './count-fact.js' diff --git a/packages/renderers/kit/src/react.ts b/packages/renderers/kit/src/react.ts index 4c7b940c3..8551f309d 100644 --- a/packages/renderers/kit/src/react.ts +++ b/packages/renderers/kit/src/react.ts @@ -29,6 +29,7 @@ export * from './react/icons.js' export {Fold, useFolds} from './react/fold.js' export {IdentifierText} from './react/identifiers.js' export * from './react/layout-components.js' +export * from './react/type.js' export {SlantedHeading, useSlantedHeadings} from './react/slanted-headings.js' export {DataTable, useTableProps} from './react/data-table.js' export type {DataTableColumn, DataTableProps, TablePropsSource} from './react/data-table.js' diff --git a/packages/renderers/kit/src/react/facts.tsx b/packages/renderers/kit/src/react/facts.tsx index f11559fbd..b058c0fd5 100644 --- a/packages/renderers/kit/src/react/facts.tsx +++ b/packages/renderers/kit/src/react/facts.tsx @@ -61,7 +61,7 @@ export function Fact({ const Label = change === 'removed' ? 'del' : change === 'added' ? 'ins' : 'span' return (
-
+
{changed ? (