Skip to content

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

Merged
merged 45 commits into from
Jun 11, 2025
Merged

Pass data type through mark components #113

merged 45 commits into from
Jun 11, 2025

Conversation

gka
Copy link
Contributor

@gka gka commented Jun 6, 2025

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 and pnpm-lock.yaml, and the addition of functionality to filter missing screenshots in screenshot-examples.js.

Type Safety Enhancements:

Dependency Updates:

  • package.json: Added new type dependencies (@types/d3-quadtree, @types/geojson, @types/topojson, etc.) and reverted the version number from 0.3.3 to 0.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 the ONLY_MISSING environment variable. [1] [2] [3]

Miscellaneous Improvements:

  • src/lib/helpers/autoTicks.ts: Enhanced the autoTicks function to filter ticks within the domain range.
  • Updated type imports across multiple files (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.

Copy link

netlify bot commented Jun 6, 2025

Deploy Preview for svelteplot ready!

Name Link
🔨 Latest commit 75edbb7
🔍 Latest deploy log https://app.netlify.com/projects/svelteplot/deploys/6849f379faf94400081faf4e
😎 Deploy Preview https://deploy-preview-113--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 force-pushed the ts/pass-thru-data-type branch 2 times, most recently from 6d90fea to 703ad4b Compare June 10, 2025 22:26
@gka gka force-pushed the ts/pass-thru-data-type branch from 46e86fb to de86fae Compare June 11, 2025 17:39
@gka gka changed the title Ts/pass thru data type Pass data type through mark components Jun 11, 2025
@gka gka requested a review from Copilot June 11, 2025 21:13
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 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'))

@gka gka marked this pull request as ready for review June 11, 2025 21:14
Copy link

📦 Preview package for this PR is published!

Version: 0.3.2-pr-113.0

Install it with:

npm install svelteplot@pr-113
# or install the specific version
npm install svelteplot@0.3.2-pr-113.0

Copy link

📦 Preview package for this PR is published!

Version: 0.3.2-pr-113.1

Install it with:

npm install svelteplot@pr-113
# or install the specific version
npm install svelteplot@0.3.2-pr-113.1

Copy link

📦 Preview package for this PR is published!

Version: 0.3.2-pr-113.2

Install it with:

npm install svelteplot@pr-113
# or install the specific version
npm install svelteplot@0.3.2-pr-113.2

@gka gka merged commit 789a105 into main Jun 11, 2025
8 checks passed
@gka gka deleted the ts/pass-thru-data-type branch June 11, 2025 21:26
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.

(Suggestion) Make components generic to pasthrough datarow shape
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