Skip to content
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

Type error with 'options' in Text #17

Closed
CKylinMC opened this issue Sep 18, 2024 · 5 comments
Closed

Type error with 'options' in Text #17

CKylinMC opened this issue Sep 18, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@CKylinMC
Copy link

CKylinMC commented Sep 18, 2024

Svelte Tweakpane UI version: 1.3.0
Svelte version: 4.2.19

image
I'm trying to force this text field to be "text", and I found that I can add "{view: 'string'}" into options to do that. It works, but one issue is, it will always throwing an error from typescript tell me "no 'options' here".

And I see through the .d.ts file and I found it has been excluded by definition.
image

Did this property blocked for any reason?

@kitschpatrol kitschpatrol self-assigned this Sep 18, 2024
@kitschpatrol
Copy link
Owner

kitschpatrol commented Sep 18, 2024

Hi, thanks for using the library and opening an issue.

I might have just missed this prop or not seen a use for it that wouldn't already be covered by the <Color> component? (And just as a general tip, both auto-completions in your editor and the component documentation pages should provide an accurate list of supported props.)

Can you explain what you're trying to do at a higher level? I'm guessing you have a hex string that you want to edit directly as text, and Tweakpane is giving you the color control instead?

From a quick look at this, it just seems like an oversight on my part and I should have hard-coded view to text in the internal implementation of the <Text> component, and in the documentation I should encourage the more semantically explicit use of the <Color> component when a color control is desired.

@kitschpatrol kitschpatrol added the bug Something isn't working label Sep 18, 2024
kitschpatrol added a commit that referenced this issue Sep 19, 2024
@kitschpatrol
Copy link
Owner

kitschpatrol commented Sep 19, 2024

Thinking about this more, it's basically a bug... the <Text> component should always give you a control with view: 'text' set internally, regardless of the semantic content of value.

I've addressed this in v1.3.2.

Thanks for bringing it to my attention.

Note that Tweakpane's view option is still intentionally not exposed, since Svelte Tweakpane UI's separates Tweakpane control types into discrete components instead of inferring control types from values. (With a few exceptions for the lower-level components.)

@CKylinMC
Copy link
Author

CKylinMC commented Sep 19, 2024

Yes, I want it force to be text just because it always turn my hex-like string into color selector, and I see that used to be an issue in tweakpane v2/v3 and after that they use "{view: 'string'}" to control it, so I tried to add it manually.

Since this issue has been solved internally, I can let the 'options' go. Thanks!

Btw I have another issue with <Element>, when I use it in "if" block, it sometimes make the next blade fly away. I'm still finding what cause that. For reproduce, see this. I have opened a new issues for this: #18

@kitschpatrol
Copy link
Owner

Ok great.

Can you please open another issue for the <Element> problem you found? Thanks for the reproduction.

@CKylinMC
Copy link
Author

Ok, check this: #18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants