@roots/bud-client 6.3.5 → 6.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +0 -3
  3. package/lib/components/index.d.ts +4 -0
  4. package/lib/components/index.d.ts.map +1 -0
  5. package/lib/components/index.js +49 -0
  6. package/lib/components/{overlay/index.d.cts → indicator/index.d.ts} +1 -1
  7. package/lib/components/indicator/index.d.ts.map +1 -0
  8. package/lib/components/indicator/index.js +21 -0
  9. package/lib/components/indicator/{indicator.component.d.cts → indicator.component.d.ts} +6 -7
  10. package/lib/components/indicator/indicator.component.d.ts.map +1 -0
  11. package/lib/components/indicator/{indicator.component.cjs → indicator.component.js} +26 -29
  12. package/lib/components/indicator/indicator.controller.d.ts +45 -0
  13. package/lib/components/indicator/indicator.controller.d.ts.map +1 -0
  14. package/lib/components/indicator/indicator.controller.js +58 -0
  15. package/lib/components/indicator/{indicator.pulse.d.cts → indicator.pulse.d.ts} +1 -1
  16. package/lib/components/indicator/indicator.pulse.d.ts.map +1 -0
  17. package/lib/components/indicator/{indicator.pulse.cjs → indicator.pulse.js} +0 -1
  18. package/lib/components/{indicator/index.d.cts → overlay/index.d.ts} +1 -1
  19. package/lib/components/overlay/index.d.ts.map +1 -0
  20. package/lib/components/overlay/index.js +21 -0
  21. package/lib/components/overlay/{overlay.component.d.cts → overlay.component.d.ts} +1 -1
  22. package/lib/components/overlay/overlay.component.d.ts.map +1 -0
  23. package/lib/components/overlay/{overlay.component.cjs → overlay.component.js} +16 -21
  24. package/lib/components/overlay/{overlay.controller.d.cts → overlay.controller.d.ts} +1 -7
  25. package/lib/components/overlay/overlay.controller.d.ts.map +1 -0
  26. package/lib/components/overlay/{overlay.controller.cjs → overlay.controller.js} +11 -10
  27. package/lib/hmr/events.d.ts +52 -0
  28. package/lib/hmr/events.d.ts.map +1 -0
  29. package/lib/hmr/events.js +100 -0
  30. package/lib/index.d.mts +1 -5
  31. package/lib/index.d.mts.map +1 -1
  32. package/lib/index.d.ts +2 -0
  33. package/lib/index.d.ts.map +1 -0
  34. package/lib/index.js +117 -0
  35. package/lib/index.mjs +1 -5
  36. package/lib/intercept.d.ts +3 -0
  37. package/lib/intercept.d.ts.map +1 -0
  38. package/lib/intercept.js +20 -0
  39. package/lib/interface.d.ts +53 -0
  40. package/lib/interface.d.ts.map +1 -0
  41. package/lib/interface.js +4 -0
  42. package/lib/options.d.ts +16 -0
  43. package/lib/options.d.ts.map +1 -0
  44. package/lib/options.js +39 -0
  45. package/lib/proxy-click-interceptor.d.ts +2 -0
  46. package/lib/proxy-click-interceptor.d.ts.map +1 -0
  47. package/lib/proxy-click-interceptor.js +31 -0
  48. package/package.json +10 -14
  49. package/lib/components/indicator/index.cjs +0 -14
  50. package/lib/components/indicator/index.cjs.map +0 -1
  51. package/lib/components/indicator/index.d.cts.map +0 -1
  52. package/lib/components/indicator/indicator.component.cjs.map +0 -1
  53. package/lib/components/indicator/indicator.component.d.cts.map +0 -1
  54. package/lib/components/indicator/indicator.controller.cjs +0 -40
  55. package/lib/components/indicator/indicator.controller.cjs.map +0 -1
  56. package/lib/components/indicator/indicator.controller.d.cts +0 -27
  57. package/lib/components/indicator/indicator.controller.d.cts.map +0 -1
  58. package/lib/components/indicator/indicator.pulse.cjs.map +0 -1
  59. package/lib/components/indicator/indicator.pulse.d.cts.map +0 -1
  60. package/lib/components/overlay/index.cjs +0 -14
  61. package/lib/components/overlay/index.cjs.map +0 -1
  62. package/lib/components/overlay/index.d.cts.map +0 -1
  63. package/lib/components/overlay/overlay.component.cjs.map +0 -1
  64. package/lib/components/overlay/overlay.component.d.cts.map +0 -1
  65. package/lib/components/overlay/overlay.controller.cjs.map +0 -1
  66. package/lib/components/overlay/overlay.controller.d.cts.map +0 -1
  67. package/lib/hmr/bridge.cjs +0 -290
  68. package/lib/hmr/bridge.cjs.map +0 -1
  69. package/lib/hmr/bridge.d.cts +0 -5
  70. package/lib/hmr/bridge.d.cts.map +0 -1
  71. package/lib/hmr/index.cjs +0 -81
  72. package/lib/hmr/index.cjs.map +0 -1
  73. package/lib/hmr/index.d.cts +0 -19
  74. package/lib/hmr/index.d.cts.map +0 -1
  75. package/lib/hmr/update.cjs +0 -154
  76. package/lib/hmr/update.cjs.map +0 -1
  77. package/lib/hmr/update.d.cts +0 -8
  78. package/lib/hmr/update.d.cts.map +0 -1
  79. package/lib/index.cjs +0 -5
  80. package/lib/index.cjs.map +0 -1
  81. package/lib/index.d.cts +0 -4
  82. package/lib/index.d.cts.map +0 -1
  83. package/lib/index.mjs.map +0 -1
  84. package/lib/proxy-click-interceptor.cjs +0 -49
  85. package/lib/proxy-click-interceptor.cjs.map +0 -1
  86. package/lib/proxy-click-interceptor.d.cts +0 -4
  87. package/lib/proxy-click-interceptor.d.cts.map +0 -1
package/LICENSE.md CHANGED
@@ -12,7 +12,7 @@ copies or substantial portions of the Software.
12
12
 
13
13
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
14
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
16
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
17
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
18
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
package/README.md CHANGED
@@ -63,9 +63,6 @@ Help support our open-source development efforts by [becoming a patron](https://
63
63
  <a href="https://carrot.com/">
64
64
  <img src="https://cdn.roots.io/app/uploads/carrot.svg" alt="Carrot" width="200" height="150"/>
65
65
  </a>
66
- <a href="https://www.c21redwood.com/">
67
- <img src="https://cdn.roots.io/app/uploads/c21redwood.svg" alt="C21 Redwood Realty" width="200" height="150"/>
68
- </a>
69
66
  <a href="https://wordpress.com/">
70
67
  <img src="https://cdn.roots.io/app/uploads/wordpress.svg" alt="WordPress.com" width="200" height="150"/>
71
68
  </a>
@@ -0,0 +1,4 @@
1
+ declare let controllers: Array<Controller>;
2
+ declare const make: (options: Options) => Promise<Array<Controller>>;
3
+ export { controllers, make };
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,QAAA,IAAI,WAAW,EAAE,KAAK,CAAC,UAAU,CAAM,CAAA;AAEvC,QAAA,MAAM,IAAI,EAAE,CACV,OAAO,EAAE,OAAO,KACb,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAc7B,CAAA;AAED,OAAO,EAAC,WAAW,EAAE,IAAI,EAAC,CAAA"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.make = exports.controllers = void 0;
36
+ let controllers = [];
37
+ exports.controllers = controllers;
38
+ const make = (options) => __awaiter(void 0, void 0, void 0, function* () {
39
+ if (options.indicator && !customElements.get(`bud-activity-indicator`)) {
40
+ yield Promise.resolve().then(() => __importStar(require(`./indicator/index.js`))).then((controller) => __awaiter(void 0, void 0, void 0, function* () { return yield controller.make(); }))
41
+ .then(controller => controllers.push(controller));
42
+ }
43
+ if (options.overlay && !customElements.get(`bud-error`)) {
44
+ yield Promise.resolve().then(() => __importStar(require(`./overlay/index.js`))).then((controller) => __awaiter(void 0, void 0, void 0, function* () { return yield controller.make(); }))
45
+ .then(controller => controllers.push(controller));
46
+ }
47
+ return controllers;
48
+ });
49
+ exports.make = make;
@@ -1,4 +1,4 @@
1
1
  export declare const make: () => Promise<{
2
2
  update: (data: any) => void;
3
3
  }>;
4
- //# sourceMappingURL=index.d.cts.map
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/indicator/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI;2BAAwC,IAAI;EAM5D,CAAA"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.make = void 0;
13
+ const indicator_component_js_1 = require("./indicator.component.js");
14
+ const indicator_controller_js_1 = require("./indicator.controller.js");
15
+ const make = () => __awaiter(void 0, void 0, void 0, function* () {
16
+ if (customElements.get(`bud-activity-indicator`))
17
+ return;
18
+ customElements.define(`bud-activity-indicator`, indicator_component_js_1.Component);
19
+ return new indicator_controller_js_1.Controller();
20
+ });
21
+ exports.make = make;
@@ -24,11 +24,6 @@ export declare class Component extends HTMLElement {
24
24
  * @public
25
25
  */
26
26
  hideTimeout: NodeJS.Timer;
27
- /**
28
- * hmr status payload
29
- * @public
30
- */
31
- payload: any;
32
27
  /**
33
28
  * Get accessor: has errors
34
29
  * @public
@@ -44,6 +39,11 @@ export declare class Component extends HTMLElement {
44
39
  * @public
45
40
  */
46
41
  colors: Record<string, [number, number, number, number]>;
42
+ /**
43
+ * Class constructor
44
+ * @public
45
+ */
46
+ constructor();
47
47
  /**
48
48
  * Render status indicator
49
49
  * @public
@@ -80,6 +80,5 @@ export declare class Component extends HTMLElement {
80
80
  onWarning(): void;
81
81
  static get observedAttributes(): string[];
82
82
  attributeChangedCallback(): void;
83
- connectedCallback(): void;
84
83
  }
85
- //# sourceMappingURL=indicator.component.d.cts.map
84
+ //# sourceMappingURL=indicator.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"indicator.component.d.ts","sourceRoot":"","sources":["../../../src/components/indicator/indicator.component.ts"],"names":[],"mappings":";AAEA;;;GAGG;AACH,qBAAa,SAAU,SAAQ,WAAW;IACxC;;;OAGG;IACI,QAAQ,EAAE,OAAO,CAAA;IAExB;;;OAGG;IACI,IAAI,EAAE,MAAM,CAA2B;IAE9C;;;OAGG;IACH,IAAW,QAAQ,WAElB;IAED;;;OAGG;IACI,WAAW,EAAE,MAAM,CAAC,KAAK,CAAA;IAEhC;;;OAGG;IACH,IAAW,SAAS,IAAI,OAAO,CAE9B;IAED;;;OAGG;IACH,IAAW,WAAW,IAAI,OAAO,CAEhC;IAED;;;OAGG;IACI,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAK9D;IAED;;;OAGG;;IAMH;;;OAGG;IACI,YAAY;IA4CnB;;;OAGG;IACI,IAAI;IAKX;;OAEG;IACI,IAAI;IAMX;;;OAGG;IACI,SAAS;IAYhB;;;OAGG;IACI,SAAS;IAYhB;;;OAGG;IACI,OAAO;IASd;;;OAGG;IACI,SAAS;IAUhB,WAAkB,kBAAkB,aAEnC;IAEM,wBAAwB;CAiBhC"}
@@ -1,14 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Component = void 0;
4
- const indicator_pulse_cjs_1 = require("./indicator.pulse.cjs");
4
+ const indicator_pulse_js_1 = require("./indicator.pulse.js");
5
5
  /**
6
6
  * Indicator web component
7
7
  * @public
8
8
  */
9
9
  class Component extends HTMLElement {
10
+ /**
11
+ * Class constructor
12
+ * @public
13
+ */
10
14
  constructor() {
11
- super(...arguments);
15
+ super();
12
16
  /**
13
17
  * Component name
14
18
  * @public
@@ -24,6 +28,7 @@ class Component extends HTMLElement {
24
28
  warn: [252, 211, 77, 1],
25
29
  pending: [59, 130, 246, 1],
26
30
  };
31
+ this.renderShadow();
27
32
  }
28
33
  /**
29
34
  * Root div querySelector selector
@@ -37,21 +42,21 @@ class Component extends HTMLElement {
37
42
  * @public
38
43
  */
39
44
  get hasErrors() {
40
- return this.getAttribute('has-errors') == 'true';
45
+ return this.getAttribute(`has-errors`) == `true`;
41
46
  }
42
47
  /**
43
48
  * Get accessor: has warnings
44
49
  * @public
45
50
  */
46
51
  get hasWarnings() {
47
- return this.getAttribute('has-warnings') == 'true';
52
+ return this.getAttribute(`has-warnings`) == `true`;
48
53
  }
49
54
  /**
50
55
  * Render status indicator
51
56
  * @public
52
57
  */
53
58
  renderShadow() {
54
- const container = document.createElement('div');
59
+ const container = document.createElement(`div`);
55
60
  container.classList.add(this.name);
56
61
  container.innerHTML = `
57
62
  <style>
@@ -83,14 +88,14 @@ class Component extends HTMLElement {
83
88
  all .6s ease-in-out;
84
89
  }
85
90
 
86
- ${(0, indicator_pulse_cjs_1.pulse)(`success`, this.colors.success)}
87
- ${(0, indicator_pulse_cjs_1.pulse)(`error`, this.colors.error)}
88
- ${(0, indicator_pulse_cjs_1.pulse)(`warning`, this.colors.warn)}
89
- ${(0, indicator_pulse_cjs_1.pulse)(`pending`, this.colors.pending)}
91
+ ${(0, indicator_pulse_js_1.pulse)(`success`, this.colors.success)}
92
+ ${(0, indicator_pulse_js_1.pulse)(`error`, this.colors.error)}
93
+ ${(0, indicator_pulse_js_1.pulse)(`warning`, this.colors.warn)}
94
+ ${(0, indicator_pulse_js_1.pulse)(`pending`, this.colors.pending)}
90
95
 
91
96
  </style>
92
97
  `;
93
- this.attachShadow({ mode: 'open' }).appendChild(container);
98
+ this.attachShadow({ mode: `open` }).appendChild(container);
94
99
  }
95
100
  /**
96
101
  * Show status indicator
@@ -98,14 +103,14 @@ class Component extends HTMLElement {
98
103
  */
99
104
  show() {
100
105
  this.hideTimeout && clearTimeout(this.hideTimeout);
101
- this.shadowRoot.querySelector(this.selector).classList.add('show');
106
+ this.shadowRoot.querySelector(this.selector).classList.add(`show`);
102
107
  }
103
108
  /**
104
109
  * Hide status indicator
105
110
  */
106
111
  hide() {
107
112
  this.hideTimeout = setTimeout(() => {
108
- this.shadowRoot.querySelector(this.selector).classList.remove('show');
113
+ this.shadowRoot.querySelector(this.selector).classList.remove(`show`);
109
114
  }, 2000);
110
115
  }
111
116
  /**
@@ -117,7 +122,7 @@ class Component extends HTMLElement {
117
122
  this.shadowRoot
118
123
  .querySelector(this.selector)
119
124
  .classList.remove(`error`, `warning`, `success`);
120
- this.shadowRoot.querySelector(this.selector).classList.add('pending');
125
+ this.shadowRoot.querySelector(this.selector).classList.add(`pending`);
121
126
  this.hide();
122
127
  }
123
128
  /**
@@ -155,28 +160,20 @@ class Component extends HTMLElement {
155
160
  this.shadowRoot.querySelector(this.selector).classList.add(`warning`);
156
161
  }
157
162
  static get observedAttributes() {
158
- return ['has-errors', 'has-warnings', 'action'];
163
+ return [`has-errors`, `has-warnings`, `action`];
159
164
  }
160
165
  attributeChangedCallback() {
161
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
162
- if ((_b = (_a = this.payload) === null || _a === void 0 ? void 0 : _a.errors) === null || _b === void 0 ? void 0 : _b.length)
166
+ if (this.hasAttribute(`has-errors`))
163
167
  return this.onError();
164
- if ((_d = (_c = this.payload) === null || _c === void 0 ? void 0 : _c.warnings) === null || _d === void 0 ? void 0 : _d.length)
168
+ if (this.hasAttribute(`has-warnings`))
165
169
  return this.onWarning();
166
- if (!((_f = (_e = this.payload) === null || _e === void 0 ? void 0 : _e.errors) === null || _f === void 0 ? void 0 : _f.length) &&
167
- !((_h = (_g = this.payload) === null || _g === void 0 ? void 0 : _g.warnings) === null || _h === void 0 ? void 0 : _h.length) &&
168
- this.payload.action == 'built')
170
+ if (!this.hasAttribute(`has-errors`) &&
171
+ !this.hasAttribute(`has-warnings`) &&
172
+ this.getAttribute(`action`) === `built`)
169
173
  return this.onSuccess();
170
- if (((_j = this.payload) === null || _j === void 0 ? void 0 : _j.action) == 'building' ||
171
- ((_k = this.payload) === null || _k === void 0 ? void 0 : _k.action) == 'sync')
174
+ if (this.getAttribute(`action`) == `building` ||
175
+ this.getAttribute(`action`) == `sync`)
172
176
  return this.onPending();
173
177
  }
174
- connectedCallback() {
175
- if (!this.rendered) {
176
- this.renderShadow();
177
- this.rendered = true;
178
- }
179
- }
180
178
  }
181
179
  exports.Component = Component;
182
- //# sourceMappingURL=indicator.component.cjs.map
@@ -0,0 +1,45 @@
1
+ /// <reference types="node" />
2
+ /**
3
+ * Activity indicator controller
4
+ * @public
5
+ */
6
+ export declare class Controller {
7
+ /**
8
+ * DOM node
9
+ * @public
10
+ */
11
+ node: HTMLElement;
12
+ /**
13
+ * Active WHM payload
14
+ * @public
15
+ */
16
+ payload: any;
17
+ /**
18
+ * Timer handler
19
+ * @public
20
+ */
21
+ timer: NodeJS.Timeout;
22
+ /**
23
+ * Initialization
24
+ * @public
25
+ */
26
+ constructor();
27
+ /**
28
+ * Append `bud-error` element to the DOM
29
+ *
30
+ * @public
31
+ */
32
+ addNode(): void;
33
+ /**
34
+ * Remove `bud-error` element from the DOM (if present)
35
+ *
36
+ * @public
37
+ */
38
+ removeNode(): void;
39
+ /**
40
+ * Update activity indicator
41
+ * @public
42
+ */
43
+ update(payload: Payload): void;
44
+ }
45
+ //# sourceMappingURL=indicator.controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"indicator.controller.d.ts","sourceRoot":"","sources":["../../../src/components/indicator/indicator.controller.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH,qBAAa,UAAU;IACrB;;;OAGG;IACI,IAAI,EAAE,WAAW,CAAA;IAExB;;;OAGG;IACI,OAAO,MAAO;IAErB;;;OAGG;IACI,KAAK,EAAE,MAAM,CAAC,OAAO,CAAA;IAE5B;;;OAGG;;IAMH;;;;OAIG;IACI,OAAO;IAUd;;;;OAIG;IACI,UAAU;IAIjB;;;OAGG;IACI,MAAM,CAAC,OAAO,EAAE,OAAO;CAe/B"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Controller = void 0;
4
+ /**
5
+ * Activity indicator controller
6
+ * @public
7
+ */
8
+ class Controller {
9
+ /**
10
+ * Initialization
11
+ * @public
12
+ */
13
+ constructor() {
14
+ /**
15
+ * Active WHM payload
16
+ * @public
17
+ */
18
+ this.payload = null;
19
+ this.node = document.createElement(`bud-activity-indicator`);
20
+ this.update = this.update.bind(this);
21
+ }
22
+ /**
23
+ * Append `bud-error` element to the DOM
24
+ *
25
+ * @public
26
+ */
27
+ addNode() {
28
+ var _a;
29
+ if (document.body.querySelector(`bud-activity-indicator`)) {
30
+ if (typeof this.timer.unref === `function`)
31
+ this.timer.unref();
32
+ this.removeNode();
33
+ }
34
+ (_a = document.body) === null || _a === void 0 ? void 0 : _a.appendChild(this.node);
35
+ this.timer = setTimeout(this.removeNode, 3000);
36
+ }
37
+ /**
38
+ * Remove `bud-error` element from the DOM (if present)
39
+ *
40
+ * @public
41
+ */
42
+ removeNode() {
43
+ var _a;
44
+ (_a = document.body.querySelector(`bud-activity-indicator`)) === null || _a === void 0 ? void 0 : _a.remove();
45
+ }
46
+ /**
47
+ * Update activity indicator
48
+ * @public
49
+ */
50
+ update(payload) {
51
+ var _a, _b;
52
+ this.node.toggleAttribute(`has-errors`, ((_a = payload.errors) === null || _a === void 0 ? void 0 : _a.length) ? true : false);
53
+ this.node.toggleAttribute(`has-warnings`, ((_b = payload.warnings) === null || _b === void 0 ? void 0 : _b.length) ? true : false);
54
+ this.node.setAttribute(`action`, payload.action);
55
+ this.addNode();
56
+ }
57
+ }
58
+ exports.Controller = Controller;
@@ -6,4 +6,4 @@ export interface pulse {
6
6
  * @public
7
7
  */
8
8
  export declare const pulse: (name: string, color: [number, number, number, number]) => string;
9
- //# sourceMappingURL=indicator.pulse.d.cts.map
9
+ //# sourceMappingURL=indicator.pulse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"indicator.pulse.d.ts","sourceRoot":"","sources":["../../../src/components/indicator/indicator.pulse.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAA;CACxD;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,SACV,MAAM,SACL,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,KACtC,MA+BF,CAAA"}
@@ -38,4 +38,3 @@ const pulse = (name, color) => `
38
38
  }
39
39
  `;
40
40
  exports.pulse = pulse;
41
- //# sourceMappingURL=indicator.pulse.cjs.map
@@ -1,4 +1,4 @@
1
1
  export declare const make: () => Promise<{
2
2
  update: (data: any) => void;
3
3
  }>;
4
- //# sourceMappingURL=index.d.cts.map
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/overlay/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI;2BAAwC,IAAI;EAM5D,CAAA"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.make = void 0;
13
+ const overlay_component_js_1 = require("./overlay.component.js");
14
+ const overlay_controller_js_1 = require("./overlay.controller.js");
15
+ const make = () => __awaiter(void 0, void 0, void 0, function* () {
16
+ if (customElements.get(`bud-error`))
17
+ return;
18
+ customElements.define(`bud-error`, overlay_component_js_1.Component);
19
+ return new overlay_controller_js_1.Controller();
20
+ });
21
+ exports.make = make;
@@ -19,4 +19,4 @@ export declare class Component extends HTMLElement {
19
19
  attributeChangedCallback(): void;
20
20
  connectedCallback(): void;
21
21
  }
22
- //# sourceMappingURL=overlay.component.d.cts.map
22
+ //# sourceMappingURL=overlay.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay.component.d.ts","sourceRoot":"","sources":["../../../src/components/overlay/overlay.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,SAAU,SAAQ,WAAW;IACjC,IAAI,EAAE,MAAM,CAAgB;IAEnC;;;;OAIG;IACI,OAAO,EAAE,GAAG,CAAA;IAEZ,iBAAiB,EAAE,GAAG,CAAA;IAE7B,IAAW,OAAO,WAEjB;;IAOM,YAAY,IAAI,IAAI;IA+G3B,WAAkB,kBAAkB,aAEnC;IAEM,wBAAwB;IAsBxB,iBAAiB;CAGzB"}
@@ -13,11 +13,11 @@ class Component extends HTMLElement {
13
13
  this.renderShadow();
14
14
  }
15
15
  get message() {
16
- return this.getAttribute('message');
16
+ return this.getAttribute(`message`);
17
17
  }
18
18
  renderShadow() {
19
- const container = document.createElement('div');
20
- container.classList.add('overlay');
19
+ const container = document.createElement(`div`);
20
+ container.classList.add(`overlay`);
21
21
  container.innerHTML = `
22
22
  <style>
23
23
  .overlay {
@@ -39,18 +39,20 @@ class Component extends HTMLElement {
39
39
  }
40
40
 
41
41
  .visible {
42
- border-top: 5px solid red;
42
+ position: fixed;
43
43
  top: 0;
44
+ z-index: 9998;
44
45
  opacity: 1;
46
+ border-top: 5px solid red;
45
47
  transition: opacity 0.2s ease-in-out, border 0.4s ease-in-out;
46
- z-index: 9998;
47
48
  max-width: 100vw;
48
49
  }
49
50
 
50
51
  .messages {
51
52
  background-color: white;
52
53
  border-radius: 5px;
53
- filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow(0 1px 1px rgb(0 0 0 / 0.06)); display: flex;
54
+ filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow(0 1px 1px rgb(0 0 0 / 0.06));
55
+ display: flex;
54
56
  align-self: center;
55
57
  width: 800px;
56
58
  max-width: 90vw;
@@ -85,12 +87,6 @@ class Component extends HTMLElement {
85
87
  max-width:95vw;
86
88
  }
87
89
 
88
- .messages > div > span {
89
- font-size: 1.2rem;
90
- line-height: 2rem;
91
- font-weight: 300;
92
- }
93
-
94
90
  .messages > div > pre {
95
91
  font-weight: 300;
96
92
  font-size: 0.8rem;
@@ -126,26 +122,26 @@ class Component extends HTMLElement {
126
122
  </style>
127
123
  <div class="messages"></div>
128
124
  `;
129
- this.attachShadow({ mode: 'open' }).appendChild(container);
125
+ this.attachShadow({ mode: `open` }).appendChild(container);
130
126
  }
131
127
  static get observedAttributes() {
132
- return ['message'];
128
+ return [`message`];
133
129
  }
134
130
  attributeChangedCallback() {
135
131
  var _a, _b, _c;
136
132
  if (!this.documentBodyStyle)
137
133
  this.documentBodyStyle = (_a = document.body) === null || _a === void 0 ? void 0 : _a.style;
138
- if (this.getAttribute('message')) {
139
- document.body.style.overflow = 'hidden';
140
- this.shadowRoot.querySelector('.overlay').classList.add(`visible`);
141
- this.shadowRoot.querySelector('.messages').innerHTML =
142
- this.getAttribute('message');
134
+ if (this.getAttribute(`message`)) {
135
+ document.body.style.overflow = `hidden`;
136
+ this.shadowRoot.querySelector(`.overlay`).classList.add(`visible`);
137
+ this.shadowRoot.querySelector(`.messages`).innerHTML =
138
+ this.getAttribute(`message`);
143
139
  return;
144
140
  }
145
141
  if (((_b = this.documentBodyStyle) === null || _b === void 0 ? void 0 : _b.overflow) && ((_c = document === null || document === void 0 ? void 0 : document.body) === null || _c === void 0 ? void 0 : _c.style)) {
146
142
  document.body.style.overflow = this.documentBodyStyle.overflow;
147
143
  }
148
- this.shadowRoot.querySelector('.overlay').classList.remove(`visible`);
144
+ this.shadowRoot.querySelector(`.overlay`).classList.remove(`visible`);
149
145
  }
150
146
  connectedCallback() {
151
147
  var _a;
@@ -154,4 +150,3 @@ class Component extends HTMLElement {
154
150
  }
155
151
  }
156
152
  exports.Component = Component;
157
- //# sourceMappingURL=overlay.component.cjs.map
@@ -1,8 +1,3 @@
1
- import type Webpack from 'webpack';
2
- interface Payload {
3
- hash: string;
4
- errors: Array<Webpack.StatsError>;
5
- }
6
1
  /**
7
2
  * Overlay controller
8
3
  * @public
@@ -48,5 +43,4 @@ export declare class Controller {
48
43
  */
49
44
  update(payload: Payload): void;
50
45
  }
51
- export {};
52
- //# sourceMappingURL=overlay.controller.d.cts.map
46
+ //# sourceMappingURL=overlay.controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay.controller.d.ts","sourceRoot":"","sources":["../../../src/components/overlay/overlay.controller.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,qBAAa,UAAU;IACrB;;;OAGG;IACI,OAAO,EAAE,WAAW,CAAA;IAE3B;;;OAGG;IACI,OAAO,EAAE,OAAO,CAAA;IAEvB;;;OAGG;IACH,IAAW,OAAO,IAAI,MAAM,CAQ3B;IAED;;;;OAIG;;IAMH;;;;OAIG;IACI,WAAW;IAKlB;;;;OAIG;IACI,WAAW;IAIlB;;;;OAIG;IACI,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;CAWtC"}
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.Controller = void 0;
4
- const stripAnsi = require("strip-ansi");
7
+ const strip_ansi_1 = __importDefault(require("strip-ansi"));
5
8
  /**
6
9
  * Overlay controller
7
10
  * @public
@@ -14,7 +17,7 @@ class Controller {
14
17
  */
15
18
  constructor() {
16
19
  this.update = this.update.bind(this);
17
- this.element = document.createElement('bud-error');
20
+ this.element = document.createElement(`bud-error`);
18
21
  }
19
22
  /**
20
23
  * Formatted error message
@@ -23,11 +26,10 @@ class Controller {
23
26
  get message() {
24
27
  var _a;
25
28
  return (_a = this.payload.errors) === null || _a === void 0 ? void 0 : _a.reduce((a, c) => {
26
- var _a, _b;
29
+ var _a;
27
30
  return `${a}
28
31
  <div>
29
- <span>${(_a = c === null || c === void 0 ? void 0 : c.title) !== null && _a !== void 0 ? _a : 'Compilation error'}</span>
30
- <pre>${(_b = stripAnsi.default(c === null || c === void 0 ? void 0 : c.message)) !== null && _b !== void 0 ? _b : ''}</pre>
32
+ <pre>${(_a = (0, strip_ansi_1.default)(c === null || c === void 0 ? void 0 : c.message)) !== null && _a !== void 0 ? _a : ``}</pre>
31
33
  </div>`;
32
34
  }, ``);
33
35
  }
@@ -38,7 +40,7 @@ class Controller {
38
40
  */
39
41
  createError() {
40
42
  var _a;
41
- !document.body.querySelector('bud-error') &&
43
+ !document.body.querySelector(`bud-error`) &&
42
44
  ((_a = document.body) === null || _a === void 0 ? void 0 : _a.appendChild(this.element));
43
45
  }
44
46
  /**
@@ -48,7 +50,7 @@ class Controller {
48
50
  */
49
51
  removeError() {
50
52
  var _a;
51
- (_a = document.body.querySelector('bud-error')) === null || _a === void 0 ? void 0 : _a.remove();
53
+ (_a = document.body.querySelector(`bud-error`)) === null || _a === void 0 ? void 0 : _a.remove();
52
54
  }
53
55
  /**
54
56
  * Update DOM
@@ -58,12 +60,11 @@ class Controller {
58
60
  update(payload) {
59
61
  var _a, _b;
60
62
  this.payload = payload;
61
- this.element.setAttribute('message', (_a = this.message) !== null && _a !== void 0 ? _a : ``);
62
- if ((_b = this.payload.errors) === null || _b === void 0 ? void 0 : _b.length) {
63
+ this.element.setAttribute(`message`, (_a = this.message) !== null && _a !== void 0 ? _a : ``);
64
+ if (((_b = this.payload.errors) === null || _b === void 0 ? void 0 : _b.length) > 0) {
63
65
  return this.createError();
64
66
  }
65
67
  this.removeError();
66
68
  }
67
69
  }
68
70
  exports.Controller = Controller;
69
- //# sourceMappingURL=overlay.controller.cjs.map