@perses-dev/gauge-chart-plugin 0.13.0-rc.1 → 0.14.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 (121) hide show
  1. package/__mf/js/{GaugeChart.ac26e4f3.js → GaugeChart.666448e5.js} +4 -4
  2. package/__mf/js/async/121.a37557d3.js +2 -0
  3. package/__mf/js/async/192.1bece79a.js +1 -0
  4. package/__mf/js/async/2.e1c5abe4.js +1 -0
  5. package/__mf/js/async/208.a09e3946.js +83 -0
  6. package/__mf/js/async/235.25414f3a.js +1 -0
  7. package/__mf/js/async/244.f21ad375.js +7 -0
  8. package/__mf/js/async/{700.1be812d5.js.LICENSE.txt → 244.f21ad375.js.LICENSE.txt} +41 -1
  9. package/__mf/js/async/354.c398a3bf.js +4 -0
  10. package/__mf/js/async/354.c398a3bf.js.LICENSE.txt +9 -0
  11. package/__mf/js/async/356.d85a4e2e.js +1 -0
  12. package/__mf/js/async/373.0403e3b1.js +38 -0
  13. package/__mf/js/async/392.605cca25.js +2 -0
  14. package/__mf/js/async/458.501ed0da.js +1 -0
  15. package/__mf/js/async/470.a2c22a78.js +2 -0
  16. package/__mf/js/async/587.6f130e41.js +1 -0
  17. package/__mf/js/async/616.cecf44f8.js +1 -0
  18. package/__mf/js/async/663.97d3fd12.js +1 -0
  19. package/__mf/js/async/710.23542577.js +29 -0
  20. package/__mf/js/async/77.c33fcfb5.js +1 -0
  21. package/__mf/js/async/893.a44ef766.js +2 -0
  22. package/__mf/js/async/941.e909e334.js +2 -0
  23. package/__mf/js/async/963.caed232d.js +1 -0
  24. package/__mf/js/async/968.7d1ce389.js +1 -0
  25. package/__mf/js/async/__federation_expose_GaugeChart.1812e964.js +1 -0
  26. package/__mf/js/async/lib-router.005da842.js +2 -0
  27. package/__mf/js/{main.378e6f17.js → main.9a8ce910.js} +7 -7
  28. package/lib/GaugeChart.d.ts +3 -3
  29. package/lib/GaugeChart.d.ts.map +1 -1
  30. package/lib/GaugeChart.js +3 -3
  31. package/lib/GaugeChart.js.map +1 -1
  32. package/lib/GaugeChartBase.d.ts +3 -3
  33. package/lib/GaugeChartBase.d.ts.map +1 -1
  34. package/lib/GaugeChartBase.js +7 -7
  35. package/lib/GaugeChartBase.js.map +1 -1
  36. package/lib/GaugeChartOptionsEditorSettings.d.ts +2 -2
  37. package/lib/GaugeChartOptionsEditorSettings.d.ts.map +1 -1
  38. package/lib/GaugeChartOptionsEditorSettings.js +7 -7
  39. package/lib/GaugeChartOptionsEditorSettings.js.map +1 -1
  40. package/lib/GaugeChartPanel.d.ts +4 -4
  41. package/lib/GaugeChartPanel.d.ts.map +1 -1
  42. package/lib/GaugeChartPanel.js +8 -8
  43. package/lib/GaugeChartPanel.js.map +1 -1
  44. package/lib/bootstrap.js +2 -2
  45. package/lib/gauge-chart-model.d.ts +3 -3
  46. package/lib/gauge-chart-model.d.ts.map +1 -1
  47. package/lib/gauge-chart-model.js.map +1 -1
  48. package/lib/getPluginModule.d.ts +1 -1
  49. package/lib/getPluginModule.d.ts.map +1 -1
  50. package/lib/getPluginModule.js +3 -1
  51. package/lib/getPluginModule.js.map +1 -1
  52. package/lib/index-federation.js +1 -1
  53. package/lib/index.js +6 -6
  54. package/lib/index.js.map +1 -1
  55. package/lib/setup-tests.d.ts +1 -1
  56. package/lib/setup-tests.d.ts.map +1 -1
  57. package/lib/setup-tests.js +2 -2
  58. package/lib/setup-tests.js.map +1 -1
  59. package/lib/thresholds.d.ts +1 -1
  60. package/lib/thresholds.d.ts.map +1 -1
  61. package/lib/thresholds.js +1 -1
  62. package/lib/thresholds.js.map +1 -1
  63. package/mf-manifest.json +31 -97
  64. package/mf-stats.json +31 -109
  65. package/package.json +10 -10
  66. package/__mf/js/async/121.4c5f5798.js +0 -2
  67. package/__mf/js/async/172.afec864d.js +0 -110
  68. package/__mf/js/async/177.2e554778.js +0 -1
  69. package/__mf/js/async/187.ba6fd686.js +0 -7
  70. package/__mf/js/async/187.ba6fd686.js.LICENSE.txt +0 -39
  71. package/__mf/js/async/192.fb5cd927.js +0 -1
  72. package/__mf/js/async/235.b918db36.js +0 -1
  73. package/__mf/js/async/274.9badab92.js +0 -2
  74. package/__mf/js/async/356.c7cf4f79.js +0 -1
  75. package/__mf/js/async/377.06309086.js +0 -1
  76. package/__mf/js/async/392.4807325b.js +0 -2
  77. package/__mf/js/async/403.9db35877.js +0 -2
  78. package/__mf/js/async/410.4043d582.js +0 -1
  79. package/__mf/js/async/458.0f5bc9ee.js +0 -1
  80. package/__mf/js/async/470.9e955be3.js +0 -2
  81. package/__mf/js/async/496.dc9e951b.js +0 -1
  82. package/__mf/js/async/546.9670f97a.js +0 -24
  83. package/__mf/js/async/546.9670f97a.js.LICENSE.txt +0 -19
  84. package/__mf/js/async/558.9e9f2911.js +0 -1
  85. package/__mf/js/async/587.2649e50b.js +0 -1
  86. package/__mf/js/async/588.f25e2591.js +0 -1
  87. package/__mf/js/async/616.0741833f.js +0 -1
  88. package/__mf/js/async/700.1be812d5.js +0 -30
  89. package/__mf/js/async/71.57cf30f3.js +0 -1
  90. package/__mf/js/async/756.cbb57779.js +0 -1
  91. package/__mf/js/async/77.629e7e49.js +0 -1
  92. package/__mf/js/async/823.488b0ae9.js +0 -10
  93. package/__mf/js/async/854.d052322d.js +0 -1
  94. package/__mf/js/async/873.650a20f9.js +0 -1
  95. package/__mf/js/async/941.c6518e38.js +0 -2
  96. package/__mf/js/async/963.ab063f73.js +0 -1
  97. package/__mf/js/async/968.5b4a4f18.js +0 -1
  98. package/__mf/js/async/978.8aa2a024.js +0 -1
  99. package/__mf/js/async/__federation_expose_GaugeChart.938eb098.js +0 -1
  100. package/__mf/js/async/lib-router.f8568e8a.js +0 -2
  101. package/lib/cjs/GaugeChart.js +0 -39
  102. package/lib/cjs/GaugeChartBase.js +0 -196
  103. package/lib/cjs/GaugeChartOptionsEditorSettings.js +0 -120
  104. package/lib/cjs/GaugeChartPanel.js +0 -195
  105. package/lib/cjs/bootstrap.js +0 -26
  106. package/lib/cjs/env.d.js +0 -14
  107. package/lib/cjs/gauge-chart-model.js +0 -57
  108. package/lib/cjs/getPluginModule.js +0 -39
  109. package/lib/cjs/index-federation.js +0 -55
  110. package/lib/cjs/index.js +0 -41
  111. package/lib/cjs/setup-tests.js +0 -19
  112. package/lib/cjs/thresholds.js +0 -77
  113. /package/__mf/css/async/{187.85c2cbf6.css → 244.85c2cbf6.css} +0 -0
  114. /package/__mf/js/async/{121.4c5f5798.js.LICENSE.txt → 121.a37557d3.js.LICENSE.txt} +0 -0
  115. /package/__mf/js/async/{823.488b0ae9.js.LICENSE.txt → 208.a09e3946.js.LICENSE.txt} +0 -0
  116. /package/__mf/js/async/{403.9db35877.js.LICENSE.txt → 373.0403e3b1.js.LICENSE.txt} +0 -0
  117. /package/__mf/js/async/{392.4807325b.js.LICENSE.txt → 392.605cca25.js.LICENSE.txt} +0 -0
  118. /package/__mf/js/async/{470.9e955be3.js.LICENSE.txt → 470.a2c22a78.js.LICENSE.txt} +0 -0
  119. /package/__mf/js/async/{274.9badab92.js.LICENSE.txt → 893.a44ef766.js.LICENSE.txt} +0 -0
  120. /package/__mf/js/async/{941.c6518e38.js.LICENSE.txt → 941.e909e334.js.LICENSE.txt} +0 -0
  121. /package/__mf/js/async/{lib-router.f8568e8a.js.LICENSE.txt → lib-router.005da842.js.LICENSE.txt} +0 -0
@@ -1,6 +1,6 @@
1
- import { PanelPlugin } from '@perses-dev/plugin-system';
2
- import { GaugeChartOptions } from './gauge-chart-model';
3
- import { GaugeChartPanelProps } from './GaugeChartPanel';
1
+ import type { PanelPlugin } from '@perses-dev/plugin-system';
2
+ import type { GaugeChartOptions } from './gauge-chart-model';
3
+ import type { GaugeChartPanelProps } from './GaugeChartPanel';
4
4
  /**
5
5
  * The core GaugeChart panel plugin for Perses.
6
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"GaugeChart.d.ts","sourceRoot":"","sources":["../../src/GaugeChart.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAkC,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExF,OAAO,EAAsC,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE7F;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,iBAAiB,EAAE,oBAAoB,CAW3E,CAAC"}
1
+ {"version":3,"file":"GaugeChart.d.ts","sourceRoot":"","sources":["../../src/GaugeChart.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAG7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAG9D;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,iBAAiB,EAAE,oBAAoB,CAW3E,CAAC"}
package/lib/GaugeChart.js CHANGED
@@ -10,9 +10,9 @@
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 { createInitialGaugeChartOptions } from './gauge-chart-model';
14
- import { GaugeChartOptionsEditorSettings } from './GaugeChartOptionsEditorSettings';
15
- import { GaugeChartLoading, GaugeChartPanel } from './GaugeChartPanel';
13
+ import { createInitialGaugeChartOptions } from "./gauge-chart-model.js";
14
+ import { GaugeChartOptionsEditorSettings } from "./GaugeChartOptionsEditorSettings.js";
15
+ import { GaugeChartLoading, GaugeChartPanel } from "./GaugeChartPanel.js";
16
16
  /**
17
17
  * The core GaugeChart panel plugin for Perses.
18
18
  */ export const GaugeChart = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/GaugeChart.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 { PanelPlugin } from '@perses-dev/plugin-system';\nimport { createInitialGaugeChartOptions, GaugeChartOptions } from './gauge-chart-model';\nimport { GaugeChartOptionsEditorSettings } from './GaugeChartOptionsEditorSettings';\nimport { GaugeChartLoading, GaugeChartPanel, GaugeChartPanelProps } from './GaugeChartPanel';\n\n/**\n * The core GaugeChart panel plugin for Perses.\n */\nexport const GaugeChart: PanelPlugin<GaugeChartOptions, GaugeChartPanelProps> = {\n PanelComponent: GaugeChartPanel,\n LoadingComponent: GaugeChartLoading,\n supportedQueryTypes: ['TimeSeriesQuery'],\n panelOptionsEditorComponents: [\n {\n label: 'Settings',\n content: GaugeChartOptionsEditorSettings,\n },\n ],\n createInitialOptions: createInitialGaugeChartOptions,\n};\n"],"names":["createInitialGaugeChartOptions","GaugeChartOptionsEditorSettings","GaugeChartLoading","GaugeChartPanel","GaugeChart","PanelComponent","LoadingComponent","supportedQueryTypes","panelOptionsEditorComponents","label","content","createInitialOptions"],"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,8BAA8B,QAA2B,sBAAsB;AACxF,SAASC,+BAA+B,QAAQ,oCAAoC;AACpF,SAASC,iBAAiB,EAAEC,eAAe,QAA8B,oBAAoB;AAE7F;;CAEC,GACD,OAAO,MAAMC,aAAmE;IAC9EC,gBAAgBF;IAChBG,kBAAkBJ;IAClBK,qBAAqB;QAAC;KAAkB;IACxCC,8BAA8B;QAC5B;YACEC,OAAO;YACPC,SAAST;QACX;KACD;IACDU,sBAAsBX;AACxB,EAAE"}
1
+ {"version":3,"sources":["../../src/GaugeChart.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 type { PanelPlugin } from '@perses-dev/plugin-system';\n\nimport type { GaugeChartOptions } from './gauge-chart-model';\nimport { createInitialGaugeChartOptions } from './gauge-chart-model';\nimport { GaugeChartOptionsEditorSettings } from './GaugeChartOptionsEditorSettings';\nimport type { GaugeChartPanelProps } from './GaugeChartPanel';\nimport { GaugeChartLoading, GaugeChartPanel } from './GaugeChartPanel';\n\n/**\n * The core GaugeChart panel plugin for Perses.\n */\nexport const GaugeChart: PanelPlugin<GaugeChartOptions, GaugeChartPanelProps> = {\n PanelComponent: GaugeChartPanel,\n LoadingComponent: GaugeChartLoading,\n supportedQueryTypes: ['TimeSeriesQuery'],\n panelOptionsEditorComponents: [\n {\n label: 'Settings',\n content: GaugeChartOptionsEditorSettings,\n },\n ],\n createInitialOptions: createInitialGaugeChartOptions,\n};\n"],"names":["createInitialGaugeChartOptions","GaugeChartOptionsEditorSettings","GaugeChartLoading","GaugeChartPanel","GaugeChart","PanelComponent","LoadingComponent","supportedQueryTypes","panelOptionsEditorComponents","label","content","createInitialOptions"],"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;AAKjC,SAASA,8BAA8B,QAAQ,yBAAsB;AACrE,SAASC,+BAA+B,QAAQ,uCAAoC;AAEpF,SAASC,iBAAiB,EAAEC,eAAe,QAAQ,uBAAoB;AAEvE;;CAEC,GACD,OAAO,MAAMC,aAAmE;IAC9EC,gBAAgBF;IAChBG,kBAAkBJ;IAClBK,qBAAqB;QAAC;KAAkB;IACxCC,8BAA8B;QAC5B;YACEC,OAAO;YACPC,SAAST;QACX;KACD;IACDU,sBAAsBX;AACxB,EAAE"}
@@ -1,6 +1,6 @@
1
- import { FormatOptions } from '@perses-dev/components';
2
- import { GaugeSeriesOption } from 'echarts/charts';
3
- import { ReactElement } from 'react';
1
+ import type { FormatOptions } from '@perses-dev/components';
2
+ import type { GaugeSeriesOption } from 'echarts/charts';
3
+ import type { ReactElement } from 'react';
4
4
  export type GaugeChartValue = number | null | undefined;
5
5
  export type GaugeSeries = {
6
6
  value: GaugeChartValue;
@@ -1 +1 @@
1
- {"version":3,"file":"GaugeChartBase.d.ts","sourceRoot":"","sources":["../../src/GaugeChartBase.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAU,aAAa,EAA4C,MAAM,wBAAwB,CAAC;AAEzG,OAAO,EAAmC,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGpF,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAOrC,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAExD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,YAAY,CA4IvE"}
1
+ {"version":3,"file":"GaugeChartBase.d.ts","sourceRoot":"","sources":["../../src/GaugeChartBase.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAMxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAO1C,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAExD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,YAAY,CA4IvE"}
@@ -1,4 +1,3 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  // Copyright The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
@@ -11,12 +10,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- import { EChart, formatValue, useChartsTheme, useDeepMemo } from '@perses-dev/components';
15
- import { use } from 'echarts/core';
16
- import { GaugeChart as EChartsGaugeChart } from 'echarts/charts';
17
- import { GridComponent, TitleComponent, TooltipComponent } from 'echarts/components';
18
- import { CanvasRenderer } from 'echarts/renderers';
19
- use([
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { EChart, formatValue, useChartsTheme, useDeepMemo } from "@perses-dev/components";
15
+ import { GaugeChart as EChartsGaugeChart } from "echarts/charts";
16
+ import { GridComponent, TitleComponent, TooltipComponent } from "echarts/components";
17
+ import { use as registerECharts } from "echarts/core";
18
+ import { CanvasRenderer } from "echarts/renderers";
19
+ registerECharts([
20
20
  EChartsGaugeChart,
21
21
  GridComponent,
22
22
  TitleComponent,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/GaugeChartBase.tsx"],"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 { EChart, FormatOptions, formatValue, useChartsTheme, useDeepMemo } from '@perses-dev/components';\nimport { use, EChartsCoreOption } from 'echarts/core';\nimport { GaugeChart as EChartsGaugeChart, GaugeSeriesOption } from 'echarts/charts';\nimport { GridComponent, TitleComponent, TooltipComponent } from 'echarts/components';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport { ReactElement } from 'react';\n\nuse([EChartsGaugeChart, GridComponent, TitleComponent, TooltipComponent, CanvasRenderer]);\n\n// adjusts when to show pointer icon\nconst GAUGE_SMALL_BREAKPOINT = 170;\n\nexport type GaugeChartValue = number | null | undefined;\n\nexport type GaugeSeries = {\n value: GaugeChartValue;\n label: string;\n};\n\nexport interface GaugeChartBaseProps {\n width: number;\n height: number;\n data: GaugeSeries;\n format: FormatOptions;\n axisLine: GaugeSeriesOption['axisLine'];\n max?: number;\n valueFontSize: string;\n progressWidth: number;\n titleFontSize: number;\n}\n\nexport function GaugeChartBase(props: GaugeChartBaseProps): ReactElement {\n const { width, height, data, format, axisLine, max, valueFontSize, progressWidth, titleFontSize } = props;\n const chartsTheme = useChartsTheme();\n\n // useDeepMemo ensures value size util does not rerun everytime you hover on the chart\n const option: EChartsCoreOption = useDeepMemo(() => {\n if (data.value === undefined) return chartsTheme.noDataOption;\n\n // Base configuration shared by both series (= progress & scale)\n const baseGaugeConfig = {\n type: 'gauge' as const,\n center: ['50%', '65%'] as [string, string],\n startAngle: 200,\n endAngle: -20,\n min: 0,\n max: max,\n axisTick: {\n show: false,\n },\n splitLine: {\n show: false,\n },\n axisLabel: {\n show: false,\n },\n data: [\n {\n value: data.value,\n },\n ],\n };\n\n return {\n title: {\n show: false,\n },\n tooltip: {\n show: false,\n },\n series: [\n // Inner gauge (progress)\n {\n ...baseGaugeConfig,\n radius: '90%',\n silent: true,\n progress: {\n show: true,\n width: progressWidth,\n itemStyle: {\n color: 'auto',\n },\n },\n axisLine: {\n lineStyle: {\n color: [[1, 'rgba(127,127,127,0.35)']], // TODO (sjcobb): use future chart theme colors\n width: progressWidth,\n },\n },\n pointer: {\n show: false,\n },\n anchor: {\n show: false,\n },\n title: {\n show: false,\n },\n detail: {\n show: false,\n },\n },\n // Outer gauge (scale & display)\n {\n ...baseGaugeConfig,\n radius: '100%',\n pointer: {\n show: true,\n // pointer hidden for small panels, path taken from ex: https://echarts.apache.org/examples/en/editor.html?c=gauge-grade\n icon: width > GAUGE_SMALL_BREAKPOINT ? 'path://M12.8,0.7l12,40.1H0.7L12.8,0.7z' : 'none',\n length: 10,\n width: 5,\n offsetCenter: [0, '-49%'],\n itemStyle: {\n color: 'auto',\n },\n },\n axisLine: axisLine,\n // `detail` is the text displayed in the middle\n detail: {\n show: true,\n width: '60%',\n borderRadius: 8,\n offsetCenter: [0, '-9%'],\n color: 'inherit', // allows value color to match active threshold color\n fontSize: valueFontSize,\n formatter:\n data.value === null\n ? // We use a different function when we *know* the value is null\n // at this level because the `formatter` function argument is `NaN`\n // when the value is `null`, making it difficult to differentiate\n // `null` from a true `NaN` case.\n (): string => 'null'\n : (value: number): string | undefined => {\n return formatValue(value, format);\n },\n },\n data: [\n {\n value: data.value,\n name: data.label,\n // TODO: new UX for series names, create separate React component or reuse ListLegendItem\n // https://echarts.apache.org/en/option.html#series-gauge.data.title\n title: {\n show: true,\n color: chartsTheme.echartsTheme.textStyle?.color ?? 'inherit', // series name font color\n offsetCenter: [0, '55%'],\n overflow: 'truncate',\n fontSize: titleFontSize,\n width: width * 0.8,\n },\n },\n ],\n },\n ],\n };\n }, [data, width, height, chartsTheme, format, axisLine, max, valueFontSize, progressWidth, titleFontSize]);\n\n return (\n <EChart\n style={{\n width: width,\n height: height,\n }}\n sx={{\n padding: `${chartsTheme.container.padding.default}px`,\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n />\n );\n}\n"],"names":["EChart","formatValue","useChartsTheme","useDeepMemo","use","GaugeChart","EChartsGaugeChart","GridComponent","TitleComponent","TooltipComponent","CanvasRenderer","GAUGE_SMALL_BREAKPOINT","GaugeChartBase","props","width","height","data","format","axisLine","max","valueFontSize","progressWidth","titleFontSize","chartsTheme","option","value","undefined","noDataOption","baseGaugeConfig","type","center","startAngle","endAngle","min","axisTick","show","splitLine","axisLabel","title","tooltip","series","radius","silent","progress","itemStyle","color","lineStyle","pointer","anchor","detail","icon","length","offsetCenter","borderRadius","fontSize","formatter","name","label","echartsTheme","textStyle","overflow","style","sx","padding","container","default","theme"],"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,MAAM,EAA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AAGxC,YAAYyC,SAAS,CAACD,OAAO,CAACE,OAAO,CAAC,EAAE,CAAC;QACvD;QACAzC,QAAQA;QACR0C,OAAO3C,YAAYmC,YAAY;;AAGrC"}
1
+ {"version":3,"sources":["../../src/GaugeChartBase.tsx"],"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 type { FormatOptions } from '@perses-dev/components';\nimport { EChart, formatValue, useChartsTheme, useDeepMemo } from '@perses-dev/components';\nimport type { GaugeSeriesOption } from 'echarts/charts';\nimport { GaugeChart as EChartsGaugeChart } from 'echarts/charts';\nimport { GridComponent, TitleComponent, TooltipComponent } from 'echarts/components';\nimport type { EChartsCoreOption } from 'echarts/core';\nimport { use as registerECharts } from 'echarts/core';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport type { ReactElement } from 'react';\n\nregisterECharts([EChartsGaugeChart, GridComponent, TitleComponent, TooltipComponent, CanvasRenderer]);\n\n// adjusts when to show pointer icon\nconst GAUGE_SMALL_BREAKPOINT = 170;\n\nexport type GaugeChartValue = number | null | undefined;\n\nexport type GaugeSeries = {\n value: GaugeChartValue;\n label: string;\n};\n\nexport interface GaugeChartBaseProps {\n width: number;\n height: number;\n data: GaugeSeries;\n format: FormatOptions;\n axisLine: GaugeSeriesOption['axisLine'];\n max?: number;\n valueFontSize: string;\n progressWidth: number;\n titleFontSize: number;\n}\n\nexport function GaugeChartBase(props: GaugeChartBaseProps): ReactElement {\n const { width, height, data, format, axisLine, max, valueFontSize, progressWidth, titleFontSize } = props;\n const chartsTheme = useChartsTheme();\n\n // useDeepMemo ensures value size util does not rerun everytime you hover on the chart\n const option: EChartsCoreOption = useDeepMemo(() => {\n if (data.value === undefined) return chartsTheme.noDataOption;\n\n // Base configuration shared by both series (= progress & scale)\n const baseGaugeConfig = {\n type: 'gauge' as const,\n center: ['50%', '65%'] as [string, string],\n startAngle: 200,\n endAngle: -20,\n min: 0,\n max: max,\n axisTick: {\n show: false,\n },\n splitLine: {\n show: false,\n },\n axisLabel: {\n show: false,\n },\n data: [\n {\n value: data.value,\n },\n ],\n };\n\n return {\n title: {\n show: false,\n },\n tooltip: {\n show: false,\n },\n series: [\n // Inner gauge (progress)\n {\n ...baseGaugeConfig,\n radius: '90%',\n silent: true,\n progress: {\n show: true,\n width: progressWidth,\n itemStyle: {\n color: 'auto',\n },\n },\n axisLine: {\n lineStyle: {\n color: [[1, 'rgba(127,127,127,0.35)']], // TODO (sjcobb): use future chart theme colors\n width: progressWidth,\n },\n },\n pointer: {\n show: false,\n },\n anchor: {\n show: false,\n },\n title: {\n show: false,\n },\n detail: {\n show: false,\n },\n },\n // Outer gauge (scale & display)\n {\n ...baseGaugeConfig,\n radius: '100%',\n pointer: {\n show: true,\n // pointer hidden for small panels, path taken from ex: https://echarts.apache.org/examples/en/editor.html?c=gauge-grade\n icon: width > GAUGE_SMALL_BREAKPOINT ? 'path://M12.8,0.7l12,40.1H0.7L12.8,0.7z' : 'none',\n length: 10,\n width: 5,\n offsetCenter: [0, '-49%'],\n itemStyle: {\n color: 'auto',\n },\n },\n axisLine: axisLine,\n // `detail` is the text displayed in the middle\n detail: {\n show: true,\n width: '60%',\n borderRadius: 8,\n offsetCenter: [0, '-9%'],\n color: 'inherit', // allows value color to match active threshold color\n fontSize: valueFontSize,\n formatter:\n data.value === null\n ? // We use a different function when we *know* the value is null\n // at this level because the `formatter` function argument is `NaN`\n // when the value is `null`, making it difficult to differentiate\n // `null` from a true `NaN` case.\n (): string => 'null'\n : (value: number): string | undefined => {\n return formatValue(value, format);\n },\n },\n data: [\n {\n value: data.value,\n name: data.label,\n // TODO: new UX for series names, create separate React component or reuse ListLegendItem\n // https://echarts.apache.org/en/option.html#series-gauge.data.title\n title: {\n show: true,\n color: chartsTheme.echartsTheme.textStyle?.color ?? 'inherit', // series name font color\n offsetCenter: [0, '55%'],\n overflow: 'truncate',\n fontSize: titleFontSize,\n width: width * 0.8,\n },\n },\n ],\n },\n ],\n };\n }, [data, width, height, chartsTheme, format, axisLine, max, valueFontSize, progressWidth, titleFontSize]);\n\n return (\n <EChart\n style={{\n width: width,\n height: height,\n }}\n sx={{\n padding: `${chartsTheme.container.padding.default}px`,\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n />\n );\n}\n"],"names":["EChart","formatValue","useChartsTheme","useDeepMemo","GaugeChart","EChartsGaugeChart","GridComponent","TitleComponent","TooltipComponent","use","registerECharts","CanvasRenderer","GAUGE_SMALL_BREAKPOINT","GaugeChartBase","props","width","height","data","format","axisLine","max","valueFontSize","progressWidth","titleFontSize","chartsTheme","option","value","undefined","noDataOption","baseGaugeConfig","type","center","startAngle","endAngle","min","axisTick","show","splitLine","axisLabel","title","tooltip","series","radius","silent","progress","itemStyle","color","lineStyle","pointer","anchor","detail","icon","length","offsetCenter","borderRadius","fontSize","formatter","name","label","echartsTheme","textStyle","overflow","style","sx","padding","container","default","theme"],"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,MAAM,EAAEC,WAAW,EAAEC,cAAc,EAAEC,WAAW,QAAQ,yBAAyB;AAE1F,SAASC,cAAcC,iBAAiB,QAAQ,iBAAiB;AACjE,SAASC,aAAa,EAAEC,cAAc,EAAEC,gBAAgB,QAAQ,qBAAqB;AAErF,SAASC,OAAOC,eAAe,QAAQ,eAAe;AACtD,SAASC,cAAc,QAAQ,oBAAoB;AAGnDD,gBAAgB;IAACL;IA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S;wBACPZ,MAAM;wBACN,wHAAwH;wBACxHe,MAAMpC,QAAQH,yBAAyB,2CAA2C;wBAClFwC,QAAQ;wBACRrC,OAAO;wBACPsC,cAAc;4BAAC;4BAAG;yBAAO;wBACzBR,WAAW;4BACTC,OAAO;wBACT;oBACF;oBACA3B,UAAUA;oBACV,+CAA+C;oBAC/C+B,QAAQ;wBACNd,MAAM;wBACNrB,OAAO;wBACPuC,cAAc;wBACdD,cAAc;4BAAC;4BAAG;yBAAM;wBACxBP,OAAO;wBACPS,UAAUlC;wBACVmC,WACEvC,KAAKS,KAAK,KAAK,OAEX,mEAAmE;wBACnE,iEAAiE;wBACjE,iCAAiC;wBACjC,IAAc,SACd,CAACA;4BACC,OAAOzB,YAAYyB,OAAOR;wBAC5B;oBACR;oBACAD,MAAM;wBACJ;4BACES,OAAOT,KAAKS,KAAK;4BACjB+B,MAAMxC,KAAKyC,KAAK;4BAChB,yFAAyF;4BACzF,oEAAoE;4BACpEnB,OAAO;gCACLH,MAAM;gCACNU,OAAOtB,YAAYmC,YAAY,CAACC,SAAS,EAAEd,SAAS;gCACpDO,cAAc;oCAAC;oCAAG;iCAAM;gCACxBQ,UAAU;gCACVN,UAAUhC;gCACVR,OAAOA,QAAQ;4BACjB;wBACF;qBACD;gBACH;aACD;QACH;IACF,GAAG;QAACE;QAAMF;QAAOC;QAAQQ;QAAaN;QAAQC;QAAUC;QAAKC;QAAeC;QAAeC;KAAc;IAEzG,qBACE,KAACvB;QACC8D,OAAO;YACL/C,OAAOA;YACPC,QAAQA;QACV;QACA+C,IAAI;YACFC,SAAS,GAAGxC,YAAYyC,SAAS,CAACD,OAAO,CAACE,OAAO,CAAC,EAAE,CAAC;QACvD;QACAzC,QAAQA;QACR0C,OAAO3C,YAAYmC,YAAY;;AAGrC"}
@@ -1,4 +1,4 @@
1
- import { ReactElement } from 'react';
2
- import { GaugeChartOptionsEditorProps } from './gauge-chart-model';
1
+ import type { ReactElement } from 'react';
2
+ import type { GaugeChartOptionsEditorProps } from './gauge-chart-model';
3
3
  export declare function GaugeChartOptionsEditorSettings(props: GaugeChartOptionsEditorProps): ReactElement;
4
4
  //# sourceMappingURL=GaugeChartOptionsEditorSettings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GaugeChartOptionsEditorSettings.d.ts","sourceRoot":"","sources":["../../src/GaugeChartOptionsEditorSettings.tsx"],"names":[],"mappings":"AA2BA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAKL,4BAA4B,EAC7B,MAAM,qBAAqB,CAAC;AAE7B,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,4BAA4B,GAAG,YAAY,CAyFjG"}
1
+ {"version":3,"file":"GaugeChartOptionsEditorSettings.d.ts","sourceRoot":"","sources":["../../src/GaugeChartOptionsEditorSettings.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAqB,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAG3F,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,4BAA4B,GAAG,YAAY,CAyFjG"}
@@ -11,15 +11,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
- import { Switch, TextField } from '@mui/material';
15
- import { FormatControls, OptionsEditorColumn, OptionsEditorControl, OptionsEditorGrid, OptionsEditorGroup, ThresholdsEditor } from '@perses-dev/components';
16
- import { CalculationSelector } from '@perses-dev/plugin-system';
17
- import { produce } from 'immer';
18
- import merge from 'lodash/merge';
19
- import { DEFAULT_FORMAT, DEFAULT_MAX_PERCENT, DEFAULT_MAX_PERCENT_DECIMAL } from './gauge-chart-model';
14
+ import { Switch, TextField } from "@mui/material";
15
+ import { FormatControls, OptionsEditorColumn, OptionsEditorControl, OptionsEditorGrid, OptionsEditorGroup, ThresholdsEditor } from "@perses-dev/components";
16
+ import { CalculationSelector } from "@perses-dev/plugin-system";
17
+ import { produce } from "immer";
18
+ import merge from "lodash/merge";
19
+ import { DEFAULT_FORMAT, DEFAULT_MAX_PERCENT, DEFAULT_MAX_PERCENT_DECIMAL } from "./gauge-chart-model.js";
20
20
  export function GaugeChartOptionsEditorSettings(props) {
21
21
  const { onChange, value } = props;
22
- /* If legend setting doesn't exist (because it is optional), the legend should show by default
22
+ /* If legend setting doesn't exist (because it is optional), the legend should show by default
23
23
  This is for the records before the legend option was added
24
24
  */ const showLegend = value?.legend?.show ?? true;
25
25
  const handleCalculationChange = (newCalculation)=>{
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/GaugeChartOptionsEditorSettings.tsx"],"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 { Switch, TextField } from '@mui/material';\nimport {\n FormatControls,\n FormatControlsProps,\n OptionsEditorColumn,\n OptionsEditorControl,\n OptionsEditorGrid,\n OptionsEditorGroup,\n ThresholdOptions,\n ThresholdsEditor,\n} from '@perses-dev/components';\nimport { CalculationSelector, CalculationSelectorProps } from '@perses-dev/plugin-system';\nimport { produce } from 'immer';\nimport merge from 'lodash/merge';\nimport { ReactElement } from 'react';\nimport {\n DEFAULT_FORMAT,\n DEFAULT_MAX_PERCENT,\n DEFAULT_MAX_PERCENT_DECIMAL,\n GaugeChartOptions,\n GaugeChartOptionsEditorProps,\n} from './gauge-chart-model';\n\nexport function GaugeChartOptionsEditorSettings(props: GaugeChartOptionsEditorProps): ReactElement {\n const { onChange, value } = props;\n /* If legend setting doesn't exist (because it is optional), the legend should show by default \n This is for the records before the legend option was added\n */\n const showLegend = value?.legend?.show ?? true;\n\n const handleCalculationChange: CalculationSelectorProps['onChange'] = (newCalculation) => {\n onChange(\n produce(value, (draft: GaugeChartOptions) => {\n draft.calculation = newCalculation;\n })\n );\n };\n\n const handleUnitChange: FormatControlsProps['onChange'] = (newFormat) => {\n onChange(\n produce(value, (draft: GaugeChartOptions) => {\n draft.format = newFormat;\n })\n );\n };\n\n // ensures decimalPlaces defaults to correct value\n const format = merge({}, DEFAULT_FORMAT, value.format);\n\n // max only needs to be set explicitly for units other than percent and percent-decimal\n let maxPlaceholder = 'Enter value';\n if (format.unit === 'percent') {\n maxPlaceholder = DEFAULT_MAX_PERCENT.toString();\n } else if (format.unit === 'percent-decimal') {\n maxPlaceholder = DEFAULT_MAX_PERCENT_DECIMAL.toString();\n }\n\n const handleThresholdsChange = (thresholds: ThresholdOptions): void => {\n onChange(\n produce(value, (draft: GaugeChartOptions) => {\n draft.thresholds = thresholds;\n })\n );\n };\n\n return (\n <OptionsEditorGrid>\n <OptionsEditorColumn>\n <OptionsEditorGroup title=\"Misc\">\n <FormatControls value={format} onChange={handleUnitChange} />\n <CalculationSelector value={value.calculation} onChange={handleCalculationChange} />\n <OptionsEditorControl\n label=\"Max\"\n control={\n <TextField\n type=\"number\"\n value={value.max ?? ''}\n onChange={(e) => {\n // ensure empty value resets to undef to allow chart to calculate max\n const newValue = e.target.value ? Number(e.target.value) : undefined;\n onChange(\n produce(value, (draft: GaugeChartOptions) => {\n draft.max = newValue;\n })\n );\n }}\n placeholder={maxPlaceholder}\n />\n }\n />\n </OptionsEditorGroup>\n </OptionsEditorColumn>\n <OptionsEditorColumn>\n <ThresholdsEditor thresholds={value.thresholds} onChange={handleThresholdsChange} />\n <OptionsEditorControl\n label=\"Show legend\"\n control={\n <Switch\n onChange={(): void => {\n onChange(\n produce(value, (draft: GaugeChartOptions) => {\n draft.legend = { ...draft.legend, show: !showLegend };\n })\n );\n }}\n checked={showLegend}\n />\n }\n />\n </OptionsEditorColumn>\n </OptionsEditorGrid>\n );\n}\n"],"names":["Switch","TextField","FormatControls","OptionsEditorColumn","OptionsEditorControl","OptionsEditorGrid","OptionsEditorGroup","ThresholdsEditor","CalculationSelector","produce","merge","DEFAULT_FORMAT","DEFAULT_MAX_PERCENT","DEFAULT_MAX_PERCENT_DECIMAL","GaugeChartOptionsEditorSettings","props","onChange","value","showLegend","legend","show","handleCalculationChange","newCalculation","draft","calculation","handleUnitChange","newFormat","format","maxPlaceholder","unit","toString","handleThresholdsChange","thresholds","title","label","control","type","max","e","newValue","target","Number","undefined","placeholder","checked"],"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,MAAM,EAAEC,SAAS,QAAQ,gBAAgB;AAClD,SACEC,cAAc,EAEdC,mBAAmB,EACnBC,oBAAoB,EACpBC,iBAAiB,EACjBC,kBAAkB,EAElBC,gBAAgB,QACX,yBAAyB;AAChC,SAASC,mBAAmB,QAAkC,4BAA4B;AAC1F,SAASC,OAAO,QAAQ,QAAQ;AAChC,OAAOC,WAAW,eAAe;AAEjC,SACEC,cAAc,EACdC,mBAAmB,EACnBC,2BAA2B,QAGtB,sBAAsB;AAE7B,OAAO,SAASC,gCAAgCC,KAAmC;IACjF,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAC5B;;EAEA,GACA,MAAMG,aAAaD,OAAOE,QAAQC,QAAQ;IAE1C,MAAMC,0BAAgE,CAACC;QACrEN,SACEP,QAAQQ,OAAO,CAACM;YACdA,MAAMC,WAAW,GAAGF;QACtB;IAEJ;IAEA,MAAMG,mBAAoD,CAACC;QACzDV,SACEP,QAAQQ,OAAO,CAACM;YACdA,MAAMI,MAAM,GAA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,"sources":["../../src/GaugeChartOptionsEditorSettings.tsx"],"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 { Switch, TextField } from '@mui/material';\nimport type { FormatControlsProps, ThresholdOptions } from '@perses-dev/components';\nimport {\n FormatControls,\n OptionsEditorColumn,\n OptionsEditorControl,\n OptionsEditorGrid,\n OptionsEditorGroup,\n ThresholdsEditor,\n} from '@perses-dev/components';\nimport type { CalculationSelectorProps } from '@perses-dev/plugin-system';\nimport { CalculationSelector } from '@perses-dev/plugin-system';\nimport { produce } from 'immer';\nimport merge from 'lodash/merge';\nimport type { ReactElement } from 'react';\n\nimport type { GaugeChartOptions, GaugeChartOptionsEditorProps } from './gauge-chart-model';\nimport { DEFAULT_FORMAT, DEFAULT_MAX_PERCENT, DEFAULT_MAX_PERCENT_DECIMAL } from './gauge-chart-model';\n\nexport function GaugeChartOptionsEditorSettings(props: GaugeChartOptionsEditorProps): ReactElement {\n const { onChange, value } = props;\n /* If legend setting doesn't exist (because it is optional), the legend should show by default\n This is for the records before the legend option was added\n */\n const showLegend = value?.legend?.show ?? true;\n\n const handleCalculationChange: CalculationSelectorProps['onChange'] = (newCalculation) => {\n onChange(\n produce(value, (draft: GaugeChartOptions) => {\n draft.calculation = newCalculation;\n }),\n );\n };\n\n const handleUnitChange: FormatControlsProps['onChange'] = (newFormat) => {\n onChange(\n produce(value, (draft: GaugeChartOptions) => {\n draft.format = newFormat;\n }),\n );\n };\n\n // ensures decimalPlaces defaults to correct value\n const format = merge({}, DEFAULT_FORMAT, value.format);\n\n // max only needs to be set explicitly for units other than percent and percent-decimal\n let maxPlaceholder = 'Enter value';\n if (format.unit === 'percent') {\n maxPlaceholder = DEFAULT_MAX_PERCENT.toString();\n } else if (format.unit === 'percent-decimal') {\n maxPlaceholder = DEFAULT_MAX_PERCENT_DECIMAL.toString();\n }\n\n const handleThresholdsChange = (thresholds: ThresholdOptions): void => {\n onChange(\n produce(value, (draft: GaugeChartOptions) => {\n draft.thresholds = thresholds;\n }),\n );\n };\n\n return (\n <OptionsEditorGrid>\n <OptionsEditorColumn>\n <OptionsEditorGroup title=\"Misc\">\n <FormatControls value={format} onChange={handleUnitChange} />\n <CalculationSelector value={value.calculation} onChange={handleCalculationChange} />\n <OptionsEditorControl\n label=\"Max\"\n control={\n <TextField\n type=\"number\"\n value={value.max ?? ''}\n onChange={(e) => {\n // ensure empty value resets to undef to allow chart to calculate max\n const newValue = e.target.value ? Number(e.target.value) : undefined;\n onChange(\n produce(value, (draft: GaugeChartOptions) => {\n draft.max = newValue;\n }),\n );\n }}\n placeholder={maxPlaceholder}\n />\n }\n />\n </OptionsEditorGroup>\n </OptionsEditorColumn>\n <OptionsEditorColumn>\n <ThresholdsEditor thresholds={value.thresholds} onChange={handleThresholdsChange} />\n <OptionsEditorControl\n label=\"Show legend\"\n control={\n <Switch\n onChange={(): void => {\n onChange(\n produce(value, (draft: GaugeChartOptions) => {\n draft.legend = { ...draft.legend, show: !showLegend };\n }),\n );\n }}\n checked={showLegend}\n />\n }\n />\n </OptionsEditorColumn>\n </OptionsEditorGrid>\n );\n}\n"],"names":["Switch","TextField","FormatControls","OptionsEditorColumn","OptionsEditorControl","OptionsEditorGrid","OptionsEditorGroup","ThresholdsEditor","CalculationSelector","produce","merge","DEFAULT_FORMAT","DEFAULT_MAX_PERCENT","DEFAULT_MAX_PERCENT_DECIMAL","GaugeChartOptionsEditorSettings","props","onChange","value","showLegend","legend","show","handleCalculationChange","newCalculation","draft","calculation","handleUnitChange","newFormat","format","maxPlaceholder","unit","toString","handleThresholdsChange","thresholds","title","label","control","type","max","e","newValue","target","Number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B;IAEJ;IAEA,qBACE,MAAC3B;;0BACC,KAACF;0BACC,cAAA,MAACG;oBAAmB2B,OAAM;;sCACxB,KAAC/B;4BAAee,OAAOU;4BAAQX,UAAUS;;sCACzC,KAACjB;4BAAoBS,OAAOA,MAAMO,WAAW;4BAAER,UAAUK;;sCACzD,KAACjB;4BACC8B,OAAM;4BACNC,uBACE,KAAClC;gCACCmC,MAAK;gCACLnB,OAAOA,MAAMoB,GAAG,IAAI;gCACpBrB,UAAU,CAACsB;oCACT,qEAAqE;oCACrE,MAAMC,WAAWD,EAAEE,MAAM,CAACvB,KAAK,GAAGwB,OAAOH,EAAEE,MAAM,CAACvB,KAAK,IAAIyB;oCAC3D1B,SACEP,QAAQQ,OAAO,CAACM;wCACdA,MAAMc,GAAG,GAAGE;oCACd;gCAEJ;gCACAI,aAAaf;;;;;;0BAMvB,MAACzB;;kCACC,KAACI;wBAAiByB,YAAYf,MAAMe,UAAU;wBAAEhB,UAAUe;;kCAC1D,KAAC3B;wBACC8B,OAAM;wBACNC,uBACE,KAACnC;4BACCgB,UAAU;gCACRA,SACEP,QAAQQ,OAAO,CAACM;oCACdA,MAAMJ,MAAM,GAAG;wCAAE,GAAGI,MAAMJ,MAAM;wCAAEC,MAAM,CAACF;oCAAW;gCACtD;4BAEJ;4BACA0B,SAAS1B;;;;;;;AAOvB"}
@@ -1,7 +1,7 @@
1
- import { PanelProps } from '@perses-dev/plugin-system';
2
- import { ReactElement } from 'react';
3
- import { TimeSeriesData } from '@perses-dev/spec';
4
- import { GaugeChartOptions } from './gauge-chart-model';
1
+ import type { PanelProps } from '@perses-dev/plugin-system';
2
+ import type { TimeSeriesData } from '@perses-dev/spec';
3
+ import type { ReactElement } from 'react';
4
+ import type { GaugeChartOptions } from './gauge-chart-model';
5
5
  export type GaugeChartPanelProps = PanelProps<GaugeChartOptions, TimeSeriesData>;
6
6
  export declare function GaugeChartPanel(props: GaugeChartPanelProps): ReactElement | null;
7
7
  export declare function GaugeChartLoading({ contentDimensions }: GaugeChartPanelProps): React.ReactElement | null;
@@ -1 +1 @@
1
- {"version":3,"file":"GaugeChartPanel.d.ts","sourceRoot":"","sources":["../../src/GaugeChartPanel.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAwC,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAG7F,OAAO,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAIL,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAyD7B,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC;AAEjF,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,GAAG,IAAI,CA8HhF;AAED,wBAAgB,iBAAiB,CAAC,EAAE,iBAAiB,EAAE,EAAE,oBAAoB,GAAG,KAAK,CAAC,YAAY,GAAG,IAAI,CAUxG"}
1
+ {"version":3,"file":"GaugeChartPanel.d.ts","sourceRoot":"","sources":["../../src/GaugeChartPanel.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AA2D7D,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC;AAEjF,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,GAAG,IAAI,CA8HhF;AAED,wBAAgB,iBAAiB,CAAC,EAAE,iBAAiB,EAAE,EAAE,oBAAoB,GAAG,KAAK,CAAC,YAAY,GAAG,IAAI,CAUxG"}
@@ -11,14 +11,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
11
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
- import { Box, Skeleton, Stack } from '@mui/material';
15
- import { formatValue, useChartsTheme } from '@perses-dev/components';
16
- import { CalculationsMap, DEFAULT_CALCULATION } from '@perses-dev/plugin-system';
17
- import merge from 'lodash/merge';
18
- import { useMemo } from 'react';
19
- import { DEFAULT_FORMAT, DEFAULT_MAX_PERCENT, DEFAULT_MAX_PERCENT_DECIMAL } from './gauge-chart-model';
20
- import { convertThresholds, defaultThresholdInput } from './thresholds';
21
- import { GaugeChartBase } from './GaugeChartBase';
14
+ import { Box, Skeleton, Stack } from "@mui/material";
15
+ import { formatValue, useChartsTheme } from "@perses-dev/components";
16
+ import { CalculationsMap, DEFAULT_CALCULATION } from "@perses-dev/plugin-system";
17
+ import merge from "lodash/merge";
18
+ import { useMemo } from "react";
19
+ import { DEFAULT_FORMAT, DEFAULT_MAX_PERCENT, DEFAULT_MAX_PERCENT_DECIMAL } from "./gauge-chart-model.js";
20
+ import { GaugeChartBase } from "./GaugeChartBase.js";
21
+ import { convertThresholds, defaultThresholdInput } from "./thresholds.js";
22
22
  const EMPTY_GAUGE_SERIES = {
23
23
  label: '',
24
24
  value: undefined
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/GaugeChartPanel.tsx"],"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 { Box, Skeleton, Stack } from '@mui/material';\nimport { FormatOptions, formatValue, useChartsTheme } from '@perses-dev/components';\nimport { CalculationsMap, DEFAULT_CALCULATION, PanelProps } from '@perses-dev/plugin-system';\nimport type { GaugeSeriesOption } from 'echarts';\nimport merge from 'lodash/merge';\nimport { ReactElement, useMemo } from 'react';\nimport { TimeSeriesData } from '@perses-dev/spec';\nimport {\n DEFAULT_FORMAT,\n DEFAULT_MAX_PERCENT,\n DEFAULT_MAX_PERCENT_DECIMAL,\n GaugeChartOptions,\n} from './gauge-chart-model';\nimport { convertThresholds, defaultThresholdInput } from './thresholds';\nimport { GaugeChartBase, GaugeSeries } from './GaugeChartBase';\n\nconst EMPTY_GAUGE_SERIES: GaugeSeries = { label: '', value: undefined };\nconst GAUGE_MIN_WIDTH = 90;\nconst PANEL_PADDING_OFFSET = 20;\n\n/**\n * Calculate responsive progress width based on panel dimensions\n */\nfunction getResponsiveProgressWidth(width: number, height: number): number {\n const MIN_WIDTH = 10;\n const MAX_WIDTH = 48;\n const RATIO = 0.1; // 10% of the smaller dimension\n\n const minSize = Math.min(width, height);\n // Use RATIO of the smaller dimension as base, with reasonable min/max bounds\n return Math.max(MIN_WIDTH, Math.min(MAX_WIDTH, Math.round(minSize * RATIO)));\n}\n\n/**\n * Responsive font size depending on number of characters and panel dimensions.\n * Uses clamp to ensure the text never overflows and scales appropriately with panel size.\n * (Value refers to the main number value displayed inside the gauge)\n */\nfunction getResponsiveValueFontSize(\n value: number | null,\n format: FormatOptions,\n width: number,\n height: number\n): string {\n const MIN_SIZE = 8;\n const MAX_SIZE = 64;\n const formattedValue = typeof value === 'number' ? formatValue(value, format) : `${value}`;\n\n const valueTextLength = Math.max(formattedValue.length, 6); // Ensure a minimum length to avoid overly large text for short values\n const availableSpace = Math.min(width, height);\n const fontSize = availableSpace / valueTextLength;\n\n return `clamp(${MIN_SIZE}px, ${fontSize}px, ${MAX_SIZE}px)`;\n}\n\n/**\n * Calculate responsive title font size based on panel dimensions\n * (Title refers to the text displayed below the gauge as a legend)\n */\nfunction getResponsiveTitleFontSize(width: number, height: number): number {\n const MIN_SIZE = 10;\n const MAX_SIZE = 16;\n const RATIO = 0.06; // Use 6% of the smaller dimension as base\n\n const size = Math.round(Math.min(width, height) * RATIO);\n // Scale based on panel size, with reasonable min/max bounds\n return Math.max(MIN_SIZE, Math.min(MAX_SIZE, size));\n}\n\nexport type GaugeChartPanelProps = PanelProps<GaugeChartOptions, TimeSeriesData>;\n\nexport function GaugeChartPanel(props: GaugeChartPanelProps): ReactElement | null {\n const { spec: pluginSpec, contentDimensions, queryResults } = props;\n const { calculation, max, legend } = pluginSpec;\n\n const { thresholds: thresholdsColors } = useChartsTheme();\n\n /* Legend setting just added to the cue schema\n This line assures that if legend setting doesn't exist (for old gauge setting records),\n The legend shows normally as before. If it exists, then it checks the show property.\n */\n const showLegend = legend?.show ?? true;\n\n // ensures all default format properties set if undef\n const format = merge({}, DEFAULT_FORMAT, pluginSpec.format);\n\n const thresholds = pluginSpec.thresholds ?? defaultThresholdInput;\n\n const gaugeData = useMemo((): GaugeSeries[] => {\n const seriesData: GaugeSeries[] = [];\n\n if (!CalculationsMap[calculation]) {\n console.warn(`Invalid GaugeChart panel calculation ${calculation}, fallback to ${DEFAULT_CALCULATION}`);\n }\n\n const calculate = CalculationsMap[calculation] ?? CalculationsMap[DEFAULT_CALCULATION];\n\n for (const result of queryResults) {\n for (const timeSeries of result.data.series) {\n seriesData.push({\n value: calculate(timeSeries.values),\n label: showLegend ? (timeSeries.formattedName ?? '') : '',\n });\n }\n }\n return seriesData;\n }, [queryResults, calculation, showLegend]);\n\n if (!contentDimensions) return null;\n\n // needed for end value of last threshold color segment\n let thresholdMax = max;\n if (thresholdMax === undefined) {\n thresholdMax = format.unit === 'percent' ? DEFAULT_MAX_PERCENT : DEFAULT_MAX_PERCENT_DECIMAL;\n }\n const axisLineColors = convertThresholds(thresholds, format, thresholdMax, thresholdsColors);\n\n // accounts for showing a separate chart for each time series\n let chartWidth = contentDimensions.width / gaugeData.length - PANEL_PADDING_OFFSET;\n if (chartWidth < GAUGE_MIN_WIDTH && gaugeData.length > 1) {\n // enables horizontal scroll when charts overflow outside of panel\n chartWidth = GAUGE_MIN_WIDTH;\n }\n\n // Calculate responsive values based on chart dimensions\n const progressWidth = getResponsiveProgressWidth(chartWidth, contentDimensions.height);\n const axisLineWidth = Math.round(progressWidth * 0.2); // Axis line width is 20% of progress width\n const titleFontSize = getResponsiveTitleFontSize(chartWidth, contentDimensions.height);\n\n const axisLine: GaugeSeriesOption['axisLine'] = {\n show: true,\n lineStyle: {\n width: axisLineWidth,\n color: axisLineColors,\n },\n };\n\n // no data message handled inside chart component\n if (!gaugeData.length) {\n const emptyValueFontSize = getResponsiveValueFontSize(\n null,\n format,\n contentDimensions.width,\n contentDimensions.height\n );\n const emptyProgressWidth = getResponsiveProgressWidth(contentDimensions.width, contentDimensions.height);\n const emptyTitleFontSize = getResponsiveTitleFontSize(contentDimensions.width, contentDimensions.height);\n\n return (\n <GaugeChartBase\n width={contentDimensions.width}\n height={contentDimensions.height}\n data={EMPTY_GAUGE_SERIES}\n format={format}\n axisLine={axisLine}\n max={thresholdMax}\n valueFontSize={emptyValueFontSize}\n progressWidth={emptyProgressWidth}\n titleFontSize={emptyTitleFontSize}\n />\n );\n }\n\n const hasMultipleCharts = gaugeData.length > 1;\n\n return (\n <Stack\n direction=\"row\"\n spacing={hasMultipleCharts ? 2 : 0}\n justifyContent={hasMultipleCharts ? 'left' : 'center'}\n alignItems=\"center\"\n sx={{\n // so scrollbar only shows when necessary\n overflowX: gaugeData.length > 1 ? 'scroll' : 'auto',\n }}\n >\n {gaugeData.map((series, seriesIndex) => {\n const fontSize = getResponsiveValueFontSize(series.value ?? null, format, chartWidth, contentDimensions.height);\n\n return (\n <Box key={`gauge-series-${seriesIndex}`}>\n <GaugeChartBase\n width={chartWidth}\n height={contentDimensions.height}\n data={series}\n format={format}\n axisLine={axisLine}\n max={thresholdMax}\n valueFontSize={fontSize}\n progressWidth={progressWidth}\n titleFontSize={titleFontSize}\n />\n </Box>\n );\n })}\n </Stack>\n );\n}\n\nexport function GaugeChartLoading({ contentDimensions }: GaugeChartPanelProps): React.ReactElement | null {\n if (!contentDimensions) return null;\n return (\n <Skeleton\n sx={{ margin: '0 auto' }}\n variant=\"circular\"\n width={contentDimensions.width > contentDimensions.height ? contentDimensions.height : contentDimensions.width}\n height={contentDimensions.height}\n />\n );\n}\n"],"names":["Box","Skeleton","Stack","formatValue","useChartsTheme","CalculationsMap","DEFAULT_CALCULATION","merge","useMemo","DEFAULT_FORMAT","DEFAULT_MAX_PERCENT","DEFAULT_MAX_PERCENT_DECIMAL","convertThresholds","defaultThresholdInput","GaugeChartBase","EMPTY_GAUGE_SERIES","label","value","undefined","GAUGE_MIN_WIDTH","PANEL_PADDING_OFFSET","getResponsiveProgressWidth","width","height","MIN_WIDTH","MAX_WIDTH","RATIO","minSize","Math","min","max","round","getResponsiveValueFontSize","format","MIN_SIZE","MAX_SIZE","formattedValue","valueTextLength","length","availableSpace","fontSize","getResponsiveTitleFontSize","size","GaugeChartPanel","props","spec","pluginSpec","contentDimensions","queryResults","calculation","legend","thresholds","thresholdsColors","showLegend","show","gaugeData","seriesData","console","warn","calculate","result","timeSeries","data","series","push","values","formattedName","thresholdMax","unit","axisLineColors","chartWidth","progressWidth","axisLineWidth","titleFontSize","axisLine","lineStyle","color","emptyValueFontSize","emptyProgressWidth","emptyTitleFontSize","valueFontSize","hasMultipleCharts","direction","spacing","justifyContent","alignItems","sx","overflowX","map","seriesIndex","GaugeChartLoading","margin","variant"],"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,GAAG,EAAEC,QAAQ,EAAEC,KAAK,QAAQ,gBAAgB;AACrD,SAAwBC,WAAW,EAAEC,cAAc,QAAQ,yBAAyB;AACpF,SAASC,eAAe,EAAEC,mBAAmB,QAAoB,4BAA4B;AA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,WAAW;QAC/C;kBAECiB,UAAUiC,GAAG,CAAC,CAACzB,QAAQ0B;YACtB,MAAMjD,WAAWR,2BAA2B+B,OAAO9C,KAAK,IAAI,MAAMgB,QAAQqC,YAAYvB,kBAAkBxB,MAAM;YAE9G,qBACE,KAACvB;0BACC,cAAA,KAACc;oBACCQ,OAAOgD;oBACP/C,QAAQwB,kBAAkBxB,MAAM;oBAChCuC,MAAMC;oBACN9B,QAAQA;oBACRyC,UAAUA;oBACV5C,KAAKqC;oBACLa,eAAexC;oBACf+B,eAAeA;oBACfE,eAAeA;;eAVT,CAAC,aAAa,EAAEgB,aAAa;QAc3C;;AAGN;AAEA,OAAO,SAASC,kBAAkB,EAAE3C,iBAAiB,EAAwB;IAC3E,IAAI,CAACA,mBAAmB,OAAO;IAC/B,qBACE,KAAC9C;QACCqF,IAAI;YAAEK,QAAQ;QAAS;QACvBC,SAAQ;QACRtE,OAAOyB,kBAAkBzB,KAAK,GAAGyB,kBAAkBxB,MAAM,GAAGwB,kBAAkBxB,MAAM,GAAGwB,kBAAkBzB,KAAK;QAC9GC,QAAQwB,kBAAkBxB,MAAM;;AAGtC"}
1
+ {"version":3,"sources":["../../src/GaugeChartPanel.tsx"],"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 { Box, Skeleton, Stack } from '@mui/material';\nimport type { FormatOptions } from '@perses-dev/components';\nimport { formatValue, useChartsTheme } from '@perses-dev/components';\nimport type { PanelProps } from '@perses-dev/plugin-system';\nimport { CalculationsMap, DEFAULT_CALCULATION } from '@perses-dev/plugin-system';\nimport type { TimeSeriesData } from '@perses-dev/spec';\nimport type { GaugeSeriesOption } from 'echarts';\nimport merge from 'lodash/merge';\nimport type { ReactElement } from 'react';\nimport { useMemo } from 'react';\n\nimport type { GaugeChartOptions } from './gauge-chart-model';\nimport { DEFAULT_FORMAT, DEFAULT_MAX_PERCENT, DEFAULT_MAX_PERCENT_DECIMAL } from './gauge-chart-model';\nimport type { GaugeSeries } from './GaugeChartBase';\nimport { GaugeChartBase } from './GaugeChartBase';\nimport { convertThresholds, defaultThresholdInput } from './thresholds';\n\nconst EMPTY_GAUGE_SERIES: GaugeSeries = { label: '', value: undefined };\nconst GAUGE_MIN_WIDTH = 90;\nconst PANEL_PADDING_OFFSET = 20;\n\n/**\n * Calculate responsive progress width based on panel dimensions\n */\nfunction getResponsiveProgressWidth(width: number, height: number): number {\n const MIN_WIDTH = 10;\n const MAX_WIDTH = 48;\n const RATIO = 0.1; // 10% of the smaller dimension\n\n const minSize = Math.min(width, height);\n // Use RATIO of the smaller dimension as base, with reasonable min/max bounds\n return Math.max(MIN_WIDTH, Math.min(MAX_WIDTH, Math.round(minSize * RATIO)));\n}\n\n/**\n * Responsive font size depending on number of characters and panel dimensions.\n * Uses clamp to ensure the text never overflows and scales appropriately with panel size.\n * (Value refers to the main number value displayed inside the gauge)\n */\nfunction getResponsiveValueFontSize(\n value: number | null,\n format: FormatOptions,\n width: number,\n height: number,\n): string {\n const MIN_SIZE = 8;\n const MAX_SIZE = 64;\n const formattedValue = typeof value === 'number' ? formatValue(value, format) : `${value}`;\n\n const valueTextLength = Math.max(formattedValue.length, 6); // Ensure a minimum length to avoid overly large text for short values\n const availableSpace = Math.min(width, height);\n const fontSize = availableSpace / valueTextLength;\n\n return `clamp(${MIN_SIZE}px, ${fontSize}px, ${MAX_SIZE}px)`;\n}\n\n/**\n * Calculate responsive title font size based on panel dimensions\n * (Title refers to the text displayed below the gauge as a legend)\n */\nfunction getResponsiveTitleFontSize(width: number, height: number): number {\n const MIN_SIZE = 10;\n const MAX_SIZE = 16;\n const RATIO = 0.06; // Use 6% of the smaller dimension as base\n\n const size = Math.round(Math.min(width, height) * RATIO);\n // Scale based on panel size, with reasonable min/max bounds\n return Math.max(MIN_SIZE, Math.min(MAX_SIZE, size));\n}\n\nexport type GaugeChartPanelProps = PanelProps<GaugeChartOptions, TimeSeriesData>;\n\nexport function GaugeChartPanel(props: GaugeChartPanelProps): ReactElement | null {\n const { spec: pluginSpec, contentDimensions, queryResults } = props;\n const { calculation, max, legend } = pluginSpec;\n\n const { thresholds: thresholdsColors } = useChartsTheme();\n\n /* Legend setting just added to the cue schema\n This line assures that if legend setting doesn't exist (for old gauge setting records),\n The legend shows normally as before. If it exists, then it checks the show property.\n */\n const showLegend = legend?.show ?? true;\n\n // ensures all default format properties set if undef\n const format = merge({}, DEFAULT_FORMAT, pluginSpec.format);\n\n const thresholds = pluginSpec.thresholds ?? defaultThresholdInput;\n\n const gaugeData = useMemo((): GaugeSeries[] => {\n const seriesData: GaugeSeries[] = [];\n\n if (!CalculationsMap[calculation]) {\n console.warn(`Invalid GaugeChart panel calculation ${calculation}, fallback to ${DEFAULT_CALCULATION}`);\n }\n\n const calculate = CalculationsMap[calculation] ?? CalculationsMap[DEFAULT_CALCULATION];\n\n for (const result of queryResults) {\n for (const timeSeries of result.data.series) {\n seriesData.push({\n value: calculate(timeSeries.values),\n label: showLegend ? (timeSeries.formattedName ?? '') : '',\n });\n }\n }\n return seriesData;\n }, [queryResults, calculation, showLegend]);\n\n if (!contentDimensions) return null;\n\n // needed for end value of last threshold color segment\n let thresholdMax = max;\n if (thresholdMax === undefined) {\n thresholdMax = format.unit === 'percent' ? DEFAULT_MAX_PERCENT : DEFAULT_MAX_PERCENT_DECIMAL;\n }\n const axisLineColors = convertThresholds(thresholds, format, thresholdMax, thresholdsColors);\n\n // accounts for showing a separate chart for each time series\n let chartWidth = contentDimensions.width / gaugeData.length - PANEL_PADDING_OFFSET;\n if (chartWidth < GAUGE_MIN_WIDTH && gaugeData.length > 1) {\n // enables horizontal scroll when charts overflow outside of panel\n chartWidth = GAUGE_MIN_WIDTH;\n }\n\n // Calculate responsive values based on chart dimensions\n const progressWidth = getResponsiveProgressWidth(chartWidth, contentDimensions.height);\n const axisLineWidth = Math.round(progressWidth * 0.2); // Axis line width is 20% of progress width\n const titleFontSize = getResponsiveTitleFontSize(chartWidth, contentDimensions.height);\n\n const axisLine: GaugeSeriesOption['axisLine'] = {\n show: true,\n lineStyle: {\n width: axisLineWidth,\n color: axisLineColors,\n },\n };\n\n // no data message handled inside chart component\n if (!gaugeData.length) {\n const emptyValueFontSize = getResponsiveValueFontSize(\n null,\n format,\n contentDimensions.width,\n contentDimensions.height,\n );\n const emptyProgressWidth = getResponsiveProgressWidth(contentDimensions.width, contentDimensions.height);\n const emptyTitleFontSize = getResponsiveTitleFontSize(contentDimensions.width, contentDimensions.height);\n\n return (\n <GaugeChartBase\n width={contentDimensions.width}\n height={contentDimensions.height}\n data={EMPTY_GAUGE_SERIES}\n format={format}\n axisLine={axisLine}\n max={thresholdMax}\n valueFontSize={emptyValueFontSize}\n progressWidth={emptyProgressWidth}\n titleFontSize={emptyTitleFontSize}\n />\n );\n }\n\n const hasMultipleCharts = gaugeData.length > 1;\n\n return (\n <Stack\n direction=\"row\"\n spacing={hasMultipleCharts ? 2 : 0}\n justifyContent={hasMultipleCharts ? 'left' : 'center'}\n alignItems=\"center\"\n sx={{\n // so scrollbar only shows when necessary\n overflowX: gaugeData.length > 1 ? 'scroll' : 'auto',\n }}\n >\n {gaugeData.map((series, seriesIndex) => {\n const fontSize = getResponsiveValueFontSize(series.value ?? null, format, chartWidth, contentDimensions.height);\n\n return (\n <Box key={`gauge-series-${seriesIndex}`}>\n <GaugeChartBase\n width={chartWidth}\n height={contentDimensions.height}\n data={series}\n format={format}\n axisLine={axisLine}\n max={thresholdMax}\n valueFontSize={fontSize}\n progressWidth={progressWidth}\n titleFontSize={titleFontSize}\n />\n </Box>\n );\n })}\n </Stack>\n );\n}\n\nexport function GaugeChartLoading({ contentDimensions }: GaugeChartPanelProps): React.ReactElement | null {\n if (!contentDimensions) return null;\n return (\n <Skeleton\n sx={{ margin: '0 auto' }}\n variant=\"circular\"\n width={contentDimensions.width > contentDimensions.height ? contentDimensions.height : contentDimensions.width}\n height={contentDimensions.height}\n />\n );\n}\n"],"names":["Box","Skeleton","Stack","formatValue","useChartsTheme","CalculationsMap","DEFAULT_CALCULATION","merge","useMemo","DEFAULT_FORMAT","DEFAULT_MAX_PERCENT","DEFAULT_MAX_PERCENT_DECIMAL","GaugeChartBase","convertThresholds","defaultThresholdInput","EMPTY_GAUGE_SERIES","label","value","undefined","GAUGE_MIN_WIDTH","PANEL_PADDING_OFFSET","getResponsiveProgressWidth","width","height","MIN_WIDTH","MAX_WIDTH","RATIO","minSize","Math","min","max","round","getResponsiveValueFontSize","format","MIN_SIZE","MAX_SIZE","formattedValue","valueTextLength","length","availableSpace","fontSize","getResponsiveTitleFontSize","size","GaugeChartPanel","props","spec","pluginSpec","contentDimensions","queryResults","calculation","legend","thresholds","thresholdsColors","showLegend","show","gaugeData","seriesData","console","warn","calculate","result","timeSeries","data","series","push","values","formattedName","thresholdMax","unit","axisLineColors","chartWidth","progressWidth","axisLineWidth","titleFontSize","axisLine","lineStyle","color","emptyValueFontSize","emptyProgressWidth","emptyTitleFontSize","valueFontSize","hasMultipleCharts","direction","spacing","justifyContent","alignItems","sx","overflowX","map","seriesIndex","GaugeChartLoading","margin","variant"],"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,GAAG,EAAEC,QAAQ,EAAEC,KAAK,QAAQ,gBAAgB;AAErD,SAASC,WAAW,EAAEC,cAAc,QAAQ,yBAAyB;AAErE,SAASC,eAAe,EAAEC,mBAAmB,QAAQ,4BAA4B;AAGjF,OAAOC,WAAW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AECiB,UAAUiC,GAAG,CAAC,CAACzB,QAAQ0B;YACtB,MAAMjD,WAAWR,2BAA2B+B,OAAO9C,KAAK,IAAI,MAAMgB,QAAQqC,YAAYvB,kBAAkBxB,MAAM;YAE9G,qBACE,KAACvB;0BACC,cAAA,KAACY;oBACCU,OAAOgD;oBACP/C,QAAQwB,kBAAkBxB,MAAM;oBAChCuC,MAAMC;oBACN9B,QAAQA;oBACRyC,UAAUA;oBACV5C,KAAKqC;oBACLa,eAAexC;oBACf+B,eAAeA;oBACfE,eAAeA;;eAVT,CAAC,aAAa,EAAEgB,aAAa;QAc3C;;AAGN;AAEA,OAAO,SAASC,kBAAkB,EAAE3C,iBAAiB,EAAwB;IAC3E,IAAI,CAACA,mBAAmB,OAAO;IAC/B,qBACE,KAAC9C;QACCqF,IAAI;YAAEK,QAAQ;QAAS;QACvBC,SAAQ;QACRtE,OAAOyB,kBAAkBzB,KAAK,GAAGyB,kBAAkBxB,MAAM,GAAGwB,kBAAkBxB,MAAM,GAAGwB,kBAAkBzB,KAAK;QAC9GC,QAAQwB,kBAAkBxB,MAAM;;AAGtC"}
package/lib/bootstrap.js CHANGED
@@ -11,8 +11,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
11
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
- import React from 'react';
15
- import ReactDOM from 'react-dom/client';
14
+ import React from "react";
15
+ import ReactDOM from "react-dom/client";
16
16
  const root = ReactDOM.createRoot(document.getElementById('root'));
17
17
  root.render(/*#__PURE__*/ _jsx(React.StrictMode, {}));
18
18
 
@@ -1,6 +1,6 @@
1
- import { FormatOptions, ThresholdOptions } from '@perses-dev/components';
2
- import { CalculationType, OptionsEditorProps } from '@perses-dev/plugin-system';
3
- import { Definition } from '@perses-dev/spec';
1
+ import type { FormatOptions, ThresholdOptions } from '@perses-dev/components';
2
+ import type { CalculationType, OptionsEditorProps } from '@perses-dev/plugin-system';
3
+ import type { Definition } from '@perses-dev/spec';
4
4
  export declare const DEFAULT_FORMAT: FormatOptions;
5
5
  export declare const DEFAULT_MAX_PERCENT = 100;
6
6
  export declare const DEFAULT_MAX_PERCENT_DECIMAL = 1;
@@ -1 +1 @@
1
- {"version":3,"file":"gauge-chart-model.d.ts","sourceRoot":"","sources":["../../src/gauge-chart-model.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,eAAO,MAAM,cAAc,EAAE,aAA2C,CAAC;AACzE,eAAO,MAAM,mBAAmB,MAAM,CAAC;AACvC,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,UAAU,CAAC,iBAAiB,CAAC;IACzE,IAAI,EAAE,YAAY,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,eAAe,CAAC;IAC7B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CAC7B;AAED,MAAM,MAAM,4BAA4B,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;AAEjF;;GAEG;AACH,wBAAgB,8BAA8B,IAAI,iBAAiB,CAelE"}
1
+ {"version":3,"file":"gauge-chart-model.d.ts","sourceRoot":"","sources":["../../src/gauge-chart-model.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACrF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,eAAO,MAAM,cAAc,EAAE,aAA2C,CAAC;AACzE,eAAO,MAAM,mBAAmB,MAAM,CAAC;AACvC,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,UAAU,CAAC,iBAAiB,CAAC;IACzE,IAAI,EAAE,YAAY,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,eAAe,CAAC;IAC7B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CAC7B;AAED,MAAM,MAAM,4BAA4B,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;AAEjF;;GAEG;AACH,wBAAgB,8BAA8B,IAAI,iBAAiB,CAelE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/gauge-chart-model.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 { FormatOptions, ThresholdOptions } from '@perses-dev/components';\nimport { CalculationType, OptionsEditorProps } from '@perses-dev/plugin-system';\nimport { Definition } from '@perses-dev/spec';\n\nexport const DEFAULT_FORMAT: FormatOptions = { unit: 'percent-decimal' };\nexport const DEFAULT_MAX_PERCENT = 100;\nexport const DEFAULT_MAX_PERCENT_DECIMAL = 1;\n\n/**\n * The schema for a GaugeChart panel.\n */\nexport interface GaugeChartDefinition extends Definition<GaugeChartOptions> {\n kind: 'GaugeChart';\n}\n\n/**\n * The Options object type supported by the GaugeChart panel plugin.\n */\nexport interface GaugeChartOptions {\n calculation: CalculationType;\n format?: FormatOptions;\n thresholds?: ThresholdOptions;\n max?: number;\n legend?: { show?: boolean };\n}\n\nexport type GaugeChartOptionsEditorProps = OptionsEditorProps<GaugeChartOptions>;\n\n/**\n * Creates the initial/empty options for a GaugeChart panel.\n */\nexport function createInitialGaugeChartOptions(): GaugeChartOptions {\n return {\n calculation: 'last-number',\n format: DEFAULT_FORMAT,\n thresholds: {\n steps: [\n {\n value: 0.8,\n },\n {\n value: 0.9,\n },\n ],\n },\n };\n}\n"],"names":["DEFAULT_FORMAT","unit","DEFAULT_MAX_PERCENT","DEFAULT_MAX_PERCENT_DECIMAL","createInitialGaugeChartOptions","calculation","format","thresholds","steps","value"],"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;AAMjC,OAAO,MAAMA,iBAAgC;IAAEC,MAAM;AAAkB,EAAE;AACzE,OAAO,MAAMC,sBAAsB,IAAI;AACvC,OAAO,MAAMC,8BAA8B,EAAE;AAsB7C;;CAEC,GACD,OAAO,SAASC;IACd,OAAO;QACLC,aAAa;QACbC,QAAQN;QACRO,YAAY;YACVC,OAAO;gBACL;oBACEC,OAAO;gBACT;gBACA;oBACEA,OAAO;gBACT;aACD;QACH;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/gauge-chart-model.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 type { FormatOptions, ThresholdOptions } from '@perses-dev/components';\nimport type { CalculationType, OptionsEditorProps } from '@perses-dev/plugin-system';\nimport type { Definition } from '@perses-dev/spec';\n\nexport const DEFAULT_FORMAT: FormatOptions = { unit: 'percent-decimal' };\nexport const DEFAULT_MAX_PERCENT = 100;\nexport const DEFAULT_MAX_PERCENT_DECIMAL = 1;\n\n/**\n * The schema for a GaugeChart panel.\n */\nexport interface GaugeChartDefinition extends Definition<GaugeChartOptions> {\n kind: 'GaugeChart';\n}\n\n/**\n * The Options object type supported by the GaugeChart panel plugin.\n */\nexport interface GaugeChartOptions {\n calculation: CalculationType;\n format?: FormatOptions;\n thresholds?: ThresholdOptions;\n max?: number;\n legend?: { show?: boolean };\n}\n\nexport type GaugeChartOptionsEditorProps = OptionsEditorProps<GaugeChartOptions>;\n\n/**\n * Creates the initial/empty options for a GaugeChart panel.\n */\nexport function createInitialGaugeChartOptions(): GaugeChartOptions {\n return {\n calculation: 'last-number',\n format: DEFAULT_FORMAT,\n thresholds: {\n steps: [\n {\n value: 0.8,\n },\n {\n value: 0.9,\n },\n ],\n },\n };\n}\n"],"names":["DEFAULT_FORMAT","unit","DEFAULT_MAX_PERCENT","DEFAULT_MAX_PERCENT_DECIMAL","createInitialGaugeChartOptions","calculation","format","thresholds","steps","value"],"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;AAMjC,OAAO,MAAMA,iBAAgC;IAAEC,MAAM;AAAkB,EAAE;AACzE,OAAO,MAAMC,sBAAsB,IAAI;AACvC,OAAO,MAAMC,8BAA8B,EAAE;AAsB7C;;CAEC,GACD,OAAO,SAASC;IACd,OAAO;QACLC,aAAa;QACbC,QAAQN;QACRO,YAAY;YACVC,OAAO;gBACL;oBACEC,OAAO;gBACT;gBACA;oBACEA,OAAO;gBACT;aACD;QACH;IACF;AACF"}
@@ -1,4 +1,4 @@
1
- import { PluginModuleResource } from '@perses-dev/plugin-system';
1
+ import type { PluginModuleResource } from '@perses-dev/plugin-system';
2
2
  /**
3
3
  * Returns the plugin module information from package.json
4
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"getPluginModule.d.ts","sourceRoot":"","sources":["../../src/getPluginModule.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,oBAAoB,EAAoB,MAAM,2BAA2B,CAAC;AAGnF;;GAEG;AACH,wBAAgB,eAAe,IAAI,oBAAoB,CAUtD"}
1
+ {"version":3,"file":"getPluginModule.d.ts","sourceRoot":"","sources":["../../src/getPluginModule.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,oBAAoB,EAAoB,MAAM,2BAA2B,CAAC;AAIxF;;GAEG;AACH,wBAAgB,eAAe,IAAI,oBAAoB,CAUtD"}
@@ -10,7 +10,9 @@
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 packageJson from '../package.json';
13
+ import packageJson from "../package.json" with {
14
+ type: 'json'
15
+ };
14
16
  /**
15
17
  * Returns the plugin module information from package.json
16
18
  */ export function getPluginModule() {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/getPluginModule.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 { PluginModuleResource, PluginModuleSpec } from '@perses-dev/plugin-system';\nimport packageJson from '../package.json';\n\n/**\n * Returns the plugin module information from package.json\n */\nexport function getPluginModule(): PluginModuleResource {\n const { name, version, perses } = packageJson;\n return {\n kind: 'PluginModule',\n metadata: {\n name,\n version,\n },\n spec: perses as PluginModuleSpec,\n };\n}\n"],"names":["packageJson","getPluginModule","name","version","perses","kind","metadata","spec"],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,OAAOA,iBAAiB,kBAAkB;AAE1C;;CAEC,GACD,OAAO,SAASC;IACd,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGJ;IAClC,OAAO;QACLK,MAAM;QACNC,UAAU;YACRJ;YACAC;QACF;QACAI,MAAMH;IACR;AACF"}
1
+ {"version":3,"sources":["../../src/getPluginModule.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 type { PluginModuleResource, PluginModuleSpec } from '@perses-dev/plugin-system';\n\nimport packageJson from '../package.json' with { type: 'json' };\n\n/**\n * Returns the plugin module information from package.json\n */\nexport function getPluginModule(): PluginModuleResource {\n const { name, version, perses } = packageJson;\n return {\n kind: 'PluginModule',\n metadata: {\n name,\n version,\n },\n spec: perses as PluginModuleSpec,\n };\n}\n"],"names":["packageJson","type","getPluginModule","name","version","perses","kind","metadata","spec"],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAOA,iBAAiB,uBAAuB;IAAEC,MAAM;AAAO,EAAE;AAEhE;;CAEC,GACD,OAAO,SAASC;IACd,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGL;IAClC,OAAO;QACLM,MAAM;QACNC,UAAU;YACRJ;YACAC;QACF;QACAI,MAAMH;IACR;AACF"}
@@ -10,6 +10,6 @@
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('./bootstrap');
13
+ import("./bootstrap.js");
14
14
 
15
15
  //# sourceMappingURL=index-federation.js.map
package/lib/index.js CHANGED
@@ -10,11 +10,11 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- export * from './gauge-chart-model';
14
- export * from './GaugeChart';
15
- export * from './GaugeChartOptionsEditorSettings';
16
- export * from './GaugeChartPanel';
17
- export { getPluginModule } from './getPluginModule';
18
- export * from './thresholds';
13
+ export * from "./gauge-chart-model.js";
14
+ export * from "./GaugeChart.js";
15
+ export * from "./GaugeChartOptionsEditorSettings.js";
16
+ export * from "./GaugeChartPanel.js";
17
+ export { getPluginModule } from "./getPluginModule.js";
18
+ export * from "./thresholds.js";
19
19
 
20
20
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/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 './gauge-chart-model';\nexport * from './GaugeChart';\nexport * from './GaugeChartOptionsEditorSettings';\nexport * from './GaugeChartPanel';\nexport { getPluginModule } from './getPluginModule';\nexport * from './thresholds';\n"],"names":["getPluginModule"],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,sBAAsB;AACpC,cAAc,eAAe;AAC7B,cAAc,oCAAoC;AAClD,cAAc,oBAAoB;AAClC,SAASA,eAAe,QAAQ,oBAAoB;AACpD,cAAc,eAAe"}
1
+ {"version":3,"sources":["../../src/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 './gauge-chart-model';\nexport * from './GaugeChart';\nexport * from './GaugeChartOptionsEditorSettings';\nexport * from './GaugeChartPanel';\nexport { getPluginModule } from './getPluginModule';\nexport * from './thresholds';\n"],"names":["getPluginModule"],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,yBAAsB;AACpC,cAAc,kBAAe;AAC7B,cAAc,uCAAoC;AAClD,cAAc,uBAAoB;AAClC,SAASA,eAAe,QAAQ,uBAAoB;AACpD,cAAc,kBAAe"}
@@ -1,2 +1,2 @@
1
- import '@testing-library/jest-dom';
1
+ import '@testing-library/jest-dom/vitest';
2
2
  //# sourceMappingURL=setup-tests.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setup-tests.d.ts","sourceRoot":"","sources":["../../src/setup-tests.ts"],"names":[],"mappings":"AAaA,OAAO,2BAA2B,CAAC"}
1
+ {"version":3,"file":"setup-tests.d.ts","sourceRoot":"","sources":["../../src/setup-tests.ts"],"names":[],"mappings":"AAaA,OAAO,kCAAkC,CAAC"}
@@ -10,8 +10,8 @@
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 '@testing-library/jest-dom';
13
+ import "@testing-library/jest-dom/vitest";
14
14
  // Always mock e-charts during tests since we don't have a proper canvas in jsdom
15
- jest.mock('echarts/core');
15
+ vi.mock('echarts/core');
16
16
 
17
17
  //# sourceMappingURL=setup-tests.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/setup-tests.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 '@testing-library/jest-dom';\n\n// Always mock e-charts during tests since we don't have a proper canvas in jsdom\njest.mock('echarts/core');\n"],"names":["jest","mock"],"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;AAEnC,iFAAiF;AACjFA,KAAKC,IAAI,CAAC"}
1
+ {"version":3,"sources":["../../src/setup-tests.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 '@testing-library/jest-dom/vitest';\n\n// Always mock e-charts during tests since we don't have a proper canvas in jsdom\nvi.mock('echarts/core');\n"],"names":["vi","mock"],"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,mCAAmC;AAE1C,iFAAiF;AACjFA,GAAGC,IAAI,CAAC"}
@@ -1,4 +1,4 @@
1
- import { FormatOptions, ThresholdColorPalette, ThresholdOptions } from '@perses-dev/components';
1
+ import type { FormatOptions, ThresholdColorPalette, ThresholdOptions } from '@perses-dev/components';
2
2
  export type GaugeColorStop = [number, string];
3
3
  export type EChartsAxisLineColors = GaugeColorStop[];
4
4
  export declare const defaultThresholdInput: ThresholdOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"thresholds.d.ts","sourceRoot":"","sources":["../../src/thresholds.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAe,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG7G,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE9C,MAAM,MAAM,qBAAqB,GAAG,cAAc,EAAE,CAAC;AAErD,eAAO,MAAM,qBAAqB,EAAE,gBAA4C,CAAC;AAEjF,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,gBAAgB,EAC5B,IAAI,EAAE,aAAa,EACnB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,qBAAqB,GAC7B,qBAAqB,CA4BvB"}
1
+ {"version":3,"file":"thresholds.d.ts","sourceRoot":"","sources":["../../src/thresholds.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAe,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAGlH,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE9C,MAAM,MAAM,qBAAqB,GAAG,cAAc,EAAE,CAAC;AAErD,eAAO,MAAM,qBAAqB,EAAE,gBAA4C,CAAC;AAEjF,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,gBAAgB,EAC5B,IAAI,EAAE,aAAa,EACnB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,qBAAqB,GAC7B,qBAAqB,CA4BvB"}
package/lib/thresholds.js CHANGED
@@ -10,7 +10,7 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import zip from 'lodash/zip';
13
+ import zip from "lodash/zip";
14
14
  export const defaultThresholdInput = {
15
15
  steps: [
16
16
  {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/thresholds.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 { FormatOptions, StepOptions, ThresholdColorPalette, ThresholdOptions } from '@perses-dev/components';\nimport zip from 'lodash/zip';\n\nexport type GaugeColorStop = [number, string];\n\nexport type EChartsAxisLineColors = GaugeColorStop[];\n\nexport const defaultThresholdInput: ThresholdOptions = { steps: [{ value: 0 }] };\n\nexport function convertThresholds(\n thresholds: ThresholdOptions,\n unit: FormatOptions,\n max: number,\n palette: ThresholdColorPalette\n): EChartsAxisLineColors {\n const defaultThresholdColor = thresholds.defaultColor ?? palette.defaultColor;\n const defaultThresholdSteps: EChartsAxisLineColors = [[0, defaultThresholdColor]];\n\n if (thresholds.steps !== undefined) {\n // https://echarts.apache.org/en/option.html#series-gauge.axisLine.lineStyle.color\n // color segments must be decimal between 0 and 1\n const segmentMax = 1;\n const valuesArr: number[] = thresholds.steps.map((step: StepOptions) => {\n if (thresholds.mode === 'percent') {\n return step.value / 100;\n }\n return step.value / max;\n });\n valuesArr.push(segmentMax);\n\n const colorsArr = thresholds.steps.map((step: StepOptions, index) => step.color ?? palette.palette[index]);\n colorsArr.unshift(defaultThresholdColor);\n\n const zippedArr = zip(valuesArr, colorsArr);\n return zippedArr.map((elem) => {\n const convertedValues = elem[0] ?? segmentMax;\n const convertedColors = elem[1] ?? defaultThresholdColor;\n return [convertedValues, convertedColors];\n });\n } else {\n return defaultThresholdSteps;\n }\n}\n"],"names":["zip","defaultThresholdInput","steps","value","convertThresholds","thresholds","unit","max","palette","defaultThresholdColor","defaultColor","defaultThresholdSteps","undefined","segmentMax","valuesArr","map","step","mode","push","colorsArr","index","color","unshift","zippedArr","elem","convertedValues","conv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authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { FormatOptions, StepOptions, ThresholdColorPalette, ThresholdOptions } from '@perses-dev/components';\nimport zip from 'lodash/zip';\n\nexport type GaugeColorStop = [number, string];\n\nexport type EChartsAxisLineColors = GaugeColorStop[];\n\nexport const defaultThresholdInput: ThresholdOptions = { steps: [{ value: 0 }] };\n\nexport function convertThresholds(\n thresholds: ThresholdOptions,\n unit: FormatOptions,\n max: number,\n palette: ThresholdColorPalette,\n): EChartsAxisLineColors {\n const defaultThresholdColor = thresholds.defaultColor ?? palette.defaultColor;\n const defaultThresholdSteps: EChartsAxisLineColors = [[0, defaultThresholdColor]];\n\n if (thresholds.steps !== undefined) {\n // https://echarts.apache.org/en/option.html#series-gauge.axisLine.lineStyle.color\n // color segments must be decimal between 0 and 1\n const segmentMax = 1;\n const valuesArr: number[] = thresholds.steps.map((step: StepOptions) => {\n if (thresholds.mode === 'percent') {\n return step.value / 100;\n }\n return step.value / max;\n });\n valuesArr.push(segmentMax);\n\n const colorsArr = thresholds.steps.map((step: StepOptions, index) => step.color ?? palette.palette[index]);\n colorsArr.unshift(defaultThresholdColor);\n\n const zippedArr = zip(valuesArr, colorsArr);\n return zippedArr.map((elem) => {\n const convertedValues = elem[0] ?? segmentMax;\n const convertedColors = elem[1] ?? defaultThresholdColor;\n return [convertedValues, convertedColors];\n });\n } else {\n return defaultThresholdSteps;\n }\n}\n"],"names":["zip","defaultThresholdInput","steps","value","convertThresholds","thresholds","unit","max","palette","defaultThresholdColor","defaultColor","defaultThresholdSteps","undefined","segmentMax","valuesArr","map","step","mode","push","colorsArr","index","color","unshift","zippedArr","elem","convertedValues","convertedColors"],"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,OAAOA,SAAS,aAAa;AAM7B,OAAO,MAAMC,wBAA0C;IAAEC,OAAO;QAAC;YAAEC,OAAO;QAAE;KAAE;AAAC,EAAE;AAEjF,OAAO,SAASC,kBACdC,UAA4B,EAC5BC,IAAmB,EACnBC,GAAW,EACXC,OAA8B;IAE9B,MAAMC,wBAAwBJ,WAAWK,YAAY,IAAIF,QAAQE,YAAY;IAC7E,MAAMC,wBAA+C;QAAC;YAAC;YAAGF;SAAsB;KAAC;IAEjF,IAAIJ,WAAWH,KAAK,KAAKU,WAAW;QAClC,kFAAkF;QAClF,iDAAiD;QACjD,MAAMC,aAAa;QACnB,MAAMC,YAAsBT,WAAWH,KAAK,CAACa,GAAG,CAAC,CAACC;YAChD,IAAIX,WAAWY,IAAI,KAAK,WAAW;gBACjC,OAAOD,KAAKb,KAAK,GAAG;YACtB;YACA,OAAOa,KAAKb,KAAK,GAAGI;QACtB;QACAO,UAAUI,IAAI,CAACL;QAEf,MAAMM,YAAYd,WAAWH,KAAK,CAACa,GAAG,CAAC,CAACC,MAAmBI,QAAUJ,KAAKK,KAAK,IAAIb,QAAQA,OAAO,CAACY,MAAM;QACzGD,UAAUG,OAAO,CAACb;QAElB,MAAMc,YAAYvB,IAAIc,WAAWK;QACjC,OAAOI,UAAUR,GAAG,CAAC,CAACS;YACpB,MAAMC,kBAAkBD,IAAI,CAAC,EAAE,IAAIX;YACnC,MAAMa,kBAAkBF,IAAI,CAAC,EAAE,IAAIf;YACnC,OAAO;gBAACgB;gBAAiBC;aAAgB;QAC3C;IACF,OAAO;QACL,OAAOf;IACT;AACF"}