Skip to content

Request for render transform, svelte/motion integration, or children snippet support #125

Open
@scheatkode

Description

@scheatkode

I'd like to preface this by commending you on such a great library. It's truly a breath of fresh air.

I’m unsure whether svelteplot strictly adheres to Observable Plot’s API or is open to divergence as noted in the README:

Its API is heavily inspired by Observable Plot.

Regardless, I’d like to propose three potential solutions for a missing feature.

Is your feature request related to a problem? Please describe.

Currently, users lack fine-grained control over mark rendering beyond the exposed props. My specific use case involves tweening between states, which doesn’t seem possible with svelteplot today. Another use case is rendering custom components as marks.

Describe the solution you'd like

Here are three approaches to address this:

1. Implement a render transform

This would expose low-level D3 constructs, allowing users to inject custom logic (e.g., .transform()) into the rendering pipeline.

Example: https://observablehq.com/@fil/plot-animate-a-bar-chart/2

2. Integrate with svelte/motion

Expose a motion prop, either:

  • Declaratively (similar to layerchart):

    <LineY {data} x="x" y="y" motion={{ type: "tween", duration: 500, ...rest }} />
  • Or via direct object injection (cleaner/treeshakable):

    <LineY {data} x="x" y="y" motion={new Tween(0, { duration: 500, ...rest })} />

Examples:

3. Support children snippet

The simplest yet most powerful option: allow users to inject Svelte snippets for full rendering control.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      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