@perses-dev/components 0.23.1 → 0.25.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 (181) hide show
  1. package/dist/ColorPicker/ColorPicker.d.ts +12 -0
  2. package/dist/ColorPicker/ColorPicker.d.ts.map +1 -0
  3. package/dist/ColorPicker/ColorPicker.js +78 -0
  4. package/dist/ColorPicker/ColorPicker.js.map +1 -0
  5. package/dist/ColorPicker/index.d.ts +2 -0
  6. package/dist/ColorPicker/index.d.ts.map +1 -0
  7. package/dist/ColorPicker/index.js +15 -0
  8. package/dist/ColorPicker/index.js.map +1 -0
  9. package/dist/Dialog/Dialog.d.ts +2 -1
  10. package/dist/Dialog/Dialog.d.ts.map +1 -1
  11. package/dist/Dialog/Dialog.js +12 -1
  12. package/dist/Dialog/Dialog.js.map +1 -1
  13. package/dist/{EChart.d.ts → EChart/EChart.d.ts} +3 -3
  14. package/dist/EChart/EChart.d.ts.map +1 -0
  15. package/dist/EChart/EChart.js.map +1 -0
  16. package/dist/EChart/index.d.ts +2 -0
  17. package/dist/EChart/index.d.ts.map +1 -0
  18. package/dist/EChart/index.js +15 -0
  19. package/dist/EChart/index.js.map +1 -0
  20. package/dist/GaugeChart/GaugeChart.d.ts +1 -2
  21. package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
  22. package/dist/GaugeChart/GaugeChart.js.map +1 -1
  23. package/dist/InfoTooltip/InfoTooltip.d.ts.map +1 -1
  24. package/dist/InfoTooltip/InfoTooltip.js +7 -3
  25. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  26. package/dist/Legend/Legend.d.ts +1 -2
  27. package/dist/Legend/Legend.d.ts.map +1 -1
  28. package/dist/Legend/Legend.js +6 -9
  29. package/dist/Legend/Legend.js.map +1 -1
  30. package/dist/LineChart/LineChart.d.ts +4 -2
  31. package/dist/LineChart/LineChart.d.ts.map +1 -1
  32. package/dist/LineChart/LineChart.js +1 -1
  33. package/dist/LineChart/LineChart.js.map +1 -1
  34. package/dist/OptionsEditorLayout/OptionsEditorControl.js +1 -1
  35. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  36. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts +3 -2
  37. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts.map +1 -1
  38. package/dist/OptionsEditorLayout/OptionsEditorGroup.js +17 -5
  39. package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
  40. package/dist/StatChart/StatChart.d.ts +1 -3
  41. package/dist/StatChart/StatChart.d.ts.map +1 -1
  42. package/dist/StatChart/StatChart.js +1 -3
  43. package/dist/StatChart/StatChart.js.map +1 -1
  44. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts +4 -0
  45. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts.map +1 -0
  46. package/dist/ThresholdsEditor/ThresholdColorPicker.js +76 -0
  47. package/dist/ThresholdsEditor/ThresholdColorPicker.js.map +1 -0
  48. package/dist/ThresholdsEditor/ThresholdInput.d.ts +13 -0
  49. package/dist/ThresholdsEditor/ThresholdInput.d.ts.map +1 -0
  50. package/dist/ThresholdsEditor/ThresholdInput.js +61 -0
  51. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -0
  52. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts +10 -0
  53. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -0
  54. package/dist/ThresholdsEditor/ThresholdsEditor.js +215 -0
  55. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -0
  56. package/dist/ThresholdsEditor/index.d.ts +2 -0
  57. package/dist/ThresholdsEditor/index.d.ts.map +1 -0
  58. package/dist/ThresholdsEditor/index.js +15 -0
  59. package/dist/ThresholdsEditor/index.js.map +1 -0
  60. package/dist/TimeSeriesTooltip/focused-series.d.ts.map +1 -1
  61. package/dist/TimeSeriesTooltip/focused-series.js +3 -3
  62. package/dist/TimeSeriesTooltip/focused-series.js.map +1 -1
  63. package/dist/cjs/ColorPicker/ColorPicker.js +128 -0
  64. package/dist/cjs/{model/legend.test.js → ColorPicker/index.js} +11 -12
  65. package/dist/cjs/Dialog/Dialog.js +11 -0
  66. package/dist/{model/legend.test.js → cjs/EChart/index.js} +15 -14
  67. package/dist/cjs/InfoTooltip/InfoTooltip.js +7 -3
  68. package/dist/cjs/Legend/Legend.js +5 -8
  69. package/dist/cjs/LineChart/LineChart.js +40 -1
  70. package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +1 -1
  71. package/dist/cjs/OptionsEditorLayout/OptionsEditorGroup.js +22 -5
  72. package/dist/cjs/StatChart/StatChart.js +1 -41
  73. package/dist/cjs/ThresholdsEditor/ThresholdColorPicker.js +87 -0
  74. package/dist/cjs/ThresholdsEditor/ThresholdInput.js +72 -0
  75. package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +265 -0
  76. package/dist/cjs/ThresholdsEditor/index.js +28 -0
  77. package/dist/cjs/TimeSeriesTooltip/focused-series.js +3 -3
  78. package/dist/cjs/index.js +2 -0
  79. package/dist/cjs/test-utils/theme.js +8 -0
  80. package/dist/cjs/theme/component-overrides/alert.js +102 -0
  81. package/dist/cjs/theme/theme.js +4 -8
  82. package/dist/cjs/utils/theme-gen.js +8 -0
  83. package/dist/index.d.ts +2 -0
  84. package/dist/index.d.ts.map +1 -1
  85. package/dist/index.js +2 -0
  86. package/dist/index.js.map +1 -1
  87. package/dist/model/graph.d.ts +2 -2
  88. package/dist/model/graph.d.ts.map +1 -1
  89. package/dist/model/graph.js.map +1 -1
  90. package/dist/model/legend.d.ts +1 -1
  91. package/dist/model/legend.d.ts.map +1 -1
  92. package/dist/model/legend.js.map +1 -1
  93. package/dist/model/theme.d.ts +5 -0
  94. package/dist/model/theme.d.ts.map +1 -1
  95. package/dist/model/theme.js.map +1 -1
  96. package/dist/model/units/bytes.d.ts +1 -1
  97. package/dist/model/units/bytes.d.ts.map +1 -1
  98. package/dist/model/units/bytes.js.map +1 -1
  99. package/dist/model/units/decimal.d.ts +1 -1
  100. package/dist/model/units/decimal.d.ts.map +1 -1
  101. package/dist/model/units/decimal.js.map +1 -1
  102. package/dist/model/units/percent.d.ts +1 -1
  103. package/dist/model/units/percent.d.ts.map +1 -1
  104. package/dist/model/units/percent.js.map +1 -1
  105. package/dist/model/units/time.d.ts +1 -1
  106. package/dist/model/units/time.d.ts.map +1 -1
  107. package/dist/model/units/time.js.map +1 -1
  108. package/dist/model/units/types.d.ts +1 -1
  109. package/dist/model/units/types.d.ts.map +1 -1
  110. package/dist/model/units/types.js.map +1 -1
  111. package/dist/test-utils/theme.d.ts.map +1 -1
  112. package/dist/test-utils/theme.js +8 -0
  113. package/dist/test-utils/theme.js.map +1 -1
  114. package/dist/theme/component-overrides/alert.d.ts +3 -0
  115. package/dist/theme/component-overrides/alert.d.ts.map +1 -0
  116. package/dist/theme/component-overrides/alert.js +96 -0
  117. package/dist/theme/component-overrides/alert.js.map +1 -0
  118. package/dist/theme/theme.d.ts.map +1 -1
  119. package/dist/theme/theme.js +5 -9
  120. package/dist/theme/theme.js.map +1 -1
  121. package/dist/utils/theme-gen.d.ts.map +1 -1
  122. package/dist/utils/theme-gen.js +8 -0
  123. package/dist/utils/theme-gen.js.map +1 -1
  124. package/package.json +8 -3
  125. package/dist/EChart.d.ts.map +0 -1
  126. package/dist/EChart.js.map +0 -1
  127. package/dist/InfoTooltip/InfoTooltip.test.d.ts +0 -2
  128. package/dist/InfoTooltip/InfoTooltip.test.d.ts.map +0 -1
  129. package/dist/InfoTooltip/InfoTooltip.test.js +0 -36
  130. package/dist/InfoTooltip/InfoTooltip.test.js.map +0 -1
  131. package/dist/LegendOptionsEditor/LegendOptionsEditor.test.d.ts +0 -2
  132. package/dist/LegendOptionsEditor/LegendOptionsEditor.test.d.ts.map +0 -1
  133. package/dist/LegendOptionsEditor/LegendOptionsEditor.test.js +0 -62
  134. package/dist/LegendOptionsEditor/LegendOptionsEditor.test.js.map +0 -1
  135. package/dist/StatChart/StatChart.test.d.ts +0 -2
  136. package/dist/StatChart/StatChart.test.d.ts.map +0 -1
  137. package/dist/StatChart/StatChart.test.js +0 -94
  138. package/dist/StatChart/StatChart.test.js.map +0 -1
  139. package/dist/TimeSeriesTooltip/SeriesInfo.test.d.ts +0 -2
  140. package/dist/TimeSeriesTooltip/SeriesInfo.test.d.ts.map +0 -1
  141. package/dist/TimeSeriesTooltip/SeriesInfo.test.js +0 -52
  142. package/dist/TimeSeriesTooltip/SeriesInfo.test.js.map +0 -1
  143. package/dist/TimeSeriesTooltip/TooltipContent.test.d.ts +0 -2
  144. package/dist/TimeSeriesTooltip/TooltipContent.test.d.ts.map +0 -1
  145. package/dist/TimeSeriesTooltip/TooltipContent.test.js +0 -78
  146. package/dist/TimeSeriesTooltip/TooltipContent.test.js.map +0 -1
  147. package/dist/TimeSeriesTooltip/focused-series.test.d.ts +0 -2
  148. package/dist/TimeSeriesTooltip/focused-series.test.d.ts.map +0 -1
  149. package/dist/TimeSeriesTooltip/focused-series.test.js +0 -93
  150. package/dist/TimeSeriesTooltip/focused-series.test.js.map +0 -1
  151. package/dist/UnitSelector/UnitSelector.test.d.ts +0 -2
  152. package/dist/UnitSelector/UnitSelector.test.d.ts.map +0 -1
  153. package/dist/UnitSelector/UnitSelector.test.js +0 -204
  154. package/dist/UnitSelector/UnitSelector.test.js.map +0 -1
  155. package/dist/cjs/InfoTooltip/InfoTooltip.test.js +0 -43
  156. package/dist/cjs/LegendOptionsEditor/LegendOptionsEditor.test.js +0 -69
  157. package/dist/cjs/StatChart/StatChart.test.js +0 -96
  158. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.test.js +0 -54
  159. package/dist/cjs/TimeSeriesTooltip/TooltipContent.test.js +0 -80
  160. package/dist/cjs/TimeSeriesTooltip/focused-series.test.js +0 -95
  161. package/dist/cjs/UnitSelector/UnitSelector.test.js +0 -211
  162. package/dist/cjs/model/units/units.test.js +0 -206
  163. package/dist/cjs/utils/format.test.js +0 -47
  164. package/dist/cjs/utils/theme-gen.test.js +0 -202
  165. package/dist/model/legend.test.d.ts +0 -2
  166. package/dist/model/legend.test.d.ts.map +0 -1
  167. package/dist/model/legend.test.js.map +0 -1
  168. package/dist/model/units/units.test.d.ts +0 -2
  169. package/dist/model/units/units.test.d.ts.map +0 -1
  170. package/dist/model/units/units.test.js +0 -204
  171. package/dist/model/units/units.test.js.map +0 -1
  172. package/dist/utils/format.test.d.ts +0 -2
  173. package/dist/utils/format.test.d.ts.map +0 -1
  174. package/dist/utils/format.test.js +0 -45
  175. package/dist/utils/format.test.js.map +0 -1
  176. package/dist/utils/theme-gen.test.d.ts +0 -2
  177. package/dist/utils/theme-gen.test.d.ts.map +0 -1
  178. package/dist/utils/theme-gen.test.js +0 -200
  179. package/dist/utils/theme-gen.test.js.map +0 -1
  180. /package/dist/{EChart.js → EChart/EChart.js} +0 -0
  181. /package/dist/cjs/{EChart.js → EChart/EChart.js} +0 -0
@@ -0,0 +1,102 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "MuiAlert", {
18
+ enumerable: true,
19
+ get: ()=>MuiAlert
20
+ });
21
+ const _material = require("@mui/material");
22
+ const MuiAlert = {
23
+ defaultProps: {
24
+ variant: 'standard',
25
+ severity: 'success'
26
+ },
27
+ styleOverrides: {
28
+ standardError: ({ theme })=>{
29
+ return theme.palette.mode === 'dark' ? {
30
+ ...theme.typography.body1,
31
+ backgroundColor: theme.palette.error.dark,
32
+ color: theme.palette.error.light,
33
+ [`& .${_material.alertClasses.icon}`]: {
34
+ color: theme.palette.error.main
35
+ }
36
+ } : {
37
+ ...theme.typography.body1,
38
+ backgroundColor: theme.palette.error.light,
39
+ color: theme.palette.error.dark,
40
+ [`& .${_material.alertClasses.icon}`]: {
41
+ color: theme.palette.error.main
42
+ }
43
+ };
44
+ },
45
+ standardInfo: ({ theme })=>{
46
+ return theme.palette.mode === 'dark' ? {
47
+ ...theme.typography.body1,
48
+ backgroundColor: theme.palette.info.dark,
49
+ color: theme.palette.info.light,
50
+ [`& .${_material.alertClasses.icon}`]: {
51
+ color: theme.palette.info.main
52
+ }
53
+ } : {
54
+ ...theme.typography.body1,
55
+ backgroundColor: theme.palette.info.light,
56
+ color: theme.palette.info.dark,
57
+ [`& .${_material.alertClasses.icon}`]: {
58
+ color: theme.palette.info.main
59
+ }
60
+ };
61
+ },
62
+ standardSuccess: ({ theme })=>{
63
+ return theme.palette.mode === 'dark' ? {
64
+ ...theme.typography.body1,
65
+ backgroundColor: theme.palette.success.dark,
66
+ color: theme.palette.success.light,
67
+ [`& .${_material.alertClasses.icon}`]: {
68
+ color: theme.palette.success.main
69
+ }
70
+ } : {
71
+ ...theme.typography.body1,
72
+ backgroundColor: theme.palette.success.light,
73
+ color: theme.palette.success.dark,
74
+ [`& .${_material.alertClasses.icon}`]: {
75
+ color: theme.palette.success.main
76
+ }
77
+ };
78
+ },
79
+ standardWarning: ({ theme })=>{
80
+ return theme.palette.mode === 'dark' ? {
81
+ ...theme.typography.body1,
82
+ backgroundColor: theme.palette.warning.dark,
83
+ color: theme.palette.warning.light,
84
+ [`& .${_material.alertClasses.icon}`]: {
85
+ color: theme.palette.warning.main
86
+ }
87
+ } : {
88
+ ...theme.typography.body1,
89
+ backgroundColor: theme.palette.warning.light,
90
+ color: theme.palette.warning.dark,
91
+ [`& .${_material.alertClasses.icon}`]: {
92
+ color: theme.palette.warning.main
93
+ }
94
+ };
95
+ },
96
+ root: {
97
+ ['& .' + _material.linkClasses.root]: {
98
+ textDecoration: 'underline'
99
+ }
100
+ }
101
+ }
102
+ };
@@ -19,6 +19,7 @@ Object.defineProperty(exports, "getTheme", {
19
19
  get: ()=>getTheme
20
20
  });
21
21
  const _material = require("@mui/material");
22
+ const _alert = require("./component-overrides/alert");
22
23
  const _paletteOptions = require("./palette/palette-options");
23
24
  const _typography = require("./typography");
24
25
  const getModalBackgroundStyle = ({ theme })=>{
@@ -41,6 +42,7 @@ function getTheme(mode) {
41
42
  }
42
43
  // Overrides for component default prop values and styles go here
43
44
  const components = {
45
+ MuiAlert: _alert.MuiAlert,
44
46
  MuiFormControl: {
45
47
  defaultProps: {
46
48
  size: 'small'
@@ -61,15 +63,9 @@ const components = {
61
63
  paper: getModalBackgroundStyle
62
64
  }
63
65
  },
64
- MuiAlert: {
66
+ MuiPopover: {
65
67
  styleOverrides: {
66
- standardError: ({ theme })=>({
67
- backgroundColor: theme.palette.designSystem.red[500],
68
- color: theme.palette.common.white,
69
- [`& .${_material.alertClasses.icon}`]: {
70
- color: theme.palette.common.white
71
- }
72
- })
68
+ paper: getModalBackgroundStyle
73
69
  }
74
70
  }
75
71
  };
@@ -188,6 +188,14 @@ function generateChartsTheme(muiTheme, echartsTheme) {
188
188
  padding: {
189
189
  default: parseInt(muiTheme.spacing(1.5), 10)
190
190
  }
191
+ },
192
+ thresholds: {
193
+ defaultColor: muiTheme.palette.success.main,
194
+ palette: [
195
+ '#FFCC00',
196
+ muiTheme.palette.warning.main,
197
+ muiTheme.palette.error.main
198
+ ]
191
199
  }
192
200
  };
193
201
  }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './ColorPicker';
1
2
  export * from './DateTimeRangePicker';
2
3
  export * from './Dialog';
3
4
  export * from './Drawer';
@@ -12,6 +13,7 @@ export * from './LegendOptionsEditor';
12
13
  export * from './LineChart';
13
14
  export * from './OptionsEditorLayout';
14
15
  export * from './StatChart';
16
+ export * from './ThresholdsEditor';
15
17
  export * from './TimeSeriesTooltip';
16
18
  export * from './UnitSelector';
17
19
  export * from './YAxisLabel';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -10,6 +10,7 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
+ export * from './ColorPicker';
13
14
  export * from './DateTimeRangePicker';
14
15
  export * from './Dialog';
15
16
  export * from './Drawer';
@@ -24,6 +25,7 @@ export * from './LegendOptionsEditor';
24
25
  export * from './LineChart';
25
26
  export * from './OptionsEditorLayout';
26
27
  export * from './StatChart';
28
+ export * from './ThresholdsEditor';
27
29
  export * from './TimeSeriesTooltip';
28
30
  export * from './UnitSelector';
29
31
  export * from './YAxisLabel';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DateTimeRangePicker';\nexport * from './Dialog';\nexport * from './Drawer';\nexport * from './EChart';\nexport * from './ErrorAlert';\nexport * from './ErrorBoundary';\nexport * from './GaugeChart';\nexport * from './InfoTooltip';\nexport * from './JSONEditor';\nexport * from './Legend';\nexport * from './LegendOptionsEditor';\nexport * from './LineChart';\nexport * from './OptionsEditorLayout';\nexport * from './StatChart';\nexport * from './TimeSeriesTooltip';\nexport * from './UnitSelector';\nexport * from './YAxisLabel';\nexport * from './context/ChartsThemeProvider';\nexport * from './context/TimeZoneProvider';\nexport * from './utils';\nexport * from './model';\nexport * from './test-utils';\nexport * from './theme';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './ColorPicker';\nexport * from './DateTimeRangePicker';\nexport * from './Dialog';\nexport * from './Drawer';\nexport * from './EChart';\nexport * from './ErrorAlert';\nexport * from './ErrorBoundary';\nexport * from './GaugeChart';\nexport * from './InfoTooltip';\nexport * from './JSONEditor';\nexport * from './Legend';\nexport * from './LegendOptionsEditor';\nexport * from './LineChart';\nexport * from './OptionsEditorLayout';\nexport * from './StatChart';\nexport * from './ThresholdsEditor';\nexport * from './TimeSeriesTooltip';\nexport * from './UnitSelector';\nexport * from './YAxisLabel';\nexport * from './context/ChartsThemeProvider';\nexport * from './context/TimeZoneProvider';\nexport * from './utils';\nexport * from './model';\nexport * from './test-utils';\nexport * from './theme';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
@@ -1,11 +1,11 @@
1
+ import { TimeSeriesValueTuple } from '@perses-dev/core';
1
2
  import { LineSeriesOption } from 'echarts/charts';
2
3
  import { LegendItem } from './legend';
3
4
  export declare const OPTIMIZED_MODE_SERIES_LIMIT = 1000;
4
5
  export declare type UnixTimeMs = number;
5
- export declare type GraphSeriesValueTuple = [timestamp: UnixTimeMs, value: number];
6
6
  export interface GraphSeries {
7
7
  name: string;
8
- values: Iterable<GraphSeriesValueTuple>;
8
+ values: TimeSeriesValueTuple[];
9
9
  }
10
10
  export declare type EChartsValues = number | null | '-';
11
11
  export interface EChartsTimeSeries extends Omit<LineSeriesOption, 'data'> {
@@ -1 +1 @@
1
- {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/model/graph.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGtC,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAEhD,oBAAY,UAAU,GAAG,MAAM,CAAC;AAEhC,oBAAY,qBAAqB,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAE3E,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,QAAQ,CAAC,qBAAqB,CAAC,CAAC;CACzC;AAED,oBAAY,aAAa,GAAG,MAAM,GAAG,IAAI,GAAG,GAAG,CAAC;AAEhD,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAEvE,IAAI,EAAE,aAAa,EAAE,CAAC;CACvB;AAED,oBAAY,iBAAiB,GAAG;IAC9B,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAChC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
1
+ {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/model/graph.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGtC,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAEhD,oBAAY,UAAU,GAAG,MAAM,CAAC;AAEhC,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,oBAAoB,EAAE,CAAC;CAChC;AAED,oBAAY,aAAa,GAAG,MAAM,GAAG,IAAI,GAAG,GAAG,CAAC;AAEhD,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAEvE,IAAI,EAAE,aAAa,EAAE,CAAC;CACvB;AAED,oBAAY,iBAAiB,GAAG;IAC9B,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAChC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/graph.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { LineSeriesOption } from 'echarts/charts';\nimport { LegendItem } from './legend';\n\n// adjust display when there are many time series to help with performance\nexport const OPTIMIZED_MODE_SERIES_LIMIT = 1000;\n\nexport type UnixTimeMs = number;\n\nexport type GraphSeriesValueTuple = [timestamp: UnixTimeMs, value: number];\n\nexport interface GraphSeries {\n name: string;\n values: Iterable<GraphSeriesValueTuple>;\n}\n\nexport type EChartsValues = number | null | '-';\n\nexport interface EChartsTimeSeries extends Omit<LineSeriesOption, 'data'> {\n // TODO: support dataset and both category / time xAxis types\n data: EChartsValues[];\n}\n\nexport type EChartsDataFormat = {\n timeSeries: EChartsTimeSeries[];\n xAxis: number[];\n legendItems?: LegendItem[];\n xAxisMax?: number | string;\n rangeMs?: number;\n};\n"],"names":["OPTIMIZED_MODE_SERIES_LIMIT"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAKjC,0EAA0E;AAC1E,OAAO,MAAMA,2BAA2B,GAAG,IAAI,CAAC"}
1
+ {"version":3,"sources":["../../src/model/graph.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TimeSeriesValueTuple } from '@perses-dev/core';\nimport { LineSeriesOption } from 'echarts/charts';\nimport { LegendItem } from './legend';\n\n// adjust display when there are many time series to help with performance\nexport const OPTIMIZED_MODE_SERIES_LIMIT = 1000;\n\nexport type UnixTimeMs = number;\n\nexport interface GraphSeries {\n name: string;\n values: TimeSeriesValueTuple[];\n}\n\nexport type EChartsValues = number | null | '-';\n\nexport interface EChartsTimeSeries extends Omit<LineSeriesOption, 'data'> {\n // TODO: support dataset and both category / time xAxis types\n data: EChartsValues[];\n}\n\nexport type EChartsDataFormat = {\n timeSeries: EChartsTimeSeries[];\n xAxis: number[];\n legendItems?: LegendItem[];\n xAxisMax?: number | string;\n rangeMs?: number;\n};\n"],"names":["OPTIMIZED_MODE_SERIES_LIMIT"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAMjC,0EAA0E;AAC1E,OAAO,MAAMA,2BAA2B,GAAG,IAAI,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { MouseEventHandler } from 'react';
2
2
  export declare const legendPositions: readonly ["Bottom", "Right"];
3
- export declare type LegendPositions = typeof legendPositions[number];
3
+ export declare type LegendPositions = (typeof legendPositions)[number];
4
4
  export interface LegendOptions {
5
5
  position: LegendPositions;
6
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"legend.d.ts","sourceRoot":"","sources":["../../src/model/legend.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1C,eAAO,MAAM,eAAe,8BAA+B,CAAC;AAE5D,oBAAY,eAAe,GAAG,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;AAE7D,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAC;CAC3C;AAED,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,MAAM,CAAC,EAAE,aAAa,WASxD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/legend.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { MouseEventHandler } from 'react';\n\nexport const legendPositions = ['Bottom', 'Right'] as const;\n\nexport type LegendPositions = typeof legendPositions[number];\n\nexport interface LegendOptions {\n position: LegendPositions;\n}\n\nexport interface LegendItem {\n id: string;\n label: string;\n isSelected: boolean;\n color: string;\n onClick: MouseEventHandler<HTMLLIElement>;\n}\n\nexport type LegendPositionConfig = {\n label: string;\n};\n\nexport const LEGEND_POSITIONS_CONFIG: Readonly<Record<LegendPositions, LegendPositionConfig>> = {\n Bottom: { label: 'Bottom' },\n Right: { label: 'Right' },\n};\n\nexport const DEFAULT_LEGEND: LegendOptions = {\n position: 'Bottom',\n};\n\nexport function getLegendPosition(position?: LegendPositions) {\n if (position === undefined) {\n return DEFAULT_LEGEND.position;\n }\n if (isValidLegendPosition(position)) {\n return position;\n }\n return DEFAULT_LEGEND.position;\n}\n\nexport function isValidLegendPosition(position: LegendPositions) {\n return (legendPositions as readonly string[]).includes(position);\n}\n\nexport function validateLegendSpec(legend?: LegendOptions) {\n if (legend === undefined) {\n // undefined is valid since this is how legend is hidden by default\n return true;\n }\n if (!isValidLegendPosition(legend.position)) {\n return false;\n }\n return true;\n}\n"],"names":["legendPositions","LEGEND_POSITIONS_CONFIG","Bottom","label","Right","DEFAULT_LEGEND","position","getLegendPosition","undefined","isValidLegendPosition","includes","validateLegendSpec","legend"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,MAAMA,eAAe,GAAG;IAAC,QAAQ;IAAE,OAAO;CAAC,AAAS,CAAC;AAoB5D,OAAO,MAAMC,uBAAuB,GAA4D;IAC9FC,MAAM,EAAE;QAAEC,KAAK,EAAE,QAAQ;KAAE;IAC3BC,KAAK,EAAE;QAAED,KAAK,EAAE,OAAO;KAAE;CAC1B,CAAC;AAEF,OAAO,MAAME,cAAc,GAAkB;IAC3CC,QAAQ,EAAE,QAAQ;CACnB,CAAC;AAEF,OAAO,SAASC,iBAAiB,CAACD,QAA0B,EAAE;IAC5D,IAAIA,QAAQ,KAAKE,SAAS,EAAE;QAC1B,OAAOH,cAAc,CAACC,QAAQ,CAAC;IACjC,CAAC;IACD,IAAIG,qBAAqB,CAACH,QAAQ,CAAC,EAAE;QACnC,OAAOA,QAAQ,CAAC;IAClB,CAAC;IACD,OAAOD,cAAc,CAACC,QAAQ,CAAC;AACjC,CAAC;AAED,OAAO,SAASG,qBAAqB,CAACH,QAAyB,EAAE;IAC/D,OAAO,AAACN,eAAe,CAAuBU,QAAQ,CAACJ,QAAQ,CAAC,CAAC;AACnE,CAAC;AAED,OAAO,SAASK,kBAAkB,CAACC,MAAsB,EAAE;IACzD,IAAIA,MAAM,KAAKJ,SAAS,EAAE;QACxB,mEAAmE;QACnE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAACC,qBAAqB,CAACG,MAAM,CAACN,QAAQ,CAAC,EAAE;QAC3C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
1
+ {"version":3,"sources":["../../src/model/legend.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { MouseEventHandler } from 'react';\n\nexport const legendPositions = ['Bottom', 'Right'] as const;\n\nexport type LegendPositions = (typeof legendPositions)[number];\n\nexport interface LegendOptions {\n position: LegendPositions;\n}\n\nexport interface LegendItem {\n id: string;\n label: string;\n isSelected: boolean;\n color: string;\n onClick: MouseEventHandler<HTMLLIElement>;\n}\n\nexport type LegendPositionConfig = {\n label: string;\n};\n\nexport const LEGEND_POSITIONS_CONFIG: Readonly<Record<LegendPositions, LegendPositionConfig>> = {\n Bottom: { label: 'Bottom' },\n Right: { label: 'Right' },\n};\n\nexport const DEFAULT_LEGEND: LegendOptions = {\n position: 'Bottom',\n};\n\nexport function getLegendPosition(position?: LegendPositions) {\n if (position === undefined) {\n return DEFAULT_LEGEND.position;\n }\n if (isValidLegendPosition(position)) {\n return position;\n }\n return DEFAULT_LEGEND.position;\n}\n\nexport function isValidLegendPosition(position: LegendPositions) {\n return (legendPositions as readonly string[]).includes(position);\n}\n\nexport function validateLegendSpec(legend?: LegendOptions) {\n if (legend === undefined) {\n // undefined is valid since this is how legend is hidden by default\n return true;\n }\n if (!isValidLegendPosition(legend.position)) {\n return false;\n }\n return true;\n}\n"],"names":["legendPositions","LEGEND_POSITIONS_CONFIG","Bottom","label","Right","DEFAULT_LEGEND","position","getLegendPosition","undefined","isValidLegendPosition","includes","validateLegendSpec","legend"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,MAAMA,eAAe,GAAG;IAAC,QAAQ;IAAE,OAAO;CAAC,AAAS,CAAC;AAoB5D,OAAO,MAAMC,uBAAuB,GAA4D;IAC9FC,MAAM,EAAE;QAAEC,KAAK,EAAE,QAAQ;KAAE;IAC3BC,KAAK,EAAE;QAAED,KAAK,EAAE,OAAO;KAAE;CAC1B,CAAC;AAEF,OAAO,MAAME,cAAc,GAAkB;IAC3CC,QAAQ,EAAE,QAAQ;CACnB,CAAC;AAEF,OAAO,SAASC,iBAAiB,CAACD,QAA0B,EAAE;IAC5D,IAAIA,QAAQ,KAAKE,SAAS,EAAE;QAC1B,OAAOH,cAAc,CAACC,QAAQ,CAAC;IACjC,CAAC;IACD,IAAIG,qBAAqB,CAACH,QAAQ,CAAC,EAAE;QACnC,OAAOA,QAAQ,CAAC;IAClB,CAAC;IACD,OAAOD,cAAc,CAACC,QAAQ,CAAC;AACjC,CAAC;AAED,OAAO,SAASG,qBAAqB,CAACH,QAAyB,EAAE;IAC/D,OAAO,AAACN,eAAe,CAAuBU,QAAQ,CAACJ,QAAQ,CAAC,CAAC;AACnE,CAAC;AAED,OAAO,SAASK,kBAAkB,CAACC,MAAsB,EAAE;IACzD,IAAIA,MAAM,KAAKJ,SAAS,EAAE;QACxB,mEAAmE;QACnE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAACC,qBAAqB,CAACG,MAAM,CAACN,QAAQ,CAAC,EAAE;QAC3C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -17,10 +17,15 @@ export interface PersesChartsTheme {
17
17
  default: number;
18
18
  };
19
19
  };
20
+ thresholds: ThresholdColorPalette;
20
21
  }
21
22
  export interface EChartsTheme extends EChartsOption {
22
23
  bar?: BarSeriesOption;
23
24
  line?: LineSeriesOption;
24
25
  gauge?: GaugeSeriesOption;
25
26
  }
27
+ export interface ThresholdColorPalette {
28
+ defaultColor: string;
29
+ palette: string[];
30
+ }
26
31
  //# sourceMappingURL=theme.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/model/theme.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,eAAe,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEtH,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,iBAAiB,CAAC;IAChC,SAAS,EAAE;QACT,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF;;OAEG;IACH,SAAS,EAAE;QACT;;WAEG;QACH,OAAO,EAAE;YACP,OAAO,EAAE,MAAM,CAAC;SACjB,CAAC;KACH,CAAC;CACH;AAGD,MAAM,WAAW,YAAa,SAAQ,aAAa;IACjD,GAAG,CAAC,EAAE,eAAe,CAAC;IACtB,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,KAAK,CAAC,EAAE,iBAAiB,CAAC;CAC3B"}
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/model/theme.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,eAAe,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEtH,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,iBAAiB,CAAC;IAChC,SAAS,EAAE;QACT,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF;;OAEG;IACH,SAAS,EAAE;QACT;;WAEG;QACH,OAAO,EAAE;YACP,OAAO,EAAE,MAAM,CAAC;SACjB,CAAC;KACH,CAAC;IACF,UAAU,EAAE,qBAAqB,CAAC;CACnC;AAGD,MAAM,WAAW,YAAa,SAAQ,aAAa;IACjD,GAAG,CAAC,EAAE,eAAe,CAAC;IACtB,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,KAAK,CAAC,EAAE,iBAAiB,CAAC;CAC3B;AAED,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/theme.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { EChartsOption, EChartsCoreOption, BarSeriesOption, LineSeriesOption, GaugeSeriesOption } from 'echarts';\n\nexport interface PersesChartsTheme {\n echartsTheme: EChartsTheme;\n noDataOption: EChartsCoreOption;\n sparkline: {\n width: number;\n color: string;\n };\n /**\n * Theming for the container that wraps a chart.\n */\n container: {\n /**\n * Padding in pixels.\n */\n padding: {\n default: number;\n };\n };\n}\n\n// https://github.com/apache/echarts/issues/12489#issuecomment-643185207\nexport interface EChartsTheme extends EChartsOption {\n bar?: BarSeriesOption;\n line?: LineSeriesOption;\n gauge?: GaugeSeriesOption;\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,WA2BC"}
1
+ {"version":3,"sources":["../../src/model/theme.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { EChartsOption, EChartsCoreOption, BarSeriesOption, LineSeriesOption, GaugeSeriesOption } from 'echarts';\n\nexport interface PersesChartsTheme {\n echartsTheme: EChartsTheme;\n noDataOption: EChartsCoreOption;\n sparkline: {\n width: number;\n color: string;\n };\n /**\n * Theming for the container that wraps a chart.\n */\n container: {\n /**\n * Padding in pixels.\n */\n padding: {\n default: number;\n };\n };\n thresholds: ThresholdColorPalette;\n}\n\n// https://github.com/apache/echarts/issues/12489#issuecomment-643185207\nexport interface EChartsTheme extends EChartsOption {\n bar?: BarSeriesOption;\n line?: LineSeriesOption;\n gauge?: GaugeSeriesOption;\n}\n\nexport interface ThresholdColorPalette {\n defaultColor: string;\n palette: string[];\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,WAiCC"}
@@ -1,6 +1,6 @@
1
1
  import { UnitGroupConfig, UnitConfig } from './types';
2
2
  declare const bytesUnitKinds: readonly ["Bytes"];
3
- declare type BytesUnitKind = typeof bytesUnitKinds[number];
3
+ declare type BytesUnitKind = (typeof bytesUnitKinds)[number];
4
4
  export declare type BytesUnitOptions = {
5
5
  kind: BytesUnitKind;
6
6
  decimal_places?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../../src/model/units/bytes.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEtD,QAAA,MAAM,cAAc,oBAAqB,CAAC;AAC1C,aAAK,aAAa,GAAG,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;AACnD,oBAAY,gBAAgB,GAAG;IAC7B,IAAI,EAAE,aAAa,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AACF,eAAO,MAAM,kBAAkB,EAAE,eAIhC,CAAC;AACF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,CAKzE,CAAC;AAEF;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,gBAAgB,UAmCvE"}
1
+ {"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../../src/model/units/bytes.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEtD,QAAA,MAAM,cAAc,oBAAqB,CAAC;AAC1C,aAAK,aAAa,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AACrD,oBAAY,gBAAgB,GAAG;IAC7B,IAAI,EAAE,aAAa,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AACF,eAAO,MAAM,kBAAkB,EAAE,eAIhC,CAAC;AACF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,CAKzE,CAAC;AAEF;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,gBAAgB,UAmCvE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/model/units/bytes.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DEFAULT_DECIMAL_PLACES } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\n\nconst bytesUnitKinds = ['Bytes'] as const;\ntype BytesUnitKind = typeof bytesUnitKinds[number];\nexport type BytesUnitOptions = {\n kind: BytesUnitKind;\n decimal_places?: number;\n abbreviate?: boolean;\n};\nexport const BYTES_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Bytes',\n decimal_places: true,\n abbreviate: true,\n};\nexport const BYTES_UNIT_CONFIG: Readonly<Record<BytesUnitKind, UnitConfig>> = {\n Bytes: {\n group: 'Bytes',\n label: 'Bytes',\n },\n};\n\n/**\n * Format value as bytes, use abbreviate option for more readable sizes (KB, MB, GB, etc.)\n * https://stackoverflow.com/questions/15900485/correct-way-to-convert-size-in-bytes-to-kb-mb-gb-in-javascript/18650828#18650828\n */\nexport function formatBytes(bytes: number, unitOptions: BytesUnitOptions) {\n if (bytes === 0) return '0 bytes';\n\n // default to full 'Bytes' formatting\n const options = unitOptions.abbreviate === undefined ? { ...unitOptions, abbreviate: false } : unitOptions;\n\n let decimals = options.decimal_places ?? DEFAULT_DECIMAL_PLACES;\n // avoids minimumFractionDigits value is out of range error, possible values are 0 to 20\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#minimumfractiondigits\n if (decimals < 0) {\n decimals = 0;\n } else if (decimals > 20) {\n decimals = 20;\n }\n\n const formatParams: Intl.NumberFormatOptions = {\n style: 'decimal',\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n useGrouping: true,\n };\n const formatter = new Intl.NumberFormat('en-US', formatParams);\n\n if (options.abbreviate === false) {\n return `${formatter.format(bytes)} bytes`;\n }\n\n const k = 1024;\n const sizes = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n\n // Math.max(0, ...) ensures that we don't return -1 as a value for the index.\n // Why? When the number of bytes are between -1 and 1, Math.floor(Math.log(bytes)/Math.log(1024)) returns -1.\n const i = Math.max(0, Math.floor(Math.log(bytes) / Math.log(k)));\n const abbreviatedValue = bytes / Math.pow(k, i);\n return `${formatter.format(abbreviatedValue)} ${sizes[i]}`;\n}\n"],"names":["DEFAULT_DECIMAL_PLACES","bytesUnitKinds","BYTES_GROUP_CONFIG","label","decimal_places","abbreviate","BYTES_UNIT_CONFIG","Bytes","group","formatBytes","bytes","unitOptions","options","undefined","decimals","formatParams","style","minimumFractionDigits","maximumFractionDigits","useGrouping","formatter","Intl","NumberFormat","format","k","sizes","i","Math","max","floor","log","abbreviatedValue","pow"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,sBAAsB,QAAQ,aAAa,CAAC;AAGrD,MAAMC,cAAc,GAAG;IAAC,OAAO;CAAC,AAAS,AAAC;AAO1C,OAAO,MAAMC,kBAAkB,GAAoB;IACjDC,KAAK,EAAE,OAAO;IACdC,cAAc,EAAE,IAAI;IACpBC,UAAU,EAAE,IAAI;CACjB,CAAC;AACF,OAAO,MAAMC,iBAAiB,GAAgD;IAC5EC,KAAK,EAAE;QACLC,KAAK,EAAE,OAAO;QACdL,KAAK,EAAE,OAAO;KACf;CACF,CAAC;AAEF;;;CAGC,GACD,OAAO,SAASM,WAAW,CAACC,KAAa,EAAEC,WAA6B,EAAE;IACxE,IAAID,KAAK,KAAK,CAAC,EAAE,OAAO,SAAS,CAAC;IAElC,qCAAqC;IACrC,MAAME,OAAO,GAAGD,WAAW,CAACN,UA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AGrB,KAAK,GAAGiB,IAAI,CAACK,GAAG,CAACR,CAAC,EAAEE,CAAC,CAAC,AAAC;IAChD,OAAO,CAAC,EAAEN,SAAS,CAACG,MAAM,CAACQ,gBAAgB,CAAC,CAAC,CAAC,EAAEN,KAAK,CAACC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7D,CAAC"}
1
+ {"version":3,"sources":["../../../src/model/units/bytes.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DEFAULT_DECIMAL_PLACES } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\n\nconst bytesUnitKinds = ['Bytes'] as const;\ntype BytesUnitKind = (typeof bytesUnitKinds)[number];\nexport type BytesUnitOptions = {\n kind: BytesUnitKind;\n decimal_places?: number;\n abbreviate?: boolean;\n};\nexport const BYTES_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Bytes',\n decimal_places: true,\n abbreviate: true,\n};\nexport const BYTES_UNIT_CONFIG: Readonly<Record<BytesUnitKind, UnitConfig>> = {\n Bytes: {\n group: 'Bytes',\n label: 'Bytes',\n },\n};\n\n/**\n * Format value as bytes, use abbreviate option for more readable sizes (KB, MB, GB, etc.)\n * https://stackoverflow.com/questions/15900485/correct-way-to-convert-size-in-bytes-to-kb-mb-gb-in-javascript/18650828#18650828\n */\nexport function formatBytes(bytes: number, unitOptions: BytesUnitOptions) {\n if (bytes === 0) return '0 bytes';\n\n // default to full 'Bytes' formatting\n const options = unitOptions.abbreviate === undefined ? { ...unitOptions, abbreviate: false } : unitOptions;\n\n let decimals = options.decimal_places ?? DEFAULT_DECIMAL_PLACES;\n // avoids minimumFractionDigits value is out of range error, possible values are 0 to 20\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#minimumfractiondigits\n if (decimals < 0) {\n decimals = 0;\n } else if (decimals > 20) {\n decimals = 20;\n }\n\n const formatParams: Intl.NumberFormatOptions = {\n style: 'decimal',\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n useGrouping: true,\n };\n const formatter = new Intl.NumberFormat('en-US', formatParams);\n\n if (options.abbreviate === false) {\n return `${formatter.format(bytes)} bytes`;\n }\n\n const k = 1024;\n const sizes = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n\n // Math.max(0, ...) ensures that we don't return -1 as a value for the index.\n // Why? When the number of bytes are between -1 and 1, Math.floor(Math.log(bytes)/Math.log(1024)) returns -1.\n const i = Math.max(0, Math.floor(Math.log(bytes) / Math.log(k)));\n const abbreviatedValue = bytes / Math.pow(k, i);\n return `${formatter.format(abbreviatedValue)} ${sizes[i]}`;\n}\n"],"names":["DEFAULT_DECIMAL_PLACES","bytesUnitKinds","BYTES_GROUP_CONFIG","label","decimal_places","abbreviate","BYTES_UNIT_CONFIG","Bytes","group","formatBytes","bytes","unitOptions","options","undefined","decimals","formatParams","style","minimumFractionDigits","maximumFractionDigits","useGrouping","formatter","Intl","NumberFormat","format","k","sizes","i","Math","max","floor","log","abbreviatedValue","pow"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,sBAAsB,QAAQ,aAAa,CAAC;AAGrD,MAAMC,cAAc,GAAG;IAAC,OAAO;CAAC,AAAS,AAAC;AAO1C,OAAO,MAAMC,kBAAkB,GAAoB;IACjDC,KAAK,EAA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AG;QAAC,OAAO;QAAE,IAAI;QAAE,IAAI;QAAE,IAAI;QAAE,IAAI;QAAE,IAAI;QAAE,IAAI;QAAE,IAAI;QAAE,IAAI;KAAC,AAAC;IAExE,6EAA6E;IAC7E,6GAA6G;IAC7G,MAAMC,CAAC,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAED,IAAI,CAACE,KAAK,CAACF,IAAI,CAACG,GAAG,CAACpB,KAAK,CAAC,GAAGiB,IAAI,CAACG,GAAG,CAACN,CAAC,CAAC,CAAC,CAAC,AAAC;IACjE,MAAMO,gBAAgB,GAAGrB,KAAK,GAAGiB,IAAI,CAACK,GAAG,CAACR,CAAC,EAAEE,CAAC,CAAC,AAAC;IAChD,OAAO,CAAC,EAAEN,SAAS,CAACG,MAAM,CAACQ,gBAAgB,CAAC,CAAC,CAAC,EAAEN,KAAK,CAACC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7D,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { UnitGroupConfig, UnitConfig } from './types';
2
2
  declare const decimalUnitKinds: readonly ["Decimal"];
3
- declare type DecimalUnitKind = typeof decimalUnitKinds[number];
3
+ declare type DecimalUnitKind = (typeof decimalUnitKinds)[number];
4
4
  export declare type DecimalUnitOptions = {
5
5
  kind: DecimalUnitKind;
6
6
  decimal_places?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"decimal.d.ts","sourceRoot":"","sources":["../../../src/model/units/decimal.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEtD,QAAA,MAAM,gBAAgB,sBAAuB,CAAC;AAC9C,aAAK,eAAe,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACvD,oBAAY,kBAAkB,GAAG;IAC/B,IAAI,EAAE,eAAe,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AACF,eAAO,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AC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAYlF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/model/units/decimal.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { round } from '../../utils/mathjs';\nimport { DEFAULT_DECIMAL_PLACES } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\n\nconst decimalUnitKinds = ['Decimal'] as const;\ntype DecimalUnitKind = typeof decimalUnitKinds[number];\nexport type DecimalUnitOptions = {\n kind: DecimalUnitKind;\n decimal_places?: number;\n abbreviate?: boolean;\n};\nexport const PERCENT_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Percent',\n decimal_places: true,\n};\nexport const DECIMAL_UNIT_CONFIG: Readonly<Record<DecimalUnitKind, UnitConfig>> = {\n Decimal: {\n group: 'Decimal',\n label: 'Decimal',\n },\n};\n\nexport function formatDecimal(value: number, unitOptions: DecimalUnitOptions): string {\n const decimals = unitOptions.decimal_places ?? DEFAULT_DECIMAL_PLACES;\n\n if (value === 0) {\n return value.toString();\n }\n\n if (unitOptions.abbreviate && value >= 1000) {\n return abbreviateLargeNumber(value, decimals);\n }\n\n const formatParams: Intl.NumberFormatOptions = {\n style: 'decimal',\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n useGrouping: true,\n };\n const decimalFormatter = new Intl.NumberFormat('en-US', formatParams);\n return decimalFormatter.format(value);\n}\n\n/**\n * Takes large numbers and abbreviates them with the appropriate suffix\n * 10123 -> 10.123k\n * 1000000 -> 1M\n */\nexport function abbreviateLargeNumber(num: number, decimals = 2) {\n const modifier = (n: number) => round(n, decimals);\n return formatNumber(num, modifier);\n}\n\n/**\n * Takes large numbers, rounds and abbreviates them with the appropriate suffix\n * Add modifier to run on output value prior to unit being added (defaults to rounding)\n */\nexport function formatNumber(num: number, modifier?: (n: number) => number): string {\n const fn = modifier ?? Math.round;\n\n return num >= 1e12\n ? fn(num / 1e12) + 'T'\n : num >= 1e9\n ? fn(num / 1e9) + 'B'\n : num >= 1e6\n ? fn(num / 1e6) + 'M'\n : num >= 1e3\n ? fn(num / 1e3) + 'K'\n : num.toString();\n}\n"],"names":["round","DEFAULT_DECIMAL_PLACES","decimalUnitKinds","PERCENT_GROUP_CONFIG","label","decimal_places","DECIMAL_UNIT_CONFIG","Decimal","group","formatDecimal","value","unitOptions","decimals","toString","abbreviate","abbreviateLargeNumber","formatParams","style","minimumFractionDigits","maximumFractionDigits","useGrouping","decimalFormatter","Intl","NumberFormat","format","num","modifier","n","formatNumber","fn","Math"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,KAAK,QAAQ,oBAAoB,CAAC;AAC3C,SAASC,sBAAsB,QAAQ,aAAa,CAAC;AAGrD,MAAMC,gBAAgB,GAAG;IAAC,SAAS;CAAC,AAAS,AAAC;AAO9C,OAAO,MAAMC,oBAAoB,GAAoB;IACnDC,KAAK,EAAE,SAAS;IAChBC,cAAc,EAAE,IAAI;CACrB,CAAC;AACF,OAAO,MAAMC,mBAAmB,GAAkD;IAChFC,OAAO,EAAE;QACPC,KAAK,EAAE,SAAS;QAChBJ,KAAK,EAAE,SAAS;KACjB;CACF,CAAC;AAEF,OAAO,SAASK,aAAa,CAACC,KAAa,EAAEC,WAA+B,EAAU;QACnEA,eAA0B;IAA3C,MAAMC,QAAQ,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AAG,IAAI,GAAG,GACVI,EAAE,CAACJ,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GACnBA,GAAG,IAAI,GAAG,GACVI,EAAE,CAACJ,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GACnBA,GAAG,CAACZ,QAAQ,EAAE,CAAC;AACrB,CAAC"}
1
+ {"version":3,"sources":["../../../src/model/units/decimal.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { round } from '../../utils/mathjs';\nimport { DEFAULT_DECIMAL_PLACES } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\n\nconst decimalUnitKinds = ['Decimal'] as const;\ntype DecimalUnitKind = (typeof decimalUnitKinds)[number];\nexport type DecimalUnitOptions = {\n kind: DecimalUnitKind;\n decimal_places?: number;\n abbreviate?: boolean;\n};\nexport const PERCENT_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Percent',\n decimal_places: true,\n};\nexport const DECIMAL_UNIT_CONFIG: Readonly<Record<DecimalUnitKind, UnitConfig>> = {\n Decimal: {\n group: 'Decimal',\n label: 'Decimal',\n },\n};\n\nexport function formatDecimal(value: number, unitOptions: DecimalUnitOptions): string {\n const decimals = unitOptions.decimal_places ?? DEFAULT_DECIMAL_PLACES;\n\n if (value === 0) {\n return value.toString();\n }\n\n if (unitOptions.abbreviate && value >= 1000) {\n return abbreviateLargeNumber(value, decimals);\n }\n\n const formatParams: Intl.NumberFormatOptions = {\n style: 'decimal',\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n useGrouping: true,\n };\n const decimalFormatter = new Intl.NumberFormat('en-US', formatParams);\n return decimalFormatter.format(value);\n}\n\n/**\n * Takes large numbers and abbreviates them with the appropriate suffix\n * 10123 -> 10.123k\n * 1000000 -> 1M\n */\nexport function abbreviateLargeNumber(num: number, decimals = 2) {\n const modifier = (n: number) => round(n, decimals);\n return formatNumber(num, modifier);\n}\n\n/**\n * Takes large numbers, rounds and abbreviates them with the appropriate suffix\n * Add modifier to run on output value prior to unit being added (defaults to rounding)\n */\nexport function formatNumber(num: number, modifier?: (n: number) => number): string {\n const fn = modifier ?? Math.round;\n\n return num >= 1e12\n ? fn(num / 1e12) + 'T'\n : num >= 1e9\n ? fn(num / 1e9) + 'B'\n : num >= 1e6\n ? fn(num / 1e6) + 'M'\n : num >= 1e3\n ? fn(num / 1e3) + 'K'\n : num.toString();\n}\n"],"names":["round","DEFAULT_DECIMAL_PLACES","decimalUnitKinds","PERCENT_GROUP_CONFIG","label","decimal_places","DECIMAL_UNIT_CONFIG","Decimal","group","formatDecimal","value","unitOptions","decimals","toString","abbreviate","abbreviateLargeNumber","formatParams","style","minimumFractionDigits","maximumFractionDigits","useGrouping","decimalFormatter","Intl","NumberFormat","format","num","modifier","n","formatNumber","fn","Math"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,KAAK,QAAQ,oBAAoB,CAAC;AAC3C,SAASC,sBAAsB,QAAQ,aAAa,CAAC;AAGrD,MAAMC,gBAAgB,GAAG;IAAC,SAAS;CAAC,AAAS,AAAC;AAO9C,OAAO,MAAMC,oBAAoB,GAAoB;IACnDC,KAAK,EAAE,SAAS;IAChBC,cAAc,EAAE,IAAI;CACrB,CAAC;AACF,OAAO,MAAMC,mBAAmB,GAAkD;IAChFC,OAAO,EAAE;QACPC,KAAK,EAAE,SAAS;QAChBJ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J,GAAG,GAAG,IAAI,CAAC,GAAG,GAAG,GACpBA,GAAG,IAAI,GAAG,GACVI,EAAE,CAACJ,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GACnBA,GAAG,IAAI,GAAG,GACVI,EAAE,CAACJ,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GACnBA,GAAG,IAAI,GAAG,GACVI,EAAE,CAACJ,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GACnBA,GAAG,CAACZ,QAAQ,EAAE,CAAC;AACrB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { UnitGroupConfig, UnitConfig } from './types';
2
2
  declare const percentUnitKinds: readonly ["Percent", "PercentDecimal", "%"];
3
- declare type PercentUnitKind = typeof percentUnitKinds[number];
3
+ declare type PercentUnitKind = (typeof percentUnitKinds)[number];
4
4
  export declare type PercentUnitOptions = {
5
5
  kind: PercentUnitKind;
6
6
  decimal_places?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"percent.d.ts","sourceRoot":"","sources":["../../../src/model/units/percent.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGtD,QAAA,MAAM,gBAAgB,6CAA8C,CAAC;AACrE,aAAK,eAAe,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACvD,oBAAY,kBAAkB,GAAG;IAC/B,IAAI,EAAE,eAAe,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AACF,eAAO,MAAM,oBAAoB,EAAE,eAIlC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,UAAU,CAAC,CAgB7E,CAAC;AAEF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,kBAAkB,GAAG,MAAM,CAQpF"}
1
+ {"version":3,"file":"percent.d.ts","sourceRoot":"","sources":["../../../src/model/units/percent.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGtD,QAAA,MAAM,gBAAgB,6CAA8C,CAAC;AACrE,aAAK,eAAe,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AACzD,oBAAY,kBAAkB,GAAG;IAC/B,IAAI,EAAE,eAAe,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AACF,eAAO,MAAM,oBAAoB,EAAE,eAIlC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,UAAU,CAAC,CAgB7E,CAAC;AAEF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,kBAAkB,GAAG,MAAM,CAQpF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/model/units/percent.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { UnitGroupConfig, UnitConfig } from './types';\nimport { DEFAULT_DECIMAL_PLACES } from './constants';\n\nconst percentUnitKinds = ['Percent', 'PercentDecimal', '%'] as const;\ntype PercentUnitKind = typeof percentUnitKinds[number];\nexport type PercentUnitOptions = {\n kind: PercentUnitKind;\n decimal_places?: number;\n};\nexport const DECIMAL_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Decimal',\n decimal_places: true,\n abbreviate: true,\n};\nconst PERCENT_GROUP = 'Percent';\nexport const PERCENT_UNIT_CONFIG: Readonly<Record<PercentUnitKind, UnitConfig>> = {\n Percent: {\n group: PERCENT_GROUP,\n label: 'Percent (0-100)',\n },\n PercentDecimal: {\n group: PERCENT_GROUP,\n label: 'Percent (0.0-1.0)',\n },\n '%': {\n // This option is not shown in the selector because it is a shorthand\n // duplicate of `Percent`.\n disableSelectorOption: true,\n group: PERCENT_GROUP,\n label: '%',\n },\n};\n\nexport function formatPercent(value: number, unitOptions: PercentUnitOptions): string {\n const decimals = unitOptions.decimal_places ?? DEFAULT_DECIMAL_PLACES;\n\n if (unitOptions.kind === 'PercentDecimal') {\n value = value * 100;\n }\n\n return value.toFixed(decimals) + '%';\n}\n"],"names":["DEFAULT_DECIMAL_PLACES","percentUnitKinds","DECIMAL_GROUP_CONFIG","label","decimal_places","abbreviate","PERCENT_GROUP","PERCENT_UNIT_CONFIG","Percent","group","PercentDecimal","disableSelectorOption","formatPercent","value","unitOptions","decimals","kind","toFixed"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,sBAAsB,QAAQ,aAAa,CAAC;AAErD,MAAMC,gBAAgB,GAAG;IAAC,SAAS;IAAE,gBAAgB;IAAE,GAAG;CAAC,AAAS,AAAC;AAMrE,OAAO,MAAMC,oBAAoB,GAAoB;IACnDC,KAAK,EAAE,SAAS;IAChBC,cAAc,EAAE,IAAI;IACpBC,UAAU,EAAE,IAAI;CACjB,CAAC;AACF,MAAMC,aAAa,GAAG,SAAS,AAAC;AAChC,OAAO,MAAMC,mBAAmB,GAAkD;IAChFC,OAAO,EAAE;QACPC,KAAK,EAAEH,aAAa;QACpBH,KAAK,EAAE,iBAAiB;KACzB;IACDO,cAAc,EAAE;QACdD,KAAK,EAAEH,aAAa;QACpBH,KAAK,EAAE,mBAAmB;KAC3B;IACD,GAAG,EAAE;QACH,qEAAqE;QACrE,0BAA0B;QAC1BQ,qBAAqB,EAAE,IAAI;QAC3BF,KAAK,EAAEH,aAAa;QACpBH,KAAK,EAAE,GAAG;KACX;CACF,CAAC;AAEF,OAAO,SAASS,aAAa,CAACC,KAAa,EAAEC,WAA+B,EAAU;QACnEA,eAA0B;IAA3C,MAAMC,QAAQ,GAAGD,CAAAA,eAA0B,GAA1BA,WAAW,CAACV,cAAc,cAA1BU,eAA0B,cAA1BA,eAA0B,GAAId,sBAAsB,AAAC;IAEtE,IAAIc,WAAW,CAACE,IAAI,KAAK,gBAAgB,EAAE;QACzCH,KAAK,GAAGA,KAAK,GAAG,GAAG,CAAC;IACtB,CAAC;IAED,OAAOA,KAAK,CAACI,OAAO,CAACF,QAAQ,CAAC,GAAG,GAAG,CAAC;AACvC,CAAC"}
1
+ {"version":3,"sources":["../../../src/model/units/percent.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { UnitGroupConfig, UnitConfig } from './types';\nimport { DEFAULT_DECIMAL_PLACES } from './constants';\n\nconst percentUnitKinds = ['Percent', 'PercentDecimal', '%'] as const;\ntype PercentUnitKind = (typeof percentUnitKinds)[number];\nexport type PercentUnitOptions = {\n kind: PercentUnitKind;\n decimal_places?: number;\n};\nexport const DECIMAL_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Decimal',\n decimal_places: true,\n abbreviate: true,\n};\nconst PERCENT_GROUP = 'Percent';\nexport const PERCENT_UNIT_CONFIG: Readonly<Record<PercentUnitKind, UnitConfig>> = {\n Percent: {\n group: PERCENT_GROUP,\n label: 'Percent (0-100)',\n },\n PercentDecimal: {\n group: PERCENT_GROUP,\n label: 'Percent (0.0-1.0)',\n },\n '%': {\n // This option is not shown in the selector because it is a shorthand\n // duplicate of `Percent`.\n disableSelectorOption: true,\n group: PERCENT_GROUP,\n label: '%',\n },\n};\n\nexport function formatPercent(value: number, unitOptions: PercentUnitOptions): string {\n const decimals = unitOptions.decimal_places ?? DEFAULT_DECIMAL_PLACES;\n\n if (unitOptions.kind === 'PercentDecimal') {\n value = value * 100;\n }\n\n return value.toFixed(decimals) + '%';\n}\n"],"names":["DEFAULT_DECIMAL_PLACES","percentUnitKinds","DECIMAL_GROUP_CONFIG","label","decimal_places","abbreviate","PERCENT_GROUP","PERCENT_UNIT_CONFIG","Percent","group","PercentDecimal","disableSelectorOption","formatPercent","value","unitOptions","decimals","kind","toFixed"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,sBAAsB,QAAQ,aAAa,CAAC;AAErD,MAAMC,gBAAgB,GAAG;IAAC,SAAS;IAAE,gBAAgB;IAAE,GAAG;CAAC,AAAS,AAAC;AAMrE,OAAO,MAAMC,oBAAoB,GAAoB;IACnDC,KAAK,EAAE,SAAS;IAChBC,cAAc,EAAE,IAAI;IACpBC,UAAU,EAAE,IAAI;CACjB,CAAC;AACF,MAAMC,aAAa,GAAG,SAAS,AAAC;AAChC,OAAO,MAAMC,mBAAmB,GAAkD;IAChFC,OAAO,EAAE;QACPC,KAAK,EAAEH,aAAa;QACpBH,KAAK,EAAE,iBAAiB;KACzB;IACDO,cAAc,EAAE;QACdD,KAAK,EAAEH,aAAa;QACpBH,KAAK,EAAE,mBAAmB;KAC3B;IACD,GAAG,EAAE;QACH,qEAAqE;QACrE,0BAA0B;QAC1BQ,qBAAqB,EAAE,IAAI;QAC3BF,KAAK,EAAEH,aAAa;QACpBH,KAAK,EAAE,GAAG;KACX;CACF,CAAC;AAEF,OAAO,SAASS,aAAa,CAACC,KAAa,EAAEC,WAA+B,EAAU;QACnEA,eAA0B;IAA3C,MAAMC,QAAQ,GAAGD,CAAAA,eAA0B,GAA1BA,WAAW,CAACV,cAAc,cAA1BU,eAA0B,cAA1BA,eAA0B,GAAId,sBAAsB,AAAC;IAEtE,IAAIc,WAAW,CAACE,IAAI,KAAK,gBAAgB,EAAE;QACzCH,KAAK,GAAGA,KAAK,GAAG,GAAG,CAAC;IACtB,CAAC;IAED,OAAOA,KAAK,CAACI,OAAO,CAACF,QAAQ,CAAC,GAAG,GAAG,CAAC;AACvC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { UnitGroupConfig, UnitConfig } from './types';
2
2
  declare const timeUnitKinds: readonly ["Milliseconds", "Seconds", "Minutes", "Hours", "Days", "Weeks", "Months", "Years"];
3
- declare type TimeUnitKind = typeof timeUnitKinds[number];
3
+ declare type TimeUnitKind = (typeof timeUnitKinds)[number];
4
4
  export declare type TimeUnitOptions = {
5
5
  kind: TimeUnitKind;
6
6
  decimal_places?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../../src/model/units/time.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEtD,QAAA,MAAM,aAAa,8FAA+F,CAAC;AACnH,aAAK,YAAY,GAAG,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;AACjD,oBAAY,eAAe,GAAG;IAC5B,IAAI,EAAE,YAAY,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,eAG/B,CAAC;AACF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,UAAU,CAAC,CAiCvE,CAAC;AAIF,oBAAY,gBAAgB;IAC1B,YAAY,gBAAgB;IAC5B,OAAO,WAAW;IAClB,OAAO,WAAW;IAClB,KAAK,SAAS;IACd,IAAI,QAAQ;IACZ,KAAK,SAAS;IACd,MAAM,UAAU;IAChB,KAAK,SAAS;CACf;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,GAAG,MAAM,CAW9E"}
1
+ {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../../src/model/units/time.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEtD,QAAA,MAAM,aAAa,8FAA+F,CAAC;AACnH,aAAK,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AACnD,oBAAY,eAAe,GAAG;IAC5B,IAAI,EAAE,YAAY,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,eAG/B,CAAC;AACF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,UAAU,CAAC,CAiCvE,CAAC;AAIF,oBAAY,gBAAgB;IAC1B,YAAY,gBAAgB;IAC5B,OAAO,WAAW;IAClB,OAAO,WAAW;IAClB,KAAK,SAAS;IACd,IAAI,QAAQ;IACZ,KAAK,SAAS;IACd,MAAM,UAAU;IAChB,KAAK,SAAS;CACf;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,GAAG,MAAM,CAW9E"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/model/units/time.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DEFAULT_DECIMAL_PLACES } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\n\nconst timeUnitKinds = ['Milliseconds', 'Seconds', 'Minutes', 'Hours', 'Days', 'Weeks', 'Months', 'Years'] as const;\ntype TimeUnitKind = typeof timeUnitKinds[number];\nexport type TimeUnitOptions = {\n kind: TimeUnitKind;\n decimal_places?: number;\n};\nconst TIME_GROUP = 'Time';\nexport const TIME_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Time',\n decimal_places: true,\n};\nexport const TIME_UNIT_CONFIG: Readonly<Record<TimeUnitKind, UnitConfig>> = {\n Milliseconds: {\n group: TIME_GROUP,\n label: 'Milliseconds',\n },\n Seconds: {\n group: TIME_GROUP,\n label: 'Seconds',\n },\n Minutes: {\n group: TIME_GROUP,\n label: 'Minutes',\n },\n Hours: {\n group: TIME_GROUP,\n label: 'Hours',\n },\n Days: {\n group: TIME_GROUP,\n label: 'Days',\n },\n Weeks: {\n group: TIME_GROUP,\n label: 'Weeks',\n },\n Months: {\n group: TIME_GROUP,\n label: 'Months',\n },\n Years: {\n group: TIME_GROUP,\n label: 'Years',\n },\n};\n\n// Mapping of time units to what Intl.NumberFormat formatter expects\n// https://v8.dev/features/intl-numberformat#units\nexport enum TimeIntlDuration {\n Milliseconds = 'millisecond',\n Seconds = 'second',\n Minutes = 'minute',\n Hours = 'hour',\n Days = 'day',\n Weeks = 'week',\n Months = 'month',\n Years = 'year',\n}\n\nexport function formatTime(value: number, unitOptions: TimeUnitOptions): string {\n const decimals = unitOptions.decimal_places ?? DEFAULT_DECIMAL_PLACES;\n const timeUnit: string = TimeIntlDuration[unitOptions.kind];\n const formatter = new Intl.NumberFormat('en-US', {\n style: 'unit',\n unit: timeUnit,\n unitDisplay: 'long',\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n });\n return formatter.format(value);\n}\n"],"names":["DEFAULT_DECIMAL_PLACES","timeUnitKinds","TIME_GROUP","TIME_GROUP_CONFIG","label","decimal_places","TIME_UNIT_CONFIG","Milliseconds","group","Seconds","Minutes","Hours","Days","Weeks","Months","Years","TimeIntlDuration","formatTime","value","unitOptions","decimals","timeUnit","kind","formatter","Intl","NumberFormat","style","unit","unitDisplay","minimumFractionDigits","maximumFractionDigits","format"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,sBAAsB,QAAQ,aAAa,CAAC;AAGrD,MAAMC,aAAa,GAAG;IAAC,cAAc;IAAE,SAAS;IAAE,SAAS;IAAE,OAAO;IAAE,MAAM;IAAE,OAAO;IAAE,QAAQ;IAAE,OAAO;CAAC,AAAS,AAAC;AAMnH,MAAMC,UAAU,GAAG,MAAM,AAAC;AAC1B,OAAO,MAAMC,iBAAiB,GAAoB;IAChDC,KAAK,EAAE,MAAM;IACbC,cAAc,EAAE,IAAI;CACrB,CAAC;AACF,OAAO,MAAMC,gBAAgB,GAA+C;IAC1EC,YAAY,EAAE;QACZC,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,cAAc;KACtB;IACDK,OAAO,EAAE;QACPD,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,SAAS;KACjB;IACDM,OAAO,EAAE;QACPF,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,SAAS;KACjB;IACDO,KAAK,EAAE;QACLH,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,OAAO;KACf;IACDQ,IAAI,EAAE;QACJJ,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,MAAM;KACd;IACDS,KAAK,EAAE;QACLL,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,OAAO;KACf;IACDU,MAAM,EAAE;QACNN,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,QAAQ;KAChB;IACDW,KAAK,EAAE;QACLP,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,OAAO;KACf;CACF,CAAC;WAIK,gBASN;UATWY,gBAAgB;IAAhBA,gBAAgB,CAC1BT,cAAY,IAAG,aAAa;IADlBS,gBAAgB,CAE1BP,SAAO,IAAG,QAAQ;IAFRO,gBAAgB,CAG1BN,SAAO,IAAG,QAAQ;IAHRM,gBAAgB,CAI1BL,OAAK,IAAG,MAAM;IAJJK,gBAAgB,CAK1BJ,MAAI,IAAG,KAAK;IALFI,gBAAgB,CAM1BH,OAAK,IAAG,MAAM;IANJG,gBAAgB,CAO1BF,QAAM,IAAG,OAAO;IAPNE,gBAAgB,CAQ1BD,OAAK,IAAG,MAAM;GARJC,gBAAgB,KAAhBA,gBAAgB;AAW5B,OAAO,SAASC,UAAU,CAACC,KAAa,EAAEC,WAA4B,EAAU;QAC7DA,eAA0B;IAA3C,MAAMC,QAAQ,GAAGD,CAAAA,eAA0B,GAA1BA,WAAW,CAACd,cAAc,cAA1Bc,eAA0B,cAA1BA,eAA0B,GAAInB,sBAAsB,AAAC;IACtE,MAAMqB,QAAQ,GAAWL,gBAAgB,CAACG,WAAW,CAACG,IAAI,CAAC,AAAC;IAC5D,MAAMC,SAAS,GAAG,IAAIC,IAAI,CAACC,YAAY,CAAC,OAAO,EAAE;QAC/CC,KAAK,EAAE,MAAM;QACbC,IAAI,EAAEN,QAAQ;QACdO,WAAW,EAAE,MAAM;QACnBC,qBAAqB,EAAET,QAAQ;QAC/BU,qBAAqB,EAAEV,QAAQ;KAChC,CAAC,AAAC;IACH,OAAOG,SAAS,CAACQ,MAAM,CAACb,KAAK,CAAC,CAAC;AACjC,CAAC"}
1
+ {"version":3,"sources":["../../../src/model/units/time.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DEFAULT_DECIMAL_PLACES } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\n\nconst timeUnitKinds = ['Milliseconds', 'Seconds', 'Minutes', 'Hours', 'Days', 'Weeks', 'Months', 'Years'] as const;\ntype TimeUnitKind = (typeof timeUnitKinds)[number];\nexport type TimeUnitOptions = {\n kind: TimeUnitKind;\n decimal_places?: number;\n};\nconst TIME_GROUP = 'Time';\nexport const TIME_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Time',\n decimal_places: true,\n};\nexport const TIME_UNIT_CONFIG: Readonly<Record<TimeUnitKind, UnitConfig>> = {\n Milliseconds: {\n group: TIME_GROUP,\n label: 'Milliseconds',\n },\n Seconds: {\n group: TIME_GROUP,\n label: 'Seconds',\n },\n Minutes: {\n group: TIME_GROUP,\n label: 'Minutes',\n },\n Hours: {\n group: TIME_GROUP,\n label: 'Hours',\n },\n Days: {\n group: TIME_GROUP,\n label: 'Days',\n },\n Weeks: {\n group: TIME_GROUP,\n label: 'Weeks',\n },\n Months: {\n group: TIME_GROUP,\n label: 'Months',\n },\n Years: {\n group: TIME_GROUP,\n label: 'Years',\n },\n};\n\n// Mapping of time units to what Intl.NumberFormat formatter expects\n// https://v8.dev/features/intl-numberformat#units\nexport enum TimeIntlDuration {\n Milliseconds = 'millisecond',\n Seconds = 'second',\n Minutes = 'minute',\n Hours = 'hour',\n Days = 'day',\n Weeks = 'week',\n Months = 'month',\n Years = 'year',\n}\n\nexport function formatTime(value: number, unitOptions: TimeUnitOptions): string {\n const decimals = unitOptions.decimal_places ?? DEFAULT_DECIMAL_PLACES;\n const timeUnit: string = TimeIntlDuration[unitOptions.kind];\n const formatter = new Intl.NumberFormat('en-US', {\n style: 'unit',\n unit: timeUnit,\n unitDisplay: 'long',\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n });\n return formatter.format(value);\n}\n"],"names":["DEFAULT_DECIMAL_PLACES","timeUnitKinds","TIME_GROUP","TIME_GROUP_CONFIG","label","decimal_places","TIME_UNIT_CONFIG","Milliseconds","group","Seconds","Minutes","Hours","Days","Weeks","Months","Years","TimeIntlDuration","formatTime","value","unitOptions","decimals","timeUnit","kind","formatter","Intl","NumberFormat","style","unit","unitDisplay","minimumFractionDigits","maximumFractionDigits","format"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,sBAAsB,QAAQ,aAAa,CAAC;AAGrD,MAAMC,aAAa,GAAG;IAAC,cAAc;IAAE,SAAS;IAAE,SAAS;IAAE,OAAO;IAAE,MAAM;IAAE,OAAO;IAAE,QAAQ;IAAE,OAAO;CAAC,AAAS,AAAC;AAMnH,MAAMC,UAAU,GAAG,MAAM,AAAC;AAC1B,OAAO,MAAMC,iBAAiB,GAAoB;IAChDC,KAAK,EAAE,MAAM;IACbC,cAAc,EAAE,IAAI;CACrB,CAAC;AACF,OAAO,MAAMC,gBAAgB,GAA+C;IAC1EC,YAAY,EAAE;QACZC,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,cAAc;KACtB;IACDK,OAAO,EAAE;QACPD,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,SAAS;KACjB;IACDM,OAAO,EAAE;QACPF,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,SAAS;KACjB;IACDO,KAAK,EAAE;QACLH,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,OAAO;KACf;IACDQ,IAAI,EAAE;QACJJ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;AACjC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export declare const UNIT_GROUPS: readonly ["Time", "Percent", "Decimal", "Bytes"];
2
- export declare type UnitGroup = typeof UNIT_GROUPS[number];
2
+ export declare type UnitGroup = (typeof UNIT_GROUPS)[number];
3
3
  /**
4
4
  * Configuration for rendering units that are part of a group.
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/model/units/types.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,WAAW,kDAAmD,CAAC;AAC5E,oBAAY,SAAS,GAAG,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC;AAEnD;;GAEG;AACH,oBAAY,eAAe,GAAG;IAC5B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,oBAAY,UAAU,GAAG;IACvB;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/model/units/types.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,WAAW,kDAAmD,CAAC;AAC5E,oBAAY,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD;;GAEG;AACH,oBAAY,eAAe,GAAG;IAC5B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,oBAAY,UAAU,GAAG;IACvB;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/model/units/types.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Common types needed across individual unit groups and the overall combined\n// units.\n\nexport const UNIT_GROUPS = ['Time', 'Percent', 'Decimal', 'Bytes'] as const;\nexport type UnitGroup = typeof UNIT_GROUPS[number];\n\n/**\n * Configuration for rendering units that are part of a group.\n */\nexport type UnitGroupConfig = {\n /**\n * The label that is shown in the UI.\n */\n label: string;\n /**\n * When true, the unit group supports setting decimal places.\n */\n decimal_places?: boolean;\n /**\n * When true, the unit group supports enabling abbreviate.\n */\n abbreviate?: boolean;\n};\n\n/**\n * Configuration for rendering a specific unit.\n */\nexport type UnitConfig = {\n /**\n * The group the unit is part of. This will inform common rendering behavior.\n */\n group: UnitGroup;\n\n /**\n * When true, this unit will not be displayed in the unit selector. This is\n * useful for units that are shorthand variants of other units.\n */\n disableSelectorOption?: boolean;\n\n /**\n * The label that is shown in the UI.\n */\n label: string;\n};\n"],"names":["UNIT_GROUPS"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,6EAA6E;AAC7E,SAAS;AAET,OAAO,MAAMA,WAAW,GAAG;IAAC,MAAM;IAAE,SAAS;IAAE,SAAS;IAAE,OAAO;CAAC,AAAS,CAAC"}
1
+ {"version":3,"sources":["../../../src/model/units/types.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Common types needed across individual unit groups and the overall combined\n// units.\n\nexport const UNIT_GROUPS = ['Time', 'Percent', 'Decimal', 'Bytes'] as const;\nexport type UnitGroup = (typeof UNIT_GROUPS)[number];\n\n/**\n * Configuration for rendering units that are part of a group.\n */\nexport type UnitGroupConfig = {\n /**\n * The label that is shown in the UI.\n */\n label: string;\n /**\n * When true, the unit group supports setting decimal places.\n */\n decimal_places?: boolean;\n /**\n * When true, the unit group supports enabling abbreviate.\n */\n abbreviate?: boolean;\n};\n\n/**\n * Configuration for rendering a specific unit.\n */\nexport type UnitConfig = {\n /**\n * The group the unit is part of. This will inform common rendering behavior.\n */\n group: UnitGroup;\n\n /**\n * When true, this unit will not be displayed in the unit selector. This is\n * useful for units that are shorthand variants of other units.\n */\n disableSelectorOption?: boolean;\n\n /**\n * The label that is shown in the UI.\n */\n label: string;\n};\n"],"names":["UNIT_GROUPS"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,6EAA6E;AAC7E,SAAS;AAET,OAAO,MAAMA,WAAW,GAAG;IAAC,MAAM;IAAE,SAAS;IAAE,SAAS;IAAE,OAAO;CAAC,AAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/test-utils/theme.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,eAAe,EAAE,iBAY7B,CAAC"}
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/test-utils/theme.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,eAAe,EAAE,iBAgB7B,CAAC"}
@@ -21,6 +21,14 @@ export const testChartsTheme = {
21
21
  padding: {
22
22
  default: 12
23
23
  }
24
+ },
25
+ thresholds: {
26
+ defaultColor: '#59CC8D',
27
+ palette: [
28
+ '#438FEB',
29
+ '#FFB249',
30
+ '#EE6C6C'
31
+ ]
24
32
  }
25
33
  };
26
34
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test-utils/theme.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PersesChartsTheme } from '../model';\n\nexport const testChartsTheme: PersesChartsTheme = {\n echartsTheme: {},\n noDataOption: {},\n sparkline: {\n width: 1,\n color: '#000000',\n },\n container: {\n padding: {\n default: 12,\n },\n },\n};\n"],"names":["testChartsTheme","echartsTheme","noDataOption","sparkline","width","color","container","padding","default"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,MAAMA,eAAe,GAAsB;IAChDC,YAAY,EAAE,EAAE;IAChBC,YAAY,EAAE,EAAE;IAChBC,SAAS,EAAE;QACTC,KAAK,EAAE,CAAC;QACRC,KAAK,EAAE,SAAS;KACjB;IACDC,SAAS,EAAE;QACTC,OAAO,EAAE;YACPC,OAAO,EAAE,EAAE;SACZ;KACF;CACF,CAAC"}
1
+ {"version":3,"sources":["../../src/test-utils/theme.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PersesChartsTheme } from '../model';\n\nexport const testChartsTheme: PersesChartsTheme = {\n echartsTheme: {},\n noDataOption: {},\n sparkline: {\n width: 1,\n color: '#000000',\n },\n container: {\n padding: {\n default: 12,\n },\n },\n thresholds: {\n defaultColor: '#59CC8D',\n palette: ['#438FEB', '#FFB249', '#EE6C6C'],\n },\n};\n"],"names":["testChartsTheme","echartsTheme","noDataOption","sparkline","width","color","container","padding","default","thresholds","defaultColor","palette"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,MAAMA,eAAe,GAAsB;IAChDC,YAAY,EAAE,EAAE;IAChBC,YAAY,EAAE,EAAE;IAChBC,SAAS,EAAE;QACTC,KAAK,EAAE,CAAC;QACRC,KAAK,EAAE,SAAS;KACjB;IACDC,SAAS,EAAE;QACTC,OAAO,EAAE;YACPC,OAAO,EAAE,EAAE;SACZ;KACF;IACDC,UAAU,EAAE;QACVC,YAAY,EAAE,SAAS;QACvBC,OAAO,EAAE;YAAC,SAAS;YAAE,SAAS;YAAE,SAAS;SAAC;KAC3C;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Components, Theme } from '@mui/material';
2
+ export declare const MuiAlert: Components<Theme>['MuiAlert'];
3
+ //# sourceMappingURL=alert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../src/theme/component-overrides/alert.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,KAAK,EAA6B,MAAM,eAAe,CAAC;AAE7E,eAAO,MAAM,QAAQ,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,UAAU,CAwFlD,CAAC"}