@cdc/core 4.22.10 → 4.22.11

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 (73) hide show
  1. package/README.md +1 -1
  2. package/components/AdvancedEditor.js +52 -67
  3. package/components/ErrorBoundary.jsx +10 -11
  4. package/components/GlobalContext.jsx +2 -6
  5. package/components/LegendCircle.jsx +3 -4
  6. package/components/Loading.jsx +14 -12
  7. package/components/Waiting.jsx +14 -5
  8. package/components/elements/Button.jsx +34 -45
  9. package/components/elements/Card.jsx +1 -1
  10. package/components/inputs/InputCheckbox.jsx +32 -35
  11. package/components/inputs/InputGroup.jsx +38 -17
  12. package/components/inputs/InputSelect.jsx +27 -23
  13. package/components/inputs/InputText.jsx +9 -25
  14. package/components/inputs/InputToggle.jsx +29 -33
  15. package/components/managers/DataDesigner.jsx +87 -64
  16. package/components/ui/Accordion.jsx +18 -30
  17. package/components/ui/Icon.jsx +34 -35
  18. package/components/ui/LoadSpin.jsx +6 -11
  19. package/components/ui/Modal.jsx +40 -44
  20. package/components/ui/Overlay.jsx +12 -23
  21. package/components/ui/OverlayFrame.jsx +1 -5
  22. package/components/ui/Tooltip.jsx +8 -28
  23. package/data/colorPalettes.js +29 -266
  24. package/data/dataDesignerTables.js +107 -107
  25. package/data/themes.js +13 -13
  26. package/helpers/DataTransform.js +92 -92
  27. package/helpers/cacheBustingString.js +3 -3
  28. package/helpers/events.js +5 -6
  29. package/helpers/fetchRemoteData.js +31 -33
  30. package/helpers/getViewport.js +15 -15
  31. package/helpers/numberFromString.js +7 -7
  32. package/helpers/updatePaletteNames.js +15 -17
  33. package/helpers/useDataVizClasses.js +38 -35
  34. package/helpers/validateFipsCodeLength.js +41 -56
  35. package/package.json +2 -2
  36. package/styles/_data-table.scss +32 -27
  37. package/styles/_global.scss +29 -24
  38. package/styles/_mixins.scss +12 -12
  39. package/styles/_reset.scss +85 -16
  40. package/styles/_variables.scss +5 -5
  41. package/styles/base.scss +99 -48
  42. package/styles/heading-colors.scss +6 -2
  43. package/styles/loading.scss +62 -60
  44. package/styles/v2/base/_file-selector.scss +2 -2
  45. package/styles/v2/base/_general.scss +1 -1
  46. package/styles/v2/base/_reset.scss +2 -2
  47. package/styles/v2/base/index.scss +4 -4
  48. package/styles/v2/components/accordion.scss +13 -13
  49. package/styles/v2/components/button.scss +3 -3
  50. package/styles/v2/components/card.scss +1 -1
  51. package/styles/v2/components/data-designer.scss +7 -6
  52. package/styles/v2/components/editor.scss +52 -51
  53. package/styles/v2/components/guidance-block.scss +6 -6
  54. package/styles/v2/components/input/_input-check-radio.scss +7 -7
  55. package/styles/v2/components/input/_input-group.scss +2 -2
  56. package/styles/v2/components/input/_input-slider.scss +2 -3
  57. package/styles/v2/components/input/index.scss +6 -6
  58. package/styles/v2/components/loadspin.scss +1 -1
  59. package/styles/v2/components/modal.scss +2 -2
  60. package/styles/v2/components/overlay.scss +4 -4
  61. package/styles/v2/layout/_alert.scss +8 -8
  62. package/styles/v2/layout/_component.scss +1 -1
  63. package/styles/v2/layout/_data-table.scss +12 -11
  64. package/styles/v2/layout/_progression.scss +8 -6
  65. package/styles/v2/layout/index.scss +5 -5
  66. package/styles/v2/main.scss +7 -7
  67. package/styles/v2/themes/_color-definitions.scss +77 -24
  68. package/styles/v2/themes/index.scss +1 -1
  69. package/styles/v2/utils/_animations.scss +2 -2
  70. package/styles/v2/utils/_breakpoints.scss +53 -12
  71. package/styles/v2/utils/_variables.scss +5 -5
  72. package/styles/v2/utils/index.scss +8 -8
  73. package/styles/waiting.scss +22 -23
@@ -4,40 +4,40 @@ export const DATA_TABLE_VERTICAL = (
4
4
  <>
5
5
  <table>
6
6
  <tbody>
7
- <tr>
8
- <th>Date</th>
9
- <th>Value</th>
10
- <th>...</th>
11
- </tr>
12
- <tr>
13
- <td>01/01/2020</td>
14
- <td>150</td>
15
- <td>...</td>
16
- </tr>
17
- <tr>
18
- <td>02/01/2020</td>
19
- <td>150</td>
20
- <td>...</td>
21
- </tr>
7
+ <tr>
8
+ <th>Date</th>
9
+ <th>Value</th>
10
+ <th>...</th>
11
+ </tr>
12
+ <tr>
13
+ <td>01/01/2020</td>
14
+ <td>150</td>
15
+ <td>...</td>
16
+ </tr>
17
+ <tr>
18
+ <td>02/01/2020</td>
19
+ <td>150</td>
20
+ <td>...</td>
21
+ </tr>
22
22
  </tbody>
23
23
  </table>
24
24
  <table>
25
25
  <tbody>
26
- <tr>
27
- <th>State</th>
28
- <th>Value</th>
29
- <th>...</th>
30
- </tr>
31
- <tr>
32
- <td>Georgia</td>
33
- <td>150</td>
34
- <td>...</td>
35
- </tr>
36
- <tr>
37
- <td>Florida</td>
38
- <td>150</td>
39
- <td>...</td>
40
- </tr>
26
+ <tr>
27
+ <th>State</th>
28
+ <th>Value</th>
29
+ <th>...</th>
30
+ </tr>
31
+ <tr>
32
+ <td>Georgia</td>
33
+ <td>150</td>
34
+ <td>...</td>
35
+ </tr>
36
+ <tr>
37
+ <td>Florida</td>
38
+ <td>150</td>
39
+ <td>...</td>
40
+ </tr>
41
41
  </tbody>
42
42
  </table>
43
43
  </>
@@ -47,34 +47,34 @@ export const DATA_TABLE_HORIZONTAL = (
47
47
  <>
48
48
  <table>
49
49
  <tbody>
50
- <tr>
51
- <th>Date</th>
52
- <td>01/01/2020</td>
53
- <td>02/01/2020</td>
54
- <td>...</td>
55
- </tr>
56
- <tr>
57
- <th>Value</th>
58
- <td>100</td>
59
- <td>150</td>
60
- <td>...</td>
61
- </tr>
50
+ <tr>
51
+ <th>Date</th>
52
+ <td>01/01/2020</td>
53
+ <td>02/01/2020</td>
54
+ <td>...</td>
55
+ </tr>
56
+ <tr>
57
+ <th>Value</th>
58
+ <td>100</td>
59
+ <td>150</td>
60
+ <td>...</td>
61
+ </tr>
62
62
  </tbody>
63
63
  </table>
64
64
  <table>
65
65
  <tbody>
66
- <tr>
67
- <th>State</th>
68
- <td>Georgia</td>
69
- <td>Florida</td>
70
- <td>...</td>
71
- </tr>
72
- <tr>
73
- <th>Value</th>
74
- <td>100</td>
75
- <td>150</td>
76
- <td>...</td>
77
- </tr>
66
+ <tr>
67
+ <th>State</th>
68
+ <td>Georgia</td>
69
+ <td>Florida</td>
70
+ <td>...</td>
71
+ </tr>
72
+ <tr>
73
+ <th>Value</th>
74
+ <td>100</td>
75
+ <td>150</td>
76
+ <td>...</td>
77
+ </tr>
78
78
  </tbody>
79
79
  </table>
80
80
  </>
@@ -83,24 +83,24 @@ export const DATA_TABLE_HORIZONTAL = (
83
83
  export const DATA_TABLE_SINGLE_ROW = (
84
84
  <table>
85
85
  <tbody>
86
- <tr>
87
- <th>Date</th>
88
- <th>Virus 1</th>
89
- <th>Virus 2</th>
90
- <th>...</th>
91
- </tr>
92
- <tr>
93
- <td>01/01/2020</td>
94
- <td>100</td>
95
- <td>150</td>
96
- <td>...</td>
97
- </tr>
98
- <tr>
99
- <td>02/01/2020</td>
100
- <td>15</td>
101
- <td>20</td>
102
- <td>...</td>
103
- </tr>
86
+ <tr>
87
+ <th>Date</th>
88
+ <th>Virus 1</th>
89
+ <th>Virus 2</th>
90
+ <th>...</th>
91
+ </tr>
92
+ <tr>
93
+ <td>01/01/2020</td>
94
+ <td>100</td>
95
+ <td>150</td>
96
+ <td>...</td>
97
+ </tr>
98
+ <tr>
99
+ <td>02/01/2020</td>
100
+ <td>15</td>
101
+ <td>20</td>
102
+ <td>...</td>
103
+ </tr>
104
104
  </tbody>
105
105
  </table>
106
106
  )
@@ -108,41 +108,41 @@ export const DATA_TABLE_SINGLE_ROW = (
108
108
  export const DATA_TABLE_MULTI_ROW = (
109
109
  <table>
110
110
  <tbody>
111
- <tr>
112
- <th>Virus</th>
113
- <th>Date</th>
114
- <th>Value</th>
115
- </tr>
116
- <tr>
117
- <td>Virus 1</td>
118
- <td>01/01/2020</td>
119
- <td>100</td>
120
- </tr>
121
- <tr>
122
- <td>Virus 1</td>
123
- <td>02/01/2020</td>
124
- <td>150</td>
125
- </tr>
126
- <tr>
127
- <td>...</td>
128
- <td>...</td>
129
- <td>...</td>
130
- </tr>
131
- <tr>
132
- <td>Virus 2</td>
133
- <td>01/01/2020</td>
134
- <td>15</td>
135
- </tr>
136
- <tr>
137
- <td>Virus 2</td>
138
- <td>02/01/2020</td>
139
- <td>20</td>
140
- </tr>
141
- <tr>
142
- <td>...</td>
143
- <td>...</td>
144
- <td>...</td>
145
- </tr>
111
+ <tr>
112
+ <th>Virus</th>
113
+ <th>Date</th>
114
+ <th>Value</th>
115
+ </tr>
116
+ <tr>
117
+ <td>Virus 1</td>
118
+ <td>01/01/2020</td>
119
+ <td>100</td>
120
+ </tr>
121
+ <tr>
122
+ <td>Virus 1</td>
123
+ <td>02/01/2020</td>
124
+ <td>150</td>
125
+ </tr>
126
+ <tr>
127
+ <td>...</td>
128
+ <td>...</td>
129
+ <td>...</td>
130
+ </tr>
131
+ <tr>
132
+ <td>Virus 2</td>
133
+ <td>01/01/2020</td>
134
+ <td>15</td>
135
+ </tr>
136
+ <tr>
137
+ <td>Virus 2</td>
138
+ <td>02/01/2020</td>
139
+ <td>20</td>
140
+ </tr>
141
+ <tr>
142
+ <td>...</td>
143
+ <td>...</td>
144
+ <td>...</td>
145
+ </tr>
146
146
  </tbody>
147
147
  </table>
148
148
  )
package/data/themes.js CHANGED
@@ -1,70 +1,70 @@
1
1
  const themes = {
2
2
  'theme-blue': {
3
- primary: '#005eaa',
3
+ primary: '#005eaa',
4
4
  secondary: '#88c3ea',
5
- tertiary: '#c0e9ff',
5
+ tertiary: '#c0e9ff',
6
6
  quaternary: '#edf9ff'
7
7
  },
8
8
  'theme-purple': {
9
9
  primary: '#712177',
10
10
  secondary: '#b890bb',
11
11
  tertiary: '#e3d3e4',
12
- quaternary: '#f7f2f7',
12
+ quaternary: '#f7f2f7'
13
13
  },
14
14
  'theme-brown': {
15
15
  primary: '#705043',
16
16
  secondary: '#ad907b',
17
17
  tertiary: '#d7ccc8',
18
- quaternary: '#f2ebe8',
18
+ quaternary: '#f2ebe8'
19
19
  },
20
20
  'theme-teal': {
21
21
  primary: '#00695c',
22
22
  secondary: '#4ebaaa',
23
23
  tertiary: '#ceece7',
24
- quaternary: '#ebf7f5',
24
+ quaternary: '#ebf7f5'
25
25
  },
26
26
  'theme-pink': {
27
27
  primary: '#af4448',
28
28
  secondary: '#e57373',
29
29
  tertiary: '#ffc2c2',
30
- quaternary: '#ffe7e7',
30
+ quaternary: '#ffe7e7'
31
31
  },
32
32
  'theme-orange': {
33
33
  primary: '#bb4d00',
34
34
  secondary: '#ffad42',
35
35
  tertiary: '#ffe97d',
36
- quaternary: '#fff4cf',
36
+ quaternary: '#fff4cf'
37
37
  },
38
38
  'theme-slate': {
39
39
  primary: '#29434e',
40
40
  secondary: '#7e9ba5',
41
41
  tertiary: '#b6c6d2',
42
- quaternary: '#e2e8ed',
42
+ quaternary: '#e2e8ed'
43
43
  },
44
44
  'theme-indigo': {
45
45
  primary: '#26418f',
46
46
  secondary: '#92a6dd',
47
47
  tertiary: '#dee8ff',
48
- quaternary: '#f2f6ff',
48
+ quaternary: '#f2f6ff'
49
49
  },
50
50
  'theme-cyan': {
51
51
  primary: '#006778',
52
52
  secondary: '#65b0bd',
53
53
  tertiary: '#cce5e9',
54
- quaternary: '#ebf5f6',
54
+ quaternary: '#ebf5f6'
55
55
  },
56
56
  'theme-green': {
57
57
  primary: '#4b830d',
58
58
  secondary: '#84bc49',
59
59
  tertiary: '#dcedc8',
60
- quaternary: '#f1f8e9',
60
+ quaternary: '#f1f8e9'
61
61
  },
62
62
  'theme-amber': {
63
63
  primary: '#fbab18',
64
64
  secondary: '#ffd54f',
65
65
  tertiary: '#ffecb3',
66
66
  quaternary: '#fff7e1'
67
- },
67
+ }
68
68
  }
69
69
 
70
- export default themes;
70
+ export default themes
@@ -6,157 +6,157 @@ export class DataTransform {
6
6
  descriptionHeader: 1,
7
7
  descriptionRoot: 2,
8
8
  descriptionSeriesFilter: 3
9
- };
9
+ }
10
10
  }
11
11
 
12
12
  //Performs standardizations that can be completed automatically without use input
13
- autoStandardize(data){
13
+ autoStandardize(data) {
14
14
  const errorsFound = []
15
15
 
16
16
  // Empty data
17
- if ( 0 === data.length ) {
18
- errorsFound.push(this.constants.errorMessageEmptyData);
17
+ if (0 === data.length) {
18
+ errorsFound.push(this.constants.errorMessageEmptyData)
19
19
  }
20
20
 
21
21
  // Does it have the correct data structure?
22
- if (!data.filter || data.filter(row => typeof row !== 'object').length > 0) {
23
- errorsFound.push(this.constants.errorMessageFormat);
22
+ if (!data.filter || data.filter(row => typeof row !== 'object').length > 0) {
23
+ errorsFound.push(this.constants.errorMessageFormat)
24
24
  }
25
25
 
26
- if(errorsFound.length > 0) {
27
- console.error(errorsFound);
28
- return undefined;
26
+ if (errorsFound.length > 0) {
27
+ console.error(errorsFound)
28
+ return undefined
29
29
  }
30
30
 
31
31
  //Convert array of arrays, to array of objects
32
- if (data.filter(row => row.constructor !== Object).length > 0) {
33
- let standardizedData = [];
34
- for(let row = 1; row < data.length; row++){
35
- let standardizedRow = {};
32
+ if (data.filter(row => row.constructor !== Object).length > 0) {
33
+ let standardizedData = []
34
+ for (let row = 1; row < data.length; row++) {
35
+ let standardizedRow = {}
36
36
  data[row].forEach((datum, col) => {
37
- standardizedRow[data[0][col]] = datum;
38
- });
39
- standardizedData.push(standardizedRow);
37
+ standardizedRow[data[0][col]] = datum
38
+ })
39
+ standardizedData.push(standardizedRow)
40
40
  }
41
- data = standardizedData;
41
+ data = standardizedData
42
42
  }
43
43
 
44
- return data;
44
+ return data
45
45
  }
46
46
 
47
47
  //Performs standardizations based on developer provided description of the data
48
- developerStandardize(data, description){
48
+ developerStandardize(data, description) {
49
49
  //Validate the description object
50
- if(!description){
50
+ if (!description) {
51
51
  return undefined
52
52
  }
53
53
 
54
- if(description.horizontal === undefined || description.series === undefined){
54
+ if (description.horizontal === undefined || description.series === undefined) {
55
55
  return undefined
56
56
  }
57
57
 
58
- if(description.series === true && description.horizontal === false && description.singleRow === undefined){
58
+ if (description.series === true && description.horizontal === false && description.singleRow === undefined) {
59
59
  return undefined
60
60
  }
61
61
 
62
- if(description.horizontal === true){
63
- if(description.series === true) {
64
- if(!description.seriesKey){
62
+ if (description.horizontal === true) {
63
+ if (description.series === true) {
64
+ if (!description.seriesKey) {
65
65
  return undefined
66
66
  }
67
67
 
68
- let standardizedMapped = {};
69
- let standardized = [];
70
- data.forEach((row) => {
71
- let nonNumericKeys = [];
72
- Object.keys(row).forEach((key) => {
73
- if(key !== description.seriesKey && isNaN(parseFloat(row[key]))){
74
- nonNumericKeys.push(key);
68
+ let standardizedMapped = {}
69
+ let standardized = []
70
+ data.forEach(row => {
71
+ let nonNumericKeys = []
72
+ Object.keys(row).forEach(key => {
73
+ if (key !== description.seriesKey && isNaN(parseFloat(row[key]))) {
74
+ nonNumericKeys.push(key)
75
75
  }
76
- });
77
-
78
- Object.keys(row).forEach((key) => {
79
- if(key !== description.seriesKey && nonNumericKeys.indexOf(key) === -1) {
80
- let uniqueKey = key + '|' + nonNumericKeys.map((nonNumericKey) => (nonNumericKey + '=' + row[nonNumericKey]));
81
- if(!standardizedMapped[uniqueKey]){
82
- standardizedMapped[uniqueKey] = {[row[description.seriesKey]]: row[key], key};
83
- nonNumericKeys.forEach((nonNumericKey) => {
84
- standardizedMapped[uniqueKey][nonNumericKey] = row[nonNumericKey];
85
- });
76
+ })
77
+
78
+ Object.keys(row).forEach(key => {
79
+ if (key !== description.seriesKey && nonNumericKeys.indexOf(key) === -1) {
80
+ let uniqueKey = key + '|' + nonNumericKeys.map(nonNumericKey => nonNumericKey + '=' + row[nonNumericKey])
81
+ if (!standardizedMapped[uniqueKey]) {
82
+ standardizedMapped[uniqueKey] = { [row[description.seriesKey]]: row[key], key }
83
+ nonNumericKeys.forEach(nonNumericKey => {
84
+ standardizedMapped[uniqueKey][nonNumericKey] = row[nonNumericKey]
85
+ })
86
86
  }
87
- standardizedMapped[uniqueKey][row[description.seriesKey]] = row[key];
87
+ standardizedMapped[uniqueKey][row[description.seriesKey]] = row[key]
88
88
  }
89
- });
90
- });
89
+ })
90
+ })
91
91
 
92
- Object.keys(standardizedMapped).forEach((key) => {
93
- standardized.push(standardizedMapped[key]);
94
- });
92
+ Object.keys(standardizedMapped).forEach(key => {
93
+ standardized.push(standardizedMapped[key])
94
+ })
95
95
 
96
- return standardized;
96
+ return standardized
97
97
  } else {
98
- let standardized = [];
98
+ let standardized = []
99
99
 
100
- data.forEach((row) => {
101
- let nonNumericKeys = [];
102
- Object.keys(row).forEach((key) => {
103
- if(isNaN(parseFloat(row[key]))){
104
- nonNumericKeys.push(key);
100
+ data.forEach(row => {
101
+ let nonNumericKeys = []
102
+ Object.keys(row).forEach(key => {
103
+ if (isNaN(parseFloat(row[key]))) {
104
+ nonNumericKeys.push(key)
105
105
  }
106
- });
106
+ })
107
107
 
108
- Object.keys(row).forEach((key) => {
109
- if(nonNumericKeys.indexOf(key) === -1){
110
- let newRow = {key, value: row[key]};
108
+ Object.keys(row).forEach(key => {
109
+ if (nonNumericKeys.indexOf(key) === -1) {
110
+ let newRow = { key, value: row[key] }
111
111
 
112
- nonNumericKeys.forEach((nonNumericKey) => {
113
- newRow[nonNumericKey] = row[nonNumericKey];
114
- });
112
+ nonNumericKeys.forEach(nonNumericKey => {
113
+ newRow[nonNumericKey] = row[nonNumericKey]
114
+ })
115
115
 
116
- standardized.push(newRow);
116
+ standardized.push(newRow)
117
117
  }
118
- });
119
- });
118
+ })
119
+ })
120
120
 
121
- return standardized;
121
+ return standardized
122
122
  }
123
- } else if(description.series === true && description.singleRow === false){
124
- if(description.seriesKey !== undefined && description.xKey !== undefined && description.valueKey !== undefined){
125
- let standardizedMapped = {};
126
- let standardized = [];
127
-
128
- data.forEach((row) => {
129
- let extraKeys = [];
130
- let uniqueKey = row[description.xKey];
131
- Object.keys(row).forEach((key) => {
132
- if(key !== description.xKey && key !== description.seriesKey && key !== description.valueKey){
133
- uniqueKey += '|' + key + '=' + row[key];
134
- extraKeys.push(key);
123
+ } else if (description.series === true && description.singleRow === false) {
124
+ if (description.seriesKey !== undefined && description.xKey !== undefined && description.valueKey !== undefined) {
125
+ let standardizedMapped = {}
126
+ let standardized = []
127
+
128
+ data.forEach(row => {
129
+ let extraKeys = []
130
+ let uniqueKey = row[description.xKey]
131
+ Object.keys(row).forEach(key => {
132
+ if (key !== description.xKey && key !== description.seriesKey && key !== description.valueKey) {
133
+ uniqueKey += '|' + key + '=' + row[key]
134
+ extraKeys.push(key)
135
135
  }
136
- });
136
+ })
137
137
 
138
- if(standardizedMapped[uniqueKey]){
139
- standardizedMapped[uniqueKey][row[description.seriesKey]] = row[description.valueKey];
138
+ if (standardizedMapped[uniqueKey]) {
139
+ standardizedMapped[uniqueKey][row[description.seriesKey]] = row[description.valueKey]
140
140
  } else {
141
- standardizedMapped[uniqueKey] = {[description.xKey]: row[description.xKey], [row[description.seriesKey]]: row[description.valueKey]};
142
- extraKeys.forEach((key) => {
143
- standardizedMapped[uniqueKey][key] = row[key];
144
- });
141
+ standardizedMapped[uniqueKey] = { [description.xKey]: row[description.xKey], [row[description.seriesKey]]: row[description.valueKey] }
142
+ extraKeys.forEach(key => {
143
+ standardizedMapped[uniqueKey][key] = row[key]
144
+ })
145
145
  }
146
- });
146
+ })
147
147
 
148
- Object.keys(standardizedMapped).forEach((key) => {
149
- standardized.push(standardizedMapped[key]);
150
- });
148
+ Object.keys(standardizedMapped).forEach(key => {
149
+ standardized.push(standardizedMapped[key])
150
+ })
151
151
 
152
- return standardized;
152
+ return standardized
153
153
  } else {
154
154
  return undefined
155
155
  }
156
156
  }
157
157
 
158
- return data;
158
+ return data
159
159
  }
160
160
  }
161
161
 
162
- export default DataTransform;
162
+ export default DataTransform
@@ -1,5 +1,5 @@
1
1
  export default function cacheBustingString() {
2
- const round = 1000 * 60 * 15;
3
- const date = new Date();
4
- return new Date(date.getTime() - (date.getTime() % round)).toISOString();
2
+ const round = 1000 * 60 * 15
3
+ const date = new Date()
4
+ return new Date(date.getTime() - (date.getTime() % round)).toISOString()
5
5
  }
package/helpers/events.js CHANGED
@@ -1,15 +1,14 @@
1
-
2
1
  function subscribe(eventName, listener) {
3
- document.addEventListener(eventName, listener);
2
+ document.addEventListener(eventName, listener)
4
3
  }
5
4
 
6
5
  function unsubscribe(eventName, listener) {
7
- document.removeEventListener(eventName, listener);
6
+ document.removeEventListener(eventName, listener)
8
7
  }
9
8
 
10
9
  function publish(eventName, data) {
11
- const event = new CustomEvent(eventName, { detail: data });
12
- document.dispatchEvent(event);
10
+ const event = new CustomEvent(eventName, { detail: data })
11
+ document.dispatchEvent(event)
13
12
  }
14
13
 
15
- export { publish, subscribe, unsubscribe};
14
+ export { publish, subscribe, unsubscribe }