@principal-ai/file-city-react 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder/cityDataUtils.d.ts +15 -0
- package/dist/builder/cityDataUtils.d.ts.map +1 -0
- package/dist/builder/cityDataUtils.js +348 -0
- package/dist/components/ArchitectureMapHighlightLayers.d.ts +63 -0
- package/dist/components/ArchitectureMapHighlightLayers.d.ts.map +1 -0
- package/dist/components/ArchitectureMapHighlightLayers.js +1040 -0
- package/dist/components/CityViewWithReactFlow.d.ts +14 -0
- package/dist/components/CityViewWithReactFlow.d.ts.map +1 -0
- package/dist/components/CityViewWithReactFlow.js +266 -0
- package/dist/config/files.json +996 -0
- package/dist/hooks/useCodeCityData.d.ts +21 -0
- package/dist/hooks/useCodeCityData.d.ts.map +1 -0
- package/dist/hooks/useCodeCityData.js +57 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/render/client/drawLayeredBuildings.d.ts +51 -0
- package/dist/render/client/drawLayeredBuildings.d.ts.map +1 -0
- package/dist/render/client/drawLayeredBuildings.js +650 -0
- package/dist/stories/ArchitectureMapGridLayout.stories.d.ts +73 -0
- package/dist/stories/ArchitectureMapGridLayout.stories.d.ts.map +1 -0
- package/dist/stories/ArchitectureMapGridLayout.stories.js +345 -0
- package/dist/stories/ArchitectureMapHighlightLayers.stories.d.ts +78 -0
- package/dist/stories/ArchitectureMapHighlightLayers.stories.d.ts.map +1 -0
- package/dist/stories/ArchitectureMapHighlightLayers.stories.js +270 -0
- package/dist/stories/CityViewWithReactFlow.stories.d.ts +24 -0
- package/dist/stories/CityViewWithReactFlow.stories.d.ts.map +1 -0
- package/dist/stories/CityViewWithReactFlow.stories.js +778 -0
- package/dist/stories/sample-data.d.ts +4 -0
- package/dist/stories/sample-data.d.ts.map +1 -0
- package/dist/stories/sample-data.js +268 -0
- package/dist/types/react-types.d.ts +17 -0
- package/dist/types/react-types.d.ts.map +1 -0
- package/dist/types/react-types.js +4 -0
- package/dist/utils/fileColorHighlightLayers.d.ts +86 -0
- package/dist/utils/fileColorHighlightLayers.d.ts.map +1 -0
- package/dist/utils/fileColorHighlightLayers.js +283 -0
- package/package.json +49 -0
- package/src/builder/cityDataUtils.ts +430 -0
- package/src/components/ArchitectureMapHighlightLayers.tsx +1518 -0
- package/src/components/CityViewWithReactFlow.tsx +365 -0
- package/src/config/files.json +996 -0
- package/src/hooks/useCodeCityData.ts +82 -0
- package/src/index.ts +64 -0
- package/src/render/client/drawLayeredBuildings.ts +946 -0
- package/src/stories/ArchitectureMapGridLayout.stories.tsx +410 -0
- package/src/stories/ArchitectureMapHighlightLayers.stories.tsx +312 -0
- package/src/stories/CityViewWithReactFlow.stories.tsx +787 -0
- package/src/stories/sample-data.ts +301 -0
- package/src/types/react-types.ts +18 -0
- package/src/utils/fileColorHighlightLayers.ts +378 -0
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WithBorderRadius = exports.WithTransformations = exports.WithGrid = exports.CustomRenderStrategies = exports.WithAbstractionLayer = exports.Interactive = exports.SubdirectoryMode = exports.SelectiveRendering = exports.DirectoryHighlighting = exports.WithHighlightLayers = exports.Default = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const ArchitectureMapHighlightLayers_1 = require("../components/ArchitectureMapHighlightLayers");
|
|
6
|
+
const sample_data_1 = require("./sample-data");
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Components/ArchitectureMapHighlightLayers',
|
|
9
|
+
component: ArchitectureMapHighlightLayers_1.ArchitectureMapHighlightLayers,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'fullscreen',
|
|
12
|
+
},
|
|
13
|
+
decorators: [
|
|
14
|
+
Story => (React.createElement("div", { style: { width: '100vw', height: '100vh', backgroundColor: '#1a1a1a' } },
|
|
15
|
+
React.createElement(Story, null))),
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
exports.default = meta;
|
|
19
|
+
// Basic story with sample city data
|
|
20
|
+
exports.Default = {
|
|
21
|
+
args: {
|
|
22
|
+
cityData: (0, sample_data_1.createSampleCityData)(),
|
|
23
|
+
showGrid: false,
|
|
24
|
+
fullSize: true,
|
|
25
|
+
canvasBackgroundColor: '#0f1419',
|
|
26
|
+
defaultBuildingColor: '#36454F',
|
|
27
|
+
defaultDirectoryColor: '#111827',
|
|
28
|
+
enableZoom: true,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
// Story with highlight layers
|
|
32
|
+
exports.WithHighlightLayers = {
|
|
33
|
+
render: function RenderWithHighlightLayers() {
|
|
34
|
+
const [layers, setLayers] = (0, react_1.useState)([
|
|
35
|
+
{
|
|
36
|
+
id: 'modified-files',
|
|
37
|
+
name: 'Modified Files',
|
|
38
|
+
enabled: true,
|
|
39
|
+
color: '#3b82f6',
|
|
40
|
+
priority: 1,
|
|
41
|
+
items: [
|
|
42
|
+
{ path: 'src/components/App.tsx', type: 'file' },
|
|
43
|
+
{ path: 'src/components/Header.tsx', type: 'file' },
|
|
44
|
+
{ path: 'src/utils/helpers.ts', type: 'file' },
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: 'new-files',
|
|
49
|
+
name: 'New Files',
|
|
50
|
+
enabled: true,
|
|
51
|
+
color: '#10b981',
|
|
52
|
+
priority: 2,
|
|
53
|
+
items: [
|
|
54
|
+
{ path: 'src/components/Footer.tsx', type: 'file' },
|
|
55
|
+
{ path: 'tests/unit/footer.test.tsx', type: 'file' },
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: 'deleted-files',
|
|
60
|
+
name: 'Deleted Files',
|
|
61
|
+
enabled: false,
|
|
62
|
+
color: '#ef4444',
|
|
63
|
+
priority: 3,
|
|
64
|
+
items: [{ path: 'src/deprecated/OldComponent.tsx', type: 'file' }],
|
|
65
|
+
},
|
|
66
|
+
]);
|
|
67
|
+
const handleLayerToggle = (layerId, enabled) => {
|
|
68
|
+
setLayers(prev => prev.map(layer => (layer.id === layerId ? { ...layer, enabled } : layer)));
|
|
69
|
+
};
|
|
70
|
+
return (React.createElement(ArchitectureMapHighlightLayers_1.ArchitectureMapHighlightLayers, { cityData: (0, sample_data_1.createSampleCityData)(), highlightLayers: layers, onLayerToggle: handleLayerToggle, showLayerControls: true, fullSize: true, canvasBackgroundColor: "#0f1419", defaultBuildingColor: "#36454F", defaultDirectoryColor: "#111827", enableZoom: true }));
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
// Story with directory highlighting
|
|
74
|
+
exports.DirectoryHighlighting = {
|
|
75
|
+
args: {
|
|
76
|
+
cityData: (0, sample_data_1.createSampleCityData)(),
|
|
77
|
+
highlightLayers: [
|
|
78
|
+
{
|
|
79
|
+
id: 'test-directory',
|
|
80
|
+
name: 'Test Files',
|
|
81
|
+
enabled: true,
|
|
82
|
+
color: '#f59e0b',
|
|
83
|
+
priority: 1,
|
|
84
|
+
items: [
|
|
85
|
+
{ path: 'tests', type: 'directory' },
|
|
86
|
+
{ path: '__tests__', type: 'directory' },
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
showLayerControls: true,
|
|
91
|
+
fullSize: true,
|
|
92
|
+
enableZoom: true,
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
// Story with selective rendering
|
|
96
|
+
exports.SelectiveRendering = {
|
|
97
|
+
args: {
|
|
98
|
+
cityData: (0, sample_data_1.createSampleCityData)(),
|
|
99
|
+
selectiveRender: {
|
|
100
|
+
mode: 'filter',
|
|
101
|
+
directories: new Set(['src', 'tests']),
|
|
102
|
+
},
|
|
103
|
+
fullSize: true,
|
|
104
|
+
enableZoom: true,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
// Story with subdirectory mode
|
|
108
|
+
exports.SubdirectoryMode = {
|
|
109
|
+
args: {
|
|
110
|
+
cityData: (0, sample_data_1.createSampleCityData)(),
|
|
111
|
+
subdirectoryMode: {
|
|
112
|
+
enabled: true,
|
|
113
|
+
rootPath: 'src',
|
|
114
|
+
autoCenter: true,
|
|
115
|
+
},
|
|
116
|
+
fullSize: true,
|
|
117
|
+
enableZoom: true,
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
// Interactive story with hover and click callbacks
|
|
121
|
+
exports.Interactive = {
|
|
122
|
+
render: function RenderInteractive() {
|
|
123
|
+
const [hoveredInfo, setHoveredInfo] = (0, react_1.useState)('');
|
|
124
|
+
const [clickedPath, setClickedPath] = (0, react_1.useState)('');
|
|
125
|
+
return (React.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' } },
|
|
126
|
+
React.createElement(ArchitectureMapHighlightLayers_1.ArchitectureMapHighlightLayers, { cityData: (0, sample_data_1.createSampleCityData)(), fullSize: true, enableZoom: true, onHover: info => {
|
|
127
|
+
if (info.hoveredBuilding) {
|
|
128
|
+
setHoveredInfo(`File: ${info.hoveredBuilding.path}`);
|
|
129
|
+
}
|
|
130
|
+
else if (info.hoveredDistrict) {
|
|
131
|
+
setHoveredInfo(`Directory: ${info.hoveredDistrict.path || '/'}`);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
setHoveredInfo('');
|
|
135
|
+
}
|
|
136
|
+
}, onFileClick: (path, type) => {
|
|
137
|
+
setClickedPath(`Clicked: ${type} - ${path}`);
|
|
138
|
+
} }),
|
|
139
|
+
React.createElement("div", { style: {
|
|
140
|
+
position: 'absolute',
|
|
141
|
+
top: 20,
|
|
142
|
+
left: 20,
|
|
143
|
+
color: 'white',
|
|
144
|
+
backgroundColor: 'rgba(0, 0, 0, 0.7)',
|
|
145
|
+
padding: '10px',
|
|
146
|
+
borderRadius: '4px',
|
|
147
|
+
fontFamily: 'monospace',
|
|
148
|
+
} },
|
|
149
|
+
React.createElement("div", null, hoveredInfo || 'Hover over elements'),
|
|
150
|
+
clickedPath && React.createElement("div", null, clickedPath))));
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
// Story with abstraction layer
|
|
154
|
+
exports.WithAbstractionLayer = {
|
|
155
|
+
args: {
|
|
156
|
+
cityData: (0, sample_data_1.createSampleCityData)(),
|
|
157
|
+
highlightLayers: [
|
|
158
|
+
{
|
|
159
|
+
id: 'directory-abstraction',
|
|
160
|
+
name: 'Directory Abstraction',
|
|
161
|
+
enabled: true,
|
|
162
|
+
color: '#1e40af',
|
|
163
|
+
priority: 0,
|
|
164
|
+
items: [],
|
|
165
|
+
// @ts-expect-error - abstraction layer specific properties
|
|
166
|
+
abstractionLayer: true,
|
|
167
|
+
abstractionConfig: {
|
|
168
|
+
maxZoomLevel: 2.0,
|
|
169
|
+
minPercentage: 0.02,
|
|
170
|
+
backgroundColor: '#1e40af',
|
|
171
|
+
allowRootAbstraction: false,
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
fullSize: true,
|
|
176
|
+
enableZoom: true,
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
// Story with custom rendering strategies
|
|
180
|
+
exports.CustomRenderStrategies = {
|
|
181
|
+
args: {
|
|
182
|
+
cityData: (0, sample_data_1.createSampleCityData)(),
|
|
183
|
+
highlightLayers: [
|
|
184
|
+
{
|
|
185
|
+
id: 'glow-effect',
|
|
186
|
+
name: 'Glow Effect',
|
|
187
|
+
enabled: true,
|
|
188
|
+
color: '#fbbf24',
|
|
189
|
+
priority: 1,
|
|
190
|
+
items: [
|
|
191
|
+
{
|
|
192
|
+
path: 'src/index.ts',
|
|
193
|
+
type: 'file',
|
|
194
|
+
renderStrategy: 'glow',
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
id: 'pattern-fill',
|
|
200
|
+
name: 'Pattern Fill',
|
|
201
|
+
enabled: true,
|
|
202
|
+
color: '#8b5cf6',
|
|
203
|
+
priority: 2,
|
|
204
|
+
items: [
|
|
205
|
+
{
|
|
206
|
+
path: 'package.json',
|
|
207
|
+
type: 'file',
|
|
208
|
+
renderStrategy: 'pattern',
|
|
209
|
+
},
|
|
210
|
+
],
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
id: 'covered-directories',
|
|
214
|
+
name: 'Covered Directories',
|
|
215
|
+
enabled: true,
|
|
216
|
+
color: '#06b6d4',
|
|
217
|
+
priority: 3,
|
|
218
|
+
items: [
|
|
219
|
+
{
|
|
220
|
+
path: 'node_modules',
|
|
221
|
+
type: 'directory',
|
|
222
|
+
renderStrategy: 'cover',
|
|
223
|
+
coverOptions: {
|
|
224
|
+
text: 'Dependencies',
|
|
225
|
+
backgroundColor: '#06b6d4',
|
|
226
|
+
opacity: 0.8,
|
|
227
|
+
borderRadius: 4,
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
],
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
showLayerControls: true,
|
|
234
|
+
fullSize: true,
|
|
235
|
+
enableZoom: true,
|
|
236
|
+
},
|
|
237
|
+
};
|
|
238
|
+
// Story with grid display
|
|
239
|
+
exports.WithGrid = {
|
|
240
|
+
args: {
|
|
241
|
+
cityData: (0, sample_data_1.createSampleCityData)(),
|
|
242
|
+
showGrid: true,
|
|
243
|
+
showFileNames: true,
|
|
244
|
+
fullSize: true,
|
|
245
|
+
enableZoom: true,
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
// Story with transformations
|
|
249
|
+
exports.WithTransformations = {
|
|
250
|
+
args: {
|
|
251
|
+
cityData: (0, sample_data_1.createSampleCityData)(),
|
|
252
|
+
transform: {
|
|
253
|
+
rotation: 90,
|
|
254
|
+
flipHorizontal: false,
|
|
255
|
+
flipVertical: false,
|
|
256
|
+
},
|
|
257
|
+
fullSize: true,
|
|
258
|
+
enableZoom: true,
|
|
259
|
+
},
|
|
260
|
+
};
|
|
261
|
+
// Story with border radius
|
|
262
|
+
exports.WithBorderRadius = {
|
|
263
|
+
args: {
|
|
264
|
+
cityData: (0, sample_data_1.createSampleCityData)(),
|
|
265
|
+
buildingBorderRadius: 4,
|
|
266
|
+
districtBorderRadius: 8,
|
|
267
|
+
fullSize: true,
|
|
268
|
+
enableZoom: true,
|
|
269
|
+
},
|
|
270
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
import { FileTree } from '@principal-ai/repository-abstraction';
|
|
3
|
+
import { CodebaseView } from '@principal-ai/alexandria-core-library';
|
|
4
|
+
declare const meta: {
|
|
5
|
+
title: string;
|
|
6
|
+
component: import("react").FC<import("../components/CityViewWithReactFlow").CityViewWithReactFlowProps>;
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: string;
|
|
9
|
+
};
|
|
10
|
+
decorators: ((Story: import("@storybook/types").PartialStoryFn<import("@storybook/react").ReactRenderer, {
|
|
11
|
+
fileTree: FileTree;
|
|
12
|
+
gridConfig?: CodebaseView | undefined;
|
|
13
|
+
onCellClick?: ((cellId: string) => void) | undefined;
|
|
14
|
+
cellWidth?: number | undefined;
|
|
15
|
+
cellHeight?: number | undefined;
|
|
16
|
+
cellSpacing?: number | undefined;
|
|
17
|
+
}>) => import("react").JSX.Element)[];
|
|
18
|
+
};
|
|
19
|
+
export default meta;
|
|
20
|
+
type Story = StoryObj<typeof meta>;
|
|
21
|
+
export declare const SingleCell: Story;
|
|
22
|
+
export declare const MultiCell: Story;
|
|
23
|
+
export declare const LargeGrid: Story;
|
|
24
|
+
//# sourceMappingURL=CityViewWithReactFlow.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CityViewWithReactFlow.stories.d.ts","sourceRoot":"","sources":["../../src/stories/CityViewWithReactFlow.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAA2B,MAAM,sCAAsC,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAErE,QAAA,MAAM,IAAI;;;;;;;;;;;;;;CAaoC,CAAC;AAE/C,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AA4nBnC,eAAO,MAAM,UAAU,EAAE,KA2BxB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAuCvB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KA2DvB,CAAC"}
|