@roots/bud-client 6.10.0 → 6.12.0

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 (63) hide show
  1. package/lib/hot/client.d.ts +6 -0
  2. package/lib/hot/client.d.ts.map +1 -0
  3. package/lib/hot/client.js +135 -0
  4. package/lib/hot/components/index.d.ts +2 -0
  5. package/lib/hot/components/index.d.ts.map +1 -0
  6. package/lib/hot/components/index.js +32 -0
  7. package/lib/hot/components/indicator/index.d.ts +4 -0
  8. package/lib/hot/components/indicator/index.d.ts.map +1 -0
  9. package/lib/hot/components/indicator/index.js +17 -0
  10. package/lib/hot/components/indicator/indicator.component.d.ts +69 -0
  11. package/lib/hot/components/indicator/indicator.component.d.ts.map +1 -0
  12. package/lib/hot/components/indicator/indicator.component.js +162 -0
  13. package/lib/hot/components/indicator/indicator.controller.d.ts +35 -0
  14. package/lib/hot/components/indicator/indicator.controller.d.ts.map +1 -0
  15. package/lib/hot/components/indicator/indicator.controller.js +46 -0
  16. package/lib/hot/components/indicator/indicator.pulse.d.ts +8 -0
  17. package/lib/hot/components/indicator/indicator.pulse.d.ts.map +1 -0
  18. package/lib/hot/components/indicator/indicator.pulse.js +35 -0
  19. package/lib/hot/components/overlay/index.d.ts +4 -0
  20. package/lib/hot/components/overlay/index.d.ts.map +1 -0
  21. package/lib/hot/components/overlay/index.js +17 -0
  22. package/lib/hot/components/overlay/overlay.component.d.ts +18 -0
  23. package/lib/hot/components/overlay/overlay.component.d.ts.map +1 -0
  24. package/lib/hot/components/overlay/overlay.component.js +146 -0
  25. package/lib/hot/components/overlay/overlay.controller.d.ts +34 -0
  26. package/lib/hot/components/overlay/overlay.controller.d.ts.map +1 -0
  27. package/lib/hot/components/overlay/overlay.controller.js +60 -0
  28. package/lib/hot/events.d.ts +98 -0
  29. package/lib/hot/events.d.ts.map +1 -0
  30. package/lib/hot/events.js +87 -0
  31. package/lib/hot/index.cjs +5 -0
  32. package/lib/hot/index.d.cts +2 -0
  33. package/lib/hot/index.d.cts.map +1 -0
  34. package/lib/hot/index.d.mts +2 -0
  35. package/lib/hot/index.d.mts.map +1 -0
  36. package/lib/hot/index.mjs +17 -0
  37. package/lib/hot/log.d.ts +11 -0
  38. package/lib/hot/log.d.ts.map +1 -0
  39. package/lib/hot/log.js +37 -0
  40. package/lib/hot/options.d.ts +14 -0
  41. package/lib/hot/options.d.ts.map +1 -0
  42. package/lib/hot/options.js +30 -0
  43. package/lib/index.cjs +3 -0
  44. package/lib/index.d.cts +13 -0
  45. package/lib/index.d.cts.map +1 -0
  46. package/lib/index.d.mts +13 -0
  47. package/lib/index.d.mts.map +1 -0
  48. package/lib/index.mjs +3 -0
  49. package/lib/intercept/index.d.ts +3 -0
  50. package/lib/intercept/index.d.ts.map +1 -0
  51. package/lib/intercept/index.js +18 -0
  52. package/lib/intercept/proxy-click-interceptor.d.ts +2 -0
  53. package/lib/intercept/proxy-click-interceptor.d.ts.map +1 -0
  54. package/lib/intercept/proxy-click-interceptor.js +26 -0
  55. package/package.json +28 -19
  56. package/src/hot/client.ts +0 -8
  57. package/src/hot/components/indicator/indicator.component.ts +0 -15
  58. package/src/hot/components/indicator/indicator.controller.ts +0 -10
  59. package/src/hot/components/indicator/indicator.pulse.ts +0 -1
  60. package/src/hot/components/overlay/overlay.component.ts +0 -2
  61. package/src/hot/components/overlay/overlay.controller.ts +0 -12
  62. package/src/hot/events.ts +0 -2
  63. package/src/hot/options.ts +0 -3
@@ -0,0 +1,26 @@
1
+ /* eslint-disable no-console */
2
+ /* global __resourceQuery */
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ import intercept from './index.js';
13
+ window.requestAnimationFrame(function ready() {
14
+ return __awaiter(this, void 0, void 0, function* () {
15
+ if (!__resourceQuery)
16
+ return;
17
+ const params = new URLSearchParams(__resourceQuery);
18
+ if (!params || !params.has(`search`) || !params.has(`replace`))
19
+ return;
20
+ const search = decodeURI(params.get(`search`));
21
+ const replace = decodeURI(params.get(`replace`));
22
+ return document.body
23
+ ? intercept(search, replace)
24
+ : window.requestAnimationFrame(ready);
25
+ });
26
+ });
package/package.json CHANGED
@@ -1,12 +1,9 @@
1
1
  {
2
2
  "name": "@roots/bud-client",
3
+ "version": "6.12.0",
3
4
  "description": "Client scripts for @roots/bud",
4
- "version": "6.10.0",
5
- "homepage": "https://roots.io/bud",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/roots/bud.git",
9
- "directory": "sources/@roots/bud-client"
5
+ "engines": {
6
+ "node": ">=16"
10
7
  },
11
8
  "contributors": [
12
9
  {
@@ -21,46 +18,58 @@
21
18
  }
22
19
  ],
23
20
  "license": "MIT",
24
- "bugs": {
25
- "url": "https://github.com/roots/bud/issues"
26
- },
21
+ "homepage": "https://roots.io/bud",
27
22
  "funding": {
28
23
  "type": "github sponsors",
29
24
  "url": "https://github.com/sponsors/roots"
30
25
  },
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/roots/bud.git",
29
+ "directory": "sources/@roots/bud-client"
30
+ },
31
+ "bugs": "https://github.com/roots/bud/issues",
31
32
  "keywords": [
32
33
  "bud",
33
34
  "bud-framework"
34
35
  ],
35
- "engines": {
36
- "node": ">=16"
37
- },
38
36
  "files": [
39
37
  "docs",
40
38
  "lib",
41
39
  "src"
42
40
  ],
43
- "main": "./lib/index.cjs",
44
- "module": "./lib/index.mjs",
45
- "types": "./lib/index.d.ts",
46
41
  "exports": {
47
42
  ".": {
48
- "types": "./lib/index.d.mts",
49
43
  "require": "./lib/index.cjs",
50
44
  "default": "./lib/index.mjs"
51
45
  },
52
46
  "./lib/*": {
53
- "types": "./lib/*.d.mts",
54
47
  "require": "./lib/*",
55
48
  "default": "./lib/*"
56
49
  }
57
50
  },
51
+ "typesVersions": {
52
+ "*": {
53
+ ".": [
54
+ "./lib/index.d.ts"
55
+ ],
56
+ "./lib/*": [
57
+ "./lib/*"
58
+ ]
59
+ }
60
+ },
61
+ "types": "./lib/index.d.ts",
62
+ "main": "./lib/index.cjs",
63
+ "module": "./lib/index.mjs",
58
64
  "devDependencies": {
59
- "@roots/bud": "6.10.0",
65
+ "@roots/bud": "6.12.0",
60
66
  "@skypack/package-check": "0.2.2",
61
- "@types/node": "18.11.18",
67
+ "@types/node": "18.15.10",
62
68
  "@types/webpack-env": "1.18.0"
63
69
  },
70
+ "dependencies": {
71
+ "tslib": "2.5.0"
72
+ },
64
73
  "peerDependencies": {
65
74
  "@roots/bud": "*",
66
75
  "@types/webpack-env": "*"
package/src/hot/client.ts CHANGED
@@ -54,8 +54,6 @@ export const client = async (
54
54
 
55
55
  /**
56
56
  * Webpack HMR check handler
57
- *
58
- * @internal
59
57
  */
60
58
  const check = async () => {
61
59
  if (webpackHot.status() === `idle`) {
@@ -73,8 +71,6 @@ export const client = async (
73
71
 
74
72
  /**
75
73
  * Webpack HMR unaccepted module handler
76
- *
77
- * @internal
78
74
  */
79
75
  const onUnacceptedOrDeclined = (
80
76
  info: __WebpackModuleApi.HotNotifierInfo,
@@ -85,8 +81,6 @@ export const client = async (
85
81
 
86
82
  /**
87
83
  * Webpack HMR error handler
88
- *
89
- * @internal
90
84
  */
91
85
  const onErrored = (error: any) => {
92
86
  window.bud.controllers.map(controller =>
@@ -98,8 +92,6 @@ export const client = async (
98
92
 
99
93
  /**
100
94
  * Webpack HMR update handler
101
- *
102
- * @internal
103
95
  */
104
96
  const update = async () => {
105
97
  try {
@@ -2,24 +2,20 @@ import {pulse} from './indicator.pulse.js'
2
2
 
3
3
  /**
4
4
  * Indicator web component
5
- * @public
6
5
  */
7
6
  export class Component extends HTMLElement {
8
7
  /**
9
8
  * Has component rendered
10
- * @public
11
9
  */
12
10
  public rendered: boolean
13
11
 
14
12
  /**
15
13
  * Component name
16
- * @public
17
14
  */
18
15
  public name: string = `bud-activity-indicator`
19
16
 
20
17
  /**
21
18
  * Root div querySelector selector
22
- * @public
23
19
  */
24
20
  public get selector() {
25
21
  return `.${this.name}`
@@ -27,13 +23,11 @@ export class Component extends HTMLElement {
27
23
 
28
24
  /**
29
25
  * Timer
30
- * @public
31
26
  */
32
27
  public hideTimeout: NodeJS.Timer
33
28
 
34
29
  /**
35
30
  * Get accessor: has errors
36
- * @public
37
31
  */
38
32
  public get hasErrors(): boolean {
39
33
  return this.getAttribute(`has-errors`) == `true`
@@ -41,7 +35,6 @@ export class Component extends HTMLElement {
41
35
 
42
36
  /**
43
37
  * Get accessor: has warnings
44
- * @public
45
38
  */
46
39
  public get hasWarnings(): boolean {
47
40
  return this.getAttribute(`has-warnings`) == `true`
@@ -49,7 +42,6 @@ export class Component extends HTMLElement {
49
42
 
50
43
  /**
51
44
  * Status indicator colors
52
- * @public
53
45
  */
54
46
  public colors: Record<string, [number, number, number, number]> = {
55
47
  success: [4, 120, 87, 1],
@@ -60,7 +52,6 @@ export class Component extends HTMLElement {
60
52
 
61
53
  /**
62
54
  * Class constructor
63
- * @public
64
55
  */
65
56
  public constructor() {
66
57
  super()
@@ -69,7 +60,6 @@ export class Component extends HTMLElement {
69
60
 
70
61
  /**
71
62
  * Render status indicator
72
- * @public
73
63
  */
74
64
  public renderShadow() {
75
65
  const container = document.createElement(`div`)
@@ -117,7 +107,6 @@ export class Component extends HTMLElement {
117
107
 
118
108
  /**
119
109
  * Show status indicator
120
- * @public
121
110
  */
122
111
  public show() {
123
112
  this.hideTimeout && clearTimeout(this.hideTimeout)
@@ -135,7 +124,6 @@ export class Component extends HTMLElement {
135
124
 
136
125
  /**
137
126
  * Status is pending
138
- * @public
139
127
  */
140
128
  public onPending() {
141
129
  this.show()
@@ -151,7 +139,6 @@ export class Component extends HTMLElement {
151
139
 
152
140
  /**
153
141
  * Status is success
154
- * @public
155
142
  */
156
143
  public onSuccess() {
157
144
  this.show()
@@ -167,7 +154,6 @@ export class Component extends HTMLElement {
167
154
 
168
155
  /**
169
156
  * Status is error
170
- * @public
171
157
  */
172
158
  public onError() {
173
159
  this.show()
@@ -180,7 +166,6 @@ export class Component extends HTMLElement {
180
166
 
181
167
  /**
182
168
  * Status is warning
183
- * @public
184
169
  */
185
170
  public onWarning() {
186
171
  this.show()
@@ -1,29 +1,24 @@
1
1
  /**
2
2
  * Activity indicator controller
3
- * @public
4
3
  */
5
4
  export class Controller {
6
5
  /**
7
6
  * DOM node
8
- * @public
9
7
  */
10
8
  public node: HTMLElement
11
9
 
12
10
  /**
13
11
  * Active WHM payload
14
- * @public
15
12
  */
16
13
  public payload = null
17
14
 
18
15
  /**
19
16
  * Timer handler
20
- * @public
21
17
  */
22
18
  public timer: NodeJS.Timeout
23
19
 
24
20
  /**
25
21
  * Initialization
26
- * @public
27
22
  */
28
23
  public constructor() {
29
24
  this.node = document.createElement(`bud-activity-indicator`)
@@ -32,8 +27,6 @@ export class Controller {
32
27
 
33
28
  /**
34
29
  * Append `bud-error` element to the DOM
35
- *
36
- * @public
37
30
  */
38
31
  public addNode() {
39
32
  if (document.body.querySelector(`bud-activity-indicator`)) {
@@ -47,8 +40,6 @@ export class Controller {
47
40
 
48
41
  /**
49
42
  * Remove `bud-error` element from the DOM (if present)
50
- *
51
- * @public
52
43
  */
53
44
  public removeNode() {
54
45
  document.body.querySelector(`bud-activity-indicator`)?.remove()
@@ -56,7 +47,6 @@ export class Controller {
56
47
 
57
48
  /**
58
49
  * Update activity indicator
59
- * @public
60
50
  */
61
51
  public update(payload: Payload) {
62
52
  this.node.toggleAttribute(
@@ -4,7 +4,6 @@ export interface pulse {
4
4
 
5
5
  /**
6
6
  * CSS animation for reload indicator
7
- * @public
8
7
  */
9
8
  export const pulse = (
10
9
  name: string,
@@ -6,8 +6,6 @@ export class Component extends HTMLElement {
6
6
 
7
7
  /**
8
8
  * WHM payload
9
- *
10
- * @public
11
9
  */
12
10
  public payload: any
13
11
 
@@ -8,24 +8,20 @@ const stripAnsi = (body: string) =>
8
8
 
9
9
  /**
10
10
  * Overlay controller
11
- * @public
12
11
  */
13
12
  export class Controller {
14
13
  /**
15
14
  * Element
16
- * @public
17
15
  */
18
16
  public element: HTMLElement
19
17
 
20
18
  /**
21
19
  * HMR update
22
- * @public
23
20
  */
24
21
  public payload: Payload
25
22
 
26
23
  /**
27
24
  * Formatted error message
28
- * @public
29
25
  */
30
26
  public get message(): string {
31
27
  return this.payload.errors?.reduce((a, c) => {
@@ -40,8 +36,6 @@ export class Controller {
40
36
 
41
37
  /**
42
38
  * Class constructor
43
- *
44
- * @public
45
39
  */
46
40
  public constructor() {
47
41
  this.update = this.update.bind(this)
@@ -50,8 +44,6 @@ export class Controller {
50
44
 
51
45
  /**
52
46
  * Append `bud-error` element to the DOM
53
- *
54
- * @public
55
47
  */
56
48
  public createError() {
57
49
  !document.body.querySelector(`bud-error`) &&
@@ -60,8 +52,6 @@ export class Controller {
60
52
 
61
53
  /**
62
54
  * Remove `bud-error` element from the DOM (if present)
63
- *
64
- * @public
65
55
  */
66
56
  public removeError() {
67
57
  document.body.querySelector(`bud-error`)?.remove()
@@ -69,8 +59,6 @@ export class Controller {
69
59
 
70
60
  /**
71
61
  * Update DOM
72
- *
73
- * @public
74
62
  */
75
63
  public update(payload: Payload): void {
76
64
  this.payload = payload
package/src/hot/events.ts CHANGED
@@ -9,8 +9,6 @@ export const injectEvents = (
9
9
  * @remarks
10
10
  * wraps EventSource in a function to allow for
11
11
  * mocking in tests
12
- *
13
- * @public
14
12
  */
15
13
  return class Events extends eventSource {
16
14
  /**
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * Client options
3
- * @public
4
3
  */
5
4
  let data: Options = {
6
5
  timeout: 2000,
@@ -15,14 +14,12 @@ let data: Options = {
15
14
 
16
15
  /**
17
16
  * Get client option
18
- * @public
19
17
  */
20
18
  const get = (name?: string, key?: string) =>
21
19
  key ? data[name][key] : data[name]
22
20
 
23
21
  /**
24
22
  * Set client data based on URL parameters
25
- * @public
26
23
  */
27
24
  const setFromParameters = (query: string): Options => {
28
25
  let parsedParams: Partial<Options> = {}