Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork21
feat: add setPlotDefaults and getPlotDefaults hooks#219
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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.
Pull Request Overview
This PR refactors default plot settings management by introducing newgetPlotDefaults andsetPlotDefaults hooks to replace the previous Svelte context API approach. The new hooks provide a more consistent and maintainable way to manage plot defaults across all mark components.
- Replaces
setContext('svelteplot/defaults', ...)withsetPlotDefaults(...) - Updates all mark components to use
getPlotDefaults()instead ofgetContext<PlotDefaults>('svelteplot/_defaults') - Adds backward compatibility with deprecation warnings for the old context-based approach
Reviewed Changes
Copilot reviewed 46 out of 46 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/hooks/plotDefaults.ts | New hook implementation with backward compatibility |
| src/lib/index.ts | Exports the new hooks for public API |
| src/lib/core/Plot.svelte | Updated to use new hook system |
| src/lib/marks/*.svelte | All mark components updated to usegetPlotDefaults() |
| src/tests/plot.test.svelte | Updated test to use newsetPlotDefaults hook |
| Documentation files | Updated examples and references to use new hook syntax |
Comments suppressed due to low confidence (1)
src/lib/marks/Brush.svelte:1
- The
Brushtype has duplicatey2property on lines 56 and 58. Line 56 should likely bex2instead ofy2.
<!--Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
netlifybot commentedOct 5, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
✅ Deploy Preview forsvelteplot ready!
To edit notification comments on pull requests, go to yourNetlify project configuration. |
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-219# or install the specific versionnpm install svelteplot@0.4.7-pr-219.0 |
c26e998 intomainUh oh!
There was an error while loading.Please reload this page.
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-219# or install the specific versionnpm install svelteplot@0.4.7-pr-219.1 |
Uh oh!
There was an error while loading.Please reload this page.
This pull request refactors how default plot settings are managed and accessed across the codebase. It introduces a new
getPlotDefaultsandsetPlotDefaultshook, replacing the previous use of Svelte's context API for plot defaults. All mark components now use this new hook to retrieve their default settings, leading to a more consistent and maintainable approach. Additionally, related imports and type usages have been updated for clarity and efficiency.resolves#218