-
-
Notifications
You must be signed in to change notification settings - Fork 13
Pass data type through mark components #113
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. |
6d90fea
to
703ad4b
Compare
resolves #97
46e86fb
to
de86fae
Compare
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 pull request refactors the mark components by passing through a generic data type (Datum) and updates type imports to use the new paths. Additionally, several helper functions and components have been updated for improved type safety and consistency.
- Introduce a generic type parameter (“Datum”) to various mark components.
- Update import paths from legacy types files to the new “types/index.js” location.
- Refine helper functions (e.g. autoTicks) and add new filtering logic in screenshot examples.
Reviewed Changes
Copilot reviewed 174 out of 175 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/lib/marks/BarY.svelte | Added generics for data type and updated type references. |
src/lib/marks/BarX.svelte | Similar generic refactoring and type import path updates. |
src/lib/marks/AxisY.svelte | Introduced generics and adjusted props including className. |
src/lib/marks/AxisX.svelte | Added generics and updated prop ordering for clarity. |
src/lib/marks/Arrow.svelte | Applied generics and adjusted type imports for channel access. |
src/lib/marks/AreaY.svelte | Updated generics and default values based on data channel. |
src/lib/marks/AreaX.svelte | Same as AreaY with horizontal orientation updates. |
src/lib/marks/Area.svelte | Converted to generic and updated type and default handling. |
src/lib/helpers/resolve.ts | Added a type parameter to improve type safety in channel resolution. |
src/lib/helpers/projection.ts | Updated export for the Clip type. |
src/lib/helpers/autoTicks.ts | Enhanced autoTicks by filtering ticks within bounds. |
Multiple core files | Updated type import paths for consistency. |
screenshot-examples.js | Added logic to only process missing screenshots when enabled. |
package.json | Adjusted dependencies and (unexpectedly) downgraded the version. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (3)
src/lib/marks/BarY.svelte:6
- Changing from a module script to an instance script alters the export context in Svelte. Verify that this change was intentional to ensure that type exports and module-level logic behave as expected.
<script lang="ts" generics="Datum extends DataRow">
package.json:3
- The package version was downgraded from 0.3.3 to 0.3.2, which may be unintentional. Please verify that the version number aligns with your release conventions.
"version": "0.3.2",
screenshot-examples.js:202
- [nitpick] Using string replacement to match screenshot filenames can be fragile. Consider employing a more robust approach such as parsing the file paths to ensure correct matching.
filePath.endsWith(screenshot.replace('.png', '.svelte'))
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-113
# or install the specific version
npm install svelteplot@0.3.2-pr-113.0 |
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-113
# or install the specific version
npm install svelteplot@0.3.2-pr-113.1 |
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-113
# or install the specific version
npm install svelteplot@0.3.2-pr-113.2 |
resolves #6 and #97
This pull request improves type safety, enhance functionality, and update dependencies. The most notable changes include the introduction of generics for better type inference in Svelte components, updates to the dependency list in
package.json
andpnpm-lock.yaml
, and the addition of functionality to filter missing screenshots inscreenshot-examples.js
.Type Safety Enhancements:
src/lib/Mark.svelte
: Added generics (Datum extends DataRecord
) toMarkProps
for improved type inference and replaced inline type definitions with an interface. [1] [2] [3]src/lib/marks/Area.svelte
: Introduced generics (Datum extends DataRecord
) toAreaMarkProps
and updated type imports for consistency. [1] [2]src/lib/helpers/resolve.ts
: UpdatedresolveChannel
function to support generics for enhanced type safety.Dependency Updates:
package.json
: Added new type dependencies (@types/d3-quadtree
,@types/geojson
,@types/topojson
, etc.) and reverted the version number from0.3.3
to0.3.2
. [1] [2]pnpm-lock.yaml
: Updated type dependency versions and added new entries for@types/topojson-client
,@types/topojson-server
, and related packages. [1] [2] [3]Screenshot Filtering:
screenshot-examples.js
: Added functionality to filter Svelte example files and only take screenshots for files missing corresponding.png
images, controlled by theONLY_MISSING
environment variable. [1] [2] [3]Miscellaneous Improvements:
src/lib/helpers/autoTicks.ts
: Enhanced theautoTicks
function to filter ticks within the domain range.src/lib/Plot.svelte
,src/lib/core/Facet.svelte
, etc.) for consistency and maintainability. [1] [2] [3] [4] [5]These changes collectively improve the project's type safety, functionality, and dependency management while ensuring better maintainability and scalability.