leva icon indicating copy to clipboard operation
leva copied to clipboard

export function backing "evaluate" property

Open sritchie opened this issue 2 years ago • 4 comments

Here were my Discord notes backing this request. Not sure what you think of the name, or if my export here is actually valid JS syntax... let me know!

"I have an example going with the Bezier plugin, and noticed that the returned value is an array of four entries, BUT ALSO used as an object, with a couple of keys added for (I think) evaluate etc.

This is convenient... but these keys don't survive conversion to ClojureScript, and the code isn't structured to make it easy to recover those values with only the 4 bezier curve entries.

What do you think of restructuring the code to export an evaluate function that takes the array of 4 entries as well as a point? we can keep the current behavior, but the change would let me evaluate without the plugin internally building that evaluate function for me."

sritchie avatar Jan 11 '23 14:01 sritchie

⚠️ No Changeset found

Latest commit: 08ea39659c76fed7566fb1a3c7c50125c74540d8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Jan 11 '23 14:01 changeset-bot[bot]

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
leva ❌ Failed (Inspect) Jan 11, 2023 at 2:27PM (UTC)

vercel[bot] avatar Jan 11 '23 14:01 vercel[bot]

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 08ea39659c76fed7566fb1a3c7c50125c74540d8:

Sandbox Source
leva-minimal Configuration
leva-busy Configuration
leva-scroll Configuration
leva-advanced-panels Configuration
leva-ui Configuration
leva-theme Configuration
leva-transient Configuration
leva-plugin-plot Configuration
leva-plugin-bezier Configuration
leva-plugin-spring Configuration
leva-plugin-dates Configuration
leva-custom-plugin Configuration

codesandbox-ci[bot] avatar Jan 11 '23 14:01 codesandbox-ci[bot]

If you like this, I'd also like to turn the code that generates the cssEasing string https://github.com/pmndrs/leva/blob/main/packages/plugin-bezier/src/bezier-plugin.ts#L31 into a function in bezier-utils.ts and export that as well. Then users can still proceed even if they don't use the kv pairs added to the array.

sritchie avatar Jan 11 '23 14:01 sritchie

@sritchie if you are still interested in doing this, lmk

gsimone avatar Nov 02 '25 15:11 gsimone