-
-
Notifications
You must be signed in to change notification settings - Fork 13
feature: apply mark defaults #110
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
✅ Deploy Preview for svelteplot ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-110
# or install the specific version
npm install svelteplot@0.2.10-pr-110.0 |
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-110
# or install the specific version
npm install svelteplot@0.2.10-pr-110.1 |
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 centralizes and applies default styling and behavioral options for all marks via a shared PlotDefaults
context, and refactors prop handling to merge user props with those defaults using Svelte’s $derived
stores.
- Introduce
DEFAULTS
objects in each mark to pull fromsvelteplot/_defaults
and merge via$derived
. - Refactor all marks to use
let markProps = $props()
+$derived({ ...DEFAULTS, ...markProps })
instead of direct$props()
destructuring. - Update core
Plot.svelte
to reshape its defaults structure into nestedaxisX
,axisY
,gridX
, andgridY
with implicit flags.
Reviewed Changes
Copilot reviewed 118 out of 118 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
src/lib/marks/Frame.svelte | Added DEFAULTS and merged frame props via $derived . |
src/lib/marks/Dot.svelte | Pulled dot defaults from context; updated hardcoded radius. |
src/lib/marks/ColorLegend.svelte | Renamed DefaultOptions to PlotDefaults import. |
src/lib/marks/Cell.svelte | Added DEFAULTS and merged cell props via $derived . |
src/lib/marks/BrushY.svelte/X.svelte | Added brush defaults and merged via $derived . |
src/lib/marks/Brush.svelte | Refactored brush prop defaults; unified context defaults. |
src/lib/marks/BoxY.svelte/X.svelte | Added defaults context and merged via $derived . |
src/lib/marks/BarY.svelte/X.svelte | Added defaults context and merged via $derived . |
src/lib/marks/AxisY.svelte/X.svelte | Added defaults context and merged via $derived . |
src/lib/marks/Arrow.svelte | Added arrow defaults; refactored snippet invocation. |
src/lib/marks/AreaY/X/Area.svelte | Added defaults context and merged via $derived . |
src/lib/core/Plot.svelte | Restructured core defaults into nested axes and grids. |
screenshot-examples.js | Adjusted Playwright selectors for screenshot tests. |
Comments suppressed due to low confidence (1)
src/lib/marks/AxisY.svelte:57
- Using
ChannelName
(a type) in anOmit
generic instead of a string literal property name will cause a type error. Ensure you omit actual prop keys (e.g.,Omit<AxisYMarkProps, 'data' | 'somePropName'>
).
const DEFAULTS: Omit<AxisYMarkProps, 'data' | ChannelName> = {
@@ -80,7 +84,7 @@ | |||
'fillOpacity', | |||
'strokeOpacity' | |||
]} | |||
defaults={{ r: dotRadius, symbol: 'circle' }} | |||
defaults={{ r: 3, symbol: 'circle' }} |
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.
Using a hardcoded dot radius (3) instead of pulling from the context default (dotRadius
) will ignore user-defined settings. Consider replacing 3
with the value from getContext<PlotDefaults>('svelteplot/_defaults').dotRadius
.
defaults={{ r: 3, symbol: 'circle' }} | |
defaults={{ r: dotRadius, symbol: 'circle' }} |
Copilot uses AI. Check for mistakes.
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-110
# or install the specific version
npm install svelteplot@0.2.10-pr-110.2 |
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-110
# or install the specific version
npm install svelteplot@0.2.10-pr-110.3 |
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-110
# or install the specific version
npm install svelteplot@0.2.10-pr-110.4 |
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-110
# or install the specific version
npm install svelteplot@0.2.10-pr-110.5 |
resolves #59 and #66
Todos