From 2c6e3d6465afd4d1afc5957df815cc07b892224f Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 6 Sep 2026 08:25:52 +0000 Subject: [PATCH] docs(plugin-gantt): compile the gantt README's 18 blocks and drop its ledger entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All 18 ts/tsx blocks in `packages/plugin-gantt/README.md` now compile against the built types, so the document leaves `UNGATED_DOCS` in `scripts/check-doc-snippet-types.mjs` — a two-line removal inside the object literal, the only change to the gate file. The 26 measured diagnostics were 13 parse (two bare object literals fenced `typescript`, so neither was a statement), 11 fragment-shape undefined names across four blocks, and two real drifts: - `` did not type-check: `ObjectGanttProps.schema` is `ObjectGanttSchema`, whose `type` is the literal `'object-gantt'`. The direct-React example now spells the type the way this README's other direct-render example already does. The registry still claims both keys; that table is unchanged. - The data-source example's `const schema = { … }` widened `type` to `string` and so was not assignable to `ObjectGanttSchema` where it was passed. It is now annotated with the shipped type, which checks every key in it. The `GanttTask` excerpt keeps its `readme-exports` partial marker and gains the two type imports it always referenced. No `packages/**` source, no widened type, no loosened gate, and no new fragment marker: declared fragments stay at 158, so all 18 blocks earn coverage by compiling. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01MM7kaS4dPpYHV5BsMyu4tQ --- packages/plugin-gantt/README.md | 46 +++++++++++++++++++++-------- scripts/check-doc-snippet-types.mjs | 2 -- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/packages/plugin-gantt/README.md b/packages/plugin-gantt/README.md index 17b504eb2..08de99d2f 100644 --- a/packages/plugin-gantt/README.md +++ b/packages/plugin-gantt/README.md @@ -76,7 +76,14 @@ When you embed the lower-level `` directly, pass `onTaskUpdate` to opt in: ```tsx - void; + +const editableChart = { // `changes` is a Partial>: @@ -86,7 +93,7 @@ to opt in: if (!start || !end) return; save(task.id, { start, end }); }} -/> +/>; ``` ## Installation @@ -212,14 +219,14 @@ that is present wins; if none is present there is no data config at all and the chart renders empty: ```typescript -{ +const recordSource = { type: 'gantt', // Pick ONE of the three: objectName: 'project_tasks', // load through the host DataSource // data: { provider: 'value', items: [ /* records */ ] }, // inline records // staticData: [ /* records */ ], // shorthand for the above -} +}; ``` `data` is the spec's `ViewData` union — `{ provider: 'object', object }`, @@ -239,7 +246,7 @@ it here. Before that flip the flat branch returned first, so an authored `gantt` block was discarded silently. ```typescript -{ +const fieldMapping = { type: 'gantt', objectName: 'project_tasks', @@ -257,7 +264,7 @@ block was discarded silently. // (b) …or the same configuration as one block, which OUTRANKS (a): // gantt: { startDateField: 'start_date', endDateField: 'end_date', … } -} +}; ``` `viewMode` is real authoring surface (`ObjectGanttSchema`, derived from the @@ -391,6 +398,8 @@ the label field is `title` (`src/GanttView.tsx`): ```typescript +import type { GanttDependency, GanttTaskType } from '@object-ui/plugin-gantt'; + interface GanttTask { id: string | number; title: string; @@ -486,10 +495,15 @@ When you render the component yourself, hand the callbacks in as React props: ```tsx import { ObjectGantt } from '@object-ui/plugin-gantt'; +import type { DataSource } from '@object-ui/types'; - console.log('Task clicked:', record)} -/> +/>; ``` To turn editing off from the metadata instead, set `readOnly: true` on the @@ -633,13 +647,18 @@ Two more chrome features ship with it: - **Custom markers** — vertical reference lines beyond the Today marker: ```tsx - +/>; ``` Through the schema, pass the same array as `markers` on the gantt node. @@ -712,13 +731,14 @@ the object and the fields: ```tsx import { createObjectStackAdapter } from '@object-ui/data-objectstack'; import { ObjectGantt } from '@object-ui/plugin-gantt'; +import type { ObjectGanttSchema } from '@object-ui/types'; const dataSource = createObjectStackAdapter({ baseUrl: 'https://api.example.com', token: 'your-auth-token' }); -const schema = { +const schema: ObjectGanttSchema = { type: 'object-gantt', objectName: 'tasks', titleField: 'task_name', @@ -727,7 +747,7 @@ const schema = { progressField: 'progress_percent' }; - +const ganttWithAdapter = ; ``` ⚠️ A `dataSource` key **on the schema node** is a different thing with the same diff --git a/scripts/check-doc-snippet-types.mjs b/scripts/check-doc-snippet-types.mjs index 68dc6bc44..1bb15d56b 100644 --- a/scripts/check-doc-snippet-types.mjs +++ b/scripts/check-doc-snippet-types.mjs @@ -733,8 +733,6 @@ const UNGATED_DOCS = { '5 parse diagnostic(s) — blocks fenced `ts` that are bare object literals or elided bodies; 15 undefined-name diagnostic(s) — blocks continue an earlier block, or use ambient names the page never defines', 'packages/plugin-editor/README.md': '6 parse diagnostic(s) — blocks fenced `ts` that are bare object literals or elided bodies', - 'packages/plugin-gantt/README.md': - '9 parse diagnostic(s) — blocks fenced `ts` that are bare object literals or elided bodies; 12 undefined-name diagnostic(s) — blocks continue an earlier block, or use ambient names the page never defines', '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':