From 642e4804151dca0a03be7fafe5015b77624d9f34 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 6 Sep 2026 15:28:59 +0000 Subject: [PATCH] docs(plugin-list): compile every README snippet and leave the ungated ledger MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Part of #5174 — batch 24 of the UNGATED_DOCS burn-down. packages/plugin-list/README.md leaves the ledger and every ts/tsx block on the page now compiles against the built types. The gate file's only change is the two lines of that one entry; the strictness region is byte-identical. The 8 diagnostics were three families: - TS7006x4 (implicit any on a callback parameter). Not annotated: the block simply binds ListView with a real self-import, and the parameters then take their types contextually from the shipped ListViewProps. Two are genuinely checked (ViewType and string); onSortChange / onFilterChange are declared any upstream, so those two compile without being checked — measured, and reported rather than smoothed. - TS2657x1 (JSX expressions must have one parent element). The block was a catalogue of two ALTERNATIVE grouping shapes, not two siblings a reader renders together, so it is split into the two blocks it really is rather than wrapped in a fragment that would have taught the wrong thing. - TS2304x3 (ambient names). Real self-imports of ListView, and the Schema section's hand-copied interface replaced by an example annotated against the shipped ListViewSchema. That hand copy had DRIFTED: it claimed six viewType values where the shipped union carries nine (tree, gallery and timeline missing), and the Features bullet named a "List" view type the union has never carried. The replacement annotates against @object-ui/types instead of restating it, and writes the vocabulary as a record keyed by the shipped union, so neither can go stale again without failing this gate. No packages/** source touched, no public type widened, no gate loosened, no new fragment marker (158 to 158). Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr --- packages/plugin-list/README.md | 102 ++++++++++++++++++---------- scripts/check-doc-snippet-types.mjs | 2 - 2 files changed, 67 insertions(+), 37 deletions(-) diff --git a/packages/plugin-list/README.md b/packages/plugin-list/README.md index 2fbd28b34b..703d5cac89 100644 --- a/packages/plugin-list/README.md +++ b/packages/plugin-list/README.md @@ -4,7 +4,8 @@ ListView plugin for ObjectUI - A unified view component with view type switching ## Features -- **View Type Switching**: Switch between Grid, List, Kanban, Calendar, and Chart views +- **View Type Switching**: Switch between Grid, Kanban, Gallery, Calendar, + Timeline, Gantt, Map, Chart and Tree views - **View Persistence**: Automatically saves user's view preference - **Integrated Search**: Full-text search across records - **Filtering**: Advanced filter UI (expandable filter panel) @@ -66,8 +67,12 @@ function ContactsView() { Group rows in grid/gallery views by one or more fields. Two equivalent shapes are supported on the schema: +Spec-compliant: a structured `GroupingConfig` (multi-level, with per-field +options). + ```tsx -// Spec-compliant: structured GroupingConfig (multi-level + per-field options) +import { ListView } from '@object-ui/plugin-list'; + +``` + +Shorthand: a single field name, the shape the visual view-config UI emits. It is +normalized internally into the `GroupingConfig` above — an alternative to the +block before it, never a second view rendered beside it. + +```tsx +import { ListView } from '@object-ui/plugin-list'; -// Shorthand: a single field name (used by the visual view-config UI). -// Internally normalized into the GroupingConfig above. ; - sort?: Array<{ field: string; order: 'asc' | 'desc' }>; - options?: { - grid?: Record; - list?: Record; - kanban?: { - groupField: string; - titleField?: string; - cardFields?: string[]; - }; - calendar?: { - startDateField: string; - endDateField?: string; - titleField: string; - }; - chart?: { - chartType: 'bar' | 'line' | 'pie' | 'area'; - xAxisField: string; - yAxisFields: string[]; - }; - }; -} +import type { ListViewSchema } from '@object-ui/types'; + +const view: ListViewSchema = { + type: 'list-view', + objectName: 'tasks', + viewType: 'grid', + // Spec-canonical column list. The legacy `fields` alias is still accepted on + // input (stored view metadata carries it) and folded into `columns` by + // `normalizeListViewSchema` — but nothing reads it, so emit `columns`. + columns: ['title', 'status', 'assignee'], + filters: [['status', '=', 'open']], + sort: [{ field: 'title', order: 'asc' }], + options: { + grid: {}, + kanban: { groupField: 'status', titleField: 'title', cardFields: ['assignee'] }, + calendar: { startDateField: 'due_date', titleField: 'title' }, + chart: { chartType: 'bar', xAxisField: 'status', yAxisFields: ['amount'] }, + }, +}; + +// `columns` also accepts ListColumn objects in place of the field-name strings. +const richColumns: ListViewSchema['columns'] = [ + { field: 'title', label: 'Title', width: 200 }, +]; + +// The view-type vocabulary, written as a record keyed by the shipped union so +// this list cannot go stale: a value added to or removed from +// ListViewSchema['viewType'] fails this block. +const viewTypes: Record, string> = { + grid: 'Rows and columns', + kanban: 'Cards grouped into columns', + gallery: 'Card grid', + calendar: 'Records on a month / week calendar', + timeline: 'Records bucketed on a date axis', + gantt: 'Bars over a project timeline', + map: 'Records at their geographic coordinates', + chart: 'Aggregated bar / line / pie / area chart', + tree: 'Hierarchical parent-child rows', +}; + +export { view, richColumns, viewTypes }; ``` ## Page binding — `dataSource` (referencing a saved view by name) diff --git a/scripts/check-doc-snippet-types.mjs b/scripts/check-doc-snippet-types.mjs index 610eee05e8..21ff7e8818 100644 --- a/scripts/check-doc-snippet-types.mjs +++ b/scripts/check-doc-snippet-types.mjs @@ -727,8 +727,6 @@ const UNGATED_DOCS = { '6 parse diagnostic(s) — blocks fenced `ts` that are bare object literals or elided bodies', 'packages/plugin-kanban/README.md': '6 parse diagnostic(s) — blocks fenced `ts` that are bare object literals or elided bodies', - 'packages/plugin-list/README.md': - '1 parse diagnostic(s) — blocks fenced `ts` that are bare object literals or elided bodies; 7 undefined-name diagnostic(s) — blocks continue an earlier block, or use ambient names the page never defines', 'packages/plugin-map/README.md': '1 parse diagnostic(s) — blocks fenced `ts` that are bare object literals or elided bodies; 1 undefined-name diagnostic(s) — blocks continue an earlier block, or use ambient names the page never defines; plus TS2322x1 — candidate real defects, un-triaged', 'packages/plugin-markdown/README.md':