@perses-dev/histogram-chart-plugin 0.12.0 → 0.13.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 (83) hide show
  1. package/__mf/js/{HistogramChart.e667cd2b.js → HistogramChart.0f1adecd.js} +3 -3
  2. package/__mf/js/async/121.659e0317.js +2 -0
  3. package/__mf/js/async/362.ff3a7bb8.js +1 -0
  4. package/__mf/js/async/392.c8481e53.js +2 -0
  5. package/__mf/js/async/470.d84c70c2.js +2 -0
  6. package/__mf/js/async/887.9e698b68.js +144 -0
  7. package/__mf/js/async/888.d8661a22.js +1 -0
  8. package/__mf/js/async/941.5bb16de1.js +2 -0
  9. package/__mf/js/async/{953.5b6a6f54.js → 953.020f89f2.js} +2 -2
  10. package/__mf/js/async/963.9484d062.js +1 -0
  11. package/__mf/js/async/__federation_expose_HistogramChart.bf4139cd.js +1 -0
  12. package/__mf/js/{main.ffd61509.js → main.1f60788b.js} +3 -3
  13. package/lib/HistogramChart.d.ts +3 -3
  14. package/lib/HistogramChart.d.ts.map +1 -1
  15. package/lib/HistogramChart.js +2 -2
  16. package/lib/HistogramChart.js.map +1 -1
  17. package/lib/bootstrap.js +2 -2
  18. package/lib/components/HistogramChart.d.ts +4 -4
  19. package/lib/components/HistogramChart.d.ts.map +1 -1
  20. package/lib/components/HistogramChart.js +7 -7
  21. package/lib/components/HistogramChart.js.map +1 -1
  22. package/lib/components/HistogramChartOptionsEditorSettings.d.ts +2 -2
  23. package/lib/components/HistogramChartOptionsEditorSettings.d.ts.map +1 -1
  24. package/lib/components/HistogramChartOptionsEditorSettings.js +5 -5
  25. package/lib/components/HistogramChartOptionsEditorSettings.js.map +1 -1
  26. package/lib/components/HistogramChartPanel.d.ts +4 -4
  27. package/lib/components/HistogramChartPanel.d.ts.map +1 -1
  28. package/lib/components/HistogramChartPanel.js +6 -6
  29. package/lib/components/HistogramChartPanel.js.map +1 -1
  30. package/lib/components/index.js +3 -3
  31. package/lib/components/index.js.map +1 -1
  32. package/lib/getPluginModule.d.ts +1 -1
  33. package/lib/getPluginModule.d.ts.map +1 -1
  34. package/lib/getPluginModule.js +3 -1
  35. package/lib/getPluginModule.js.map +1 -1
  36. package/lib/histogram-chart-model.d.ts +3 -3
  37. package/lib/histogram-chart-model.d.ts.map +1 -1
  38. package/lib/histogram-chart-model.js.map +1 -1
  39. package/lib/index-federation.js +1 -1
  40. package/lib/index.js +4 -4
  41. package/lib/index.js.map +1 -1
  42. package/lib/setup-tests.d.ts +1 -1
  43. package/lib/setup-tests.d.ts.map +1 -1
  44. package/lib/setup-tests.js +2 -2
  45. package/lib/setup-tests.js.map +1 -1
  46. package/lib/utils/index.js +1 -1
  47. package/lib/utils/index.js.map +1 -1
  48. package/lib/utils/thresholds.d.ts +1 -1
  49. package/lib/utils/thresholds.d.ts.map +1 -1
  50. package/lib/utils/thresholds.js.map +1 -1
  51. package/mf-manifest.json +18 -18
  52. package/mf-stats.json +18 -18
  53. package/package.json +10 -10
  54. package/__mf/js/async/121.4fbaef7c.js +0 -2
  55. package/__mf/js/async/392.76c75fd4.js +0 -2
  56. package/__mf/js/async/470.46eda164.js +0 -2
  57. package/__mf/js/async/535.32b814f1.js +0 -1
  58. package/__mf/js/async/888.0f662c7e.js +0 -1
  59. package/__mf/js/async/892.f82ac287.js +0 -144
  60. package/__mf/js/async/941.4dc35097.js +0 -2
  61. package/__mf/js/async/963.85edfb9c.js +0 -1
  62. package/__mf/js/async/__federation_expose_HistogramChart.c1589bb7.js +0 -1
  63. package/lib/cjs/HistogramChart.js +0 -40
  64. package/lib/cjs/bootstrap.js +0 -26
  65. package/lib/cjs/components/HistogramChart.js +0 -207
  66. package/lib/cjs/components/HistogramChartOptionsEditorSettings.js +0 -138
  67. package/lib/cjs/components/HistogramChartPanel.js +0 -104
  68. package/lib/cjs/components/index.js +0 -32
  69. package/lib/cjs/env.d.js +0 -14
  70. package/lib/cjs/getPluginModule.js +0 -39
  71. package/lib/cjs/histogram-chart-model.js +0 -84
  72. package/lib/cjs/index-federation.js +0 -55
  73. package/lib/cjs/index.js +0 -47
  74. package/lib/cjs/setup-tests.js +0 -19
  75. package/lib/cjs/utils/index.js +0 -30
  76. package/lib/cjs/utils/thresholds.js +0 -34
  77. /package/__mf/css/async/{892.85c2cbf6.css → 887.85c2cbf6.css} +0 -0
  78. /package/__mf/js/async/{121.4fbaef7c.js.LICENSE.txt → 121.659e0317.js.LICENSE.txt} +0 -0
  79. /package/__mf/js/async/{392.76c75fd4.js.LICENSE.txt → 392.c8481e53.js.LICENSE.txt} +0 -0
  80. /package/__mf/js/async/{470.46eda164.js.LICENSE.txt → 470.d84c70c2.js.LICENSE.txt} +0 -0
  81. /package/__mf/js/async/{892.f82ac287.js.LICENSE.txt → 887.9e698b68.js.LICENSE.txt} +0 -0
  82. /package/__mf/js/async/{941.4dc35097.js.LICENSE.txt → 941.5bb16de1.js.LICENSE.txt} +0 -0
  83. /package/__mf/js/async/{953.5b6a6f54.js.LICENSE.txt → 953.020f89f2.js.LICENSE.txt} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/HistogramChart.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 { HistogramChartOptionsEditorSettings, HistogramChartPanel, HistogramChartPanelProps } from './components';\nimport { createInitialHistogramChartOptions, HistogramChartOptions } from './histogram-chart-model';\n\n/**\n * The core HistogramChart panel plugin for Perses.\n */\nexport const HistogramChart: PanelPlugin<HistogramChartOptions, HistogramChartPanelProps> = {\n PanelComponent: HistogramChartPanel,\n supportedQueryTypes: ['TimeSeriesQuery'],\n queryOptions: {\n mode: 'instant',\n },\n panelOptionsEditorComponents: [\n {\n label: 'Settings',\n content: HistogramChartOptionsEditorSettings,\n },\n ],\n createInitialOptions: createInitialHistogramChartOptions,\n};\n"],"names":["HistogramChartOptionsEditorSettings","HistogramChartPanel","createInitialHistogramChartOptions","HistogramChart","PanelComponent","supportedQueryTypes","queryOptions","mode","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,mCAAmC,EAAEC,mBAAmB,QAAkC,eAAe;AAClH,SAASC,kCAAkC,QAA+B,0BAA0B;AAEpG;;CAEC,GACD,OAAO,MAAMC,iBAA+E;IAC1FC,gBAAgBH;IAChBI,qBAAqB;QAAC;KAAkB;IACxCC,cAAc;QACZC,MAAM;IACR;IACAC,8BAA8B;QAC5B;YACEC,OAAO;YACPC,SAASV;QACX;KACD;IACDW,sBAAsBT;AACxB,EAAE"}
1
+ {"version":3,"sources":["../../src/HistogramChart.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 { HistogramChartPanelProps } from './components';\nimport { HistogramChartOptionsEditorSettings, HistogramChartPanel } from './components';\nimport type { HistogramChartOptions } from './histogram-chart-model';\nimport { createInitialHistogramChartOptions } from './histogram-chart-model';\n\n/**\n * The core HistogramChart panel plugin for Perses.\n */\nexport const HistogramChart: PanelPlugin<HistogramChartOptions, HistogramChartPanelProps> = {\n PanelComponent: HistogramChartPanel,\n supportedQueryTypes: ['TimeSeriesQuery'],\n queryOptions: {\n mode: 'instant',\n },\n panelOptionsEditorComponents: [\n {\n label: 'Settings',\n content: HistogramChartOptionsEditorSettings,\n },\n ],\n createInitialOptions: createInitialHistogramChartOptions,\n};\n"],"names":["HistogramChartOptionsEditorSettings","HistogramChartPanel","createInitialHistogramChartOptions","HistogramChart","PanelComponent","supportedQueryTypes","queryOptions","mode","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,mCAAmC,EAAEC,mBAAmB,QAAQ,wBAAe;AAExF,SAASC,kCAAkC,QAAQ,6BAA0B;AAE7E;;CAEC,GACD,OAAO,MAAMC,iBAA+E;IAC1FC,gBAAgBH;IAChBI,qBAAqB;QAAC;KAAkB;IACxCC,cAAc;QACZC,MAAM;IACR;IACAC,8BAA8B;QAC5B;YACEC,OAAO;YACPC,SAASV;QACX;KACD;IACDW,sBAAsBT;AACxB,EAAE"}
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,7 +1,7 @@
1
- import { ReactElement } from 'react';
2
- import { FormatOptions, ThresholdOptions } from '@perses-dev/components';
3
- import { BucketTuple } from '@perses-dev/spec';
4
- import { LOG_BASE } from '../histogram-chart-model';
1
+ import type { FormatOptions, ThresholdOptions } from '@perses-dev/components';
2
+ import type { BucketTuple } from '@perses-dev/spec';
3
+ import type { ReactElement } from 'react';
4
+ import type { LOG_BASE } from '../histogram-chart-model';
5
5
  export interface HistogramChartData {
6
6
  buckets: BucketTuple[];
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"HistogramChart.d.ts","sourceRoot":"","sources":["../../../src/components/HistogramChart.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAU,aAAa,EAAoB,gBAAgB,EAAkB,MAAM,wBAAwB,CAAC;AAKnH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAIpD,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,kBAAkB,CAAC;IACzB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,OAAO,CAAC,EAAE,QAAQ,CAAC;CACpB;AAED,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,MAAM,EACN,IAAI,EACJ,MAAM,EACN,GAAG,EACH,GAAG,EACH,UAAU,EACV,OAAO,GACR,EAAE,mBAAmB,GAAG,YAAY,GAAG,IAAI,CA4K3C"}
1
+ {"version":3,"file":"HistogramChart.d.ts","sourceRoot":"","sources":["../../../src/components/HistogramChart.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAKpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAKzD,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,kBAAkB,CAAC;IACzB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,OAAO,CAAC,EAAE,QAAQ,CAAC;CACpB;AAED,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,MAAM,EACN,IAAI,EACJ,MAAM,EACN,GAAG,EACH,GAAG,EACH,UAAU,EACV,OAAO,GACR,EAAE,mBAAmB,GAAG,YAAY,GAAG,IAAI,CA4K3C"}
@@ -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 { useMemo } from 'react';
15
- import { EChart, getFormattedAxis, useChartsTheme } from '@perses-dev/components';
16
- import { use } from 'echarts/core';
17
- import { CustomChart } from 'echarts/charts';
18
- import { getColorFromThresholds } from '../utils';
19
- use([
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { EChart, getFormattedAxis, useChartsTheme } from "@perses-dev/components";
15
+ import { CustomChart } from "echarts/charts";
16
+ import { use as registerECharts } from "echarts/core";
17
+ import { useMemo } from "react";
18
+ import { getColorFromThresholds } from "../utils/index.js";
19
+ registerECharts([
20
20
  CustomChart
21
21
  ]);
22
22
  export function HistogramChart({ width, height, data, format, min, max, thresholds, logBase }) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/HistogramChart.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 { ReactElement, useMemo } from 'react';\nimport { EChart, FormatOptions, getFormattedAxis, ThresholdOptions, useChartsTheme } from '@perses-dev/components';\nimport { use, EChartsCoreOption } from 'echarts/core';\nimport { CustomSeriesRenderItemAPI, CustomSeriesRenderItemParams } from 'echarts';\nimport { CustomChart } from 'echarts/charts';\nimport { CustomSeriesRenderItemReturn } from 'echarts/types/dist/echarts';\nimport { BucketTuple } from '@perses-dev/spec';\nimport { getColorFromThresholds } from '../utils';\nimport { LOG_BASE } from '../histogram-chart-model';\n\nuse([CustomChart]);\n\nexport interface HistogramChartData {\n buckets: BucketTuple[];\n}\n\nexport interface HistogramChartProps {\n width: number;\n height: number;\n data: HistogramChartData;\n format?: FormatOptions;\n min?: number;\n max?: number;\n thresholds?: ThresholdOptions;\n logBase?: LOG_BASE;\n}\n\nexport function HistogramChart({\n width,\n height,\n data,\n format,\n min,\n max,\n thresholds,\n logBase,\n}: HistogramChartProps): ReactElement | null {\n const chartsTheme = useChartsTheme();\n\n const transformedData = useMemo(() => {\n return data.buckets\n .map(([bucket, lowerBound, upperBound, count]) => {\n let lower = parseFloat(lowerBound);\n const upper = parseFloat(upperBound);\n const countValue = parseFloat(count);\n\n // For logarithmic scales, we need to handle non-positive lower bounds\n // since log(0) and log(negative) are undefined\n if (logBase !== undefined && lower <= 0) {\n // Skip buckets that would be entirely non-positive on a log scale\n if (upper <= 0) {\n return null;\n }\n // For buckets that span from 0 (or negative) to positive,\n // use a small fraction of the upper bound as the lower bound\n // This ensures the bucket is still visible on the log scale\n lower = upper * 0.001; // Use 0.1% of upper bound as minimum\n }\n\n return {\n value: [lower, upper, countValue, bucket],\n itemStyle: {\n color: getColorFromThresholds(\n parseFloat(lowerBound), // Use original lower bound for threshold coloring\n thresholds,\n chartsTheme,\n chartsTheme.echartsTheme[0] as string\n ),\n },\n };\n })\n .filter((item): item is NonNullable<typeof item> => item !== null);\n }, [chartsTheme, data.buckets, logBase, thresholds]);\n\n const minXAxis: number | undefined = useMemo(() => {\n if (logBase !== undefined) {\n // For logarithmic scales, let ECharts auto-calculate the range based on data\n // to avoid issues with non-positive values\n return undefined;\n }\n\n if (min) {\n return min;\n }\n\n if (transformedData && transformedData[0]) {\n return Math.min(0, Math.floor(transformedData[0]?.value[0] ?? 0));\n }\n return undefined;\n }, [logBase, min, transformedData]);\n\n const maxXAxis: number | undefined = useMemo(() => {\n if (max) {\n return max;\n }\n if (transformedData && transformedData[transformedData.length - 1]) {\n return Math.ceil(transformedData[transformedData.length - 1]?.value[1] ?? 1);\n }\n return undefined;\n }, [max, transformedData]);\n\n const option: EChartsCoreOption = useMemo(() => {\n if (!transformedData) return chartsTheme.noDataOption;\n\n // Build xAxis configuration based on whether logarithmic scale is requested\n const xAxisConfig: Record<string, unknown> = {\n scale: false,\n min: minXAxis,\n max: maxXAxis,\n };\n\n // Apply logarithmic scale settings if requested\n if (logBase !== undefined) {\n xAxisConfig.type = 'log';\n xAxisConfig.logBase = logBase;\n }\n\n return {\n title: {\n show: false,\n },\n tooltip: {},\n xAxis: xAxisConfig,\n yAxis: getFormattedAxis({}, format),\n series: [\n {\n type: 'custom',\n renderItem: function (\n params: CustomSeriesRenderItemParams,\n api: CustomSeriesRenderItemAPI\n ): CustomSeriesRenderItemReturn {\n const lowerBound = api.value(0) as number;\n const upperBound = api.value(1) as number;\n const yValue = api.value(2) as number;\n\n // Get the pixel coordinates for the start and end points of the bar\n const startCoord = api.coord([lowerBound, yValue]);\n const endCoord = api.coord([upperBound, 0]);\n\n // Extract coordinates with safety checks\n const startX = startCoord?.[0];\n const startY = startCoord?.[1];\n const endX = endCoord?.[0];\n const endY = endCoord?.[1];\n\n // Check if coordinates are valid before proceeding\n if (startX === undefined || startY === undefined || endX === undefined || endY === undefined) {\n return null;\n }\n\n // For logarithmic scales, api.size() doesn't work correctly because\n // the visual width isn't linear. Instead, we calculate the width\n // directly from the pixel coordinates.\n const barWidth = endX - startX;\n const barHeight = endY - startY;\n\n const style = api.style?.();\n\n // Skip rendering if coordinates are invalid (can happen with log scale edge cases)\n if (\n !Number.isFinite(startX) ||\n !Number.isFinite(startY) ||\n !Number.isFinite(barWidth) ||\n !Number.isFinite(barHeight)\n ) {\n return null;\n }\n\n return {\n type: 'rect',\n shape: {\n x: startX,\n y: startY,\n width: barWidth,\n height: barHeight,\n },\n style: style,\n };\n },\n label: {\n show: false,\n },\n dimensions: ['from', 'to'],\n encode: {\n x: [0, 1],\n y: 2,\n tooltip: [0, 1],\n itemName: 2,\n },\n data: transformedData,\n },\n ],\n };\n }, [chartsTheme.noDataOption, format, logBase, maxXAxis, minXAxis, transformedData]);\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":["useMemo","EChart","getFormattedAxis","useChartsTheme","use","CustomChart","getColorFromThresholds","HistogramChart","width","height","data","format","min","max","thresholds","logBase","chartsTheme","transformedData","buckets","map","bucket","lowerBound","upperBound","count","lower","parseFloat","upper","countValue","undefined","value","itemStyle","color","echartsTheme","filter","item","minXAxis","Math","floor","maxXAxis","length","ceil","option","noDataOption","xAxisConfig","scale","type","title","show","tooltip","xAxis","yAxis","series","renderItem","params","api","yValue","startCoord","coord","endCoord","startX","startY","endX","endY","barWidth","barHeight","style","Number","isFinite","shape","x","y","label","dimensions","encode","itemName","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,SAAuBA,OAAO,QAAQ,QAAQ;AAC9C,SAASC,MAAM,EAAiBC,gBAAgB,EAAoBC,cAAc,QAAQ,yBAAyB;AACnH,SAASC,GAAG,QAA2B,eAAe;AAEtD,SAASC,WAAW,QAAQ,iBAAiB;AAG7C,SAASC,sBAAsB,QAAQ,WAAW;AAGlDF,IAAI;IAACC;CAAY;AAiBjB,OAAO,SAASE,eAAe,EAC7BC,KAAK,EACLC,MAAM,EACNC,IAAI,EACJC,MAAM,EACNC,GAAG,EACHC,GAAG,EACHC,UAAU,EACVC,OAAO,EACa;IACpB,MAAMC,cAAcb;IAEpB,MAAMc,kBAAkBjB,QAAQ;QAC9B,OAAOU,KAAKQ,OAAO,CAChBC,GAAG,CAAC,CAAC,CAACC,QAAQC,YAAYC,YAAYC,MAAM;YAC3C,IAAIC,QAAQC,WAAWJ;YACvB,MAAMK,QAAQD,WAAWH;YACzB,MAAMK,aAAaF,WAAWF;YAE9B,sEAAsE;YACtE,+CAA+C;YAC/C,IAAIR,YAAYa,aAAaJ,SAAS,GAAG;gBACvC,kEAAkE;gBAClE,IAAIE,SAAS,GAAG;oBACd,OAAO;gBACT;gBACA,0DAA0D;gBAC1D,6DAA6D;gBAC7D,4DAA4D;gBAC5DF,QAAQE,QAAQ,OAAO,qCAA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ACAyB,YAAY;wBAAC;wBAAQ;qBAAK;oBAC1BC,QAAQ;wBACNJ,GAAG;4BAAC;4BAAG;yBAAE;wBACTC,GAAG;wBACHtB,SAAS;4BAAC;4BAAG;yBAAE;wBACf0B,UAAU;oBACZ;oBACAhE,MAAMO;gBACR;aACD;QACH;IACF,GAAG;QAACD,YAAY0B,YAAY;QAAE/B;QAAQI;QAASuB;QAAUH;QAAUlB;KAAgB;IAEnF,qBACE,KAAChB;QACCgE,OAAO;YACLzD,OAAOA;YACPC,QAAQA;QACV;QACAkE,IAAI;YACFC,SAAS,GAAG5D,YAAY6D,SAAS,CAACD,OAAO,CAACE,OAAO,CAAC,EAAE,CAAC;QACvD;QACArC,QAAQA;QACRsC,OAAO/D,YAAYgB,YAAY;;AAGrC"}
1
+ {"version":3,"sources":["../../../src/components/HistogramChart.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, ThresholdOptions } from '@perses-dev/components';\nimport { EChart, getFormattedAxis, useChartsTheme } from '@perses-dev/components';\nimport type { BucketTuple } from '@perses-dev/spec';\nimport type { CustomSeriesRenderItemAPI, CustomSeriesRenderItemParams, CustomSeriesRenderItemReturn } from 'echarts';\nimport { CustomChart } from 'echarts/charts';\nimport type { EChartsCoreOption } from 'echarts/core';\nimport { use as registerECharts } from 'echarts/core';\nimport type { ReactElement } from 'react';\nimport { useMemo } from 'react';\n\nimport type { LOG_BASE } from '../histogram-chart-model';\nimport { getColorFromThresholds } from '../utils';\n\nregisterECharts([CustomChart]);\n\nexport interface HistogramChartData {\n buckets: BucketTuple[];\n}\n\nexport interface HistogramChartProps {\n width: number;\n height: number;\n data: HistogramChartData;\n format?: FormatOptions;\n min?: number;\n max?: number;\n thresholds?: ThresholdOptions;\n logBase?: LOG_BASE;\n}\n\nexport function HistogramChart({\n width,\n height,\n data,\n format,\n min,\n max,\n thresholds,\n logBase,\n}: HistogramChartProps): ReactElement | null {\n const chartsTheme = useChartsTheme();\n\n const transformedData = useMemo(() => {\n return data.buckets\n .map(([bucket, lowerBound, upperBound, count]) => {\n let lower = parseFloat(lowerBound);\n const upper = parseFloat(upperBound);\n const countValue = parseFloat(count);\n\n // For logarithmic scales, we need to handle non-positive lower bounds\n // since log(0) and log(negative) are undefined\n if (logBase !== undefined && lower <= 0) {\n // Skip buckets that would be entirely non-positive on a log scale\n if (upper <= 0) {\n return null;\n }\n // For buckets that span from 0 (or negative) to positive,\n // use a small fraction of the upper bound as the lower bound\n // This ensures the bucket is still visible on the log scale\n lower = upper * 0.001; // Use 0.1% of upper bound as minimum\n }\n\n return {\n value: [lower, upper, countValue, bucket],\n itemStyle: {\n color: getColorFromThresholds(\n parseFloat(lowerBound), // Use original lower bound for threshold coloring\n thresholds,\n chartsTheme,\n chartsTheme.echartsTheme[0] as string,\n ),\n },\n };\n })\n .filter((item): item is NonNullable<typeof item> => item !== null);\n }, [chartsTheme, data.buckets, logBase, thresholds]);\n\n const minXAxis: number | undefined = useMemo(() => {\n if (logBase !== undefined) {\n // For logarithmic scales, let ECharts auto-calculate the range based on data\n // to avoid issues with non-positive values\n return undefined;\n }\n\n if (min) {\n return min;\n }\n\n if (transformedData && transformedData[0]) {\n return Math.min(0, Math.floor(transformedData[0]?.value[0] ?? 0));\n }\n return undefined;\n }, [logBase, min, transformedData]);\n\n const maxXAxis: number | undefined = useMemo(() => {\n if (max) {\n return max;\n }\n if (transformedData && transformedData[transformedData.length - 1]) {\n return Math.ceil(transformedData[transformedData.length - 1]?.value[1] ?? 1);\n }\n return undefined;\n }, [max, transformedData]);\n\n const option: EChartsCoreOption = useMemo(() => {\n if (!transformedData) return chartsTheme.noDataOption;\n\n // Build xAxis configuration based on whether logarithmic scale is requested\n const xAxisConfig: Record<string, unknown> = {\n scale: false,\n min: minXAxis,\n max: maxXAxis,\n };\n\n // Apply logarithmic scale settings if requested\n if (logBase !== undefined) {\n xAxisConfig.type = 'log';\n xAxisConfig.logBase = logBase;\n }\n\n return {\n title: {\n show: false,\n },\n tooltip: {},\n xAxis: xAxisConfig,\n yAxis: getFormattedAxis({}, format),\n series: [\n {\n type: 'custom',\n renderItem: function (\n params: CustomSeriesRenderItemParams,\n api: CustomSeriesRenderItemAPI,\n ): CustomSeriesRenderItemReturn {\n const lowerBound = api.value(0) as number;\n const upperBound = api.value(1) as number;\n const yValue = api.value(2) as number;\n\n // Get the pixel coordinates for the start and end points of the bar\n const startCoord = api.coord([lowerBound, yValue]);\n const endCoord = api.coord([upperBound, 0]);\n\n // Extract coordinates with safety checks\n const startX = startCoord?.[0];\n const startY = startCoord?.[1];\n const endX = endCoord?.[0];\n const endY = endCoord?.[1];\n\n // Check if coordinates are valid before proceeding\n if (startX === undefined || startY === undefined || endX === undefined || endY === undefined) {\n return null;\n }\n\n // For logarithmic scales, api.size() doesn't work correctly because\n // the visual width isn't linear. Instead, we calculate the width\n // directly from the pixel coordinates.\n const barWidth = endX - startX;\n const barHeight = endY - startY;\n\n const style = api.style?.();\n\n // Skip rendering if coordinates are invalid (can happen with log scale edge cases)\n if (\n !Number.isFinite(startX) ||\n !Number.isFinite(startY) ||\n !Number.isFinite(barWidth) ||\n !Number.isFinite(barHeight)\n ) {\n return null;\n }\n\n return {\n type: 'rect',\n shape: {\n x: startX,\n y: startY,\n width: barWidth,\n height: barHeight,\n },\n style: style,\n };\n },\n label: {\n show: false,\n },\n dimensions: ['from', 'to'],\n encode: {\n x: [0, 1],\n y: 2,\n tooltip: [0, 1],\n itemName: 2,\n },\n data: transformedData,\n },\n ],\n };\n }, [chartsTheme.noDataOption, format, logBase, maxXAxis, minXAxis, transformedData]);\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","getFormattedAxis","useChartsTheme","CustomChart","use","registerECharts","useMemo","getColorFromThresholds","HistogramChart","width","height","data","format","min","max","thresholds","logBase","chartsTheme","transformedData","buckets","map","bucket","lowerBound","upperBound","count","lower","parseFloat","upper","countValue","undefined","value","itemStyle","color","echartsTheme","filter","item","minXAxis","Math","floor","maxXAxis","length","ceil","option","noDataOption","xAxisConfig","scale","type","title","show","tooltip","xAxis","yAxis","series","renderItem","params","api","yValue","startCoord","coord","endCoord","startX","startY","endX","endY","barWidth","barHeight","style","Number","isFinite","shape","x","y","label","dimensions","encode","itemName","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,gBAAgB,EAAEC,cAAc,QAAQ,yBAAyB;AAGlF,SAASC,WAAW,QAAQ,iBAAiB;AAE7C,SAASC,OAAOC,eAAe,QAAQ,eAAe;AAEtD,SAASC,OAAO,QAAQ,QAAQ;AAGhC,SAASC,sBAAsB,QAAQ,oBAAW;AAElDF,gBAAgB;IAACF;CAAY;AAiB7B,OAAO,SAASK,eAAe,EAC7BC,KAAK,EACLC,MAAM,EACNC,IAAI,EACJC,MAAM,EACNC,GAAG,EACHC,GAAG,EACHC,UAAU,EACVC,OAAO,EACa;IACpB,MAAMC,cAAcf;IAEpB,MAAMgB,kBAAkBZ,QAAQ;QAC9B,OAAOK,KAAKQ,OAAO,CAChBC,GAAG,CAAC,CAAC,CAACC,QAAQC,YAAYC,YAAYC,MAAM;YAC3C,IAAIC,QAAQC,WAAWJ;YACvB,MAAMK,Q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AACM,OAAOC,QAAQ,CAACJ,aACjB,CAACG,OAAOC,QAAQ,CAACH,YACjB;4BACA,OAAO;wBACT;wBAEA,OAAO;4BACLnB,MAAM;4BACNuB,OAAO;gCACLC,GAAGV;gCACHW,GAAGV;gCACHpD,OAAOuD;gCACPtD,QAAQuD;4BACV;4BACAC,OAAOA;wBACT;oBACF;oBACAM,OAAO;wBACLxB,MAAM;oBACR;oBACAyB,YAAY;wBAAC;wBAAQ;qBAAK;oBAC1BC,QAAQ;wBACNJ,GAAG;4BAAC;4BAAG;yBAAE;wBACTC,GAAG;wBACHtB,SAAS;4BAAC;4BAAG;yBAAE;wBACf0B,UAAU;oBACZ;oBACAhE,MAAMO;gBACR;aACD;QACH;IACF,GAAG;QAACD,YAAY0B,YAAY;QAAE/B;QAAQI;QAASuB;QAAUH;QAAUlB;KAAgB;IAEnF,qBACE,KAAClB;QACCkE,OAAO;YACLzD,OAAOA;YACPC,QAAQA;QACV;QACAkE,IAAI;YACFC,SAAS,GAAG5D,YAAY6D,SAAS,CAACD,OAAO,CAACE,OAAO,CAAC,EAAE,CAAC;QACvD;QACArC,QAAQA;QACRsC,OAAO/D,YAAYgB,YAAY;;AAGrC"}
@@ -1,4 +1,4 @@
1
- import { ReactElement } from 'react';
2
- import { HistogramChartOptionsEditorProps } from '../histogram-chart-model';
1
+ import type { ReactElement } from 'react';
2
+ import type { HistogramChartOptionsEditorProps } from '../histogram-chart-model';
3
3
  export declare function HistogramChartOptionsEditorSettings(props: HistogramChartOptionsEditorProps): ReactElement;
4
4
  //# sourceMappingURL=HistogramChartOptionsEditorSettings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HistogramChartOptionsEditorSettings.d.ts","sourceRoot":"","sources":["../../../src/components/HistogramChartOptionsEditorSettings.tsx"],"names":[],"mappings":"AA2BA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAQL,gCAAgC,EAGjC,MAAM,0BAA0B,CAAC;AAElC,wBAAgB,mCAAmC,CAAC,KAAK,EAAE,gCAAgC,GAAG,YAAY,CAkHzG"}
1
+ {"version":3,"file":"HistogramChartOptionsEditorSettings.d.ts","sourceRoot":"","sources":["../../../src/components/HistogramChartOptionsEditorSettings.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAyB,gCAAgC,EAAE,MAAM,0BAA0B,CAAC;AAYxG,wBAAgB,mCAAmC,CAAC,KAAK,EAAE,gCAAgC,GAAG,YAAY,CAkHzG"}
@@ -11,11 +11,11 @@ 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 { TextField } from '@mui/material';
15
- import { FormatControls, OptionsEditorColumn, OptionsEditorControl, OptionsEditorGrid, OptionsEditorGroup, ThresholdsEditor, SettingsAutocomplete } from '@perses-dev/components';
16
- import { produce } from 'immer';
17
- import merge from 'lodash/merge';
18
- import { DEFAULT_FORMAT, DEFAULT_MAX_PERCENT, DEFAULT_MAX_PERCENT_DECIMAL, DEFAULT_MIN_PERCENT, DEFAULT_MIN_PERCENT_DECIMAL, DEFAULT_THRESHOLDS, LOG_BASE_CONFIG, LOG_BASE_OPTIONS } from '../histogram-chart-model';
14
+ import { TextField } from "@mui/material";
15
+ import { FormatControls, OptionsEditorColumn, OptionsEditorControl, OptionsEditorGrid, OptionsEditorGroup, ThresholdsEditor, SettingsAutocomplete } from "@perses-dev/components";
16
+ import { produce } from "immer";
17
+ import merge from "lodash/merge";
18
+ import { DEFAULT_FORMAT, DEFAULT_MAX_PERCENT, DEFAULT_MAX_PERCENT_DECIMAL, DEFAULT_MIN_PERCENT, DEFAULT_MIN_PERCENT_DECIMAL, DEFAULT_THRESHOLDS, LOG_BASE_CONFIG, LOG_BASE_OPTIONS } from "../histogram-chart-model.js";
19
19
  export function HistogramChartOptionsEditorSettings(props) {
20
20
  const { onChange, value } = props;
21
21
  const handleUnitChange = (newFormat)=>{
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/HistogramChartOptionsEditorSettings.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 { TextField } from '@mui/material';\nimport {\n FormatControls,\n FormatControlsProps,\n OptionsEditorColumn,\n OptionsEditorControl,\n OptionsEditorGrid,\n OptionsEditorGroup,\n ThresholdsEditor,\n ThresholdsEditorProps,\n SettingsAutocomplete,\n} from '@perses-dev/components';\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 DEFAULT_MIN_PERCENT,\n DEFAULT_MIN_PERCENT_DECIMAL,\n DEFAULT_THRESHOLDS,\n HistogramChartOptions,\n HistogramChartOptionsEditorProps,\n LOG_BASE_CONFIG,\n LOG_BASE_OPTIONS,\n} from '../histogram-chart-model';\n\nexport function HistogramChartOptionsEditorSettings(props: HistogramChartOptionsEditorProps): ReactElement {\n const { onChange, value } = props;\n\n const handleUnitChange: FormatControlsProps['onChange'] = (newFormat) => {\n onChange(\n produce(value, (draft: HistogramChartOptions) => {\n draft.format = newFormat;\n })\n );\n };\n\n const handleThresholdsChange: ThresholdsEditorProps['onChange'] = (thresholds) => {\n onChange(\n produce(value, (draft: HistogramChartOptions) => {\n draft.thresholds = thresholds;\n })\n );\n };\n\n // ensures decimalPlaces defaults to correct value\n const format = merge({}, DEFAULT_FORMAT, value.format);\n const thresholds = merge({}, DEFAULT_THRESHOLDS, value.thresholds);\n\n // Get the current log base configuration\n const logBase = value.logBase ? LOG_BASE_CONFIG[value.logBase] : LOG_BASE_CONFIG['none'];\n\n // max only needs to be set explicitly for units other than percent and percent-decimal\n let minPlaceholder = 'Enter value';\n if (format.unit === 'percent') {\n minPlaceholder = DEFAULT_MIN_PERCENT.toString();\n } else if (format.unit === 'percent-decimal') {\n minPlaceholder = DEFAULT_MIN_PERCENT_DECIMAL.toString();\n }\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 return (\n <OptionsEditorGrid>\n <OptionsEditorColumn>\n <OptionsEditorGroup title=\"Misc\">\n <FormatControls value={format} onChange={handleUnitChange} />\n <OptionsEditorControl\n label=\"Min\"\n control={\n <TextField\n type=\"number\"\n value={value.min ?? ''}\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: HistogramChartOptions) => {\n draft.min = newValue;\n })\n );\n }}\n placeholder={minPlaceholder}\n sx={{ width: '100%' }}\n />\n }\n />\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: HistogramChartOptions) => {\n draft.max = newValue;\n })\n );\n }}\n placeholder={maxPlaceholder}\n sx={{ width: '100%' }}\n />\n }\n />\n <OptionsEditorControl\n label=\"Log Base\"\n control={\n <SettingsAutocomplete\n value={{\n ...logBase,\n id: logBase?.label ?? 'None',\n }}\n options={LOG_BASE_OPTIONS}\n onChange={(__, newValue) => {\n onChange(\n produce(value, (draft: HistogramChartOptions) => {\n draft.logBase = newValue.log;\n })\n );\n }}\n disableClearable\n />\n }\n />\n </OptionsEditorGroup>\n </OptionsEditorColumn>\n <OptionsEditorColumn>\n <ThresholdsEditor thresholds={thresholds} onChange={handleThresholdsChange} />\n </OptionsEditorColumn>\n </OptionsEditorGrid>\n );\n}\n"],"names":["TextField","FormatControls","OptionsEditorColumn","OptionsEditorControl","OptionsEditorGrid","OptionsEditorGroup","ThresholdsEditor","SettingsAutocomplete","produce","merge","DEFAULT_FORMAT","DEFAULT_MAX_PERCENT","DEFAULT_MAX_PERCENT_DECIMAL","DEFAULT_MIN_PERCENT","DEFAULT_MIN_PERCENT_DECIMAL","DEFAULT_THRESHOLDS","LOG_BASE_CONFIG","LOG_BASE_OPTIONS","HistogramChartOptionsEditorSettings","props","onChange","value","handleUnitChange","newFormat","draft","format","handleThresholdsChange","thresholds","logBase","minPlaceholder","unit","toString","maxPlaceholder","title","label","control","type","min","e","newValue","target","Number","undefined","placeholder","sx","width","max","id","options","__","log","disableClearable"],"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,SAAS,QAAQ,gBAAgB;AAC1C,SACEC,cAAc,EAEdC,mBAAmB,EACnBC,oBAAoB,EACpBC,iBAAiB,EACjBC,kBAAkB,EAClBC,gBAAgB,EAEhBC,oBAAoB,QACf,yBAAyB;AAChC,SAASC,OAAO,QAAQ,QAAQ;AAChC,OAAOC,WAAW,eAAe;AAEjC,SACEC,cAAc,EACdC,mBAAmB,EACnBC,2BAA2B,EAC3BC,mBAAmB,EACnBC,2BAA2B,EAC3BC,kBAAkB,EAGlBC,eAAe,EACfC,gBAAgB,QACX,2BAA2B;AAElC,OAAO,SAASC,oCAAoC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GoB,OAAOH,EAAEE,MAAM,CAACnB,KAAK,IAAIqB;oCAC3DtB,SACEZ,QAAQa,OAAO,CAACG;wCACdA,MAAMa,GAAG,GAAGE;oCACd;gCAEJ;gCACAI,aAAad;gCACbe,IAAI;oCAAEC,OAAO;gCAAO;;;sCAI1B,KAAC1C;4BACC+B,OAAM;4BACNC,uBACE,KAACnC;gCACCoC,MAAK;gCACLf,OAAOA,MAAMyB,GAAG,IAAI;gCACpB1B,UAAU,CAACkB;oCACT,qEAAqE;oCACrE,MAAMC,WAAWD,EAAEE,MAAM,CAACnB,KAAK,GAAGoB,OAAOH,EAAEE,MAAM,CAACnB,KAAK,IAAIqB;oCAC3DtB,SACEZ,QAAQa,OAAO,CAACG;wCACdA,MAAMsB,GAAG,GAAGP;oCACd;gCAEJ;gCACAI,aAAaX;gCACbY,IAAI;oCAAEC,OAAO;gCAAO;;;sCAI1B,KAAC1C;4BACC+B,OAAM;4BACNC,uBACE,KAAC5B;gCACCc,OAAO;oCACL,GAAGO,OAAO;oCACVmB,IAAInB,SAASM,SAAS;gCACxB;gCACAc,SAAS/B;gCACTG,UAAU,CAAC6B,IAAIV;oCACbnB,SACEZ,QAAQa,OAAO,CAACG;wCACdA,MAAMI,OAAO,GAAGW,SAASW,GAAG;oCAC9B;gCAEJ;gCACAC,gBAAgB;;;;;;0BAM1B,KAACjD;0BACC,cAAA,KAACI;oBAAiBqB,YAAYA;oBAAYP,UAAUM;;;;;AAI5D"}
1
+ {"version":3,"sources":["../../../src/components/HistogramChartOptionsEditorSettings.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 { TextField } from '@mui/material';\nimport type { FormatControlsProps, ThresholdsEditorProps } from '@perses-dev/components';\nimport {\n FormatControls,\n OptionsEditorColumn,\n OptionsEditorControl,\n OptionsEditorGrid,\n OptionsEditorGroup,\n ThresholdsEditor,\n SettingsAutocomplete,\n} from '@perses-dev/components';\nimport { produce } from 'immer';\nimport merge from 'lodash/merge';\nimport type { ReactElement } from 'react';\n\nimport type { HistogramChartOptions, HistogramChartOptionsEditorProps } from '../histogram-chart-model';\nimport {\n DEFAULT_FORMAT,\n DEFAULT_MAX_PERCENT,\n DEFAULT_MAX_PERCENT_DECIMAL,\n DEFAULT_MIN_PERCENT,\n DEFAULT_MIN_PERCENT_DECIMAL,\n DEFAULT_THRESHOLDS,\n LOG_BASE_CONFIG,\n LOG_BASE_OPTIONS,\n} from '../histogram-chart-model';\n\nexport function HistogramChartOptionsEditorSettings(props: HistogramChartOptionsEditorProps): ReactElement {\n const { onChange, value } = props;\n\n const handleUnitChange: FormatControlsProps['onChange'] = (newFormat) => {\n onChange(\n produce(value, (draft: HistogramChartOptions) => {\n draft.format = newFormat;\n }),\n );\n };\n\n const handleThresholdsChange: ThresholdsEditorProps['onChange'] = (thresholds) => {\n onChange(\n produce(value, (draft: HistogramChartOptions) => {\n draft.thresholds = thresholds;\n }),\n );\n };\n\n // ensures decimalPlaces defaults to correct value\n const format = merge({}, DEFAULT_FORMAT, value.format);\n const thresholds = merge({}, DEFAULT_THRESHOLDS, value.thresholds);\n\n // Get the current log base configuration\n const logBase = value.logBase ? LOG_BASE_CONFIG[value.logBase] : LOG_BASE_CONFIG['none'];\n\n // max only needs to be set explicitly for units other than percent and percent-decimal\n let minPlaceholder = 'Enter value';\n if (format.unit === 'percent') {\n minPlaceholder = DEFAULT_MIN_PERCENT.toString();\n } else if (format.unit === 'percent-decimal') {\n minPlaceholder = DEFAULT_MIN_PERCENT_DECIMAL.toString();\n }\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 return (\n <OptionsEditorGrid>\n <OptionsEditorColumn>\n <OptionsEditorGroup title=\"Misc\">\n <FormatControls value={format} onChange={handleUnitChange} />\n <OptionsEditorControl\n label=\"Min\"\n control={\n <TextField\n type=\"number\"\n value={value.min ?? ''}\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: HistogramChartOptions) => {\n draft.min = newValue;\n }),\n );\n }}\n placeholder={minPlaceholder}\n sx={{ width: '100%' }}\n />\n }\n />\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: HistogramChartOptions) => {\n draft.max = newValue;\n }),\n );\n }}\n placeholder={maxPlaceholder}\n sx={{ width: '100%' }}\n />\n }\n />\n <OptionsEditorControl\n label=\"Log Base\"\n control={\n <SettingsAutocomplete\n value={{\n ...logBase,\n id: logBase?.label ?? 'None',\n }}\n options={LOG_BASE_OPTIONS}\n onChange={(__, newValue) => {\n onChange(\n produce(value, (draft: HistogramChartOptions) => {\n draft.logBase = newValue.log;\n }),\n );\n }}\n disableClearable\n />\n }\n />\n </OptionsEditorGroup>\n </OptionsEditorColumn>\n <OptionsEditorColumn>\n <ThresholdsEditor thresholds={thresholds} onChange={handleThresholdsChange} />\n </OptionsEditorColumn>\n </OptionsEditorGrid>\n );\n}\n"],"names":["TextField","FormatControls","OptionsEditorColumn","OptionsEditorControl","OptionsEditorGrid","OptionsEditorGroup","ThresholdsEditor","SettingsAutocomplete","produce","merge","DEFAULT_FORMAT","DEFAULT_MAX_PERCENT","DEFAULT_MAX_PERCENT_DECIMAL","DEFAULT_MIN_PERCENT","DEFAULT_MIN_PERCENT_DECIMAL","DEFAULT_THRESHOLDS","LOG_BASE_CONFIG","LOG_BASE_OPTIONS","HistogramChartOptionsEditorSettings","props","onChange","value","handleUnitChange","newFormat","draft","format","handleThresholdsChange","thresholds","logBase","minPlaceholder","unit","toString","maxPlaceholder","title","label","control","type","min","e","newValue","target","Number","undefined","placeholder","sx","width","max","id","options","__","log","disableClearable"],"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,SAAS,QAAQ,gBAAgB;AAE1C,SACEC,cAAc,EACdC,mBAAmB,EACnBC,oBAAoB,EACpBC,iBAAiB,EACjBC,kBAAkB,EAClBC,gBAAgB,EAChBC,oBAAoB,QACf,yBAAyB;AAChC,SAASC,OAAO,QAAQ,QAAQ;AAChC,OAAOC,WAAW,eAAe;AAIjC,SACEC,cAAc,EACdC,mBAAmB,EACnBC,2BAA2B,EAC3BC,mBAAmB,EACnBC,2BAA2B,EAC3BC,kBAAkB,EAClBC,eAAe,EACfC,gBAAgB,QACX,8BAA2B;AAElC,OAAO,SAASC,oCAAoCC,KAAuC;IACzF,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAE5B,MAAMG,mBAAoD,CAACC;QACzDH,SACEZ,QAAQa,OAAO,CAACG;YACdA,MAAMC,MAAM,GAAGF;QACjB;IAEJ;IAEA,MAAMG,yBAA4D,CAACC;QACjEP,SACEZ,QAAQa,OAAO,CAACG;YACdA,MAAMG,UAAU,GAAGA;QACrB;IAEJ;IAEA,kDAAkD;IAClD,MAAMF,SAAShB,MAAM,CAAC,GAAGC,gBAAgBW,MAAMI,MAAM;IACrD,MAAME,aAAalB,MAAM,CAAC,GAAGM,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AEE,MAAM,CAACnB,KAAK,IAAIqB;oCAC3DtB,SACEZ,QAAQa,OAAO,CAACG;wCACdA,MAAMsB,GAAG,GAAGP;oCACd;gCAEJ;gCACAI,aAAaX;gCACbY,IAAI;oCAAEC,OAAO;gCAAO;;;sCAI1B,KAAC1C;4BACC+B,OAAM;4BACNC,uBACE,KAAC5B;gCACCc,OAAO;oCACL,GAAGO,OAAO;oCACVmB,IAAInB,SAASM,SAAS;gCACxB;gCACAc,SAAS/B;gCACTG,UAAU,CAAC6B,IAAIV;oCACbnB,SACEZ,QAAQa,OAAO,CAACG;wCACdA,MAAMI,OAAO,GAAGW,SAASW,GAAG;oCAC9B;gCAEJ;gCACAC,gBAAgB;;;;;;0BAM1B,KAACjD;0BACC,cAAA,KAACI;oBAAiBqB,YAAYA;oBAAYP,UAAUM;;;;;AAI5D"}
@@ -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 { HistogramChartOptions } from '../histogram-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 { HistogramChartOptions } from '../histogram-chart-model';
5
5
  export type HistogramChartPanelProps = PanelProps<HistogramChartOptions, TimeSeriesData>;
6
6
  export declare function HistogramChartPanel(props: HistogramChartPanelProps): ReactElement | null;
7
7
  //# sourceMappingURL=HistogramChartPanel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HistogramChartPanel.d.ts","sourceRoot":"","sources":["../../../src/components/HistogramChartPanel.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAsC,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAKrG,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,qBAAqB,EAAE,cAAc,CAAC,CAAC;AAEzF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,YAAY,GAAG,IAAI,CA2ExF"}
1
+ {"version":3,"file":"HistogramChartPanel.d.ts","sourceRoot":"","sources":["../../../src/components/HistogramChartPanel.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAOtE,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,qBAAqB,EAAE,cAAc,CAAC,CAAC;AAEzF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,YAAY,GAAG,IAAI,CA2ExF"}
@@ -11,12 +11,12 @@ 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, Stack, Typography } from '@mui/material';
15
- import merge from 'lodash/merge';
16
- import { useMemo } from 'react';
17
- import { useChartsTheme } from '@perses-dev/components';
18
- import { DEFAULT_FORMAT, DEFAULT_THRESHOLDS } from '../histogram-chart-model';
19
- import { HistogramChart } from './HistogramChart';
14
+ import { Box, Stack, Typography } from "@mui/material";
15
+ import { useChartsTheme } from "@perses-dev/components";
16
+ import merge from "lodash/merge";
17
+ import { useMemo } from "react";
18
+ import { DEFAULT_FORMAT, DEFAULT_THRESHOLDS } from "../histogram-chart-model.js";
19
+ import { HistogramChart } from "./HistogramChart.js";
20
20
  const HISTOGRAM_MIN_WIDTH = 90;
21
21
  export function HistogramChartPanel(props) {
22
22
  const { spec: pluginSpec, contentDimensions, queryResults } = props;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/HistogramChartPanel.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, Stack, Typography } from '@mui/material';\nimport { PanelProps } from '@perses-dev/plugin-system';\nimport merge from 'lodash/merge';\nimport { ReactElement, useMemo } from 'react';\nimport { useChartsTheme } from '@perses-dev/components';\nimport { TimeSeriesData } from '@perses-dev/spec';\nimport { DEFAULT_FORMAT, DEFAULT_THRESHOLDS, HistogramChartOptions } from '../histogram-chart-model';\nimport { HistogramChart, HistogramChartData } from './HistogramChart';\n\nconst HISTOGRAM_MIN_WIDTH = 90;\n\nexport type HistogramChartPanelProps = PanelProps<HistogramChartOptions, TimeSeriesData>;\n\nexport function HistogramChartPanel(props: HistogramChartPanelProps): ReactElement | null {\n const { spec: pluginSpec, contentDimensions, queryResults } = props;\n const { min, max } = pluginSpec;\n\n const chartsTheme = useChartsTheme();\n // ensures all default format properties set if undef\n const format = merge({}, DEFAULT_FORMAT, pluginSpec.format);\n const thresholds = merge({}, DEFAULT_THRESHOLDS, pluginSpec.thresholds);\n\n const histogramData: HistogramChartData[] = useMemo(() => {\n const histograms: HistogramChartData[] = [];\n\n for (const result of queryResults) {\n for (const timeSeries of result.data.series) {\n if (!timeSeries.histograms || timeSeries.histograms.length === 0) {\n continue;\n }\n\n const [, histoBuckets] = timeSeries.histograms[0]!;\n if (histoBuckets && histoBuckets.buckets) {\n histograms.push({ buckets: histoBuckets.buckets });\n }\n }\n }\n return histograms;\n }, [queryResults]);\n\n // no data message handled inside chart component\n if (histogramData.length === 0) {\n return (\n <Stack justifyContent=\"center\" height=\"100%\">\n <Typography variant=\"body2\" textAlign=\"center\">\n No data available (only native histograms are supported for now)\n </Typography>\n </Stack>\n );\n }\n\n if (contentDimensions === undefined) return null;\n\n // accounts for showing a separate chart for each time series\n let chartWidth = contentDimensions.width / histogramData.length - chartsTheme.container.padding.default;\n if (chartWidth < HISTOGRAM_MIN_WIDTH && histogramData.length > 1) {\n // enables horizontal scroll when charts overflow outside of panel\n chartWidth = HISTOGRAM_MIN_WIDTH;\n }\n\n return (\n <Stack\n direction=\"row\"\n justifyContent=\"center\"\n alignItems=\"center\"\n sx={{\n // so scrollbar only shows when necessary\n overflowX: histogramData.length > 1 ? 'scroll' : 'auto',\n }}\n >\n {histogramData.map((series, seriesIndex) => {\n return (\n <Box key={`histogram-series-${seriesIndex}`}>\n <HistogramChart\n width={chartWidth}\n height={contentDimensions.height}\n data={series}\n format={format}\n min={min}\n max={max}\n thresholds={thresholds}\n logBase={pluginSpec.logBase}\n />\n </Box>\n );\n })}\n </Stack>\n );\n}\n"],"names":["Box","Stack","Typography","merge","useMemo","useChartsTheme","DEFAULT_FORMAT","DEFAULT_THRESHOLDS","HistogramChart","HISTOGRAM_MIN_WIDTH","HistogramChartPanel","props","spec","pluginSpec","contentDimensions","queryResults","min","max","chartsTheme","format","thresholds","histogramData","histograms","result","timeSeries","data","series","length","histoBuckets","buckets","push","justifyContent","height","variant","textAlign","undefined","chartWidth","width","container","padding","default","direction","alignItems","sx","overflowX","map","seriesIndex","logBase"],"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,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AAEvD,OAAOC,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B,KAAK,GAAGhB,cAAcM,MAAM,GAAGT,YAAYoB,SAAS,CAACC,OAAO,CAACC,OAAO;IACvG,IAAIJ,aAAa3B,uBAAuBY,cAAcM,MAAM,GAAG,GAAG;QAChE,kEAAkE;QAClES,aAAa3B;IACf;IAEA,qBACE,KAACR;QACCwC,WAAU;QACVV,gBAAe;QACfW,YAAW;QACXC,IAAI;YACF,yCAAyC;YACzCC,WAAWvB,cAAcM,MAAM,GAAG,IAAI,WAAW;QACnD;kBAECN,cAAcwB,GAAG,CAAC,CAACnB,QAAQoB;YAC1B,qBACE,KAAC9C;0BACC,cAAA,KAACQ;oBACC6B,OAAOD;oBACPJ,QAAQlB,kBAAkBkB,MAAM;oBAChCP,MAAMC;oBACNP,QAAQA;oBACRH,KAAKA;oBACLC,KAAKA;oBACLG,YAAYA;oBACZ2B,SAASlC,WAAWkC,OAAO;;eATrB,CAAC,iBAAiB,EAAED,aAAa;QAa/C;;AAGN"}
1
+ {"version":3,"sources":["../../../src/components/HistogramChartPanel.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, Stack, Typography } from '@mui/material';\nimport { useChartsTheme } from '@perses-dev/components';\nimport type { PanelProps } from '@perses-dev/plugin-system';\nimport type { TimeSeriesData } from '@perses-dev/spec';\nimport merge from 'lodash/merge';\nimport type { ReactElement } from 'react';\nimport { useMemo } from 'react';\n\nimport type { HistogramChartOptions } from '../histogram-chart-model';\nimport { DEFAULT_FORMAT, DEFAULT_THRESHOLDS } from '../histogram-chart-model';\nimport type { HistogramChartData } from './HistogramChart';\nimport { HistogramChart } from './HistogramChart';\n\nconst HISTOGRAM_MIN_WIDTH = 90;\n\nexport type HistogramChartPanelProps = PanelProps<HistogramChartOptions, TimeSeriesData>;\n\nexport function HistogramChartPanel(props: HistogramChartPanelProps): ReactElement | null {\n const { spec: pluginSpec, contentDimensions, queryResults } = props;\n const { min, max } = pluginSpec;\n\n const chartsTheme = useChartsTheme();\n // ensures all default format properties set if undef\n const format = merge({}, DEFAULT_FORMAT, pluginSpec.format);\n const thresholds = merge({}, DEFAULT_THRESHOLDS, pluginSpec.thresholds);\n\n const histogramData: HistogramChartData[] = useMemo(() => {\n const histograms: HistogramChartData[] = [];\n\n for (const result of queryResults) {\n for (const timeSeries of result.data.series) {\n if (!timeSeries.histograms || timeSeries.histograms.length === 0) {\n continue;\n }\n\n const [, histoBuckets] = timeSeries.histograms[0]!;\n if (histoBuckets && histoBuckets.buckets) {\n histograms.push({ buckets: histoBuckets.buckets });\n }\n }\n }\n return histograms;\n }, [queryResults]);\n\n // no data message handled inside chart component\n if (histogramData.length === 0) {\n return (\n <Stack justifyContent=\"center\" height=\"100%\">\n <Typography variant=\"body2\" textAlign=\"center\">\n No data available (only native histograms are supported for now)\n </Typography>\n </Stack>\n );\n }\n\n if (contentDimensions === undefined) return null;\n\n // accounts for showing a separate chart for each time series\n let chartWidth = contentDimensions.width / histogramData.length - chartsTheme.container.padding.default;\n if (chartWidth < HISTOGRAM_MIN_WIDTH && histogramData.length > 1) {\n // enables horizontal scroll when charts overflow outside of panel\n chartWidth = HISTOGRAM_MIN_WIDTH;\n }\n\n return (\n <Stack\n direction=\"row\"\n justifyContent=\"center\"\n alignItems=\"center\"\n sx={{\n // so scrollbar only shows when necessary\n overflowX: histogramData.length > 1 ? 'scroll' : 'auto',\n }}\n >\n {histogramData.map((series, seriesIndex) => {\n return (\n <Box key={`histogram-series-${seriesIndex}`}>\n <HistogramChart\n width={chartWidth}\n height={contentDimensions.height}\n data={series}\n format={format}\n min={min}\n max={max}\n thresholds={thresholds}\n logBase={pluginSpec.logBase}\n />\n </Box>\n );\n })}\n </Stack>\n );\n}\n"],"names":["Box","Stack","Typography","useChartsTheme","merge","useMemo","DEFAULT_FORMAT","DEFAULT_THRESHOLDS","HistogramChart","HISTOGRAM_MIN_WIDTH","HistogramChartPanel","props","spec","pluginSpec","contentDimensions","queryResults","min","max","chartsTheme","format","thresholds","histogramData","histograms","result","timeSeries","data","series","length","histoBuckets","buckets","push","justifyContent","height","variant","textAlign","undefined","chartWidth","width","container","padding","default","direction","alignItems","sx","overflowX","map","seriesIndex","logBase"],"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,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AACvD,SAASC,cAAc,QAAQ,yBAAyB;AAGxD,OAAOC,WAAW,eAAe;AAEjC,SAASC,OAAO,QAAQ,QAAQ;AAGhC,SAASC,cAAc,EAAEC,kBAAkB,QAAQ,8BAA2B;AAE9E,SAASC,cAAc,QAAQ,sBAAmB;AAElD,MAAMC,sBAAsB;AAI5B,OAAO,SAASC,oBAAoBC,KAA+B;IACjE,MAAM,EAAEC,MAAMC,UAAU,EAAEC,iBAAiB,EAAEC,YAAY,EAAE,GAAGJ;IAC9D,MAAM,EAAEK,GAAG,EAAEC,GAAG,EAAE,GAAGJ;IAErB,MAAMK,cAAcf;IACpB,qDAAqD;IACrD,MAAMgB,SAASf,MAAM,CAAC,GAAGE,gBAAgBO,WAAWM,MAAM;IAC1D,MAAMC,aAAahB,MAAM,CAAC,GAAGG,oBAAoBM,WAAWO,UAAU;IAEtE,MAAMC,gBAAsChB,QAAQ;QAClD,MAAMiB,aAAmC,EAAE;QAE3C,KAAK,MAAMC,UAAUR,aAAc;YACjC,KAAK,MAAMS,cAAcD,OAAOE,IAAI,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Y 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 './HistogramChartOptionsEditorSettings';
14
- export * from './HistogramChartPanel';
15
- export * from './HistogramChart';
13
+ export * from "./HistogramChartOptionsEditorSettings.js";
14
+ export * from "./HistogramChartPanel.js";
15
+ export * from "./HistogramChart.js";
16
16
 
17
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/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 './HistogramChartOptionsEditorSettings';\nexport * from './HistogramChartPanel';\nexport * from './HistogramChart';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,wCAAwC;AACtD,cAAc,wBAAwB;AACtC,cAAc,mBAAmB"}
1
+ {"version":3,"sources":["../../../src/components/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 './HistogramChartOptionsEditorSettings';\nexport * from './HistogramChartPanel';\nexport * from './HistogramChart';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,2CAAwC;AACtD,cAAc,2BAAwB;AACtC,cAAc,sBAAmB"}
@@ -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"}
@@ -1,6 +1,6 @@
1
- import { FormatOptions, ThresholdOptions } from '@perses-dev/components';
2
- import { 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 { 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_THRESHOLDS: ThresholdOptions;
6
6
  export declare const DEFAULT_MIN_PERCENT = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"histogram-chart-model.d.ts","sourceRoot":"","sources":["../../src/histogram-chart-model.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,eAAO,MAAM,cAAc,EAAE,a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;AAEnD,eAAO,MAAM,cAAc,EAAE,aAAmC,CAAC;AACjE,eAAO,MAAM,kBAAkB,EAAE,gBAA8C,CAAC;AAChF,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,mBAAmB,MAAM,CAAC;AACvC,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAC7C,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAG7C,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,CAAC,GAAG,EAAE,CAAC;AAE1C,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,QAAQ,CAAA;CAAE,CAI5E,CAAC;AAGF,eAAO,MAAM,gBAAgB;WAPyB,MAAM;SAAO,QAAQ;QAQ/D,MAAM;GAEf,CAAC;AAEJ;;GAEG;AACH,MAAM,WAAW,wBAAyB,SAAQ,UAAU,CAAC,qBAAqB,CAAC;IACjF,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,OAAO,CAAC,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,MAAM,gCAAgC,GAAG,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;AAEzF;;GAEG;AACH,wBAAgB,kCAAkC,IAAI,qBAAqB,CAI1E"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/histogram-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 { OptionsEditorProps } from '@perses-dev/plugin-system';\nimport { Definition } from '@perses-dev/spec';\n\nexport const DEFAULT_FORMAT: FormatOptions = { unit: 'decimal' };\nexport const DEFAULT_THRESHOLDS: ThresholdOptions = { defaultColor: '#56b4e9' };\nexport const DEFAULT_MIN_PERCENT = 0;\nexport const DEFAULT_MAX_PERCENT = 100;\nexport const DEFAULT_MIN_PERCENT_DECIMAL = 0;\nexport const DEFAULT_MAX_PERCENT_DECIMAL = 1;\n\n// LogBase outlines the allowed log bases for the histogram x-axis.\nexport type LOG_BASE = undefined | 2 | 10;\n\nexport const LOG_BASE_CONFIG: Record<string, { label: string; log: LOG_BASE }> = {\n none: { label: 'None', log: undefined },\n '2': { label: '2', log: 2 },\n '10': { label: '10', log: 10 },\n};\n\n// Options array for SettingsAutocomplete\nexport const LOG_BASE_OPTIONS = Object.entries(LOG_BASE_CONFIG).map(([id, config]) => ({\n id: id as string,\n ...config,\n}));\n\n/**\n * The schema for a HistogramChart panel.\n */\nexport interface HistogramChartDefinition extends Definition<HistogramChartOptions> {\n kind: 'HistogramChart';\n}\n\n/**\n * The Options object type supported by the HistogramChart panel plugin.\n */\nexport interface HistogramChartOptions {\n format?: FormatOptions;\n min?: number;\n max?: number;\n thresholds?: ThresholdOptions;\n logBase?: LOG_BASE;\n}\n\nexport type HistogramChartOptionsEditorProps = OptionsEditorProps<HistogramChartOptions>;\n\n/**\n * Creates the initial/empty options for a HistogramChart panel.\n */\nexport function createInitialHistogramChartOptions(): HistogramChartOptions {\n return {\n format: DEFAULT_FORMAT,\n };\n}\n"],"names":["DEFAULT_FORMAT","unit","DEFAULT_THRESHOLDS","defaultColor","DEFAULT_MIN_PERCENT","DEFAULT_MAX_PERCENT","DEFAULT_MIN_PERCENT_DECIMAL","DEFAULT_MAX_PERCENT_DECIMAL","LOG_BASE_CONFIG","none","label","log","undefined","LOG_BASE_OPTIONS","Object","entries","map","id","config","createInitialHistogramChartOptions","format"],"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;AAAU,EAAE;AACjE,OAAO,MAAMC,qBAAuC;IAAEC,cAAc;AAAU,EAAE;AAChF,OAAO,MAAMC,sBAAsB,EAAE;AACrC,OAAO,MAAMC,sBAAsB,IAAI;AACvC,OAAO,MAAMC,8BAA8B,EAAE;AAC7C,OAAO,MAAMC,8BAA8B,EAAE;AAK7C,OAAO,MAAMC,kBAAoE;IAC/EC,MAAM;QAAEC,OAAO;QAAQC,KAAKC;IAAU;IACtC,KAAK;QAAEF,OAAO;QAAKC,KAAK;IAAE;IAC1B,MAAM;QAAED,OAAO;QAAMC,KAAK;IAAG;AAC/B,EAAE;AAEF,yCAAyC;AACzC,OAAO,MAAME,mBAAmBC,OAAOC,OAAO,CAACP,iBAAiBQ,GAAG,CAAC,CAAC,CAACC,IAAIC,OAAO,GAAM,CAAA;QACrFD,IAAIA;QACJ,GAAGC,MAAM;IACX,CAAA,GAAI;AAsBJ;;CAEC,GACD,OAAO,SAASC;IACd,OAAO;QACLC,QAAQpB;IACV;AACF"}
1
+ {"version":3,"sources":["../../src/histogram-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 { OptionsEditorProps } from '@perses-dev/plugin-system';\nimport type { Definition } from '@perses-dev/spec';\n\nexport const DEFAULT_FORMAT: FormatOptions = { unit: 'decimal' };\nexport const DEFAULT_THRESHOLDS: ThresholdOptions = { defaultColor: '#56b4e9' };\nexport const DEFAULT_MIN_PERCENT = 0;\nexport const DEFAULT_MAX_PERCENT = 100;\nexport const DEFAULT_MIN_PERCENT_DECIMAL = 0;\nexport const DEFAULT_MAX_PERCENT_DECIMAL = 1;\n\n// LogBase outlines the allowed log bases for the histogram x-axis.\nexport type LOG_BASE = undefined | 2 | 10;\n\nexport const LOG_BASE_CONFIG: Record<string, { label: string; log: LOG_BASE }> = {\n none: { label: 'None', log: undefined },\n '2': { label: '2', log: 2 },\n '10': { label: '10', log: 10 },\n};\n\n// Options array for SettingsAutocomplete\nexport const LOG_BASE_OPTIONS = Object.entries(LOG_BASE_CONFIG).map(([id, config]) => ({\n id: id as string,\n ...config,\n}));\n\n/**\n * The schema for a HistogramChart panel.\n */\nexport interface HistogramChartDefinition extends Definition<HistogramChartOptions> {\n kind: 'HistogramChart';\n}\n\n/**\n * The Options object type supported by the HistogramChart panel plugin.\n */\nexport interface HistogramChartOptions {\n format?: FormatOptions;\n min?: number;\n max?: number;\n thresholds?: ThresholdOptions;\n logBase?: LOG_BASE;\n}\n\nexport type HistogramChartOptionsEditorProps = OptionsEditorProps<HistogramChartOptions>;\n\n/**\n * Creates the initial/empty options for a HistogramChart panel.\n */\nexport function createInitialHistogramChartOptions(): HistogramChartOptions {\n return {\n format: DEFAULT_FORMAT,\n };\n}\n"],"names":["DEFAULT_FORMAT","unit","DEFAULT_THRESHOLDS","defaultColor","DEFAULT_MIN_PERCENT","DEFAULT_MAX_PERCENT","DEFAULT_MIN_PERCENT_DECIMAL","DEFAULT_MAX_PERCENT_DECIMAL","LOG_BASE_CONFIG","none","label","log","undefined","LOG_BASE_OPTIONS","Object","entries","map","id","config","createInitialHistogramChartOptions","format"],"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;AAAU,EAAE;AACjE,OAAO,MAAMC,qBAAuC;IAAEC,cAAc;AAAU,EAAE;AAChF,OAAO,MAAMC,sBAAsB,EAAE;AACrC,OAAO,MAAMC,sBAAsB,IAAI;AACvC,OAAO,MAAMC,8BAA8B,EAAE;AAC7C,OAAO,MAAMC,8BAA8B,EAAE;AAK7C,OAAO,MAAMC,kBAAoE;IAC/EC,MAAM;QAAEC,OAAO;QAAQC,KAAKC;IAAU;IACtC,KAAK;QAAEF,OAAO;QAAKC,KAAK;IAAE;IAC1B,MAAM;QAAED,OAAO;QAAMC,KAAK;IAAG;AAC/B,EAAE;AAEF,yCAAyC;AACzC,OAAO,MAAME,mBAAmBC,OAAOC,OAAO,CAACP,iBAAiBQ,GAAG,CAAC,CAAC,CAACC,IAAIC,OAAO,GAAM,CAAA;QACrFD,IAAIA;QACJ,GAAGC,MAAM;IACX,CAAA,GAAI;AAsBJ;;CAEC,GACD,OAAO,SAASC;IACd,OAAO;QACLC,QAAQpB;IACV;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,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
- export { getPluginModule } from './getPluginModule';
14
- export { HistogramChartPanel } from './components';
15
- export * from './histogram-chart-model';
16
- export * from './HistogramChart';
13
+ export { getPluginModule } from "./getPluginModule.js";
14
+ export { HistogramChartPanel } from "./components/index.js";
15
+ export * from "./histogram-chart-model.js";
16
+ export * from "./HistogramChart.js";
17
17
 
18
18
  //# 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 { getPluginModule } from './getPluginModule';\nexport { HistogramChartPanel } from './components';\nexport * from './histogram-chart-model';\nexport * from './HistogramChart';\n"],"names":["getPluginModule","HistogramChartPanel"],"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,eAAe,QAAQ,oBAAoB;AACpD,SAASC,mBAAmB,QAAQ,eAAe;AACnD,cAAc,0BAA0B;AACxC,cAAc,mBAAmB"}
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 { getPluginModule } from './getPluginModule';\nexport { HistogramChartPanel } from './components';\nexport * from './histogram-chart-model';\nexport * from './HistogramChart';\n"],"names":["getPluginModule","HistogramChartPanel"],"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,eAAe,QAAQ,uBAAoB;AACpD,SAASC,mBAAmB,QAAQ,wBAAe;AACnD,cAAc,6BAA0B;AACxC,cAAc,sBAAmB"}
@@ -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"}
@@ -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
- export * from './thresholds';
13
+ export * from "./thresholds.js";
14
14
 
15
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './thresholds';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,eAAe"}
1
+ {"version":3,"sources":["../../../src/utils/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './thresholds';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,kBAAe"}
@@ -1,3 +1,3 @@
1
- import { PersesChartsTheme, ThresholdOptions } from '@perses-dev/components';
1
+ import type { PersesChartsTheme, ThresholdOptions } from '@perses-dev/components';
2
2
  export declare function getColorFromThresholds(value: number, thresholds: ThresholdOptions | undefined, chartsTheme: PersesChartsTheme, defaultColor: string): string | null;
3
3
  //# sourceMappingURL=thresholds.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"thresholds.d.ts","sourceRoot":"","sources":["../../../src/utils/thresholds.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE7E,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,gBAAgB,GAAG,SAAS,EACxC,WAAW,EAAE,iBAAiB,EAC9B,YAAY,EAAE,MAAM,GACnB,MAAM,GAAG,IAAI,CAcf"}
1
+ {"version":3,"file":"thresholds.d.ts","sourceRoot":"","sources":["../../../src/utils/thresholds.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAElF,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,gBAAgB,GAAG,SAAS,EACxC,WAAW,EAAE,iBAAiB,EAC9B,YAAY,EAAE,MAAM,GACnB,MAAM,GAAG,IAAI,CAcf"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/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 { PersesChartsTheme, ThresholdOptions } from '@perses-dev/components';\n\nexport function getColorFromThresholds(\n value: number,\n thresholds: ThresholdOptions | undefined,\n chartsTheme: PersesChartsTheme,\n defaultColor: string\n): string | null {\n if (thresholds?.steps) {\n const matchingColors = thresholds.steps\n .map((step, index) => {\n if (value >= step.value) {\n return step.color ?? chartsTheme.thresholds.palette[index] ?? thresholds.defaultColor ?? defaultColor;\n }\n return null;\n })\n .filter((color): color is string => color !== null);\n\n return matchingColors[matchingColors.length - 1] ?? thresholds.defaultColor ?? defaultColor;\n }\n return thresholds?.defaultColor ?? defaultColor;\n}\n"],"names":["getColorFromThresholds","value","thresholds","chartsTheme","defaultColor","steps","matchingColors","map","step","index","color","palette","filter","length"],"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,OAAO,SAASA,uBACdC,KAAa,EACbC,UAAwC,EACxCC,WAA8B,EAC9BC,YAAoB;IAEpB,IAAIF,YAAYG,OAAO;QACrB,MAAMC,iBAAiBJ,WAAWG,KAAK,CACpCE,GAAG,CAAC,CAACC,MAAMC;YACV,IAAIR,SAASO,KAAKP,KAAK,EAAE;gBACvB,OAAOO,KAAKE,KAAK,IAAIP,YAAYD,UAAU,CAACS,OAAO,CAACF,MAAM,IAAIP,WAAWE,YAAY,IAAIA;YAC3F;YACA,OAAO;QACT,GACCQ,MAAM,CAAC,CAACF,QAA2BA,UAAU;QAEhD,OAAOJ,cAAc,CAACA,eAAeO,MAAM,GAAG,EAAE,IAAIX,WAAWE,YAAY,IAAIA;IACjF;IACA,OAAOF,YAAYE,gBAAgBA;AACrC"}
1
+ {"version":3,"sources":["../../../src/utils/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 type { PersesChartsTheme, ThresholdOptions } from '@perses-dev/components';\n\nexport function getColorFromThresholds(\n value: number,\n thresholds: ThresholdOptions | undefined,\n chartsTheme: PersesChartsTheme,\n defaultColor: string,\n): string | null {\n if (thresholds?.steps) {\n const matchingColors = thresholds.steps\n .map((step, index) => {\n if (value >= step.value) {\n return step.color ?? chartsTheme.thresholds.palette[index] ?? thresholds.defaultColor ?? defaultColor;\n }\n return null;\n })\n .filter((color): color is string => color !== null);\n\n return matchingColors[matchingColors.length - 1] ?? thresholds.defaultColor ?? defaultColor;\n }\n return thresholds?.defaultColor ?? defaultColor;\n}\n"],"names":["getColorFromThresholds","value","thresholds","chartsTheme","defaultColor","steps","matchingColors","map","step","index","color","palette","filter","length"],"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,OAAO,SAASA,uBACdC,KAAa,EACbC,UAAwC,EACxCC,WAA8B,EAC9BC,YAAoB;IAEpB,IAAIF,YAAYG,OAAO;QACrB,MAAMC,iBAAiBJ,WAAWG,KAAK,CACpCE,GAAG,CAAC,CAACC,MAAMC;YACV,IAAIR,SAASO,KAAKP,KAAK,EAAE;gBACvB,OAAOO,KAAKE,KAAK,IAAIP,YAAYD,UAAU,CAACS,OAAO,CAACF,MAAM,IAAIP,WAAWE,YAAY,IAAIA;YAC3F;YACA,OAAO;QACT,GACCQ,MAAM,CAAC,CAACF,QAA2BA,UAAU;QAEhD,OAAOJ,cAAc,CAACA,eAAeO,MAAM,GAAG,EAAE,IAAIX,WAAWE,YAAY,IAAIA;IACjF;IACA,OAAOF,YAAYE,gBAAgBA;AACrC"}