Skip to content

Commit b548e43

Browse files
os-salesclaude
andauthored
docs(spec): colorField describes a field to derive a colour FROM (#15470)
`TimelineConfigSchema`, `CalendarConfigSchema` and `GanttConfigSchema` each declare a `colorField`, and all three `.describe()` strings said only that the named field "determines" / "drives" the colour. That reads as "point this at a field that holds a colour" — the case the renderers need least. The common author intent is `colorField: 'status'`, a select field whose options already carry the colours. The renderers resolve it as a ladder (objectui#7243, shared as `createFieldColorResolver` in `@object-ui/core`, present at the console pin 00d3f09c): the option colour the field declares for the record's stored value, else the value itself when it already is a colour literal, else each renderer's own last rung — a semantic colour token (gantt), a theme-aware palette hash (calendar), the default marker (timeline). The three strings now say that, each naming its own last rung. No accept-set change: all three keys stay `z.string().optional()`, and `check:authorable-surface` needed no regeneration. The only regenerated follower is `content/docs/references/ui/view.mdx`. Claude-Session: https://claude.ai/code/session_01G4138K1EG7kQ81FNba5Kp4 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 40a44b9 commit b548e43

3 files changed

Lines changed: 27 additions & 12 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
"@objectstack/spec": patch
3+
---
4+
5+
`colorField` now documents what it means: a field to DERIVE a colour from, not a field holding one.
6+
7+
`TimelineConfigSchema`, `CalendarConfigSchema` and `GanttConfigSchema` each declare a `colorField`, and all three `.describe()` strings said only that the field "determines"/"drives" the colour — `'Field to determine item color'`, `'Field whose value determines the event color'`, `'Field that drives the bar color'`. Read literally, that invites pointing the key at a field whose stored value *is* a colour, which is the one case the renderers need the least: the common author intent is `colorField: 'status'`, a select field whose options already carry the colours.
8+
9+
The renderers resolve it as a derivation ladder (objectui#7243, shared as `createFieldColorResolver` in `@object-ui/core`):
10+
11+
1. the option `color` the field declares for the record's stored value;
12+
2. else the value itself, when it already is a colour literal (hex 3/6/8-digit, `rgb(...)`, `hsl(...)`);
13+
3. else each renderer's own last rung — the gantt derives a semantic colour token, the calendar hashes onto its theme-aware palette, the timeline draws its default marker.
14+
15+
The three strings now say that, each naming its own last rung. **Nothing in the accept set moves**: all three keys stay `z.string().optional()`, and a config pointing `colorField` at a plain hex field is still exactly as valid as before — that is rung 2. This is prose on a declared key, so the only regenerated follower is `content/docs/references/ui/view.mdx`.

content/docs/references/ui/view.mdx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Appearance and visualization configuration
106106
| **startDateField** | `string` || Field providing the event start date/time |
107107
| **endDateField** | `string` | optional | Field providing the event end date/time (defaults to a single-day event) |
108108
| **titleField** | `string` | optional | Field displayed as the event title. Omit to fall back to the record display name (ADR-0079 resolver chain) |
109-
| **colorField** | `string` | optional | Field whose value determines the event color |
109+
| **colorField** | `string` | optional | Field to derive each event color from (it names a field, not a color): the option color declared on that field for the record value, else the value itself when it already is a color literal (hex, rgb() or hsl()), else the calendar theme-aware palette color hashed from the value |
110110

111111

112112
---
@@ -559,7 +559,7 @@ Gallery/card view configuration
559559
| **titleField** | `string` || Field displayed as the task title |
560560
| **progressField** | `string` | optional | Field providing the task completion percentage |
561561
| **dependenciesField** | `string` | optional | Field listing the task's predecessor (dependency) record ids |
562-
| **colorField** | `string` | optional | Field that drives the bar color |
562+
| **colorField** | `string` | optional | Field to derive each bar color from (it names a field, not a color): the option color declared on that field for the record value, else the value itself when it already is a color literal (hex, rgb() or hsl()), else a semantic color token derived from the value |
563563
| **parentField** | `string` | optional | Field holding the parent task id (builds the summary → step tree) |
564564
| **typeField** | `string` | optional | Field whose value maps to task/summary/milestone |
565565
| **baselineStartField** | `string` | optional | Baseline (planned) start field |
@@ -915,7 +915,7 @@ View filter rule
915915
| **startDateField** | `string` || Field providing the event start date/time |
916916
| **endDateField** | `string` | optional | Field providing the event end date/time (defaults to a single-day event) |
917917
| **titleField** | `string` | optional | Field displayed as the event title. Omit to fall back to the record display name (ADR-0079 resolver chain) |
918-
| **colorField** | `string` | optional | Field whose value determines the event color |
918+
| **colorField** | `string` | optional | Field to derive each event color from (it names a field, not a color): the option color declared on that field for the record value, else the value itself when it already is a color literal (hex, rgb() or hsl()), else the calendar theme-aware palette color hashed from the value |
919919

920920
### Nested Shape: `ListView.gantt`
921921

@@ -926,7 +926,7 @@ View filter rule
926926
| **titleField** | `string` || Field displayed as the task title |
927927
| **progressField** | `string` | optional | Field providing the task completion percentage |
928928
| **dependenciesField** | `string` | optional | Field listing the task's predecessor (dependency) record ids |
929-
| **colorField** | `string` | optional | Field that drives the bar color |
929+
| **colorField** | `string` | optional | Field to derive each bar color from (it names a field, not a color): the option color declared on that field for the record value, else the value itself when it already is a color literal (hex, rgb() or hsl()), else a semantic color token derived from the value |
930930
| **parentField** | `string` | optional | Field holding the parent task id (builds the summary → step tree) |
931931
| **typeField** | `string` | optional | Field whose value maps to task/summary/milestone |
932932
| **baselineStartField** | `string` | optional | Baseline (planned) start field |
@@ -959,7 +959,7 @@ View filter rule
959959
| **endDateField** | `string` | optional | Field for timeline item end date |
960960
| **titleField** | `string` || Field to display as timeline item title |
961961
| **groupByField** | `string` | optional | Field to group timeline rows |
962-
| **colorField** | `string` | optional | Field to determine item color |
962+
| **colorField** | `string` | optional | Field to derive each item color from (it names a field, not a color): the option color declared on that field for the record value, else the value itself when it already is a color literal (hex, rgb() or hsl()), else the timeline default marker color |
963963
| **scale** | `Enum<'hour' \| 'day' \| 'week' \| 'month' \| 'quarter' \| 'year'>` | optional (default: `"week"`) | Default timeline scale |
964964

965965
### Nested Shape: `ListView.chart`
@@ -1301,7 +1301,7 @@ View filter rule
13011301
| **startDateField** | `string` || Field providing the event start date/time |
13021302
| **endDateField** | `string` | optional | Field providing the event end date/time (defaults to a single-day event) |
13031303
| **titleField** | `string` | optional | Field displayed as the event title. Omit to fall back to the record display name (ADR-0079 resolver chain) |
1304-
| **colorField** | `string` | optional | Field whose value determines the event color |
1304+
| **colorField** | `string` | optional | Field to derive each event color from (it names a field, not a color): the option color declared on that field for the record value, else the value itself when it already is a color literal (hex, rgb() or hsl()), else the calendar theme-aware palette color hashed from the value |
13051305

13061306
### Nested Shape: `ObjectListView.gantt`
13071307

@@ -1312,7 +1312,7 @@ View filter rule
13121312
| **titleField** | `string` || Field displayed as the task title |
13131313
| **progressField** | `string` | optional | Field providing the task completion percentage |
13141314
| **dependenciesField** | `string` | optional | Field listing the task's predecessor (dependency) record ids |
1315-
| **colorField** | `string` | optional | Field that drives the bar color |
1315+
| **colorField** | `string` | optional | Field to derive each bar color from (it names a field, not a color): the option color declared on that field for the record value, else the value itself when it already is a color literal (hex, rgb() or hsl()), else a semantic color token derived from the value |
13161316
| **parentField** | `string` | optional | Field holding the parent task id (builds the summary → step tree) |
13171317
| **typeField** | `string` | optional | Field whose value maps to task/summary/milestone |
13181318
| **baselineStartField** | `string` | optional | Baseline (planned) start field |
@@ -1345,7 +1345,7 @@ View filter rule
13451345
| **endDateField** | `string` | optional | Field for timeline item end date |
13461346
| **titleField** | `string` || Field to display as timeline item title |
13471347
| **groupByField** | `string` | optional | Field to group timeline rows |
1348-
| **colorField** | `string` | optional | Field to determine item color |
1348+
| **colorField** | `string` | optional | Field to derive each item color from (it names a field, not a color): the option color declared on that field for the record value, else the value itself when it already is a color literal (hex, rgb() or hsl()), else the timeline default marker color |
13491349
| **scale** | `Enum<'hour' \| 'day' \| 'week' \| 'month' \| 'quarter' \| 'year'>` | optional (default: `"week"`) | Default timeline scale |
13501350

13511351
### Nested Shape: `ObjectListView.chart`
@@ -1597,7 +1597,7 @@ Timeline view configuration
15971597
| **endDateField** | `string` | optional | Field for timeline item end date |
15981598
| **titleField** | `string` || Field to display as timeline item title |
15991599
| **groupByField** | `string` | optional | Field to group timeline rows |
1600-
| **colorField** | `string` | optional | Field to determine item color |
1600+
| **colorField** | `string` | optional | Field to derive each item color from (it names a field, not a color): the option color declared on that field for the record value, else the value itself when it already is a color literal (hex, rgb() or hsl()), else the timeline default marker color |
16011601
| **scale** | `Enum<'hour' \| 'day' \| 'week' \| 'month' \| 'quarter' \| 'year'>` | optional (default: `"week"`) | Default timeline scale |
16021602

16031603

packages/spec/src/ui/view.zod.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ export const TimelineConfigSchema = lazySchema(() => strictObject({
965965
endDateField: z.string().optional().describe('Field for timeline item end date'),
966966
titleField: z.string().describe('Field to display as timeline item title'),
967967
groupByField: z.string().optional().describe('Field to group timeline rows'),
968-
colorField: z.string().optional().describe('Field to determine item color'),
968+
colorField: z.string().optional().describe('Field to derive each item color from (it names a field, not a color): the option color declared on that field for the record value, else the value itself when it already is a color literal (hex, rgb() or hsl()), else the timeline default marker color'),
969969
scale: z.enum(['hour', 'day', 'week', 'month', 'quarter', 'year']).default('week').describe('Default timeline scale'),
970970
}).describe('Timeline view configuration'));
971971

@@ -1300,7 +1300,7 @@ export const CalendarConfigSchema = lazySchema(() => strictObject({
13001300
startDateField: z.string().describe('Field providing the event start date/time'),
13011301
endDateField: z.string().optional().describe('Field providing the event end date/time (defaults to a single-day event)'),
13021302
titleField: z.string().optional().describe('Field displayed as the event title. Omit to fall back to the record display name (ADR-0079 resolver chain)'),
1303-
colorField: z.string().optional().describe('Field whose value determines the event color'),
1303+
colorField: z.string().optional().describe('Field to derive each event color from (it names a field, not a color): the option color declared on that field for the record value, else the value itself when it already is a color literal (hex, rgb() or hsl()), else the calendar theme-aware palette color hashed from the value'),
13041304
}));
13051305

13061306
/**
@@ -1344,7 +1344,7 @@ export const GanttConfigSchema = lazySchema(() => strictObject({
13441344
titleField: z.string().describe('Field displayed as the task title'),
13451345
progressField: z.string().optional().describe('Field providing the task completion percentage'),
13461346
dependenciesField: z.string().optional().describe("Field listing the task's predecessor (dependency) record ids"),
1347-
colorField: z.string().optional().describe('Field that drives the bar color'),
1347+
colorField: z.string().optional().describe('Field to derive each bar color from (it names a field, not a color): the option color declared on that field for the record value, else the value itself when it already is a color literal (hex, rgb() or hsl()), else a semantic color token derived from the value'),
13481348
// Two-level hierarchy: a parent task id (summary bar) and a row type.
13491349
parentField: z.string().optional().describe('Field holding the parent task id (builds the summary → step tree)'),
13501350
typeField: z.string().optional().describe('Field whose value maps to task/summary/milestone'),

0 commit comments

Comments
 (0)