@industry-theme/principal-view-panels 0.12.5 → 0.12.7
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/index.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export type { WorkflowScenariosPanelProps } from './panels/WorkflowScenariosPane
|
|
|
6
6
|
export { StoryboardListPanel } from './panels/StoryboardListPanel';
|
|
7
7
|
export { TraceListPanel } from './panels/TraceListPanel';
|
|
8
8
|
export { TraceDetailsPanel } from './panels/TraceDetailsPanel';
|
|
9
|
+
export { MultiCanvasPanel, createMultiCanvasLayout } from './panels/MultiCanvasPanel';
|
|
10
|
+
export type { MultiCanvasPanelProps, CanvasInfo } from './panels/MultiCanvasPanel';
|
|
9
11
|
export { PanelFileSystemAdapter } from './adapters/PanelFileSystemAdapter';
|
|
10
12
|
export type { FileTreeEntry, PanelFileSystemAdapterOptions } from './adapters/PanelFileSystemAdapter';
|
|
11
13
|
export type { RegisteredTrace, WorkflowMatch } from './types/otel';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,SAAS,CAAC;AAIlE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,YAAY,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,YAAY,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src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AAE,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,EA+G7C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,qBAGzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,qBAG3B,CAAC;AAEF;;;GAGG;AACH,OAAO,EACL,uBAAuB,EACvB,+BAA+B,EAC/B,aAAa,EACb,aAAa,EACb,gBAAgB,GACjB,MAAM,SAAS,CAAC"}
|
|
@@ -1,9 +1,30 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type MultiCanvasLayout } from '@principal-ai/principal-view-react';
|
|
3
3
|
import type { ExtendedCanvas } from '@principal-ai/principal-view-core';
|
|
4
|
+
/**
|
|
5
|
+
* Canvas info with path for loading
|
|
6
|
+
*/
|
|
7
|
+
export interface CanvasInfo {
|
|
8
|
+
/** Unique identifier */
|
|
9
|
+
id: string;
|
|
10
|
+
/** Path to load the canvas from (relative to repository root) */
|
|
11
|
+
path: string;
|
|
12
|
+
/** Display label */
|
|
13
|
+
label?: string;
|
|
14
|
+
}
|
|
4
15
|
export interface MultiCanvasPanelProps {
|
|
5
|
-
/**
|
|
6
|
-
|
|
16
|
+
/** Context from panel framework */
|
|
17
|
+
context: {
|
|
18
|
+
repositoryPath?: string;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
};
|
|
21
|
+
/** Actions from panel framework */
|
|
22
|
+
actions: {
|
|
23
|
+
readFile?: (path: string) => Promise<string>;
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
};
|
|
26
|
+
/** Canvas infos with paths to load */
|
|
27
|
+
canvasInfos: CanvasInfo[];
|
|
7
28
|
/** Whether to show group borders around each canvas (default: true) */
|
|
8
29
|
showGroups?: boolean;
|
|
9
30
|
/** Show minimap for navigation (default: false) */
|
|
@@ -14,15 +35,15 @@ export interface MultiCanvasPanelProps {
|
|
|
14
35
|
showBackground?: boolean;
|
|
15
36
|
/** Background pattern variant */
|
|
16
37
|
backgroundVariant?: 'dots' | 'lines' | 'cross';
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
|
|
38
|
+
/** Layout direction */
|
|
39
|
+
direction?: 'vertical' | 'horizontal';
|
|
40
|
+
/** Gap between canvases */
|
|
41
|
+
gap?: number;
|
|
21
42
|
/** Optional click handler for nodes */
|
|
22
43
|
onNodeClick?: (nodeId: string) => void;
|
|
23
44
|
}
|
|
24
45
|
/**
|
|
25
|
-
* MultiCanvasPanel displays multiple canvases on a single unified view
|
|
46
|
+
* MultiCanvasPanel loads and displays multiple canvases on a single unified view
|
|
26
47
|
* using the MultiCanvasRenderer from principal-view-react.
|
|
27
48
|
*/
|
|
28
49
|
export declare const MultiCanvasPanel: React.FC<MultiCanvasPanelProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiCanvasPanel.d.ts","sourceRoot":"","sources":["../../src/panels/MultiCanvasPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"MultiCanvasPanel.d.ts","sourceRoot":"","sources":["../../src/panels/MultiCanvasPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACjG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAGxE;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,wBAAwB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,qBAAqB;IACpC,mCAAmC;IACnC,OAAO,EAAE;QACP,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;IACF,mCAAmC;IACnC,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;QAC7C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;IACF,sCAAsC;IACtC,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,uEAAuE;IACvE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mDAAmD;IACnD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,yCAAyC;IACzC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,8CAA8C;IAC9C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iCAAiC;IACjC,iBAAiB,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IAC/C,uBAAuB;IACvB,SAAS,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IACtC,2BAA2B;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAQD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA8I5D,CAAC;AAEF;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,KAAK,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,EACF,OAAO,CAAC,EAAE;IACR,SAAS,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,GACA,iBAAiB,CA0BnB"}
|
package/dist/panels.bundle.js
CHANGED
|
@@ -88218,7 +88218,7 @@ function parseNodeId(mergedNodeId) {
|
|
|
88218
88218
|
nodeId: mergedNodeId.substring(colonIndex + 1)
|
|
88219
88219
|
};
|
|
88220
88220
|
}
|
|
88221
|
-
forwardRef(function
|
|
88221
|
+
const MultiCanvasRenderer = forwardRef(function MultiCanvasRenderer2({ layout, onLayoutChange, showGroups = true, ...graphRendererProps }, ref) {
|
|
88222
88222
|
const groupPositionsRef = useRef(/* @__PURE__ */ new Map());
|
|
88223
88223
|
const mergedCanvas = useMemo(() => mergeCanvases(layout.placements, { showGroups }), [layout.placements, showGroups]);
|
|
88224
88224
|
const draggableNodeIds = useMemo(() => {
|
|
@@ -106065,6 +106065,145 @@ const TraceDetailsPanel = ({
|
|
|
106065
106065
|
}
|
|
106066
106066
|
);
|
|
106067
106067
|
};
|
|
106068
|
+
const MultiCanvasPanel = ({
|
|
106069
|
+
context: context2,
|
|
106070
|
+
actions,
|
|
106071
|
+
canvasInfos,
|
|
106072
|
+
showGroups = true,
|
|
106073
|
+
showMinimap = true,
|
|
106074
|
+
showControls = true,
|
|
106075
|
+
showBackground = true,
|
|
106076
|
+
backgroundVariant = "dots",
|
|
106077
|
+
direction = "vertical",
|
|
106078
|
+
gap = 150,
|
|
106079
|
+
onNodeClick
|
|
106080
|
+
}) => {
|
|
106081
|
+
const [loadedCanvases, setLoadedCanvases] = useState([]);
|
|
106082
|
+
const [loading, setLoading] = useState(true);
|
|
106083
|
+
const [error, setError] = useState(null);
|
|
106084
|
+
const contextRef = useRef(context2);
|
|
106085
|
+
const actionsRef = useRef(actions);
|
|
106086
|
+
useEffect(() => {
|
|
106087
|
+
contextRef.current = context2;
|
|
106088
|
+
actionsRef.current = actions;
|
|
106089
|
+
});
|
|
106090
|
+
const loadCanvases = useCallback(async () => {
|
|
106091
|
+
const ctx = contextRef.current;
|
|
106092
|
+
const acts = actionsRef.current;
|
|
106093
|
+
const readFile = acts.readFile;
|
|
106094
|
+
if (!readFile) {
|
|
106095
|
+
setError("readFile action not available");
|
|
106096
|
+
setLoading(false);
|
|
106097
|
+
return;
|
|
106098
|
+
}
|
|
106099
|
+
const repositoryPath = ctx.repositoryPath;
|
|
106100
|
+
if (!repositoryPath) {
|
|
106101
|
+
setError("Repository path not available");
|
|
106102
|
+
setLoading(false);
|
|
106103
|
+
return;
|
|
106104
|
+
}
|
|
106105
|
+
setLoading(true);
|
|
106106
|
+
setError(null);
|
|
106107
|
+
try {
|
|
106108
|
+
const loaded = [];
|
|
106109
|
+
for (const info of canvasInfos) {
|
|
106110
|
+
try {
|
|
106111
|
+
const fullPath = `${repositoryPath}/${info.path}`;
|
|
106112
|
+
const content2 = await readFile(fullPath);
|
|
106113
|
+
if (content2 && typeof content2 === "string") {
|
|
106114
|
+
const canvas = ConfigLoader.parseCanvas(content2);
|
|
106115
|
+
if (canvas) {
|
|
106116
|
+
loaded.push({
|
|
106117
|
+
id: info.id,
|
|
106118
|
+
canvas,
|
|
106119
|
+
label: info.label
|
|
106120
|
+
});
|
|
106121
|
+
}
|
|
106122
|
+
}
|
|
106123
|
+
} catch (err) {
|
|
106124
|
+
console.warn(`[MultiCanvasPanel] Failed to load canvas ${info.path}:`, err);
|
|
106125
|
+
}
|
|
106126
|
+
}
|
|
106127
|
+
setLoadedCanvases(loaded);
|
|
106128
|
+
setLoading(false);
|
|
106129
|
+
} catch (err) {
|
|
106130
|
+
setError(err instanceof Error ? err.message : "Failed to load canvases");
|
|
106131
|
+
setLoading(false);
|
|
106132
|
+
}
|
|
106133
|
+
}, [canvasInfos]);
|
|
106134
|
+
useEffect(() => {
|
|
106135
|
+
loadCanvases();
|
|
106136
|
+
}, [loadCanvases]);
|
|
106137
|
+
if (loading) {
|
|
106138
|
+
return /* @__PURE__ */ jsxs("div", { style: {
|
|
106139
|
+
display: "flex",
|
|
106140
|
+
alignItems: "center",
|
|
106141
|
+
justifyContent: "center",
|
|
106142
|
+
height: "100%",
|
|
106143
|
+
color: "#888",
|
|
106144
|
+
fontSize: "14px"
|
|
106145
|
+
}, children: [
|
|
106146
|
+
"Loading ",
|
|
106147
|
+
canvasInfos.length,
|
|
106148
|
+
" canvases..."
|
|
106149
|
+
] });
|
|
106150
|
+
}
|
|
106151
|
+
if (error) {
|
|
106152
|
+
return /* @__PURE__ */ jsxs("div", { style: {
|
|
106153
|
+
display: "flex",
|
|
106154
|
+
alignItems: "center",
|
|
106155
|
+
justifyContent: "center",
|
|
106156
|
+
height: "100%",
|
|
106157
|
+
color: "#ef4444",
|
|
106158
|
+
fontSize: "14px"
|
|
106159
|
+
}, children: [
|
|
106160
|
+
"Error: ",
|
|
106161
|
+
error
|
|
106162
|
+
] });
|
|
106163
|
+
}
|
|
106164
|
+
if (loadedCanvases.length === 0) {
|
|
106165
|
+
return /* @__PURE__ */ jsx("div", { style: {
|
|
106166
|
+
display: "flex",
|
|
106167
|
+
alignItems: "center",
|
|
106168
|
+
justifyContent: "center",
|
|
106169
|
+
height: "100%",
|
|
106170
|
+
color: "#888",
|
|
106171
|
+
fontSize: "14px"
|
|
106172
|
+
}, children: "No canvases loaded" });
|
|
106173
|
+
}
|
|
106174
|
+
const layout = createMultiCanvasLayout(loadedCanvases, { direction, gap });
|
|
106175
|
+
return /* @__PURE__ */ jsx(
|
|
106176
|
+
MultiCanvasRenderer,
|
|
106177
|
+
{
|
|
106178
|
+
layout,
|
|
106179
|
+
showGroups,
|
|
106180
|
+
showMinimap,
|
|
106181
|
+
showControls,
|
|
106182
|
+
showBackground,
|
|
106183
|
+
backgroundVariant,
|
|
106184
|
+
onNodeClick
|
|
106185
|
+
}
|
|
106186
|
+
);
|
|
106187
|
+
};
|
|
106188
|
+
function createMultiCanvasLayout(canvases, options) {
|
|
106189
|
+
const direction = (options == null ? void 0 : options.direction) ?? "vertical";
|
|
106190
|
+
const gap = (options == null ? void 0 : options.gap) ?? 100;
|
|
106191
|
+
let currentOffset = 0;
|
|
106192
|
+
const placements = canvases.map(({ id: id2, canvas, label }) => {
|
|
106193
|
+
const placement = {
|
|
106194
|
+
canvasId: id2,
|
|
106195
|
+
canvas,
|
|
106196
|
+
position: direction === "vertical" ? { x: 0, y: currentOffset } : { x: currentOffset, y: 0 },
|
|
106197
|
+
label
|
|
106198
|
+
};
|
|
106199
|
+
const nodes = canvas.nodes ?? [];
|
|
106200
|
+
const maxY = nodes.length > 0 ? Math.max(...nodes.map((n) => (n.y ?? 0) + (n.height ?? 100))) : 200;
|
|
106201
|
+
const maxX = nodes.length > 0 ? Math.max(...nodes.map((n) => (n.x ?? 0) + (n.width ?? 200))) : 400;
|
|
106202
|
+
currentOffset += (direction === "vertical" ? maxY : maxX) + gap;
|
|
106203
|
+
return placement;
|
|
106204
|
+
});
|
|
106205
|
+
return { placements };
|
|
106206
|
+
}
|
|
106068
106207
|
const TRACER_NAME = "@industry-theme/principal-view-panels";
|
|
106069
106208
|
const TRACER_VERSION = "0.11.40";
|
|
106070
106209
|
function getTracer() {
|
|
@@ -106218,6 +106357,7 @@ const onPackageUnload = async () => {
|
|
|
106218
106357
|
};
|
|
106219
106358
|
export {
|
|
106220
106359
|
CanvasEditorPanel,
|
|
106360
|
+
MultiCanvasPanel,
|
|
106221
106361
|
PanelFileSystemAdapter,
|
|
106222
106362
|
SpanStatusCode2 as SpanStatusCode,
|
|
106223
106363
|
StoryboardListPanel,
|
|
@@ -106227,6 +106367,7 @@ export {
|
|
|
106227
106367
|
TraceExpansion,
|
|
106228
106368
|
TraceListPanel,
|
|
106229
106369
|
WorkflowScenariosPanel,
|
|
106370
|
+
createMultiCanvasLayout,
|
|
106230
106371
|
focusNodeTool,
|
|
106231
106372
|
getActiveSpan,
|
|
106232
106373
|
getResource,
|