eoussama/temme.js

Inheritance range

eoussama opened this issue · 0 comments

Adding the ability to specify what to inherit and what to ignore. Sometimes you would want to inherit only the classes and ignore all other options, some other times you would want to inherit everything except for a certain option.
include and exclude are both options that go along the from option and give control over option inheritance.

Syntax

{
    children: [
        {
            ref: 'some-ref',
            name: 'input',
            classes: ['bold', 'red'],
            attributes: {
                type: 'button',
                name: 'form-input'
            }
        },
        {
            from: {
                ref: 'some-ref',
                mode: 'append',
                include: ['classes']
            }
        }
    ]
}

Data structure

  • A from option can either have an include option or exclude option, but never both at the same time.
  • A from option can have none of the options above, in that case, it should include all by default (exclude nothing).