@principal-ai/file-city-react 0.5.14 → 0.5.16
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/components/CityViewWithReactFlow.d.ts +1 -1
- package/dist/components/CityViewWithReactFlow.d.ts.map +1 -1
- package/dist/components/FileCity3D/FileCity3D.d.ts +67 -1
- package/dist/components/FileCity3D/FileCity3D.d.ts.map +1 -1
- package/dist/components/FileCity3D/FileCity3D.js +482 -93
- package/dist/components/FileCity3D/index.d.ts +2 -2
- package/dist/components/FileCity3D/index.d.ts.map +1 -1
- package/dist/components/FileCity3D/index.js +1 -1
- package/package.json +11 -4
- package/src/components/CityViewWithReactFlow.tsx +1 -2
- package/src/components/FileCity3D/FileCity3D.tsx +625 -104
- package/src/components/FileCity3D/index.ts +2 -1
- package/src/stories/CityViewWithReactFlow.stories.tsx +1 -1
- package/src/stories/FileCity3D.stories.tsx +1018 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import 'reactflow/dist/style.css';
|
|
3
3
|
import { FileTree } from '@principal-ai/repository-abstraction';
|
|
4
|
-
import { CodebaseView } from '@principal-ai/
|
|
4
|
+
import { CodebaseView } from '@principal-ai/file-city-builder';
|
|
5
5
|
export interface CityViewWithReactFlowProps {
|
|
6
6
|
fileTree: FileTree;
|
|
7
7
|
gridConfig?: CodebaseView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CityViewWithReactFlow.d.ts","sourceRoot":"","sources":["../../src/components/CityViewWithReactFlow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAepD,OAAO,0BAA0B,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAChE,OAAO,
|
|
1
|
+
{"version":3,"file":"CityViewWithReactFlow.d.ts","sourceRoot":"","sources":["../../src/components/CityViewWithReactFlow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAepD,OAAO,0BAA0B,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAChE,OAAO,EAA8C,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAG3G,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAiVD,eAAO,MAAM,qBAAqB,sCAA6B,CAAC"}
|
|
@@ -54,7 +54,71 @@ export interface AnimationConfig {
|
|
|
54
54
|
}
|
|
55
55
|
/** Height scaling mode for buildings */
|
|
56
56
|
export type HeightScaling = 'logarithmic' | 'linear';
|
|
57
|
+
export interface RotateOptions {
|
|
58
|
+
/** Animation duration in milliseconds. Default uses spring physics (~800ms feel). */
|
|
59
|
+
duration?: number;
|
|
60
|
+
}
|
|
57
61
|
export declare function resetCamera(): void;
|
|
62
|
+
export declare function moveCameraTo(x: number, z: number, size?: number): void;
|
|
63
|
+
/**
|
|
64
|
+
* Set the camera's look-at target (center point for orbiting).
|
|
65
|
+
* Camera maintains its current distance and angles relative to the new target.
|
|
66
|
+
* @param x - Target X coordinate
|
|
67
|
+
* @param y - Target Y coordinate (usually 0 for ground level)
|
|
68
|
+
* @param z - Target Z coordinate
|
|
69
|
+
* @param options - Optional settings including duration in ms
|
|
70
|
+
*/
|
|
71
|
+
export declare function setCameraTarget(x: number, y: number, z: number, options?: RotateOptions): void;
|
|
72
|
+
/**
|
|
73
|
+
* Get the current camera target (look-at point).
|
|
74
|
+
*/
|
|
75
|
+
export declare function getCameraTarget(): {
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
z: number;
|
|
79
|
+
} | null;
|
|
80
|
+
/**
|
|
81
|
+
* Rotate the camera to view the city from a specific angle or cardinal direction.
|
|
82
|
+
* Uses the shortest path (e.g., 350° to 10° goes through 0°, not 180°).
|
|
83
|
+
* @param angleOrDirection - Angle in degrees (0 = south, 90 = west, 180 = north, 270 = east)
|
|
84
|
+
* or a cardinal direction string ('north', 'south', 'east', 'west')
|
|
85
|
+
* @param options - Optional settings including duration in ms
|
|
86
|
+
*/
|
|
87
|
+
export declare function rotateCameraTo(angleOrDirection: number | 'north' | 'south' | 'east' | 'west', options?: RotateOptions): void;
|
|
88
|
+
/**
|
|
89
|
+
* Rotate the camera by a relative amount.
|
|
90
|
+
* @param degrees - Degrees to rotate. Positive = clockwise, negative = counter-clockwise.
|
|
91
|
+
* @param options - Optional settings including duration in ms
|
|
92
|
+
*/
|
|
93
|
+
export declare function rotateCameraBy(degrees: number, options?: RotateOptions): void;
|
|
94
|
+
/**
|
|
95
|
+
* Tilt the camera to a specific vertical angle or preset.
|
|
96
|
+
* @param angle - Angle in degrees (0 = top-down, 90 = level/horizontal)
|
|
97
|
+
* or a preset: 'top' (15°), 'high' (35°), 'low' (60°), 'level' (80°)
|
|
98
|
+
* @param options - Optional settings including duration in ms
|
|
99
|
+
*/
|
|
100
|
+
export declare function tiltCameraTo(angle: number | 'top' | 'level' | 'high' | 'low', options?: RotateOptions): void;
|
|
101
|
+
/**
|
|
102
|
+
* Tilt the camera by a relative amount.
|
|
103
|
+
* @param degrees - Degrees to tilt. Positive = tilt down (towards top-down), negative = tilt up (towards level).
|
|
104
|
+
* @param options - Optional settings including duration in ms
|
|
105
|
+
*/
|
|
106
|
+
export declare function tiltCameraBy(degrees: number, options?: RotateOptions): void;
|
|
107
|
+
export declare function getCameraPosition(): {
|
|
108
|
+
x: number;
|
|
109
|
+
y: number;
|
|
110
|
+
z: number;
|
|
111
|
+
} | null;
|
|
112
|
+
/**
|
|
113
|
+
* Get the current camera angle in degrees (0-360).
|
|
114
|
+
* 0 = south, 90 = west, 180 = north, 270 = east
|
|
115
|
+
*/
|
|
116
|
+
export declare function getCameraAngle(): number | null;
|
|
117
|
+
/**
|
|
118
|
+
* Get the current camera tilt in degrees (0-90).
|
|
119
|
+
* 0 = top-down view, 90 = level/horizontal view
|
|
120
|
+
*/
|
|
121
|
+
export declare function getCameraTilt(): number | null;
|
|
58
122
|
export interface FileCity3DProps {
|
|
59
123
|
/** City data from file-city-builder */
|
|
60
124
|
cityData: CityData;
|
|
@@ -94,6 +158,8 @@ export interface FileCity3DProps {
|
|
|
94
158
|
linearScale?: number;
|
|
95
159
|
/** Directory path to focus on - buildings outside will collapse */
|
|
96
160
|
focusDirectory?: string | null;
|
|
161
|
+
/** Color to highlight the focused directory (hex color, e.g. "#3b82f6") */
|
|
162
|
+
focusColor?: string | null;
|
|
97
163
|
/** Callback when user clicks on a district to navigate */
|
|
98
164
|
onDirectorySelect?: (directory: string | null) => void;
|
|
99
165
|
/** Background color for the canvas container */
|
|
@@ -109,6 +175,6 @@ export interface FileCity3DProps {
|
|
|
109
175
|
* Renders CityData as an interactive 3D city where buildings represent files
|
|
110
176
|
* and their height corresponds to line count or file size.
|
|
111
177
|
*/
|
|
112
|
-
export declare function FileCity3D({ cityData, width, height, onBuildingClick, className, style, animation, isGrown: externalIsGrown, onGrowChange, showControls, highlightLayers, isolationMode, dimOpacity, isLoading, loadingMessage, emptyMessage, heightScaling, linearScale, focusDirectory, onDirectorySelect, backgroundColor, textColor, selectedBuilding, }: FileCity3DProps): import("react/jsx-runtime").JSX.Element;
|
|
178
|
+
export declare function FileCity3D({ cityData, width, height, onBuildingClick, className, style, animation, isGrown: externalIsGrown, onGrowChange, showControls, highlightLayers, isolationMode, dimOpacity: _dimOpacity, isLoading, loadingMessage, emptyMessage, heightScaling, linearScale, focusDirectory, focusColor, onDirectorySelect: _onDirectorySelect, backgroundColor, textColor, selectedBuilding, }: FileCity3DProps): import("react/jsx-runtime").JSX.Element;
|
|
113
179
|
export default FileCity3D;
|
|
114
180
|
//# sourceMappingURL=FileCity3D.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileCity3D.d.ts","sourceRoot":"","sources":["../../../src/components/FileCity3D/FileCity3D.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAA4D,MAAM,OAAO,CAAC;AAMjF,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EACZ,YAAY,EAEb,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD,OAAO,QAAQ,OAAO,CAAC;IAErB,UAAU,GAAG,CAAC;QAEZ,UAAU,iBAAkB,SAAQ,aAAa;SAAG;KACrD;CACF;AAGD,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC;AAGrD,MAAM,WAAW,cAAc;IAC7B,wBAAwB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,8BAA8B;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,yBAAyB;IACzB,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,mBAAmB;IACnB,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;CAC5B;AAED,gDAAgD;AAChD,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,aAAa,GACb,UAAU,GACV,MAAM,CAAC;AAGX,MAAM,WAAW,eAAe;IAC9B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mFAAmF;IACnF,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,2CAA2C;IAC3C,YAAY,CAAC,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