-
Notifications
You must be signed in to change notification settings - Fork 80
RFC for adding built-in actions #24
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
Open
kevmodrome
wants to merge
5
commits into
sveltejs:master
Choose a base branch
from
kevmodrome:kevmodrome-patch-1
base: master
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.
+60
−0
Open
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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 hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
- Start Date: 2020-06-12 | ||
- RFC PR: | ||
- Svelte Issue: | ||
|
||
# Built-in Actions | ||
|
||
## Summary | ||
|
||
This RFC proposes the idea of having a number of common built-in actions much like there | ||
are built-in transitions. | ||
|
||
## Motivation | ||
|
||
Actions are currently a bit of a mystery to a lot of people but are incredibly powerful. | ||
Having a number of ready-made actions would increase the simpleness of getting started | ||
and adds ease-of-use to beginners of Svelte. | ||
|
||
This is one of those things that blows minds when they first see it, much like the | ||
transitions. It would greatly ease efforts to market Svelte as *the* framework that | ||
people should use. | ||
|
||
## Detailed design | ||
|
||
Much like the `svelte/transition` package a `svelte/action` package could be created. | ||
You would import them like so: `import { longPress } from 'svelte/action'`. | ||
In here we would put whatever actions that would make sense to put here. These | ||
could be actions such as: | ||
|
||
- `use:longpress` | ||
- `use:clickOutside` | ||
- `use:lazyload` | ||
- `use:debugFlash` | ||
|
||
Determining what actions should and should not be included needs to be discussed. | ||
|
||
## How we teach this | ||
|
||
There are no real new concepts added by this RFC but I can see how we would probably want | ||
to add one or two new Tutorials and Examples. The documentation would need to be expanded | ||
a bit to also show off these actions, much like how transitions are described there. | ||
|
||
## Drawbacks | ||
|
||
The first one is documentaiton. This would probably require the most work in the short-term | ||
but I think it would be a pretty straight-forward thing once the actual actions that are | ||
included are decided. | ||
|
||
The other downside is that the amount of code to maintain increases. We would have to update | ||
and keep these actions working but unless the syntax changes radically or the concept of | ||
actions is going away (😡) I think it might be worth it. | ||
|
||
## Alternatives | ||
|
||
There are probably not any other alternatives to this, apart from not doing it. | ||
|
||
|
||
## Unresolved questions | ||
|
||
The obvious question here would be to decide what actions should be included. What are some | ||
popular use-cases that would fit well here? |
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.
Uh oh!
There was an error while loading. Please reload this page.