UNPKG

996 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = void 0;
7
8var Section = function Section(key, props, sectionsBuilder) {
9 var section = {
10 key: key,
11 elements: []
12 };
13 var builder = {
14 element: function element(_element) {
15 section.elements.push(_element);
16 return builder;
17 },
18 build: function build() {
19 props.sections.push(section);
20 return sectionsBuilder;
21 }
22 };
23 return builder;
24};
25
26var _default = function _default() {
27 var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
28 var builder = {};
29 props.sections = props.sections || [];
30
31 builder.section = function () {
32 var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
33 key = key || "section-".concat(props.sections.length);
34 return Section(key, props, builder);
35 };
36
37 builder.build = function () {
38 return props;
39 };
40
41 return builder;
42};
43
44exports.default = _default;
\No newline at end of file