@perses-dev/components 0.53.1 → 0.54.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/dist/ContentWithLegend/ContentWithLegend.js +1 -1
  2. package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
  3. package/dist/ContentWithLegend/model/content-with-legend-model.d.ts +1 -1
  4. package/dist/ContentWithLegend/model/content-with-legend-model.d.ts.map +1 -1
  5. package/dist/ContentWithLegend/model/content-with-legend-model.js +1 -1
  6. package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
  7. package/dist/FormEditor/FormActions.d.ts +1 -1
  8. package/dist/FormEditor/FormActions.d.ts.map +1 -1
  9. package/dist/FormEditor/FormActions.js.map +1 -1
  10. package/dist/FormatControls/FormatControls.d.ts +1 -1
  11. package/dist/FormatControls/FormatControls.d.ts.map +1 -1
  12. package/dist/FormatControls/FormatControls.js +1 -1
  13. package/dist/FormatControls/FormatControls.js.map +1 -1
  14. package/dist/FormatControls/UnitSelector.d.ts +1 -1
  15. package/dist/FormatControls/UnitSelector.d.ts.map +1 -1
  16. package/dist/FormatControls/UnitSelector.js +1 -1
  17. package/dist/FormatControls/UnitSelector.js.map +1 -1
  18. package/dist/Legend/Legend.js +1 -1
  19. package/dist/Legend/Legend.js.map +1 -1
  20. package/dist/Legend/legend-model.d.ts +1 -1
  21. package/dist/Legend/legend-model.d.ts.map +1 -1
  22. package/dist/Legend/legend-model.js.map +1 -1
  23. package/dist/LinksEditor/LinksEditor.d.ts +1 -1
  24. package/dist/LinksEditor/LinksEditor.js.map +1 -1
  25. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts +1 -1
  26. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
  27. package/dist/Table/Table.d.ts +1 -1
  28. package/dist/Table/Table.d.ts.map +1 -1
  29. package/dist/Table/Table.js +26 -6
  30. package/dist/Table/Table.js.map +1 -1
  31. package/dist/Table/TableToolbar.d.ts +34 -0
  32. package/dist/Table/TableToolbar.d.ts.map +1 -0
  33. package/dist/Table/TableToolbar.js +127 -0
  34. package/dist/Table/TableToolbar.js.map +1 -0
  35. package/dist/Table/VirtualizedTable.d.ts +3 -1
  36. package/dist/Table/VirtualizedTable.d.ts.map +1 -1
  37. package/dist/Table/VirtualizedTable.js +128 -117
  38. package/dist/Table/VirtualizedTable.js.map +1 -1
  39. package/dist/Table/VirtualizedTableContainer.d.ts.map +1 -1
  40. package/dist/Table/VirtualizedTableContainer.js +5 -1
  41. package/dist/Table/VirtualizedTableContainer.js.map +1 -1
  42. package/dist/Table/hooks/useFuzzySearch.d.ts +12 -0
  43. package/dist/Table/hooks/useFuzzySearch.d.ts.map +1 -0
  44. package/dist/Table/hooks/useFuzzySearch.js +43 -0
  45. package/dist/Table/hooks/useFuzzySearch.js.map +1 -0
  46. package/dist/Table/model/table-model.d.ts +38 -4
  47. package/dist/Table/model/table-model.d.ts.map +1 -1
  48. package/dist/Table/model/table-model.js.map +1 -1
  49. package/dist/ThresholdsEditor/ThresholdInput.d.ts +1 -1
  50. package/dist/ThresholdsEditor/ThresholdInput.d.ts.map +1 -1
  51. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
  52. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts +1 -1
  53. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
  54. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  55. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts +2 -3
  56. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts.map +1 -1
  57. package/dist/TimeRangeSelector/DateTimeRangePicker.js +2 -0
  58. package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -1
  59. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts +1 -1
  60. package/dist/TimeRangeSelector/TimeRangeSelector.js +1 -1
  61. package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
  62. package/dist/TimeRangeSelector/utils.d.ts +1 -1
  63. package/dist/TimeRangeSelector/utils.js +1 -1
  64. package/dist/TimeRangeSelector/utils.js.map +1 -1
  65. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +2 -2
  66. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
  67. package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
  68. package/dist/TimeSeriesTooltip/nearby-series.d.ts +2 -2
  69. package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
  70. package/dist/TimeSeriesTooltip/nearby-series.js +1 -2
  71. package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
  72. package/dist/TransformsEditor/TransformEditor.d.ts +1 -1
  73. package/dist/TransformsEditor/TransformEditor.d.ts.map +1 -1
  74. package/dist/TransformsEditor/TransformEditor.js.map +1 -1
  75. package/dist/TransformsEditor/TransformEditorContainer.d.ts.map +1 -1
  76. package/dist/TransformsEditor/TransformEditorContainer.js +1 -1
  77. package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -1
  78. package/dist/TransformsEditor/TransformsEditor.d.ts +1 -1
  79. package/dist/TransformsEditor/TransformsEditor.d.ts.map +1 -1
  80. package/dist/TransformsEditor/TransformsEditor.js.map +1 -1
  81. package/dist/ValueMappingEditor/ValueMappingEditor.js.map +1 -1
  82. package/dist/ValueMappingEditor/ValueMappingsEditor.d.ts.map +1 -1
  83. package/dist/ValueMappingEditor/ValueMappingsEditor.js.map +1 -1
  84. package/dist/cjs/ContentWithLegend/ContentWithLegend.js +2 -2
  85. package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +2 -2
  86. package/dist/cjs/FormatControls/FormatControls.js +4 -4
  87. package/dist/cjs/FormatControls/UnitSelector.js +3 -3
  88. package/dist/cjs/Legend/Legend.js +2 -2
  89. package/dist/cjs/Table/Table.js +24 -4
  90. package/dist/cjs/Table/TableToolbar.js +140 -0
  91. package/dist/cjs/Table/VirtualizedTable.js +126 -115
  92. package/dist/cjs/Table/VirtualizedTableContainer.js +5 -1
  93. package/dist/cjs/Table/hooks/useFuzzySearch.js +48 -0
  94. package/dist/cjs/TimeRangeSelector/DateTimeRangePicker.js +2 -0
  95. package/dist/cjs/TimeRangeSelector/TimeRangeSelector.js +3 -3
  96. package/dist/cjs/TimeRangeSelector/utils.js +2 -2
  97. package/dist/cjs/TimeSeriesTooltip/nearby-series.js +2 -3
  98. package/dist/cjs/TransformsEditor/TransformEditorContainer.js +2 -2
  99. package/dist/cjs/model/action.js +43 -0
  100. package/dist/cjs/model/bits.js +113 -0
  101. package/dist/cjs/model/bytes.js +115 -0
  102. package/dist/cjs/model/constants.js +23 -0
  103. package/dist/cjs/model/currency.js +126 -0
  104. package/dist/cjs/model/date.js +297 -0
  105. package/dist/cjs/model/decimal.js +72 -0
  106. package/dist/cjs/model/formatterCache.js +120 -0
  107. package/dist/cjs/model/index.js +16 -0
  108. package/dist/cjs/model/legend.js +101 -0
  109. package/dist/cjs/model/percent.js +82 -0
  110. package/dist/cjs/model/temperature.js +72 -0
  111. package/dist/cjs/model/thresholds.js +16 -0
  112. package/dist/cjs/model/throughput.js +161 -0
  113. package/dist/cjs/model/time.js +178 -0
  114. package/dist/cjs/model/timeOption.js +2 -2
  115. package/dist/cjs/model/transforms.js +29 -0
  116. package/dist/cjs/model/types.js +16 -0
  117. package/dist/cjs/model/units.js +186 -0
  118. package/dist/cjs/model/utils.js +48 -0
  119. package/dist/cjs/theme/theme.js +44 -29
  120. package/dist/cjs/theme/typography.js +8 -7
  121. package/dist/cjs/utils/axis.js +5 -5
  122. package/dist/cjs/utils/index.js +1 -0
  123. package/dist/cjs/utils/request-interpolation.js +49 -0
  124. package/dist/model/action.d.ts +4 -0
  125. package/dist/model/action.d.ts.map +1 -0
  126. package/dist/model/action.js +27 -0
  127. package/dist/model/action.js.map +1 -0
  128. package/dist/model/bits.d.ts +12 -0
  129. package/dist/model/bits.d.ts.map +1 -0
  130. package/dist/model/bits.js +89 -0
  131. package/dist/model/bits.js.map +1 -0
  132. package/dist/model/bytes.d.ts +12 -0
  133. package/dist/model/bytes.d.ts.map +1 -0
  134. package/dist/model/bytes.js +91 -0
  135. package/dist/model/bytes.js.map +1 -0
  136. package/dist/model/constants.d.ts +2 -0
  137. package/dist/model/constants.d.ts.map +1 -0
  138. package/dist/model/constants.js +15 -0
  139. package/dist/model/constants.js.map +1 -0
  140. package/dist/model/currency.d.ts +11 -0
  141. package/dist/model/currency.d.ts.map +1 -0
  142. package/dist/model/currency.js +107 -0
  143. package/dist/model/currency.js.map +1 -0
  144. package/dist/model/date.d.ts +28 -0
  145. package/dist/model/date.d.ts.map +1 -0
  146. package/dist/model/date.js +278 -0
  147. package/dist/model/date.js.map +1 -0
  148. package/dist/model/decimal.d.ts +12 -0
  149. package/dist/model/decimal.d.ts.map +1 -0
  150. package/dist/model/decimal.js +53 -0
  151. package/dist/model/decimal.js.map +1 -0
  152. package/dist/model/formatterCache.d.ts +11 -0
  153. package/dist/model/formatterCache.d.ts.map +1 -0
  154. package/dist/model/formatterCache.js +104 -0
  155. package/dist/model/formatterCache.js.map +1 -0
  156. package/dist/model/graph.d.ts +1 -1
  157. package/dist/model/graph.js.map +1 -1
  158. package/dist/model/index.d.ts +16 -0
  159. package/dist/model/index.d.ts.map +1 -1
  160. package/dist/model/index.js +16 -0
  161. package/dist/model/index.js.map +1 -1
  162. package/dist/model/legend.d.ts +19 -0
  163. package/dist/model/legend.d.ts.map +1 -0
  164. package/dist/model/legend.js +61 -0
  165. package/dist/model/legend.js.map +1 -0
  166. package/dist/model/percent.d.ts +11 -0
  167. package/dist/model/percent.d.ts.map +1 -0
  168. package/dist/model/percent.js +63 -0
  169. package/dist/model/percent.js.map +1 -0
  170. package/dist/model/temperature.d.ts +11 -0
  171. package/dist/model/temperature.d.ts.map +1 -0
  172. package/dist/model/temperature.js +53 -0
  173. package/dist/model/temperature.js.map +1 -0
  174. package/dist/model/theme.d.ts +1 -1
  175. package/dist/model/theme.d.ts.map +1 -1
  176. package/dist/model/theme.js.map +1 -1
  177. package/dist/model/thresholds.d.ts +16 -0
  178. package/dist/model/thresholds.d.ts.map +1 -0
  179. package/dist/model/thresholds.js +15 -0
  180. package/dist/model/thresholds.js.map +1 -0
  181. package/dist/model/throughput.d.ts +12 -0
  182. package/dist/model/throughput.d.ts.map +1 -0
  183. package/dist/model/throughput.js +142 -0
  184. package/dist/model/throughput.js.map +1 -0
  185. package/dist/model/time.d.ts +23 -0
  186. package/dist/model/time.d.ts.map +1 -0
  187. package/dist/model/time.js +158 -0
  188. package/dist/model/time.js.map +1 -0
  189. package/dist/model/timeOption.d.ts +1 -1
  190. package/dist/model/timeOption.js +1 -1
  191. package/dist/model/timeOption.js.map +1 -1
  192. package/dist/model/transforms.d.ts +43 -0
  193. package/dist/model/transforms.d.ts.map +1 -0
  194. package/dist/model/transforms.js +22 -0
  195. package/dist/model/transforms.js.map +1 -0
  196. package/dist/model/types.d.ts +56 -0
  197. package/dist/model/types.d.ts.map +1 -0
  198. package/dist/model/types.js +15 -0
  199. package/dist/model/types.js.map +1 -0
  200. package/dist/model/units.d.ts +105 -0
  201. package/dist/model/units.d.ts.map +1 -0
  202. package/dist/model/units.js +132 -0
  203. package/dist/model/units.js.map +1 -0
  204. package/dist/model/utils.d.ts +4 -0
  205. package/dist/model/utils.d.ts.map +1 -0
  206. package/dist/model/utils.js +32 -0
  207. package/dist/model/utils.js.map +1 -0
  208. package/dist/theme/theme.d.ts +3 -1
  209. package/dist/theme/theme.d.ts.map +1 -1
  210. package/dist/theme/theme.js +46 -29
  211. package/dist/theme/theme.js.map +1 -1
  212. package/dist/theme/typography.d.ts +6 -4
  213. package/dist/theme/typography.d.ts.map +1 -1
  214. package/dist/theme/typography.js +8 -7
  215. package/dist/theme/typography.js.map +1 -1
  216. package/dist/utils/axis.d.ts +1 -1
  217. package/dist/utils/axis.d.ts.map +1 -1
  218. package/dist/utils/axis.js +1 -1
  219. package/dist/utils/axis.js.map +1 -1
  220. package/dist/utils/chart-actions.d.ts +1 -1
  221. package/dist/utils/chart-actions.js.map +1 -1
  222. package/dist/utils/index.d.ts +1 -0
  223. package/dist/utils/index.d.ts.map +1 -1
  224. package/dist/utils/index.js +1 -0
  225. package/dist/utils/index.js.map +1 -1
  226. package/dist/utils/request-interpolation.d.ts +6 -0
  227. package/dist/utils/request-interpolation.d.ts.map +1 -0
  228. package/dist/utils/request-interpolation.js +33 -0
  229. package/dist/utils/request-interpolation.js.map +1 -0
  230. package/dist/utils/variable-interpolation.d.ts +1 -1
  231. package/dist/utils/variable-interpolation.js.map +1 -1
  232. package/package.json +6 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/model/utils.ts"],"names":[],"mappings":"AAaA,wBAAgB,mBAAmB,CAAC,WAAW,CAAC,EAAE,OAAO,GAAG,OAAO,CAElE;AAED,wBAAgB,gBAAgB,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAEhE;AAKD,wBAAgB,kBAAkB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUnE"}
@@ -0,0 +1,32 @@
1
+ // Copyright 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
+ export function shouldShortenValues(shortValues) {
14
+ return shortValues !== false;
15
+ }
16
+ export function hasDecimalPlaces(decimalPlaces) {
17
+ return typeof decimalPlaces === 'number';
18
+ }
19
+ // Avoids maximumFractionDigits out-of-range error.
20
+ // Allowed values are 0 to 20.
21
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#maximumfractiondigits
22
+ export function limitDecimalPlaces(num) {
23
+ if (!num) return num;
24
+ if (num < 0) {
25
+ num = 0;
26
+ } else if (num > 20) {
27
+ num = 20;
28
+ }
29
+ return num;
30
+ }
31
+
32
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/model/utils.ts"],"sourcesContent":["// Copyright 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 function shouldShortenValues(shortValues?: boolean): boolean {\n return shortValues !== false;\n}\n\nexport function hasDecimalPlaces(decimalPlaces?: number): boolean {\n return typeof decimalPlaces === 'number';\n}\n\n// Avoids maximumFractionDigits out-of-range error.\n// Allowed values are 0 to 20.\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#maximumfractiondigits\nexport function limitDecimalPlaces(num?: number): number | undefined {\n if (!num) return num;\n\n if (num < 0) {\n num = 0;\n } else if (num > 20) {\n num = 20;\n }\n\n return num;\n}\n"],"names":["shouldShortenValues","shortValues","hasDecimalPlaces","decimalPlaces","limitDecimalPlaces","num"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,SAASA,oBAAoBC,WAAqB;IACvD,OAAOA,gBAAgB;AACzB;AAEA,OAAO,SAASC,iBAAiBC,aAAsB;IACrD,OAAO,OAAOA,kBAAkB;AAClC;AAEA,mDAAmD;AACnD,8BAA8B;AAC9B,wIAAwI;AACxI,OAAO,SAASC,mBAAmBC,GAAY;IAC7C,IAAI,CAACA,KAAK,OAAOA;IAEjB,IAAIA,MAAM,GAAG;QACXA,MAAM;IACR,OAAO,IAAIA,MAAM,IAAI;QACnBA,MAAM;IACR;IAEA,OAAOA;AACT"}
@@ -8,6 +8,8 @@ import { createTheme, PaletteMode, Theme } from '@mui/material';
8
8
  *
9
9
  * Need to reinstantiate the theme everytime to support switching between light and dark themes
10
10
  * https://github.com/mui-org/material-ui/issues/18831
11
+ *
12
+ * Enable disableBodyOverride to prevent the theme from applying color scheme to the body element.
11
13
  */
12
- export declare function getTheme(mode: PaletteMode, options?: Parameters<typeof createTheme>[0]): Theme;
14
+ export declare function getTheme(mode: PaletteMode, options?: Parameters<typeof createTheme>[0], disableBodyOverride?: boolean): Theme;
13
15
  //# sourceMappingURL=theme.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/theme/theme.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAgB,KAAK,EAAE,MAAM,eAAe,CAAC;AAuB9E;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,GAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAM,GAAG,KAAK,CAQlG"}
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/theme/theme.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAgB,KAAK,EAAE,MAAM,eAAe,CAAC;AAuB9E;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,WAAW,EACjB,OAAO,GAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAM,EAC/C,mBAAmB,GAAE,OAAe,GACnC,KAAK,CAQP"}
@@ -33,44 +33,61 @@ const getModalBackgroundStyle = ({ theme })=>{
33
33
  *
34
34
  * Need to reinstantiate the theme everytime to support switching between light and dark themes
35
35
  * https://github.com/mui-org/material-ui/issues/18831
36
- */ export function getTheme(mode, options = {}) {
36
+ *
37
+ * Enable disableBodyOverride to prevent the theme from applying color scheme to the body element.
38
+ */ export function getTheme(mode, options = {}, disableBodyOverride = false) {
37
39
  return createTheme({
38
40
  palette: getPaletteOptions(mode),
39
41
  typography,
40
42
  mixins: {},
41
- components,
43
+ components: getComponents(mode, disableBodyOverride),
42
44
  ...options
43
45
  });
44
46
  }
45
47
  // Overrides for component default prop values and styles go here
46
- const components = {
47
- MuiAlert,
48
- MuiFormControl: {
49
- defaultProps: {
50
- size: 'small'
51
- }
52
- },
53
- MuiPaper,
54
- MuiTextField: {
55
- defaultProps: {
56
- size: 'small'
57
- }
58
- },
59
- MuiDrawer: {
60
- styleOverrides: {
61
- paper: getModalBackgroundStyle
62
- }
63
- },
64
- MuiDialog: {
65
- styleOverrides: {
66
- paper: getModalBackgroundStyle
67
- }
68
- },
69
- MuiPopover: {
70
- styleOverrides: {
71
- paper: getModalBackgroundStyle
48
+ function getComponents(mode, disableBodyOverride) {
49
+ const components = {
50
+ MuiAlert,
51
+ MuiFormControl: {
52
+ defaultProps: {
53
+ size: 'small'
54
+ }
55
+ },
56
+ MuiPaper,
57
+ MuiTextField: {
58
+ defaultProps: {
59
+ size: 'small'
60
+ }
61
+ },
62
+ MuiDrawer: {
63
+ styleOverrides: {
64
+ paper: getModalBackgroundStyle
65
+ }
66
+ },
67
+ MuiDialog: {
68
+ styleOverrides: {
69
+ paper: getModalBackgroundStyle
70
+ }
71
+ },
72
+ MuiPopover: {
73
+ styleOverrides: {
74
+ paper: getModalBackgroundStyle
75
+ }
72
76
  }
77
+ };
78
+ if (disableBodyOverride) {
79
+ return components;
73
80
  }
74
- };
81
+ return {
82
+ MuiCssBaseline: {
83
+ styleOverrides: {
84
+ body: {
85
+ colorScheme: mode
86
+ }
87
+ }
88
+ },
89
+ ...components
90
+ };
91
+ }
75
92
 
76
93
  //# sourceMappingURL=theme.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/theme/theme.ts"],"sourcesContent":["// Copyright 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 { createTheme, PaletteMode, ThemeOptions, Theme } from '@mui/material';\nimport { MuiAlert } from './component-overrides/alert';\nimport { MuiPaper } from './component-overrides/paper';\nimport { getPaletteOptions } from './palette';\nimport { typography } from './typography';\n\nconst getModalBackgroundStyle = ({\n theme,\n}: {\n theme: Omit<Theme, 'components'>;\n}): { backgroundImage?: string; backgroundColor?: string } => {\n const backgroundStyle =\n theme.palette.mode === 'light'\n ? {}\n : {\n backgroundImage: 'unset',\n backgroundColor: theme.palette.designSystem.grey[800],\n };\n return {\n ...backgroundStyle,\n };\n};\n\n/**\n * Gets theme used by all components for the provided mode. For more details, see:\n * - Base colors, typography, sizing - go/chrono-ui-theme\n * - Material UI defaults: https://material-ui.com/customization/default-theme/\n * - Material UI variables: https://material-ui.com/customization/theming/#theme-configuration-variables\n * - Material UI global overrides and default props: https://material-ui.com/customization/globals/#css\n *\n * Need to reinstantiate the theme everytime to support switching between light and dark themes\n * https://github.com/mui-org/material-ui/issues/18831\n */\nexport function getTheme(mode: PaletteMode, options: Parameters<typeof createTheme>[0] = {}): Theme {\n return createTheme({\n palette: getPaletteOptions(mode),\n typography,\n mixins: {},\n components,\n ...options,\n });\n}\n\n// Overrides for component default prop values and styles go here\nconst components: ThemeOptions['components'] = {\n MuiAlert,\n MuiFormControl: {\n defaultProps: {\n size: 'small',\n },\n },\n MuiPaper,\n MuiTextField: {\n defaultProps: {\n size: 'small',\n },\n },\n MuiDrawer: {\n styleOverrides: {\n paper: getModalBackgroundStyle,\n },\n },\n MuiDialog: {\n styleOverrides: {\n paper: getModalBackgroundStyle,\n },\n },\n MuiPopover: {\n styleOverrides: {\n paper: getModalBackgroundStyle,\n },\n },\n};\n"],"names":["createTheme","MuiAlert","MuiPaper","getPaletteOptions","typography","getModalBackgroundStyle","theme","backgroundStyle","palette","mode","backgroundImage","backgroundColor","designSystem","grey","getTheme","options","mixins","components","MuiFormControl","defaultProps","size","MuiTextField","MuiDrawer","styleOverrides","paper","MuiDialog","MuiPopover"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,WAAW,QAA0C,gBAAgB;AAC9E,SAASC,QAAQ,QAAQ,8BAA8B;AACvD,SAASC,QAAQ,QAAQ,8BAA8B;AACvD,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,UAAU,QAAQ,eAAe;AAE1C,MAAMC,0BAA0B,CAAC,EAC/BC,KAAK,EAGN;IACC,MAAMC,kBACJD,MAAME,OAAO,CAACC,IAAI,KAAK,UACnB,CAAC,IACD;QACEC,iBAAiB;QACjBC,iBAAiBL,MAAME,OAAO,CAACI,YAAY,CAACC,IAAI,CAAC,IAAI;IACvD;IACN,OAAO;QACL,GAAGN,eAAe;IACpB;AACF;AAEA;;;;;;;;;CASC,GACD,OAAO,SAASO,SAASL,IAAiB,EAAEM,UAA6C,CAAC,CAAC;IACzF,OAAOf,YAAY;QACjBQ,SAASL,kBAAkBM;QAC3BL;QACAY,QAAQ,CAAC;QACTC;QACA,GAAGF,OAAO;IACZ;AACF;AAEA,iEAAiE;AACjE,MAAME,aAAyC;IAC7ChB;IACAiB,gBAAgB;QACdC,cAAc;YACZC,MAAM;QACR;IACF;IACAlB;IACAmB,cAAc;QACZF,cAAc;YACZC,MAAM;QACR;IACF;IACAE,WAAW;QACTC,gBAAgB;YACdC,OAAOnB;QACT;IACF;IACAoB,WAAW;QACTF,gBAAgB;YACdC,OAAOnB;QACT;IACF;IACAqB,YAAY;QACVH,gBAAgB;YACdC,OAAOnB;QACT;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/theme/theme.ts"],"sourcesContent":["// Copyright 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 { createTheme, PaletteMode, ThemeOptions, Theme } from '@mui/material';\nimport { MuiAlert } from './component-overrides/alert';\nimport { MuiPaper } from './component-overrides/paper';\nimport { getPaletteOptions } from './palette';\nimport { typography } from './typography';\n\nconst getModalBackgroundStyle = ({\n theme,\n}: {\n theme: Omit<Theme, 'components'>;\n}): { backgroundImage?: string; backgroundColor?: string } => {\n const backgroundStyle =\n theme.palette.mode === 'light'\n ? {}\n : {\n backgroundImage: 'unset',\n backgroundColor: theme.palette.designSystem.grey[800],\n };\n return {\n ...backgroundStyle,\n };\n};\n\n/**\n * Gets theme used by all components for the provided mode. For more details, see:\n * - Base colors, typography, sizing - go/chrono-ui-theme\n * - Material UI defaults: https://material-ui.com/customization/default-theme/\n * - Material UI variables: https://material-ui.com/customization/theming/#theme-configuration-variables\n * - Material UI global overrides and default props: https://material-ui.com/customization/globals/#css\n *\n * Need to reinstantiate the theme everytime to support switching between light and dark themes\n * https://github.com/mui-org/material-ui/issues/18831\n *\n * Enable disableBodyOverride to prevent the theme from applying color scheme to the body element.\n */\nexport function getTheme(\n mode: PaletteMode,\n options: Parameters<typeof createTheme>[0] = {},\n disableBodyOverride: boolean = false\n): Theme {\n return createTheme({\n palette: getPaletteOptions(mode),\n typography,\n mixins: {},\n components: getComponents(mode, disableBodyOverride),\n ...options,\n });\n}\n\n// Overrides for component default prop values and styles go here\nfunction getComponents(mode: PaletteMode, disableBodyOverride: boolean): ThemeOptions['components'] {\n const components: ThemeOptions['components'] = {\n MuiAlert,\n MuiFormControl: {\n defaultProps: {\n size: 'small',\n },\n },\n MuiPaper,\n MuiTextField: {\n defaultProps: {\n size: 'small',\n },\n },\n MuiDrawer: {\n styleOverrides: {\n paper: getModalBackgroundStyle,\n },\n },\n MuiDialog: {\n styleOverrides: {\n paper: getModalBackgroundStyle,\n },\n },\n MuiPopover: {\n styleOverrides: {\n paper: getModalBackgroundStyle,\n },\n },\n };\n\n if (disableBodyOverride) {\n return components;\n }\n\n return {\n MuiCssBaseline: {\n styleOverrides: {\n body: {\n colorScheme: mode,\n },\n },\n },\n ...components,\n };\n}\n"],"names":["createTheme","MuiAlert","MuiPaper","getPaletteOptions","typography","getModalBackgroundStyle","theme","backgroundStyle","palette","mode","backgroundImage","backgroundColor","designSystem","grey","getTheme","options","disableBodyOverride","mixins","components","getComponents","MuiFormControl","defaultProps","size","MuiTextField","MuiDrawer","styleOverrides","paper","MuiDialog","MuiPopover","MuiCssBaseline","body","colorScheme"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,WAAW,QAA0C,gBAAgB;AAC9E,SAASC,QAAQ,QAAQ,8BAA8B;AACvD,SAASC,QAAQ,QAAQ,8BAA8B;AACvD,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,UAAU,QAAQ,eAAe;AAE1C,MAAMC,0BAA0B,CAAC,EAC/BC,KAAK,EAGN;IACC,MAAMC,kBACJD,MAAME,OAAO,CAACC,IAAI,KAAK,UACnB,CAAC,IACD;QACEC,iBAAiB;QACjBC,iBAAiBL,MAAME,OAAO,CAACI,YAAY,CAACC,IAAI,CAAC,IAAI;IACvD;IACN,OAAO;QACL,GAAGN,eAAe;IACpB;AACF;AAEA;;;;;;;;;;;CAWC,GACD,OAAO,SAASO,SACdL,IAAiB,EACjBM,UAA6C,CAAC,CAAC,EAC/CC,sBAA+B,KAAK;IAEpC,OAAOhB,YAAY;QACjBQ,SAASL,kBAAkBM;QAC3BL;QACAa,QAAQ,CAAC;QACTC,YAAYC,cAAcV,MAAMO;QAChC,GAAGD,OAAO;IACZ;AACF;AAEA,iEAAiE;AACjE,SAASI,cAAcV,IAAiB,EAAEO,mBAA4B;IACpE,MAAME,aAAyC;QAC7CjB;QACAmB,gBAAgB;YACdC,cAAc;gBACZC,MAAM;YACR;QACF;QACApB;QACAqB,cAAc;YACZF,cAAc;gBACZC,MAAM;YACR;QACF;QACAE,WAAW;YACTC,gBAAgB;gBACdC,OAAOrB;YACT;QACF;QACAsB,WAAW;YACTF,gBAAgB;gBACdC,OAAOrB;YACT;QACF;QACAuB,YAAY;YACVH,gBAAgB;gBACdC,OAAOrB;YACT;QACF;IACF;IAEA,IAAIW,qBAAqB;QACvB,OAAOE;IACT;IAEA,OAAO;QACLW,gBAAgB;YACdJ,gBAAgB;gBACdK,MAAM;oBACJC,aAAatB;gBACf;YACF;QACF;QACA,GAAGS,UAAU;IACf;AACF"}
@@ -1,7 +1,9 @@
1
- import '@fontsource/lato/300.css';
2
- import '@fontsource/lato/400.css';
3
- import '@fontsource/lato/700.css';
4
- import '@fontsource/lato/900.css';
1
+ import '@fontsource/inter/300.css';
2
+ import '@fontsource/inter/400.css';
3
+ import '@fontsource/inter/500.css';
4
+ import '@fontsource/inter/600.css';
5
+ import '@fontsource/inter/700.css';
6
+ import '@fontsource/inter/900.css';
5
7
  import { ThemeOptions } from '@mui/material';
6
8
  /**
7
9
  * Theme typography options that are the same across both the dark and light themes.
@@ -1 +1 @@
1
- {"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../src/theme/typography.ts"],"names":[],"mappings":"AAaA,OAAO,0BAA0B,CAAC;AAClC,OAAO,0BAA0B,CAAC;AAClC,OAAO,0BAA0B,CAAC;AAClC,OAAO,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAS7C;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,YAAY,CAAC,YAAY,CAqEjD,CAAC"}
1
+ {"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../src/theme/typography.ts"],"names":[],"mappings":"AAaA,OAAO,2BAA2B,CAAC;AACnC,OAAO,2BAA2B,CAAC;AACnC,OAAO,2BAA2B,CAAC;AACnC,OAAO,2BAA2B,CAAC;AACnC,OAAO,2BAA2B,CAAC;AACnC,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAQ7C;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,YAAY,CAAC,YAAY,CAsEjD,CAAC"}
@@ -10,20 +10,21 @@
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
- import '@fontsource/lato/300.css';
14
- import '@fontsource/lato/400.css';
15
- import '@fontsource/lato/700.css';
16
- import '@fontsource/lato/900.css';
13
+ import '@fontsource/inter/300.css';
14
+ import '@fontsource/inter/400.css';
15
+ import '@fontsource/inter/500.css';
16
+ import '@fontsource/inter/600.css';
17
+ import '@fontsource/inter/700.css';
18
+ import '@fontsource/inter/900.css';
17
19
  // Font weights need to correspond with the imports at the top of the file
18
- // (Lato supports 100, 300, 400, 700, 900)
19
20
  const fontWeightLight = 300;
20
21
  const fontWeightRegular = 400;
21
- const fontWeightMedium = 700;
22
+ const fontWeightMedium = 600;
22
23
  const fontWeightBold = 900;
23
24
  /**
24
25
  * Theme typography options that are the same across both the dark and light themes.
25
26
  */ export const typography = {
26
- fontFamily: '"Lato", sans-serif',
27
+ fontFamily: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
27
28
  fontWeightLight,
28
29
  fontWeightRegular,
29
30
  fontWeightMedium,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/theme/typography.ts"],"sourcesContent":["// Copyright 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 '@fontsource/lato/300.css';\nimport '@fontsource/lato/400.css';\nimport '@fontsource/lato/700.css';\nimport '@fontsource/lato/900.css';\nimport { ThemeOptions } from '@mui/material';\n\n// Font weights need to correspond with the imports at the top of the file\n// (Lato supports 100, 300, 400, 700, 900)\nconst fontWeightLight = 300;\nconst fontWeightRegular = 400;\nconst fontWeightMedium = 700;\nconst fontWeightBold = 900;\n\n/**\n * Theme typography options that are the same across both the dark and light themes.\n */\nexport const typography: ThemeOptions['typography'] = {\n fontFamily: '\"Lato\", sans-serif',\n\n fontWeightLight,\n fontWeightRegular,\n fontWeightMedium,\n fontWeightBold,\n\n h1: {\n fontSize: '1.5rem', // 24px\n fontWeight: fontWeightMedium,\n lineHeight: '32px',\n },\n h2: {\n fontSize: '1.25rem', // 20px\n fontWeight: fontWeightMedium,\n lineHeight: '28px',\n },\n h3: {\n fontSize: '1rem', // 16px\n fontWeight: fontWeightMedium,\n lineHeight: '24px',\n },\n h4: {\n fontSize: '0.875rem', // 14px\n fontWeight: fontWeightMedium,\n lineHeight: '22px',\n },\n h5: undefined,\n h6: undefined,\n\n body1: {\n fontSize: '0.875rem', // 14px\n fontWeight: fontWeightRegular,\n lineHeight: '20px',\n },\n body2: {\n fontSize: '0.75rem', // 12px\n fontWeight: fontWeightRegular,\n lineHeight: '18px',\n },\n subtitle1: {\n fontSize: '1rem', // 16px\n fontWeight: fontWeightRegular,\n lineHeight: '24px',\n letterSpacing: '0.02rem',\n },\n subtitle2: {\n fontSize: '0.875rem', // 14px\n fontWeight: fontWeightMedium,\n lineHeight: '22px',\n letterSpacing: '0.03rem',\n textTransform: 'uppercase',\n },\n\n button: {\n // 14px\n fontSize: '0.875rem',\n fontWeight: fontWeightMedium,\n // 20 px\n lineHeight: '1.25rem',\n textTransform: 'none',\n letterSpacing: '0.03rem',\n },\n caption: {\n fontSize: '0.6875rem', // 11px\n fontWeight: fontWeightRegular,\n lineHeight: '16px',\n },\n};\n"],"names":["fontWeightLight","fontWeightRegular","fontWeightMedium","fontWeightBold","typography","fontFamily","h1","fontSize","fontWeight","lineHeight","h2","h3","h4","h5","undefined","h6","body1","body2","subtitle1","letterSpacing","subtitle2","textTransform","button","caption"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,2BAA2B;AAClC,OAAO,2BAA2B;AAClC,OAAO,2BAA2B;AAClC,OAAO,2BAA2B;AAGlC,0EAA0E;AAC1E,0CAA0C;AAC1C,MAAMA,kBAAkB;AACxB,MAAMC,oBAAoB;AAC1B,MAAMC,mBAAmB;AACzB,MAAMC,iBAAiB;AAEvB;;CAEC,GACD,OAAO,MAAMC,aAAyC;IACpDC,YAAY;IAEZL;IACAC;IACAC;IACAC;IAEAG,IAAI;QACFC,UAAU;QACVC,YAAYN;QACZO,YAAY;IACd;IACAC,IAAI;QACFH,UAAU;QACVC,YAAYN;QACZO,YAAY;IACd;IACAE,IAAI;QACFJ,UAAU;QACVC,YAAYN;QACZO,YAAY;IACd;IACAG,IAAI;QACFL,UAAU;QACVC,YAAYN;QACZO,YAAY;IACd;IACAI,IAAIC;IACJC,IAAID;IAEJE,OAAO;QACLT,UAAU;QACVC,YAAYP;QACZQ,YAAY;IACd;IACAQ,OAAO;QACLV,UAAU;QACVC,YAAYP;QACZQ,YAAY;IACd;IACAS,WAAW;QACTX,UAAU;QACVC,YAAYP;QACZQ,YAAY;QACZU,eAAe;IACjB;IACAC,WAAW;QACTb,UAAU;QACVC,YAAYN;QACZO,YAAY;QACZU,eAAe;QACfE,eAAe;IACjB;IAEAC,QAAQ;QACN,OAAO;QACPf,UAAU;QACVC,YAAYN;QACZ,QAAQ;QACRO,YAAY;QACZY,eAAe;QACfF,eAAe;IACjB;IACAI,SAAS;QACPhB,UAAU;QACVC,YAAYP;QACZQ,YAAY;IACd;AACF,EAAE"}
1
+ {"version":3,"sources":["../../src/theme/typography.ts"],"sourcesContent":["// Copyright 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 '@fontsource/inter/300.css';\nimport '@fontsource/inter/400.css';\nimport '@fontsource/inter/500.css';\nimport '@fontsource/inter/600.css';\nimport '@fontsource/inter/700.css';\nimport '@fontsource/inter/900.css';\nimport { ThemeOptions } from '@mui/material';\n\n// Font weights need to correspond with the imports at the top of the file\nconst fontWeightLight = 300;\nconst fontWeightRegular = 400;\nconst fontWeightMedium = 600;\nconst fontWeightBold = 900;\n\n/**\n * Theme typography options that are the same across both the dark and light themes.\n */\nexport const typography: ThemeOptions['typography'] = {\n fontFamily:\n 'Inter, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"',\n\n fontWeightLight,\n fontWeightRegular,\n fontWeightMedium,\n fontWeightBold,\n\n h1: {\n fontSize: '1.5rem', // 24px\n fontWeight: fontWeightMedium,\n lineHeight: '32px',\n },\n h2: {\n fontSize: '1.25rem', // 20px\n fontWeight: fontWeightMedium,\n lineHeight: '28px',\n },\n h3: {\n fontSize: '1rem', // 16px\n fontWeight: fontWeightMedium,\n lineHeight: '24px',\n },\n h4: {\n fontSize: '0.875rem', // 14px\n fontWeight: fontWeightMedium,\n lineHeight: '22px',\n },\n h5: undefined,\n h6: undefined,\n\n body1: {\n fontSize: '0.875rem', // 14px\n fontWeight: fontWeightRegular,\n lineHeight: '20px',\n },\n body2: {\n fontSize: '0.75rem', // 12px\n fontWeight: fontWeightRegular,\n lineHeight: '18px',\n },\n subtitle1: {\n fontSize: '1rem', // 16px\n fontWeight: fontWeightRegular,\n lineHeight: '24px',\n letterSpacing: '0.02rem',\n },\n subtitle2: {\n fontSize: '0.875rem', // 14px\n fontWeight: fontWeightMedium,\n lineHeight: '22px',\n letterSpacing: '0.03rem',\n textTransform: 'uppercase',\n },\n\n button: {\n // 14px\n fontSize: '0.875rem',\n fontWeight: fontWeightMedium,\n // 20 px\n lineHeight: '1.25rem',\n textTransform: 'none',\n letterSpacing: '0.03rem',\n },\n caption: {\n fontSize: '0.6875rem', // 11px\n fontWeight: fontWeightRegular,\n lineHeight: '16px',\n },\n};\n"],"names":["fontWeightLight","fontWeightRegular","fontWeightMedium","fontWeightBold","typography","fontFamily","h1","fontSize","fontWeight","lineHeight","h2","h3","h4","h5","undefined","h6","body1","body2","subtitle1","letterSpacing","subtitle2","textTransform","button","caption"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,4BAA4B;AACnC,OAAO,4BAA4B;AACnC,OAAO,4BAA4B;AACnC,OAAO,4BAA4B;AACnC,OAAO,4BAA4B;AACnC,OAAO,4BAA4B;AAGnC,0EAA0E;AAC1E,MAAMA,kBAAkB;AACxB,MAAMC,oBAAoB;AAC1B,MAAMC,mBAAmB;AACzB,MAAMC,iBAAiB;AAEvB;;CAEC,GACD,OAAO,MAAMC,aAAyC;IACpDC,YACE;IAEFL;IACAC;IACAC;IACAC;IAEAG,IAAI;QACFC,UAAU;QACVC,YAAYN;QACZO,YAAY;IACd;IACAC,IAAI;QACFH,UAAU;QACVC,YAAYN;QACZO,YAAY;IACd;IACAE,IAAI;QACFJ,UAAU;QACVC,YAAYN;QACZO,YAAY;IACd;IACAG,IAAI;QACFL,UAAU;QACVC,YAAYN;QACZO,YAAY;IACd;IACAI,IAAIC;IACJC,IAAID;IAEJE,OAAO;QACLT,UAAU;QACVC,YAAYP;QACZQ,YAAY;IACd;IACAQ,OAAO;QACLV,UAAU;QACVC,YAAYP;QACZQ,YAAY;IACd;IACAS,WAAW;QACTX,UAAU;QACVC,YAAYP;QACZQ,YAAY;QACZU,eAAe;IACjB;IACAC,WAAW;QACTb,UAAU;QACVC,YAAYN;QACZO,YAAY;QACZU,eAAe;QACfE,eAAe;IACjB;IAEAC,QAAQ;QACN,OAAO;QACPf,UAAU;QACVC,YAAYN;QACZ,QAAQ;QACRO,YAAY;QACZY,eAAe;QACfF,eAAe;IACjB;IACAI,SAAS;QACPhB,UAAU;QACVC,YAAYP;QACZQ,YAAY;IACd;AACF,EAAE"}
@@ -1,5 +1,5 @@
1
1
  import type { XAXisComponentOption, YAXisComponentOption } from 'echarts';
2
- import { FormatOptions } from '@perses-dev/core';
2
+ import { FormatOptions } from '../model';
3
3
  export interface YAxisConfig {
4
4
  format?: FormatOptions;
5
5
  position?: 'left' | 'right';
@@ -1 +1 @@
1
- {"version":3,"file":"axis.d.ts","sourceRoot":"","sources":["../../src/utils/axis.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAe,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE9D,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AA0BD,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,oBAAoB,GAAG,oBAAoB,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,OAAO,EAAE,CAWpH;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,oBAAoB,GAAG,SAAS,EAC1C,UAAU,EAAE,aAAa,GAAG,SAAS,EACrC,iBAAiB,EAAE,aAAa,EAAE,EAClC,SAAS,CAAC,EAAE,MAAM,EAAE,GACnB,oBAAoB,EAAE,CAkDxB"}
1
+ {"version":3,"file":"axis.d.ts","sourceRoot":"","sources":["../../src/utils/axis.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAe,MAAM,UAAU,CAAC;AAEtD,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AA0BD,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,oBAAoB,GAAG,oBAAoB,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,OAAO,EAAE,CAWpH;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,oBAAoB,GAAG,SAAS,EAC1C,UAAU,EAAE,aAAa,GAAG,SAAS,EACrC,iBAAiB,EAAE,aAAa,EAAE,EAClC,SAAS,CAAC,EAAE,MAAM,EAAE,GACnB,oBAAoB,EAAE,CAkDxB"}
@@ -11,7 +11,7 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import merge from 'lodash/merge';
14
- import { formatValue } from '@perses-dev/core';
14
+ import { formatValue } from '../model';
15
15
  // Character width multipliers (approximate for typical UI fonts)
16
16
  const CHAR_WIDTH_BASE = 6;
17
17
  const AXIS_LABEL_PADDING = 10; // Extra padding to avoid label clipping
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/axis.ts"],"sourcesContent":["// Copyright 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 merge from 'lodash/merge';\nimport type { XAXisComponentOption, YAXisComponentOption } from 'echarts';\nimport { formatValue, FormatOptions } from '@perses-dev/core';\n\nexport interface YAxisConfig {\n format?: FormatOptions;\n position?: 'left' | 'right';\n show?: boolean;\n min?: number;\n max?: number;\n}\n\n// Character width multipliers (approximate for typical UI fonts)\nconst CHAR_WIDTH_BASE = 6;\nconst AXIS_LABEL_PADDING = 10; // Extra padding to avoid label clipping\n\n/**\n * Estimate the pixel width needed for an axis label using Canvas API.\n */\nfunction estimateLabelWidth(format: FormatOptions | undefined, maxValue: number): number {\n const formattedLabel = formatValue(maxValue, format);\n // Create a canvas element (reuse if possible for performance)\n const canvas = document.createElement('canvas');\n const context = canvas.getContext('2d');\n if (!context) {\n // Fallback to estimation if canvas not available\n return formattedLabel.length * CHAR_WIDTH_BASE;\n }\n context.font = '12px sans-serif';\n const metrics = context.measureText(formattedLabel);\n return metrics.width;\n}\n\n/*\n * Populate yAxis or xAxis properties, returns an Array since multiple axes are supported\n */\nexport function getFormattedAxis(axis?: YAXisComponentOption | XAXisComponentOption, unit?: FormatOptions): unknown[] {\n const AXIS_DEFAULT = {\n type: 'value',\n boundaryGap: [0, '10%'],\n axisLabel: {\n formatter: (value: number): string => {\n return formatValue(value, unit);\n },\n },\n };\n return [merge(AXIS_DEFAULT, axis)];\n}\n\n/**\n * Create multiple Y axes configurations for ECharts\n * The first axis (index 0) is always on the left side (default axis from panel settings)\n * Additional axes are placed on the right side\n *\n * @param baseAxis - Base axis configuration from panel settings\n * @param baseFormat - Format for the base/default Y axis\n * @param additionalFormats - Array of formats for additional right-side Y axes\n * @param maxValues - Optional array of max values for each additional format (used to compute dynamic label widths)\n */\nexport function getFormattedMultipleYAxes(\n baseAxis: YAXisComponentOption | undefined,\n baseFormat: FormatOptions | undefined,\n additionalFormats: FormatOptions[],\n maxValues?: number[]\n): YAXisComponentOption[] {\n const axes: YAXisComponentOption[] = [];\n\n // Base/default Y axis (left side)\n const baseAxisConfig: YAXisComponentOption = merge(\n {\n type: 'value',\n position: 'left',\n boundaryGap: [0, '10%'],\n axisLabel: {\n formatter: (value: number): string => {\n return formatValue(value, baseFormat);\n },\n // Let ECharts handle width automatically\n overflow: 'truncate',\n },\n },\n baseAxis\n );\n axes.push(baseAxisConfig);\n\n // Calculate cumulative offsets based on actual formatted label widths\n let cumulativeOffset = 0;\n\n // Additional Y axes (right side) for each unique format\n additionalFormats.forEach((format, index) => {\n const rightAxisConfig: YAXisComponentOption = {\n type: 'value',\n position: 'right',\n // Dynamic offset based on cumulative width of preceding axis labels\n offset: cumulativeOffset,\n boundaryGap: [0, '10%'],\n axisLabel: {\n formatter: (value: number): string => {\n return formatValue(value, format);\n },\n },\n splitLine: {\n show: false, // Hide grid lines for right-side axes to reduce visual noise\n },\n show: baseAxis?.show,\n };\n axes.push(rightAxisConfig);\n // For subsequent axes, add the width of the previous axis's labels\n if (maxValues) {\n cumulativeOffset += estimateLabelWidth(format, maxValues[index] ?? 1000) + AXIS_LABEL_PADDING;\n }\n });\n\n return axes;\n}\n"],"names":["merge","formatValue","CHAR_WIDTH_BASE","AXIS_LABEL_PADDING","estimateLabelWidth","format","maxValue","formattedLabel","canvas","document","createElement","context","getContext","length","font","metrics","measureText","width","getFormattedAxis","axis","unit","AXIS_DEFAULT","type","boundaryGap","axisLabel","formatter","value","getFormattedMultipleYAxes","baseAxis","baseFormat","additionalFormats","maxValues","axes","baseAxisConfig","position","overflow","push","cumulativeOffset","forEach","index","rightAxisConfig","offset","splitLine","show"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAOA,WAAW,eAAe;AAEjC,SAASC,WAAW,QAAuB,mBAAmB;AAU9D,iEAAiE;AACjE,MAAMC,kBAAkB;AACxB,MAAMC,qBAAqB,IAAI,wCAAwC;AAEvE;;CAEC,GACD,SAASC,mBAAmBC,MAAiC,EAAEC,QAAgB;IAC7E,MAAMC,iBAAiBN,YAAYK,UAAUD;IAC7C,8DAA8D;IAC9D,MAAMG,SAASC,SAASC,aAAa,CAAC;IACtC,MAAMC,UAAUH,OAAOI,UAAU,CAAC;IAClC,IAAI,CAACD,SAAS;QACZ,iDAAiD;QACjD,OAAOJ,eAAeM,MA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1
+ {"version":3,"sources":["../../src/utils/axis.ts"],"sourcesContent":["// Copyright 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 merge from 'lodash/merge';\nimport type { XAXisComponentOption, YAXisComponentOption } from 'echarts';\nimport { FormatOptions, formatValue } from '../model';\n\nexport interface YAxisConfig {\n format?: FormatOptions;\n position?: 'left' | 'right';\n show?: boolean;\n min?: number;\n max?: number;\n}\n\n// Character width multipliers (approximate for typical UI fonts)\nconst CHAR_WIDTH_BASE = 6;\nconst AXIS_LABEL_PADDING = 10; // Extra padding to avoid label clipping\n\n/**\n * Estimate the pixel width needed for an axis label using Canvas API.\n */\nfunction estimateLabelWidth(format: FormatOptions | undefined, maxValue: number): number {\n const formattedLabel = formatValue(maxValue, format);\n // Create a canvas element (reuse if possible for performance)\n const canvas = document.createElement('canvas');\n const context = canvas.getContext('2d');\n if (!context) {\n // Fallback to estimation if canvas not available\n return formattedLabel.length * CHAR_WIDTH_BASE;\n }\n context.font = '12px sans-serif';\n const metrics = context.measureText(formattedLabel);\n return metrics.width;\n}\n\n/*\n * Populate yAxis or xAxis properties, returns an Array since multiple axes are supported\n */\nexport function getFormattedAxis(axis?: YAXisComponentOption | XAXisComponentOption, unit?: FormatOptions): unknown[] {\n const AXIS_DEFAULT = {\n type: 'value',\n boundaryGap: [0, '10%'],\n axisLabel: {\n formatter: (value: number): string => {\n return formatValue(value, unit);\n },\n },\n };\n return [merge(AXIS_DEFAULT, axis)];\n}\n\n/**\n * Create multiple Y axes configurations for ECharts\n * The first axis (index 0) is always on the left side (default axis from panel settings)\n * Additional axes are placed on the right side\n *\n * @param baseAxis - Base axis configuration from panel settings\n * @param baseFormat - Format for the base/default Y axis\n * @param additionalFormats - Array of formats for additional right-side Y axes\n * @param maxValues - Optional array of max values for each additional format (used to compute dynamic label widths)\n */\nexport function getFormattedMultipleYAxes(\n baseAxis: YAXisComponentOption | undefined,\n baseFormat: FormatOptions | undefined,\n additionalFormats: FormatOptions[],\n maxValues?: number[]\n): YAXisComponentOption[] {\n const axes: YAXisComponentOption[] = [];\n\n // Base/default Y axis (left side)\n const baseAxisConfig: YAXisComponentOption = merge(\n {\n type: 'value',\n position: 'left',\n boundaryGap: [0, '10%'],\n axisLabel: {\n formatter: (value: number): string => {\n return formatValue(value, baseFormat);\n },\n // Let ECharts handle width automatically\n overflow: 'truncate',\n },\n },\n baseAxis\n );\n axes.push(baseAxisConfig);\n\n // Calculate cumulative offsets based on actual formatted label widths\n let cumulativeOffset = 0;\n\n // Additional Y axes (right side) for each unique format\n additionalFormats.forEach((format, index) => {\n const rightAxisConfig: YAXisComponentOption = {\n type: 'value',\n position: 'right',\n // Dynamic offset based on cumulative width of preceding axis labels\n offset: cumulativeOffset,\n boundaryGap: [0, '10%'],\n axisLabel: {\n formatter: (value: number): string => {\n return formatValue(value, format);\n },\n },\n splitLine: {\n show: false, // Hide grid lines for right-side axes to reduce visual noise\n },\n show: baseAxis?.show,\n };\n axes.push(rightAxisConfig);\n // For subsequent axes, add the width of the previous axis's labels\n if (maxValues) {\n cumulativeOffset += estimateLabelWidth(format, maxValues[index] ?? 1000) + AXIS_LABEL_PADDING;\n }\n });\n\n return axes;\n}\n"],"names":["merge","formatValue","CHAR_WIDTH_BASE","AXIS_LABEL_PADDING","estimateLabelWidth","format","maxValue","formattedLabel","canvas","document","createElement","context","getContext","length","font","metrics","measureText","width","getFormattedAxis","axis","unit","AXIS_DEFAULT","type","boundaryGap","axisLabel","formatter","value","getFormattedMultipleYAxes","baseAxis","baseFormat","additionalFormats","maxValues","axes","baseAxisConfig","position","overflow","push","cumulativeOffset","forEach","index","rightAxisConfig","offset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B;YACA,yCAAyC;YACzCM,UAAU;QACZ;IACF,GACAP;IAEFI,KAAKI,IAAI,CAACH;IAEV,sEAAsE;IACtE,IAAII,mBAAmB;IAEvB,wDAAwD;IACxDP,kBAAkBQ,OAAO,CAAC,CAACjC,QAAQkC;QACjC,MAAMC,kBAAwC;YAC5ClB,MAAM;YACNY,UAAU;YACV,oEAAoE;YACpEO,QAAQJ;YACRd,aAAa;gBAAC;gBAAG;aAAM;YACvBC,WAAW;gBACTC,WAAW,CAACC;oBACV,OAAOzB,YAAYyB,OAAOrB;gBAC5B;YACF;YACAqC,WAAW;gBACTC,MAAM;YACR;YACAA,MAAMf,UAAUe;QAClB;QACAX,KAAKI,IAAI,CAACI;QACV,mEAAmE;QACnE,IAAIT,WAAW;YACbM,oBAAoBjC,mBAAmBC,QAAQ0B,SAAS,CAACQ,MAAM,IAAI,QAAQpC;QAC7E;IACF;IAEA,OAAO6B;AACT"}
@@ -1,5 +1,5 @@
1
1
  import { ECharts as EChartsInstance } from 'echarts/core';
2
- import { TimeSeries, TimeSeriesValueTuple } from '@perses-dev/core';
2
+ import { TimeSeries, TimeSeriesValueTuple } from '@perses-dev/spec';
3
3
  import { DatapointInfo, TimeChartSeriesMapping } from '../model';
4
4
  export interface ZoomEventData {
5
5
  start: number;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/chart-actions.ts"],"sourcesContent":["// Copyright 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 { ECharts as EChartsInstance } from 'echarts/core';\nimport { TimeSeries, TimeSeriesValueTuple } from '@perses-dev/core';\nimport { DatapointInfo, PINNED_CROSSHAIR_SERIES_NAME, TimeChartSeriesMapping } from '../model';\n\nexport interface ZoomEventData {\n start: number;\n end: number;\n}\n\n/**\n * Enable dataZoom without requring user to click toolbox icon.\n * https://stackoverflow.com/questions/57183297/is-there-a-way-to-use-zoom-of-type-select-without-showing-the-toolbar\n */\nexport function enableDataZoom(chart: EChartsInstance): void {\n const chartModel = chart['_model'];\n if (chartModel === undefined) return;\n if (chartModel.option.toolbox !== undefined && chartModel.option.toolbox.length > 0) {\n // check if hidden data zoom icon is unselected (if selected it would be 'emphasis' instead of 'normal')\n if (chartModel.option.toolbox[0].feature.dataZoom.iconStatus.zoom === 'normal') {\n chart.dispatchAction({\n type: 'takeGlobalCursor',\n key: 'dataZoomSelect',\n dataZoomSelectActive: true,\n });\n }\n }\n}\n\n/**\n * Restore chart to original state before zoom or other actions were dispatched\n */\nexport function restoreChart(chart: EChartsInstance): void {\n // TODO: support incremental unzoom instead of restore to original state\n chart.dispatchAction({\n type: 'restore', // https://echarts.apache.org/en/api.html#events.restore\n });\n}\n\n/*\n * Clear all highlighted series when cursor exits canvas\n * https://echarts.apache.org/en/api.html#action.downplay\n */\nexport function clearHighlightedSeries(chart: EChartsInstance): void {\n if (chart.dispatchAction !== undefined) {\n // Clear any selected data points\n chart.dispatchAction({\n type: 'unselect',\n });\n\n // Clear any highlighted series\n chart.dispatchAction({\n type: 'downplay',\n });\n }\n}\n\n/*\n * Convert a point from pixel coordinate to logical coordinate.\n * Used to determine if cursor is over chart canvas and closest datapoint.\n * https://echarts.apache.org/en/api.html#echartsInstance.convertFromPixel\n */\nexport function getPointInGrid(cursorCoordX: number, cursorCoordY: number, chart?: EChartsInstance): number[] | null {\n if (chart === undefined) {\n return null;\n }\n\n const pointInPixel = [cursorCoordX, cursorCoordY];\n if (!chart.containPixel('grid', pointInPixel)) {\n return null;\n }\n\n const pointInGrid: number[] = chart.convertFromPixel('grid', pointInPixel);\n return pointInGrid;\n}\n\n/*\n * TimeSeriesChart tooltip is built custom to support finding nearby series instead of single or all series.\n * This means ECharts actions need to be dispatched manually for series highlighting, datapoint select state, etc.\n * More info: https://echarts.apache.org/en/api.html#action\n */\nexport function batchDispatchNearbySeriesActions(\n chart: EChartsInstance,\n nearbySeriesIndexes: number[],\n emphasizedSeriesIndexes: number[],\n nonEmphasizedSeriesIndexes: number[],\n emphasizedDatapoints: DatapointInfo[],\n duplicateDatapoints: DatapointInfo[]\n): void {\n // Accounts for multiple series that are rendered direct on top of eachother.\n // Only applies select state to the datapoint that is visible to avoid color mismatch.\n const lastEmphasizedDatapoint =\n duplicateDatapoints.length > 0\n ? duplicateDatapoints[duplicateDatapoints.length - 1]\n : emphasizedDatapoints[emphasizedDatapoints.length - 1];\n if (lastEmphasizedDatapoint !== undefined) {\n // Corresponds to select options inside getTimeSeries util.\n // https://echarts.apache.org/en/option.html#series-line.select.itemStyle\n chart.dispatchAction({\n type: 'select',\n seriesIndex: lastEmphasizedDatapoint.seriesIndex,\n dataIndex: lastEmphasizedDatapoint.dataIndex,\n // Shared crosshair should not emphasize datapoints on adjacent charts.\n escapeConnect: true, // TODO: try to remove escapeConnect and match by seriesName for cross panel correlation\n });\n }\n\n // Clears emphasis state of all lines that are not emphasized.\n // Emphasized is a subset of just the nearby series that are closest to cursor.\n chart.dispatchAction({\n type: 'downplay',\n seriesIndex: nonEmphasizedSeriesIndexes,\n });\n\n // https://echarts.apache.org/en/api.html#action.highlight\n if (emphasizedSeriesIndexes.length > 0) {\n // Fadeout opacity of all series not closest to cursor.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: emphasizedSeriesIndexes,\n notBlur: false, // ensure blur IS triggered, this is default but setting so it is explicit\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n } else {\n // When no emphasized series with bold text, notBlur allows opacity fadeout to not trigger.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: nearbySeriesIndexes,\n notBlur: true, // do not trigger blur state when cursor is not immediately close to any series\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n\n // Clears selected datapoints since no bold series in tooltip, restore does not impact highlighting\n chart.dispatchAction({\n type: 'toggleSelect', // https://echarts.apache.org/en/api.html#action.toggleSelect\n });\n }\n}\n\n/*\n * Determine whether a markLine was pushed into the final series, which means crosshair was already pinned onClick\n */\nexport function checkCrosshairPinnedStatus(seriesMapping: TimeChartSeriesMapping): boolean {\n const isCrosshairPinned = seriesMapping[seriesMapping.length - 1]?.name === PINNED_CROSSHAIR_SERIES_NAME;\n return isCrosshairPinned;\n}\n\n/*\n * Find closest timestamp to logical x coordinate returned from echartsInstance.convertFromPixel\n * Used to find nearby series in time series tooltip.\n */\nexport function getClosestTimestamp(timeSeriesValues?: TimeSeriesValueTuple[], cursorX?: number): number | null {\n if (timeSeriesValues === undefined || cursorX === undefined) {\n return null;\n }\n\n let currentClosestTimestamp: number | null = null;\n let currentClosestDistance = Infinity;\n\n for (const [timestamp] of timeSeriesValues) {\n const distance = Math.abs(timestamp - cursorX);\n if (distance < currentClosestDistance) {\n currentClosestTimestamp = timestamp;\n currentClosestDistance = distance;\n }\n }\n return currentClosestTimestamp;\n}\n\n/*\n * Find closest timestamp in full dataset, used to snap crosshair into place onClick when tooltip is pinned.\n */\nexport function getClosestTimestampInFullDataset(data: TimeSeries[], cursorX?: number): number | null {\n if (cursorX === undefined) {\n return null;\n }\n const totalSeries = data.length;\n let closestTimestamp = null;\n for (let seriesIdx = 0; seriesIdx < totalSeries; seriesIdx++) {\n const currentDataset = totalSeries > 0 ? data[seriesIdx] : null;\n if (!currentDataset) break;\n const currentValues: TimeSeriesValueTuple[] = currentDataset.values;\n closestTimestamp = getClosestTimestamp(currentValues, cursorX);\n }\n return closestTimestamp;\n}\n"],"names":["PINNED_CROSSHAIR_SERIES_NAME","enableDataZoom","chart","chartModel","undefined","option","toolbox","length","feature","dataZoom","iconStatus","zoom","dispatchAction","type","key","dataZoomSelectActive","restoreChart","clearHighlightedSeries","getPointInGrid","cursorCoordX","cursorCoordY","pointInPixel","containPixel","pointInGrid","convertFromPixel","batchDispatchNearbySeriesActions","nearbySeriesIndexes","emphasizedSeriesIndexes","nonEmphasizedSeriesIndexes","emphasizedDatapoints","duplicateDatapoints","lastEmphasizedDatapoint","seriesIndex","dataIndex","escapeConnect","notBlur","checkCrosshairPinnedStatus","seriesMapping","isCrosshairPinned","name","getClosestTimestamp","timeSeriesValues","cursorX","currentClosestTimestamp","currentClosestDistance","Infinity","timestamp","distance","Math","abs","getClosestTimestampInFullDataset","data","totalSeries","closestTimestamp","seriesIdx","currentDataset","currentValues","values"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,SAAwBA,4BAA4B,QAAgC,WAAW;AAO/F;;;CAGC,GACD,OAAO,SAASC,eAAeC,KAAsB;IACnD,MAAMC,aAAaD,KAAK,CAAC,SAAS;IAClC,IAAIC,eAAeC,WAAW;IAC9B,IAAID,WAAWE,MAAM,CAACC,OAAO,KAAKF,aAAaD,WAAWE,MAAM,CAACC,OAAO,CAACC,MAAM,GAAG,GAAG;QACnF,wGAAwG;QACxG,IAAIJ,WAAWE,MAAM,CAACC,OAAO,CAAC,EAAE,CAACE,OAAO,CAACC,QAAQ,CAACC,UAAU,CAACC,IAAI,KAAK,UAAU;YAC9ET,MAAMU,cAAc,CAAC;gBACnBC,MAAM;gBACNC,KAAK;gBACLC,sBAAsB;YACxB;QACF;IACF;AACF;AAEA;;CAEC,GACD,OAAO,SAASC,aAAad,KAAsB;IACjD,wEAAwE;IACxEA,MAAMU,cAAc,CAAC;QACnBC,MAAM;IACR;AACF;AAEA;;;CAGC,GACD,OAAO,SAASI,uBAAuBf,KAAsB;IAC3D,IAAIA,MAAMU,cAAc,KAAKR,WAAW;QACtC,iCAAiC;QACjCF,MAAMU,cAAc,CAAC;YACnBC,MAAM;Q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AAe;QACjB;QAEA,mGAAmG;QACnGhC,MAAMU,cAAc,CAAC;YACnBC,MAAM;QACR;IACF;AACF;AAEA;;CAEC,GACD,OAAO,SAASuB,2BAA2BC,aAAqC;IAC9E,MAAMC,oBAAoBD,aAAa,CAACA,cAAc9B,MAAM,GAAG,EAAE,EAAEgC,SAASvC;IAC5E,OAAOsC;AACT;AAEA;;;CAGC,GACD,OAAO,SAASE,oBAAoBC,gBAAyC,EAAEC,OAAgB;IAC7F,IAAID,qBAAqBrC,aAAasC,YAAYtC,WAAW;QAC3D,OAAO;IACT;IAEA,IAAIuC,0BAAyC;IAC7C,IAAIC,yBAAyBC;IAE7B,KAAK,MAAM,CAACC,UAAU,IAAIL,iBAAkB;QAC1C,MAAMM,WAAWC,KAAKC,GAAG,CAACH,YAAYJ;QACtC,IAAIK,WAAWH,wBAAwB;YACrCD,0BAA0BG;YAC1BF,yBAAyBG;QAC3B;IACF;IACA,OAAOJ;AACT;AAEA;;CAEC,GACD,OAAO,SAASO,iCAAiCC,IAAkB,EAAET,OAAgB;IACnF,IAAIA,YAAYtC,WAAW;QACzB,OAAO;IACT;IACA,MAAMgD,cAAcD,KAAK5C,MAAM;IAC/B,IAAI8C,mBAAmB;IACvB,IAAK,IAAIC,YAAY,GAAGA,YAAYF,aAAaE,YAAa;QAC5D,MAAMC,iBAAiBH,cAAc,IAAID,IAAI,CAACG,UAAU,GAAG;QAC3D,IAAI,CAACC,gBAAgB;QACrB,MAAMC,gBAAwCD,eAAeE,MAAM;QACnEJ,mBAAmBb,oBAAoBgB,eAAed;IACxD;IACA,OAAOW;AACT"}
1
+ {"version":3,"sources":["../../src/utils/chart-actions.ts"],"sourcesContent":["// Copyright 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 { ECharts as EChartsInstance } from 'echarts/core';\nimport { TimeSeries, TimeSeriesValueTuple } from '@perses-dev/spec';\nimport { DatapointInfo, PINNED_CROSSHAIR_SERIES_NAME, TimeChartSeriesMapping } from '../model';\n\nexport interface ZoomEventData {\n start: number;\n end: number;\n}\n\n/**\n * Enable dataZoom without requring user to click toolbox icon.\n * https://stackoverflow.com/questions/57183297/is-there-a-way-to-use-zoom-of-type-select-without-showing-the-toolbar\n */\nexport function enableDataZoom(chart: EChartsInstance): void {\n const chartModel = chart['_model'];\n if (chartModel === undefined) return;\n if (chartModel.option.toolbox !== undefined && chartModel.option.toolbox.length > 0) {\n // check if hidden data zoom icon is unselected (if selected it would be 'emphasis' instead of 'normal')\n if (chartModel.option.toolbox[0].feature.dataZoom.iconStatus.zoom === 'normal') {\n chart.dispatchAction({\n type: 'takeGlobalCursor',\n key: 'dataZoomSelect',\n dataZoomSelectActive: true,\n });\n }\n }\n}\n\n/**\n * Restore chart to original state before zoom or other actions were dispatched\n */\nexport function restoreChart(chart: EChartsInstance): void {\n // TODO: support incremental unzoom instead of restore to original state\n chart.dispatchAction({\n type: 'restore', // https://echarts.apache.org/en/api.html#events.restore\n });\n}\n\n/*\n * Clear all highlighted series when cursor exits canvas\n * https://echarts.apache.org/en/api.html#action.downplay\n */\nexport function clearHighlightedSeries(chart: EChartsInstance): void {\n if (chart.dispatchAction !== undefined) {\n // Clear any selected data points\n chart.dispatchAction({\n type: 'unselect',\n });\n\n // Clear any highlighted series\n chart.dispatchAction({\n type: 'downplay',\n });\n }\n}\n\n/*\n * Convert a point from pixel coordinate to logical coordinate.\n * Used to determine if cursor is over chart canvas and closest datapoint.\n * https://echarts.apache.org/en/api.html#echartsInstance.convertFromPixel\n */\nexport function getPointInGrid(cursorCoordX: number, cursorCoordY: number, chart?: EChartsInstance): number[] | null {\n if (chart === undefined) {\n return null;\n }\n\n const pointInPixel = [cursorCoordX, cursorCoordY];\n if (!chart.containPixel('grid', pointInPixel)) {\n return null;\n }\n\n const pointInGrid: number[] = chart.convertFromPixel('grid', pointInPixel);\n return pointInGrid;\n}\n\n/*\n * TimeSeriesChart tooltip is built custom to support finding nearby series instead of single or all series.\n * This means ECharts actions need to be dispatched manually for series highlighting, datapoint select state, etc.\n * More info: https://echarts.apache.org/en/api.html#action\n */\nexport function batchDispatchNearbySeriesActions(\n chart: EChartsInstance,\n nearbySeriesIndexes: number[],\n emphasizedSeriesIndexes: number[],\n nonEmphasizedSeriesIndexes: number[],\n emphasizedDatapoints: DatapointInfo[],\n duplicateDatapoints: DatapointInfo[]\n): void {\n // Accounts for multiple series that are rendered direct on top of eachother.\n // Only applies select state to the datapoint that is visible to avoid color mismatch.\n const lastEmphasizedDatapoint =\n duplicateDatapoints.length > 0\n ? duplicateDatapoints[duplicateDatapoints.length - 1]\n : emphasizedDatapoints[emphasizedDatapoints.length - 1];\n if (lastEmphasizedDatapoint !== undefined) {\n // Corresponds to select options inside getTimeSeries util.\n // https://echarts.apache.org/en/option.html#series-line.select.itemStyle\n chart.dispatchAction({\n type: 'select',\n seriesIndex: lastEmphasizedDatapoint.seriesIndex,\n dataIndex: lastEmphasizedDatapoint.dataIndex,\n // Shared crosshair should not emphasize datapoints on adjacent charts.\n escapeConnect: true, // TODO: try to remove escapeConnect and match by seriesName for cross panel correlation\n });\n }\n\n // Clears emphasis state of all lines that are not emphasized.\n // Emphasized is a subset of just the nearby series that are closest to cursor.\n chart.dispatchAction({\n type: 'downplay',\n seriesIndex: nonEmphasizedSeriesIndexes,\n });\n\n // https://echarts.apache.org/en/api.html#action.highlight\n if (emphasizedSeriesIndexes.length > 0) {\n // Fadeout opacity of all series not closest to cursor.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: emphasizedSeriesIndexes,\n notBlur: false, // ensure blur IS triggered, this is default but setting so it is explicit\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n } else {\n // When no emphasized series with bold text, notBlur allows opacity fadeout to not trigger.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: nearbySeriesIndexes,\n notBlur: true, // do not trigger blur state when cursor is not immediately close to any series\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n\n // Clears selected datapoints since no bold series in tooltip, restore does not impact highlighting\n chart.dispatchAction({\n type: 'toggleSelect', // https://echarts.apache.org/en/api.html#action.toggleSelect\n });\n }\n}\n\n/*\n * Determine whether a markLine was pushed into the final series, which means crosshair was already pinned onClick\n */\nexport function checkCrosshairPinnedStatus(seriesMapping: TimeChartSeriesMapping): boolean {\n const isCrosshairPinned = seriesMapping[seriesMapping.length - 1]?.name === PINNED_CROSSHAIR_SERIES_NAME;\n return isCrosshairPinned;\n}\n\n/*\n * Find closest timestamp to logical x coordinate returned from echartsInstance.convertFromPixel\n * Used to find nearby series in time series tooltip.\n */\nexport function getClosestTimestamp(timeSeriesValues?: TimeSeriesValueTuple[], cursorX?: number): number | null {\n if (timeSeriesValues === undefined || cursorX === undefined) {\n return null;\n }\n\n let currentClosestTimestamp: number | null = null;\n let currentClosestDistance = Infinity;\n\n for (const [timestamp] of timeSeriesValues) {\n const distance = Math.abs(timestamp - cursorX);\n if (distance < currentClosestDistance) {\n currentClosestTimestamp = timestamp;\n currentClosestDistance = distance;\n }\n }\n return currentClosestTimestamp;\n}\n\n/*\n * Find closest timestamp in full dataset, used to snap crosshair into place onClick when tooltip is pinned.\n */\nexport function getClosestTimestampInFullDataset(data: TimeSeries[], cursorX?: number): number | null {\n if (cursorX === undefined) {\n return null;\n }\n const totalSeries = data.length;\n let closestTimestamp = null;\n for (let seriesIdx = 0; seriesIdx < totalSeries; seriesIdx++) {\n const currentDataset = totalSeries > 0 ? data[seriesIdx] : null;\n if (!currentDataset) break;\n const currentValues: TimeSeriesValueTuple[] = currentDataset.values;\n closestTimestamp = getClosestTimestamp(currentValues, cursorX);\n }\n return closestTimestamp;\n}\n"],"names":["PINNED_CROSSHAIR_SERIES_NAME","enableDataZoom","chart","chartModel","undefined","option","toolbox","length","feature","dataZoom","iconStatus","zoom","dispatchAction","type","key","dataZoomSelectActive","restoreChart","clearHighlightedSeries","getPointInGrid","cursorCoordX","cursorCoordY","pointInPixel","containPixel","pointInGrid","convertFromPixel","batchDispatchNearbySeriesActions","nearbySeriesIndexes","emphasizedSeriesIndexes","nonEmphasizedSeriesIndexes","emphasizedDatapoints","duplicateDatapoints","lastEmphasizedDatapoint","seriesIndex","dataIndex","escapeConnect","notBlur","checkCrosshairPinnedStatus","seriesMapping","isCrosshairPinned","name","getClosestTimestamp","timeSeriesValues","cursorX","currentClosestTimestamp","currentClosestDistance","Infinity","timestamp","distance","Math","abs","getClosestTimestampInFullDataset","data","totalSeries","closestTimestamp","seriesIdx","currentDataset","currentValues","values"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,SAAwBA,4BAA4B,QAAgC,WAAW;AAO/F;;;CAGC,GACD,OAAO,SAASC,eAAeC,KAAsB;IACnD,MAAMC,aAAaD,KAAK,CAAC,SAAS;IAClC,IAAIC,eAAeC,WAAW;IAC9B,IAAID,WAAWE,MAAM,CAACC,OAAO,KAAKF,aAAaD,WAAWE,MAAM,CAACC,OAAO,CAACC,MAAM,GAAG,GAAG;QACnF,wGAAwG;QACxG,IAAIJ,WAAWE,MAAM,CAACC,OAAO,CAAC,EAAE,CAACE,OAAO,CAACC,QAAQ,CAACC,UAAU,CAACC,IAAI,KAAK,UAAU;YAC9ET,MAAMU,cAAc,CAAC;gBACnBC,MAAM;gBACNC,KAAK;gBACLC,sBAAsB;YACxB;QACF;IACF;AACF;AAEA;;CAEC,GACD,OAAO,SAASC,aAAad,KAAsB;IACjD,wEAAwE;IACxEA,M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7
7
  export * from './format';
8
8
  export * from './memo';
9
+ export * from './request-interpolation';
9
10
  export * from './selection-interpolation';
10
11
  export * from './theme-gen';
11
12
  export * from './variable-interpolation';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAaA,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAaA,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC"}
@@ -18,6 +18,7 @@ export * from './component-ids';
18
18
  export * from './data-field-interpolation';
19
19
  export * from './format';
20
20
  export * from './memo';
21
+ export * from './request-interpolation';
21
22
  export * from './selection-interpolation';
22
23
  export * from './theme-gen';
23
24
  export * from './variable-interpolation';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["// Copyright 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 './axis';\nexport * from './browser-storage';\nexport * from './chart-actions';\nexport * from './combine-sx';\nexport * from './component-ids';\nexport * from './data-field-interpolation';\nexport * from './format';\nexport * from './memo';\nexport * from './selection-interpolation';\nexport * from './theme-gen';\nexport * from './variable-interpolation';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,SAAS;AACvB,cAAc,oBAAoB;AAClC,cAAc,kBAAkB;AAChC,cAAc,eAAe;AAC7B,cAAc,kBAAkB;AAChC,cAAc,6BAA6B;AAC3C,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,4BAA4B;AAC1C,cAAc,cAAc;AAC5B,cAAc,2BAA2B"}
1
+ {"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["// Copyright 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 './axis';\nexport * from './browser-storage';\nexport * from './chart-actions';\nexport * from './combine-sx';\nexport * from './component-ids';\nexport * from './data-field-interpolation';\nexport * from './format';\nexport * from './memo';\nexport * from './request-interpolation';\nexport * from './selection-interpolation';\nexport * from './theme-gen';\nexport * from './variable-interpolation';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,SAAS;AACvB,cAAc,oBAAoB;AAClC,cAAc,kBAAkB;AAChC,cAAc,eAAe;AAC7B,cAAc,kBAAkB;AAChC,cAAc,6BAA6B;AAC3C,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,0BAA0B;AACxC,cAAc,4BAA4B;AAC1C,cAAc,cAAc;AAC5B,cAAc,2BAA2B"}
@@ -0,0 +1,6 @@
1
+ import { RequestHeaders } from '@perses-dev/core';
2
+ import { VariableStateMap } from './variable-interpolation';
3
+ export type QueryParamValues = Record<string, string | string[]>;
4
+ export declare function interpolateHeaders(headers: Record<string, string>, variableState: VariableStateMap): RequestHeaders;
5
+ export declare function interpolateQueryParams(queryParams: QueryParamValues, variableState: VariableStateMap): QueryParamValues;
6
+ //# sourceMappingURL=request-interpolation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-interpolation.d.ts","sourceRoot":"","sources":["../../src/utils/request-interpolation.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAoB,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE9E,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;AAEjE,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,EAAE,gBAAgB,GAAG,cAAc,CAMnH;AAED,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,gBAAgB,EAC7B,aAAa,EAAE,gBAAgB,GAC9B,gBAAgB,CAUlB"}
@@ -0,0 +1,33 @@
1
+ // Copyright 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
+ import { replaceVariables } from './variable-interpolation';
14
+ export function interpolateHeaders(headers, variableState) {
15
+ const result = {};
16
+ for (const [key, value] of Object.entries(headers)){
17
+ result[key] = replaceVariables(value, variableState);
18
+ }
19
+ return result;
20
+ }
21
+ export function interpolateQueryParams(queryParams, variableState) {
22
+ const result = {};
23
+ for (const [key, value] of Object.entries(queryParams)){
24
+ if (Array.isArray(value)) {
25
+ result[key] = value.map((v)=>replaceVariables(v, variableState));
26
+ } else {
27
+ result[key] = replaceVariables(value, variableState);
28
+ }
29
+ }
30
+ return result;
31
+ }
32
+
33
+ //# sourceMappingURL=request-interpolation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/request-interpolation.ts"],"sourcesContent":["// Copyright 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 { RequestHeaders } from '@perses-dev/core';\nimport { replaceVariables, VariableStateMap } from './variable-interpolation';\n\nexport type QueryParamValues = Record<string, string | string[]>;\n\nexport function interpolateHeaders(headers: Record<string, string>, variableState: VariableStateMap): RequestHeaders {\n const result: RequestHeaders = {};\n for (const [key, value] of Object.entries(headers)) {\n result[key] = replaceVariables(value, variableState);\n }\n return result;\n}\n\nexport function interpolateQueryParams(\n queryParams: QueryParamValues,\n variableState: VariableStateMap\n): QueryParamValues {\n const result: QueryParamValues = {};\n for (const [key, value] of Object.entries(queryParams)) {\n if (Array.isArray(value)) {\n result[key] = value.map((v) => replaceVariables(v, variableState));\n } else {\n result[key] = replaceVariables(value, variableState);\n }\n }\n return result;\n}\n"],"names":["replaceVariables","interpolateHeaders","headers","variableState","result","key","value","Object","entries","interpolateQueryParams","queryParams","Array","isArray","map","v"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,gBAAgB,QAA0B,2BAA2B;AAI9E,OAAO,SAASC,mBAAmBC,OAA+B,EAAEC,aAA+B;IACjG,MAAMC,SAAyB,CAAC;IAChC,KAAK,MAAM,CAACC,KAAKC,MAAM,IAAIC,OAAOC,OAAO,CAACN,SAAU;QAClDE,MAAM,CAACC,IAAI,GAAGL,iBAAiBM,OAAOH;IACxC;IACA,OAAOC;AACT;AAEA,OAAO,SAASK,uBACdC,WAA6B,EAC7BP,aAA+B;IAE/B,MAAMC,SAA2B,CAAC;IAClC,KAAK,MAAM,CAACC,KAAKC,MAAM,IAAIC,OAAOC,OAAO,CAACE,aAAc;QACtD,IAAIC,MAAMC,OAAO,CAACN,QAAQ;YACxBF,MAAM,CAACC,IAAI,GAAGC,MAAMO,GAAG,CAAC,CAACC,IAAMd,iBAAiBc,GAAGX;QACrD,OAAO;YACLC,MAAM,CAACC,IAAI,GAAGL,iBAAiBM,OAAOH;QACxC;IACF;IACA,OAAOC;AACT"}
@@ -1,4 +1,4 @@
1
- import { VariableValue } from '@perses-dev/core';
1
+ import { VariableValue } from '@perses-dev/spec';
2
2
  /**
3
3
  * Option for a variable with label and value
4
4
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/variable-interpolation.ts"],"sourcesContent":["// Copyright 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 { VariableValue } from '@perses-dev/core';\n\n/**\n * Option for a variable with label and value\n */\nexport type VariableOption = { label: string; value: string };\n\n/**\n * State of a variable including its current value, options, and loading state\n */\nexport type VariableState = {\n value: VariableValue;\n options?: VariableOption[];\n loading: boolean;\n error?: Error;\n /**\n * If a local variable is overriding an external variable, local var will have the flag ``overriding=true``.\n */\n overriding?: boolean;\n /**\n * If a local variable is overriding an external variable, external var will have the flag ``overridden=true``.\n */\n overridden?: boolean;\n defaultValue?: VariableValue;\n};\n\n/**\n * Map of variable names to their states\n */\nexport type VariableStateMap = Record<string, VariableState>;\n\n/**\n * Supported interpolation formats for variable values\n */\nexport enum InterpolationFormat {\n CSV = 'csv',\n DISTRIBUTED = 'distributed',\n DOUBLEQUOTE = 'doublequote',\n GLOB = 'glob',\n JSON = 'json',\n LUCENE = 'lucene',\n PERCENTENCODE = 'percentencode',\n PIPE = 'pipe',\n PROMETHEUS = 'prometheus',\n RAW = 'raw',\n REGEX = 'regex',\n SINGLEQUOTE = 'singlequote',\n SQLSTRING = 'sqlstring',\n TEXT = 'text',\n QUERYPARAM = 'queryparam',\n}\n\nfunction stringToFormat(val: string | undefined): InterpolationFormat | undefined {\n if (!val) return undefined;\n\n const lowerVal = val.toLowerCase();\n return Object.values(InterpolationFormat).find((format) => format === lowerVal) || undefined;\n}\n\n/**\n * Interpolate an array of values with a specific format\n */\nexport function interpolate(values: string[], name: string, format: InterpolationFormat): string {\n switch (format) {\n case InterpolationFormat.CSV:\n case InterpolationFormat.RAW:\n return values.join(',');\n case InterpolationFormat.DISTRIBUTED: {\n const [first, ...rest] = values;\n return `${[first, ...rest.map((v) => `${name}=${v}`)].join(',')}`;\n }\n case InterpolationFormat.DOUBLEQUOTE:\n return values.map((v) => `\"${v}\"`).join(',');\n case InterpolationFormat.GLOB:\n return `{${values.join(',')}}`;\n case InterpolationFormat.JSON: {\n // values might contain stringified JSON objects so we need to parse them first\n // and then return a JSON stringified array to return valid JSON\n const parsedValues = values.map((v) => {\n try {\n return JSON.parse(v);\n } catch {\n return v;\n }\n });\n\n return JSON.stringify(parsedValues);\n }\n case InterpolationFormat.LUCENE:\n return `(${values.map((v) => `\"${v}\"`).join(' OR ')})`;\n case InterpolationFormat.PERCENTENCODE:\n return encodeURIComponent(values.join(','));\n case InterpolationFormat.PIPE:\n return values.join('|');\n case InterpolationFormat.REGEX: {\n const escapedRegex = values.map((v) => v.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&'));\n return `(${escapedRegex.join('|')})`;\n }\n case InterpolationFormat.SINGLEQUOTE:\n return values.map((v) => `'${v}'`).join(',');\n case InterpolationFormat.SQLSTRING:\n return values.map((v) => `'${v.replace(/'/g, \"''\")}'`).join(',');\n case InterpolationFormat.TEXT:\n return values.join(' + ');\n case InterpolationFormat.QUERYPARAM:\n return values.map((v) => `${name}=${encodeURIComponent(v)}`).join('&');\n case InterpolationFormat.PROMETHEUS:\n default:\n return `(${values.join('|')})`;\n }\n}\n\n/**\n * Replace a single variable in text with its value\n */\nexport function replaceVariable(\n text: string,\n varName: string,\n variableValue: VariableValue,\n varFormat?: InterpolationFormat\n): string {\n const variableSyntax = '$' + varName;\n const alternativeVariableSyntax = '${' + varName + (varFormat ? ':' + varFormat : '') + '}';\n\n let replaceString = '';\n if (Array.isArray(variableValue)) {\n replaceString = interpolate(variableValue, varName, varFormat || InterpolationFormat.PROMETHEUS);\n }\n if (typeof variableValue === 'string') {\n replaceString = interpolate([variableValue], varName, varFormat || InterpolationFormat.RAW);\n }\n\n text = text.replaceAll(variableSyntax, replaceString);\n return text.replaceAll(alternativeVariableSyntax, replaceString);\n}\n\n// This regular expression is designed to identify variable references in a string.\n// It supports two formats for referencing variables:\n// 1. $variableName - This is a simpler format, and the regular expression captures the variable name (\\w+ matches one or more word characters).\n// 2. ${variableName} - This is a more complex format and the regular expression captures the variable name (\\w+ matches one or more word characters) in the curly braces.\n// 3. ${variableName:format} - This is a more complex format that allows specifying a format interpolation.\n\nconst VARIABLE_REGEX = /\\$(\\w+)|\\${(\\w+)(?:\\.([^:^}]+))?(?::([^}]+))?}/gm;\n\n/**\n * Returns a list of variables\n */\nexport function parseVariables(text: string): string[] {\n const matches = new Set<string>();\n let match;\n\n while ((match = VARIABLE_REGEX.exec(text)) !== null) {\n if (match) {\n if (match[1]) {\n // \\$(\\w+)\\\n matches.add(match[1]);\n } else if (match[2]) {\n // \\${(\\w+)}\\\n matches.add(match[2]);\n }\n }\n }\n // return unique matches\n return Array.from(matches.values());\n}\n\n/**\n * Returns a map of variable names and its format. If no format is specified, it will be undefined.\n */\nexport function parseVariablesAndFormat(text: string): Map<string, InterpolationFormat | undefined> {\n const matches = new Map<string, InterpolationFormat | undefined>();\n let match;\n\n while ((match = VARIABLE_REGEX.exec(text)) !== null) {\n if (match) {\n let format = undefined;\n if (match[4]) {\n format = match[4];\n }\n if (match[1]) {\n // \\$(\\w+)\\\n matches.set(match[1], stringToFormat(format));\n } else if (match[2]) {\n // \\${(\\w+)}\\\n matches.set(match[2], stringToFormat(format));\n }\n }\n }\n return matches;\n}\n\n/**\n * Replace all variables in text with their values from the variable state map\n */\nexport function replaceVariables(text: string, variableState: VariableStateMap): string {\n const variablesMap = parseVariablesAndFormat(text);\n const variables = Array.from(variablesMap.keys());\n let finalText = text;\n variables\n // Sorting variables by their length.\n // In order to not have a variable name have contained in another variable name.\n // i.e.: $__range replacing $__range_ms => '3600_ms' instead of '3600000'\n .sort((a, b) => b.length - a.length)\n .forEach((v) => {\n const variable = variableState[v];\n if (variable && variable.value !== undefined) {\n finalText = replaceVariable(finalText, v, variable?.value, variablesMap.get(v));\n }\n });\n\n return finalText;\n}\n"],"names":["InterpolationFormat","stringToFormat","val","undefined","lowerVal","toLowerCase","Object","values","find","format","interpolate","name","join","first","rest","map","v","parsedValues","JSON","parse","stringify","encodeURIComponent","escapedRegex","replace","replaceVariable","text","varName","variableValue","varFormat","variableSyntax","alternativeVariableSyntax","replaceString","Array","isArray","replaceAll","VARIABLE_REGEX","parseVariables","matches","Set","match","exec","add","from","parseVariablesAndFormat","Map","set","replaceVariables","variableState","variablesMap","variables","keys","finalText","sort","a","b","length","forEach","variable","value","get"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAiCjC;;CAEC,GACD,OAAO,IAAA,AAAKA,6CAAAA;;;;;;;;;;;;;;;;WAAAA;MAgBX;AAED,SAASC,eAAeC,GAAuB;IAC7C,IAAI,CAACA,KAAK,OAAOC;IAEjB,MAAMC,WAAWF,IAAIG,WAAW;IAChC,OAAOC,OAAOC,MAAM,CAACP,qBAAqBQ,IAAI,CAAC,CAACC,SAAWA,WAAWL,aAAaD;AACrF;AAEA;;CAEC,GACD,OAAO,SAASO,YAAYH,MAAgB,EAAEI,IAAY,EAAEF,MAA2B;IACrF,OAAQA;QACN;QACA;YACE,OAAOF,OAAOK,IAAI,CAAC;QACrB;YAAsC;gBACpC,MAAM,CAACC,OAAO,GAAGC,KAAK,GAAGP;gBACzB,OAAO,GAAG;oBAACM;uBAAUC,KAAKC,GAAG,CAAC,CAACC,IAAM,GAAGL,KAAK,CAAC,EAAEK,GAAG;iBAAE,CAACJ,IAAI,CAAC,MAAM;YACnE;QACA;YACE,OAAOL,OAAOQ,GAAG,CAAC,CAACC,IAAM,C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AASN;YACb,IAAIoC,KAAK,CAAC,EAAE,EAAE;gBACZ9B,SAAS8B,KAAK,CAAC,EAAE;YACnB;YACA,IAAIA,KAAK,CAAC,EAAE,EAAE;gBACZ,WAAW;gBACXF,QAAQQ,GAAG,CAACN,KAAK,CAAC,EAAE,EAAEtC,eAAeQ;YACvC,OAAO,IAAI8B,KAAK,CAAC,EAAE,EAAE;gBACnB,aAAa;gBACbF,QAAQQ,GAAG,CAACN,KAAK,CAAC,EAAE,EAAEtC,eAAeQ;YACvC;QACF;IACF;IACA,OAAO4B;AACT;AAEA;;CAEC,GACD,OAAO,SAASS,iBAAiBrB,IAAY,EAAEsB,aAA+B;IAC5E,MAAMC,eAAeL,wBAAwBlB;IAC7C,MAAMwB,YAAYjB,MAAMU,IAAI,CAACM,aAAaE,IAAI;IAC9C,IAAIC,YAAY1B;IAChBwB,SACE,qCAAqC;IACrC,gFAAgF;IAChF,yEAAyE;KACxEG,IAAI,CAAC,CAACC,GAAGC,IAAMA,EAAEC,MAAM,GAAGF,EAAEE,MAAM,EAClCC,OAAO,CAAC,CAACxC;QACR,MAAMyC,WAAWV,aAAa,CAAC/B,EAAE;QACjC,IAAIyC,YAAYA,SAASC,KAAK,KAAKvD,WAAW;YAC5CgD,YAAY3B,gBAAgB2B,WAAWnC,GAAGyC,UAAUC,OAAOV,aAAaW,GAAG,CAAC3C;QAC9E;IACF;IAEF,OAAOmC;AACT"}
1
+ {"version":3,"sources":["../../src/utils/variable-interpolation.ts"],"sourcesContent":["// Copyright 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 { VariableValue } from '@perses-dev/spec';\n\n/**\n * Option for a variable with label and value\n */\nexport type VariableOption = { label: string; value: string };\n\n/**\n * State of a variable including its current value, options, and loading state\n */\nexport type VariableState = {\n value: VariableValue;\n options?: VariableOption[];\n loading: boolean;\n error?: Error;\n /**\n * If a local variable is overriding an external variable, local var will have the flag ``overriding=true``.\n */\n overriding?: boolean;\n /**\n * If a local variable is overriding an external variable, external var will have the flag ``overridden=true``.\n */\n overridden?: boolean;\n defaultValue?: VariableValue;\n};\n\n/**\n * Map of variable names to their states\n */\nexport type VariableStateMap = Record<string, VariableState>;\n\n/**\n * Supported interpolation formats for variable values\n */\nexport enum InterpolationFormat {\n CSV = 'csv',\n DISTRIBUTED = 'distributed',\n DOUBLEQUOTE = 'doublequote',\n GLOB = 'glob',\n JSON = 'json',\n LUCENE = 'lucene',\n PERCENTENCODE = 'percentencode',\n PIPE = 'pipe',\n PROMETHEUS = 'prometheus',\n RAW = 'raw',\n REGEX = 'regex',\n SINGLEQUOTE = 'singlequote',\n SQLSTRING = 'sqlstring',\n TEXT = 'text',\n QUERYPARAM = 'queryparam',\n}\n\nfunction stringToFormat(val: string | undefined): InterpolationFormat | undefined {\n if (!val) return undefined;\n\n const lowerVal = val.toLowerCase();\n return Object.values(InterpolationFormat).find((format) => format === lowerVal) || undefined;\n}\n\n/**\n * Interpolate an array of values with a specific format\n */\nexport function interpolate(values: string[], name: string, format: InterpolationFormat): string {\n switch (format) {\n case InterpolationFormat.CSV:\n case InterpolationFormat.RAW:\n return values.join(',');\n case InterpolationFormat.DISTRIBUTED: {\n const [first, ...rest] = values;\n return `${[first, ...rest.map((v) => `${name}=${v}`)].join(',')}`;\n }\n case InterpolationFormat.DOUBLEQUOTE:\n return values.map((v) => `\"${v}\"`).join(',');\n case InterpolationFormat.GLOB:\n return `{${values.join(',')}}`;\n case InterpolationFormat.JSON: {\n // values might contain stringified JSON objects so we need to parse them first\n // and then return a JSON stringified array to return valid JSON\n const parsedValues = values.map((v) => {\n try {\n return JSON.parse(v);\n } catch {\n return v;\n }\n });\n\n return JSON.stringify(parsedValues);\n }\n case InterpolationFormat.LUCENE:\n return `(${values.map((v) => `\"${v}\"`).join(' OR ')})`;\n case InterpolationFormat.PERCENTENCODE:\n return encodeURIComponent(values.join(','));\n case InterpolationFormat.PIPE:\n return values.join('|');\n case InterpolationFormat.REGEX: {\n const escapedRegex = values.map((v) => v.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&'));\n return `(${escapedRegex.join('|')})`;\n }\n case InterpolationFormat.SINGLEQUOTE:\n return values.map((v) => `'${v}'`).join(',');\n case InterpolationFormat.SQLSTRING:\n return values.map((v) => `'${v.replace(/'/g, \"''\")}'`).join(',');\n case InterpolationFormat.TEXT:\n return values.join(' + ');\n case InterpolationFormat.QUERYPARAM:\n return values.map((v) => `${name}=${encodeURIComponent(v)}`).join('&');\n case InterpolationFormat.PROMETHEUS:\n default:\n return `(${values.join('|')})`;\n }\n}\n\n/**\n * Replace a single variable in text with its value\n */\nexport function replaceVariable(\n text: string,\n varName: string,\n variableValue: VariableValue,\n varFormat?: InterpolationFormat\n): string {\n const variableSyntax = '$' + varName;\n const alternativeVariableSyntax = '${' + varName + (varFormat ? ':' + varFormat : '') + '}';\n\n let replaceString = '';\n if (Array.isArray(variableValue)) {\n replaceString = interpolate(variableValue, varName, varFormat || InterpolationFormat.PROMETHEUS);\n }\n if (typeof variableValue === 'string') {\n replaceString = interpolate([variableValue], varName, varFormat || InterpolationFormat.RAW);\n }\n\n text = text.replaceAll(variableSyntax, replaceString);\n return text.replaceAll(alternativeVariableSyntax, replaceString);\n}\n\n// This regular expression is designed to identify variable references in a string.\n// It supports two formats for referencing variables:\n// 1. $variableName - This is a simpler format, and the regular expression captures the variable name (\\w+ matches one or more word characters).\n// 2. ${variableName} - This is a more complex format and the regular expression captures the variable name (\\w+ matches one or more word characters) in the curly braces.\n// 3. ${variableName:format} - This is a more complex format that allows specifying a format interpolation.\n\nconst VARIABLE_REGEX = /\\$(\\w+)|\\${(\\w+)(?:\\.([^:^}]+))?(?::([^}]+))?}/gm;\n\n/**\n * Returns a list of variables\n */\nexport function parseVariables(text: string): string[] {\n const matches = new Set<string>();\n let match;\n\n while ((match = VARIABLE_REGEX.exec(text)) !== null) {\n if (match) {\n if (match[1]) {\n // \\$(\\w+)\\\n matches.add(match[1]);\n } else if (match[2]) {\n // \\${(\\w+)}\\\n matches.add(match[2]);\n }\n }\n }\n // return unique matches\n return Array.from(matches.values());\n}\n\n/**\n * Returns a map of variable names and its format. If no format is specified, it will be undefined.\n */\nexport function parseVariablesAndFormat(text: string): Map<string, InterpolationFormat | undefined> {\n const matches = new Map<string, InterpolationFormat | undefined>();\n let match;\n\n while ((match = VARIABLE_REGEX.exec(text)) !== null) {\n if (match) {\n let format = undefined;\n if (match[4]) {\n format = match[4];\n }\n if (match[1]) {\n // \\$(\\w+)\\\n matches.set(match[1], stringToFormat(format));\n } else if (match[2]) {\n // \\${(\\w+)}\\\n matches.set(match[2], stringToFormat(format));\n }\n }\n }\n return matches;\n}\n\n/**\n * Replace all variables in text with their values from the variable state map\n */\nexport function replaceVariables(text: string, variableState: VariableStateMap): string {\n const variablesMap = parseVariablesAndFormat(text);\n const variables = Array.from(variablesMap.keys());\n let finalText = text;\n variables\n // Sorting variables by their length.\n // In order to not have a variable name have contained in another variable name.\n // i.e.: $__range replacing $__range_ms => '3600_ms' instead of '3600000'\n .sort((a, b) => b.length - a.length)\n .forEach((v) => {\n const variable = variableState[v];\n if (variable && variable.value !== undefined) {\n finalText = replaceVariable(finalText, v, variable?.value, variablesMap.get(v));\n }\n });\n\n return finalText;\n}\n"],"names":["InterpolationFormat","stringToFormat","val","undefined","lowerVal","toLowerCase","Object","values","find","format","interpolate","name","join","first","rest","map","v","parsedValues","JSON","parse","stringify","encodeURIComponent","escapedRegex","replace","replaceVariable","text","varName","variableValue","varFormat","variableSyntax","alternativeVariableSyntax","replaceString","Array","isArray","replaceAll","VARIABLE_REGEX","parseVariables","matches","Set","match","exec","add","from","parseVariablesAndFormat","Map","set","replaceVariables","variableState","variablesMap","variables","keys","finalText","sort","a","b","length","forEach","variable","value","get"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAiCjC;;CAEC,GACD,OAAO,IAAA,AAAKA,6CAAAA;;;;;;;;;;;;;;;;WAAAA;MAgBX;AAED,SAASC,eAAeC,GAAuB;IAC7C,IAAI,CAACA,KAAK,OAAOC;IAEjB,MAAMC,WAAWF,IAAIG,WAAW;IAChC,OAAOC,OAAOC,MAAM,CAACP,qBAAqBQ,IAAI,CAAC,CAACC,SAAWA,WAAWL,aAAaD;AACrF;AAEA;;CAEC,GACD,OAAO,SAASO,YAAYH,MAAgB,EAAEI,IAAY,EAAEF,MAA2B;IACrF,OAAQA;QACN;QACA;YACE,OAAOF,OAAOK,IAAI,CAAC;QACrB;YAAsC;gBACpC,MAAM,CAACC,OAAO,GAAGC,KAAK,GAAGP;gBACzB,OAAO,GAAG;oBAACM;uBAAUC,KAAKC,GAAG,CAAC,CAACC,IAAM,GAAGL,KAAK,CAAC,EAAEK,GAAG;iBAAE,CAACJ,IAAI,CAAC,MAAM;YACnE;QACA;YACE,OAAOL,OAAOQ,GAAG,CAAC,CAACC,IAAM,CAAC,CAAC,EAAEA,EAAE,CAAC,CAAC,EAAEJ,IAAI,CAAC;QAC1C;YACE,OAAO,CAAC,CAAC,EAAEL,OAAOK,IAAI,CAAC,KAAK,CAAC,CAAC;QAChC;YAA+B;gBAC7B,+EAA+E;gBAC/E,gEAAgE;gBAChE,MAAMK,eAAeV,OAAOQ,GAAG,CAAC,CAACC;oBAC/B,IAAI;wBACF,OAAOE,KAAKC,KAAK,CAACH;oBACpB,EAAE,OAAM;wBACN,OAAOA;oBACT;gBACF;gBAEA,OAAOE,KAAKE,SAAS,CAACH;Y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EA;;CAEC,GACD,OAAO,SAASS,iBAAiBrB,IAAY,EAAEsB,aAA+B;IAC5E,MAAMC,eAAeL,wBAAwBlB;IAC7C,MAAMwB,YAAYjB,MAAMU,IAAI,CAACM,aAAaE,IAAI;IAC9C,IAAIC,YAAY1B;IAChBwB,SACE,qCAAqC;IACrC,gFAAgF;IAChF,yEAAyE;KACxEG,IAAI,CAAC,CAACC,GAAGC,IAAMA,EAAEC,MAAM,GAAGF,EAAEE,MAAM,EAClCC,OAAO,CAAC,CAACxC;QACR,MAAMyC,WAAWV,aAAa,CAAC/B,EAAE;QACjC,IAAIyC,YAAYA,SAASC,KAAK,KAAKvD,WAAW;YAC5CgD,YAAY3B,gBAAgB2B,WAAWnC,GAAGyC,UAAUC,OAAOV,aAAaW,GAAG,CAAC3C;QAC9E;IACF;IAEF,OAAOmC;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/components",
3
- "version": "0.53.1",
3
+ "version": "0.54.0-beta.1",
4
4
  "description": "Common UI components used across Perses features",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/perses/perses/blob/main/README.md",
@@ -32,9 +32,11 @@
32
32
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.3",
33
33
  "@codemirror/lang-json": "^6.0.1",
34
34
  "@date-fns/tz": "^1.4.1",
35
- "@fontsource/lato": "^4.5.10",
35
+ "@fontsource/inter": "^5.0.0",
36
36
  "@mui/x-date-pickers": "^7.23.1",
37
37
  "@perses-dev/core": "0.53.0",
38
+ "@perses-dev/spec": "0.2.0-beta.0",
39
+ "@tanstack/match-sorter-utils": "^8.19.4",
38
40
  "@tanstack/react-table": "^8.20.5",
39
41
  "@uiw/react-codemirror": "^4.19.1",
40
42
  "date-fns": "^4.1.0",
@@ -53,6 +55,8 @@
53
55
  "@types/lodash": "^4.17.20"
54
56
  },
55
57
  "peerDependencies": {
58
+ "@emotion/react": "^11.14.0",
59
+ "@emotion/styled": "^11.14.1",
56
60
  "@mui/material": "^6.1.10",
57
61
  "lodash": "^4.17.21",
58
62
  "react": "^17.0.2 || ^18.0.0",