"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Renderables_1 = require("../Renderables");
var node_1 = require("../../support/node");
var Specification_1 = require("../../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_1.default(this.spec.ordered ? "ol" : "ul");
        new Specification_1.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_1.default(x)); }); });
        isNested && items.addClasses("lto-nested");
        return items.unwrap();
    };
    return Items;
}());
exports.Items = Items;
Renderables_1.default.register("items", Items);
//# sourceMappingURL=index.js.map