-
Notifications
You must be signed in to change notification settings - Fork 0
Upgrade to Svelte 5.0 #1
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
Upgrade `src/lib/components/Anchor/Anchor.svelte`, `src/lib/components/ContrastTheme/ContrastTheme.svelte`, and `src/lib/components/Controls/Controls.svelte` to Svelte 5.0 syntax. * **Reactivity Syntax**: Replace `let` with `$state` for reactive variables. Replace `$:` with `$derived` or `$effect` for reactive statements. * **Props**: Use `$props` to declare props with destructuring. * **Event Handling**: Replace `on:click` with `onclick` for event handlers. Replace `createEventDispatcher` with callback props. * **Other Changes**: Refactor various functions and variables to align with the new syntax and structure of Svelte 5.0.
Reviewer's Guide by SourceryThis pull request upgrades the codebase to Svelte 5.0, focusing on syntax changes related to reactivity, props, and event handling. It also includes refactoring of various functions and variables to align with the new Svelte 5.0 structure. Class diagram showing updated component structure with Svelte 5.0 changesclassDiagram
class Component {
$props
$state
$derived
$effect()
}
class Edge {
+$props: EdgeProps
+$state: EdgeState
+$derived dynamic
+$derived edgeColor
+$effect()
}
class Graph {
+$props: GraphProps
+$state: GraphState
+$derived dimensions
+$effect()
}
class Node {
+$props: NodeProps
+$state: NodeState
+$derived nodePosition
+$effect()
}
Component <|-- Edge
Component <|-- Graph
Component <|-- Node
note for Component "Base structure for
Svelte 5.0 components"
note for Edge "Updated with new
reactivity syntax"
note for Graph "Refactored state
management"
note for Node "Modified props and
state handling"
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 keeping
on:event
syntax instead of changing toonevent
attributes, as this may break event modifier functionality and is not a required change for Svelte 5 - Establish consistent patterns for state initialization - some components mix old-style declarations with new
$state
syntax which could lead to confusion
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 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.
const graphDOMElement = getContext<Writable<HTMLElement>>('graphDOMElement'); | ||
const dispatch = createEventDispatcher(); | ||
const dispatch = (eventName, detail) => { |
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.
issue (bug_risk): Custom event dispatch implementation may not handle bubbling correctly
Consider using Svelte's built-in createEventDispatcher instead of a custom implementation to ensure proper event bubbling and typing.
Upgrade
src/lib/components/Anchor/Anchor.svelte
,src/lib/components/ContrastTheme/ContrastTheme.svelte
, andsrc/lib/components/Controls/Controls.svelte
to Svelte 5.0 syntax.let
with$state
for reactive variables. Replace$:
with$derived
or$effect
for reactive statements.$props
to declare props with destructuring.on:click
withonclick
for event handlers. ReplacecreateEventDispatcher
with callback props.Summary by Sourcery
Update components to use Svelte 5 syntax, including reactivity changes, props updates, and event handling modifications.
New Features:
Enhancements: