Skip to content

Fallthrough attributes #48

Description

@snixtho

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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions