-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor components to function-based syntax #8
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
Conversation
Refactor components to use function-based syntax instead of class-based syntax. * **Controls.svelte** - Refactor to use function-based syntax. - Replace class-based syntax with function-based syntax. - Update event handling to use callback props. * **Graph.svelte** - Refactor to use function-based syntax. - Replace class-based syntax with function-based syntax. - Update event handling to use callback props. - Replace `$props` with individual prop declarations. - Update reactivity syntax to use `$derived` and `$effect`.
Reviewer's Guide by SourceryThis pull request refactors the Svelvet components to use function-based syntax instead of class-based syntax. This includes converting the component's state and props to use the new syntax, as well as updating event handling to use callback props. Class diagram showing the Graph component refactoringclassDiagram
class Graph {
+graph: Graph
+width: number
+height: number
+minimap: boolean
+controls: boolean
+toggle: boolean
+fixedZoom: boolean
+pannable: boolean
+disableSelection: boolean
+ZOOM_INCREMENT: number
+PAN_INCREMENT: number
+PAN_TIME: number
+MAX_SCALE: number
+MIN_SCALE: number
+selectionColor: CSSColorString
+backgroundExists: boolean
+fitView: boolean
+trackpadPan: boolean
+modifier: string
+theme: string
+title: string
+drawer: boolean
+contrast: boolean
-animationFrameId: number
-initialDistance: number
-initialScale: number
-anchor: object
-selecting: boolean
-creating: boolean
-adding: boolean
-isMovable: boolean
-pinching: boolean
-initialFit: boolean
-graphDimensions: GraphDimensions
+onMouseUp()
+onMouseDown()
+handleKeyDown()
+handleScroll()
+fitIntoView()
}
note for Graph "Refactored from class-based to function-based syntax"
Class diagram showing the Controls component refactoringclassDiagram
class Controls {
+increment: number
+horizontal: boolean
+onZoomIn: function
+onZoomOut: function
+onFit: function
+onLock: function
+onHide: function
+onUnhideAll: function
-transforms: Graph['transforms']
-dimensions: Graph['dimensions']
-locked: Graph['locked']
-groups: Graph['groups']
-bounds: Graph['bounds']
+unhideAll()
+zoomIn()
+zoomOut()
+fit()
+lock()
}
note for Controls "Converted from class-based to function-based component"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @jknohr - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider using arrow functions consistently throughout the codebase for better style consistency with the modern function-based approach
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Refactor components to use function-based syntax instead of class-based syntax.
Controls.svelte
Graph.svelte
$props
with individual prop declarations.$derived
and$effect
.Summary by Sourcery
Refactor the
Graph
andControls
components to use function-based syntax, removing the class-based syntax and updating event handling to use callback props. Update reactivity syntax inGraph
to use$derived
and$effect
.New Features:
svelvet-theme
attribute on the document element.Enhancements:
$props
with individual prop declarations in theGraph
component.