-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(web): plugin API v2.0.0 #1009
Conversation
✅ Deploy Preview for reearth-web ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
WalkthroughRecent updates enhance the web application's functionality by refining dependency management and improving component interactions. Key changes include version updates for the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 15
Outside diff range, codebase verification and nitpick comments (2)
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/layers.ts (1)
66-76
: Consider adding detailed documentation for theoptions
parameter.The
LayersEvents
type is correctly defined, but adding more detailed documentation for theoptions
parameter in theon
method would improve clarity.web/src/beta/features/Visualizer/Crust/Plugins/hooks/useLayers.ts (1)
10-28
: Issues found inuseLayers
hook initializationThe
useLayers
hook is not correctly initialized with all the necessary properties in the following files:
web/src/beta/features/Editor/hooks/index.ts
: MissingmapRef
,selectedLayer
,selectedFeature
,onLayerEdit
,onLayerVisibility
, andonLayerLoad
.web/src/beta/features/Visualizer/Crust/Plugins/hooks/index.ts
: MissingonLayerLoad
.Please ensure that all required properties are passed to the
useLayers
hook.
Analysis chain
Verify the correctness of
useLayers
hook initialization.Ensure that the
useLayers
hook is correctly initialized with the necessary properties (mapRef
,selectedLayer
,selectedFeature
,onLayerEdit
,onLayerVisibility
,onLayerLoad
).Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `useLayers` hook initialization. # Test: Search for the usage of `useLayers` in the codebase. Expect: Correct initialization and usage. rg --type ts $'useLayers'Length of output: 1981
Script:
#!/bin/bash # Extract lines where `useLayers` is used in the identified files for verification # Extract lines from `web/src/beta/features/Editor/hooks/index.ts` rg -A 5 'useLayers' web/src/beta/features/Editor/hooks/index.ts # Extract lines from `web/src/beta/features/Visualizer/Crust/Plugins/hooks/index.ts` rg -A 5 'useLayers' web/src/beta/features/Visualizer/Crust/Plugins/hooks/index.tsLength of output: 767
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
web/yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
Files selected for processing (55)
- web/package.json (2 hunks)
- web/src/beta/features/Editor/Visualizer/hooks.ts (5 hunks)
- web/src/beta/features/Editor/Visualizer/index.tsx (3 hunks)
- web/src/beta/features/PluginPlayground/Viewer/hooks.ts (3 hunks)
- web/src/beta/features/PluginPlayground/Viewer/index.tsx (1 hunks)
- web/src/beta/features/Published/hooks.ts (3 hunks)
- web/src/beta/features/Published/index.tsx (2 hunks)
- web/src/beta/features/Published/types.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/Plugin/ModalContainer/index.tsx (2 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/Plugin/PopupContainer/index.tsx (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/Plugin/hooks/index.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/Plugin/hooks/usePluginAPI.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/Plugin/index.tsx (3 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/PluginFrame/SafeIFrame/hooks.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/PluginFrame/hooks.ts (3 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/hooks/index.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/hooks/useCamera.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/hooks/useCommonEvents.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/hooks/useData.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/hooks/useDeprecated.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/hooks/useExtension.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/hooks/useLayers.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/hooks/useSketch.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/hooks/useTimeline.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/hooks/useViewer.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/commonReearth.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/constaint.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/exposedReearth.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/pluginAPIv1Types.ts (6 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/camera.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/common.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/data.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/engine.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/extension.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/globe.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/index.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/layers.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/modal.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/popup.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/reearth.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/sketch.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/timeline.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/ui.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/viewer.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/storybook.tsx (2 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/types.ts (3 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/usePluginInstances.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/utils/events.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Widgets/index.tsx (3 hunks)
- web/src/beta/features/Visualizer/Crust/context.ts (2 hunks)
- web/src/beta/features/Visualizer/Crust/hooks.tsx (1 hunks)
- web/src/beta/features/Visualizer/Crust/index.tsx (11 hunks)
- web/src/beta/features/Visualizer/Crust/theme/index.ts (2 hunks)
- web/src/beta/features/Visualizer/Crust/types.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/utils.ts (2 hunks)
Files not processed due to max files limit (11)
- web/src/beta/features/Visualizer/hooks.ts
- web/src/beta/features/Visualizer/index.tsx
- web/src/beta/features/Visualizer/shared/components/BlockWrapper/index.tsx
- web/src/beta/features/Visualizer/utils/index.ts
- web/src/beta/features/Visualizer/utils/useOverriddenProperty.test.ts
- web/src/beta/features/Visualizer/utils/useOverriddenProperty.ts
- web/src/beta/types/index.ts
- web/src/beta/types/sceneProperty.ts
- web/src/beta/utils/convert-object.test.ts
- web/src/beta/utils/convert-object.ts
- web/src/beta/utils/value.ts
Files skipped from review due to trivial changes (11)
- web/src/beta/features/PluginPlayground/Viewer/index.tsx
- web/src/beta/features/Published/types.ts
- web/src/beta/features/Visualizer/Crust/Plugins/Plugin/PopupContainer/index.tsx
- web/src/beta/features/Visualizer/Crust/Plugins/hooks/useData.ts
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/constaint.ts
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/engine.ts
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/index.ts
- web/src/beta/features/Visualizer/Crust/Plugins/usePluginInstances.ts
- web/src/beta/features/Visualizer/Crust/Widgets/index.tsx
- web/src/beta/features/Visualizer/Crust/hooks.tsx
- web/src/beta/features/Visualizer/Crust/types.ts
Additional context used
Biome
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/timeline.ts
[error] 9-9: void is confusing inside a union type.
Unsafe fix: Use undefined instead.
(lint/suspicious/noConfusingVoidType)
web/src/beta/features/Visualizer/Crust/Plugins/utils/events.ts
[error] 88-88: Avoid the use of spread (
...
) syntax on accumulators.Spread syntax should be avoided on accumulators (like those in
.reduce
) because it causes a time complexity ofO(n^2)
.
Consider methods such as .splice or .push instead.(lint/performance/noAccumulatingSpread)
web/src/beta/features/Visualizer/Crust/Plugins/hooks/index.ts
[error] 357-357: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
Additional comments not posted (173)
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/common.ts (2)
1-5
: LGTM!The
LatLngHeight
type is well-defined and straightforward. No issues found.
7-12
: LGTM!The
GeoRect
type is well-defined and straightforward. No issues found.web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/globe.ts (1)
1-9
: LGTM!The
GlobalThis
type is well-defined and straightforward. No issues found.web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/data.ts (2)
1-3
: LGTM!The
Data
type is well-defined and straightforward. No issues found.
5-11
: LGTM!The
ClientStorage
type is well-defined and straightforward. No issues found.web/src/beta/features/PluginPlayground/Viewer/hooks.ts (3)
4-4
: LGTM! The import statement is correct.The import statement for
ViewerProperty
aligns with the changes described in the PR summary.
20-22
: LGTM! The declaration ofviewerProperty
is correct.The declaration of
viewerProperty
asViewerProperty
improves type safety and clarity.
38-38
: LGTM! The return statement is correct.The return statement includes
viewerProperty
instead ofsceneProperty
, aligning with the changes described in the PR summary.web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/ui.ts (2)
1-20
: Ensure consistent method parameter types and optionality.The
show
method'soptions
parameter has optional properties, but theresize
method's parameters are not consistently marked as optional.Ensure that the
resize
method parameters should be optional if intended.- width: string | number | undefined, - height: string | number | undefined, + width?: string | number, + height?: string | number,
27-37
: Ensure event handling methods are type-safe.The
on
andoff
methods are well-defined, but ensure that callback parameters are correctly typed.The event handling methods are correctly typed and consistent with best practices.
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/modal.ts (2)
1-21
: Ensure consistent method parameter types and optionality.The
show
andupdate
methods'options
parameters have optional properties, but ensure that all optional properties are consistently marked.The method parameters are well-defined and consistent with best practices.
27-37
: Ensure event handling methods are type-safe.The
on
andoff
methods are well-defined, but ensure that callback parameters are correctly typed.The event handling methods are correctly typed and consistent with best practices.
web/src/beta/features/Published/index.tsx (2)
14-25
: Ensure consistency with new API.The destructured properties now include
viewerProperty
,widgetThemeOptions
, andinitialCamera
. Ensure that these properties are correctly utilized within the component.The changes are consistent with the new API and enhance the component's functionality.
43-49
: Ensure correct prop passing to Visualizer component.The
Published
component now passeswidgetThemeOptions
,viewerProperty
, andinitialCamera
to theVisualizer
component. Ensure that theVisualizer
component handles these props correctly.The props are correctly passed to the
Visualizer
component, enhancing its functionality.web/src/beta/features/Visualizer/Crust/utils.ts (2)
1-1
: Import statements updated correctly.The import statements have been updated to include
useCallback
anduseRef
from React, which are essential for the newuseGet
function.
40-44
: New utility functionuseGet
added.The
useGet
function is well-implemented, usinguseRef
to maintain a reference to the value anduseCallback
to return a memoized function that provides the current value. This ensures consistency across re-renders without causing additional renders.web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/popup.ts (5)
1-13
: TypePopupPosition
declared correctly.The
PopupPosition
type defines various positions for the popup, covering all possible placement options.
15-21
: TypePopupOffset
declared correctly.The
PopupOffset
type allows for specifying offsets as either a number or an object withmainAxis
,crossAxis
, andalignmentAxis
properties.
23-43
: TypePopup
declared correctly.The
Popup
type defines the structure and behavior of a popup, including methods for showing, posting messages, updating, closing, and managing events.
45-47
: TypePopupEventType
declared correctly.The
PopupEventType
type defines the possible events for the popup, currently only including theclose
event.
49-59
: TypePopupEvents
declared correctly.The
PopupEvents
type defines methods for adding and removing event listeners for popup events.web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/timeline.ts (4)
1-22
: TypeTimeline
declared correctly.The
Timeline
type defines the structure and behavior of a timeline, including properties for time management, playback control, and event handling.Tools
Biome
[error] 9-9: void is confusing inside a union type.
Unsafe fix: Use undefined instead.
(lint/suspicious/noConfusingVoidType)
24-33
: TypeTimelineCommitter
declared correctly.The
TimelineCommitter
type defines the source of a timeline commit, allowing for various sources such aswidgetContext
,pluginAPI
, and others.
35-38
: TypeTimelineEventType
declared correctly.The
TimelineEventType
type defines the possible events for the timeline, includingtick
andcommit
.
40-50
: TypeTimelineEvents
declared correctly.The
TimelineEvents
type defines methods for adding and removing event listeners for timeline events.web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/sketch.ts (5)
3-3
: LGTM!The type definition for
SketchAppearance
looks good.
4-8
: LGTM!The type definition for
SketchEventProps
looks good.
10-18
: LGTM!The type definition for
SketchType
looks good.
20-27
: LGTM!The type definition for
Sketch
looks good.
29-54
: LGTM!The type definitions for
SketchOptions
,SketchEventType
, andSketchEvents
look good.web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/extension.ts (6)
4-11
: LGTM!The type definition for
Extension
looks good.
13-21
: LGTM!The type definition for
Block
looks good.
23-34
: LGTM!The type definition for
Widget
looks good.
36-43
: LGTM!The type definition for
PluginExtensionInstance
looks good.
45-60
: LGTM!The type definitions for
ExtensionEventType
andExtensionEvents
look good.
62-65
: LGTM!The type definition for
ExtensionMessage
looks good.web/src/beta/features/Visualizer/Crust/Plugins/Plugin/ModalContainer/index.tsx (2)
14-14
: LGTM!The addition of the
clickBgToClose
property inPluginModalInfo
looks good.
31-34
: LGTM!The modification of the
handleModalClose
function looks good.web/src/beta/features/Visualizer/Crust/theme/index.ts (3)
20-23
: LGTM! The renaming enhances clarity.The type
SceneThemeOptions
has been appropriately renamed toWidgetThemeOptions
to reflect the new context.
41-43
: LGTM! The function signature update ensures consistency.The function
usePublishTheme
has been updated to useWidgetThemeOptions
instead ofSceneThemeOptions
, aligning with the new type declaration.
Line range hint
45-78
:
LGTM! The function signature update ensures consistency.The function
publishTheme
has been updated to useWidgetThemeOptions
instead ofSceneThemeOptions
, aligning with the new type declaration.web/src/beta/features/Visualizer/Crust/Plugins/hooks/useSketch.ts (2)
1-7
: LGTM! The import statements are correct.The import statements correctly bring in necessary hooks and types for the functionality of the file.
9-77
: LGTM! The hook is well-structured and the logic is correct.The default export function effectively manages sketch tool operations using various hooks and utility functions.
web/src/beta/features/Visualizer/Crust/Plugins/types.ts (2)
Line range hint
41-55
:
LGTM! The changes enhance clarity and type safety.The
Props
type has been updated to replacesceneProperty
withviewerProperty
andoverrideSceneProperty
withoverrideViewerProperty
, improving clarity and type safety.
72-78
: LGTM! The changes enhance the structure and functionality.The
Context
type has been updated to replaceoverrideSceneProperty
withoverrideViewerProperty
and add various event properties, providing a more comprehensive event handling mechanism.web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/layers.ts (3)
14-14
: LGTM!The
LayerId
type alias is correctly defined as a string.
16-57
: Ensure consistency in method signatures.The
Layers
type is well-defined, but ensure that all methods consistently use the same parameter naming conventions and types. For example,delete
andoverride
methods are optional while others are not. Consider making this consistent if possible.
59-64
: LGTM!The
LayersEventType
is correctly defined with appropriate event types and their corresponding argument types.web/src/beta/features/Visualizer/Crust/Plugins/Plugin/index.tsx (3)
1-1
: Stylistic change in import syntax.The change from
import type { RefObject }
toimport { type RefObject }
is primarily stylistic and does not affect functionality.
Line range hint
28-28
:
LGTM!The removal of
onWidgetMove
from destructured props in thePlugin
component aligns with the updatedProps
type definition.
7-7
: Verify the impact of removingonWidgetMove
.The
onWidgetMove
property has been removed from theProps
type definition. Ensure that this removal does not affect other parts of the codebase whereonWidgetMove
might be used.web/src/beta/features/Visualizer/Crust/context.ts (2)
12-25
: LGTM!The
useWidgetContext
function has been correctly updated to includeviewerProperty
andinitialCamera
parameters, ensuring the memoized value recalculates when these inputs change.
Line range hint
31-53
:
LGTM!The
widgetContextFromMapRef
function has been correctly updated to includeviewerProperty
andinitialCamera
parameters, enhancing context handling and flexibility in camera settings.web/src/beta/features/Visualizer/Crust/Plugins/utils/events.ts (2)
107-117
: LGTM!The
useEmit
function is well-structured and follows React hooks rules.
81-104
: LGTM!The
mergeEvents
function is well-structured and follows best practices.Tools
Biome
[error] 88-88: Avoid the use of spread (
...
) syntax on accumulators.Spread syntax should be avoided on accumulators (like those in
.reduce
) because it causes a time complexity ofO(n^2)
.
Consider methods such as .splice or .push instead.(lint/performance/noAccumulatingSpread)
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/camera.ts (5)
51-58
: LGTM!The
CameraPosition
type declaration is comprehensive and follows best practices.
60-68
: LGTM!The
LookAtDestination
type declaration is comprehensive and follows best practices.
70-74
: LGTM!The
CameraMoveOptions
type declaration is comprehensive and follows best practices.
105-115
: LGTM!The
CameraEvents
type declaration is comprehensive and follows best practices.
33-35
: Specify parameter types for rotation methods.The
rotateAround
,rotateRight
, andorbit
methods should have more specific parameter types, such asnumber
for theradian
parameter.readonly rotateAround: (radian: number) => void; readonly rotateRight: (radian: number) => void; readonly orbit: (radian: number) => void;Likely invalid or redundant comment.
web/src/beta/features/Visualizer/Crust/Plugins/hooks/useTimeline.ts (3)
63-130
: LGTM!The
getTimeline
function is well-structured and follows best practices.
39-50
: LGTM!The
timelineEventsOn
function is well-structured and follows best practices.
52-60
: LGTM!The
timelineEventsOff
function is well-structured and follows best practices.web/src/beta/features/Editor/Visualizer/index.tsx (2)
114-120
: Verify the correct usage ofviewerProperty
andinitialCamera
in the JSX block.Ensure that
viewerProperty
andinitialCamera
are correctly passed as props to theVisualizer
component. Verify that their values are correctly managed and utilized within the component.Verification successful
Verified the correct usage of
viewerProperty
andinitialCamera
in the JSX block.Both
viewerProperty
andinitialCamera
are correctly passed as props to theVisualizer
component and are properly managed within the component.
viewerProperty
is used inweb/src/beta/features/Visualizer/index.tsx
and other related files.initialCamera
is also used inweb/src/beta/features/Visualizer/index.tsx
and other related files.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correct usage of `viewerProperty` and `initialCamera` in the JSX block. # Test: Search for the usage of `viewerProperty` and `initialCamera` in the `Visualizer` component. Expect: Correct integration and usage. rg --type tsx -A 5 $'viewerProperty' rg --type tsx -A 5 $'initialCamera'Length of output: 126
Script:
#!/bin/bash # Description: Verify the correct usage of `viewerProperty` and `initialCamera` in the JSX block. # Test: Search for the usage of `viewerProperty` and `initialCamera` in the `Visualizer` component. Expect: Correct integration and usage. rg -A 5 'viewerProperty' rg -A 5 'initialCamera'Length of output: 31688
Line range hint
65-74
:
Verify the correct usage ofviewerProperty
andinitialCamera
.Ensure that
viewerProperty
andinitialCamera
are correctly integrated and used within the custom hook. Verify that their values are correctly managed and passed to the relevant components.Verification successful
Verification successful:
viewerProperty
andinitialCamera
are correctly integrated and used within the codebase.The properties
viewerProperty
andinitialCamera
are correctly managed and passed to the relevant components across various files, ensuring proper integration and usage.
viewerProperty
is used inindex.tsx
,hooks.ts
,context.ts
, and other related files.initialCamera
is used inindex.tsx
,hooks.ts
,context.ts
, and other related files.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correct usage of `viewerProperty` and `initialCamera`. # Test: Search for the usage of `viewerProperty` and `initialCamera` in the codebase. Expect: Correct integration and usage. rg --type tsx -A 5 $'viewerProperty' rg --type tsx -A 5 $'initialCamera'Length of output: 126
Script:
#!/bin/bash # Description: Verify the correct usage of `viewerProperty` and `initialCamera`. # Test: Search for the usage of `viewerProperty` and `initialCamera` in the codebase. Expect: Correct integration and usage. rg -A 5 'viewerProperty' rg -A 5 'initialCamera'Length of output: 31688
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/viewer.ts (19)
23-26
: Verify the correctness ofLayerSelectWithRectEnd
type.Ensure that all properties (
features
,isClick
) are correctly defined and used.Verification successful
The
LayerSelectWithRectEnd
type is correctly defined and used.The properties
features
andisClick
are appropriately defined and utilized in the codebase.
- The
features
property is of typePickedFeature[] | undefined
, andPickedFeature
is correctly defined as an extension ofComputedFeature
.- The
isClick
property is a boolean and is used correctly in the context of event handling and function parameters.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `LayerSelectWithRectEnd` type. # Test: Search for the usage of `LayerSelectWithRectEnd` in the codebase. Expect: Correct integration and usage. rg --type ts $'LayerSelectWithRectEnd'Length of output: 1979
Script:
#!/bin/bash # Find the definition of PickedFeature rg --type ts 'type PickedFeature' -A 5 # Examine the usages of LayerSelectWithRectEnd in detail rg --type ts 'LayerSelectWithRectEnd' -A 10Length of output: 17969
72-75
: Verify the correctness ofEnv
type.Ensure that all properties (
inEditor
,isBuilt
) are correctly defined and used.Verification successful
The
Env
type is correctly defined and used.The properties
inEditor
andisBuilt
are appropriately integrated and utilized across the codebase.
inEditor
is used in files such asindex.tsx
,Crust/index.tsx
,Widgets/index.tsx
,commonReearth.ts
, and more.isBuilt
is used in files such asindex.tsx
,shared/types.ts
,Crust/index.tsx
,commonReearth.ts
, and more.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `Env` type. # Test: Search for the usage of `Env` in the codebase. Expect: Correct integration and usage. rg --type ts $'Env'Length of output: 801
Script:
#!/bin/bash # Description: Verify the usage of `inEditor` and `isBuilt` properties of `Env` type. # Search for occurrences of `inEditor` in the codebase. rg --type ts 'inEditor' # Search for occurrences of `isBuilt` in the codebase. rg --type ts 'isBuilt'Length of output: 10740
77-106
: Verify the correctness ofTools
type.Ensure that all methods (
getLocationFromScreenCoordinate
,getScreenCoordinateFromPosition
,getTerrainHeightAsync
,getGlobeHeight
,getGlobeHeightByCamera
,cartographicToCartesian
,cartesianToCartographic
,transformByOffsetOnScreen
,isPositionVisibleOnGlobe
) are correctly defined and used.Verification successful
The
Tools
type is correctly defined and integrated.All methods (
getLocationFromScreenCoordinate
,getScreenCoordinateFromPosition
,getTerrainHeightAsync
,getGlobeHeight
,getGlobeHeightByCamera
,cartographicToCartesian
,cartesianToCartographic
,transformByOffsetOnScreen
,isPositionVisibleOnGlobe
) are properly referenced and used within the codebase.
- Verified in files such as
useViewer
,commonReearth
, and others.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `Tools` type. # Test: Search for the usage of `Tools` in the codebase. Expect: Correct integration and usage. rg --type ts $'Tools'Length of output: 2604
Script:
#!/bin/bash # Description: Verify the definitions and usages of each method in the `Tools` type. # Methods to verify methods=( "getLocationFromScreenCoordinate" "getScreenCoordinateFromPosition" "getTerrainHeightAsync" "getGlobeHeight" "getGlobeHeightByCamera" "cartographicToCartesian" "cartesianToCartographic" "transformByOffsetOnScreen" "isPositionVisibleOnGlobe" ) # Search for each method in the codebase for method in "${methods[@]}"; do echo "Searching for method: $method" rg --type ts "$method" doneLength of output: 15312
57-59
: Verify the correctness ofViewport
type.Ensure that all properties (
query
) are correctly defined and used.Verification successful
The
Viewport
type is correctly defined and used.The
query
property and other properties inherited fromViewportSize
are appropriately utilized across the codebase.
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/viewer.ts
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/pluginAPIv1Types.ts
web/src/beta/features/Visualizer/Crust/Plugins/hooks/useViewer.ts
web/src/beta/features/Visualizer/Crust/Plugins/hooks/useLayers.ts
web/src/beta/features/Visualizer/Crust/Plugins/hooks/useCamera.ts
web/src/beta/features/Visualizer/Crust/Plugins/hooks/index.ts
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/commonReearth.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `Viewport` type. # Test: Search for the usage of `Viewport` in the codebase. Expect: Correct integration and usage. rg --type ts $'Viewport'Length of output: 5447
Script:
#!/bin/bash # Description: Extract context around the usages of `Viewport` to verify the correctness of the `query` property and other properties. # Extract context around the definition and usage of `Viewport` in the relevant files rg --type ts 'Viewport' -A 5 -B 5Length of output: 49437
39-49
: Verify the correctness ofViewer
type.Ensure that all properties (
property
,overrideProperty
,viewport
,interactionMode
,env
,tools
,capture
,on
,off
) are correctly defined and used.Verification successful
The
Viewer
type is correctly defined and used.All properties (
property
,overrideProperty
,viewport
,interactionMode
,env
,tools
,capture
,on
,off
) are correctly defined and used within the codebase.
ViewerProperty
: Defined and used in multiple files.Viewport
: Defined and used in multiple files.InteractionMode
: Defined and used in multiple files.Env
: Defined and used in multiple files.Tools
: Defined and used in multiple files.ViewerEvents
: Defined and used in multiple files.capture
: Defined and used in multiple files.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `Viewer` type. # Test: Search for the usage of `Viewer` in the codebase. Expect: Correct integration and usage. rg --type ts $'Viewer'Length of output: 11125
Script:
#!/bin/bash # Description: Verify the definitions and usages of each property in the `Viewer` type. # Search for the definition and usage of `ViewerProperty` rg --type ts 'ViewerProperty' # Search for the definition and usage of `Viewport` rg --type ts 'Viewport' # Search for the definition and usage of `InteractionMode` rg --type ts 'InteractionMode' # Search for the definition and usage of `Env` rg --type ts 'Env' # Search for the definition and usage of `Tools` rg --type ts 'Tools' # Search for the definition and usage of `ViewerEvents` rg --type ts 'ViewerEvents' # Search for the definition and usage of the `capture` method rg --type ts 'capture'Length of output: 24367
144-154
: Verify the correctness ofSelectionModeEvents
type.Ensure that all methods (
on
,off
) are correctly defined and used.
37-37
: Verify the correctness ofInteractionModeType
type.Ensure that all values (
default
,move
,selection
,sketch
) are correctly defined and used.Verification successful
The
InteractionModeType
type is correctly defined and used.The values "default", "move", "selection", and "sketch" are appropriately integrated and utilized within the codebase.
- Verified usages in relevant files:
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/viewer.ts
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/commonReearth.ts
web/src/beta/features/Visualizer/Crust/Plugins/hooks/useCamera.ts
web/src/beta/features/Visualizer/Crust/Plugins/storybook.tsx
web/src/beta/features/Visualizer/Crust/Plugins/hooks/useViewer.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `InteractionModeType` type. # Test: Search for the usage of `InteractionModeType` in the codebase. Expect: Correct integration and usage. rg --type ts $'InteractionModeType'Length of output: 2021
Script:
#!/bin/bash # Description: Verify the usage of each value of `InteractionModeType` in the codebase. # Search for the usage of "default" rg --type ts '"default"' # Search for the usage of "move" rg --type ts '"move"' # Search for the usage of "selection" rg --type ts '"selection"' # Search for the usage of "sketch" rg --type ts '"sketch"'Length of output: 46801
61-65
: Verify the correctness ofInteractionMode
type.Ensure that all properties (
mode
,override
,selectionMode
) are correctly defined and used.Verification successful
The
InteractionMode
type is correctly defined and used.The properties
mode
,override
, andselectionMode
are correctly integrated and utilized across the codebase.
mode
is correctly defined asInteractionModeType
.override
is correctly defined as a function that takesInteractionModeType
as an argument.selectionMode
is correctly defined and used in the context ofSelectionMode
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `InteractionMode` type. # Test: Search for the usage of `InteractionMode` in the codebase. Expect: Correct integration and usage. rg --type ts $'InteractionMode'Length of output: 4951
Script:
#!/bin/bash # Description: Verify the correctness of `InteractionMode` type by checking the definitions and usages of its properties. # Search for the definition of `InteractionMode` to confirm its properties. rg --type ts 'InteractionMode' -A 5 # Search for the usage of `mode` property within `InteractionMode`. rg --type ts 'interactionMode\.mode' # Search for the usage of `override` property within `InteractionMode`. rg --type ts 'interactionMode\.override' # Search for the usage of `selectionMode` property within `InteractionMode`. rg --type ts 'interactionMode\.selectionMode'Length of output: 23323
15-17
: Verify the correctness ofLayerSelectWithRect
type.Ensure that all properties (
pressedKey
) are correctly defined and used.Verification successful
The
LayerSelectWithRect
type is correctly defined and used.The
pressedKey
property is correctly defined as an optional property of type"shift"
and is used appropriately in the context of the related event handlers.
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/viewer.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `LayerSelectWithRect` type. # Test: Search for the usage of `LayerSelectWithRect` in the codebase. Expect: Correct integration and usage. rg --type ts $'LayerSelectWithRect'Length of output: 6058
Script:
#!/bin/bash # Extract the definition and usage of LayerSelectWithRect and its related types # Extract the definition of LayerSelectWithRect rg --type ts --context 5 'export declare type LayerSelectWithRect' # Extract the usage of LayerSelectWithRect and its related types with context rg --type ts --context 5 'LayerSelectWithRectStart' rg --type ts --context 5 'LayerSelectWithRectMove' rg --type ts --context 5 'LayerSelectWithRectEnd'Length of output: 55621
51-55
: Verify the correctness ofViewportSize
type.Ensure that all properties (
width
,height
,isMobile
) are correctly defined and used.Verification successful
The
ViewportSize
type and its properties (width
,height
,isMobile
) are correctly defined and used.The properties are accessed and utilized as expected in the relevant files.
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/pluginAPIv1Types.ts
web/src/beta/features/Visualizer/Crust/Plugins/hooks/useViewer.ts
web/src/beta/features/Visualizer/Crust/Plugins/hooks/useCommonEvents.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `ViewportSize` type. # Test: Search for the usage of `ViewportSize` in the codebase. Expect: Correct integration and usage. rg --type ts $'ViewportSize'Length of output: 1243
Script:
#!/bin/bash # Description: Verify the usage of `width`, `height`, and `isMobile` properties of `ViewportSize` type. # Search for the usage of `width` property in the relevant files. rg --type ts 'width' web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/pluginAPIv1Types.ts web/src/beta/features/Visualizer/Crust/Plugins/hooks/useViewer.ts web/src/beta/features/Visualizer/Crust/Plugins/hooks/useCommonEvents.ts # Search for the usage of `height` property in the relevant files. rg --type ts 'height' web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/pluginAPIv1Types.ts web/src/beta/features/Visualizer/Crust/Plugins/hooks/useViewer.ts web/src/beta/features/Visualizer/Crust/Plugins/hooks/useCommonEvents.ts # Search for the usage of `isMobile` property in the relevant files. rg --type ts 'isMobile' web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/pluginAPIv1Types.ts web/src/beta/features/Visualizer/Crust/Plugins/hooks/useViewer.ts web/src/beta/features/Visualizer/Crust/Plugins/hooks/useCommonEvents.tsLength of output: 5791
35-35
: Verify the correctness ofLayerSelectWithRectStart
type.Ensure that all properties are correctly defined and used.
Verification successful
Let's start by locating the definition of
LayerSelectWithRect
to understand its structure and properties.
Let's start by locating the definition of
MouseEventProps
to understand its structure and properties.
The type
LayerSelectWithRectStart
is correctly defined as it inherits all necessary properties fromLayerSelectWithRect
, which in turn extendsMouseEventProps
. The properties are well-defined and cover the expected fields for mouse events.Verified the correctness of
LayerSelectWithRectStart
type.
- The type
LayerSelectWithRectStart
is correctly defined as an alias forLayerSelectWithRect
.- The properties of
LayerSelectWithRect
are properly defined and inherited fromMouseEventProps
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `LayerSelectWithRectStart` type. # Test: Search for the usage of `LayerSelectWithRectStart` in the codebase. Expect: Correct integration and usage. rg --type ts $'LayerSelectWithRectStart'Length of output: 2022
Script:
#!/bin/bash # Locate the definition of `LayerSelectWithRect` in the codebase. rg --type ts 'type LayerSelectWithRect' -A 10Length of output: 3187
Script:
#!/bin/bash # Locate the definition of `MouseEventProps` in the codebase. rg --type ts 'type MouseEventProps' -A 10Length of output: 1069
138-154
: Verify the correctness ofSelectionModeEventType
type.Ensure that all event types (
marqueeStart
,marqueeMove
,marqueeEnd
) are correctly defined and used.Verification successful
The
SelectionModeEventType
type is correctly defined and used.The definitions of
LayerSelectWithRectStart
,LayerSelectWithRectMove
, andLayerSelectWithRectEnd
are accurate, and their usage inSelectionModeEventType
aligns with the expected types. The integration ofSelectionModeEventType
across the codebase is consistent and correct.
LayerSelectWithRectStart
,LayerSelectWithRectMove
, andLayerSelectWithRectEnd
are defined inweb/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/viewer.ts
.- The usage of
SelectionModeEventType
inusePluginAPI.ts
,types.ts
, anduseViewer.ts
is consistent with its definition.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `SelectionModeEventType` type. # Test: Search for the usage of `SelectionModeEventType` in the codebase. Expect: Correct integration and usage. rg --type ts $'SelectionModeEventType'Length of output: 1899
Script:
#!/bin/bash # Description: Retrieve the definitions of LayerSelectWithRectStart, LayerSelectWithRectMove, and LayerSelectWithRectEnd # Search for the definitions of LayerSelectWithRectStart, LayerSelectWithRectMove, and LayerSelectWithRectEnd rg --type ts 'type LayerSelectWithRect(Start|Move|End)' -A 5Length of output: 1825
Script:
#!/bin/bash # Description: Extract relevant sections of the files where SelectionModeEventType is used to verify correct integration # Extract relevant sections from usePluginAPI.ts rg --type ts 'SelectionModeEventType' -A 10 web/src/beta/features/Visualizer/Crust/Plugins/Plugin/hooks/usePluginAPI.ts # Extract relevant sections from types.ts rg --type ts 'SelectionModeEventType' -A 10 web/src/beta/features/Visualizer/Crust/Plugins/types.ts # Extract relevant sections from useViewer.ts rg --type ts 'SelectionModeEventType' -A 10 web/src/beta/features/Visualizer/Crust/Plugins/hooks/useViewer.tsLength of output: 3011
19-21
: Verify the correctness ofPickedFeature
type.Ensure that all properties (
layerId
) are correctly defined and used.Verification successful
The
PickedFeature
type and itslayerId
property are correctly defined and used.
- The
PickedFeature
type is defined asComputedFeature & { layerId?: string; }
.- It is used in
LayerSelectWithRectEnd
which has afeatures
property of typePickedFeature[] | undefined
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `PickedFeature` type. # Test: Search for the usage of `PickedFeature` in the codebase. Expect: Correct integration and usage. rg --type ts $'PickedFeature'Length of output: 271
Script:
#!/bin/bash # Description: Verify the correctness of `PickedFeature` type by examining the usage of the `features` property. # Test: Search for the usage of `features` in the codebase. Expect: Correct integration and usage. rg --type ts 'features'Length of output: 100584
Script:
#!/bin/bash # Description: Verify the correctness of `PickedFeature` type by examining its definition and usage in `viewer.ts`. # Test: Search for the `PickedFeature` type definition and usage in `viewer.ts`. Expect: Correct integration and usage. rg --type ts 'PickedFeature' -A 10 -B 10 web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/viewer.tsLength of output: 643
28-33
: Verify the correctness ofLayerSelectWithRectMove
type.Ensure that all properties (
startX
,startY
,width
,height
) are correctly defined and used.Verification successful
The
LayerSelectWithRectMove
type is correctly defined and used in the codebase.The properties
startX
,startY
,width
, andheight
are part of the type definition and are used consistently in function signatures and event handling.
- Files where
LayerSelectWithRectMove
is used:
web/src/beta/features/Visualizer/Crust/Plugins/types.ts
web/src/beta/features/Visualizer/Crust/Plugins/hooks/useCommonEvents.ts
web/src/beta/features/Visualizer/Crust/Plugins/hooks/useViewer.ts
web/src/beta/features/Visualizer/Crust/Plugins/hooks/index.ts
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/pluginAPIv1Types.ts
web/src/beta/features/Visualizer/Crust/index.tsx
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `LayerSelectWithRectMove` type. # Test: Search for the usage of `LayerSelectWithRectMove` in the codebase. Expect: Correct integration and usage. rg --type ts $'LayerSelectWithRectMove'Length of output: 2002
Script:
#!/bin/bash # Extract context around the usage of `LayerSelectWithRectMove` in the identified files to verify correctness of its properties. # Searching for `LayerSelectWithRectMove` in `web/src/beta/features/Visualizer/Crust/Plugins/types.ts` rg --type ts -A 5 -B 5 'LayerSelectWithRectMove' web/src/beta/features/Visualizer/Crust/Plugins/types.ts # Searching for `LayerSelectWithRectMove` in `web/src/beta/features/Visualizer/Crust/Plugins/hooks/useCommonEvents.ts` rg --type ts -A 5 -B 5 'LayerSelectWithRectMove' web/src/beta/features/Visualizer/Crust/Plugins/hooks/useCommonEvents.ts # Searching for `LayerSelectWithRectMove` in `web/src/beta/features/Visualizer/Crust/Plugins/hooks/useViewer.ts` rg --type ts -A 5 -B 5 'LayerSelectWithRectMove' web/src/beta/features/Visualizer/Crust/Plugins/hooks/useViewer.ts # Searching for `LayerSelectWithRectMove` in `web/src/beta/features/Visualizer/Crust/Plugins/hooks/index.ts` rg --type ts -A 5 -B 5 'LayerSelectWithRectMove' web/src/beta/features/Visualizer/Crust/Plugins/hooks/index.ts # Searching for `LayerSelectWithRectMove` in `web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/pluginAPIv1Types.ts` rg --type ts -A 5 -B 5 'LayerSelectWithRectMove' web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/pluginAPIv1Types.ts # Searching for `LayerSelectWithRectMove` in `web/src/beta/features/Visualizer/Crust/index.tsx` rg --type ts -A 5 -B 5 'LayerSelectWithRectMove' web/src/beta/features/Visualizer/Crust/index.tsxLength of output: 5582
126-136
: Verify the correctness ofViewerEvents
type.Ensure that all methods (
on
,off
) are correctly defined and used.Verification successful
ViewerEvents
type verification completeThe
ViewerEvents
type and its methodson
andoff
are correctly defined within theviewer.ts
file. There are no further usages or implementations found elsewhere in the codebase, confirming the correctness of the type definition.
ViewerEvents
type is correctly defined and used withinviewer.ts
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `ViewerEvents` type. # Test: Search for the usage of `ViewerEvents` in the codebase. Expect: Correct integration and usage. rg --type ts $'ViewerEvents'Length of output: 355
Script:
#!/bin/bash # Description: Verify the correctness of `ViewerEvents` type by checking its usage across the codebase. # Test: Search for the usage of `ViewerEvents` type in the entire codebase. rg 'ViewerEvents' --type tsLength of output: 355
Script:
#!/bin/bash # Description: Verify the implementation of `on` and `off` methods in the `viewer.ts` file. # Test: Search for the implementation of `on` method in the `viewer.ts` file. rg 'on' --type ts -A 5 web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/viewer.ts # Test: Search for the implementation of `off` method in the `viewer.ts` file. rg 'off' --type ts -A 5 web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/viewer.tsLength of output: 4188
5-13
: Verify the correctness ofMouseEventProps
type.Ensure that all properties (
x
,y
,lat
,lng
,height
,layerId
,delta
) are correctly defined and used.
67-70
: Verify the correctness ofSelectionMode
type.Ensure that all properties (
on
,off
) are correctly defined and used.Verification successful
The
SelectionMode
type is correctly defined and used.The properties
on
andoff
are properly set up to handle events as expected.
- Definitions of
SelectionModeEvents
andSelectionModeEventType
confirm the correct structure.- Usage instances in the codebase validate their correct implementation.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `SelectionMode` type. # Test: Search for the usage of `SelectionMode` in the codebase. Expect: Correct integration and usage. rg --type ts $'SelectionMode'Length of output: 3312
Script:
#!/bin/bash # Extract definitions of `SelectionModeEvents` and `SelectionModeEventType` # Search for the definition of `SelectionModeEvents` echo "Definition of SelectionModeEvents:" rg --type ts --context 10 $'export declare type SelectionModeEvents' # Search for the definition of `SelectionModeEventType` echo "Definition of SelectionModeEventType:" rg --type ts --context 10 $'export declare type SelectionModeEventType'Length of output: 4637
Script:
#!/bin/bash # Search for the usage of `SelectionMode` properties `on` and `off` # Search for the usage of `SelectionMode.on` echo "Usage of SelectionMode.on:" rg --type ts $'SelectionMode.on' # Search for the usage of `SelectionMode.off` echo "Usage of SelectionMode.off:" rg --type ts $'SelectionMode.off'Length of output: 192
Script:
#!/bin/bash # Refined search for the usage of `SelectionMode` and its properties `on` and `off` # Search for the usage of `SelectionMode` echo "Usage of SelectionMode:" rg --type ts $'SelectionMode' # Search for potential variations in the usage of `SelectionMode.on` echo "Potential variations of SelectionMode.on usage:" rg --type ts $'selectionMode.on' # Search for potential variations in the usage of `SelectionMode.off` echo "Potential variations of SelectionMode.off usage:" rg --type ts $'selectionMode.off'Length of output: 3848
108-124
: Verify the correctness ofViewerEventType
type.Ensure that all event types (
click
,doubleClick
,mouseDown
,mouseUp
,rightClick
,rightDown
,rightUp
,middleClick
,middleDown
,middleUp
,mouseMove
,mouseEnter
,mouseLeave
,wheel
,resize
) are correctly defined and used.Verification successful
The
ViewerEventType
type is correctly defined and used.The search results confirm that the event names and their corresponding types (
MouseEvent
for mouse-related events andViewportSize
for the resize event) are correctly referenced in the codebase.
click: [e: MouseEvent]
doubleClick: [e: MouseEvent]
mouseDown: [e: MouseEvent]
mouseUp: [e: MouseEvent]
rightClick: [e: MouseEvent]
rightDown: [e: MouseEvent]
rightUp: [e: MouseEvent]
middleClick: [e: MouseEvent]
middleDown: [e: MouseEvent]
middleUp: [e: MouseEvent]
mouseMove: [e: MouseEvent]
mouseEnter: [e: MouseEvent]
mouseLeave: [e: MouseEvent]
wheel: [e: MouseEvent]
resize: [e: ViewportSize]
These definitions are consistent with their usage in the codebase.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `ViewerEventType` type. # Test: Search for the usage of `ViewerEventType` in the codebase. Expect: Correct integration and usage. rg --type ts $'ViewerEventType'Length of output: 1814
Script:
#!/bin/bash # Description: Verify the correctness of event names in `ViewerEventType` type. # Test: Search for the usage of each event name defined in `ViewerEventType` in the codebase. rg --type ts 'click|doubleClick|mouseDown|mouseUp|rightClick|rightDown|rightUp|middleClick|middleDown|middleUp|mouseMove|mouseEnter|mouseLeave|wheel|resize'Length of output: 29389
Script:
#!/bin/bash # Description: Verify the correctness of event types in `ViewerEventType` type. # Test: Search for the usage of each event name with their types defined in `ViewerEventType` in the codebase. rg --type ts 'click: \[e: MouseEvent\]|doubleClick: \[e: MouseEvent\]|mouseDown: \[e: MouseEvent\]|mouseUp: \[e: MouseEvent\]|rightClick: \[e: MouseEvent\]|rightDown: \[e: MouseEvent\]|rightUp: \[e: MouseEvent\]|middleClick: \[e: MouseEvent\]|middleDown: \[e: MouseEvent\]|middleUp: \[e: MouseEvent\]|mouseMove: \[e: MouseEvent\]|mouseEnter: \[e: MouseEvent\]|mouseLeave: \[e: MouseEvent\]|wheel: \[e: MouseEvent\]|resize: \[e: ViewportSize\]'Length of output: 1984
1-4
: Verify the correctness of imported types.Ensure that
ViewerProperty
,ComputedFeature
, andLatLngHeight
are correctly imported from@reearth/core
and./common
.Verification successful
Verify the correctness of imported types.
Ensure that
ViewerProperty
,ComputedFeature
, andLatLngHeight
are correctly imported from@reearth/core
and./common
.
Verify the correctness of imported types.
Ensure that
ViewerProperty
,ComputedFeature
, andLatLngHeight
are correctly imported from@reearth/core
and./common
.
Verify the correctness of imported types.
Ensure that
LatLngHeight
is correctly defined and exported in./common
.
The imported types are correctly defined and exported.
The types
ViewerProperty
andComputedFeature
are correctly imported from@reearth/core
, andLatLngHeight
is correctly defined and exported in./common
.
ViewerProperty
andComputedFeature
are confirmed to be present in@reearth/core
.LatLngHeight
is correctly defined inweb/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/common.ts
.Everything looks good with the imports.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of imported types. # Test: Search for the definition of `ViewerProperty`, `ComputedFeature`, and `LatLngHeight`. Expect: Correct definitions. rg --type ts $'ViewerProperty' rg --type ts $'ComputedFeature' rg --type ts $'LatLngHeight'Length of output: 12499
Script:
#!/bin/bash # Description: Verify the correctness of imported types by locating their definitions. # Locate the definition of `ViewerProperty` in the codebase. ast-grep --lang typescript --pattern 'type ViewerProperty $_' # Locate the definition of `ComputedFeature` in the codebase. ast-grep --lang typescript --pattern 'type ComputedFeature $_' # Locate the definition of `LatLngHeight` in the codebase. ast-grep --lang typescript --pattern 'type LatLngHeight $_'Length of output: 1225
Script:
#!/bin/bash # Description: Verify the correctness of imported types by locating their definitions. # Locate the definition of `ViewerProperty` in the codebase. rg 'type ViewerProperty' --type ts -A 5 # Locate the definition of `ComputedFeature` in the codebase. rg 'type ComputedFeature' --type ts -A 5 # Locate the definition of `LatLngHeight` in the codebase. rg 'type LatLngHeight' --type ts -A 5Length of output: 2545
Script:
#!/bin/bash # Description: Verify the correctness of imported types by locating their definitions and exports. # Locate the definition and export of `LatLngHeight` in `./common`. rg 'LatLngHeight' web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/common.ts -A 5Length of output: 184
web/src/beta/features/Visualizer/Crust/Plugins/hooks/useLayers.ts (3)
38-43
: Verify the correctness ofshowLayer
callback.Ensure
1-4
: Verify the correctness of imported types and hooks.Ensure that
ComputedFeature
,NaiveLayer
,useGet
,LayersEventType
,Props
,events
, anduseEmit
are correctly imported and used.Verification successful
All imported types and hooks are correctly defined and used.
The types and hooks
ComputedFeature
,NaiveLayer
,useGet
,LayersEventType
,Props
,events
, anduseEmit
are correctly imported and used within theuseLayers.ts
file. The imports are necessary and correctly contribute to the functionality of the custom hook.
ComputedFeature
andNaiveLayer
are imported from@reearth/core
.useGet
is imported from../../utils
.LayersEventType
,Props
,events
, anduseEmit
are imported from../pluginAPI/types
and../utils/events
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of imported types and hooks. # Test: Search for the definition of `ComputedFeature`, `NaiveLayer`, `useGet`, `LayersEventType`, `Props`, `events`, and `useEmit`. Expect: Correct definitions. rg --type ts $'ComputedFeature' rg --type ts $'NaiveLayer' rg --type ts $'useGet' rg --type ts $'LayersEventType' rg --type ts $'Props' rg --type ts $'events' rg --type ts $'useEmit'Length of output: 145033
31-35
: Verify the correctness ofhideLayer
callback.Ensure that the
hideLayer
callback is correctly defined and used to hide layers.Verification successful
The
hideLayer
callback is correctly defined and used.
- Definition in
useLayers.ts
: ThehideLayer
function is defined usinguseCallback
and callslayersRef?.hide(...args)
.- Usage in
index.ts
andcommonReearth.ts
: The function is used as part of an object managing layers, consistent with its definition.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `hideLayer` callback. # Test: Search for the usage of `hideLayer` in the codebase. Expect: Correct definition and usage. rg --type ts $'hideLayer'Length of output: 756
Script:
#!/bin/bash # Get the definition and context of `hideLayer` in `useLayers.ts` rg --type ts -A 5 -B 5 $'const hideLayer = useCallback' web/src/beta/features/Visualizer/Crust/Plugins/hooks/useLayers.ts # Get the usage context of `hideLayer` in `index.ts` rg --type ts -A 5 -B 5 $'hideLayer' web/src/beta/features/Visualizer/Crust/Plugins/hooks/index.ts # Get the usage context of `hideLayer` in `commonReearth.ts` rg --type ts -A 5 -B 5 $'hideLayer' web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/commonReearth.tsLength of output: 2241
web/src/beta/features/Visualizer/Crust/Plugins/PluginFrame/SafeIFrame/hooks.ts (1)
149-152
: LGTM!The added calculations for
horizontalScrollbarHeight
andverticalScrollbarWidth
improve the accuracy of the reported dimensions by accounting for scrollbars.web/src/beta/features/Visualizer/Crust/Plugins/Plugin/hooks/index.ts (3)
1-12
: LGTM!The imports are necessary for the functionality of the file and appear to be correct.
15-33
: LGTM!The function signature is well-defined and the parameters cover all necessary aspects for plugin management.
64-179
: LGTM!The core logic is well-structured and follows best practices for React hooks and state management. The use of callbacks, effects, and memoization is appropriate.
web/src/beta/features/Visualizer/Crust/Plugins/PluginFrame/hooks.ts (2)
84-86
: LGTM! Improved reliability ofonDispose
callback handling.The use of
useRef
to store the current value ofonDispose
ensures that the most recent version of the callback is invoked during cleanup, enhancing the reliability of the hook's behavior.
210-210
: LGTM! Ensures the latestonDispose
is called during cleanup.Using
onDisposeRef.current
in the cleanup function ensures that the most recent version of theonDispose
callback is invoked, which is a good practice.web/src/beta/features/Visualizer/Crust/Plugins/hooks/useCamera.ts (5)
1-6
: LGTM! Necessary imports are included.The imports from React and other modules are standard and necessary for the functionality provided in the file.
25-35
: LGTM! Memoization ofcameraPosition
.Memoizing
cameraPosition
usinguseMemo
helps in optimizing performance by preventing unnecessary recalculations when thecamera
state changes.
37-40
: LGTM! Use ofuseGet
hooks.Using
useGet
forgetCameraPosition
,getCameraFov
, andgetCameraAspectRatio
ensures that the latest values are retrieved when needed, which is a good practice.
44-70
: LGTM! Use ofuseCallback
for camera actions.Wrapping camera actions like
zoomIn
,zoomOut
,setView
,flyTo
, etc., inuseCallback
helps in optimizing performance by preventing unnecessary re-creations of the functions.Also applies to: 72-84, 86-91, 93-96, 98-103, 105-110, 112-117, 119-124, 126-131, 133-150, 152-157, 159-164
166-177
: LGTM! Well-structured event handling and return object.The event handling using
useMemo
,useEmit
, anduseCallback
is well-structured. The return object provides a comprehensive API for camera-related actions and events.Also applies to: 179-195, 197-220
web/package.json (2)
117-117
: Verify the reason for the version change of@reearth/core
.The
@reearth/core
package version is updated from0.0.7-beta.0
to0.0.7-alpha.3
. This change could imply a rollback in versioning strategy or a reclassification of the package's stability. Please verify the reason for this version change.
206-206
: LGTM! Addition ofpackageManager
field.Adding the
packageManager
field helps clarify the environment setup for developers and could affect how dependencies are installed or managed in the project.web/src/beta/features/Visualizer/Crust/Plugins/storybook.tsx (10)
90-94
: LGTM! The engine property is now more structured.The nested structure for the
engine
property enhances clarity regarding the engine's identity and versioning.
95-129
: LGTM! The viewer object is well-structured.The new
viewer
object encapsulates various properties, providing a more organized approach to managing viewer-related settings.
132-152
: LGTM! The camera object enhancements are well-implemented.The expanded
camera
object with additional methods and properties improves the camera's configurability.
154-169
: LGTM! The timeline property is more descriptive and clear.Renaming
clock
totimeline
and the addition of methods for controlling playback and tracking state improve clarity in managing time-related functionalities.
170-177
: LGTM! The sketch property enhances functionality.The addition of the
sketch
property with methods likesetTool
andoverrideOptions
enhances functionality related to sketch tools.
178-203
: LGTM! The layers property is more comprehensive.The expanded
layers
property with methods for selecting, finding, and manipulating layers provides a more comprehensive API for layer interactions.
204-208
: LGTM! The extension property enhances functionality.The addition of the
extension
property with a getter for thelist
enhances functionality related to extensions.
230-231
: LGTM! The clientStorage property is more functional.The addition of the
dropStore
method to theclientStorage
property enhances functionality related to client storage.
232-232
: LGTM! The overrideViewerProperty method enhances functionality.The addition of the
overrideViewerProperty
method enhances functionality related to overriding viewer properties.
233-261
: LGTM! The event handling properties enhance interaction management.The addition of various event handling properties (
viewerEvents
,cameraEvents
, etc.) allows for better management of interactions within the visualization context.web/src/beta/features/Published/hooks.ts (5)
11-14
: LGTM! New imports are correctly added.The new imports
convertData
andsceneProperty2ViewerPropertyMapping
are correctly added and will be used in the code.
38-39
: LGTM! The initialCamera state variable improves camera state handling.The addition of the
initialCamera
state variable enhances the handling of camera states.
40-54
: LGTM! The useMemo hook modifications enhance viewer property management.The modifications to the
useMemo
hook to extractviewerProperty
,widgetThemeOptions
, andcesiumIonAccessToken
from the processed scene property enhance the ability to manage viewer properties in a more structured manner.
56-58
: LGTM! The useEffect hook improves camera state handling.The addition of the
useEffect
hook to set thecurrentCamera
to theinitialCamera
improves the handling of camera states.
263-268
: LGTM! The cesiumIonAccessToken logic is more reliable.The refined logic for determining the
cesiumIonAccessToken
ensures that the token used is valid, improving the reliability of the viewer's access to Cesium resources.web/src/beta/features/Visualizer/Crust/Plugins/hooks/useViewer.ts (10)
1-14
: LGTM! The imports are correctly added.The imports of various hooks and types are correctly added and will be used in the code.
16-41
: LGTM! The default export function is well-defined.The default export function is correctly defined with various properties and methods related to viewer management.
44-54
: LGTM! The useGet hook is correctly used.The
useGet
hook is correctly used to getviewerProperty
andviewport
.
55-60
: LGTM! The captureScreen method is well-defined.The
captureScreen
method is correctly defined usinguseCallback
.
62-66
: LGTM! The selectionModeEvents are correctly defined.The
selectionModeEvents
andemitSelectionModeEvent
are correctly defined usinguseMemo
.
68-84
: LGTM! The useEffect hooks are well-defined.The
useEffect
hooks are correctly defined to handle layer selection events.
86-107
: LGTM! The selectionModeEventsOn and selectionModeEventsOff methods are well-defined.The
selectionModeEventsOn
andselectionModeEventsOff
methods are correctly defined usinguseCallback
.
109-121
: LGTM! The getInteractionMode method is well-defined.The
getInteractionMode
method is correctly defined usinguseGet
anduseMemo
.
127-203
: LGTM! The utility methods are well-defined.The utility methods related to viewer management are correctly defined using
useCallback
.
205-275
: LGTM! The viewer event handling methods are well-defined.The
viewerEvents
andemit
are correctly defined usinguseMemo
, and various event handling methods are correctly defined usinguseCallback
.web/src/beta/features/Visualizer/Crust/Plugins/hooks/index.ts (6)
1-13
: LGTM! Imports are relevant.The import statements are appropriate and necessary for the functionality of the file.
15-40
: LGTM! Function signature is comprehensive and well-typed.The function signature includes all necessary props and is correctly typed.
41-74
: LGTM! Correct usage of useViewer hook.The useViewer hook is used correctly to retrieve all necessary viewer-related properties and methods.
76-102
: LGTM! Correct usage of useCamera hook.The useCamera hook is used correctly to retrieve all necessary camera-related properties and methods.
104-159
: LGTM! Correct usage of remaining hooks.The remaining hooks (useTimeline, useLayers, useSketch, useExtension, useData, useDeprecated) are used correctly to retrieve all necessary properties and methods.
161-351
: LGTM! Correct usage of useMemo hook.The useMemo hook is used correctly to create a context value.
web/src/beta/features/Editor/Visualizer/hooks.ts (6)
4-9
: LGTM! Imports are relevant.The import statements are appropriate and necessary for the functionality of the file.
62-68
: LGTM! Correct usage of state and callback hooks.The state variables and callback hooks are used correctly and efficiently.
78-90
: LGTM! Correct usage of useMemo hook.The useMemo hook is used correctly to compute viewerProperty and cesiumIonAccessToken.
92-94
: LGTM! Correct usage of useEffect hook.The useEffect hook is used correctly to synchronize the current camera with the initial camera.
281-286
: LGTM! Correct usage of useMemo hook for engineMeta.The useMemo hook is used correctly to compute engineMeta.
Line range hint
299-308
:
LGTM! Correct return statement.The return statement provides all necessary properties and methods.
web/src/beta/features/Visualizer/Crust/index.tsx (5)
Line range hint
1-20
:
LGTM! Imports are relevant.The import statements are appropriate and necessary for the functionality of the file.
60-67
: LGTM! Comprehensive and well-typed Props definition.The Props type definition includes all necessary properties and is correctly typed.
205-207
: LGTM! Correct usage of useEffect hook.The useEffect hook is used correctly to log the selectedLayer whenever it changes.
228-229
: LGTM! Correct usage of useWidgetContext hook.The useWidgetContext hook is used correctly to pass viewerProperty and initialCamera.
Line range hint
254-288
:
LGTM! Correct return statement and JSX structure.The return statement provides all necessary properties and methods related to viewer and widget management.
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/commonReearth.ts (6)
184-217
: Verify viewer properties and methods.Ensure that the viewer properties and methods are correctly defined and implemented.
Verification successful
Verified viewer properties and methods.
The viewer properties and methods are correctly defined and implemented in the
commonReearth.ts
file.
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/commonReearth.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify viewer properties and methods. # Test: Search for the definitions and implementations of the viewer properties and methods. Expect: Correct definitions and implementations. rg --type ts -A 5 $'viewer: {'Length of output: 113
Script:
#!/bin/bash # Description: Verify viewer properties and methods. # Test: Search for the definitions and implementations of the viewer properties and methods. Expect: Correct definitions and implementations. rg --type ts -A 20 'viewer: {'Length of output: 114
Script:
#!/bin/bash # Description: Verify viewer properties and methods. # Test: Search for the definitions and implementations of the viewer properties and methods. Expect: Correct definitions and implementations. rg --type ts -A 20 'viewer: \{'Length of output: 3841
1-9
: Verify import paths and type definitions.Ensure that the import paths are correct and the
CommonReearth
type definition is accurate and aligns with the rest of the codebase.
253-327
: Verify layers properties and methods.Ensure that the layers properties and methods are correctly defined and implemented.
175-349
: Ensure correct construction of the returned object.Verify that all properties and methods in the returned object are correctly defined and implemented.
328-343
: Verify sketch properties and methods.Ensure that the sketch properties and methods are correctly defined and implemented.
Verification successful
Let's correct the
rg
command and re-run the search to verify the definitions and implementations of the sketch properties and methods.
Let's correct the
rg
command by escaping both the curly braces and parentheses, and re-run the search to verify the definitions and implementations of the sketch properties and methods.
Let's search for the definitions and implementations of the methods and properties within the
sketch
object individually.
Let's search for the occurrences of these identifiers in the codebase to locate their definitions and implementations.
Verified sketch properties and methods.
The sketch properties and methods are correctly defined and implemented.
getSketchTool
is defined inweb/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/commonReearth.ts
andweb/src/beta/features/Visualizer/Crust/Plugins/hooks/useSketch.ts
.setSketchTool
is defined inweb/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/commonReearth.ts
andweb/src/beta/features/Visualizer/Crust/Plugins/hooks/useSketch.ts
.getSketchOptions
is defined inweb/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/commonReearth.ts
andweb/src/beta/features/Visualizer/Crust/Plugins/hooks/useSketch.ts
.overrideSketchOptions
is defined inweb/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/commonReearth.ts
andweb/src/beta/features/Visualizer/Crust/Plugins/hooks/useSketch.ts
.sketchEventsOn
is defined inweb/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/commonReearth.ts
andweb/src/beta/features/Visualizer/Crust/Plugins/hooks/useSketch.ts
.sketchEventsOff
is defined inweb/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/commonReearth.ts
andweb/src/beta/features/Visualizer/Crust/Plugins/hooks/useSketch.ts
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify sketch properties and methods. # Test: Search for the definitions and implementations of the sketch properties and methods. Expect: Correct definitions and implementations. rg --type ts -A 5 $'sketch: merge(sketchDeprecated, {'Length of output: 185
Script:
#!/bin/bash # Description: Verify sketch properties and methods. # Test: Search for the definitions and implementations of the sketch properties and methods. Expect: Correct definitions and implementations. rg --type ts -A 5 $'sketch: merge(sketchDeprecated, \{'Length of output: 155
Script:
#!/bin/bash # Description: Verify sketch properties and methods. # Test: Search for the definitions and implementations of the sketch properties and methods. Expect: Correct definitions and implementations. rg --type ts -A 5 $'sketch: merge\\(sketchDeprecated, \\{'Length of output: 651
Script:
#!/bin/bash # Description: Verify definitions and implementations of sketch properties and methods. # Test: Search for the definition of `getSketchTool`. rg --type ts 'function getSketchTool' # Test: Search for the definition of `setSketchTool`. rg --type ts 'function setSketchTool' # Test: Search for the definition of `getSketchOptions`. rg --type ts 'function getSketchOptions' # Test: Search for the definition of `overrideSketchOptions`. rg --type ts 'function overrideSketchOptions' # Test: Search for the definition of `sketchEventsOn`. rg --type ts 'function sketchEventsOn' # Test: Search for the definition of `sketchEventsOff`. rg --type ts 'function sketchEventsOff'Length of output: 253
Script:
#!/bin/bash # Description: Verify occurrences of sketch properties and methods. # Test: Search for occurrences of `getSketchTool`. rg --type ts 'getSketchTool' # Test: Search for occurrences of `setSketchTool`. rg --type ts 'setSketchTool' # Test: Search for occurrences of `getSketchOptions`. rg --type ts 'getSketchOptions' # Test: Search for occurrences of `overrideSketchOptions`. rg --type ts 'overrideSketchOptions' # Test: Search for occurrences of `sketchEventsOn`. rg --type ts 'sketchEventsOn' # Test: Search for occurrences of `sketchEventsOff`. rg --type ts 'sketchEventsOff'Length of output: 5011
218-249
: Verify camera properties and methods.Ensure that the camera properties and methods are correctly defined and implemented.
Verification successful
Verified camera properties and methods.
The camera properties and methods are correctly defined and implemented.
- The functions such as
getCameraPosition
,getCameraFov
,getCameraAspectRatio
,getCameraViewport
,zoomIn
,zoomOut
,setView
,flyTo
,flyToBoundingBox
,getGlobeIntersection
,enableScreenSpaceCameraController
,overrideScreenSpaceCameraController
,lookAt
,rotateAround
,rotateRight
,orbit
,move
,moveOverTerrain
,enableForceHorizontalRoll
,cameraEventsOn
, andcameraEventsOff
are correctly defined and implemented.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify camera properties and methods. # Test: Search for the definitions and implementations of the camera properties and methods. Expect: Correct definitions and implementations. rg --type ts -A 5 $'camera: merge(cameraDeprecated, {'Length of output: 185
Script:
#!/bin/bash # Description: Verify camera properties and methods. # Test: Search for the definitions and implementations of the camera properties and methods. Expect: Correct definitions and implementations. rg --type ts -A 5 $'camera: merge(cameraDeprecated, \\{'Length of output: 155
Script:
#!/bin/bash # Description: Verify camera properties and methods. # Test: Search for the definitions and implementations of the camera properties and methods. Expect: Correct definitions and implementations. rg --type ts -A 5 $'camera: merge\\(cameraDeprecated, \\{'Length of output: 656
Script:
#!/bin/bash # Description: Verify implementations of camera properties and methods. # Test: Search for the definitions and implementations of the methods and properties used within the camera object. Expect: Correct definitions and implementations. # Search for getCameraPosition function rg --type ts 'function getCameraPosition' # Search for getCameraFov function rg --type ts 'function getCameraFov' # Search for getCameraAspectRatio function rg --type ts 'function getCameraAspectRatio' # Search for getCameraViewport function rg --type ts 'function getCameraViewport' # Search for zoomIn function rg --type ts 'function zoomIn' # Search for zoomOut function rg --type ts 'function zoomOut' # Search for setView function rg --type ts 'function setView' # Search for flyTo function rg --type ts 'function flyTo' # Search for flyToBoundingBox function rg --type ts 'function flyToBoundingBox' # Search for getGlobeIntersection function rg --type ts 'function getGlobeIntersection' # Search for enableScreenSpaceCameraController function rg --type ts 'function enableScreenSpaceCameraController' # Search for overrideScreenSpaceCameraController function rg --type ts 'function overrideScreenSpaceCameraController' # Search for lookAt function rg --type ts 'function lookAt' # Search for rotateAround function rg --type ts 'function rotateAround' # Search for rotateRight function rg --type ts 'function rotateRight' # Search for orbit function rg --type ts 'function orbit' # Search for move function rg --type ts 'function move' # Search for moveOverTerrain function rg --type ts 'function moveOverTerrain' # Search for enableForceHorizontalRoll function rg --type ts 'function enableForceHorizontalRoll' # Search for cameraEventsOn function rg --type ts 'function cameraEventsOn' # Search for cameraEventsOff function rg --type ts 'function cameraEventsOff'Length of output: 868
Script:
#!/bin/bash # Description: Verify implementations of camera properties and methods. # Test: Search for the definitions and implementations of the methods and properties used within the camera object. Expect: Correct definitions and implementations. # Search for getCameraPosition rg --type ts 'getCameraPosition' # Search for getCameraFov rg --type ts 'getCameraFov' # Search for getCameraAspectRatio rg --type ts 'getCameraAspectRatio' # Search for getCameraViewport rg --type ts 'getCameraViewport' # Search for zoomIn rg --type ts 'zoomIn' # Search for zoomOut rg --type ts 'zoomOut' # Search for setView rg --type ts 'setView' # Search for flyTo rg --type ts 'flyTo' # Search for flyToBoundingBox rg --type ts 'flyToBoundingBox' # Search for getGlobeIntersection rg --type ts 'getGlobeIntersection' # Search for enableScreenSpaceCameraController rg --type ts 'enableScreenSpaceCameraController' # Search for overrideScreenSpaceCameraController rg --type ts 'overrideScreenSpaceCameraController' # Search for lookAt rg --type ts 'lookAt' # Search for rotateAround rg --type ts 'rotateAround' # Search for rotateRight rg --type ts 'rotateRight' # Search for orbit rg --type ts 'orbit' # Search for move rg --type ts 'move' # Search for moveOverTerrain rg --type ts 'moveOverTerrain' # Search for enableForceHorizontalRoll rg --type ts 'enableForceHorizontalRoll' # Search for cameraEventsOn rg --type ts 'cameraEventsOn' # Search for cameraEventsOff rg --type ts 'cameraEventsOff'Length of output: 199882
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/exposedReearth.ts (4)
106-123
: Verify viewer properties and methods.Ensure that the viewer properties and methods are correctly defined and implemented.
Verification successful
Viewer properties and methods are correctly defined and implemented.
The
viewer
object and its properties, includingoverrideProperty
andtools.getTerrainHeightAsync
, are correctly defined and implemented in theexposedReearth.ts
file.
viewer: merge(commonReearth.viewer, { ... })
overrideProperty
methodtools.getTerrainHeightAsync
methodScripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify viewer properties and methods. # Test: Search for the definitions and implementations of the viewer properties and methods. Expect: Correct definitions and implementations. rg --type ts -A 5 $'viewer: merge(commonReearth.viewer, {'Length of output: 197
Script:
#!/bin/bash # Description: Verify viewer properties and methods. # Test: Search for the definitions and implementations of the viewer properties and methods. Expect: Correct definitions and implementations. rg --type ts -A 10 $'viewer: merge\\(commonReearth.viewer, \\{'Length of output: 1419
1-9
: Verify import paths and function parameters.Ensure that the import paths are correct and the function parameters are accurately defined.
Verification successful
Let's correct the regex parse error and re-run the script to verify the import paths and function parameters.
Let's escape the special characters in the search pattern and re-run the script to verify the import paths and function parameters.
Verification successful: Import paths and function parameters are correctly defined.
- The import path for
merge
from@reearth/beta/utils/object
is accurate and present in the expected file.- The surrounding import statements are also correctly defined.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify import paths and function parameters. # Test: Search for the import paths and function parameters. Expect: Correct paths and definitions. rg --type ts -A 5 $'import { merge } from "@reearth/beta/utils/object"'Length of output: 214
Script:
#!/bin/bash # Description: Verify import paths and function parameters. # Test: Search for the import paths and function parameters. Expect: Correct paths and definitions. rg --type ts -A 5 'import { merge } from "@reearth/beta/utils/object"'Length of output: 214
Script:
#!/bin/bash # Description: Verify import paths and function parameters. # Test: Search for the import paths and function parameters. Expect: Correct paths and definitions. rg --type ts -A 5 'import \{ merge \} from "@reearth/beta/utils/object"'Length of output: 1482
124-220
: Verify timeline properties and methods.Ensure that the timeline properties and methods are correctly defined and implemented.
Verification successful
Verified timeline properties and methods.
The
timeline
properties and methods (play
,pause
,setTime
,setSpeed
) are correctly defined and implemented. They commit the appropriate commands to thetimelineManagerRef
with the necessary payload and committer information.
play
method commits the "PLAY" command.pause
method commits the "PAUSE" command.setTime
method commits the "SET_TIME" command with the time payload.setSpeed
method commits the "SET_OPTIONS" command with the speed payload.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify timeline properties and methods. # Test: Search for the definitions and implementations of the timeline properties and methods. Expect: Correct definitions and implementations. rg --type ts -A 5 $'timeline: merge(commonReearth.timeline, {'Length of output: 209
Script:
#!/bin/bash # Description: Verify timeline properties and methods. # Test: Search for the definitions and implementations of the timeline properties and methods. Expect: Correct definitions and implementations. rg --type ts -A 50 'timeline: merge(commonReearth.timeline, {'Length of output: 210
Script:
#!/bin/bash # Description: Verify timeline properties and methods. # Test: Search for the definitions and implementations of the timeline properties and methods. Expect: Correct definitions and implementations. rg --type ts -A 50 'timeline: merge(commonReearth.timeline'Length of output: 166
Script:
#!/bin/bash # Description: Verify timeline properties and methods. # Test: Search for the definitions and implementations of the timeline properties and methods. Expect: Correct definitions and implementations. rg --type ts -A 50 'timeline: merge'Length of output: 5570
100-364
: Ensure correct construction of the returned object.Verify that all properties and methods in the returned object are correctly defined and implemented.
web/src/beta/features/Visualizer/Crust/Plugins/hooks/useDeprecated.ts (5)
308-320
: Ensure correct implementation of the warning function.Verify that the warning function is correctly defined and implemented.
Verification successful
The
warning
function is correctly defined and implemented.The function logs a warning message for deprecated properties and methods, including suggestions if available.
- Location:
web/src/beta/features/Visualizer/Crust/Plugins/hooks/useDeprecated.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of the warning function. # Test: Search for the definitions and implementations of the warning function. Expect: Correct definitions and implementations. rg --type ts -A 5 $'function warning(name: string, additional?: string) {'Length of output: 245
Script:
#!/bin/bash # Description: Verify the implementation of the warning function. # Test: Search for the definitions and implementations of the warning function. Expect: Correct definitions and implementations. rg --type ts -A 5 $'function warning(name: string, additional?: string) \\{'Length of output: 76
Script:
#!/bin/bash # Description: Verify the implementation of the warning function. # Test: Search for the definitions and implementations of the warning function. Expect: Correct definitions and implementations. rg --type ts -A 5 'function warning'Length of output: 690
274-304
: Ensure correct implementation of utility functions.Verify that the utility functions are correctly defined and implemented.
Verification successful
The utility functions
addProperty
,addWarning
, andaddEventWarning
are correctly defined and implemented.The definitions and implementations of the utility functions
addProperty
,addWarning
, andaddEventWarning
were found in the specified file, and they match the expected structure.
addProperty
: Found atweb/src/beta/features/Visualizer/Crust/Plugins/hooks/useDeprecated.ts
addWarning
: Found atweb/src/beta/features/Visualizer/Crust/Plugins/hooks/useDeprecated.ts
addEventWarning
: Found atweb/src/beta/features/Visualizer/Crust/Plugins/hooks/useDeprecated.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of the utility functions. # Test: Search for the definitions and implementations of the utility functions. Expect: Correct definitions and implementations. rg --type ts -A 5 $'function addProperty(obj: object, name: string, value: unknown) {'Length of output: 281
Script:
#!/bin/bash # Description: Verify the implementation of the utility functions. # Test: Search for the definitions and implementations of the utility functions. Expect: Correct definitions and implementations. rg --type ts -A 5 'function addProperty\(obj: object, name: string, value: unknown\) {'Length of output: 287
Script:
#!/bin/bash # Description: Verify the implementation of the utility functions. # Test: Search for the definitions and implementations of the utility functions. Expect: Correct definitions and implementations. rg --type ts -A 5 'function addProperty\(obj: object, name: string, value: unknown\) \{'Length of output: 675
Script:
#!/bin/bash # Description: Verify the implementation of the utility functions `addWarning` and `addEventWarning`. # Test: Search for the definitions and implementations of the utility functions. Expect: Correct definitions and implementations. rg --type ts -A 5 'function addWarning\(obj: object, name: string, value: string\) \{' rg --type ts -A 5 'function addEventWarning\(obj: object, name: string, isOnce = false\) \{'Length of output: 1401
1-5
: Verify import paths and type definition.Ensure that the import paths are correct and the
Props
type definition is accurate and aligns with the rest of the codebase.Verification successful
Let's correct the regex pattern and re-run the search to verify the import paths and type definitions.
Let's use
ast-grep
to search for the import statement and verify the type definition.
Let's use
ast-grep
to search for theProps
type definition and verify its usage.
Verification successful for import paths and type definition.
- The import statement for
useMemo
from "react" is correctly used.- The
Props
type definition is accurately implemented.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify import paths and type definitions. # Test: Search for the import paths and type definitions. Expect: Correct paths and definitions. rg --type ts -A 5 $'import { useMemo } from "react"'Length of output: 176
Script:
#!/bin/bash # Description: Verify import paths and type definitions. # Test: Search for the import paths and type definitions. Expect: Correct paths and definitions. rg --type ts -A 5 'import { useMemo } from "react"'Length of output: 176
Script:
#!/bin/bash # Description: Verify import paths and type definitions using ast-grep. # Test: Search for the import statement and type definition. ast-grep --lang typescript --pattern $'import { useMemo } from "react"'Length of output: 609
Script:
#!/bin/bash # Description: Verify `Props` type definition using ast-grep. # Test: Search for the `Props` type definition. ast-grep --lang typescript --pattern $'type Props = {\n built?: boolean;\n}'Length of output: 335
7-160
: Ensure correct implementation of the hook.Verify that the hook implementation is correct and all deprecated properties and methods are accurately defined.
Verification successful
Let's correct the regex pattern by escaping the
{
character and try again.
Let's simplify the regex pattern to avoid issues with special characters and search for the function implementation in a more reliable way.
To ensure that all deprecated properties and methods are correctly defined and implemented, we need to verify the implementations of the
addWarning
andaddProperty
functions used in the hook.
Verified: The hook implementation is correct.
The hook correctly defines deprecated properties and methods using
useMemo
, and the helper functionsaddWarning
andaddProperty
are implemented as expected.
addWarning
defines properties with custom getters that return warning messages.addProperty
defines properties with custom getters that return specified values.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of the hook. # Test: Search for the definitions and implementations of the deprecated properties and methods. Expect: Correct definitions and implementations. rg --type ts -A 5 $'export default ({ built }: Props) => {'Length of output: 190
Script:
#!/bin/bash # Description: Verify the implementation of the hook. # Test: Search for the definitions and implementations of the deprecated properties and methods. Expect: Correct definitions and implementations. rg --type ts -A 5 $'export default (\\{ built \\}: Props) => {'Length of output: 206
Script:
#!/bin/bash # Description: Verify the implementation of the hook. # Test: Search for the definitions and implementations of the deprecated properties and methods. Expect: Correct definitions and implementations. rg --type ts -A 10 'export default \(\{ built \}: Props\) => \{'Length of output: 1189
Script:
#!/bin/bash # Description: Verify the implementations of the addWarning and addProperty functions. # Test: Search for the definitions of the addWarning and addProperty functions. Expect: Correct definitions and implementations. rg --type ts 'function addWarning' -A 10 rg --type ts 'function addProperty' -A 10Length of output: 2189
163-272
: Verify deprecated map.Ensure that the deprecated map is accurate and all mappings are correctly defined.
Verification successful
Let's correct the regex pattern and rerun the search to verify the deprecated map.
Let's correct the regex pattern by escaping the
{
character and rerun the search to verify the deprecated map.
To ensure the deprecated map is accurate, we need to verify the usage of the deprecated properties and methods across the codebase.
Verified deprecated map.
The deprecated map in
web/src/beta/features/Visualizer/Crust/Plugins/hooks/useDeprecated.ts
accurately defines the mappings from deprecated properties and methods to their new counterparts.
- Location:
web/src/beta/features/Visualizer/Crust/Plugins/hooks/useDeprecated.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the deprecated map. # Test: Search for the definitions and implementations of the deprecated map. Expect: Correct definitions and implementations. rg --type ts -A 5 $'const deprecatedMap = {'Length of output: 155
Script:
#!/bin/bash # Description: Verify the deprecated map. # Test: Search for the definitions and implementations of the deprecated map. Expect: Correct definitions and implementations. rg --type ts -A 5 'const deprecatedMap = {'Length of output: 155
Script:
#!/bin/bash # Description: Verify the deprecated map. # Test: Search for the definitions and implementations of the deprecated map. Expect: Correct definitions and implementations. rg --type ts -A 5 'const deprecatedMap = \{'Length of output: 776
Script:
#!/bin/bash # Description: Verify the usage of deprecated properties and methods in the codebase. # Test: Search for the usage of deprecated properties and methods. Expect: Correct usage and mapping. rg --type ts 'reearth\.(engineName|visualizer\.engine|visualizer\.camera|visualizer\.property|visualizer\.overrideProperty|scene\.inEditor|scene\.built|scene\.captureScreen|scene\.getLocationFromScreen|scene\.sampleTerrainHeight|scene\.computeGlobeHeight|scene\.getGlobeHeight|scene\.toXYZ|scene\.toLngLatHeight|scene\.convertScreenToPositionOffset|scene\.isPositionVisible|scene\.toWindowPosition|scene\.pickManyFromViewport|clock\.startTime|clock\.stopTime|clock\.currentTime|clock\.playing|clock\.paused|clock\.speed|clock\.stepType|clock\.rangeType|clock\.tick|clock\.play|clock\.pause|clock\.setTime|clock\.setSpeed|clock\.setStepType|clock\.setRangeType|interactionMode\.mode|interactionMode\.override|plugins\.instances|plugins\.postMessage|plugin\.id|plugin\.extensionId|plugin\.property|camera\.getFovInfo|camera\.flyToBBox|camera\.rotateOnCenter|camera\.lookHorizontal|camera\.lookVertical|camera\.moveForward|camera\.moveBackward|camera\.moveUp|camera\.moveDown|camera\.moveLeft|camera\.moveRight|camera\.flyToGround|camera\.overrideScreenSpaceController|layers\.overrideProperty|layers\.overriddenProperties|camera\.forceHorizontalRoll|sketch\.setType|sketch\.setColor|sketch\.disableShadow|sketch\.setDefaultAppearance|sketch\.createDataOnly|sketch\.enableRelativeHeight|sketch\.allowRightClickToAbort|sketch\.allowAutoResetInteractionMode|clientStorage\.getAsync|clientStorage\.setAsync|clientStorage\.deleteAsync|clientStorage\.keysAsync|clientStorage\.dropStore|event\supdate|event\sclose|event\scameramove|event\slayeredit|event\sselect|event\smessage|event\sclick|event\sdoubleclick|event\smousedown|event\smouseup|event\srightclick|event\srightdown|event\srightup|event\smiddleclick|event\smiddledown|event\smiddleup|event\smousemove|event\smouseenter|event\smouseleave|event\swheel|event\stick|event\stimelinecommit|event\sresize|event\smodalclose|event\spopupclose|event\spluginmessage|event\ssketchfeaturecreated|event\ssketchtypechange|event\slayerVisibility|event\slayerload|event\slayerSelectWithRectStart|event\slayerSelectWithRectMove|event\slayerSelectWithRectEnd)'Length of output: 11670
web/src/beta/features/Visualizer/Crust/Plugins/Plugin/hooks/usePluginAPI.ts (10)
87-89
: OptimizeuseGet
hook usage.The
useGet
hook is used forlayer
,block
, andwidget
. Ensure that this hook is necessary and not redundant.Are these hooks necessary, or can the values be accessed directly?
117-119
: Ensure proper message handling.The
pluginMessageSender
callback sends messages toextensionEvents
. Ensure that message handling is correctly implemented and consider adding error handling.Are there any edge cases where message handling might fail?
121-174
: Verify event initialization and merging.The
onPreInit
callback initializes and merges various events. Ensure that all necessary events are correctly initialized and merged.Are all required events being initialized and merged correctly?
176-198
: Ensure proper cleanup inonDispose
.The
onDispose
callback handles cleanup of events and states. Ensure that all necessary cleanup actions are performed to avoid memory leaks.Are there any resources or events that are not being properly cleaned up?
208-211
: OptimizeisMarshalable
callback.The
isMarshalable
callback checks if a target is marshalable. Ensure that this check is efficient and covers all necessary cases.Is the marshalable check comprehensive and efficient?
213-393
: ReviewstaticExposed
memoization.The
staticExposed
memoization creates an exposed API for the plugin. Ensure that all necessary properties and methods are correctly exposed and consider adding error handling.Are all required properties and methods correctly exposed?
395-397
: EnsureuiEvents
update handling.The
useEffect
hook updatesuiEvents
on changes toblock
,layer
,widget
, orctx.reearth.viewer.property
. Ensure that this update is necessary and correctly implemented.Is the
uiEvents
update necessary and correctly implemented?
399-405
: Ensure proper modal and popup close handling.The
onModalClose
andonPopupClose
callbacks handle closing of modals and popups. Ensure that these callbacks are correctly implemented and consider adding error handling.Are the modal and popup close handlers correctly implemented?
407-414
: LGTM!The return object from
usePluginAPI
looks good and includes all necessary properties and methods.
417-433
: LGTM!The
initAndMergeEvents
function correctly initializes and merges events.web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/pluginAPIv1Types.ts (6)
114-114
: Ensurelayer
property is always defined.The
layer
property is now required. Ensure that all instances ofReearth
have this property defined.Are there any instances of
Reearth
where thelayer
property might be undefined?
118-118
: Ensureviewer
property is always defined.The
viewer
property is now required. Ensure that all instances ofReearth
have this property defined.Are there any instances of
Reearth
where theviewer
property might be undefined?
186-189
: Ensureproperty
andoverrideProperty
removal is handled.The
property
andoverrideProperty
fields have been removed from theScene
type. Ensure that all instances where these fields were used are updated accordingly.Are there any instances where
property
andoverrideProperty
are still being used in the codebase?
186-189
: LGTM!The new
Viewer
type definition looks good and includes the necessary fields.
Line range hint
1-42
: LGTM!The import statements have been correctly adjusted to reflect changes in the type definitions.
1-1
: LGTM!The deprecation note clearly indicates that the plugin API v1 is deprecated.
web/src/beta/features/Visualizer/Crust/Plugins/hooks/useCommonEvents.ts
Outdated
Show resolved
Hide resolved
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/timeline.ts
Outdated
Show resolved
Hide resolved
web/src/beta/features/Visualizer/Crust/Plugins/Plugin/hooks/usePluginAPI.ts
Show resolved
Hide resolved
web/src/beta/features/Visualizer/Crust/Plugins/Plugin/hooks/usePluginAPI.ts
Outdated
Show resolved
Hide resolved
web/src/beta/features/Visualizer/Crust/Plugins/hooks/useTimeline.ts
Outdated
Show resolved
Hide resolved
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/reearth.ts
Show resolved
Hide resolved
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/commonReearth.ts
Show resolved
Hide resolved
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/exposedReearth.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Outside diff range, codebase verification and nitpick comments (2)
web/src/beta/features/Visualizer/Crust/Plugins/Plugin/hooks/usePluginAPI.ts (2)
122-175
: Add comments for better readability.The
onPreInit
function is well-structured but can benefit from additional comments to explain the purpose of each block of code.
214-403
: Add comments for better readability.The
staticExposed
function is well-structured but can benefit from additional comments to explain the purpose of each block of code.Tools
Biome
[error] 240-240: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
[error] 241-241: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (14)
- web/src/beta/features/Editor/Visualizer/convert-infobox.ts (2 hunks)
- web/src/beta/features/Editor/Visualizer/convert-story.ts (2 hunks)
- web/src/beta/features/Visualizer/Crust/Infobox/Block/index.tsx (1 hunks)
- web/src/beta/features/Visualizer/Crust/Infobox/types.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/Plugin/hooks/usePluginAPI.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/hooks/useExtension.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/exposedReearth.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/extension.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/usePluginInstances.ts (4 hunks)
- web/src/beta/features/Visualizer/Crust/StoryPanel/Block/index.tsx (1 hunks)
- web/src/beta/features/Visualizer/Crust/StoryPanel/types.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/hooks.tsx (2 hunks)
- web/src/beta/features/Visualizer/Crust/index.tsx (11 hunks)
- web/src/beta/features/Visualizer/shared/components/BlockWrapper/index.tsx (7 hunks)
Files skipped from review due to trivial changes (2)
- web/src/beta/features/Visualizer/Crust/Infobox/Block/index.tsx
- web/src/beta/features/Visualizer/Crust/StoryPanel/Block/index.tsx
Files skipped from review as they are similar to previous changes (5)
- web/src/beta/features/Visualizer/Crust/Plugins/hooks/useExtension.ts
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/exposedReearth.ts
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/extension.ts
- web/src/beta/features/Visualizer/Crust/Plugins/usePluginInstances.ts
- web/src/beta/features/Visualizer/Crust/hooks.tsx
Additional context used
Biome
web/src/beta/features/Visualizer/Crust/Plugins/Plugin/hooks/usePluginAPI.ts
[error] 240-240: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
[error] 241-241: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
Additional comments not posted (20)
web/src/beta/features/Visualizer/Crust/StoryPanel/types.ts (2)
28-32
: Enhancement: New properties for better plugin integration.The new properties
extensionType
,propertyForPluginAPI
, andpropertyItemsForPluginBlock
improve the expressiveness and integration with plugins.
35-38
: Enhancement: Variant type for specific use cases.The
PluginStoryBlock
type omitspropertyForPluginAPI
andpropertyItemsForPluginBlock
, creating a variant ofStoryBlock
for specific use cases.web/src/beta/features/Editor/Visualizer/convert-infobox.ts (2)
25-25
: Enhancement: Explicit block type categorization.The
extensionType
property categorizes the block type as"infoboxBlock"
, improving clarity.
27-29
: Enhancement: Improved property handling for plugin integration.The
propertyForPluginAPI
field is introduced, andpluginBlockPropertyItems
is renamed topropertyItemsForPluginBlock
, improving structure and clarity.web/src/beta/features/Visualizer/Crust/Infobox/types.ts (2)
26-30
: Enhancement: New properties for better plugin integration.The new properties
extensionType
,propertyForPluginAPI
, andpropertyItemsForPluginBlock
improve the expressiveness and integration with plugins.
33-36
: Enhancement: Variant type for specific use cases.The
PluginInfoboxBlock
type omitspropertyForPluginAPI
andpropertyItemsForPluginBlock
, creating a variant ofInfoboxBlock
for specific use cases.web/src/beta/features/Editor/Visualizer/convert-story.ts (2)
10-11
: Ensure clarity in property processing imports.The aliasing of
processProperty
asprocessNewProperty
and importing the originalprocessProperty
from./convert
is clear. Ensure that this restructuring is well-documented to avoid confusion.
43-45
: Ensure consistency in property processing.The use of
processNewProperty
for theproperty
field and the introduction ofpropertyForPluginAPI
using the originalprocessProperty
is a good separation of concerns. Ensure that the usage of these fields is consistent throughout the codebase.web/src/beta/features/Visualizer/shared/components/BlockWrapper/index.tsx (5)
6-6
: Ensure correct usage ofFlyTo
.The addition of the
FlyTo
import indicates new functionality for fly-to actions. Ensure that this new functionality is correctly integrated and tested.
33-33
: Prop renaming improves clarity.The renaming of
pluginBlockPropertyItems
topropertyItemsForPluginBlock
enhances clarity regarding its purpose.
62-62
: NewonFlyTo
prop added.The addition of the
onFlyTo
prop allows for more flexible handling of fly-to actions. Ensure that this new prop is correctly integrated and tested.
73-73
: Prop renaming applied in component.The
propertyItemsForPluginBlock
prop is now used in the component, aligning with the new naming convention.
86-86
: NewonFlyTo
prop integration.The
onFlyTo
prop is now passed to thePropertyItem
component, enhancing the reusability of the fly-to functionality. Ensure that this integration is correctly tested.web/src/beta/features/Visualizer/Crust/index.tsx (3)
4-11
: Ensure correct usage of new imports.The expanded imports for
Camera
,ViewerProperty
, and related types indicate new functionality for managing camera and viewer properties. Ensure that these new types are correctly integrated and used throughout the component.
60-67
: Props type updated for viewer-centric approach.The
Props
type now includes new properties for camera and viewer management, and thesceneProperty
has been removed. This shift towards a more viewer-centric approach is likely to improve interaction with viewer-specific settings.
Line range hint
152-259
:
Crust component updated for dynamic visual element management.The
Crust
component now reflects the new props structure, focusing on viewer properties and camera management. These changes enhance the component's ability to manage visual elements dynamically, improving the user experience.web/src/beta/features/Visualizer/Crust/Plugins/Plugin/hooks/usePluginAPI.ts (4)
33-50
: Ensure consistent parameter typing.Some parameters such as
pluginProperty
andlayer
are typed asany
orundefined
. Consider using more specific types for better type safety.- pluginProperty: any; - layer: Layer | undefined; + pluginProperty: PluginPropertyType; // Replace with actual type + layer?: Layer;
92-116
: Combine similar event refs initialization.The event refs initialization for
viewerEventsRef
,selectionModeEventsRef
,cameraEventsRef
, etc., follow a similar pattern. Consider creating a helper function to reduce redundancy.- const viewerEventsRef = - useRef<[Events<ViewerEventType>, EventEmitter<ViewerEventType>, (() => void) | undefined]>(); - const selectionModeEventsRef = - useRef< - [ - Events<SelectionModeEventType>, - EventEmitter<SelectionModeEventType>, - (() => void) | undefined, - ] - >(); - const cameraEventsRef = - useRef<[Events<CameraEventType>, EventEmitter<CameraEventType>, (() => void) | undefined]>(); - const timelineEventsRef = - useRef< - [Events<TimelineEventType>, EventEmitter<TimelineEventType>, (() => void) | undefined] - >(); - const layersEventsRef = - useRef<[Events<LayersEventType>, EventEmitter<LayersEventType>, (() => void) | undefined]>(); - const sketchEventsRef = - useRef<[Events<SketchEventType>, EventEmitter<SketchEventType>, (() => void) | undefined]>(); + const createEventRef = <T>() => + useRef<[Events<T>, EventEmitter<T>, (() => void) | undefined]>(); + const viewerEventsRef = createEventRef<ViewerEventType>(); + const selectionModeEventsRef = createEventRef<SelectionModeEventType>(); + const cameraEventsRef = createEventRef<CameraEventType>(); + const timelineEventsRef = createEventRef<TimelineEventType>(); + const layersEventsRef = createEventRef<LayersEventType>(); + const sketchEventsRef = createEventRef<SketchEventType>();
177-207
: LGTM!The
onDispose
function is well-structured and handles cleanup effectively.
209-212
: LGTM!The
isMarshalable
function is concise and correctly uses theuseCallback
hook.
web/src/beta/features/Visualizer/Crust/Plugins/Plugin/hooks/usePluginAPI.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
web/yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
Files selected for processing (6)
- web/package.json (2 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/Plugin/hooks/usePluginAPI.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/hooks/index.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/hooks/useTimeline.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/timeline.ts (1 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/utils/events.ts (1 hunks)
Files skipped from review as they are similar to previous changes (5)
- web/package.json
- web/src/beta/features/Visualizer/Crust/Plugins/Plugin/hooks/usePluginAPI.ts
- web/src/beta/features/Visualizer/Crust/Plugins/hooks/index.ts
- web/src/beta/features/Visualizer/Crust/Plugins/hooks/useTimeline.ts
- web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/timeline.ts
Additional context used
Biome
web/src/beta/features/Visualizer/Crust/Plugins/utils/events.ts
[error] 94-94: Avoid the use of spread (
...
) syntax on accumulators.Spread syntax should be avoided on accumulators (like those in
.reduce
) because it causes a time complexity ofO(n^2)
.
Consider methods such as .splice or .push instead.(lint/performance/noAccumulatingSpread)
Additional comments not posted (7)
web/src/beta/features/Visualizer/Crust/Plugins/utils/events.ts (7)
58-61
: Fix potential issue inoff
method.The
off
method should use the original callback instead of the event callback for deletion.const off = <T extends keyof E>(type: T, callback: EventCallback<E[T]>) => { const ecb = getEventCallback(type, callback); e.removeEventListener(String(type), ecb); - deleteEventCallback(type, ecb); + deleteEventCallback(type, callback); };
44-51
: ImprovedeleteEventCallback
function.The
deleteEventCallback
function should also delete the key from thecallbacks
map if the map becomes empty after deletion.const deleteEventCallback = (type: keyof E, cb: EventCallback): void => { const ecbs = callbacks.get(type); if (ecbs) { ecbs.delete(cb); if (ecbs.size === 0) { callbacks.delete(type); } } };
92-99
: Optimize reduce accumulator.Avoid using spread syntax in the reduce accumulator to improve performance.
const cbs = types.reduce<{ [T in keyof E]: EventCallback<E[T]> }>( (a, b) => { - ...a, - [b]: (...args: E[typeof b]) => { - dest(b, ...args); - }, + a[b] = (...args: E[typeof b]) => { + dest(b, ...args); + }; + return a; }, {} as any, );Tools
Biome
[error] 94-94: Avoid the use of spread (
...
) syntax on accumulators.Spread syntax should be avoided on accumulators (like those in
.reduce
) because it causes a time complexity ofO(n^2)
.
Consider methods such as .splice or .push instead.(lint/performance/noAccumulatingSpread)
113-124
: LGTM!The
useEmit
function is correctly implemented and follows best practices.
18-85
: LGTM!The
events
function is correctly implemented and follows best practices.
87-111
: LGTM!The
mergeEvents
function is correctly implemented and follows best practices.Tools
Biome
[error] 94-94: Avoid the use of spread (
...
) syntax on accumulators.Spread syntax should be avoided on accumulators (like those in
.reduce
) because it causes a time complexity ofO(n^2)
.
Consider methods such as .splice or .push instead.(lint/performance/noAccumulatingSpread)
113-124
: LGTM!The
useEmit
function is correctly implemented and follows best practices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
web/yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
Files selected for processing (2)
- web/package.json (2 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/Plugin/hooks/usePluginAPI.ts (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- web/package.json
- web/src/beta/features/Visualizer/Crust/Plugins/Plugin/hooks/usePluginAPI.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files ignored due to path filters (1)
web/yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
,!**/*.lock
Files selected for processing (2)
- web/package.json (1 hunks)
- web/src/beta/features/Visualizer/shared/components/BlockWrapper/index.tsx (7 hunks)
Files skipped from review as they are similar to previous changes (2)
- web/package.json
- web/src/beta/features/Visualizer/shared/components/BlockWrapper/index.tsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- web/src/beta/features/Visualizer/Crust/Plugins/utils/events.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- web/src/beta/features/Visualizer/Crust/Plugins/utils/events.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files ignored due to path filters (1)
web/yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
,!**/*.lock
Files selected for processing (6)
- web/package.json (2 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/Plugin/ModalContainer/index.tsx (2 hunks)
- web/src/beta/features/Visualizer/Crust/Plugins/Plugin/PopupContainer/index.tsx (1 hunks)
- web/src/beta/features/Visualizer/Crust/StoryPanel/Block/index.tsx (1 hunks)
- web/src/beta/features/Visualizer/index.tsx (10 hunks)
- web/src/beta/features/Visualizer/shared/components/BlockWrapper/index.tsx (7 hunks)
Files skipped from review due to trivial changes (1)
- web/src/beta/features/Visualizer/Crust/Plugins/Plugin/PopupContainer/index.tsx
Files skipped from review as they are similar to previous changes (4)
- web/package.json
- web/src/beta/features/Visualizer/Crust/Plugins/Plugin/ModalContainer/index.tsx
- web/src/beta/features/Visualizer/Crust/StoryPanel/Block/index.tsx
- web/src/beta/features/Visualizer/shared/components/BlockWrapper/index.tsx
Additional comments not posted (5)
web/src/beta/features/Visualizer/index.tsx (5)
12-12
: LGTM! New imports are appropriate.The import statements for
ViewerProperty
andWidgetThemeOptions
are necessary for the new properties added toVisualizerProps
.Also applies to: 22-22
49-49
: LGTM! EnhancedVisualizerProps
type definition.The changes to
VisualizerProps
by replacingsceneProperty
withviewerProperty
, and addinginitialCamera
andwidgetThemeOptions
improve the component's flexibility and functionality.Also applies to: 59-59, 72-72
141-141
: LGTM! UpdatedVisualizer
component definition.The updates to use
viewerProperty
,initialCamera
, andwidgetThemeOptions
align with the changes made toVisualizerProps
and ensure effective utilization of the new properties.Also applies to: 147-147, 165-165
183-191
: LGTM! UpdateduseHooks
function call.The update to include
viewerProperty
ensures that the component now relies on this property to manage its internal state more effectively.
206-206
: LGTM! Updated rendering logic.The updates to utilize
viewerProperty
andinitialCamera
align with the changes made toVisualizerProps
and ensure consistency in the component's rendering logic.Also applies to: 227-233
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (2)
- web/src/beta/features/Visualizer/Crust/StoryPanel/Block/index.tsx (1 hunks)
- web/src/beta/features/Visualizer/shared/components/BlockWrapper/index.tsx (7 hunks)
Files skipped from review as they are similar to previous changes (2)
- web/src/beta/features/Visualizer/Crust/StoryPanel/Block/index.tsx
- web/src/beta/features/Visualizer/shared/components/BlockWrapper/index.tsx
Overview
This PR
What I've done
What I haven't done
How I tested
Which point I want you to review particularly
Memo
Summary by CodeRabbit
Summary by CodeRabbit
New Features
onFlyTo
prop in theBlockWrapper
component for flexible handling of fly-to actions.clickBgToClose
property for improved user interaction.Changes
pluginBlockPropertyItems
prop topropertyItemsForPluginBlock
for clarity in multiple components.