@principal-ai/subsystems-react 0.55.1 → 0.55.3
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/README.md +2 -1
- package/dist/graphify/index.d.ts +2 -0
- package/dist/graphify/index.d.ts.map +1 -1
- package/dist/graphify/index.js +1 -0
- package/dist/graphify/index.js.map +1 -1
- package/dist/graphify/symbolFocus.d.ts +49 -0
- package/dist/graphify/symbolFocus.d.ts.map +1 -0
- package/dist/graphify/symbolFocus.js +139 -0
- package/dist/graphify/symbolFocus.js.map +1 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/stories/Canvases/Aggregate/aggregateViewFixture.d.ts.map +1 -0
- package/dist/stories/Canvases/Aggregate/aggregateViewFixture.js.map +1 -0
- package/dist/stories/Canvases/Subsystem/fixtures.d.ts.map +1 -0
- package/dist/stories/Canvases/Subsystem/fixtures.js.map +1 -0
- package/dist/subsystem/SubsystemComponentGraph.d.ts +35 -1
- package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.js +248 -33
- package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
- package/dist/subsystem/SymbolFocusedView.d.ts +30 -0
- package/dist/subsystem/SymbolFocusedView.d.ts.map +1 -0
- package/dist/subsystem/SymbolFocusedView.js +24 -0
- package/dist/subsystem/SymbolFocusedView.js.map +1 -0
- package/dist/subsystem/TrailsPanel.d.ts +16 -1
- package/dist/subsystem/TrailsPanel.d.ts.map +1 -1
- package/dist/subsystem/TrailsPanel.js +64 -8
- package/dist/subsystem/TrailsPanel.js.map +1 -1
- package/dist/subsystem/graphChrome.d.ts +13 -0
- package/dist/subsystem/graphChrome.d.ts.map +1 -1
- package/dist/subsystem/graphChrome.js +19 -1
- package/dist/subsystem/graphChrome.js.map +1 -1
- package/dist/subsystem/model.d.ts +40 -4
- package/dist/subsystem/model.d.ts.map +1 -1
- package/dist/subsystem/model.js +38 -7
- package/dist/subsystem/model.js.map +1 -1
- package/package.json +2 -2
- package/src/graphify/index.ts +6 -0
- package/src/graphify/symbolFocus.test.ts +163 -0
- package/src/graphify/symbolFocus.ts +190 -0
- package/src/index.ts +7 -0
- package/src/stories/{Subsystem/AggregateGraph → Canvases/Aggregate}/AggregateFrameGraph.stories.tsx +1 -1
- package/src/stories/{Subsystem/C4Graph → Canvases/C4}/C4CardGrow.stories.tsx +1 -1
- package/src/stories/{Subsystem/C4Graph → Canvases/C4}/C4Component.stories.tsx +1 -1
- package/src/stories/{Subsystem/C4Graph → Canvases/C4}/C4Container.stories.tsx +1 -1
- package/src/stories/{Subsystem/C4Graph → Canvases/C4}/C4NodeGallery.stories.tsx +1 -1
- package/src/stories/{Subsystem/C4Graph → Canvases/C4}/C4ToComponentDrill.stories.tsx +1 -1
- package/src/stories/{Subsystem/C4Graph → Canvases/C4}/C4Transition.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/AnimatedProgression.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/Appearance.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/Basics.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/Captures.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/Constructs.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/CustomEntities.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/Deprecated.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/DetailPanel.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/Diagnostics.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/EdgeViews.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/FrameworkStereotype.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/GraphTitle.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/Issues.stories.tsx +1 -1
- package/src/stories/Canvases/Subsystem/LayoutDirection.stories.tsx +122 -0
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/ModuleBadges.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/ModulePathNesting.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/Modules.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/NodeAnatomy.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/Packages.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/Processes.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/Proposed.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/ProposedTrails.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/Reorder.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/Scenarios.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/Spotlights.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/StoreValueType.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/TrailAutoplay.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/Trails.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/WorkspacePackageFrames.stories.tsx +1 -1
- package/src/stories/Canvases/SymbolFocusedView/SymbolFocusedView.stories.tsx +163 -0
- package/src/stories/{Subsystem → Components}/AgentsPanel.stories.tsx +1 -1
- package/src/stories/{Subsystem/ComponentDeclarationAudit.stories.tsx → Components/ComponentDeclaration/Audit.stories.tsx} +4 -4
- package/src/stories/{Subsystem/ComponentDeclarationSymbols.stories.tsx → Components/ComponentDeclaration/Symbols.stories.tsx} +5 -5
- package/src/stories/{Subsystem → Components}/ConstructsCatalog.stories.tsx +1 -1
- package/src/stories/{Subsystem/Sidebar → Components}/GraphSidebar.stories.tsx +4 -4
- package/src/stories/{Subsystem/IssueIcons.stories.tsx → Components/IssueList.stories.tsx} +1 -1
- package/src/stories/{Subsystem/StoreValueTypeDeclaration.stories.tsx → Components/StoreValueType.stories.tsx} +1 -1
- package/src/subsystem/SubsystemComponentGraph.tsx +331 -25
- package/src/subsystem/SymbolFocusedView.tsx +80 -0
- package/src/subsystem/TrailsPanel.tsx +107 -4
- package/src/subsystem/graphChrome.tsx +22 -1
- package/src/subsystem/layoutDirection.test.ts +26 -0
- package/src/subsystem/model.test.ts +17 -0
- package/src/subsystem/model.ts +70 -10
- package/dist/stories/Subsystem/AggregateGraph/aggregateViewFixture.d.ts.map +0 -1
- package/dist/stories/Subsystem/AggregateGraph/aggregateViewFixture.js.map +0 -1
- package/dist/stories/Subsystem/ComponentGraph/fixtures.d.ts.map +0 -1
- package/dist/stories/Subsystem/ComponentGraph/fixtures.js.map +0 -1
- package/src/stories/Subsystem/EgoGraph/EgoGraph.stories.tsx +0 -351
- /package/dist/stories/{Subsystem/AggregateGraph → Canvases/Aggregate}/aggregateViewFixture.d.ts +0 -0
- /package/dist/stories/{Subsystem/AggregateGraph → Canvases/Aggregate}/aggregateViewFixture.js +0 -0
- /package/dist/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/fixtures.d.ts +0 -0
- /package/dist/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/fixtures.js +0 -0
- /package/src/graphify/__fixtures__/{ego-samples.json → symbol-focused-samples.json} +0 -0
- /package/src/stories/{Subsystem/AggregateGraph → Canvases/Aggregate}/aggregateViewFixture.ts +0 -0
- /package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/fixtures.ts +0 -0
|
@@ -5,7 +5,7 @@ import { C4NodeCard, NODE_W, NODE_H } from '../../../subsystem/C4NodeCard';
|
|
|
5
5
|
import type { C4Container, C4Component } from '../../../subsystem/c4';
|
|
6
6
|
|
|
7
7
|
const meta = {
|
|
8
|
-
title: '
|
|
8
|
+
title: 'Canvases/C4/C4CardGrow',
|
|
9
9
|
parameters: { layout: 'fullscreen' },
|
|
10
10
|
tags: ['autodocs'],
|
|
11
11
|
decorators: [
|
|
@@ -6,7 +6,7 @@ import { C4Graph } from '../../../subsystem/C4Graph';
|
|
|
6
6
|
import type { C4Edge, C4Model, C4Element, C4Component, C4Container } from '../../../subsystem/c4';
|
|
7
7
|
|
|
8
8
|
const meta = {
|
|
9
|
-
title: '
|
|
9
|
+
title: 'Canvases/C4/C4Component',
|
|
10
10
|
component: C4Graph,
|
|
11
11
|
parameters: { layout: 'fullscreen' },
|
|
12
12
|
tags: ['autodocs'],
|
|
@@ -6,7 +6,7 @@ import { C4Graph } from '../../../subsystem/C4Graph';
|
|
|
6
6
|
import type { C4Edge, C4Model, C4Element, C4Container } from '../../../subsystem/c4';
|
|
7
7
|
|
|
8
8
|
const meta = {
|
|
9
|
-
title: '
|
|
9
|
+
title: 'Canvases/C4/C4Container',
|
|
10
10
|
component: C4Graph,
|
|
11
11
|
parameters: { layout: 'fullscreen' },
|
|
12
12
|
tags: ['autodocs'],
|
|
@@ -31,7 +31,7 @@ import type { C4Element } from '../../../subsystem/c4';
|
|
|
31
31
|
// ---------------------------------------------------------------------------
|
|
32
32
|
|
|
33
33
|
const meta = {
|
|
34
|
-
title: '
|
|
34
|
+
title: 'Canvases/C4/C4NodeGallery',
|
|
35
35
|
parameters: { layout: 'fullscreen' },
|
|
36
36
|
tags: ['autodocs'],
|
|
37
37
|
decorators: [
|
|
@@ -6,7 +6,7 @@ import { C4Graph } from '../../../subsystem/C4Graph';
|
|
|
6
6
|
import type { C4Edge, C4Model, C4Element, C4Component, C4Container } from '../../../subsystem/c4';
|
|
7
7
|
|
|
8
8
|
const meta = {
|
|
9
|
-
title: '
|
|
9
|
+
title: 'Canvases/C4/C4Transition',
|
|
10
10
|
component: C4Graph,
|
|
11
11
|
parameters: { layout: 'fullscreen' },
|
|
12
12
|
tags: ['autodocs'],
|
package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/AnimatedProgression.stories.tsx
RENAMED
|
@@ -14,7 +14,7 @@ import type { SubsystemComponent, SubsystemTrail } from '../../../subsystem/mode
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
const meta = {
|
|
17
|
-
title: 'Subsystem/
|
|
17
|
+
title: 'Canvases/Subsystem/Animated progression',
|
|
18
18
|
component: SubsystemComponentGraph,
|
|
19
19
|
parameters: { layout: 'fullscreen' },
|
|
20
20
|
} satisfies Meta<typeof SubsystemComponentGraph>;
|
|
@@ -8,7 +8,7 @@ import type { GraphifyComponentDetail } from '../../../graphify';
|
|
|
8
8
|
import { investigateOnlyComponents, investigateOnlyTrails } from './fixtures';
|
|
9
9
|
|
|
10
10
|
const meta = {
|
|
11
|
-
title: 'Subsystem/
|
|
11
|
+
title: 'Canvases/Subsystem/Appearance',
|
|
12
12
|
component: SubsystemComponentGraph,
|
|
13
13
|
parameters: {
|
|
14
14
|
layout: 'fullscreen',
|
|
@@ -7,7 +7,7 @@ import type { SubsystemComponent, SubsystemComponentEdge } from '../../../subsys
|
|
|
7
7
|
import { components, graphSpecFromSteps } from './fixtures';
|
|
8
8
|
|
|
9
9
|
const meta = {
|
|
10
|
-
title: 'Subsystem/
|
|
10
|
+
title: 'Canvases/Subsystem/Basics',
|
|
11
11
|
component: SubsystemComponentGraph,
|
|
12
12
|
parameters: {
|
|
13
13
|
layout: 'fullscreen',
|
|
@@ -8,7 +8,7 @@ import type { GraphifyComponentDetail } from '../../../graphify';
|
|
|
8
8
|
import { components, graphSpecFromSteps, readerDetail, investigateOnlyComponents, investigateOnlyTrails } from './fixtures';
|
|
9
9
|
|
|
10
10
|
const meta = {
|
|
11
|
-
title: 'Subsystem/
|
|
11
|
+
title: 'Canvases/Subsystem/Captures',
|
|
12
12
|
component: SubsystemComponentGraph,
|
|
13
13
|
parameters: {
|
|
14
14
|
layout: 'fullscreen',
|
|
@@ -9,7 +9,7 @@ import type { SubsystemOpenFileOptions } from '../../../subsystem/sourceSpan';
|
|
|
9
9
|
import type { GraphifyComponentDetail } from '../../../graphify';
|
|
10
10
|
|
|
11
11
|
const meta = {
|
|
12
|
-
title: 'Subsystem/
|
|
12
|
+
title: 'Canvases/Subsystem/Constructs',
|
|
13
13
|
component: SubsystemComponentGraph,
|
|
14
14
|
parameters: {
|
|
15
15
|
layout: 'fullscreen',
|
package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/CustomEntities.stories.tsx
RENAMED
|
@@ -155,7 +155,7 @@ const entityGraph = graphSpecFromSteps([
|
|
|
155
155
|
]);
|
|
156
156
|
|
|
157
157
|
const meta = {
|
|
158
|
-
title: 'Subsystem/
|
|
158
|
+
title: 'Canvases/Subsystem/CustomEntities',
|
|
159
159
|
component: SubsystemComponentGraph,
|
|
160
160
|
parameters: { layout: 'fullscreen' },
|
|
161
161
|
tags: ['autodocs'],
|
|
@@ -17,7 +17,7 @@ import { trailFromSteps } from './fixtures';
|
|
|
17
17
|
* as siblings — proposed = not built yet, deprecated = built once, removed since.
|
|
18
18
|
*/
|
|
19
19
|
const meta = {
|
|
20
|
-
title: 'Subsystem/
|
|
20
|
+
title: 'Canvases/Subsystem/Deprecated',
|
|
21
21
|
parameters: { layout: 'fullscreen' },
|
|
22
22
|
tags: ['autodocs'],
|
|
23
23
|
decorators: [
|
|
@@ -12,7 +12,7 @@ import resolveSource from '../../../graphify/resolve.ts?raw';
|
|
|
12
12
|
import { readerDetail } from './fixtures';
|
|
13
13
|
|
|
14
14
|
const meta = {
|
|
15
|
-
title: 'Subsystem/
|
|
15
|
+
title: 'Canvases/Subsystem/DetailPanel',
|
|
16
16
|
component: SubsystemComponentGraph,
|
|
17
17
|
parameters: {
|
|
18
18
|
layout: 'fullscreen',
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { components, graphSpecFromSteps } from './fixtures';
|
|
11
11
|
|
|
12
12
|
const meta = {
|
|
13
|
-
title: 'Subsystem/
|
|
13
|
+
title: 'Canvases/Subsystem/Diagnostics',
|
|
14
14
|
component: SubsystemComponentGraph,
|
|
15
15
|
parameters: {
|
|
16
16
|
layout: 'fullscreen',
|
|
@@ -7,7 +7,7 @@ import type { SubsystemEdgeView, SubsystemGraphifyRelation } from '../../../subs
|
|
|
7
7
|
import { components, trailFromSteps } from './fixtures';
|
|
8
8
|
|
|
9
9
|
const meta = {
|
|
10
|
-
title: 'Subsystem/
|
|
10
|
+
title: 'Canvases/Subsystem/EdgeViews',
|
|
11
11
|
component: SubsystemComponentGraph,
|
|
12
12
|
parameters: {
|
|
13
13
|
layout: 'fullscreen',
|
package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/FrameworkStereotype.stories.tsx
RENAMED
|
@@ -6,7 +6,7 @@ import type { SubsystemComponent } from '../../../subsystem/model';
|
|
|
6
6
|
import { trailFromSteps } from './fixtures';
|
|
7
7
|
|
|
8
8
|
const meta = {
|
|
9
|
-
title: 'Subsystem/
|
|
9
|
+
title: 'Canvases/Subsystem/FrameworkStereotype',
|
|
10
10
|
component: SubsystemComponentGraph,
|
|
11
11
|
parameters: { layout: 'fullscreen' },
|
|
12
12
|
tags: ['autodocs'],
|
|
@@ -6,7 +6,7 @@ import { SubsystemComponentGraph } from '../../../subsystem/SubsystemComponentGr
|
|
|
6
6
|
import { components, graphSpecFromSteps } from './fixtures';
|
|
7
7
|
|
|
8
8
|
const meta = {
|
|
9
|
-
title: 'Subsystem/
|
|
9
|
+
title: 'Canvases/Subsystem/GraphTitle',
|
|
10
10
|
component: SubsystemComponentGraph,
|
|
11
11
|
parameters: {
|
|
12
12
|
layout: 'fullscreen',
|
|
@@ -10,7 +10,7 @@ import type { C4Container } from '../../../subsystem/c4';
|
|
|
10
10
|
import { components, graphSpecFromSteps } from './fixtures';
|
|
11
11
|
|
|
12
12
|
const meta = {
|
|
13
|
-
title: 'Subsystem/
|
|
13
|
+
title: 'Canvases/Subsystem/Issues',
|
|
14
14
|
component: SubsystemComponentGraph,
|
|
15
15
|
parameters: {
|
|
16
16
|
layout: 'fullscreen',
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout direction — the canvas toggle flips the layered layout between
|
|
3
|
+
* left-to-right and top-to-bottom.
|
|
4
|
+
*
|
|
5
|
+
* The flip is sequenced: edges fade out, ELK re-lays out while the nodes slide
|
|
6
|
+
* to their new slots, then the edges fade back in. Old routes never cut across
|
|
7
|
+
* the new layout mid-flight. The camera refits when the new layout lands
|
|
8
|
+
* (`refocusOnLayoutFlip`, on by default) — a vertical graph grows
|
|
9
|
+
* downward and would otherwise leave most of itself off-screen.
|
|
10
|
+
*/
|
|
11
|
+
import React, { useState } from 'react';
|
|
12
|
+
import '@xyflow/react/dist/style.css';
|
|
13
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
14
|
+
import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
|
|
15
|
+
import { SubsystemComponentGraph } from '../../../subsystem/SubsystemComponentGraph';
|
|
16
|
+
import type { SubsystemLayoutDirection } from '../../../subsystem/model';
|
|
17
|
+
import { components, graphSpecFromSteps } from './fixtures';
|
|
18
|
+
|
|
19
|
+
const meta = {
|
|
20
|
+
title: 'Canvases/Subsystem/LayoutDirection',
|
|
21
|
+
component: SubsystemComponentGraph,
|
|
22
|
+
parameters: { layout: 'fullscreen' },
|
|
23
|
+
tags: ['autodocs'],
|
|
24
|
+
decorators: [
|
|
25
|
+
(Story) => (
|
|
26
|
+
<ThemeProvider theme={defaultEditorTheme}>
|
|
27
|
+
<Story />
|
|
28
|
+
</ThemeProvider>
|
|
29
|
+
),
|
|
30
|
+
],
|
|
31
|
+
} satisfies Meta<typeof SubsystemComponentGraph>;
|
|
32
|
+
|
|
33
|
+
export default meta;
|
|
34
|
+
type Story = StoryObj<typeof meta>;
|
|
35
|
+
|
|
36
|
+
// A graph with enough layers to make the axis obvious: two producers fan into
|
|
37
|
+
// a service, which writes to a store and produces an event.
|
|
38
|
+
const layoutComponents = components([
|
|
39
|
+
['api', 'ApiHandler', 'function', 'src/api/handler.ts', 'pkg:github/principal-ai/agent-monitoring', 'HTTP entry point', 'handleRequest'],
|
|
40
|
+
['cli', 'CliHandler', 'function', 'src/cli/handler.ts', 'pkg:github/principal-ai/agent-monitoring', 'command entry point', 'handleCommand'],
|
|
41
|
+
['svc', 'SessionService', 'class', 'src/session/SessionService.ts', 'pkg:github/principal-ai/agent-monitoring', 'owns session persistence', 'SessionService'],
|
|
42
|
+
['store', 'SessionStore', 'class', 'src/session/SessionStore.ts', 'pkg:github/principal-ai/agent-monitoring', 'retained session state', 'SessionStore'],
|
|
43
|
+
['event', 'SessionEvent', 'interface', 'src/types/SessionEvent.ts', 'pkg:github/principal-ai/agent-monitoring', 'output event shape', 'SessionEvent'],
|
|
44
|
+
]);
|
|
45
|
+
|
|
46
|
+
const layoutSpec = graphSpecFromSteps([
|
|
47
|
+
['api', 'svc', 'calls', 'src/api/handler.ts', 42],
|
|
48
|
+
['cli', 'svc', 'calls', 'src/cli/handler.ts', 18],
|
|
49
|
+
['svc', 'store', 'writes', 'src/session/SessionService.ts', 88],
|
|
50
|
+
['svc', 'event', 'produces', 'src/session/SessionService.ts', 95],
|
|
51
|
+
]);
|
|
52
|
+
|
|
53
|
+
function DirectionDemo({ initial }: { initial: SubsystemLayoutDirection }) {
|
|
54
|
+
return (
|
|
55
|
+
<div style={{ width: '100%', height: '100vh', display: 'flex', flexDirection: 'column' }}>
|
|
56
|
+
<SubsystemComponentGraph
|
|
57
|
+
components={layoutComponents}
|
|
58
|
+
trails={layoutSpec.trails}
|
|
59
|
+
defaultLayoutDirection={initial}
|
|
60
|
+
showEdgeLabels
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Left-to-right (the default). Click the corner toggle to watch the flip. */
|
|
67
|
+
export const Horizontal: Story = {
|
|
68
|
+
render: () => <DirectionDemo initial="horizontal" />,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** Seeded top-to-bottom. The toggle restores the remembered choice per `persistKey`. */
|
|
72
|
+
export const Vertical: Story = {
|
|
73
|
+
render: () => <DirectionDemo initial="vertical" />,
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Host-controlled: the graph renders no built-in toggle; the host owns the
|
|
78
|
+
* value and echoes it back through `onLayoutDirectionChange`.
|
|
79
|
+
*/
|
|
80
|
+
function ControlledDemo() {
|
|
81
|
+
const [direction, setDirection] = useState<SubsystemLayoutDirection>('horizontal');
|
|
82
|
+
return (
|
|
83
|
+
<div style={{ width: '100%', height: '100vh', display: 'flex', flexDirection: 'column' }}>
|
|
84
|
+
<div style={{ display: 'flex', gap: 8, padding: 8, background: defaultEditorTheme.colors.background }}>
|
|
85
|
+
{(['horizontal', 'vertical'] as const).map((d) => (
|
|
86
|
+
<button
|
|
87
|
+
key={d}
|
|
88
|
+
type="button"
|
|
89
|
+
onClick={() => setDirection(d)}
|
|
90
|
+
aria-pressed={direction === d}
|
|
91
|
+
style={{
|
|
92
|
+
padding: '4px 10px',
|
|
93
|
+
borderRadius: 6,
|
|
94
|
+
border: `1px solid ${defaultEditorTheme.colors.border}`,
|
|
95
|
+
background: direction === d ? defaultEditorTheme.colors.border : 'transparent',
|
|
96
|
+
color: defaultEditorTheme.colors.text,
|
|
97
|
+
fontFamily: defaultEditorTheme.fonts.monospace,
|
|
98
|
+
fontSize: 12,
|
|
99
|
+
cursor: 'pointer',
|
|
100
|
+
}}
|
|
101
|
+
>
|
|
102
|
+
{d}
|
|
103
|
+
</button>
|
|
104
|
+
))}
|
|
105
|
+
</div>
|
|
106
|
+
<div style={{ flex: 1, minHeight: 0 }}>
|
|
107
|
+
<SubsystemComponentGraph
|
|
108
|
+
components={layoutComponents}
|
|
109
|
+
trails={layoutSpec.trails}
|
|
110
|
+
layoutDirection={direction}
|
|
111
|
+
onLayoutDirectionChange={setDirection}
|
|
112
|
+
hideLayoutToggle
|
|
113
|
+
showEdgeLabels
|
|
114
|
+
/>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const ControlledByHost: Story = {
|
|
121
|
+
render: () => <ControlledDemo />,
|
|
122
|
+
};
|
package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/ModuleBadges.stories.tsx
RENAMED
|
@@ -12,7 +12,7 @@ import type {
|
|
|
12
12
|
import { graphSpecFromSteps } from './fixtures';
|
|
13
13
|
|
|
14
14
|
const meta = {
|
|
15
|
-
title: 'Subsystem/
|
|
15
|
+
title: 'Canvases/Subsystem/ModuleBadges',
|
|
16
16
|
parameters: { layout: 'fullscreen' },
|
|
17
17
|
tags: ['autodocs'],
|
|
18
18
|
decorators: [
|
package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/ModulePathNesting.stories.tsx
RENAMED
|
@@ -15,7 +15,7 @@ import type { SubsystemComponent } from '../../../subsystem/model';
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
const meta = {
|
|
18
|
-
title: 'Subsystem/
|
|
18
|
+
title: 'Canvases/Subsystem/Module path nesting',
|
|
19
19
|
component: SubsystemComponentGraph,
|
|
20
20
|
parameters: { layout: 'fullscreen' },
|
|
21
21
|
tags: ['autodocs'],
|
|
@@ -6,7 +6,7 @@ import type { SubsystemComponent } from '../../../subsystem/model';
|
|
|
6
6
|
import { graphSpecFromSteps } from './fixtures';
|
|
7
7
|
|
|
8
8
|
const meta = {
|
|
9
|
-
title: 'Subsystem/
|
|
9
|
+
title: 'Canvases/Subsystem/Modules',
|
|
10
10
|
component: SubsystemComponentGraph,
|
|
11
11
|
parameters: { layout: 'fullscreen' },
|
|
12
12
|
tags: ['autodocs'],
|
|
@@ -6,7 +6,7 @@ import type { SubsystemComponent } from '../../../subsystem/model';
|
|
|
6
6
|
import { graphSpecFromSteps } from './fixtures';
|
|
7
7
|
|
|
8
8
|
const meta = {
|
|
9
|
-
title: 'Subsystem/
|
|
9
|
+
title: 'Canvases/Subsystem/Packages',
|
|
10
10
|
component: SubsystemComponentGraph,
|
|
11
11
|
parameters: { layout: 'fullscreen' },
|
|
12
12
|
tags: ['autodocs'],
|
|
@@ -5,7 +5,7 @@ import { SubsystemComponentGraph } from '../../../subsystem/SubsystemComponentGr
|
|
|
5
5
|
import { components, graphSpecFromSteps } from './fixtures';
|
|
6
6
|
|
|
7
7
|
const meta = {
|
|
8
|
-
title: 'Subsystem/
|
|
8
|
+
title: 'Canvases/Subsystem/Processes',
|
|
9
9
|
component: SubsystemComponentGraph,
|
|
10
10
|
parameters: { layout: 'fullscreen' },
|
|
11
11
|
tags: ['autodocs'],
|
package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/ProposedTrails.stories.tsx
RENAMED
|
@@ -6,7 +6,7 @@ import { SubsystemComponentGraph } from '../../../subsystem/SubsystemComponentGr
|
|
|
6
6
|
import type { SubsystemComponent, SubsystemTrail } from '../../../subsystem/model';
|
|
7
7
|
|
|
8
8
|
const meta = {
|
|
9
|
-
title: 'Subsystem/
|
|
9
|
+
title: 'Canvases/Subsystem/ProposedTrails',
|
|
10
10
|
component: SubsystemComponentGraph,
|
|
11
11
|
parameters: {
|
|
12
12
|
layout: 'fullscreen',
|
|
@@ -7,7 +7,7 @@ import { TrailsPanel } from '../../../subsystem/TrailsPanel';
|
|
|
7
7
|
import type { SubsystemComponent, SubsystemTrail } from '../../../subsystem/model';
|
|
8
8
|
|
|
9
9
|
const meta = {
|
|
10
|
-
title: 'Subsystem/
|
|
10
|
+
title: 'Canvases/Subsystem/Reorder',
|
|
11
11
|
component: SubsystemComponentGraph,
|
|
12
12
|
parameters: {
|
|
13
13
|
layout: 'fullscreen',
|
|
@@ -12,7 +12,7 @@ import type { GraphifyComponentDetail } from '../../../graphify';
|
|
|
12
12
|
import { components, graphSpecFromSteps } from './fixtures';
|
|
13
13
|
|
|
14
14
|
const meta = {
|
|
15
|
-
title: 'Subsystem/
|
|
15
|
+
title: 'Canvases/Subsystem/Scenarios',
|
|
16
16
|
component: SubsystemComponentGraph,
|
|
17
17
|
parameters: {
|
|
18
18
|
layout: 'fullscreen',
|
|
@@ -17,7 +17,7 @@ import { resolvePierreSyntaxThemeName } from '../../../pierre/pierreSyntaxTheme'
|
|
|
17
17
|
import { useTheme } from '@principal-ade/industry-theme';
|
|
18
18
|
|
|
19
19
|
const meta = {
|
|
20
|
-
title: 'Subsystem/
|
|
20
|
+
title: 'Canvases/Subsystem/Spotlights',
|
|
21
21
|
parameters: { layout: 'fullscreen' },
|
|
22
22
|
tags: ['autodocs'],
|
|
23
23
|
decorators: [
|
package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/StoreValueType.stories.tsx
RENAMED
|
@@ -23,7 +23,7 @@ import type { SubsystemComponent, SubsystemGraphNode } from '../../../subsystem/
|
|
|
23
23
|
* accessor shows the accessor's name instead of the state's.
|
|
24
24
|
*/
|
|
25
25
|
const meta = {
|
|
26
|
-
title: 'Subsystem/
|
|
26
|
+
title: 'Canvases/Subsystem/StoreValueType',
|
|
27
27
|
parameters: { layout: 'fullscreen' },
|
|
28
28
|
tags: ['autodocs'],
|
|
29
29
|
decorators: [
|
package/src/stories/{Subsystem/ComponentGraph → Canvases/Subsystem}/TrailAutoplay.stories.tsx
RENAMED
|
@@ -16,7 +16,7 @@ import type { SubsystemComponent, SubsystemTrail } from '../../../subsystem/mode
|
|
|
16
16
|
* camera today. This story exists to expose that gap and iterate on it.
|
|
17
17
|
*/
|
|
18
18
|
const meta = {
|
|
19
|
-
title: 'Subsystem/
|
|
19
|
+
title: 'Canvases/Subsystem/TrailAutoplay',
|
|
20
20
|
component: SubsystemComponentGraph,
|
|
21
21
|
parameters: { layout: 'fullscreen' },
|
|
22
22
|
tags: ['autodocs'],
|
|
@@ -8,7 +8,7 @@ import { PierreTrailCodeView } from '../../../pierre';
|
|
|
8
8
|
import type { TrailViewerContext } from '../../../subsystem/SubsystemComponentGraph';
|
|
9
9
|
|
|
10
10
|
const meta = {
|
|
11
|
-
title: 'Subsystem/
|
|
11
|
+
title: 'Canvases/Subsystem/Trails',
|
|
12
12
|
component: SubsystemComponentGraph,
|
|
13
13
|
parameters: {
|
|
14
14
|
layout: 'fullscreen',
|
|
@@ -6,7 +6,7 @@ import type { SubsystemComponent } from '../../../subsystem/model';
|
|
|
6
6
|
import { graphSpecFromSteps } from './fixtures';
|
|
7
7
|
|
|
8
8
|
const meta = {
|
|
9
|
-
title: 'Subsystem/
|
|
9
|
+
title: 'Canvases/Subsystem/WorkspacePackages',
|
|
10
10
|
component: SubsystemComponentGraph,
|
|
11
11
|
parameters: { layout: 'fullscreen' },
|
|
12
12
|
tags: ['autodocs'],
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Symbol-focused view — one graphify symbol at the center plus its real
|
|
3
|
+
* connections, drawn on the shared subsystem canvas.
|
|
4
|
+
*
|
|
5
|
+
* The center + neighbors come from
|
|
6
|
+
* `graphify/__fixtures__/symbol-focused-samples.json` (extracted from this
|
|
7
|
+
* repo's cached graph). The stories only supply the focal node and its
|
|
8
|
+
* neighborhood; `SymbolFocusedView` projects them onto component-graph inputs
|
|
9
|
+
* and keeps the raw graphify verbs, so relations draw from the separate
|
|
10
|
+
* `GRAPHIFY_RELATION_COLOR` palette — visually distinct from authored
|
|
11
|
+
* subsystem mechanisms.
|
|
12
|
+
*/
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import '@xyflow/react/dist/style.css';
|
|
15
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
16
|
+
import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
|
|
17
|
+
import { SymbolFocusedView } from '../../../subsystem/SymbolFocusedView';
|
|
18
|
+
import { SubsystemComponentGraph } from '../../../subsystem/SubsystemComponentGraph';
|
|
19
|
+
import type { GraphifyEdge, GraphifyNode } from '../../../graphify';
|
|
20
|
+
import type {
|
|
21
|
+
SubsystemComponent,
|
|
22
|
+
SubsystemComponentConstruct,
|
|
23
|
+
} from '../../../subsystem/model';
|
|
24
|
+
import symbolSamples from '../../../graphify/__fixtures__/symbol-focused-samples.json';
|
|
25
|
+
|
|
26
|
+
const meta = {
|
|
27
|
+
title: 'Canvases/SymbolFocusedView',
|
|
28
|
+
component: SymbolFocusedView,
|
|
29
|
+
parameters: { layout: 'fullscreen' },
|
|
30
|
+
tags: ['autodocs'],
|
|
31
|
+
decorators: [
|
|
32
|
+
(Story) => (
|
|
33
|
+
<ThemeProvider theme={defaultEditorTheme}>
|
|
34
|
+
<Story />
|
|
35
|
+
</ThemeProvider>
|
|
36
|
+
),
|
|
37
|
+
],
|
|
38
|
+
} satisfies Meta<typeof SymbolFocusedView>;
|
|
39
|
+
|
|
40
|
+
export default meta;
|
|
41
|
+
type Story = StoryObj<typeof meta>;
|
|
42
|
+
|
|
43
|
+
// ---------------------------------------------------------------------------
|
|
44
|
+
// Fixture shape
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
|
|
47
|
+
type FixtureCategory = {
|
|
48
|
+
center?: GraphifyNode;
|
|
49
|
+
degree?: number;
|
|
50
|
+
neighborCount?: number;
|
|
51
|
+
neighbors?: GraphifyNode[];
|
|
52
|
+
edges?: GraphifyEdge[];
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
type Category = 'class' | 'function' | 'method' | 'type' | 'module';
|
|
56
|
+
|
|
57
|
+
const categories = symbolSamples.categories as unknown as Record<Category, FixtureCategory>;
|
|
58
|
+
const authoredCategories = symbolSamples.authoredCategories as unknown as Record<
|
|
59
|
+
string,
|
|
60
|
+
{ component: SubsystemComponent }
|
|
61
|
+
>;
|
|
62
|
+
|
|
63
|
+
const REPO_PURL = 'pkg:github/principal-ai/subsystem-modeling';
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Constructs graphify's structural inference cannot resolve. Inference reads
|
|
67
|
+
* labels and incident edges only, so a bare type node with no `implements`
|
|
68
|
+
* edge comes back `unknown`; the fixture knows better.
|
|
69
|
+
*/
|
|
70
|
+
const CENTER_CONSTRUCT_OVERRIDE: Partial<Record<Category, SubsystemComponentConstruct>> = {
|
|
71
|
+
type: 'interface',
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
function SymbolFocusDemo({
|
|
75
|
+
category,
|
|
76
|
+
orderByLine,
|
|
77
|
+
}: {
|
|
78
|
+
category: Category;
|
|
79
|
+
orderByLine: boolean;
|
|
80
|
+
}) {
|
|
81
|
+
const cat = categories[category];
|
|
82
|
+
if (!cat.center) return null;
|
|
83
|
+
return (
|
|
84
|
+
<div style={{ width: '100%', height: '100vh', display: 'flex', flexDirection: 'column' }}>
|
|
85
|
+
<SymbolFocusedView
|
|
86
|
+
center={cat.center}
|
|
87
|
+
neighbors={cat.neighbors ?? []}
|
|
88
|
+
edges={cat.edges ?? []}
|
|
89
|
+
repoPurl={REPO_PURL}
|
|
90
|
+
centerConstruct={CENTER_CONSTRUCT_OVERRIDE[category]}
|
|
91
|
+
orderByLine={orderByLine}
|
|
92
|
+
showSingletonFrames
|
|
93
|
+
showEdgeLabels
|
|
94
|
+
title={`Symbol focused view — ${category}`}
|
|
95
|
+
description={`graphify center ${cat.center.label} · ${cat.degree ?? 0} edges · ${cat.neighborCount ?? 0} neighbors${orderByLine ? ' · ordered by call-site line' : ''}`}
|
|
96
|
+
/>
|
|
97
|
+
</div>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** Everything on disk for the center: node + neighbor nodes + raw edges. */
|
|
102
|
+
function RawDump({ category }: { category: Category }) {
|
|
103
|
+
const cat = categories[category];
|
|
104
|
+
return (
|
|
105
|
+
<pre
|
|
106
|
+
style={{
|
|
107
|
+
margin: 0,
|
|
108
|
+
padding: 12,
|
|
109
|
+
fontSize: 12,
|
|
110
|
+
lineHeight: 1.5,
|
|
111
|
+
fontFamily: 'monospace',
|
|
112
|
+
color: '#ddd',
|
|
113
|
+
background: '#111',
|
|
114
|
+
height: '100vh',
|
|
115
|
+
overflow: 'auto',
|
|
116
|
+
boxSizing: 'border-box',
|
|
117
|
+
}}
|
|
118
|
+
>
|
|
119
|
+
{JSON.stringify({ category, ...cat }, null, 2)}
|
|
120
|
+
</pre>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// ---------------------------------------------------------------------------
|
|
125
|
+
// Stories — one per graphify node category
|
|
126
|
+
// ---------------------------------------------------------------------------
|
|
127
|
+
|
|
128
|
+
export const Class: Story = { render: () => <SymbolFocusDemo category="class" orderByLine /> };
|
|
129
|
+
export const Function: Story = { render: () => <SymbolFocusDemo category="function" orderByLine /> };
|
|
130
|
+
export const Method: Story = { render: () => <SymbolFocusDemo category="method" orderByLine /> };
|
|
131
|
+
export const Type: Story = { render: () => <SymbolFocusDemo category="type" orderByLine /> };
|
|
132
|
+
export const Module: Story = { render: () => <SymbolFocusDemo category="module" orderByLine /> };
|
|
133
|
+
|
|
134
|
+
/** Same centers, ELK's default ordering — compare against the line-ordered set. */
|
|
135
|
+
export const MethodReorderOff: Story = {
|
|
136
|
+
render: () => <SymbolFocusDemo category="method" orderByLine={false} />,
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/** The raw extracted data behind each center — no rendering involved. */
|
|
140
|
+
export const Raw: Story = { render: () => <RawDump category="class" /> };
|
|
141
|
+
|
|
142
|
+
// ---------------------------------------------------------------------------
|
|
143
|
+
// Authored-only constructs (no graphify node) pulled from the model store
|
|
144
|
+
// ---------------------------------------------------------------------------
|
|
145
|
+
|
|
146
|
+
const authoredComponents: SubsystemComponent[] = [
|
|
147
|
+
authoredCategories.store?.component,
|
|
148
|
+
authoredCategories.external?.component,
|
|
149
|
+
authoredCategories.custom_entity?.component,
|
|
150
|
+
].filter(Boolean) as SubsystemComponent[];
|
|
151
|
+
|
|
152
|
+
/** store / external / custom_entity — authored nodes, no graphify anchor. */
|
|
153
|
+
export const AuthoredConstructs: Story = {
|
|
154
|
+
render: () => (
|
|
155
|
+
<div style={{ width: '100%', height: '100vh' }}>
|
|
156
|
+
<SubsystemComponentGraph
|
|
157
|
+
components={authoredComponents}
|
|
158
|
+
title="Authored-only constructs"
|
|
159
|
+
description="store / external / custom_entity — reused cast from stored subsystem models (no graphify node, no edges)."
|
|
160
|
+
/>
|
|
161
|
+
</div>
|
|
162
|
+
),
|
|
163
|
+
};
|