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
24 changes: 24 additions & 0 deletions .changeset/guide-fabricated-exports-5343.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
---
---

Docs + gate-ledger only (objectui#5343). The getting-started guides under
`content/docs/guide/**` and `content/docs/api/schema-reference.md` documented 14 symbols
the packages do not export; a reader who copied one of those imports got a compile error,
not a degraded render. Each symbol got ONE disposition, taken from the packages' built
`dist/index.d.ts` and applied at every site:

- renamed — `PageSchema` → `PageNodeSchema`, `DashboardSchema` → `DashboardComponentSchema`,
`AppSchema` / `ThemeSchema` / `ReportSchema` → `AppComponentSchema` /
`ThemeComponentSchema` / `ReportComponentSchema` (type and zod entries both),
`componentSchema` → `ComponentSchema`, `registerDefaultRenderers` /
`registerAllComponents` → `initializeComponents()` plus the side-effect
`@object-ui/fields` import, `getComponentRegistry()` → the `ComponentRegistry` singleton;
- wrong package — `BaseSchema`, `PageSchema` and `FormSchema` were claimed from
`@object-ui/core` while they live in `@object-ui/types`;
- removed with nothing replacing it — `InputRenderer`, the `ObjectSchema` / `Field`
builder pair and `getExpressionEvaluator`: those examples are gone and the pages teach
the real surface instead.

No published behaviour changes: no package's runtime source was touched. The
`UNGATED_DOCS` entries in `scripts/check-doc-snippet-types.mjs` are rewritten to the
diagnostic mix each page now measures — every bucket equal or lower, nothing added.
18 changes: 9 additions & 9 deletions content/docs/api/schema-reference.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,7 +10,7 @@ This reference documents every ObjectUI schema type with annotated JSON examples
> **Import:** All types are available from `@object-ui/types`.
>
> ```typescript
> import type { PageSchema, FormSchema, TableSchema, /* ... */ } from '@object-ui/types';
> import type { PageNodeSchema, FormSchema, TableSchema, /* ... */ } from '@object-ui/types';
> ```

---
Expand DownExpand Up@@ -68,7 +68,7 @@ All schema types extend `BaseSchema`. These shared properties are available on e

## Layout Schemas

### PageSchema
### PageNodeSchema

Top-level page container. Defines a full page with optional regions (header, sidebar, footer).

Expand DownExpand Up@@ -196,7 +196,7 @@ A responsive grid layout. Columns can be a fixed number or responsive breakpoint
| `gap` | `number` | Gap between grid items (Tailwind spacing scale). |
| `children` | `SchemaNode \| SchemaNode[]` | Grid items. |

**Related:** [DivSchema](#divschema), [CardSchema](#cardschema), [DashboardSchema](#dashboardschema)
**Related:** [DivSchema](#divschema), [CardSchema](#cardschema), [DashboardComponentSchema](#dashboardcomponentschema)

---

Expand DownExpand Up@@ -233,7 +233,7 @@ A tabbed interface for organizing content into switchable panels.
| `orientation` | `"horizontal" \| "vertical"` | Tab bar orientation. |
| `items` | `TabItem[]` | Tab definitions, each with `value`, `label`, `icon`, `content`, and optional `disabled`. |

**Related:** [CardSchema](#cardschema), [PageSchema](#pageschema)
**Related:** [CardSchema](#cardschema), [PageNodeSchema](#pagenodeschema)

---

Expand DownExpand Up@@ -469,7 +469,7 @@ A chart visualization supporting multiple chart types.
| `animate` | `boolean` | Enable entry animations. |
| `config` | `Record<string, any>` | Additional chart library configuration. |

**Related:** [DashboardSchema](#dashboardschema), [CardSchema](#cardschema)
**Related:** [DashboardComponentSchema](#dashboardcomponentschema), [CardSchema](#cardschema)

---

Expand DownExpand Up@@ -971,7 +971,7 @@ A drag-and-drop Kanban board with columns and cards.

---

### DashboardSchema
### DashboardComponentSchema

A widget-based dashboard with configurable grid layout and auto-refresh.

Expand DownExpand Up@@ -1076,7 +1076,7 @@ A multi-view calendar for displaying and managing events.
| `onEventUpdate` | `function` | Callback when an event is modified. |
| `onDateChange` | `function` | Callback when the visible date range changes. |

**Related:** [ObjectViewSchema](#objectviewschema), [DashboardSchema](#dashboardschema)
**Related:** [ObjectViewSchema](#objectviewschema), [DashboardComponentSchema](#dashboardcomponentschema)

---

Expand DownExpand Up@@ -1281,7 +1281,7 @@ Import only the types you need:

```typescript
// Layout
import type { PageSchema, DivSchema, CardSchema, GridSchema, TabsSchema } from '@object-ui/types';
import type { PageNodeSchema, DivSchema, CardSchema, GridSchema, TabsSchema } from '@object-ui/types';

// Forms
import type { FormSchema, InputSchema, SelectSchema, ButtonSchema } from '@object-ui/types';
Expand All@@ -1296,7 +1296,7 @@ import type { CRUDSchema, ActionSchema, DetailSchema } from '@object-ui/types';
import type { ObjectGridSchema, ObjectFormSchema, ObjectViewSchema } from '@object-ui/types';

// Complex
import type { KanbanSchema, DashboardSchema, CalendarViewSchema } from '@object-ui/types';
import type { KanbanSchema, DashboardComponentSchema, CalendarViewSchema } from '@object-ui/types';

// Views
import type { DetailViewSchema, ViewSwitcherSchema } from '@object-ui/types';
Expand Down
79 changes: 52 additions & 27 deletions content/docs/guide/building-crud-app.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,46 +57,65 @@ Add to your `src/index.css`:
Create `src/setup.ts` to register the built-in component and field renderers:

```ts
import { Registry } from '@object-ui/core';
import { registerAllComponents } from '@object-ui/components';
import { registerAllFields } from '@object-ui/fields';
import { initializeComponents } from '@object-ui/components';
// Side-effect import: loading the package runs its own field registration.
import '@object-ui/fields';

registerAllComponents(Registry);
registerAllFields(Registry);
initializeComponents();
```

Loading each package registers what it owns — the components and the field
widgets go into the one `ComponentRegistry` that `@object-ui/core` exports.
`initializeComponents()` takes no arguments; it exists so a bundler cannot
tree-shake the side-effect import away.

Import this file once at the top of your app entry point (`src/main.tsx` or `src/App.tsx`).

## Step 3: Define the Object Schema

Create `src/schemas/task.ts`. This is the metadata that drives the entire UI — grid columns, form fields, validation, and views are all derived from this schema:

```ts
import { ObjectSchema, Field } from '@object-ui/types';
import type { FieldMetadata } from '@object-ui/types';

const fields: Record<string, FieldMetadata> = {
title: { name: 'title', type: 'text', label: 'Title', required: true },
status: {
name: 'status',
type: 'select',
label: 'Status',
defaultValue: 'Todo',
options: [
{ label: 'Backlog', value: 'Backlog' },
{ label: 'Todo', value: 'Todo' },
{ label: 'In Progress', value: 'In Progress' },
{ label: 'Review', value: 'Review' },
{ label: 'Done', value: 'Done' },
],
},
priority: {
name: 'priority',
type: 'select',
label: 'Priority',
defaultValue: 'Medium',
options: [
{ label: 'Critical', value: 'Critical' },
{ label: 'High', value: 'High' },
{ label: 'Medium', value: 'Medium' },
{ label: 'Low', value: 'Low' },
],
},
assignee: { name: 'assignee', type: 'text', label: 'Assignee' },
due_date: { name: 'due_date', type: 'date', label: 'Due Date' },
description: { name: 'description', type: 'textarea', label: 'Description' },
};

export const TaskSchema = ObjectSchema.create({
export const TaskSchema = {
name: 'task',
label: 'Task',
icon: 'check-circle-2',
titleFormat: '{title}',
fields: {
title: Field.text({
label: 'Title',
required: true,
searchable: true,
}),
status: Field.select(
['Backlog', 'Todo', 'In Progress', 'Review', 'Done'],
{ label: 'Status', defaultValue: 'Todo' }
),
priority: Field.select(
['Critical', 'High', 'Medium', 'Low'],
{ label: 'Priority', defaultValue: 'Medium' }
),
assignee: Field.text({ label: 'Assignee' }),
due_date: Field.date({ label: 'Due Date' }),
description: Field.textarea({ label: 'Description' }),
},
fields,
list_views: {
all: {
label: 'All Tasks',
Expand All@@ -109,10 +128,16 @@ export const TaskSchema = ObjectSchema.create({
sort: [['priority', 'asc']],
},
},
});
};
```

Each `Field.*()` call produces a `FieldMetadata` entry that ObjectUI uses to choose the correct renderer, apply validation, and generate form controls automatically.
An object's metadata is a plain document — the same shape a backend serves from
`DataSource.getObjectSchema()` — so it is written as a literal rather than built
by a helper. `FieldMetadata` is the union every field entry belongs to (`text`,
`select`, `date`, `textarea`, …), and typing the `fields` record against it is
what makes a wrong `type` or a misspelled key fail at compile time. ObjectUI
reads those entries to choose the renderer, apply validation, and generate form
controls automatically.

## Step 4: Create a Data Source

Expand Down
Loading
Loading