import Renderables from '../Renderables';
import node from "../../support/node";
import { Specification } from "../../support/Specification";
/**
 * Implementation of the 'items' markup element.
 * An ol or ul HTML element is created depending if
 * the items of the item section requires ordering.
 * The attribute id of the markup is applied and the
 * class lto-items is added to allow CSS manipulations.
 *
 * @see {@link IRenderable}
 * @see {@link IStackeable}
 * @see {@link Item}
 */
var Items = /** @class */ (function () {
    function Items(spec) {
        this.spec = spec;
    }
    /**
     * @inheritDoc
     */
    Items.prototype.render = function (renderer, isNested) {
        var _this = this;
        var items = node(this.spec.ordered ? "ol" : "ul");
        new Specification(this.spec).initNode(items, "lto-items");
        (this.spec.elements || []).map(function (e) { return renderer.render(e, _this); })
            .forEach(function (e) { return e.forEach(function (x) { return items.appendChild(node(x)); }); });
        isNested && items.addClasses("lto-nested");
        return items.unwrap();
    };
    return Items;
}());
export { Items };
Renderables.register("items", Items);
//# sourceMappingURL=index.js.map