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

Fallthrough attributes #48

Open
snixtho opened this issue Jan 16, 2024 · 0 comments
Open

Fallthrough attributes #48

snixtho opened this issue Jan 16, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@snixtho
Copy link
Member

snixtho commented Jan 16, 2024

If a user provides an attribute that isn't defined by a component, these attributes should fall through the component and be assigned to the parent of the component. If the component has more than one component as "parents", this is ignored. And if the parent component is a base Manialink tag, the attribute would then end the fallthrough at that point.

This would be useful for a type of attribute inheritance.

For example, given the following component code:

<component>
    <template>
        <label text="hello!" />
    </template>
</component>

Let's call this component HelloLabel

Currently, there is no way to directly set any attributes to the <label> without explicitly defining properties.

But with fallthrough attributes it can work like this:

<component>
    <template>
        <HelloLabel textcolor="FF0058" />
    </template>
</component>

The attribute textcolor would then fall through and be assigned to <label>. So the result would be:

<label text="hello!" textcolor="FF0058" />

This fallthrough would also go recursively, and fall through multiple components until a base manialink tag is hit.


Now imagine the HelloLabel had two parent tags:

<component>
    <template>
        <label text="hello" />
        <label text="there!" />
    </template>
</component>

In this case, it makes the fallthrough attribute ambiguous, and will be ignored.

@snixtho snixtho added the enhancement New feature or request label Jan 16, 2024
@araszka araszka self-assigned this Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants