UNPKG

aspen-decorations

Version:

Complex styling for react-aspen w/ inheritance and negations

48 lines (47 loc) 2.02 kB
import { Directory, FileEntry, Root } from 'aspen-core'; import { IDisposable } from 'notificar'; import { Decoration } from './Decoration'; import { ClasslistComposite } from './DecorationComposite'; /** * NOTES FOR CONTRIBUTORS: * - A Target is a directory or a file entry * - A Target is a DirectTarget when it is explicitly listed in a Decoration's application or negation list * - As opposed to DirectTarget, general targets are implicit targets when they simply inherit from their parent's inhertiable DecorationComposite * - All general targets "point to" their first parent's `inheritable` composite see docs for `IDecorationMeta.inheritable` */ export declare class DecorationsManager implements IDisposable { private decorations; private decorationsMeta; private disposables; private disposed; constructor(root: Root); /** * Permanently disengages the decoration system from the tree */ dispose(): void; /** * Adds the given `Decoration` to the tree * * `Decoration`s have no effect unless they are targetted at item(s). Use `Decoration#addTarget` to have them render in the filetree */ addDecoration(decoration: Decoration): void; /** * Removes a `Decoration` from the tree * * Note that this "removes" entire `Decoration` from tree but the said `Decoration`'s targets are still left intact. * * Calling `DecorationManager#addDecoration` with the same `Decoration` will undo the removal if the targets are left unchanged. */ removeDecoration(decoration: Decoration): void; /** * Returns resolved decorations for given item * * Resolution includes taking inheritances into consideration, along with any negations that may void some or all of inheritances */ getDecorations(item: FileEntry | Directory): ClasslistComposite; private targetDecoration; private unTargetDecoration; private negateDecoration; private unNegateDecoration; private switchParent; }