@principal-ai/subsystems-react 0.21.0 → 0.21.1
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/package.json +1 -1
- package/dist/components/ConfigurationSelector.d.ts +0 -35
- package/dist/components/ConfigurationSelector.d.ts.map +0 -1
- package/dist/components/ConfigurationSelector.js +0 -63
- package/dist/components/ConfigurationSelector.js.map +0 -1
- package/dist/components/GraphRenderer.d.ts +0 -295
- package/dist/components/GraphRenderer.d.ts.map +0 -1
- package/dist/components/GraphRenderer.js +0 -2008
- package/dist/components/GraphRenderer.js.map +0 -1
- package/dist/components/MultiCanvasRenderer.d.ts +0 -75
- package/dist/components/MultiCanvasRenderer.d.ts.map +0 -1
- package/dist/components/MultiCanvasRenderer.js +0 -203
- package/dist/components/MultiCanvasRenderer.js.map +0 -1
- package/dist/components/NodeTooltip.d.ts +0 -24
- package/dist/components/NodeTooltip.d.ts.map +0 -1
- package/dist/components/NodeTooltip.js +0 -160
- package/dist/components/NodeTooltip.js.map +0 -1
- package/dist/components/SelectionSidebar.d.ts +0 -18
- package/dist/components/SelectionSidebar.d.ts.map +0 -1
- package/dist/components/SelectionSidebar.js +0 -190
- package/dist/components/SelectionSidebar.js.map +0 -1
- package/dist/components/SequenceDiagramRenderer.d.ts +0 -77
- package/dist/components/SequenceDiagramRenderer.d.ts.map +0 -1
- package/dist/components/SequenceDiagramRenderer.js +0 -604
- package/dist/components/SequenceDiagramRenderer.js.map +0 -1
- package/dist/components/WorkflowSequenceDiagram.d.ts +0 -63
- package/dist/components/WorkflowSequenceDiagram.d.ts.map +0 -1
- package/dist/components/WorkflowSequenceDiagram.js +0 -147
- package/dist/components/WorkflowSequenceDiagram.js.map +0 -1
- package/dist/components/dashboard/DashboardRenderer.d.ts +0 -10
- package/dist/components/dashboard/DashboardRenderer.d.ts.map +0 -1
- package/dist/components/dashboard/DashboardRenderer.js +0 -179
- package/dist/components/dashboard/DashboardRenderer.js.map +0 -1
- package/dist/components/dashboard/MetricPanel.d.ts +0 -10
- package/dist/components/dashboard/MetricPanel.d.ts.map +0 -1
- package/dist/components/dashboard/MetricPanel.js +0 -103
- package/dist/components/dashboard/MetricPanel.js.map +0 -1
- package/dist/components/dashboard/MockDataProvider.d.ts +0 -30
- package/dist/components/dashboard/MockDataProvider.d.ts.map +0 -1
- package/dist/components/dashboard/MockDataProvider.js +0 -270
- package/dist/components/dashboard/MockDataProvider.js.map +0 -1
- package/dist/components/dashboard/components/BarChart.d.ts +0 -10
- package/dist/components/dashboard/components/BarChart.d.ts.map +0 -1
- package/dist/components/dashboard/components/BarChart.js +0 -167
- package/dist/components/dashboard/components/BarChart.js.map +0 -1
- package/dist/components/dashboard/components/LineChart.d.ts +0 -10
- package/dist/components/dashboard/components/LineChart.d.ts.map +0 -1
- package/dist/components/dashboard/components/LineChart.js +0 -141
- package/dist/components/dashboard/components/LineChart.js.map +0 -1
- package/dist/components/dashboard/components/MetricCard.d.ts +0 -9
- package/dist/components/dashboard/components/MetricCard.d.ts.map +0 -1
- package/dist/components/dashboard/components/MetricCard.js +0 -163
- package/dist/components/dashboard/components/MetricCard.js.map +0 -1
- package/dist/components/dashboard/components/SourceLink.d.ts +0 -9
- package/dist/components/dashboard/components/SourceLink.d.ts.map +0 -1
- package/dist/components/dashboard/components/SourceLink.js +0 -39
- package/dist/components/dashboard/components/SourceLink.js.map +0 -1
- package/dist/components/dashboard/components/TimeRangeSelector.d.ts +0 -9
- package/dist/components/dashboard/components/TimeRangeSelector.d.ts.map +0 -1
- package/dist/components/dashboard/components/TimeRangeSelector.js +0 -167
- package/dist/components/dashboard/components/TimeRangeSelector.js.map +0 -1
- package/dist/components/dashboard/components/index.d.ts +0 -6
- package/dist/components/dashboard/components/index.d.ts.map +0 -1
- package/dist/components/dashboard/components/index.js +0 -6
- package/dist/components/dashboard/components/index.js.map +0 -1
- package/dist/components/dashboard/index.d.ts +0 -6
- package/dist/components/dashboard/index.d.ts.map +0 -1
- package/dist/components/dashboard/index.js +0 -8
- package/dist/components/dashboard/index.js.map +0 -1
- package/dist/components/dashboard/types.d.ts +0 -74
- package/dist/components/dashboard/types.d.ts.map +0 -1
- package/dist/components/dashboard/types.js +0 -8
- package/dist/components/dashboard/types.js.map +0 -1
- package/dist/components/state-view/PipelineView.d.ts +0 -14
- package/dist/components/state-view/PipelineView.d.ts.map +0 -1
- package/dist/components/state-view/PipelineView.js +0 -195
- package/dist/components/state-view/PipelineView.js.map +0 -1
- package/dist/components/state-view/index.d.ts +0 -14
- package/dist/components/state-view/index.d.ts.map +0 -1
- package/dist/components/state-view/index.js +0 -12
- package/dist/components/state-view/index.js.map +0 -1
- package/dist/components/state-view/types.d.ts +0 -188
- package/dist/components/state-view/types.d.ts.map +0 -1
- package/dist/components/state-view/types.js +0 -10
- package/dist/components/state-view/types.js.map +0 -1
- package/dist/components/state-view/useStateView.d.ts +0 -32
- package/dist/components/state-view/useStateView.d.ts.map +0 -1
- package/dist/components/state-view/useStateView.js +0 -129
- package/dist/components/state-view/useStateView.js.map +0 -1
- package/dist/contexts/GraphEditContext.d.ts +0 -20
- package/dist/contexts/GraphEditContext.d.ts.map +0 -1
- package/dist/contexts/GraphEditContext.js +0 -8
- package/dist/contexts/GraphEditContext.js.map +0 -1
- package/dist/contexts/TooltipPortalContext.d.ts +0 -8
- package/dist/contexts/TooltipPortalContext.d.ts.map +0 -1
- package/dist/contexts/TooltipPortalContext.js +0 -8
- package/dist/contexts/TooltipPortalContext.js.map +0 -1
- package/dist/edges/CustomEdge.d.ts +0 -24
- package/dist/edges/CustomEdge.d.ts.map +0 -1
- package/dist/edges/CustomEdge.js +0 -222
- package/dist/edges/CustomEdge.js.map +0 -1
- package/dist/edges/GenericEdge.d.ts +0 -18
- package/dist/edges/GenericEdge.d.ts.map +0 -1
- package/dist/edges/GenericEdge.js +0 -10
- package/dist/edges/GenericEdge.js.map +0 -1
- package/dist/graphify/kind.d.ts +0 -23
- package/dist/graphify/kind.d.ts.map +0 -1
- package/dist/graphify/kind.js +0 -77
- package/dist/graphify/kind.js.map +0 -1
- package/dist/hooks/usePathBasedEvents.d.ts +0 -42
- package/dist/hooks/usePathBasedEvents.d.ts.map +0 -1
- package/dist/hooks/usePathBasedEvents.js +0 -119
- package/dist/hooks/usePathBasedEvents.js.map +0 -1
- package/dist/hooks/useSequenceLayout.d.ts +0 -186
- package/dist/hooks/useSequenceLayout.d.ts.map +0 -1
- package/dist/hooks/useSequenceLayout.js +0 -327
- package/dist/hooks/useSequenceLayout.js.map +0 -1
- package/dist/hooks/useUndoRedo.d.ts +0 -80
- package/dist/hooks/useUndoRedo.d.ts.map +0 -1
- package/dist/hooks/useUndoRedo.js +0 -70
- package/dist/hooks/useUndoRedo.js.map +0 -1
- package/dist/nodes/CustomNode.d.ts +0 -28
- package/dist/nodes/CustomNode.d.ts.map +0 -1
- package/dist/nodes/CustomNode.js +0 -820
- package/dist/nodes/CustomNode.js.map +0 -1
- package/dist/nodes/GenericNode.d.ts +0 -20
- package/dist/nodes/GenericNode.d.ts.map +0 -1
- package/dist/nodes/GenericNode.js +0 -20
- package/dist/nodes/GenericNode.js.map +0 -1
- package/dist/nodes/otel/OtelBoundaryNode.d.ts +0 -55
- package/dist/nodes/otel/OtelBoundaryNode.d.ts.map +0 -1
- package/dist/nodes/otel/OtelBoundaryNode.js +0 -81
- package/dist/nodes/otel/OtelBoundaryNode.js.map +0 -1
- package/dist/nodes/otel/OtelEventNode.d.ts +0 -59
- package/dist/nodes/otel/OtelEventNode.d.ts.map +0 -1
- package/dist/nodes/otel/OtelEventNode.js +0 -82
- package/dist/nodes/otel/OtelEventNode.js.map +0 -1
- package/dist/nodes/otel/OtelResourceNode.d.ts +0 -53
- package/dist/nodes/otel/OtelResourceNode.d.ts.map +0 -1
- package/dist/nodes/otel/OtelResourceNode.js +0 -105
- package/dist/nodes/otel/OtelResourceNode.js.map +0 -1
- package/dist/nodes/otel/OtelScopeNode.d.ts +0 -53
- package/dist/nodes/otel/OtelScopeNode.d.ts.map +0 -1
- package/dist/nodes/otel/OtelScopeNode.js +0 -81
- package/dist/nodes/otel/OtelScopeNode.js.map +0 -1
- package/dist/nodes/otel/OtelSpanConventionNode.d.ts +0 -61
- package/dist/nodes/otel/OtelSpanConventionNode.d.ts.map +0 -1
- package/dist/nodes/otel/OtelSpanConventionNode.js +0 -131
- package/dist/nodes/otel/OtelSpanConventionNode.js.map +0 -1
- package/dist/nodes/otel/index.d.ts +0 -17
- package/dist/nodes/otel/index.d.ts.map +0 -1
- package/dist/nodes/otel/index.js +0 -13
- package/dist/nodes/otel/index.js.map +0 -1
- package/dist/nodes/otel/shared/NodeBadges.d.ts +0 -10
- package/dist/nodes/otel/shared/NodeBadges.d.ts.map +0 -1
- package/dist/nodes/otel/shared/NodeBadges.js +0 -178
- package/dist/nodes/otel/shared/NodeBadges.js.map +0 -1
- package/dist/nodes/otel/shared/NodeContent.d.ts +0 -10
- package/dist/nodes/otel/shared/NodeContent.d.ts.map +0 -1
- package/dist/nodes/otel/shared/NodeContent.js +0 -96
- package/dist/nodes/otel/shared/NodeContent.js.map +0 -1
- package/dist/nodes/otel/shared/index.d.ts +0 -8
- package/dist/nodes/otel/shared/index.d.ts.map +0 -1
- package/dist/nodes/otel/shared/index.js +0 -8
- package/dist/nodes/otel/shared/index.js.map +0 -1
- package/dist/nodes/otel/shared/types.d.ts +0 -129
- package/dist/nodes/otel/shared/types.d.ts.map +0 -1
- package/dist/nodes/otel/shared/types.js +0 -5
- package/dist/nodes/otel/shared/types.js.map +0 -1
- package/dist/nodes/otel/shared/useNodeBehavior.d.ts +0 -42
- package/dist/nodes/otel/shared/useNodeBehavior.d.ts.map +0 -1
- package/dist/nodes/otel/shared/useNodeBehavior.js +0 -61
- package/dist/nodes/otel/shared/useNodeBehavior.js.map +0 -1
- package/dist/pierre/PierreThroughlineCodeView.d.ts +0 -22
- package/dist/pierre/PierreThroughlineCodeView.d.ts.map +0 -1
- package/dist/pierre/PierreThroughlineCodeView.js +0 -206
- package/dist/pierre/PierreThroughlineCodeView.js.map +0 -1
- package/dist/subsystem/SubsystemCarousel.d.ts +0 -36
- package/dist/subsystem/SubsystemCarousel.d.ts.map +0 -1
- package/dist/subsystem/SubsystemCarousel.js +0 -163
- package/dist/subsystem/SubsystemCarousel.js.map +0 -1
- package/dist/utils/animationMapping.d.ts +0 -53
- package/dist/utils/animationMapping.d.ts.map +0 -1
- package/dist/utils/animationMapping.js +0 -126
- package/dist/utils/animationMapping.js.map +0 -1
- package/dist/utils/canvasBounds.d.ts +0 -50
- package/dist/utils/canvasBounds.d.ts.map +0 -1
- package/dist/utils/canvasBounds.js +0 -88
- package/dist/utils/canvasBounds.js.map +0 -1
- package/dist/utils/graphConverter.d.ts +0 -18
- package/dist/utils/graphConverter.d.ts.map +0 -1
- package/dist/utils/graphConverter.js +0 -114
- package/dist/utils/graphConverter.js.map +0 -1
- package/dist/utils/iconResolver.d.ts +0 -29
- package/dist/utils/iconResolver.d.ts.map +0 -1
- package/dist/utils/iconResolver.js +0 -30
- package/dist/utils/iconResolver.js.map +0 -1
- package/dist/utils/orientationUtils.d.ts +0 -19
- package/dist/utils/orientationUtils.d.ts.map +0 -1
- package/dist/utils/orientationUtils.js +0 -62
- package/dist/utils/orientationUtils.js.map +0 -1
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SubsystemCarousel — prototype gallery for flipping through subsystem models.
|
|
3
|
-
*
|
|
4
|
-
* Stage shows one live `SubsystemComponentGraph` at a time (prev/next). A
|
|
5
|
-
* browse button opens a grid overlay of all items so users can jump directly.
|
|
6
|
-
* Hosts pass items explicitly so site showcase cases and package Storybook
|
|
7
|
-
* fixtures can both drive the same component.
|
|
8
|
-
*/
|
|
9
|
-
/// <reference types="react" />
|
|
10
|
-
import type { SubsystemComponent, SubsystemComponentEdge, SubsystemThroughline } from './model';
|
|
11
|
-
export interface SubsystemCarouselItem {
|
|
12
|
-
id: string;
|
|
13
|
-
/** Card / stage title. */
|
|
14
|
-
title: string;
|
|
15
|
-
/** One-line blurb on the card. */
|
|
16
|
-
description?: string;
|
|
17
|
-
/** Stack chip (e.g. TypeScript, Python, Rust). */
|
|
18
|
-
stack?: string;
|
|
19
|
-
complexity?: 'low' | 'medium' | 'high';
|
|
20
|
-
components: SubsystemComponent[];
|
|
21
|
-
edges: SubsystemComponentEdge[];
|
|
22
|
-
throughlines?: SubsystemThroughline[];
|
|
23
|
-
}
|
|
24
|
-
export interface SubsystemCarouselProps {
|
|
25
|
-
items: SubsystemCarouselItem[];
|
|
26
|
-
/** Controlled selection; falls back to first item when omitted. */
|
|
27
|
-
selectedId?: string;
|
|
28
|
-
/** Fires when the user picks a card or uses prev/next. */
|
|
29
|
-
onSelect?: (id: string) => void;
|
|
30
|
-
/** Show the live graph for the selected item. @default true */
|
|
31
|
-
showGraph?: boolean;
|
|
32
|
-
/** Stage height (CSS). @default '70vh' */
|
|
33
|
-
stageHeight?: string | number;
|
|
34
|
-
}
|
|
35
|
-
export declare function SubsystemCarousel({ items, selectedId: controlledId, onSelect, showGraph, stageHeight, }: SubsystemCarouselProps): import("react").JSX.Element;
|
|
36
|
-
//# sourceMappingURL=SubsystemCarousel.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SubsystemCarousel.d.ts","sourceRoot":"","sources":["../../src/subsystem/SubsystemCarousel.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;;AAOH,OAAO,KAAK,EACV,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IACvC,UAAU,EAAE,kBAAkB,EAAE,CAAC;IACjC,KAAK,EAAE,sBAAsB,EAAE,CAAC;IAChC,YAAY,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,qBAAqB,EAAE,CAAC;IAC/B,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,+DAA+D;IAC/D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC/B;AAOD,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,UAAU,EAAE,YAAY,EACxB,QAAQ,EACR,SAAgB,EAChB,WAAoB,GACrB,EAAE,sBAAsB,+BAiRxB"}
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* SubsystemCarousel — prototype gallery for flipping through subsystem models.
|
|
4
|
-
*
|
|
5
|
-
* Stage shows one live `SubsystemComponentGraph` at a time (prev/next). A
|
|
6
|
-
* browse button opens a grid overlay of all items so users can jump directly.
|
|
7
|
-
* Hosts pass items explicitly so site showcase cases and package Storybook
|
|
8
|
-
* fixtures can both drive the same component.
|
|
9
|
-
*/
|
|
10
|
-
import { useCallback, useEffect, useId, useState } from 'react';
|
|
11
|
-
import { ChevronLeft, ChevronRight, LayoutGrid, X } from 'lucide-react';
|
|
12
|
-
import { useTheme } from '@principal-ade/industry-theme';
|
|
13
|
-
import { SubsystemComponentGraph } from './SubsystemComponentGraph';
|
|
14
|
-
function clampIndex(i, len) {
|
|
15
|
-
if (len <= 0)
|
|
16
|
-
return 0;
|
|
17
|
-
return ((i % len) + len) % len;
|
|
18
|
-
}
|
|
19
|
-
export function SubsystemCarousel({ items, selectedId: controlledId, onSelect, showGraph = true, stageHeight = '70vh', }) {
|
|
20
|
-
const { theme } = useTheme();
|
|
21
|
-
const titleId = useId();
|
|
22
|
-
const [gridOpen, setGridOpen] = useState(false);
|
|
23
|
-
const [uncontrolledId, setUncontrolledId] = useState(items[0]?.id ?? '');
|
|
24
|
-
const selectedId = controlledId ?? uncontrolledId;
|
|
25
|
-
const selectedIndex = Math.max(0, items.findIndex((it) => it.id === selectedId));
|
|
26
|
-
const selected = items[selectedIndex] ?? items[0];
|
|
27
|
-
const selectAt = useCallback((index) => {
|
|
28
|
-
const next = items[clampIndex(index, items.length)];
|
|
29
|
-
if (!next)
|
|
30
|
-
return;
|
|
31
|
-
if (controlledId === undefined)
|
|
32
|
-
setUncontrolledId(next.id);
|
|
33
|
-
onSelect?.(next.id);
|
|
34
|
-
}, [controlledId, items, onSelect]);
|
|
35
|
-
const selectId = useCallback((id) => {
|
|
36
|
-
const idx = items.findIndex((it) => it.id === id);
|
|
37
|
-
if (idx >= 0)
|
|
38
|
-
selectAt(idx);
|
|
39
|
-
}, [items, selectAt]);
|
|
40
|
-
useEffect(() => {
|
|
41
|
-
if (controlledId !== undefined)
|
|
42
|
-
return;
|
|
43
|
-
if (!items.some((it) => it.id === uncontrolledId) && items[0]) {
|
|
44
|
-
setUncontrolledId(items[0].id);
|
|
45
|
-
}
|
|
46
|
-
}, [controlledId, items, uncontrolledId]);
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
if (!gridOpen)
|
|
49
|
-
return;
|
|
50
|
-
const onKey = (e) => {
|
|
51
|
-
if (e.key === 'Escape')
|
|
52
|
-
setGridOpen(false);
|
|
53
|
-
};
|
|
54
|
-
window.addEventListener('keydown', onKey);
|
|
55
|
-
return () => window.removeEventListener('keydown', onKey);
|
|
56
|
-
}, [gridOpen]);
|
|
57
|
-
const onStageKeyDown = (e) => {
|
|
58
|
-
if (gridOpen)
|
|
59
|
-
return;
|
|
60
|
-
if (e.key === 'ArrowRight') {
|
|
61
|
-
e.preventDefault();
|
|
62
|
-
selectAt(selectedIndex + 1);
|
|
63
|
-
}
|
|
64
|
-
else if (e.key === 'ArrowLeft') {
|
|
65
|
-
e.preventDefault();
|
|
66
|
-
selectAt(selectedIndex - 1);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
if (!items.length || !selected) {
|
|
70
|
-
return (_jsx("div", { style: { padding: 24, color: theme.colors.textMuted ?? theme.colors.textSecondary }, children: "No subsystem examples." }));
|
|
71
|
-
}
|
|
72
|
-
const muted = theme.colors.textMuted ?? theme.colors.textSecondary;
|
|
73
|
-
const border = theme.colors.border ?? 'rgba(127,127,127,0.3)';
|
|
74
|
-
return (_jsxs("div", { role: "region", "aria-labelledby": titleId, tabIndex: 0, onKeyDown: onStageKeyDown, style: {
|
|
75
|
-
display: 'flex',
|
|
76
|
-
flexDirection: 'column',
|
|
77
|
-
width: '100%',
|
|
78
|
-
height: '100%',
|
|
79
|
-
minHeight: 0,
|
|
80
|
-
position: 'relative',
|
|
81
|
-
background: theme.colors.background,
|
|
82
|
-
color: theme.colors.text,
|
|
83
|
-
fontFamily: theme.fonts.body,
|
|
84
|
-
outline: 'none',
|
|
85
|
-
}, children: [_jsxs("div", { style: {
|
|
86
|
-
display: 'flex',
|
|
87
|
-
alignItems: 'center',
|
|
88
|
-
justifyContent: 'space-between',
|
|
89
|
-
gap: 12,
|
|
90
|
-
padding: '10px 16px',
|
|
91
|
-
borderBottom: `1px solid ${border}`,
|
|
92
|
-
}, children: [_jsx("button", { type: "button", "aria-label": "Previous example", onClick: () => selectAt(selectedIndex - 1), style: navBtnStyle(theme), children: _jsx(ChevronLeft, { size: 18 }) }), _jsxs("div", { style: { textAlign: 'center', minWidth: 0, flex: 1 }, children: [_jsx("div", { id: titleId, style: { fontWeight: 600, fontSize: 16 }, children: selected.title }), selected.description && (_jsx("div", { style: { fontSize: 13, color: muted, marginTop: 2 }, children: selected.description })), _jsxs("div", { style: { fontSize: 11, color: muted, marginTop: 4, opacity: 0.8 }, children: [selectedIndex + 1, " / ", items.length, selected.stack ? ` · ${selected.stack}` : ''] })] }), _jsxs("div", { style: { display: 'flex', gap: 8, alignItems: 'center' }, children: [_jsxs("button", { type: "button", "aria-label": "Browse all examples", "aria-expanded": gridOpen, onClick: () => setGridOpen(true), style: {
|
|
93
|
-
...navBtnStyle(theme),
|
|
94
|
-
width: 'auto',
|
|
95
|
-
padding: '0 12px',
|
|
96
|
-
gap: 6,
|
|
97
|
-
fontSize: 13,
|
|
98
|
-
}, children: [_jsx(LayoutGrid, { size: 16 }), "All"] }), _jsx("button", { type: "button", "aria-label": "Next example", onClick: () => selectAt(selectedIndex + 1), style: navBtnStyle(theme), children: _jsx(ChevronRight, { size: 18 }) })] })] }), showGraph && (_jsx("div", { style: { flex: 1, minHeight: stageHeight, position: 'relative' }, children: _jsx(SubsystemComponentGraph, { components: selected.components, edges: selected.edges, throughlines: selected.throughlines, title: selected.title, description: selected.description, hideSidebar: true, graphTitle: selected.title, showEdgeLabels: true }, selected.id) })), gridOpen && (_jsxs("div", { role: "dialog", "aria-modal": "true", "aria-label": "All subsystem examples", style: {
|
|
99
|
-
position: 'absolute',
|
|
100
|
-
inset: 0,
|
|
101
|
-
zIndex: 40,
|
|
102
|
-
background: theme.colors.background,
|
|
103
|
-
display: 'flex',
|
|
104
|
-
flexDirection: 'column',
|
|
105
|
-
minHeight: 0,
|
|
106
|
-
}, children: [_jsxs("div", { style: {
|
|
107
|
-
display: 'flex',
|
|
108
|
-
alignItems: 'center',
|
|
109
|
-
justifyContent: 'space-between',
|
|
110
|
-
padding: '12px 16px',
|
|
111
|
-
borderBottom: `1px solid ${border}`,
|
|
112
|
-
}, children: [_jsx("div", { style: { fontWeight: 600, fontSize: 16 }, children: "All examples" }), _jsx("button", { type: "button", "aria-label": "Close browse grid", onClick: () => setGridOpen(false), style: navBtnStyle(theme), children: _jsx(X, { size: 18 }) })] }), _jsx("div", { style: {
|
|
113
|
-
flex: 1,
|
|
114
|
-
overflow: 'auto',
|
|
115
|
-
padding: 16,
|
|
116
|
-
display: 'grid',
|
|
117
|
-
gridTemplateColumns: 'repeat(auto-fill, minmax(200px, 1fr))',
|
|
118
|
-
gap: 12,
|
|
119
|
-
alignContent: 'start',
|
|
120
|
-
}, children: items.map((item) => {
|
|
121
|
-
const active = item.id === selected.id;
|
|
122
|
-
return (_jsxs("button", { type: "button", onClick: () => {
|
|
123
|
-
selectId(item.id);
|
|
124
|
-
setGridOpen(false);
|
|
125
|
-
}, style: {
|
|
126
|
-
textAlign: 'left',
|
|
127
|
-
padding: '14px 16px',
|
|
128
|
-
borderRadius: 10,
|
|
129
|
-
border: `1px solid ${active ? (theme.colors.accent ?? theme.colors.primary) : border}`,
|
|
130
|
-
background: active
|
|
131
|
-
? (theme.colors.backgroundSecondary ?? theme.colors.surface)
|
|
132
|
-
: (theme.colors.surface ?? theme.colors.background),
|
|
133
|
-
color: theme.colors.text,
|
|
134
|
-
cursor: 'pointer',
|
|
135
|
-
display: 'flex',
|
|
136
|
-
flexDirection: 'column',
|
|
137
|
-
gap: 6,
|
|
138
|
-
minHeight: 110,
|
|
139
|
-
}, children: [_jsxs("div", { style: { display: 'flex', gap: 8, flexWrap: 'wrap', alignItems: 'center' }, children: [item.stack && (_jsx("span", { style: {
|
|
140
|
-
fontSize: 11,
|
|
141
|
-
fontFamily: theme.fonts.monospace,
|
|
142
|
-
padding: '2px 6px',
|
|
143
|
-
borderRadius: 4,
|
|
144
|
-
background: theme.colors.backgroundSecondary ?? theme.colors.surface,
|
|
145
|
-
color: muted,
|
|
146
|
-
}, children: item.stack })), item.complexity && (_jsx("span", { style: { fontSize: 11, color: muted }, children: item.complexity }))] }), _jsx("div", { style: { fontSize: 15, fontWeight: 600, lineHeight: 1.3 }, children: item.title }), item.description && (_jsx("div", { style: { fontSize: 12, lineHeight: 1.4, color: muted }, children: item.description }))] }, item.id));
|
|
147
|
-
}) })] }))] }));
|
|
148
|
-
}
|
|
149
|
-
function navBtnStyle(theme) {
|
|
150
|
-
return {
|
|
151
|
-
display: 'inline-flex',
|
|
152
|
-
alignItems: 'center',
|
|
153
|
-
justifyContent: 'center',
|
|
154
|
-
width: 36,
|
|
155
|
-
height: 36,
|
|
156
|
-
borderRadius: 8,
|
|
157
|
-
border: `1px solid ${theme.colors.border ?? 'rgba(127,127,127,0.3)'}`,
|
|
158
|
-
background: theme.colors.surface ?? 'transparent',
|
|
159
|
-
color: theme.colors.text,
|
|
160
|
-
cursor: 'pointer',
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
//# sourceMappingURL=SubsystemCarousel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SubsystemCarousel.js","sourceRoot":"","sources":["../../src/subsystem/SubsystemCarousel.tsx"],"names":[],"mappings":";AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAiCpE,SAAS,UAAU,CAAC,CAAS,EAAE,GAAW;IACxC,IAAI,GAAG,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IACvB,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,EAChC,KAAK,EACL,UAAU,EAAE,YAAY,EACxB,QAAQ,EACR,SAAS,GAAG,IAAI,EAChB,WAAW,GAAG,MAAM,GACG;IACvB,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,OAAO,GAAG,KAAK,EAAE,CAAC;IACxB,MAAM,CAAC,QAAQ,EAAE,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AAI,aAAa;QACjD,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI;QACxB,MAAM,EAAE,SAAS;KAClB,CAAC;AACJ,CAAC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Animation mapping utilities
|
|
3
|
-
*
|
|
4
|
-
* Maps log levels and component events to appropriate animations
|
|
5
|
-
* for Milestone 1 default visualization behavior
|
|
6
|
-
*/
|
|
7
|
-
import type { LogLevel } from '@principal-ai/subsystems-core';
|
|
8
|
-
/**
|
|
9
|
-
* Node animation configuration
|
|
10
|
-
*/
|
|
11
|
-
export interface NodeAnimation {
|
|
12
|
-
type: 'pulse' | 'flash' | 'shake' | 'entry';
|
|
13
|
-
duration: number;
|
|
14
|
-
intensity?: number;
|
|
15
|
-
color?: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Edge animation configuration
|
|
19
|
-
*/
|
|
20
|
-
export interface EdgeAnimation {
|
|
21
|
-
type: 'flow' | 'particle' | 'pulse' | 'glow';
|
|
22
|
-
duration: number;
|
|
23
|
-
direction?: 'forward' | 'backward' | 'bidirectional';
|
|
24
|
-
color?: string;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Map log level to node animation
|
|
28
|
-
*
|
|
29
|
-
* Default behavior for Milestone 1:
|
|
30
|
-
* - debug: subtle pulse (low intensity)
|
|
31
|
-
* - info: standard pulse (medium intensity)
|
|
32
|
-
* - warn: amber pulse (high intensity)
|
|
33
|
-
* - error: red flash + shake
|
|
34
|
-
*/
|
|
35
|
-
export declare function logLevelToNodeAnimation(level: LogLevel): NodeAnimation;
|
|
36
|
-
/**
|
|
37
|
-
* Map component action to node animation (Milestone 2)
|
|
38
|
-
*/
|
|
39
|
-
export declare function actionToNodeAnimation(_action: string, state?: string): NodeAnimation;
|
|
40
|
-
/**
|
|
41
|
-
* Get animation config for edge based on action (Milestone 2)
|
|
42
|
-
*/
|
|
43
|
-
export declare function actionToEdgeAnimation(_action: string, edgeConfig?: EdgeAnimation): EdgeAnimation;
|
|
44
|
-
/**
|
|
45
|
-
* Check if log level should trigger animation
|
|
46
|
-
*/
|
|
47
|
-
export declare function shouldAnimate(level: LogLevel, minLevel?: LogLevel): boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Calculate animation intensity based on frequency
|
|
50
|
-
* Used to adjust animation intensity when multiple logs occur rapidly
|
|
51
|
-
*/
|
|
52
|
-
export declare function calculateIntensity(baseIntensity: number, eventCount: number, _timeWindow?: number): number;
|
|
53
|
-
//# sourceMappingURL=animationMapping.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"animationMapping.d.ts","sourceRoot":"","sources":["../../src/utils/animationMapping.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,eAAe,CAAC;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,QAAQ,GAAG,aAAa,CAkCtE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,aAAa,CAiDpF;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,aAAa,GAAG,aAAa,CAShG;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,GAAE,QAAiB,GAAG,OAAO,CAMnF;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAClB,WAAW,GAAE,MAAa,GACzB,MAAM,CAIR"}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Animation mapping utilities
|
|
3
|
-
*
|
|
4
|
-
* Maps log levels and component events to appropriate animations
|
|
5
|
-
* for Milestone 1 default visualization behavior
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Map log level to node animation
|
|
9
|
-
*
|
|
10
|
-
* Default behavior for Milestone 1:
|
|
11
|
-
* - debug: subtle pulse (low intensity)
|
|
12
|
-
* - info: standard pulse (medium intensity)
|
|
13
|
-
* - warn: amber pulse (high intensity)
|
|
14
|
-
* - error: red flash + shake
|
|
15
|
-
*/
|
|
16
|
-
export function logLevelToNodeAnimation(level) {
|
|
17
|
-
switch (level) {
|
|
18
|
-
case 'debug':
|
|
19
|
-
return {
|
|
20
|
-
type: 'pulse',
|
|
21
|
-
duration: 800,
|
|
22
|
-
intensity: 0.3,
|
|
23
|
-
color: '#94a3b8', // slate-400
|
|
24
|
-
};
|
|
25
|
-
case 'info':
|
|
26
|
-
return {
|
|
27
|
-
type: 'pulse',
|
|
28
|
-
duration: 1000,
|
|
29
|
-
intensity: 0.5,
|
|
30
|
-
color: '#3b82f6', // blue-500
|
|
31
|
-
};
|
|
32
|
-
case 'warn':
|
|
33
|
-
return {
|
|
34
|
-
type: 'pulse',
|
|
35
|
-
duration: 1200,
|
|
36
|
-
intensity: 1.0,
|
|
37
|
-
color: '#f59e0b', // amber-500
|
|
38
|
-
};
|
|
39
|
-
case 'error':
|
|
40
|
-
return {
|
|
41
|
-
type: 'flash',
|
|
42
|
-
duration: 1500,
|
|
43
|
-
intensity: 1.0,
|
|
44
|
-
color: '#ef4444', // red-500
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Map component action to node animation (Milestone 2)
|
|
50
|
-
*/
|
|
51
|
-
export function actionToNodeAnimation(_action, state) {
|
|
52
|
-
// Default mapping - can be overridden by configuration
|
|
53
|
-
switch (state) {
|
|
54
|
-
case 'acquired':
|
|
55
|
-
case 'active':
|
|
56
|
-
case 'processing':
|
|
57
|
-
return {
|
|
58
|
-
type: 'pulse',
|
|
59
|
-
duration: 1000,
|
|
60
|
-
intensity: 0.8,
|
|
61
|
-
color: '#22c55e', // green-500
|
|
62
|
-
};
|
|
63
|
-
case 'waiting':
|
|
64
|
-
case 'pending':
|
|
65
|
-
return {
|
|
66
|
-
type: 'pulse',
|
|
67
|
-
duration: 1500,
|
|
68
|
-
intensity: 0.5,
|
|
69
|
-
color: '#eab308', // yellow-500
|
|
70
|
-
};
|
|
71
|
-
case 'error':
|
|
72
|
-
case 'failed':
|
|
73
|
-
return {
|
|
74
|
-
type: 'shake',
|
|
75
|
-
duration: 600,
|
|
76
|
-
intensity: 1.0,
|
|
77
|
-
color: '#ef4444', // red-500
|
|
78
|
-
};
|
|
79
|
-
case 'completed':
|
|
80
|
-
case 'success':
|
|
81
|
-
return {
|
|
82
|
-
type: 'flash',
|
|
83
|
-
duration: 800,
|
|
84
|
-
intensity: 0.7,
|
|
85
|
-
color: '#22c55e', // green-500
|
|
86
|
-
};
|
|
87
|
-
default:
|
|
88
|
-
// Generic action animation
|
|
89
|
-
return {
|
|
90
|
-
type: 'pulse',
|
|
91
|
-
duration: 1000,
|
|
92
|
-
intensity: 0.6,
|
|
93
|
-
color: '#3b82f6', // blue-500
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Get animation config for edge based on action (Milestone 2)
|
|
99
|
-
*/
|
|
100
|
-
export function actionToEdgeAnimation(_action, edgeConfig) {
|
|
101
|
-
// Use edge config if provided, otherwise default
|
|
102
|
-
return (edgeConfig || {
|
|
103
|
-
type: 'flow',
|
|
104
|
-
duration: 2000,
|
|
105
|
-
direction: 'forward',
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Check if log level should trigger animation
|
|
110
|
-
*/
|
|
111
|
-
export function shouldAnimate(level, minLevel = 'info') {
|
|
112
|
-
const levels = ['debug', 'info', 'warn', 'error'];
|
|
113
|
-
const minIndex = levels.indexOf(minLevel);
|
|
114
|
-
const currentIndex = levels.indexOf(level);
|
|
115
|
-
return currentIndex >= minIndex;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Calculate animation intensity based on frequency
|
|
119
|
-
* Used to adjust animation intensity when multiple logs occur rapidly
|
|
120
|
-
*/
|
|
121
|
-
export function calculateIntensity(baseIntensity, eventCount, _timeWindow = 1000) {
|
|
122
|
-
// Reduce intensity if too many events in time window
|
|
123
|
-
const scaleFactor = Math.min(1.0, 5.0 / eventCount);
|
|
124
|
-
return Math.max(0.2, baseIntensity * scaleFactor);
|
|
125
|
-
}
|
|
126
|
-
//# sourceMappingURL=animationMapping.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"animationMapping.js","sourceRoot":"","sources":["../../src/utils/animationMapping.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAwBH;;;;;;;;GAQG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAe;IACrD,QAAQ,KAAK,EAAE;QACb,KAAK,OAAO;YACV,OAAO;gBACL,IAAI,EAAE,OAAO;gBACb,QAAQ,EAAE,GAAG;gBACb,SAAS,EAAE,GAAG;gBACd,KAAK,EAAE,SAAS,EAAE,YAAY;aAC/B,CAAC;QAEJ,KAAK,MAAM;YACT,OAAO;gBACL,IAAI,EAAE,OAAO;gBACb,QAAQ,EAAE,IAAI;gBACd,S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AA2B;YAC3B,OAAO;gBACL,IAAI,EAAE,OAAO;gBACb,QAAQ,EAAE,IAAI;gBACd,SAAS,EAAE,GAAG;gBACd,KAAK,EAAE,SAAS,EAAE,WAAW;aAC9B,CAAC;KACL;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAe,EAAE,UAA0B;IAC/E,iDAAiD;IACjD,OAAO,CACL,UAAU,IAAI;QACZ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,SAAS;KACrB,CACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,KAAe,EAAE,WAAqB,MAAM;IACxE,MAAM,MAAM,GAAe,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9D,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC1C,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAE3C,OAAO,YAAY,IAAI,QAAQ,CAAC;AAClC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,aAAqB,EACrB,UAAkB,EAClB,cAAsB,IAAI;IAE1B,qDAAqD;IACrD,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,UAAU,CAAC,CAAC;IACpD,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,aAAa,GAAG,WAAW,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { ExtendedCanvas } from '@principal-ai/subsystems-core';
|
|
2
|
-
export interface CanvasBounds {
|
|
3
|
-
minX: number;
|
|
4
|
-
minY: number;
|
|
5
|
-
maxX: number;
|
|
6
|
-
maxY: number;
|
|
7
|
-
width: number;
|
|
8
|
-
height: number;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Calculate the bounding box of all nodes in a canvas.
|
|
12
|
-
* Returns the min/max coordinates and total dimensions.
|
|
13
|
-
*/
|
|
14
|
-
export declare function getCanvasBounds(canvas: ExtendedCanvas): CanvasBounds;
|
|
15
|
-
export interface Viewport {
|
|
16
|
-
x: number;
|
|
17
|
-
y: number;
|
|
18
|
-
zoom: number;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Calculate the initial viewport to fit all nodes within a container.
|
|
22
|
-
* This allows setting defaultViewport on ReactFlow to avoid the
|
|
23
|
-
* "zoom in then animate out" effect.
|
|
24
|
-
*
|
|
25
|
-
* @param bounds - The bounding box of all nodes
|
|
26
|
-
* @param containerWidth - Width of the container in pixels
|
|
27
|
-
* @param containerHeight - Height of the container in pixels
|
|
28
|
-
* @param options - Additional options for padding and zoom limits
|
|
29
|
-
* @returns The viewport { x, y, zoom } to pass to ReactFlow's defaultViewport
|
|
30
|
-
*/
|
|
31
|
-
export declare function calculateInitialViewport(bounds: CanvasBounds, containerWidth: number, containerHeight: number, options?: {
|
|
32
|
-
padding?: number;
|
|
33
|
-
minZoom?: number;
|
|
34
|
-
maxZoom?: number;
|
|
35
|
-
}): Viewport;
|
|
36
|
-
/**
|
|
37
|
-
* Calculate a recommended display size for a canvas cell.
|
|
38
|
-
* Adds padding and enforces minimum dimensions.
|
|
39
|
-
*/
|
|
40
|
-
export declare function getCanvasDisplaySize(canvas: ExtendedCanvas, options?: {
|
|
41
|
-
padding?: number;
|
|
42
|
-
minWidth?: number;
|
|
43
|
-
minHeight?: number;
|
|
44
|
-
maxWidth?: number;
|
|
45
|
-
maxHeight?: number;
|
|
46
|
-
}): {
|
|
47
|
-
width: number;
|
|
48
|
-
height: number;
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=canvasBounds.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"canvasBounds.d.ts","sourceRoot":"","sources":["../../src/utils/canvasBounds.ts"],"names":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vas.
|
|
5
|
-
* Returns the min/max coordinates and total dimensions.
|
|
6
|
-
*/
|
|
7
|
-
export function getCanvasBounds(canvas) {
|
|
8
|
-
if (!canvas.nodes || canvas.nodes.length === 0) {
|
|
9
|
-
return {
|
|
10
|
-
minX: 0,
|
|
11
|
-
minY: 0,
|
|
12
|
-
maxX: DEFAULT_NODE_WIDTH,
|
|
13
|
-
maxY: DEFAULT_NODE_HEIGHT,
|
|
14
|
-
width: DEFAULT_NODE_WIDTH,
|
|
15
|
-
height: DEFAULT_NODE_HEIGHT,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
let minX = Infinity;
|
|
19
|
-
let minY = Infinity;
|
|
20
|
-
let maxX = -Infinity;
|
|
21
|
-
let maxY = -Infinity;
|
|
22
|
-
for (const node of canvas.nodes) {
|
|
23
|
-
const x = node.x ?? 0;
|
|
24
|
-
const y = node.y ?? 0;
|
|
25
|
-
const width = node.width ?? DEFAULT_NODE_WIDTH;
|
|
26
|
-
const height = node.height ?? DEFAULT_NODE_HEIGHT;
|
|
27
|
-
minX = Math.min(minX, x);
|
|
28
|
-
minY = Math.min(minY, y);
|
|
29
|
-
maxX = Math.max(maxX, x + width);
|
|
30
|
-
maxY = Math.max(maxY, y + height);
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
minX,
|
|
34
|
-
minY,
|
|
35
|
-
maxX,
|
|
36
|
-
maxY,
|
|
37
|
-
width: maxX - minX,
|
|
38
|
-
height: maxY - minY,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Calculate the initial viewport to fit all nodes within a container.
|
|
43
|
-
* This allows setting defaultViewport on ReactFlow to avoid the
|
|
44
|
-
* "zoom in then animate out" effect.
|
|
45
|
-
*
|
|
46
|
-
* @param bounds - The bounding box of all nodes
|
|
47
|
-
* @param containerWidth - Width of the container in pixels
|
|
48
|
-
* @param containerHeight - Height of the container in pixels
|
|
49
|
-
* @param options - Additional options for padding and zoom limits
|
|
50
|
-
* @returns The viewport { x, y, zoom } to pass to ReactFlow's defaultViewport
|
|
51
|
-
*/
|
|
52
|
-
export function calculateInitialViewport(bounds, containerWidth, containerHeight, options = {}) {
|
|
53
|
-
const { padding = 0.2, minZoom = 0.1, maxZoom = 1.5 } = options;
|
|
54
|
-
// Calculate the zoom level needed to fit the bounds within the container
|
|
55
|
-
// Account for padding by reducing the effective container size
|
|
56
|
-
const effectiveWidth = containerWidth * (1 - padding);
|
|
57
|
-
const effectiveHeight = containerHeight * (1 - padding);
|
|
58
|
-
const zoomX = effectiveWidth / bounds.width;
|
|
59
|
-
const zoomY = effectiveHeight / bounds.height;
|
|
60
|
-
// Use the smaller zoom to ensure both dimensions fit
|
|
61
|
-
let zoom = Math.min(zoomX, zoomY);
|
|
62
|
-
// Clamp to min/max zoom
|
|
63
|
-
zoom = Math.max(minZoom, Math.min(maxZoom, zoom));
|
|
64
|
-
// Calculate the center of the bounds
|
|
65
|
-
const boundsCenterX = bounds.minX + bounds.width / 2;
|
|
66
|
-
const boundsCenterY = bounds.minY + bounds.height / 2;
|
|
67
|
-
// Calculate viewport position to center the bounds
|
|
68
|
-
// ReactFlow viewport x,y represent the offset of the canvas origin from the container's top-left
|
|
69
|
-
const x = containerWidth / 2 - boundsCenterX * zoom;
|
|
70
|
-
const y = containerHeight / 2 - boundsCenterY * zoom;
|
|
71
|
-
return { x, y, zoom };
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Calculate a recommended display size for a canvas cell.
|
|
75
|
-
* Adds padding and enforces minimum dimensions.
|
|
76
|
-
*/
|
|
77
|
-
export function getCanvasDisplaySize(canvas, options = {}) {
|
|
78
|
-
const { padding = 100, minWidth = 300, minHeight = 200, maxWidth = 1200, maxHeight = 800, } = options;
|
|
79
|
-
const bounds = getCanvasBounds(canvas);
|
|
80
|
-
// Add padding to content dimensions
|
|
81
|
-
const contentWidth = bounds.width + padding * 2;
|
|
82
|
-
const contentHeight = bounds.height + padding * 2;
|
|
83
|
-
// Clamp to min/max
|
|
84
|
-
const width = Math.min(maxWidth, Math.max(minWidth, contentWidth));
|
|
85
|
-
const height = Math.min(maxHeight, Math.max(minHeight, contentHeight));
|
|
86
|
-
return { width, height };
|
|
87
|
-
}
|
|
88
|
-
//# sourceMappingURL=canvasBounds.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"canvasBounds.js","sourceRoot":"","sources":["../../src/utils/canvasBounds.ts"],"names":[],"mappings":"AAWA,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEhC;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,MAAsB;IACpD,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QAC9C,OAAO;YACL,IAAI,EAAE,CAAC;YACP,IAAI,EAAE,CAAC;YACP,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE,kBAAkB;YACzB,MAAM,EAAE,mBAAmB;SAC5B,CAAC;KACH;IAED,IAAI,IAAI,GAAG,QAAQ,CAAC;IACpB,IAAI,IAAI,GAAG,QAAQ,CAAC;IACpB,IAAI,IAAI,GAAG,CAAC,QAAQ,CAAC;IACrB,IAAI,IAAI,GAAG,CAAC,QAAQ,CAAC;IAErB,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE;QAC/B,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QACtB,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QACtB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,kBAAkB,CAAC;QAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,mBAAmB,CAAC;QAElD,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC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;IACrD,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAEtD,mDAAmD;IACnD,iGAAiG;IACjG,MAAM,CAAC,GAAG,cAAc,GAAG,CAAC,GAAG,aAAa,GAAG,IAAI,CAAC;IACpD,MAAM,CAAC,GAAG,eAAe,GAAG,CAAC,GAAG,aAAa,GAAG,IAAI,CAAC;IAErD,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC;AACxB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAsB,EACtB,UAMI,EAAE;IAEN,MAAM,EACJ,OAAO,GAAG,GAAG,EACb,QAAQ,GAAG,GAAG,EACd,SAAS,GAAG,GAAG,EACf,QAAQ,GAAG,IAAI,EACf,SAAS,GAAG,GAAG,GAChB,GAAG,OAAO,CAAC;IAEZ,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAEvC,oCAAoC;IACpC,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,GAAG,OAAO,GAAG,CAAC,CAAC;IAChD,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,GAAG,OAAO,GAAG,CAAC,CAAC;IAElD,mBAAmB;IACnB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;IACnE,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC;IAEvE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { type Node, type Edge } from '@xyflow/react';
|
|
2
|
-
import type { NodeState, EdgeState, GraphConfiguration, Violation } from '@principal-ai/subsystems-core';
|
|
3
|
-
import type { CustomNodeData } from '../nodes/CustomNode';
|
|
4
|
-
import type { CustomEdgeData } from '../edges/CustomEdge';
|
|
5
|
-
/**
|
|
6
|
-
* Convert our NodeState to xyflow Node format
|
|
7
|
-
*/
|
|
8
|
-
export declare function convertToXYFlowNodes(nodes: NodeState[], configuration: GraphConfiguration, violations?: Violation[]): Node<CustomNodeData>[];
|
|
9
|
-
/** Extended edge state with optional handle information for ReactFlow */
|
|
10
|
-
export interface EdgeStateWithHandles extends EdgeState {
|
|
11
|
-
sourceHandle?: string;
|
|
12
|
-
targetHandle?: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Convert our EdgeState to xyflow Edge format
|
|
16
|
-
*/
|
|
17
|
-
export declare function convertToXYFlowEdges(edges: (EdgeState | EdgeStateWithHandles)[], configuration: GraphConfiguration, violations?: Violation[]): Edge<CustomEdgeData>[];
|
|
18
|
-
//# sourceMappingURL=graphConverter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graphConverter.d.ts","sourceRoot":"","sources":["../../src/utils/graphConverter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,kBAAkB,EAClB,SAAS,EACV,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,EAAE,EAClB,aAAa,EAAE,kBAAkB,EACjC,UAAU,GAAE,SAAS,EAAO,GAC3B,IAAI,CAAC,cAAc,CAAC,EAAE,CA8CxB;AAED,yEAAyE;AACzE,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAmBD;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,CAAC,SAAS,GAAG,oBAAoB,CAAC,EAAE,EAC3C,aAAa,EAAE,kBAAkB,EACjC,UAAU,GAAE,SAAS,EAAO,GAC3B,IAAI,CAAC,cAAc,CAAC,EAAE,CAmDxB"}
|