Skip to content
Merged
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
32 changes: 25 additions & 7 deletions packages/plugin-kanban/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,26 @@ const schema: KanbanSchema = {
## Schema API

```typescript
{
import type { KanbanSchema } from '@object-ui/plugin-kanban';

declare const columns: KanbanColumn[];

// The board document. `type` is the only required member — `columns`,
// `onCardMove` and `className` are all optional. The annotation is the type
// this package ships, so each member below is compiled against it rather than
// read as prose: a `columns` array of the wrong shape, or an `onCardMove`
// whose parameters drift from the shipped signature, fails here. An unknown
// key does not — `KanbanSchema` extends `BaseSchema`, whose index signature
// deliberately accepts type-specific extensions, so the compiler is not what
// catches a misspelt board key.
const board: KanbanSchema = {
type: 'kanban',
columns?: KanbanColumn[], // Array of columns
onCardMove?: (cardId, fromColumnId, toColumnId, newIndex) => void,
className?: string // Tailwind classes
}
columns, // Array of columns
onCardMove: (cardId, fromColumnId, toColumnId, newIndex) => {
// see "Example with Callbacks" below
},
className: 'h-full', // Tailwind classes
};

// Column structure
interface KanbanColumn {
Expand Down Expand Up @@ -183,9 +197,13 @@ pnpm build
## Example with Callbacks

```typescript
const schema = {
import type { KanbanColumn, KanbanSchema } from '@object-ui/plugin-kanban';

declare const columns: KanbanColumn[];

const schema: KanbanSchema = {
type: 'kanban',
columns: [...],
columns,
onCardMove: (cardId, fromColumnId, toColumnId, newIndex) => {
console.log(`Card ${cardId} moved from ${fromColumnId} to ${toColumnId} at index ${newIndex}`);
// Update your backend or state here
Expand Down
2 changes: 0 additions & 2 deletions scripts/check-doc-snippet-types.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -716,8 +716,6 @@ const UNGATED_DOCS = {
'5 undefined-name diagnostic(s) — blocks continue an earlier block, or use ambient names the page never defines; 1 unresolved-module diagnostic(s); plus TS17000x1 TS2322x1 — candidate real defects, un-triaged',
'packages/plugin-editor/README.md':
'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-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':
Expand Down
Loading