import Renderables from '../Renderables';
import node from "../../support/node";
/**
 * Implementation of the 'item' markup element.
 * A li HTML element is created and the class lto-item
 * is added to allow CSS manipulations.
 *
 * @see {@link IRenderable}
 * @see {@link Items}
 */
var Item = /** @class */ (function () {
    function Item(spec) {
        this.spec = spec;
    }
    /**
     * @inheritDoc
     */
    Item.prototype.render = function (renderer, isNested) {
        var _this = this;
        var item = node("li");
        item.setId(this.spec.id);
        item.addClasses("lto-item", "lto-left");
        this.spec.class !== undefined ? item.addClasses(this.spec.class) : function () { };
        (this.spec.elements || []).map(function (e) { return renderer.render(e, _this); })
            .forEach(function (e) { return e.forEach(function (x) { return item.appendChild(node(x)); }); });
        item.unwrap().appendChild(document.createTextNode(this.spec.text || ""));
        if (isNested)
            item.addClasses("lto-nested");
        return item.unwrap();
    };
    return Item;
}());
export { Item };
Renderables.register("item", Item);
//# sourceMappingURL=index.js.map