[invokers] Generalizing command invokers
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
Research direction
Start with the existing commandfor/command and interestfor syntax described in issue #1487, then review the related value-change proposal in #1359. Compare the proposed command element, trigger, action, and for attributes against the listed use cases; done means the generalized API has an agreed scope and behavior for combining commands and supporting future triggers.
Written by the indexing model from the issue text.
Description
To design interest invokers, we have currently invented a parallel set of attributes with interestfor instead of commandfor. But essentially, interest invokers are just command invokers with a different set of events for the trigger. But re-using the same set of attributes would mean they cannot be combined on the same element, a common need.
But we'll run into this again. E.g. more triggers have already been proposed: keyboard shortcuts, overscroll, value changes (#1359), etc.
Instead of ad hoc copying the API for each case, which doesn't scale, what if we generalize it in a way that allows:
- customizing the trigger
- attaching multiple commands to the same element (this also allows multiple regular commands, for which there are use cases!)
I'd propose a <command> element:
- The invoker is implicitly the parent. Later, we can introduce an additional attribute to specify a different invoker (either on the
<command>or the invoking element), allowing for declarative reusable commands. - An attribute (
action?value?), analogous tocommand. Possibly defaulting totoggle-popoverto provide similar DX as today's interest invokers? - A new attribute for the trigger, e.g.
type="click | interest". Singular value at first, later multiple values can provide multiple triggers if use cases emerge. foras an equivalent ofcommandfor. Later, we could expand the syntax to produce dynamic targets for multiple different invoking elements.
I think this provides a lot more flexibility and room to grow with only marginally additional verbosity (and existing syntax can remain as a shortcut):
| Today | With <command> |
|---|---|
|
|
|
|
I think this offers a lot of room to grow, for example:
- Additional triggers, or even custom triggers, analogously to custom commands!
- Conditional attributes ike
media - Many actions require additional parameters, it's trivial to expand to that
<command>elements would be hidden by default per the UA stylesheet, but if visible, they can be used as click-targets, providing a way to create interest buttons, feeding two birds with one scone!
WDYT?
- Dominant language
- MDX
- Stars
- 4.5k
- Forks
- 226
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from openui/open-ui
-
Enhanced range slider
-
Enhanced range slider
-
TPAC26
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
menu
-
focusgroup
Difficulty 5/5 Over a week Newbie friendliness 30/100
Similar issues
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Complexity: Small P-Feature: Project Info and Page ready for merge team role: front end size: 0.25pt
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
libretro/common-overlays#198 ·
-
I Font Bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
area:habits beginner friendly bug community contributions-welcome difficulty:beginner difficulty:easy good first issue hacktoberfest help wanted open-source ui up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 90/100