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
3 changes: 2 additions & 1 deletion content/docs/core/schema-renderer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ ComponentRegistry.register('my-widget', MyWidgetComponent);

```tsx
import { SchemaRenderer } from '@object-ui/react';
import type { PageNodeSchema } from '@object-ui/types';

function App() {
const schema = {
const schema: PageNodeSchema = {
type: 'page',
title: 'Dashboard',
body: [
Expand Down
3 changes: 2 additions & 1 deletion content/docs/guide/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ Replace `src/App.tsx` with:
import '@object-ui/components';
import '@object-ui/fields';
import { SchemaRenderer, SchemaRendererProvider } from '@object-ui/react';
import type { CardSchema } from '@object-ui/types';

const schema = {
const schema: CardSchema = {
type: 'card',
title: 'Team Directory',
description: 'Rendered from JSON metadata',
Expand Down
3 changes: 2 additions & 1 deletion content/docs/guide/schema-playground.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,10 @@ In code, this is a single call:

```tsx
import { SchemaRenderer } from '@object-ui/react';
import type { CardSchema } from '@object-ui/types';

// The schema object (from your editor, API, or file)
const schema = {
const schema: CardSchema = {
type: 'card',
title: 'Hello',
body: { type: 'text', content: 'World' },
Expand Down
5 changes: 3 additions & 2 deletions content/docs/guide/schema-rendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,18 @@ The `SchemaRenderer` is the primary component that interprets your JSON schemas:
```tsx
import { SchemaRenderer } from '@object-ui/react'
import { initializeComponents } from '@object-ui/components'
import type { PageNodeSchema } from '@object-ui/types'
// Side-effect import: loading the package runs its own field registration.
import '@object-ui/fields'

// Register components once at app initialization
initializeComponents()

function App() {
const schema = {
const schema: PageNodeSchema = {
type: "page",
title: "My Dashboard",
body: { type: "text", content: "Hello" }
body: [{ type: "text", content: "Hello" }]
}

return <SchemaRenderer schema={schema} />
Expand Down
23 changes: 17 additions & 6 deletions content/docs/plugins/plugin-charts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ The plugin provides two chart APIs:
```tsx
// Import once in your app entry point
import '@object-ui/plugin-charts'
import type { BarChartSchema } from '@object-ui/plugin-charts'

// Use in schemas
const schema = {
const schema: BarChartSchema = {
type: 'bar-chart',
data: [
{ name: 'Jan', value: 400 },
Expand Down Expand Up @@ -95,7 +96,9 @@ The plugin provides two different chart components:
For basic single-series bar charts, use the simplified `bar-chart` type:

```tsx
const schema = {
import type { BarChartSchema } from '@object-ui/plugin-charts'

const schema: BarChartSchema = {
type: 'bar-chart',
data: [
{ month: 'Jan', sales: 400 },
Expand All @@ -116,7 +119,9 @@ For multi-series charts or line/area charts, use the advanced `chart` type with
##### Bar Chart

```tsx
const schema = {
import type { ChartSchema } from '@object-ui/types'

const schema: ChartSchema = {
type: 'chart',
chartType: 'bar',
data: [
Expand All @@ -139,7 +144,9 @@ const schema = {
##### Line Chart

```tsx
const schema = {
import type { ChartSchema } from '@object-ui/types'

const schema: ChartSchema = {
type: 'chart',
chartType: 'line',
data: [
Expand All @@ -160,7 +167,9 @@ const schema = {
###### Area Chart

```tsx
const schema = {
import type { ChartSchema } from '@object-ui/types'

const schema: ChartSchema = {
type: 'chart',
chartType: 'area',
data: [
Expand Down Expand Up @@ -198,7 +207,9 @@ Each `series` entry names the column it plots (`dataKey`, or the spec spelling `
An `area` chart keeps every key in this example live: `stack` stacks the two primary areas, and the comparison overlay takes both the dash and the opacity (on a `bar` chart the dash would still reach the mark, but a bar has no stroke to dash). Neither key needs `variant: 'comparison'` — a primary series may carry them too, and then it is the overlay's defaults, not the keys, that stay comparison-only.

```tsx
const schema = {
import type { ChartSchema } from '@object-ui/types'

const schema: ChartSchema = {
type: 'chart',
chartType: 'area',
data: [
Expand Down
15 changes: 11 additions & 4 deletions content/docs/plugins/plugin-editor.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ npm install @object-ui/plugin-editor
```tsx
// Import once in your app entry point
import '@object-ui/plugin-editor'
import type { CodeEditorSchema } from '@object-ui/plugin-editor'

// Use in schemas
const schema = {
const schema: CodeEditorSchema = {
type: 'code-editor',
value: 'console.log("Hello, World!");',
language: 'javascript',
Expand Down Expand Up @@ -97,7 +98,9 @@ The Monaco Editor supports 100+ programming languages including:
### JavaScript Editor

```tsx
const schema = {
import type { CodeEditorSchema } from '@object-ui/plugin-editor'

const schema: CodeEditorSchema = {
type: 'code-editor',
value: 'function hello() {\n console.log("Hello!");\n}',
language: 'javascript',
Expand All @@ -109,7 +112,9 @@ const schema = {
### Read-only Code Display

```tsx
const schema = {
import type { CodeEditorSchema } from '@object-ui/plugin-editor'

const schema: CodeEditorSchema = {
type: 'code-editor',
value: 'const API_KEY = "secret";\n// Do not modify',
language: 'typescript',
Expand All @@ -121,7 +126,9 @@ const schema = {
### Python Editor

```tsx
const schema = {
import type { CodeEditorSchema } from '@object-ui/plugin-editor'

const schema: CodeEditorSchema = {
type: 'code-editor',
value: 'def hello():\n print("Hello, World!")',
language: 'python',
Expand Down
4 changes: 3 additions & 1 deletion content/docs/plugins/plugin-map.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ const schema: ObjectMapSchema = {
### With Static Data

```tsx
const schema = {
import type { ObjectMapSchema } from '@object-ui/types'

const schema: ObjectMapSchema = {
type: 'object-map',
staticData: [
{
Expand Down
11 changes: 8 additions & 3 deletions content/docs/plugins/plugin-markdown.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ npm install @object-ui/plugin-markdown
```tsx
// Import once in your app entry point
import '@object-ui/plugin-markdown'
import type { MarkdownSchema } from '@object-ui/plugin-markdown'

// Use in schemas
const schema = {
const schema: MarkdownSchema = {
type: 'markdown',
content: '# Hello World\n\nThis is **markdown** text with [links](https://example.com).'
}
Expand Down Expand Up @@ -333,7 +334,9 @@ await updateData('user-123', { name: 'John Doe' })
Use Tailwind Typography plugin for better markdown styling:

```tsx
const schema = {
import type { MarkdownSchema } from '@object-ui/plugin-markdown'

const schema: MarkdownSchema = {
type: 'markdown',
content: '# My Document\n\nContent here...',
className: 'prose prose-lg prose-slate dark:prose-invert max-w-none'
Expand All @@ -354,7 +357,9 @@ All markdown content is automatically sanitized using `rehype-sanitize` to preve

```tsx
// Safe - HTML tags are sanitized
const schema = {
import type { MarkdownSchema } from '@object-ui/plugin-markdown'

const schema: MarkdownSchema = {
type: 'markdown',
content: '**Safe** markdown with <script>alert("XSS")</script>'
}
Expand Down
6 changes: 4 additions & 2 deletions scripts/__tests__/check-doc-snippet-types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,10 @@ const FENCE = '```';
*/
const README_SAMPLE_DOC = 'content/docs/plugins/plugin-markdown.mdx';
// 195 until objectui#6972 replaced two prop-table rows above it with a
// retirement blockquote (+11 lines); re-declared here, as this pin intends.
const README_SAMPLE_FENCE_LINE = 206;
// retirement blockquote (+11 lines); 206 until objectui#8125's annotation sweep
// added one `import type` line to the page's first block (+1 line);
// re-declared here each time, as this pin intends.
const README_SAMPLE_FENCE_LINE = 207;

/**
* The regex reader objectui#7555 removed from both gates, kept HERE and only
Expand Down
Loading