1 | "use strict";
|
---|
2 |
|
---|
3 | exports.__esModule = true;
|
---|
4 | exports["default"] = void 0;
|
---|
5 |
|
---|
6 | var _container = _interopRequireDefault(require("./container"));
|
---|
7 |
|
---|
8 | var _types = require("./types");
|
---|
9 |
|
---|
10 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
---|
11 |
|
---|
12 | function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
---|
13 |
|
---|
14 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
---|
15 |
|
---|
16 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
---|
17 |
|
---|
18 | function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
---|
19 |
|
---|
20 | var Root = /*#__PURE__*/function (_Container) {
|
---|
21 | _inheritsLoose(Root, _Container);
|
---|
22 |
|
---|
23 | function Root(opts) {
|
---|
24 | var _this;
|
---|
25 |
|
---|
26 | _this = _Container.call(this, opts) || this;
|
---|
27 | _this.type = _types.ROOT;
|
---|
28 | return _this;
|
---|
29 | }
|
---|
30 |
|
---|
31 | var _proto = Root.prototype;
|
---|
32 |
|
---|
33 | _proto.toString = function toString() {
|
---|
34 | var str = this.reduce(function (memo, selector) {
|
---|
35 | memo.push(String(selector));
|
---|
36 | return memo;
|
---|
37 | }, []).join(',');
|
---|
38 | return this.trailingComma ? str + ',' : str;
|
---|
39 | };
|
---|
40 |
|
---|
41 | _proto.error = function error(message, options) {
|
---|
42 | if (this._error) {
|
---|
43 | return this._error(message, options);
|
---|
44 | } else {
|
---|
45 | return new Error(message);
|
---|
46 | }
|
---|
47 | };
|
---|
48 |
|
---|
49 | _createClass(Root, [{
|
---|
50 | key: "errorGenerator",
|
---|
51 | set: function set(handler) {
|
---|
52 | this._error = handler;
|
---|
53 | }
|
---|
54 | }]);
|
---|
55 |
|
---|
56 | return Root;
|
---|
57 | }(_container["default"]);
|
---|
58 |
|
---|
59 | exports["default"] = Root;
|
---|
60 | module.exports = exports.default; |
---|