"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Renderables_1 = require("../Renderables");
var node_1 = require("../../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_1.default("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_1.default(x)); }); });
        item.unwrap().appendChild(document.createTextNode(this.spec.text || ""));
        if (isNested)
            item.addClasses("lto-nested");
        return item.unwrap();
    };
    return Item;
}());
exports.Item = Item;
Renderables_1.default.register("item", Item);
//# sourceMappingURL=index.js.map