Skip to content

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

Merged
merged 21 commits into from
Jun 5, 2025
Merged

feature: apply mark defaults #110

merged 21 commits into from
Jun 5, 2025

Conversation

gka
Copy link
Contributor

@gka gka commented Jun 3, 2025

resolves #59 and #66

Todos

  • export mark default types
  • apply area defaults
  • apply areaX defaults
  • apply areaY defaults
  • apply arrow defaults
  • apply axis defaults
  • apply axisX defaults
  • apply axisY defaults
  • apply bar defaults
  • apply barX defaults
  • apply barY defaults
  • apply brush defaults
  • apply brushX defaults
  • apply brushY defaults
  • apply cell defaults
  • apply dot defaults
  • apply frame defaults
  • apply geo defaults
  • apply graticule defaults
  • apply grid defaults
  • apply gridX defaults
  • apply gridY defaults
  • apply line defaults
  • apply link defaults
  • apply rect defaults
  • apply rectX defaults
  • apply rectY defaults
  • apply rule defaults
  • apply ruleX defaults
  • apply ruleY defaults
  • apply sphere defaults
  • apply spike defaults
  • apply text defaults
  • apply tick defaults
  • apply tickX defaults
  • apply tickY defaults
  • apply vector defaults

Copy link

netlify bot commented Jun 3, 2025

Deploy Preview for svelteplot ready!

Name Link
🔨 Latest commit c934743
🔍 Latest deploy log https://app.netlify.com/projects/svelteplot/deploys/6842146318c8b4000807f09e
😎 Deploy Preview https://deploy-preview-110--svelteplot.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@gka gka marked this pull request as ready for review June 5, 2025 20:43
Copy link

github-actions bot commented Jun 5, 2025

📦 Preview package for this PR is published!

Version: 0.2.10-pr-110.0

Install it with:

npm install svelteplot@pr-110
# or install the specific version
npm install svelteplot@0.2.10-pr-110.0

Copy link

github-actions bot commented Jun 5, 2025

📦 Preview package for this PR is published!

Version: 0.2.10-pr-110.1

Install it with:

npm install svelteplot@pr-110
# or install the specific version
npm install svelteplot@0.2.10-pr-110.1

@gka gka requested a review from Copilot June 5, 2025 21:44
Copy link
Contributor

@Copilot Copilot AI left a 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 from svelteplot/_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 nested axisX, axisY, gridX, and gridY 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 an Omit 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' }}
Copy link
Preview

Copilot AI Jun 5, 2025

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.

Suggested change
defaults={{ r: 3, symbol: 'circle' }}
defaults={{ r: dotRadius, symbol: 'circle' }}

Copilot uses AI. Check for mistakes.

Copy link

github-actions bot commented Jun 5, 2025

📦 Preview package for this PR is published!

Version: 0.2.10-pr-110.2

Install it with:

npm install svelteplot@pr-110
# or install the specific version
npm install svelteplot@0.2.10-pr-110.2

Copy link

github-actions bot commented Jun 5, 2025

📦 Preview package for this PR is published!

Version: 0.2.10-pr-110.3

Install it with:

npm install svelteplot@pr-110
# or install the specific version
npm install svelteplot@0.2.10-pr-110.3

Copy link

github-actions bot commented Jun 5, 2025

📦 Preview package for this PR is published!

Version: 0.2.10-pr-110.4

Install it with:

npm install svelteplot@pr-110
# or install the specific version
npm install svelteplot@0.2.10-pr-110.4

Copy link

github-actions bot commented Jun 5, 2025

📦 Preview package for this PR is published!

Version: 0.2.10-pr-110.5

Install it with:

npm install svelteplot@pr-110
# or install the specific version
npm install svelteplot@0.2.10-pr-110.5

@gka gka merged commit 165603a into main Jun 5, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy