pmx-canvas 0.1.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/CHANGELOG.md +38 -0
- package/LICENSE +21 -0
- package/Readme.md +865 -0
- package/dist/canvas/global.css +3173 -0
- package/dist/canvas/index.js +183 -0
- package/dist/json-render/index.css +2 -0
- package/dist/json-render/index.js +389 -0
- package/dist/types/cli/agent.d.ts +13 -0
- package/dist/types/cli/index.d.ts +2 -0
- package/dist/types/cli/watch.d.ts +5 -0
- package/dist/types/client/App.d.ts +1 -0
- package/dist/types/client/canvas/AttentionHistory.d.ts +1 -0
- package/dist/types/client/canvas/AttentionToast.d.ts +1 -0
- package/dist/types/client/canvas/CanvasNode.d.ts +8 -0
- package/dist/types/client/canvas/CanvasViewport.d.ts +8 -0
- package/dist/types/client/canvas/CommandPalette.d.ts +4 -0
- package/dist/types/client/canvas/ContextMenu.d.ts +24 -0
- package/dist/types/client/canvas/ContextPinBar.d.ts +1 -0
- package/dist/types/client/canvas/ContextPinHud.d.ts +1 -0
- package/dist/types/client/canvas/DockedNode.d.ts +4 -0
- package/dist/types/client/canvas/EdgeLayer.d.ts +8 -0
- package/dist/types/client/canvas/ExpandedNodeOverlay.d.ts +1 -0
- package/dist/types/client/canvas/FocusFieldLayer.d.ts +1 -0
- package/dist/types/client/canvas/Minimap.d.ts +23 -0
- package/dist/types/client/canvas/SelectionBar.d.ts +1 -0
- package/dist/types/client/canvas/ShortcutOverlay.d.ts +3 -0
- package/dist/types/client/canvas/SnapshotPanel.d.ts +7 -0
- package/dist/types/client/canvas/snap-guides.d.ts +23 -0
- package/dist/types/client/canvas/use-node-drag.d.ts +15 -0
- package/dist/types/client/canvas/use-node-resize.d.ts +15 -0
- package/dist/types/client/canvas/use-pan-zoom.d.ts +16 -0
- package/dist/types/client/ext-app/bridge.d.ts +161 -0
- package/dist/types/client/icons.d.ts +70 -0
- package/dist/types/client/index.d.ts +1 -0
- package/dist/types/client/nodes/ContextNode.d.ts +34 -0
- package/dist/types/client/nodes/ExtAppFrame.d.ts +18 -0
- package/dist/types/client/nodes/FileNode.d.ts +5 -0
- package/dist/types/client/nodes/GroupNode.d.ts +6 -0
- package/dist/types/client/nodes/ImageNode.d.ts +10 -0
- package/dist/types/client/nodes/InlineFormatBar.d.ts +7 -0
- package/dist/types/client/nodes/InlineMarkdownEditor.d.ts +14 -0
- package/dist/types/client/nodes/LedgerNode.d.ts +4 -0
- package/dist/types/client/nodes/MarkdownNode.d.ts +6 -0
- package/dist/types/client/nodes/McpAppNode.d.ts +4 -0
- package/dist/types/client/nodes/MdFormatBar.d.ts +8 -0
- package/dist/types/client/nodes/PromptNode.d.ts +5 -0
- package/dist/types/client/nodes/ResponseNode.d.ts +5 -0
- package/dist/types/client/nodes/StatusNode.d.ts +4 -0
- package/dist/types/client/nodes/StatusSummary.d.ts +4 -0
- package/dist/types/client/nodes/TraceNode.d.ts +4 -0
- package/dist/types/client/nodes/WebpageNode.d.ts +5 -0
- package/dist/types/client/nodes/image-warnings.d.ts +6 -0
- package/dist/types/client/nodes/inline-editor-commands.d.ts +11 -0
- package/dist/types/client/nodes/md-format.d.ts +25 -0
- package/dist/types/client/state/attention-bridge.d.ts +3 -0
- package/dist/types/client/state/attention-store.d.ts +25 -0
- package/dist/types/client/state/canvas-store.d.ts +74 -0
- package/dist/types/client/state/intent-bridge.d.ts +158 -0
- package/dist/types/client/state/sse-bridge.d.ts +5 -0
- package/dist/types/client/theme/tokens.d.ts +27 -0
- package/dist/types/client/types.d.ts +40 -0
- package/dist/types/client/utils/ext-app-tool-result.d.ts +1 -0
- package/dist/types/client/utils/placement.d.ts +1 -0
- package/dist/types/client/utils/platform.d.ts +2 -0
- package/dist/types/json-render/catalog.d.ts +815 -0
- package/dist/types/json-render/charts/components.d.ts +54 -0
- package/dist/types/json-render/charts/definitions.d.ts +103 -0
- package/dist/types/json-render/charts/extra-components.d.ts +58 -0
- package/dist/types/json-render/charts/extra-definitions.d.ts +181 -0
- package/dist/types/json-render/renderer/index.d.ts +16 -0
- package/dist/types/json-render/schema.d.ts +46 -0
- package/dist/types/json-render/server.d.ts +55 -0
- package/dist/types/mcp/server.d.ts +22 -0
- package/dist/types/server/agent-context.d.ts +21 -0
- package/dist/types/server/artifact-paths.d.ts +3 -0
- package/dist/types/server/canvas-operations.d.ts +154 -0
- package/dist/types/server/canvas-provenance.d.ts +13 -0
- package/dist/types/server/canvas-schema.d.ts +49 -0
- package/dist/types/server/canvas-serialization.d.ts +25 -0
- package/dist/types/server/canvas-state.d.ts +174 -0
- package/dist/types/server/canvas-validation.d.ts +33 -0
- package/dist/types/server/chart-template.d.ts +29 -0
- package/dist/types/server/code-graph.d.ts +67 -0
- package/dist/types/server/context-cards.d.ts +24 -0
- package/dist/types/server/diagram-presets.d.ts +28 -0
- package/dist/types/server/ext-app-call-registry.d.ts +16 -0
- package/dist/types/server/ext-app-tool-result.d.ts +1 -0
- package/dist/types/server/file-watcher.d.ts +16 -0
- package/dist/types/server/index.d.ts +243 -0
- package/dist/types/server/mcp-app-candidate.d.ts +25 -0
- package/dist/types/server/mcp-app-host.d.ts +65 -0
- package/dist/types/server/mcp-app-runtime.d.ts +47 -0
- package/dist/types/server/mutation-history.d.ts +105 -0
- package/dist/types/server/placement.d.ts +37 -0
- package/dist/types/server/server.d.ts +103 -0
- package/dist/types/server/spatial-analysis.d.ts +87 -0
- package/dist/types/server/trace-manager.d.ts +48 -0
- package/dist/types/server/web-artifacts.d.ts +50 -0
- package/dist/types/server/webpage-node.d.ts +25 -0
- package/dist/types/shared/auto-arrange.d.ts +29 -0
- package/dist/types/shared/ext-app-tool-result.d.ts +9 -0
- package/dist/types/shared/placement.d.ts +26 -0
- package/dist/types/shared/semantic-attention.d.ts +97 -0
- package/package.json +109 -0
- package/skills/data-analysis/SKILL.md +324 -0
- package/skills/doc-coauthoring/SKILL.md +375 -0
- package/skills/frontend-design/SKILL.md +45 -0
- package/skills/json-render-codegen/SKILL.md +112 -0
- package/skills/json-render-core/SKILL.md +265 -0
- package/skills/json-render-ink/SKILL.md +273 -0
- package/skills/json-render-mcp/SKILL.md +132 -0
- package/skills/json-render-react/SKILL.md +264 -0
- package/skills/json-render-shadcn/SKILL.md +159 -0
- package/skills/playwright-cli/SKILL.md +67 -0
- package/skills/pmx-canvas/SKILL.md +668 -0
- package/skills/pmx-canvas/evals/evals.json +186 -0
- package/skills/pmx-canvas-testing/SKILL.md +78 -0
- package/skills/published-consumer-e2e/SKILL.md +43 -0
- package/skills/published-consumer-e2e/scripts/run-published-consumer-e2e.sh +241 -0
- package/skills/web-artifacts-builder/SKILL.md +80 -0
- package/skills/web-artifacts-builder/scripts/bundle-artifact.sh +167 -0
- package/skills/web-artifacts-builder/scripts/init-artifact.sh +425 -0
- package/skills/web-artifacts-builder/scripts/shadcn-components.tar.gz +0 -0
- package/skills/web-design-guidelines/SKILL.md +39 -0
- package/src/cli/agent.ts +2144 -0
- package/src/cli/index.ts +622 -0
- package/src/cli/watch.ts +88 -0
- package/src/client/App.tsx +507 -0
- package/src/client/canvas/AttentionHistory.tsx +81 -0
- package/src/client/canvas/AttentionToast.tsx +19 -0
- package/src/client/canvas/CanvasNode.tsx +363 -0
- package/src/client/canvas/CanvasViewport.tsx +590 -0
- package/src/client/canvas/CommandPalette.tsx +302 -0
- package/src/client/canvas/ContextMenu.tsx +601 -0
- package/src/client/canvas/ContextPinBar.tsx +25 -0
- package/src/client/canvas/ContextPinHud.tsx +22 -0
- package/src/client/canvas/DockedNode.tsx +66 -0
- package/src/client/canvas/EdgeLayer.tsx +280 -0
- package/src/client/canvas/ExpandedNodeOverlay.tsx +260 -0
- package/src/client/canvas/FocusFieldLayer.tsx +107 -0
- package/src/client/canvas/Minimap.tsx +301 -0
- package/src/client/canvas/SelectionBar.tsx +69 -0
- package/src/client/canvas/ShortcutOverlay.tsx +69 -0
- package/src/client/canvas/SnapshotPanel.tsx +236 -0
- package/src/client/canvas/snap-guides.ts +170 -0
- package/src/client/canvas/use-node-drag.ts +51 -0
- package/src/client/canvas/use-node-resize.ts +59 -0
- package/src/client/canvas/use-pan-zoom.ts +191 -0
- package/src/client/ext-app/bridge.ts +542 -0
- package/src/client/icons.tsx +424 -0
- package/src/client/index.tsx +7 -0
- package/src/client/nodes/ContextNode.tsx +412 -0
- package/src/client/nodes/ExtAppFrame.tsx +509 -0
- package/src/client/nodes/FileNode.tsx +256 -0
- package/src/client/nodes/GroupNode.tsx +39 -0
- package/src/client/nodes/ImageNode.tsx +160 -0
- package/src/client/nodes/InlineFormatBar.tsx +169 -0
- package/src/client/nodes/InlineMarkdownEditor.tsx +123 -0
- package/src/client/nodes/LedgerNode.tsx +37 -0
- package/src/client/nodes/MarkdownNode.tsx +359 -0
- package/src/client/nodes/McpAppNode.tsx +85 -0
- package/src/client/nodes/MdFormatBar.tsx +109 -0
- package/src/client/nodes/PromptNode.tsx +597 -0
- package/src/client/nodes/ResponseNode.tsx +153 -0
- package/src/client/nodes/StatusNode.tsx +84 -0
- package/src/client/nodes/StatusSummary.tsx +38 -0
- package/src/client/nodes/TraceNode.tsx +120 -0
- package/src/client/nodes/WebpageNode.tsx +288 -0
- package/src/client/nodes/image-warnings.ts +95 -0
- package/src/client/nodes/inline-editor-commands.ts +37 -0
- package/src/client/nodes/md-format.ts +206 -0
- package/src/client/state/attention-bridge.ts +328 -0
- package/src/client/state/attention-store.ts +73 -0
- package/src/client/state/canvas-store.ts +631 -0
- package/src/client/state/intent-bridge.ts +315 -0
- package/src/client/state/sse-bridge.ts +965 -0
- package/src/client/theme/global.css +3173 -0
- package/src/client/theme/tokens.ts +72 -0
- package/src/client/types-shims.d.ts +5 -0
- package/src/client/types.ts +81 -0
- package/src/client/utils/ext-app-tool-result.ts +4 -0
- package/src/client/utils/placement.ts +4 -0
- package/src/client/utils/platform.ts +2 -0
- package/src/json-render/catalog.ts +256 -0
- package/src/json-render/charts/components.tsx +198 -0
- package/src/json-render/charts/definitions.ts +81 -0
- package/src/json-render/charts/extra-components.tsx +267 -0
- package/src/json-render/charts/extra-definitions.ts +145 -0
- package/src/json-render/renderer/index.css +174 -0
- package/src/json-render/renderer/index.tsx +86 -0
- package/src/json-render/schema.ts +62 -0
- package/src/json-render/server.ts +597 -0
- package/src/mcp/server.ts +1377 -0
- package/src/server/agent-context.ts +242 -0
- package/src/server/artifact-paths.ts +17 -0
- package/src/server/canvas-operations.ts +1279 -0
- package/src/server/canvas-provenance.ts +243 -0
- package/src/server/canvas-schema.ts +432 -0
- package/src/server/canvas-serialization.ts +95 -0
- package/src/server/canvas-state.ts +1134 -0
- package/src/server/canvas-validation.ts +114 -0
- package/src/server/chart-template.ts +449 -0
- package/src/server/code-graph.ts +370 -0
- package/src/server/context-cards.ts +31 -0
- package/src/server/diagram-presets.ts +71 -0
- package/src/server/ext-app-call-registry.ts +77 -0
- package/src/server/ext-app-tool-result.ts +4 -0
- package/src/server/file-watcher.ts +121 -0
- package/src/server/index.ts +647 -0
- package/src/server/mcp-app-candidate.ts +174 -0
- package/src/server/mcp-app-host.ts +814 -0
- package/src/server/mcp-app-runtime.ts +459 -0
- package/src/server/mutation-history.ts +350 -0
- package/src/server/placement.ts +125 -0
- package/src/server/server.ts +3846 -0
- package/src/server/spatial-analysis.ts +356 -0
- package/src/server/trace-manager.ts +333 -0
- package/src/server/web-artifacts/scripts/bundle-artifact.sh +167 -0
- package/src/server/web-artifacts/scripts/init-artifact.sh +426 -0
- package/src/server/web-artifacts/scripts/shadcn-components.tar.gz +0 -0
- package/src/server/web-artifacts.ts +442 -0
- package/src/server/webpage-node.ts +328 -0
- package/src/shared/auto-arrange.ts +439 -0
- package/src/shared/ext-app-tool-result.ts +76 -0
- package/src/shared/placement.ts +81 -0
- package/src/shared/semantic-attention.ts +598 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** @jsxImportSource react */
|
|
2
|
+
/**
|
|
3
|
+
* Chart component implementations for json-render.
|
|
4
|
+
*
|
|
5
|
+
* Built on Recharts, following the same pattern as the Vercel json-render
|
|
6
|
+
* chat example. Each component receives BaseComponentProps<T> and renders
|
|
7
|
+
* a responsive chart inside a styled container.
|
|
8
|
+
*/
|
|
9
|
+
import type { ReactNode } from 'react';
|
|
10
|
+
import type { BaseComponentProps } from '@json-render/react';
|
|
11
|
+
export declare const CHART_COLORS: string[];
|
|
12
|
+
export type AggregateMode = 'sum' | 'count' | 'avg';
|
|
13
|
+
export declare function processChartData(data: Record<string, unknown>[], xKey: string, yKey: string, aggregate: AggregateMode | null | undefined): Record<string, unknown>[];
|
|
14
|
+
export interface CartesianChartProps {
|
|
15
|
+
title?: string | null;
|
|
16
|
+
data: Record<string, unknown>[];
|
|
17
|
+
xKey: string;
|
|
18
|
+
yKey: string;
|
|
19
|
+
aggregate?: AggregateMode | null;
|
|
20
|
+
color?: string | null;
|
|
21
|
+
height?: number | null;
|
|
22
|
+
}
|
|
23
|
+
interface PieChartProps {
|
|
24
|
+
title?: string | null;
|
|
25
|
+
data: Record<string, unknown>[];
|
|
26
|
+
nameKey: string;
|
|
27
|
+
valueKey: string;
|
|
28
|
+
height?: number | null;
|
|
29
|
+
}
|
|
30
|
+
export declare const axisStyle: {
|
|
31
|
+
fontSize: number;
|
|
32
|
+
fill: string;
|
|
33
|
+
};
|
|
34
|
+
export declare const tooltipStyle: {
|
|
35
|
+
backgroundColor: string;
|
|
36
|
+
border: string;
|
|
37
|
+
borderRadius: string;
|
|
38
|
+
color: string;
|
|
39
|
+
fontSize: number;
|
|
40
|
+
};
|
|
41
|
+
/** Shared wrapper for cartesian charts (Line + Bar). */
|
|
42
|
+
export declare function CartesianChart({ props, children, }: {
|
|
43
|
+
props: CartesianChartProps;
|
|
44
|
+
children: (data: Record<string, unknown>[]) => ReactNode;
|
|
45
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
declare function ChartLineChart({ props }: BaseComponentProps<CartesianChartProps>): import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
declare function ChartBarChart({ props }: BaseComponentProps<CartesianChartProps>): import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
declare function ChartPieChart({ props }: BaseComponentProps<PieChartProps>): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
export declare const chartComponents: {
|
|
50
|
+
LineChart: typeof ChartLineChart;
|
|
51
|
+
BarChart: typeof ChartBarChart;
|
|
52
|
+
PieChart: typeof ChartPieChart;
|
|
53
|
+
};
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chart component definitions for json-render catalogs.
|
|
3
|
+
*
|
|
4
|
+
* Provides LineChart, BarChart, and PieChart components built on Recharts.
|
|
5
|
+
* Mirrors the chart definitions from the Vercel json-render chat example.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
export declare const chartComponentDefinitions: {
|
|
9
|
+
readonly LineChart: {
|
|
10
|
+
readonly props: z.ZodObject<{
|
|
11
|
+
title: z.ZodNullable<z.ZodString>;
|
|
12
|
+
data: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
13
|
+
xKey: z.ZodString;
|
|
14
|
+
yKey: z.ZodString;
|
|
15
|
+
aggregate: z.ZodNullable<z.ZodEnum<{
|
|
16
|
+
count: "count";
|
|
17
|
+
sum: "sum";
|
|
18
|
+
avg: "avg";
|
|
19
|
+
}>>;
|
|
20
|
+
color: z.ZodNullable<z.ZodString>;
|
|
21
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
readonly description: "Line chart for time-series or trend data. Provide data as an array of objects with xKey and yKey fields.";
|
|
24
|
+
readonly example: {
|
|
25
|
+
readonly title: "Weekly trend";
|
|
26
|
+
readonly data: readonly [{
|
|
27
|
+
readonly day: "Mon";
|
|
28
|
+
readonly value: 10;
|
|
29
|
+
}, {
|
|
30
|
+
readonly day: "Tue";
|
|
31
|
+
readonly value: 25;
|
|
32
|
+
}, {
|
|
33
|
+
readonly day: "Wed";
|
|
34
|
+
readonly value: 18;
|
|
35
|
+
}];
|
|
36
|
+
readonly xKey: "day";
|
|
37
|
+
readonly yKey: "value";
|
|
38
|
+
readonly aggregate: null;
|
|
39
|
+
readonly color: null;
|
|
40
|
+
readonly height: null;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
readonly BarChart: {
|
|
44
|
+
readonly props: z.ZodObject<{
|
|
45
|
+
title: z.ZodNullable<z.ZodString>;
|
|
46
|
+
data: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
47
|
+
xKey: z.ZodString;
|
|
48
|
+
yKey: z.ZodString;
|
|
49
|
+
aggregate: z.ZodNullable<z.ZodEnum<{
|
|
50
|
+
count: "count";
|
|
51
|
+
sum: "sum";
|
|
52
|
+
avg: "avg";
|
|
53
|
+
}>>;
|
|
54
|
+
color: z.ZodNullable<z.ZodString>;
|
|
55
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
readonly description: "Bar chart for comparing categories. Provide data as an array of objects with xKey and yKey fields.";
|
|
58
|
+
readonly example: {
|
|
59
|
+
readonly title: "Sales by region";
|
|
60
|
+
readonly data: readonly [{
|
|
61
|
+
readonly region: "North";
|
|
62
|
+
readonly sales: 120;
|
|
63
|
+
}, {
|
|
64
|
+
readonly region: "South";
|
|
65
|
+
readonly sales: 98;
|
|
66
|
+
}, {
|
|
67
|
+
readonly region: "East";
|
|
68
|
+
readonly sales: 150;
|
|
69
|
+
}];
|
|
70
|
+
readonly xKey: "region";
|
|
71
|
+
readonly yKey: "sales";
|
|
72
|
+
readonly aggregate: null;
|
|
73
|
+
readonly color: null;
|
|
74
|
+
readonly height: null;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
readonly PieChart: {
|
|
78
|
+
readonly props: z.ZodObject<{
|
|
79
|
+
title: z.ZodNullable<z.ZodString>;
|
|
80
|
+
data: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
81
|
+
nameKey: z.ZodString;
|
|
82
|
+
valueKey: z.ZodString;
|
|
83
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
84
|
+
}, z.core.$strip>;
|
|
85
|
+
readonly description: "Pie chart for showing proportions. Provide data as an array of objects with nameKey and valueKey fields.";
|
|
86
|
+
readonly example: {
|
|
87
|
+
readonly title: "Market share";
|
|
88
|
+
readonly data: readonly [{
|
|
89
|
+
readonly name: "Product A";
|
|
90
|
+
readonly share: 45;
|
|
91
|
+
}, {
|
|
92
|
+
readonly name: "Product B";
|
|
93
|
+
readonly share: 30;
|
|
94
|
+
}, {
|
|
95
|
+
readonly name: "Product C";
|
|
96
|
+
readonly share: 25;
|
|
97
|
+
}];
|
|
98
|
+
readonly nameKey: "name";
|
|
99
|
+
readonly valueKey: "share";
|
|
100
|
+
readonly height: null;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/** @jsxImportSource react */
|
|
2
|
+
/**
|
|
3
|
+
* Additional chart components for json-render.
|
|
4
|
+
*
|
|
5
|
+
* Lives alongside ./components.tsx so the original chart set stays
|
|
6
|
+
* unchanged and the merge point in ./catalog.ts is the only contact
|
|
7
|
+
* surface with the upstream `@json-render/*` packages.
|
|
8
|
+
*/
|
|
9
|
+
import type { BaseComponentProps } from '@json-render/react';
|
|
10
|
+
import { type CartesianChartProps } from './components';
|
|
11
|
+
type AreaChartProps = CartesianChartProps;
|
|
12
|
+
declare function ChartAreaChart({ props }: BaseComponentProps<AreaChartProps>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
interface ScatterChartProps {
|
|
14
|
+
title?: string | null;
|
|
15
|
+
data: Record<string, unknown>[];
|
|
16
|
+
xKey: string;
|
|
17
|
+
yKey: string;
|
|
18
|
+
zKey?: string | null;
|
|
19
|
+
color?: string | null;
|
|
20
|
+
height?: number | null;
|
|
21
|
+
}
|
|
22
|
+
declare function ChartScatterChart({ props }: BaseComponentProps<ScatterChartProps>): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
interface RadarChartProps {
|
|
24
|
+
title?: string | null;
|
|
25
|
+
data: Record<string, unknown>[];
|
|
26
|
+
axisKey: string;
|
|
27
|
+
metrics: string[];
|
|
28
|
+
height?: number | null;
|
|
29
|
+
}
|
|
30
|
+
declare function ChartRadarChart({ props }: BaseComponentProps<RadarChartProps>): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
interface StackedBarChartProps {
|
|
32
|
+
title?: string | null;
|
|
33
|
+
data: Record<string, unknown>[];
|
|
34
|
+
xKey: string;
|
|
35
|
+
series: string[];
|
|
36
|
+
aggregate?: 'sum' | 'count' | 'avg' | null;
|
|
37
|
+
height?: number | null;
|
|
38
|
+
}
|
|
39
|
+
declare function ChartStackedBarChart({ props }: BaseComponentProps<StackedBarChartProps>): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
interface ComposedChartProps {
|
|
41
|
+
title?: string | null;
|
|
42
|
+
data: Record<string, unknown>[];
|
|
43
|
+
xKey: string;
|
|
44
|
+
barKey: string;
|
|
45
|
+
lineKey: string;
|
|
46
|
+
barColor?: string | null;
|
|
47
|
+
lineColor?: string | null;
|
|
48
|
+
height?: number | null;
|
|
49
|
+
}
|
|
50
|
+
declare function ChartComposedChart({ props }: BaseComponentProps<ComposedChartProps>): import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
export declare const extraChartComponents: {
|
|
52
|
+
AreaChart: typeof ChartAreaChart;
|
|
53
|
+
ScatterChart: typeof ChartScatterChart;
|
|
54
|
+
RadarChart: typeof ChartRadarChart;
|
|
55
|
+
StackedBarChart: typeof ChartStackedBarChart;
|
|
56
|
+
ComposedChart: typeof ChartComposedChart;
|
|
57
|
+
};
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Definitions for the extra chart components in ./extra-components.tsx.
|
|
3
|
+
*
|
|
4
|
+
* Kept separate from ./definitions.ts so the original chart catalog stays
|
|
5
|
+
* untouched and the merge in ./catalog.ts is the only contact surface.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
export declare const extraChartComponentDefinitions: {
|
|
9
|
+
readonly AreaChart: {
|
|
10
|
+
readonly props: z.ZodObject<{
|
|
11
|
+
title: z.ZodNullable<z.ZodString>;
|
|
12
|
+
data: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
13
|
+
xKey: z.ZodString;
|
|
14
|
+
yKey: z.ZodString;
|
|
15
|
+
aggregate: z.ZodNullable<z.ZodEnum<{
|
|
16
|
+
count: "count";
|
|
17
|
+
sum: "sum";
|
|
18
|
+
avg: "avg";
|
|
19
|
+
}>>;
|
|
20
|
+
color: z.ZodNullable<z.ZodString>;
|
|
21
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
readonly description: "Area chart for cumulative or trend data. Same shape as LineChart but draws a filled area under the line.";
|
|
24
|
+
readonly example: {
|
|
25
|
+
readonly title: "Daily signups";
|
|
26
|
+
readonly data: readonly [{
|
|
27
|
+
readonly day: "Mon";
|
|
28
|
+
readonly value: 12;
|
|
29
|
+
}, {
|
|
30
|
+
readonly day: "Tue";
|
|
31
|
+
readonly value: 24;
|
|
32
|
+
}, {
|
|
33
|
+
readonly day: "Wed";
|
|
34
|
+
readonly value: 19;
|
|
35
|
+
}, {
|
|
36
|
+
readonly day: "Thu";
|
|
37
|
+
readonly value: 31;
|
|
38
|
+
}];
|
|
39
|
+
readonly xKey: "day";
|
|
40
|
+
readonly yKey: "value";
|
|
41
|
+
readonly aggregate: null;
|
|
42
|
+
readonly color: null;
|
|
43
|
+
readonly height: null;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
readonly ScatterChart: {
|
|
47
|
+
readonly props: z.ZodObject<{
|
|
48
|
+
title: z.ZodNullable<z.ZodString>;
|
|
49
|
+
data: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
50
|
+
xKey: z.ZodString;
|
|
51
|
+
yKey: z.ZodString;
|
|
52
|
+
zKey: z.ZodNullable<z.ZodString>;
|
|
53
|
+
color: z.ZodNullable<z.ZodString>;
|
|
54
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
readonly description: "Scatter plot for correlation or distribution. Both axes are numeric; optional zKey scales point size.";
|
|
57
|
+
readonly example: {
|
|
58
|
+
readonly title: "Latency vs payload size";
|
|
59
|
+
readonly data: readonly [{
|
|
60
|
+
readonly size: 10;
|
|
61
|
+
readonly latency: 25;
|
|
62
|
+
}, {
|
|
63
|
+
readonly size: 40;
|
|
64
|
+
readonly latency: 80;
|
|
65
|
+
}, {
|
|
66
|
+
readonly size: 80;
|
|
67
|
+
readonly latency: 110;
|
|
68
|
+
}, {
|
|
69
|
+
readonly size: 120;
|
|
70
|
+
readonly latency: 180;
|
|
71
|
+
}];
|
|
72
|
+
readonly xKey: "size";
|
|
73
|
+
readonly yKey: "latency";
|
|
74
|
+
readonly zKey: null;
|
|
75
|
+
readonly color: null;
|
|
76
|
+
readonly height: null;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
readonly RadarChart: {
|
|
80
|
+
readonly props: z.ZodObject<{
|
|
81
|
+
title: z.ZodNullable<z.ZodString>;
|
|
82
|
+
data: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
83
|
+
axisKey: z.ZodString;
|
|
84
|
+
metrics: z.ZodArray<z.ZodString>;
|
|
85
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
86
|
+
}, z.core.$strip>;
|
|
87
|
+
readonly description: "Radar chart for comparing multiple metrics across categories. Each metric in `metrics` is plotted as its own polygon.";
|
|
88
|
+
readonly example: {
|
|
89
|
+
readonly title: "Skill comparison";
|
|
90
|
+
readonly data: readonly [{
|
|
91
|
+
readonly skill: "Speed";
|
|
92
|
+
readonly alice: 80;
|
|
93
|
+
readonly bob: 60;
|
|
94
|
+
}, {
|
|
95
|
+
readonly skill: "Accuracy";
|
|
96
|
+
readonly alice: 70;
|
|
97
|
+
readonly bob: 90;
|
|
98
|
+
}, {
|
|
99
|
+
readonly skill: "Stamina";
|
|
100
|
+
readonly alice: 85;
|
|
101
|
+
readonly bob: 75;
|
|
102
|
+
}];
|
|
103
|
+
readonly axisKey: "skill";
|
|
104
|
+
readonly metrics: readonly ["alice", "bob"];
|
|
105
|
+
readonly height: null;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
readonly StackedBarChart: {
|
|
109
|
+
readonly props: z.ZodObject<{
|
|
110
|
+
title: z.ZodNullable<z.ZodString>;
|
|
111
|
+
data: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
112
|
+
xKey: z.ZodString;
|
|
113
|
+
series: z.ZodArray<z.ZodString>;
|
|
114
|
+
aggregate: z.ZodNullable<z.ZodEnum<{
|
|
115
|
+
count: "count";
|
|
116
|
+
sum: "sum";
|
|
117
|
+
avg: "avg";
|
|
118
|
+
}>>;
|
|
119
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
120
|
+
}, z.core.$strip>;
|
|
121
|
+
readonly description: "Stacked bar chart for compositional data. Each entry in `series` is plotted as its own bar segment per x value.";
|
|
122
|
+
readonly example: {
|
|
123
|
+
readonly title: "Revenue by region";
|
|
124
|
+
readonly data: readonly [{
|
|
125
|
+
readonly quarter: "Q1";
|
|
126
|
+
readonly north: 30;
|
|
127
|
+
readonly south: 18;
|
|
128
|
+
readonly east: 22;
|
|
129
|
+
}, {
|
|
130
|
+
readonly quarter: "Q2";
|
|
131
|
+
readonly north: 42;
|
|
132
|
+
readonly south: 25;
|
|
133
|
+
readonly east: 28;
|
|
134
|
+
}, {
|
|
135
|
+
readonly quarter: "Q3";
|
|
136
|
+
readonly north: 38;
|
|
137
|
+
readonly south: 30;
|
|
138
|
+
readonly east: 26;
|
|
139
|
+
}];
|
|
140
|
+
readonly xKey: "quarter";
|
|
141
|
+
readonly series: readonly ["north", "south", "east"];
|
|
142
|
+
readonly aggregate: null;
|
|
143
|
+
readonly height: null;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
readonly ComposedChart: {
|
|
147
|
+
readonly props: z.ZodObject<{
|
|
148
|
+
title: z.ZodNullable<z.ZodString>;
|
|
149
|
+
data: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
150
|
+
xKey: z.ZodString;
|
|
151
|
+
barKey: z.ZodString;
|
|
152
|
+
lineKey: z.ZodString;
|
|
153
|
+
barColor: z.ZodNullable<z.ZodString>;
|
|
154
|
+
lineColor: z.ZodNullable<z.ZodString>;
|
|
155
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
156
|
+
}, z.core.$strip>;
|
|
157
|
+
readonly description: "Combined bar + line chart for paired metrics (e.g. counts + a derived rate) on the same axis.";
|
|
158
|
+
readonly example: {
|
|
159
|
+
readonly title: "Visits and conversion";
|
|
160
|
+
readonly data: readonly [{
|
|
161
|
+
readonly day: "Mon";
|
|
162
|
+
readonly visits: 120;
|
|
163
|
+
readonly conversion: 4.2;
|
|
164
|
+
}, {
|
|
165
|
+
readonly day: "Tue";
|
|
166
|
+
readonly visits: 145;
|
|
167
|
+
readonly conversion: 3.8;
|
|
168
|
+
}, {
|
|
169
|
+
readonly day: "Wed";
|
|
170
|
+
readonly visits: 160;
|
|
171
|
+
readonly conversion: 5.1;
|
|
172
|
+
}];
|
|
173
|
+
readonly xKey: "day";
|
|
174
|
+
readonly barKey: "visits";
|
|
175
|
+
readonly lineKey: "conversion";
|
|
176
|
+
readonly barColor: null;
|
|
177
|
+
readonly lineColor: null;
|
|
178
|
+
readonly height: null;
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** @jsxImportSource react */
|
|
2
|
+
/**
|
|
3
|
+
* json-render iframe renderer entry point.
|
|
4
|
+
*
|
|
5
|
+
* Runs inside a pmx-canvas iframe and reads the normalized json-render spec
|
|
6
|
+
* from an inline global injected by the server-side viewer route.
|
|
7
|
+
*/
|
|
8
|
+
import type { Spec } from '@json-render/core';
|
|
9
|
+
declare global {
|
|
10
|
+
interface Window {
|
|
11
|
+
__PMX_CANVAS_JSON_RENDER_SPEC__?: Spec & {
|
|
12
|
+
state?: Record<string, unknown>;
|
|
13
|
+
};
|
|
14
|
+
__PMX_CANVAS_JSON_RENDER_THEME__?: string;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare const schema: import("@json-render/core").Schema<{
|
|
2
|
+
spec: import("@json-render/core").SchemaType<"object", {
|
|
3
|
+
root: import("@json-render/core").SchemaType<"string", unknown>;
|
|
4
|
+
elements: import("@json-render/core").SchemaType<"record", import("@json-render/core").SchemaType<"object", {
|
|
5
|
+
type: import("@json-render/core").SchemaType<"ref", string>;
|
|
6
|
+
props: import("@json-render/core").SchemaType<"propsOf", string>;
|
|
7
|
+
children: import("@json-render/core").SchemaType<"array", import("@json-render/core").SchemaType<"string", unknown>>;
|
|
8
|
+
visible: import("@json-render/core").SchemaType<"any", unknown>;
|
|
9
|
+
}>>;
|
|
10
|
+
}>;
|
|
11
|
+
catalog: import("@json-render/core").SchemaType<"object", {
|
|
12
|
+
components: import("@json-render/core").SchemaType<"map", {
|
|
13
|
+
props: import("@json-render/core").SchemaType<"zod", unknown>;
|
|
14
|
+
slots: import("@json-render/core").SchemaType<"array", import("@json-render/core").SchemaType<"string", unknown>>;
|
|
15
|
+
description: import("@json-render/core").SchemaType<"string", unknown>;
|
|
16
|
+
example: import("@json-render/core").SchemaType<"any", unknown>;
|
|
17
|
+
}>;
|
|
18
|
+
actions: import("@json-render/core").SchemaType<"map", {
|
|
19
|
+
params: import("@json-render/core").SchemaType<"zod", unknown>;
|
|
20
|
+
description: import("@json-render/core").SchemaType<"string", unknown>;
|
|
21
|
+
}>;
|
|
22
|
+
}>;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const elementTreeSchema: import("@json-render/core").Schema<{
|
|
25
|
+
spec: import("@json-render/core").SchemaType<"object", {
|
|
26
|
+
root: import("@json-render/core").SchemaType<"string", unknown>;
|
|
27
|
+
elements: import("@json-render/core").SchemaType<"record", import("@json-render/core").SchemaType<"object", {
|
|
28
|
+
type: import("@json-render/core").SchemaType<"ref", string>;
|
|
29
|
+
props: import("@json-render/core").SchemaType<"propsOf", string>;
|
|
30
|
+
children: import("@json-render/core").SchemaType<"array", import("@json-render/core").SchemaType<"string", unknown>>;
|
|
31
|
+
visible: import("@json-render/core").SchemaType<"any", unknown>;
|
|
32
|
+
}>>;
|
|
33
|
+
}>;
|
|
34
|
+
catalog: import("@json-render/core").SchemaType<"object", {
|
|
35
|
+
components: import("@json-render/core").SchemaType<"map", {
|
|
36
|
+
props: import("@json-render/core").SchemaType<"zod", unknown>;
|
|
37
|
+
slots: import("@json-render/core").SchemaType<"array", import("@json-render/core").SchemaType<"string", unknown>>;
|
|
38
|
+
description: import("@json-render/core").SchemaType<"string", unknown>;
|
|
39
|
+
example: import("@json-render/core").SchemaType<"any", unknown>;
|
|
40
|
+
}>;
|
|
41
|
+
actions: import("@json-render/core").SchemaType<"map", {
|
|
42
|
+
params: import("@json-render/core").SchemaType<"zod", unknown>;
|
|
43
|
+
description: import("@json-render/core").SchemaType<"string", unknown>;
|
|
44
|
+
}>;
|
|
45
|
+
}>;
|
|
46
|
+
}>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface JsonRenderSpec {
|
|
2
|
+
root: string;
|
|
3
|
+
elements: Record<string, unknown>;
|
|
4
|
+
state?: Record<string, unknown>;
|
|
5
|
+
}
|
|
6
|
+
export interface JsonRenderNodeInput {
|
|
7
|
+
title: string;
|
|
8
|
+
spec: unknown;
|
|
9
|
+
x?: number;
|
|
10
|
+
y?: number;
|
|
11
|
+
width?: number;
|
|
12
|
+
height?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface GraphNodeInput {
|
|
15
|
+
title?: string;
|
|
16
|
+
graphType: string;
|
|
17
|
+
data: Array<Record<string, unknown>>;
|
|
18
|
+
xKey?: string;
|
|
19
|
+
yKey?: string;
|
|
20
|
+
zKey?: string;
|
|
21
|
+
nameKey?: string;
|
|
22
|
+
valueKey?: string;
|
|
23
|
+
axisKey?: string;
|
|
24
|
+
metrics?: string[];
|
|
25
|
+
series?: string[];
|
|
26
|
+
barKey?: string;
|
|
27
|
+
lineKey?: string;
|
|
28
|
+
aggregate?: 'sum' | 'count' | 'avg';
|
|
29
|
+
color?: string;
|
|
30
|
+
barColor?: string;
|
|
31
|
+
lineColor?: string;
|
|
32
|
+
height?: number;
|
|
33
|
+
x?: number;
|
|
34
|
+
y?: number;
|
|
35
|
+
width?: number;
|
|
36
|
+
heightPx?: number;
|
|
37
|
+
}
|
|
38
|
+
export declare const JSON_RENDER_NODE_SIZE: {
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
};
|
|
42
|
+
export declare const GRAPH_NODE_SIZE: {
|
|
43
|
+
width: number;
|
|
44
|
+
height: number;
|
|
45
|
+
};
|
|
46
|
+
export type GraphChartType = 'LineChart' | 'BarChart' | 'PieChart' | 'AreaChart' | 'ScatterChart' | 'RadarChart' | 'StackedBarChart' | 'ComposedChart';
|
|
47
|
+
export declare function normalizeAndValidateJsonRenderSpec(spec: unknown): JsonRenderSpec;
|
|
48
|
+
export declare function normalizeGraphType(value: string): GraphChartType;
|
|
49
|
+
export declare function buildGraphSpec(input: GraphNodeInput): JsonRenderSpec;
|
|
50
|
+
export declare function createJsonRenderNodeData(nodeId: string, title: string, spec: JsonRenderSpec, extra?: Record<string, unknown>): Record<string, unknown>;
|
|
51
|
+
export declare function buildJsonRenderViewerHtml(options: {
|
|
52
|
+
title: string;
|
|
53
|
+
spec: JsonRenderSpec;
|
|
54
|
+
theme?: 'dark' | 'light' | 'high-contrast';
|
|
55
|
+
}): Promise<string>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PMX Canvas MCP Server
|
|
3
|
+
*
|
|
4
|
+
* Exposes the canvas as an MCP tool server so any MCP-capable agent
|
|
5
|
+
* (Claude Code, Codex, Cursor, Windsurf, pi, etc.) can control the
|
|
6
|
+
* canvas with zero configuration beyond adding the server to their config.
|
|
7
|
+
*
|
|
8
|
+
* Auto-starts the HTTP server and opens the browser on first tool call.
|
|
9
|
+
*
|
|
10
|
+
* Usage in agent MCP config:
|
|
11
|
+
* ```json
|
|
12
|
+
* {
|
|
13
|
+
* "mcpServers": {
|
|
14
|
+
* "canvas": {
|
|
15
|
+
* "command": "bunx",
|
|
16
|
+
* "args": ["pmx-canvas", "--mcp"]
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function startMcpServer(): Promise<void>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CanvasNodeState } from './canvas-state.js';
|
|
2
|
+
export interface AgentContextNode {
|
|
3
|
+
id: string;
|
|
4
|
+
type: CanvasNodeState['type'];
|
|
5
|
+
title: string | null;
|
|
6
|
+
content: string | null;
|
|
7
|
+
metadata?: Record<string, unknown>;
|
|
8
|
+
position?: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
interface AgentContextOptions {
|
|
14
|
+
defaultTextLength?: number;
|
|
15
|
+
webpageTextLength?: number;
|
|
16
|
+
includePosition?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function summarizeNodeForAgentContext(node: CanvasNodeState, options?: AgentContextOptions): string;
|
|
19
|
+
export declare function serializeNodeForAgentContext(node: CanvasNodeState, options?: AgentContextOptions): AgentContextNode;
|
|
20
|
+
export declare function buildAgentContextPreamble(nodes: CanvasNodeState[], options?: AgentContextOptions): string;
|
|
21
|
+
export {};
|