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: 3 additions & 0 deletions content/docs/guide/console-architecture.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -129,6 +129,8 @@ Navigation items can be conditionally hidden using expressions:
Actions are typed with `ActionDef` from `@object-ui/core`:

```ts
import { useActionRunner } from '@object-ui/react';

const { execute } = useActionRunner({
context: { objectName: 'contacts' },
});
Expand DownExpand Up@@ -182,6 +184,7 @@ items exist only in `AppSidebar`, which the console no longer mounts (`ConsoleLa

Per-app branding is applied via `AppShell`'s `branding` prop:

<!-- doc-snippet: fragment — a bare JSX opening tag: the section is about the shape of the branding prop, and the element is never closed -->
```tsx
<AppShell branding={{
primaryColor: '#3B82F6',
Expand Down
6 changes: 5 additions & 1 deletion content/docs/guide/data-source.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,7 +11,7 @@ This keeps the renderer backend-agnostic: ObjectStack, REST, GraphQL, and propri
The canonical interface lives in `@object-ui/types`:

```typescript
import type { QueryParams, QueryResult } from '@object-ui/types';
import type { BatchTransactionOperation, QueryParams, QueryResult } from '@object-ui/types';

export interface DataSource<T = unknown> {
find(resource: string, params?: QueryParams): Promise<QueryResult<T>>;
Expand DownExpand Up@@ -82,11 +82,14 @@ import '@object-ui/components';
import '@object-ui/fields';
import { SchemaRenderer, SchemaRendererProvider } from '@object-ui/react';
import { createObjectStackAdapter } from '@object-ui/data-objectstack';
import type { BaseSchema } from '@object-ui/types';

const dataSource = createObjectStackAdapter({
baseUrl: 'https://api.example.com'
});

const mySchema: BaseSchema = { type: 'table', objectName: 'users' };

function App() {
return (
<SchemaRendererProvider dataSource={dataSource}>
Expand DownExpand Up@@ -159,6 +162,7 @@ class UserDataSource implements DataSource<User> {

ObjectUI uses OData-style query keys for broad compatibility:

<!-- doc-snippet: fragment — continues the adapter block above: dataSource is the adapter created there, and repeating its construction here would bury the query keys this section is about -->
```typescript
await dataSource.find('users', {
$select: ['id', 'name', 'email'],
Expand Down
6 changes: 3 additions & 3 deletions content/docs/guide/fields.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,7 +33,7 @@ const MyRatingField = ({ value, onChange }: CellRendererProps) => {
{[1, 2, 3, 4, 5].map(star => (
<span
key={star}
onClick={() => onChange(star)}
onClick={() => onChange?.(star)}
style={{ color: star <= value ? 'gold' : 'grey' }}
>
Expand DownExpand Up@@ -91,7 +91,7 @@ If you are building your own custom component (like a Kanban board card), you ca
```tsx
import { getCellRenderer } from '@object-ui/fields';

export const KanbanCard = ({ task }) => {
export const KanbanCard = ({ task }: { task: { name: string; assignee: string } }) => {
// Get the standard renderer for a 'user' type field
const UserRenderer = getCellRenderer('user');

Expand All@@ -101,7 +101,7 @@ export const KanbanCard = ({ task }) => {
<div className="assignee">
<UserRenderer
value={task.assignee}
field={{ type: 'user' }}
field={{ type: 'user', name: 'assignee' }}
/>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion content/docs/guide/metadata-diagnostics.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -62,6 +62,8 @@ GET /api/v1/meta/diagnostics?severity=error
Response:

```ts
import type { MetadataDiagnostics } from '@object-ui/data-objectstack';

interface MetadataDiagnosticsSummary {
entries: Array<{
type: string;
Expand DownExpand Up@@ -196,7 +198,7 @@ A few high-leverage patterns:
```ts
import { MetadataClient } from '@object-ui/data-objectstack';

const client = new MetadataClient(/* config */);
const client = new MetadataClient({ baseUrl: 'https://api.example.com' });
const summary = await client.diagnostics({ severity: 'error' });
console.log(summary.total, 'invalid item(s)');
```
Expand Down
1 change: 1 addition & 0 deletions content/docs/guide/quick-start.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,6 +40,7 @@ pnpm add -D tailwindcss @tailwindcss/vite

Add Tailwind to your `vite.config.ts`:

<!-- doc-snippet: fragment — a vite.config.ts for the reader's own project: @vitejs/plugin-react and @tailwindcss/vite are the reader's dependencies, not this repository's, so the imports cannot resolve here -->
```ts
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
Expand Down
1 change: 1 addition & 0 deletions content/docs/guide/react-pages.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -177,6 +177,7 @@ only way the new adapter reaches the blocks inside the page. So a host that
constructs a new adapter on every render resets every react page on every
render. Provide it from state or a module constant:

<!-- doc-snippet: fragment — a bad/good contrast of two bare JSX opening tags: neither half is a closed element, and showing them closed would hide the difference the section is about -->
```tsx
// ❌ new adapter object every render — every react page below loses its state
<AdapterCtx.Provider value={new ObjectStackAdapter(config)}>
Expand Down
9 changes: 4 additions & 5 deletions content/docs/guide/schema-playground.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,12 +26,11 @@ Add the playground to any React project with ObjectUI installed:
```tsx
import { useState } from 'react';
import { SchemaRenderer } from '@object-ui/react';
import { registerDefaultRenderers } from '@object-ui/components';
import { registerAllFields } from '@object-ui/fields';
import { Registry } from '@object-ui/core';
import { initializeComponents } from '@object-ui/components';
// Side-effect import: loading the package runs its own field registration.
import '@object-ui/fields';

registerDefaultRenderers();
registerAllFields(Registry);
initializeComponents();

function SchemaPlayground() {
const [schema, setSchema] = useState('{\n "type": "button",\n "label": "Click me"\n}');
Expand Down
1 change: 1 addition & 0 deletions content/docs/guide/slotted-pages.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -147,6 +147,7 @@ same rules as `action:bar`:
regardless of how few actions exist (the synthesized Share / Delete
use this).

<!-- doc-snippet: fragment — a metadata excerpt: the bare slots: key is one fragment of a page schema, shown without the document that would contain it -->
```ts
slots: {
header: {
Expand Down
Loading
Loading