@agent-native/core 0.41.1 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action.d.ts +13 -1
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js.map +1 -1
- package/dist/agent/production-agent.d.ts +8 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +93 -0
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/cli/app-skill.d.ts +16 -0
- package/dist/cli/app-skill.d.ts.map +1 -1
- package/dist/cli/app-skill.js +33 -3
- package/dist/cli/app-skill.js.map +1 -1
- package/dist/cli/pr-visual-recap-workflow.d.ts +1 -1
- package/dist/cli/pr-visual-recap-workflow.d.ts.map +1 -1
- package/dist/cli/pr-visual-recap-workflow.js +1 -1
- package/dist/cli/pr-visual-recap-workflow.js.map +1 -1
- package/dist/cli/recap.d.ts.map +1 -1
- package/dist/cli/recap.js +14 -3
- package/dist/cli/recap.js.map +1 -1
- package/dist/cli/skills.d.ts +34 -3
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +172 -48
- package/dist/cli/skills.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +2 -2
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +172 -5
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/blocks/library/AnnotatedCodeBlock.d.ts +19 -0
- package/dist/client/blocks/library/AnnotatedCodeBlock.d.ts.map +1 -1
- package/dist/client/blocks/library/AnnotatedCodeBlock.js +5 -57
- package/dist/client/blocks/library/AnnotatedCodeBlock.js.map +1 -1
- package/dist/client/blocks/library/ApiEndpointBlock.d.ts.map +1 -1
- package/dist/client/blocks/library/ApiEndpointBlock.js +116 -7
- package/dist/client/blocks/library/ApiEndpointBlock.js.map +1 -1
- package/dist/client/blocks/library/DataModelBlock.d.ts.map +1 -1
- package/dist/client/blocks/library/DataModelBlock.js +75 -9
- package/dist/client/blocks/library/DataModelBlock.js.map +1 -1
- package/dist/client/blocks/library/DiffBlock.d.ts +1 -1
- package/dist/client/blocks/library/DiffBlock.d.ts.map +1 -1
- package/dist/client/blocks/library/DiffBlock.js +195 -34
- package/dist/client/blocks/library/DiffBlock.js.map +1 -1
- package/dist/client/blocks/library/HighlightedCode.d.ts +1 -1
- package/dist/client/blocks/library/HighlightedCode.js +1 -1
- package/dist/client/blocks/library/HighlightedCode.js.map +1 -1
- package/dist/client/blocks/library/annotation-rail.d.ts +96 -0
- package/dist/client/blocks/library/annotation-rail.d.ts.map +1 -0
- package/dist/client/blocks/library/annotation-rail.js +120 -0
- package/dist/client/blocks/library/annotation-rail.js.map +1 -0
- package/dist/client/blocks/library/api-endpoint.config.d.ts +31 -6
- package/dist/client/blocks/library/api-endpoint.config.d.ts.map +1 -1
- package/dist/client/blocks/library/api-endpoint.config.js +30 -6
- package/dist/client/blocks/library/api-endpoint.config.js.map +1 -1
- package/dist/client/blocks/library/code.d.ts.map +1 -1
- package/dist/client/blocks/library/code.js +32 -15
- package/dist/client/blocks/library/code.js.map +1 -1
- package/dist/client/blocks/library/columns.d.ts.map +1 -1
- package/dist/client/blocks/library/columns.js +56 -35
- package/dist/client/blocks/library/columns.js.map +1 -1
- package/dist/client/blocks/library/data-model.config.d.ts +17 -0
- package/dist/client/blocks/library/data-model.config.d.ts.map +1 -1
- package/dist/client/blocks/library/data-model.config.js +15 -0
- package/dist/client/blocks/library/data-model.config.js.map +1 -1
- package/dist/client/blocks/library/diff.config.d.ts +28 -6
- package/dist/client/blocks/library/diff.config.d.ts.map +1 -1
- package/dist/client/blocks/library/diff.config.js +30 -6
- package/dist/client/blocks/library/diff.config.js.map +1 -1
- package/dist/client/blocks/types.d.ts +2 -2
- package/dist/client/blocks/types.d.ts.map +1 -1
- package/dist/client/blocks/types.js.map +1 -1
- package/dist/client/rich-markdown-editor/DragHandle.d.ts.map +1 -1
- package/dist/client/rich-markdown-editor/DragHandle.js +75 -9
- package/dist/client/rich-markdown-editor/DragHandle.js.map +1 -1
- package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts +25 -1
- package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts.map +1 -1
- package/dist/client/rich-markdown-editor/RegistryBlockNode.js +29 -6
- package/dist/client/rich-markdown-editor/RegistryBlockNode.js.map +1 -1
- package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts +8 -1
- package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts.map +1 -1
- package/dist/client/rich-markdown-editor/SharedRichEditor.js +5 -1
- package/dist/client/rich-markdown-editor/SharedRichEditor.js.map +1 -1
- package/dist/extensions/actions.d.ts.map +1 -1
- package/dist/extensions/actions.js +159 -12
- package/dist/extensions/actions.js.map +1 -1
- package/dist/extensions/store.d.ts +21 -0
- package/dist/extensions/store.d.ts.map +1 -1
- package/dist/extensions/store.js +33 -1
- package/dist/extensions/store.js.map +1 -1
- package/dist/server/recap-image-route.d.ts.map +1 -1
- package/dist/server/recap-image-route.js +12 -3
- package/dist/server/recap-image-route.js.map +1 -1
- package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +30 -5
- package/docs/content/plan-plugin.md +107 -0
- package/docs/content/skills-guide.md +8 -0
- package/docs/content/visual-plans.md +2 -0
- package/package.json +1 -1
- package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +30 -5
|
@@ -5,8 +5,9 @@ import { defineBlock } from "../types.js";
|
|
|
5
5
|
import { columnsSchema, columnsMdx, } from "./columns.config.js";
|
|
6
6
|
/**
|
|
7
7
|
* Standard `columns` block: a multi-column side-by-side container whose columns
|
|
8
|
-
* each hold a list of child blocks.
|
|
9
|
-
*
|
|
8
|
+
* each hold a list of child blocks. A column's optional `label` renders as a
|
|
9
|
+
* small heading above that column (e.g. `Before` / `After`), so a comparison
|
|
10
|
+
* names its states outside the content — never baked into a child wireframe.
|
|
10
11
|
*
|
|
11
12
|
* Like `tabs`, child rendering flows through `ctx.renderBlock` — the app's own
|
|
12
13
|
* block dispatcher — so registered children render via their spec and
|
|
@@ -37,6 +38,10 @@ function gridColsClass(count) {
|
|
|
37
38
|
const API_REFERENCE_BLOCK_TYPES = new Set(["api-endpoint", "openapi-spec"]);
|
|
38
39
|
const BEFORE_LABELS = new Set(["before", "old", "previous", "current"]);
|
|
39
40
|
const AFTER_LABELS = new Set(["after", "new", "next", "target"]);
|
|
41
|
+
// Wireframe surfaces that render too wide to survive a half-width comparison
|
|
42
|
+
// column: a full desktop page or browser frame shrinks and crops when squeezed
|
|
43
|
+
// side by side, so a comparison that holds one of these stacks vertically.
|
|
44
|
+
const WIDE_WIREFRAME_SURFACES = new Set(["desktop", "browser"]);
|
|
40
45
|
function normalizedLabel(column) {
|
|
41
46
|
return column.label?.trim().toLowerCase() ?? "";
|
|
42
47
|
}
|
|
@@ -45,6 +50,16 @@ function isComparisonGroup(columns) {
|
|
|
45
50
|
return (labels.some((label) => BEFORE_LABELS.has(label)) &&
|
|
46
51
|
labels.some((label) => AFTER_LABELS.has(label)));
|
|
47
52
|
}
|
|
53
|
+
/** A wireframe child whose `surface` is wide enough to need full document width. */
|
|
54
|
+
function isWideWireframeBlock(block) {
|
|
55
|
+
if (block.type !== "wireframe")
|
|
56
|
+
return false;
|
|
57
|
+
const surface = block.data?.surface;
|
|
58
|
+
return typeof surface === "string" && WIDE_WIREFRAME_SURFACES.has(surface);
|
|
59
|
+
}
|
|
60
|
+
function hasWideWireframe(columns) {
|
|
61
|
+
return columns.some((column) => column.blocks.some(isWideWireframeBlock));
|
|
62
|
+
}
|
|
48
63
|
function isApiReferenceGroup(columns) {
|
|
49
64
|
return (columns.length > 1 &&
|
|
50
65
|
!isComparisonGroup(columns) &&
|
|
@@ -52,9 +67,15 @@ function isApiReferenceGroup(columns) {
|
|
|
52
67
|
column.blocks.every((block) => API_REFERENCE_BLOCK_TYPES.has(block.type))));
|
|
53
68
|
}
|
|
54
69
|
function columnsLayoutClass(columns) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
70
|
+
// API reference groups always read as a single stacked column.
|
|
71
|
+
if (isApiReferenceGroup(columns))
|
|
72
|
+
return COLS_CLASS[1];
|
|
73
|
+
// Wide wireframes (full desktop / browser surfaces) crop when squeezed into a
|
|
74
|
+
// half-width comparison cell, so stack the states vertically and let each
|
|
75
|
+
// frame use the full document width. Narrow surfaces stay side by side.
|
|
76
|
+
if (hasWideWireframe(columns))
|
|
77
|
+
return COLS_CLASS[1];
|
|
78
|
+
return gridColsClass(columns.length);
|
|
58
79
|
}
|
|
59
80
|
function isBlankRichTextBlock(block) {
|
|
60
81
|
if (block.type !== "rich-text")
|
|
@@ -81,7 +102,7 @@ function areSameBlocks(a, b) {
|
|
|
81
102
|
}
|
|
82
103
|
/** Read renderer: a responsive grid of columns, each child rendered read-only. */
|
|
83
104
|
export function ColumnsBlockReader({ data, blockId, title, ctx, }) {
|
|
84
|
-
return (_jsxs("section", { className: "plan-block", "data-block-id": blockId, children: [title && _jsx("div", { className: "plan-block-label", children: title }), _jsx("div", { className: cn("grid gap-6", columnsLayoutClass(data.columns)), children: data.columns.map((column) => (
|
|
105
|
+
return (_jsxs("section", { className: "plan-block", "data-block-id": blockId, children: [title && _jsx("div", { className: "plan-block-label", children: title }), _jsx("div", { className: cn("grid gap-6", columnsLayoutClass(data.columns)), children: data.columns.map((column) => (_jsxs("div", { className: "min-w-0", children: [column.label && (_jsx("h4", { className: "plan-columns-label", children: column.label })), _jsx("div", { children: column.blocks.map((child) => (_jsx("div", { children: ctx.renderBlock?.({ block: child, editing: false }) }, child.id))) })] }, column.id))) })] }));
|
|
85
106
|
}
|
|
86
107
|
/**
|
|
87
108
|
* Editor: the same responsive grid, with child blocks rendered editable in
|
|
@@ -103,36 +124,36 @@ export function ColumnsBlockEditor({ data, onChange, editable, blockId, ctx, })
|
|
|
103
124
|
blocks: column.blocks.map((existing) => existing.id === child.id ? child : existing),
|
|
104
125
|
}
|
|
105
126
|
: column));
|
|
106
|
-
return (_jsx("div", { "data-columns-edit-block": blockId, className: "grid gap-3", children: _jsx("div", { className: cn("grid gap-6", columnsLayoutClass(data.columns)), children: data.columns.map((column) => (
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
127
|
+
return (_jsx("div", { "data-columns-edit-block": blockId, className: "grid gap-3", children: _jsx("div", { className: cn("grid gap-6", columnsLayoutClass(data.columns)), children: data.columns.map((column) => (_jsxs("div", { className: "min-w-0", children: [column.label && (_jsx("h4", { className: "plan-columns-label", children: column.label })), _jsx("div", { children: ctx.renderBlocksEditor
|
|
128
|
+
? ctx.renderBlocksEditor({
|
|
129
|
+
blocks: column.blocks,
|
|
130
|
+
onChange: (nextBlocks) => {
|
|
131
|
+
if (areSameBlocks(nextBlocks, column.blocks))
|
|
132
|
+
return;
|
|
133
|
+
onChange({
|
|
134
|
+
columns: data.columns.map((existing) => existing.id === column.id
|
|
135
|
+
? {
|
|
136
|
+
...existing,
|
|
137
|
+
blocks: nextBlocks,
|
|
138
|
+
}
|
|
139
|
+
: existing),
|
|
140
|
+
}, {
|
|
141
|
+
containerRegion: {
|
|
142
|
+
regionId: column.id,
|
|
116
143
|
blocks: nextBlocks,
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
},
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
})
|
|
131
|
-
: column.blocks.map((child) => (_jsx("div", { children: ctx.renderBlock?.({
|
|
132
|
-
block: child,
|
|
133
|
-
editing: true,
|
|
134
|
-
onChange: (next) => updateChild(column.id, next),
|
|
135
|
-
}) }, child.id))) }) }, column.id))) }) }));
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
},
|
|
147
|
+
editable,
|
|
148
|
+
containerBlockId: blockId,
|
|
149
|
+
regionId: column.id,
|
|
150
|
+
regionLabel: column.label,
|
|
151
|
+
})
|
|
152
|
+
: column.blocks.map((child) => (_jsx("div", { children: ctx.renderBlock?.({
|
|
153
|
+
block: child,
|
|
154
|
+
editing: true,
|
|
155
|
+
onChange: (next) => updateChild(column.id, next),
|
|
156
|
+
}) }, child.id))) })] }, column.id))) }) }));
|
|
136
157
|
}
|
|
137
158
|
/**
|
|
138
159
|
* The standard columns block spec (with React `Read`/`Edit`). Apps register this
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columns.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/columns.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAO1C,OAAO,EACL,aAAa,EACb,UAAU,GAGX,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;;GAWG;AAEH,0EAA0E;AAC1E,SAAS,QAAQ;IACf,OAAO,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;AAC1D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,GAA2B;IACzC,CAAC,EAAE,aAAa;IAChB,CAAC,EAAE,4BAA4B;IAC/B,CAAC,EAAE,4BAA4B;IAC/B,CAAC,EAAE,4BAA4B;CAChC,CAAC;AAEF,6EAA6E;AAC7E,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;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.js\";\nimport { defineBlock } from \"../types.js\";\nimport type {\n BlockContainerRegion,\n BlockEditProps,\n BlockReadProps,\n NestedBlock,\n} from \"../types.js\";\nimport {\n columnsSchema,\n columnsMdx,\n type ColumnsData,\n type ColumnsColumn,\n} from \"./columns.config.js\";\n\n/**\n * Standard `columns` block: a multi-column side-by-side container whose columns\n * each hold a list of child blocks. Labels may still exist in stored data for\n * source round-tripping, but the document UI intentionally renders bare regions.\n *\n * Like `tabs`, child rendering flows through `ctx.renderBlock` — the app's own\n * block dispatcher — so registered children render via their spec and\n * unconverted children fall through the app's legacy switch. This is the\n * coexistence seam: the core columns block never has to know app-specific child\n * block types. The plan CSS classes (`plan-block`, `text-plan-*`) resolve\n * against the plan app's stylesheet at render time.\n */\n\n/** Mint a reasonably-unique column id without pulling a dep into core. */\nfunction newColId(): string {\n return `col-${Math.random().toString(36).slice(2, 10)}`;\n}\n\n/**\n * Tailwind grid-column classes keyed by the column count. The grid collapses to\n * a single column on small screens and fans out to the column count at `md`+, so\n * narrow viewports stack the panels instead of crushing them.\n */\nconst COLS_CLASS: Record<number, string> = {\n 1: \"grid-cols-1\",\n 2: \"grid-cols-1 md:grid-cols-2\",\n 3: \"grid-cols-1 md:grid-cols-3\",\n 4: \"grid-cols-1 md:grid-cols-4\",\n};\n\n/** Resolve the responsive grid class for a column count (clamped to 1–4). */\nfunction gridColsClass(count: number): string {\n return COLS_CLASS[Math.min(4, Math.max(1, count))] ?? COLS_CLASS[1];\n}\n\nconst API_REFERENCE_BLOCK_TYPES = new Set([\"api-endpoint\", \"openapi-spec\"]);\nconst BEFORE_LABELS = new Set([\"before\", \"old\", \"previous\", \"current\"]);\nconst AFTER_LABELS = new Set([\"after\", \"new\", \"next\", \"target\"]);\n\nfunction normalizedLabel(column: ColumnsColumn): string {\n return column.label?.trim().toLowerCase() ?? \"\";\n}\n\nfunction isComparisonGroup(columns: ColumnsColumn[]): boolean {\n const labels = columns.map(normalizedLabel);\n return (\n labels.some((label) => BEFORE_LABELS.has(label)) &&\n labels.some((label) => AFTER_LABELS.has(label))\n );\n}\n\nfunction isApiReferenceGroup(columns: ColumnsColumn[]): boolean {\n return (\n columns.length > 1 &&\n !isComparisonGroup(columns) &&\n columns.every(\n (column) =>\n column.blocks.length > 0 &&\n column.blocks.every((block) =>\n API_REFERENCE_BLOCK_TYPES.has(block.type),\n ),\n )\n );\n}\n\nfunction columnsLayoutClass(columns: ColumnsColumn[]): string {\n return isApiReferenceGroup(columns)\n ? COLS_CLASS[1]\n : gridColsClass(columns.length);\n}\n\nfunction isBlankRichTextBlock(block: NestedBlock): boolean {\n if (block.type !== \"rich-text\") return false;\n const data = block.data;\n if (!data || typeof data !== \"object\" || Array.isArray(data)) return false;\n const markdown = (data as { markdown?: unknown }).markdown;\n return typeof markdown === \"string\" && markdown.trim().length === 0;\n}\n\nfunction isEffectivelyEmptyRegion(blocks: NestedBlock[]): boolean {\n return (\n blocks.length === 0 ||\n (blocks.length === 1 && isBlankRichTextBlock(blocks[0]!))\n );\n}\n\nfunction areSameBlocks(a: NestedBlock[], b: NestedBlock[]): boolean {\n if (a === b) return true;\n try {\n return JSON.stringify(a) === JSON.stringify(b);\n } catch {\n return false;\n }\n}\n\n/** Read renderer: a responsive grid of columns, each child rendered read-only. */\nexport function ColumnsBlockReader({\n data,\n blockId,\n title,\n ctx,\n}: BlockReadProps<ColumnsData>) {\n return (\n <section className=\"plan-block\" data-block-id={blockId}>\n {title && <div className=\"plan-block-label\">{title}</div>}\n <div className={cn(\"grid gap-6\", columnsLayoutClass(data.columns))}>\n {data.columns.map((column) => (\n <div key={column.id} className=\"min-w-0\">\n <div>\n {column.blocks.map((child) => (\n <div key={child.id}>\n {ctx.renderBlock?.({ block: child, editing: false })}\n </div>\n ))}\n </div>\n </div>\n ))}\n </div>\n </section>\n );\n}\n\n/**\n * Editor: the same responsive grid, with child blocks rendered editable in\n * place through the app dispatcher. A child change updates that child within\n * its column and commits the whole\n * columns block — mirroring the legacy `tabs` onChange bubbling so the plan's\n * recursive `updateBlocks`/`findBlock` (`PlanContentRenderer`) keeps working.\n *\n * Renders BARE (no `plan-block` section / title): in edit mode the app's block\n * dispatcher already wraps registered editors in a titled `plan-block` section,\n * so wrapping again here would double-nest. The read renderer owns its own\n * section because read mode renders the spec directly.\n */\nexport function ColumnsBlockEditor({\n data,\n onChange,\n editable,\n blockId,\n ctx,\n}: BlockEditProps<ColumnsData>) {\n const commit = (columns: ColumnsColumn[]) => onChange({ columns });\n\n const updateChild = (columnId: string, child: NestedBlock) =>\n commit(\n data.columns.map((column) =>\n column.id === columnId\n ? {\n ...column,\n blocks: column.blocks.map((existing) =>\n existing.id === child.id ? child : existing,\n ),\n }\n : column,\n ),\n );\n\n return (\n <div data-columns-edit-block={blockId} className=\"grid gap-3\">\n <div className={cn(\"grid gap-6\", columnsLayoutClass(data.columns))}>\n {data.columns.map((column) => (\n <div key={column.id} className=\"min-w-0\">\n <div>\n {ctx.renderBlocksEditor\n ? ctx.renderBlocksEditor({\n blocks: column.blocks,\n onChange: (nextBlocks) => {\n if (areSameBlocks(nextBlocks, column.blocks)) return;\n onChange(\n {\n columns: data.columns.map((existing) =>\n existing.id === column.id\n ? {\n ...existing,\n blocks: nextBlocks,\n }\n : existing,\n ),\n },\n {\n containerRegion: {\n regionId: column.id,\n blocks: nextBlocks,\n },\n },\n );\n },\n editable,\n containerBlockId: blockId,\n regionId: column.id,\n regionLabel: column.label,\n })\n : column.blocks.map((child) => (\n <div key={child.id}>\n {ctx.renderBlock?.({\n block: child,\n editing: true,\n onChange: (next) => updateChild(column.id, next),\n })}\n </div>\n ))}\n </div>\n </div>\n ))}\n </div>\n </div>\n );\n}\n\n/**\n * The standard columns block spec (with React `Read`/`Edit`). Apps register this\n * in their browser registry. The schema + MDX config come from\n * `./columns.config.ts`, the exact same object server / agent code registers, so\n * rendering and source round-trip never drift.\n */\nexport const columnsBlock = defineBlock<ColumnsData>({\n type: \"columns\",\n schema: columnsSchema,\n mdx: columnsMdx,\n Read: ColumnsBlockReader,\n Edit: ColumnsBlockEditor,\n placement: [\"block\"],\n editSurface: \"container\",\n container: {\n regions: (data): BlockContainerRegion[] => data.columns,\n updateRegion: (data, regionId, blocks) => {\n const shouldRemoveRegion =\n data.columns.length > 1 && isEffectivelyEmptyRegion(blocks);\n\n return {\n columns: data.columns\n .map((column) =>\n column.id === regionId ? { ...column, blocks } : column,\n )\n .filter((column) => column.id !== regionId || !shouldRemoveRegion),\n };\n },\n addRegion: (data, afterRegionId) => {\n if (data.columns.length >= 4) return data;\n const nextColumn: ColumnsColumn = {\n id: newColId(),\n blocks: [],\n };\n if (!afterRegionId) return { columns: [...data.columns, nextColumn] };\n const afterIndex = data.columns.findIndex(\n (column) => column.id === afterRegionId,\n );\n if (afterIndex < 0) return { columns: [...data.columns, nextColumn] };\n return {\n columns: [\n ...data.columns.slice(0, afterIndex + 1),\n nextColumn,\n ...data.columns.slice(afterIndex + 1),\n ],\n };\n },\n removeRegion: (data, regionId) => {\n if (data.columns.length <= 1) return data;\n return {\n columns: data.columns.filter((column) => column.id !== regionId),\n };\n },\n },\n label: \"Columns\",\n icon: IconColumns,\n description:\n \"A multi-column side-by-side layout container; each column holds its own list of blocks. Ideal for before/after or current/target comparisons.\",\n empty: () => ({\n columns: [\n { id: newColId(), blocks: [] },\n { id: newColId(), blocks: [] },\n ],\n }),\n});\n"]}
|
|
1
|
+
{"version":3,"file":"columns.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/columns.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAO1C,OAAO,EACL,aAAa,EACb,UAAU,GAGX,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;GAYG;AAEH,0EAA0E;AAC1E,SAAS,QAAQ;IACf,OAAO,OAAO,IAAI,CAAC,MAAM,EA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AE,EAAE,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;SAC/B;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { IconColumns } from \"@tabler/icons-react\";\nimport { cn } from \"../../utils.js\";\nimport { defineBlock } from \"../types.js\";\nimport type {\n BlockContainerRegion,\n BlockEditProps,\n BlockReadProps,\n NestedBlock,\n} from \"../types.js\";\nimport {\n columnsSchema,\n columnsMdx,\n type ColumnsData,\n type ColumnsColumn,\n} from \"./columns.config.js\";\n\n/**\n * Standard `columns` block: a multi-column side-by-side container whose columns\n * each hold a list of child blocks. A column's optional `label` renders as a\n * small heading above that column (e.g. `Before` / `After`), so a comparison\n * names its states outside the content — never baked into a child wireframe.\n *\n * Like `tabs`, child rendering flows through `ctx.renderBlock` — the app's own\n * block dispatcher — so registered children render via their spec and\n * unconverted children fall through the app's legacy switch. This is the\n * coexistence seam: the core columns block never has to know app-specific child\n * block types. The plan CSS classes (`plan-block`, `text-plan-*`) resolve\n * against the plan app's stylesheet at render time.\n */\n\n/** Mint a reasonably-unique column id without pulling a dep into core. */\nfunction newColId(): string {\n return `col-${Math.random().toString(36).slice(2, 10)}`;\n}\n\n/**\n * Tailwind grid-column classes keyed by the column count. The grid collapses to\n * a single column on small screens and fans out to the column count at `md`+, so\n * narrow viewports stack the panels instead of crushing them.\n */\nconst COLS_CLASS: Record<number, string> = {\n 1: \"grid-cols-1\",\n 2: \"grid-cols-1 md:grid-cols-2\",\n 3: \"grid-cols-1 md:grid-cols-3\",\n 4: \"grid-cols-1 md:grid-cols-4\",\n};\n\n/** Resolve the responsive grid class for a column count (clamped to 1–4). */\nfunction gridColsClass(count: number): string {\n return COLS_CLASS[Math.min(4, Math.max(1, count))] ?? COLS_CLASS[1];\n}\n\nconst API_REFERENCE_BLOCK_TYPES = new Set([\"api-endpoint\", \"openapi-spec\"]);\nconst BEFORE_LABELS = new Set([\"before\", \"old\", \"previous\", \"current\"]);\nconst AFTER_LABELS = new Set([\"after\", \"new\", \"next\", \"target\"]);\n\n// Wireframe surfaces that render too wide to survive a half-width comparison\n// column: a full desktop page or browser frame shrinks and crops when squeezed\n// side by side, so a comparison that holds one of these stacks vertically.\nconst WIDE_WIREFRAME_SURFACES = new Set([\"desktop\", \"browser\"]);\n\nfunction normalizedLabel(column: ColumnsColumn): string {\n return column.label?.trim().toLowerCase() ?? \"\";\n}\n\nfunction isComparisonGroup(columns: ColumnsColumn[]): boolean {\n const labels = columns.map(normalizedLabel);\n return (\n labels.some((label) => BEFORE_LABELS.has(label)) &&\n labels.some((label) => AFTER_LABELS.has(label))\n );\n}\n\n/** A wireframe child whose `surface` is wide enough to need full document width. */\nfunction isWideWireframeBlock(block: NestedBlock): boolean {\n if (block.type !== \"wireframe\") return false;\n const surface = (block.data as { surface?: unknown } | undefined)?.surface;\n return typeof surface === \"string\" && WIDE_WIREFRAME_SURFACES.has(surface);\n}\n\nfunction hasWideWireframe(columns: ColumnsColumn[]): boolean {\n return columns.some((column) => column.blocks.some(isWideWireframeBlock));\n}\n\nfunction isApiReferenceGroup(columns: ColumnsColumn[]): boolean {\n return (\n columns.length > 1 &&\n !isComparisonGroup(columns) &&\n columns.every(\n (column) =>\n column.blocks.length > 0 &&\n column.blocks.every((block) =>\n API_REFERENCE_BLOCK_TYPES.has(block.type),\n ),\n )\n );\n}\n\nfunction columnsLayoutClass(columns: ColumnsColumn[]): string {\n // API reference groups always read as a single stacked column.\n if (isApiReferenceGroup(columns)) return COLS_CLASS[1];\n // Wide wireframes (full desktop / browser surfaces) crop when squeezed into a\n // half-width comparison cell, so stack the states vertically and let each\n // frame use the full document width. Narrow surfaces stay side by side.\n if (hasWideWireframe(columns)) return COLS_CLASS[1];\n return gridColsClass(columns.length);\n}\n\nfunction isBlankRichTextBlock(block: NestedBlock): boolean {\n if (block.type !== \"rich-text\") return false;\n const data = block.data;\n if (!data || typeof data !== \"object\" || Array.isArray(data)) return false;\n const markdown = (data as { markdown?: unknown }).markdown;\n return typeof markdown === \"string\" && markdown.trim().length === 0;\n}\n\nfunction isEffectivelyEmptyRegion(blocks: NestedBlock[]): boolean {\n return (\n blocks.length === 0 ||\n (blocks.length === 1 && isBlankRichTextBlock(blocks[0]!))\n );\n}\n\nfunction areSameBlocks(a: NestedBlock[], b: NestedBlock[]): boolean {\n if (a === b) return true;\n try {\n return JSON.stringify(a) === JSON.stringify(b);\n } catch {\n return false;\n }\n}\n\n/** Read renderer: a responsive grid of columns, each child rendered read-only. */\nexport function ColumnsBlockReader({\n data,\n blockId,\n title,\n ctx,\n}: BlockReadProps<ColumnsData>) {\n return (\n <section className=\"plan-block\" data-block-id={blockId}>\n {title && <div className=\"plan-block-label\">{title}</div>}\n <div className={cn(\"grid gap-6\", columnsLayoutClass(data.columns))}>\n {data.columns.map((column) => (\n <div key={column.id} className=\"min-w-0\">\n {column.label && (\n <h4 className=\"plan-columns-label\">{column.label}</h4>\n )}\n <div>\n {column.blocks.map((child) => (\n <div key={child.id}>\n {ctx.renderBlock?.({ block: child, editing: false })}\n </div>\n ))}\n </div>\n </div>\n ))}\n </div>\n </section>\n );\n}\n\n/**\n * Editor: the same responsive grid, with child blocks rendered editable in\n * place through the app dispatcher. A child change updates that child within\n * its column and commits the whole\n * columns block — mirroring the legacy `tabs` onChange bubbling so the plan's\n * recursive `updateBlocks`/`findBlock` (`PlanContentRenderer`) keeps working.\n *\n * Renders BARE (no `plan-block` section / title): in edit mode the app's block\n * dispatcher already wraps registered editors in a titled `plan-block` section,\n * so wrapping again here would double-nest. The read renderer owns its own\n * section because read mode renders the spec directly.\n */\nexport function ColumnsBlockEditor({\n data,\n onChange,\n editable,\n blockId,\n ctx,\n}: BlockEditProps<ColumnsData>) {\n const commit = (columns: ColumnsColumn[]) => onChange({ columns });\n\n const updateChild = (columnId: string, child: NestedBlock) =>\n commit(\n data.columns.map((column) =>\n column.id === columnId\n ? {\n ...column,\n blocks: column.blocks.map((existing) =>\n existing.id === child.id ? child : existing,\n ),\n }\n : column,\n ),\n );\n\n return (\n <div data-columns-edit-block={blockId} className=\"grid gap-3\">\n <div className={cn(\"grid gap-6\", columnsLayoutClass(data.columns))}>\n {data.columns.map((column) => (\n <div key={column.id} className=\"min-w-0\">\n {column.label && (\n <h4 className=\"plan-columns-label\">{column.label}</h4>\n )}\n <div>\n {ctx.renderBlocksEditor\n ? ctx.renderBlocksEditor({\n blocks: column.blocks,\n onChange: (nextBlocks) => {\n if (areSameBlocks(nextBlocks, column.blocks)) return;\n onChange(\n {\n columns: data.columns.map((existing) =>\n existing.id === column.id\n ? {\n ...existing,\n blocks: nextBlocks,\n }\n : existing,\n ),\n },\n {\n containerRegion: {\n regionId: column.id,\n blocks: nextBlocks,\n },\n },\n );\n },\n editable,\n containerBlockId: blockId,\n regionId: column.id,\n regionLabel: column.label,\n })\n : column.blocks.map((child) => (\n <div key={child.id}>\n {ctx.renderBlock?.({\n block: child,\n editing: true,\n onChange: (next) => updateChild(column.id, next),\n })}\n </div>\n ))}\n </div>\n </div>\n ))}\n </div>\n </div>\n );\n}\n\n/**\n * The standard columns block spec (with React `Read`/`Edit`). Apps register this\n * in their browser registry. The schema + MDX config come from\n * `./columns.config.ts`, the exact same object server / agent code registers, so\n * rendering and source round-trip never drift.\n */\nexport const columnsBlock = defineBlock<ColumnsData>({\n type: \"columns\",\n schema: columnsSchema,\n mdx: columnsMdx,\n Read: ColumnsBlockReader,\n Edit: ColumnsBlockEditor,\n placement: [\"block\"],\n editSurface: \"container\",\n container: {\n regions: (data): BlockContainerRegion[] => data.columns,\n updateRegion: (data, regionId, blocks) => {\n const shouldRemoveRegion =\n data.columns.length > 1 && isEffectivelyEmptyRegion(blocks);\n\n return {\n columns: data.columns\n .map((column) =>\n column.id === regionId ? { ...column, blocks } : column,\n )\n .filter((column) => column.id !== regionId || !shouldRemoveRegion),\n };\n },\n addRegion: (data, afterRegionId) => {\n if (data.columns.length >= 4) return data;\n const nextColumn: ColumnsColumn = {\n id: newColId(),\n blocks: [],\n };\n if (!afterRegionId) return { columns: [...data.columns, nextColumn] };\n const afterIndex = data.columns.findIndex(\n (column) => column.id === afterRegionId,\n );\n if (afterIndex < 0) return { columns: [...data.columns, nextColumn] };\n return {\n columns: [\n ...data.columns.slice(0, afterIndex + 1),\n nextColumn,\n ...data.columns.slice(afterIndex + 1),\n ],\n };\n },\n removeRegion: (data, regionId) => {\n if (data.columns.length <= 1) return data;\n return {\n columns: data.columns.filter((column) => column.id !== regionId),\n };\n },\n },\n label: \"Columns\",\n icon: IconColumns,\n description:\n \"A multi-column side-by-side layout container; each column holds its own list of blocks. Ideal for before/after or current/target comparisons.\",\n empty: () => ({\n columns: [\n { id: newColId(), blocks: [] },\n { id: newColId(), blocks: [] },\n ],\n }),\n});\n"]}
|
|
@@ -22,6 +22,13 @@ import type { BlockMdxConfig } from "../types.js";
|
|
|
22
22
|
/** Cardinality of a relation between two entities. */
|
|
23
23
|
export type DataModelRelationKind = "1-1" | "1-n" | "n-n";
|
|
24
24
|
export declare const DATA_MODEL_RELATION_KINDS: DataModelRelationKind[];
|
|
25
|
+
/**
|
|
26
|
+
* Diff status of an entity or field, used to render before/after change chips
|
|
27
|
+
* on a data model. Shares the SAME vocabulary as the `file-tree` block's
|
|
28
|
+
* `FileTreeChange` so change chips look consistent across dev-doc blocks.
|
|
29
|
+
*/
|
|
30
|
+
export type DataModelChange = "added" | "modified" | "removed" | "renamed";
|
|
31
|
+
export declare const DATA_MODEL_CHANGES: DataModelChange[];
|
|
25
32
|
/** One column of an entity. `fk` is a string like `"User.id"`. */
|
|
26
33
|
export interface DataModelField {
|
|
27
34
|
name: string;
|
|
@@ -32,12 +39,18 @@ export interface DataModelField {
|
|
|
32
39
|
nullable?: boolean;
|
|
33
40
|
default?: string;
|
|
34
41
|
note?: string;
|
|
42
|
+
/** Diff status of this field, driving its change chip. */
|
|
43
|
+
change?: DataModelChange;
|
|
44
|
+
/** Prior value when `change === "modified"` (e.g. the old column type). */
|
|
45
|
+
was?: string;
|
|
35
46
|
}
|
|
36
47
|
/** One table / model. `id` is referenced by relations (`from`/`to`). */
|
|
37
48
|
export interface DataModelEntity {
|
|
38
49
|
id: string;
|
|
39
50
|
name: string;
|
|
40
51
|
note?: string;
|
|
52
|
+
/** Diff status of the whole table (added / removed / renamed / modified). */
|
|
53
|
+
change?: DataModelChange;
|
|
41
54
|
fields: DataModelField[];
|
|
42
55
|
}
|
|
43
56
|
/** An explicit relation between two entities, by `id` (or `name`). */
|
|
@@ -63,6 +76,10 @@ export declare const dataModelSchema: z.ZodType<DataModelData>;
|
|
|
63
76
|
* props on a self-closing element — the `<DataModel id … entities={…}
|
|
64
77
|
* relations={…} />` form. `toAttrs` emits `entities` then `relations` in a STABLE
|
|
65
78
|
* order (the shared `prop()` encoder drops `relations` when it is undefined).
|
|
79
|
+
* Because `entities` is one JSON prop, each entity's `change` and each field's
|
|
80
|
+
* `change` / `was` diff attributes ride along inside it and round-trip verbatim
|
|
81
|
+
* (export → import) with no per-attribute handling, mirroring how `file-tree`
|
|
82
|
+
* encodes its per-entry `change` inside the `entries` JSON prop.
|
|
66
83
|
*
|
|
67
84
|
* `fromAttrs` tolerates missing/partial attributes for backward-compat: a missing
|
|
68
85
|
* `entities` decodes to `[]` and a missing `relations` decodes to `undefined` so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-model.config.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/data-model.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;;;;;;;GAkBG;AAEH,sDAAsD;AACtD,MAAM,MAAM,qBAAqB,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAE1D,eAAO,MAAM,yBAAyB,EAAE,qBAAqB,EAI5D,CAAC;AAEF,kEAAkE;AAClE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,8EAA8E;IAC9E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"data-model.config.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/data-model.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;;;;;;;GAkBG;AAEH,sDAAsD;AACtD,MAAM,MAAM,qBAAqB,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAE1D,eAAO,MAAM,yBAAyB,EAAE,qBAAqB,EAI5D,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;AAE3E,eAAO,MAAM,kBAAkB,EAAE,eAAe,EAK/C,CAAC;AAEF,kEAAkE;AAClE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,8EAA8E;IAC9E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,2EAA2E;IAC3E,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wEAAwE;AACxE,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,MAAM,EAAE,cAAc,EAAE,CAAC;CAC1B;AAED,sEAAsE;AACtE,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACjC;AAgCD;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAGX,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;AAE1C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,aAAa,CAUtD,CAAC"}
|
|
@@ -4,6 +4,14 @@ export const DATA_MODEL_RELATION_KINDS = [
|
|
|
4
4
|
"1-n",
|
|
5
5
|
"n-n",
|
|
6
6
|
];
|
|
7
|
+
export const DATA_MODEL_CHANGES = [
|
|
8
|
+
"added",
|
|
9
|
+
"modified",
|
|
10
|
+
"removed",
|
|
11
|
+
"renamed",
|
|
12
|
+
];
|
|
13
|
+
/** Diff-status enum, shared with the inline `data-model` schema's `change`. */
|
|
14
|
+
const changeSchema = z.enum(["added", "modified", "removed", "renamed"]);
|
|
7
15
|
const fieldSchema = z.object({
|
|
8
16
|
name: z.string().trim().min(1).max(160),
|
|
9
17
|
type: z.string().trim().max(120).optional(),
|
|
@@ -12,11 +20,14 @@ const fieldSchema = z.object({
|
|
|
12
20
|
nullable: z.boolean().optional(),
|
|
13
21
|
default: z.string().trim().max(400).optional(),
|
|
14
22
|
note: z.string().trim().max(600).optional(),
|
|
23
|
+
change: changeSchema.optional(),
|
|
24
|
+
was: z.string().trim().max(400).optional(),
|
|
15
25
|
});
|
|
16
26
|
const entitySchema = z.object({
|
|
17
27
|
id: z.string().trim().min(1).max(120),
|
|
18
28
|
name: z.string().trim().min(1).max(160),
|
|
19
29
|
note: z.string().trim().max(600).optional(),
|
|
30
|
+
change: changeSchema.optional(),
|
|
20
31
|
fields: z.array(fieldSchema).max(80),
|
|
21
32
|
});
|
|
22
33
|
const relationSchema = z.object({
|
|
@@ -40,6 +51,10 @@ export const dataModelSchema = z.object({
|
|
|
40
51
|
* props on a self-closing element — the `<DataModel id … entities={…}
|
|
41
52
|
* relations={…} />` form. `toAttrs` emits `entities` then `relations` in a STABLE
|
|
42
53
|
* order (the shared `prop()` encoder drops `relations` when it is undefined).
|
|
54
|
+
* Because `entities` is one JSON prop, each entity's `change` and each field's
|
|
55
|
+
* `change` / `was` diff attributes ride along inside it and round-trip verbatim
|
|
56
|
+
* (export → import) with no per-attribute handling, mirroring how `file-tree`
|
|
57
|
+
* encodes its per-entry `change` inside the `entries` JSON prop.
|
|
43
58
|
*
|
|
44
59
|
* `fromAttrs` tolerates missing/partial attributes for backward-compat: a missing
|
|
45
60
|
* `entities` decodes to `[]` and a missing `relations` decodes to `undefined` so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-model.config.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/data-model.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA0BxB,MAAM,CAAC,MAAM,yBAAyB,GAA4B;IAChE,KAAK;IACL,KAAK;IACL,KAAK;CACN,CAAC;
|
|
1
|
+
{"version":3,"file":"data-model.config.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/data-model.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA0BxB,MAAM,CAAC,MAAM,yBAAyB,GAA4B;IAChE,KAAK;IACL,KAAK;IACL,KAAK;CACN,CAAC;AASF,MAAM,CAAC,MAAM,kBAAkB,GAAsB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,QAAQ,EAAE;CACvD,CAAwC,CAAC;AAE1C;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,YAAY,GAAkC;IACzD,GAAG,EAAE,WAAW;IAChB,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAClB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,SAAS,EAAE,IAAI,CAAC,SAAS;KAC1B,CAAC;IACF,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACrB,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAkB,UAAU,CAAC,IAAI,EAAE;QACxD,SAAS,EAAE,KAAK,CAAC,KAAK,CAAoB,WAAW,CAAC;KACvD,CAAC;CACH,CAAC","sourcesContent":["import { z } from \"zod\";\nimport type { BlockMdxConfig } from \"../types.js\";\n\n/**\n * Pure (React-free) part of the PLAN-SPECIFIC `data-model` block: its data schema\n * and MDX round-trip config. Shared by the server MDX adapter (`plan-mdx.ts` via\n * `plan-block-registry.ts`) and the client spec (`planBlocks.tsx`). Keeping this\n * React-free means importing it into a server module never pulls React into the\n * Nitro/SSR bundle.\n *\n * The block renders a dbdiagram / Prisma-style entity-relationship diagram: a set\n * of entity cards (each a small table of fields with PK / FK / nullable flags)\n * plus optional explicit relations. The Read renderer makes foreign keys\n * interactive — hovering / clicking an FK highlights and scrolls to the\n * referenced entity — which is why this is a custom block, not a plain table.\n *\n * The schema MUST stay data-compatible with the `data-model` branch of\n * `planBlockSchema` (`plan-content.ts`), and the MDX `tag` (`DataModel`) +\n * attribute shape MUST match the inline planBlockSchema member so stored `.mdx`\n * round-trips: the whole `entities` and `relations` arrays are JSON props\n * (`<DataModel id … entities={…} relations={…} />`).\n */\n\n/** Cardinality of a relation between two entities. */\nexport type DataModelRelationKind = \"1-1\" | \"1-n\" | \"n-n\";\n\nexport const DATA_MODEL_RELATION_KINDS: DataModelRelationKind[] = [\n \"1-1\",\n \"1-n\",\n \"n-n\",\n];\n\n/**\n * Diff status of an entity or field, used to render before/after change chips\n * on a data model. Shares the SAME vocabulary as the `file-tree` block's\n * `FileTreeChange` so change chips look consistent across dev-doc blocks.\n */\nexport type DataModelChange = \"added\" | \"modified\" | \"removed\" | \"renamed\";\n\nexport const DATA_MODEL_CHANGES: DataModelChange[] = [\n \"added\",\n \"modified\",\n \"removed\",\n \"renamed\",\n];\n\n/** One column of an entity. `fk` is a string like `\"User.id\"`. */\nexport interface DataModelField {\n name: string;\n type?: string;\n pk?: boolean;\n /** Foreign-key target, e.g. `\"User.id\"` (entity name/id + optional field). */\n fk?: string;\n nullable?: boolean;\n default?: string;\n note?: string;\n /** Diff status of this field, driving its change chip. */\n change?: DataModelChange;\n /** Prior value when `change === \"modified\"` (e.g. the old column type). */\n was?: string;\n}\n\n/** One table / model. `id` is referenced by relations (`from`/`to`). */\nexport interface DataModelEntity {\n id: string;\n name: string;\n note?: string;\n /** Diff status of the whole table (added / removed / renamed / modified). */\n change?: DataModelChange;\n fields: DataModelField[];\n}\n\n/** An explicit relation between two entities, by `id` (or `name`). */\nexport interface DataModelRelation {\n from: string;\n to: string;\n kind?: DataModelRelationKind;\n label?: string;\n}\n\nexport interface DataModelData {\n entities: DataModelEntity[];\n relations?: DataModelRelation[];\n}\n\n/** Diff-status enum, shared with the inline `data-model` schema's `change`. */\nconst changeSchema = z.enum([\"added\", \"modified\", \"removed\", \"renamed\"]);\n\nconst fieldSchema = z.object({\n name: z.string().trim().min(1).max(160),\n type: z.string().trim().max(120).optional(),\n pk: z.boolean().optional(),\n fk: z.string().trim().max(200).optional(),\n nullable: z.boolean().optional(),\n default: z.string().trim().max(400).optional(),\n note: z.string().trim().max(600).optional(),\n change: changeSchema.optional(),\n was: z.string().trim().max(400).optional(),\n}) as z.ZodType<DataModelField>;\n\nconst entitySchema = z.object({\n id: z.string().trim().min(1).max(120),\n name: z.string().trim().min(1).max(160),\n note: z.string().trim().max(600).optional(),\n change: changeSchema.optional(),\n fields: z.array(fieldSchema).max(80),\n}) as z.ZodType<DataModelEntity>;\n\nconst relationSchema = z.object({\n from: z.string().trim().min(1).max(120),\n to: z.string().trim().min(1).max(120),\n kind: z.enum([\"1-1\", \"1-n\", \"n-n\"]).optional(),\n label: z.string().trim().max(160).optional(),\n}) as z.ZodType<DataModelRelation>;\n\n/**\n * Data-compatible with the inline `data-model` member of `planBlockSchema`\n * (`plan-content.ts`). At least one entity is required; `relations` is optional\n * (the Read renderer can infer simple `1-n` relations from `fk` fields when it is\n * omitted) so a fresh model validates from a single entity with a couple fields.\n */\nexport const dataModelSchema = z.object({\n entities: z.array(entitySchema).min(1).max(60),\n relations: z.array(relationSchema).max(200).optional(),\n}) as unknown as z.ZodType<DataModelData>;\n\n/**\n * MDX config: the whole `entities` and `relations` arrays are serialized as JSON\n * props on a self-closing element — the `<DataModel id … entities={…}\n * relations={…} />` form. `toAttrs` emits `entities` then `relations` in a STABLE\n * order (the shared `prop()` encoder drops `relations` when it is undefined).\n * Because `entities` is one JSON prop, each entity's `change` and each field's\n * `change` / `was` diff attributes ride along inside it and round-trip verbatim\n * (export → import) with no per-attribute handling, mirroring how `file-tree`\n * encodes its per-entry `change` inside the `entries` JSON prop.\n *\n * `fromAttrs` tolerates missing/partial attributes for backward-compat: a missing\n * `entities` decodes to `[]` and a missing `relations` decodes to `undefined` so\n * a plan written before this block existed still parses.\n */\nexport const dataModelMdx: BlockMdxConfig<DataModelData> = {\n tag: \"DataModel\",\n toAttrs: (data) => ({\n entities: data.entities,\n relations: data.relations,\n }),\n fromAttrs: (attrs) => ({\n entities: attrs.array<DataModelEntity>(\"entities\") ?? [],\n relations: attrs.array<DataModelRelation>(\"relations\"),\n }),\n};\n"]}
|
|
@@ -16,6 +16,23 @@ import type { BlockMdxConfig } from "../types.js";
|
|
|
16
16
|
*/
|
|
17
17
|
/** Rendering layout for the diff body. */
|
|
18
18
|
export type DiffMode = "unified" | "split";
|
|
19
|
+
/**
|
|
20
|
+
* One line-anchored note attached to a diff, mirroring the `annotated-code`
|
|
21
|
+
* annotation shape but adding `side`. The `lines` ref is 1-based against the
|
|
22
|
+
* chosen side's source: `side: "after"` (the default) targets the new file's
|
|
23
|
+
* line numbers, `side: "before"` the old file's. Optional ⇒ a diff without
|
|
24
|
+
* annotations renders exactly as before.
|
|
25
|
+
*/
|
|
26
|
+
export interface DiffAnnotation {
|
|
27
|
+
/** Which side the line ref targets; defaults to "after". */
|
|
28
|
+
side?: "before" | "after";
|
|
29
|
+
/** 1-based line ref against that side's text: "13" or "13-15" (inclusive). */
|
|
30
|
+
lines: string;
|
|
31
|
+
/** Optional short label shown before the note (e.g. "Validation"). */
|
|
32
|
+
label?: string;
|
|
33
|
+
/** The note prose (markdown), rendered through `ctx.renderMarkdown`. */
|
|
34
|
+
note: string;
|
|
35
|
+
}
|
|
19
36
|
export interface DiffData {
|
|
20
37
|
/** Optional file path shown in the header (e.g. `src/add.ts`). */
|
|
21
38
|
filename?: string;
|
|
@@ -27,15 +44,20 @@ export interface DiffData {
|
|
|
27
44
|
after: string;
|
|
28
45
|
/** Layout: unified (default, one column) or split (side-by-side). */
|
|
29
46
|
mode?: DiffMode;
|
|
47
|
+
/** Line-anchored notes over the before/after sides. */
|
|
48
|
+
annotations?: DiffAnnotation[];
|
|
30
49
|
}
|
|
31
50
|
export declare const diffSchema: z.ZodType<DiffData>;
|
|
32
51
|
/**
|
|
33
|
-
* MDX config: `filename`, `language`, `mode`, `before`,
|
|
34
|
-
* attributes — the
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* `
|
|
38
|
-
* attribute
|
|
52
|
+
* MDX config: `filename`, `language`, `mode`, `before`, `after`, and
|
|
53
|
+
* `annotations` are flat attributes — the
|
|
54
|
+
* `<Diff id … filename language mode before after annotations />` self-closing
|
|
55
|
+
* form. Insertion order of `toAttrs` is the on-disk attribute order. `before`/
|
|
56
|
+
* `after` are multiline string attributes (round-trip through the shared `prop()`
|
|
57
|
+
* encoder); `annotations` is a JSON array attribute, encoded the same way as the
|
|
58
|
+
* `annotated-code` block. `fromAttrs` mirrors a forgiving parse (`before ?? ""`,
|
|
59
|
+
* `after ?? ""`, `annotations ?? []`, optional `filename`/`language`/`mode`
|
|
60
|
+
* undefined when absent) so a plan missing an attribute still parses.
|
|
39
61
|
*/
|
|
40
62
|
export declare const diffMdx: BlockMdxConfig<DiffData>;
|
|
41
63
|
//# sourceMappingURL=diff.config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.config.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/diff.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;;GAaG;AAEH,0CAA0C;AAC1C,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAE3C,MAAM,WAAW,QAAQ;IACvB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,IAAI,CAAC,EAAE,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"diff.config.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/diff.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;;GAaG;AAEH,0CAA0C;AAC1C,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,4DAA4D;IAC5D,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC1B,8EAA8E;IAC9E,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,QAAQ;IACvB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,uDAAuD;IACvD,WAAW,CAAC,EAAE,cAAc,EAAE,CAAC;CAChC;AAsBD,eAAO,MAAM,UAAU,EAON,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAErC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,OAAO,EAAE,cAAc,CAAC,QAAQ,CAkB5C,CAAC"}
|
|
@@ -1,18 +1,40 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* A 1-based line reference: `"3"` or `"3-5"` (inclusive). Whitespace tolerant.
|
|
4
|
+
* Matches the `annotated-code` line-ref schema so both blocks validate refs
|
|
5
|
+
* identically.
|
|
6
|
+
*/
|
|
7
|
+
const lineRefSchema = z
|
|
8
|
+
.string()
|
|
9
|
+
.trim()
|
|
10
|
+
.regex(/^\d+(\s*-\s*\d+)?$/, {
|
|
11
|
+
message: 'lines must be a 1-based line ref like "3" or "3-5"',
|
|
12
|
+
})
|
|
13
|
+
.max(40);
|
|
14
|
+
const diffAnnotationSchema = z.object({
|
|
15
|
+
side: z.enum(["before", "after"]).optional(),
|
|
16
|
+
lines: lineRefSchema,
|
|
17
|
+
label: z.string().trim().max(160).optional(),
|
|
18
|
+
note: z.string().trim().min(1).max(4_000),
|
|
19
|
+
});
|
|
2
20
|
export const diffSchema = z.object({
|
|
3
21
|
filename: z.string().trim().max(400).optional(),
|
|
4
22
|
language: z.string().trim().max(40).optional(),
|
|
5
23
|
before: z.string().max(100_000),
|
|
6
24
|
after: z.string().max(100_000),
|
|
7
25
|
mode: z.enum(["unified", "split"]).optional(),
|
|
26
|
+
annotations: z.array(diffAnnotationSchema).max(80).optional(),
|
|
8
27
|
});
|
|
9
28
|
/**
|
|
10
|
-
* MDX config: `filename`, `language`, `mode`, `before`,
|
|
11
|
-
* attributes — the
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* `
|
|
15
|
-
* attribute
|
|
29
|
+
* MDX config: `filename`, `language`, `mode`, `before`, `after`, and
|
|
30
|
+
* `annotations` are flat attributes — the
|
|
31
|
+
* `<Diff id … filename language mode before after annotations />` self-closing
|
|
32
|
+
* form. Insertion order of `toAttrs` is the on-disk attribute order. `before`/
|
|
33
|
+
* `after` are multiline string attributes (round-trip through the shared `prop()`
|
|
34
|
+
* encoder); `annotations` is a JSON array attribute, encoded the same way as the
|
|
35
|
+
* `annotated-code` block. `fromAttrs` mirrors a forgiving parse (`before ?? ""`,
|
|
36
|
+
* `after ?? ""`, `annotations ?? []`, optional `filename`/`language`/`mode`
|
|
37
|
+
* undefined when absent) so a plan missing an attribute still parses.
|
|
16
38
|
*/
|
|
17
39
|
export const diffMdx = {
|
|
18
40
|
tag: "Diff",
|
|
@@ -22,6 +44,7 @@ export const diffMdx = {
|
|
|
22
44
|
mode: data.mode,
|
|
23
45
|
before: data.before,
|
|
24
46
|
after: data.after,
|
|
47
|
+
annotations: data.annotations,
|
|
25
48
|
}),
|
|
26
49
|
fromAttrs: (attrs) => ({
|
|
27
50
|
filename: attrs.string("filename"),
|
|
@@ -29,6 +52,7 @@ export const diffMdx = {
|
|
|
29
52
|
mode: attrs.string("mode"),
|
|
30
53
|
before: attrs.string("before") ?? "",
|
|
31
54
|
after: attrs.string("after") ?? "",
|
|
55
|
+
annotations: attrs.array("annotations") ?? [],
|
|
32
56
|
}),
|
|
33
57
|
};
|
|
34
58
|
//# sourceMappingURL=diff.config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.config.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/diff.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"diff.config.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/diff.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAsDxB;;;;GAIG;AACH,MAAM,aAAa,GAAG,CAAC;KACpB,MAAM,EAAE;KACR,IAAI,EAAE;KACN,KAAK,CAAC,oBAAoB,EAAE;IAC3B,OAAO,EAAE,oDAAoD;CAC9D,CAAC;KACD,GAAG,CAAC,EAAE,CAAC,CAAC;AAEX,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC5C,KAAK,EAAE,aAAa;IACpB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IAC5C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC;CAC1C,CAA8B,CAAC;AAEhC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IAC/C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,E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ig } from \"../types.js\";\n\n/**\n * Pure (React-free) part of the PLAN-SPECIFIC diff block: its data schema and MDX\n * round-trip config. Shared by the server MDX adapter (`plan-mdx.ts` via\n * `plan-block-registry.ts`) and the client spec (`planBlocks.tsx`). Keeping this\n * React-free means importing it into a server module never pulls React (or the\n * `diff` line-differ used only by the renderer) into the Nitro/SSR bundle.\n *\n * The schema MUST stay data-compatible with the `diff` branch of `planBlockSchema`\n * (`plan-content.ts`), and the MDX `tag` + flat attribute shape MUST match the\n * `<Diff filename language mode before after />` self-closing encoding so stored\n * `.mdx` round-trips. The `before`/`after` source lives in ATTRIBUTES (not MDX\n * children) — the shared `prop()` encoder round-trips multiline strings cleanly,\n * and keeping them attributes avoids the code being reflowed as prose.\n */\n\n/** Rendering layout for the diff body. */\nexport type DiffMode = \"unified\" | \"split\";\n\n/**\n * One line-anchored note attached to a diff, mirroring the `annotated-code`\n * annotation shape but adding `side`. The `lines` ref is 1-based against the\n * chosen side's source: `side: \"after\"` (the default) targets the new file's\n * line numbers, `side: \"before\"` the old file's. Optional ⇒ a diff without\n * annotations renders exactly as before.\n */\nexport interface DiffAnnotation {\n /** Which side the line ref targets; defaults to \"after\". */\n side?: \"before\" | \"after\";\n /** 1-based line ref against that side's text: \"13\" or \"13-15\" (inclusive). */\n lines: string;\n /** Optional short label shown before the note (e.g. \"Validation\"). */\n label?: string;\n /** The note prose (markdown), rendered through `ctx.renderMarkdown`. */\n note: string;\n}\n\nexport interface DiffData {\n /** Optional file path shown in the header (e.g. `src/add.ts`). */\n filename?: string;\n /** Optional language label rendered as a chip (e.g. `ts`). Purely cosmetic. */\n language?: string;\n /** Original (\"before\") source. */\n before: string;\n /** New (\"after\") source. */\n after: string;\n /** Layout: unified (default, one column) or split (side-by-side). */\n mode?: DiffMode;\n /** Line-anchored notes over the before/after sides. */\n annotations?: DiffAnnotation[];\n}\n\n/**\n * A 1-based line reference: `\"3\"` or `\"3-5\"` (inclusive). Whitespace tolerant.\n * Matches the `annotated-code` line-ref schema so both blocks validate refs\n * identically.\n */\nconst lineRefSchema = z\n .string()\n .trim()\n .regex(/^\\d+(\\s*-\\s*\\d+)?$/, {\n message: 'lines must be a 1-based line ref like \"3\" or \"3-5\"',\n })\n .max(40);\n\nconst diffAnnotationSchema = z.object({\n side: z.enum([\"before\", \"after\"]).optional(),\n lines: lineRefSchema,\n label: z.string().trim().max(160).optional(),\n note: z.string().trim().min(1).max(4_000),\n}) as z.ZodType<DiffAnnotation>;\n\nexport const diffSchema = z.object({\n filename: z.string().trim().max(400).optional(),\n language: z.string().trim().max(40).optional(),\n before: z.string().max(100_000),\n after: z.string().max(100_000),\n mode: z.enum([\"unified\", \"split\"]).optional(),\n annotations: z.array(diffAnnotationSchema).max(80).optional(),\n}) as unknown as z.ZodType<DiffData>;\n\n/**\n * MDX config: `filename`, `language`, `mode`, `before`, `after`, and\n * `annotations` are flat attributes — the\n * `<Diff id … filename language mode before after annotations />` self-closing\n * form. Insertion order of `toAttrs` is the on-disk attribute order. `before`/\n * `after` are multiline string attributes (round-trip through the shared `prop()`\n * encoder); `annotations` is a JSON array attribute, encoded the same way as the\n * `annotated-code` block. `fromAttrs` mirrors a forgiving parse (`before ?? \"\"`,\n * `after ?? \"\"`, `annotations ?? []`, optional `filename`/`language`/`mode`\n * undefined when absent) so a plan missing an attribute still parses.\n */\nexport const diffMdx: BlockMdxConfig<DiffData> = {\n tag: \"Diff\",\n toAttrs: (data) => ({\n filename: data.filename,\n language: data.language,\n mode: data.mode,\n before: data.before,\n after: data.after,\n annotations: data.annotations,\n }),\n fromAttrs: (attrs) => ({\n filename: attrs.string(\"filename\"),\n language: attrs.string(\"language\"),\n mode: attrs.string(\"mode\") as DiffMode | undefined,\n before: attrs.string(\"before\") ?? \"\",\n after: attrs.string(\"after\") ?? \"\",\n annotations: attrs.array<DiffAnnotation>(\"annotations\") ?? [],\n }),\n};\n"]}
|
|
@@ -120,7 +120,7 @@ export interface BlockRenderContext {
|
|
|
120
120
|
ariaLabel?: string;
|
|
121
121
|
}) => React.ReactNode;
|
|
122
122
|
/**
|
|
123
|
-
* Render an app-owned "
|
|
123
|
+
* Render an app-owned edit-by-prompt affordance ("Describe a change…") for a focused/editable block
|
|
124
124
|
* field. Core block editors pass the current field value and nearby companion
|
|
125
125
|
* fields; the host app decides how to collect the prompt and route it to the
|
|
126
126
|
* agent sidebar. This keeps reusable core blocks from importing app-specific
|
|
@@ -179,7 +179,7 @@ export interface BlockRenderContext {
|
|
|
179
179
|
onOpenChange?: (open: boolean) => void;
|
|
180
180
|
trigger: React.ReactNode;
|
|
181
181
|
children: React.ReactNode;
|
|
182
|
-
/** Metadata for host-provided contextual controls such as
|
|
182
|
+
/** Metadata for host-provided contextual controls such as the edit-by-prompt CTA. */
|
|
183
183
|
blockId?: string;
|
|
184
184
|
blockType?: string;
|
|
185
185
|
blockTitle?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/client/blocks/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEnC;;;;;;;;;;;;;GAaG;AAEH,iDAAiD;AACjD,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,MAAM,GACN,OAAO,GACP,OAAO,EAAE,GACT,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACzC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACzC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IACxC,KAAK,CAAC,CA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