-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
add bind:inputEl to textarea in TextField #531
Open
hahn-kev
wants to merge
7
commits into
techniq:main
Choose a base branch
from
hahn-kev:expose-textarea-element
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+24
−2
Open
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
dd096ad
add bind:inputEl to textarea
hahn-kev 67c4a7b
correct bind syntax
hahn-kev 7bd9438
this shouldn't be this hard for me
hahn-kev 0ae9bfd
use a read only binding to avoid type conflicts
hahn-kev 1375d1c
don't rely on svelte 5 feature
hahn-kev 13b9781
fix lint errors
hahn-kev c6076cc
add example of bind:inputEl on TextField
hahn-kev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this is using function bindings as defined here. The problem was that svelte thought we wanted to provide the value from TextField to Input, and since
inputEl
now may be a TextArea it was not happy with that since there's missing properties. This ensures that data flow is only one way out of the Input and into the TextField variable. I would have put a comment in code but there's not a good way to do that here.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.
Thanks @hahn-kev. As of right now Svelte UX supports Svelte 3-5 (and will be for 1.x, but will be Svelte 5 only). I plan to release Svelte UX 1.0 VERY soon (maybe later this week) and have a PR that has started the migration to Svelte 5, but there is a lot of regression testing and refinements that need done.
With that said, we won't be able to use Svelte 5 function bindings yet (the docs are running Svelte 5 so it succeeds).
Here's my rough plan for Svelte UX 2.x (and others). Once we start the
next
branch I would love to include this, and plan to have incremental releases.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.
Ahh ok, I didn't realize that was a svelte 5 feature. I've changed this to do the same thing but an object to act as a wrapper which lets us define a setter without a getter.
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.
Nice technique! Care to run
pnpm format
to fix the prettier lint issue and I'll merge / release.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.
Also, could you add an example or a way to validate the change. I don't have any component tests at the moment, just some unit tests and a lot of examples for visual/manual validation
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.
fixed the lint issues. FYI maybe this is because I'm on windows, but when I ran format it modified 486 files, in addition to the TextField file. I only checked in that one. That might trip up others though, I think it might be a BOM issue, but it's hard to tell what the changes are.
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.
Alright there's now also an example (really like how that system was designed btw, really cool), here's a screenshot of it, I figured I should include a toggle between single and multi-line since that's what this PR was mainly for.